Commit 551458ea authored by tianbo's avatar tianbo

feat(mapper): 重构添加装置时更新es时机

- 优化DataDockServiceImpl中的设备状态处理逻辑 - 重构数据同步方法saveEquInfoToEs的调用时机 - 统一数据源中的时间戳更新为相同值 - 调整IdxBizJgUseInfoMapper.xml中的字段查询顺序和结构
parent 894f98fe
......@@ -862,7 +862,9 @@ public class DataDockServiceImpl {
equipmentCategoryDto.setSTATUS("已认领");
equipmentCategoryDto.setIS_DO_BUSINESS(Boolean.TRUE);
equipmentCategoryDto.setIS_COMPLETE_XA(Objects.equals("0", isCompleteXa));
equipmentCategoryDto.setProblemStatus(SafetyProblemStatusEnum.HANDLED.getCode());
if (ValidationUtil.isEmpty(equipmentCategoryDto.getProblemStatus())) {
equipmentCategoryDto.setProblemStatus(SafetyProblemStatusEnum.HANDLED.getCode());
}
esEquipmentCategory.save(equipmentCategoryDto);
}
}
......@@ -2890,7 +2892,6 @@ public class DataDockServiceImpl {
IdxBizJgOtherInfo otherInfo = this.saveOtherInfo(equ, record, equList);
this.saveInspectInfo(equ, record);
this.saveTechParams(equ, record, equList);
this.saveEquInfoToEs(record, isCompleteXa);
this.saveInstallInfo(equ);//安装信息
this.historyEquUpdateMaintenanceInfo(equ);//维保信息
......@@ -2907,6 +2908,7 @@ public class DataDockServiceImpl {
this.updateUseManagementStatus(useInfo);
this.saveNewEquipResumeInfo(useInfo);
}
this.saveEquInfoToEs(record, isCompleteXa);
} else if (!businessId.isEmpty()) {
this.saveResumeInfo(equ);
equ.put("record", equ.get("resumeSeq"));
......@@ -2990,7 +2992,7 @@ public class DataDockServiceImpl {
jgUseRegistrationServiceImpl.saveOrUpdate(jgUseRegistration);
// 更新设备es(jg-all)信息
this.updateEsData2(equ, otherInfo);
// this.updateEsData2(equ, otherInfo);
// 更新登记证信息
this.updateRegistrationManagementInfo(equ, oldUseRegistrationCode);
......@@ -3279,7 +3281,7 @@ public class DataDockServiceImpl {
map.put("equCode", equCode);
// 更新es
this.updateEsData2(map, otherInfo);
// this.updateEsData2(map, otherInfo);
jgUseRegistrationServiceImpl.save(jgUseRegistration);
jgRelationEquip.setEquipTransferId(jgUseRegistration.getSequenceNbr() + "");
jgRelationEquipMapper.insert(jgRelationEquip);
......
......@@ -34,7 +34,6 @@ import com.yeejoin.amos.boot.module.common.api.dto.ESEquipmentCategoryDto;
import com.yeejoin.amos.boot.module.common.api.entity.ESEquipmentInfo;
import com.yeejoin.amos.boot.module.common.api.enums.CylinderTypeEnum;
import com.yeejoin.amos.boot.module.common.api.mapper.CustomBaseMapper;
import com.yeejoin.amos.boot.module.common.biz.refresh.DataRefreshEvent;
import com.yeejoin.amos.boot.module.common.biz.service.impl.EquipmentCategoryService;
import com.yeejoin.amos.boot.module.jg.api.common.DataDockTemplateVersionUtils;
import com.yeejoin.amos.boot.module.jg.api.dto.*;
......@@ -56,7 +55,6 @@ import com.yeejoin.amos.boot.module.ymt.api.dto.TzsUserInfoDto;
import com.yeejoin.amos.boot.module.ymt.api.entity.*;
import com.yeejoin.amos.boot.module.ymt.api.enums.*;
import com.yeejoin.amos.boot.module.ymt.api.mapper.*;
import com.yeejoin.amos.component.feign.config.InnerInvokException;
import com.yeejoin.amos.component.feign.model.FeignClientResult;
import com.yeejoin.amos.component.feign.utils.FeignUtil;
import com.yeejoin.amos.feign.systemctl.Systemctl;
......@@ -88,8 +86,6 @@ import org.springframework.http.HttpStatus;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.transaction.support.TransactionSynchronization;
import org.springframework.transaction.support.TransactionSynchronizationManager;
import org.springframework.util.ObjectUtils;
import org.springframework.web.multipart.MultipartFile;
import org.typroject.tyboot.core.foundation.context.RequestContext;
......@@ -122,7 +118,8 @@ import static com.yeejoin.amos.boot.module.common.api.enums.CylinderTypeEnum.SPE
import static com.yeejoin.amos.boot.module.jg.api.enums.CertificateStatusEnum.YIDENGJI;
import static com.yeejoin.amos.boot.module.jg.api.enums.VehicleApanageEnum.XIAN_YANG;
import static com.yeejoin.amos.boot.module.jg.api.enums.VehicleApanageEnum.XI_XIAN;
import static com.yeejoin.amos.boot.module.jg.biz.service.impl.DataHandlerServiceImpl.*;
import static com.yeejoin.amos.boot.module.jg.biz.service.impl.DataHandlerServiceImpl.IDX_BIZ_EQUIPMENT_INFO;
import static com.yeejoin.amos.boot.module.jg.biz.service.impl.DataHandlerServiceImpl.IDX_BIZ_VIEW_JG_ALL;
/**
......@@ -818,7 +815,8 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
if (inspectionDetectionInfo.getNextInspectDate() != null) {
esEquipmentDto.setNEXT_INSPECT_DATE(inspectionDetectionInfo.getNextInspectDate().getTime());
}
esEquipmentDto.setREC_DATE(System.currentTimeMillis());
esEquipmentDto.setCREATE_DATE(date.getTime());
esEquipmentDto.setREC_DATE(date.getTime());
esEquipmentDto.setSEQUENCE_NBR(record);
esEquipmentDto.setIS_INTO_MANAGEMENT(dataSource.contains("jg_his_black") && managedCategories.contains(equipmentInfoForm.get("EQU_CATEGORY")));
esEquipmentDto.setEQU_CATEGORY_CODE(registerInfo.getEquCategory());
......@@ -826,7 +824,7 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
esEquipmentDto.setEQU_LIST_CODE(registerInfo.getEquList());
esEquipmentDto.setEQU_LIST(equListName);
esEquipmentDto.setEQU_DEFINE_CODE(registerInfo.getEquDefine());
esEquipmentDto.setEQU_DEFINE(equListName);
esEquipmentDto.setEQU_DEFINE(equDefineName);
esEquipmentDto.setSTATUS("已认领");
esEquipmentDto.setUSC_UNIT_CREDIT_CODE(projectContraption.getUscUnitCreditCode());
esEquipmentDto.setUSC_UNIT_NAME(projectContraption.getUscUnitName());
......@@ -835,9 +833,6 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
esEquipmentDto.setPROJECT_CONTRAPTION(projectContraption.getProjectContraption());
esEquipmentDto.setPRODUCT_NAME(pipelineInfo.getPipeName());
esEquipmentDto.setProjectContraptionId(String.valueOf(sequenceNbr));
if (inspectionDetectionInfo.getNextInspectDate() != null) {
esEquipmentDto.setNEXT_INSPECT_DATE(inspectionDetectionInfo.getNextInspectDate().getTime());
}
esEquipmentCategoryList.add(esEquipmentDto);
}
idxBizJgUseInfoService.saveOrUpdateBatch(useInfoList);
......@@ -849,13 +844,14 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
iIdxBizJgSupervisionInfoService.saveOrUpdateBatch(supervisionInfoList);
iIdxBizJgInspectionDetectionInfoService.saveOrUpdateBatch(inspectionDetectionInfoList);
iIdxBizJgTechParamsPipelineService.saveOrUpdateBatch(paramsPipelineList);
esEquipmentCategory.saveAll(esEquipmentCategoryList);
// 更新管道长度
updatePipelineLength(projectContraption, paramsPipelineList);
if(OPERATESAVE.equals(operateType)){
// 记录设备创建履历
this.createResumePipeline(sequenceNbr, String.format(pipelineRoutePath, sequenceNbr + ""), company);
}
// 最后更新es
esEquipmentCategory.saveAll(esEquipmentCategoryList);
return sequenceNbr;
}
......@@ -4511,8 +4507,9 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
IdxBizJgUseInfo useInfo = new IdxBizJgUseInfo();
BeanUtils.copyProperties(data, useInfo);
useInfo.setRecord(record);
useInfo.setRecDate(new Date());
useInfo.setCreateDate(new Date());
Date now = new Date();
useInfo.setRecDate(now);
useInfo.setCreateDate(now);
String source = equipInfoDto.getDataSource();
useInfo.setDataSource("his".equals(source) ? "jg_his_pl" : "black".equals(source) ? "jg_his_black_pl" : "jg_pl");// 区分历史设备和新增设备
useInfo.setIsIntoManagement("his".equals(equipInfoDto.getDataSource()));// 历史气瓶导入为已纳管设备
......@@ -4539,7 +4536,7 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
IdxBizJgDesignInfo designInfo = new IdxBizJgDesignInfo();
BeanUtils.copyProperties(data, designInfo);
designInfo.setRecord(record);
designInfo.setRecDate(new Date());
designInfo.setRecDate(now);
if (data.getDesignDate() != null) {
designInfo.setDesignDate(DateUtil.parse(data.getDesignDate(), "yyyy-MM-dd"));
}
......@@ -4553,7 +4550,7 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
IdxBizJgFactoryInfo factoryInfo = new IdxBizJgFactoryInfo();
BeanUtils.copyProperties(data, factoryInfo);
factoryInfo.setRecord(record);
factoryInfo.setRecDate(new Date());
factoryInfo.setRecDate(now);
factoryInfo.setProductQualityYieldProve(productQualityYieldProve);
factoryInfo.setFactoryStandard(factoryStandard);
factoryInfo.setInsUseMaintainExplain(insUseMaintainExplain);
......@@ -4572,7 +4569,7 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
BeanUtils.copyProperties(data, registerInfo);
registerInfo.setEquCode("2".equals(data.getEquCodeType()) ? "" : registerInfo.getEquCode());
registerInfo.setRecord(record);
registerInfo.setRecDate(new Date());
registerInfo.setRecDate(now);
registerInfo.setEquCategory(equipInfoDto.getEquCategoryCode());
registerInfo.setEquDefine(equipInfoDto.getEquDefineCode());
registerInfo.setEquList(equipInfoDto.getEquListCode());
......@@ -4593,7 +4590,7 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
BeanUtils.copyProperties(data, inspectionDetectionInfo);
inspectionDetectionInfo.setInspectOrgCode(data.getInspectOrgCode());
inspectionDetectionInfo.setRecord(record);
inspectionDetectionInfo.setRecDate(new Date());
inspectionDetectionInfo.setRecDate(now);
inspectionDetectionInfo.setInspectType("ZZJDJY");
inspectionDetectionInfo.setInspectConclusion("6040");// 默认合格
Optional.ofNullable(data.getInspectDate())
......@@ -4622,7 +4619,7 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
IdxBizJgOtherInfo otherInfo = new IdxBizJgOtherInfo();
BeanUtils.copyProperties(data, otherInfo);
otherInfo.setRecord(record);
otherInfo.setRecDate(new Date());
otherInfo.setRecDate(now);
otherInfo.setCylinderStampAttachment(cylinderStampAttachment);
if ("his".equals(equipInfoDto.getDataSource())) {
otherInfo.setSupervisoryCode(supervisoryCodeIterator.next());
......@@ -4637,7 +4634,7 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
IdxBizJgTechParamsVessel paramsVessel = new IdxBizJgTechParamsVessel();
BeanUtils.copyProperties(data, paramsVessel);
paramsVessel.setRecord(record);
paramsVessel.setRecDate(new Date());
paramsVessel.setRecDate(now);
paramsVessel.setChargingMedium((String) fillingMediumMap.get(data.getChargingMedium()));
paramsVesselList.add(paramsVessel);
......@@ -4646,8 +4643,8 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
if (inspectionDetectionInfo.getNextInspectDate() != null) {
esEquipmentDto.setNEXT_INSPECT_DATE(inspectionDetectionInfo.getNextInspectDate().getTime());
}
esEquipmentDto.setCREATE_DATE(System.currentTimeMillis());
esEquipmentDto.setREC_DATE(System.currentTimeMillis());
esEquipmentDto.setCREATE_DATE(now.getTime());
esEquipmentDto.setREC_DATE(now.getTime());
esEquipmentDto.setSEQUENCE_NBR(record);
esEquipmentDto.setFACTORY_NUM(factoryInfo.getFactoryNum());
esEquipmentDto.setUSE_INNER_CODE(useInfo.getUseInnerCode());
......
......@@ -74,48 +74,49 @@
WHERE ibjoi."RECORD" = #{record}
</select>
<select id="selectDataById" resultType="java.util.Map">
SELECT SEQUENCE_NBR,
REC_DATE,
CREATE_DATE,
DATA_QUALITY_SCORE,
ORG_BRANCH_NAME,
ORG_BRANCH_CODE,
USE_UNIT_NAME,
USE_UNIT_CREDIT_CODE,
EQU_LIST_CODE,
EQU_LIST,
EQU_CATEGORY,
EQU_CATEGORY_CODE,
USE_ORG_CODE,
CODE96333,
EQU_CODE,
SUPERVISORY_CODE,
USE_PLACE,
ADDRESS,
EQU_STATE,
STATUS,
USE_INNER_CODE,
FACTORY_NUM,
PRODUCE_UNIT_NAME,
INSPECT_REPORT,
NEXT_INSPECT_DATE,
CONSTRUCTION_TYPE,
USC_UNIT_CREDIT_CODE,
USC_UNIT_NAME,
EQU_DEFINE,
EQU_DEFINE_CODE,
PRODUCT_NAME,
BRAND_NAME,
EQU_TYPE,
DATA_SOURCE,
IS_INTO_MANAGEMENT,
WHETHER_VEHICLE_CYLINDER,
WHETHER_SKID_MOUNTED_PRESSURE_VESSEL,
DATE_FORMAT(PRODUCE_DATE, '%Y-%m-%d %H:%i:%s') as PRODUCE_DATE,
PROJECT_CONTRAPTION,
TAG1
SELECT "SEQUENCE_NBR",
"REC_DATE",
"CREATE_DATE",
"DATA_QUALITY_SCORE",
"ORG_BRANCH_NAME",
"ORG_BRANCH_CODE",
"USE_UNIT_NAME",
"USE_UNIT_CREDIT_CODE",
"EQU_LIST_CODE",
"EQU_LIST",
"EQU_CATEGORY",
"EQU_CATEGORY_CODE",
"USE_ORG_CODE",
"CODE96333",
"EQU_CODE",
"SUPERVISORY_CODE",
"USE_PLACE",
"ADDRESS",
"EQU_STATE",
"STATUS",
"USE_INNER_CODE",
"FACTORY_NUM",
"PRODUCE_UNIT_NAME",
"INSPECT_REPORT",
"NEXT_INSPECT_DATE",
"CONSTRUCTION_TYPE",
"USC_UNIT_CREDIT_CODE",
"USC_UNIT_NAME",
"EQU_DEFINE",
"EQU_DEFINE_CODE",
"PRODUCT_NAME",
"BRAND_NAME",
"EQU_TYPE",
"DATA_SOURCE",
"IS_INTO_MANAGEMENT",
"WHETHER_VEHICLE_CYLINDER",
"WHETHER_SKID_MOUNTED_PRESSURE_VESSEL",
DATE_FORMAT("PRODUCE_DATE", '%Y-%m-%d %H:%i:%s') as PRODUCE_DATE,
"PROJECT_CONTRAPTION",
TAG1,
"problemStatus"
from idx_biz_view_jg_all
WHERE SEQUENCE_NBR = #{id}
WHERE "SEQUENCE_NBR" = #{id}
</select>
<select id="queryInitCode" resultType="com.yeejoin.amos.boot.module.ymt.api.entity.CategoryOtherInfo">
SELECT CODE96333 code
......
......@@ -137,53 +137,56 @@
ibjui."RECORD" AS "SEQUENCE_NBR",
ibjui."PROJECT_CONTRAPTION",
ibjui."PROJECT_CONTRAPTION_ID",
ibjsi."ORG_BRANCH_NAME",
ibjsi."ORG_BRANCH_CODE",
ibjui."REC_DATE",
ibjui."USE_UNIT_NAME",
ibjui."USE_UNIT_CREDIT_CODE",
ibjri."EQU_LIST" AS "EQU_LIST_CODE",
ibjri."EQU_DEFINE" AS "EQU_DEFINE_CODE",
ibjri."PRODUCT_NAME",
ibjri."BRAND_NAME",
ibjri."EQU_TYPE",
ibjri."EQU_CATEGORY" AS "EQU_CATEGORY_CODE",
tec2.NAME AS "EQU_DEFINE",
tec1.NAME AS "EQU_LIST",
tec.NAME AS "EQU_CATEGORY",
ibjri."USE_ORG_CODE",
ibjui."USE_INNER_CODE",
ibjui."DATA_SOURCE",
ibjoi."CODE96333",
ibjui."CREATE_DATE" ,
ibjui."SAFETY_MANAGER" ,
ibjui."PHONE",
ibjui."USE_DATE",
ibjui."USE_PLACE" as USE_SITE_CODE,
ibjui."DATA_QUALITY_SCORE",
ibjui."IS_NOT_ES",
concat_ws ( '/', ibjui."PROVINCE_NAME", ibjui."CITY_NAME", ibjui."COUNTY_NAME", ibjui."STREET_NAME" ) AS "USE_PLACE",
concat_ws ( '#', ibjui."PROVINCE", ibjui."CITY", ibjui."COUNTY", ibjui."FACTORY_USE_SITE_STREET" ) AS "USE_PLACE_CODE",
ibjui."ADDRESS",
ibjui."EQU_STATE",
ibjui."IS_INTO_MANAGEMENT",
ibjri."EQU_CODE",
ibjoi."SUPERVISORY_CODE",
ibjri."WHETHER_VEHICLE_CYLINDER",
ibjri."WHETHER_SKID_MOUNTED_PRESSURE_VESSEL",
ibjri."CYLINDER_CATEGORY",
ibjri."WHETHER_SPHERICAL_TANK",
ibjri."CAR_NUMBER",
ibjri."EQU_PRICE",
concat_ws ( '/', ibjui."PROVINCE_NAME", ibjui."CITY_NAME", ibjui."COUNTY_NAME", ibjui."STREET_NAME" ) AS "USE_PLACE",
concat_ws ( '#', ibjui."PROVINCE", ibjui."CITY", ibjui."COUNTY", ibjui."FACTORY_USE_SITE_STREET" ) AS "USE_PLACE_CODE",
ibjui."ADDRESS",
ibjui."EQU_STATE",
ibjui."IS_INTO_MANAGEMENT",
ibjoi."CLAIM_STATUS" AS "STATUS",
ibjoi."STATUS" AS problemStatus,
ibjri."EQU_LIST" AS "EQU_LIST_CODE",
ibjri."EQU_DEFINE" AS "EQU_DEFINE_CODE",
ibjri."PRODUCT_NAME",
ibjri."BRAND_NAME",
ibjri."EQU_TYPE",
ibjri."EQU_CATEGORY" AS "EQU_CATEGORY_CODE",
ibjri."TAG1" AS tag1,
ibjri."USE_ORG_CODE",
ibjsi."ORG_BRANCH_NAME",
ibjsi."ORG_BRANCH_CODE",
ibjfi."FACTORY_NUM",
ibjfi."PRODUCE_UNIT_NAME",
ibjfi."PRODUCE_UNIT_CREDIT_CODE",
ibjfi."PRODUCE_DATE",
ibjui."CREATE_DATE" ,
ibjui."SAFETY_MANAGER" ,
ibjui."PHONE",
ibjui."USE_DATE",
ibjui."USE_PLACE" as USE_SITE_CODE,
ibjui."DATA_QUALITY_SCORE",
ibjoi."CODE96333",
ibjoi."SUPERVISORY_CODE",
ibjoi."CLAIM_STATUS" AS "STATUS",
ibjoi."STATUS" AS problemStatus,
ibjoi."INFORMATION_SITUATION",
ibjoi."EDIT_STATUS",
di."DESIGN_UNIT_CREDIT_CODE",
di."DESIGN_UNIT_NAME",
di."DESIGN_DATE",
tec2.NAME AS "EQU_DEFINE",
tec1.NAME AS "EQU_LIST",
tec.NAME AS "EQU_CATEGORY",
construction_info."USC_UNIT_CREDIT_CODE",
construction_info."USC_UNIT_NAME",
construction_info."CONSTRUCTION_TYPE",
......
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