zelong.shao

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

2023年9月7日15:43:14
   szl
...@@ -236,10 +236,11 @@ public class ChmConsignmentService { ...@@ -236,10 +236,11 @@ public class ChmConsignmentService {
236 result.setUpdateTime(new Date()); 236 result.setUpdateTime(new Date());
237 SysUser sysUser = sysUserRepository.findUserByLoginName(creator); 237 SysUser sysUser = sysUserRepository.findUserByLoginName(creator);
238 if (sysUser == null){ 238 if (sysUser == null){
239 - sysUser = sysUserRepository.findUserByLoginName("CUSTOMS"); 239 + result.setCreator(creator);
240 + }else {
241 + result.setCreatorId(sysUser);
242 + result.setCreator(sysUser.getUserName());
240 } 243 }
241 - result.setCreatorId(sysUser);
242 - result.setCreator(sysUser.getUserName());
243 244
244 }catch (Exception e){ 245 }catch (Exception e){
245 result=null; 246 result=null;
...@@ -302,10 +303,11 @@ public class ChmConsignmentService { ...@@ -302,10 +303,11 @@ public class ChmConsignmentService {
302 result.setUpdateTime(pushTime); 303 result.setUpdateTime(pushTime);
303 SysUser sysUser = sysUserRepository.findUserByLoginName(creator); 304 SysUser sysUser = sysUserRepository.findUserByLoginName(creator);
304 if (sysUser == null){ 305 if (sysUser == null){
305 - sysUser = sysUserRepository.findUserByLoginName("CUSTOMS"); 306 + result.setCreator(creator);
307 + }else {
308 + result.setCreatorId(sysUser);
309 + result.setCreator(sysUser.getUserName());
306 } 310 }
307 - result.setCreatorId(sysUser);
308 - result.setCreator(sysUser.getUserName());
309 }catch (Exception e){ 311 }catch (Exception e){
310 result=null; 312 result=null;
311 313
...@@ -536,7 +538,15 @@ public class ChmConsignmentService { ...@@ -536,7 +538,15 @@ public class ChmConsignmentService {
536 ChmConsignment chmConsignmentDB = null; 538 ChmConsignment chmConsignmentDB = null;
537 // ChmConsignment chmConsignmentDB=this.findChmConsignmentByConsignmentCode(chmConsignment.getConsignmentCode(), DateUtils.addDate(DateUtils.getCurrentDate(),-7)); 539 // ChmConsignment chmConsignmentDB=this.findChmConsignmentByConsignmentCode(chmConsignment.getConsignmentCode(), DateUtils.addDate(DateUtils.getCurrentDate(),-7));
538 SysUser sysUser = sysUserRepository.findUserByLoginName(creator); 540 SysUser sysUser = sysUserRepository.findUserByLoginName(creator);
539 - List<ChmConsignment> chmConsignmentDBs=this.findChmConsignmentByConsignmentCodes(chmConsignment.getConsignmentCode(), DateUtils.addDate(DateUtils.getCurrentDate(),-7),sysUser.getUserName()); 541 + String username = null;
542 + if (sysUser == null){
543 + username = creator;
544 + }else {
545 + //设置当前运单创建人ID
546 + chmConsignment.setCreatorId(sysUser);
547 + username = sysUser.getUserName();
548 + }
549 + List<ChmConsignment> chmConsignmentDBs=this.findChmConsignmentByConsignmentCodes(chmConsignment.getConsignmentCode(), DateUtils.addDate(DateUtils.getCurrentDate(),-7),username);
540 List<ChmConsignment> newChmConsignments = new ArrayList<ChmConsignment>(); 550 List<ChmConsignment> newChmConsignments = new ArrayList<ChmConsignment>();
541 for (ChmConsignment chmConsignments : chmConsignmentDBs) { 551 for (ChmConsignment chmConsignments : chmConsignmentDBs) {
542 //如果有该用户曾经提交过得,运单状态为预审不通过或者中心审核已通过并且没有dm004的优先覆盖 552 //如果有该用户曾经提交过得,运单状态为预审不通过或者中心审核已通过并且没有dm004的优先覆盖
...@@ -556,13 +566,8 @@ public class ChmConsignmentService { ...@@ -556,13 +566,8 @@ public class ChmConsignmentService {
556 } 566 }
557 567
558 //获取用户账号信息 568 //获取用户账号信息
559 - if (sysUser == null){
560 - sysUser = sysUserRepository.findUserByLoginName("CUSTOMS");
561 - }
562 - //设置当前运单创建人ID
563 - chmConsignment.setCreatorId(sysUser);
564 //设置创建人名称 569 //设置创建人名称
565 - chmConsignment.setCreator(sysUser.getUserName()); 570 + chmConsignment.setCreator(username);
566 571
567 //3、新增或更新 572 //3、新增或更新
568 //新增:如果没有就插入 573 //新增:如果没有就插入
...@@ -682,7 +687,13 @@ public class ChmConsignmentService { ...@@ -682,7 +687,13 @@ public class ChmConsignmentService {
682 ChmConsignment chmConsignmentDB = null; 687 ChmConsignment chmConsignmentDB = null;
683 //2、校验 7天+运单 ,如果有数据并且 还未报关就更新,如果数据就插入 688 //2、校验 7天+运单 ,如果有数据并且 还未报关就更新,如果数据就插入
684 SysUser sysUser = sysUserRepository.findUserByLoginName(creator); 689 SysUser sysUser = sysUserRepository.findUserByLoginName(creator);
685 - List<ChmConsignment> chmConsignments = this.findChmConsignmentByConsignmentCodes(chmConsignment.getConsignmentCode(), DateUtils.addDate(DateUtils.getCurrentDate(),-7),sysUser.getUserName()); 690 + String username = null;
691 + if (sysUser == null){
692 + username = creator;
693 + }else {
694 + username = sysUser.getUserName();
695 + }
696 + List<ChmConsignment> chmConsignments = this.findChmConsignmentByConsignmentCodes(chmConsignment.getConsignmentCode(), DateUtils.addDate(DateUtils.getCurrentDate(),-7),username);
686 //如果没有C类待申报,从list中拿时间最晚的一条去覆盖 697 //如果没有C类待申报,从list中拿时间最晚的一条去覆盖
687 List<ChmConsignment> newChmConsignments = new ArrayList<ChmConsignment>(); 698 List<ChmConsignment> newChmConsignments = new ArrayList<ChmConsignment>();
688 for (ChmConsignment consignment : chmConsignments) { 699 for (ChmConsignment consignment : chmConsignments) {
......