demand: TMS系统 - 网点费用申请 - 费用发生变化时消息通知从账号改为名称,且告知费用变化细节
committer: heyu
This commit is contained in:
parent
b103d976a9
commit
a3f9ec0bff
@ -62,7 +62,6 @@ public class EmisWaybillAjustApplyServiceImpl extends EmisBaseService implements
|
|||||||
@Autowired
|
@Autowired
|
||||||
private SysPostMapper postMapper;
|
private SysPostMapper postMapper;
|
||||||
|
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private IEmisSettleSubBillService emisSettleSubBillService;
|
private IEmisSettleSubBillService emisSettleSubBillService;
|
||||||
|
|
||||||
@ -584,19 +583,44 @@ public class EmisWaybillAjustApplyServiceImpl extends EmisBaseService implements
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 5. 查询去重后的emp_name对应的emp_code
|
// 5. 查询去重后的emp_name对应的emp_code,并构建empCode->empName映射,避免后续重复查询
|
||||||
Set<String> notifyEmpCodes = new HashSet<>();
|
Set<String> notifyEmpCodes = new HashSet<>();
|
||||||
for (String empName : empNames) {
|
java.util.Map<String, String> empCodeToName = new java.util.HashMap<>();
|
||||||
List<String> empCodes = getEmpCodesByEmpName(empName);
|
for (String name : empNames) {
|
||||||
notifyEmpCodes.addAll(empCodes);
|
SysUser cond = new SysUser();
|
||||||
|
cond.setEmpName(name);
|
||||||
|
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());
|
||||||
|
if (!StringUtils.isEmpty(u.getEmpName())) {
|
||||||
|
empCodeToName.put(u.getEmpCode(), u.getEmpName());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 6. 分别调用sendNoticeToEmpUser发送通知
|
// 6. 循环外预先计算申请人姓名与费用变更字符串,减少重复计算
|
||||||
|
SysUser applyUser = getEmisStaffByCode(emisWaybillAjustApply.getApplyManCode());
|
||||||
|
String applyManName = (applyUser != null && !StringUtils.isEmpty(applyUser.getEmpName()))
|
||||||
|
? applyUser.getEmpName()
|
||||||
|
: emisWaybillAjustApply.getApplyManCode();
|
||||||
|
BigDecimal oldFreight = emisWaybillOld != null ? emisWaybillOld.getFreight() : null;
|
||||||
|
BigDecimal newFreight = emisWaybillSave != null ? emisWaybillSave.getFreight() : null;
|
||||||
|
String oldFreightStr = oldFreight == null ? "-" : oldFreight.stripTrailingZeros().toPlainString();
|
||||||
|
String newFreightStr = newFreight == null ? "-" : newFreight.stripTrailingZeros().toPlainString();
|
||||||
|
|
||||||
|
// 7. 分别调用sendNoticeToEmpUser发送通知
|
||||||
if (!notifyEmpCodes.isEmpty()) {
|
if (!notifyEmpCodes.isEmpty()) {
|
||||||
for (String empCode : notifyEmpCodes) {
|
for (String empCode : notifyEmpCodes) {
|
||||||
if (!StringUtils.isEmpty(empCode)) {
|
if (!StringUtils.isEmpty(empCode)) {
|
||||||
String title = emisWaybillAjustApply.getApplyManCode() + "已对运单费用进行调整," + "请" + empCode + "仔细核对,"
|
String empName = !StringUtils.isEmpty(empCodeToName.get(empCode)) ? empCodeToName.get(empCode)
|
||||||
+ "单号【" + emisWaybillAjustApply.getBillCode() + "】";
|
: empCode;
|
||||||
|
String title = applyManName + "已对运单费用进行调整," + "请" + empName + "仔细核对,"
|
||||||
|
+ "单号【" + emisWaybillAjustApply.getBillCode() + "】" + ",运费由" + oldFreightStr + "调整为"
|
||||||
|
+ newFreightStr;
|
||||||
sendNoticeToEmpUser(empCode, title, "",
|
sendNoticeToEmpUser(empCode, title, "",
|
||||||
clickPath);
|
clickPath);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user