|
|
@@ -189,48 +189,66 @@ public class AsyncUtils {
|
|
|
List<Admin> admins = adminMapper.listAdminBydepIdAndRoleType(tOrderNew.getOrderDep(),AFTConstants.SALESMAN_ADMIN);
|
|
|
for (Admin admin : admins) {
|
|
|
addNotic( noticeType,admin.getId(), str);
|
|
|
- send(new EmailBo(NoticeStatus.getValueByCode(noticeType),admin.getId(),str));
|
|
|
+ send(new EmailBo(NoticeStatus.getValueByCode(noticeType),admin.getEmail(),str));
|
|
|
}
|
|
|
}else if(type==1){
|
|
|
String str=String.format("订单编号[%s]项目编号[%s],已%s请悉知。",task.getOrderNo(),task.getId(),sotpType==1?"恢复":"暂停");
|
|
|
noticeType=sotpType==0?NoticeStatus.PROJECT_SOPT_YES.getCode() :NoticeStatus.PROJECT_RENEW_YES.getCode();
|
|
|
List<String> list = new ArrayList<>();
|
|
|
- if (task.getConsultantId()!=null)list.add(task.getConsultantId());
|
|
|
- if (task.getManagerId()!=null)list.add(task.getManagerId());
|
|
|
+ List<Notice> notes=new ArrayList<>();
|
|
|
OrderOperator orderOperator = tOrderTaskMapper.selectAidByParam(task.getId());
|
|
|
- if (orderOperator.getFinanceId()!=null)list.add(orderOperator.getFinanceId());
|
|
|
- if (orderOperator.getSalesmanId()!=null)list.add(orderOperator.getSalesmanId());
|
|
|
+ StringBuffer emails=new StringBuffer();
|
|
|
+ if (task.getConsultantId()!=null){
|
|
|
+ pushParam(task.getConsultantId(), noticeType, str, notes, emails);
|
|
|
+ }
|
|
|
+ if (task.getManagerId()!=null){
|
|
|
+ pushParam(task.getManagerId(), noticeType, str, notes, emails);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (orderOperator.getFinanceId()!=null){
|
|
|
+ pushParam(orderOperator.getFinanceId(), noticeType, str, notes, emails);
|
|
|
+
|
|
|
+ }
|
|
|
+ if (orderOperator.getSalesmanId()!=null){
|
|
|
+ pushParam(orderOperator.getSalesmanId(), noticeType, str, notes, emails);
|
|
|
+ }
|
|
|
List<Admin> cwgly = adminMapper.selectAdminByRoleType(AFTConstants.FINANCE_ADMIN);
|
|
|
for (Admin admin : cwgly) {
|
|
|
- list.add(admin.getId());
|
|
|
+ pushParam(orderOperator.getSalesmanId(), noticeType, str, notes, emails);
|
|
|
}
|
|
|
List<Admin> zxsgly = adminMapper.selectAdminByRoleType(AFTConstants.TECH_ADMIN);
|
|
|
for (Admin admin : zxsgly) {
|
|
|
- list.add(admin.getId());
|
|
|
+ pushParam(admin, noticeType, str, notes, emails);
|
|
|
}
|
|
|
List<Admin> zc = adminMapper.selectAdminByRoleType(AFTConstants.CED);
|
|
|
for (Admin admin : zc) {
|
|
|
- list.add(admin.getId());
|
|
|
+ pushParam(admin, noticeType, str, notes, emails);
|
|
|
}
|
|
|
List<Admin> dsz = adminMapper.selectAdminByRoleType(AFTConstants.APPROVAL_DECISION);
|
|
|
for (Admin admin : dsz) {
|
|
|
- list.add(admin.getId());
|
|
|
+ pushParam(admin, noticeType, str, notes, emails);
|
|
|
}
|
|
|
- if (!list.isEmpty()){
|
|
|
- List<Notice> notes=new ArrayList<>();
|
|
|
- StringBuffer emails=new StringBuffer();
|
|
|
- for (String s : list) {
|
|
|
- notes.add(new Notice(UUID.randomUUID().toString(), new Date(), 0, s,
|
|
|
- noticeType, str));
|
|
|
- emails=emails.append(s).append(",");
|
|
|
- }
|
|
|
+ System.out.println("========================"+emails.substring(0,emails.length()-1));
|
|
|
noticeMapper.insertBatch(notes);
|
|
|
- System.out.println(emails.substring(0,emails.length()-1));
|
|
|
send(new EmailBo(NoticeStatus.getValueByCode(noticeType),emails.substring(0,emails.length()-1),str));
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ private void pushParam(String id, Integer noticeType, String str, List<Notice> notes, StringBuffer emails) {
|
|
|
+ Admin admin = adminMapper.selectByPrimaryKey(id);
|
|
|
+ pushParam(admin,noticeType,str,notes,emails);
|
|
|
+
|
|
|
}
|
|
|
|
|
|
|
|
|
+
|
|
|
+ private void pushParam(Admin admin, Integer noticeType, String str, List<Notice> notes, StringBuffer emails) {
|
|
|
+ notes.add(new Notice(UUID.randomUUID().toString(), new Date(), 0, admin.getId(),
|
|
|
+ noticeType, str));
|
|
|
+ if (admin.getEmail()!=null) emails = emails.append(admin.getEmail()).append(",");
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
}
|