|
|
@@ -3,12 +3,15 @@ package com.ningdatech.pmapi.scheduler.task; |
|
|
|
import cn.hutool.core.collection.CollUtil; |
|
|
|
import cn.hutool.core.date.StopWatch; |
|
|
|
import cn.hutool.core.util.IdUtil; |
|
|
|
import com.alibaba.fastjson.JSON; |
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
|
|
|
import com.google.common.collect.Maps; |
|
|
|
import com.ningdatech.basic.exception.BizException; |
|
|
|
import com.ningdatech.pmapi.common.constant.RegionConst; |
|
|
|
import com.ningdatech.pmapi.common.enumeration.ProjectProcessStageEnum; |
|
|
|
import com.ningdatech.pmapi.common.helper.RegionCacheHelper; |
|
|
|
import com.ningdatech.pmapi.scheduler.contants.TaskContant; |
|
|
|
import com.ningdatech.pmapi.sys.model.dto.RegionDTO; |
|
|
|
import com.ningdatech.pmapi.sys.model.entity.Region; |
|
|
|
import com.ningdatech.pmapi.sys.service.IRegionService; |
|
|
|
import com.wflow.bean.dto.WflowModelHistorysDto; |
|
|
@@ -45,16 +48,16 @@ public class InitProcessTask { |
|
|
|
|
|
|
|
private final WflowFormsService formsService; |
|
|
|
|
|
|
|
@Scheduled(cron = "0 22 17 30 1 ?") |
|
|
|
private final RegionCacheHelper regionCacheHelper; |
|
|
|
|
|
|
|
@Scheduled(cron = "0 31 15 07 3 ?") |
|
|
|
public void doTask() throws UnknownHostException { |
|
|
|
if (TaskContant.Host.HOST_ZPF.equals(InetAddress.getLocalHost().getHostName())) { |
|
|
|
log.info("=========== 初始化丽水二期 系统表单和流程配置 ======== 任务开始"); |
|
|
|
StopWatch stopWatch = new StopWatch(); |
|
|
|
stopWatch.start(); |
|
|
|
//1.查出丽水市下的 区县 分别去初始化 表单和流程配置数据 |
|
|
|
List<Region> regions = regionService.list(Wrappers.lambdaQuery(Region.class) |
|
|
|
.eq(Region::getDeleted,Boolean.FALSE) |
|
|
|
.eq(Region::getParentCode, RegionConst.RC_LS)); |
|
|
|
List<RegionDTO> regions = regionCacheHelper.listChildren(RegionConst.RC_LS, RegionConst.RL_COUNTY); |
|
|
|
|
|
|
|
if(CollUtil.isEmpty(regions)){ |
|
|
|
throw new BizException("丽水地区数据为空 任务结束!"); |
|
|
@@ -62,7 +65,7 @@ public class InitProcessTask { |
|
|
|
|
|
|
|
Map<String, WflowForms> formsMap = Maps.newConcurrentMap(); |
|
|
|
//2.首先插入表单默认配置 |
|
|
|
for(Region region : regions){ |
|
|
|
for(RegionDTO region : regions){ |
|
|
|
log.info("当前初始化的是 【{}】 表单信息",region.getRegionName()); |
|
|
|
|
|
|
|
WflowForms existsForm = formsService.getOne(Wrappers.lambdaQuery(WflowForms.class) |
|
|
@@ -90,7 +93,7 @@ public class InitProcessTask { |
|
|
|
} |
|
|
|
|
|
|
|
//3.接着插入流程默认配置 |
|
|
|
for(Region region : regions){ |
|
|
|
for(RegionDTO region : regions){ |
|
|
|
log.info("当前初始化的是 【{}】 流程配置",region.getRegionName()); |
|
|
|
|
|
|
|
if(processModelService.count(Wrappers.lambdaQuery(WflowModels.class) |
|
|
@@ -116,7 +119,8 @@ public class InitProcessTask { |
|
|
|
models.setFormName(formName); |
|
|
|
models.setProcessType(processType); |
|
|
|
models.setRegionCode(region.getRegionCode()); |
|
|
|
ProcessNode processNode = new ProcessNode(); |
|
|
|
String process = "{\"children\":{\"children\":{},\"id\":\"node_039152532706\",\"name\":\"审批人\",\"parentId\":\"root\",\"props\":{\"mode\":\"AND\",\"role\":[],\"refuse\":{\"type\":\"TO_END\",\"target\":\"\"},\"assignedOrg\":[{\"orgName\":\"数转办\",\"orgCode\":\"GO_3bc86256687a4884ae410af00682b762\",\"type\":\"DEFAULT\",\"processDefId\":\"\"}],\"sign\":false,\"assignedType\":\"ASSIGN_ORG\",\"assignedDept\":[]},\"type\":\"SUB\"},\"id\":\"root\",\"name\":\"发起人\",\"props\":{\"formPerms\":[],\"assignedUser\":[]},\"type\":\"ROOT\"}"; |
|
|
|
ProcessNode processNode = JSON.parseObject(process,ProcessNode.class); |
|
|
|
models.setProcess(processNode); |
|
|
|
models.setSettings("{\"sign\":false,\"admin\":[],\"notify\":{},\"commiter\":[]}"); |
|
|
|
models.setFormItems("[]"); |
|
|
|