修改时间转换失败

release
zhenghaiyang@ele-cloud.com 2 years ago
parent 871b0ed7e6
commit 735518e926
  1. 86
      dxhy-erp/src/main/java/com/dxhy/erp/service/impl/InvoiceAuthServiceImpl.java

@ -10,6 +10,7 @@ import com.dxhy.common.datasource.config.DynamicContextHolder;
import com.dxhy.common.enums.FplxEnum; import com.dxhy.common.enums.FplxEnum;
import com.dxhy.common.enums.ReturnCodeEnum; import com.dxhy.common.enums.ReturnCodeEnum;
import com.dxhy.common.service.impl.MpBaseServiceImpl; import com.dxhy.common.service.impl.MpBaseServiceImpl;
import com.dxhy.common.util.DateOrderUtil;
import com.dxhy.common.util.StringHelper; import com.dxhy.common.util.StringHelper;
import com.dxhy.common.util.pojo.Authorize; import com.dxhy.common.util.pojo.Authorize;
import com.dxhy.common.util.pojo.GlobalInfo; import com.dxhy.common.util.pojo.GlobalInfo;
@ -20,8 +21,11 @@ import com.dxhy.erp.model.auth.InterfaceCode;
import com.dxhy.erp.service.InvoiceAuthService; import com.dxhy.erp.service.InvoiceAuthService;
import com.dxhy.erp.service.TDxInvoiceReimburseService; import com.dxhy.erp.service.TDxInvoiceReimburseService;
import com.dxhy.erp.utils.CheckUtils; import com.dxhy.erp.utils.CheckUtils;
import com.dxhy.erp.utils.DateUtil;
import com.google.common.collect.Maps;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
import org.joda.time.DateTime;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.annotation.Resource; import javax.annotation.Resource;
@ -386,20 +390,7 @@ public class InvoiceAuthServiceImpl extends MpBaseServiceImpl<RecordInvoiceDao,
if(fplxList.contains(zdata1.getZFPLX()) && !"X".equalsIgnoreCase(xxbs)){ if(fplxList.contains(zdata1.getZFPLX()) && !"X".equalsIgnoreCase(xxbs)){
TdxRecordInvoice recordInvoiceByUuid = tDxrecordInvoiceDao.getRecordInvoiceByUuid(uuid); TdxRecordInvoice recordInvoiceByUuid = tDxrecordInvoiceDao.getRecordInvoiceByUuid(uuid);
if(recordInvoiceByUuid!=null){ if(recordInvoiceByUuid!=null){
UpdateWrapper updateWrapper = new UpdateWrapper(); UpdateWrapper updateWrapper = convertRecordInvoice(zdata1,uuid);
updateWrapper.eq("uuid",uuid);
//凭证号
updateWrapper.set("sn_voucher_number",zdata1.getBELNR());
//凭证过账日期
updateWrapper.set("posting_time",zdata1.getBUDAT());
//账期
updateWrapper.set("account_period",zdata1.getBUDAT().substring(0,7));
//报账单号
updateWrapper.set("bzdh",zdata1.getZBZDH());
//入账状态
updateWrapper.set("inaccount_status",zdata1.getZYWZT());
updateWrapper.set("comp_code",zdata1.getZGSDM());
updateWrapper.set("bzr",zdata1.getZJBRT());
DynamicContextHolder.push("business"+DbConstant.BUSINESS_WRITE); DynamicContextHolder.push("business"+DbConstant.BUSINESS_WRITE);
int update = tDxrecordInvoiceDao.update(null, updateWrapper); int update = tDxrecordInvoiceDao.update(null, updateWrapper);
if(update>0){ if(update>0){
@ -422,34 +413,13 @@ public class InvoiceAuthServiceImpl extends MpBaseServiceImpl<RecordInvoiceDao,
} }
} }
}else { }else {
UpdateWrapper updateWrapper = new UpdateWrapper(); UpdateWrapper updateWrapper = convertRecordInvoice(zdata1,uuid);
updateWrapper.eq("uuid",uuid);
//凭证号
updateWrapper.set("sn_voucher_number",zdata1.getBELNR());
//凭证过账日期
updateWrapper.set("posting_time",zdata1.getBUDAT());
//账期
updateWrapper.set("account_period",zdata1.getBUDAT().substring(0,7));
//报账单号
updateWrapper.set("bzdh",zdata1.getZBZDH());
//入账状态
updateWrapper.set("inaccount_status",zdata1.getZYWZT());
updateWrapper.set("comp_code",zdata1.getZGSDM());
updateWrapper.set("bzr",zdata1.getZJBRT());
DynamicContextHolder.push("business"+DbConstant.BUSINESS_WRITE); DynamicContextHolder.push("business"+DbConstant.BUSINESS_WRITE);
tDxInvoiceReimburseService.getBaseMapper().update(null,updateWrapper); tDxInvoiceReimburseService.getBaseMapper().update(null,updateWrapper);
} }
if ("X".equalsIgnoreCase(xxbs)){ if ("X".equalsIgnoreCase(xxbs)){
DynamicContextHolder.push("business"+DbConstant.BUSINESS_WRITE); DynamicContextHolder.push("business"+DbConstant.BUSINESS_WRITE);
UpdateWrapper updateWrapper = new UpdateWrapper(); UpdateWrapper updateWrapper = convertRecordInvoice(zdata1,uuid);
updateWrapper.set("sn_voucher_number",zdata1.getBELNR());
updateWrapper.set("posting_time",zdata1.getBUDAT());
updateWrapper.set("account_period",zdata1.getBUDAT().substring(0,7));
updateWrapper.set("bzdh",zdata1.getZBZDH());
updateWrapper.set("inaccount_status",zdata1.getZYWZT());
updateWrapper.set("comp_code",zdata1.getZGSDM());
updateWrapper.set("bzr",zdata1.getZJBRT());
updateWrapper.eq("uuid",uuid);
tdxSaleRecordInvoiceDao.update(null,updateWrapper); tdxSaleRecordInvoiceDao.update(null,updateWrapper);
} }
@ -464,6 +434,25 @@ public class InvoiceAuthServiceImpl extends MpBaseServiceImpl<RecordInvoiceDao,
return es; return es;
} }
public UpdateWrapper convertRecordInvoice(ZDATA zdata,String uuid){
UpdateWrapper updateWrapper = new UpdateWrapper();
updateWrapper.set("sn_voucher_number",zdata.getBELNR());
try {
DateTime parse = DateTime.parse(zdata.getBUDAT());
updateWrapper.set("posting_time",zdata.getBUDAT());
//账期
updateWrapper.set("account_period",zdata.getBUDAT().substring(0,7));
} catch (Exception e) {
log.error("时间转换异常:{}",e);
}
updateWrapper.set("bzdh",zdata.getZBZDH());
updateWrapper.set("inaccount_status",zdata.getZYWZT());
updateWrapper.set("comp_code",zdata.getZGSDM());
updateWrapper.set("bzr",zdata.getZJBRT());
updateWrapper.eq("uuid",uuid);
return updateWrapper;
}
public ReturnStateInfo getCheckData(List<Map<String, Object>> authStateList, Integer contentRows) { public ReturnStateInfo getCheckData(List<Map<String, Object>> authStateList, Integer contentRows) {
ReturnStateInfo run = new ReturnStateInfo(); ReturnStateInfo run = new ReturnStateInfo();
if (contentRows == null || authStateList.size() != contentRows) { if (contentRows == null || authStateList.size() != contentRows) {
@ -537,9 +526,26 @@ public class InvoiceAuthServiceImpl extends MpBaseServiceImpl<RecordInvoiceDao,
} }
public static void main(String[] args) { public static void main(String[] args) {
String d="2023";
String substring = d.substring(0, 7); Date date = DateUtil.strToDate("0000-00-00");
System.out.println(substring); DateTime parse1 = DateTime.parse("2012-12-01");
Date date11 = parse1.toDate();
HashMap<Object, Object> map = Maps.newHashMap();
map.put("1","3");
try {
DateTime parse = DateTime.parse("0000-00-00");
map.put("2","3");
Date date1 = parse.toDate();
String s = parse.toString("yyyy-MM-dd ");
System.out.println("");
} catch (Exception e) {
// throw new RuntimeException(e);
}
map.put("3","3");
System.out.println();
// String d="2023";
// String substring = d.substring(0, 7);
// System.out.println(substring);
} }

Loading…
Cancel
Save