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;
} }
package com.yeejoin.amos.boot.module.hygf.biz.service.impl; package com.yeejoin.amos.boot.module.hygf.biz.service.impl;
import cn.hutool.core.collection.CollectionUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
import com.yeejoin.amos.boot.module.hygf.api.Enum.*; import com.yeejoin.amos.boot.module.hygf.api.Enum.*;
import com.yeejoin.amos.boot.module.hygf.api.dto.*; import com.yeejoin.amos.boot.module.hygf.api.dto.BasicGridAcceptanceDto;
import com.yeejoin.amos.boot.module.hygf.api.dto.WorkflowResultDto;
import com.yeejoin.amos.boot.module.hygf.api.entity.*; import com.yeejoin.amos.boot.module.hygf.api.entity.*;
import com.yeejoin.amos.boot.module.hygf.api.mapper.*; import com.yeejoin.amos.boot.module.hygf.api.mapper.*;
import com.yeejoin.amos.boot.module.hygf.api.service.IBasicGridAcceptanceService; import com.yeejoin.amos.boot.module.hygf.api.service.IBasicGridAcceptanceService;
import com.yeejoin.amos.boot.module.hygf.api.util.NumberUtil; import com.yeejoin.amos.boot.module.hygf.api.util.NumberUtil;
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.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.springframework.transaction.annotation.Transactional;
import org.typroject.tyboot.core.foundation.utils.DateUtil;
import org.typroject.tyboot.core.rdbms.service.BaseService; import org.typroject.tyboot.core.rdbms.service.BaseService;
import java.util.*; import java.util.*;
...@@ -25,147 +29,127 @@ import java.util.*; ...@@ -25,147 +29,127 @@ import java.util.*;
@Slf4j @Slf4j
@Service @Service
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public class BasicGridAcceptanceServiceImpl public class BasicGridAcceptanceServiceImpl extends BaseService<BasicGridAcceptanceDto, BasicGridAcceptance, BasicGridAcceptanceMapper> implements IBasicGridAcceptanceService {
extends BaseService<BasicGridAcceptanceDto, BasicGridAcceptance, BasicGridAcceptanceMapper>
implements IBasicGridAcceptanceService { private final String OK = "0";
private final String PASS = "5";
@Autowired @Autowired
BasicGridAcceptanceMapper basicGridAcceptanceMapper; BasicGridAcceptanceMapper basicGridAcceptanceMapper;
@Autowired @Autowired
HygfOnGridMapper onGridMapper; HygfOnGridMapper onGridMapper;
@Autowired @Autowired
PersonnelBusinessMapper personnelBusinessMapper; PersonnelBusinessMapper personnelBusinessMapper;
@Autowired // @Autowired
WorkflowImpl workflow; // WorkflowImpl workflow;
@Autowired @Autowired
AcceptanceCheckItemMapper acceptanceCheckItemMapper; AcceptanceCheckItemMapper acceptanceCheckItemMapper;
@Autowired @Autowired
AcceptanceRectificationOrderMapper acceptanceRectificationOrderMapper; AcceptanceRectificationOrderMapper acceptanceRectificationOrderMapper;
@Autowired @Autowired
RegionalCompaniesMapper regionalCompaniesMapper; RegionalCompaniesMapper regionalCompaniesMapper;
@Autowired @Autowired
WorkOrderMapper workOrderMapper; WorkOrderMapper workOrderMapper;
@Autowired
@Autowired PeasantHouseholdMapper peasantHouseholdMapper;
PeasantHouseholdMapper peasantHouseholdMapper; @Autowired
@Autowired private WorkFlowService workFlowService;
private CommonServiceImpl commonService; @Autowired
private CommonServiceImpl commonService;
private final String OK = "0";
private final String PASS = "5"; public Page<BasicGridAcceptanceDto> selectPage(Long regionCompanyId, Long amosDealerId, int current, int size, String projectAddress, String powerStationCode, String ownersName, String gridStatus, String gridConnectionTime, String formType) throws Exception {
PageHelper.startPage(current, size);
public Page<BasicGridAcceptanceDto> selectPage(Long regionCompanyId, Long amosDealerId, int current, int size, Map<String, Object> map = new HashMap<>();
String projectAddress, String powerStationCode, String ownersName, String gridStatus, Date date = null;
String gridConnectionTime, String formType) throws Exception {
PageHelper.startPage(current, size);
Map<String, Object> map = new HashMap<>();
Date date = null;
// if (StringUtils.isNotEmpty(gridConnectionTime)) { // if (StringUtils.isNotEmpty(gridConnectionTime)) {
// date = DateUtil.formatStringToDate(gridConnectionTime, "yyyy-MM-dd HH:mm:ss"); // date = DateUtil.formatStringToDate(gridConnectionTime, "yyyy-MM-dd HH:mm:ss");
// } // }
map.put("projectAddress", projectAddress); map.put("projectAddress", projectAddress);
map.put("powerStationCode", powerStationCode); map.put("powerStationCode", powerStationCode);
map.put("ownersName", ownersName); map.put("ownersName", ownersName);
map.put("gridStatus", gridStatus); map.put("gridStatus", gridStatus);
map.put("gridConnectionTime", gridConnectionTime); map.put("gridConnectionTime", gridConnectionTime);
map.put("formType", formType); map.put("formType", formType);
map.put("regionCompanyId", regionCompanyId); map.put("regionCompanyId", regionCompanyId);
map.put("amosDealerId", amosDealerId); map.put("amosDealerId", amosDealerId);
List<BasicGridAcceptanceDto> list = basicGridAcceptanceMapper.selectPageList(map); List<BasicGridAcceptanceDto> list = basicGridAcceptanceMapper.selectPageList(map);
PageInfo<BasicGridAcceptanceDto> page = new PageInfo(list); PageInfo<BasicGridAcceptanceDto> page = new PageInfo(list);
Page<BasicGridAcceptanceDto> pageNew = new Page<>(); Page<BasicGridAcceptanceDto> pageNew = new Page<>();
pageNew.setCurrent(current); pageNew.setCurrent(current);
pageNew.setTotal(page.getTotal()); pageNew.setTotal(page.getTotal());
pageNew.setSize(size); pageNew.setSize(size);
pageNew.setRecords(page.getList()); pageNew.setRecords(page.getList());
return pageNew; return pageNew;
} }
public HygfOnGrid saveEntity(HygfOnGrid grid) {
if (grid.getSequenceNbr() != null) {
onGridMapper.updateById(grid);
} else {
onGridMapper.insert(grid);
}
return grid;
}
@GlobalTransactional
public HygfOnGrid saveAndCommit(HygfOnGrid grid, String userId) {
BasicGridAcceptance basicGridAcceptance = basicGridAcceptanceMapper
.selectOne(new LambdaQueryWrapper<BasicGridAcceptance>()
.eq(BasicGridAcceptance::getWorkOrderPowerStationId, grid.getWorkOrderPowerStationId()));
basicGridAcceptance.setGridStatus(GridStatusEnum.DSH.getCode());
if (grid.getType() != null && "1".equals(grid.getType())) {
// 执行工作流
StandardDto standardDto = new StandardDto();
standardDto.setTaskId(basicGridAcceptance.getNextTaskId());
workflow.standard(basicGridAcceptance, standardDto, userId);
} else {
// 调用工作流执行第一个节点
ProcessDto processDto = new ProcessDto();
processDto.setProcessDefinitionKey("hygf_bwys");
processDto.setBusinessKey(String.valueOf(basicGridAcceptance.getSequenceNbr()));
StartProcessDto startProcessDto = new StartProcessDto();
List<ProcessDto> process = new ArrayList<>();
process.add(processDto);
startProcessDto.setProcess(process);
workflow.startProcess(basicGridAcceptance, startProcessDto, userId);
// 线上验收
LambdaUpdateWrapper<PeasantHousehold> up = new LambdaUpdateWrapper<>();
up.set(PeasantHousehold::getConstructionState, ArrivalStateeEnum.并网中.getCode());
long idsk = basicGridAcceptance.getPeasantHouseholdId();
up.eq(PeasantHousehold::getSequenceNbr, idsk);
peasantHouseholdMapper.update(null, up);
} public HygfOnGrid saveEntity(HygfOnGrid grid) {
if (grid.getSequenceNbr() != null) { if (grid.getSequenceNbr() != null) {
onGridMapper.updateById(grid); onGridMapper.updateById(grid);
} else { } else {
onGridMapper.insert(grid); onGridMapper.insert(grid);
} }
basicGridAcceptanceMapper.updateById(basicGridAcceptance);
//发起待办 return grid;
// commonService.buildTaskModel(buildBWYSTaskModel(grid, basicGridAcceptance)); }
return grid;
}
private List<TaskModelDto> buildBWYSTaskModel(HygfOnGrid grid, BasicGridAcceptance basicGridAcceptance) { @GlobalTransactional
List<TaskModelDto> taskModelDtoList = new ArrayList<>(); public HygfOnGrid saveAndCommit(HygfOnGrid grid, String userId) {
TaskModelDto taskModelDto = new TaskModelDto();
taskModelDto.setFlowCode(basicGridAcceptance.getNextTaskId()); BasicGridAcceptance basicGridAcceptance = basicGridAcceptanceMapper.selectOne(new LambdaQueryWrapper<BasicGridAcceptance>().eq(BasicGridAcceptance::getWorkOrderPowerStationId, grid.getWorkOrderPowerStationId()));
taskModelDto.setFlowCreateDate(new Date()); basicGridAcceptance.setGridStatus(GridStatusEnum.DSH.getCode());
taskModelDto.setFlowStatus(FlowStatusEnum.TO_BE_PROCESSED.getCode()); List<ProcessTaskDTO> processTaskDTOS = new ArrayList<>();
taskModelDto.setFlowStatusLabel(FlowStatusEnum.TO_BE_PROCESSED.getName()); if (grid.getType() != null && "1".equals(grid.getType())) {
taskModelDto.setPageType(null); // // 执行工作流
taskModelDto.setExecuteUserIds(basicGridAcceptance.getNextExecuteUserIds()); // StandardDto standardDto = new StandardDto();
taskModelDto.setModel(grid); // standardDto.setTaskId(basicGridAcceptance.getNextTaskId());
taskModelDto.setRelationId(basicGridAcceptance.getInstanceId()); // workflow.standard(basicGridAcceptance, standardDto, userId);
taskModelDto.setRoutePath(null); //执行流程
taskModelDto.setStartUserId(basicGridAcceptance.getRecUserId()); TaskResultDTO task = new TaskResultDTO();
taskModelDto.setStartUser(basicGridAcceptance.getRecUserName()); task.setTaskId(basicGridAcceptance.getNextTaskId());
taskModelDto.setStartDate(basicGridAcceptance.getRecDate()); ProcessTaskDTO processTaskDTO = workFlowService.standard(basicGridAcceptance, task, userId);
taskModelDto.setStartUserCompanyName(null); processTaskDTOS.add(processTaskDTO);
taskModelDto.setTaskName(basicGridAcceptance.getNextNodeName()); } else {
taskModelDto.setTaskCode(String.valueOf(basicGridAcceptance.getWorkOrderId())); // 调用工作流执行第一个节点
taskModelDto.setTaskType(BusinessTypeEnum.HYGF_BWYS.getCode()); // ProcessDto processDto = new ProcessDto();
taskModelDto.setTaskTypeLabel(BusinessTypeEnum.HYGF_BWYS.getName()); // processDto.setProcessDefinitionKey("hygf_bwys");
taskModelDto.setTaskStatus(TaskStatusEnum.UNDERWAY.getValue()); // processDto.setBusinessKey(String.valueOf(basicGridAcceptance.getSequenceNbr()));
taskModelDto.setTaskStatusLabel(TaskStatusEnum.UNDERWAY.getName()); // StartProcessDto startProcessDto = new StartProcessDto();
// taskModelDto.setTaskDesc(); // List<ProcessDto> process = new ArrayList<>();
// taskModelDto.setTaskContent(); // process.add(processDto);
taskModelDto.setNextExecuteUser(basicGridAcceptance.getNextExecutorIds()); // startProcessDto.setProcess(process);
taskModelDtoList.add(taskModelDto); // workflow.startProcess(basicGridAcceptance, startProcessDto, userId);
return taskModelDtoList;
//开启工作流 并执行一步
ActWorkflowBatchDTO actWorkflowBatchDTO = new ActWorkflowBatchDTO();
List<ActWorkflowStartDTO> list = new ArrayList<>();
ActWorkflowStartDTO dto = new ActWorkflowStartDTO();
dto.setProcessDefinitionKey(BusinessTypeEnum.HYGF_BWYS.getCode());
dto.setBusinessKey(String.valueOf(basicGridAcceptance.getSequenceNbr()));
dto.setCompleteFirstTask(true);
list.add(dto);
actWorkflowBatchDTO.setProcess(list);
processTaskDTOS = workFlowService.startBatch(actWorkflowBatchDTO);
basicGridAcceptance = workFlowService.getBasicGridAcceptance(basicGridAcceptance, processTaskDTOS, userId);
// 线上验收
LambdaUpdateWrapper<PeasantHousehold> up = new LambdaUpdateWrapper<>();
up.set(PeasantHousehold::getConstructionState, ArrivalStateeEnum.并网中.getCode());
long idsk = basicGridAcceptance.getPeasantHouseholdId();
up.eq(PeasantHousehold::getSequenceNbr, idsk);
peasantHouseholdMapper.update(null, up);
}
if (grid.getSequenceNbr() != null) {
onGridMapper.updateById(grid);
} else {
onGridMapper.insert(grid);
}
basicGridAcceptanceMapper.updateById(basicGridAcceptance);
//发起待办
List<WorkflowResultDto> workflowResultDtos = workFlowService.buildWorkFlowInfo(processTaskDTOS);
commonService.buildTaskModel(commonService.buildTaskModelDto(basicGridAcceptance, workflowResultDtos.get(0), BusinessTypeEnum.HYGF_BWYS));
return grid;
} }
public HygfOnGrid modifyEntity(HygfOnGrid grid) { public HygfOnGrid modifyEntity(HygfOnGrid grid) {
onGridMapper.updateById(grid); onGridMapper.updateById(grid);
return grid; return grid;
...@@ -180,9 +164,7 @@ public class BasicGridAcceptanceServiceImpl ...@@ -180,9 +164,7 @@ public class BasicGridAcceptanceServiceImpl
for (HygfOnGrid x : grids) { for (HygfOnGrid x : grids) {
x.setIsDelete(true); x.setIsDelete(true);
int num = onGridMapper.updateById(x); int num = onGridMapper.updateById(x);
BasicGridAcceptance acceptance = basicGridAcceptanceMapper BasicGridAcceptance acceptance = basicGridAcceptanceMapper.selectOne(new LambdaQueryWrapper<BasicGridAcceptance>().eq(BasicGridAcceptance::getWorkOrderPowerStationId, x.getWorkOrderPowerStationId()));
.selectOne(new LambdaQueryWrapper<BasicGridAcceptance>()
.eq(BasicGridAcceptance::getWorkOrderPowerStationId, x.getWorkOrderPowerStationId()));
acceptance.setIsDelete(true); acceptance.setIsDelete(true);
int count = basicGridAcceptanceMapper.updateById(acceptance); int count = basicGridAcceptanceMapper.updateById(acceptance);
if (0 == num || 0 == count) { if (0 == num || 0 == count) {
...@@ -193,31 +175,30 @@ public class BasicGridAcceptanceServiceImpl ...@@ -193,31 +175,30 @@ public class BasicGridAcceptanceServiceImpl
return bool; return bool;
} }
@GlobalTransactional @GlobalTransactional
public void execute(AcceptanceCheckItem dto, String userId) { public void execute(AcceptanceCheckItem dto, String userId) {
// 查询并网审批信息 // 查询并网审批信息
BasicGridAcceptance basicGridAcceptanc = basicGridAcceptanceMapper.selectById(dto.getBasicGridAcceptanceId()); BasicGridAcceptance basicGridAcceptanc = basicGridAcceptanceMapper.selectById(dto.getBasicGridAcceptanceId());
String nextNodeKey = basicGridAcceptanc.getNextNodeKey(); String nextNodeKey = basicGridAcceptanc.getNextNodeKey();
if (OK.equals(dto.getApprovalStatus())) { if (OK.equals(dto.getApprovalStatus())) {
if (BasicGridAcceptancEnum.并网管理端工程审核.getCode().equals(nextNodeKey)) { if (BasicGridAcceptancEnum.并网管理端工程审核.getCode().equals(nextNodeKey)) {
basicGridAcceptanc.setGridStatus(GridStatusEnum.YWC.getCode()); basicGridAcceptanc.setGridStatus(GridStatusEnum.YWC.getCode());
basicGridAcceptanc.setAcceptanceStatus(AcceptanceStatusEnum.待提交验收.getCode()); basicGridAcceptanc.setAcceptanceStatus(AcceptanceStatusEnum.待提交验收.getCode());
// 并网时间 // 并网时间
LambdaUpdateWrapper<HygfOnGrid> upq = new LambdaUpdateWrapper(); LambdaUpdateWrapper<HygfOnGrid> upq = new LambdaUpdateWrapper();
upq.eq(HygfOnGrid::getSequenceNbr, dto.getFonGridId()); upq.eq(HygfOnGrid::getSequenceNbr, dto.getFonGridId());
upq.set(HygfOnGrid::getGridConnectionTime, new Date()); upq.set(HygfOnGrid::getGridConnectionTime, new Date());
onGridMapper.update(null, upq); onGridMapper.update(null, upq);
// 并网完成 // 并网完成
LambdaUpdateWrapper<PeasantHousehold> up = new LambdaUpdateWrapper<>(); LambdaUpdateWrapper<PeasantHousehold> up = new LambdaUpdateWrapper<>();
up.set(PeasantHousehold::getConstructionState, ArrivalStateeEnum.并网完成.getCode()); up.set(PeasantHousehold::getConstructionState, ArrivalStateeEnum.并网完成.getCode());
long idsk = basicGridAcceptanc.getPeasantHouseholdId(); long idsk = basicGridAcceptanc.getPeasantHouseholdId();
up.eq(PeasantHousehold::getSequenceNbr, idsk); up.eq(PeasantHousehold::getSequenceNbr, idsk);
peasantHouseholdMapper.update(null, up); peasantHouseholdMapper.update(null, up);
} else { } else {
basicGridAcceptanc basicGridAcceptanc.setAcceptanceStatus(AcceptanceStatusEnum.getNodeByKey(nextNodeKey, dto.getApprovalStatus()));
.setAcceptanceStatus(AcceptanceStatusEnum.getNodeByKey(nextNodeKey, dto.getApprovalStatus()));
} }
} else { } else {
...@@ -226,17 +207,12 @@ public class BasicGridAcceptanceServiceImpl ...@@ -226,17 +207,12 @@ public class BasicGridAcceptanceServiceImpl
basicGridAcceptanc.setAcceptanceStatus(AcceptanceStatusEnum.getNodeByKey(nextNodeKey, dto.getApprovalStatus())); basicGridAcceptanc.setAcceptanceStatus(AcceptanceStatusEnum.getNodeByKey(nextNodeKey, dto.getApprovalStatus()));
} }
// 投融/法务/工程/线下验收审核不通过 // 投融/法务/工程/线下验收审核不通过
else if (BasicGridAcceptancEnum.管理端投融审核.getCode().equals(nextNodeKey) else if (BasicGridAcceptancEnum.管理端投融审核.getCode().equals(nextNodeKey) || BasicGridAcceptancEnum.管理端法务审核.getCode().equals(nextNodeKey) || BasicGridAcceptancEnum.管理端工程审核.getCode().equals(nextNodeKey) || BasicGridAcceptancEnum.管理端工程线下验.getCode().equals(nextNodeKey)) {
|| BasicGridAcceptancEnum.管理端法务审核.getCode().equals(nextNodeKey)
|| BasicGridAcceptancEnum.管理端工程审核.getCode().equals(nextNodeKey)
|| BasicGridAcceptancEnum.管理端工程线下验.getCode().equals(nextNodeKey)) {
AcceptanceRectificationOrder rectificationOrder = new AcceptanceRectificationOrder(); AcceptanceRectificationOrder rectificationOrder = new AcceptanceRectificationOrder();
try { try {
WorkOrder workOrder = workOrderMapper.selectById(basicGridAcceptanc.getWorkOrderId()); WorkOrder workOrder = workOrderMapper.selectById(basicGridAcceptanc.getWorkOrderId());
RegionalCompanies regionalCompanies = regionalCompaniesMapper RegionalCompanies regionalCompanies = regionalCompaniesMapper.selectRegionName(workOrder.getRegionCompanyId());
.selectRegionName(workOrder.getRegionCompanyId()); String code = NumberUtil.getCode(CodeEnum.整改单.getCode(), regionalCompanies.getCompanyCode(), regionalCompanies.getRegionalAddress());
String code = NumberUtil.getCode(CodeEnum.整改单.getCode(), regionalCompanies.getCompanyCode(),
regionalCompanies.getRegionalAddress());
rectificationOrder.setRectificationOrderCode(code); rectificationOrder.setRectificationOrderCode(code);
rectificationOrder.setWorkOrderId(basicGridAcceptanc.getWorkOrderId()); rectificationOrder.setWorkOrderId(basicGridAcceptanc.getWorkOrderId());
rectificationOrder.setWorkOrderPowerStationId(basicGridAcceptanc.getWorkOrderPowerStationId()); rectificationOrder.setWorkOrderPowerStationId(basicGridAcceptanc.getWorkOrderPowerStationId());
...@@ -247,11 +223,9 @@ public class BasicGridAcceptanceServiceImpl ...@@ -247,11 +223,9 @@ public class BasicGridAcceptanceServiceImpl
throw new RuntimeException(e); throw new RuntimeException(e);
} }
acceptanceRectificationOrderMapper.insert(rectificationOrder); acceptanceRectificationOrderMapper.insert(rectificationOrder);
basicGridAcceptanc basicGridAcceptanc.setAcceptanceStatus(AcceptanceStatusEnum.getNodeByKey(nextNodeKey, dto.getApprovalStatus()));
.setAcceptanceStatus(AcceptanceStatusEnum.getNodeByKey(nextNodeKey, dto.getApprovalStatus()));
} else { } else {
basicGridAcceptanc basicGridAcceptanc.setAcceptanceStatus(AcceptanceStatusEnum.getNodeByKey(nextNodeKey, dto.getApprovalStatus()));
.setAcceptanceStatus(AcceptanceStatusEnum.getNodeByKey(nextNodeKey, dto.getApprovalStatus()));
} }
} }
...@@ -262,19 +236,30 @@ public class BasicGridAcceptanceServiceImpl ...@@ -262,19 +236,30 @@ public class BasicGridAcceptanceServiceImpl
acceptanceCheckItemMapper.insert(dto); acceptanceCheckItemMapper.insert(dto);
} }
// 执行工作流 // 执行工作流
StandardDto standardDto = new StandardDto(); // StandardDto standardDto = new StandardDto();
standardDto.setComment(dto.getComment()); // standardDto.setComment(dto.getComment());
standardDto.setResult(dto.getApprovalStatus()); // standardDto.setResult(dto.getApprovalStatus());
standardDto.setTaskId(basicGridAcceptanc.getNextTaskId()); // standardDto.setTaskId(basicGridAcceptanc.getNextTaskId());
VariableDto variable = new VariableDto(); // VariableDto variable = new VariableDto();
variable.setApprovalStatus(dto.getApprovalStatus()); // variable.setApprovalStatus(dto.getApprovalStatus());
variable.setComment(dto.getComment()); // variable.setComment(dto.getComment());
variable.setOperationTime(dto.getOperationTime()); // variable.setOperationTime(dto.getOperationTime());
variable.setOperator(dto.getOperator()); // variable.setOperator(dto.getOperator());
standardDto.setVariable(variable); // standardDto.setVariable(variable);
BasicGridAcceptance workBasicGridAcceptance = workflow.standard(basicGridAcceptanc, standardDto, userId); // BasicGridAcceptance workBasicGridAcceptance = workflow.standard(basicGridAcceptanc, standardDto, userId);
// 执行流程
if (workBasicGridAcceptance.getNextNodeKey().equals(BasicGridAcceptancEnum.管理端工程线下验.getCode())) { TaskResultDTO taskResultDTO = new TaskResultDTO();
taskResultDTO.setComment(dto.getComment());
taskResultDTO.setResult(dto.getApprovalStatus());
taskResultDTO.setTaskId(basicGridAcceptanc.getNextTaskId());
HashMap<String, Object> variableMap = new HashMap<>();
variableMap.put("approvalStatus", dto.getApprovalStatus());
variableMap.put("comment", dto.getComment());
variableMap.put("operationTime", dto.getOperationTime());
variableMap.put("operator", dto.getOperator());
taskResultDTO.setVariable(variableMap);
ProcessTaskDTO processTaskDTO = workFlowService.standard(basicGridAcceptanc, taskResultDTO, userId);
if (basicGridAcceptanc.getNextNodeKey().equals(BasicGridAcceptancEnum.管理端工程线下验.getCode())) {
// 线下验收 // 线下验收
LambdaUpdateWrapper<PeasantHousehold> up = new LambdaUpdateWrapper<>(); LambdaUpdateWrapper<PeasantHousehold> up = new LambdaUpdateWrapper<>();
up.set(PeasantHousehold::getConstructionState, ArrivalStateeEnum.线下验收.getCode()); up.set(PeasantHousehold::getConstructionState, ArrivalStateeEnum.线下验收.getCode());
...@@ -284,10 +269,10 @@ public class BasicGridAcceptanceServiceImpl ...@@ -284,10 +269,10 @@ public class BasicGridAcceptanceServiceImpl
} }
// 验收完成 // 验收完成
System.out.println("验收完成===============================" + workBasicGridAcceptance.getNextTaskId()); System.out.println("验收完成===============================" + basicGridAcceptanc.getNextTaskId());
System.out.println("验收完成888888===============================" + workBasicGridAcceptance.getAcceptanceStatus()); System.out.println("验收完成888888===============================" + basicGridAcceptanc.getAcceptanceStatus());
if ("10".equals(workBasicGridAcceptance.getAcceptanceStatus())) { if ("10".equals(basicGridAcceptanc.getAcceptanceStatus())) {
// 更新状态 // 更新状态
LambdaUpdateWrapper<PeasantHousehold> up = new LambdaUpdateWrapper<>(); LambdaUpdateWrapper<PeasantHousehold> up = new LambdaUpdateWrapper<>();
up.set(PeasantHousehold::getConstructionState, ArrivalStateeEnum.验收完成.getCode()); up.set(PeasantHousehold::getConstructionState, ArrivalStateeEnum.验收完成.getCode());
...@@ -297,27 +282,25 @@ public class BasicGridAcceptanceServiceImpl ...@@ -297,27 +282,25 @@ public class BasicGridAcceptanceServiceImpl
} }
basicGridAcceptanceMapper.updateById(workBasicGridAcceptance); basicGridAcceptanceMapper.updateById(basicGridAcceptanc);
//更新待办 //更新待办
// commonService.updateTaskModelNew(buildBWYSUpdateTaskModel(basicGridAcceptanc,dto)); updateBasicGridAcceptanceTask(basicGridAcceptanc, workFlowService.buildWorkFlowInfo(CollectionUtil.newArrayList(processTaskDTO)).get(0));
} }
private Map<String, Object> buildBWYSUpdateTaskModel(BasicGridAcceptance basicGridAcceptance, AcceptanceCheckItem acceptanceCheckItem) { /**
Map<String, Object> map = new HashMap<>(); * 此处先更新完成待办然后在新增待办
if (OK.equals(acceptanceCheckItem.getApprovalStatus())) { * @param basicGridAcceptance
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 updateBasicGridAcceptanceTask(BasicGridAcceptance basicGridAcceptance, 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", basicGridAcceptance);
} updateTaskParam.put("relationId", workflowResultDto.getInstanceId());
map.put("model", acceptanceCheckItem); commonService.updateTaskModel(updateTaskParam);
map.put("relationId", basicGridAcceptance.getInstanceId()); commonService.buildTaskModel((commonService.buildTaskModelDto(basicGridAcceptance, workflowResultDto, BusinessTypeEnum.HYGF_BWYS)));
return map;
} }
} }
...@@ -2,16 +2,20 @@ package com.yeejoin.amos.boot.module.hygf.biz.service.impl; ...@@ -2,16 +2,20 @@ package com.yeejoin.amos.boot.module.hygf.biz.service.impl;
import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams; import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.amos.boot.biz.common.utils.RedisKey; import com.yeejoin.amos.boot.biz.common.utils.RedisKey;
import com.yeejoin.amos.boot.biz.common.utils.RedisUtils; 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.FlowKeyTodoEnum;
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.dto.TaskModelDto; 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.util.JsonUtils; import com.yeejoin.amos.boot.module.hygf.api.util.JsonUtils;
import com.yeejoin.amos.boot.module.hygf.biz.feign.TaskV2FeignService; import com.yeejoin.amos.boot.module.hygf.biz.feign.TaskV2FeignService;
import com.yeejoin.amos.component.robot.AmosRequestContext;
import com.yeejoin.amos.feign.systemctl.model.TaskV2Model; import com.yeejoin.amos.feign.systemctl.model.TaskV2Model;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
...@@ -43,6 +47,8 @@ public class CommonServiceImpl { ...@@ -43,6 +47,8 @@ public class CommonServiceImpl {
private RedisUtils redisUtils; private RedisUtils redisUtils;
@Value("classpath:/json/urlInfo.json") @Value("classpath:/json/urlInfo.json")
private Resource urlInfo; private Resource urlInfo;
@Autowired
private AmosRequestContext amosRequestContext;
private static String toQueryParams2(JSONObject jsonObject) { private static String toQueryParams2(JSONObject jsonObject) {
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
...@@ -54,9 +60,7 @@ public class CommonServiceImpl { ...@@ -54,9 +60,7 @@ public class CommonServiceImpl {
} }
try { try {
if (value != null && !"".equals(value)) { if (value != null && !"".equals(value)) {
sb.append(URLEncoder.encode(key, "UTF-8")) sb.append(URLEncoder.encode(key, "UTF-8")).append('=').append(URLEncoder.encode(value.toString(), "UTF-8"));
.append('=')
.append(URLEncoder.encode(value.toString(), "UTF-8"));
} }
} catch (UnsupportedEncodingException e) { } catch (UnsupportedEncodingException e) {
e.printStackTrace(); e.printStackTrace();
...@@ -65,6 +69,38 @@ public class CommonServiceImpl { ...@@ -65,6 +69,38 @@ public class CommonServiceImpl {
return sb.toString(); return sb.toString();
} }
public List<TaskModelDto> buildTaskModelDto(Object model, WorkflowResultDto workflowResultDto, BusinessTypeEnum businessType) {
List<TaskModelDto> taskModelDtoList = new ArrayList<>();
TaskModelDto taskModelDto = new TaskModelDto();
FlowKeyTodoEnum flowKeyTodoEnum = FlowKeyTodoEnum.getEumByFlowNodeKey(workflowResultDto.getNextNodeKey());
if (!Objects.isNull(flowKeyTodoEnum)) {
taskModelDto.setFlowStatus(flowKeyTodoEnum.getCode());
taskModelDto.setFlowStatusLabel(flowKeyTodoEnum.getDealName());
}
taskModelDto.setRoutePath(null);
taskModelDto.setFlowCode(workflowResultDto.getNextTaskId());
taskModelDto.setFlowCreateDate(new Date());
taskModelDto.setPageType(null);
taskModelDto.setExecuteUserIds(workflowResultDto.getNextExecuteUserIds());
taskModelDto.setModel(model);
taskModelDto.setRelationId(workflowResultDto.getInstanceId());
taskModelDto.setStartUserId(workflowResultDto.getStartUserId());
taskModelDto.setStartUser(workflowResultDto.getStartUser());
taskModelDto.setStartDate(workflowResultDto.getStartDate());
taskModelDto.setStartUserCompanyName(workflowResultDto.getStartUserCompanyName());
taskModelDto.setTaskName(workflowResultDto.getNextNodeName());
taskModelDto.setTaskCode(workflowResultDto.getNextNodeKey());
taskModelDto.setTaskType(businessType.getCode());
taskModelDto.setTaskTypeLabel(businessType.getName());
taskModelDto.setTaskStatus(FlowStatusEnum.TO_BE_PROCESSED.getCode());
taskModelDto.setTaskStatusLabel(FlowStatusEnum.TO_BE_PROCESSED.getName());
// taskModelDto.setTaskDesc();
// taskModelDto.setTaskContent();
taskModelDto.setNextExecuteUser(workflowResultDto.getNextExecutorIds());
taskModelDtoList.add(taskModelDto);
return taskModelDtoList;
}
public void deleteTaskModel(String id) { public void deleteTaskModel(String id) {
List<TaskV2Model> result = taskV2FeignService.selectListByRelationId(id).getResult(); List<TaskV2Model> result = taskV2FeignService.selectListByRelationId(id).getResult();
if (!result.isEmpty()) { if (!result.isEmpty()) {
...@@ -78,20 +114,27 @@ public class CommonServiceImpl { ...@@ -78,20 +114,27 @@ public class CommonServiceImpl {
* 待办新增接口 * 待办新增接口
**/ **/
public void buildTaskModel(List<TaskModelDto> list) { public void buildTaskModel(List<TaskModelDto> list) {
//执行人为空使用系统机器人账号
if (StrUtil.isEmpty(RequestContext.getExeUserId())) {
RequestContext.setExeUserId(amosRequestContext.getUserId());
RequestContext.setToken(amosRequestContext.getToken());
RequestContext.setAgencyCode("JXIOP");
}
List<TaskV2Model> taskV2Models = new ArrayList<>(); List<TaskV2Model> taskV2Models = new ArrayList<>();
for (TaskModelDto obj : list) { for (TaskModelDto obj : list) {
// 判断是否是暂存 新增若无下一节点执行人即为暂存 // 判断是否是暂存 新增若无下一节点执行人即为暂存
boolean flag = StringUtils.isEmpty(obj.getNextExecuteUser()); boolean flag = StringUtils.isEmpty(obj.getNextExecuteUser());
if (flag) { if (flag) {
List<TaskV2Model> result = taskV2FeignService.selectListByRelationId(obj.getRelationId()).getResult(); List<TaskV2Model> result = taskV2FeignService.selectListByRelationId(obj.getRelationId()).getResult();
if (CollectionUtil.isNotEmpty(result) && !result.isEmpty()) { if (CollectionUtil.isNotEmpty(result)) {
break; break;
} }
} }
ReginParams reginParams = JSONObject.parseObject(redisUtils.get(RedisKey.buildReginKey(RequestContext.getExeUserId(), RequestContext.getToken())).toString(), ReginParams.class); //处理开始流程人员为空的问题
dealStartUser(obj);
TaskV2Model model = new TaskV2Model(); TaskV2Model model = new TaskV2Model();
BeanUtil.copyProperties(obj, model); BeanUtil.copyProperties(obj, model);
String urlParams = ""; String urlParams = "&formType=edit";
try { try {
urlParams = "&" + toQueryParams(obj.getModel()); urlParams = "&" + toQueryParams(obj.getModel());
} catch (UnsupportedEncodingException e) { } catch (UnsupportedEncodingException e) {
...@@ -99,19 +142,18 @@ public class CommonServiceImpl { ...@@ -99,19 +142,18 @@ public class CommonServiceImpl {
} }
List<Map> urlList = JsonUtils.getResourceList(urlInfo); List<Map> urlList = JsonUtils.getResourceList(urlInfo);
for (Map map : urlList) { for (Map map : urlList) {
// 获取暂存的可编辑页面url if (map.get("type").equals(obj.getTaskCode())) {
if (flag && map.get("type").equals(obj.getTaskType()) && map.get("pageType").equals("draft")) {
model.setRoutePath(map.get("url").toString() + urlParams); model.setRoutePath(map.get("url").toString() + urlParams);
break; break;
} }
// 其他逻辑均按详情页面获取
else if (map.get("type").equals(obj.getTaskType()) && map.get("pageType").equals(null == obj.getPageType() ? "look" : obj.getPageType())) {
model.setRoutePath(map.get("url").toString().replace("{roleIds}", obj.getNextExecuteUser()) + urlParams + "&nextExecuteUserIds=" + model.getExecuteUserIds());
break;
}
} }
// 是true则为暂存 除公共部分统一处理 // 是true则为暂存 除公共部分统一处理
if (flag) { if (flag) {
Object redisUserInfo = redisUtils.get(RedisKey.buildReginKey(RequestContext.getExeUserId(), RequestContext.getToken()));
if (Objects.isNull(redisUserInfo)) {
break;
}
ReginParams reginParams = JSONObject.parseObject(redisUserInfo.toString(), ReginParams.class);
model.setFlowStatus(FlowStatusEnum.TO_BE_SUBMITTED.getCode()); model.setFlowStatus(FlowStatusEnum.TO_BE_SUBMITTED.getCode());
model.setFlowStatusLabel(FlowStatusEnum.TO_BE_SUBMITTED.getName()); model.setFlowStatusLabel(FlowStatusEnum.TO_BE_SUBMITTED.getName());
model.setStartUserId(RequestContext.getExeUserId()); model.setStartUserId(RequestContext.getExeUserId());
...@@ -142,6 +184,22 @@ public class CommonServiceImpl { ...@@ -142,6 +184,22 @@ public class CommonServiceImpl {
taskV2FeignService.batchAdd(taskV2Models); taskV2FeignService.batchAdd(taskV2Models);
} }
private void dealStartUser(TaskModelDto obj) {
if (StrUtil.isEmpty(obj.getStartUser())) {
List<TaskV2Model> result = taskV2FeignService.selectListByRelationId(obj.getRelationId()).getResult();
if (CollectionUtil.isNotEmpty(result)) {
List<TaskV2Model> collect = result.stream().filter(item -> item.getStartUser() != null).collect(Collectors.toList());
if (CollectionUtil.isNotEmpty(collect)) {
TaskV2Model taskV2Model = collect.get(0);
obj.setStartUserId(taskV2Model.getStartUserId());
obj.setStartUser(taskV2Model.getStartUser());
obj.setStartDate(taskV2Model.getStartDate());
obj.setStartUserCompanyName(taskV2Model.getStartUserCompanyName());
}
}
}
}
/** /**
* 待办编辑接口 * 待办编辑接口
* 参数 * 参数
...@@ -165,16 +223,9 @@ public class CommonServiceImpl { ...@@ -165,16 +223,9 @@ public class CommonServiceImpl {
collect.get(0).setTaskStatusLabel(params.get("taskStatusLabel").toString()); collect.get(0).setTaskStatusLabel(params.get("taskStatusLabel").toString());
collect.get(0).setEndUserId(exeUserId); collect.get(0).setEndUserId(exeUserId);
collect.get(0).setEndDate(new Date()); collect.get(0).setEndDate(new Date());
// String[] roleIds = model.getRoutePath().split("roleIds=");
// String[] userIds = roleIds[1].split("&userId");
// String url = roleIds[0]+"roleIds="+"55555"+"&userId"+ userIds[1];
// String tarUrl = url.replaceFirst("&executeUserIds=", "");
// tarUrl+"&executeUserIds="
// model.setRoutePath( roleIds[0]+"roleIds="+"55555"+"&userId"+userIds[1]);
// 当流程完成时将所有待办状态统一修改为已完成 // 当流程完成时将所有待办状态统一修改为已完成
String urlParams = "&formType=detail";
if (collect.get(0).getFlowStatusLabel().equals(FlowStatusEnum.TO_BE_FINISHED.getName())) { if (collect.get(0).getFlowStatusLabel().equals(FlowStatusEnum.TO_BE_FINISHED.getName())) {
String urlParams = "";
try { try {
urlParams = "&" + toQueryParams(params.get("model")); urlParams = "&" + toQueryParams(params.get("model"));
} catch (UnsupportedEncodingException e) { } catch (UnsupportedEncodingException e) {
...@@ -182,8 +233,8 @@ public class CommonServiceImpl { ...@@ -182,8 +233,8 @@ public class CommonServiceImpl {
} }
List<Map> urlList = JsonUtils.getResourceList(urlInfo); List<Map> urlList = JsonUtils.getResourceList(urlInfo);
for (Map map : urlList) { for (Map map : urlList) {
if (map.get("type").equals(collect.get(0).getTaskType()) && map.get("pageType").equals("look")) { if (map.get("type").equals(collect.get(0).getTaskCode())) {
urlParams = map.get("url").toString().replace("{roleIds}", "") + urlParams + "&taskStatus" + collect.get(0).getTaskStatus() + "&nextExecuteUserIds="; urlParams = map.get("url").toString() + urlParams;
break; break;
} }
} }
...@@ -209,72 +260,6 @@ public class CommonServiceImpl { ...@@ -209,72 +260,6 @@ public class CommonServiceImpl {
return collect.get(0); return collect.get(0);
} }
/**
* 待办编辑接口 【如果没有代办直接返回空,业务判断】 ---- 在用,误删
* 参数
* taskStatus
* taskStatusLabel 操作名称 1驳回 2通过 3重新提交
* flowStatusLabel 任务状态枚举code
* 流程实例id instanceId
* flowCode 任务id
**/
public TaskV2Model updateTaskModelNew(Map<String, Object> params) {
String exeUserId = RequestContext.getExeUserId();
List<TaskV2Model> result = taskV2FeignService.selectListByRelationId(params.get("relationId").toString()).getResult();
// TaskV2Model model = result.stream().filter(e->e.getFlowCode().equals(params.get("flowCode").toString())).sorted((r1, r2) -> r2.getSequenceNbr().compareTo(r2.getSequenceNbr())) // 按时间降序排序
// .findFirst()
// .orElse(null);
List<TaskV2Model> collect = result.stream().sorted((r1, r2) -> r2.getSequenceNbr().compareTo(r1.getSequenceNbr())).collect(Collectors.toList());
if (null == collect || collect.size() == 0) {
TaskV2Model model = new TaskV2Model();
model.setFlowStatus(Integer.valueOf(params.get("flowStatus").toString()));
model.setFlowStatusLabel(params.get("flowStatusLabel").toString());
model.setTaskStatus(Integer.valueOf(params.get("taskStatus").toString()));
model.setTaskStatusLabel(params.get("taskStatusLabel").toString());
return model;
}
collect.get(0).setFlowStatus(Integer.valueOf(params.get("flowStatus").toString()));
collect.get(0).setFlowStatusLabel(params.get("flowStatusLabel").toString());
collect.get(0).setTaskStatus(Integer.valueOf(params.get("taskStatus").toString()));
collect.get(0).setTaskStatusLabel(params.get("taskStatusLabel").toString());
collect.get(0).setEndUserId(exeUserId);
collect.get(0).setEndDate(new Date());
// 当流程完成时将所有待办状态统一修改为已完成
if (collect.get(0).getFlowStatusLabel().equals(FlowStatusEnum.TO_BE_FINISHED.getName())) {
String urlParams = "";
try {
urlParams = "&" + toQueryParams(params.get("model"));
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
List<Map> urlList = JsonUtils.getResourceList(urlInfo);
for (Map map : urlList) {
if (map.get("type").equals(collect.get(0).getTaskType()) && map.get("pageType").equals("look")) {
urlParams = map.get("url").toString().replace("{roleIds}", "") + urlParams + "&nextExecuteUserIds=";
break;
}
}
collect.get(0).setRoutePath(urlParams);
for (TaskV2Model taskV2Model : collect) {
taskV2Model.setTaskStatusLabel((FlowStatusEnum.TO_BE_FINISHED.getName()));
taskV2Model.setTaskStatus(FlowStatusEnum.TO_BE_FINISHED.getCode());
taskV2Model.setFlowStatusLabel((FlowStatusEnum.TO_BE_FINISHED.getName()));
taskV2Model.setFlowStatus(FlowStatusEnum.TO_BE_FINISHED.getCode());
}
taskV2FeignService.batchUpdate(collect);
} else {
collect.get(0).setRoutePath(collect.get(0).getRoutePath().replace("roleIds=", "roleIds=55555&fq="));
taskV2FeignService.update(collect.get(0), collect.get(0).getSequenceNbr());
}
collect.get(0).setEndUserId(null);
collect.get(0).setTaskStatus(null);
collect.get(0).setEndDate(null);
collect.get(0).setSequenceNbr(null);
collect.get(0).setCreateDate(new Date());
collect.get(0).setStartDate(new Date());
return collect.get(0);
}
/** /**
* 待办 撤回 * 待办 撤回
...@@ -326,7 +311,7 @@ public class CommonServiceImpl { ...@@ -326,7 +311,7 @@ public class CommonServiceImpl {
model.setFlowStatusLabel(obj.get("flowStatusLabel").toString()); model.setFlowStatusLabel(obj.get("flowStatusLabel").toString());
} }
for (Map map : urlList) { for (Map map : urlList) {
if (map.get("type").equals(obj.get("taskType")) && map.get("pageType").equals("edit")) { if (map.get("type").equals(obj.get("taskType")) && map.get("pageType").equals("edit")) {
model.setRoutePath(map.get("url").toString().replace("{roleIds}", obj.get("nextExecuteUser").toString()) + urlParams); model.setRoutePath(map.get("url").toString().replace("{roleIds}", obj.get("nextExecuteUser").toString()) + urlParams);
break; break;
} }
......
...@@ -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
...@@ -248,7 +215,7 @@ public class FinancingInfoServiceImpl extends BaseService<FinancingInfoDto, Fina ...@@ -248,7 +215,7 @@ public class FinancingInfoServiceImpl extends BaseService<FinancingInfoDto, Fina
//此处是工作流网关路线原因 相同参数存在工作流不知道怎么执行报错问题 暂未排除问题 先修改不同表达式 //此处是工作流网关路线原因 相同参数存在工作流不知道怎么执行报错问题 暂未排除问题 先修改不同表达式
if (params.containsKey("isFlag")) { if (params.containsKey("isFlag")) {
task.setResultCode("isFlag"); task.setResultCode("isFlag");
map.put("isFlag", params.get("isFlag")); map.put("isFlag", params.get("isFlag"));
if (params.get("isFlag").equals("1")) { if (params.get("isFlag").equals("1")) {
params.put("comments", "退回整改"); params.put("comments", "退回整改");
} }
...@@ -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) {
......
package com.yeejoin.amos.boot.module.hygf.biz.service.impl; package com.yeejoin.amos.boot.module.hygf.biz.service.impl;
import com.alibaba.fastjson.JSON; import cn.hutool.core.collection.CollectionUtil;
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.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
...@@ -10,7 +9,9 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page; ...@@ -10,7 +9,9 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
import com.yeejoin.amos.boot.biz.common.utils.RedisUtils; 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.DealerReviewEnum; import com.yeejoin.amos.boot.module.hygf.api.Enum.DealerReviewEnum;
import com.yeejoin.amos.boot.module.hygf.api.Enum.FlowStatusEnum;
import com.yeejoin.amos.boot.module.hygf.api.dto.*; import com.yeejoin.amos.boot.module.hygf.api.dto.*;
import com.yeejoin.amos.boot.module.hygf.api.entity.*; import com.yeejoin.amos.boot.module.hygf.api.entity.*;
import com.yeejoin.amos.boot.module.hygf.api.fegin.IdxFeginService; import com.yeejoin.amos.boot.module.hygf.api.fegin.IdxFeginService;
...@@ -28,7 +29,10 @@ import com.yeejoin.amos.feign.privilege.model.CompanyModel; ...@@ -28,7 +29,10 @@ import com.yeejoin.amos.feign.privilege.model.CompanyModel;
import com.yeejoin.amos.feign.privilege.model.RoleModel; import com.yeejoin.amos.feign.privilege.model.RoleModel;
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.systemctl.model.SmsRecordModel; 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 org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -53,22 +57,21 @@ import java.util.stream.Stream; ...@@ -53,22 +57,21 @@ import java.util.stream.Stream;
* @date 2023-07-07 * @date 2023-07-07
*/ */
@Service @Service
public class UnitInfoServiceImpl extends BaseService<UnitInfoDto,UnitInfo,UnitInfoMapper> implements IUnitInfoService { public class UnitInfoServiceImpl extends BaseService<UnitInfoDto, UnitInfo, UnitInfoMapper> implements IUnitInfoService {
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";
private static final String VERIFY_RESULT_YES = "0";
private static final String VERIFY_RESULT_NO = "1";
private static final String SMSTEMPCODENO = "SMS_HYGF_0003";
private static final String SMSTEMPCODEYES = "SMS_HYGF_0004";
String COMPANY_TREE_REDIS_KEY = "REGULATOR_UNIT_TREE"; String COMPANY_TREE_REDIS_KEY = "REGULATOR_UNIT_TREE";
@Value("${regulator.unit.code}")
private String code;
@Value("${dealer.appcode}")
private String appCodes;
@Autowired @Autowired
RedisUtils redisUtil; RedisUtils redisUtil;
@Autowired @Autowired
PrivilegeFeginService privilegeFeginService; PrivilegeFeginService privilegeFeginService;
@Autowired @Autowired
CommerceInfoServiceImpl commerceInfoService; CommerceInfoServiceImpl commerceInfoService;
@Autowired @Autowired
...@@ -85,67 +88,69 @@ public class UnitInfoServiceImpl extends BaseService<UnitInfoDto,UnitInfo,UnitIn ...@@ -85,67 +88,69 @@ public class UnitInfoServiceImpl extends BaseService<UnitInfoDto,UnitInfo,UnitIn
PublicAgencyUserMapper publicAgencyUserMapper; PublicAgencyUserMapper publicAgencyUserMapper;
@Autowired @Autowired
IDealerReviewService dealerReviewService; IDealerReviewService dealerReviewService;
@Value("${hygf.user.group.id}")
private long userGroupId;
@Value("${regionalCompanies.company.seq}")
private Long regionalCompanies;
@Autowired @Autowired
IdxFeginService idxFeginService; IdxFeginService idxFeginService;
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";
private static final String VERIFY_RESULT_YES="0";
private static final String VERIFY_RESULT_NO="1";
@Autowired @Autowired
DealerReviewMapper dealerReviewMapper; DealerReviewMapper dealerReviewMapper;
@Autowired
AmosRequestContext amosRequestContext;
@Autowired
PersonnelBusinessMapper personnelBusinessMapper;
@Autowired
WorkflowImpl workflow;
@Autowired
WorkFlowService workFlowService;
@Autowired
CommonServiceImpl commonService;
@Autowired
UserEmpowerMapper userEmpowerMapper;
@Value("${regulator.unit.code}")
private String code;
@Value("${dealer.appcode}")
private String appCodes;
@Value("${hygf.user.group.id}")
private long userGroupId;
@Value("${regionalCompanies.company.seq}")
private Long regionalCompanies;
@Value("${power.station.examine.pageId}") @Value("${power.station.examine.pageId}")
private long pageId; private long pageId;
@Autowired
AmosRequestContext requestContext;
@Value("${unitInfo.station.examine.planId}") @Value("${unitInfo.station.examine.planId}")
private String planId; private String planId;
// @Value("${amos.system.user.product}")
@Value("${amos.system.user.product}") // private String AMOS_STUDIO_WEB;
private String AMOS_STUDIO_WEB; // @Value("${amos.system.user.app-key}")
@Value("${amos.system.user.app-key}") // private String AMOS_STUDIO;
private String AMOS_STUDIO;
@Value("${hygf.sms.tempCodeJXS}") @Value("${hygf.sms.tempCodeJXS}")
private String smsTempCode; private String smsTempCode;
@Value("${dealer.managementUnitId}") @Value("${dealer.managementUnitId}")
private String managementUnitId; private String managementUnitId;
@Value("${dealer.roleId}") @Value("${dealer.roleId}")
private String roleId; private String roleId;
@Autowired private static List<LinkedHashMap> findNodesByCondition(List<LinkedHashMap> nodes, String conditionName,
PersonnelBusinessMapper personnelBusinessMapper; String condition, String childName) {
return nodes.stream()
@Autowired .flatMap(node -> Stream.concat(
WorkflowImpl workflow; node.get(conditionName).equals(condition) ? Stream.of(node) : Stream.empty(),
node.get(childName) != null ? findNodesByCondition((List<LinkedHashMap>) node.get(childName),
@Autowired conditionName, condition, condition).stream() :
UserEmpowerMapper userEmpowerMapper; Stream.empty()
))
private static final String SMSTEMPCODENO="SMS_HYGF_0003"; .collect(Collectors.toList());
}
private static final String SMSTEMPCODEYES="SMS_HYGF_0004";
/** /**
* 分页查询 * 分页查询
*/ */
public Page<UnitInfoDto> queryForUnitInfoPage(Page<UnitInfoDto> page) { public Page<UnitInfoDto> queryForUnitInfoPage(Page<UnitInfoDto> page) {
return this.queryForPage(page, null, false); return this.queryForPage(page, null, false);
} }
/** /**
* 列表查询 示例 * 列表查询 示例
*/ */
public List<UnitInfoDto> queryForUnitInfoList() { public List<UnitInfoDto> queryForUnitInfoList() {
return this.queryForList("" , false); return this.queryForList("", false);
} }
@Override @Override
...@@ -171,15 +176,15 @@ public class UnitInfoServiceImpl extends BaseService<UnitInfoDto,UnitInfo,UnitIn ...@@ -171,15 +176,15 @@ public class UnitInfoServiceImpl extends BaseService<UnitInfoDto,UnitInfo,UnitIn
regUnitInfo.setManagementUnit("经销商"); regUnitInfo.setManagementUnit("经销商");
try { try {
// 1. 调用平台进行创建单位、用户信息 // 1. 调用平台进行创建单位、用户信息
// this.createCompanyAndUser(regUnitInfo); // this.createCompanyAndUser(regUnitInfo);
// 2.插入单位表 // 2.插入单位表
// regUnitInfo = this.createWithModel(regUnitInfo); // regUnitInfo = this.createWithModel(regUnitInfo);
regUnitInfo = this.createWithModelnew(regUnitInfo); regUnitInfo = this.createWithModelnew(regUnitInfo);
CommerceInfoDto commerceInfo = model.getCommerceInfoDto(); CommerceInfoDto commerceInfo = model.getCommerceInfoDto();
commerceInfo.setUnitSeq(regUnitInfo.getSequenceNbr()); commerceInfo.setUnitSeq(regUnitInfo.getSequenceNbr());
commerceInfo = commerceInfoService.createWithModel(commerceInfo); commerceInfo = commerceInfoService.createWithModel(commerceInfo);
List<RegionalCompanies> regionalCompanies= regUnitInfo.getRegionalCompanies(); List<RegionalCompanies> regionalCompanies = regUnitInfo.getRegionalCompanies();
for (RegionalCompanies regionalCompany : regionalCompanies) { for (RegionalCompanies regionalCompany : regionalCompanies) {
regionalCompany.setUnitId(regUnitInfo.getAmosCompanySeq()); regionalCompany.setUnitId(regUnitInfo.getAmosCompanySeq());
regionalCompany.setUnitInfoId(regUnitInfo.getSequenceNbr()); regionalCompany.setUnitInfoId(regUnitInfo.getSequenceNbr());
...@@ -231,20 +236,8 @@ public class UnitInfoServiceImpl extends BaseService<UnitInfoDto,UnitInfo,UnitIn ...@@ -231,20 +236,8 @@ public class UnitInfoServiceImpl extends BaseService<UnitInfoDto,UnitInfo,UnitIn
return model; return model;
} }
private static List<LinkedHashMap> findNodesByCondition(List<LinkedHashMap> nodes, String conditionName,
String condition, String childName) {
return nodes.stream()
.flatMap(node -> Stream.concat(
node.get(conditionName).equals(condition) ? Stream.of(node) : Stream.empty(),
node.get(childName) != null ? findNodesByCondition((List<LinkedHashMap>) node.get(childName),
conditionName, condition, condition).stream() :
Stream.empty()
))
.collect(Collectors.toList());
}
private List<LinkedHashMap> creatTree() { private List<LinkedHashMap> creatTree() {
FeignClientResult tree = privilegeFeginService.tree(RequestContext.getToken(),RequestContext.getAppKey(),RequestContext.getProduct()); FeignClientResult tree = privilegeFeginService.tree(RequestContext.getToken(), RequestContext.getAppKey(), RequestContext.getProduct());
List<LinkedHashMap> result = (List<LinkedHashMap>) tree.getResult(); List<LinkedHashMap> result = (List<LinkedHashMap>) tree.getResult();
List<LinkedHashMap> treeData = deleteRegulatorTreeData(result); List<LinkedHashMap> treeData = deleteRegulatorTreeData(result);
List<LinkedHashMap> supervisionTree = treeData.stream().filter(e -> code.equals(e.get("orgCode"))).collect(Collectors.toList()); List<LinkedHashMap> supervisionTree = treeData.stream().filter(e -> code.equals(e.get("orgCode"))).collect(Collectors.toList());
...@@ -320,8 +313,8 @@ public class UnitInfoServiceImpl extends BaseService<UnitInfoDto,UnitInfo,UnitIn ...@@ -320,8 +313,8 @@ public class UnitInfoServiceImpl extends BaseService<UnitInfoDto,UnitInfo,UnitIn
companyInfo.setLandlinePhone(regUnitInfo.getHeadPhone()); companyInfo.setLandlinePhone(regUnitInfo.getHeadPhone());
FeignClientResult<CompanyModel> companyResult = Privilege.companyClient.create(companyInfo); FeignClientResult<CompanyModel> companyResult = Privilege.companyClient.create(companyInfo);
if (companyResult == null || companyResult.getStatus()!=200) { if (companyResult == null || companyResult.getStatus() != 200) {
throw new BadRequest("单位注册失败!"+companyResult.getDevMessage()); throw new BadRequest("单位注册失败!" + companyResult.getDevMessage());
} }
String adminUserName = regUnitInfo.getAdminUserName(); String adminUserName = regUnitInfo.getAdminUserName();
...@@ -357,8 +350,8 @@ public class UnitInfoServiceImpl extends BaseService<UnitInfoDto,UnitInfo,UnitIn ...@@ -357,8 +350,8 @@ public class UnitInfoServiceImpl extends BaseService<UnitInfoDto,UnitInfo,UnitIn
agencyUserModel.setOrgRoleSeqs(roleSeqMap); agencyUserModel.setOrgRoleSeqs(roleSeqMap);
userResult = Privilege.agencyUserClient.create(agencyUserModel); userResult = Privilege.agencyUserClient.create(agencyUserModel);
if (userResult == null || userResult.getStatus()!=200) { if (userResult == null || userResult.getStatus() != 200) {
throw new BadRequest("单位注册失败!"+userResult.getDevMessage()); throw new BadRequest("单位注册失败!" + userResult.getDevMessage());
} }
regUnitInfo.setAdminUserId(userResult.getResult().getUserId()); regUnitInfo.setAdminUserId(userResult.getResult().getUserId());
regUnitInfo.setAmosCompanySeq(companyInfo.getSequenceNbr()); regUnitInfo.setAmosCompanySeq(companyInfo.getSequenceNbr());
...@@ -388,7 +381,7 @@ public class UnitInfoServiceImpl extends BaseService<UnitInfoDto,UnitInfo,UnitIn ...@@ -388,7 +381,7 @@ public class UnitInfoServiceImpl extends BaseService<UnitInfoDto,UnitInfo,UnitIn
FeignClientResult<AgencyUserModel> userResult = null; FeignClientResult<AgencyUserModel> userResult = null;
try { try {
//FeignClientResult<List<RoleModel>> roleListResult = Privilege.roleClient.queryRoleList(null, null); //FeignClientResult<List<RoleModel>> roleListResult = Privilege.roleClient.queryRoleList(null, null);
// List<RoleModel> allRoleList = roleListResult.getResult(); // List<RoleModel> allRoleList = roleListResult.getResult();
List<RoleModel> userRoleList = new ArrayList<>(); List<RoleModel> userRoleList = new ArrayList<>();
List<Long> roleIds = new ArrayList<>(); List<Long> roleIds = new ArrayList<>();
// 1创建公司 // 1创建公司
...@@ -397,14 +390,14 @@ public class UnitInfoServiceImpl extends BaseService<UnitInfoDto,UnitInfo,UnitIn ...@@ -397,14 +390,14 @@ public class UnitInfoServiceImpl extends BaseService<UnitInfoDto,UnitInfo,UnitIn
companyInfo.setParentId(Long.parseLong(regUnitInfo.getManagementUnitId())); companyInfo.setParentId(Long.parseLong(regUnitInfo.getManagementUnitId()));
companyInfo.setLevel("station"); companyInfo.setLevel("station");
companyInfo.setCompanyName(regUnitInfo.getName()); companyInfo.setCompanyName(regUnitInfo.getName());
// companyInfo.setCompanyCode(regUnitInfo.getUnitType()); // companyInfo.setCompanyCode(regUnitInfo.getUnitType());
companyInfo.setContact(regUnitInfo.getHeadName()); companyInfo.setContact(regUnitInfo.getHeadName());
companyInfo.setCompanyType(regUnitInfo.getUnitType()); companyInfo.setCompanyType(regUnitInfo.getUnitType());
companyInfo.setLandlinePhone(regUnitInfo.getHeadPhone()); companyInfo.setLandlinePhone(regUnitInfo.getHeadPhone());
FeignClientResult<CompanyModel> companyResult = Privilege.companyClient.create(companyInfo); FeignClientResult<CompanyModel> companyResult = Privilege.companyClient.create(companyInfo);
if (companyResult == null || companyResult.getStatus()!=200) { if (companyResult == null || companyResult.getStatus() != 200) {
throw new BadRequest("单位注册失败!"+companyResult.getDevMessage()); throw new BadRequest("单位注册失败!" + companyResult.getDevMessage());
} }
String adminUserName = regUnitInfo.getAdminUserName(); String adminUserName = regUnitInfo.getAdminUserName();
...@@ -431,7 +424,7 @@ public class UnitInfoServiceImpl extends BaseService<UnitInfoDto,UnitInfo,UnitIn ...@@ -431,7 +424,7 @@ public class UnitInfoServiceImpl extends BaseService<UnitInfoDto,UnitInfo,UnitIn
// roleIds.add(r.getSequenceNbr()); // roleIds.add(r.getSequenceNbr());
// } // }
// }); // });
// roleIds.add(Long.valueOf(regUnitInfo.getRoleId())); // roleIds.add(Long.valueOf(regUnitInfo.getRoleId()));
roleIds.add(userGroupId); roleIds.add(userGroupId);
roleSeqMap.put(companyInfo.getSequenceNbr(), roleIds); roleSeqMap.put(companyInfo.getSequenceNbr(), roleIds);
...@@ -440,8 +433,8 @@ public class UnitInfoServiceImpl extends BaseService<UnitInfoDto,UnitInfo,UnitIn ...@@ -440,8 +433,8 @@ public class UnitInfoServiceImpl extends BaseService<UnitInfoDto,UnitInfo,UnitIn
agencyUserModel.setOrgRoleSeqs(roleSeqMap); agencyUserModel.setOrgRoleSeqs(roleSeqMap);
userResult = Privilege.agencyUserClient.create(agencyUserModel); userResult = Privilege.agencyUserClient.create(agencyUserModel);
if (userResult == null || userResult.getStatus()!=200) { if (userResult == null || userResult.getStatus() != 200) {
throw new BadRequest("单位注册失败!"+userResult.getDevMessage()); throw new BadRequest("单位注册失败!" + userResult.getDevMessage());
} }
regUnitInfo.setAdminUserId(userResult.getResult().getUserId()); regUnitInfo.setAdminUserId(userResult.getResult().getUserId());
regUnitInfo.setAmosCompanySeq(companyInfo.getSequenceNbr()); regUnitInfo.setAmosCompanySeq(companyInfo.getSequenceNbr());
...@@ -465,20 +458,17 @@ public class UnitInfoServiceImpl extends BaseService<UnitInfoDto,UnitInfo,UnitIn ...@@ -465,20 +458,17 @@ public class UnitInfoServiceImpl extends BaseService<UnitInfoDto,UnitInfo,UnitIn
} }
public UnitInfoDto createWithModelnew(UnitInfoDto regUnitInfo){ public UnitInfoDto createWithModelnew(UnitInfoDto regUnitInfo) {
regUnitInfo.setBlacklist(1); regUnitInfo.setBlacklist(1);
regUnitInfo.setAuditStatus(1); regUnitInfo.setAuditStatus(1);
regUnitInfo.setManagementUnit("经销商事业部"); regUnitInfo.setManagementUnit("经销商事业部");
regUnitInfo= this.createWithModel(regUnitInfo); regUnitInfo = this.createWithModel(regUnitInfo);
this.submitExamine(regUnitInfo); //添加上下文
return regUnitInfo; this.submitExamine(regUnitInfo);
} return regUnitInfo;
}
private void submitExamine( UnitInfoDto regUnitInfo) {
private void submitExamine(UnitInfoDto regUnitInfo) {
String taskId = null; String taskId = null;
Map<String, Object> objectMap = new HashMap<>(1); Map<String, Object> objectMap = new HashMap<>(1);
objectMap.put("describe", "经销商已上传信息"); objectMap.put("describe", "经销商已上传信息");
...@@ -489,15 +479,27 @@ public class UnitInfoServiceImpl extends BaseService<UnitInfoDto,UnitInfo,UnitIn ...@@ -489,15 +479,27 @@ public class UnitInfoServiceImpl extends BaseService<UnitInfoDto,UnitInfo,UnitIn
//发起工作流 //发起工作流
// 调用工作流执行第一个节点 // 调用工作流执行第一个节点
ProcessDto processDto = new ProcessDto(); // ProcessDto processDto = new ProcessDto();
processDto.setBusinessKey(String.valueOf(regUnitInfo.getSequenceNbr())); // processDto.setBusinessKey(String.valueOf(regUnitInfo.getSequenceNbr()));
processDto.setProcessDefinitionKey("JXS_SH"); // processDto.setProcessDefinitionKey(BusinessTypeEnum.HYGF_JXS_SH.getCode());
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);
BasicGridAcceptance basicGridAcceptance=new BasicGridAcceptance(); BasicGridAcceptance basicGridAcceptance = new BasicGridAcceptance();
workflow.startProcessnew(AMOS_STUDIO, AMOS_STUDIO_WEB,requestContext.getToken(),basicGridAcceptance, startProcessDto,requestContext.getUserId()); // workflow.startProcessnew(AMOS_STUDIO, AMOS_STUDIO_WEB, requestContext.getToken(), basicGridAcceptance, startProcessDto, requestContext.getUserId());
//开启工作流 并执行一步
ActWorkflowBatchDTO actWorkflowBatchDTO = new ActWorkflowBatchDTO();
List<ActWorkflowStartDTO> list = new ArrayList<>();
ActWorkflowStartDTO dto = new ActWorkflowStartDTO();
dto.setProcessDefinitionKey(BusinessTypeEnum.HYGF_JXS_SH.getCode());
dto.setBusinessKey(String.valueOf(regUnitInfo.getSequenceNbr()));
dto.setCompleteFirstTask(true);
list.add(dto);
actWorkflowBatchDTO.setProcess(list);
List<ProcessTaskDTO> processTaskDTOS = workFlowService.startBatchNew(amosRequestContext.getAppKey(), amosRequestContext.getProduct(), amosRequestContext.getToken(), actWorkflowBatchDTO);
workFlowService.getBasicGridAcceptance(basicGridAcceptance, processTaskDTOS, amosRequestContext.getUserId());
// 插入记录表 // 插入记录表
dealerReview.setPlanInstanceId(planId); dealerReview.setPlanInstanceId(planId);
dealerReview.setUnitInfoId(regUnitInfo.getSequenceNbr()); dealerReview.setUnitInfoId(regUnitInfo.getSequenceNbr());
...@@ -506,15 +508,17 @@ public class UnitInfoServiceImpl extends BaseService<UnitInfoDto,UnitInfo,UnitIn ...@@ -506,15 +508,17 @@ public class UnitInfoServiceImpl extends BaseService<UnitInfoDto,UnitInfo,UnitIn
dealerReview.setFlowTaskId(basicGridAcceptance.getNextTaskId()); dealerReview.setFlowTaskId(basicGridAcceptance.getNextTaskId());
dealerReview.setNodeRole(basicGridAcceptance.getNextExecutorIds()); dealerReview.setNodeRole(basicGridAcceptance.getNextExecutorIds());
dealerReview.setNextProcessNode(DealerReviewEnum.经销商管理员审核.getCode()); dealerReview.setNextProcessNode(DealerReviewEnum.经销商管理员审核.getCode());
dealerReviewService.saveDealerReview(dealerReview,true,false,regUnitInfo.getName(),"任务明细:经销商已上传信息"); dealerReviewService.saveDealerReview(dealerReview, true, false, regUnitInfo.getName(), "任务明细:经销商已上传信息");
//添加待办
List<WorkflowResultDto> workflowResultDtos = workFlowService.buildWorkFlowInfo(processTaskDTOS);
commonService.buildTaskModel(commonService.buildTaskModelDto(dealerReview, workflowResultDtos.get(0), BusinessTypeEnum.HYGF_JXS_SH));
} catch (Exception e){ } catch (Exception e) {
throw new BaseException("获取工作流节点失败!","400","获取工作流节点失败!"); log.error(e.getMessage(),e);
throw new BaseException("获取工作流节点失败!", "400", "获取工作流节点失败!");
} }
// //
// String taskId = null; // String taskId = null;
// Map<String, Object> objectMap = new HashMap<>(1); // Map<String, Object> objectMap = new HashMap<>(1);
...@@ -554,18 +558,17 @@ public class UnitInfoServiceImpl extends BaseService<UnitInfoDto,UnitInfo,UnitIn ...@@ -554,18 +558,17 @@ public class UnitInfoServiceImpl extends BaseService<UnitInfoDto,UnitInfo,UnitIn
} }
@Override @Override
@Transactional @Transactional
public String powerStationExamine(long pageId, String nodeCode, String stationId, String taskId, String planInstanceId, Map<String, Object> kv) { public String powerStationExamine(long pageId, String nodeCode, String stationId, String taskId, String planInstanceId, Map<String, Object> kv) {
// 2.更新审核记录表 // 2.更新审核记录表
UnitInfo unitInfo=null; UnitInfo unitInfo = null;
try{ try {
DealerReview dealerReview= dealerReviewMapper.selectOne(new QueryWrapper<DealerReview>().eq("unit_info_id", stationId)); DealerReview dealerReview = dealerReviewMapper.selectOne(new QueryWrapper<DealerReview>().eq("unit_info_id", stationId));
unitInfo= this.getById(stationId); unitInfo = this.getById(stationId);
DealerReviewEnum nodeByCode = DealerReviewEnum.getNodeByCode(nodeCode); DealerReviewEnum nodeByCode = DealerReviewEnum.getNodeByCode(nodeCode);
String approvalStatue=""; String approvalStatue = "";
if (DealerReviewEnum.经销商管理员审核.getCode().equals(nodeCode)) { if (DealerReviewEnum.经销商管理员审核.getCode().equals(nodeCode)) {
String result = String.valueOf(kv.get("approvalStatus")); String result = String.valueOf(kv.get("approvalStatus"));
if (VERIFY_RESULT_NO.equals(result)) { if (VERIFY_RESULT_NO.equals(result)) {
...@@ -574,41 +577,41 @@ public class UnitInfoServiceImpl extends BaseService<UnitInfoDto,UnitInfo,UnitIn ...@@ -574,41 +577,41 @@ public class UnitInfoServiceImpl extends BaseService<UnitInfoDto,UnitInfo,UnitIn
//发送断线 //发送断线
Boolean flag = true; Boolean flag = true;
HashMap<String, String> params = new HashMap<>(3); HashMap<String, String> params = new HashMap<>(3);
String meg= String.valueOf(kv.get("approveInfo")); String meg = String.valueOf(kv.get("approveInfo"));
params.put("code","不通过"); params.put("code", "不通过");
params.put("mobile",unitInfo.getAdminPhone()); params.put("mobile", unitInfo.getAdminPhone());
params.put("smsCode", SMSTEMPCODENO); params.put("smsCode", SMSTEMPCODENO);
approvalStatue="任务明细:"+DealerReviewEnum.经销商管理员审核.getName()+"审核不通过"; approvalStatue = "任务明细:" + DealerReviewEnum.经销商管理员审核.getName() + "审核不通过";
// FeignClientResult<SmsRecordModel> date= Systemctl.smsClient.sendCommonSms(params); // FeignClientResult<SmsRecordModel> date= Systemctl.smsClient.sendCommonSms(params);
// System.out.println("短信通知============================"+JSON.toJSONString(date)); // System.out.println("短信通知============================"+JSON.toJSONString(date));
}else{ } else {
// 1. 更新经销商状态 // 1. 更新经销商状态
unitInfo.setAuditStatus(2); unitInfo.setAuditStatus(2);
unitInfo.setBlacklist(0); unitInfo.setBlacklist(0);
this.createCompanyAndUsernew(unitInfo); this.createCompanyAndUsernew(unitInfo);
PublicAgencyUser publicAgencyUser=new PublicAgencyUser(); PublicAgencyUser publicAgencyUser = new PublicAgencyUser();
publicAgencyUser.setAmosUserId(unitInfo.getAdminUserId()); publicAgencyUser.setAmosUserId(unitInfo.getAdminUserId());
publicAgencyUser.setAmosUserName(unitInfo.getAdminLoginName()); publicAgencyUser.setAmosUserName(unitInfo.getAdminLoginName());
publicAgencyUser.setRealName(unitInfo.getAdminLoginName()); publicAgencyUser.setRealName(unitInfo.getAdminLoginName());
publicAgencyUser.setRole("["+unitInfo.getRoleId()+"]"); publicAgencyUser.setRole("[" + unitInfo.getRoleId() + "]");
publicAgencyUser.setEmergencyTelephone(unitInfo.getAdminPhone()); publicAgencyUser.setEmergencyTelephone(unitInfo.getAdminPhone());
publicAgencyUser.setLockStatus("UNLOCK"); publicAgencyUser.setLockStatus("UNLOCK");
publicAgencyUserMapper.insert(publicAgencyUser); publicAgencyUserMapper.insert(publicAgencyUser);
List<String> lis=new ArrayList<>(); List<String> lis = new ArrayList<>();
// lis.add(unitInfo.getAmosCompanyCode()); // lis.add(unitInfo.getAmosCompanyCode());
LambdaQueryWrapper<RegionalCompanies> queryWrapper = new LambdaQueryWrapper<RegionalCompanies>(); LambdaQueryWrapper<RegionalCompanies> queryWrapper = new LambdaQueryWrapper<RegionalCompanies>();
queryWrapper.eq(RegionalCompanies::getUnitInfoId, unitInfo.getSequenceNbr()); queryWrapper.eq(RegionalCompanies::getUnitInfoId, unitInfo.getSequenceNbr());
List<RegionalCompanies> list= regionalCompaniesMapper.selectList(queryWrapper); List<RegionalCompanies> list = regionalCompaniesMapper.selectList(queryWrapper);
for (RegionalCompanies companies : list) { for (RegionalCompanies companies : list) {
companies.setUnitId(unitInfo.getAmosCompanySeq()); companies.setUnitId(unitInfo.getAmosCompanySeq());
lis.add(companies.getRegionalCompaniesCode()); lis.add(companies.getRegionalCompaniesCode());
} }
regionalCompaniesService.saveOrUpdateBatch(list); regionalCompaniesService.saveOrUpdateBatch(list);
PersonnelBusiness re=new PersonnelBusiness(); PersonnelBusiness re = new PersonnelBusiness();
re.setAmosDealerId(unitInfo.getAmosCompanySeq()); re.setAmosDealerId(unitInfo.getAmosCompanySeq());
re.setAmosUnitId(unitInfo.getAmosCompanySeq()); re.setAmosUnitId(unitInfo.getAmosCompanySeq());
re.setAmosUnitName(unitInfo.getName()); re.setAmosUnitName(unitInfo.getName());
...@@ -618,14 +621,14 @@ public class UnitInfoServiceImpl extends BaseService<UnitInfoDto,UnitInfo,UnitIn ...@@ -618,14 +621,14 @@ public class UnitInfoServiceImpl extends BaseService<UnitInfoDto,UnitInfo,UnitIn
personnelBusinessMapper.insert(re); personnelBusinessMapper.insert(re);
//管理员绑定角色权限 //管理员绑定角色权限
StdUserEmpower stdUserEmpower=new StdUserEmpower(); StdUserEmpower stdUserEmpower = new StdUserEmpower();
stdUserEmpower.setAmosUserId(unitInfo.getAdminUserId()); stdUserEmpower.setAmosUserId(unitInfo.getAdminUserId());
stdUserEmpower.setAmosOrgCode(lis); stdUserEmpower.setAmosOrgCode(lis);
stdUserEmpower.setPermissionType("HYGF"); stdUserEmpower.setPermissionType("HYGF");
userEmpowerMapper.insert(stdUserEmpower); userEmpowerMapper.insert(stdUserEmpower);
// Privilege.agencyUserClient.unlockUsers(unitInfo.getAdminUserId()); // Privilege.agencyUserClient.unlockUsers(unitInfo.getAdminUserId());
approvalStatue="任务明细:"+DealerReviewEnum.经销商管理员审核.getName()+"审核通过"; approvalStatue = "任务明细:" + DealerReviewEnum.经销商管理员审核.getName() + "审核通过";
// HashMap<String, String> params = new HashMap<>(3); // HashMap<String, String> params = new HashMap<>(3);
// params.put("code","通过"); // params.put("code","通过");
// params.put("mobile",unitInfo.getAdminPhone()); // params.put("mobile",unitInfo.getAdminPhone());
...@@ -640,29 +643,43 @@ public class UnitInfoServiceImpl extends BaseService<UnitInfoDto,UnitInfo,UnitIn ...@@ -640,29 +643,43 @@ public class UnitInfoServiceImpl extends BaseService<UnitInfoDto,UnitInfo,UnitIn
// 3. 工作流执行 // 3. 工作流执行
//执行工作流 //执行工作流
BasicGridAcceptance basicGridAcceptance=new BasicGridAcceptance(); BasicGridAcceptance basicGridAcceptance = new BasicGridAcceptance();
StandardDto standardDto = new StandardDto(); // StandardDto standardDto = new StandardDto();
standardDto.setComment(kv.get("approvalInfo")!=null?String.valueOf(kv.get("approvalInfo")):""); // standardDto.setComment(kv.get("approvalInfo") != null ? String.valueOf(kv.get("approvalInfo")) : "");
standardDto.setResult(String.valueOf(kv.get("approvalStatus"))); // standardDto.setResult(String.valueOf(kv.get("approvalStatus")));
standardDto.setTaskId(dealerReview.getFlowTaskId()); // standardDto.setTaskId(dealerReview.getFlowTaskId());
VariableDto variable = new VariableDto(); // VariableDto variable = new VariableDto();
variable.setApprovalStatus(String.valueOf(kv.get("approvalStatus"))); // variable.setApprovalStatus(String.valueOf(kv.get("approvalStatus")));
variable.setComment(kv.get("approvalInfo")!=null?String.valueOf(kv.get("approvalInfo")):""); // variable.setComment(kv.get("approvalInfo") != null ? String.valueOf(kv.get("approvalInfo")) : "");
variable.setOperationTime(String.valueOf(kv.get("approveDate"))); // variable.setOperationTime(String.valueOf(kv.get("approveDate")));
variable.setOperator(String.valueOf(kv.get("approveName"))); // variable.setOperator(String.valueOf(kv.get("approveName")));
standardDto.setVariable(variable); // standardDto.setVariable(variable);
BasicGridAcceptance workBasicGridAcceptance = workflow.standard(basicGridAcceptance, standardDto, requestContext.getUserId()); // BasicGridAcceptance workBasicGridAcceptance = workflow.standard(basicGridAcceptance, standardDto, requestContext.getUserId());
//执行工作流
TaskResultDTO taskResultDTO = new TaskResultDTO();
taskResultDTO.setComment(kv.get("approvalInfo") != null ? String.valueOf(kv.get("approvalInfo")) : "");
taskResultDTO.setResult(String.valueOf(kv.get("approvalStatus")));
taskResultDTO.setTaskId(dealerReview.getFlowTaskId());
HashMap<String, Object> variableMap = new HashMap<>();
variableMap.put("approvalStatus", String.valueOf(kv.get("approvalStatus")));
variableMap.put("comment", kv.get("approvalInfo") != null ? String.valueOf(kv.get("approvalInfo")) : "");
variableMap.put("operationTime", String.valueOf(kv.get("approveDate")));
variableMap.put("operator", String.valueOf(kv.get("approveName")));
taskResultDTO.setVariable(variableMap);
ProcessTaskDTO processTaskDTO = workFlowService.standard(basicGridAcceptance, taskResultDTO, amosRequestContext.getUserId());
dealerReview.setFlowTaskId(basicGridAcceptance.getNextTaskId()); dealerReview.setFlowTaskId(basicGridAcceptance.getNextTaskId());
dealerReviewService.saveDealerReview(dealerReview,false,true,unitInfo.getName(),approvalStatue); dealerReviewService.saveDealerReview(dealerReview, false, true, unitInfo.getName(), approvalStatue);
this.saveOrUpdate(unitInfo); this.saveOrUpdate(unitInfo);
//更新待办 //更新待办
// commonService.updateTaskModelNew(buildJXSSHUpdateTaskModel(basicGridAcceptance, unitInfo, kv)); WorkflowResultDto workflowResultDto = workFlowService.buildWorkFlowInfo(CollectionUtil.newArrayList(processTaskDTO)).get(0);
workflowResultDto.setInstanceId(planInstanceId);
updateUnitInfoTask(dealerReview, workflowResultDto);
}catch (Exception e){ } catch (Exception e) {
if (!ObjectUtils.isEmpty(unitInfo.getAmosCompanySeq())) { if (!ObjectUtils.isEmpty(unitInfo.getAmosCompanySeq())) {
FeignClientResult<CompanyModel> feignClientResult = Privilege.companyClient FeignClientResult<CompanyModel> feignClientResult = Privilege.companyClient
...@@ -681,15 +698,13 @@ public class UnitInfoServiceImpl extends BaseService<UnitInfoDto,UnitInfo,UnitIn ...@@ -681,15 +698,13 @@ public class UnitInfoServiceImpl extends BaseService<UnitInfoDto,UnitInfo,UnitIn
} }
e.printStackTrace(); e.printStackTrace();
throw new BaseException("获取工作流节点失败!","400","获取工作流节点失败!"); throw new BaseException("获取工作流节点失败!", "400", "获取工作流节点失败!");
} }
// // 2.更新审核记录表 // // 2.更新审核记录表
// UnitInfo unitInfo=null; // UnitInfo unitInfo=null;
// try{ // try{
...@@ -800,28 +815,22 @@ public class UnitInfoServiceImpl extends BaseService<UnitInfoDto,UnitInfo,UnitIn ...@@ -800,28 +815,22 @@ public class UnitInfoServiceImpl extends BaseService<UnitInfoDto,UnitInfo,UnitIn
return code; return code;
} }
private Map<String, Object> buildJXSSHUpdateTaskModel(BasicGridAcceptance basicGridAcceptance, UnitInfo unitInfo, Map<String, Object> params) { private void updateUnitInfoTask(DealerReview dealerReview, WorkflowResultDto workflowResultDto) {
Map<String, Object> map = new HashMap<>(); Map<String, Object> updateTaskParam = new HashMap<>();
if ("0".equals(params.get("approvalStatus"))) { updateTaskParam.put("flowStatus", FlowStatusEnum.TO_BE_FINISHED.getCode());
map.put("flowStatus", FlowStatusEnum.TO_BE_FINISHED.getCode()); updateTaskParam.put("flowStatusLabel", FlowStatusEnum.TO_BE_FINISHED.getName());
map.put("flowStatusLabel", FlowStatusEnum.TO_BE_FINISHED.getName()); updateTaskParam.put("taskStatus", FlowStatusEnum.TO_BE_FINISHED.getCode());
map.put("taskStatus", FlowStatusEnum.TO_BE_FINISHED.getCode()); updateTaskParam.put("taskStatusLabel", FlowStatusEnum.TO_BE_FINISHED.getName());
map.put("taskStatusLabel", FlowStatusEnum.TO_BE_FINISHED.getName()); updateTaskParam.put("model", dealerReview);
} else { updateTaskParam.put("relationId", workflowResultDto.getInstanceId());
map.put("flowStatus", FlowStatusEnum.TO_BE_PROCESSED.getCode()); commonService.updateTaskModel(updateTaskParam);
map.put("flowStatusLabel", FlowStatusEnum.TO_BE_PROCESSED.getName()); commonService.buildTaskModel((commonService.buildTaskModelDto(dealerReview, workflowResultDto, BusinessTypeEnum.HYGF_JXS_SH)));
map.put("taskStatus", FlowStatusEnum.TO_BE_PROCESSED.getCode());
map.put("taskStatusLabel", FlowStatusEnum.TO_BE_PROCESSED.getName());
}
map.put("model", unitInfo);
map.put("relationId", basicGridAcceptance.getInstanceId());
return map;
} }
@Override @Override
public IPage<CompanyDto> getCompanyDto(CompanyDto dto) { public IPage<CompanyDto> getCompanyDto(CompanyDto dto) {
//列表数据组装 //列表数据组装
IPage<CompanyDto> pag = unitInfoMapper.getCompanyDto( dto); IPage<CompanyDto> pag = unitInfoMapper.getCompanyDto(dto);
// List<CompanyDto> pag = unitInfoMapper.getCompanyDto( (page.getCurrent()-1)*page.getSize(),page.getSize(),dto); // List<CompanyDto> pag = unitInfoMapper.getCompanyDto( (page.getCurrent()-1)*page.getSize(),page.getSize(),dto);
//// Map<String,Integer> count = unitInfoMapper.getCompanyDtoCount(dto); //// Map<String,Integer> count = unitInfoMapper.getCompanyDtoCount(dto);
//// page.setTotal(count.get("num")); //// page.setTotal(count.get("num"));
...@@ -830,124 +839,120 @@ public class UnitInfoServiceImpl extends BaseService<UnitInfoDto,UnitInfo,UnitIn ...@@ -830,124 +839,120 @@ public class UnitInfoServiceImpl extends BaseService<UnitInfoDto,UnitInfo,UnitIn
} }
//单位详情 //单位详情
public UnitDataDto getUnitDataDto(Long id){ public UnitDataDto getUnitDataDto(Long id) {
LambdaQueryWrapper<UnitInfo> queryWrapper = new LambdaQueryWrapper<UnitInfo>(); LambdaQueryWrapper<UnitInfo> queryWrapper = new LambdaQueryWrapper<UnitInfo>();
queryWrapper.eq(UnitInfo::getAmosCompanySeq, id); queryWrapper.eq(UnitInfo::getAmosCompanySeq, id);
UnitInfo unitInfo= unitInfoMapper.selectOne(queryWrapper); UnitInfo unitInfo = unitInfoMapper.selectOne(queryWrapper);
LambdaQueryWrapper<CommerceInfo> queryWrapper1 = new LambdaQueryWrapper<CommerceInfo>(); LambdaQueryWrapper<CommerceInfo> queryWrapper1 = new LambdaQueryWrapper<CommerceInfo>();
queryWrapper1.eq(CommerceInfo::getUnitSeq, unitInfo.getSequenceNbr()); queryWrapper1.eq(CommerceInfo::getUnitSeq, unitInfo.getSequenceNbr());
CommerceInfo commerceInfo= commerceInfoMapper.selectOne(queryWrapper1); CommerceInfo commerceInfo = commerceInfoMapper.selectOne(queryWrapper1);
//单位管理 //单位管理
UnitInformation unitInformation=new UnitInformation(); UnitInformation unitInformation = new UnitInformation();
//工商信息 //工商信息
CommerceDto commerceDto=new CommerceDto(); CommerceDto commerceDto = new CommerceDto();
//管理员账号 //管理员账号
Account cccount=new Account(); Account cccount = new Account();
BeanUtils.copyProperties(unitInfo,unitInformation); BeanUtils.copyProperties(unitInfo, unitInformation);
unitInformation.setHeadCardPhotoBack(unitInformation.getHeadCardPhotoBack()); unitInformation.setHeadCardPhotoBack(unitInformation.getHeadCardPhotoBack());
unitInformation.setHeadCardPhotoFront(unitInformation.getHeadCardPhotoFront()); unitInformation.setHeadCardPhotoFront(unitInformation.getHeadCardPhotoFront());
unitInformation.setRegisterPcdCode((unitInformation.getRegisterPcdCode()!=null&&!"".equals(unitInformation.getRegisterPcdCode()))?unitInformation.getRegisterPcdCode():null); unitInformation.setRegisterPcdCode((unitInformation.getRegisterPcdCode() != null && !"".equals(unitInformation.getRegisterPcdCode())) ? unitInformation.getRegisterPcdCode() : null);
unitInformation.setWorkPcdCode((unitInformation.getWorkPcdCode()!=null&&!"".equals(unitInformation.getWorkPcdCode()))?unitInformation.getWorkPcdCode():null); unitInformation.setWorkPcdCode((unitInformation.getWorkPcdCode() != null && !"".equals(unitInformation.getWorkPcdCode())) ? unitInformation.getWorkPcdCode() : null);
BeanUtils.copyProperties(commerceInfo,commerceDto); BeanUtils.copyProperties(commerceInfo, commerceDto);
commerceDto.setBusinessLicensePhoto(commerceDto.getBusinessLicensePhoto()); commerceDto.setBusinessLicensePhoto(commerceDto.getBusinessLicensePhoto());
commerceDto.setLegalPersonCardPhotoBack(commerceDto.getLegalPersonCardPhotoBack()); commerceDto.setLegalPersonCardPhotoBack(commerceDto.getLegalPersonCardPhotoBack());
commerceDto.setLegalPersonCardPhotoFront(commerceDto.getLegalPersonCardPhotoFront()); commerceDto.setLegalPersonCardPhotoFront(commerceDto.getLegalPersonCardPhotoFront());
BeanUtils.copyProperties(unitInfo,cccount); BeanUtils.copyProperties(unitInfo, cccount);
UnitDataDto unitDataDt = new UnitDataDto(unitInformation,commerceDto,cccount); UnitDataDto unitDataDt = new UnitDataDto(unitInformation, commerceDto, cccount);
return unitDataDt; return unitDataDt;
} }
@Transactional(rollbackFor = Exception.class)
public Boolean updateUnitDataDto(UnitDataDto unitDataDto) {
//验证二维码
UnitInfo unitInfo = new UnitInfo();
unitInfo = unitInfoMapper.selectById(unitDataDto.getUnitInformation().getSequenceNbr());
UnitInformation unitInformation = unitDataDto.getUnitInformation();
List<Long> dis = unitInformation.getRegionalCompaniesSeq();
//区域公司
LambdaQueryWrapper<RegionalCompanies> qu = new LambdaQueryWrapper<>();
qu.eq(RegionalCompanies::getUnitId, unitInfo.getAmosCompanySeq());
List<RegionalCompanies> oldList = regionalCompaniesMapper.selectList(qu);
List<String> oldDisString = oldList.stream().map((regionalCompanies) -> regionalCompanies.getRegionalCompaniesSeq().toString()).collect(Collectors.toList());
List<String> newDisString = dis.stream().map((regionalCompaniesSeq) -> regionalCompaniesSeq.toString()).collect(Collectors.toList());
for (String item : oldDisString) {
if (!newDisString.contains(item)) {
throw new BadRequest("所属区域公司只能增加, 不能删除");
}
}
List<String> lisk = new ArrayList<>();
JSONArray regionName = getRegionName();
List<RegionModel> list = JSONArray.parseArray(regionName.toJSONString(), RegionModel.class);
List<Integer> regist = unitInformation.getRegisterPcdCodeList();
List<Integer> workP = unitInformation.getWorkPcdCodeList();
//注册地址
if (regist != null && !regist.isEmpty()) {
StringBuilder codenameRegi = new StringBuilder();
for (int i = 0, len = regist.size(); i < len; i++) {
for (RegionModel regionModel : list) {
if (regionModel.getRegionCode().intValue() == regist.get(i).intValue()) {
codenameRegi.append(regionModel.getRegionName());
if (i != len - 1) {
codenameRegi.append("-");
}
}
}
}
unitInformation.setRegisterPcd(codenameRegi != null && !"".equals(codenameRegi.toString()) ? codenameRegi.toString() : null);
}
//办公地址
@Transactional(rollbackFor = Exception.class) if (workP != null && !workP.isEmpty()) {
public Boolean updateUnitDataDto(UnitDataDto unitDataDto){ StringBuilder codenamework = new StringBuilder();
//验证二维码 ;
UnitInfo unitInfo=new UnitInfo(); for (int i = 0, len = workP.size(); i < len; i++) {
unitInfo= unitInfoMapper.selectById(unitDataDto.getUnitInformation().getSequenceNbr()); for (RegionModel regionModel : list) {
UnitInformation unitInformation= unitDataDto.getUnitInformation(); if (regionModel.getRegionCode().intValue() == workP.get(i).intValue()) {
List<Long> dis= unitInformation.getRegionalCompaniesSeq(); codenamework.append(regionModel.getRegionName());
//区域公司 if (i != len - 1) {
LambdaQueryWrapper<RegionalCompanies> qu=new LambdaQueryWrapper<>(); codenamework.append("-");
qu.eq(RegionalCompanies::getUnitId,unitInfo.getAmosCompanySeq()); }
List<RegionalCompanies> oldList = regionalCompaniesMapper.selectList(qu); }
List<String> oldDisString = oldList.stream().map((regionalCompanies) -> regionalCompanies.getRegionalCompaniesSeq().toString()).collect(Collectors.toList()); }
List<String> newDisString = dis.stream().map((regionalCompaniesSeq) -> regionalCompaniesSeq.toString()).collect(Collectors.toList()); }
for(String item:oldDisString){ unitInformation.setWorkPcd(codenamework != null && !"".equals(codenamework.toString()) ? codenamework.toString() : null);
if(!newDisString.contains(item)){ }
throw new BadRequest("所属区域公司只能增加, 不能删除"); unitInformation.setHeadCardPhotoBackUrl(unitInformation.getHeadCardPhotoBackUrl());
} unitInformation.setHeadCardPhotoFrontUrl(unitInformation.getHeadCardPhotoFrontUrl());
} unitInformation.setRegisterPcdCodeList(unitInformation.getRegisterPcdCodeList());
unitInformation.setWorkPcdCodeList(unitInformation.getWorkPcdCodeList());
List<String> lisk=new ArrayList<>();
JSONArray regionName = getRegionName();
List<RegionModel> list = JSONArray.parseArray(regionName.toJSONString(), RegionModel.class); List<String> disST = dis.stream().map(x -> x + "").collect(Collectors.toList());
List<Integer> regist= unitInformation.getRegisterPcdCodeList(); BeanUtils.copyProperties(unitInformation, unitInfo);
List<Integer> workP= unitInformation.getWorkPcdCodeList(); CommerceInfo commerceInfo = new CommerceInfo();
//注册地址 commerceInfo = commerceInfoMapper.selectById(unitDataDto.getCommerceDto().getSequenceNbr());
if(regist!=null&&!regist.isEmpty()){ CommerceDto commerceDto = unitDataDto.getCommerceDto();
StringBuilder codenameRegi=new StringBuilder(); commerceDto.setBusinessLicensePhotoUrl(commerceDto.getBusinessLicensePhotoUrl());
for (int i = 0, len = regist.size(); i < len; i++) { commerceDto.setLegalPersonCardPhotoBackUrl(commerceDto.getLegalPersonCardPhotoBackUrl());
for (RegionModel regionModel : list) { commerceDto.setLegalPersonCardPhotoFrontUrl(commerceDto.getLegalPersonCardPhotoFrontUrl());
if (regionModel.getRegionCode().intValue() == regist.get(i).intValue()) { BeanUtils.copyProperties(commerceDto, commerceInfo);
codenameRegi.append(regionModel.getRegionName()); unitInfo.setRegionalCompaniesSeq(disST);
if (i != len - 1) {
codenameRegi.append("-");
}
}
}
}
unitInformation.setRegisterPcd(codenameRegi!=null&&!"".equals(codenameRegi.toString())?codenameRegi.toString():null);
}
//办公地址
if(workP!=null&&!workP.isEmpty()){
StringBuilder codenamework= new StringBuilder();;
for (int i = 0, len = workP.size(); i < len; i++) {
for (RegionModel regionModel : list) {
if (regionModel.getRegionCode().intValue() == workP.get(i).intValue()) {
codenamework.append(regionModel.getRegionName());
if (i != len - 1) {
codenamework.append("-");
}
}
}
}
unitInformation.setWorkPcd(codenamework!=null&&!"".equals(codenamework.toString())?codenamework.toString():null);
}
unitInformation.setHeadCardPhotoBackUrl(unitInformation.getHeadCardPhotoBackUrl());
unitInformation.setHeadCardPhotoFrontUrl(unitInformation.getHeadCardPhotoFrontUrl());
unitInformation.setRegisterPcdCodeList(unitInformation.getRegisterPcdCodeList());
unitInformation.setWorkPcdCodeList(unitInformation.getWorkPcdCodeList());
List<String> disST= dis.stream().map(x->x+"").collect(Collectors.toList());
BeanUtils.copyProperties(unitInformation,unitInfo);
CommerceInfo commerceInfo=new CommerceInfo();
commerceInfo= commerceInfoMapper.selectById(unitDataDto.getCommerceDto().getSequenceNbr());
CommerceDto commerceDto= unitDataDto.getCommerceDto();
commerceDto.setBusinessLicensePhotoUrl(commerceDto.getBusinessLicensePhotoUrl());
commerceDto.setLegalPersonCardPhotoBackUrl(commerceDto.getLegalPersonCardPhotoBackUrl());
commerceDto.setLegalPersonCardPhotoFrontUrl(commerceDto.getLegalPersonCardPhotoFrontUrl());
BeanUtils.copyProperties(commerceDto,commerceInfo);
unitInfo.setRegionalCompaniesSeq(disST);
unitInfoMapper.updateById(unitInfo); unitInfoMapper.updateById(unitInfo);
commerceInfoMapper.updateById(commerceInfo); commerceInfoMapper.updateById(commerceInfo);
regionalCompaniesMapper.delete(qu); regionalCompaniesMapper.delete(qu);
List<RegionalCompanies> regionalComp = new ArrayList<>();
FeignClientResult<Collection<CompanyModel>> feignClientResult = Privilege.companyClient.querySubAgencyTree(regionalCompanies);
List<RegionalCompanies> regionalComp= new ArrayList<>(); List<CompanyModel> companyModel = (List<CompanyModel>) feignClientResult.getResult();
FeignClientResult<Collection<CompanyModel>> feignClientResult= Privilege.companyClient.querySubAgencyTree(regionalCompanies); List<String> lisd = unitInfo.getRegionalCompaniesSeq();
List<CompanyModel> companyModel = (List<CompanyModel>)feignClientResult.getResult();
List<String> lisd=unitInfo.getRegionalCompaniesSeq();
if (oldList == null) { if (oldList == null) {
...@@ -1000,22 +1005,20 @@ public class UnitInfoServiceImpl extends BaseService<UnitInfoDto,UnitInfo,UnitIn ...@@ -1000,22 +1005,20 @@ public class UnitInfoServiceImpl extends BaseService<UnitInfoDto,UnitInfo,UnitIn
} }
public JSONArray getRegionName() {
public JSONArray getRegionName(){
JSONArray jsonArray = new JSONArray(); JSONArray jsonArray = new JSONArray();
if (redisUtil.hasKey(regionRedis)) { if (redisUtil.hasKey(regionRedis)) {
jsonArray= JSONArray.parseArray(redisUtil.get(regionRedis).toString()); jsonArray = JSONArray.parseArray(redisUtil.get(regionRedis).toString());
}else { } else {
Collection<RegionModel> regionChild = new ArrayList<>(); Collection<RegionModel> regionChild = new ArrayList<>();
RegionModel regionModel1 = new RegionModel(); RegionModel regionModel1 = new RegionModel();
regionChild.add(regionModel1); regionChild.add(regionModel1);
FeignClientResult<Collection<RegionModel>> collectionFeignClientResult = Systemctl.regionClient.queryForTreeParent(610000L); FeignClientResult<Collection<RegionModel>> collectionFeignClientResult = Systemctl.regionClient.queryForTreeParent(610000L);
Collection<RegionModel> result = collectionFeignClientResult.getResult(); Collection<RegionModel> result = collectionFeignClientResult.getResult();
for (RegionModel regionModel : result) { for (RegionModel regionModel : result) {
if(null != regionModel && null != regionModel.getChildren()) { if (null != regionModel && null != regionModel.getChildren()) {
for (RegionModel child : regionModel.getChildren()) { for (RegionModel child : regionModel.getChildren()) {
if(null != child && null != child.getChildren()) { if (null != child && null != child.getChildren()) {
for (RegionModel childChild : child.getChildren()) { for (RegionModel childChild : child.getChildren()) {
jsonArray.add(childChild); jsonArray.add(childChild);
} }
...@@ -1028,23 +1031,22 @@ public class UnitInfoServiceImpl extends BaseService<UnitInfoDto,UnitInfo,UnitIn ...@@ -1028,23 +1031,22 @@ public class UnitInfoServiceImpl extends BaseService<UnitInfoDto,UnitInfo,UnitIn
} }
} }
redisUtil.set(regionRedis,jsonArray); redisUtil.set(regionRedis, jsonArray);
} }
return jsonArray; return jsonArray;
} }
public Page<PeasantHousehold> getPeasantHouseholdData(Long unitInfoId,
public Page<PeasantHousehold> getPeasantHouseholdData( Long unitInfoId, Long regionalCompaniesSeq,
Long regionalCompaniesSeq, int pageNum,
int pageNum, int pageSize,
int pageSize, String peasantHouseholdNo,
String peasantHouseholdNo, String ownersName,
String ownersName, String ids) {
String ids){ UnitInfo unitInfo = unitInfoMapper.selectById(unitInfoId);
UnitInfo unitInfo=unitInfoMapper.selectById(unitInfoId);
PageHelper.startPage(pageNum, pageSize); PageHelper.startPage(pageNum, pageSize);
List<PeasantHousehold> list=peasantHouseholdMapper.selectPeasantHouseholdList(unitInfo.getAmosCompanySeq(),regionalCompaniesSeq,peasantHouseholdNo,ownersName,ids); List<PeasantHousehold> list = peasantHouseholdMapper.selectPeasantHouseholdList(unitInfo.getAmosCompanySeq(), regionalCompaniesSeq, peasantHouseholdNo, ownersName, ids);
PageInfo<PeasantHousehold> page = new PageInfo(list); PageInfo<PeasantHousehold> page = new PageInfo(list);
Page<PeasantHousehold> pagenew = new Page<PeasantHousehold>(); Page<PeasantHousehold> pagenew = new Page<PeasantHousehold>();
pagenew.setCurrent(pageNum); pagenew.setCurrent(pageNum);
...@@ -1053,15 +1055,16 @@ public class UnitInfoServiceImpl extends BaseService<UnitInfoDto,UnitInfo,UnitIn ...@@ -1053,15 +1055,16 @@ public class UnitInfoServiceImpl extends BaseService<UnitInfoDto,UnitInfo,UnitIn
pagenew.setRecords(page.getList()); pagenew.setRecords(page.getList());
return pagenew; return pagenew;
} }
public Page<PeasantHousehold> selectPeasantHouseholdListsg( Long unitInfoId,
Long regionalCompaniesSeq, public Page<PeasantHousehold> selectPeasantHouseholdListsg(Long unitInfoId,
int pageNum, Long regionalCompaniesSeq,
int pageSize, int pageNum,
String peasantHouseholdNo, int pageSize,
String ownersName, String peasantHouseholdNo,
String ids){ String ownersName,
String ids) {
PageHelper.startPage(pageNum, pageSize); PageHelper.startPage(pageNum, pageSize);
List<PeasantHousehold> list=peasantHouseholdMapper.selectPeasantHouseholdListsg(unitInfoId,regionalCompaniesSeq,peasantHouseholdNo,ownersName,ids); List<PeasantHousehold> list = peasantHouseholdMapper.selectPeasantHouseholdListsg(unitInfoId, regionalCompaniesSeq, peasantHouseholdNo, ownersName, ids);
PageInfo<PeasantHousehold> page = new PageInfo(list); PageInfo<PeasantHousehold> page = new PageInfo(list);
Page<PeasantHousehold> pagenew = new Page<PeasantHousehold>(); Page<PeasantHousehold> pagenew = new Page<PeasantHousehold>();
pagenew.setCurrent(pageNum); pagenew.setCurrent(pageNum);
......
...@@ -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,15 +99,14 @@ public class WorkFlowService { ...@@ -70,15 +99,14 @@ 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()));
if (!CollectionUtils.isEmpty(item.getNextTask())) { if (!CollectionUtils.isEmpty(item.getNextTask())) {
ActTaskDTO actTaskDTO = item.getNextTask().get(0); ActTaskDTO actTaskDTO = item.getNextTask().get(0);
workflowResultDto.setTaskName(actTaskDTO.getName()); workflowResultDto.setTaskName(actTaskDTO.getName());
...@@ -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