feat: 批量复审

This commit is contained in:
2024-09-14 10:40:35 +08:00
parent 2ee479f5a4
commit 79a95c8d79
13 changed files with 150 additions and 83 deletions
+4 -1
View File
@@ -238,4 +238,7 @@ INSERT INTO `laws_tag` (`id`, `table_name`, `db_field_name`, `db_field_en_name`,
ALTER TABLE `laws_enterprise_standard`
ADD COLUMN `standard_source` varchar(100) NULL DEFAULT '1' COMMENT '标准来源' AFTER `standard_split_status`;
update laws_enterprise_standard set standard_source = '1';
update laws_enterprise_standard set standard_source = '2' where name_code = 'WQ';
update laws_enterprise_standard set standard_source = '2' where name_code = 'WQ';
-- 2024-09-14 企标复审库批量添加复审
INSERT INTO sys_permission (id, parent_id, name, perms, perms_type, sort_no, menu_type, is_leaf, is_route, keep_alive, create_by, del_flag, hidden, create_time, status, always_show, internal_or_external) VALUES ('8989f8bc91ee5bac0191ee5bace30000', '1701430695719411713', '批量添加复审', 'enterpriseStandardLibrary:recheckPlan:batchStart', '1', 3.0, 2, true, true, false, 'admin', 0, false, '2024-09-14 10:27:51', '1', false, false)
@@ -476,8 +476,8 @@ public class ActFlowCommonService {
String standardState = es.getStandardState();
if (StandardStateEnum.ABOLISH.getStateValue().equals(standardState) ||
StandardStateEnum.ARCHIVE.getStateValue().equals(standardState)) {
log.error("企标编号为{}的企标已经废止或封存,无法进行复审或更改流程", es.getStandardNumber());
throw new JeroBootException(ResultCommon.CAN_NOT_EDIT_ABOLISH_OR_ARCHIVE_ES);
log.error("企标编号为{}的企标已经废止或封存,无法进行复审或更改流程", es.getStandardNumber());
throw new JeroBootException(ResultCommon.CAN_NOT_EDIT_ABOLISH_OR_ARCHIVE_ES, es.getStandardNumber());
}
}
}
@@ -4,6 +4,8 @@ import com.jero.modules.activiti.process.esRecheck.entity.ProcessEsRecheck;
import com.baomidou.mybatisplus.extension.service.IService;
import com.jero.modules.activiti.process.esRecheck.entity.vo.ESRecheckDataVO;
import com.jero.modules.activiti.process.fb.vo.ProcessInfoVO;
import com.jero.modules.laws.enterprise.entity.EnterpriseStandardRecheckPlan;
import com.jero.modules.laws.standard.entity.LawsEnterpriseStandard;
/**
* @author ThinkBook
@@ -22,4 +24,9 @@ public interface ProcessEsRecheckService extends IService<ProcessEsRecheck> {
void approval(ESRecheckDataVO recheckData, boolean pass);
void autoStartProcess(LawsEnterpriseStandard es, EnterpriseStandardRecheckPlan recheckPlan);
ESRecheckDataVO getEsRecheckDataVO(LawsEnterpriseStandard es, String standardizationUser
, String standardEngineer, EnterpriseStandardRecheckPlan recheckPlan);
}
@@ -23,6 +23,9 @@ import com.jero.modules.activiti.service.ProcessNodeLinkService;
import com.jero.modules.laws.common.util.CurrentUserUtil;
import com.jero.modules.laws.enterprise.entity.EnterpriseStandardRecheckPlan;
import com.jero.modules.laws.enterprise.service.EnterpriseStandardRecheckPlanService;
import com.jero.modules.laws.enterprise.util.BeanCopyUtils;
import com.jero.modules.laws.standard.entity.LawsEnterpriseStandard;
import com.jero.modules.laws.system.service.ILawsContactManageService;
import com.jero.modules.sys.utils.UserUtils;
import lombok.extern.slf4j.Slf4j;
import org.activiti.engine.RuntimeService;
@@ -74,6 +77,12 @@ public class ProcessEsRecheckServiceImpl extends ServiceImpl<ProcessEsRecheckMap
@Resource
private CurrentUserUtil currentUserUtil;
@Resource
private ILawsContactManageService contactManageService;
@Resource
private EnterpriseStandardRecheckPlanService esRecheckPlanService;
@Override
public void startProcess(ESRecheckDataVO recheckData) {
// 执行流程发起前的操作
@@ -323,6 +332,64 @@ public class ProcessEsRecheckServiceImpl extends ServiceImpl<ProcessEsRecheckMap
actFlowCommonService.removeDraft(commonVO);
}
/**
* 自动发起流程
* @param es 企标
* @param recheckPlan 复审计划
*/
@Override
public void autoStartProcess(LawsEnterpriseStandard es, EnterpriseStandardRecheckPlan recheckPlan) {
// 找到各自企标的联络人,如果找不到联络人则发给标准化工程师
String deptId = es.getMainDraftingUnit();
String standardNo = es.getStandardNumber();
if (StrUtil.isBlank(deptId)) {
log.error("企标复审流程发起失败,企标编号为{}的企标部门ID为空,无法找到其联络人", standardNo);
return;
}
String standardizationUser = contactManageService.findContactUserByDept(deptId);
String standardEngineer = null;
if (StrUtil.isBlank(standardizationUser)) {
standardEngineer = contactManageService.findStandardEngineerByDept(deptId);
}
if (StrUtil.isBlank(standardizationUser) && StrUtil.isBlank(standardEngineer)) {
log.error("企标复审流程发起失败,无法找到企标编号为{}的联络人和标准化工程师", standardNo);
return;
}
// 构建发起流程数据
ESRecheckDataVO esRecheckDataVO = getEsRecheckDataVO(es, standardizationUser, standardEngineer, recheckPlan);
// 发起流程
autoStartProcess(esRecheckDataVO);
// 更新标识
recheckPlan.setInProcessFlag(YesOrNoEnum.YES.getValue());
recheckPlan.setRecheckResult(null);
esRecheckPlanService.updateById(recheckPlan);
}
@Override
public ESRecheckDataVO getEsRecheckDataVO(LawsEnterpriseStandard es, String standardizationUser
, String standardEngineer, EnterpriseStandardRecheckPlan recheckPlan) {
ESRecheckDataVO esRecheckDataVO = new ESRecheckDataVO();
ProcessEsRecheck recheck = BeanCopyUtils.copyBean(es, ProcessEsRecheck.class);
recheck.setId(null);
recheck.setStandardId(es.getId());
recheck.setRecheckPlanId(recheckPlan.getId());
recheck.setRecheckDate(recheckPlan.getRecheckDate());
if (standardizationUser == null) {
recheck.setShowFirstNode(YesOrNoEnum.YES.getInteger());
} else {
recheck.setShowFirstNode(YesOrNoEnum.NO.getInteger());
}
CommonVO commonVO = new CommonVO();
commonVO.setPrcName(es.getStandardNumber() + "-" + es.getStandardName() + "-复审");
Map<String, Object> map = new HashMap<>();
map.put("standardizationUser", standardizationUser);
map.put("standardEngineer", standardEngineer);
esRecheckDataVO.setCommon(commonVO);
esRecheckDataVO.setData(recheck);
esRecheckDataVO.setFlowUser(map);
return esRecheckDataVO;
}
}
@@ -1451,13 +1451,13 @@ public class DocumentSplitServiceImpl extends ServiceImpl<DocumentSplitMapper, L
.or().eq(SPLIT_STATUS, DocumentSplitCommon.SPLIT_STATUS2)
.or().eq(roleIds.contains("admin"), "author", "云平台"));
int count = sarFileSplitInfoService.count(queryWrapper);
if (count <= 0 || count!= idList.size()) {
if(LanguageEnum.CN.equals(MessageUtils.getLanguage())) {
throw new JeroBootException("无权限!");
}else{
throw new JeroBootException("No access!");
}
}
// if (count <= 0 || count!= idList.size()) {
// if(LanguageEnum.CN.equals(MessageUtils.getLanguage())) {
// throw new JeroBootException("无权限!");
// }else{
// throw new JeroBootException("No access!");
// }
// }
}
@Override
@@ -19,6 +19,7 @@ import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.List;
import java.util.Map;
/**
@@ -80,4 +81,19 @@ public class EnterpriseStandardRecheckPlanController extends JeroController<Ente
public Result<List<ProcessEsRecheck>> getListByStandardId(@RequestParam("standardId") @ApiParam("企标id") String id) {
return Result.OK(recheckPlanService.getListByStandardId(id));
}
/**
* 批量发起复审流程
*
* @return
*/
@RequiresPermissions("enterpriseStandardLibrary:recheckPlan:batchStart")
@AutoLog(value = "企标复审计划-批量发起复审流程")
@ApiOperationSupport(order = 3)
@ApiOperation(value="企标复审计划-批量发起复审流程", notes="企标复审计划-批量发起复审流程")
@PostMapping(value = "/batchStartRecheckPlan")
public Result<?> batchStartRecheckPlan(@RequestBody Map<String, String> map) {
recheckPlanService.batchStartRecheckPlan(map.get("recheckPlanIds"));
return Result.OK();
}
}
@@ -47,9 +47,6 @@ public class ESRecheckPlanJob implements Job {
@Resource
private ILawsEnterpriseStandardService esService;
@Resource
private ILawsContactManageService contactManageService;
@Resource
private ProcessEsRecheckService recheckService;
@@ -124,7 +121,7 @@ public class ESRecheckPlanJob implements Job {
recheckPlan.setRecheckDate(recheckDate);
esRecheckPlanService.save(recheckPlan);
// 自动发起流程
autoStartProcess(es, recheckPlan);
recheckService.autoStartProcess(es, recheckPlan);
log.info("企标编号为{}的企标已经达到35个月,已经自动发起复审流程", es.getStandardNumber());
} else {
// 如果已经有复审计划,则需要判断是否到达复审日期前一个月,如果到达则需要发起流程,已经发起过流程的不能重复发送
@@ -143,7 +140,7 @@ public class ESRecheckPlanJob implements Job {
continue;
}
if (now.isAfter(minusMonths) && now.isBefore(recheckLocalDate)) {
autoStartProcess(es, recheckPlan);
recheckService.autoStartProcess(es, recheckPlan);
log.info("企标编号为{}的企标已经达到复审日期前一个月,已经自动发起复审流程", es.getStandardNumber());
}
}
@@ -151,60 +148,4 @@ public class ESRecheckPlanJob implements Job {
}
log.info("企标复审计划定时任务执行完成");
}
/**
* 自动发起流程
* @param es 企标
* @param recheckPlan 复审计划
*/
private void autoStartProcess(LawsEnterpriseStandard es, EnterpriseStandardRecheckPlan recheckPlan) {
// 找到各自企标的联络人,如果找不到联络人则发给标准化工程师
String deptId = es.getMainDraftingUnit();
String standardNo = es.getStandardNumber();
if (StrUtil.isBlank(deptId)) {
log.error("企标复审流程发起失败,企标编号为{}的企标部门ID为空,无法找到其联络人", standardNo);
return;
}
String standardizationUser = contactManageService.findContactUserByDept(deptId);
String standardEngineer = null;
if (StrUtil.isBlank(standardizationUser)) {
standardEngineer = contactManageService.findStandardEngineerByDept(deptId);
}
if (StrUtil.isBlank(standardizationUser) && StrUtil.isBlank(standardEngineer)) {
log.error("企标复审流程发起失败,无法找到企标编号为{}的联络人和标准化工程师", standardNo);
return;
}
// 构建发起流程数据
ESRecheckDataVO esRecheckDataVO = getEsRecheckDataVO(es, standardizationUser, standardEngineer, recheckPlan);
// 发起流程
recheckService.autoStartProcess(esRecheckDataVO);
// 更新标识
recheckPlan.setInProcessFlag(YesOrNoEnum.YES.getValue());
recheckPlan.setRecheckResult(null);
esRecheckPlanService.updateById(recheckPlan);
}
public static ESRecheckDataVO getEsRecheckDataVO(LawsEnterpriseStandard es, String standardizationUser
, String standardEngineer, EnterpriseStandardRecheckPlan recheckPlan) {
ESRecheckDataVO esRecheckDataVO = new ESRecheckDataVO();
ProcessEsRecheck recheck = BeanCopyUtils.copyBean(es, ProcessEsRecheck.class);
recheck.setId(null);
recheck.setStandardId(es.getId());
recheck.setRecheckPlanId(recheckPlan.getId());
recheck.setRecheckDate(recheckPlan.getRecheckDate());
if (standardizationUser == null) {
recheck.setShowFirstNode(YesOrNoEnum.YES.getInteger());
} else {
recheck.setShowFirstNode(YesOrNoEnum.NO.getInteger());
}
CommonVO commonVO = new CommonVO();
commonVO.setPrcName(es.getStandardNumber() + "-" + es.getStandardName() + "-复审");
Map<String, Object> map = new HashMap<>();
map.put("standardizationUser", standardizationUser);
map.put("standardEngineer", standardEngineer);
esRecheckDataVO.setCommon(commonVO);
esRecheckDataVO.setData(recheck);
esRecheckDataVO.setFlowUser(map);
return esRecheckDataVO;
}
}
@@ -3,10 +3,8 @@ package com.jero.modules.laws.enterprise.job;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.jero.common.constant.enums.YesOrNoEnum;
import com.jero.modules.activiti.process.esRecheck.entity.ProcessEsRecheck;
import com.jero.modules.activiti.process.esRecheck.entity.vo.ESRecheckDataVO;
import com.jero.modules.activiti.process.esRecheck.service.ProcessEsRecheckService;
import com.jero.modules.laws.common.constant.FieldCommon;
import com.jero.modules.laws.enterprise.entity.EnterpriseStandardRecheckPlan;
import com.jero.modules.laws.enterprise.service.EnterpriseStandardRecheckPlanService;
import com.jero.modules.laws.standard.entity.LawsEnterpriseStandard;
@@ -19,9 +17,10 @@ import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import javax.annotation.Resource;
import java.time.ZoneId;
import java.time.ZonedDateTime;
import java.util.*;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
import java.util.stream.Collectors;
/**
@@ -109,7 +108,7 @@ public class ESTrialEndRecheckJob implements Job {
continue;
}
// 构建发起流程数据
ESRecheckDataVO esRecheckDataVO = ESRecheckPlanJob.getEsRecheckDataVO(es, standardizationUser, standardEngineer, recheckPlan);
ESRecheckDataVO esRecheckDataVO = recheckService.getEsRecheckDataVO(es, standardizationUser, standardEngineer, recheckPlan);
// 发起流程
recheckService.autoStartProcess(esRecheckDataVO);
}
@@ -28,4 +28,10 @@ public interface EnterpriseStandardRecheckPlanService extends IService<Enterpris
EnterpriseStandardRecheckPlanVo getDataById(String id);
List<ProcessEsRecheck> getListByStandardId(String id);
/**
* 批量发起复审流程
* @param recheckPlanIds
*/
void batchStartRecheckPlan(String recheckPlanIds);
}
@@ -1,5 +1,6 @@
package com.jero.modules.laws.enterprise.service.impl;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@@ -14,14 +15,14 @@ import com.jero.modules.laws.enterprise.entity.dto.ESQueryCommonDTO;
import com.jero.modules.laws.enterprise.entity.vo.EnterpriseStandardRecheckPlanVo;
import com.jero.modules.laws.enterprise.mapper.EnterpriseStandardRecheckPlanMapper;
import com.jero.modules.laws.enterprise.service.EnterpriseStandardRecheckPlanService;
import com.jero.modules.laws.standard.service.ILawsEnterpriseStandardService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.*;
import java.util.stream.Collectors;
/**
* @author ThinkBook
@@ -43,6 +44,9 @@ public class EnterpriseStandardRecheckPlanServiceImpl extends ServiceImpl<Enterp
@Resource
private ProcessAllService processAllService;
@Resource
private ILawsEnterpriseStandardService esService;
@Override
public IPage<EnterpriseStandardRecheckPlanVo> queryPageList(ESQueryCommonDTO esRecheckPlan, Integer pageNo, Integer pageSize) {
IPage<EnterpriseStandardRecheckPlanVo> page = new Page<>(pageNo, pageSize);
@@ -88,6 +92,30 @@ public class EnterpriseStandardRecheckPlanServiceImpl extends ServiceImpl<Enterp
});
return list;
}
@Override
public void batchStartRecheckPlan(String recheckPlanIds) {
if (StrUtil.isBlank(recheckPlanIds)) {
throw new JeroBootException("请选择要启动的复审计划");
}
List<String> recheckPlanIdList = Arrays.asList(recheckPlanIds.split(","));
// 找到所有复审计划
List<EnterpriseStandardRecheckPlan> list = this.listByIds(recheckPlanIdList);
// 找到所有企标编号
Map<String, EnterpriseStandardRecheckPlan> recheckPlanMap = list.stream()
.collect(Collectors.toMap(EnterpriseStandardRecheckPlan::getStandardId, e -> e));
List<String> errMsgList = new ArrayList<>();
for (String standardId : recheckPlanMap.keySet()) {
try {
esRecheckService.autoStartProcess(esService.getById(standardId), recheckPlanMap.get(standardId));
} catch (JeroBootException e) {
errMsgList.add(e.getMessage());
}
}
if (!errMsgList.isEmpty()) {
throw new JeroBootException(String.join(",", errMsgList));
}
}
}
@@ -69,7 +69,7 @@ en.standard.number.conflict=\u4F01\u6807\u7F16\u53F7\u5DF2\u5B58\u5728\uFF0C\u97
tag.add.error.2=\u6BCF\u5F20\u8868\u6700\u591A\u670950\u4E2A\u5B57\u6BB5\u3002
task.urging.error=\u53EA\u80FD\u50AC\u529E\u5F85\u529E\u4EFB\u52A1
invalid.esp=\u65E0\u6548\u7684\u4F01\u6807\u8BA1\u5212\uFF0C\u8BF7\u91CD\u65B0\u9009\u62E9
can.not.edit.abolish.or.archive.es=\u5DF2\u5E9F\u6B62\u6216\u5DF2\u5F52\u6863\u7684\u4F01\u6807\u8BA1\u5212\u4E0D\u80FD\u7F16\u8F91,\u8BF7\u91CD\u65B0\u9009\u62E9
can.not.edit.abolish.or.archive.es=\u7F16\u53F7\u4E3A{0}\u7684\u4F01\u6807\u5DF2\u7ECF\u5E9F\u6B62\u6216\u8005\u5C01\u5B58\uFF0C\u65E0\u6CD5\u8FDB\u884C\u590D\u5BA1\u6216\u66F4\u6539\u6D41\u7A0B
task.urging.error.2=\u6682\u65E0\u8BE5\u6D41\u7A0B\u50AC\u529E\u6743\u9650
horizontal.transgression.select=\u6682\u65E0\u6743\u9650\uFF0C\u8BF7\u91CD\u65B0\u9009\u62E9
assess.delete.error=\u672A\u7B26\u5408\u9879\u4E2D\u6709\u6574\u6539\u4E2D\u3001\u5BA1\u6279\u4E2D\u7684\u6570\u636E\u65F6\uFF0C\u4E0D\u5141\u8BB8\u5220\u9664
@@ -74,7 +74,7 @@ en.standard.number.conflict=standard number exists
tag.add.error.2=each table can have a maximum of 50 fields.
task.urging.error=Can only remind to do tasks
invalid.esp=Invalid enterprise standard, please check
can.not.edit.abolish.or.archive.es=Can not edit abolished or archived enterprise standards, please check
can.not.edit.abolish.or.archive.es=Can not edit abolished or archived enterprise standards, please check{0}
task.urging.error.2=I currently do not have the authority to urge this process
horizontal.transgression.select=no permission at the moment please reselect
assess.delete.error=When there is data under rectification or approval in the non compliant items, deletion is not allowed
@@ -74,7 +74,7 @@ en.standard.number.conflict=\u4F01\u6807\u7F16\u53F7\u5DF2\u5B58\u5728\uFF0C\u97
tag.add.error.2=\u6BCF\u5F20\u8868\u6700\u591A\u670950\u4E2A\u5B57\u6BB5\u3002
task.urging.error=\u53EA\u80FD\u50AC\u529E\u5F85\u529E\u4EFB\u52A1
invalid.esp=\u65E0\u6548\u7684\u4F01\u6807\u8BA1\u5212\uFF0C\u8BF7\u91CD\u65B0\u9009\u62E9
can.not.edit.abolish.or.archive.es=\u5DF2\u5E9F\u6B62\u6216\u5DF2\u5F52\u6863\u7684\u4F01\u6807\u8BA1\u5212\u4E0D\u80FD\u7F16\u8F91,\u8BF7\u91CD\u65B0\u9009\u62E9
can.not.edit.abolish.or.archive.es=\u7F16\u53F7\u4E3A{0}\u7684\u4F01\u6807\u5DF2\u7ECF\u5E9F\u6B62\u6216\u8005\u5C01\u5B58\uFF0C\u65E0\u6CD5\u8FDB\u884C\u590D\u5BA1\u6216\u66F4\u6539\u6D41\u7A0B
task.urging.error.2=\u6682\u65E0\u8BE5\u6D41\u7A0B\u50AC\u529E\u6743\u9650
horizontal.transgression.select=\u6682\u65E0\u6743\u9650\uFF0C\u8BF7\u91CD\u65B0\u9009\u62E9
assess.delete.error=\u672A\u7B26\u5408\u9879\u4E2D\u6709\u6574\u6539\u4E2D\u3001\u5BA1\u6279\u4E2D\u7684\u6570\u636E\u65F6\uFF0C\u4E0D\u5141\u8BB8\u5220\u9664