Commit 2518e8bc authored by suhuiguang's avatar suhuiguang

Merge branch 'develop_tzs_register' of…

Merge branch 'develop_tzs_register' of http://39.100.92.250:5000/moa/amos-boot-biz into develop_tzs_register
parents 0e18e892 bcb3ed48
......@@ -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());
}
}
......
......@@ -41,4 +41,14 @@ public class EquipRequestParamsDto {
private String equCode;
private String inspectUnitCreditCode;
private String inspectUnitName;
private String province;
private String provinceName;
private String city;
private String cityName;
private String county;
private String countyName;
private String street;
private String streetName;
private String address;
private String usePlace;
}
\ No newline at end of file
......@@ -646,6 +646,7 @@
pp."WORK_TEMPERATURE" AS workTemperature,
pp."WORK_MEDIUM" AS workMedium,
(select INSPECT_ORG_NAME from idx_biz_jg_inspection_detection_info where "RECORD" = ui."RECORD" ORDER BY INSPECT_DATE DESC limit 1) inspectOrgName,
(select INSPECT_CONCLUSION from idx_biz_jg_inspection_detection_info where "RECORD" = ui."RECORD" ORDER BY INSPECT_DATE DESC limit 1) inspectConclusionCode,
(select name from cb_data_dictionary where type = 'JYJL' and code = (select INSPECT_CONCLUSION from idx_biz_jg_inspection_detection_info where "RECORD" = ui."RECORD" ORDER BY INSPECT_DATE DESC limit 1)) inspectConclusion,
to_char((select NEXT_INSPECT_DATE from idx_biz_jg_inspection_detection_info where "RECORD" = ui."RECORD" ORDER BY INSPECT_DATE DESC limit 1), 'YYYY-MM-DD') nextInspectDate
FROM
......@@ -1074,7 +1075,6 @@
#{item}
</foreach>
AND ui.IS_INTO_MANAGEMENT = true
AND (length(ri.USE_ORG_CODE) = 0 OR ri.USE_ORG_CODE IS NULL)
ORDER BY ui.REC_DATE DESC
)
</select>
......
package com.yeejoin.amos.boot.module.jg.biz.controller;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
......@@ -42,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));
}
......@@ -165,8 +166,8 @@ public class IdxBizJgProjectContraptionController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY)
@PostMapping(value = "/saveOrUpdateDetectionInfoBatch")
@ApiOperation(httpMethod = "POST", value = "新增或者更新检验信息", notes = "新增或者更新检验信息")
public ResponseModel<?> saveOrUpdateDetectionInfoBatch(@RequestBody List<IdxBizJgInspectionDetectionInfo> detectionInfos) {
idxBizJgProjectContraptionServiceImpl.saveOrUpdateDetectionInfoBatch(detectionInfos);
public ResponseModel<?> saveOrUpdateDetectionInfoBatch(@RequestBody JSONObject jsonObject) {
idxBizJgProjectContraptionServiceImpl.saveOrUpdateDetectionInfoBatch(jsonObject);
return ResponseHelper.buildResponse("更新成功");
}
......@@ -194,6 +195,18 @@ public class IdxBizJgProjectContraptionController extends BaseController {
return ResponseHelper.buildResponse(idxBizJgProjectContraptionServiceImpl.getDetectionInfoDetail(sequenceNbr));
}
/**
* 获取最新检验信息详情
*
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/getNewInspectionDetailByRecord")
@ApiOperation(httpMethod = "GET", value = "获取最新检验信息详情", notes = "获取最新检验信息详情")
public ResponseModel<IdxBizJgInspectionDetectionInfo> getNewInspectionDetailByRecord(@RequestParam("record") String record) {
return ResponseHelper.buildResponse(idxBizJgProjectContraptionServiceImpl.getNewInspectionDetailByRecord(record));
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/summaryBasicInfo/export")
@ApiOperation(httpMethod = "GET", value = "导出基本信息汇总表(长输/公用管道)", notes = "导出基本信息汇总表(长输/公用管道)")
......
......@@ -389,7 +389,7 @@ public class JgUseRegistrationController extends BaseController {
@ApiOperation(httpMethod = "GET", value = "查询工程装置下的所有做过安装告知但是为做使用登记的管道", notes = "查询工程装置下的所有做过安装告知但是为做使用登记的管道")
@GetMapping(value = "/getDeviceListByProjectContraptionSeq")
public ResponseModel<Object> getDeviceListByProjectContraption(@RequestParam("record") String projectContraptionSeq,
@RequestParam(required = false) String[] originProjectContraptionIds) {
@RequestParam("originProjectContraptionIds") String[] originProjectContraptionIds) {
return ResponseHelper.buildResponse(jgUseRegistrationServiceImpl.getDeviceListByProjectContraption(projectContraptionSeq, originProjectContraptionIds));
}
}
......@@ -155,17 +155,17 @@ public class BatchDataChangeProcessStrategy implements IChangeDataProcessStrateg
List<String> records = eqs.stream().map(JgUseRegistrationEq::getEquId).collect(toList());
IdxBizJgRegisterInfo registerInfo = useRegistrationService.getRegisterInfo(jgUseRegistration);
List<Map<String, Object>> tableData;
if (CylinderTypeEnum.CYLINDER.getCode().equals(registerInfo.getEquCategory())) {
List<DictionarieValueModel> fillingMedium = Systemctl.dictionarieClient.dictValues("FILLING_MEDIUM").getResult();
Map<String, Object> fillingMediumMap = fillingMedium.stream().collect(Collectors.toMap(DictionarieValueModel::getDictDataKey, DictionarieValueModel::getDictDataValue));
tableData = jgUseRegistrationMapper.queryForUnitVesselEquipment(records);
tableData.forEach(i -> i.put("chargingMedium", fillingMediumMap.get(i.get("chargingMedium"))));
} else {
if (EquipmentClassifityEnum.YLGD.getCode().equals(registerInfo.getEquList())){
IdxBizJgProjectContraption idxBizJgProjectContraption = idxBizJgProjectContraptionService.getById(jgUseRegistration.getProjectContraptionId());
Map<String, Object> map = IdxBizJgRegisterInfoServiceImpl.convertCamelToUnderscore(idxBizJgProjectContraption, IdxBizJgProjectContraptionServiceImpl.jsonFields);
result.putAll(map);
result.put("projectContraptionId", idxBizJgProjectContraption.getSequenceNbr());
tableData = jgUseRegistrationMapper.queryForUnitPipelineEquipmentForEdit(records);
} else {
List<DictionarieValueModel> fillingMedium = Systemctl.dictionarieClient.dictValues("FILLING_MEDIUM").getResult();
Map<String, Object> fillingMediumMap = fillingMedium.stream().collect(Collectors.toMap(DictionarieValueModel::getDictDataKey, DictionarieValueModel::getDictDataValue));
tableData = jgUseRegistrationMapper.queryForUnitVesselEquipment(records);
tableData.forEach(i -> i.put("chargingMedium", fillingMediumMap.get(i.get("chargingMedium"))));
}
result.put("tableData", tableData);
return result;
......
......@@ -43,7 +43,7 @@ import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.math.NumberUtils;
import org.aspectj.weaver.ast.Var;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.ObjectUtils;
......@@ -1535,7 +1535,7 @@ public class DataDockServiceImpl {
* @param paramsDto
*/
public void checkTheUnitRegManageAlreadyExists(EquipRequestParamsDto paramsDto) {
idxBizJgRegisterInfoServiceImpl.checkUseRegistrationCode(paramsDto.getUseOrgCode(),"unit");
idxBizJgRegisterInfoServiceImpl.checkUseRegistrationCode(paramsDto.getUseOrgCode(), "unit");
Integer useRegManageCount = jgUseRegistrationManageService.lambdaQuery()
.eq(JgUseRegistrationManage::getUseUnitCreditCode, paramsDto.getCompanyCode())
.eq(JgUseRegistrationManage::getUseUnitName, paramsDto.getCompanyName())
......@@ -1566,7 +1566,24 @@ public class DataDockServiceImpl {
String inspectUnitCreditCode = Optional.ofNullable(equLists.get(0).getInspectOrgCode()).orElse("");
String inspectUnitName = Optional.ofNullable(equLists.get(0).getInspectOrgName()).orElse("");
String useOrgCode = String.valueOf(equipInfo.get("USE_ORG_CODE"));
String province = String.valueOf(equipInfo.get("province"));
String city = String.valueOf(equipInfo.get("city"));
String county = String.valueOf(equipInfo.get("county"));
String street = String.valueOf(equipInfo.get("street"));
String address = String.valueOf(equipInfo.get("address"));
String usePlace = String.valueOf(equipInfo.get("usePlace"));
return new EquipRequestParamsDto().setCompanyCode(company.getCompanyCode().split("_")[0])
.setProvince(province)
.setProvinceName("陕西省")
.setCity(city)
.setCityName(this.getRegionName("CITY", "CITY".toLowerCase(), equipInfo))
.setCounty(county)
.setCountyName(this.getRegionName("REGION", "COUNTY".toLowerCase(), equipInfo))
.setStreet(street)
.setStreetName(this.getRegionName("STREET", "STREET".toLowerCase(), equipInfo))
.setAddress(address)
.setUsePlace(usePlace)
.setCompanyName(company.getCompanyName())
.setCompanyAddress(company.getAddress())
.setExecUserId(userModel.getUserId())
......@@ -1595,6 +1612,24 @@ public class DataDockServiceImpl {
}
/**
* 根据code获取市区县名字
*
* @param key key
* @param codeKey codeKey
* @param mapData 表单信息
* @return name
*/
private String getRegionName(String key, String codeKey, JSONObject mapData) {
return Optional.ofNullable((List<LinkedHashMap>) redisUtils.get(key))
.flatMap(list -> list.stream()
.filter(item -> String.valueOf(item.get("regionCode"))
.equals(String.valueOf(mapData.get(codeKey))))
.map(item -> (String) item.get("regionName"))
.findFirst())
.orElse("");
}
/**
* 检查本单位是否已存在该工程装置
* 存在则抛出异常
*
......@@ -1662,6 +1697,7 @@ public class DataDockServiceImpl {
useInfo.setUseUnitName(paramsDto.getCompanyName());
useInfo.setProjectContraption(paramsDto.getProjectContraption());
useInfo.setProjectContraptionId(paramsDto.getProjectContraptionSeq());
BeanUtils.copyProperties(paramsDto, useInfo);
useInfoList.add(useInfo);
// 检验检测信息
......@@ -1762,6 +1798,18 @@ public class DataDockServiceImpl {
esEquipmentDto.setPROJECT_CONTRAPTION(paramsDto.getProjectContraption());
esEquipmentDto.setPRODUCT_NAME(pipelineInfo.getPipeName());
esEquipmentDto.setProjectContraptionId(paramsDto.getProjectContraptionSeq());
esEquipmentDto.setUSE_ORG_CODE(paramsDto.getUseOrgCode());
esEquipmentDto.setSUPERVISORY_CODE(proCon.getSupervisoryCode());
esEquipmentDto.setUSE_UNIT_CREDIT_CODE(paramsDto.getCompanyCode());
esEquipmentDto.setUSE_UNIT_NAME(paramsDto.getCompanyName());
esEquipmentDto.setADDRESS(paramsDto.getAddress());
esEquipmentDto.setUSE_PLACE(paramsDto.getProvinceName() + "/" + paramsDto.getCityName() + "/" + paramsDto.getCountyName() + "/" + paramsDto.getStreetName());
esEquipmentDto.setUSE_PLACE_CODE(paramsDto.getProvince() + "#" + paramsDto.getCity() + "#" + paramsDto.getCounty() + "#" + paramsDto.getStreet());
esEquipmentDto.setUSE_SITE_CODE(paramsDto.getUsePlace());
esEquipmentDto.setORG_BRANCH_CODE(paramsDto.getOrgBranchCode());
esEquipmentDto.setORG_BRANCH_NAME(paramsDto.getOrgBranchName());
esEquipmentDto.setEQU_STATE(1);
esEquipmentDto.setEQU_CODE(paramsDto.getEquCode());
if (inspectionDetectionInfo.getNextInspectDate() != null) {
esEquipmentDto.setNEXT_INSPECT_DATE(inspectionDetectionInfo.getNextInspectDate().getTime());
}
......@@ -1944,7 +1992,9 @@ public class DataDockServiceImpl {
.orgCode(paramsDto.getOrgBranchCode())
.orgName(paramsDto.getOrgBranchName())
.productQualificationCertificate(paramsDto.getProductQualificationCertificate())
// .province().provinceName().city().cityName().county().countyName().street().streetName().address()
.province(paramsDto.getProvince()).provinceName(paramsDto.getProvinceName()).city(paramsDto.getCity()).cityName(paramsDto.getCityName())
.county(paramsDto.getCounty()).countyName(paramsDto.getCountyName()).street(paramsDto.getStreet()).streetName(paramsDto.getStreetName())
.address(paramsDto.getAddress())
.supervisoryCode(idxBizJgRegisterInfoServiceImpl.getSupervisoryCode(paramsDto.getVehicleApanage(), paramsDto.getEquCategoryCode())).isIntoManagement(Boolean.TRUE).dataSource(paramsDto.getDataSource()).equCode(paramsDto.getEquCode()).isFirstMerge(Boolean.FALSE).build();
contraption.setSequenceNbr(seq);
paramsDto.setProjectContraptionSeq(String.valueOf(seq));
......
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;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
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.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;
......@@ -56,6 +50,7 @@ import java.util.stream.IntStream;
import java.util.stream.Stream;
import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream;
import static com.alibaba.fastjson.JSON.toJSONString;
/**
* 管道工程装置表服务实现类
......@@ -306,24 +301,42 @@ public class IdxBizJgProjectContraptionServiceImpl extends BaseService<IdxBizJgP
Page<Map<String, Object>> page=new Page<>();
page.setCurrent(current);
page.setSize(size);
page.setRecords(baseMapper.selectEquipListPage(sequenceNbr,(current-1)*size,size));
page.setRecords(baseMapper.selectEquipListPage(sequenceNbr, (current - 1) * size, size));
page.setTotal(baseMapper.selectEquipCount(sequenceNbr));
return page;
}
@Transactional(rollbackFor = Exception.class)
public void saveOrUpdateDetectionInfo(IdxBizJgInspectionDetectionInfo detectionInfo) {
detectionInfo.setRecDate(new Date());
detectionInfoService.saveOrUpdateData(detectionInfo);
}
public void saveOrUpdateDetectionInfoBatch(List<IdxBizJgInspectionDetectionInfo> detectionInfos) {
if(CollectionUtil.isNotEmpty(detectionInfos)){
for (IdxBizJgInspectionDetectionInfo detectionInfo : detectionInfos) {
@Transactional(rollbackFor = Exception.class)
public void saveOrUpdateDetectionInfoBatch(JSONObject jsonObject) {
if(Objects.nonNull(jsonObject)){
JSONArray records = jsonObject.getJSONArray("records");
if(CollectionUtil.isNotEmpty(records)){
List<IdxBizJgInspectionDetectionInfo> jgInspectionDetectionInfos= new ArrayList<>();
for (Object record : records) {
IdxBizJgInspectionDetectionInfo detectionInfo = JSON.parseObject(JSONObject.toJSONString(record), IdxBizJgInspectionDetectionInfo.class);
if(Objects.nonNull(detectionInfo)){
if (record instanceof LinkedHashMap){
Map map = (LinkedHashMap)record;
detectionInfo.setRecDate(new Date());
detectionInfo.setSequenceNbr((String) map.get("detectionInfoSequenceNbr"));
detectionInfo.setInspectConclusion((String)map.get("inspectConclusionCode"));
jgInspectionDetectionInfos.add(detectionInfo);
}
}
}
detectionInfoService.saveOrUpdateBatch(detectionInfos);
if(CollUtil.isNotEmpty(jgInspectionDetectionInfos)){
detectionInfoService.saveOrUpdateBatch(jgInspectionDetectionInfos);
}
}
}
}
public IdxBizJgInspectionDetectionInfo getDetectionInfoDetail(String sequenceNbr) {
return detectionInfoService.getById(sequenceNbr);
......@@ -485,15 +498,15 @@ 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);
String equListName = jgVehicleInformationMapper.getEquCategoryNameByCode(model.getEquListCode());
String equCategoryName = jgVehicleInformationMapper.getEquCategoryNameByCode(model.getEquCategoryCode());
String equDefineName = jgVehicleInformationMapper.getEquCategoryNameByCode(model.getEquDefineCode());
projectContraption.setDataSource("new");
projectContraption.setIsIntoManagement(true);
projectContraption.setDataSource("jg");
projectContraption.setIsIntoManagement(false);
projectContraption.setProvinceName("陕西省");
projectContraption.setEquList(model.getEquListCode());
projectContraption.setEquCategory(model.getEquCategoryCode());
......@@ -504,7 +517,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
......@@ -584,4 +598,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;
}
}
\ No newline at end of file
......@@ -532,6 +532,7 @@ public class JgUseRegistrationManageServiceImpl extends BaseService<JgUseRegistr
JSONObject dto = jsonObject.getJSONObject("sourceAsMap");
dto.put("record", dto.get("SEQUENCE_NBR"));
dto.put("equipAddress", dto.get("USE_PLACE") + "/" + dto.get("ADDRESS"));
dto.put("EQU_STATE_NAME",EquimentEnum.getName.get(Integer.valueOf(dto.getString("EQU_STATE"))));
list.add(dto);
}
totle = Objects.requireNonNull(response.getInternalResponse().hits().getTotalHits()).value;
......
......@@ -405,6 +405,7 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
if("unit".equals(jgUseRegistration.getManageType()) && registerInfo.getEquList().equals(EquipmentClassifityEnum.YLGD.getCode())){
// 压力管道逻辑,根据设备record + 检验报告编号判定唯一一条检验流水,有进行更新,无则进行插入
inspectionDetectionInfo.setInspectConclusion((String) map.get("inspectConclusionCode"));
saveEquipOfPieLineInspectData(record, inspectionDetectionInfo);
} else {
// 其他逻辑
......@@ -751,8 +752,6 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
ReginParams reginParams = JSONObject.parseObject(redisUtils.get(RedisKey.buildReginKey(RequestContext.getExeUserId(), RequestContext.getToken())) + "", ReginParams.class);
CompanyBo company = reginParams.getCompany();
String equListCode = String.valueOf(map.get("EQU_LIST_CODE"));
// 压力管道逻辑
// EquipmentClassifityEnum.YLGD.getCode().equals(equListCode)
List<Map<String, Object>> equipmentLists = (List<Map<String, Object>>) map.get("equipmentLists");
if (CollectionUtils.isEmpty(equipmentLists)) {
throw new BadRequest("请选择设备信息!");
......@@ -771,8 +770,22 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
}
}
// 压力管道逻辑(如果是合并到已有证的工程装置,需要去除已完成设备)
Set<Object> excludedRecords = EquipmentClassifityEnum.YLGD.getCode().equals(equListCode) ?
idxBizJgUseInfoService.lambdaQuery()
.eq(IdxBizJgUseInfo::getProjectContraptionId, map.get("projectContraptionId"))
.list().stream()
.map(IdxBizJgUseInfo::getRecord)
.collect(Collectors.toSet())
: Collections.emptySet();
List<Map<String, Object>> filteredEquipmentLists = equipmentLists.stream()
.filter(equipment -> !excludedRecords.contains(equipment.get("record")))
.collect(Collectors.toList());
// 提交时进行校验设备是否在流程中使用(并发及同时打开多个相同的页面时才会出现此种情况)
checkForRepeatUsedEquip(map, equipmentLists, company);
checkForRepeatUsedEquip(map, filteredEquipmentLists, company);
JgUseRegistration useRegistration = JSON.parseObject(JSON.toJSONString(map), JgUseRegistration.class);
useRegistration.setRegDate(new Date());
useRegistration.setCreateDate(new Date());
......@@ -1101,6 +1114,7 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
}
private void updateRegAndProjectContraption(JgUseRegistration jgUseRegistration, JSONObject mapData) {
//总工程装置
if(!StringUtils.isEmpty(jgUseRegistration.getProjectContraptionId())){
IdxBizJgProjectContraption jgProjectContraption = jgProjectContraptionService.getById(jgUseRegistration.getProjectContraptionId());
jgUseRegistration.setProjectContraption(jgProjectContraption.getProjectContraption());
......@@ -1118,8 +1132,8 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
jgProjectContraption.setOrgName(String.valueOf(mapData.getString("orgBranchCode")).split("_")[1]);
jgProjectContraption.setOrgCode(String.valueOf(mapData.getString("orgBranchCode")).split("_")[0]);
}
jgProjectContraptionService.updateById(jgProjectContraption);
}
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
......@@ -1145,6 +1159,17 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
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);
}
jgProjectContraptionService.updateById(jgProjectContraption);
}
}
......@@ -2001,9 +2026,9 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
}
// 完成、作废时显示历史数据,其他状态显示实时数据
if (!(jgUseRegistration.getStatus().equals(FlowStatusEnum.TO_BE_FINISHED.getName()) || jgUseRegistration.getStatus().equals(FlowStatusEnum.TO_BE_DISCARD.getName()))) {
jsonObject.remove("equipmentLists");
// 查询气瓶设备详情
if (CylinderTypeEnum.CYLINDER.getCode().equals(jsonObject.get("EQU_CATEGORY_CODE"))) {
jsonObject.remove("equipmentLists");
List<DictionarieValueModel> fillingMedium = Systemctl.dictionarieClient.dictValues("FILLING_MEDIUM").getResult();
Map<String, Object> fillingMediumMap = fillingMedium.stream().collect(Collectors.toMap(DictionarieValueModel::getDictDataKey, DictionarieValueModel::getDictDataValue));
List<Map<String, Object>> result = jgUseRegistrationMapper.queryForUnitVesselEquipment(records);
......@@ -2011,10 +2036,11 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
i.put("chargingMedium", fillingMediumMap.get(i.get("chargingMedium")));
});
jsonObject.put("equipmentLists", result);
} else {
// 查询管道设备详情
jsonObject.put("equipmentLists", jgUseRegistrationMapper.queryForUnitPipelineEquipment(records));
}
// else {
// 查询管道设备详情
// jsonObject.put("equipmentLists", jgUseRegistrationMapper.queryForUnitPipelineEquipment(records));
//}
} else {
this.setPieLineInspectInfo(jgUseRegistration.getProjectContraptionId(), jsonObject);
this.setConstructionInfo(jgUseRegistration.getProjectContraptionId(), jsonObject);
......@@ -2373,6 +2399,10 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
for (int i = 0; i < equipmentLists.size(); i++) {
JSONObject equipmentItem = equipmentLists.getJSONObject(i);
equipmentItem.put("useDate", timeToMonths(useDateValue));
// 过滤出目前在用的设备
if(!this.checkEquStatusInUse(equipmentItem.getString("record"))){
equipmentLists.remove(i);
}
}
allEquipment.addAll(equipmentLists);
}
......@@ -2423,6 +2453,17 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
}
return futureList;
}
/**
* 根据record判断设备状态是否为【在用】
* @param record
* @return
*/
private boolean checkEquStatusInUse(String record) {
IdxBizJgUseInfo useInfo = idxBizJgUseInfoService.lambdaQuery().select(IdxBizJgUseInfo::getEquState).eq(IdxBizJgUseInfo::getRecord, record).one();
return EquimentEnum.ZAIYONG.getCode().toString().equals(useInfo.getEquState());
}
/**
* 导出基本信息汇总表(工业管道/气瓶)
*
......@@ -2838,6 +2879,10 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
this.invalidUseRegistrationCertificate(jgUseRegistration);
// 单据逻辑删除
this.lambdaUpdate().set(JgUseRegistration::getIsDelete, Boolean.TRUE).eq(JgUseRegistration::getSequenceNbr, sequenceNbr).update();
// 管道作废工程装置
if (!ValidationUtil.isEmpty(jgUseRegistration.getProjectContraptionId())) {
idxBizJgProjectContraptionMapper.delete(new LambdaQueryWrapper<IdxBizJgProjectContraption>().eq(IdxBizJgProjectContraption::getSequenceNbr,jgUseRegistration.getProjectContraptionId()));
}
} else {
// 处理非批量导入数据,更新关联业务状态
processElseDataByStatus(oldStatus, jgUseRegistration);
......@@ -2884,7 +2929,7 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
// 3.回滚更新idx_biz_jg_supervision_info表
this.rollBackSupervisionInfo(record);
// 4.es的EQU_STATE, USE_ORG_CODE、ORG_BRANCH_CODE、ORG_BRANCH_NAME、STATUS
this.rollBackForEquipEsInfo(record, flag);
this.rollBackForEquipEsInfo(record, flag,jgUseRegistration);
// 5.历史设备处理
this.dealHisRegEquipData(jgUseRegistration, record);
});
......@@ -2977,7 +3022,7 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
return jgRelationEquipMapper.selectList(eqLambdaQueryWrapper);
}
private void rollBackForEquipEsInfo(String record, Boolean flag) {
private void rollBackForEquipEsInfo(String record, Boolean flag,JgUseRegistration jgUseRegistration) {
LambdaQueryWrapper<IdxBizJgConstructionInfo> wrapper = new LambdaQueryWrapper<>();
wrapper.select(IdxBizJgConstructionInfo::getUscUnitCreditCode,
IdxBizJgConstructionInfo::getUscUnitName,
......@@ -2998,8 +3043,12 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
if (jgConstructionInfo != null){
esEquipmentCategoryDto.setUSC_UNIT_NAME(jgConstructionInfo.getUscUnitName());
esEquipmentCategoryDto.setUSC_UNIT_CREDIT_CODE(jgConstructionInfo.getUscUnitCreditCode());
esEquipmentCategory.save(esEquipmentCategoryDto);
}
//如果是历史电站已纳管改为未纳管
if("1".equals(jgUseRegistration.getRegType())){
esEquipmentCategoryDto.setIS_INTO_MANAGEMENT(false);
}
esEquipmentCategory.save(esEquipmentCategoryDto);
}
}
......@@ -3927,6 +3976,7 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
LambdaQueryWrapper<IdxBizJgProjectContraption> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(IdxBizJgProjectContraption::getUseUnitCreditCode,useUnitCreditCode);
wrapper.eq(IdxBizJgProjectContraption::getIsIntoManagement, true);
wrapper.eq(IdxBizJgProjectContraption::getEquCategory, "8300");
wrapper.eq(IdxBizJgProjectContraption::getIsFirstMerge, false);
wrapper.notIn(!proIds.isEmpty(), BaseEntity::getSequenceNbr, proIds);
wrapper.isNull(IdxBizJgProjectContraption::getProjectContraptionParentId);
......@@ -4002,7 +4052,14 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
fieldMappings.put("city", hisJson.get("city"));
fieldMappings.put("isXixian", hisJson.get("isXixian"));
fieldMappings.put("county", hisJson.get("county"));
fieldMappings.put("longitudeLatitude", hisJson.get("longitudeLatitude"));
fieldMappings.put("startLatitudeLongitude",
Objects.isNull(hisJson.get("startLatitudeLongitude")) ?
hisJson.get("longitudeLatitude") :
hisJson.get("startLatitudeLongitude"));
fieldMappings.put("endLatitudeLongitude",
Objects.isNull(hisJson.get("startLatitudeLongitude")) ?
hisJson.get("longitudeLatitude") :
hisJson.get("endLatitudeLongitude"));
fieldMappings.put("estateUnitName", hisJson.get("estateUnitName"));
fieldMappings.put("orgBranchCode", hisJson.get("orgBranchCode"));
fieldMappings.forEach(re::put);
......
......@@ -146,7 +146,7 @@
SELECT ibjtpp."SEQUENCE_NBR" AS sequenceNbr,
ibjtpp."PIPE_NAME" AS pipeName,
ibjtpp."PIPELINE_NUMBER" AS pipelineNumber,
ibjtpp."DEVICE_LEVEL" AS deviceLevel,
(select name from cb_data_dictionary where code = ibjtpp."DEVICE_LEVEL" and type = 'GBI') deviceLevel,
ibjtpp."NOMINAL_DIAMETER" AS nominalDiameter,
ibjtpp."WALL_THICKNESS" AS wallThickness,
ibjtpp."PIPE_LENGTH" AS pipeLength,
......@@ -159,12 +159,12 @@
ibjtpp."REMARKS" AS remarks,
(select SEQUENCE_NBR from idx_biz_jg_inspection_detection_info where "RECORD" = ibjui."RECORD" ORDER BY INSPECT_DATE DESC limit 1) detectionInfoSequenceNbr,
(select INSPECT_ORG_NAME from idx_biz_jg_inspection_detection_info where "RECORD" = ibjui."RECORD" ORDER BY INSPECT_DATE DESC limit 1) inspectOrgName,
(select INSPECT_CONCLUSION from idx_biz_jg_inspection_detection_info where "RECORD" = ibjui."RECORD" ORDER BY INSPECT_DATE DESC limit 1) inspectConclusion,
(select NEXT_INSPECT_DATE from idx_biz_jg_inspection_detection_info where "RECORD" = ibjui."RECORD" ORDER BY INSPECT_DATE DESC limit 1) nextInspectDate,
(select name from cb_data_dictionary where type = 'JYJL' and code = (select INSPECT_CONCLUSION from idx_biz_jg_inspection_detection_info where "RECORD" = ibjui."RECORD" ORDER BY INSPECT_DATE DESC limit 1)) inspectConclusion,
to_char((select NEXT_INSPECT_DATE from idx_biz_jg_inspection_detection_info where "RECORD" = ibjui."RECORD" ORDER BY INSPECT_DATE DESC limit 1),'YYYY-MM-DD') nextInspectDate,
(select USC_UNIT_NAME from idx_biz_jg_construction_info jci where ibjui.RECORD = jci.RECORD ORDER BY jci."USC_DATE" DESC limit 1) as uscUnitName,
(select USC_DATE from idx_biz_jg_construction_info jci where ibjui.RECORD = jci.RECORD ORDER BY jci."USC_DATE" DESC limit 1) as uscDate,
to_char((select USC_DATE from idx_biz_jg_construction_info jci where ibjui.RECORD = jci.RECORD ORDER BY jci."USC_DATE" DESC limit 1),'YYYY-MM-DD') as uscDate,
ibjdi."DESIGN_UNIT_NAME" AS designUnitName,
ibjui."USE_DATE" AS useDate,
to_char(ibjui."USE_DATE",'YYYY-MM-DD') AS useDate,
ibjui."RECORD" AS record
FROM idx_biz_jg_use_info ibjui
LEFT JOIN idx_biz_jg_tech_params_pipeline ibjtpp ON ibjui.RECORD = ibjtpp.RECORD
......@@ -219,7 +219,7 @@
<select id="selectEquipListByExport" resultType="java.util.Map">
SELECT ibjtpp."PIPE_NAME" AS productName,
ibjtpp."PIPELINE_NUMBER" AS pipelineNumber,
ibjtpp."DEVICE_LEVEL" AS deviceLevel,
(select name from cb_data_dictionary where code = ibjtpp."DEVICE_LEVEL" and type = 'GBI') deviceLevel,
ibjtpp."NOMINAL_DIAMETER" AS nominalDiameter,
ibjtpp."WALL_THICKNESS" AS wallThickness,
ibjtpp."PIPE_LENGTH" AS pipeLength,
......@@ -231,12 +231,12 @@
ibjtpp."WORK_MEDIUM" AS workMedium,
ibjtpp."REMARKS" AS remarks,
(select INSPECT_ORG_NAME from idx_biz_jg_inspection_detection_info where "RECORD" = ibjui."RECORD" ORDER BY INSPECT_DATE DESC limit 1) inspectOrgName,
(select INSPECT_CONCLUSION from idx_biz_jg_inspection_detection_info where "RECORD" = ibjui."RECORD" ORDER BY INSPECT_DATE DESC limit 1) inspectConclusion,
(select NEXT_INSPECT_DATE from idx_biz_jg_inspection_detection_info where "RECORD" = ibjui."RECORD" ORDER BY INSPECT_DATE DESC limit 1) nextInspectDate,
(select name from cb_data_dictionary where type = 'JYJL' and code = (select INSPECT_CONCLUSION from idx_biz_jg_inspection_detection_info where "RECORD" = ibjui."RECORD" ORDER BY INSPECT_DATE DESC limit 1)) inspectConclusion,
to_char((select NEXT_INSPECT_DATE from idx_biz_jg_inspection_detection_info where "RECORD" = ibjui."RECORD" ORDER BY INSPECT_DATE DESC limit 1),'YYYY-MM-DD') nextInspectDate,
(select USC_UNIT_NAME from idx_biz_jg_construction_info jci where ibjui.RECORD = jci.RECORD ORDER BY jci."USC_DATE" DESC limit 1) as uscUnitName,
(select USC_DATE from idx_biz_jg_construction_info jci where ibjui.RECORD = jci.RECORD ORDER BY jci."USC_DATE" DESC limit 1) as uscDate,
to_char((select USC_DATE from idx_biz_jg_construction_info jci where ibjui.RECORD = jci.RECORD ORDER BY jci."USC_DATE" DESC limit 1),'YYYY-MM-DD') as uscDate,
ibjdi."DESIGN_UNIT_NAME" AS designUnitName,
ibjui."USE_DATE" AS useDate,
to_char(ibjui."USE_DATE",'YYYY-MM-DD') AS useDate,
ibjui."RECORD" AS record
FROM idx_biz_jg_use_info ibjui
LEFT JOIN idx_biz_jg_tech_params_pipeline ibjtpp ON ibjui.RECORD = ibjtpp.RECORD
......@@ -261,8 +261,8 @@
ibjui.project_contraption_id = #{sequenceNbr}
) A
WHERE
A.inspectOrgName != NULL AND A.inspectOrgName != '' AND A.inspectConclusion!=NULL and A.inspectConclusion!=''
and A.nextInspectDate != NULL
A.inspectOrgName IS NOT NULL AND A.inspectOrgName != '' AND A.inspectConclusion IS NOT NULL and A.inspectConclusion!=''
and A.nextInspectDate IS NOT NULL
</select>
<select id="countContraptionInUseTimesForDeleteByIntoManagement" resultType="java.lang.Integer">
......
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