Commit 078d7b81 authored by 刘林's avatar 刘林

fix(jg):超设计使用年限功能开发

parent a5905186
......@@ -25,4 +25,6 @@ public interface JgOverDesignServiceLifeMapper extends BaseMapper<JgOverDesignSe
@Param("sort") SortVo sortMap,
@Param("dto") JgOverDesignServiceLifeDto dto ,
@Param("type") String type);
List<Map<String, Object>> selectEquipList(@Param("records") List<String> records);
}
......@@ -97,4 +97,28 @@
</if>
ovds.create_date DESC, ovds.apply_no DESC
</select>
<select id="selectEquipList" resultType="java.util.Map">
select jui.RECORD as SEQUENCE_NBR,
jfi.PRODUCE_UNIT_NAME,
jui.USE_INNER_CODE,
jfi.FACTORY_NUM,
jui.ADDRESS as ADDRESS,
jui.RECORD record,
(SELECT name from tz_equipment_category where code = jri.EQU_DEFINE) as EQU_DEFINE,
jri.PRODUCT_NAME,
jri.EQU_CODE,
jri.USE_ORG_CODE,
(SELECT name from tz_equipment_category where code = jri.EQU_LIST) as EQU_LIST,
(SELECT name from tz_equipment_category where code = jri.EQU_CATEGORY) as EQU_CATEGORY,
(select other.SUPERVISORY_CODE from idx_biz_jg_other_info other where other.RECORD = jui.RECORD) as SUPERVISORY_CODE,
to_char((select NEXT_INSPECT_DATE from idx_biz_jg_inspection_detection_info where "RECORD" = jui."RECORD" ORDER BY INSPECT_DATE DESC limit 1), 'YYYY-MM-DD') as NEXT_INSPECT_DATE
FROM idx_biz_jg_use_info jui
LEFT JOIN idx_biz_jg_factory_info jfi on jui.RECORD = jfi.RECORD
LEFT JOIN idx_biz_jg_register_info jri on jui.RECORD = jri.RECORD
WHERE jui.record in
<foreach collection="records" item="record" open="(" close=")" separator=",">
#{record}
</foreach>
</select>
</mapper>
......@@ -60,6 +60,12 @@
<artifactId>seata-spring-boot-starter</artifactId>
<version>1.8.0</version>
</dependency>
<dependency>
<groupId>org.apache.pdfbox</groupId>
<artifactId>pdfbox</artifactId>
<version>2.0.12</version>
<scope>compile</scope>
</dependency>
</dependencies>
<build>
<plugins>
......
......@@ -17,4 +17,6 @@ public interface IIdxBizJgInspectionDetectionInfoService {
List<IdxBizJgInspectionDetectionInfo> checkInspectionInfo(List<String> records);
boolean saveOrUpdateBatch(List<IdxBizJgInspectionDetectionInfo> inspectionDetectionInfoList);
List<IdxBizJgInspectionDetectionInfo> queryInspectionListByRecord(String record);
}
......@@ -72,6 +72,7 @@ import com.yeejoin.amos.feign.workflow.model.ProcessTaskDTO;
import freemarker.template.Configuration;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.apache.pdfbox.multipdf.PDFMergerUtility;
import org.redisson.api.RBucket;
import org.redisson.api.RLock;
import org.redisson.api.RedissonClient;
......@@ -804,7 +805,7 @@ public class CommonServiceImpl implements ICommonService {
while (it.hasNext()) {
LinkedHashMap e = (LinkedHashMap) it.next();
// 删除非指定的单位类型
if (!e.get("companyType").toString().contains(companyType)) {
if (e.get("companyType") != null && !e.get("companyType").toString().contains(companyType)) {
it.remove();
}
if (!ObjectUtils.isEmpty(e.get("children"))) {
......@@ -2451,47 +2452,54 @@ public class CommonServiceImpl implements ICommonService {
return formData;
}
//多个证进行批量生成
public List<JSONObject> buildFileForOverDesign(JSONObject jsonObject) {
List<JSONObject> formDataList = new ArrayList<>();
if (jsonObject.containsKey("equipmentLists")) {
JSONArray equipmentLists = jsonObject.getJSONArray("equipmentLists");
List<Map<String, Object>> equips = equipmentLists.stream()
.filter(obj -> obj instanceof Map)
.map(obj -> (Map<String, Object>) obj)
.collect(Collectors.toList());
if (!CollectionUtils.isEmpty(equips)) {
Map<String, Object> firstEquip = equips.get(0);
String equDefine = (String) firstEquip.get("EQU_DEFINE");
String equCategory = (String) firstEquip.get("EQU_CATEGORY");
formDataList = equips.stream().map(v -> {
JSONObject formData = new JSONObject();
formData.putAll(jsonObject);
formData.put("equDefine", equDefine);
formData.put("equCategory", equCategory);
formData.entrySet().removeIf(entry -> entry.getValue() == null);
DateTimeFormatter inputFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
DateTimeFormatter outputFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
if (formData.containsKey("type")) {
formData.put("registrationType", RegistrationTypeEnum.getNameByType(formData.getString("type")));
}
if (formData.containsKey("equListCode")) {
formData.put("equList", EquipmentClassifityEnum.getNameByCode(formData.getString("equListCode")));
}
//多个证进行批量生成
if (formData.containsKey("equipmentLists")) {
JSONArray equipmentLists = formData.getJSONArray("equipmentLists");
List<Map<String, Object>> equips = equipmentLists.stream()
.filter(obj -> obj instanceof Map)
.map(obj -> (Map<String, Object>) obj).collect(Collectors.toList());
if (!CollectionUtils.isEmpty(equips)) {
formData.put("equDefine", equips.get(0).get("EQU_DEFINE"));
formData.put("equCategory", equips.get(0).get("EQU_CATEGORY"));
equips.forEach(v -> {
String useRegistrationCode = Objects.toString(v.get("USE_ORG_CODE"),"");
Optional.ofNullable(Objects.toString(jsonObject.get("type"), ""))
.ifPresent(type -> formData.put("registrationType", RegistrationTypeEnum.getNameByType(type)));
Optional.ofNullable(Objects.toString(jsonObject.get("equListCode"), ""))
.ifPresent(code -> formData.put("equList", EquipmentClassifityEnum.getNameByCode(code)));
String useRegistrationCode = Objects.toString(v.get("USE_ORG_CODE"), "");
JgUseRegistrationManage manage = jgUseRegistrationManageService.lambdaQuery()
.eq(JgUseRegistrationManage::getUseRegistrationCode, useRegistrationCode)
.eq(JgUseRegistrationManage::getIsDelete, 0)
.eq(JgUseRegistrationManage::getCertificateStatus,CertificateStatusEnum.YIDENGJI.getName()).one();
.eq(JgUseRegistrationManage::getCertificateStatus, CertificateStatusEnum.YIDENGJI.getName())
.one();
formData.put("equCode", v.get("EQU_CODE"));
formData.put("useRegistrationCode", v.get("USE_ORG_CODE"));
formData.put("produceUnitName", v.get("PRODUCE_UNIT_NAME"));
formData.put("produceDate", LocalDateTime.parse(Objects.toString(v.get("PRODUCE_DATE")), inputFormatter).format(outputFormatter));
formData.put("produceDate", LocalDateTime.parse(Objects.toString(v.get("PRODUCE_DATE")), inputFormatter)
.format(outputFormatter));
formData.put("factoryNum", v.get("FACTORY_NUM"));
formData.put("productName", v.get("PRODUCT_NAME"));
formData.put("useUnitName", v.get("USE_UNIT_NAME"));
formData.put("auditPassDate", new SimpleDateFormat("yyyy-MM-dd").format( manage.getAuditPassDate()));
formData.put("receiveCompanyOrgName", manage.getReceiveOrgName());
formData.put("applyNo", manage.getApplyNo());
if (manage != null && manage.getAuditPassDate() != null) {
formData.put("auditPassDate", new SimpleDateFormat("yyyy-MM-dd").format(manage.getAuditPassDate()));
}
formData.put("receiveCompanyOrgName", manage != null ? manage.getReceiveOrgName() : null);
formData.put("applyNo", manage != null ? manage.getApplyNo() : null);
formData.put("cruDate", DateUtils.convertDateToString(new Date(), DateUtils.CHN_DATE_PATTERN));
formDataList.add(formData);
});
return formData;
}).collect(Collectors.toList());
}
}
return formDataList;
......@@ -2575,16 +2583,19 @@ public class CommonServiceImpl implements ICommonService {
List<JSONObject> formDataList = buildFileForOverDesign(jsonObject);
String wordPath = "use-registration-change-certificate.ftl";
String fileName = "特种设备使用登记变更证明_";
List<String> uploadedUrls = new ArrayList<>();
List<File> generatedFiles = new ArrayList<>();
File mergedPdfFile = null;
try {
List<File> pdfFiles = new ArrayList<>();
for (JSONObject formData : formDataList) {
File pdfFile = wordToPdf(fileName, wordPath, formData);
pdfFiles.add(pdfFile);
generatedFiles.add(pdfFile);
uploadedUrls.add(uploadFile(pdfFile, "useRegistrationFormFiles"));
}
return MapBuilder.<String, Object>create().put("useRegistrationFormUrl", uploadedUrls).build();
mergedPdfFile = mergePdfFiles(pdfFiles, fileName + "合并.pdf");
String uploadedUrl = uploadFile(mergedPdfFile, "useRegistrationFormFiles");
return MapBuilder.<String, Object>create().put("useRegistrationFormUrl", uploadedUrl).build();
} catch (Exception e) {
throw new RuntimeException(e);
} finally {
......@@ -2595,7 +2606,25 @@ public class CommonServiceImpl implements ICommonService {
log.error("文件找不到,删除失败:{}", e);
}
}
if (mergedPdfFile != null) {
try {
Files.deleteIfExists(mergedPdfFile.toPath());
} catch (Exception e) {
log.error("合并 PDF 文件删除失败:{}", e);
}
}
}
}
private File mergePdfFiles(List<File> pdfFiles, String outputFileName) throws IOException {
PDFMergerUtility merger = new PDFMergerUtility();
File outputFile = new File(System.getProperty("java.io.tmpdir"), outputFileName);
merger.setDestinationFileName(outputFile.getAbsolutePath());
for (File pdf : pdfFiles) {
merger.addSource(pdf);
}
merger.mergeDocuments(null);
return outputFile;
}
@Override
......
......@@ -12,6 +12,7 @@ import org.typroject.tyboot.core.rdbms.service.BaseService;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
/**
* 安全追溯-检验检测信息表服务实现类
......@@ -57,4 +58,19 @@ public class IdxBizJgInspectionDetectionInfoServiceImpl extends BaseService<IdxB
public boolean saveOrUpdateBatch(List<IdxBizJgInspectionDetectionInfo> inspectionDetectionInfoList) {
return super.saveOrUpdateBatch(inspectionDetectionInfoList);
}
@Override
public List<IdxBizJgInspectionDetectionInfo> queryInspectionListByRecord(String record) {
return list(new QueryWrapper<IdxBizJgInspectionDetectionInfo>()
.lambda()
.eq(IdxBizJgInspectionDetectionInfo::getRecord, record)
.orderByDesc(IdxBizJgInspectionDetectionInfo::getInspectDate))
.stream()
.map(info -> {
IdxBizJgInspectionDetectionInfo result = new IdxBizJgInspectionDetectionInfo();
BeanUtils.copyProperties(info, result);
return result;
})
.collect(Collectors.toList());
}
}
\ No newline at end of file
......@@ -29,11 +29,13 @@ import com.yeejoin.amos.boot.module.jg.biz.context.FlowingEquipRedisContext;
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.ICompensateFlowDataOfRedis;
import com.yeejoin.amos.boot.module.jg.biz.service.IIdxBizJgInspectionDetectionInfoService;
import com.yeejoin.amos.boot.module.ymt.api.entity.IdxBizJgDesignInfo;
import com.yeejoin.amos.boot.module.ymt.api.entity.IdxBizJgInspectionDetectionInfo;
import com.yeejoin.amos.boot.module.ymt.api.entity.IdxBizJgRegisterInfo;
import com.yeejoin.amos.boot.module.ymt.api.enums.ApplicationFormTypeEnum;
import com.yeejoin.amos.boot.module.ymt.api.enums.FlowStatusEnum;
import com.yeejoin.amos.boot.module.ymt.api.mapper.IdxBizJgDesignInfoMapper;
import com.yeejoin.amos.feign.privilege.Privilege;
import com.yeejoin.amos.feign.privilege.model.CompanyModel;
import com.yeejoin.amos.feign.systemctl.model.TaskV2Model;
......@@ -59,6 +61,7 @@ import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import java.time.ZoneId;
import java.util.*;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
......@@ -71,12 +74,11 @@ import static java.util.stream.Collectors.toList;
* @date 2025-03-06
*/
@Service
public class JgOverDesignServiceLifeServiceImpl extends BaseService<JgOverDesignServiceLife,JgOverDesignServiceLife,JgOverDesignServiceLifeMapper> implements IJgOverDesignServiceLifeService, ICompensateFlowDataOfRedis<JgOverDesignServiceLife> {
public class JgOverDesignServiceLifeServiceImpl extends BaseService<JgOverDesignServiceLife, JgOverDesignServiceLife, JgOverDesignServiceLifeMapper> implements IJgOverDesignServiceLifeService, ICompensateFlowDataOfRedis<JgOverDesignServiceLife> {
private static final String DEFINITION_KEY = "overDesignServiceLife";
public static final String SUBMIT_TYPE_FLOW = "1";
public static final String SUBMIT_DATA = "0";
private static final String TABLE_PAGE_ID = "overDesignServiceLife";
private final List<String> NOT_FLOWING_STATE = Arrays.asList("使用单位待提交", "一级受理已驳回", "使用单位已撤回", "已作废");
@Autowired
private CommonServiceImpl commonService;
......@@ -108,6 +110,12 @@ public class JgOverDesignServiceLifeServiceImpl extends BaseService<JgOverDesign
private JgRegistrationHistoryMapper jgRegistrationHistoryMapper;
@Autowired
private JgUseRegistrationManageServiceImpl useRegistrationManageService;
@Autowired
IdxBizJgDesignInfoServiceImpl idxBizJgDesignInfoService;
@Autowired
IdxBizJgDesignInfoMapper idxBizJgDesignInfoMapper;
@Autowired
IIdxBizJgInspectionDetectionInfoService iIdxBizJgInspectionDetectionInfoService;
/**
* 分页查询
......@@ -127,9 +135,9 @@ public class JgOverDesignServiceLifeServiceImpl extends BaseService<JgOverDesign
public List<JgOverDesignServiceLife> saveOrUpdate(JSONObject map, ReginParams reginParams) {
CompanyBo company = reginParams.getCompany();
try {
if(SUBMIT_TYPE_FLOW.equals(map.get("submit"))){
if (SUBMIT_TYPE_FLOW.equals(map.get("submit"))) {
JSONArray useRegistrationFormFile = map.getJSONArray("useRegistrationFormFile");
if(CollUtil.isEmpty(useRegistrationFormFile)){
if (CollUtil.isEmpty(useRegistrationFormFile)) {
throw new BadRequest("特种设备超设计使用年限变更证明(签章后)为空,请上传后再提交!");
}
}
......@@ -137,9 +145,9 @@ public class JgOverDesignServiceLifeServiceImpl extends BaseService<JgOverDesign
Optional.ofNullable(map.get("useRegistrationFormFile"))
.map(JSONObject::toJSONString)
.ifPresent(overDesignDto::setUseRegistrationFormFile);
map.put("userName",reginParams.getUserModel().getRealName());
Map<String, Object> overDesign = commonService.getRegistrationFormUrl("vehicle", map);
if(Objects.nonNull(overDesign)){
map.put("userName", reginParams.getUserModel().getRealName());
Map<String, Object> overDesign = commonService.getRegistrationFormUrl("overDesign", map);
if (Objects.nonNull(overDesign)) {
overDesignDto.setUseRegistrationFormUrl(String.valueOf(overDesign.get("useRegistrationFormUrl")));
}
List<Map<String, Object>> equipmentLists = (List<Map<String, Object>>) map.get("equipmentLists");
......@@ -226,10 +234,10 @@ public class JgOverDesignServiceLifeServiceImpl extends BaseService<JgOverDesign
equip.setEquId(String.valueOf(device.get("record")));
equip.setOverDesignId(Objects.toString(overDesignServiceLife.getSequenceNbr()));
equip.setDeviceInfo(JSONObject.toJSONString(device));
equip.setUseRegistrationCode(Objects.toString(device.get("USE_ORG_CODE"),""));
equip.setEquList(Objects.toString(device.get("EQU_LIST_CODE"),""));
equip.setEquCategory(Objects.toString(device.get("EQU_CATEGORY_CODE"),""));
equip.setEquDefine(Objects.toString(device.get("EQU_DEFINE_CODE"),""));
equip.setUseRegistrationCode(Objects.toString(device.get("USE_ORG_CODE"), ""));
equip.setEquList(Objects.toString(device.get("EQU_LIST_CODE"), ""));
equip.setEquCategory(Objects.toString(device.get("EQU_CATEGORY_CODE"), ""));
equip.setEquDefine(Objects.toString(device.get("EQU_DEFINE_CODE"), ""));
if (!ObjectUtils.isEmpty(device.get("SAFETY_ASSESSMENT_REPORT"))) {
equip.setSafetyAssessmentReport(JSONObject.toJSONString(device.get("SAFETY_ASSESSMENT_REPORT")));
}
......@@ -278,7 +286,7 @@ public class JgOverDesignServiceLifeServiceImpl extends BaseService<JgOverDesign
commonService.buildTaskModel(list);
}
}
commonService.saveOrUpdateHistory(BusinessTypeEnum.JG_OVER_DESIGN_SERVICE_LIFE.getName(), JSON.parseArray(JSON.toJSONString(equipmentLists)), null, overDesignServiceLife.getSequenceNbr() + "");
commonService.saveOrUpdateHistory(BusinessTypeEnum.JG_OVER_DESIGN_SERVICE_LIFE.getName(), map, null, overDesignServiceLife.getSequenceNbr() + "");
return Collections.singletonList(overDesignServiceLife);
} catch (BadRequest | LocalBadRequest e) {
log.error(e.getMessage(), e);
......@@ -333,7 +341,7 @@ public class JgOverDesignServiceLifeServiceImpl extends BaseService<JgOverDesign
LambdaUpdateWrapper<JgOverDesignServiceLifeEq> overDesignServiceLifeEqWrapper = new LambdaUpdateWrapper<JgOverDesignServiceLifeEq>()
.eq(JgOverDesignServiceLifeEq::getEquId, sequenceNbr)
.set(JgOverDesignServiceLifeEq::getIsDelete, true);
jgOverDesignServiceLifeEqService.getBaseMapper().update(null,overDesignServiceLifeEqWrapper);
jgOverDesignServiceLifeEqService.getBaseMapper().update(null, overDesignServiceLifeEqWrapper);
// 删除单子对应历史表数据
jgRegistrationHistoryService.getBaseMapper().update(null,
new LambdaUpdateWrapper<JgRegistrationHistory>()
......@@ -351,6 +359,7 @@ public class JgOverDesignServiceLifeServiceImpl extends BaseService<JgOverDesign
/**
* 撤回
*
* @param instanceId 流程id
* @param nextTaskId 任务id
* @param manageType 类型
......@@ -572,20 +581,8 @@ public class JgOverDesignServiceLifeServiceImpl extends BaseService<JgOverDesign
lambdaSelect.eq(JgRegistrationHistory::getIsDelete, false);
JgRegistrationHistory jgRegistrationHistory = jgRegistrationHistoryService.getBaseMapper().selectOne(lambdaSelect);
String jsonData = jgRegistrationHistory.getChangeData();
JSONArray jsonArray = JSONArray.parseArray(jsonData);
for (int i = 0; i < jsonArray.size(); i++) {
JSONObject mapData = jsonArray.getJSONObject(i);
// 更新设备信息
// this.updateEquipMessage(jgOverDesignServiceLife, mapData, registerInfo, otherInfo);
// // 更新es
// updateEsData(mapData, jgOverDesignServiceLife, otherInfo);
}
// 更新新生成的历史数据的设备代码
jgRegistrationHistory.setChangeData(JSON.toJSONString(jsonArray));
jgRegistrationHistoryService.updateById(jgRegistrationHistory);
JSONObject jsonObject = JSONObject.parseObject(jsonData);
this.updateEquipMessage(jsonObject);
// 更新代办状态
HashMap<String, Object> params = new HashMap<>();
params.put("relationId", jgOverDesignServiceLife.getInstanceId());
......@@ -602,6 +599,42 @@ public class JgOverDesignServiceLifeServiceImpl extends BaseService<JgOverDesign
commonService.saveExecuteFlowData2Redis(jgOverDesignServiceLife.getInstanceId(), this.buildInstanceRuntimeData(jgOverDesignServiceLife));
}
private void updateEquipMessage(JSONObject jsonObject) {
List<Map<String, Object>> equipmentLists = (List<Map<String, Object>>) jsonObject.get("equipmentLists");
List<String> useOrgCodes = equipmentLists.stream()
.map(obj -> ((JSONObject) obj).getString("USE_ORG_CODE"))
.collect(Collectors.toList());
List<IdxBizJgDesignInfo> designInfoList = idxBizJgDesignInfoServiceImpl.checkOverDesignRegNum(
equipmentLists.stream().map(v -> (String) v.get("record")).collect(Collectors.toList())
);
if (CollectionUtils.isEmpty(designInfoList)) {
throw new BadRequest("未查询到设备设计信息!");
};
String equListCode = Objects.toString(equipmentLists.get(0).get("EQU_LIST_CODE"));
ZoneId zoneId = ZoneId.systemDefault();
designInfoList.forEach(designInfo -> {
List<IdxBizJgInspectionDetectionInfo> inspectionList =
iIdxBizJgInspectionDetectionInfoService.queryInspectionListByRecord(designInfo.getRecord());
designInfo.setOverDesignRegNum(Math.min(designInfo.getOverDesignRegNum() + 1, 2));
designInfo.setDelayServiceLifeDate(inspectionList.stream()
.filter(info -> "6000".equals(equListCode) || "WTJY".equals(info.getInspectType()))
.findFirst()
.map(info -> "6000".equals(equListCode) ? info.getInspectDate() : info.getNextInspectDate())
.map(date -> date.toInstant().atZone(zoneId).toLocalDate().plusYears("6000".equals(equListCode) ? 4 : 0).toString())
.orElse(null));
});
idxBizJgDesignInfoService.saveOrUpdateBatch(designInfoList);
useRegistrationManageService.lambdaUpdate()
.set(JgUseRegistrationManage::getIsOverDesign, 1)
.in(JgUseRegistrationManage::getUseRegistrationCode, useOrgCodes)
.update();
}
private void buildTask(JgOverDesignServiceLife jgOverDesignServiceLife, WorkflowResultDto workflowResultDto) {
// 代办消息
ArrayList<TaskModelDto> list = new ArrayList<>();
......@@ -651,8 +684,8 @@ public class JgOverDesignServiceLifeServiceImpl extends BaseService<JgOverDesign
}
public String getEquipListCode(String record) {
IdxBizJgRegisterInfo registerInfo = idxBizJgRegisterInfoService.getOne(new LambdaQueryWrapper<IdxBizJgRegisterInfo>().eq(IdxBizJgRegisterInfo::getRecord, record).select(TzsBaseEntity::getSequenceNbr,IdxBizJgRegisterInfo::getEquList));
if(registerInfo != null){
IdxBizJgRegisterInfo registerInfo = idxBizJgRegisterInfoService.getOne(new LambdaQueryWrapper<IdxBizJgRegisterInfo>().eq(IdxBizJgRegisterInfo::getRecord, record).select(TzsBaseEntity::getSequenceNbr, IdxBizJgRegisterInfo::getEquList));
if (registerInfo != null) {
return registerInfo.getEquList();
}
return null;
......@@ -700,43 +733,49 @@ public class JgOverDesignServiceLifeServiceImpl extends BaseService<JgOverDesign
Map<String, Object> resultDataMap = new HashMap<>();
JgOverDesignServiceLife overDesignServiceLife = this.getById(sequenceNbr);
this.doCompensate(overDesignServiceLife);
JSONArray historyData = commonService.queryHistoryDataObj(sequenceNbr);
if (ValidationUtil.equals(FlowStatusEnum.TO_BE_FINISHED.getName(), overDesignServiceLife.getStatus())) {
if (!ValidationUtil.isEmpty(historyData)) {
if (!ValidationUtil.isEmpty(overDesignServiceLife)) {
JgRegistrationHistory jgRegistrationHistory = jgRegistrationHistoryService.getBaseMapper()
.selectOne(new QueryWrapper<JgRegistrationHistory>().lambda()
.eq(JgRegistrationHistory::getCurrentDocumentId, sequenceNbr)
.eq(JgRegistrationHistory::getIsDelete, false));
JSONObject jsonObject = JSONObject.parseObject(jgRegistrationHistory.getChangeData());
if (FlowStatusEnum.TO_BE_FINISHED.getName().equals(overDesignServiceLife.getStatus()) &&
!ValidationUtil.isEmpty(jsonObject) &&
!ValidationUtil.isEmpty(overDesignServiceLife)) {
String companyAndOrg = overDesignServiceLife.getReceiveCompanyCode() + "_" + overDesignServiceLife.getReceiveOrgName();
Map<String, Object> transferToMap = Bean.BeantoMap(overDesignServiceLife);
transferToMap.put("equipmentLists", JSONArray.parseArray(String.valueOf(historyData)));
transferToMap.put("receiveCompanyCode", overDesignServiceLife.getReceiveCompanyCode() + "_" + overDesignServiceLife.getReceiveOrgName());
transferToMap.put("receiveOrgCode", overDesignServiceLife.getReceiveCompanyCode() + "_" + overDesignServiceLife.getReceiveOrgName());
transferToMap.put("equipmentLists", jsonObject.get("equipmentLists"));
transferToMap.put("receiveCompanyCode", companyAndOrg);
transferToMap.put("receiveOrgCode", companyAndOrg);
resultDataMap.putAll(transferToMap);
}
}
} else {
if (!ValidationUtil.isEmpty(overDesignServiceLife)) {
List<String> useRegistrationCodes = historyData.stream()
} else if (!ValidationUtil.isEmpty(overDesignServiceLife)) { // 非执行完成状态显示最新设备信息
List<Map<String, Object>> equipmentLists = (List<Map<String, Object>>) jsonObject.get("equipmentLists");
List<String> records = equipmentLists.stream()
.map(v -> (String) v.get("record"))
.collect(Collectors.toList());
List<String> useOrgCodes = equipmentLists.stream()
.map(obj -> ((JSONObject) obj).getString("USE_ORG_CODE"))
.collect(Collectors.toList());
List<JgUseRegistrationManage> registrationList = useRegistrationManageService.lambdaQuery()
.in(JgUseRegistrationManage::getUseRegistrationCode, useRegistrationCodes)
.in(JgUseRegistrationManage::getUseRegistrationCode, useOrgCodes)
.list();
String companyAndOrg = overDesignServiceLife.getReceiveCompanyCode() + "_" + overDesignServiceLife.getReceiveOrgName();
resultDataMap.putAll(Bean.BeantoMap(overDesignServiceLife));
resultDataMap.put("receiveCompanyCode", overDesignServiceLife.getReceiveCompanyCode() + "_" + overDesignServiceLife.getReceiveOrgName());
resultDataMap.put("receiveOrgCode", overDesignServiceLife.getReceiveCompanyCode() + "_" + overDesignServiceLife.getReceiveOrgName());
resultDataMap.put("receiveCompanyCode", companyAndOrg);
resultDataMap.put("receiveOrgCode", companyAndOrg);
resultDataMap.put("sequenceNbrs", registrationList.stream()
.map(BaseEntity::getSequenceNbr)
.collect(Collectors.toList()));
resultDataMap.put("equipmentLists", JSONArray.parseArray(String.valueOf(historyData)));
}
List<Map<String, Object>> result = this.getBaseMapper().selectEquipList(records);
resultDataMap.put("equipmentLists", result);
}
commonService.convertStringToJsonobject(resultDataMap, new String[]{"otherAccessories"});
commonService.convertStringToJsonobject(resultDataMap, new String[]{"useRegistrationFormFile"});
return resultDataMap;
}
@Override
public boolean beforeCheck(JgOverDesignServiceLife overDesignServiceLife) {
return overDesignServiceLife.getInstanceId() != null && !overDesignServiceLife.getStatus().equals(FlowStatusEnum.TO_BE_FINISHED.getName()) &&!overDesignServiceLife.getStatus().equals(FlowStatusEnum.TO_BE_DISCARD.getName());
return overDesignServiceLife.getInstanceId() != null && !overDesignServiceLife.getStatus().equals(FlowStatusEnum.TO_BE_FINISHED.getName()) && !overDesignServiceLife.getStatus().equals(FlowStatusEnum.TO_BE_DISCARD.getName());
}
@Override
......
......@@ -321,7 +321,7 @@
"type": "120",
"pageType": "look",
"name": "超设计使用年限变更",
"url": "/mixuap?appId=1742358052905971713&id=1897575052807794690&roleIds={roleIds}&userId={userId}&pageType=look"
"url": "/mixuap?appId=1742358052905971713&id=1897575343384981506&roleIds={roleIds}&userId={userId}&pageType=look"
},
{
"type": "121",
......
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