法规技术评估对接。

法规技术评估到达截止日期定时器。
This commit is contained in:
wangzhijiang
2022-07-14 11:09:30 +08:00
parent 333eb6d0f7
commit d7be39abe6
6 changed files with 154 additions and 14 deletions
@@ -11,10 +11,12 @@ import com.jero.modules.lawsOpinionGather.enums.LawsOpinionGatherNodeEnum;
import com.jero.modules.lawsOpinionGather.enums.OperatorRoleCodeEnum;
import com.jero.modules.lawsOpinionGather.mapper.LawsProcessHistoryEOMapper;
import com.jero.modules.lawsOpinionGather.service.ILawsProcessHistoryEOService;
import com.jero.modules.lawsTechnologyEvaluation.job.LawsTechnologyEvaluationNodeEnum;
import com.jero.modules.project.enums.OperatorTypeEnum;
import com.jero.modules.project.enums.RequestSourceEnum;
import com.jero.modules.system.entity.SysUser;
import com.jero.modules.system.service.ISysUserService;
import com.jero.modules.wkflow.enums.FlowTypeEnum;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
@@ -120,9 +122,12 @@ public class LawsProcessHistoryEOServiceImpl extends ServiceImpl<LawsProcessHist
if(StringUtils.isNotEmpty(data.getOperatorRoleCode())){
data.setOperatorRoleName(OperatorRoleCodeEnum.getTextByValue(data.getOperatorRoleCode(),cut));
}
if(StringUtils.isNotEmpty(data.getTaskDefinitionKey())){
data.setTaskDefinitionKeyName(LawsOpinionGatherNodeEnum.getTextByValue(data.getTaskDefinitionKey(),cut));
if(StringUtils.equals(data.getFlowType(), FlowTypeEnum.FGYJSJLC.getValue())){
data.setTaskDefinitionKeyName(LawsOpinionGatherNodeEnum.getTextByValue(data.getTaskDefinitionKey(),cut));
}else if(StringUtils.equals(data.getFlowType(),FlowTypeEnum.FGJSPG.getValue())){
data.setTaskDefinitionKeyName(LawsTechnologyEvaluationNodeEnum.getTextByValue(data.getTaskDefinitionKey(),cut));
}
}
});
}
@@ -205,7 +205,7 @@ public class LawsTechnologyEvaluationEOController extends JeroController<LawsTec
@AutoLog(value = "条款导入")
@ApiOperation(value = "条款导入")
@GetMapping(value = "/importItemExcel")
@PostMapping(value = "/importItemExcel")
public List<Map<String,Object>> importItemExcel(MultipartFile file, @RequestParam(name = "cut") String cut, HttpServletRequest request) throws Exception {
List<Map<String,Object>> result = this.lawsTechnologyEvaluationEOService.importItemExcel(file,cut,request);
return result;
@@ -0,0 +1,80 @@
package com.jero.modules.lawsTechnologyEvaluation.job;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.jero.common.api.vo.Result;
import com.jero.modules.lawsOpinionGather.enums.GatherResultEnum;
import com.jero.modules.lawsTechnologyEvaluation.entity.LawsTechnologyEvaluationEO;
import com.jero.modules.lawsTechnologyEvaluation.entity.LawsTechnologyEvaluationFlowDetailEO;
import com.jero.modules.lawsTechnologyEvaluation.service.ILawsTechnologyEvaluationEOService;
import com.jero.modules.lawsTechnologyEvaluation.service.ILawsTechnologyEvaluationFlowDetailEOService;
import com.jero.modules.wkflow.feginClient.WorkFlowFeignClient;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.jeecg.modules.jmreport.common.constant.CommonConstant;
import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.Date;
import java.util.List;
import java.util.stream.Collectors;
/**
* 法规技术评估 - 定时器
* 作用:当前日期大于等于截止日志的时候,把该数据的流程状态,更新为已完成,同时把当前这条数据的所有待办任务提交
*/
@Slf4j
public class LawsTechnologyEvaluationJob implements Job {
@Autowired
private ILawsTechnologyEvaluationEOService lawsTechnologyEvaluationEOService;
@Autowired
private ILawsTechnologyEvaluationFlowDetailEOService lawsTechnologyEvaluationFlowDetailEOService;
@Autowired
private WorkFlowFeignClient workFlowFeignClient;
@Override
public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
log.info("法规技术评估流程,定时任务开启 =====================================================");
QueryWrapper<LawsTechnologyEvaluationEO> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(LawsTechnologyEvaluationEO::getFlowStatus, GatherResultEnum.UNDERWAY.getValue());
List<LawsTechnologyEvaluationEO> lawsTechnologyEvaluationEOList = this.lawsTechnologyEvaluationEOService.list(queryWrapper);
if (CollectionUtils.isNotEmpty(lawsTechnologyEvaluationEOList)) {
Date currentDate = new Date();
//过滤截止日期小于当前日期的法规技术评估数据
List<LawsTechnologyEvaluationEO> updateLawsTechnologyEvaluationEOList = lawsTechnologyEvaluationEOList.stream().filter(e -> {
boolean flag = false;
if(currentDate.after(e.getEndTime())){
flag = true;
}
return flag;
}).collect(Collectors.toList());
if(CollectionUtils.isNotEmpty(updateLawsTechnologyEvaluationEOList)){
List<String> lawsTechnologyEvaluationIdList = updateLawsTechnologyEvaluationEOList.stream().map(LawsTechnologyEvaluationEO::getId).distinct().collect(Collectors.toList());
//获取这些法规技术评估数据的下级流程明细数据。
QueryWrapper<LawsTechnologyEvaluationFlowDetailEO> flowDetailEOQueryWrapper = new QueryWrapper<>();
flowDetailEOQueryWrapper.lambda().in(LawsTechnologyEvaluationFlowDetailEO::getLawsTechnologyEvaluationId,lawsTechnologyEvaluationIdList);
List<LawsTechnologyEvaluationFlowDetailEO> lawsTechnologyEvaluationFlowDetailEOList = lawsTechnologyEvaluationFlowDetailEOService.list(flowDetailEOQueryWrapper);
if(CollectionUtils.isNotEmpty(lawsTechnologyEvaluationFlowDetailEOList)){
String actiProcInstIds = lawsTechnologyEvaluationFlowDetailEOList.stream().map(LawsTechnologyEvaluationFlowDetailEO::getActiProcInstId).distinct().collect(Collectors.joining(","));
Result<String> result = this.workFlowFeignClient.completeTaskByPids(actiProcInstIds);
if(result.getCode().equals(CommonConstant.SC_OK_200)){
updateLawsTechnologyEvaluationEOList.forEach(lawsTechnologyEvaluationEO -> {
lawsTechnologyEvaluationEO.setFlowStatus(GatherResultEnum.COMPLETED.getValue());
});
this.lawsTechnologyEvaluationEOService.updateBatchById(updateLawsTechnologyEvaluationEOList);
}
}
}
}
log.info("法规技术评估流程,定时任务结束 =====================================================");
}
}
@@ -0,0 +1,63 @@
package com.jero.modules.lawsTechnologyEvaluation.job;
import com.alibaba.druid.util.StringUtils;
import com.jero.common.constant.enums.CutEnum;
/**
* 法规技术评估 节点枚举类
*/
public enum LawsTechnologyEvaluationNodeEnum {
ENGINEER_INITIATED("fggcsfq","法规工程师发起","Engineer initiated"),
APPRAISERS_EVALUATION("pgrqr","评估人评估","Appraiser's evaluation"),
SPONSOR_REVIEW("fqrsc","发起人审查","Sponsor review"),
;
String key;
String cnName;
String enName;
private LawsTechnologyEvaluationNodeEnum(String key, String cnName, String enName) {
this.key = key;
this.cnName = cnName;
this.enName = enName;
}
public String getKey() {
return key;
}
public void setKey(String key) {
this.key = key;
}
public String getCnName() {
return cnName;
}
public void setCnName(String cnName) {
this.cnName = cnName;
}
public String getEnName() {
return enName;
}
public void setEnName(String enName) {
this.enName = enName;
}
public static String getTextByValue(String key,String cut) {
LawsTechnologyEvaluationNodeEnum[] values = values();
for (LawsTechnologyEvaluationNodeEnum lawsOpinionGatherNodeEnum : values) {
if (lawsOpinionGatherNodeEnum.key.equals(key)) {
if(StringUtils.equals(cut, CutEnum.CN.getValue())){
return lawsOpinionGatherNodeEnum.cnName;
}else if(StringUtils.equals(cut,CutEnum.EN.getValue())){
return lawsOpinionGatherNodeEnum.enName;
}
}
}
return null;
}
}
@@ -336,13 +336,6 @@ public class LawsTechnologyEvaluationEOServiceImpl extends ServiceImpl<LawsTechn
HSSFCellStyle cellStyleTemp = workbook.createCellStyle();
cellStyleTemp.setWrapText(true);//自动换行
int startLine = 0;
int endLine = 4;
//合并单元格
CellRangeAddress region1 =
new CellRangeAddress(1, 1, startLine, endLine); //参数1:起始行 参数2:终止行 参数3:起始列 参数4:终止列
sheet.addMergedRegion(region1);
String explainInfo = null;
HSSFRichTextString explain = new HSSFRichTextString(explainInfo);
@@ -354,12 +347,12 @@ public class LawsTechnologyEvaluationEOServiceImpl extends ServiceImpl<LawsTechn
row.createCell(m).setCellValue(headerArr[m]);
}
Row rowExplain = sheet.createRow(1);
/*Row rowExplain = sheet.createRow(1);
short height = (short) (7 * 200);
rowExplain.setHeight((short) height);
Cell cell = rowExplain.createCell(0);
cell.setCellValue(explain);
cell.setCellStyle(cellStyleTemp);
cell.setCellStyle(cellStyleTemp);*/
response.setHeader("Content-Disposition",
"attachment; filename=\"" + fileOriName + ".xls");
@@ -189,8 +189,7 @@
lawsOpinionAssessmentResult() {
getAction(this.url.list, {
lawsTechnologyEvaluationId: this.queryProject.lawsTechnologyEvaluationId,
actiProcInstId: this.$route.query.prcId,
createBy: this.userInfo().username
actiProcInstId: this.$route.query.prcId
}).then((res) => {
if (res.success) {
this.complianceResult = res.result.complianceResult || {}