Commit 4c17a1dd authored by hezhuozhi's avatar hezhuozhi

Merge remote-tracking branch 'origin/develop_tzs_register' into develop_tzs_register

parents cccf428d 331540b7
......@@ -15,12 +15,10 @@ import com.yeejoin.amos.api.openapi.util.MultiFieldKey;
import org.apache.commons.compress.utils.Lists;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
import org.typroject.tyboot.core.foundation.utils.Bean;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
import java.util.stream.Collectors;
......@@ -45,7 +43,6 @@ public class TmCylinderFillingExamineService extends MyBaseServiceImpl<TmCylinde
private EventPublisher eventPublisher;
@DSTransactional
@Transactional(rollbackFor = Exception.class)
public String createCylinderFillingExamine(List<TmCylinderFillingExamineModel> model) {
if (ValidationUtil.isEmpty(model))
throw new BadRequest("液化气体气瓶充装信息审核为空.");
......@@ -87,11 +84,14 @@ public class TmCylinderFillingExamineService extends MyBaseServiceImpl<TmCylinde
if (!ValidationUtil.isEmpty(oldList)) {
List<String> fileUrlList = Lists.newArrayList();
oldList.forEach(old -> {
if (old.getFillingAuditUrl() != null) {
fileUrlList.addAll(Arrays.asList(ValidationUtil.isEmpty(old.getFillingAuditUrl()) ? new String[0] : old.getFillingAuditUrl().split(",")));
if (!ValidationUtil.isEmpty(old.getFillingAuditUrl())) {
fileUrlList.add(old.getFillingAuditUrl());
}
});
eventPublisher.publish(new FileToBeDeleteEvent(this, FileDeleteUtil.extractFileNames(fileUrlList)));
List<String> fileNameList = FileDeleteUtil.extractFileNames(fileUrlList);
if (!ValidationUtil.isEmpty(fileNameList)) {
eventPublisher.publish(new FileToBeDeleteEvent(this, fileNameList));
}
}
}
......
......@@ -32,6 +32,11 @@ public class FileDeleteUtil {
List<String> fileUrls = Lists.newArrayList();
if (!ValidationUtil.isEmpty(jsonStr)) {
try {
log.debug("jsonStr:{}", jsonStr);
if (!JSONObject.isValid(jsonStr)) {
fileUrls.add(jsonStr);
return fileUrls;
}
Object json = JSONObject.parse(jsonStr);
if (json instanceof JSONArray) {
JSONArray jsonArray = JSONObject.parseArray(jsonStr);
......@@ -57,7 +62,7 @@ public class FileDeleteUtil {
}
return fileUrls;
} catch (Exception e) {
log.info("Error parsing JSON: {}", jsonStr);
log.error("Error parsing JSON: {}", jsonStr);
System.err.println("Error parsing JSON: " + e.getMessage());
}
}
......
......@@ -51,7 +51,7 @@ public interface JgScrapCancelMapper extends BaseMapper<JgScrapCancel> {
List<EquipBizCountDto> queryScrappedDeviceStaticListData(DPFilterParamDto dpFilterParamDto);
Integer getScrappedDeviceCount(@Param("dpFilterParamDto") DPFilterParamDto dpFilterParamDto);
List<Map<String, Object>> getScrappedDeviceCount(@Param("dpFilterParamDto") DPFilterParamDto dpFilterParamDto);
List<CompanyEquipCountDto> queryForFlowingEquipList();
}
......@@ -90,7 +90,7 @@ public interface JgUseRegistrationMapper extends BaseMapper<JgUseRegistration> {
List<EquipBizCountDto> queryNewDeviceStaticListData(DPFilterParamDto dpFilterParamDto);
Integer getUseRegisterCount(@Param("dpFilterParamDto") DPFilterParamDto dpFilterParamDto);
List<Map<String,Object>> getUseRegisterCount(@Param("orgCode")String orgCode);
List<Map<String, Object>> getElevatorModeList(@Param("equIds") List<String> equIds);
......
......@@ -272,14 +272,12 @@
c.equ_category,
c.equ_define
</select>
<select id="getScrappedDeviceCount" resultType="java.lang.Integer">
<select id="getScrappedDeviceCount" resultType="java.util.Map">
select
count(1) as num
count(1) as num,c.time
from
(SELECT
ri.equ_list,
ri.equ_category,
ri.equ_define,
date_format(A.audit_pass_date , '%Y-%m') as time,
concat(u.PROVINCE,'#', u.CITY,'#', u.COUNTY) as areaCode
FROM
"tzs_jg_scrap_cancel_eq" ae,
......@@ -291,14 +289,13 @@
AND ri.EQU_CATEGORY = '2300'
and ae.equ_id = u."RECORD"
and u."RECORD" = ri."RECORD"
and (a.audit_pass_date between #{dpFilterParamDto.beginDate} and #{dpFilterParamDto.endDate})
and a.cancel_type ='1'
and a.audit_status='已完成'
) c
where
c.areaCode like concat('%',#{dpFilterParamDto.cityCode}, '%')
group by
c.equ_category
c.time
</select>
<select id="queryForFlowingEquipList" resultType="com.yeejoin.amos.boot.module.jg.api.dto.CompanyEquipCountDto">
......
......@@ -931,16 +931,12 @@
c.equ_category,
c.equ_define
</select>
<select id="getUseRegisterCount" resultType="java.lang.Integer">
SELECT COUNT(1) AS num
<select id="getUseRegisterCount" resultType="java.util.Map">
SELECT COUNT(1) AS num,C.time
FROM
(
SELECT
ri.equ_list,
ri.equ_category,
ri.equ_define,
A.audit_pass_date,
concat ( u.PROVINCE, '#', u.CITY, '#', u.COUNTY ) AS areaCode
date_format(A.audit_pass_date , '%Y-%m') as time
FROM
"tzs_jg_use_registration_eq" ae,
tzs_jg_use_registration A,
......@@ -951,14 +947,12 @@
AND ri.EQU_CATEGORY = '2300'
AND A.sequence_nbr = ae.equip_transfer_id
AND u."RECORD" = ri."RECORD"
and (a.audit_pass_date between #{dpFilterParamDto.beginDate} and #{dpFilterParamDto.endDate})
AND A.status = '已完成'
AND A.is_delete = 0
AND A.supervision_org_code LIKE concat (#{orgCode}, '%' )
) C
WHERE
C.areaCode LIKE concat ( '%', #{dpFilterParamDto.cityCode}, '%' )
GROUP BY
C.equ_category
C.time
</select>
<select id="getElevatorModeList" resultType="java.util.Map">
......
......@@ -43,7 +43,7 @@ public class IdxBizJgProjectContraptionController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY)
@PostMapping(value = "/save")
@ApiOperation(httpMethod = "POST", value = "新增管道工程装置表", notes = "新增管道工程装置表")
public ResponseModel<Boolean> save(@RequestBody IdxBizJgProjectContraptionDto model) {
public ResponseModel<IdxBizJgProjectContraption> save(@RequestBody IdxBizJgProjectContraptionDto model) {
return ResponseHelper.buildResponse(idxBizJgProjectContraptionServiceImpl.saveFirstMergeProjectContraption(model));
}
......@@ -203,7 +203,7 @@ public class IdxBizJgProjectContraptionController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/getNewInspectionDetailByRecord")
@ApiOperation(httpMethod = "GET", value = "获取最新检验信息详情", notes = "获取最新检验信息详情")
public ResponseModel<IdxBizJgInspectionDetectionInfo> getNewInspectionDetailByRecord(@RequestParam("record") String record) {
public ResponseModel<Map<String, Object>> getNewInspectionDetailByRecord(@RequestParam("record") String record) {
return ResponseHelper.buildResponse(idxBizJgProjectContraptionServiceImpl.getNewInspectionDetailByRecord(record));
}
......
......@@ -964,6 +964,7 @@ public class DataHandlerServiceImpl {
List<JgUseRegistration> useRegistrations = useRegistrationService.list(
new LambdaQueryWrapper<JgUseRegistration>()
.isNotNull(JgUseRegistration::getProjectContraptionId)
.isNull(JgUseRegistration::getOriginProjectContraptionIds)
.select(BaseEntity::getSequenceNbr, JgUseRegistration::getProjectContraptionId)
);
......
......@@ -2,8 +2,6 @@ package com.yeejoin.amos.boot.module.jg.biz.service.impl;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.date.DatePattern;
import cn.hutool.core.date.DateUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
......@@ -13,19 +11,14 @@ 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.controller.BaseController;
import com.yeejoin.amos.boot.biz.common.utils.RedisUtils;
import com.yeejoin.amos.boot.biz.common.entity.DataDictionary;
import com.yeejoin.amos.boot.biz.common.service.impl.DataDictionaryServiceImpl;
import com.yeejoin.amos.boot.module.common.api.dao.ESEquipmentCategory;
import com.yeejoin.amos.boot.module.common.api.dto.ESEquipmentCategoryDto;
import com.yeejoin.amos.boot.module.jg.api.converter.DictParamsConverter;
import com.yeejoin.amos.boot.module.jg.api.dto.InspectConclusionConverter;
import com.yeejoin.amos.boot.module.jg.api.dto.InspectTypeConverter;
import com.yeejoin.amos.boot.module.jg.api.dto.PipingExcelDto;
import com.yeejoin.amos.boot.module.jg.api.enums.CompanyTypeEnum;
import com.yeejoin.amos.boot.module.jg.api.enums.EquipSourceEnum;
import com.yeejoin.amos.boot.module.jg.api.enums.PipelineEnum;
import com.yeejoin.amos.boot.module.jg.api.mapper.JgVehicleInformationMapper;
import com.yeejoin.amos.boot.module.jg.biz.feign.TzsServiceFeignClient;
import com.yeejoin.amos.boot.module.jg.biz.service.*;
import com.yeejoin.amos.boot.module.jg.biz.service.IIdxBizJgProjectContraptionService;
import com.yeejoin.amos.boot.module.ymt.api.dto.IdxBizJgProjectContraptionDto;
import com.yeejoin.amos.boot.module.ymt.api.entity.*;
import com.yeejoin.amos.boot.module.ymt.api.mapper.IdxBizJgProjectContraptionMapper;
......@@ -38,12 +31,11 @@ import org.apache.commons.io.IOUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import org.springframework.util.ObjectUtils;
import org.typroject.tyboot.core.foundation.utils.Bean;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.rdbms.service.BaseService;
import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.io.ByteArrayOutputStream;
......@@ -118,6 +110,8 @@ public class IdxBizJgProjectContraptionServiceImpl extends BaseService<IdxBizJgP
private IdxBizJgConstructionInfoServiceImpl idxBizJgConstructionInfoService;
@Autowired
private ESEquipmentCategory esEquipmentCategory;
@Autowired
private DataDictionaryServiceImpl dataDictionaryServiceImpl;
@Override
public boolean saveOrUpdateData(IdxBizJgProjectContraption projectContraption) {
......@@ -507,7 +501,7 @@ public class IdxBizJgProjectContraptionServiceImpl extends BaseService<IdxBizJgP
}
}
public boolean saveFirstMergeProjectContraption(IdxBizJgProjectContraptionDto model) {
public IdxBizJgProjectContraption saveFirstMergeProjectContraption(IdxBizJgProjectContraptionDto model) {
// 单位类型
Map<String, Object> companyInfoMap = jgInstallationNoticeService.getCompanyType();
IdxBizJgProjectContraption projectContraption = JSON.parseObject(toJSONString(model), IdxBizJgProjectContraption.class);
......@@ -515,7 +509,7 @@ public class IdxBizJgProjectContraptionServiceImpl extends BaseService<IdxBizJgP
String equCategoryName = jgVehicleInformationMapper.getEquCategoryNameByCode(model.getEquCategoryCode());
String equDefineName = jgVehicleInformationMapper.getEquCategoryNameByCode(model.getEquDefineCode());
projectContraption.setDataSource("jg");
projectContraption.setIsIntoManagement(true);
projectContraption.setIsIntoManagement(false);
projectContraption.setProvinceName("陕西省");
projectContraption.setEquList(model.getEquListCode());
projectContraption.setEquCategory(model.getEquCategoryCode());
......@@ -526,7 +520,8 @@ public class IdxBizJgProjectContraptionServiceImpl extends BaseService<IdxBizJgP
projectContraption.setPipelineLength(0.0);
projectContraption.setUseUnitName(companyInfoMap.get("companyName").toString());
projectContraption.setUseUnitCreditCode(companyInfoMap.get("creditCode").toString());
return this.saveOrUpdateData(projectContraption);
this.saveOrUpdateData(projectContraption);
return projectContraption;
}
@Override
......@@ -606,14 +601,14 @@ public class IdxBizJgProjectContraptionServiceImpl extends BaseService<IdxBizJgP
}
}
public IdxBizJgInspectionDetectionInfo getNewInspectionDetailByRecord(String record) {
IdxBizJgInspectionDetectionInfo inspectionDetectionInfo = detectionInfoService.queryNewestDetailByRecord(record);
if (inspectionDetectionInfo != null) {
String inspectReport = inspectionDetectionInfo.getInspectReport();
if (inspectReport != null) {
inspectionDetectionInfo.setInspectReport(JSON.parseArray(inspectReport).toJSONString());
}
}
return inspectionDetectionInfo;
public Map<String, Object> getNewInspectionDetailByRecord(String record) {
IdxBizJgInspectionDetectionInfo info = detectionInfoService.queryNewestDetailByRecord(record);
if (info == null) return Collections.emptyMap();
Map<String, Object> result = new HashMap<>(Bean.BeantoMap(info));
result.put("inspectReport", JSON.parseArray(info.getInspectReport()));
result.put("inspectConclusionCode", info.getInspectConclusion());
result.put("inspectConclusion", Optional.ofNullable(dataDictionaryServiceImpl.getByCode(info.getInspectConclusion(), "JYJL"))
.map(DataDictionary::getName).orElse(""));
return result;
}
}
\ No newline at end of file
......@@ -451,11 +451,12 @@ public class JgChangeVehicleRegistrationUnitServiceImpl extends BaseService<JgCh
param.put("USE_INNER_CODE", jgChangeVehicleRegistrationUnit.getNewCarNumber());
if (!ObjectUtils.isEmpty(useRegistCode)) {
param.put("USE_ORG_CODE", useRegistCode);
LambdaQueryWrapper<IdxBizJgOtherInfo> eq = new QueryWrapper<IdxBizJgOtherInfo>().lambda().eq(IdxBizJgOtherInfo::getRecord, item);
IdxBizJgOtherInfo idxBizJgOtherInfo = otherInfoMapper.selectOne(eq);
if (!ObjectUtils.isEmpty(idxBizJgOtherInfo)) {
param.put("SUPERVISORY_CODE", idxBizJgOtherInfo.getSupervisoryCode());
}
// 需求调整 监管码一生不再变化
// LambdaQueryWrapper<IdxBizJgOtherInfo> eq = new QueryWrapper<IdxBizJgOtherInfo>().lambda().eq(IdxBizJgOtherInfo::getRecord, item);
// IdxBizJgOtherInfo idxBizJgOtherInfo = otherInfoMapper.selectOne(eq);
// if (!ObjectUtils.isEmpty(idxBizJgOtherInfo)) {
// param.put("SUPERVISORY_CODE", idxBizJgOtherInfo.getSupervisoryCode());
// }
}
objMap.put(item, param);
});
......@@ -511,6 +512,7 @@ public class JgChangeVehicleRegistrationUnitServiceImpl extends BaseService<JgCh
CompanyModel receiveParentResult = Privilege.companyClient.seleteOne(receiveCompanyResult.getParentId()).getResult();
receiveCompanyCode = receiveParentResult.getCompanyCode();
}
// 生成新的监管码
String code = this.generateVehicleUseRegistrationCode(receiveCompanyCode, manage.getEquDefineCode());
manage.setUseRegistrationCode(code);
// 更新设备使用登记证信息
......@@ -519,10 +521,10 @@ public class JgChangeVehicleRegistrationUnitServiceImpl extends BaseService<JgCh
IdxBizJgRegisterInfo registerInfo = new IdxBizJgRegisterInfo();
registerInfo.setUseOrgCode(code);
idxBizJgRegisterInfoService.update(registerInfo, lambda);
// 使用登记证下设备更新监管码
collect.forEach(a -> {
createCode(jgChangeVehicleRegistrationUnit, manage.getEquDefineCode(), a);
});
// 使用登记证下设备更新监管码, 需求调整 监管码一生不再变化
// collect.forEach(a -> {
// createCode(jgChangeVehicleRegistrationUnit, manage.getEquDefineCode(), a);
// });
// 更新es数据
updateEsData(collect, jgChangeVehicleRegistrationUnit, code);
}
......
......@@ -394,7 +394,7 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
}
// 更新设备使用登记证
idxBizJgRegisterInfoMapper.updateUseOrgCodeByEquip(String.valueOf(map.get("equipId")), flag ? useRegistrationCode : useOrgCode);
// 生成监管码、96333码
// 生成监管码、96333码(管道合并到有证不生成)
createCode(map, jgUseRegistration, registerInfo, useInfo, otherInfo);
}
......@@ -1030,6 +1030,7 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
String useRegistrationCode = null;
Long useRegistrationManageSeq = null;
Boolean flag = Boolean.FALSE;
boolean isMerge = Boolean.FALSE;
String equCategoryCode = String.valueOf(mapData.get("EQU_CATEGORY_CODE"));
String equDefineCode = String.valueOf(mapData.get("EQU_DEFINE_CODE"));
if (mapData.containsKey("equipmentLists") && !ObjectUtils.isEmpty(mapData.get("equipmentLists"))) {
......@@ -1057,10 +1058,15 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
&& Objects.nonNull(jgUseRegistration.getUseRegistrationCode())) {
useRegistrationCode = jgUseRegistration.getUseRegistrationCode();
flag = true;
isMerge = true;
}
List<Map<String, Object>> equipmentLists = (List<Map<String, Object>>) mapData.get("equipmentLists");
// String inspectConclusionName = getInspectConclusionName(mapData);
IdxBizJgProjectContraption jgProjectContraption = null;
if (!StringUtils.isEmpty(jgUseRegistration.getProjectContraptionId())) {
jgProjectContraption = jgProjectContraptionService.getById(jgUseRegistration.getProjectContraptionId());
}
if (!CollectionUtils.isEmpty(equipmentLists)) {
for (int i = 0; i < equipmentLists.size(); i++) {
Map<String, Object> equipment = equipmentLists.get(i);
......@@ -1072,13 +1078,21 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
LambdaQueryWrapper<IdxBizJgRegisterInfo> lambdaReg = new QueryWrapper<IdxBizJgRegisterInfo>().lambda();
lambdaReg.eq(IdxBizJgRegisterInfo::getRecord, equId);
IdxBizJgRegisterInfo registerInfo = idxBizJgRegisterInfoMapper.selectOne(lambdaReg);
// 其他信息
LambdaQueryWrapper<IdxBizJgOtherInfo> lambdaOth = new QueryWrapper<IdxBizJgOtherInfo>().lambda();
lambdaOth.eq(IdxBizJgOtherInfo::getRecord, String.valueOf(mapData.get("equipId")));
IdxBizJgOtherInfo otherInfo = otherInfoMapper.selectOne(lambdaOth);
if (isMerge && jgProjectContraption != null) {
otherInfo.setSupervisoryCode(jgProjectContraption.getSupervisoryCode());
registerInfo.setEquCode(jgProjectContraption.getEquCode());
}
// 压力管道:[更新的原始引用]更新检验日期-nextInspectDate、检验结论-inspectConclusion、检验机构名称-inspectOrgName
// equipment.put("nextInspectDate", mapData.getOrDefault("nextInspectDate", ""));
// equipment.put("inspectOrgName", mapData.getOrDefault("inspectOrgName", ""));
// equipment.put("inspectConclusion", inspectConclusionName);
// 更新设备信息 && 生成使用登记证编号 && 同步es
processMapData(sequenceNbr, mapData, jgUseRegistration, jgRegistrationHistory, registerInfo, taskV2Model, jsonObject, flag, useRegistrationCode);
processMapData(sequenceNbr, mapData, jgUseRegistration, jgRegistrationHistory, registerInfo, otherInfo, taskV2Model, jsonObject, flag, useRegistrationCode, isMerge);
// 查询设备制造信息
LambdaQueryWrapper<IdxBizJgFactoryInfo> factoryInfoWrapper = new LambdaQueryWrapper<>();
factoryInfoWrapper.eq(IdxBizJgFactoryInfo::getRecord, equId);
......@@ -1107,16 +1121,15 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
jgRegistrationHistory.setChangeData(JSON.toJSONString(mapData));
jgRegistrationHistoryService.updateById(jgRegistrationHistory);
// 装置表写入使用登记证编号、将装置名称写入到使用登记表
updateRegAndProjectContraption(jgUseRegistration, mapData);
updateRegAndProjectContraption(jgUseRegistration, mapData, jgProjectContraption);
}
this.getBaseMapper().updateById(jgUseRegistration);
commonServiceImpl.saveExecuteFlowData2Redis(jgUseRegistration.getInstanceId(), this.buildInstanceRuntimeData(jgUseRegistration));
}
private void updateRegAndProjectContraption(JgUseRegistration jgUseRegistration, JSONObject mapData) {
private void updateRegAndProjectContraption(JgUseRegistration jgUseRegistration, JSONObject mapData, IdxBizJgProjectContraption jgProjectContraption) {
//总工程装置
if(!StringUtils.isEmpty(jgUseRegistration.getProjectContraptionId())){
IdxBizJgProjectContraption jgProjectContraption = jgProjectContraptionService.getById(jgUseRegistration.getProjectContraptionId());
if(!StringUtils.isEmpty(jgProjectContraption)){
jgUseRegistration.setProjectContraption(jgProjectContraption.getProjectContraption());
jgProjectContraption.setUseRegistrationCode(jgUseRegistration.getUseRegistrationCode());
jgProjectContraption.setUseDate(String.valueOf(mapData.get("useDate")));
......@@ -1128,6 +1141,7 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
jgProjectContraption.setCountyName(getRegionName(REGION, COUNTY.toLowerCase(), mapData));
jgProjectContraption.setStreetName(getRegionName(STREET, "factoryUseSiteStreet", mapData));
jgProjectContraption.setIsFirstMerge(false);
jgProjectContraption.setIsIntoManagement(true);
if (!StringUtils.isEmpty(mapData.get("orgBranchCode"))) {
jgProjectContraption.setOrgName(String.valueOf(mapData.getString("orgBranchCode")).split("_")[1]);
jgProjectContraption.setOrgCode(String.valueOf(mapData.getString("orgBranchCode")).split("_")[0]);
......@@ -1135,40 +1149,35 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
jgProjectContraption.setStartLatitudeLongitude(String.valueOf(mapData.get("startLatitudeLongitude")));
jgProjectContraption.setEndLatitudeLongitude(String.valueOf(mapData.get("endLatitudeLongitude")));
//装置进行合并
if (!jgUseRegistration.getOriginProjectContraptionIds().contains(jgUseRegistration.getProjectContraptionId())){
//1.修改所有原始工程id集合下的use_info表中的工程装置Id为总工程装置ID
List<IdxBizJgUseInfo> useInfoList = idxBizJgUseInfoService.lambdaQuery()
if (!jgUseRegistration.getOriginProjectContraptionIds().contains(jgUseRegistration.getProjectContraptionId())) {
// 1. 修改 use_info 表中的工程装置 ID
List<IdxBizJgUseInfo> useInfoList = idxBizJgUseInfoService.lambdaQuery()
.in(IdxBizJgUseInfo::getProjectContraptionId, jgUseRegistration.getOriginProjectContraptionIds())
.list();
for (IdxBizJgUseInfo useInfo : useInfoList) {
Optional<ESEquipmentCategoryDto> equInfosWithEs = esEquipmentCategory.findById(useInfo.getRecord());
equInfosWithEs.ifPresent(equInfoEs -> {
useInfoList.forEach(useInfo -> {
esEquipmentCategory.findById(useInfo.getRecord()).ifPresent(equInfoEs -> {
if (PipelineEnum.INDUSTRIAL_PIPELINE.getCode().equals(equInfoEs.getEQU_CATEGORY_CODE())) {
equInfoEs.setProjectContraptionId(useInfo.getProjectContraptionId());
equInfoEs.setProjectContraptionId(jgUseRegistration.getProjectContraptionId());
esEquipmentCategory.save(equInfoEs);
}
});
useInfo.setProjectContraptionId(jgUseRegistration.getProjectContraptionId());
useInfoMapper.updateById(useInfo);
}
//2.修改原始工程装置表中的父级工程装置为总工程装置ID
List<IdxBizJgProjectContraption> projectContraptionList = jgProjectContraptionService.lambdaQuery()
});
// 2. 修改原始工程装置表的父级工程装置 ID
List<IdxBizJgProjectContraption> originProjectContraptionList = jgProjectContraptionService.lambdaQuery()
.in(BaseEntity::getSequenceNbr, jgUseRegistration.getOriginProjectContraptionIds())
.list();
for (IdxBizJgProjectContraption contraption : projectContraptionList) {
originProjectContraptionList.forEach(contraption -> {
contraption.setProjectContraptionParentId(jgUseRegistration.getProjectContraptionId());
jgProjectContraptionService.updateById(contraption);
}
//计算合并后总长度
double totalPipelineLength = Stream.concat(projectContraptionList.stream()
.map(IdxBizJgProjectContraption::getPipelineLength),
Stream.of(jgProjectContraption.getPipelineLength()))
.filter(Objects::nonNull)
.mapToDouble(Double::doubleValue)
.sum();
jgProjectContraption.setPipelineLength(totalPipelineLength);
});
jgProjectContraption.setPipelineLength((Double.parseDouble((String) mapData.get("pipelineLength"))));
}
// 更新 jgProjectContraption 数据
jgProjectContraptionService.updateById(jgProjectContraption);
}
}
......@@ -1452,11 +1461,15 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
LambdaQueryWrapper<IdxBizJgRegisterInfo> lambdaReg = new QueryWrapper<IdxBizJgRegisterInfo>().lambda();
lambdaReg.eq(IdxBizJgRegisterInfo::getRecord, equId);
IdxBizJgRegisterInfo registerInfo = idxBizJgRegisterInfoMapper.selectOne(lambdaReg);
// 其他信息
LambdaQueryWrapper<IdxBizJgOtherInfo> lambdaOth = new QueryWrapper<IdxBizJgOtherInfo>().lambda();
lambdaOth.eq(IdxBizJgOtherInfo::getRecord, String.valueOf(mapData.get("equipId")));
IdxBizJgOtherInfo otherInfo = otherInfoMapper.selectOne(lambdaOth);
// 更新代办
TaskV2Model taskV2Model = updateAgency(jgUseRegistration);
processMapData(sequenceNbr, mapData, jgUseRegistration, jgRegistrationHistory, registerInfo, taskV2Model, jsonObject, Boolean.FALSE, null);
processMapData(sequenceNbr, mapData, jgUseRegistration, jgRegistrationHistory, registerInfo, otherInfo, taskV2Model, jsonObject, Boolean.FALSE, null, Boolean.FALSE);
// 生成证书管理表记录
generateRegistrationManage(jgUseRegistration, registerInfo, Boolean.FALSE, null);
......@@ -1482,12 +1495,8 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
}
private void processMapData(Long sequenceNbr, JSONObject mapData, JgUseRegistration jgUseRegistration,
JgRegistrationHistory jgRegistrationHistory, IdxBizJgRegisterInfo registerInfo, TaskV2Model taskV2Model,
JSONObject jsonObject, Boolean flag, String useRegistrationCode) {
// 其他信息
LambdaQueryWrapper<IdxBizJgOtherInfo> lambdaOth = new QueryWrapper<IdxBizJgOtherInfo>().lambda();
lambdaOth.eq(IdxBizJgOtherInfo::getRecord, String.valueOf(mapData.get("equipId")));
IdxBizJgOtherInfo otherInfo = otherInfoMapper.selectOne(lambdaOth);
JgRegistrationHistory jgRegistrationHistory, IdxBizJgRegisterInfo registerInfo, IdxBizJgOtherInfo otherInfo,
TaskV2Model taskV2Model, JSONObject jsonObject, Boolean flag, String useRegistrationCode, Boolean isMerge) {
jgUseRegistration.setSupervisoryCode(otherInfo.getSupervisoryCode());
// 更新设备信息
......@@ -2886,7 +2895,7 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
} else {
// 处理非批量导入数据,更新关联业务状态
processElseDataByStatus(oldStatus, jgUseRegistration);
// 注册事务提交后的操作
// 统一处理设备的纳管状态【注册事务提交后的操作】
registerAfterCommitTask(records);
}
return jgUseRegistration;
......@@ -3044,10 +3053,6 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
esEquipmentCategoryDto.setUSC_UNIT_NAME(jgConstructionInfo.getUscUnitName());
esEquipmentCategoryDto.setUSC_UNIT_CREDIT_CODE(jgConstructionInfo.getUscUnitCreditCode());
}
//如果是历史电站已纳管改为未纳管
if("1".equals(jgUseRegistration.getRegType())){
esEquipmentCategoryDto.setIS_INTO_MANAGEMENT(false);
}
esEquipmentCategory.save(esEquipmentCategoryDto);
}
}
......@@ -4001,7 +4006,6 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
.collect(toSet());
LambdaQueryWrapper<IdxBizJgProjectContraption> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(IdxBizJgProjectContraption::getUseUnitCreditCode, useUnitCreditCode)
.eq(IdxBizJgProjectContraption::getIsIntoManagement, true)
.notIn(!proIds.isEmpty(), BaseEntity::getSequenceNbr, proIds)
.and(w -> w.isNotNull(IdxBizJgProjectContraption::getUseRegistrationCode)
.or().eq(IdxBizJgProjectContraption::getIsFirstMerge, true));
......
......@@ -10,7 +10,7 @@ import org.springframework.context.ApplicationEvent;
@Getter
public class InspectionApplicationPushEvent extends ApplicationEvent {
private JyjcInspectionApplicationModel jyjcInspectionApplicationModel;
private final JyjcInspectionApplicationModel jyjcInspectionApplicationModel;
/**
* Create a new {@code ApplicationEvent}.
......
......@@ -24,6 +24,7 @@ import com.yeejoin.amos.boot.module.jyjc.biz.service.impl.JyjcInspectionApplicat
import com.yeejoin.amos.boot.module.jyjc.biz.util.JsonUtils;
import com.yeejoin.amos.boot.module.jyjc.biz.util.JyjcConstant;
import com.yeejoin.amos.boot.module.ymt.api.entity.*;
import com.yeejoin.amos.boot.module.ymt.api.enums.EquipmentClassifityEnum;
import com.yeejoin.amos.boot.module.ymt.api.mapper.*;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -142,8 +143,8 @@ public class InspectionApplicationPushEventListener implements ApplicationListen
@PostConstruct
public void init() {
companyCodeRegNameMap = JsonUtils.getResourceJson(regNameJson);
ExecutorService executorService = Executors.newFixedThreadPool(threadNum);
companyCodeRegNameMap = JsonUtils.getResourceJson(regNameJson);
// 可处理的检验检测类型,目前只处理检验的,不处理检测业务
List<String> canDealInspectionTypes = getCanDealInspectionType();
for (int i = 0; i < threadNum; i++) {
......@@ -154,6 +155,10 @@ public class InspectionApplicationPushEventListener implements ApplicationListen
if (!canDealInspectionTypes.contains(applicationModel.getInspectionType())) {
return;
}
if(applicationModel.getEquipClassify().equals(EquipmentClassifityEnum.YLGD.getCode())){
log.info("压力管道暂不处理");
return;
}
//构建数据
JyjcInspectionApplicationPushLog pushLog = this.createPushData(applicationModel);
// 发送数据
......
......@@ -820,7 +820,7 @@ public class JyjcInspectionApplicationServiceImpl extends BaseService<JyjcInspec
}
inspectionResultService.saveOrUpdateBatch(resultModels);
// 报检信息推送 TODO
// this.pushInspectionApplication(model);
this.pushInspectionApplication(model);
this.saveBatchResume(jgResumeInfoDtoList);
this.createHisAfterReceive(model);
// 更新流程中的流程数据
......
......@@ -508,19 +508,28 @@ public class JGDPStatisticsServiceImpl {
result.put("legendData", legendDataList);
LocalDate today = LocalDate.now();
List xDataList = new ArrayList();
List<Integer> newDeviceList = new ArrayList();
List<Integer> scrappedDeviceList = new ArrayList();
DateTimeFormatter sdf = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
List<Object> newDeviceList = new ArrayList();
List<Object> scrappedDeviceList = new ArrayList();
DateTimeFormatter sdf = DateTimeFormatter.ofPattern("yyyy-MM");
String orgCode = stCommonService.getAndSetOrgCode(dpFilterParamDto.getCityCode());
List<Map<String,Object>> useRegisterCountList = useRegistrationMapper.getUseRegisterCount(orgCode);
List<Map<String,Object>> scrappedDeviceCountList = scrapCancelMapper.getScrappedDeviceCount(dpFilterParamDto);
Map<String,Object> useRegisterCount = new HashMap<>();
Map<String,Object> scrappedDeviceCount = new HashMap<>();
if(CollectionUtils.isNotEmpty(useRegisterCountList)) {
useRegisterCountList.forEach(item -> {
useRegisterCount.put(item.get("time") + "", item.get("num"));
});
}
if(CollectionUtils.isNotEmpty(scrappedDeviceCountList)) {
scrappedDeviceCountList.forEach(item -> {
scrappedDeviceCount.put(item.get("time") + "", item.get("num"));
});
}
for (int i = 2; i >= 0; i--) {
LocalDate firstDayOfPrevMonth = today.minusMonths(i).with(TemporalAdjusters.firstDayOfMonth());
LocalDate lastDayOfPrevMonth = today.minusMonths(i).with(TemporalAdjusters.lastDayOfMonth());
dpFilterParamDto.setBeginDate(LocalDateTime.of(firstDayOfPrevMonth, java.time.LocalTime.MIN).format(sdf));
dpFilterParamDto.setEndDate(LocalDateTime.of(lastDayOfPrevMonth, java.time.LocalTime.MAX).format(sdf));
Integer useRegisterCount = useRegistrationMapper.getUseRegisterCount(dpFilterParamDto);
Integer scrappedDeviceCount = scrapCancelMapper.getScrappedDeviceCount(dpFilterParamDto);
xDataList.add(firstDayOfPrevMonth.getMonthValue() + "月");
newDeviceList.add(null == useRegisterCount ? 0 : useRegisterCount);
scrappedDeviceList.add(null == scrappedDeviceCount ? 0 : scrappedDeviceCount);
xDataList.add(today.minusMonths(i).format(sdf));
newDeviceList.add(null == useRegisterCount.get(today.minusMonths(i).format(sdf)) ? 0 : Integer.valueOf(useRegisterCount.get(today.minusMonths(i).format(sdf))+""));
scrappedDeviceList.add(null == scrappedDeviceCount.get(today.minusMonths(i).format(sdf)) ? 0 : Integer.valueOf(scrappedDeviceCount.get(today.minusMonths(i).format(sdf))+""));
}
result.put("xdata", xDataList);
result.put("newDevice", newDeviceList);
......
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