feat: 批量复审
This commit is contained in:
+2
-2
@@ -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());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+7
@@ -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);
|
||||
|
||||
}
|
||||
|
||||
+67
@@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
+7
-7
@@ -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
|
||||
|
||||
+16
@@ -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();
|
||||
}
|
||||
}
|
||||
+2
-61
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
+5
-6
@@ -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);
|
||||
}
|
||||
|
||||
+6
@@ -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);
|
||||
}
|
||||
|
||||
+31
-3
@@ -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));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user