Commit d86a5271 authored by hezhuozhi's avatar hezhuozhi

26854 【智信户用(管理端)】迁移工作台相关代码

parent c05bc689
package com.yeejoin.amos.boot.module.hygf.api.Enum;
import lombok.AllArgsConstructor;
import lombok.Getter;
/**
* 此处是为了待办提供的流程状态 提供流程Key对应此时流程的状态名称
*/
@Getter
@AllArgsConstructor
public enum FlowKeyTodoEnum {
TSRZ(1001, "待推送", "AbarbeitungWaitPush", "推送融资"),
JXSZG(1002, "待整改", "WaitAbarbeitung", "经销商整改"),
RZSH(1003, "待审核", "FinancingAudit", "融资审核"),
XXFK(1004, "待放款", "AuditPass", "线下放款"),
JXSGLYSH(1005, "待经销商管理员审核", "jxs_03", "经销商管理员审核"),
;
private final int code;
private final String dealName;
private final String flowNodeKey;
private final String flowNodeName;
public static FlowKeyTodoEnum getEumByFlowNodeKey(String flowNodeKey) {
for (FlowKeyTodoEnum statusEnum : FlowKeyTodoEnum.values()) {
if (statusEnum.getFlowNodeKey().equals(flowNodeKey)) {
return statusEnum;
}
}
return null;
}
}
\ No newline at end of file
...@@ -2,6 +2,8 @@ package com.yeejoin.amos.boot.module.hygf.api.dto; ...@@ -2,6 +2,8 @@ package com.yeejoin.amos.boot.module.hygf.api.dto;
import lombok.Data; import lombok.Data;
import java.util.Date;
@Data @Data
public class WorkflowResultDto { public class WorkflowResultDto {
...@@ -11,11 +13,6 @@ public class WorkflowResultDto { ...@@ -11,11 +13,6 @@ public class WorkflowResultDto {
*/ */
String instanceId; String instanceId;
// /**
// * 执行人角色
// */
// String nextExecutorIds;
String executorId; String executorId;
...@@ -49,4 +46,22 @@ public class WorkflowResultDto { ...@@ -49,4 +46,22 @@ public class WorkflowResultDto {
String nextNodeKey; String nextNodeKey;
/**
* 任务发起人id 不变 第一次提交的人
* 从业务表中 created_uesr_id
*/
private String startUserId;
/**
* 任务发起人名称 不变
* 名字
*/
private String startUser;
/**
* 任务发起人所在单位 不变
*/
private String startUserCompanyName;
/**
* 任务发起人发起时间 不变
*/
private Date startDate;
} }
...@@ -3,7 +3,6 @@ package com.yeejoin.amos.boot.module.hygf.biz.service.impl; ...@@ -3,7 +3,6 @@ package com.yeejoin.amos.boot.module.hygf.biz.service.impl;
import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.collection.CollectionUtil;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
...@@ -17,11 +16,9 @@ import com.yeejoin.amos.boot.biz.common.utils.RedisUtils; ...@@ -17,11 +16,9 @@ import com.yeejoin.amos.boot.biz.common.utils.RedisUtils;
import com.yeejoin.amos.boot.module.hygf.api.Enum.BusinessTypeEnum; import com.yeejoin.amos.boot.module.hygf.api.Enum.BusinessTypeEnum;
import com.yeejoin.amos.boot.module.hygf.api.Enum.FinancingAuditEnum; import com.yeejoin.amos.boot.module.hygf.api.Enum.FinancingAuditEnum;
import com.yeejoin.amos.boot.module.hygf.api.Enum.FlowStatusEnum; import com.yeejoin.amos.boot.module.hygf.api.Enum.FlowStatusEnum;
import com.yeejoin.amos.boot.module.hygf.api.Enum.TaskStatusEnum;
import com.yeejoin.amos.boot.module.hygf.api.config.UserLimits; import com.yeejoin.amos.boot.module.hygf.api.config.UserLimits;
import com.yeejoin.amos.boot.module.hygf.api.dto.FinancingAuditingDto; import com.yeejoin.amos.boot.module.hygf.api.dto.FinancingAuditingDto;
import com.yeejoin.amos.boot.module.hygf.api.dto.FinancingInfoDto; import com.yeejoin.amos.boot.module.hygf.api.dto.FinancingInfoDto;
import com.yeejoin.amos.boot.module.hygf.api.dto.TaskModelDto;
import com.yeejoin.amos.boot.module.hygf.api.dto.WorkflowResultDto; import com.yeejoin.amos.boot.module.hygf.api.dto.WorkflowResultDto;
import com.yeejoin.amos.boot.module.hygf.api.entity.FinancingAuditing; import com.yeejoin.amos.boot.module.hygf.api.entity.FinancingAuditing;
import com.yeejoin.amos.boot.module.hygf.api.entity.FinancingInfo; import com.yeejoin.amos.boot.module.hygf.api.entity.FinancingInfo;
...@@ -37,7 +34,6 @@ import io.seata.spring.annotation.GlobalTransactional; ...@@ -37,7 +34,6 @@ import io.seata.spring.annotation.GlobalTransactional;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.typroject.tyboot.core.foundation.context.RequestContext; import org.typroject.tyboot.core.foundation.context.RequestContext;
import org.typroject.tyboot.core.rdbms.service.BaseService; import org.typroject.tyboot.core.rdbms.service.BaseService;
...@@ -51,7 +47,6 @@ import java.util.*; ...@@ -51,7 +47,6 @@ import java.util.*;
*/ */
@Service @Service
public class FinancingInfoServiceImpl extends BaseService<FinancingInfoDto, FinancingInfo, FinancingInfoMapper> implements IFinancingInfoService { public class FinancingInfoServiceImpl extends BaseService<FinancingInfoDto, FinancingInfo, FinancingInfoMapper> implements IFinancingInfoService {
private static String PROCESSKEY = "StationFinancing";
@Autowired @Autowired
RedisUtils redisUtils; RedisUtils redisUtils;
/** /**
...@@ -61,8 +56,8 @@ public class FinancingInfoServiceImpl extends BaseService<FinancingInfoDto, Fina ...@@ -61,8 +56,8 @@ public class FinancingInfoServiceImpl extends BaseService<FinancingInfoDto, Fina
private FinancingInfoMapper financingInfoMapper; private FinancingInfoMapper financingInfoMapper;
@Autowired @Autowired
private WorkFlowService workFlowService; private WorkFlowService workFlowService;
@Autowired // @Autowired
private WorkflowImpl workflow; // private WorkflowImpl workflow;
@Autowired @Autowired
private FinancingAuditingServiceImpl financingAuditingService; private FinancingAuditingServiceImpl financingAuditingService;
@Autowired @Autowired
...@@ -145,7 +140,7 @@ public class FinancingInfoServiceImpl extends BaseService<FinancingInfoDto, Fina ...@@ -145,7 +140,7 @@ public class FinancingInfoServiceImpl extends BaseService<FinancingInfoDto, Fina
ActWorkflowBatchDTO actWorkflowBatchDTO = new ActWorkflowBatchDTO(); ActWorkflowBatchDTO actWorkflowBatchDTO = new ActWorkflowBatchDTO();
List<ActWorkflowStartDTO> list = new ArrayList<>(); List<ActWorkflowStartDTO> list = new ArrayList<>();
ActWorkflowStartDTO dto = new ActWorkflowStartDTO(); ActWorkflowStartDTO dto = new ActWorkflowStartDTO();
dto.setProcessDefinitionKey(PROCESSKEY); dto.setProcessDefinitionKey(BusinessTypeEnum.HYGF_DZTRRZ.getCode());
Date date = new Date(); Date date = new Date();
dto.setBusinessKey(String.valueOf(date.getTime())); dto.setBusinessKey(String.valueOf(date.getTime()));
dto.setCompleteFirstTask(true); dto.setCompleteFirstTask(true);
...@@ -164,44 +159,16 @@ public class FinancingInfoServiceImpl extends BaseService<FinancingInfoDto, Fina ...@@ -164,44 +159,16 @@ public class FinancingInfoServiceImpl extends BaseService<FinancingInfoDto, Fina
financingAuditingDto.setPromoter(RequestContext.getExeUserId()); financingAuditingDto.setPromoter(RequestContext.getExeUserId());
financingAuditingService.createWithModel(financingAuditingDto); financingAuditingService.createWithModel(financingAuditingDto);
//发起待办 //发起待办
// commonService.buildTaskModel(buildDZTRZTaskModel(model, workflowResultDto, date)); FinancingInfo newFinancingInfo = new FinancingInfo();
BeanUtils.copyProperties(model, newFinancingInfo);
newFinancingInfo.setStatus(FinancingAuditEnum.待融资审核.getName());
commonService.buildTaskModel(commonService.buildTaskModelDto(newFinancingInfo, workflowResultDto, BusinessTypeEnum.HYGF_DZTRRZ));
}); });
return model; return model;
} }
private List<TaskModelDto> buildDZTRZTaskModel(FinancingInfoDto model, WorkflowResultDto workflowResultDto, Date startDate) {
ReginParams reginParams = JSONObject.parseObject(redisUtils.get(RedisKey.buildReginKey(RequestContext.getExeUserId(), RequestContext.getToken())).toString(), ReginParams.class);
List<TaskModelDto> taskModelDtoList = new ArrayList<>();
TaskModelDto taskModelDto = new TaskModelDto();
taskModelDto.setFlowCode(workflowResultDto.getNextTaskId());
taskModelDto.setFlowCreateDate(new Date());
taskModelDto.setFlowStatus(FlowStatusEnum.TO_BE_PROCESSED.getCode());
taskModelDto.setFlowStatusLabel(FlowStatusEnum.TO_BE_PROCESSED.getName());
taskModelDto.setPageType(null);
taskModelDto.setExecuteUserIds(workflowResultDto.getNextExecuteUserIds());
taskModelDto.setModel(model);
taskModelDto.setRelationId(workflowResultDto.getInstanceId());
taskModelDto.setRoutePath(null);
taskModelDto.setStartUserId(reginParams.getUserModel().getUserId());
taskModelDto.setStartUser(reginParams.getUserModel().getUserName());
taskModelDto.setStartDate(startDate);
taskModelDto.setStartUserCompanyName(null);
taskModelDto.setTaskName(workflowResultDto.getNextNodeName());
taskModelDto.setTaskCode(workflowResultDto.getNextNodeCode());
taskModelDto.setTaskType(BusinessTypeEnum.HYGF_DZTRRZ.getCode());
taskModelDto.setTaskTypeLabel(BusinessTypeEnum.HYGF_DZTRRZ.getName());
taskModelDto.setTaskStatus(TaskStatusEnum.UNDERWAY.getValue());
taskModelDto.setTaskStatusLabel(TaskStatusEnum.UNDERWAY.getName());
// taskModelDto.setTaskDesc();
// taskModelDto.setTaskContent();
taskModelDto.setNextExecuteUser(workflowResultDto.getNextExecutorIds());
taskModelDtoList.add(taskModelDto);
return taskModelDtoList;
}
@Override @Override
@GlobalTransactional @GlobalTransactional
public void rollback(String processId, String peasantHouseholdId) { public void rollback(String processId, String peasantHouseholdId) {
...@@ -219,7 +186,7 @@ public class FinancingInfoServiceImpl extends BaseService<FinancingInfoDto, Fina ...@@ -219,7 +186,7 @@ public class FinancingInfoServiceImpl extends BaseService<FinancingInfoDto, Fina
this.updateById(financingInfo); this.updateById(financingInfo);
} }
//停止流程 //停止流程
// commonService.rollbackTask(); commonService.deleteTaskModel(processId);
} }
@Override @Override
...@@ -267,6 +234,7 @@ public class FinancingInfoServiceImpl extends BaseService<FinancingInfoDto, Fina ...@@ -267,6 +234,7 @@ public class FinancingInfoServiceImpl extends BaseService<FinancingInfoDto, Fina
financingAuditingDto.setPromoter(financingAuditing.getPromoter()); financingAuditingDto.setPromoter(financingAuditing.getPromoter());
if (null == financingAuditingDto.getInstanceId()) { if (null == financingAuditingDto.getInstanceId()) {
financingAuditingDto.setInstanceId(financingAuditing.getInstanceId()); financingAuditingDto.setInstanceId(financingAuditing.getInstanceId());
workflowResultDto.setInstanceId(financingAuditing.getInstanceId());
} }
financingAuditingDto.setStatus(params.getOrDefault("comments", "").toString()); financingAuditingDto.setStatus(params.getOrDefault("comments", "").toString());
financingAuditingDto.setNodeRouting(FinancingAuditEnum.getNodeByCode(workflowResultDto.getNextNodeKey())); financingAuditingDto.setNodeRouting(FinancingAuditEnum.getNodeByCode(workflowResultDto.getNextNodeKey()));
...@@ -288,7 +256,8 @@ public class FinancingInfoServiceImpl extends BaseService<FinancingInfoDto, Fina ...@@ -288,7 +256,8 @@ public class FinancingInfoServiceImpl extends BaseService<FinancingInfoDto, Fina
financingInfo.setStatus(statusName); financingInfo.setStatus(statusName);
} }
this.updateById(financingInfo); this.updateById(financingInfo);
//更新待办
updateFinancingInfoTask(financingInfo, workflowResultDto);
//节点为待整改时生成整改单 //节点为待整改时生成整改单
if (params.containsKey("isFlag") && params.get("isFlag").equals("1") && workflowResultDto.getNextNodeKey().equals(FinancingAuditEnum.待整改.getCode())) { if (params.containsKey("isFlag") && params.get("isFlag").equals("1") && workflowResultDto.getNextNodeKey().equals(FinancingAuditEnum.待整改.getCode())) {
...@@ -316,27 +285,24 @@ public class FinancingInfoServiceImpl extends BaseService<FinancingInfoDto, Fina ...@@ -316,27 +285,24 @@ public class FinancingInfoServiceImpl extends BaseService<FinancingInfoDto, Fina
financingRectificationOrder.setResponsibleUserPhone(params.getOrDefault("responsibleUserPhone", "").toString()); financingRectificationOrder.setResponsibleUserPhone(params.getOrDefault("responsibleUserPhone", "").toString());
financingRectificationOrderService.save(financingRectificationOrder); financingRectificationOrderService.save(financingRectificationOrder);
} }
//更新待办
// commonService.updateTaskModelNew(buildDZTRZUpdateTaskParams(params,financingAuditing));
} }
private Map<String, Object> buildDZTRZUpdateTaskParams(Map<String, Object> params, FinancingAuditing financingAuditing) { /**
Map<String, Object> map = new HashMap<>(); * 此处先更新完成待办然后在新增待办
if ("0".equals(params.get("approvalStatus"))) { * @param financingInfo
map.put("flowStatus", FlowStatusEnum.TO_BE_FINISHED.getCode()); * @param workflowResultDto
map.put("flowStatusLabel", FlowStatusEnum.TO_BE_FINISHED.getName()); */
map.put("taskStatus", FlowStatusEnum.TO_BE_FINISHED.getCode()); private void updateFinancingInfoTask(FinancingInfo financingInfo, WorkflowResultDto workflowResultDto) {
map.put("taskStatusLabel", FlowStatusEnum.TO_BE_FINISHED.getName()); Map<String, Object> updateTaskParam = new HashMap<>();
} else { updateTaskParam.put("flowStatus", FlowStatusEnum.TO_BE_FINISHED.getCode());
map.put("flowStatus", FlowStatusEnum.TO_BE_PROCESSED.getCode()); updateTaskParam.put("flowStatusLabel", FlowStatusEnum.TO_BE_FINISHED.getName());
map.put("flowStatusLabel", FlowStatusEnum.TO_BE_PROCESSED.getName()); updateTaskParam.put("taskStatus", FlowStatusEnum.TO_BE_FINISHED.getCode());
map.put("taskStatus", FlowStatusEnum.TO_BE_PROCESSED.getCode()); updateTaskParam.put("taskStatusLabel", FlowStatusEnum.TO_BE_FINISHED.getName());
map.put("taskStatusLabel", FlowStatusEnum.TO_BE_PROCESSED.getName()); updateTaskParam.put("model", financingInfo);
} updateTaskParam.put("relationId", workflowResultDto.getInstanceId());
map.put("model", financingAuditing); commonService.updateTaskModel(updateTaskParam);
map.put("relationId", financingAuditing.getInstanceId()); commonService.buildTaskModel((commonService.buildTaskModelDto(financingInfo, workflowResultDto, BusinessTypeEnum.HYGF_DZTRRZ)));
return map;
} }
public List<Map<String, Object>> selectOrgList() { public List<Map<String, Object>> selectOrgList() {
......
...@@ -3,7 +3,6 @@ package com.yeejoin.amos.boot.module.hygf.biz.service.impl; ...@@ -3,7 +3,6 @@ package com.yeejoin.amos.boot.module.hygf.biz.service.impl;
import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.collection.CollectionUtil;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
...@@ -24,6 +23,10 @@ import com.yeejoin.amos.component.robot.AmosRequestContext; ...@@ -24,6 +23,10 @@ import com.yeejoin.amos.component.robot.AmosRequestContext;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel; import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import com.yeejoin.amos.feign.systemctl.Systemctl; import com.yeejoin.amos.feign.systemctl.Systemctl;
import com.yeejoin.amos.feign.systemctl.model.RegionModel; import com.yeejoin.amos.feign.systemctl.model.RegionModel;
import com.yeejoin.amos.feign.workflow.model.ActWorkflowBatchDTO;
import com.yeejoin.amos.feign.workflow.model.ActWorkflowStartDTO;
import com.yeejoin.amos.feign.workflow.model.ProcessTaskDTO;
import com.yeejoin.amos.feign.workflow.model.TaskResultDTO;
import io.seata.spring.annotation.GlobalTransactional; import io.seata.spring.annotation.GlobalTransactional;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.ObjectUtils; import org.apache.commons.lang3.ObjectUtils;
...@@ -32,15 +35,12 @@ import org.springframework.beans.BeanUtils; ...@@ -32,15 +35,12 @@ import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.typroject.tyboot.component.emq.EmqKeeper; import org.typroject.tyboot.component.emq.EmqKeeper;
import org.typroject.tyboot.core.foundation.exception.BaseException; import org.typroject.tyboot.core.foundation.exception.BaseException;
import org.typroject.tyboot.core.rdbms.service.BaseService; import org.typroject.tyboot.core.rdbms.service.BaseService;
import org.typroject.tyboot.core.restful.exception.instance.BadRequest; import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
import java.util.*; import java.util.*;
import java.util.stream.Collectors;
import java.util.stream.Stream;
/** /**
* 勘察信息服务实现类 * 勘察信息服务实现类
...@@ -54,30 +54,28 @@ public class SurveyInformationServiceImpl ...@@ -54,30 +54,28 @@ public class SurveyInformationServiceImpl
extends BaseService<SurveyInformationDto, SurveyInformation, SurveyInformationMapper> extends BaseService<SurveyInformationDto, SurveyInformation, SurveyInformationMapper>
implements ISurveyInformationService { implements ISurveyInformationService {
private static final String regionRedis = "app_region_redis";
private static final String OPERATION_TYPE_SUBMIT = "submit";
private static final String OPERATION_TYPE_APPLY = "apply";
private static final String IDX_REQUEST_STATE = "200";
@Autowired
protected EmqKeeper emqKeeper;
@Autowired @Autowired
SurveyDetailsServiceImpl surveyDetailsService; SurveyDetailsServiceImpl surveyDetailsService;
@Autowired @Autowired
InformationServiceImpl informationService; InformationServiceImpl informationService;
@Autowired @Autowired
ExtendedInformationServiceImpl extendedInformationService; ExtendedInformationServiceImpl extendedInformationService;
@Autowired @Autowired
CommercialServiceImpl commercialService; CommercialServiceImpl commercialService;
@Autowired @Autowired
PeasantHouseholdServiceImpl peasantHouseholdServiceImpl; PeasantHouseholdServiceImpl peasantHouseholdServiceImpl;
@Autowired @Autowired
DesignInformationServiceImpl designInformationService; DesignInformationServiceImpl designInformationService;
@Autowired @Autowired
WorkflowFeignClient workflowFeignClient; WorkflowFeignClient workflowFeignClient;
@Autowired @Autowired
RedisUtils redisUtils; RedisUtils redisUtils;
@Autowired @Autowired
IdxFeginService idxFeginService; IdxFeginService idxFeginService;
@Autowired @Autowired
...@@ -88,22 +86,10 @@ public class SurveyInformationServiceImpl ...@@ -88,22 +86,10 @@ public class SurveyInformationServiceImpl
ToDoTasksMapper toDoTasksMapper; ToDoTasksMapper toDoTasksMapper;
@Autowired @Autowired
UserMessageMapper userMessageMapper; UserMessageMapper userMessageMapper;
@Value("${power.station.examine.pageId}")
private long pageId;
@Autowired
protected EmqKeeper emqKeeper;
@Value("${power.station.examine.planId}")
private String planId;
private static final String regionRedis = "app_region_redis";
private static final String OPERATION_TYPE_SUBMIT = "submit";
private static final String OPERATION_TYPE_APPLY = "apply";
private static final String IDX_REQUEST_STATE = "200";
@Autowired @Autowired
PersonnelBusinessMapper personnelBusinessMapper; PersonnelBusinessMapper personnelBusinessMapper;
@Autowired @Autowired
PeasantHouseholdMapper peasantHouseholdMapper; PeasantHouseholdMapper peasantHouseholdMapper;
@Autowired @Autowired
WorkOrderMapper workOrderMapper; WorkOrderMapper workOrderMapper;
@Autowired @Autowired
...@@ -114,7 +100,6 @@ public class SurveyInformationServiceImpl ...@@ -114,7 +100,6 @@ public class SurveyInformationServiceImpl
ConstructionRecordsMapper constructionRecordsMapper; ConstructionRecordsMapper constructionRecordsMapper;
@Autowired @Autowired
BasicGridAcceptanceMapper basicGridAcceptanceMapper; BasicGridAcceptanceMapper basicGridAcceptanceMapper;
@Autowired @Autowired
SurveyInformationMapper surveyInformationMapper; SurveyInformationMapper surveyInformationMapper;
@Autowired @Autowired
...@@ -125,9 +110,16 @@ public class SurveyInformationServiceImpl ...@@ -125,9 +110,16 @@ public class SurveyInformationServiceImpl
WorkOrderPowerStationMapper workOrderPowerStationMapper; WorkOrderPowerStationMapper workOrderPowerStationMapper;
@Autowired @Autowired
AmosRequestContext requestContext; AmosRequestContext requestContext;
// @Autowired
// WorkflowImpl workflow;
@Autowired @Autowired
WorkflowImpl workflow; CommonServiceImpl commonService;
@Autowired
WorkFlowService workFlowService;
@Value("${power.station.examine.pageId}")
private long pageId;
@Value("${power.station.examine.planId}")
private String planId;
/** /**
* 分页查询 * 分页查询
...@@ -313,28 +305,50 @@ public class SurveyInformationServiceImpl ...@@ -313,28 +305,50 @@ public class SurveyInformationServiceImpl
try { try {
BasicGridAcceptance basicGridAcceptance = new BasicGridAcceptance(); BasicGridAcceptance basicGridAcceptance = new BasicGridAcceptance();
List<ProcessTaskDTO> processTaskDTOS = new ArrayList();
if (ObjectUtils.isNotEmpty(powerStation)) { if (ObjectUtils.isNotEmpty(powerStation)) {
// 工作流执行一步 // 工作流执行一步
// taskId = powerStation.getTaskId(); // taskId = powerStation.getTaskId();
StandardDto standardDto = new StandardDto(); // StandardDto standardDto = new StandardDto();
standardDto.setResult("0"); // standardDto.setResult("0");
standardDto.setTaskId(powerStation.getFlowTaskId()); // standardDto.setTaskId(powerStation.getFlowTaskId());
VariableDto variable = new VariableDto(); // VariableDto variable = new VariableDto();
variable.setApprovalStatus("0"); // variable.setApprovalStatus("0");
standardDto.setVariable(variable); // standardDto.setVariable(variable);
workflow.standard(basicGridAcceptance, standardDto, requestContext.getUserId()); // workflow.standard(basicGridAcceptance, standardDto, requestContext.getUserId());
//执行流程
TaskResultDTO taskResultDTO = new TaskResultDTO();
taskResultDTO.setResult("0");
taskResultDTO.setTaskId(powerStation.getFlowTaskId());
HashMap<String, Object> variableMap = new HashMap<>();
variableMap.put("approvalStatus", "0");
taskResultDTO.setVariable(variableMap);
ProcessTaskDTO processTaskDTO = workFlowService.standard(basicGridAcceptance, taskResultDTO, requestContext.getUserId());
processTaskDTOS.add(processTaskDTO);
} else { } else {
// 第一步启动工作流 // 第一步启动工作流
// 发起工作流 // 发起工作流
// 调用工作流执行第一个节点 // 调用工作流执行第一个节点
ProcessDto processDto = new ProcessDto(); // ProcessDto processDto = new ProcessDto();
processDto.setBusinessKey(String.valueOf(peasantHousehold.getSequenceNbr())); // processDto.setBusinessKey(String.valueOf(peasantHousehold.getSequenceNbr()));
processDto.setProcessDefinitionKey("hygf_10001"); // processDto.setProcessDefinitionKey("hygf_10001");
StartProcessDto startProcessDto = new StartProcessDto(); // StartProcessDto startProcessDto = new StartProcessDto();
List<ProcessDto> process = new ArrayList<>(); // List<ProcessDto> process = new ArrayList<>();
process.add(processDto); // process.add(processDto);
startProcessDto.setProcess(process); // startProcessDto.setProcess(process);
workflow.startProcess(basicGridAcceptance, startProcessDto, requestContext.getUserId()); // workflow.startProcess(basicGridAcceptance, startProcessDto, requestContext.getUserId());
//开启工作流 并执行一步
ActWorkflowBatchDTO actWorkflowBatchDTO = new ActWorkflowBatchDTO();
List<ActWorkflowStartDTO> list = new ArrayList<>();
ActWorkflowStartDTO dto = new ActWorkflowStartDTO();
dto.setProcessDefinitionKey(BusinessTypeEnum.HYGF_DZ_SH.getCode());
dto.setBusinessKey(String.valueOf(peasantHousehold.getSequenceNbr()));
dto.setCompleteFirstTask(true);
list.add(dto);
actWorkflowBatchDTO.setProcess(list);
processTaskDTOS = workFlowService.startBatch(actWorkflowBatchDTO);
basicGridAcceptance = workFlowService.getBasicGridAcceptance(basicGridAcceptance, processTaskDTOS, requestContext.getUserId());
powerStation = new PowerStation(); powerStation = new PowerStation();
} }
peasantHousehold.setSurveyOrNot(2); peasantHousehold.setSurveyOrNot(2);
...@@ -366,6 +380,8 @@ public class SurveyInformationServiceImpl ...@@ -366,6 +380,8 @@ public class SurveyInformationServiceImpl
long idsk = peasantHousehold.getSequenceNbr(); long idsk = peasantHousehold.getSequenceNbr();
up.eq(PeasantHousehold::getSequenceNbr, idsk); up.eq(PeasantHousehold::getSequenceNbr, idsk);
peasantHouseholdMapper.update(null, up); peasantHouseholdMapper.update(null, up);
List<WorkflowResultDto> workflowResultDtos = workFlowService.buildWorkFlowInfo(processTaskDTOS);
commonService.buildTaskModel(commonService.buildTaskModelDto(powerStation, workflowResultDtos.get(0), BusinessTypeEnum.HYGF_DZ_SH));
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
...@@ -420,6 +436,7 @@ public class SurveyInformationServiceImpl ...@@ -420,6 +436,7 @@ public class SurveyInformationServiceImpl
// } // }
} }
public SurveyInfoAllDto querySurveyInfo(String surveyInformationId, String peasantHouseholdId, public SurveyInfoAllDto querySurveyInfo(String surveyInformationId, String peasantHouseholdId,
String processInstanceId, AgencyUserModel userInfo) { String processInstanceId, AgencyUserModel userInfo) {
......
...@@ -2,10 +2,10 @@ package com.yeejoin.amos.boot.module.hygf.biz.service.impl; ...@@ -2,10 +2,10 @@ package com.yeejoin.amos.boot.module.hygf.biz.service.impl;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.yeejoin.amos.boot.module.hygf.api.dto.WorkflowResultDto; import com.yeejoin.amos.boot.module.hygf.api.dto.WorkflowResultDto;
import com.yeejoin.amos.boot.module.hygf.api.entity.BasicGridAcceptance;
import com.yeejoin.amos.boot.module.hygf.biz.feign.WorkFlowFeignService; import com.yeejoin.amos.boot.module.hygf.biz.feign.WorkFlowFeignService;
import com.yeejoin.amos.component.feign.utils.FeignUtil;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel; import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import com.yeejoin.amos.feign.workflow.Workflow; import com.yeejoin.amos.feign.privilege.model.CompanyModel;
import com.yeejoin.amos.feign.workflow.model.*; import com.yeejoin.amos.feign.workflow.model.*;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -13,7 +13,9 @@ import org.springframework.stereotype.Service; ...@@ -13,7 +13,9 @@ import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors; import java.util.stream.Collectors;
...@@ -39,12 +41,27 @@ public class WorkFlowService { ...@@ -39,12 +41,27 @@ public class WorkFlowService {
return processTasks; return processTasks;
} }
/***
* 开启并执行一步 支持批量
*
* */
public List<ProcessTaskDTO> startBatchNew(String appKey, String product, String token, ActWorkflowBatchDTO params) {
List<ProcessTaskDTO> processTasks;
try {
log.info("开始前请求工作流启动接口:/start/batch,appKey:{},product:{},token:{}请求请求参数:{}", appKey, product, token, JSONObject.toJSONString(params));
processTasks = workFlowFeignService.startForBatchNew(appKey, product, token, params).getResult();
} catch (Exception e) {
log.error("调用工作流批量启动失败", e);
throw new RuntimeException("调用工作流批量启动失败");
}
return processTasks;
}
public ProcessInstanceDTO stopProcess(String processInstanceId) { public ProcessInstanceDTO stopProcess(String processInstanceId) {
ProcessInstanceDTO processInstanceDTO ; ProcessInstanceDTO processInstanceDTO;
try { try {
log.info("开始前请求工作流停止接口:stopProcess,请求参数:{}", processInstanceId); log.info("开始前请求工作流停止接口:stopProcess,请求参数:{}", processInstanceId);
processInstanceDTO = workFlowFeignService.stopProcess(processInstanceId,null).getResult(); processInstanceDTO = workFlowFeignService.stopProcess(processInstanceId, null).getResult();
} catch (Exception e) { } catch (Exception e) {
log.error("调用工作流批量停止失败", e); log.error("调用工作流批量停止失败", e);
throw new RuntimeException("调用工作流批量停止失败"); throw new RuntimeException("调用工作流批量停止失败");
...@@ -53,6 +70,18 @@ public class WorkFlowService { ...@@ -53,6 +70,18 @@ public class WorkFlowService {
} }
public ProcessTaskDTO standard(BasicGridAcceptance basicGridAcceptance, TaskResultDTO taskResultDTO, String userid) {
ProcessTaskDTO processTaskDTO;
if (taskResultDTO.getResult() != null) {
taskResultDTO.setResultCode("approvalStatus");
processTaskDTO = complete(taskResultDTO.getTaskId(), taskResultDTO);
} else {
processTaskDTO = complete(taskResultDTO.getTaskId(), taskResultDTO);
}
this.getBasicGridAcceptanceone(basicGridAcceptance, processTaskDTO, userid);
return processTaskDTO;
}
/*** /***
* 执行 * 执行
* *
...@@ -70,12 +99,11 @@ public class WorkFlowService { ...@@ -70,12 +99,11 @@ public class WorkFlowService {
} }
public List<WorkflowResultDto> buildWorkFlowInfo(List<ProcessTaskDTO> processTaskDTOS) { public List<WorkflowResultDto> buildWorkFlowInfo(List<ProcessTaskDTO> processTaskDTOS) {
List<WorkflowResultDto> workflowResultDtoList = new ArrayList<>(); List<WorkflowResultDto> workflowResultDtoList = new ArrayList<>();
processTaskDTOS.forEach(item -> { processTaskDTOS.forEach(item -> {
WorkflowResultDto workflowResultDto = new WorkflowResultDto(); WorkflowResultDto workflowResultDto = new WorkflowResultDto();
if (null != item.getProcessInstance()){ if (null != item.getProcessInstance()) {
workflowResultDto.setInstanceId(item.getProcessInstance().getId()); workflowResultDto.setInstanceId(item.getProcessInstance().getId());
} }
// workflowResultDto.setNextExecutorIds(String.join(",", item.getCandidateGroups())); // workflowResultDto.setNextExecutorIds(String.join(",", item.getCandidateGroups()));
...@@ -92,8 +120,121 @@ public class WorkFlowService { ...@@ -92,8 +120,121 @@ public class WorkFlowService {
String nextUserIdsString = String.join(",", nextUserIds); String nextUserIdsString = String.join(",", nextUserIds);
workflowResultDto.setNextExecuteUserIds(nextUserIdsString); workflowResultDto.setNextExecuteUserIds(nextUserIdsString);
} }
if (!Objects.isNull(item.getStartUser())) {
workflowResultDto.setStartDate(new Date());
workflowResultDto.setStartUserId(item.getStartUser().getUserId());
workflowResultDto.setStartUser(item.getStartUser().getUserName());
List<CompanyModel> companys = item.getStartUser().getCompanys();
if (!CollectionUtils.isEmpty(companys) && companys.size() >= 1) {
workflowResultDto.setStartUserCompanyName(companys.get(0).getCompanyName());
}
}
workflowResultDtoList.add(workflowResultDto); workflowResultDtoList.add(workflowResultDto);
}); });
return workflowResultDtoList; return workflowResultDtoList;
} }
public BasicGridAcceptance getBasicGridAcceptance(BasicGridAcceptance basicGridAcceptance, List<ProcessTaskDTO> processTaskDTOList, String userid) {
ProcessTaskDTO listco = processTaskDTOList.isEmpty() ? null : processTaskDTOList.get(0);
if (listco != null) {
// 当前节点执行任务id
basicGridAcceptance.setPromoter(userid);
//流程实例
basicGridAcceptance.setInstanceId(listco.getProcessInstance().getId());
// 流程下一节点id
if (listco.getNextTask() != null && !listco.getNextTask().isEmpty()) {
basicGridAcceptance.setNextTaskId(listco.getNextTask().get(0).getId());
//下个节点名称
basicGridAcceptance.setNextNodeName(listco.getNextTask().get(0).getName());
//下个节点key
basicGridAcceptance.setNextNodeKey(listco.getNextTask().get(0).getKey());
}
/// 下一个节点角色权限
if (listco.getNextCandidateGroups() != null) {
List<String> ld = listco.getNextCandidateGroups().get(basicGridAcceptance.getNextTaskId());
StringBuffer sbf = new StringBuffer();
for (int i = 0; i <= ld.size() - 1; i++) {
if (i < ld.size() - 1) {
sbf.append(ld.get(i) + ",");
} else {
sbf.append(ld.get(i));
}
}
basicGridAcceptance.setNextExecutorIds(sbf.toString());
}
//下一节点可执行人逗号分割 0 0
if (listco.getNextTaskExecutor() != null) {
List<AgencyUserModel> li = listco.getNextTaskExecutor().get(basicGridAcceptance.getNextTaskId());
if (li != null && !li.isEmpty()) {
StringBuffer sbf = new StringBuffer();
for (int i = 0; i <= li.size() - 1; i++) {
if (i < li.size() - 1) {
sbf.append(li.get(i).getUserId() + ",");
} else {
sbf.append(li.get(i).getUserId());
}
}
basicGridAcceptance.setNextExecuteUserIds(sbf.toString());
}
}
//工作流发起人id
basicGridAcceptance.setCreateUserId(listco.getStartUser().getUserId());
} else {
throw new RuntimeException("工作流异常");
}
return basicGridAcceptance;
}
public void getBasicGridAcceptanceone(BasicGridAcceptance basicGridAcceptance, ProcessTaskDTO processTaskDTO, String userid) {
if (processTaskDTO != null) {
// 当前节点执行任务id
basicGridAcceptance.setPromoter(userid);
// 流程下一节点id
if (processTaskDTO.getNextTask() != null && !processTaskDTO.getNextTask().isEmpty()) {
basicGridAcceptance.setNextTaskId(processTaskDTO.getNextTask().get(0).getId());
//下个节点名称
basicGridAcceptance.setNextNodeName(processTaskDTO.getNextTask().get(0).getName());
//下个节点key
basicGridAcceptance.setNextNodeKey(processTaskDTO.getNextTask().get(0).getKey());
} else {
return;
}
/// 下一个节点角色权限
if (processTaskDTO.getNextCandidateGroups() != null) {
List<String> ld = processTaskDTO.getNextCandidateGroups().get(basicGridAcceptance.getNextTaskId());
StringBuffer sbf = new StringBuffer();
for (int i = 0; i <= ld.size() - 1; i++) {
if (i < ld.size() - 1) {
sbf.append(ld.get(i) + ",");
} else {
sbf.append(ld.get(i));
}
}
basicGridAcceptance.setNextExecutorIds(sbf.toString());
}
//下一节点可执行人逗号分割 0 0
if (processTaskDTO.getNextTaskExecutor() != null) {
List<AgencyUserModel> li = processTaskDTO.getNextTaskExecutor().get(basicGridAcceptance.getNextTaskId());
if (li != null && !li.isEmpty()) {
StringBuffer sbf = new StringBuffer();
for (int i = 0; i <= li.size() - 1; i++) {
if (i < li.size() - 1) {
sbf.append(li.get(i).getUserId() + ",");
} else {
sbf.append(li.get(i).getUserId());
}
}
basicGridAcceptance.setNextExecuteUserIds(sbf.toString());
}
}
}
}
} }
[
{
"type": "AbarbeitungWaitPush",
"pageType": "",
"name": "推送融资",
"url": "/mixuap?appId=1678340647909617665&id=1774627124162859009"
},
{
"type": "WaitAbarbeitung",
"pageType": "",
"name": "经销商整改",
"url": "/mixuap?appId=1678340647909617665&id=1806150815363108865"
},
{
"type": "FinancingAudit",
"pageType": "",
"name": "融资审核",
"url": "/mixuap?appId=1678340647909617665&id=1775075407041662977"
},
{
"type": "AuditPass",
"pageType": "",
"name": "线下放款",
"url": "/mixuap?appId=1678340647909617665&id=1805852764345995265"
},
{
"type": "jxs_03",
"pageType": "",
"name": "经销商管理员审核",
"url": "/mixuap?appId=1678340647909617665&id=1686219644483956738"
}
]
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment