diff --git a/emis-biz/src/main/java/com/xdadan/erp/emis/service/impl/EmisWaybillServiceImpl.java b/emis-biz/src/main/java/com/xdadan/erp/emis/service/impl/EmisWaybillServiceImpl.java index 051da3372..da4a43e32 100644 --- a/emis-biz/src/main/java/com/xdadan/erp/emis/service/impl/EmisWaybillServiceImpl.java +++ b/emis-biz/src/main/java/com/xdadan/erp/emis/service/impl/EmisWaybillServiceImpl.java @@ -6363,84 +6363,84 @@ public class EmisWaybillServiceImpl extends EmisBaseService implements IEmisWayb } for (EmisWaybill waybill : waybillList) { - if (waybill == null || StringUtils.isBlank(waybill.getBillCode())) { - continue; - } - - try { - // 收集需要通知的员工姓名:销售联系人、销售支持、销售分享人 - Set notifyEmpNames = new LinkedHashSet<>(); - - // 销售联系人 - if (!StringUtils.isBlank(waybill.getSalesmen())) { - String salesmen = waybill.getSalesmen(); - notifyEmpNames.add(salesmen); - - // 销售分享关系:salesmen -> salesAss(使用当前批次预加载的关系) - List relList = salesRelMap.get(salesmen); - if (!CollectionUtils.isEmpty(relList)) { - for (EmisSalesmenRel rel : relList) { - if (rel == null || StringUtils.isBlank(rel.getSalesAss())) { - continue; - } - notifyEmpNames.add(rel.getSalesAss()); - } - } - } - - // 销售支持 - EmisWaybillOther waybillOther = waybill.getWaybillOther(); - if (waybillOther != null && !StringUtils.isBlank(waybillOther.getSalesSupport())) { - String[] supports = waybillOther.getSalesSupport().split("[,,]"); - for (String support : supports) { - if (!StringUtils.isBlank(support)) { - notifyEmpNames.add(support.trim()); - } - } - } - - if (notifyEmpNames.isEmpty()) { + if (waybill == null || StringUtils.isBlank(waybill.getBillCode())) { continue; } - // 根据notifyEmpNames查询sys_user获取所有的notifyEmpCodes - Set notifyEmpCodes = new LinkedHashSet<>(); - for (String empName : notifyEmpNames) { - try { - SysUser cond = new SysUser(); - cond.setEmpName(empName); - List users = sysUserMapper.selectUserList(cond); - if (!CollectionUtils.isEmpty(users)) { - for (SysUser u : users) { - if (u != null && !StringUtils.isBlank(u.getEmpCode())) { - notifyEmpCodes.add(u.getEmpCode()); + try { + // 收集需要通知的员工姓名:销售联系人、销售支持、销售分享人 + Set notifyEmpNames = new LinkedHashSet<>(); + + // 销售联系人 + if (!StringUtils.isBlank(waybill.getSalesmen())) { + String salesmen = waybill.getSalesmen(); + notifyEmpNames.add(salesmen); + + // 销售分享关系:salesmen -> salesAss(使用当前批次预加载的关系) + List relList = salesRelMap.get(salesmen); + if (!CollectionUtils.isEmpty(relList)) { + for (EmisSalesmenRel rel : relList) { + if (rel == null || StringUtils.isBlank(rel.getSalesAss())) { + continue; + } + notifyEmpNames.add(rel.getSalesAss()); + } + } + } + + // 销售支持 + EmisWaybillOther waybillOther = waybill.getWaybillOther(); + if (waybillOther != null && !StringUtils.isBlank(waybillOther.getSalesSupport())) { + String[] supports = waybillOther.getSalesSupport().split("[,,]"); + for (String support : supports) { + if (!StringUtils.isBlank(support)) { + notifyEmpNames.add(support.trim()); + } + } + } + + if (notifyEmpNames.isEmpty()) { + continue; + } + + // 根据notifyEmpNames查询sys_user获取所有的notifyEmpCodes + Set notifyEmpCodes = new LinkedHashSet<>(); + for (String empName : notifyEmpNames) { + try { + SysUser cond = new SysUser(); + cond.setEmpName(empName); + List users = sysUserMapper.selectUserList(cond); + if (!CollectionUtils.isEmpty(users)) { + for (SysUser u : users) { + if (u != null && !StringUtils.isBlank(u.getEmpCode())) { + notifyEmpCodes.add(u.getEmpCode()); + } } } + } catch (Exception ex) { + log.error("autoTraceWarning: query sys_user error, billCode={}, empName={}", waybill.getBillCode(), empName, ex); } - } 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 url = "/d24/waybillManagement/SendWaybillList?billCode=" + billCode; - notifyEmpCodes.forEach(empCode -> { - try { - String timeStr = DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS, now); - String title = "轨迹异常:运单【" + billCode + "】停留超过3天_" + empCode + "_" + timeStr; - String content = title; - NoticeUtils.outSendNoticeToInner(title, content, url, empCode, 2); - } catch (Exception ex) { - log.error("autoTraceWarning: send notice error, billCode={}, empCode={}", billCode, empCode, ex); + if (notifyEmpCodes.isEmpty()) { + continue; } - }); - } catch (Exception ex) { - log.error("autoTraceWarning: handle waybill error, billCode={}", waybill.getBillCode(), ex); - } + + String billCode = waybill.getBillCode(); + String url = "/d24/waybillManagement/SendWaybillList?billCode=" + billCode; + notifyEmpCodes.forEach(empCode -> { + try { + String timeStr = DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS, now); + String title = "轨迹异常:运单【" + billCode + "】停留超过3天_" + empCode + "_" + timeStr; + String content = title; + NoticeUtils.outSendNoticeToInner(title, content, url, empCode, 2); + } catch (Exception ex) { + log.error("autoTraceWarning: send notice error, billCode={}, empCode={}", billCode, empCode, ex); + } + }); + } catch (Exception ex) { + log.error("autoTraceWarning: handle waybill error, billCode={}", waybill.getBillCode(), ex); + } } if (waybillList.size() < pageSize) {