法规清单-强制转办接口开发。

This commit is contained in:
wangzhijiang
2023-04-13 18:12:46 +08:00
parent b0f7c713fb
commit dd09dfcdeb
3 changed files with 248 additions and 0 deletions
@@ -519,4 +519,11 @@ public class ProjectLawsInventoryEOController extends JeroController<ProjectLaws
public Result<?> citeDeliverable(@RequestBody JSONObject json) {
return this.projectLawsInventoryEOService.citeDeliverable(json);
}
@AutoLog(value = "项目库-法规清单表-强制转办")
@ApiOperation(value="项目库-法规清单表-强制转办", notes="项目库-法规清单表-强制转办")
@PostMapping(value = "/compulsoryTransfer")
public Result<?> compulsoryTransfer(@RequestBody JSONObject json) {
return this.projectLawsInventoryEOService.compulsoryTransfer(json);
}
}
@@ -253,4 +253,6 @@ public interface IProjectLawsInventoryEOService extends IService<ProjectLawsInve
Result<?> updateFlowStatusBatch(JSONObject json);
Result<?> citeDeliverable(JSONObject json);
Result<?> compulsoryTransfer(JSONObject json);
}
@@ -12005,4 +12005,243 @@ public class ProjectLawsInventoryEOServiceImpl extends ServiceImpl<ProjectLawsIn
}
return Result.OK(resultMsg,citePhEo);
}
@Override
public Result<?> compulsoryTransfer(JSONObject json) {
String projectLibraryId = json.getString("projectLibraryId");
String ids = json.getString("ids");
if(StringUtils.isEmpty(ids)){
throw new JeroBootException("请选择数据进行强制转办操作!");
}
List<String> projectLawsInventoryIdList = Arrays.asList(ids.split(","));
String designTransferUserId = json.getString("designTransferUserId");
String verifyTransferUserId = json.getString("verifyTransferUserId");
QueryWrapper<ProjectLawsInventoryEO> pliQueryWrap = new QueryWrapper<>();
pliQueryWrap.lambda().in(ProjectLawsInventoryEO::getId,projectLawsInventoryIdList);
List<ProjectLawsInventoryEO> pliEoList = this.list();
if(CollectionUtils.isNotEmpty(pliEoList)){
QueryWrapper<ProcessInfoEO> piQueryWrap = new QueryWrapper<>();
piQueryWrap.lambda().in(ProcessInfoEO::getProjectLawsInventoryId,projectLawsInventoryIdList);
List<ProcessInfoEO> piEoList = this.processInfoEOService.list();
if(CollectionUtils.isNotEmpty(piEoList)){
if (StringUtils.isNotEmpty(designTransferUserId)) {
// 设计符合性相关待办任务强制转办
this.designCompulsoryTransfer(projectLibraryId, designTransferUserId, pliEoList, piEoList);
}
if(StringUtils.isNotEmpty(verifyTransferUserId)){
// 验证符合性相关待办任务强制转办
this.verifyCompulsoryTransfer(projectLibraryId,verifyTransferUserId, pliEoList, piEoList);
}
}
}
return Result.OK("强制转办成功!");
}
/**
* 设计符合性相关待办任务强制转办
* @param projectLibraryId
* @param designTransferUserId
* @param pliEoList
* @param piEoList
*/
private void designCompulsoryTransfer(String projectLibraryId, String designTransferUserId, List<ProjectLawsInventoryEO> pliEoList, List<ProcessInfoEO> piEoList) {
LoginUser currentUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
List<ProcessInfoEO> designPiEoList = piEoList.stream().filter(piEo -> {
boolean flag = false;
if(StringUtils.equals(piEo.getFlowType(),FlowTypeEnum.SJFHXSHLC.getValue())){
flag = true;
}
return flag;
}).collect(Collectors.toList());
List<String> taskDefinitionKeyList = new ArrayList<>();
taskDefinitionKeyList.add(DesignComplianceFlowNodeKeyEnum.ZRRQR.getValue());
taskDefinitionKeyList.add(DesignComplianceFlowNodeKeyEnum.DEZRRQR.getValue());
taskDefinitionKeyList.add(DesignComplianceFlowNodeKeyEnum.ZRRTJJFW.getValue());
taskDefinitionKeyList.add(DesignComplianceFlowNodeKeyEnum.DEZRRTJJFW.getValue());
List<String> actiProcInstIdList = designPiEoList.stream().map(ProcessInfoEO::getActiProcInstId).distinct().collect(Collectors.toList());
QueryWrapper<ProcessInfoDetailEO> pidQueryWrap = new QueryWrapper<>();
pidQueryWrap.lambda().in(ProcessInfoDetailEO::getActiProcInstId,actiProcInstIdList);
pidQueryWrap.lambda().eq(ProcessInfoDetailEO::getStatus,TaskStatusEnum.NOT_DONE.getValue());
pidQueryWrap.lambda().eq(ProcessInfoDetailEO::getTaskDefinitionKey,taskDefinitionKeyList);
List<ProcessInfoDetailEO> pidEoList = this.processInfoDetailEOService.list(pidQueryWrap);
if(CollectionUtils.isNotEmpty(pidEoList)){
pidEoList.forEach(pidEo ->{
pidEo.setUserId(designTransferUserId);
});
String taskIds = pidEoList.stream().map(ProcessInfoDetailEO::getTaskId).distinct().collect(Collectors.joining(","));
this.workFlowFeignClient.changeAssigneeBatch(taskIds, designTransferUserId);
this.processInfoDetailEOService.updateBatchById(pidEoList);
for (ProcessInfoDetailEO pidEo : pidEoList) {
List<ProcessInfoEO> piEoListTemp = piEoList.stream().filter(piEo -> {
boolean flag = false;
if (StringUtils.equals(piEo.getActiProcInstId(), pidEo.getActiProcInstId())) {
flag = true;
}
return flag;
}).collect(Collectors.toList());
if(CollectionUtils.isNotEmpty(piEoListTemp)){
ProcessInfoEO piEoTemp = piEoListTemp.get(0);
String projectLawsInventoryId = piEoTemp.getProjectLawsInventoryId();
List<ProjectLawsInventoryEO> pliEoListTemp = pliEoList.stream().filter(pliEo -> {
boolean flag = false;
if (StringUtils.equals(pliEo.getId(), projectLawsInventoryId)) {
flag = true;
}
return flag;
}).collect(Collectors.toList());
if(CollectionUtils.isNotEmpty(pliEoListTemp)){
ProjectLawsInventoryEO pliEoTemp = pliEoListTemp.get(0);
Date endTime = null;
String contentCn = "";
String contentEn = "";
String templateId = "";
String taskDefinitionKey = pidEo.getTaskDefinitionKey();
if(StringUtils.equals(taskDefinitionKey,DesignComplianceFlowNodeKeyEnum.ZRRQR.getValue())
|| StringUtils.equals(taskDefinitionKey,DesignComplianceFlowNodeKeyEnum.DEZRRQR.getValue())){
contentCn = "您好,请及时查看确认以下任务要求,谢谢!";
contentEn = "Hello! Please check and confirm the following task requirement in a timely manner. Thank you!";
templateId = TemplateInfoEnum2.REGULATION_TASK_CONFIRMATION1.getValue();
endTime = pliEoTemp.getDesignDutyDueDate();
} else if(StringUtils.equals(taskDefinitionKey,DesignComplianceFlowNodeKeyEnum.ZRRTJJFW.getValue())
|| StringUtils.equals(taskDefinitionKey,DesignComplianceFlowNodeKeyEnum.DEZRRTJJFW.getValue())){
contentCn = "您好,"+currentUser.getUsername()+"向您分发了该任务,请及时查看处理,谢谢!";
contentEn = "Hello! "+currentUser.getUsername()+" has assigned the task to you. Please check and address it in a timely manner. Thank you!";
templateId = TemplateInfoEnum2.DESIGN_COMPLIANCE_CONFIRMATION1.getValue();
endTime = pliEoTemp.getDesignDueDate();
}
Map<String,Object> params = new HashMap<>();
params.put("userIdList",Arrays.asList(designTransferUserId.split(",")));
params.put("projectLibraryId", projectLibraryId);
params.put("endTime", endTime);
params.put("serialNumbers", pliEoTemp.getSerialNumber());
params.put("contentCn", contentCn);
params.put("contentEn", contentEn);
params.put("id",projectLawsInventoryId);
JSONObject sendMsgJson = new JSONObject();
sendMsgJson.put("requestSource",RequestSourceEnum.WORK_FLOW.getValue());
sendMsgJson.put("operatorType",OperatorTypeEnum.SEND_MSG.getValue());
sendMsgJson.put("templateId", templateId);
sendMsgJson.put("params", params);
this.processCall(sendMsgJson);
}
}
}
}
}
/**
* 验证符合性相关待办任务强制转办
* @param projectLibraryId
* @param verifyTransferUserId
* @param pliEoList
* @param piEoList
*/
private void verifyCompulsoryTransfer(String projectLibraryId, String verifyTransferUserId, List<ProjectLawsInventoryEO> pliEoList, List<ProcessInfoEO> piEoList) {
LoginUser currentUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
List<ProcessInfoEO> verifyPiEoList = piEoList.stream().filter(piEo -> {
boolean flag = false;
if(StringUtils.equals(piEo.getFlowType(),FlowTypeEnum.YZFHXSCLC.getValue())){
flag = true;
}
return flag;
}).collect(Collectors.toList());
List<String> taskDefinitionKeyList = new ArrayList<>();
taskDefinitionKeyList.add(VerifyComplianceFlowNodeKeyEnum.ZRRQR.getValue());
taskDefinitionKeyList.add(VerifyComplianceFlowNodeKeyEnum.DEZRRQR.getValue());
taskDefinitionKeyList.add(VerifyComplianceFlowNodeKeyEnum.ZRRTJJFW.getValue());
taskDefinitionKeyList.add(VerifyComplianceFlowNodeKeyEnum.DEZRRTJJFW.getValue());
List<String> actiProcInstIdList = verifyPiEoList.stream().map(ProcessInfoEO::getActiProcInstId).distinct().collect(Collectors.toList());
QueryWrapper<ProcessInfoDetailEO> pidQueryWrap = new QueryWrapper<>();
pidQueryWrap.lambda().in(ProcessInfoDetailEO::getActiProcInstId,actiProcInstIdList);
pidQueryWrap.lambda().eq(ProcessInfoDetailEO::getStatus,TaskStatusEnum.NOT_DONE.getValue());
pidQueryWrap.lambda().in(ProcessInfoDetailEO::getTaskDefinitionKey,taskDefinitionKeyList);
List<ProcessInfoDetailEO> pidEoList = this.processInfoDetailEOService.list(pidQueryWrap);
if(CollectionUtils.isNotEmpty(pidEoList)){
pidEoList.forEach(pidEo ->{
pidEo.setUserId(verifyTransferUserId);
});
String taskIds = pidEoList.stream().map(ProcessInfoDetailEO::getTaskId).distinct().collect(Collectors.joining(","));
this.workFlowFeignClient.changeAssigneeBatch(taskIds,verifyTransferUserId);
this.processInfoDetailEOService.updateBatchById(pidEoList);
for (ProcessInfoDetailEO pidEo : pidEoList) {
List<ProcessInfoEO> piEoListTemp = piEoList.stream().filter(piEo -> {
boolean flag = false;
if (StringUtils.equals(piEo.getActiProcInstId(), pidEo.getActiProcInstId())) {
flag = true;
}
return flag;
}).collect(Collectors.toList());
if(CollectionUtils.isNotEmpty(piEoListTemp)){
ProcessInfoEO piEoTemp = piEoListTemp.get(0);
String projectLawsInventoryId = piEoTemp.getProjectLawsInventoryId();
List<ProjectLawsInventoryEO> pliEoListTemp = pliEoList.stream().filter(pliEo -> {
boolean flag = false;
if (StringUtils.equals(pliEo.getId(), projectLawsInventoryId)) {
flag = true;
}
return flag;
}).collect(Collectors.toList());
if(CollectionUtils.isNotEmpty(pliEoListTemp)){
ProjectLawsInventoryEO pliEoTemp = pliEoListTemp.get(0);
Date endTime = null;
String contentCn = "";
String contentEn = "";
String templateId = "";
String taskDefinitionKey = pidEo.getTaskDefinitionKey();
if(StringUtils.equals(taskDefinitionKey,VerifyComplianceFlowNodeKeyEnum.ZRRQR.getValue())
|| StringUtils.equals(taskDefinitionKey,VerifyComplianceFlowNodeKeyEnum.DEZRRQR.getValue())){
contentCn = "您好,请及时查看确认以下任务要求,谢谢!";
contentEn = "Hello! Please check and confirm the following task requirement in a timely manner. Thank you!";
templateId = TemplateInfoEnum2.REGULATION_TASK_CONFIRMATION1.getValue();
endTime = pliEoTemp.getVerifyDutyDueDate();
} else if(StringUtils.equals(taskDefinitionKey,VerifyComplianceFlowNodeKeyEnum.ZRRTJJFW.getValue())
|| StringUtils.equals(taskDefinitionKey,VerifyComplianceFlowNodeKeyEnum.DEZRRTJJFW.getValue())){
contentCn = "您好,"+currentUser.getUsername()+"向您分发了该任务,请及时查看处理,谢谢!";
contentEn = "Hello! "+currentUser.getUsername()+" has assigned the task to you. Please check and address it in a timely manner. Thank you!";
templateId = TemplateInfoEnum2.VALIDATION_COMPLIANCE_CONFIRMATION1.getValue();
endTime = pliEoTemp.getVerifyDueDate();
}
Map<String,Object> params = new HashMap<>();
params.put("userIdList",Arrays.asList(verifyTransferUserId.split(",")));
params.put("projectLibraryId", projectLibraryId);
params.put("endTime", endTime);
params.put("serialNumbers", pliEoTemp.getSerialNumber());
params.put("contentCn", contentCn);
params.put("contentEn", contentEn);
params.put("id",projectLawsInventoryId);
JSONObject sendMsgJson = new JSONObject();
sendMsgJson.put("requestSource",RequestSourceEnum.WORK_FLOW.getValue());
sendMsgJson.put("operatorType",OperatorTypeEnum.SEND_MSG.getValue());
sendMsgJson.put("templateId", templateId);
sendMsgJson.put("params", params);
this.processCall(sendMsgJson);
}
}
}
}
}
}