|
@@ -15,6 +15,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import com.tofly.common.oauth.util.SecurityUtils;
|
|
|
import com.tofly.workflow.baseconf.entity.TfTaskP;
|
|
|
+import com.tofly.workflow.baseconf.entity.dto.ProcessPostDto;
|
|
|
import com.tofly.workflow.baseconf.service.TfTaskPService;
|
|
|
import com.tofly.workflow.buss.entity.TfContractW;
|
|
|
import com.tofly.workflow.buss.entity.TfDesignBudgetW;
|
|
@@ -34,10 +35,12 @@ import com.tofly.workflow.process.service.TfNowHandleLService;
|
|
|
import com.tofly.workflow.process.service.TfProcessLService;
|
|
|
import com.tofly.workflow.process.service.TfProcessNodeLService;
|
|
|
import com.tofly.workflow.processconfig.entity.TfProcessConfigL;
|
|
|
+import com.tofly.workflow.processconfig.entity.TfProcessConfigStepL;
|
|
|
import com.tofly.workflow.processconfig.entity.vo.CTypeVo;
|
|
|
import com.tofly.workflow.processconfig.entity.vo.ServiceImplVo;
|
|
|
import com.tofly.workflow.processconfig.service.TfPageControlLService;
|
|
|
import com.tofly.workflow.processconfig.service.TfProcessConfigLService;
|
|
|
+import com.tofly.workflow.processconfig.service.TfProcessConfigStepLService;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
@@ -97,6 +100,9 @@ public class TfProcessLServiceImpl extends ServiceImpl<TfProcessLMapper, TfProce
|
|
|
private RedisTemplate redisTemplate;
|
|
|
@Autowired
|
|
|
private TfProcessNodeLService tfProcessNodeLService;
|
|
|
+ @Autowired
|
|
|
+ private TfProcessConfigStepLService tfProcessConfigStepLService;
|
|
|
+
|
|
|
/**
|
|
|
* 流程上报保存
|
|
|
* @param dto 工单上报信息
|
|
@@ -270,6 +276,132 @@ public class TfProcessLServiceImpl extends ServiceImpl<TfProcessLMapper, TfProce
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public ProcessVo getTfProcessLAndAuth(ProcessPostDto processDto) {
|
|
|
+ Long id = processDto.getProcessId();
|
|
|
+
|
|
|
+
|
|
|
+ ProcessVo vo = this.baseMapper.getProcessById(id);
|
|
|
+ if(vo==null){
|
|
|
+ return vo;
|
|
|
+ }
|
|
|
+ Long configId = vo.getConfigId();
|
|
|
+ Integer edition = vo.getEdition();
|
|
|
+ Map<String,ServiceImplVo> map =pControlService.getServiceImplByConfig(configId,edition).stream().collect(Collectors.toMap(ServiceImplVo::getNode,r->r));
|
|
|
+
|
|
|
+ if(CollUtil.isNotEmpty(vo.getNodes())&&CollUtil.isNotEmpty(map)){
|
|
|
+ for (ProcessNodeVo pn:vo.getNodes()) {
|
|
|
+ ServiceImplVo si = map.get(pn.getProcessStep()+"_"+pn.getStepNode());
|
|
|
+ if(StringUtils.isNotEmpty(si.getServiceImpls())){
|
|
|
+ Map<String,Object> dtmap = new HashMap<>();
|
|
|
+ for (String str:si.getServiceImpls().split(FlowConstant.CSV)) {
|
|
|
+ BaseService bs = SpringUtil.getBean(str);
|
|
|
+ dtmap.put(str,bs.getBaseDatas(pn.getProcessId(),pn.getId(),vo.getTenantId()));
|
|
|
+ }
|
|
|
+ pn.setDataMap(dtmap);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ Integer nodeType = this.baseMapper.getProcessNodeType(id);
|
|
|
+ if (nodeType!=null && nodeType == 3){
|
|
|
+ ProcessNodeVo processNodes = tfProcessNodeLService.getProcessNodes(id);
|
|
|
+ processNodes.setIsValid((short)1);
|
|
|
+ if(vo.getNodes().get(0)!=null &&vo.getNodes().get(0).getId()>processNodes.getId()){
|
|
|
+
|
|
|
+ }else{
|
|
|
+ vo.getNodes().set(0, processNodes);
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+ List<ProcessNodeVo> nodes = vo.getNodes();
|
|
|
+ //查询用户职位可以查看的步骤
|
|
|
+ String postIds = processDto.getPostIds();
|
|
|
+ List<String> authCollect= new ArrayList<>();
|
|
|
+ if(postIds!=null ){
|
|
|
+ String[] split = postIds.split(",");
|
|
|
+ for (String postId : split) {
|
|
|
+ List<TfProcessConfigStepL> list = tfProcessConfigStepLService.list(Wrappers.<TfProcessConfigStepL>lambdaQuery()
|
|
|
+ .eq(TfProcessConfigStepL::getConfigId, vo.getConfigId())
|
|
|
+ .eq(TfProcessConfigStepL::getEdition, vo.getEdition())
|
|
|
+ .like(TfProcessConfigStepL::getSeeDept, postId));
|
|
|
+
|
|
|
+ List<String> collect1 =
|
|
|
+ list.stream().map(l -> l.getConfigId()+"-" + l.getEdition() +"-"+ l.getStepOrder())
|
|
|
+ .collect(Collectors.toList());
|
|
|
+ authCollect.addAll(collect1);
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ if(!authCollect.isEmpty()){
|
|
|
+ //过滤
|
|
|
+ List<ProcessNodeVo> collect = nodes.stream().filter(processNodeVo -> {
|
|
|
+ String key = processNodeVo.getConfigId()+"-"+processNodeVo.getEdition()+"-"+processNodeVo.getProcessStep();
|
|
|
+
|
|
|
+ return !authCollect.contains(key);
|
|
|
+ }).collect(Collectors.toList());
|
|
|
+
|
|
|
+
|
|
|
+ vo.setNodes(collect);
|
|
|
+ if (CollUtil.isEmpty(collect)) {
|
|
|
+ return vo;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ if ((StringUtils.isNotBlank(nodes.get(0).getPageCode())
|
|
|
+ && !nodes.get(0).getPageCode().equals("contractCheck_addProject")
|
|
|
+ && !nodes.get(0).getPageCode().equals("designBudget_addBudget"))
|
|
|
+ || StringUtils.isBlank(nodes.get(0).getPageCode())) {
|
|
|
+ return vo;
|
|
|
+ }
|
|
|
+ if (nodes.get(0).getPageCode().equals("contractCheck_addProject")
|
|
|
+ && CollUtil.isEmpty((List<TfContractW>) nodes.get(0).getDataMap().get("tfContractWService"))) {
|
|
|
+ List<ProcessNodeVo> midNodes = new ArrayList<>();
|
|
|
+ nodes.forEach(node -> {
|
|
|
+ if (StringUtils.isNotEmpty(node.getPageCode())
|
|
|
+ && node.getPageCode().equals("contractCheck_addProject")
|
|
|
+ && node.getIsValid() != null
|
|
|
+ && node.getIsValid() == (short) 0) {
|
|
|
+ midNodes.add(node);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ if (CollUtil.isNotEmpty(midNodes)) {
|
|
|
+ ProcessNodeVo resNode = midNodes.get(0);
|
|
|
+ resNode.setId(null);
|
|
|
+ resNode.setIsValid((short) 1);
|
|
|
+ resNode.setIsValidName("有效");
|
|
|
+ nodes.set(0, resNode);
|
|
|
+ }
|
|
|
+ vo.setNodes(nodes);
|
|
|
+ return vo;
|
|
|
+ } else if (nodes.get(0).getPageCode().equals("designBudget_addBudget")
|
|
|
+ && CollUtil.isEmpty((List<TfDesignBudgetW>) nodes.get(0).getDataMap().get("tfDesignBudgetWService"))) {
|
|
|
+ List<ProcessNodeVo> midNodes = new ArrayList<>();
|
|
|
+ nodes.forEach(node -> {
|
|
|
+ if (StringUtils.isNotEmpty(node.getPageCode())
|
|
|
+ && node.getPageCode().equals("designBudget_addBudget")
|
|
|
+ && node.getIsValid() != null
|
|
|
+ && node.getIsValid() == (short) 0) {
|
|
|
+ midNodes.add(node);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ if (CollUtil.isNotEmpty(midNodes)) {
|
|
|
+ ProcessNodeVo resNode = midNodes.get(0);
|
|
|
+ resNode.setId(null);
|
|
|
+ resNode.setIsValid((short) 1);
|
|
|
+ resNode.setIsValidName("有效");
|
|
|
+ nodes.set(0, resNode);
|
|
|
+ }
|
|
|
+ vo.setNodes(nodes);
|
|
|
+ return vo;
|
|
|
+ } else {
|
|
|
+ return vo;
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
/**
|
|
|
* 根据ID获取流程数据
|
|
|
* @return 流程数据
|
|
@@ -383,6 +515,17 @@ public class TfProcessLServiceImpl extends ServiceImpl<TfProcessLMapper, TfProce
|
|
|
return baseMapper.getProcessIdWithOutPush();
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public Date findProcessLastCheckTime(Long processId,Long label) {
|
|
|
+ return baseMapper.findProcessLastCheckTime(processId,label);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public Date findCompleteTime(Long processId) {
|
|
|
+ return baseMapper.findCompleteTime(processId);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
/**
|
|
|
* 终止流程
|
|
|
* @param id 终止申请流程id
|
|
@@ -504,9 +647,14 @@ public class TfProcessLServiceImpl extends ServiceImpl<TfProcessLMapper, TfProce
|
|
|
.eq(TfProcessConfigL::getTenantId, SecurityUtils.getTenantId()).eq(TfProcessConfigL::getIsDel,FlowConstant.SHORT_ZERO)
|
|
|
.eq(TfProcessConfigL::getIsMould,FlowConstant.SHORT_ZERO).eq(TfProcessConfigL::getIsValid,FlowConstant.SHORT_ONE)
|
|
|
.select(TfProcessConfigL::getEdition),r-> r==null?null:Integer.valueOf(r.toString()));
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
if(edition == null){
|
|
|
return FlowConstant.CONFIG_NOT_EXIST;
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
}
|
|
|
|
|
|
/**流程名称校验*/
|
|
@@ -530,6 +678,35 @@ public class TfProcessLServiceImpl extends ServiceImpl<TfProcessLMapper, TfProce
|
|
|
return check;
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 特殊判断 管控流程 需要对应主流程 领料完成
|
|
|
+ */
|
|
|
+ //判断绵竹中民
|
|
|
+ TfProcessConfigL tfProcessConfigL = pConfigService.getOne(Wrappers.<TfProcessConfigL>lambdaQuery()
|
|
|
+ .eq(TfProcessConfigL::getId, dto.getConfigId())
|
|
|
+ .eq(TfProcessConfigL::getTenantId, SecurityUtils.getTenantId())
|
|
|
+ .eq(TfProcessConfigL::getIsDel, FlowConstant.SHORT_ZERO)
|
|
|
+ .eq(TfProcessConfigL::getIsMould, FlowConstant.SHORT_ZERO)
|
|
|
+ .eq(TfProcessConfigL::getIsValid, FlowConstant.SHORT_ONE));
|
|
|
+ if(tfProcessConfigL!=null){
|
|
|
+ //如果是工程管控流程
|
|
|
+ if(tfProcessConfigL.getProcessName().indexOf("工程管控")>0) {
|
|
|
+ //验证该流程对应的领料是否完成
|
|
|
+ int gcll = this.count(Wrappers.<TfProcessL>lambdaQuery()
|
|
|
+ .eq(TfProcessL::getRelationId, dto.getRelationId())
|
|
|
+ .like(TfProcessL::getProcessNumber, "gcll")
|
|
|
+ .eq(TfProcessL::getIsDel, FlowConstant.SHORT_ZERO)
|
|
|
+ .ne(TfProcessL::getProcessState, FlowConstant.SHORT_FOUR)
|
|
|
+ );
|
|
|
+ if(gcll>0){
|
|
|
+ return FlowConstant.WORK_LL_PROCESS;
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
return null;
|
|
|
}
|
|
|
|