Commit fddc283a authored by hcing's avatar hcing

设备认领-管道认领

parent d105c9aa
...@@ -46,4 +46,11 @@ public class EquipClaimController extends BaseController { ...@@ -46,4 +46,11 @@ public class EquipClaimController extends BaseController {
return ResponseHelper.buildResponse(equipClaimService.pipeEquipPage(new JSONObject(map))); return ResponseHelper.buildResponse(equipClaimService.pipeEquipPage(new JSONObject(map)));
} }
@TycloudOperation(ApiLevel = UserType.AGENCY)
@PostMapping(value = "/pipeEquip/claim")
@ApiOperation(value = "认领-管道设备", httpMethod = "POST")
public ResponseModel<Object> pipeEquipClaim(@RequestBody Map<String, Object> map) {
return ResponseHelper.buildResponse(equipClaimService.pipeEquipClaim(new JSONObject(map)));
}
} }
...@@ -30,6 +30,7 @@ import org.typroject.tyboot.core.foundation.utils.ValidationUtil; ...@@ -30,6 +30,7 @@ import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.restful.doc.TycloudOperation; import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.restful.utils.ResponseHelper; import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel; import org.typroject.tyboot.core.restful.utils.ResponseModel;
import javax.annotation.Resource; import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.text.ParseException; import java.text.ParseException;
...@@ -147,8 +148,8 @@ public class JgUseRegistrationController extends BaseController { ...@@ -147,8 +148,8 @@ public class JgUseRegistrationController extends BaseController {
list.getRecords().forEach(x -> { list.getRecords().forEach(x -> {
x.put("companyType", info.getCompany().getCompanyType()); x.put("companyType", info.getCompany().getCompanyType());
x.put("regType", "1".equals(x.get("regType")) ? "历史登记": "2".equals(x.get("regType")) ? "特殊历史登记": "新增登记"); x.put("regType", "1".equals(x.get("regType")) ? "历史登记": "2".equals(x.get("regType")) ? "特殊历史登记": "新增登记");
if ("8000".equals(String.valueOf(x.get("equListCode"))) && !ValidationUtil.isEmpty(x.get("projectContraptionId"))){ if ("8000".equals(String.valueOf(x.get("equListCode"))) && !ValidationUtil.isEmpty(x.get("projectContraptionId"))) {
x.put("canVoided", jgProjectContraptionMapper.countContraptionInUseTimesForDeleteByIntoManagement(Long.parseLong((String) x.get("projectContraptionId"))) == 0); x.put("canVoided", jgProjectContraptionMapper.countContraptionInUseTimesForDeleteByIntoManagement(Objects.toString(x.get("projectContraptionId"))) == 0);
} else { } else {
x.put("canVoided", Optional.ofNullable(x.get("useRegistrationCode")).map(jgUseRegistrationServiceImpl::countUseTimesForInvalid) x.put("canVoided", Optional.ofNullable(x.get("useRegistrationCode")).map(jgUseRegistrationServiceImpl::countUseTimesForInvalid)
.orElse(true)); .orElse(true));
......
...@@ -18,4 +18,6 @@ public interface IIdxBizJgConstructionInfoService extends IService<IdxBizJgConst ...@@ -18,4 +18,6 @@ public interface IIdxBizJgConstructionInfoService extends IService<IdxBizJgConst
boolean saveOrUpdateBatch(List<IdxBizJgConstructionInfo> constructionInfoList); boolean saveOrUpdateBatch(List<IdxBizJgConstructionInfo> constructionInfoList);
IdxBizJgConstructionInfo queryNewestDetailByRecord(String record); IdxBizJgConstructionInfo queryNewestDetailByRecord(String record);
void updateBatchByRecord(List<IdxBizJgConstructionInfo> toUpdateConstructionInfoList);
} }
...@@ -18,4 +18,6 @@ public interface IIdxBizJgDesignInfoService { ...@@ -18,4 +18,6 @@ public interface IIdxBizJgDesignInfoService {
boolean saveOrUpdateBatch(List<IdxBizJgDesignInfo> designInfoList); boolean saveOrUpdateBatch(List<IdxBizJgDesignInfo> designInfoList);
IdxBizJgDesignInfo getOneData(String record); IdxBizJgDesignInfo getOneData(String record);
void updateBatchByRecord(List<IdxBizJgDesignInfo> toUpdateDesignInfoList);
} }
...@@ -18,4 +18,6 @@ public interface IIdxBizJgFactoryInfoService { ...@@ -18,4 +18,6 @@ public interface IIdxBizJgFactoryInfoService {
IdxBizJgFactoryInfo getOneData(String record); IdxBizJgFactoryInfo getOneData(String record);
boolean saveOrUpdateBatch(List<IdxBizJgFactoryInfo> factoryInfoList); boolean saveOrUpdateBatch(List<IdxBizJgFactoryInfo> factoryInfoList);
void updateBatchByRecord(List<IdxBizJgFactoryInfo> toUpdateFactoryInfoList);
} }
package com.yeejoin.amos.boot.module.jg.biz.service; package com.yeejoin.amos.boot.module.jg.biz.service;
import com.yeejoin.amos.boot.module.ymt.api.entity.IdxBizJgInspectionDetectionInfo; import com.yeejoin.amos.boot.module.ymt.api.entity.IdxBizJgInspectionDetectionInfo;
import java.util.List; import java.util.List;
/** /**
* 安全追溯-检验检测信息表接口类 * 安全追溯-检验检测信息表接口类
...@@ -27,4 +28,5 @@ public interface IIdxBizJgInspectionDetectionInfoService { ...@@ -27,4 +28,5 @@ public interface IIdxBizJgInspectionDetectionInfoService {
*/ */
List<IdxBizJgInspectionDetectionInfo> queryLastedGroupByInspectType(String record); List<IdxBizJgInspectionDetectionInfo> queryLastedGroupByInspectType(String record);
void updateBatchByRecord(List<IdxBizJgInspectionDetectionInfo> toUpdateInspectionDetectionInfoList);
} }
...@@ -2,6 +2,7 @@ package com.yeejoin.amos.boot.module.jg.biz.service; ...@@ -2,6 +2,7 @@ package com.yeejoin.amos.boot.module.jg.biz.service;
import com.yeejoin.amos.boot.module.ymt.api.entity.IdxBizJgOtherInfo; import com.yeejoin.amos.boot.module.ymt.api.entity.IdxBizJgOtherInfo;
import java.util.List; import java.util.List;
/** /**
...@@ -19,4 +20,6 @@ public interface IIdxBizJgOtherInfoService { ...@@ -19,4 +20,6 @@ public interface IIdxBizJgOtherInfoService {
void saveBatch(List<IdxBizJgOtherInfo> otherInfoList); void saveBatch(List<IdxBizJgOtherInfo> otherInfoList);
boolean saveOrUpdateBatch(List<IdxBizJgOtherInfo> otherInfoList); boolean saveOrUpdateBatch(List<IdxBizJgOtherInfo> otherInfoList);
void updateBatchByRecord(List<IdxBizJgOtherInfo> toUpdateOtherInfoList);
} }
...@@ -19,4 +19,6 @@ public interface IIdxBizJgSupervisionInfoService extends IService<IdxBizJgSuperv ...@@ -19,4 +19,6 @@ public interface IIdxBizJgSupervisionInfoService extends IService<IdxBizJgSuperv
IdxBizJgSupervisionInfo getOneData(String record); IdxBizJgSupervisionInfo getOneData(String record);
boolean saveOrUpdateBatch(List<IdxBizJgSupervisionInfo> supervisionInfoList); boolean saveOrUpdateBatch(List<IdxBizJgSupervisionInfo> supervisionInfoList);
void updateBatchByRecord(List<IdxBizJgSupervisionInfo> toUpdateSupervisionInfoList);
} }
...@@ -4,6 +4,8 @@ package com.yeejoin.amos.boot.module.jg.biz.service; ...@@ -4,6 +4,8 @@ package com.yeejoin.amos.boot.module.jg.biz.service;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.yeejoin.amos.boot.module.ymt.api.entity.IdxBizJgTechParamsPipeline; import com.yeejoin.amos.boot.module.ymt.api.entity.IdxBizJgTechParamsPipeline;
import java.util.List;
/** /**
* 安全追溯-压力管道接口类 * 安全追溯-压力管道接口类
* *
...@@ -15,4 +17,6 @@ public interface IIdxBizJgTechParamsPipelineService extends IService<IdxBizJgTec ...@@ -15,4 +17,6 @@ public interface IIdxBizJgTechParamsPipelineService extends IService<IdxBizJgTec
void saveOrUpdateData(IdxBizJgTechParamsPipeline pipeline); void saveOrUpdateData(IdxBizJgTechParamsPipeline pipeline);
IdxBizJgTechParamsPipeline getOneData(String record); IdxBizJgTechParamsPipeline getOneData(String record);
void updateBatchByRecord(List<IdxBizJgTechParamsPipeline> toUpdateParamsPipelineList);
} }
...@@ -23,4 +23,6 @@ public interface IIdxBizJgUseInfoService extends IService<IdxBizJgUseInfo> { ...@@ -23,4 +23,6 @@ public interface IIdxBizJgUseInfoService extends IService<IdxBizJgUseInfo> {
boolean saveBatch(List<IdxBizJgUseInfo> useInfoList); boolean saveBatch(List<IdxBizJgUseInfo> useInfoList);
boolean saveOrUpdateBatch(List<IdxBizJgUseInfo> useInfoList); boolean saveOrUpdateBatch(List<IdxBizJgUseInfo> useInfoList);
void updateBatchByRecord(List<IdxBizJgUseInfo> toUpdateUseInfoList);
} }
...@@ -4,6 +4,7 @@ import cn.hutool.core.date.DatePattern; ...@@ -4,6 +4,7 @@ import cn.hutool.core.date.DatePattern;
import cn.hutool.core.date.DateUtil; import cn.hutool.core.date.DateUtil;
import cn.hutool.core.map.MapUtil; import cn.hutool.core.map.MapUtil;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
...@@ -15,13 +16,15 @@ import com.yeejoin.amos.boot.biz.common.utils.DateUtils; ...@@ -15,13 +16,15 @@ import com.yeejoin.amos.boot.biz.common.utils.DateUtils;
import com.yeejoin.amos.boot.biz.common.utils.RedisKey; import com.yeejoin.amos.boot.biz.common.utils.RedisKey;
import com.yeejoin.amos.boot.biz.common.utils.RedisUtils; import com.yeejoin.amos.boot.biz.common.utils.RedisUtils;
import com.yeejoin.amos.boot.biz.common.utils.SnowflakeIdUtil; import com.yeejoin.amos.boot.biz.common.utils.SnowflakeIdUtil;
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.dto.EquipRequestParamsDto;
import com.yeejoin.amos.boot.module.jg.api.dto.JgResumeInfoDto; import com.yeejoin.amos.boot.module.jg.api.dto.JgResumeInfoDto;
import com.yeejoin.amos.boot.module.jg.api.entity.JgResumeInfo; import com.yeejoin.amos.boot.module.jg.api.entity.*;
import com.yeejoin.amos.boot.module.jg.api.entity.JgUseRegistration;
import com.yeejoin.amos.boot.module.jg.api.entity.JgUseRegistrationEq;
import com.yeejoin.amos.boot.module.jg.api.enums.BusinessTypeEnum; import com.yeejoin.amos.boot.module.jg.api.enums.BusinessTypeEnum;
import com.yeejoin.amos.boot.module.jg.api.enums.CompanyTypeEnum; import com.yeejoin.amos.boot.module.jg.api.enums.CompanyTypeEnum;
import com.yeejoin.amos.boot.module.jg.api.mapper.JgUseRegistrationEqMapper; import com.yeejoin.amos.boot.module.jg.api.mapper.JgUseRegistrationEqMapper;
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.feign.TzsServiceFeignClient;
import com.yeejoin.amos.boot.module.jg.biz.service.*; import com.yeejoin.amos.boot.module.jg.biz.service.*;
import com.yeejoin.amos.boot.module.ymt.api.entity.*; import com.yeejoin.amos.boot.module.ymt.api.entity.*;
...@@ -31,8 +34,10 @@ import com.yeejoin.amos.boot.module.ymt.api.enums.EquipmentClassifityEnum; ...@@ -31,8 +34,10 @@ import com.yeejoin.amos.boot.module.ymt.api.enums.EquipmentClassifityEnum;
import com.yeejoin.amos.boot.module.ymt.api.enums.FlowStatusEnum; import com.yeejoin.amos.boot.module.ymt.api.enums.FlowStatusEnum;
import com.yeejoin.amos.boot.module.ymt.api.mapper.*; import com.yeejoin.amos.boot.module.ymt.api.mapper.*;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel; import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import io.seata.spring.annotation.GlobalTransactional;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections.CollectionUtils;
import org.apache.lucene.queryparser.classic.QueryParser; import org.apache.lucene.queryparser.classic.QueryParser;
import org.elasticsearch.action.search.SearchRequest; import org.elasticsearch.action.search.SearchRequest;
import org.elasticsearch.action.search.SearchResponse; import org.elasticsearch.action.search.SearchResponse;
...@@ -51,9 +56,13 @@ import org.springframework.util.ObjectUtils; ...@@ -51,9 +56,13 @@ import org.springframework.util.ObjectUtils;
import org.springframework.util.StringUtils; import org.springframework.util.StringUtils;
import org.typroject.tyboot.core.foundation.context.RequestContext; import org.typroject.tyboot.core.foundation.context.RequestContext;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil; import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
import org.typroject.tyboot.core.restful.utils.ResponseModel; import org.typroject.tyboot.core.restful.utils.ResponseModel;
import java.io.IOException; import java.io.IOException;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.text.SimpleDateFormat;
import java.time.Instant; import java.time.Instant;
import java.time.ZoneId; import java.time.ZoneId;
import java.util.*; import java.util.*;
...@@ -92,9 +101,10 @@ public class EquipClaimServiceImpl { ...@@ -92,9 +101,10 @@ public class EquipClaimServiceImpl {
private static final String equ_list = "equ_list"; private static final String equ_list = "equ_list";
private static final String create_date = "create_date"; private static final String create_date = "create_date";
public static final String JG_HIS_XA_CLAIM = "jg_his_xa_claim"; public static final String JG_HIS_XA_CLAIM = "jg_his_xa_claim";
public static final String USE_REGISTRATION_CODE = "useRegistrationCode";
private final RedisUtils redisUtils; private final RedisUtils redisUtils;
private final ICommonService commonService; private final CommonServiceImpl commonService;
private final RestHighLevelClient restHighLevelClient; private final RestHighLevelClient restHighLevelClient;
private final JgResumeInfoServiceImpl jgResumeInfoService; private final JgResumeInfoServiceImpl jgResumeInfoService;
private final IdxBizJgProjectContraptionServiceImplService projectContraptionServiceImplService; private final IdxBizJgProjectContraptionServiceImplService projectContraptionServiceImplService;
...@@ -118,6 +128,16 @@ public class EquipClaimServiceImpl { ...@@ -118,6 +128,16 @@ public class EquipClaimServiceImpl {
private final IdxBizJgUseInfoMapper useInfoMapper; private final IdxBizJgUseInfoMapper useInfoMapper;
private final IdxBizJgOtherInfoMapper otherInfoMapper; private final IdxBizJgOtherInfoMapper otherInfoMapper;
private final SnowflakeIdUtil sequence; private final SnowflakeIdUtil sequence;
private final IIdxBizJgProjectContraptionService idxBizJgProjectContraptionService;
private final JgUseRegistrationManageServiceImpl jgUseRegistrationManageService;
private final JgVehicleInformationMapper jgVehicleInformationMapper;
private final IIdxBizJgTechParamsPipelineService iIdxBizJgTechParamsPipelineService;
private final ESEquipmentCategory esEquipmentCategory;
private final JgRegistrationHistoryServiceImpl jgRegistrationHistoryService;
private final JgUseRegistrationEqServiceImpl jgUseRegistrationEqServiceImpl;
private final JgCertificateChangeRecordServiceImpl certificateChangeRecordService;
private final JgCertificateChangeRecordEqServiceImpl certificateChangeRecordEqService;
private final DataDockServiceImpl dockService;
/** /**
...@@ -299,11 +319,12 @@ public class EquipClaimServiceImpl { ...@@ -299,11 +319,12 @@ public class EquipClaimServiceImpl {
* @return * @return
*/ */
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
@GlobalTransactional(rollbackFor = Exception.class)
public Object setEquipClaim(JSONObject json) { public Object setEquipClaim(JSONObject json) {
JSONObject equipInfo = JSON.parseObject(toJSONString(json.get(EQUIP_INFO_FORM_ID))); JSONObject equipInfo = JSON.parseObject(toJSONString(json.get(EQUIP_INFO_FORM_ID)));
JSONObject equipParams = JSON.parseObject(toJSONString(json.get(EQUIP_PARAMS_FORM_ID))); JSONObject equipParams = JSON.parseObject(toJSONString(json.get(EQUIP_PARAMS_FORM_ID)));
CompanyBo company = getSelectedOrgInfo().getCompany(); CompanyBo company = getSelectedOrgInfo().getCompany();
String useRegistrationCode = Objects.toString(equipInfo.get("useRegistrationCode"), null); String useRegistrationCode = Objects.toString(equipInfo.get(USE_REGISTRATION_CODE), null);
// 参数校验 - 同 设备录入的逻辑 // 参数校验 - 同 设备录入的逻辑
this.checkParams(new LinkedHashMap<>(equipInfo)); this.checkParams(new LinkedHashMap<>(equipInfo));
...@@ -313,7 +334,7 @@ public class EquipClaimServiceImpl { ...@@ -313,7 +334,7 @@ public class EquipClaimServiceImpl {
// 认领 更新设备信息 // 认领 更新设备信息
this.updateEquipInfoWithClaim(equipInfo, equipParams, false); this.updateEquipInfoWithClaim(equipInfo, equipParams, false);
// 添加设备的业务履历 // 添加设备的业务履历
this.addEquipResume(equipInfo, new JgUseRegistration()); this.addEquipResume(equipInfo, BusinessTypeEnum.JG_EQUIP_CLAIM, new JgUseRegistration());
} else { } else {
// 认领到自己单位下 -> 已纳管设备列表 , + 历史设备登记 // 认领到自己单位下 -> 已纳管设备列表 , + 历史设备登记
...@@ -322,7 +343,7 @@ public class EquipClaimServiceImpl { ...@@ -322,7 +343,7 @@ public class EquipClaimServiceImpl {
// 历史设备登记 // 历史设备登记
JgUseRegistration useRegistration = this.addHistoryEquipRegistration(equipInfo); JgUseRegistration useRegistration = this.addHistoryEquipRegistration(equipInfo);
// 添加设备的业务履历 // 添加设备的业务履历
this.addEquipResume(equipInfo, useRegistration); this.addEquipResume(equipInfo, BusinessTypeEnum.JG_EQUIP_CLAIM, useRegistration);
} }
// 添加es中的使用单位信息 // 添加es中的使用单位信息
HashMap<String, Map<String, Object>> objMap = new HashMap<>(); HashMap<String, Map<String, Object>> objMap = new HashMap<>();
...@@ -335,7 +356,7 @@ public class EquipClaimServiceImpl { ...@@ -335,7 +356,7 @@ public class EquipClaimServiceImpl {
} }
/** /**
* 历史设备登记 * 台套历史设备登记
* *
* @param equipInfo * @param equipInfo
* @return * @return
...@@ -389,51 +410,7 @@ public class EquipClaimServiceImpl { ...@@ -389,51 +410,7 @@ public class EquipClaimServiceImpl {
if (!ObjectUtils.isEmpty(equipInfo.get("isXixian"))) { if (!ObjectUtils.isEmpty(equipInfo.get("isXixian"))) {
jgUseRegistration.setIsXixian(Objects.toString(equipInfo.get("isXixian"), null)); jgUseRegistration.setIsXixian(Objects.toString(equipInfo.get("isXixian"), null));
} }
// 使用地点 CityCountyStreet result = getCityCountStreet(equipInfo, jgUseRegistration);
String useCityName = "";
String useCountyName = "";
String useStreetName = "";
// 市
List<LinkedHashMap> city = (List<LinkedHashMap>) redisUtils.get("CITY");
// 区
List<LinkedHashMap> region = (List<LinkedHashMap>) redisUtils.get("REGION");
// 街道
List<LinkedHashMap> street = (List<LinkedHashMap>) redisUtils.get("STREET");
jgUseRegistration.setUseAddress("陕西省");
// 城市
if (!ObjectUtils.isEmpty(equipInfo.get("city")) && !ObjectUtils.isEmpty(city)) {
AtomicReference<String> atomicUseCity = new AtomicReference<>(useCityName);
city.forEach(item -> {
if (Objects.toString(item.get("regionCode")).equals(Objects.toString(equipInfo.get("city")))) {
atomicUseCity.set("" + item.get("regionName"));
jgUseRegistration.setUseAddress(jgUseRegistration.getUseAddress() + item.get("regionName"));
}
});
useCityName = atomicUseCity.get();
}
// 区县
if (!ObjectUtils.isEmpty(equipInfo.get("county")) && !ObjectUtils.isEmpty(city)) {
AtomicReference<String> atomicUseCounty = new AtomicReference<>(useCountyName);
region.forEach(item -> {
if (Objects.toString(item.get("regionCode")).equals(Objects.toString(equipInfo.get("county")))) {
atomicUseCounty.set("" + item.get("regionName"));
jgUseRegistration.setUseAddress(jgUseRegistration.getUseAddress() + item.get("regionName"));
}
});
useCountyName = atomicUseCounty.get();
}
// 街道
if (!ObjectUtils.isEmpty(equipInfo.get("factoryUseSiteStreet")) && !ObjectUtils.isEmpty(city)) {
JSONObject finalMap2 = equipInfo;
AtomicReference<String> atomicUseStreet = new AtomicReference<>(useStreetName);
street.forEach(item -> {
if (Objects.toString(item.get("regionCode")).equals(Objects.toString(finalMap2.get("factoryUseSiteStreet")))) {
atomicUseStreet.set("" + item.get("regionName"));
jgUseRegistration.setUseAddress(jgUseRegistration.getUseAddress() + item.get("regionName"));
}
});
useStreetName = atomicUseStreet.get();
}
jgUseRegistration.setUseAddress(jgUseRegistration.getUseAddress() + equipInfo.get("address")); jgUseRegistration.setUseAddress(jgUseRegistration.getUseAddress() + equipInfo.get("address"));
...@@ -530,11 +507,11 @@ public class EquipClaimServiceImpl { ...@@ -530,11 +507,11 @@ public class EquipClaimServiceImpl {
useInfo.setProvinceName("陕西省"); useInfo.setProvinceName("陕西省");
useInfo.setCity(Objects.toString(equipInfo.get("city"), null)); useInfo.setCity(Objects.toString(equipInfo.get("city"), null));
useInfo.setUseInnerCode(Objects.toString(equipInfo.get("useInnerCode"), null)); useInfo.setUseInnerCode(Objects.toString(equipInfo.get("useInnerCode"), null));
useInfo.setCityName(useCityName); useInfo.setCityName(result.useCityName);
useInfo.setCounty(Objects.toString(equipInfo.get("county"), null)); useInfo.setCounty(Objects.toString(equipInfo.get("county"), null));
useInfo.setCountyName(useCountyName); useInfo.setCountyName(result.useCountyName);
useInfo.setFactoryUseSiteStreet(Objects.toString(equipInfo.get("factoryUseSiteStreet"), null)); useInfo.setFactoryUseSiteStreet(Objects.toString(equipInfo.get("factoryUseSiteStreet"), null));
useInfo.setStreetName(useStreetName); useInfo.setStreetName(result.useStreetName);
useInfo.setAddress(Objects.toString(equipInfo.get("address"), null)); useInfo.setAddress(Objects.toString(equipInfo.get("address"), null));
useInfo.setIsNotXiXian(Objects.toString(equipInfo.get("isXixian"), null)); useInfo.setIsNotXiXian(Objects.toString(equipInfo.get("isXixian"), null));
useInfo.setEstateUnitCreditCode(Optional.ofNullable(equipInfo.get("estateUnitName")) useInfo.setEstateUnitCreditCode(Optional.ofNullable(equipInfo.get("estateUnitName"))
...@@ -605,23 +582,85 @@ public class EquipClaimServiceImpl { ...@@ -605,23 +582,85 @@ public class EquipClaimServiceImpl {
jgRelationEquip.setEquId(record); jgRelationEquip.setEquId(record);
jgRelationEquip.setEquipTransferId(jgUseRegistration.getSequenceNbr().toString()); jgRelationEquip.setEquipTransferId(jgUseRegistration.getSequenceNbr().toString());
jgRelationEquipMapper.insert(jgRelationEquip); jgRelationEquipMapper.insert(jgRelationEquip);
// todo 流水
return useRegistrationService.getBaseMapper().selectById(jgUseRegistration.getSequenceNbr()); return useRegistrationService.getBaseMapper().selectById(jgUseRegistration.getSequenceNbr());
} }
private CityCountyStreet getCityCountStreet(JSONObject equipInfo, JgUseRegistration jgUseRegistration) {
// 使用地点
String useCityName = "";
String useCountyName = "";
String useStreetName = "";
// 市
List<LinkedHashMap> city = (List<LinkedHashMap>) redisUtils.get("CITY");
// 区
List<LinkedHashMap> region = (List<LinkedHashMap>) redisUtils.get("REGION");
// 街道
List<LinkedHashMap> street = (List<LinkedHashMap>) redisUtils.get("STREET");
jgUseRegistration.setUseAddress("陕西省");
// 城市
if (!ObjectUtils.isEmpty(equipInfo.get("city")) && !ObjectUtils.isEmpty(city)) {
AtomicReference<String> atomicUseCity = new AtomicReference<>(useCityName);
city.forEach(item -> {
if (Objects.toString(item.get("regionCode")).equals(Objects.toString(equipInfo.get("city")))) {
atomicUseCity.set("" + item.get("regionName"));
jgUseRegistration.setUseAddress(jgUseRegistration.getUseAddress() + item.get("regionName"));
}
});
useCityName = atomicUseCity.get();
}
// 区县
if (!ObjectUtils.isEmpty(equipInfo.get("county")) && !ObjectUtils.isEmpty(city)) {
AtomicReference<String> atomicUseCounty = new AtomicReference<>(useCountyName);
region.forEach(item -> {
if (Objects.toString(item.get("regionCode")).equals(Objects.toString(equipInfo.get("county")))) {
atomicUseCounty.set("" + item.get("regionName"));
jgUseRegistration.setUseAddress(jgUseRegistration.getUseAddress() + item.get("regionName"));
}
});
useCountyName = atomicUseCounty.get();
}
// 街道
if (!ObjectUtils.isEmpty(equipInfo.get("factoryUseSiteStreet")) && !ObjectUtils.isEmpty(city)) {
JSONObject finalMap2 = equipInfo;
AtomicReference<String> atomicUseStreet = new AtomicReference<>(useStreetName);
street.forEach(item -> {
if (Objects.toString(item.get("regionCode")).equals(Objects.toString(finalMap2.get("factoryUseSiteStreet")))) {
atomicUseStreet.set("" + item.get("regionName"));
jgUseRegistration.setUseAddress(jgUseRegistration.getUseAddress() + item.get("regionName"));
}
});
useStreetName = atomicUseStreet.get();
}
return new CityCountyStreet(useCityName, useCountyName, useStreetName);
}
public static class CityCountyStreet {
public final String useCityName;
public final String useCountyName;
public final String useStreetName;
public CityCountyStreet(String useCityName, String useCountyName, String useStreetName) {
this.useCityName = useCityName;
this.useCountyName = useCountyName;
this.useStreetName = useStreetName;
}
}
/** /**
* 添加设备的业务履历 * 添加设备的业务履历
*/ */
public void addEquipResume(JSONObject equipInfo, JgUseRegistration useRegistration) { public void addEquipResume(JSONObject equipInfo, BusinessTypeEnum businessTypeEnum, JgUseRegistration useRegistration) {
String record = (String) equipInfo.get(RECORD); String record = (String) equipInfo.get(RECORD);
JgResumeInfoDto resumeInfoDto = JgResumeInfoDto.builder() JgResumeInfoDto resumeInfoDto = JgResumeInfoDto.builder()
.applyNo(null) .applyNo(null)
.businessType(BusinessTypeEnum.JG_EQUIP_CLAIM.getName()) .businessType(businessTypeEnum.getName())
.businessId(record) .businessId(record)
.equId(record) .equId(record)
.approvalUnit(useRegistration.getReceiveOrgName()) .approvalUnit(useRegistration.getReceiveOrgName())
.approvalUnitCode(useRegistration.getReceiveOrgName()) .approvalUnitCode(useRegistration.getReceiveOrgName())
.status("正常") .status("正常")
.changeContent(BusinessTypeEnum.JG_EQUIP_CLAIM.getName() + "业务") .changeContent(businessTypeEnum.getName() + "业务")
.routePath(null) .routePath(null)
.build(); .build();
JgResumeInfo resumeInfo = new JgResumeInfo(); JgResumeInfo resumeInfo = new JgResumeInfo();
...@@ -635,6 +674,8 @@ public class EquipClaimServiceImpl { ...@@ -635,6 +674,8 @@ public class EquipClaimServiceImpl {
public void checkParams(LinkedHashMap equipInfo) { public void checkParams(LinkedHashMap equipInfo) {
String dataSource = (String) equipInfo.get(DATA_SOURCE); String dataSource = (String) equipInfo.get(DATA_SOURCE);
String record = (String) equipInfo.get(RECORD); String record = (String) equipInfo.get(RECORD);
// 使用登记证校验
jgRegisterInfoService.checkUseRegistrationCode(equipInfo);
// 设备代码 字段的唯一性校验 // 设备代码 字段的唯一性校验
jgRegisterInfoService.checkEquCodeUniqueness(equipInfo); jgRegisterInfoService.checkEquCodeUniqueness(equipInfo);
// 车用气瓶业务里面的 产品编号 校验唯一性(产品编号在车用气瓶范围内全局唯一) // 车用气瓶业务里面的 产品编号 校验唯一性(产品编号在车用气瓶范围内全局唯一)
...@@ -733,4 +774,607 @@ public class EquipClaimServiceImpl { ...@@ -733,4 +774,607 @@ public class EquipClaimServiceImpl {
// 更新es // 更新es
jgRegisterInfoService.checkEsData(record); jgRegisterInfoService.checkEsData(record);
} }
/**
* 认领-管道设备
*
* @param json
* @return result
*/
@Transactional(rollbackFor = Exception.class)
@GlobalTransactional(rollbackFor = Exception.class)
public Object pipeEquipClaim(JSONObject json) {
JSONObject equipInfo = JSON.parseObject(toJSONString(json.get(EQUIP_INFO_FORM_ID)));
// 校验
this.checkPipeParams(equipInfo);
// 认领 工程装置及管道设备信息 及历史登记
this.updateConProEquipInfoWithClaim(equipInfo);
return Boolean.TRUE;
}
/**
* 历史管道登记
*
* @param equipInfo
* @return
*/
public JgUseRegistration addHistoryPipeRegistration(JSONObject equipInfo) {
return null;
}
private <T> List<T> initializeList() {
return new ArrayList<>(15);
}
/**
* 工程装置及管道设备信息
*
* @param equipInfo
*/
public void updateConProEquipInfoWithClaim(JSONObject equipInfo) {
CompanyBo company = getSelectedOrgInfo().getCompany();
String proConNo = equipInfo.getString("PROJECT_CONTRAPTION_NO");
IdxBizJgProjectContraption oldProCon = idxBizJgProjectContraptionService.getBaseMapper().selectOne(new LambdaQueryWrapper<IdxBizJgProjectContraption>()
.eq(IdxBizJgProjectContraption::getUseUnitCreditCode, company.getCompanyCode())
.eq(IdxBizJgProjectContraption::getProjectContraptionNo, proConNo)
.eq(IdxBizJgProjectContraption::getIsDelete, Boolean.FALSE)
.isNull(IdxBizJgProjectContraption::getProjectContraptionParentId));
boolean hasThisProCon = !ObjectUtils.isEmpty(oldProCon);
String equListName = jgVehicleInformationMapper.getEquCategoryNameByCode((String) equipInfo.get("EQU_LIST"));
String equCategoryName = jgVehicleInformationMapper.getEquCategoryNameByCode((String) equipInfo.get("EQU_CATEGORY"));
String equDefineName = jgVehicleInformationMapper.getEquCategoryNameByCode((String) equipInfo.get("EQU_DEFINE"));
// 1. 本单位下无该工程装置
if (!hasThisProCon) {
List<Map<String, Object>> pipelineList = (List<Map<String, Object>>) equipInfo.get(PIPELINE_LIST);
// 工程装置
IdxBizJgProjectContraption projectContraption = JSON.parseObject(toJSONString(equipInfo), IdxBizJgProjectContraption.class);
projectContraption.setDataSource(JG_HIS_XA_CLAIM);
projectContraption.setIsIntoManagement(false);
projectContraption.setProvinceName("陕西省");
CityCountyStreet result = getCityCountStreet(equipInfo, new JgUseRegistration());
projectContraption.setCityName(result.useCityName);
projectContraption.setCountyName(result.useCountyName);
projectContraption.setStreetName(result.useStreetName);
projectContraption.setEquListName(equListName);
projectContraption.setEquCategoryName(equCategoryName);
projectContraption.setEquDefineName(equDefineName);
projectContraption.setPipelineLength(
BigDecimal.valueOf(pipelineList.stream()
.map(pipeline -> pipeline.get("pipeLength"))
.filter(Objects::nonNull)
.mapToDouble(pipeLength -> Double.parseDouble(String.valueOf(pipeLength)))
.sum())
.setScale(2, RoundingMode.HALF_UP)
.doubleValue()
);
projectContraption.setUseUnitName(company.getCompanyName());
projectContraption.setUseUnitCreditCode(company.getCompanyCode());
projectContraption.setIsFirstMerge(false);
projectContraption.setCreateDate(new Date());
idxBizJgProjectContraptionService.updateById(projectContraption);
// 设备
this.addOrUpdatePipeEquip(equipInfo, false);
// 历史管道登记
if (!ObjectUtils.isEmpty(equipInfo.get(USE_REGISTRATION_CODE))) {
this.pipeHistoryRegister(equipInfo);
}
}
// 2. 本单位下有该工程装置
if (hasThisProCon) {
boolean hasRegister = !ObjectUtils.isEmpty(oldProCon.getUseRegistrationCode());
// 2.1 已经有的工程装置【未登记】
// 更新管道长度
List<Map<String, Object>> pipelineList = (List<Map<String, Object>>) equipInfo.get(PIPELINE_LIST);
BigDecimal oldPipeLengthBd = BigDecimal.valueOf(oldProCon.getPipelineLength());
BigDecimal newPipeLengthBd = BigDecimal.valueOf(pipelineList.stream()
.map(pipeline -> pipeline.get("pipeLength"))
.filter(Objects::nonNull)
.mapToDouble(pipeLength -> {
if (pipeLength instanceof Number) {
return ((Number) pipeLength).doubleValue();
}
return Double.parseDouble(String.valueOf(pipeLength));
})
.sum())
.setScale(2, RoundingMode.HALF_UP); // 保持为 BigDecimal
BigDecimal totalPipeLengthBd = oldPipeLengthBd.add(newPipeLengthBd);
oldProCon.setPipelineLength(totalPipeLengthBd.doubleValue());
// 更新设备
this.addOrUpdatePipeEquip(equipInfo, true);
// 2.1 已经有的工程装置【已登记】
String useRegistrationCode1 = oldProCon.getUseRegistrationCode();
String useRegistrationCode2 = Objects.toString(equipInfo.get(USE_REGISTRATION_CODE), null);
if (hasRegister && useRegistrationCode1.equals(useRegistrationCode2)) {
// 更新原使用登记
JgUseRegistration useRegistration = useRegistrationService.lambdaQuery().eq(JgUseRegistration::getUseRegistrationCode, useRegistrationCode1).eq(JgUseRegistration::getIsDelete, Boolean.FALSE).ne(JgUseRegistration::getStatus, FlowStatusEnum.TO_BE_DISCARD.getName()).one();
if (!ObjectUtils.isEmpty(useRegistration.getSequenceNbr())) {
// 更新历史表中的数据 changeData中的【管道设备】equipmentLists 【管道长度】pipelineLength
JgRegistrationHistory history = jgRegistrationHistoryService.lambdaQuery().select(JgRegistrationHistory::getSequenceNbr, JgRegistrationHistory::getChangeData).eq(JgRegistrationHistory::getCurrentDocumentId, useRegistration.getSequenceNbr().toString()).one();
Optional.ofNullable(history).ifPresent(his -> {
JSONObject changeDataJSON = JSON.parseObject(toJSONString(his.getChangeData()));
JSONArray equipmentLists = JSON.parseArray(toJSONString(changeDataJSON.get("equipmentLists")));
equipmentLists.add(pipelineList);
changeDataJSON.put("pipelineLength", totalPipeLengthBd.doubleValue());
his.setChangeData(JSON.toJSONString(changeDataJSON));
jgRegistrationHistoryService.updateById(his);
});
}
}
}
}
/**
* 管道历史登记
*
* @param equipInfo
*/
public void pipeHistoryRegister(JSONObject equipInfo) {
CompanyBo company = getSelectedOrgInfo().getCompany();
AgencyUserModel userModel = getSelectedOrgInfo().getUserModel();
String proConName = equipInfo.getString("PROJECT_CONTRAPTION");
String proConNo = equipInfo.getString("PROJECT_CONTRAPTION_NO");
List<Map<String, Object>> pipelineList = (List<Map<String, Object>>) equipInfo.get(PIPELINE_LIST);
// 使用登记表 eq关系表
ResponseModel<List<String>> listResponseModel = tzsServiceFeignClient.applicationFormCode(ApplicationFormTypeEnum.SYDJ.getCode(), 1);
String applyNo = listResponseModel.getResult().get(0);
Long useRegseq = sequence.nextId();
JgUseRegistration useReg = JSON.parseObject(toJSONString(equipInfo), JgUseRegistration.class);
String[] splitMaintenanceUnitCode = Objects.toString(equipInfo.getString("receiveOrgCode"), "").split("_");
String[] splitOrgBranchCode = Objects.toString(equipInfo.getString("orgBranchCode"), "").split("_");
useReg.setUseUnitCreditCode(company.getCompanyCode())
.setUseUnitName(company.getCompanyName())
.setApplyNo(applyNo)
.setAuditStatus(FlowStatusEnum.TO_BE_FINISHED.getName())
.setStatus(FlowStatusEnum.TO_BE_FINISHED.getName())
.setReceiveOrgName(splitMaintenanceUnitCode[1])
.setAuditPassDate(new Date()).setRegType("1")
.setRegDate(new Date())
.setUseRegistrationCode(equipInfo.get(USE_REGISTRATION_CODE).toString())
.setReceiveOrgCode(splitMaintenanceUnitCode[0])
.setReceiveCompanyCode(splitMaintenanceUnitCode[0])
.setUseAddress("")
.setManageType("unit")
.setCreateDate(new Date())
.setCreateUserId(userModel.getUserId())
.setCreateUserName(userModel.getRealName())
.setProjectContraptionId(proConNo)
.setProjectContraption(proConName)
.setSupervisionOrgCode(splitOrgBranchCode[0])
.setRegDate(new Date());
useReg.setSequenceNbr(useRegseq);
useRegistrationService.save(useReg);
pipelineList.forEach(pipe -> {
JgUseRegistrationEq useRegEq = new JgUseRegistrationEq();
useRegEq.setEquipTransferId(String.valueOf(useReg.getSequenceNbr()));
useRegEq.setRecDate(new Date());
useRegEq.setEquId(pipe.get(record).toString());
useRegEq.setRecUserId(userModel.getUserId());
useRegEq.setRecUserName(userModel.getRealName());
jgUseRegistrationEqServiceImpl.save(useRegEq);
});
// 历史表
// JSONObject changeData = getJgUseRegistrationChangeData(paramsDto, records, applyNo);
JgRegistrationHistory registrationHistory = JgRegistrationHistory.builder()
.registrationClass("使用登记")
.changeData(JSON.toJSONString(equipInfo))
.status("history")
.currentDocumentId(String.valueOf(useRegseq))
.build();
registrationHistory.setRecDate(new Date());
registrationHistory.setCreateDate(new Date());
registrationHistory.setRecUserId(userModel.getUserId());
registrationHistory.setCreateUserId(userModel.getUserId());
registrationHistory.setRecUserName(userModel.getRealName());
jgRegistrationHistoryService.save(registrationHistory);
String routePath = dockService.buildTaskModel(useReg, new EquipRequestParamsDto());
jgResumeInfoService.createWithModel(JgResumeInfoDto.builder()
.applyNo(useReg.getApplyNo())
.businessType(BusinessTypeEnum.JG_HISTORY_USAGE_REGISTRATION.getName())
.businessId(useReg.getSequenceNbr() + "")
.equId(useReg.getProjectContraptionId())
.approvalUnit(useReg.getReceiveOrgName())
.approvalUnitCode(useReg.getReceiveOrgCode())
.status("正常")
.routePath(routePath)
.changeContent(BusinessTypeEnum.JG_HISTORY_USAGE_REGISTRATION.getName() + "业务办理")
.build());
// 证管理表
String equListName = jgVehicleInformationMapper.getEquCategoryNameByCode((String) equipInfo.get("EQU_LIST"));
String equCategoryName = jgVehicleInformationMapper.getEquCategoryNameByCode((String) equipInfo.get("EQU_CATEGORY"));
String equDefineName = jgVehicleInformationMapper.getEquCategoryNameByCode((String) equipInfo.get("EQU_DEFINE"));
Map<String, String> equType = new HashMap<>();
equType.put("equListCode", equipInfo.get("EQU_LIST").toString());
equType.put("equCategoryCode", equipInfo.get("EQU_CATEGORY").toString());
JgUseRegistrationManage registrationManage = JgUseRegistrationManage.builder()
.equListCode(equipInfo.get("EQU_LIST").toString())
.equList(equListName)
.equCategoryCode(equipInfo.get("EQU_CATEGORY").toString())
.equCategory(equCategoryName)
.equDefineCode(equipInfo.get("EQU_DEFINE").toString())
.equDefine(equDefineName)
.useUnitName(company.getCompanyName())
.useUnitCreditCode(company.getCompanyCode())
.applyNo(useReg.getApplyNo())
.receiveCompanyCode(splitMaintenanceUnitCode[0])
.receiveOrgName(splitMaintenanceUnitCode[1])
.auditPassDate(new Date())
.useRegistrationCode(equipInfo.get(USE_REGISTRATION_CODE).toString())
.certificateNo(commonService.generateCertificateNo(equType, new Date(), useReg.getReceiveOrgCode()))
.regType(BusinessTypeEnum.JG_HISTORY_USAGE_REGISTRATION.getName())
.certificateStatus("已登记")
.regDate(new Date())
.createDate(new Date())
.createUserId(userModel.getUserId())
.useUnitAddress(company.getAddress())
.manageType("unit")
.isScrap("0")
.version(1)
.superviseOrgCode(splitOrgBranchCode[0])
.superviseOrgName(splitOrgBranchCode[1])
.build();
jgUseRegistrationManageService.save(registrationManage);
// 流水表
Long changeRecordSeq = sequence.nextId();
JgCertificateChangeRecord changeRecord = new JgCertificateChangeRecord()
.setApplyNo(useReg.getApplyNo())
.setReceiveOrgName(useReg.getReceiveOrgName())
.setAuditPassDate(new Date())
.setRegType(BusinessTypeEnum.JG_USAGE_REGISTRATION.getName())
.setRegDate(useReg.getCreateDate())
.setChangeContent(company.getCompanyName() + "的" + userModel.getRealName() + "办理了【" + "历史设备登记" + "】," +
"单号【" + useReg.getApplyNo() + "】,办理日期" + new SimpleDateFormat("yyyy年MM月dd日").format(new Date()))
.setUseRegistrationCode(useReg.getUseRegistrationCode())
.setReceiveCompanyCode(useReg.getReceiveCompanyOrgCode())
.setCertificateNo(registrationManage.getCertificateNo())
.setUseUnitCreditCode(useReg.getUseUnitCreditCode())
.setUseUnitName(useReg.getUseUnitName())
.setEquCategory(equCategoryName)
.setCreateDate(new Date());
changeRecord.setSequenceNbr(changeRecordSeq);
certificateChangeRecordService.save(changeRecord);
pipelineList.forEach(pipe -> {
JgCertificateChangeRecordEq changeRecordEq = new JgCertificateChangeRecordEq();
changeRecordEq.setChangeRecordId(String.valueOf(changeRecordSeq));
changeRecordEq.setEquId(pipe.get(record).toString());
certificateChangeRecordEqService.save(changeRecordEq);
});
}
// private JSONObject getJgUseRegistrationChangeData(EquipRequestParamsDto paramsDto, List<String> records, String spplyNo) {
// String record = Optional.ofNullable(records.get(0)).orElse("");
// JSONObject jsonObject = new JSONObject();
// jsonObject.put("receiveOrgCode", paramsDto.getReceiveOrgCode() + "_" + paramsDto.getReceiveOrgName());
// jsonObject.put("status", FlowStatusEnum.TO_BE_FINISHED.getName());
// jsonObject.put("applyNo", spplyNo);
// jsonObject.remove("submit");
// jsonObject.remove("instanceId");
// if (!ObjectUtils.isEmpty(jsonObject.get("factoryUseSiteStreet"))) {
// jsonObject.put("factoryUseSiteStreet", String.valueOf(Long.valueOf(jsonObject.get("factoryUseSiteStreet").toString())));
// }
// IdxBizJgProjectContraption projectContraption = idxBizJgProjectContraptionService.getById(paramsDto.getProjectContraptionSeq());
// jsonObject.put("pipelineLength", projectContraption.getPipelineLength());
// jsonObject.put("useUnitCreditCode", paramsDto.getCompanyCode());
// jsonObject.put("useUnitName", paramsDto.getCompanyName());
// IdxBizJgConstructionInfo constructionInfo = idxBizJgConstructionInfoService.lambdaQuery().eq(IdxBizJgConstructionInfo::getRecord, record).orderByDesc(IdxBizJgConstructionInfo::getRecDate).one();
// jsonObject.put("uscUnitCreditCode", constructionInfo.getUscUnitCreditCode());
// jsonObject.put("uscUnitName", constructionInfo.getUscUnitName());
// IdxBizJgInspectionDetectionInfo inspectionDetectionInfo = idxBizJgInspectionDetectionInfoService.lambdaQuery().eq(IdxBizJgInspectionDetectionInfo::getRecord, record).orderByDesc(IdxBizJgInspectionDetectionInfo::getRecDate).one();
// JSONObject inspectionDetectionInfoJO = (JSONObject) JSON.toJSON(inspectionDetectionInfo);
// jsonObject.putAll(inspectionDetectionInfoJO);
// SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
// jsonObject.put("inspectDate", Optional.ofNullable(inspectionDetectionInfo.getInspectDate())
// .map(sdf::format)
// .orElse(null));
// jsonObject.put("nextInspectDate", Optional.ofNullable(inspectionDetectionInfo.getNextInspectDate())
// .map(sdf::format)
// .orElse(null));
// jsonObject.put("orgBranchCode", paramsDto.getOrgBranchCode() + "_" + paramsDto.getOrgBranchName());
// jsonObject.put("projectContraption", projectContraption.getProjectContraption());
// jsonObject.put("projectContraptionNo", projectContraption.getProjectContraptionNo());
// jsonObject.put("equipmentLists", jgUseRegistrationServiceImpl.getBaseMapper().queryForUnitPipelineEquipment(records));
// jsonObject.put("useRegistrationCode", paramsDto.getUseOrgCode());
// // 转化 附件 字段
// dockService.convertStringToJsonObject(jsonObject, JgUseRegistrationServiceImpl.jsonFields);
// return jsonObject;
// }
public void addOrUpdatePipeEquip(JSONObject equipInfo, Boolean isIntoManagement) {
Date nowDate = new Date();
List<Map<String, Object>> pipelineList = (List<Map<String, Object>>) equipInfo.get(PIPELINE_LIST);
CompanyBo company = getSelectedOrgInfo().getCompany();
String proConName = equipInfo.getString("PROJECT_CONTRAPTION");
String proConNo = equipInfo.getString("PROJECT_CONTRAPTION_NO");
String equListName = jgVehicleInformationMapper.getEquCategoryNameByCode((String) equipInfo.get("EQU_LIST"));
String equCategoryName = jgVehicleInformationMapper.getEquCategoryNameByCode((String) equipInfo.get("EQU_CATEGORY"));
List<IdxBizJgUseInfo> toUpdateUseInfoList = initializeList();
List<IdxBizJgUseInfo> toAddUseInfoList = initializeList();
List<IdxBizJgDesignInfo> toUpdateDesignInfoList = initializeList();
List<IdxBizJgDesignInfo> toAddDesignInfoList = initializeList();
List<IdxBizJgFactoryInfo> toUpdateFactoryInfoList = initializeList();
List<IdxBizJgFactoryInfo> toAddFactoryInfoList = initializeList();
List<IdxBizJgConstructionInfo> toUpdateConstructionInfoList = initializeList();
List<IdxBizJgConstructionInfo> toAddConstructionInfoList = initializeList();
List<IdxBizJgRegisterInfo> toUpdateRegisterInfoList = initializeList();
List<IdxBizJgRegisterInfo> toAddRegisterInfoList = initializeList();
List<IdxBizJgSupervisionInfo> toUpdateSupervisionInfoList = initializeList();
List<IdxBizJgSupervisionInfo> toAddSupervisionInfoList = initializeList();
List<IdxBizJgOtherInfo> toUpdateOtherInfoList = initializeList();
List<IdxBizJgOtherInfo> toAddOtherInfoList = initializeList();
List<IdxBizJgInspectionDetectionInfo> toUpdateInspectionDetectionInfoList = initializeList();
List<IdxBizJgInspectionDetectionInfo> toAddInspectionDetectionInfoList = initializeList();
List<IdxBizJgTechParamsPipeline> toUpdateParamsPipelineList = initializeList();
List<IdxBizJgTechParamsPipeline> toAddParamsPipelineList = initializeList();
List<ESEquipmentCategoryDto> esEquipmentCategoryList = initializeList();
// 设备信息
for (Map<String, Object> pipeline : pipelineList) {
boolean hasRecord = !ObjectUtils.isEmpty(pipeline.get("record"));
String record = hasRecord ? pipeline.get("record").toString() : UUID.randomUUID().toString();
// 更新时工业管道(8300)检验检测信息
IdxBizJgInspectionDetectionInfo inspectionDetectionInfo = JSON.parseObject(toJSONString(pipeline), IdxBizJgInspectionDetectionInfo.class);
if (!ValidationUtil.isEmpty(inspectionDetectionInfo)) {
List<Map<String, Object>> inspectionAndTestingInstitutions = commonService.getUnitListByType("inspection", "gasCylindersForCars", false);
Optional<Map<String, Object>> optional = inspectionAndTestingInstitutions.stream().filter(x -> x.get("useCode").equals(inspectionDetectionInfo.getInspectOrgCode())).findFirst();
Map<String, Object> mapOrDefault = optional.orElse(Collections.emptyMap());
inspectionDetectionInfo.setInspectOrgName((String) mapOrDefault.getOrDefault("useUnit", inspectionDetectionInfo.getInspectOrgName()));
inspectionDetectionInfo.setRecord(record);
inspectionDetectionInfo.setRecDate(nowDate);
inspectionDetectionInfo.setSequenceNbr(null);
if (inspectionDetectionInfo.getNextInspectDate() != null) {
inspectionDetectionInfo.setNextInspectDate(DateUtil.parse(DateUtil.format(inspectionDetectionInfo.getNextInspectDate(), DatePattern.NORM_DATE_PATTERN)));
}
if (hasRecord) {
toUpdateInspectionDetectionInfoList.add(inspectionDetectionInfo);
} else {
toAddInspectionDetectionInfoList.add(inspectionDetectionInfo);
}
}
// 使用信息
IdxBizJgUseInfo useInfo = JSON.parseObject(toJSONString(pipeline), IdxBizJgUseInfo.class);
// 使用信息
useInfo.setRecord(record);
useInfo.setSequenceNbr(null);
useInfo.setRecDate(nowDate);
useInfo.setCreateDate(nowDate);
useInfo.setDataSource(JG_HIS_XA_CLAIM);
useInfo.setIsIntoManagement(isIntoManagement);
useInfo.setUseUnitCreditCode(company.getCompanyCode());
useInfo.setUseUnitName(company.getCompanyName());
useInfo.setEquState("");
useInfo.setProjectContraption(proConName);
useInfo.setProjectContraptionId(proConNo);
if (hasRecord) {
toUpdateUseInfoList.add(useInfo);
} else {
toAddUseInfoList.add(useInfo);
}
// 设计信息
IdxBizJgDesignInfo designInfo = JSON.parseObject(toJSONString(pipeline), IdxBizJgDesignInfo.class);
designInfo.setRecord(record);
designInfo.setRecDate(nowDate);
designInfo.setSequenceNbr(null);
if (hasRecord) {
toUpdateDesignInfoList.add(designInfo);
} else {
toAddDesignInfoList.add(designInfo);
}
// 制造信息
IdxBizJgFactoryInfo factoryInfo = JSON.parseObject(toJSONString(pipeline), IdxBizJgFactoryInfo.class);
factoryInfo.setRecord(record);
factoryInfo.setRecDate(nowDate);
factoryInfo.setSequenceNbr(null);
if (hasRecord) {
toUpdateFactoryInfoList.add(factoryInfo);
} else {
toAddFactoryInfoList.add(factoryInfo);
}
// 施工信息
JSONObject pipeJSON = new JSONObject(pipeline);
pipeJSON.remove("uscDate");
IdxBizJgConstructionInfo constructionInfo = JSON.parseObject(toJSONString(pipeJSON), IdxBizJgConstructionInfo.class);
constructionInfo.setUscDate(ValidationUtil.isEmpty(pipeline.get("uscDate")) ? null : DateUtil.parse(pipeline.get("uscDate").toString(), DatePattern.NORM_MONTH_FORMAT));
constructionInfo.setRecord(record);
constructionInfo.setRecDate(nowDate);
constructionInfo.setSequenceNbr(null);
if (hasRecord) {
toUpdateConstructionInfoList.add(constructionInfo);
} else {
toAddConstructionInfoList.add(constructionInfo);
}
// 监督管理
IdxBizJgSupervisionInfo supervisionInfo = JSON.parseObject(toJSONString(pipeline), IdxBizJgSupervisionInfo.class);
supervisionInfo.setRecord(record);
supervisionInfo.setRecDate(nowDate);
supervisionInfo.setSequenceNbr(null);
if (hasRecord) {
toUpdateSupervisionInfoList.add(supervisionInfo);
} else {
toAddSupervisionInfoList.add(supervisionInfo);
}
// 其他信息
IdxBizJgOtherInfo otherInfo = JSON.parseObject(toJSONString(pipeline), IdxBizJgOtherInfo.class);
otherInfo.setRecord(record);
otherInfo.setSequenceNbr(null);
otherInfo.setClaimStatus("已认领");
otherInfo.setRecDate(nowDate);
otherInfo.setSupervisoryCode("");
otherInfo.setCylinderStampAttachment("");
otherInfo.setInformationSituation("");
otherInfo.setInformationManageCode("");
if (hasRecord) {
toUpdateOtherInfoList.add(otherInfo);
} else {
toAddOtherInfoList.add(otherInfo);
}
// 管道技术参数
IdxBizJgTechParamsPipeline pipelineInfo = JSON.parseObject(toJSONString(pipeline), IdxBizJgTechParamsPipeline.class);
if (!ValidationUtil.isEmpty(pipelineInfo)) {
pipelineInfo.setRecord(record);
pipelineInfo.setRecDate(nowDate);
pipelineInfo.setSequenceNbr(null);
if (hasRecord) {
toUpdateParamsPipelineList.add(pipelineInfo);
} else {
toAddParamsPipelineList.add(pipelineInfo);
}
}
// 注册登记信息
IdxBizJgRegisterInfo registerInfo = JSON.parseObject(toJSONString(equipInfo), IdxBizJgRegisterInfo.class);
registerInfo.setRecord(record);
registerInfo.setRecDate(nowDate);
registerInfo.setSequenceNbr(null);
registerInfo.setEquCodeType("2");
registerInfo.setRegisterState(jgRegisterInfoService.getRegCode());
registerInfo.setEquCode(ObjectUtils.isEmpty(registerInfo.getEquCode()) ? "" : registerInfo.getEquCode());
registerInfo.setProductName(pipelineInfo.getPipeName());
if (hasRecord) {
toUpdateRegisterInfoList.add(registerInfo);
} else {
toAddRegisterInfoList.add(registerInfo);
}
ESEquipmentCategoryDto esEquipmentDto = JSON.parseObject(toJSONString(equipInfo), ESEquipmentCategoryDto.class);
esEquipmentDto.setDATA_SOURCE(useInfo.getDataSource());
if (inspectionDetectionInfo.getNextInspectDate() != null) {
esEquipmentDto.setNEXT_INSPECT_DATE(inspectionDetectionInfo.getNextInspectDate().getTime());
}
esEquipmentDto.setREC_DATE(System.currentTimeMillis());
esEquipmentDto.setCREATE_DATE(System.currentTimeMillis());
esEquipmentDto.setSEQUENCE_NBR(record);
esEquipmentDto.setIS_INTO_MANAGEMENT(false);
esEquipmentDto.setEQU_CATEGORY_CODE(registerInfo.getEquCategory());
esEquipmentDto.setEQU_CATEGORY(equCategoryName);
esEquipmentDto.setEQU_LIST_CODE(registerInfo.getEquList());
esEquipmentDto.setEQU_LIST(equListName);
esEquipmentDto.setEQU_DEFINE_CODE(registerInfo.getEquDefine());
esEquipmentDto.setEQU_DEFINE(equListName);
esEquipmentDto.setSTATUS("已认领");
esEquipmentDto.setUSC_UNIT_CREDIT_CODE(null);
esEquipmentDto.setUSC_UNIT_NAME(null);
esEquipmentDto.setUSE_UNIT_CREDIT_CODE(company.getCompanyCode());
esEquipmentDto.setUSE_UNIT_NAME(company.getCompanyName());
esEquipmentDto.setPROJECT_CONTRAPTION(proConName);
esEquipmentDto.setPRODUCT_NAME(pipelineInfo.getPipeName());
esEquipmentDto.setProjectContraptionId(proConNo);
if (inspectionDetectionInfo.getNextInspectDate() != null) {
esEquipmentDto.setNEXT_INSPECT_DATE(inspectionDetectionInfo.getNextInspectDate().getTime());
}
esEquipmentCategoryList.add(esEquipmentDto);
}
// 使用信息
if (!toAddUseInfoList.isEmpty()) {
idxBizJgUseInfoService.saveBatch(toAddUseInfoList);
}
if (!toUpdateUseInfoList.isEmpty()) {
idxBizJgUseInfoService.updateBatchByRecord(toUpdateUseInfoList);
}
// 设计信息
if (!toAddDesignInfoList.isEmpty()) {
iIdxBizJgDesignInfoService.saveOrUpdateBatch(toAddDesignInfoList);
}
if (!toUpdateDesignInfoList.isEmpty()) {
iIdxBizJgDesignInfoService.updateBatchByRecord(toUpdateDesignInfoList);
}
// 施工信息
if (!toAddConstructionInfoList.isEmpty()) {
iIdxBizJgConstructionInfoService.saveBatch(toAddConstructionInfoList);
}
if (!toUpdateConstructionInfoList.isEmpty()) {
iIdxBizJgConstructionInfoService.updateBatchByRecord(toUpdateConstructionInfoList);
}
// 厂信息
if (!toAddFactoryInfoList.isEmpty()) {
iIdxBizJgFactoryInfoService.saveOrUpdateBatch(toAddFactoryInfoList);
}
if (!toUpdateFactoryInfoList.isEmpty()) {
iIdxBizJgFactoryInfoService.updateBatchByRecord(toUpdateFactoryInfoList);
}
// 注册信息
if (!toAddRegisterInfoList.isEmpty()) {
jgRegisterInfoService.saveOrUpdateBatch(toAddRegisterInfoList);
}
if (!toUpdateRegisterInfoList.isEmpty()) {
jgRegisterInfoService.updateBatchByRecord(toUpdateRegisterInfoList);
}
// 其他信息
if (!toAddOtherInfoList.isEmpty()) {
iIdxBizJgOtherInfoService.saveOrUpdateBatch(toAddOtherInfoList);
}
if (!toUpdateOtherInfoList.isEmpty()) {
iIdxBizJgOtherInfoService.updateBatchByRecord(toUpdateOtherInfoList);
}
// 监督信息
if (!toAddSupervisionInfoList.isEmpty()) {
iIdxBizJgSupervisionInfoService.saveOrUpdateBatch(toAddSupervisionInfoList);
}
if (!toUpdateSupervisionInfoList.isEmpty()) {
iIdxBizJgSupervisionInfoService.updateBatchByRecord(toUpdateSupervisionInfoList);
}
// 检验检测信息
if (!toAddInspectionDetectionInfoList.isEmpty()) {
iIdxBizJgInspectionDetectionInfoService.saveOrUpdateBatch(toAddInspectionDetectionInfoList);
}
if (!toUpdateInspectionDetectionInfoList.isEmpty()) {
iIdxBizJgInspectionDetectionInfoService.updateBatchByRecord(toUpdateInspectionDetectionInfoList);
}
// 技术参数管道信息
if (!toAddParamsPipelineList.isEmpty()) {
iIdxBizJgTechParamsPipelineService.saveOrUpdateBatch(toAddParamsPipelineList);
}
if (!toUpdateParamsPipelineList.isEmpty()) {
iIdxBizJgTechParamsPipelineService.updateBatchByRecord(toUpdateParamsPipelineList);
}
esEquipmentCategory.saveAll(esEquipmentCategoryList);
}
/**
* 使用登记证校验 + 工程装置编号名称组合校验
*
* @param equipInfo
*/
public void checkPipeParams(JSONObject equipInfo) {
CompanyBo company = getSelectedOrgInfo().getCompany();
// 管道校验
List<Map<String, Object>> pipelineList = (List<Map<String, Object>>) equipInfo.get(PIPELINE_LIST);
if (CollectionUtils.isEmpty(pipelineList) || pipelineList.size() != pipelineList.stream()
.map(v -> (String) v.get("pipelineNumber")).distinct().count()) {
throw new BadRequest(CollectionUtils.isEmpty(pipelineList) ? "请填写管道信息!" : "同一工程装置下管道编号不能重复!");
}
String useRegistrationCode = Objects.toString(equipInfo.get(USE_REGISTRATION_CODE), null);
// todo
}
} }
package com.yeejoin.amos.boot.module.jg.biz.service.impl; package com.yeejoin.amos.boot.module.jg.biz.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.yeejoin.amos.boot.biz.common.entity.TzsBaseEntity; import com.yeejoin.amos.boot.biz.common.entity.TzsBaseEntity;
import com.yeejoin.amos.boot.module.jg.biz.core.BaseService; import com.yeejoin.amos.boot.module.jg.biz.core.BaseService;
import com.yeejoin.amos.boot.module.jg.biz.service.IIdxBizJgConstructionInfoService; import com.yeejoin.amos.boot.module.jg.biz.service.IIdxBizJgConstructionInfoService;
import com.yeejoin.amos.boot.module.ymt.api.dto.IdxBizJgConstructionInfoDto;
import com.yeejoin.amos.boot.module.ymt.api.entity.IdxBizJgConstructionInfo; import com.yeejoin.amos.boot.module.ymt.api.entity.IdxBizJgConstructionInfo;
import com.yeejoin.amos.boot.module.ymt.api.mapper.IdxBizJgConstructionInfoMapper; import com.yeejoin.amos.boot.module.ymt.api.mapper.IdxBizJgConstructionInfoMapper;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
...@@ -43,6 +43,11 @@ public class IdxBizJgConstructionInfoServiceImpl extends BaseService<IdxBizJgCon ...@@ -43,6 +43,11 @@ public class IdxBizJgConstructionInfoServiceImpl extends BaseService<IdxBizJgCon
return result; return result;
} }
@Override
public void updateBatchByRecord(List<IdxBizJgConstructionInfo> toUpdateConstructionInfoList) {
toUpdateConstructionInfoList.forEach(info -> super.update(info, new LambdaUpdateWrapper<IdxBizJgConstructionInfo>().eq(IdxBizJgConstructionInfo::getRecord, info.getRecord())));
}
/** /**
* 查询最新的一条施工信息主键 * 查询最新的一条施工信息主键
* @param record 设备唯一标识 * @param record 设备唯一标识
......
package com.yeejoin.amos.boot.module.jg.biz.service.impl; package com.yeejoin.amos.boot.module.jg.biz.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.yeejoin.amos.boot.module.jg.biz.core.BaseService; import com.yeejoin.amos.boot.module.jg.biz.core.BaseService;
import com.yeejoin.amos.boot.module.jg.biz.service.IIdxBizJgDesignInfoService; import com.yeejoin.amos.boot.module.jg.biz.service.IIdxBizJgDesignInfoService;
import com.yeejoin.amos.boot.module.ymt.api.entity.IdxBizJgDesignInfo; import com.yeejoin.amos.boot.module.ymt.api.entity.IdxBizJgDesignInfo;
import com.yeejoin.amos.boot.module.ymt.api.mapper.IdxBizJgDesignInfoMapper; import com.yeejoin.amos.boot.module.ymt.api.mapper.IdxBizJgDesignInfoMapper;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
import java.util.LinkedHashMap;
import java.util.List; import java.util.List;
import java.util.*;
import java.util.function.Function; import java.util.function.Function;
import java.util.stream.Collectors; import java.util.stream.Collectors;
...@@ -36,6 +38,11 @@ public class IdxBizJgDesignInfoServiceImpl extends BaseService<IdxBizJgDesignInf ...@@ -36,6 +38,11 @@ public class IdxBizJgDesignInfoServiceImpl extends BaseService<IdxBizJgDesignInf
return this.getOne(new QueryWrapper<IdxBizJgDesignInfo>().eq("RECORD", record)); return this.getOne(new QueryWrapper<IdxBizJgDesignInfo>().eq("RECORD", record));
} }
@Override
public void updateBatchByRecord(List<IdxBizJgDesignInfo> toUpdateDesignInfoList) {
toUpdateDesignInfoList.forEach(info -> super.update(info, new LambdaUpdateWrapper<IdxBizJgDesignInfo>().eq(IdxBizJgDesignInfo::getRecord, info.getRecord())));
}
public List<IdxBizJgDesignInfo> checkOverDesignRegNum(List<String> records) { public List<IdxBizJgDesignInfo> checkOverDesignRegNum(List<String> records) {
if (records == null || records.isEmpty()) { if (records == null || records.isEmpty()) {
return Collections.emptyList(); return Collections.emptyList();
......
package com.yeejoin.amos.boot.module.jg.biz.service.impl; package com.yeejoin.amos.boot.module.jg.biz.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.yeejoin.amos.boot.module.jg.biz.core.BaseService; import com.yeejoin.amos.boot.module.jg.biz.core.BaseService;
import com.yeejoin.amos.boot.module.jg.biz.service.IIdxBizJgFactoryInfoService; import com.yeejoin.amos.boot.module.jg.biz.service.IIdxBizJgFactoryInfoService;
import com.yeejoin.amos.boot.module.ymt.api.entity.IdxBizJgFactoryInfo; import com.yeejoin.amos.boot.module.ymt.api.entity.IdxBizJgFactoryInfo;
...@@ -31,4 +32,9 @@ public class IdxBizJgFactoryInfoServiceImpl extends BaseService<IdxBizJgFactoryI ...@@ -31,4 +32,9 @@ public class IdxBizJgFactoryInfoServiceImpl extends BaseService<IdxBizJgFactoryI
public boolean saveOrUpdateBatch(List<IdxBizJgFactoryInfo> factoryInfoList) { public boolean saveOrUpdateBatch(List<IdxBizJgFactoryInfo> factoryInfoList) {
return super.saveOrUpdateBatch(factoryInfoList); return super.saveOrUpdateBatch(factoryInfoList);
} }
@Override
public void updateBatchByRecord(List<IdxBizJgFactoryInfo> toUpdateFactoryInfoList) {
toUpdateFactoryInfoList.forEach(info -> super.update(info, new LambdaUpdateWrapper<IdxBizJgFactoryInfo>().eq(IdxBizJgFactoryInfo::getRecord, info.getRecord())));
}
} }
\ No newline at end of file
package com.yeejoin.amos.boot.module.jg.biz.service.impl; package com.yeejoin.amos.boot.module.jg.biz.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.yeejoin.amos.boot.module.jg.biz.core.BaseService; import com.yeejoin.amos.boot.module.jg.biz.core.BaseService;
import com.yeejoin.amos.boot.module.jg.biz.service.IIdxBizJgInspectionDetectionInfoService; import com.yeejoin.amos.boot.module.jg.biz.service.IIdxBizJgInspectionDetectionInfoService;
import com.yeejoin.amos.boot.module.ymt.api.entity.IdxBizJgInspectionDetectionInfo; import com.yeejoin.amos.boot.module.ymt.api.entity.IdxBizJgInspectionDetectionInfo;
...@@ -11,7 +11,6 @@ import org.springframework.stereotype.Service; ...@@ -11,7 +11,6 @@ import org.springframework.stereotype.Service;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil; import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.stream.Collectors; import java.util.stream.Collectors;
...@@ -79,4 +78,9 @@ public class IdxBizJgInspectionDetectionInfoServiceImpl extends BaseService<IdxB ...@@ -79,4 +78,9 @@ public class IdxBizJgInspectionDetectionInfoServiceImpl extends BaseService<IdxB
public List<IdxBizJgInspectionDetectionInfo> queryLastedGroupByInspectType(String record) { public List<IdxBizJgInspectionDetectionInfo> queryLastedGroupByInspectType(String record) {
return this.getBaseMapper().selectLastedGroupByInspectType(record); return this.getBaseMapper().selectLastedGroupByInspectType(record);
} }
@Override
public void updateBatchByRecord(List<IdxBizJgInspectionDetectionInfo> toUpdateInspectionDetectionInfoList) {
toUpdateInspectionDetectionInfoList.forEach(info -> super.update(info, new LambdaUpdateWrapper<IdxBizJgInspectionDetectionInfo>().eq(IdxBizJgInspectionDetectionInfo::getRecord, info.getRecord())));
}
} }
\ No newline at end of file
package com.yeejoin.amos.boot.module.jg.biz.service.impl; package com.yeejoin.amos.boot.module.jg.biz.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.yeejoin.amos.boot.module.jg.biz.core.BaseService; import com.yeejoin.amos.boot.module.jg.biz.core.BaseService;
import com.yeejoin.amos.boot.module.jg.biz.service.IIdxBizJgOtherInfoService; import com.yeejoin.amos.boot.module.jg.biz.service.IIdxBizJgOtherInfoService;
import com.yeejoin.amos.boot.module.ymt.api.entity.IdxBizJgOtherInfo; import com.yeejoin.amos.boot.module.ymt.api.entity.IdxBizJgOtherInfo;
...@@ -36,4 +37,9 @@ public class IdxBizJgOtherInfoServiceImpl extends BaseService<IdxBizJgOtherInfoM ...@@ -36,4 +37,9 @@ public class IdxBizJgOtherInfoServiceImpl extends BaseService<IdxBizJgOtherInfoM
public boolean saveOrUpdateBatch(List<IdxBizJgOtherInfo> otherInfoList) { public boolean saveOrUpdateBatch(List<IdxBizJgOtherInfo> otherInfoList) {
return super.saveOrUpdateBatch(otherInfoList); return super.saveOrUpdateBatch(otherInfoList);
} }
@Override
public void updateBatchByRecord(List<IdxBizJgOtherInfo> toUpdateOtherInfoList) {
toUpdateOtherInfoList.forEach(info -> super.update(info, new LambdaUpdateWrapper<IdxBizJgOtherInfo>().eq(IdxBizJgOtherInfo::getRecord, info.getRecord())));
}
} }
\ No newline at end of file
...@@ -14,6 +14,7 @@ import com.alibaba.fastjson.JSONArray; ...@@ -14,6 +14,7 @@ import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.toolkit.StringUtils; import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.google.common.base.Joiner; import com.google.common.base.Joiner;
...@@ -826,34 +827,8 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste ...@@ -826,34 +827,8 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
String dataSource = (String) equipmentInfoForm.get(DATA_SOURCE); String dataSource = (String) equipmentInfoForm.get(DATA_SOURCE);
if (dataSource.contains("his")) { if (dataSource.contains("his")) {
String useRegistrationCode = Optional.ofNullable(equipmentInfoForm.get("useRegistrationCode")) // 使用登记证编号校验
.map(String::valueOf) this.checkUseRegistrationCode(equipmentInfoForm);
.map(String::trim)
.orElse(null);
if (useRegistrationCode == null) {
throw new BadRequest("请填写使用登记证编号后进行暂存!");
}
String equipId = String.valueOf(equipmentInfoForm.get("RECORD"));
// 校验使用登记证编号的唯一性
if (!CylinderTypeEnum.CYLINDER.getCode().equals(equipmentInfoForm.get("EQU_CATEGORY")) && commonService.useRegistrationCertificateAccountUnique(useRegistrationCode, equipId)) {
throw new BadRequest("使用登记证编号已存在!");
} else {
if (CylinderTypeEnum.CYLINDER.getCode().equals(equipmentInfoForm.get("EQU_CATEGORY"))) {
// 需求 35094 历史设备(有使用登记证)需按证录入。录入时先录入使用登记证编号。
// 需验证录入的使用登记证编号平台是否跟当前用户(使用单位类型)一致,如跟当前用户不一致,系统给出提示“该使用登记证编号”已被“单位名称“使用”,请确认后再录入”。
// 历史设备不限制使用登记证编号在一个单位重复录入,但需验证使用登记证编号+单位内编号唯一。(下面方法checkFactoryNumUniqueWithGasCylinder中已经校验)
String occupiedUseUnitName = commonService.isRegistrationNumberUsedByOtherUnits(useRegistrationCode);
if (!ValidationUtil.isEmpty(occupiedUseUnitName)) {
throw new BadRequest("该使用登记证编号已被【" + occupiedUseUnitName + "】使用,请确认后再录入!");
}
}
}
String regType = Optional.ofNullable(equipmentInfoForm.get("EQU_LIST"))
.filter(code -> CylinderTypeEnum.CYLINDER.getCode().equals(code))
.map(code -> "1".equals(equipmentInfoForm.get("WHETHER_VEHICLE_CYLINDER")) ? "vehicle" : "cylinder")
.orElse("set");
// 判断是否使用未来系统生成编号
idxBizJgRegisterInfoService.checkUseRegistrationCode(useRegistrationCode, regType);
} }
try { try {
...@@ -896,7 +871,40 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste ...@@ -896,7 +871,40 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
return ResponseHelper.buildResponse(record); return ResponseHelper.buildResponse(record);
} }
/**
* 使用登记证编号相关校验
* @param equipmentInfoForm
*/
public void checkUseRegistrationCode(LinkedHashMap equipmentInfoForm) {
String useRegistrationCode = Optional.ofNullable(equipmentInfoForm.get("useRegistrationCode"))
.map(String::valueOf)
.map(String::trim)
.orElse(null);
if (useRegistrationCode == null) {
throw new BadRequest("请填写使用登记证编号后进行暂存!");
}
String equipId = String.valueOf(equipmentInfoForm.get("RECORD"));
// 校验使用登记证编号的唯一性
if (!CylinderTypeEnum.CYLINDER.getCode().equals(equipmentInfoForm.get("EQU_CATEGORY")) && commonService.useRegistrationCertificateAccountUnique(useRegistrationCode, equipId)) {
throw new BadRequest("使用登记证编号已存在!");
} else {
if (CylinderTypeEnum.CYLINDER.getCode().equals(equipmentInfoForm.get("EQU_CATEGORY"))) {
// 需求 35094 历史设备(有使用登记证)需按证录入。录入时先录入使用登记证编号。
// 需验证录入的使用登记证编号平台是否跟当前用户(使用单位类型)一致,如跟当前用户不一致,系统给出提示“该使用登记证编号”已被“单位名称“使用”,请确认后再录入”。
// 历史设备不限制使用登记证编号在一个单位重复录入,但需验证使用登记证编号+单位内编号唯一。(下面方法checkFactoryNumUniqueWithGasCylinder中已经校验)
String occupiedUseUnitName = commonService.isRegistrationNumberUsedByOtherUnits(useRegistrationCode);
if (!ValidationUtil.isEmpty(occupiedUseUnitName)) {
throw new BadRequest("该使用登记证编号已被【" + occupiedUseUnitName + "】使用,请确认后再录入!");
}
}
}
String regType = Optional.ofNullable(equipmentInfoForm.get("EQU_LIST"))
.filter(code -> CylinderTypeEnum.CYLINDER.getCode().equals(code))
.map(code -> "1".equals(equipmentInfoForm.get("WHETHER_VEHICLE_CYLINDER")) ? "vehicle" : "cylinder")
.orElse("set");
// 判断是否使用未来系统生成编号
idxBizJgRegisterInfoService.checkUseRegistrationCode(useRegistrationCode, regType);
}
private Object checkAndCast(Object obj) { private Object checkAndCast(Object obj) {
...@@ -5232,4 +5240,8 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste ...@@ -5232,4 +5240,8 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
} }
return result; return result;
} }
public void updateBatchByRecord(List<IdxBizJgRegisterInfo> toUpdateRegisterInfoList) {
toUpdateRegisterInfoList.forEach(info -> super.update(info, new LambdaUpdateWrapper<IdxBizJgRegisterInfo>().eq(IdxBizJgRegisterInfo::getRecord, info.getRecord())));
}
} }
\ No newline at end of file
package com.yeejoin.amos.boot.module.jg.biz.service.impl; package com.yeejoin.amos.boot.module.jg.biz.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.yeejoin.amos.boot.module.jg.biz.core.BaseService; import com.yeejoin.amos.boot.module.jg.biz.core.BaseService;
import com.yeejoin.amos.boot.module.jg.biz.service.IIdxBizJgSupervisionInfoService; import com.yeejoin.amos.boot.module.jg.biz.service.IIdxBizJgSupervisionInfoService;
import com.yeejoin.amos.boot.module.ymt.api.entity.IdxBizJgSupervisionInfo; import com.yeejoin.amos.boot.module.ymt.api.entity.IdxBizJgSupervisionInfo;
import com.yeejoin.amos.boot.module.ymt.api.mapper.IdxBizJgSupervisionInfoMapper; import com.yeejoin.amos.boot.module.ymt.api.mapper.IdxBizJgSupervisionInfoMapper;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.List; import java.util.List;
/** /**
...@@ -30,4 +32,9 @@ public class IdxBizJgSupervisionInfoServiceImpl extends BaseService<IdxBizJgSupe ...@@ -30,4 +32,9 @@ public class IdxBizJgSupervisionInfoServiceImpl extends BaseService<IdxBizJgSupe
public boolean saveOrUpdateBatch(List<IdxBizJgSupervisionInfo> supervisionInfoList) { public boolean saveOrUpdateBatch(List<IdxBizJgSupervisionInfo> supervisionInfoList) {
return super.saveOrUpdateBatch(supervisionInfoList); return super.saveOrUpdateBatch(supervisionInfoList);
} }
@Override
public void updateBatchByRecord(List<IdxBizJgSupervisionInfo> toUpdateSupervisionInfoList) {
toUpdateSupervisionInfoList.forEach(info -> super.update(info, new LambdaUpdateWrapper<IdxBizJgSupervisionInfo>().eq(IdxBizJgSupervisionInfo::getRecord, info.getRecord())));
}
} }
\ No newline at end of file
package com.yeejoin.amos.boot.module.jg.biz.service.impl; package com.yeejoin.amos.boot.module.jg.biz.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.yeejoin.amos.boot.module.jg.biz.core.BaseService; import com.yeejoin.amos.boot.module.jg.biz.core.BaseService;
import com.yeejoin.amos.boot.module.jg.biz.service.IIdxBizJgTechParamsPipelineService; import com.yeejoin.amos.boot.module.jg.biz.service.IIdxBizJgTechParamsPipelineService;
import com.yeejoin.amos.boot.module.ymt.api.entity.IdxBizJgTechParamsPipeline; import com.yeejoin.amos.boot.module.ymt.api.entity.IdxBizJgTechParamsPipeline;
import com.yeejoin.amos.boot.module.ymt.api.mapper.IdxBizJgTechParamsPipelineMapper; import com.yeejoin.amos.boot.module.ymt.api.mapper.IdxBizJgTechParamsPipelineMapper;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.List;
/** /**
* 安全追溯-压力管道服务实现类 * 安全追溯-压力管道服务实现类
* *
...@@ -23,4 +26,9 @@ public class IdxBizJgTechParamsPipelineServiceImpl extends BaseService<IdxBizJgT ...@@ -23,4 +26,9 @@ public class IdxBizJgTechParamsPipelineServiceImpl extends BaseService<IdxBizJgT
public IdxBizJgTechParamsPipeline getOneData(String record) { public IdxBizJgTechParamsPipeline getOneData(String record) {
return this.getOne(new QueryWrapper<IdxBizJgTechParamsPipeline>().eq("RECORD", record)); return this.getOne(new QueryWrapper<IdxBizJgTechParamsPipeline>().eq("RECORD", record));
} }
@Override
public void updateBatchByRecord(List<IdxBizJgTechParamsPipeline> toUpdateParamsPipelineList) {
toUpdateParamsPipelineList.forEach(info -> super.update(info, new LambdaUpdateWrapper<IdxBizJgTechParamsPipeline>().eq(IdxBizJgTechParamsPipeline::getRecord, info.getRecord())));
}
} }
\ No newline at end of file
package com.yeejoin.amos.boot.module.jg.biz.service.impl; package com.yeejoin.amos.boot.module.jg.biz.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.yeejoin.amos.boot.module.jg.biz.core.BaseService; import com.yeejoin.amos.boot.module.jg.biz.core.BaseService;
import com.yeejoin.amos.boot.module.jg.biz.service.IIdxBizJgUseInfoService; import com.yeejoin.amos.boot.module.jg.biz.service.IIdxBizJgUseInfoService;
import com.yeejoin.amos.boot.module.ymt.api.dto.IdxBizJgUseInfoDto;
import com.yeejoin.amos.boot.module.ymt.api.entity.IdxBizJgUseInfo; import com.yeejoin.amos.boot.module.ymt.api.entity.IdxBizJgUseInfo;
import com.yeejoin.amos.boot.module.ymt.api.mapper.IdxBizJgUseInfoMapper; import com.yeejoin.amos.boot.module.ymt.api.mapper.IdxBizJgUseInfoMapper;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
...@@ -44,4 +44,9 @@ public class IdxBizJgUseInfoServiceImpl extends BaseService<IdxBizJgUseInfoMappe ...@@ -44,4 +44,9 @@ public class IdxBizJgUseInfoServiceImpl extends BaseService<IdxBizJgUseInfoMappe
public boolean saveOrUpdateBatch(List<IdxBizJgUseInfo> useInfoList) { public boolean saveOrUpdateBatch(List<IdxBizJgUseInfo> useInfoList) {
return super.saveOrUpdateBatch(useInfoList); return super.saveOrUpdateBatch(useInfoList);
} }
@Override
public void updateBatchByRecord(List<IdxBizJgUseInfo> toUpdateUseInfoList) {
toUpdateUseInfoList.forEach(useInfo -> super.update(useInfo, new LambdaUpdateWrapper<IdxBizJgUseInfo>().eq(IdxBizJgUseInfo::getRecord, useInfo.getRecord())));
}
} }
\ No newline at end of file
...@@ -396,7 +396,7 @@ public class JgReformNoticeServiceImpl extends BaseService<JgReformNoticeDto, Jg ...@@ -396,7 +396,7 @@ public class JgReformNoticeServiceImpl extends BaseService<JgReformNoticeDto, Jg
}); });
// 压力管道添加作废标识:不在流程中即可作废 // 压力管道添加作废标识:不在流程中即可作废
if (EquipmentClassifityEnum.YLGD.getCode().equals(notice.get("equListCode")) && !ValidationUtil.isEmpty(notice.get("projectContraptionId"))) { if (EquipmentClassifityEnum.YLGD.getCode().equals(notice.get("equListCode")) && !ValidationUtil.isEmpty(notice.get("projectContraptionId"))) {
notice.put("canVoided", idxBizJgProjectContraptionMapper.countContraptionInUseTimesForDeleteByIntoManagement(Long.parseLong(String.valueOf(notice.get("projectContraptionId")))) == 0); notice.put("canVoided", idxBizJgProjectContraptionMapper.countContraptionInUseTimesForDeleteByIntoManagement(String.valueOf(notice.get("projectContraptionId"))) == 0);
} }
}).collect(Collectors.toList()); }).collect(Collectors.toList());
......
...@@ -57,7 +57,7 @@ public interface IdxBizJgProjectContraptionMapper extends BaseMapper<IdxBizJgPro ...@@ -57,7 +57,7 @@ public interface IdxBizJgProjectContraptionMapper extends BaseMapper<IdxBizJgPro
* @param projectContraptionId 设备唯一标识 * @param projectContraptionId 设备唯一标识
* @return 被引用次数 > 0 则设备不可删除 * @return 被引用次数 > 0 则设备不可删除
*/ */
Integer countContraptionInUseTimesForDeleteByIntoManagement(@Param("projectContraptionId") Long projectContraptionId); Integer countContraptionInUseTimesForDeleteByIntoManagement(@Param("projectContraptionId") String projectContraptionId);
List<IdxBizJgProjectContraption> selectErrorManagementProject(); List<IdxBizJgProjectContraption> selectErrorManagementProject();
......
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