Commit aa2d238e authored by suhuiguang's avatar suhuiguang

feat(jg): 设备业务履历

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