Commit 943b699b authored by tianbo's avatar tianbo

Merge remote-tracking branch 'origin/develop_tzs_register' into develop_tzs_register

# Conflicts: # amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-biz/src/main/java/com/yeejoin/amos/boot/module/jg/biz/service/impl/JgInstallationNoticeServiceImpl.java
parents 0c0ca08a 8634f107
......@@ -248,5 +248,14 @@ public class JgInstallationNoticeDto extends BaseDto {
@JsonSerialize(using = BizCustomDateSerializer.class)
private Date handleDate;
private String createUserCompanyName;
//下一步任务ID
private String nextTaskId;
/**
* 创建人
*/
private String createUserName;
}
......@@ -400,4 +400,19 @@ public class JgInstallationNotice extends BaseEntity {
*/
private String approvalStatus;
@TableField(value = "\"create_user_company_name\"")
private String createUserCompanyName;
//下一步任务ID
@TableField(value = "\"next_taskId\"")
private String nextTaskId;
/**
* 创建人
*/
@TableField("\"create_user_name\"")
private String createUserName;
}
......@@ -81,10 +81,13 @@
isn.install_leader_name AS installLeaderName,
isn.install_leader_phone AS installLeaderPhone,
isn.use_unit_name AS useUnitName,
tec2.name AS equCategory,
tec1.name AS equList,
tec.name AS equDefine,
isn.equ_register_code AS equRegisterCode,
ri.equ_list AS equList,
ri.equ_category AS equCategory,
ri.EQU_DEFINE AS equDefine,
ri.product_name AS productName,
ri.brand_name AS brandName,
ri.equ_type AS equType,
......@@ -124,6 +127,9 @@
LEFT JOIN idx_biz_jg_inspection_detection_info idi ON idi.record = re.equ_id
LEFT JOIN idx_biz_jg_use_info ui ON ui.record = re.equ_id
LEFT JOIN tz_base_enterprise_info ei ON ei.use_code = isn.use_unit_credit_code
LEFT JOIN amos_tzs_biz.tz_equipment_category tec ON ri."EQU_CATEGORY"::text = tec.code::text
LEFT JOIN amos_tzs_biz.tz_equipment_category tec1 ON ri."EQU_LIST"::text = tec1.code::text
LEFT JOIN amos_tzs_biz.tz_equipment_category tec2 ON ri."EQU_DEFINE"::text = tec2.code::text
WHERE
isn.sequence_nbr = #{sequenceNbr}
LIMIT 1
......
......@@ -48,6 +48,7 @@ import java.io.IOException;
import java.lang.reflect.Field;
import java.sql.Timestamp;
import java.util.*;
import java.util.stream.Collectors;
import static com.alibaba.fastjson.JSON.toJSONString;
......@@ -292,8 +293,10 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
//注册登记
IdxBizJgRegisterInfo registerInfo = this.getOne(new QueryWrapper<IdxBizJgRegisterInfo>().eq("RECORD", record));
if (!ValidationUtil.isEmpty(registerInfo)) {
String equList = registerInfo.getEquList();//设备种类
String equCategory = registerInfo.getEquCategory();//设备类别
String equDefine = registerInfo.getEquDefine();//设备品种
List<EquipmentCategory> categoryList0 = commonService.getEquipmentCategoryList(equList, null);
List<EquipmentCategory> categoryList1 = commonService.getEquipmentCategoryList(equCategory, null);
List<EquipmentCategory> categoryList2 = commonService.getEquipmentCategoryList(equDefine, null);
Map<String, Object> registerInfoMap;
......@@ -302,6 +305,9 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
registerInfoMap.put("registerinfoSeq", registerInfo.getSequenceNbr());
registerInfoMap.put("sequenceNbr", registerInfo.getSequenceNbr());
registerInfoMap.put("productPhoto", JSON.parseArray(registerInfo.getProductPhoto()));
if (CollectionUtils.isNotEmpty(categoryList0)) {
registerInfoMap.put("equListDesc", categoryList0.get(0).getName());
}
if (CollectionUtils.isNotEmpty(categoryList1)) {
registerInfoMap.put("equCategoryDesc", categoryList1.get(0).getName());
}
......@@ -321,7 +327,11 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
}
}
if (!registerInfoMap.isEmpty()) {
objMap.putAll(registerInfoMap);
Map<String, Object> filterMap = registerInfoMap.entrySet()
.stream()
.filter(e -> e.getValue() != null && e.getValue() != "" )
.collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue));
objMap.putAll(filterMap);
}
}
return objMap;
......@@ -404,7 +414,11 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
useInfoMap.put("USEINFO_SEQ", useInfo.getSequenceNbr());
}
if (!useInfoMap.isEmpty()) {
objMap.putAll(useInfoMap);
Map<String, Object> filterMap = useInfoMap.entrySet()
.stream()
.filter(e -> e.getValue() != null && e.getValue() != "" )
.collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue));
objMap.putAll(filterMap);
}
}
//设计制造
......@@ -422,7 +436,11 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
designInfoMap.put("DESIGNINFO_SEQ", designInfo.getSequenceNbr());
}
if (!designInfoMap.isEmpty()) {
objMap.putAll(designInfoMap);
Map<String, Object> filterMap = designInfoMap.entrySet()
.stream()
.filter(e -> e.getValue() != null && e.getValue() != "" )
.collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue));
objMap.putAll(filterMap);
}
}
//制造信息
......@@ -453,7 +471,11 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
factoryInfoMap.put("FACTORYINFO_SEQ", factoryInfo.getSequenceNbr());
}
if (!factoryInfoMap.isEmpty()) {
objMap.putAll(factoryInfoMap);
Map<String, Object> filterMap = factoryInfoMap.entrySet()
.stream()
.filter(e -> e.getValue() != null && e.getValue() != "" )
.collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue));
objMap.putAll(filterMap);
}
}
//施工信息 【一对多,暂时只取最新一条数据】
......@@ -468,7 +490,11 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
constructionInfoMap.put("CONSTRUCTIONINFO_SEQ", constructionInfo.getSequenceNbr());
}
if (!constructionInfoMap.isEmpty()) {
objMap.putAll(constructionInfoMap);
Map<String, Object> filterMap = constructionInfoMap.entrySet()
.stream()
.filter(e -> e.getValue() != null && e.getValue() != "" )
.collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue));
objMap.putAll(filterMap);
}
}
//注册登记
......@@ -503,7 +529,11 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
}
}
if (!registerInfoMap.isEmpty()) {
objMap.putAll(registerInfoMap);
Map<String, Object> filterMap = registerInfoMap.entrySet()
.stream()
.filter(e -> e.getValue() != null && e.getValue() != "" )
.collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue));
objMap.putAll(filterMap);
}
}
//维保备案【一对多,暂时只取最新一条数据】
......@@ -518,7 +548,11 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
maintenanceRecordInfoMap.put("MAINTENANCERECORDINFO_SEQ", maintenanceRecordInfo.getSequenceNbr());
}
if (!maintenanceRecordInfoMap.isEmpty()) {
objMap.putAll(maintenanceRecordInfoMap);
Map<String, Object> filterMap = maintenanceRecordInfoMap.entrySet()
.stream()
.filter(e -> e.getValue() != null && e.getValue() != "" )
.collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue));
objMap.putAll(filterMap);
}
}
//监督管理
......@@ -533,7 +567,11 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
supervisionInfoMap.put("SUPERVISIONINFO_SEQ", supervisionInfo.getSequenceNbr());
}
if (!supervisionInfoMap.isEmpty()) {
objMap.putAll(supervisionInfoMap);
Map<String, Object> filterMap = supervisionInfoMap.entrySet()
.stream()
.filter(e -> e.getValue() != null && e.getValue() != "" )
.collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue));
objMap.putAll(filterMap);
}
}
//其他信息
......@@ -548,7 +586,11 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
otherInfoMap.put("OTHERINFO_SEQ", otherInfo.getSequenceNbr());
}
if (!otherInfoMap.isEmpty()) {
objMap.putAll(otherInfoMap);
Map<String, Object> filterMap = otherInfoMap.entrySet()
.stream()
.filter(e -> e.getValue() != null && e.getValue() != "" )
.collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue));
objMap.putAll(filterMap);
}
}
//检验检测【一对多,暂时只取最新一条数据】
......@@ -565,7 +607,11 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
inspectionDetectionInfoMap.put("INSPECTIONDETECTIONINFO_SEQ", inspectionDetectionInfo.getSequenceNbr());
}
if (!inspectionDetectionInfoMap.isEmpty()) {
objMap.putAll(inspectionDetectionInfoMap);
Map<String, Object> filterMap = inspectionDetectionInfoMap.entrySet()
.stream()
.filter(e -> e.getValue() != null && e.getValue() != "" )
.collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue));
objMap.putAll(filterMap);
}
}
......@@ -597,7 +643,11 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
elevatorMap.put("ELEVATOR_SEQ", elevator.getSequenceNbr());
}
if (!elevatorMap.isEmpty()) {
objMap.putAll(elevatorMap);
Map<String, Object> filterMap = elevatorMap.entrySet()
.stream()
.filter(e -> e.getValue() != null && e.getValue() != "" )
.collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue));
objMap.putAll(filterMap);
}
}
} else if (EquipmentClassifityEnum.CC.getCode().equals(equipCode)) {
......@@ -613,7 +663,11 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
vehicleMap.put("VEHICLE_SEQ", vehicle.getSequenceNbr());
}
if (!vehicleMap.isEmpty()) {
objMap.putAll(vehicleMap);
Map<String, Object> filterMap = vehicleMap.entrySet()
.stream()
.filter(e -> e.getValue() != null && e.getValue() != "" )
.collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue));
objMap.putAll(filterMap);
}
}
// 主要零部件
......@@ -633,7 +687,11 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
ropewayMap.put("ROPEWAY_SEQ", ropeway.getSequenceNbr());
}
if (!ropewayMap.isEmpty()) {
objMap.putAll(ropewayMap);
Map<String, Object> filterMap = ropewayMap.entrySet()
.stream()
.filter(e -> e.getValue() != null && e.getValue() != "" )
.collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue));
objMap.putAll(filterMap);
}
}
// 主要零部件
......@@ -652,7 +710,11 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
ridesMap.put("RIDES_SEQ", rides.getSequenceNbr());
}
if (!ridesMap.isEmpty()) {
objMap.putAll(ridesMap);
Map<String, Object> filterMap = ridesMap.entrySet()
.stream()
.filter(e -> e.getValue() != null && e.getValue() != "" )
.collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue));
objMap.putAll(filterMap);
}
}
......@@ -669,7 +731,11 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
boilerMap.put("BOILER_SEQ", boiler.getSequenceNbr());
}
if (!boilerMap.isEmpty()) {
objMap.putAll(boilerMap);
Map<String, Object> filterMap = boilerMap.entrySet()
.stream()
.filter(e -> e.getValue() != null && e.getValue() != "" )
.collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue));
objMap.putAll(filterMap);
}
}
// 安全附件
......@@ -688,7 +754,11 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
vesselMap.put("VESSEL_SEQ", vessel.getSequenceNbr());
}
if (!vesselMap.isEmpty()) {
objMap.putAll(vesselMap);
Map<String, Object> filterMap = vesselMap.entrySet()
.stream()
.filter(e -> e.getValue() != null && e.getValue() != "" )
.collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue));
objMap.putAll(filterMap);
}
}
// 主要零部件和安全附件
......@@ -709,7 +779,11 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
pipelineMap.put("PIPELINE_SEQ", pipeline.getSequenceNbr());
}
if (!pipelineMap.isEmpty()) {
objMap.putAll(pipelineMap);
Map<String, Object> filterMap = pipelineMap.entrySet()
.stream()
.filter(e -> e.getValue() != null && e.getValue() != "" )
.collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue));
objMap.putAll(filterMap);
}
}
// 主要零部件
......@@ -728,7 +802,11 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
liftingMap.put("LIFTING_SEQ", lifting.getSequenceNbr());
}
if (!liftingMap.isEmpty()) {
objMap.putAll(liftingMap);
Map<String, Object> filterMap = liftingMap.entrySet()
.stream()
.filter(e -> e.getValue() != null && e.getValue() != "" )
.collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue));
objMap.putAll(filterMap);
}
}
......@@ -1264,7 +1342,7 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
List<IdxBizJgMainParts> mainPartsList = new ArrayList<>();
List<IdxBizJgProtectionDevices> protectionDevicesList = new ArrayList<>();
if (EQUIP_MAINPARTS_FORM_ID.equals(subFormType)) {
if (EQUIP_MAINPARTS_FORM_ID.equals(subFormType) && !ValidationUtil.isEmpty(list)) {
for (Object s : list) {
List subFormMainPartsList = (ArrayList) map.get(s);
if (!ObjectUtils.isEmpty(subFormMainPartsList)) {
......@@ -1279,7 +1357,7 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
}
}
return mainPartsList;
} else if (EQUIP_PROTECTIONDEVICES_FORM_ID.equals(subFormType)) {
} else if (EQUIP_PROTECTIONDEVICES_FORM_ID.equals(subFormType) && !ValidationUtil.isEmpty(list)) {
for (Object s : list) {
List subFormProtectionDevicesList = (ArrayList) map.get(s);
if (!ObjectUtils.isEmpty(subFormProtectionDevicesList)) {
......
......@@ -275,7 +275,7 @@ public class JgChangeRegistrationReformServiceImpl extends BaseService<JgChangeR
// 驳回操作
jgChangeRegistrationReform.setAuditStatus(WorkFlowStatusEnum.getMessage(taskCode).getReject());
jgChangeRegistrationReform.setStatus(WorkFlowStatusEnum.getMessage(taskCode).getReject());
jgChangeRegistrationReform.setPromoter(null);
jgChangeRegistrationReform.setPromoter("");
}
if(updateTodoAndCreate) {
// 上个代办改为已办
......@@ -316,10 +316,9 @@ public class JgChangeRegistrationReformServiceImpl extends BaseService<JgChangeR
map.put("flowStatus", FlowStatusEnum.TO_BE_FINISHED.getCode());
map.put("flowStatusLabel", FlowStatusEnum.TO_BE_FINISHED.getName());
map.put("relationId", jgChangeRegistrationReform.getInstanceId());
TaskV2Model taskV2Model = commonServiceImpl.updateTaskModel(map);
jgChangeRegistrationReform.setNextTaskId(null);
jgChangeRegistrationReform.setNextExecuteUserIds(null);
jgChangeRegistrationReform.setNextExecutorIds(null);
jgChangeRegistrationReform.setNextExecuteUserIds("");
map.put("model",jgChangeRegistrationReform);
commonServiceImpl.updateTaskModel(map);
}
this.getBaseMapper().updateById(jgChangeRegistrationReform);
}
......@@ -368,6 +367,7 @@ public class JgChangeRegistrationReformServiceImpl extends BaseService<JgChangeR
jgChangeRegistrationReform.setStatus(WorkFlowStatusEnum.getMessage(taskCode).getRollBack());
}
jgChangeRegistrationReform.setPromoter(reginParams.getUserModel().getUserId());
jgChangeRegistrationReform.setNextTaskId(workflowResultDto.getNextTaskId());
jgChangeRegistrationReform.setNextExecutorIds(role);
this.update(jgChangeRegistrationReform, lambda);
// commonServiceImpl.deleteTaskModel(instanceId);
......@@ -375,6 +375,7 @@ public class JgChangeRegistrationReformServiceImpl extends BaseService<JgChangeR
jsonObject.put("nextTaskId", jgChangeRegistrationReform.getNextTaskId());
jsonObject.put("nextExecuteUser", jgChangeRegistrationReform.getNextExecutorIds());
jsonObject.put("taskType",BusinessTypeEnum.JG_RENOVATION_REGISTRATION.getCode());
jsonObject.put("model",jgChangeRegistrationReform);
commonServiceImpl.rollbackTask(instanceId,jsonObject);
}
......
package com.yeejoin.amos.boot.module.jg.biz.service.impl;
import com.alibaba.fastjson.JSON;
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.QueryWrapper;
......@@ -11,13 +10,9 @@ import com.yeejoin.amos.boot.biz.common.utils.RedisKey;
import com.yeejoin.amos.boot.biz.common.utils.RedisUtils;
import com.yeejoin.amos.boot.module.jg.api.dto.TaskModelDto;
import com.yeejoin.amos.boot.module.jg.api.dto.WorkflowResultDto;
import com.yeejoin.amos.boot.module.jg.api.entity.JgChangeRegistrationReform;
import com.yeejoin.amos.boot.module.jg.api.entity.JgChangeRegistrationTransfer;
import com.yeejoin.amos.boot.module.jg.api.entity.JgChangeRegistrationTransferEq;
import com.yeejoin.amos.boot.module.jg.api.entity.JgRegistrationHistory;
import com.yeejoin.amos.boot.module.jg.api.entity.*;
import com.yeejoin.amos.boot.module.jg.api.enums.BusinessTypeEnum;
import com.yeejoin.amos.boot.module.jg.api.enums.EquipTypeEnum;
import com.yeejoin.amos.boot.module.jg.api.enums.UseStatusEnum;
import com.yeejoin.amos.boot.module.jg.api.enums.WorkFlowStatusEnum;
import com.yeejoin.amos.boot.module.jg.api.mapper.JgChangeRegistrationNameEqMapper;
import com.yeejoin.amos.boot.module.jg.api.mapper.JgChangeRegistrationReformEqMapper;
......@@ -42,13 +37,8 @@ import com.yeejoin.amos.boot.module.ymt.api.enums.ApplicationFormTypeEnum;
import com.yeejoin.amos.boot.module.ymt.api.enums.FlowStatusEnum;
import com.yeejoin.amos.boot.module.ymt.api.mapper.IdxBizJgOtherInfoMapper;
import com.yeejoin.amos.boot.module.ymt.api.mapper.IdxBizJgRegisterInfoMapper;
import com.yeejoin.amos.component.feign.model.FeignClientResult;
import com.yeejoin.amos.feign.privilege.Privilege;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import com.yeejoin.amos.feign.systemctl.model.TaskV2Model;
import com.yeejoin.amos.feign.workflow.Workflow;
import com.yeejoin.amos.feign.workflow.model.*;
import fr.opensagres.xdocreport.core.io.IOUtils;
import org.apache.commons.collections.CollectionUtils;
import org.elasticsearch.action.search.SearchRequest;
import org.elasticsearch.action.search.SearchResponse;
......@@ -62,7 +52,6 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.core.io.Resource;
import org.springframework.util.ObjectUtils;
import org.springframework.util.StringUtils;
import org.typroject.tyboot.core.foundation.context.RequestContext;
import org.typroject.tyboot.core.foundation.utils.Bean;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
......@@ -74,14 +63,10 @@ import org.typroject.tyboot.core.restful.utils.ResponseModel;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.time.LocalDate;
import java.util.*;
import java.util.stream.Collectors;
import static com.alibaba.fastjson.JSON.parseArray;
import static com.yeejoin.amos.boot.module.jg.api.enums.BusinessTypeEnum.JG_CHANGE_REGISTRATION;
/**
* 移装变更登记登记服务实现类
*
......@@ -170,7 +155,7 @@ public class JgChangeRegistrationTransferServiceImpl extends BaseService<JgChang
}
CompanyBo company = reginParams.getCompany();
String sequenceNbr = (String) map.get("sequenceNbr");
String equId = (String) map.get("equipId");
String equId = (String) tableData.get("record");
String receiveOrgCode = (String) tableData.get("receiveOrgCode");
String receiveOrgName = "";
String supervisoryCode = "";
......@@ -191,14 +176,6 @@ public class JgChangeRegistrationTransferServiceImpl extends BaseService<JgChang
receiveOrgName = receiveOrgCodeList[1];
}
}
//查询申请单号
ResponseModel<List<String>> result = tzsServiceFeignClient.applicationFormCode(ApplicationFormTypeEnum.YZBG.getCode(), 1);
if (!result.getResult().isEmpty()) {
//申请编号
oldTransfer.setApplyNo(result.getResult().get(0));
} else {
throw new BadRequest("申请单编号生成失败,请稍后重试!");
}
//有sequenceNbr代表修改数据
if (!ValidationUtil.isEmpty(sequenceNbr)) {
......@@ -211,6 +188,15 @@ public class JgChangeRegistrationTransferServiceImpl extends BaseService<JgChang
oldHistory = jgRegistrationHistoryService.getDteailByRecord(oldTransferEq.getEquId(), oldTransfer.getApplyNo());
useInfo = idxBizJgUseInfoService.getOneData(oldTransferEq.getEquId());
}
}else {
//查询申请单号
ResponseModel<List<String>> result = tzsServiceFeignClient.applicationFormCode(ApplicationFormTypeEnum.getCode.get(String.valueOf(tableData.get("businessCode"))), 1);
if (!result.getResult().isEmpty()) {
//申请编号
oldTransfer.setApplyNo(result.getResult().get(0));
} else {
throw new BadRequest("申请单编号生成失败,请稍后重试!");
}
}
//登记类别
......@@ -392,22 +378,27 @@ public class JgChangeRegistrationTransferServiceImpl extends BaseService<JgChang
ProcessTaskDTO processTask = icmWorkflowService.rollBack(instanceId);
WorkflowResultDto workflowResult = commonService.buildWorkFlowInfo(Collections.singletonList(processTask)).get(0);
String taskCode = Optional.ofNullable(workflowResult.getNextTaskCode()).orElse("");
String role = Optional.ofNullable(workflowResult.getNextExecutorRoleIds()).orElse("");
String taskCode = "";
String role = "";
if(!ValidationUtil.isEmpty(workflowResult)){
taskCode = Optional.ofNullable(workflowResult.getNextTaskCode()).orElse("");
role = Optional.ofNullable(workflowResult.getNextExecutorRoleIds()).orElse("");
jgTransfer.setNextTaskId(workflowResult.getNextTaskId());
// 更新下一步可执行人
jgTransfer.setNextExecuteUserIds(workflowResult.getNextExecutorUserIds());
}
if (!ObjectUtils.isEmpty(taskCode)) {
jgTransfer.setAuditStatus(WorkFlowStatusEnum.getMessage(taskCode).getRollBack());
jgTransfer.setStatus(WorkFlowStatusEnum.getMessage(taskCode).getRollBack());
}
jgTransfer.setPromoter(reginParams.getUserModel().getUserId());
jgTransfer.setNextExecutorIds(role);
// 更新下一步可执行人
jgTransfer.setNextExecuteUserIds(workflowResult.getNextExecutorUserIds());
this.update(jgTransfer, lambda);
//待办 撤回
JSONObject jsonObject = JSON.parseObject(JSON.toJSONString(jgTransfer));
jsonObject.put("nextTaskId", jgTransfer.getNextTaskId());
jsonObject.put("nextExecuteUser", jgTransfer.getNextExecutorIds());
JgChangeRegistrationTransfer data = this.baseMapper.selectOne(lambda);
JSONObject jsonObject = JSONObject.parseObject(JSONObject.toJSONString(data));
jsonObject.put("nextTaskId", data.getNextTaskId());
jsonObject.put("nextExecuteUser", data.getNextExecutorIds());
jsonObject.put("taskType",BusinessTypeEnum.JG_CHANGE_REGISTRATION.getCode());
commonService.rollbackTask(instanceId, JSON.parseObject(JSON.toJSONString(jgTransfer)));
}
......@@ -700,6 +691,7 @@ public class JgChangeRegistrationTransferServiceImpl extends BaseService<JgChang
map.put("flowStatus", FlowStatusEnum.TO_BE_FINISHED.getCode());
map.put("flowStatusLabel", FlowStatusEnum.TO_BE_FINISHED.getName());
map.put("relationId", jgChangeRegistrationTransfer.getInstanceId());
map.put("model", jgChangeRegistrationTransfer);
TaskV2Model taskV2Model = commonService.updateTaskModel(map);
}
......
......@@ -12,13 +12,19 @@ import com.yeejoin.amos.boot.biz.common.entity.DataDictionary;
import com.yeejoin.amos.boot.biz.common.utils.DateUtils;
import com.yeejoin.amos.boot.biz.common.utils.RedisUtils;
import com.yeejoin.amos.boot.module.jg.api.dto.JgInstallationNoticeDto;
import com.yeejoin.amos.boot.module.jg.api.dto.TaskModelDto;
import com.yeejoin.amos.boot.module.jg.api.dto.WorkflowResultDto;
import com.yeejoin.amos.boot.module.jg.api.entity.JgInstallationNotice;
import com.yeejoin.amos.boot.module.jg.api.entity.JgInstallationNoticeEq;
import com.yeejoin.amos.boot.module.jg.api.entity.JgTransferNotice;
import com.yeejoin.amos.boot.module.jg.api.entity.JgTransferNoticeEq;
import com.yeejoin.amos.boot.module.jg.api.enums.BusinessTypeEnum;
import com.yeejoin.amos.boot.module.jg.api.enums.CompanyTypeEnum;
import com.yeejoin.amos.boot.module.jg.api.mapper.JgInstallationNoticeEqMapper;
import com.yeejoin.amos.boot.module.jg.api.mapper.JgInstallationNoticeMapper;
import com.yeejoin.amos.boot.module.jg.api.service.IJgInstallationNoticeService;
import com.yeejoin.amos.boot.module.jg.biz.feign.TzsServiceFeignClient;
import com.yeejoin.amos.boot.module.jg.biz.service.ICmWorkflowService;
import com.yeejoin.amos.boot.module.jg.biz.service.IIdxBizJgConstructionInfoService;
import com.yeejoin.amos.boot.module.jg.biz.service.IIdxBizJgUseInfoService;
import com.yeejoin.amos.boot.module.jg.biz.utils.ImageUtils;
......@@ -36,10 +42,7 @@ import com.yeejoin.amos.feign.privilege.model.CompanyModel;
import com.yeejoin.amos.feign.systemctl.Systemctl;
import com.yeejoin.amos.feign.systemctl.model.TaskV2Model;
import com.yeejoin.amos.feign.workflow.Workflow;
import com.yeejoin.amos.feign.workflow.model.ActWorkflowBatchDTO;
import com.yeejoin.amos.feign.workflow.model.ActWorkflowStartDTO;
import com.yeejoin.amos.feign.workflow.model.AjaxResult;
import com.yeejoin.amos.feign.workflow.model.TaskResultDTO;
import com.yeejoin.amos.feign.workflow.model.*;
import fr.opensagres.xdocreport.core.io.IOUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
......@@ -142,6 +145,13 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN
@Autowired
AmosRequestContext amosRequestContext;
@Autowired
private ICmWorkflowService iCmWorkflowService;
@Autowired
private CommonServiceImpl commonService;
/**
* 根据sequenceNbr查询
*
......@@ -185,10 +195,10 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN
equipmentInfos.get(0).put(s, parseArray(equipmentInfos.get(0).get(s).toString()));
}
}
Map<String, Object> map = equipmentInfos.get(0);
BeanUtil.copyProperties(installationInfo, map, "equList", "supervisoryCode");
return new HashMap<String, Map<String, Object>>() {{
this.put("installationInfo", installationInfo);
this.put("equipmentInfo", equipmentInfos.get(0));
this.put("installationInfo", map);
}};
}
......@@ -199,89 +209,104 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN
*/
@SuppressWarnings({"rawtypes", "Duplicates"})
public JgInstallationNoticeDto updateInstallationNotice(String submitType, JgInstallationNoticeDto noticeDto, String op) {
boolean instancedId = ObjectUtils.isEmpty(noticeDto.getInstanceId());
ReginParams reginParams = JSONObject.parseObject(redisUtils.get(RedisKey.buildReginKey(RequestContext.getExeUserId(), RequestContext.getToken())).toString(), ReginParams.class);
if (Objects.isNull(noticeDto) || StringUtils.isEmpty(submitType)) {
throw new IllegalArgumentException("参数不能为空");
}
String[] taskName = new String[]{"流程结束"};
// 字段转换
this.convertField(noticeDto);
ArrayList<String> roleListFirst = new ArrayList<>();
ArrayList<String> roleListSecond = new ArrayList<>();
JgInstallationNotice notice = this.getById(noticeDto.getSequenceNbr());
if (SUBMIT_TYPE_FLOW.equals(submitType)) {
AjaxResult ajaxResult;
// 发起流程
if (!StringUtils.hasText(noticeDto.getInstanceId())) {
// 发起流程
ProcessTaskDTO processTaskDTO = new ProcessTaskDTO();
WorkflowResultDto workflowResultDto = new WorkflowResultDto();
// 如果没有实例ID,说明是启动并执行一步
// 直接调用工作流 启动并执行API - 可以拿到两个节点的信息,用于填充业务字段
ActWorkflowBatchDTO actWorkflowBatchDTO = new ActWorkflowBatchDTO();
List<ActWorkflowStartDTO> list = new ArrayList<>();
ActWorkflowStartDTO dto = new ActWorkflowStartDTO();
dto.setProcessDefinitionKey(PROCESS_DEFINITION_KEY);
dto.setBusinessKey("1");
try {
ajaxResult = Workflow.taskClient.startByVariable(dto);
String instanceId = ((Map) ajaxResult.get("data")).get("id").toString();
noticeDto.setInstanceId(instanceId);
// 查询下节点任务
getNext(roleListFirst, instanceId,taskName);
noticeDto.setInstanceStatus(String.join(",", roleListFirst));
} catch (Exception e) {
log.error("提交失败:{}", e);
dto.setBusinessKey(noticeDto.getSequenceNbr().toString());
dto.setCompleteFirstTask(Boolean.TRUE);
list.add(dto);
actWorkflowBatchDTO.setProcess(list);
processTaskDTO = iCmWorkflowService.startBatch(actWorkflowBatchDTO).get(0);
// 提取节点等信息
workflowResultDto = commonService.buildWorkFlowInfo(Collections.singletonList(processTaskDTO)).get(0);
BeanUtils.copyProperties(noticeDto, notice);
if (!ObjectUtils.isEmpty(notice.getInstanceStatus())) {
notice.setInstanceStatus(notice.getInstanceStatus() + "," + workflowResultDto.getNextExecutorRoleIds());
} else {
notice.setInstanceStatus(workflowResultDto.getNextExecutorRoleIds());
}
notice.setPromoter(RequestContext.getExeUserId());
notice.setNextExecuteIds(String.join(",", workflowResultDto.getNextExecutorRoleIds()));
notice.setNoticeStatus(String.valueOf(FlowStatusEnum.TO_BE_PROCESSED.getCode()));
notice.setNextTaskId(workflowResultDto.getNextTaskId());
this.updateById(notice);
// 如果为保存并提交,则创建代办
buildTask(Collections.singletonList(notice), Collections.singletonList(workflowResultDto));
} else {
ProcessTaskDTO processTaskDTO = new ProcessTaskDTO();
WorkflowResultDto workflowResultDto = new WorkflowResultDto();
// 只调用执行API,返回下个节点信息,用于填充业务字段
//组装信息
TaskResultDTO dto = new TaskResultDTO();
dto.setResultCode("approvalStatus");
dto.setTaskId(notice.getNextTaskId());
HashMap<String, Object> commMap = new HashMap<>();
if (notice.getNoticeStatus().equals("6614") || notice.getNoticeStatus().equals("6615")) {
commMap.put("approvalStatus", "提交");
} else {
commMap.put("approvalStatus", op);
}
JgInstallationNotice notice = new JgInstallationNotice();
BeanUtils.copyProperties(noticeDto,notice);
boolean submit = submit(notice, op);
if(submit) {
// 查询下节点任务
getNext(roleListSecond, notice.getInstanceId(),taskName);
notice.setStatus(taskName[0]);
dto.setVariable(commMap);
processTaskDTO = iCmWorkflowService.complete(notice.getNextTaskId(), dto);
// 提取节点等信息
workflowResultDto = commonService.buildWorkFlowInfo(Collections.singletonList(processTaskDTO)).get(0);
BeanUtils.copyProperties(noticeDto, notice);
if (!ObjectUtils.isEmpty(notice.getInstanceStatus())) {
notice.setInstanceStatus(notice.getInstanceStatus() + "," + roleListSecond);
notice.setInstanceStatus(notice.getInstanceStatus() + "," + workflowResultDto.getNextExecutorRoleIds());
} else {
notice.setInstanceStatus(String.join(",", roleListSecond));
notice.setInstanceStatus(workflowResultDto.getNextExecutorRoleIds());
}
notice.setPromoter(RequestContext.getExeUserId());
notice.setNextExecuteIds(String.join(",", roleListSecond));
notice.setNextExecuteIds(String.join(",", workflowResultDto.getNextExecutorRoleIds()));
notice.setNoticeStatus(String.valueOf(FlowStatusEnum.TO_BE_PROCESSED.getCode()));
jgInstallationNoticeMapper.updateById(notice);
}
if (!instancedId) {
notice.setNextTaskId(workflowResultDto.getNextTaskId());
this.updateById(notice);
// 上个代办改为已办
HashMap<String, Object> map = new HashMap<>();
map.put("taskStatus", FlowStatusEnum.TO_BE_PROCESSED.getCode());
map.put("taskStatusLabel", FlowStatusEnum.TO_BE_PROCESSED.getName());
map.put("relationId", notice.getInstanceId());
map.put("taskStatus", FlowStatusEnum.TO_BE_FINISHED.getCode());
map.put("taskStatusLabel", FlowStatusEnum.TO_BE_FINISHED.getName());
updateTaskModel(map,null);
map.put("flowStatus", FlowStatusEnum.TO_BE_PROCESSED.getCode());
map.put("flowStatusLabel", FlowStatusEnum.TO_BE_PROCESSED.getName());
TaskV2Model taskV2Model = commonService.updateTaskModel(map);
if (ObjectUtils.isEmpty(taskV2Model)) {
// 如果为保存并提交,则创建代办
buildTask(Collections.singletonList(notice), Collections.singletonList(workflowResultDto));
} else {
TaskModelDto taskModelDto = new TaskModelDto();
BeanUtils.copyProperties(taskV2Model, taskModelDto);
// 创建新的代办
taskModelDto.setModel(notice);
taskModelDto.setTaskName(workflowResultDto.getNextTaskName());
taskModelDto.setExecuteUserIds(workflowResultDto.getNextExecutorUserIds());
taskModelDto.setFlowStatus(FlowStatusEnum.TO_BE_PROCESSED.getCode());
taskModelDto.setFlowStatusLabel(FlowStatusEnum.TO_BE_PROCESSED.getName());
taskModelDto.setFlowCode(notice.getNextTaskId());
taskModelDto.setNextExecuteUser(workflowResultDto.getNextExecutorRoleIds());
commonService.buildTaskModel(Collections.singletonList(taskModelDto));
}
}
TaskV2Model taskV2Model = new TaskV2Model();
//获取待办任务执行人
List<AgencyUserModel> userList = Privilege.agencyUserClient
.queryByRoleId(notice.getNextExecuteIds(), null,Boolean.FALSE).getResult();
List<String> userIds = userList.stream().map(AgencyUserModel::getUserId).collect(Collectors.toList());
taskV2Model.setExecuteUserIds(CollectionUtils.isEmpty(userIds)?"": String.join(",", userIds));
taskV2Model.setExtras(JSON.toJSONString(notice));
taskV2Model.setRelationId(notice.getInstanceId());
Map<String, Object> userOrgRoleMap = FeignUtil.remoteCall(() -> Privilege.userOrgRoleClient.getme());
List<String> userOrgRoleList = (List<String>) userOrgRoleMap.get("roleId");
String roleIds = String.join(",", userOrgRoleList);
taskV2Model.setTaskType("installNotice");
taskV2Model.setTaskTypeLabel("安装告知");
String url = getUrl(taskV2Model.getTaskType(), "look");
String format = String.format(url, notice.getSequenceNbr(), notice.getNextExecuteIds(), notice.getNextExecuteIds(), notice.getNoticeStatus(), notice.getInstanceId());
taskV2Model.setRoutePath(format);
taskV2Model.setTaskTitle(notice.getStatus());
taskV2Model.setTaskName(notice.getStatus());
taskV2Model.setTaskStatus(FlowStatusEnum.TO_BE_PROCESSED.getCode());
taskV2Model.setTaskStatusLabel(FlowStatusEnum.TO_BE_PROCESSED.getName());
taskV2Model.setTaskCode(notice.getApplyNo());
buildTaskModel(taskV2Model);
} else {
JgInstallationNotice bean = new JgInstallationNotice();
BeanUtils.copyProperties(noticeDto, bean);
jgInstallationNoticeMapper.updateById(bean);
this.updateById(bean);
}
return noticeDto;
}
......@@ -434,11 +459,7 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN
@SuppressWarnings({"Duplicates", "rawtypes"})
@Transactional(rollbackFor = Exception.class)
public void saveNotice(String submitType, JSONObject jgInstallationNoticeDtoMap, ReginParams reginParams) {
String[] taskName = new String[]{"流程结束"};
// TransactionStatus transactionStatus = platformTransactionManager.getTransaction(transactionDefinition);
// JgInstallationNoticeDto model = BeanUtil.toBeanIgnoreError(jgInstallationNoticeDtoMap.get(TABLE_PAGE_ID).toString(), JgInstallationNoticeDto.class);
JgInstallationNoticeDto model = JSON.parseObject(jgInstallationNoticeDtoMap.get(TABLE_PAGE_ID).toString(), JgInstallationNoticeDto.class);
// 字段转换
convertField(model);
......@@ -448,7 +469,6 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN
if (CollectionUtils.isEmpty(deviceList)) {
throw new BadRequest("设备列表为空");
}
// 获取告知单号
ResponseModel<List<String>> listResponseModel = tzsServiceFeignClient.applicationFormCode(ApplicationFormTypeEnum.AZGZ.getCode(), deviceList.size());
if (!ObjectUtils.isEmpty(listResponseModel) && listResponseModel.getStatus() != HttpStatus.OK.value()) {
......@@ -461,9 +481,57 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN
throw new BadRequest("告知单生成失败!");
}
// 启动工作流并返回信息
List<WorkflowResultDto> workflowResultList = workFlowInfo(submitType, deviceList);
List<JgInstallationNotice> list = new ArrayList<>();
List<JgInstallationNoticeEq> equipList = new ArrayList<>();
//业务数据组装等
businessData(submitType, reginParams, model, deviceList, applyNoList, list, equipList, workflowResultList);
jgInstallationNoticeMapper.insertBatchSomeColumn(list);
// 如果为保存并提交,则创建代办
if (SUBMIT_TYPE_FLOW.equals(submitType)) {
buildTask(list, workflowResultList);
}
List<JgInstallationNoticeEq> jgRelationEquipList = equipList.stream().map(jgRelationEquip -> {
List<JgInstallationNotice> collect = list.stream().filter(jgInstallationNotice -> jgRelationEquip.getEquipTransferId().equals(jgInstallationNotice.getApplyNo())).collect(Collectors.toList());
Long sequenceNbr = collect.get(0).getSequenceNbr();
return jgRelationEquip.setEquipTransferId(String.valueOf(sequenceNbr));
}).collect(Collectors.toList());
jgInstallationNoticeEqMapper.insertBatchSomeColumn(jgRelationEquipList);
}
private void buildTask(List<JgInstallationNotice> list, List<WorkflowResultDto> workflowResultList) {
List<TaskModelDto> taskModelDtoList = new ArrayList<>();
WorkflowResultDto workflowResultDto = workflowResultList.get(0);
list.forEach(item -> {
TaskModelDto taskModelDto = new TaskModelDto();
taskModelDto.setFlowCreateDate(item.getCreateDate());
taskModelDto.setTaskName(workflowResultDto.getNextTaskName()); // 工作流API返回
taskModelDto.setTaskCode(item.getApplyNo());
taskModelDto.setTaskType(BusinessTypeEnum.JG_INSTALLATION_NOTIFICATION.getCode());
taskModelDto.setTaskTypeLabel(BusinessTypeEnum.JG_INSTALLATION_NOTIFICATION.getName());
taskModelDto.setRelationId(item.getInstanceId());
taskModelDto.setExecuteUserIds(workflowResultDto.getNextExecutorUserIds()); // 工作流API返回
taskModelDto.setTaskStatusLabel(FlowStatusEnum.TO_BE_PROCESSED.getName());
taskModelDto.setFlowStatus(commonService.getDictionaryCodeByName(FlowStatusEnum.TO_BE_PROCESSED.getName())); // 流程状态枚举
taskModelDto.setFlowStatusLabel(FlowStatusEnum.TO_BE_PROCESSED.getName());
taskModelDto.setFlowCode(item.getNextTaskId());
taskModelDto.setStartUserId(item.getCreateUserId());
taskModelDto.setStartUser(item.getCreateUserName());
taskModelDto.setStartUserCompanyName(item.getCreateUserCompanyName()); // 任务发起人所在单位
taskModelDto.setStartDate(item.getCreateDate());
taskModelDto.setModel(item);
taskModelDto.setNextExecuteUser(item.getNextExecuteIds());
taskModelDto.setTaskContent(String.format("来自%s【%s】的业务办理,【申请单号:%s】", item.getEquList(), StringUtils.isEmpty(item.getEquRegisterCode()) ? "" : item.getEquRegisterCode(), item.getApplyNo()));
taskModelDtoList.add(taskModelDto);
});
commonService.buildTaskModel(taskModelDtoList);
}
private void businessData(String submitType, ReginParams reginParams, JgInstallationNoticeDto model, List<Map<String, Object>> deviceList, List<String> applyNoList, List<JgInstallationNotice> list, List<JgInstallationNoticeEq> equipList, List<WorkflowResultDto> workflowResultList) {
deviceList.forEach(obj -> {
JgInstallationNoticeEq jgRelationEquip = new JgInstallationNoticeEq();
JgInstallationNotice dto = new JgInstallationNotice();
......@@ -473,116 +541,61 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN
dto.setApplyNo(applyNo);
dto.setNoticeDate(new Date());
if(SUBMIT_TYPE_FLOW.equals(submitType)) {
dto.setPromoter(RequestContext.getExeUserId());
dto.setNoticeStatus(String.valueOf(FlowStatusEnum.TO_BE_SUBMITTED.getCode()));
dto.setNextExecuteIds(workflowResultList.get(i).getNextExecutorRoleIds());
dto.setInstanceStatus(workflowResultList.get(i).getNextExecutorRoleIds() + "," + workflowResultList.get(i).getExecutorRoleIds());
dto.setPromoter(reginParams.getUserModel().getUserId());
dto.setNextTaskId(workflowResultList.get(i).getNextTaskId());
}
dto.setCreateUserId(RequestContext.getExeUserId());
dto.setInstallUnitName(reginParams.getCompany().getCompanyName());
dto.setInstallUnitCreditCode(reginParams.getCompany().getCompanyCode());
dto.setEquList((String.valueOf(obj.get("EQU_CATEGORY"))));
dto.setEntrustingUnitName(dto.getUseUnitName());
dto.setCreateUserCompanyName(reginParams.getCompany().getCompanyName());
dto.setEquRegisterCode(String.valueOf(obj.get("EQU_CODE")));
StringBuffer buffer = new StringBuffer();
buffer.append(dto.getProvinceName()).append(dto.getCityName()).append(dto.getCountyName()).append(dto.getAddress());
dto.setEquAddress(buffer.toString());
jgRelationEquip.setEquId(String.valueOf(obj.get("SEQUENCE_NBR")));
jgRelationEquip.setEquipTransferId(applyNo);
if (!CollectionUtils.isEmpty(workflowResultList)) {
dto.setInstanceId(workflowResultList.get(i).getInstanceId());
dto.setNoticeStatus(String.valueOf(FlowStatusEnum.TO_BE_PROCESSED.getCode()));
} else {
dto.setNoticeStatus(String.valueOf(FlowStatusEnum.TO_BE_SUBMITTED.getCode()));
}
dto.setCreateUserName(reginParams.getUserModel().getRealName());
dto.setCreateUserId(reginParams.getUserModel().getUserId());
list.add(dto);
equipList.add(jgRelationEquip);
});
}
jgInstallationNoticeMapper.insertBatchSomeColumn(list);
List<JgInstallationNoticeEq> jgRelationEquipList = equipList.stream().map(jgRelationEquip -> {
List<JgInstallationNotice> collect = list.stream().filter(jgInstallationNotice -> jgRelationEquip.getEquipTransferId().equals(jgInstallationNotice.getApplyNo())).collect(Collectors.toList());
Long sequenceNbr = collect.get(0).getSequenceNbr();
return jgRelationEquip.setEquipTransferId(String.valueOf(sequenceNbr));
}).collect(Collectors.toList());
jgInstallationNoticeEqMapper.insertBatchSomeColumn(jgRelationEquipList);
// 需要在事务提交之后,否则事务隔离查询不出数据
TransactionSynchronizationManager.registerSynchronization(new TransactionSynchronization() {
@Override
public void afterCommit() {
ActWorkflowBatchDTO actWorkflowBatchDTO = new ActWorkflowBatchDTO();
List<ActWorkflowStartDTO> workflowStartDTOS = new ArrayList<>();
list.forEach(item -> {
/**
* 工作流启动并执行
* @param submitType 是否提交
* @param deviceList 设备信息
* @return 工作流返回相关数据
*/
private List<WorkflowResultDto> workFlowInfo(String submitType, List<Map<String, Object>> deviceList) {
if (SUBMIT_TYPE_FLOW.equals(submitType)) {
// 发起流程
ActWorkflowBatchDTO actWorkflowBatchDTO = new ActWorkflowBatchDTO();
List<ActWorkflowStartDTO> list = new ArrayList<>();
deviceList.forEach(item -> {
ActWorkflowStartDTO dto = new ActWorkflowStartDTO();
dto.setProcessDefinitionKey(PROCESS_DEFINITION_KEY);
dto.setBusinessKey(item.getSequenceNbr() + "");
dto.setBusinessKey(item.get("SEQUENCE_NBR").toString());
dto.setCompleteFirstTask(Boolean.TRUE);
workflowStartDTOS.add(dto);
}
list.add(dto);
});
try {
actWorkflowBatchDTO.setProcess(workflowStartDTOS);
Workflow.taskV2Client.startByVariableBatch(actWorkflowBatchDTO);
} catch (Exception e) {
log.error("提交失败:{}", e);
actWorkflowBatchDTO.setProcess(list);
List<ProcessTaskDTO> processTaskDTOS = iCmWorkflowService.startBatch(actWorkflowBatchDTO);
// 组装工作流返回的数据
return commonService.buildWorkFlowInfo(processTaskDTOS);
}
return new ArrayList<>();
}
});
// platformTransactionManager.commit(transactionStatus);
// list.forEach(item -> {
// // 代办业务
// if(SUBMIT_TYPE_FLOW.equals(submitType)) {
// TaskV2Model taskV2Model = new TaskV2Model();
// //获取待办任务执行人
// List<AgencyUserModel> userList = Privilege.agencyUserClient
// .queryByRoleId(item.getNextExecuteIds(), null,Boolean.FALSE).getResult();
// List<String> userIds = userList.stream().map(AgencyUserModel::getUserId).collect(Collectors.toList());
// taskV2Model.setExecuteUserIds(CollectionUtils.isEmpty(userIds)?"": String.join(",", userIds));
// taskV2Model.setExtras(JSON.toJSONString(item));
// taskV2Model.setRelationId(item.getInstanceId());
// Map<String, Object> userOrgRoleMap = FeignUtil.remoteCall(() -> Privilege.userOrgRoleClient.getme());
// List<String> userOrgRoleList = (List<String>) userOrgRoleMap.get("roleId");
// String roleIds = String.join(",", userOrgRoleList);
// taskV2Model.setTaskType("installNotice");
// taskV2Model.setTaskTypeLabel("安装告知");
// String url = getUrl(taskV2Model.getTaskType(), "look");
// String format = String.format(url, item.getSequenceNbr(), item.getNextExecuteIds(), item.getNextExecuteIds(), item.getNoticeStatus(), item.getInstanceId());
// taskV2Model.setRoutePath(format);
// taskV2Model.setTaskTitle(item.getStatus());
// taskV2Model.setTaskName(item.getStatus());
// taskV2Model.setTaskStatus(FlowStatusEnum.TO_BE_PROCESSED.getCode());
// taskV2Model.setTaskStatusLabel(FlowStatusEnum.TO_BE_PROCESSED.getName());
// taskV2Model.setTaskCode(item.getApplyNo());
// buildTaskModel(taskV2Model);
// }
// });
}
void getNext(ArrayList<String> roleListFirst, String instanceId, String[] taskName) {
AjaxResult aj = Workflow.taskClient.getTaskNoAuth(instanceId);
JSONObject taskNoAuth = JSON.parseObject(JSON.toJSONString(aj.get("data")));
if (!ObjectUtils.isEmpty(taskNoAuth)) {
String nextTaskId = taskNoAuth.getString("id");
AjaxResult taskGroupName = Workflow.taskClient.getTaskGroupName(nextTaskId);
taskName[0] = taskNoAuth.getString("name");
JSONArray data = parseArray(JSON.toJSONString(taskGroupName.get("data")));
for (Object datum : data) {
if (((Map) datum).containsKey("groupId")) {
roleListFirst.add(((Map) datum).get("groupId").toString());
}
}
}
}
private void convertField(JgInstallationNoticeDto model) {
// 处理图片
if(!ValidationUtil.isEmpty(model.getProxyStatementAttachmentList())) {
......@@ -667,145 +680,53 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN
}
}
private String convertImageUrl(List<Map<String, String>> urlList) {
String urls = "";
if (!CollectionUtils.isEmpty(urlList)) {
urls = urlList.stream().map(map -> map.get("url")).collect(Collectors.joining(","));
}
return urls;
}
public boolean submit(JgInstallationNotice notice,String op) {
AjaxResult ajaxResult = Workflow.taskClient.getTask(notice.getInstanceId());
JSONObject dataObject = JSON.parseObject(JSON.toJSONString(ajaxResult.get("data")));
String taskId = dataObject.getString("id");
//组装信息
TaskResultDTO dto = new TaskResultDTO();
dto.setResultCode("approvalStatus");
dto.setTaskId(taskId);
if(!ValidationUtil.isEmpty(notice.getProcessAdvice())) {
dto.setComment(notice.getProcessAdvice());
}
HashMap<String, Object> map = new HashMap<>();
if(notice.getNoticeStatus().equals("6614") || notice.getNoticeStatus().equals("6615") ) {
map.put("approvalStatus", "提交");
} else {
map.put("approvalStatus", op);
}
dto.setVariable(map);
//执行流程
AjaxResult ajaxResult1 = null;
try {
ajaxResult1 = Workflow.taskClient.completeByTask(taskId, dto);
if (ajaxResult1.get("code").equals(200)) {
return true;
} else {
return false;
}
} catch (Exception e) {
log.error("提交失败:{}", e);
return false;
}
}
public void cancel(JgInstallationNoticeDto noticeDto) {
String[] taskName = new String[]{"流程结束"};
FeignClientResult ajaxResult = Workflow.taskV2Client.rollBack(noticeDto.getInstanceId());
JgInstallationNotice jgInstallationNotice = this.baseMapper.selectById(noticeDto.getSequenceNbr());
ArrayList<String> roleList = new ArrayList<>();
if(ajaxResult.getStatus() == 200) {
// HashMap<String, Object> map = new HashMap<>();
// map.put("relationId", noticeDto.getInstanceId());
// map.put("taskStatus", FlowStatusEnum.TO_BE_FINISHED.getCode());
// map.put("taskStatusLabel", FlowStatusEnum.TO_BE_FINISHED.getName());
// map.put("isDelete", Boolean.TRUE);
// updateTaskModel(map);
getNext(roleList, noticeDto.getInstanceId(),taskName);
jgInstallationNotice.setStatus(taskName[0]);
ProcessTaskDTO processTaskDTO = iCmWorkflowService.rollBack(jgInstallationNotice.getInstanceId());
// 提取节点等信息
WorkflowResultDto workflowResultDto = commonService.buildWorkFlowInfo(Collections.singletonList(processTaskDTO)).get(0);
jgInstallationNotice.setPromoter("");
jgInstallationNotice.setNextExecuteIds(String.join(",", roleList));
jgInstallationNotice.setNextExecuteIds(workflowResultDto.getNextExecutorRoleIds());
jgInstallationNotice.setNoticeStatus(String.valueOf(FlowStatusEnum.ROLLBACK.getCode()));
jgInstallationNoticeMapper.updateById(jgInstallationNotice);
}
jgInstallationNotice.setNextTaskId(workflowResultDto.getNextTaskId());
this.updateById(jgInstallationNotice);
JSONObject jsonObject = JSON.parseObject(JSON.toJSONString(jgInstallationNotice));
jsonObject.put("taskType", BusinessTypeEnum.JG_INSTALLATION_NOTIFICATION.getCode());
jsonObject.put("nextExecuteUser", jgInstallationNotice.getNextExecuteIds());
commonService.rollbackTask(jgInstallationNotice.getInstanceId(), jsonObject);
}
@Transactional(rollbackFor = Exception.class)
public void accept(JgInstallationNoticeDto dto,String op) {
String[] taskName = new String[]{"流程结束"};
String userId = RequestContext.getExeUserId();
JgInstallationNotice jgInstallationNotice = this.jgInstallationNoticeMapper.selectById(dto.getSequenceNbr());
ReginParams reginParams = JSONObject.parseObject(redisUtils.get(RedisKey.buildReginKey(RequestContext.getExeUserId(), RequestContext.getToken())).toString(), ReginParams.class);
JgInstallationNotice jgInstallationNotice = this.getById(dto.getSequenceNbr());
jgInstallationNotice.setProcessAdvice(dto.getProcessAdvice());
ArrayList<String> roleList = new ArrayList<>();
boolean submit = submit(jgInstallationNotice, op);
// if(submit) {
//// getNext(roleList, dto.getInstanceId(),taskName);
//// jgInstallationNotice.setStatus(taskName[0]);
// if("0".equals(op)) {
// finishTask(jgInstallationNotice);
// } else {
// jgInstallationNotice.setPromoter("");
// jgInstallationNotice.setNoticeStatus(String.valueOf(FlowStatusEnum.REJECTED.getCode()));
//
// HashMap<String, Object> map = new HashMap<>();
// map.put("relationId", jgInstallationNotice.getInstanceId());
// map.put("taskStatus", FlowStatusEnum.REJECTED.getCode());
// map.put("taskStatusLabel", FlowStatusEnum.REJECTED.getName());
// TaskV2Model taskV2ModelOld = updateTaskModel(map);
// TaskV2Model taskV2Model = new TaskV2Model();
// //获取待办任务执行人
// List<AgencyUserModel> userList = Privilege.agencyUserClient
// .queryByRoleId(jgInstallationNotice.getNextExecuteIds(), null,Boolean.FALSE).getResult();
// List<String> userIds = userList.stream().map(AgencyUserModel::getUserId).collect(Collectors.toList());
// taskV2Model.setExecuteUserIds(taskV2ModelOld.getRecUserId());
// taskV2Model.setExtras(JSON.toJSONString(jgInstallationNotice));
// taskV2Model.setRelationId(jgInstallationNotice.getInstanceId());
// Map<String, Object> userOrgRoleMap = FeignUtil.remoteCall(() -> Privilege.userOrgRoleClient.getme());
// List<String> userOrgRoleList = (List<String>) userOrgRoleMap.get("roleId");
// String roleIds = String.join(",", userOrgRoleList);
// taskV2Model.setTaskType("installNotice");
// taskV2Model.setTaskTypeLabel("安装告知");
// String url = getUrl(taskV2Model.getTaskType(), "edit");
// String format = String.format(url, jgInstallationNotice.getSequenceNbr(), jgInstallationNotice.getNextExecuteIds(), jgInstallationNotice.getNextExecuteIds(), jgInstallationNotice.getNoticeStatus(), "", jgInstallationNotice.getInstanceId());
// taskV2Model.setRoutePath(format);
// taskV2Model.setTaskTitle(jgInstallationNotice.getStatus());
// taskV2Model.setTaskName(jgInstallationNotice.getStatus());
// taskV2Model.setTaskStatus(FlowStatusEnum.TO_BE_PROCESSED.getCode());
// taskV2Model.setTaskStatusLabel(FlowStatusEnum.TO_BE_PROCESSED.getName());
// taskV2Model.setTaskCode(jgInstallationNotice.getApplyNo());
// buildTaskModel(taskV2Model);
// }
// jgInstallationNoticeMapper.updateById(jgInstallationNotice);
// }
}
public void finishTask(JgInstallationNotice jgInstallationNotice) {
// 组装设备注册代码
StringBuffer stringBuffer = new StringBuffer();
String ym = null;
try {
ym = DateUtils.dateFormat(new Date(), DateUtils.DATE_PATTERN_MM);
} catch (ParseException e) {
log.error("日期转换失败:{}", e);
}
// 组装设备注册代码
StringBuffer stringBuffer = new StringBuffer();
// 执行工作流并返回组装好的工作流信息
WorkflowResultDto workflowResultDto = getWorkflowResultDto(op, jgInstallationNotice);
jgInstallationNotice.setPromoter(reginParams.getUserModel().getUserId());
TaskV2Model taskV2Model = new TaskV2Model();
if ("0".equals(op)) {
if (StringUtils.isEmpty(workflowResultDto.getNextExecutorRoleIds())) {
LambdaQueryWrapper<JgInstallationNoticeEq> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(JgInstallationNoticeEq::getEquipTransferId,jgInstallationNotice.getSequenceNbr());
queryWrapper.eq(JgInstallationNoticeEq::getEquipTransferId,dto.getSequenceNbr());
JgInstallationNoticeEq jgRelationEquip = jgInstallationNoticeEqMapper.selectOne(queryWrapper);
LambdaQueryWrapper<OtherInfo> queryWrapper1 = new LambdaQueryWrapper<>();
queryWrapper1.eq(OtherInfo::getRecord,jgRelationEquip.getEquId());
OtherInfo tzsJgOtherInfo = tzsJgOtherInfoMapper.selectOne(queryWrapper1);
LambdaQueryWrapper<RegistrationInfo> queryWrapper2 = new LambdaQueryWrapper<>();
queryWrapper2.eq(RegistrationInfo::getRecord,jgRelationEquip.getEquId());
RegistrationInfo tzsJgRegistrationInfo = tzsJgRegistrationInfoMapper.selectOne(queryWrapper2);
stringBuffer.append(tzsJgRegistrationInfo.getEquCategory()).append(jgInstallationNotice.getCity()).append(ym);
String equCode = stringBuffer.toString();
ResponseModel<String> responseModel = tzsServiceFeignClient.deviceRegistrationCode(equCode);
String deviceRegistrationCode = responseModel.getResult();
Map<String, Object> map = new HashMap<>();
......@@ -816,7 +737,6 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN
Map<String, Object> mapCode;
ResponseModel<Map<String, Object>> code = tzsServiceFeignClient.createCode(map);
mapCode = code.getResult();
LambdaQueryWrapper<SupervisoryCodeInfo> queryWrapper3 = new LambdaQueryWrapper<>();
queryWrapper3.eq(SupervisoryCodeInfo::getSupervisoryCode,mapCode.get("superviseCode").toString());
SupervisoryCodeInfo supervisoryCodeInfo = supervisoryCodeInfoMapper.selectOne(queryWrapper3);
......@@ -824,9 +744,7 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN
supervisoryCodeInfoMapper.updateById(supervisoryCodeInfo);
jgInstallationNotice.setNoticeStatus(String.valueOf(FlowStatusEnum.TO_BE_FINISHED.getCode()));
jgInstallationNotice.setHandleDate(new Date());
Map<String,Object> map1 =new HashMap<>();
// 更新其他业务表
if(!ValidationUtil.isEmpty(mapCode.get("code96333"))) {
tzsJgOtherInfo.setCode96333(mapCode.get("code96333").toString());
......@@ -841,7 +759,6 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN
map1.put("SUPERVISORY_CODE",tzsJgOtherInfo.getSupervisoryCode());
map1.put("USE_UNIT_CREDIT_CODE",jgInstallationNotice.getUseUnitCreditCode());
map1.put("USE_UNIT_NAME",jgInstallationNotice.getUseUnitName());
map1.put("USC_UNIT_CREDIT_CODE",jgInstallationNotice.getInstallUnitCreditCode());
map1.put("USC_UNIT_NAME",jgInstallationNotice.getInstallUnitName());
objMap.put(tzsJgOtherInfo.getRecord(),map1);
......@@ -849,7 +766,6 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN
tzsServiceFeignClient.commonUpdateEsDataByIds(objMap);
tzsJgOtherInfoMapper.updateById(tzsJgOtherInfo);
tzsJgRegistrationInfoMapper.updateById(tzsJgRegistrationInfo);
// 更新施工信息表
IdxBizJgConstructionInfo idxBizJgConstructionInfo = constructionInfoService.queryNewestDetailByRecord(jgRelationEquip.getEquId());
if (!ObjectUtils.isEmpty(idxBizJgConstructionInfo)) {
......@@ -866,7 +782,6 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN
}
constructionInfoService.saveOrUpdateData(idxBizJgConstructionInfo);
}
// 使用信息表更新是否西咸
IdxBizJgUseInfo useInfo = useInfoService.getOneData(jgRelationEquip.getEquId());
if (!ObjectUtils.isEmpty(useInfo)) {
......@@ -875,158 +790,108 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN
useInfo.setIsNotXiXian(jgInstallationNotice.getIsXixian() == null ? "0" : jgInstallationNotice.getIsXixian());
useInfoService.saveOrUpdateData(useInfo);
}
}
public void buildTaskModel(TaskV2Model model){
// ReginParams reginParams = JSONObject.parseObject(redisUtils.get(RedisKey.buildReginKey(RequestContext.getExeUserId(), RequestContext.getToken())).toString(), ReginParams.class);
model.setStartDate(new Date());
model.setTaskSource("workFlow");
model.setCreateDate(new Date());
//model.setFinishStatus(Boolean.FALSE);
model.setAgencyCode("tzs");
model.setTaskTitle("发起了" + model.getTaskTitle());
Systemctl.taskV2Client.create(model);
}
public TaskV2Model updateTaskModel(Map<String, Object> params, JSONObject jsonObject){
JSONObject userJson = null;
if(jsonObject != null){
userJson = JSON.parseObject(jsonObject.get("user").toString());
}
List<TaskV2Model> result =Systemctl.taskV2Client.selectListByRelationId(params.get("relationId").toString()).getResult();
TaskV2Model model = result.stream().min((r1, r2) -> r2.getSequenceNbr().compareTo(r1.getSequenceNbr()))
.orElse(null);
if(model == null){
return null;
}
model.setTaskStatus(Integer.valueOf(params.get("taskStatus").toString()));
model.setRoutePath(model.getRoutePath().replace("nextExecuteIds", "nextExecuteIdsOld"));
model.setTaskStatusLabel(params.get("taskStatusLabel").toString());
model.setEndDate(new Date());
//model.setFinishStatus(Boolean.TRUE);
model.setEndUserId(userJson != null ? userJson.get("userId").toString() : "");
if (params.containsKey("isDelete")) {
Systemctl.taskV2Client.delete(model.getSequenceNbr().toString());
// 上个代办改为已办
HashMap<String, Object> taskMap = new HashMap<>();
taskMap.put("taskStatus", FlowStatusEnum.TO_BE_FINISHED.getCode());
taskMap.put("taskStatusLabel", FlowStatusEnum.TO_BE_FINISHED.getName());
taskMap.put("relationId", jgInstallationNotice.getInstanceId());
taskMap.put("flowStatus", FlowStatusEnum.TO_BE_FINISHED.getCode());
taskMap.put("flowStatusLabel", FlowStatusEnum.TO_BE_FINISHED.getName());
taskMap.put("model", jgInstallationNotice);
taskV2Model = commonService.updateTaskModel(taskMap);
} else {
Systemctl.taskV2Client.update(model, model.getSequenceNbr());
jgInstallationNotice.setNextExecuteIds(workflowResultDto.getNextExecutorRoleIds());
if (!ObjectUtils.isEmpty(jgInstallationNotice.getInstanceStatus())) {
jgInstallationNotice.setInstanceStatus(jgInstallationNotice.getInstanceStatus() + "," + workflowResultDto.getNextExecutorRoleIds());
} else {
jgInstallationNotice.setInstanceStatus(workflowResultDto.getNextExecutorRoleIds());
}
jgInstallationNotice.setNoticeStatus(String.valueOf(FlowStatusEnum.TO_BE_PROCESSED.getCode()));
// 上个代办改为已办
HashMap<String, Object> taskMap = new HashMap<>();
taskMap.put("taskStatus", FlowStatusEnum.TO_BE_PROCESSED.getCode());
taskMap.put("taskStatusLabel", FlowStatusEnum.TO_BE_PROCESSED.getName());
taskMap.put("flowStatus", FlowStatusEnum.TO_BE_PROCESSED.getCode());
taskMap.put("flowStatusLabel", FlowStatusEnum.TO_BE_PROCESSED.getName());
taskMap.put("relationId", jgInstallationNotice.getInstanceId());
taskV2Model = commonService.updateTaskModel(taskMap);
TaskModelDto taskModelDto = new TaskModelDto();
BeanUtils.copyProperties(taskV2Model, taskModelDto);
// 创建新的代办
taskModelDto.setModel(jgInstallationNotice);
taskModelDto.setTaskName(workflowResultDto.getNextTaskName());
taskModelDto.setExecuteUserIds(workflowResultDto.getNextExecutorUserIds());
taskModelDto.setFlowStatus(FlowStatusEnum.TO_BE_PROCESSED.getCode());
taskModelDto.setFlowStatusLabel(FlowStatusEnum.TO_BE_PROCESSED.getName());
taskModelDto.setFlowCode(workflowResultDto.getNextTaskId());
taskModelDto.setTaskStatusLabel(FlowStatusEnum.TO_BE_PROCESSED.getName());
taskModelDto.setNextExecuteUser(workflowResultDto.getNextExecutorRoleIds());
commonService.buildTaskModel(Collections.singletonList(taskModelDto));
}
return model;
} else {
jgInstallationNotice.setPromoter("");
jgInstallationNotice.setNoticeStatus(String.valueOf(FlowStatusEnum.REJECTED.getCode()));
// 上个代办改为已办
HashMap<String, Object> taskMap = new HashMap<>();
taskMap.put("taskStatus", jgInstallationNotice.getNoticeStatus());
taskMap.put("taskStatusLabel", FlowStatusEnum.REJECTED.getName());
taskMap.put("relationId", jgInstallationNotice.getInstanceId());
taskMap.put("flowStatus", FlowStatusEnum.REJECTED.getCode());
taskMap.put("flowStatusLabel", FlowStatusEnum.REJECTED.getName());
taskV2Model = commonService.updateTaskModel(taskMap);
TaskModelDto taskModelDto = new TaskModelDto();
BeanUtils.copyProperties(taskV2Model, taskModelDto);
// 创建新的代办
taskModelDto.setModel(jgInstallationNotice);
taskModelDto.setTaskName(workflowResultDto.getNextTaskName());
taskModelDto.setExecuteUserIds(workflowResultDto.getNextExecutorUserIds());
taskModelDto.setFlowStatus(FlowStatusEnum.REJECTED.getCode());
taskModelDto.setFlowStatusLabel(FlowStatusEnum.REJECTED.getName());
taskModelDto.setFlowCode(workflowResultDto.getNextTaskId());
taskModelDto.setNextExecuteUser(workflowResultDto.getNextExecutorRoleIds());
commonService.buildTaskModel(Collections.singletonList(taskModelDto));
}
jgInstallationNotice.setNextTaskId(workflowResultDto.getNextTaskId());
this.updateById(jgInstallationNotice);
}
private String getUrl(String type, String pageType) {
String json = null;
try {
json = IOUtils.toString(bizTypeInfo.getInputStream(), java.lang.String.valueOf(StandardCharsets.UTF_8));
} catch (IOException e) {
e.printStackTrace();
}
List<Map> list = parseArray(json, Map.class);
String url = null;
for (Map map : list) {
if (map.get("type").equals(type)&& pageType.equals(map.get("pageType"))){
url = map.get("url").toString();
break;
}
}
return url;
}
public void updateByWorkFlow(JSONObject jsonObject) {
String businessKey = jsonObject.getString("businessKey");
JgInstallationNotice jgInstallationNotice = this.getById(businessKey);
List<String> list = (List<String>) jsonObject.get("candidateGroups");
JSONArray executor = parseArray(jsonObject.get("executor").toString());
List<String> userList = new ArrayList<>();
for (Object datum : executor) {
if (((Map) datum).containsKey("userId")) {
userList.add(((Map) datum).get("userId").toString());
}
}
String userIds = String.join(",", userList);
jgInstallationNotice.setInstanceId(jsonObject.get("processInstanceId").toString());
jgInstallationNotice.setNextExecuteIds(String.join(",", list));
jgInstallationNotice.setInstanceStatus(jgInstallationNotice.getInstanceStatus() + "," + String.join(",", list));
jgInstallationNotice.setStatus(jsonObject.get("nodeName").toString());
FlowStatusEnum noticeStatus = this.buildNoticeStatus(jgInstallationNotice.getApprovalStatus());
jgInstallationNotice.setNoticeStatus(noticeStatus.getCode() + "");
this.updateById(jgInstallationNotice);
if (!"撤回".equals(jgInstallationNotice.getApprovalStatus())) {
// 创建待办
TaskV2Model taskV2Model = new TaskV2Model();
taskV2Model.setExecuteUserIds(userIds);
taskV2Model.setExtras(JSON.toJSONString(jgInstallationNotice));
taskV2Model.setRelationId(jgInstallationNotice.getInstanceId());
taskV2Model.setTaskType("installNotice");
taskV2Model.setTaskTypeLabel("安装告知");
String url = getUrl(taskV2Model.getTaskType(), "look");
String format = String.format(url, jgInstallationNotice.getSequenceNbr(), jgInstallationNotice.getNextExecuteIds(), jgInstallationNotice.getNextExecuteIds(), jgInstallationNotice.getNoticeStatus(), jgInstallationNotice.getInstanceId());
taskV2Model.setRoutePath(format);
taskV2Model.setTaskTitle(jgInstallationNotice.getStatus());
taskV2Model.setTaskName(jgInstallationNotice.getStatus());
taskV2Model.setTaskStatus(noticeStatus.getCode());
taskV2Model.setTaskStatusLabel(noticeStatus.getName());
taskV2Model.setTaskCode(jgInstallationNotice.getApplyNo());
taskV2Model.setStartUserId(jgInstallationNotice.getCreateUserId());
//taskV2Model.setCreateUserId(jgInstallationNotice.getCreateUserId());
buildTaskModel(taskV2Model);
}
}
private FlowStatusEnum buildNoticeStatus(String approvalStatus){
if("提交".equals(approvalStatus)){
return FlowStatusEnum.TO_BE_PROCESSED;
} else if("驳回".equals(approvalStatus) || "1".equals(approvalStatus)){
return FlowStatusEnum.REJECTED;
} else if("通过".equals(approvalStatus) || "0".equals(approvalStatus)){
return FlowStatusEnum.TO_BE_FINISHED;
/**
* 执行工作流并返回组装好的工作流信息
* @param op 是否通过
* @param jgTransferNotice 业务信息 opinion 备注信息
* @return 返回组装好的工作流信息
*/
private WorkflowResultDto getWorkflowResultDto(String op, JgInstallationNotice jgTransferNotice) {
ProcessTaskDTO processTaskDTO = new ProcessTaskDTO();
WorkflowResultDto workflowResultDto = new WorkflowResultDto();
// 只调用执行API,返回下个节点信息,用于填充业务字段
//组装信息
TaskResultDTO workDto = new TaskResultDTO();
workDto.setResultCode("approvalStatus");
workDto.setTaskId(jgTransferNotice.getNextTaskId());
HashMap<String, Object> commMap = new HashMap<>();
if (jgTransferNotice.getNoticeStatus().equals("6614") || jgTransferNotice.getNoticeStatus().equals("6615")) {
commMap.put("approvalStatus", "提交");
} else {
return FlowStatusEnum.ROLLBACK;
commMap.put("approvalStatus", op);
}
workDto.setVariable(commMap);
workDto.setComment(jgTransferNotice.getProcessAdvice());
processTaskDTO = iCmWorkflowService.complete(jgTransferNotice.getNextTaskId(), workDto);
// 提取节点等信息
workflowResultDto = commonService.buildWorkFlowInfo(Collections.singletonList(processTaskDTO)).get(0);
return workflowResultDto;
}
public void completeWorkFlow(String approvalStatus, JSONObject jsonObject) {
// 1.更新业务字段
String businessKey = jsonObject.getString("businessKey");
JgInstallationNotice jgInstallationNotice = this.getById(businessKey);
jgInstallationNotice.setInstanceId(jsonObject.get("processInstanceId").toString());
jgInstallationNotice.setStatus(jsonObject.get("nodeName").toString());
jgInstallationNotice.setApprovalStatus(approvalStatus);
FlowStatusEnum noticeStatus = this.buildNoticeStatus(jgInstallationNotice.getApprovalStatus());
jgInstallationNotice.setNoticeStatus(noticeStatus.getCode() + "");
this.updateById(jgInstallationNotice);
if ("撤回".equals(approvalStatus)) {
// 删除待办
HashMap<String, Object> map = new HashMap<>();
map.put("relationId", jgInstallationNotice.getInstanceId());
map.put("taskStatus", FlowStatusEnum.TO_BE_FINISHED.getCode());
map.put("taskStatusLabel", FlowStatusEnum.TO_BE_FINISHED.getName());
map.put("isDelete", Boolean.TRUE);
updateTaskModel(map, jsonObject);
} else {
// 更新代办为已完成及更新url
List<TaskV2Model> result = Systemctl.taskV2Client.selectListByRelationId(jgInstallationNotice.getInstanceId()).getResult();
// 按时间降序排序
TaskV2Model model = result.stream().min((r1, r2) -> r2.getSequenceNbr().compareTo(r1.getSequenceNbr()))
.orElse(null);
if (model == null) {
return;
}
String url = getUrl(model.getTaskType(), "look");
String format = String.format(url, jgInstallationNotice.getSequenceNbr(), jgInstallationNotice.getNextExecuteIds(), jgInstallationNotice.getNextExecuteIds(), jgInstallationNotice.getNoticeStatus(), jgInstallationNotice.getInstanceId());
model.setRoutePath(format);
model.setRoutePath(model.getRoutePath().replace("nextExecuteIds", "nextExecuteIdsOld"));
model.setTaskStatusLabel(jsonObject.get("nodeName").toString());
model.setEndDate(new Date());
//model.setFinishStatus(Boolean.TRUE);
JSONObject userJson = JSON.parseObject(jsonObject.get("user").toString());
model.setEndUserId(userJson.get("userId").toString());
Systemctl.taskV2Client.update(model, model.getSequenceNbr());
}
}
@Override
public Map<String, Object> getCompanyType() {
Map<String, Object> result = new HashMap<>();
......
......@@ -55,8 +55,6 @@ import org.typroject.tyboot.core.restful.utils.ResponseModel;
import java.util.*;
import java.util.stream.Collectors;
import static com.alibaba.fastjson.JSON.parseArray;
/**
* 设备注销报废服务实现类
*
......@@ -461,6 +459,7 @@ public class JgScrapCancelServiceImpl extends BaseService<JgScrapCancelDto, JgSc
params.put("taskStatusLabel", flowStatusEnum.getName());
params.put("flowStatus", this.getTaskStatusByName(jgScrapCancelDto.getAuditStatus()));
params.put("flowStatusLabel", jgScrapCancelDto.getAuditStatus());
params.put("model", jgScrapCancelDto);
return commonService.updateTaskModel(params);
}
......@@ -492,7 +491,7 @@ public class JgScrapCancelServiceImpl extends BaseService<JgScrapCancelDto, JgSc
}
Map<String, Object> installationInfo = BeanUtil.beanToMap(notice);
installationInfo.put("receiveOrgCode", notice.getReceiveOrgCode() + "_" + notice.getReceiveOrgName());
installationInfo.put("cancelCertificateList", parseArray(installationInfo.get("cancelCertificate").toString()));
installationInfo.put("cancelCertificateList", JSON.parseArray(String.valueOf(installationInfo.get("cancelCertificate"))));
LambdaQueryWrapper<JgScrapCancelEq> lambdaEq = new QueryWrapper<JgScrapCancelEq>().lambda();
lambdaEq.eq(JgScrapCancelEq::getEquipTransferId, sequenceNbr);
JgScrapCancelEq jgScrapCancelEq = jgScrapCancelEqMapper.selectOne(lambdaEq);
......@@ -540,7 +539,7 @@ public class JgScrapCancelServiceImpl extends BaseService<JgScrapCancelDto, JgSc
commonService.rollbackTask(instanceId, jsonObject);
}
@Transactional
public void flowExecute(Long id, String instanceId, String operate, String comment) {
try {
JgScrapCancel jgScrapCancel = this.getBaseMapper().selectById(id);
......@@ -606,8 +605,6 @@ public class JgScrapCancelServiceImpl extends BaseService<JgScrapCancelDto, JgSc
// 更新上一步待办、创建待办
executeOneStep(scrapCancelDto, taskName, nextUserIds, operate);
} else {
jgScrapCancel.setAuditStatus(FlowStatusEnum.TO_BE_FINISHED.getName());
jgScrapCancel.setAuditPassDate(new Date());
// 完成时 下一步骤可执行人清空
jgScrapCancel.setNextExecuteUserIds("");
// 修改业务信息
......
......@@ -592,7 +592,7 @@ public class JgTransferNoticeServiceImpl extends BaseService<JgTransferNoticeDto
JSONObject jsonObject = JSON.parseObject(JSON.toJSONString(jgInstallationNotice));
jsonObject.put("taskType", BusinessTypeEnum.JG_ADVICE_REMOVAL.getCode());
jsonObject.put("nextExecuteUser", jgInstallationNotice.getNextExecuteIds());
commonService.rollbackTask(jgInstallationNotice.getInstanceId(), JSON.parseObject(JSON.toJSONString(jgInstallationNotice)));
commonService.rollbackTask(jgInstallationNotice.getInstanceId(), jsonObject);
}
@Transactional
......@@ -633,6 +633,7 @@ public class JgTransferNoticeServiceImpl extends BaseService<JgTransferNoticeDto
taskMap.put("relationId", jgTransferNotice.getInstanceId());
taskMap.put("flowStatus", FlowStatusEnum.TO_BE_FINISHED.getCode());
taskMap.put("flowStatusLabel", FlowStatusEnum.TO_BE_FINISHED.getName());
taskMap.put("model", jgTransferNotice);
taskV2Model = commonService.updateTaskModel(taskMap);
} else {
jgTransferNotice.setNextExecuteIds(workflowResultDto.getNextExecutorRoleIds());
......
......@@ -274,7 +274,7 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
} else {
// 驳回操作
jgUseRegistration.setStatus(WorkFlowStatusEnum.getMessage(taskCode).getReject());
jgUseRegistration.setPromoter(null);
jgUseRegistration.setPromoter("");
}
if (isFirst){
buildTask(jgUseRegistration, workflowResultDto);
......
......@@ -9,13 +9,13 @@
"type": "102",
"pageType": "look",
"name": "安装告知",
"url": "/mixuap?appId=1742358052905971713&id=1735246137364869121&sequenceNbr=%s&roleIds=%s&&userId={userId}&nextExecuteIds=%s&formType=detail&noticeStatus=%s&instanceId=%s"
"url": "/mixuap?appId=1742358052905971713&id=1735246137364869121&roleIds={roleIds}&userId={userId}&formType=detail"
},
{
"type": "102",
"pageType": "edit",
"name": "安装告知",
"url": "/mixuap?appId=1742358052905971713&id=1734127099570057217&sequenceNbr=%s&roleIds=%s&userId={userId}&nextExecuteIds=%s&formType=edit&noticeStatus=%s&instanceId=%s"
"url": ""
},
{
"type": "103",
......
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