zelong.shao

D类提交如果有不存在的用户用customs

2023年9月6日10:02:40
szl
...@@ -234,7 +234,12 @@ public class ChmConsignmentService { ...@@ -234,7 +234,12 @@ public class ChmConsignmentService {
234 //推送时间作为创建时间,可以用来校验数据的有序性,如果新的推送时间小于已有的创建时间,就不更新数据 234 //推送时间作为创建时间,可以用来校验数据的有序性,如果新的推送时间小于已有的创建时间,就不更新数据
235 result.setCreateTime(new Date()); 235 result.setCreateTime(new Date());
236 result.setUpdateTime(new Date()); 236 result.setUpdateTime(new Date());
237 - result.setCreator(creator); 237 + SysUser sysUser = sysUserRepository.findUserByLoginName(creator);
238 + if (sysUser == null){
239 + sysUser = sysUserRepository.findUserByLoginName("CUSTOMS");
240 + }
241 + result.setCreatorId(sysUser);
242 + result.setCreator(sysUser.getUserName());
238 243
239 }catch (Exception e){ 244 }catch (Exception e){
240 result=null; 245 result=null;
...@@ -296,8 +301,11 @@ public class ChmConsignmentService { ...@@ -296,8 +301,11 @@ public class ChmConsignmentService {
296 result.setCreateTime(new Date()); 301 result.setCreateTime(new Date());
297 result.setUpdateTime(pushTime); 302 result.setUpdateTime(pushTime);
298 SysUser sysUser = sysUserRepository.findUserByLoginName(creator); 303 SysUser sysUser = sysUserRepository.findUserByLoginName(creator);
304 + if (sysUser == null){
305 + sysUser = sysUserRepository.findUserByLoginName("CUSTOMS");
306 + }
299 result.setCreatorId(sysUser); 307 result.setCreatorId(sysUser);
300 - result.setCreator(sysUser.getLoginName()); 308 + result.setCreator(sysUser.getUserName());
301 }catch (Exception e){ 309 }catch (Exception e){
302 result=null; 310 result=null;
303 311
...@@ -527,7 +535,8 @@ public class ChmConsignmentService { ...@@ -527,7 +535,8 @@ public class ChmConsignmentService {
527 //2、校验 7天+运单 ,如果有数据并且 还未报关就更新,如果数据就插入 535 //2、校验 7天+运单 ,如果有数据并且 还未报关就更新,如果数据就插入
528 ChmConsignment chmConsignmentDB = null; 536 ChmConsignment chmConsignmentDB = null;
529 // ChmConsignment chmConsignmentDB=this.findChmConsignmentByConsignmentCode(chmConsignment.getConsignmentCode(), DateUtils.addDate(DateUtils.getCurrentDate(),-7)); 537 // ChmConsignment chmConsignmentDB=this.findChmConsignmentByConsignmentCode(chmConsignment.getConsignmentCode(), DateUtils.addDate(DateUtils.getCurrentDate(),-7));
530 - List<ChmConsignment> chmConsignmentDBs=this.findChmConsignmentByConsignmentCodes(chmConsignment.getConsignmentCode(), DateUtils.addDate(DateUtils.getCurrentDate(),-7),creator); 538 + SysUser sysUser = sysUserRepository.findUserByLoginName(creator);
539 + List<ChmConsignment> chmConsignmentDBs=this.findChmConsignmentByConsignmentCodes(chmConsignment.getConsignmentCode(), DateUtils.addDate(DateUtils.getCurrentDate(),-7),sysUser.getUserName());
531 List<ChmConsignment> newChmConsignments = new ArrayList<ChmConsignment>(); 540 List<ChmConsignment> newChmConsignments = new ArrayList<ChmConsignment>();
532 for (ChmConsignment chmConsignments : chmConsignmentDBs) { 541 for (ChmConsignment chmConsignments : chmConsignmentDBs) {
533 //如果有该用户曾经提交过得,运单状态为预审不通过或者中心审核已通过并且没有dm004的优先覆盖 542 //如果有该用户曾经提交过得,运单状态为预审不通过或者中心审核已通过并且没有dm004的优先覆盖
...@@ -547,7 +556,6 @@ public class ChmConsignmentService { ...@@ -547,7 +556,6 @@ public class ChmConsignmentService {
547 } 556 }
548 557
549 //获取用户账号信息 558 //获取用户账号信息
550 - SysUser sysUser = sysUserRepository.findUserByLoginName(creator);
551 if (sysUser == null){ 559 if (sysUser == null){
552 sysUser = sysUserRepository.findUserByLoginName("CUSTOMS"); 560 sysUser = sysUserRepository.findUserByLoginName("CUSTOMS");
553 } 561 }
...@@ -673,7 +681,8 @@ public class ChmConsignmentService { ...@@ -673,7 +681,8 @@ public class ChmConsignmentService {
673 chmConsignment.setChmConsignmentDetailList(chmConsignmentDetailList); 681 chmConsignment.setChmConsignmentDetailList(chmConsignmentDetailList);
674 ChmConsignment chmConsignmentDB = null; 682 ChmConsignment chmConsignmentDB = null;
675 //2、校验 7天+运单 ,如果有数据并且 还未报关就更新,如果数据就插入 683 //2、校验 7天+运单 ,如果有数据并且 还未报关就更新,如果数据就插入
676 - List<ChmConsignment> chmConsignments = this.findChmConsignmentByConsignmentCodes(chmConsignment.getConsignmentCode(), DateUtils.addDate(DateUtils.getCurrentDate(),-7),creator); 684 + SysUser sysUser = sysUserRepository.findUserByLoginName(creator);
685 + List<ChmConsignment> chmConsignments = this.findChmConsignmentByConsignmentCodes(chmConsignment.getConsignmentCode(), DateUtils.addDate(DateUtils.getCurrentDate(),-7),sysUser.getUserName());
677 //如果没有C类待申报,从list中拿时间最晚的一条去覆盖 686 //如果没有C类待申报,从list中拿时间最晚的一条去覆盖
678 List<ChmConsignment> newChmConsignments = new ArrayList<ChmConsignment>(); 687 List<ChmConsignment> newChmConsignments = new ArrayList<ChmConsignment>();
679 for (ChmConsignment consignment : chmConsignments) { 688 for (ChmConsignment consignment : chmConsignments) {
......