Commit aa2d238e authored by suhuiguang's avatar suhuiguang

feat(jg): 设备业务履历

1.设备创建、装置创建增加履历
parent 77fa2049
...@@ -61,7 +61,7 @@ public class IdxBizJqEquipmentRegisterController extends BaseController { ...@@ -61,7 +61,7 @@ public class IdxBizJqEquipmentRegisterController extends BaseController {
@RestEventTrigger(value = "operateLogRestEventHandler") @RestEventTrigger(value = "operateLogRestEventHandler")
@ApiOperation(httpMethod = "POST", value = "设备注册和更新信息", notes = "设备注册和更新信息") @ApiOperation(httpMethod = "POST", value = "设备注册和更新信息", notes = "设备注册和更新信息")
public ResponseModel<Object> submit(@RequestBody Map<String, Object> paramMap) { public ResponseModel<Object> submit(@RequestBody Map<String, Object> paramMap) {
return ResponseHelper.buildResponse(idxBizJgRegisterInfoService.equipmentRegisterSubmit(paramMap)); return ResponseHelper.buildResponse(idxBizJgRegisterInfoService.equipmentRegisterSubmit(paramMap, getSelectedOrgInfo().getCompany()));
} }
......
...@@ -2,6 +2,7 @@ package com.yeejoin.amos.boot.module.jg.biz.service; ...@@ -2,6 +2,7 @@ package com.yeejoin.amos.boot.module.jg.biz.service;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.biz.common.bo.CompanyBo;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams; import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.amos.feign.systemctl.model.DictionarieValueModel; import com.yeejoin.amos.feign.systemctl.model.DictionarieValueModel;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
...@@ -18,7 +19,7 @@ import java.util.Map; ...@@ -18,7 +19,7 @@ import java.util.Map;
*/ */
public interface IIdxBizJgRegisterInfoService { public interface IIdxBizJgRegisterInfoService {
ResponseModel equipmentRegisterSubmit(Map<String, Object> paramMap); ResponseModel equipmentRegisterSubmit(Map<String, Object> paramMap, CompanyBo company);
boolean batchDeleteByRecord(Map<String,Object> map); boolean batchDeleteByRecord(Map<String,Object> map);
......
...@@ -336,6 +336,12 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste ...@@ -336,6 +336,12 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
@Value("classpath:/json/urlInfo.json") @Value("classpath:/json/urlInfo.json")
private Resource urlInfo; private Resource urlInfo;
@Value("${equip.detail.path:/mixuap?appId=1742358052905971713&id=1734100233714954241&formType=detail&record=%s&DATA_SOURCE=%s}")
private String equipRoutePath;
@Value("${pipeline.detail.path:/mixuap?appId=1742358052905971713&id=1867406434120003586&formType=detail&sequenceNbr=%s}")
private String pipelineRoutePath;
@Lazy @Lazy
@Autowired @Autowired
private CommonServiceImpl commonServiceImpl; private CommonServiceImpl commonServiceImpl;
...@@ -442,10 +448,11 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste ...@@ -442,10 +448,11 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
* 设备注册信息 * 设备注册信息
* *
* @param paramMap * @param paramMap
* @param company
* @return * @return
*/ */
@Transactional @Transactional
public ResponseModel equipmentRegisterSubmit(Map<String, Object> paramMap) { public ResponseModel equipmentRegisterSubmit(Map<String, Object> paramMap, CompanyBo company) {
if (paramMap == null) { if (paramMap == null) {
throw new IllegalArgumentException("参数Map不能为空"); throw new IllegalArgumentException("参数Map不能为空");
} }
...@@ -454,18 +461,18 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste ...@@ -454,18 +461,18 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
String equListCode = (String) equipmentInfoForm.get(EQU_LIST); String equListCode = (String) equipmentInfoForm.get(EQU_LIST);
//管道添加设备 //管道添加设备
if (PipelineEnum.PRESSURE_PIPELINE.getCode().equals(equListCode)) { if (PipelineEnum.PRESSURE_PIPELINE.getCode().equals(equListCode)) {
ResponseModel responseModel = this.pipelineEquipCreateOrUpdate(paramMap); ResponseModel responseModel = this.pipelineEquipCreateOrUpdate(paramMap, company);
Long projectContraptionId = (Long)responseModel.getResult(); Long projectContraptionId = (Long)responseModel.getResult();
eventPublisher.publish(new EquipCreateOrEditEvent(this, BusinessTypeEnum.JG_NEW_PROJECT.name(), Sets.newHashSet(projectContraptionId.toString()), EquipCreateOrEditEvent.EquipType.project)); eventPublisher.publish(new EquipCreateOrEditEvent(this, BusinessTypeEnum.JG_NEW_PROJECT.name(), Sets.newHashSet(projectContraptionId.toString()), EquipCreateOrEditEvent.EquipType.project));
return responseModel; return responseModel;
} }
if(dataSource.contains("black")){ if(dataSource.contains("black")){
ResponseModel responseModel = this.blackEquipCreateOrUpdate(paramMap); ResponseModel responseModel = this.blackEquipCreateOrUpdate(paramMap, company);
String record = (String)responseModel.getResult(); String record = (String)responseModel.getResult();
eventPublisher.publish(new EquipCreateOrEditEvent(this, BusinessTypeEnum.JG_NEW_EQUIP.name(), Sets.newHashSet(record), EquipCreateOrEditEvent.EquipType.equip)); eventPublisher.publish(new EquipCreateOrEditEvent(this, BusinessTypeEnum.JG_NEW_EQUIP.name(), Sets.newHashSet(record), EquipCreateOrEditEvent.EquipType.equip));
return responseModel; return responseModel;
} else { } else {
ResponseModel responseModel = this.otherEquipCreateOrUpdate(paramMap); ResponseModel responseModel = this.otherEquipCreateOrUpdate(paramMap, company);
String record = (String)responseModel.getResult(); String record = (String)responseModel.getResult();
eventPublisher.publish(new EquipCreateOrEditEvent(this, BusinessTypeEnum.JG_NEW_EQUIP.name(), Sets.newHashSet(record), EquipCreateOrEditEvent.EquipType.equip)); eventPublisher.publish(new EquipCreateOrEditEvent(this, BusinessTypeEnum.JG_NEW_EQUIP.name(), Sets.newHashSet(record), EquipCreateOrEditEvent.EquipType.equip));
return responseModel; return responseModel;
...@@ -477,14 +484,15 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste ...@@ -477,14 +484,15 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
* 管道设备新增或更新 * 管道设备新增或更新
* *
* @param paramMap 前端参数 * @param paramMap 前端参数
* @param company
* @return record * @return record
*/ */
private ResponseModel pipelineEquipCreateOrUpdate(Map<String, Object> paramMap) { private ResponseModel pipelineEquipCreateOrUpdate(Map<String, Object> paramMap, CompanyBo company) {
try { try {
// 获取表单数据并进行类型检查 // 获取表单数据并进行类型检查
LinkedHashMap equipmentInfoForm = castToLinkedHashMap(paramMap.get(EQUIP_INFO_FORM_ID)); LinkedHashMap equipmentInfoForm = castToLinkedHashMap(paramMap.get(EQUIP_INFO_FORM_ID));
String submitType = String.valueOf(paramMap.get("submitType")); String submitType = String.valueOf(paramMap.get("submitType"));
return ResponseHelper.buildResponse(batchSubmitOrUpdatePipeline(equipmentInfoForm, submitType)); return ResponseHelper.buildResponse(batchSubmitOrUpdatePipeline(equipmentInfoForm, submitType, company));
} catch (Exception e) { } catch (Exception e) {
log.error("操作失败,数据异常: {}", e.getMessage(), e); log.error("操作失败,数据异常: {}", e.getMessage(), e);
handleError(e, String.valueOf(paramMap.getOrDefault(SEQUENCE_NBR, ""))); handleError(e, String.valueOf(paramMap.getOrDefault(SEQUENCE_NBR, "")));
...@@ -512,7 +520,7 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste ...@@ -512,7 +520,7 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
return new ArrayList<>(15); return new ArrayList<>(15);
} }
private Long batchSubmitOrUpdatePipeline(LinkedHashMap equipmentInfoForm, String submitType) { private Long batchSubmitOrUpdatePipeline(LinkedHashMap equipmentInfoForm, String submitType, CompanyBo company) {
Date date = new Date(); Date date = new Date();
String operateType = ValidationUtil.isEmpty(equipmentInfoForm.get(SEQUENCE_NBR)) ? OPERATESAVE : OPERATEEDIT; String operateType = ValidationUtil.isEmpty(equipmentInfoForm.get(SEQUENCE_NBR)) ? OPERATESAVE : OPERATEEDIT;
// 设备是否复制而来,复制来的设备走新增 // 设备是否复制而来,复制来的设备走新增
...@@ -821,15 +829,33 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste ...@@ -821,15 +829,33 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
iIdxBizJgDesignInfoService.saveOrUpdateBatch(designInfoList); iIdxBizJgDesignInfoService.saveOrUpdateBatch(designInfoList);
iIdxBizJgConstructionInfoService.saveOrUpdateBatch(constructionInfoList); iIdxBizJgConstructionInfoService.saveOrUpdateBatch(constructionInfoList);
iIdxBizJgFactoryInfoService.saveOrUpdateBatch(factoryInfoList); iIdxBizJgFactoryInfoService.saveOrUpdateBatch(factoryInfoList);
this.saveOrUpdateBatch(registerInfoList); super.saveOrUpdateBatch(registerInfoList);
iIdxBizJgOtherInfoService.saveOrUpdateBatch(otherInfoList); iIdxBizJgOtherInfoService.saveOrUpdateBatch(otherInfoList);
iIdxBizJgSupervisionInfoService.saveOrUpdateBatch(supervisionInfoList); iIdxBizJgSupervisionInfoService.saveOrUpdateBatch(supervisionInfoList);
iIdxBizJgInspectionDetectionInfoService.saveOrUpdateBatch(inspectionDetectionInfoList); iIdxBizJgInspectionDetectionInfoService.saveOrUpdateBatch(inspectionDetectionInfoList);
iIdxBizJgTechParamsPipelineService.saveOrUpdateBatch(paramsPipelineList); iIdxBizJgTechParamsPipelineService.saveOrUpdateBatch(paramsPipelineList);
esEquipmentCategory.saveAll(esEquipmentCategoryList); esEquipmentCategory.saveAll(esEquipmentCategoryList);
if(OPERATESAVE.equals(operateType)){
// 记录设备创建履历
this.createResumePipeline(sequenceNbr, String.format(pipelineRoutePath, sequenceNbr + ""), company);
}
return sequenceNbr; return sequenceNbr;
} }
private void createResumePipeline(Long sequenceNbr, String routePath, CompanyBo company) {
jgResumeInfoService.saveBatchResume(Collections.singletonList(JgResumeInfoDto.builder()
.businessType(BusinessTypeEnum.JG_NEW_PROJECT.getName())
.businessId(sequenceNbr + "")
.equId(sequenceNbr + "")
.status("正常")
.approvalUnitCode(company.getCompanyCode())
.approvalUnit(company.getCompanyName())
.changeContent(BusinessTypeEnum.JG_NEW_PROJECT.getName() + "业务办理")
.routePath(routePath)
.build())
);
}
/** /**
* 根据code获取市区县名字 * 根据code获取市区县名字
* @param key key * @param key key
...@@ -847,7 +873,7 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste ...@@ -847,7 +873,7 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
.orElse(""); .orElse("");
} }
private ResponseModel blackEquipCreateOrUpdate(Map<String, Object> paramMap) { private ResponseModel blackEquipCreateOrUpdate(Map<String, Object> paramMap, CompanyBo company) {
LinkedHashMap equipmentClassForm = (LinkedHashMap) checkAndCast(paramMap.get(EQUIP_CLASS_FORM_ID)); LinkedHashMap equipmentClassForm = (LinkedHashMap) checkAndCast(paramMap.get(EQUIP_CLASS_FORM_ID));
LinkedHashMap equipmentInfoForm = (LinkedHashMap) checkAndCast(paramMap.get(EQUIP_INFO_FORM_ID)); LinkedHashMap equipmentInfoForm = (LinkedHashMap) checkAndCast(paramMap.get(EQUIP_INFO_FORM_ID));
LinkedHashMap equipmentParamsForm = (LinkedHashMap) checkAndCast(paramMap.get(EQUIP_PARAMS_FORM_ID)); LinkedHashMap equipmentParamsForm = (LinkedHashMap) checkAndCast(paramMap.get(EQUIP_PARAMS_FORM_ID));
...@@ -866,7 +892,7 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste ...@@ -866,7 +892,7 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
// 操作类型 // 操作类型
try { try {
// 保存数据 // 保存数据
record = batchSubmitOrUpdate(equipmentClassForm, equipmentInfoForm, equipmentParamsForm, submitType); record = batchSubmitOrUpdate(equipmentClassForm, equipmentInfoForm, equipmentParamsForm, submitType, company);
// 保存Es数据 // 保存Es数据
if (!ObjectUtils.isEmpty(record)) { if (!ObjectUtils.isEmpty(record)) {
checkEsData(record); checkEsData(record);
...@@ -878,7 +904,7 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste ...@@ -878,7 +904,7 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
return ResponseHelper.buildResponse(record); return ResponseHelper.buildResponse(record);
} }
private ResponseModel otherEquipCreateOrUpdate(Map<String, Object> paramMap) { private ResponseModel otherEquipCreateOrUpdate(Map<String, Object> paramMap, CompanyBo company) {
if (paramMap == null) { if (paramMap == null) {
throw new IllegalArgumentException("参数Map不能为空"); throw new IllegalArgumentException("参数Map不能为空");
} }
...@@ -922,7 +948,7 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste ...@@ -922,7 +948,7 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
// 操作类型 // 操作类型
try { try {
// 保存数据 // 保存数据
record = batchSubmitOrUpdate(equipmentClassForm, equipmentInfoForm, equipmentParamsForm, submitType); record = batchSubmitOrUpdate(equipmentClassForm, equipmentInfoForm, equipmentParamsForm, submitType, company);
// 保存Es数据 // 保存Es数据
if (!ObjectUtils.isEmpty(record)) { if (!ObjectUtils.isEmpty(record)) {
checkEsData(record); checkEsData(record);
...@@ -3446,7 +3472,7 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste ...@@ -3446,7 +3472,7 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
return ""; return "";
} }
private String batchSubmitOrUpdate(LinkedHashMap equipmentClassForm, LinkedHashMap equipmentInfoForm, LinkedHashMap equipmentParamsForm, String submitType) { private String batchSubmitOrUpdate(LinkedHashMap equipmentClassForm, LinkedHashMap equipmentInfoForm, LinkedHashMap equipmentParamsForm, String submitType, CompanyBo company) {
Date date = new Date(); Date date = new Date();
String record = null; String record = null;
...@@ -3669,9 +3695,27 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste ...@@ -3669,9 +3695,27 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
iIdxBizJgOtherInfoService.saveOrUpdateData(otherInfo); iIdxBizJgOtherInfoService.saveOrUpdateData(otherInfo);
// 保存或者更新设备技术参数 // 保存或者更新设备技术参数
this.saveOrUpdateEquParams(equipmentInfoForm, equipmentParamsForm, equList, record, date, operateType); this.saveOrUpdateEquParams(equipmentInfoForm, equipmentParamsForm, equList, record, date, operateType);
if(OPERATESAVE.equals(operateType)){
// 记录设备创建履历
this.createResume(record, String.format(equipRoutePath, record, useInfo.getDataSource()), company);
}
return record; return record;
} }
private void createResume(String record, String routePath, CompanyBo company) {
jgResumeInfoService.saveBatchResume(Collections.singletonList(JgResumeInfoDto.builder()
.businessType(BusinessTypeEnum.JG_NEW_EQUIP.getName())
.businessId(record)
.equId(record)
.status("正常")
.approvalUnitCode(company.getCompanyCode())
.approvalUnit(company.getCompanyName())
.changeContent(BusinessTypeEnum.JG_NEW_EQUIP.getName() + "业务办理")
.routePath(routePath)
.build())
);
}
/** /**
* 保存或者更新设备技术参数 * 保存或者更新设备技术参数
* @param equipmentInfoForm * @param equipmentInfoForm
......
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