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 { ...@@ -248,5 +248,14 @@ public class JgInstallationNoticeDto extends BaseDto {
@JsonSerialize(using = BizCustomDateSerializer.class) @JsonSerialize(using = BizCustomDateSerializer.class)
private Date handleDate; private Date handleDate;
private String createUserCompanyName;
//下一步任务ID
private String nextTaskId;
/**
* 创建人
*/
private String createUserName;
} }
...@@ -400,4 +400,19 @@ public class JgInstallationNotice extends BaseEntity { ...@@ -400,4 +400,19 @@ public class JgInstallationNotice extends BaseEntity {
*/ */
private String approvalStatus; 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 @@ ...@@ -81,10 +81,13 @@
isn.install_leader_name AS installLeaderName, isn.install_leader_name AS installLeaderName,
isn.install_leader_phone AS installLeaderPhone, isn.install_leader_phone AS installLeaderPhone,
isn.use_unit_name AS useUnitName, isn.use_unit_name AS useUnitName,
tec2.name AS equCategory,
tec1.name AS equList,
tec.name AS equDefine,
isn.equ_register_code AS equRegisterCode, 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.product_name AS productName,
ri.brand_name AS brandName, ri.brand_name AS brandName,
ri.equ_type AS equType, ri.equ_type AS equType,
...@@ -124,6 +127,9 @@ ...@@ -124,6 +127,9 @@
LEFT JOIN idx_biz_jg_inspection_detection_info idi ON idi.record = re.equ_id 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 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 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 WHERE
isn.sequence_nbr = #{sequenceNbr} isn.sequence_nbr = #{sequenceNbr}
LIMIT 1 LIMIT 1
......
...@@ -48,6 +48,7 @@ import java.io.IOException; ...@@ -48,6 +48,7 @@ import java.io.IOException;
import java.lang.reflect.Field; import java.lang.reflect.Field;
import java.sql.Timestamp; import java.sql.Timestamp;
import java.util.*; import java.util.*;
import java.util.stream.Collectors;
import static com.alibaba.fastjson.JSON.toJSONString; import static com.alibaba.fastjson.JSON.toJSONString;
...@@ -292,8 +293,10 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste ...@@ -292,8 +293,10 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
//注册登记 //注册登记
IdxBizJgRegisterInfo registerInfo = this.getOne(new QueryWrapper<IdxBizJgRegisterInfo>().eq("RECORD", record)); IdxBizJgRegisterInfo registerInfo = this.getOne(new QueryWrapper<IdxBizJgRegisterInfo>().eq("RECORD", record));
if (!ValidationUtil.isEmpty(registerInfo)) { if (!ValidationUtil.isEmpty(registerInfo)) {
String equList = registerInfo.getEquList();//设备种类
String equCategory = registerInfo.getEquCategory();//设备类别 String equCategory = registerInfo.getEquCategory();//设备类别
String equDefine = registerInfo.getEquDefine();//设备品种 String equDefine = registerInfo.getEquDefine();//设备品种
List<EquipmentCategory> categoryList0 = commonService.getEquipmentCategoryList(equList, null);
List<EquipmentCategory> categoryList1 = commonService.getEquipmentCategoryList(equCategory, null); List<EquipmentCategory> categoryList1 = commonService.getEquipmentCategoryList(equCategory, null);
List<EquipmentCategory> categoryList2 = commonService.getEquipmentCategoryList(equDefine, null); List<EquipmentCategory> categoryList2 = commonService.getEquipmentCategoryList(equDefine, null);
Map<String, Object> registerInfoMap; Map<String, Object> registerInfoMap;
...@@ -302,6 +305,9 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste ...@@ -302,6 +305,9 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
registerInfoMap.put("registerinfoSeq", registerInfo.getSequenceNbr()); registerInfoMap.put("registerinfoSeq", registerInfo.getSequenceNbr());
registerInfoMap.put("sequenceNbr", registerInfo.getSequenceNbr()); registerInfoMap.put("sequenceNbr", registerInfo.getSequenceNbr());
registerInfoMap.put("productPhoto", JSON.parseArray(registerInfo.getProductPhoto())); registerInfoMap.put("productPhoto", JSON.parseArray(registerInfo.getProductPhoto()));
if (CollectionUtils.isNotEmpty(categoryList0)) {
registerInfoMap.put("equListDesc", categoryList0.get(0).getName());
}
if (CollectionUtils.isNotEmpty(categoryList1)) { if (CollectionUtils.isNotEmpty(categoryList1)) {
registerInfoMap.put("equCategoryDesc", categoryList1.get(0).getName()); registerInfoMap.put("equCategoryDesc", categoryList1.get(0).getName());
} }
...@@ -321,7 +327,11 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste ...@@ -321,7 +327,11 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
} }
} }
if (!registerInfoMap.isEmpty()) { 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; return objMap;
...@@ -404,7 +414,11 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste ...@@ -404,7 +414,11 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
useInfoMap.put("USEINFO_SEQ", useInfo.getSequenceNbr()); useInfoMap.put("USEINFO_SEQ", useInfo.getSequenceNbr());
} }
if (!useInfoMap.isEmpty()) { 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 ...@@ -422,7 +436,11 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
designInfoMap.put("DESIGNINFO_SEQ", designInfo.getSequenceNbr()); designInfoMap.put("DESIGNINFO_SEQ", designInfo.getSequenceNbr());
} }
if (!designInfoMap.isEmpty()) { 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 ...@@ -453,7 +471,11 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
factoryInfoMap.put("FACTORYINFO_SEQ", factoryInfo.getSequenceNbr()); factoryInfoMap.put("FACTORYINFO_SEQ", factoryInfo.getSequenceNbr());
} }
if (!factoryInfoMap.isEmpty()) { 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 ...@@ -468,7 +490,11 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
constructionInfoMap.put("CONSTRUCTIONINFO_SEQ", constructionInfo.getSequenceNbr()); constructionInfoMap.put("CONSTRUCTIONINFO_SEQ", constructionInfo.getSequenceNbr());
} }
if (!constructionInfoMap.isEmpty()) { 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 ...@@ -503,7 +529,11 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
} }
} }
if (!registerInfoMap.isEmpty()) { 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 ...@@ -518,7 +548,11 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
maintenanceRecordInfoMap.put("MAINTENANCERECORDINFO_SEQ", maintenanceRecordInfo.getSequenceNbr()); maintenanceRecordInfoMap.put("MAINTENANCERECORDINFO_SEQ", maintenanceRecordInfo.getSequenceNbr());
} }
if (!maintenanceRecordInfoMap.isEmpty()) { 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 ...@@ -533,7 +567,11 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
supervisionInfoMap.put("SUPERVISIONINFO_SEQ", supervisionInfo.getSequenceNbr()); supervisionInfoMap.put("SUPERVISIONINFO_SEQ", supervisionInfo.getSequenceNbr());
} }
if (!supervisionInfoMap.isEmpty()) { 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 ...@@ -548,7 +586,11 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
otherInfoMap.put("OTHERINFO_SEQ", otherInfo.getSequenceNbr()); otherInfoMap.put("OTHERINFO_SEQ", otherInfo.getSequenceNbr());
} }
if (!otherInfoMap.isEmpty()) { 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 ...@@ -565,7 +607,11 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
inspectionDetectionInfoMap.put("INSPECTIONDETECTIONINFO_SEQ", inspectionDetectionInfo.getSequenceNbr()); inspectionDetectionInfoMap.put("INSPECTIONDETECTIONINFO_SEQ", inspectionDetectionInfo.getSequenceNbr());
} }
if (!inspectionDetectionInfoMap.isEmpty()) { 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 ...@@ -597,7 +643,11 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
elevatorMap.put("ELEVATOR_SEQ", elevator.getSequenceNbr()); elevatorMap.put("ELEVATOR_SEQ", elevator.getSequenceNbr());
} }
if (!elevatorMap.isEmpty()) { 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)) { } else if (EquipmentClassifityEnum.CC.getCode().equals(equipCode)) {
...@@ -613,7 +663,11 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste ...@@ -613,7 +663,11 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
vehicleMap.put("VEHICLE_SEQ", vehicle.getSequenceNbr()); vehicleMap.put("VEHICLE_SEQ", vehicle.getSequenceNbr());
} }
if (!vehicleMap.isEmpty()) { 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 ...@@ -633,7 +687,11 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
ropewayMap.put("ROPEWAY_SEQ", ropeway.getSequenceNbr()); ropewayMap.put("ROPEWAY_SEQ", ropeway.getSequenceNbr());
} }
if (!ropewayMap.isEmpty()) { 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 ...@@ -652,7 +710,11 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
ridesMap.put("RIDES_SEQ", rides.getSequenceNbr()); ridesMap.put("RIDES_SEQ", rides.getSequenceNbr());
} }
if (!ridesMap.isEmpty()) { 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 ...@@ -669,7 +731,11 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
boilerMap.put("BOILER_SEQ", boiler.getSequenceNbr()); boilerMap.put("BOILER_SEQ", boiler.getSequenceNbr());
} }
if (!boilerMap.isEmpty()) { 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 ...@@ -688,7 +754,11 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
vesselMap.put("VESSEL_SEQ", vessel.getSequenceNbr()); vesselMap.put("VESSEL_SEQ", vessel.getSequenceNbr());
} }
if (!vesselMap.isEmpty()) { 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 ...@@ -709,7 +779,11 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
pipelineMap.put("PIPELINE_SEQ", pipeline.getSequenceNbr()); pipelineMap.put("PIPELINE_SEQ", pipeline.getSequenceNbr());
} }
if (!pipelineMap.isEmpty()) { 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 ...@@ -728,7 +802,11 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
liftingMap.put("LIFTING_SEQ", lifting.getSequenceNbr()); liftingMap.put("LIFTING_SEQ", lifting.getSequenceNbr());
} }
if (!liftingMap.isEmpty()) { 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 ...@@ -1264,7 +1342,7 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
List<IdxBizJgMainParts> mainPartsList = new ArrayList<>(); List<IdxBizJgMainParts> mainPartsList = new ArrayList<>();
List<IdxBizJgProtectionDevices> protectionDevicesList = 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) { for (Object s : list) {
List subFormMainPartsList = (ArrayList) map.get(s); List subFormMainPartsList = (ArrayList) map.get(s);
if (!ObjectUtils.isEmpty(subFormMainPartsList)) { if (!ObjectUtils.isEmpty(subFormMainPartsList)) {
...@@ -1279,7 +1357,7 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste ...@@ -1279,7 +1357,7 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
} }
} }
return mainPartsList; 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) { for (Object s : list) {
List subFormProtectionDevicesList = (ArrayList) map.get(s); List subFormProtectionDevicesList = (ArrayList) map.get(s);
if (!ObjectUtils.isEmpty(subFormProtectionDevicesList)) { if (!ObjectUtils.isEmpty(subFormProtectionDevicesList)) {
......
...@@ -275,7 +275,7 @@ public class JgChangeRegistrationReformServiceImpl extends BaseService<JgChangeR ...@@ -275,7 +275,7 @@ public class JgChangeRegistrationReformServiceImpl extends BaseService<JgChangeR
// 驳回操作 // 驳回操作
jgChangeRegistrationReform.setAuditStatus(WorkFlowStatusEnum.getMessage(taskCode).getReject()); jgChangeRegistrationReform.setAuditStatus(WorkFlowStatusEnum.getMessage(taskCode).getReject());
jgChangeRegistrationReform.setStatus(WorkFlowStatusEnum.getMessage(taskCode).getReject()); jgChangeRegistrationReform.setStatus(WorkFlowStatusEnum.getMessage(taskCode).getReject());
jgChangeRegistrationReform.setPromoter(null); jgChangeRegistrationReform.setPromoter("");
} }
if(updateTodoAndCreate) { if(updateTodoAndCreate) {
// 上个代办改为已办 // 上个代办改为已办
...@@ -316,10 +316,9 @@ public class JgChangeRegistrationReformServiceImpl extends BaseService<JgChangeR ...@@ -316,10 +316,9 @@ public class JgChangeRegistrationReformServiceImpl extends BaseService<JgChangeR
map.put("flowStatus", FlowStatusEnum.TO_BE_FINISHED.getCode()); map.put("flowStatus", FlowStatusEnum.TO_BE_FINISHED.getCode());
map.put("flowStatusLabel", FlowStatusEnum.TO_BE_FINISHED.getName()); map.put("flowStatusLabel", FlowStatusEnum.TO_BE_FINISHED.getName());
map.put("relationId", jgChangeRegistrationReform.getInstanceId()); map.put("relationId", jgChangeRegistrationReform.getInstanceId());
TaskV2Model taskV2Model = commonServiceImpl.updateTaskModel(map); jgChangeRegistrationReform.setNextExecuteUserIds("");
jgChangeRegistrationReform.setNextTaskId(null); map.put("model",jgChangeRegistrationReform);
jgChangeRegistrationReform.setNextExecuteUserIds(null); commonServiceImpl.updateTaskModel(map);
jgChangeRegistrationReform.setNextExecutorIds(null);
} }
this.getBaseMapper().updateById(jgChangeRegistrationReform); this.getBaseMapper().updateById(jgChangeRegistrationReform);
} }
...@@ -368,6 +367,7 @@ public class JgChangeRegistrationReformServiceImpl extends BaseService<JgChangeR ...@@ -368,6 +367,7 @@ public class JgChangeRegistrationReformServiceImpl extends BaseService<JgChangeR
jgChangeRegistrationReform.setStatus(WorkFlowStatusEnum.getMessage(taskCode).getRollBack()); jgChangeRegistrationReform.setStatus(WorkFlowStatusEnum.getMessage(taskCode).getRollBack());
} }
jgChangeRegistrationReform.setPromoter(reginParams.getUserModel().getUserId()); jgChangeRegistrationReform.setPromoter(reginParams.getUserModel().getUserId());
jgChangeRegistrationReform.setNextTaskId(workflowResultDto.getNextTaskId());
jgChangeRegistrationReform.setNextExecutorIds(role); jgChangeRegistrationReform.setNextExecutorIds(role);
this.update(jgChangeRegistrationReform, lambda); this.update(jgChangeRegistrationReform, lambda);
// commonServiceImpl.deleteTaskModel(instanceId); // commonServiceImpl.deleteTaskModel(instanceId);
...@@ -375,6 +375,7 @@ public class JgChangeRegistrationReformServiceImpl extends BaseService<JgChangeR ...@@ -375,6 +375,7 @@ public class JgChangeRegistrationReformServiceImpl extends BaseService<JgChangeR
jsonObject.put("nextTaskId", jgChangeRegistrationReform.getNextTaskId()); jsonObject.put("nextTaskId", jgChangeRegistrationReform.getNextTaskId());
jsonObject.put("nextExecuteUser", jgChangeRegistrationReform.getNextExecutorIds()); jsonObject.put("nextExecuteUser", jgChangeRegistrationReform.getNextExecutorIds());
jsonObject.put("taskType",BusinessTypeEnum.JG_RENOVATION_REGISTRATION.getCode()); jsonObject.put("taskType",BusinessTypeEnum.JG_RENOVATION_REGISTRATION.getCode());
jsonObject.put("model",jgChangeRegistrationReform);
commonServiceImpl.rollbackTask(instanceId,jsonObject); commonServiceImpl.rollbackTask(instanceId,jsonObject);
} }
......
package com.yeejoin.amos.boot.module.jg.biz.service.impl; package com.yeejoin.amos.boot.module.jg.biz.service.impl;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; 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;
...@@ -11,13 +10,9 @@ import com.yeejoin.amos.boot.biz.common.utils.RedisKey; ...@@ -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.biz.common.utils.RedisUtils;
import com.yeejoin.amos.boot.module.jg.api.dto.TaskModelDto; 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.dto.WorkflowResultDto;
import com.yeejoin.amos.boot.module.jg.api.entity.JgChangeRegistrationReform; import com.yeejoin.amos.boot.module.jg.api.entity.*;
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.enums.BusinessTypeEnum; 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.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.enums.WorkFlowStatusEnum;
import com.yeejoin.amos.boot.module.jg.api.mapper.JgChangeRegistrationNameEqMapper; import com.yeejoin.amos.boot.module.jg.api.mapper.JgChangeRegistrationNameEqMapper;
import com.yeejoin.amos.boot.module.jg.api.mapper.JgChangeRegistrationReformEqMapper; import com.yeejoin.amos.boot.module.jg.api.mapper.JgChangeRegistrationReformEqMapper;
...@@ -42,13 +37,8 @@ import com.yeejoin.amos.boot.module.ymt.api.enums.ApplicationFormTypeEnum; ...@@ -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.enums.FlowStatusEnum;
import com.yeejoin.amos.boot.module.ymt.api.mapper.IdxBizJgOtherInfoMapper; import com.yeejoin.amos.boot.module.ymt.api.mapper.IdxBizJgOtherInfoMapper;
import com.yeejoin.amos.boot.module.ymt.api.mapper.IdxBizJgRegisterInfoMapper; 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.systemctl.model.TaskV2Model;
import com.yeejoin.amos.feign.workflow.Workflow;
import com.yeejoin.amos.feign.workflow.model.*; import com.yeejoin.amos.feign.workflow.model.*;
import fr.opensagres.xdocreport.core.io.IOUtils;
import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.CollectionUtils;
import org.elasticsearch.action.search.SearchRequest; import org.elasticsearch.action.search.SearchRequest;
import org.elasticsearch.action.search.SearchResponse; import org.elasticsearch.action.search.SearchResponse;
...@@ -62,7 +52,6 @@ import org.springframework.beans.factory.annotation.Autowired; ...@@ -62,7 +52,6 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.core.io.Resource; import org.springframework.core.io.Resource;
import org.springframework.util.ObjectUtils; import org.springframework.util.ObjectUtils;
import org.springframework.util.StringUtils;
import org.typroject.tyboot.core.foundation.context.RequestContext; import org.typroject.tyboot.core.foundation.context.RequestContext;
import org.typroject.tyboot.core.foundation.utils.Bean; import org.typroject.tyboot.core.foundation.utils.Bean;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil; import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
...@@ -74,14 +63,10 @@ import org.typroject.tyboot.core.restful.utils.ResponseModel; ...@@ -74,14 +63,10 @@ import org.typroject.tyboot.core.restful.utils.ResponseModel;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.io.IOException; import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.time.LocalDate; import java.time.LocalDate;
import java.util.*; import java.util.*;
import java.util.stream.Collectors; 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 ...@@ -170,7 +155,7 @@ public class JgChangeRegistrationTransferServiceImpl extends BaseService<JgChang
} }
CompanyBo company = reginParams.getCompany(); CompanyBo company = reginParams.getCompany();
String sequenceNbr = (String) map.get("sequenceNbr"); 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 receiveOrgCode = (String) tableData.get("receiveOrgCode");
String receiveOrgName = ""; String receiveOrgName = "";
String supervisoryCode = ""; String supervisoryCode = "";
...@@ -191,14 +176,6 @@ public class JgChangeRegistrationTransferServiceImpl extends BaseService<JgChang ...@@ -191,14 +176,6 @@ public class JgChangeRegistrationTransferServiceImpl extends BaseService<JgChang
receiveOrgName = receiveOrgCodeList[1]; 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代表修改数据 //有sequenceNbr代表修改数据
if (!ValidationUtil.isEmpty(sequenceNbr)) { if (!ValidationUtil.isEmpty(sequenceNbr)) {
...@@ -211,6 +188,15 @@ public class JgChangeRegistrationTransferServiceImpl extends BaseService<JgChang ...@@ -211,6 +188,15 @@ public class JgChangeRegistrationTransferServiceImpl extends BaseService<JgChang
oldHistory = jgRegistrationHistoryService.getDteailByRecord(oldTransferEq.getEquId(), oldTransfer.getApplyNo()); oldHistory = jgRegistrationHistoryService.getDteailByRecord(oldTransferEq.getEquId(), oldTransfer.getApplyNo());
useInfo = idxBizJgUseInfoService.getOneData(oldTransferEq.getEquId()); 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 ...@@ -392,22 +378,27 @@ public class JgChangeRegistrationTransferServiceImpl extends BaseService<JgChang
ProcessTaskDTO processTask = icmWorkflowService.rollBack(instanceId); ProcessTaskDTO processTask = icmWorkflowService.rollBack(instanceId);
WorkflowResultDto workflowResult = commonService.buildWorkFlowInfo(Collections.singletonList(processTask)).get(0); WorkflowResultDto workflowResult = commonService.buildWorkFlowInfo(Collections.singletonList(processTask)).get(0);
String taskCode = Optional.ofNullable(workflowResult.getNextTaskCode()).orElse(""); String taskCode = "";
String role = Optional.ofNullable(workflowResult.getNextExecutorRoleIds()).orElse(""); 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)) { if (!ObjectUtils.isEmpty(taskCode)) {
jgTransfer.setAuditStatus(WorkFlowStatusEnum.getMessage(taskCode).getRollBack()); jgTransfer.setAuditStatus(WorkFlowStatusEnum.getMessage(taskCode).getRollBack());
jgTransfer.setStatus(WorkFlowStatusEnum.getMessage(taskCode).getRollBack()); jgTransfer.setStatus(WorkFlowStatusEnum.getMessage(taskCode).getRollBack());
} }
jgTransfer.setPromoter(reginParams.getUserModel().getUserId()); jgTransfer.setPromoter(reginParams.getUserModel().getUserId());
jgTransfer.setNextExecutorIds(role); jgTransfer.setNextExecutorIds(role);
// 更新下一步可执行人
jgTransfer.setNextExecuteUserIds(workflowResult.getNextExecutorUserIds());
this.update(jgTransfer, lambda); this.update(jgTransfer, lambda);
//待办 撤回 //待办 撤回
JSONObject jsonObject = JSON.parseObject(JSON.toJSONString(jgTransfer)); JgChangeRegistrationTransfer data = this.baseMapper.selectOne(lambda);
jsonObject.put("nextTaskId", jgTransfer.getNextTaskId()); JSONObject jsonObject = JSONObject.parseObject(JSONObject.toJSONString(data));
jsonObject.put("nextExecuteUser", jgTransfer.getNextExecutorIds()); jsonObject.put("nextTaskId", data.getNextTaskId());
jsonObject.put("nextExecuteUser", data.getNextExecutorIds());
jsonObject.put("taskType",BusinessTypeEnum.JG_CHANGE_REGISTRATION.getCode()); jsonObject.put("taskType",BusinessTypeEnum.JG_CHANGE_REGISTRATION.getCode());
commonService.rollbackTask(instanceId, JSON.parseObject(JSON.toJSONString(jgTransfer))); commonService.rollbackTask(instanceId, JSON.parseObject(JSON.toJSONString(jgTransfer)));
} }
...@@ -700,6 +691,7 @@ public class JgChangeRegistrationTransferServiceImpl extends BaseService<JgChang ...@@ -700,6 +691,7 @@ public class JgChangeRegistrationTransferServiceImpl extends BaseService<JgChang
map.put("flowStatus", FlowStatusEnum.TO_BE_FINISHED.getCode()); map.put("flowStatus", FlowStatusEnum.TO_BE_FINISHED.getCode());
map.put("flowStatusLabel", FlowStatusEnum.TO_BE_FINISHED.getName()); map.put("flowStatusLabel", FlowStatusEnum.TO_BE_FINISHED.getName());
map.put("relationId", jgChangeRegistrationTransfer.getInstanceId()); map.put("relationId", jgChangeRegistrationTransfer.getInstanceId());
map.put("model", jgChangeRegistrationTransfer);
TaskV2Model taskV2Model = commonService.updateTaskModel(map); TaskV2Model taskV2Model = commonService.updateTaskModel(map);
} }
......
...@@ -12,13 +12,19 @@ import com.yeejoin.amos.boot.biz.common.entity.DataDictionary; ...@@ -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.DateUtils;
import com.yeejoin.amos.boot.biz.common.utils.RedisUtils; 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.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.JgInstallationNotice;
import com.yeejoin.amos.boot.module.jg.api.entity.JgInstallationNoticeEq; 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.enums.CompanyTypeEnum;
import com.yeejoin.amos.boot.module.jg.api.mapper.JgInstallationNoticeEqMapper; 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.mapper.JgInstallationNoticeMapper;
import com.yeejoin.amos.boot.module.jg.api.service.IJgInstallationNoticeService; 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.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.IIdxBizJgConstructionInfoService;
import com.yeejoin.amos.boot.module.jg.biz.service.IIdxBizJgUseInfoService; import com.yeejoin.amos.boot.module.jg.biz.service.IIdxBizJgUseInfoService;
import com.yeejoin.amos.boot.module.jg.biz.utils.ImageUtils; import com.yeejoin.amos.boot.module.jg.biz.utils.ImageUtils;
...@@ -36,10 +42,7 @@ import com.yeejoin.amos.feign.privilege.model.CompanyModel; ...@@ -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.Systemctl;
import com.yeejoin.amos.feign.systemctl.model.TaskV2Model; import com.yeejoin.amos.feign.systemctl.model.TaskV2Model;
import com.yeejoin.amos.feign.workflow.Workflow; import com.yeejoin.amos.feign.workflow.Workflow;
import com.yeejoin.amos.feign.workflow.model.ActWorkflowBatchDTO; import com.yeejoin.amos.feign.workflow.model.*;
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 fr.opensagres.xdocreport.core.io.IOUtils; import fr.opensagres.xdocreport.core.io.IOUtils;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
...@@ -142,6 +145,13 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN ...@@ -142,6 +145,13 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN
@Autowired @Autowired
AmosRequestContext amosRequestContext; AmosRequestContext amosRequestContext;
@Autowired
private ICmWorkflowService iCmWorkflowService;
@Autowired
private CommonServiceImpl commonService;
/** /**
* 根据sequenceNbr查询 * 根据sequenceNbr查询
* *
...@@ -185,10 +195,10 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN ...@@ -185,10 +195,10 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN
equipmentInfos.get(0).put(s, parseArray(equipmentInfos.get(0).get(s).toString())); 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>>() {{ return new HashMap<String, Map<String, Object>>() {{
this.put("installationInfo", installationInfo); this.put("installationInfo", map);
this.put("equipmentInfo", equipmentInfos.get(0));
}}; }};
} }
...@@ -199,89 +209,104 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN ...@@ -199,89 +209,104 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN
*/ */
@SuppressWarnings({"rawtypes", "Duplicates"}) @SuppressWarnings({"rawtypes", "Duplicates"})
public JgInstallationNoticeDto updateInstallationNotice(String submitType, JgInstallationNoticeDto noticeDto, String op) { 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)) { if (Objects.isNull(noticeDto) || StringUtils.isEmpty(submitType)) {
throw new IllegalArgumentException("参数不能为空"); throw new IllegalArgumentException("参数不能为空");
} }
String[] taskName = new String[]{"流程结束"};
// 字段转换 // 字段转换
this.convertField(noticeDto); this.convertField(noticeDto);
ArrayList<String> roleListFirst = new ArrayList<>(); JgInstallationNotice notice = this.getById(noticeDto.getSequenceNbr());
ArrayList<String> roleListSecond = new ArrayList<>();
if (SUBMIT_TYPE_FLOW.equals(submitType)) { if (SUBMIT_TYPE_FLOW.equals(submitType)) {
AjaxResult ajaxResult;
// 发起流程
if (!StringUtils.hasText(noticeDto.getInstanceId())) { 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(); ActWorkflowStartDTO dto = new ActWorkflowStartDTO();
dto.setProcessDefinitionKey(PROCESS_DEFINITION_KEY); dto.setProcessDefinitionKey(PROCESS_DEFINITION_KEY);
dto.setBusinessKey("1"); dto.setBusinessKey(noticeDto.getSequenceNbr().toString());
try { dto.setCompleteFirstTask(Boolean.TRUE);
ajaxResult = Workflow.taskClient.startByVariable(dto); list.add(dto);
String instanceId = ((Map) ajaxResult.get("data")).get("id").toString(); actWorkflowBatchDTO.setProcess(list);
noticeDto.setInstanceId(instanceId); processTaskDTO = iCmWorkflowService.startBatch(actWorkflowBatchDTO).get(0);
// 查询下节点任务 // 提取节点等信息
getNext(roleListFirst, instanceId,taskName); workflowResultDto = commonService.buildWorkFlowInfo(Collections.singletonList(processTaskDTO)).get(0);
noticeDto.setInstanceStatus(String.join(",", roleListFirst)); BeanUtils.copyProperties(noticeDto, notice);
} catch (Exception e) { if (!ObjectUtils.isEmpty(notice.getInstanceStatus())) {
log.error("提交失败:{}", e); notice.setInstanceStatus(notice.getInstanceStatus() + "," + workflowResultDto.getNextExecutorRoleIds());
} else {
notice.setInstanceStatus(workflowResultDto.getNextExecutorRoleIds());
} }
} notice.setPromoter(RequestContext.getExeUserId());
notice.setNextExecuteIds(String.join(",", workflowResultDto.getNextExecutorRoleIds()));
JgInstallationNotice notice = new JgInstallationNotice(); notice.setNoticeStatus(String.valueOf(FlowStatusEnum.TO_BE_PROCESSED.getCode()));
BeanUtils.copyProperties(noticeDto,notice); notice.setNextTaskId(workflowResultDto.getNextTaskId());
this.updateById(notice);
boolean submit = submit(notice, op); // 如果为保存并提交,则创建代办
buildTask(Collections.singletonList(notice), Collections.singletonList(workflowResultDto));
if(submit) { } else {
// 查询下节点任务 ProcessTaskDTO processTaskDTO = new ProcessTaskDTO();
getNext(roleListSecond, notice.getInstanceId(),taskName); WorkflowResultDto workflowResultDto = new WorkflowResultDto();
notice.setStatus(taskName[0]); // 只调用执行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);
}
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())) { if (!ObjectUtils.isEmpty(notice.getInstanceStatus())) {
notice.setInstanceStatus(notice.getInstanceStatus() + "," + roleListSecond); notice.setInstanceStatus(notice.getInstanceStatus() + "," + workflowResultDto.getNextExecutorRoleIds());
} else { } else {
notice.setInstanceStatus(String.join(",", roleListSecond)); notice.setInstanceStatus(workflowResultDto.getNextExecutorRoleIds());
} }
notice.setPromoter(RequestContext.getExeUserId()); notice.setPromoter(RequestContext.getExeUserId());
notice.setNextExecuteIds(String.join(",", roleListSecond)); notice.setNextExecuteIds(String.join(",", workflowResultDto.getNextExecutorRoleIds()));
notice.setNoticeStatus(String.valueOf(FlowStatusEnum.TO_BE_PROCESSED.getCode())); notice.setNoticeStatus(String.valueOf(FlowStatusEnum.TO_BE_PROCESSED.getCode()));
jgInstallationNoticeMapper.updateById(notice); notice.setNextTaskId(workflowResultDto.getNextTaskId());
} this.updateById(notice);
if (!instancedId) { // 上个代办改为已办
HashMap<String, Object> map = new HashMap<>(); 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("relationId", notice.getInstanceId());
map.put("taskStatus", FlowStatusEnum.TO_BE_FINISHED.getCode()); map.put("flowStatus", FlowStatusEnum.TO_BE_PROCESSED.getCode());
map.put("taskStatusLabel", FlowStatusEnum.TO_BE_FINISHED.getName()); map.put("flowStatusLabel", FlowStatusEnum.TO_BE_PROCESSED.getName());
updateTaskModel(map,null); 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 { } else {
JgInstallationNotice bean = new JgInstallationNotice(); JgInstallationNotice bean = new JgInstallationNotice();
BeanUtils.copyProperties(noticeDto, bean); BeanUtils.copyProperties(noticeDto, bean);
jgInstallationNoticeMapper.updateById(bean); this.updateById(bean);
} }
return noticeDto; return noticeDto;
} }
...@@ -434,11 +459,7 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN ...@@ -434,11 +459,7 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN
@SuppressWarnings({"Duplicates", "rawtypes"}) @SuppressWarnings({"Duplicates", "rawtypes"})
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void saveNotice(String submitType, JSONObject jgInstallationNoticeDtoMap, ReginParams reginParams) { 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); JgInstallationNoticeDto model = JSON.parseObject(jgInstallationNoticeDtoMap.get(TABLE_PAGE_ID).toString(), JgInstallationNoticeDto.class);
// 字段转换 // 字段转换
convertField(model); convertField(model);
...@@ -448,7 +469,6 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN ...@@ -448,7 +469,6 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN
if (CollectionUtils.isEmpty(deviceList)) { if (CollectionUtils.isEmpty(deviceList)) {
throw new BadRequest("设备列表为空"); throw new BadRequest("设备列表为空");
} }
// 获取告知单号 // 获取告知单号
ResponseModel<List<String>> listResponseModel = tzsServiceFeignClient.applicationFormCode(ApplicationFormTypeEnum.AZGZ.getCode(), deviceList.size()); ResponseModel<List<String>> listResponseModel = tzsServiceFeignClient.applicationFormCode(ApplicationFormTypeEnum.AZGZ.getCode(), deviceList.size());
if (!ObjectUtils.isEmpty(listResponseModel) && listResponseModel.getStatus() != HttpStatus.OK.value()) { if (!ObjectUtils.isEmpty(listResponseModel) && listResponseModel.getStatus() != HttpStatus.OK.value()) {
...@@ -461,9 +481,57 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN ...@@ -461,9 +481,57 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN
throw new BadRequest("告知单生成失败!"); throw new BadRequest("告知单生成失败!");
} }
// 启动工作流并返回信息
List<WorkflowResultDto> workflowResultList = workFlowInfo(submitType, deviceList);
List<JgInstallationNotice> list = new ArrayList<>(); List<JgInstallationNotice> list = new ArrayList<>();
List<JgInstallationNoticeEq> equipList = 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 -> { deviceList.forEach(obj -> {
JgInstallationNoticeEq jgRelationEquip = new JgInstallationNoticeEq(); JgInstallationNoticeEq jgRelationEquip = new JgInstallationNoticeEq();
JgInstallationNotice dto = new JgInstallationNotice(); JgInstallationNotice dto = new JgInstallationNotice();
...@@ -473,116 +541,61 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN ...@@ -473,116 +541,61 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN
dto.setApplyNo(applyNo); dto.setApplyNo(applyNo);
dto.setNoticeDate(new Date()); dto.setNoticeDate(new Date());
if(SUBMIT_TYPE_FLOW.equals(submitType)) { if(SUBMIT_TYPE_FLOW.equals(submitType)) {
dto.setPromoter(RequestContext.getExeUserId()); dto.setNextExecuteIds(workflowResultList.get(i).getNextExecutorRoleIds());
dto.setNoticeStatus(String.valueOf(FlowStatusEnum.TO_BE_SUBMITTED.getCode())); 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.setInstallUnitName(reginParams.getCompany().getCompanyName());
dto.setInstallUnitCreditCode(reginParams.getCompany().getCompanyCode()); dto.setInstallUnitCreditCode(reginParams.getCompany().getCompanyCode());
dto.setEquList((String.valueOf(obj.get("EQU_CATEGORY")))); dto.setEquList((String.valueOf(obj.get("EQU_CATEGORY"))));
dto.setEntrustingUnitName(dto.getUseUnitName()); dto.setEntrustingUnitName(dto.getUseUnitName());
dto.setCreateUserCompanyName(reginParams.getCompany().getCompanyName());
dto.setEquRegisterCode(String.valueOf(obj.get("EQU_CODE")));
StringBuffer buffer = new StringBuffer(); StringBuffer buffer = new StringBuffer();
buffer.append(dto.getProvinceName()).append(dto.getCityName()).append(dto.getCountyName()).append(dto.getAddress()); buffer.append(dto.getProvinceName()).append(dto.getCityName()).append(dto.getCountyName()).append(dto.getAddress());
dto.setEquAddress(buffer.toString()); dto.setEquAddress(buffer.toString());
jgRelationEquip.setEquId(String.valueOf(obj.get("SEQUENCE_NBR"))); jgRelationEquip.setEquId(String.valueOf(obj.get("SEQUENCE_NBR")));
jgRelationEquip.setEquipTransferId(applyNo); 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); list.add(dto);
equipList.add(jgRelationEquip); 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 -> {
if (SUBMIT_TYPE_FLOW.equals(submitType)) {
// 发起流程
ActWorkflowStartDTO dto = new ActWorkflowStartDTO();
dto.setProcessDefinitionKey(PROCESS_DEFINITION_KEY);
dto.setBusinessKey(item.getSequenceNbr() + "");
dto.setCompleteFirstTask(Boolean.TRUE);
workflowStartDTOS.add(dto);
}
});
try {
actWorkflowBatchDTO.setProcess(workflowStartDTOS);
Workflow.taskV2Client.startByVariableBatch(actWorkflowBatchDTO);
} catch (Exception e) {
log.error("提交失败:{}", e);
}
}
});
// 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"))); * @param submitType 是否提交
if (!ObjectUtils.isEmpty(taskNoAuth)) { * @param deviceList 设备信息
String nextTaskId = taskNoAuth.getString("id"); * @return 工作流返回相关数据
AjaxResult taskGroupName = Workflow.taskClient.getTaskGroupName(nextTaskId); */
taskName[0] = taskNoAuth.getString("name"); private List<WorkflowResultDto> workFlowInfo(String submitType, List<Map<String, Object>> deviceList) {
JSONArray data = parseArray(JSON.toJSONString(taskGroupName.get("data"))); if (SUBMIT_TYPE_FLOW.equals(submitType)) {
for (Object datum : data) { ActWorkflowBatchDTO actWorkflowBatchDTO = new ActWorkflowBatchDTO();
if (((Map) datum).containsKey("groupId")) { List<ActWorkflowStartDTO> list = new ArrayList<>();
roleListFirst.add(((Map) datum).get("groupId").toString()); deviceList.forEach(item -> {
} ActWorkflowStartDTO dto = new ActWorkflowStartDTO();
} dto.setProcessDefinitionKey(PROCESS_DEFINITION_KEY);
dto.setBusinessKey(item.get("SEQUENCE_NBR").toString());
dto.setCompleteFirstTask(Boolean.TRUE);
list.add(dto);
});
actWorkflowBatchDTO.setProcess(list);
List<ProcessTaskDTO> processTaskDTOS = iCmWorkflowService.startBatch(actWorkflowBatchDTO);
// 组装工作流返回的数据
return commonService.buildWorkFlowInfo(processTaskDTOS);
} }
return new ArrayList<>();
} }
private void convertField(JgInstallationNoticeDto model) { private void convertField(JgInstallationNoticeDto model) {
// 处理图片 // 处理图片
if(!ValidationUtil.isEmpty(model.getProxyStatementAttachmentList())) { if(!ValidationUtil.isEmpty(model.getProxyStatementAttachmentList())) {
...@@ -667,366 +680,218 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN ...@@ -667,366 +680,218 @@ 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) { public void cancel(JgInstallationNoticeDto noticeDto) {
String[] taskName = new String[]{"流程结束"};
FeignClientResult ajaxResult = Workflow.taskV2Client.rollBack(noticeDto.getInstanceId());
JgInstallationNotice jgInstallationNotice = this.baseMapper.selectById(noticeDto.getSequenceNbr()); JgInstallationNotice jgInstallationNotice = this.baseMapper.selectById(noticeDto.getSequenceNbr());
ArrayList<String> roleList = new ArrayList<>(); ProcessTaskDTO processTaskDTO = iCmWorkflowService.rollBack(jgInstallationNotice.getInstanceId());
if(ajaxResult.getStatus() == 200) { // 提取节点等信息
WorkflowResultDto workflowResultDto = commonService.buildWorkFlowInfo(Collections.singletonList(processTaskDTO)).get(0);
// HashMap<String, Object> map = new HashMap<>(); jgInstallationNotice.setPromoter("");
// map.put("relationId", noticeDto.getInstanceId()); jgInstallationNotice.setNextExecuteIds(workflowResultDto.getNextExecutorRoleIds());
// map.put("taskStatus", FlowStatusEnum.TO_BE_FINISHED.getCode()); jgInstallationNotice.setNoticeStatus(String.valueOf(FlowStatusEnum.ROLLBACK.getCode()));
// map.put("taskStatusLabel", FlowStatusEnum.TO_BE_FINISHED.getName()); jgInstallationNotice.setNextTaskId(workflowResultDto.getNextTaskId());
// map.put("isDelete", Boolean.TRUE); this.updateById(jgInstallationNotice);
// updateTaskModel(map); JSONObject jsonObject = JSON.parseObject(JSON.toJSONString(jgInstallationNotice));
jsonObject.put("taskType", BusinessTypeEnum.JG_INSTALLATION_NOTIFICATION.getCode());
getNext(roleList, noticeDto.getInstanceId(),taskName); jsonObject.put("nextExecuteUser", jgInstallationNotice.getNextExecuteIds());
jgInstallationNotice.setStatus(taskName[0]); commonService.rollbackTask(jgInstallationNotice.getInstanceId(), jsonObject);
jgInstallationNotice.setPromoter("");
jgInstallationNotice.setNextExecuteIds(String.join(",", roleList));
jgInstallationNotice.setNoticeStatus(String.valueOf(FlowStatusEnum.ROLLBACK.getCode()));
jgInstallationNoticeMapper.updateById(jgInstallationNotice);
}
} }
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void accept(JgInstallationNoticeDto dto,String op) { public void accept(JgInstallationNoticeDto dto,String op) {
String[] taskName = new String[]{"流程结束"}; ReginParams reginParams = JSONObject.parseObject(redisUtils.get(RedisKey.buildReginKey(RequestContext.getExeUserId(), RequestContext.getToken())).toString(), ReginParams.class);
String userId = RequestContext.getExeUserId(); JgInstallationNotice jgInstallationNotice = this.getById(dto.getSequenceNbr());
JgInstallationNotice jgInstallationNotice = this.jgInstallationNoticeMapper.selectById(dto.getSequenceNbr());
jgInstallationNotice.setProcessAdvice(dto.getProcessAdvice()); jgInstallationNotice.setProcessAdvice(dto.getProcessAdvice());
ArrayList<String> roleList = new ArrayList<>(); // 组装设备注册代码
boolean submit = submit(jgInstallationNotice, op); StringBuffer stringBuffer = new StringBuffer();
// 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) {
String ym = null; String ym = null;
try { try {
ym = DateUtils.dateFormat(new Date(), DateUtils.DATE_PATTERN_MM); ym = DateUtils.dateFormat(new Date(), DateUtils.DATE_PATTERN_MM);
} catch (ParseException e) { } catch (ParseException e) {
log.error("日期转换失败:{}", e); log.error("日期转换失败:{}", e);
} }
// 组装设备注册代码 // 执行工作流并返回组装好的工作流信息
StringBuffer stringBuffer = new StringBuffer(); WorkflowResultDto workflowResultDto = getWorkflowResultDto(op, jgInstallationNotice);
LambdaQueryWrapper<JgInstallationNoticeEq> queryWrapper = new LambdaQueryWrapper<>(); jgInstallationNotice.setPromoter(reginParams.getUserModel().getUserId());
queryWrapper.eq(JgInstallationNoticeEq::getEquipTransferId,jgInstallationNotice.getSequenceNbr()); TaskV2Model taskV2Model = new TaskV2Model();
JgInstallationNoticeEq jgRelationEquip = jgInstallationNoticeEqMapper.selectOne(queryWrapper); if ("0".equals(op)) {
if (StringUtils.isEmpty(workflowResultDto.getNextExecutorRoleIds())) {
LambdaQueryWrapper<OtherInfo> queryWrapper1 = new LambdaQueryWrapper<>(); LambdaQueryWrapper<JgInstallationNoticeEq> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper1.eq(OtherInfo::getRecord,jgRelationEquip.getEquId()); queryWrapper.eq(JgInstallationNoticeEq::getEquipTransferId,dto.getSequenceNbr());
OtherInfo tzsJgOtherInfo = tzsJgOtherInfoMapper.selectOne(queryWrapper1); JgInstallationNoticeEq jgRelationEquip = jgInstallationNoticeEqMapper.selectOne(queryWrapper);
LambdaQueryWrapper<OtherInfo> queryWrapper1 = new LambdaQueryWrapper<>();
LambdaQueryWrapper<RegistrationInfo> queryWrapper2 = new LambdaQueryWrapper<>(); queryWrapper1.eq(OtherInfo::getRecord,jgRelationEquip.getEquId());
queryWrapper2.eq(RegistrationInfo::getRecord,jgRelationEquip.getEquId()); OtherInfo tzsJgOtherInfo = tzsJgOtherInfoMapper.selectOne(queryWrapper1);
RegistrationInfo tzsJgRegistrationInfo = tzsJgRegistrationInfoMapper.selectOne(queryWrapper2); LambdaQueryWrapper<RegistrationInfo> queryWrapper2 = new LambdaQueryWrapper<>();
queryWrapper2.eq(RegistrationInfo::getRecord,jgRelationEquip.getEquId());
stringBuffer.append(tzsJgRegistrationInfo.getEquCategory()).append(jgInstallationNotice.getCity()).append(ym); RegistrationInfo tzsJgRegistrationInfo = tzsJgRegistrationInfoMapper.selectOne(queryWrapper2);
String equCode = stringBuffer.toString(); stringBuffer.append(tzsJgRegistrationInfo.getEquCategory()).append(jgInstallationNotice.getCity()).append(ym);
String equCode = stringBuffer.toString();
ResponseModel<String> responseModel = tzsServiceFeignClient.deviceRegistrationCode(equCode); ResponseModel<String> responseModel = tzsServiceFeignClient.deviceRegistrationCode(equCode);
String deviceRegistrationCode = responseModel.getResult(); String deviceRegistrationCode = responseModel.getResult();
Map<String, Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
map.put("cityCode",jgInstallationNotice.getCity()); map.put("cityCode",jgInstallationNotice.getCity());
map.put("countyCode",jgInstallationNotice.getCounty()); map.put("countyCode",jgInstallationNotice.getCounty());
map.put("equCategory",tzsJgRegistrationInfo.getEquCategory()); map.put("equCategory",tzsJgRegistrationInfo.getEquCategory());
map.put("isXiXian", jgInstallationNotice.getIsXixian() == null ? "null" : jgInstallationNotice.getIsXixian().equals("0") ? "null" : "1"); map.put("isXiXian", jgInstallationNotice.getIsXixian() == null ? "null" : jgInstallationNotice.getIsXixian().equals("0") ? "null" : "1");
Map<String, Object> mapCode; Map<String, Object> mapCode;
ResponseModel<Map<String, Object>> code = tzsServiceFeignClient.createCode(map); ResponseModel<Map<String, Object>> code = tzsServiceFeignClient.createCode(map);
mapCode = code.getResult(); mapCode = code.getResult();
LambdaQueryWrapper<SupervisoryCodeInfo> queryWrapper3 = new LambdaQueryWrapper<>();
LambdaQueryWrapper<SupervisoryCodeInfo> queryWrapper3 = new LambdaQueryWrapper<>(); queryWrapper3.eq(SupervisoryCodeInfo::getSupervisoryCode,mapCode.get("superviseCode").toString());
queryWrapper3.eq(SupervisoryCodeInfo::getSupervisoryCode,mapCode.get("superviseCode").toString()); SupervisoryCodeInfo supervisoryCodeInfo = supervisoryCodeInfoMapper.selectOne(queryWrapper3);
SupervisoryCodeInfo supervisoryCodeInfo = supervisoryCodeInfoMapper.selectOne(queryWrapper3); supervisoryCodeInfo.setStatus("1");
supervisoryCodeInfo.setStatus("1"); supervisoryCodeInfoMapper.updateById(supervisoryCodeInfo);
supervisoryCodeInfoMapper.updateById(supervisoryCodeInfo); jgInstallationNotice.setNoticeStatus(String.valueOf(FlowStatusEnum.TO_BE_FINISHED.getCode()));
jgInstallationNotice.setNoticeStatus(String.valueOf(FlowStatusEnum.TO_BE_FINISHED.getCode())); jgInstallationNotice.setHandleDate(new Date());
jgInstallationNotice.setHandleDate(new Date()); Map<String,Object> map1 =new HashMap<>();
// 更新其他业务表
Map<String,Object> map1 =new HashMap<>(); if(!ValidationUtil.isEmpty(mapCode.get("code96333"))) {
tzsJgOtherInfo.setCode96333(mapCode.get("code96333").toString());
// 更新其他业务表 map1.put("CODE96333",tzsJgOtherInfo.getCode96333() );
if(!ValidationUtil.isEmpty(mapCode.get("code96333"))) { }
tzsJgOtherInfo.setCode96333(mapCode.get("code96333").toString()); tzsJgOtherInfo.setSupervisoryCode(mapCode.get("superviseCode").toString());
map1.put("CODE96333",tzsJgOtherInfo.getCode96333() ); tzsJgRegistrationInfo.setEquCode(deviceRegistrationCode);
} jgInstallationNotice.setEquRegisterCode(deviceRegistrationCode);
tzsJgOtherInfo.setSupervisoryCode(mapCode.get("superviseCode").toString()); jgInstallationNotice.setSupervisoryCode(mapCode.get("superviseCode").toString());
tzsJgRegistrationInfo.setEquCode(deviceRegistrationCode); Map<String,Map<String,Object>> objMap = new HashMap<>();
jgInstallationNotice.setEquRegisterCode(deviceRegistrationCode); map1.put("EQU_CODE",tzsJgRegistrationInfo.getEquCode() );
jgInstallationNotice.setSupervisoryCode(mapCode.get("superviseCode").toString()); map1.put("SUPERVISORY_CODE",tzsJgOtherInfo.getSupervisoryCode());
Map<String,Map<String,Object>> objMap = new HashMap<>(); map1.put("USE_UNIT_CREDIT_CODE",jgInstallationNotice.getUseUnitCreditCode());
map1.put("EQU_CODE",tzsJgRegistrationInfo.getEquCode() ); map1.put("USE_UNIT_NAME",jgInstallationNotice.getUseUnitName());
map1.put("SUPERVISORY_CODE",tzsJgOtherInfo.getSupervisoryCode()); map1.put("USC_UNIT_CREDIT_CODE",jgInstallationNotice.getInstallUnitCreditCode());
map1.put("USE_UNIT_CREDIT_CODE",jgInstallationNotice.getUseUnitCreditCode()); map1.put("USC_UNIT_NAME",jgInstallationNotice.getInstallUnitName());
map1.put("USE_UNIT_NAME",jgInstallationNotice.getUseUnitName()); objMap.put(tzsJgOtherInfo.getRecord(),map1);
jgInstallationNotice.setPromoter("");
map1.put("USC_UNIT_CREDIT_CODE",jgInstallationNotice.getInstallUnitCreditCode()); tzsServiceFeignClient.commonUpdateEsDataByIds(objMap);
map1.put("USC_UNIT_NAME",jgInstallationNotice.getInstallUnitName()); tzsJgOtherInfoMapper.updateById(tzsJgOtherInfo);
objMap.put(tzsJgOtherInfo.getRecord(),map1); tzsJgRegistrationInfoMapper.updateById(tzsJgRegistrationInfo);
jgInstallationNotice.setPromoter(""); // 更新施工信息表
tzsServiceFeignClient.commonUpdateEsDataByIds(objMap); IdxBizJgConstructionInfo idxBizJgConstructionInfo = constructionInfoService.queryNewestDetailByRecord(jgRelationEquip.getEquId());
tzsJgOtherInfoMapper.updateById(tzsJgOtherInfo); if (!ObjectUtils.isEmpty(idxBizJgConstructionInfo)) {
tzsJgRegistrationInfoMapper.updateById(tzsJgRegistrationInfo); idxBizJgConstructionInfo.setUscUnitCreditCode(jgInstallationNotice.getInstallUnitCreditCode());
idxBizJgConstructionInfo.setUscUnitName(jgInstallationNotice.getInstallUnitName());
// 更新施工信息表 idxBizJgConstructionInfo.setUscDate(jgInstallationNotice.getInstallStartDate());
IdxBizJgConstructionInfo idxBizJgConstructionInfo = constructionInfoService.queryNewestDetailByRecord(jgRelationEquip.getEquId()); // 获取施工类型id
if (!ObjectUtils.isEmpty(idxBizJgConstructionInfo)) { LambdaQueryWrapper<DataDictionary> lambda = new LambdaQueryWrapper<>();
idxBizJgConstructionInfo.setUscUnitCreditCode(jgInstallationNotice.getInstallUnitCreditCode()); lambda.eq(DataDictionary::getType, CONSTRUCTION_TYPE);
idxBizJgConstructionInfo.setUscUnitName(jgInstallationNotice.getInstallUnitName()); lambda.eq(DataDictionary::getName, CONSTRUCTION_TYPE_NAME);
idxBizJgConstructionInfo.setUscDate(jgInstallationNotice.getInstallStartDate()); List<DataDictionary> dataDictionaries = dataDictionaryMapper.selectList(lambda);
// 获取施工类型id if (!CollectionUtils.isEmpty(dataDictionaries)) {
LambdaQueryWrapper<DataDictionary> lambda = new LambdaQueryWrapper<>(); idxBizJgConstructionInfo.setConstructionType(String.valueOf(dataDictionaries.get(0).getSequenceNbr()));
lambda.eq(DataDictionary::getType, CONSTRUCTION_TYPE); }
lambda.eq(DataDictionary::getName, CONSTRUCTION_TYPE_NAME); constructionInfoService.saveOrUpdateData(idxBizJgConstructionInfo);
List<DataDictionary> dataDictionaries = dataDictionaryMapper.selectList(lambda); }
if (!CollectionUtils.isEmpty(dataDictionaries)) { // 使用信息表更新是否西咸
idxBizJgConstructionInfo.setConstructionType(String.valueOf(dataDictionaries.get(0).getSequenceNbr())); IdxBizJgUseInfo useInfo = useInfoService.getOneData(jgRelationEquip.getEquId());
if (!ObjectUtils.isEmpty(useInfo)) {
useInfo.setUseUnitCreditCode(jgInstallationNotice.getUseUnitCreditCode());
useInfo.setUseUnitName(jgInstallationNotice.getUseUnitName());
useInfo.setIsNotXiXian(jgInstallationNotice.getIsXixian() == null ? "0" : jgInstallationNotice.getIsXixian());
useInfoService.saveOrUpdateData(useInfo);
}
// 上个代办改为已办
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 {
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));
} }
constructionInfoService.saveOrUpdateData(idxBizJgConstructionInfo); } else {
} jgInstallationNotice.setPromoter("");
jgInstallationNotice.setNoticeStatus(String.valueOf(FlowStatusEnum.REJECTED.getCode()));
// 使用信息表更新是否西咸 // 上个代办改为已办
IdxBizJgUseInfo useInfo = useInfoService.getOneData(jgRelationEquip.getEquId()); HashMap<String, Object> taskMap = new HashMap<>();
if (!ObjectUtils.isEmpty(useInfo)) { taskMap.put("taskStatus", jgInstallationNotice.getNoticeStatus());
useInfo.setUseUnitCreditCode(jgInstallationNotice.getUseUnitCreditCode()); taskMap.put("taskStatusLabel", FlowStatusEnum.REJECTED.getName());
useInfo.setUseUnitName(jgInstallationNotice.getUseUnitName()); taskMap.put("relationId", jgInstallationNotice.getInstanceId());
useInfo.setIsNotXiXian(jgInstallationNotice.getIsXixian() == null ? "0" : jgInstallationNotice.getIsXixian()); taskMap.put("flowStatus", FlowStatusEnum.REJECTED.getCode());
useInfoService.saveOrUpdateData(useInfo); 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);
} }
public void buildTaskModel(TaskV2Model model){ /**
// ReginParams reginParams = JSONObject.parseObject(redisUtils.get(RedisKey.buildReginKey(RequestContext.getExeUserId(), RequestContext.getToken())).toString(), ReginParams.class); * 执行工作流并返回组装好的工作流信息
model.setStartDate(new Date()); * @param op 是否通过
model.setTaskSource("workFlow"); * @param jgTransferNotice 业务信息 opinion 备注信息
model.setCreateDate(new Date()); * @return 返回组装好的工作流信息
//model.setFinishStatus(Boolean.FALSE); */
model.setAgencyCode("tzs"); private WorkflowResultDto getWorkflowResultDto(String op, JgInstallationNotice jgTransferNotice) {
model.setTaskTitle("发起了" + model.getTaskTitle()); ProcessTaskDTO processTaskDTO = new ProcessTaskDTO();
Systemctl.taskV2Client.create(model); WorkflowResultDto workflowResultDto = new WorkflowResultDto();
} // 只调用执行API,返回下个节点信息,用于填充业务字段
//组装信息
public TaskV2Model updateTaskModel(Map<String, Object> params, JSONObject jsonObject){ TaskResultDTO workDto = new TaskResultDTO();
JSONObject userJson = null; workDto.setResultCode("approvalStatus");
if(jsonObject != null){ workDto.setTaskId(jgTransferNotice.getNextTaskId());
userJson = JSON.parseObject(jsonObject.get("user").toString()); HashMap<String, Object> commMap = new HashMap<>();
} if (jgTransferNotice.getNoticeStatus().equals("6614") || jgTransferNotice.getNoticeStatus().equals("6615")) {
List<TaskV2Model> result =Systemctl.taskV2Client.selectListByRelationId(params.get("relationId").toString()).getResult(); commMap.put("approvalStatus", "提交");
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());
} else { } else {
Systemctl.taskV2Client.update(model, model.getSequenceNbr()); commMap.put("approvalStatus", op);
} }
return model; workDto.setVariable(commMap);
workDto.setComment(jgTransferNotice.getProcessAdvice());
processTaskDTO = iCmWorkflowService.complete(jgTransferNotice.getNextTaskId(), workDto);
// 提取节点等信息
workflowResultDto = commonService.buildWorkFlowInfo(Collections.singletonList(processTaskDTO)).get(0);
return workflowResultDto;
} }
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;
} else {
return FlowStatusEnum.ROLLBACK;
}
}
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 @Override
public Map<String, Object> getCompanyType() { public Map<String, Object> getCompanyType() {
Map<String, Object> result = new HashMap<>(); Map<String, Object> result = new HashMap<>();
......
...@@ -55,8 +55,6 @@ import org.typroject.tyboot.core.restful.utils.ResponseModel; ...@@ -55,8 +55,6 @@ import org.typroject.tyboot.core.restful.utils.ResponseModel;
import java.util.*; import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import static com.alibaba.fastjson.JSON.parseArray;
/** /**
* 设备注销报废服务实现类 * 设备注销报废服务实现类
* *
...@@ -461,6 +459,7 @@ public class JgScrapCancelServiceImpl extends BaseService<JgScrapCancelDto, JgSc ...@@ -461,6 +459,7 @@ public class JgScrapCancelServiceImpl extends BaseService<JgScrapCancelDto, JgSc
params.put("taskStatusLabel", flowStatusEnum.getName()); params.put("taskStatusLabel", flowStatusEnum.getName());
params.put("flowStatus", this.getTaskStatusByName(jgScrapCancelDto.getAuditStatus())); params.put("flowStatus", this.getTaskStatusByName(jgScrapCancelDto.getAuditStatus()));
params.put("flowStatusLabel", jgScrapCancelDto.getAuditStatus()); params.put("flowStatusLabel", jgScrapCancelDto.getAuditStatus());
params.put("model", jgScrapCancelDto);
return commonService.updateTaskModel(params); return commonService.updateTaskModel(params);
} }
...@@ -492,7 +491,7 @@ public class JgScrapCancelServiceImpl extends BaseService<JgScrapCancelDto, JgSc ...@@ -492,7 +491,7 @@ public class JgScrapCancelServiceImpl extends BaseService<JgScrapCancelDto, JgSc
} }
Map<String, Object> installationInfo = BeanUtil.beanToMap(notice); Map<String, Object> installationInfo = BeanUtil.beanToMap(notice);
installationInfo.put("receiveOrgCode", notice.getReceiveOrgCode() + "_" + notice.getReceiveOrgName()); 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(); LambdaQueryWrapper<JgScrapCancelEq> lambdaEq = new QueryWrapper<JgScrapCancelEq>().lambda();
lambdaEq.eq(JgScrapCancelEq::getEquipTransferId, sequenceNbr); lambdaEq.eq(JgScrapCancelEq::getEquipTransferId, sequenceNbr);
JgScrapCancelEq jgScrapCancelEq = jgScrapCancelEqMapper.selectOne(lambdaEq); JgScrapCancelEq jgScrapCancelEq = jgScrapCancelEqMapper.selectOne(lambdaEq);
...@@ -540,7 +539,7 @@ public class JgScrapCancelServiceImpl extends BaseService<JgScrapCancelDto, JgSc ...@@ -540,7 +539,7 @@ public class JgScrapCancelServiceImpl extends BaseService<JgScrapCancelDto, JgSc
commonService.rollbackTask(instanceId, jsonObject); commonService.rollbackTask(instanceId, jsonObject);
} }
@Transactional
public void flowExecute(Long id, String instanceId, String operate, String comment) { public void flowExecute(Long id, String instanceId, String operate, String comment) {
try { try {
JgScrapCancel jgScrapCancel = this.getBaseMapper().selectById(id); JgScrapCancel jgScrapCancel = this.getBaseMapper().selectById(id);
...@@ -606,8 +605,6 @@ public class JgScrapCancelServiceImpl extends BaseService<JgScrapCancelDto, JgSc ...@@ -606,8 +605,6 @@ public class JgScrapCancelServiceImpl extends BaseService<JgScrapCancelDto, JgSc
// 更新上一步待办、创建待办 // 更新上一步待办、创建待办
executeOneStep(scrapCancelDto, taskName, nextUserIds, operate); executeOneStep(scrapCancelDto, taskName, nextUserIds, operate);
} else { } else {
jgScrapCancel.setAuditStatus(FlowStatusEnum.TO_BE_FINISHED.getName());
jgScrapCancel.setAuditPassDate(new Date());
// 完成时 下一步骤可执行人清空 // 完成时 下一步骤可执行人清空
jgScrapCancel.setNextExecuteUserIds(""); jgScrapCancel.setNextExecuteUserIds("");
// 修改业务信息 // 修改业务信息
......
...@@ -592,7 +592,7 @@ public class JgTransferNoticeServiceImpl extends BaseService<JgTransferNoticeDto ...@@ -592,7 +592,7 @@ public class JgTransferNoticeServiceImpl extends BaseService<JgTransferNoticeDto
JSONObject jsonObject = JSON.parseObject(JSON.toJSONString(jgInstallationNotice)); JSONObject jsonObject = JSON.parseObject(JSON.toJSONString(jgInstallationNotice));
jsonObject.put("taskType", BusinessTypeEnum.JG_ADVICE_REMOVAL.getCode()); jsonObject.put("taskType", BusinessTypeEnum.JG_ADVICE_REMOVAL.getCode());
jsonObject.put("nextExecuteUser", jgInstallationNotice.getNextExecuteIds()); jsonObject.put("nextExecuteUser", jgInstallationNotice.getNextExecuteIds());
commonService.rollbackTask(jgInstallationNotice.getInstanceId(), JSON.parseObject(JSON.toJSONString(jgInstallationNotice))); commonService.rollbackTask(jgInstallationNotice.getInstanceId(), jsonObject);
} }
@Transactional @Transactional
...@@ -633,6 +633,7 @@ public class JgTransferNoticeServiceImpl extends BaseService<JgTransferNoticeDto ...@@ -633,6 +633,7 @@ public class JgTransferNoticeServiceImpl extends BaseService<JgTransferNoticeDto
taskMap.put("relationId", jgTransferNotice.getInstanceId()); taskMap.put("relationId", jgTransferNotice.getInstanceId());
taskMap.put("flowStatus", FlowStatusEnum.TO_BE_FINISHED.getCode()); taskMap.put("flowStatus", FlowStatusEnum.TO_BE_FINISHED.getCode());
taskMap.put("flowStatusLabel", FlowStatusEnum.TO_BE_FINISHED.getName()); taskMap.put("flowStatusLabel", FlowStatusEnum.TO_BE_FINISHED.getName());
taskMap.put("model", jgTransferNotice);
taskV2Model = commonService.updateTaskModel(taskMap); taskV2Model = commonService.updateTaskModel(taskMap);
} else { } else {
jgTransferNotice.setNextExecuteIds(workflowResultDto.getNextExecutorRoleIds()); jgTransferNotice.setNextExecuteIds(workflowResultDto.getNextExecutorRoleIds());
......
...@@ -274,7 +274,7 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD ...@@ -274,7 +274,7 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
} else { } else {
// 驳回操作 // 驳回操作
jgUseRegistration.setStatus(WorkFlowStatusEnum.getMessage(taskCode).getReject()); jgUseRegistration.setStatus(WorkFlowStatusEnum.getMessage(taskCode).getReject());
jgUseRegistration.setPromoter(null); jgUseRegistration.setPromoter("");
} }
if (isFirst){ if (isFirst){
buildTask(jgUseRegistration, workflowResultDto); buildTask(jgUseRegistration, workflowResultDto);
......
...@@ -9,13 +9,13 @@ ...@@ -9,13 +9,13 @@
"type": "102", "type": "102",
"pageType": "look", "pageType": "look",
"name": "安装告知", "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", "type": "102",
"pageType": "edit", "pageType": "edit",
"name": "安装告知", "name": "安装告知",
"url": "/mixuap?appId=1742358052905971713&id=1734127099570057217&sequenceNbr=%s&roleIds=%s&userId={userId}&nextExecuteIds=%s&formType=edit&noticeStatus=%s&instanceId=%s" "url": ""
}, },
{ {
"type": "103", "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