zelong.shao

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

2023年9月6日10:02:40
szl
......@@ -234,7 +234,12 @@ public class ChmConsignmentService {
//推送时间作为创建时间,可以用来校验数据的有序性,如果新的推送时间小于已有的创建时间,就不更新数据
result.setCreateTime(new Date());
result.setUpdateTime(new Date());
result.setCreator(creator);
SysUser sysUser = sysUserRepository.findUserByLoginName(creator);
if (sysUser == null){
sysUser = sysUserRepository.findUserByLoginName("CUSTOMS");
}
result.setCreatorId(sysUser);
result.setCreator(sysUser.getUserName());
}catch (Exception e){
result=null;
......@@ -296,8 +301,11 @@ public class ChmConsignmentService {
result.setCreateTime(new Date());
result.setUpdateTime(pushTime);
SysUser sysUser = sysUserRepository.findUserByLoginName(creator);
if (sysUser == null){
sysUser = sysUserRepository.findUserByLoginName("CUSTOMS");
}
result.setCreatorId(sysUser);
result.setCreator(sysUser.getLoginName());
result.setCreator(sysUser.getUserName());
}catch (Exception e){
result=null;
......@@ -527,7 +535,8 @@ public class ChmConsignmentService {
//2、校验 7天+运单 ,如果有数据并且 还未报关就更新,如果数据就插入
ChmConsignment chmConsignmentDB = null;
// ChmConsignment chmConsignmentDB=this.findChmConsignmentByConsignmentCode(chmConsignment.getConsignmentCode(), DateUtils.addDate(DateUtils.getCurrentDate(),-7));
List<ChmConsignment> chmConsignmentDBs=this.findChmConsignmentByConsignmentCodes(chmConsignment.getConsignmentCode(), DateUtils.addDate(DateUtils.getCurrentDate(),-7),creator);
SysUser sysUser = sysUserRepository.findUserByLoginName(creator);
List<ChmConsignment> chmConsignmentDBs=this.findChmConsignmentByConsignmentCodes(chmConsignment.getConsignmentCode(), DateUtils.addDate(DateUtils.getCurrentDate(),-7),sysUser.getUserName());
List<ChmConsignment> newChmConsignments = new ArrayList<ChmConsignment>();
for (ChmConsignment chmConsignments : chmConsignmentDBs) {
//如果有该用户曾经提交过得,运单状态为预审不通过或者中心审核已通过并且没有dm004的优先覆盖
......@@ -547,7 +556,6 @@ public class ChmConsignmentService {
}
//获取用户账号信息
SysUser sysUser = sysUserRepository.findUserByLoginName(creator);
if (sysUser == null){
sysUser = sysUserRepository.findUserByLoginName("CUSTOMS");
}
......@@ -673,7 +681,8 @@ public class ChmConsignmentService {
chmConsignment.setChmConsignmentDetailList(chmConsignmentDetailList);
ChmConsignment chmConsignmentDB = null;
//2、校验 7天+运单 ,如果有数据并且 还未报关就更新,如果数据就插入
List<ChmConsignment> chmConsignments = this.findChmConsignmentByConsignmentCodes(chmConsignment.getConsignmentCode(), DateUtils.addDate(DateUtils.getCurrentDate(),-7),creator);
SysUser sysUser = sysUserRepository.findUserByLoginName(creator);
List<ChmConsignment> chmConsignments = this.findChmConsignmentByConsignmentCodes(chmConsignment.getConsignmentCode(), DateUtils.addDate(DateUtils.getCurrentDate(),-7),sysUser.getUserName());
//如果没有C类待申报,从list中拿时间最晚的一条去覆盖
List<ChmConsignment> newChmConsignments = new ArrayList<ChmConsignment>();
for (ChmConsignment consignment : chmConsignments) {
......