|
@@ -7,6 +7,7 @@ import cn.cslg.pas.domain.business.ImportTask;
|
|
|
import cn.cslg.pas.domain.business.ImportTaskCondition;
|
|
|
import cn.cslg.pas.domain.business.Project;
|
|
|
import cn.cslg.pas.domain.business.SystemDict;
|
|
|
+import cn.cslg.pas.service.business.AssoProjectPersonService;
|
|
|
import cn.cslg.pas.service.business.ImportTaskConditionService;
|
|
|
import cn.cslg.pas.service.business.ProjectService;
|
|
|
import cn.cslg.pas.service.business.SystemDictService;
|
|
@@ -36,7 +37,8 @@ public class MailSendService {
|
|
|
private ProjectService projectService;
|
|
|
@Autowired
|
|
|
private SystemDictService systemDictService;
|
|
|
-
|
|
|
+ @Autowired
|
|
|
+ private AssoProjectPersonService assoProjectPersonService;
|
|
|
//发送协同邮件
|
|
|
public String sendSynery(String personId, Boolean ifInner, Integer projectId, Integer taskId, Integer reportType, String code) {
|
|
|
Map<String, Object> map = new LinkedHashMap<>();
|
|
@@ -164,16 +166,33 @@ public class MailSendService {
|
|
|
ImportTaskCondition importTaskCondition = importTaskConditionService.getById(importTask.getImportTaskConditionId());
|
|
|
Integer projectId = importTaskCondition.getProjectId();
|
|
|
Project project = projectService.getById(projectId);
|
|
|
- String personId = importTask.getCreateId();
|
|
|
+ List<String> personIds= assoProjectPersonService.getProjectShareIds(projectId);
|
|
|
+ String createId= project.getCreateId();
|
|
|
+ String handlerId =project.getHeadId();
|
|
|
+ if(createId!=null&&!createId.trim().equals("")){
|
|
|
+ personIds.add(createId);
|
|
|
+ }
|
|
|
+ if(handlerId!=null&&!handlerId.trim().equals("")){
|
|
|
+ personIds.add(handlerId);
|
|
|
+ }
|
|
|
+ if(personIds.size()==0){
|
|
|
+ return;
|
|
|
+ }
|
|
|
String res = "";
|
|
|
try {
|
|
|
- res = permissionService.getPersonnelByIdsFromPCS(Arrays.asList(personId));
|
|
|
+ res = permissionService.getPersonnelByIdsFromPCS(personIds);
|
|
|
} catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
}
|
|
|
if (!res.equals("")) {
|
|
|
JSONObject jsonObject = JSONObject.parseObject(res);
|
|
|
List<Personnel> personnels = JSON.parseArray(jsonObject.getString("data"), Personnel.class);
|
|
|
- Personnel personnel = personnels.get(0);
|
|
|
+ LambdaQueryWrapper<SystemDict> queryWrapper = new LambdaQueryWrapper<>();
|
|
|
+ queryWrapper.in(SystemDict::getType, "CYCLE_IMPORT_BCC");
|
|
|
+ List<SystemDict> systemDictList = systemDictService.list(queryWrapper);
|
|
|
+
|
|
|
+
|
|
|
+ for (Personnel personnel:personnels){
|
|
|
Map<String, Object> map = new LinkedHashMap<>();
|
|
|
map.put("title", "监控通知");
|
|
|
map.put("template", "mail/cycleTaskDone.html");
|
|
@@ -181,6 +200,14 @@ public class MailSendService {
|
|
|
map.put("img", "/logo.png");
|
|
|
map.put("email", personnel.getPersonnelEmail());
|
|
|
map.put("value2", project.getName());
|
|
|
+
|
|
|
+ if (systemDictList.size() > 0&&personnel.getId().equals(createId)) {
|
|
|
+ String[] bcs = new String[systemDictList.size()];
|
|
|
+ for (int i = 0; i <= systemDictList.size()-1; i++) {
|
|
|
+ bcs[i] = systemDictList.get(i).getValue();
|
|
|
+ }
|
|
|
+ map.put("bcc", bcs);
|
|
|
+ }
|
|
|
String dateRange = "";
|
|
|
if (importTask != null) {
|
|
|
if (importTask.getLastUpdateToDate() != null) {
|
|
@@ -200,19 +227,9 @@ public class MailSendService {
|
|
|
map.put("value3", dateRange);
|
|
|
map.put("value4", importTask.getAllNum());
|
|
|
|
|
|
- LambdaQueryWrapper<SystemDict> queryWrapper = new LambdaQueryWrapper<>();
|
|
|
- queryWrapper.in(SystemDict::getType, "CYCLE_IMPORT_BCC");
|
|
|
- List<SystemDict> systemDictList = systemDictService.list(queryWrapper);
|
|
|
-
|
|
|
- if (systemDictList.size() > 0) {
|
|
|
- String[] bcs = new String[systemDictList.size()];
|
|
|
- for (int i = 0; i < systemDictList.size(); i++) {
|
|
|
- bcs[i] = systemDictList.get(i).getValue();
|
|
|
- }
|
|
|
- map.put("bcc", bcs);
|
|
|
- }
|
|
|
rabbitMQUtils.sendEmailMessage(map);
|
|
|
}
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
public void sendSysCycleStartEmail() {
|
|
@@ -231,7 +248,7 @@ public class MailSendService {
|
|
|
map.put("email", systemDict.getValue());
|
|
|
if (systemDictList.size() > 0) {
|
|
|
String[] ccs = new String[systemDictList.size()];
|
|
|
- for (int i = 0; i < systemDictList.size(); i++) {
|
|
|
+ for (int i = 0; i <= systemDictList.size()-1; i++) {
|
|
|
ccs[i] = systemDictList.get(i).getValue();
|
|
|
}
|
|
|
map.put("cc", ccs);
|