法规清单-催办接口开发。

This commit is contained in:
wangzhijiang
2022-06-15 18:26:55 +08:00
parent e6df3732ea
commit 130609a818
5 changed files with 167 additions and 11 deletions
@@ -429,4 +429,11 @@ public class ProjectLawsInventoryEOController extends JeroController<ProjectLaws
this.projectLawsInventoryEOService.downloadDocxReport(params,req,resp);
}
@AutoLog(value = "催办")
@ApiOperation(value="催办", notes="催办")
@PostMapping(value = "/expediting")
public Result<?> expediting(@RequestBody JSONObject json) {
return this.projectLawsInventoryEOService.expediting(json);
}
}
@@ -137,4 +137,11 @@ public interface IProjectLawsInventoryEOService extends IService<ProjectLawsInve
* @param resp
*/
void downloadDocxReport(Map<String, Object> params, HttpServletRequest req, HttpServletResponse resp);
/**
* 催办
* @param json
* @return
*/
Result<?> expediting(JSONObject json);
}
@@ -61,6 +61,7 @@ import com.jero.modules.system.service.impl.SysDictItemServiceImpl;
import com.jero.modules.wkflow.entity.ProcessHistoryEO;
import com.jero.modules.wkflow.enums.DesignComplianceNodeEnum;
import com.jero.modules.wkflow.enums.FlowTypeEnum;
import com.jero.modules.wkflow.feginClient.impl.TaskFeignClientImpl;
import com.jero.modules.wkflow.feginClient.impl.WorkFlowFeignClientImpl;
import com.jero.modules.wkflow.service.IProcessHistoryEOService;
import lombok.SneakyThrows;
@@ -200,6 +201,9 @@ public class ProjectLawsInventoryEOServiceImpl extends ServiceImpl<ProjectLawsIn
@Autowired
SysCategoryMapper sysCategoryMapper;
@Autowired
private TaskFeignClientImpl taskFeignClient;
/**
* 保存
*
@@ -5695,15 +5699,134 @@ public class ProjectLawsInventoryEOServiceImpl extends ServiceImpl<ProjectLawsIn
return template;
}
// public static void main(String[] args){
// InputStream inputStream = ProjectLawsInventoryEOServiceImpl.class.getClassLoader().getResourceAsStream("exportPdfTemp/ComplianceReportTemplate.docx");
// Resource resource = new ClassPathResource("ComplianceReportTemplate.docx");
// try {
// InputStream inputStream1 = resource.getInputStream();
// System.out.println(inputStream1 != null);
// } catch (IOException e) {
// e.printStackTrace();
// }
// System.out.println(inputStream != null);
// }
/**
* 催办
* @param json
* @return
*/
@Override
public Result<?> expediting(JSONObject json) {
String cut = json.getString("cut");
String ids = json.getString("ids");
String projectLibraryId = json.getString("projectLibraryId");
if(StringUtils.isEmpty(ids)){
if(StringUtils.equals(cut,CutEnum.CN.getValue())){
throw new JeroBootException("请至少选择一条数据!");
}else if(StringUtils.equals(cut,CutEnum.EN.getValue())){
throw new JeroBootException("Please select at least one data!");
}
}
//法规清单id数组
List<String> projectLawsInventoryIdList = Arrays.asList(ids.split(","));
QueryWrapper<ProjectLawsInventoryEO> lawsInventoryEOQueryWrapper = new QueryWrapper<>();
lawsInventoryEOQueryWrapper.lambda().eq(ProjectLawsInventoryEO::getProjectLibraryId,projectLibraryId);
lawsInventoryEOQueryWrapper.lambda().in(ProjectLawsInventoryEO::getId,projectLawsInventoryIdList);
List<ProjectLawsInventoryEO> projectLawsInventoryEOList = this.baseMapper.selectList(lawsInventoryEOQueryWrapper);
//获取已经发起的 任务确认流程信息当前处理人
JSONObject queryFlowCurrentTaskJson = new JSONObject();
queryFlowCurrentTaskJson.put("projectLawsInventoryIdList",projectLawsInventoryIdList);
queryFlowCurrentTaskJson.put("flowType",FlowTypeEnum.RWQRLC.getValue());
String result = this.taskFeignClient.queryFlowCurrentTask(queryFlowCurrentTaskJson);
JSONObject jsonObject = JSONObject.parseObject(result);
QueryWrapper<ProjectLibraryBase> libraryBaseQueryWrapper = new QueryWrapper<>();
libraryBaseQueryWrapper.lambda().eq(ProjectLibraryBase::getId,projectLibraryId);
ProjectLibraryBase projectLibraryBase = this.projectLibraryBaseMapper.selectOne(libraryBaseQueryWrapper);
projectLawsInventoryEOList.forEach(projectLawsInventoryEO -> {
//如果清单确认状态为待确认的进行催办
if(StringUtils.equals(projectLawsInventoryEO.getInventoryAffirmStatus(),InventoryAffirmStatusEnum.LIST_TO_CONFIRM.getValue())){
List<String> inventoryAffirmUserIdList = new ArrayList<>();
if(StringUtils.isEmpty(projectLawsInventoryEO.getHomologationEngineerSubmitStatus())){
//如果'认证工程师提交状态'为空则代表认证工程师没提交过给认证工程师发消息
inventoryAffirmUserIdList.add(projectLawsInventoryEO.getHomologationEngineerId());
}
if(StringUtils.isEmpty(projectLawsInventoryEO.getRegulationOwnerSubmitStatus())){
//如果'法规工程师提交状态'为空则代表认证工程师没提交过给认证工程师发消息
inventoryAffirmUserIdList.add(projectLawsInventoryEO.getRegulationOwnerId());
}
if(CollectionUtils.isNotEmpty(inventoryAffirmUserIdList)){
//如果清单确认 没办理的用户不为空给这些人发送消息清单确认催办
inventoryAffirmUserIdList = inventoryAffirmUserIdList.stream().distinct().collect(Collectors.toList());
log.debug("清单确认待办人员:" + inventoryAffirmUserIdList.toString());
QueryWrapper<ProjectNameInfoEO> projectNameInfoEOQueryWrapper = new QueryWrapper<>();
projectNameInfoEOQueryWrapper.lambda().eq(ProjectNameInfoEO::getId,projectLibraryBase.getProjectNameId());
ProjectNameInfoEO projectNameInfoEO = projectNameInfoEOMapper.selectOne(projectNameInfoEOQueryWrapper);
//消息内容
String msgContentEN = "Please address the regulation list confirmation process for "+ projectNameInfoEO.getProjectName() +" ASAP. ";
//飞书跳转链接
String hrefFeishu = backUrl + JumpLinkEnum.INVENTORY_AFFIRM_LINK.getLink() + projectLibraryId + JumpLinkEnum.INVENTORY_AFFIRM_LINK.getType();
//系统内部跳转链接
String href = "<a href='"
+ JumpLinkEnum.INVENTORY_AFFIRM_LINK.getLink() + projectLibraryId + JumpLinkEnum.INVENTORY_AFFIRM_LINK.getType() +
"'>" + "Jump link" + "</a>";
String contentInfo = msgContentEN + " " + href;
Map<String,Object> sendMessageMap = new HashMap<>();
sendMessageMap.put("hrefFeishu",hrefFeishu);
sendMessageMap.put("contentInfo",contentInfo);
//发送消息
sendMessage(msgContentEN,inventoryAffirmUserIdList,projectLibraryId,sendMessageMap);
}
}
//如果任务确认状态为待确认的进行催办
if(StringUtils.equals(projectLawsInventoryEO.getTaskAffirmStatus(),TaskAffirmStatusEnum.LIST_TO_CONFIRM.getValue())){
List<String> taskAffirmUserIdList = new ArrayList<>();
List<Map<String,Object>> currentTaskList = (List<Map<String,Object>>) jsonObject.get("currentTaskList");
List<String> finalTaskAffirmUserIdList = new ArrayList<>();
currentTaskList.forEach(currentTask -> {
String projectLawsInventoryId = (String) currentTask.get("projectLawsInventoryId");
if(StringUtils.equals(projectLawsInventoryId,projectLawsInventoryEO.getId())){
List<Map<String,Object>> taskList = (List<Map<String,Object>>) currentTask.get("taskList");
taskList.forEach(task -> {
String assignee = (String) task.get("assignee");
finalTaskAffirmUserIdList.add(assignee);
});
}
});
if(CollectionUtils.isNotEmpty(finalTaskAffirmUserIdList)){
//如果任务确认 没办理的用户不为空给这些人发送消息任务确认催办
taskAffirmUserIdList = finalTaskAffirmUserIdList.stream().distinct().collect(Collectors.toList());
log.debug("任务确认待办人员:" + taskAffirmUserIdList.toString());
QueryWrapper<ProjectNameInfoEO> projectNameInfoEOQueryWrapper = new QueryWrapper<>();
projectNameInfoEOQueryWrapper.lambda().eq(ProjectNameInfoEO::getId,projectLibraryBase.getProjectNameId());
ProjectNameInfoEO projectNameInfoEO = projectNameInfoEOMapper.selectOne(projectNameInfoEOQueryWrapper);
//消息内容
String msgContentEN = "Please address the regulation task confirmation process for "+ projectNameInfoEO.getProjectName() +" ASAP. ";
//飞书跳转链接
String hrefFeishu = backUrl + JumpLinkEnum.TASK_AFFIRM_LINK.getLink();
//系统内部跳转链接
String href = "<a href='" + JumpLinkEnum.TASK_AFFIRM_LINK.getLink() + "'>" + "Jump link" + "</a>";
String contentInfo = msgContentEN + " " + href;
Map<String,Object> sendMessageMap = new HashMap<>();
sendMessageMap.put("hrefFeishu",hrefFeishu);
sendMessageMap.put("contentInfo",contentInfo);
//发送消息
sendMessage(msgContentEN,taskAffirmUserIdList,projectLibraryId,sendMessageMap);
}
}
});
return Result.OK();
}
}
@@ -1,5 +1,6 @@
package com.jero.modules.wkflow.feginClient;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.jero.common.api.vo.Result;
import com.jero.modules.wkflow.entity.BusMes;
@@ -104,4 +105,12 @@ public interface TaskFeignClient {
*/
@RequestMapping(value = "/bat-wkflow/deleteDraft",method = RequestMethod.GET)
Result<String> deleteDraft(@RequestParam("id") String id);
/**
* 查询流程当前任务(当前办理人)
* @param jsonObject
* @return
*/
@RequestMapping(value = "/bat-wkflow/datas/bus-process-name/queryFlowCurrentTask",method = RequestMethod.POST,headers = {"content-type=application/json"})
String queryFlowCurrentTask(String jsonObject);
}
@@ -1,5 +1,6 @@
package com.jero.modules.wkflow.feginClient.impl;
import com.alibaba.fastjson.JSONObject;
import com.jero.common.api.vo.Result;
import com.jero.modules.wkflow.entity.BusMes;
import com.jero.modules.wkflow.entity.BusProcessName;
@@ -126,4 +127,13 @@ public class TaskFeignClientImpl {
return taskFeignClient.deleteDraft(id);
}
/**
* 查询流程当前任务(当前办理人)
* @param jsonObject
* @return
*/
public String queryFlowCurrentTask(@RequestBody JSONObject jsonObject) {
return taskFeignClient.queryFlowCurrentTask(jsonObject.toString());
}
}