demand: 新增轨迹预警定时任务,定时扫描轨迹异常的运单,并通知相关责任人 tms-扫描管理-发件扫描-扫描可勾选轨迹已结束,用于人工确认运单轨迹结束 tms-扫描管理-扫描记录查询-查询条件增加'轨迹状态‘,查询返回增加'轨迹状态‘
This commit is contained in:
parent
01e22b98fc
commit
c14b91a81a
@ -38,9 +38,10 @@ package com.xdadan.erp.emis.service.impl;
|
||||
import com.xdadan.erp.emis.service.warehouse.DocUtils;
|
||||
import com.xdadan.erp.emis.utils.WaybillHelper;
|
||||
import com.xdadan.erp.emis.utils.sensitive.Convert;
|
||||
import com.xdadan.erp.system.domain.SysFileInfo;
|
||||
import com.xdadan.erp.system.service.ISysFileInfoService;
|
||||
import com.xdadan.erp.system.service.ISysNoticeService;
|
||||
import com.xdadan.erp.system.domain.SysFileInfo;
|
||||
import com.xdadan.erp.system.mapper.SysUserMapper;
|
||||
import com.xdadan.erp.system.service.ISysFileInfoService;
|
||||
import com.xdadan.erp.system.service.ISysNoticeService;
|
||||
import jodd.util.StringUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections.MapUtils;
|
||||
@ -156,6 +157,9 @@ public class EmisWaybillServiceImpl extends EmisBaseService implements IEmisWayb
|
||||
@Autowired
|
||||
private EmisMoneyUserMapper emisMoneyUserMapper;
|
||||
|
||||
@Autowired
|
||||
private SysUserMapper sysUserMapper;
|
||||
|
||||
/**
|
||||
* 保存或更新运单其他信息副表
|
||||
* @param emisWaybillSave
|
||||
@ -6236,13 +6240,13 @@ public class EmisWaybillServiceImpl extends EmisBaseService implements IEmisWayb
|
||||
}
|
||||
|
||||
try {
|
||||
// 收集需要通知的员工编码:销售联系人、销售支持、销售分享人
|
||||
Set<String> notifyEmpCodes = new LinkedHashSet<>();
|
||||
// 收集需要通知的员工姓名:销售联系人、销售支持、销售分享人
|
||||
Set<String> notifyEmpNames = new LinkedHashSet<>();
|
||||
|
||||
// 销售联系人
|
||||
if (!StringUtils.isEmpty(waybill.getSalesmen())) {
|
||||
String salesmen = waybill.getSalesmen();
|
||||
notifyEmpCodes.add(salesmen);
|
||||
notifyEmpNames.add(salesmen);
|
||||
|
||||
// 销售分享关系:salesmen -> salesAss(使用当前批次预加载的关系)
|
||||
List<EmisSalesmenRel> relList = salesRelMap.get(salesmen);
|
||||
@ -6251,7 +6255,7 @@ public class EmisWaybillServiceImpl extends EmisBaseService implements IEmisWayb
|
||||
if (rel == null || StringUtils.isEmpty(rel.getSalesAss())) {
|
||||
continue;
|
||||
}
|
||||
notifyEmpCodes.add(rel.getSalesAss());
|
||||
notifyEmpNames.add(rel.getSalesAss());
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -6262,23 +6266,46 @@ public class EmisWaybillServiceImpl extends EmisBaseService implements IEmisWayb
|
||||
String[] supports = waybillOther.getSalesSupport().split("[,,]");
|
||||
for (String support : supports) {
|
||||
if (!StringUtils.isEmpty(support)) {
|
||||
notifyEmpCodes.add(support.trim());
|
||||
notifyEmpNames.add(support.trim());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (notifyEmpNames.isEmpty()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// 根据notifyEmpNames查询sys_user获取所有的notifyEmpCodes
|
||||
Set<String> notifyEmpCodes = new LinkedHashSet<>();
|
||||
for (String empName : notifyEmpNames) {
|
||||
try {
|
||||
SysUser cond = new SysUser();
|
||||
cond.setEmpName(empName);
|
||||
List<SysUser> users = sysUserMapper.selectUserList(cond);
|
||||
if (!CollectionUtils.isEmpty(users)) {
|
||||
for (SysUser u : users) {
|
||||
if (u != null && !StringUtils.isEmpty(u.getEmpCode())) {
|
||||
notifyEmpCodes.add(u.getEmpCode());
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
log.error("autoTraceWarning: query sys_user error, billCode={}, empName={}", waybill.getBillCode(), empName, ex);
|
||||
}
|
||||
}
|
||||
|
||||
if (notifyEmpCodes.isEmpty()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
String billCode = waybill.getBillCode();
|
||||
String timeStr = DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS, now);
|
||||
String title = "轨迹异常:运单【" + billCode + "】停留超过3天_" + timeStr;
|
||||
String content = title;
|
||||
String url = "/d24/waybillManagement/SendWaybillList?billCode=" + billCode;
|
||||
notifyEmpCodes.forEach(empCode -> {
|
||||
try {
|
||||
NoticeUtils.outSendNoticeToInner(title, content, url, empCode, 3);
|
||||
// String timeStr = DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS, now);
|
||||
String title = "轨迹异常:运单【" + billCode + "】停留超过3天_" + empCode;
|
||||
String content = title;
|
||||
NoticeUtils.outSendNoticeToInner(title, content, url, empCode, 2);
|
||||
} catch (Exception ex) {
|
||||
log.error("autoTraceWarning: send notice error, billCode={}, empCode={}", billCode, empCode, ex);
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user