Commit a3669bec authored by suhuiguang's avatar suhuiguang

Merge branch 'develop_tzs_bugfix' into develop_tzs_register

parents 8240aff8 168d2e0c
package com.yeejoin.amos.boot.module.common.biz.service.impl;
import com.yeejoin.amos.boot.module.common.api.dao.ESEquipmentCategory;
import com.yeejoin.amos.boot.module.common.api.dto.ESEquipmentCategoryDto;
import lombok.RequiredArgsConstructor;
import org.springframework.data.elasticsearch.core.ElasticsearchOperations;
import org.springframework.stereotype.Service;
@Service
@RequiredArgsConstructor
public class EquipmentCategoryService {
private final ESEquipmentCategory equipmentCategoryDao;
private final ElasticsearchOperations elasticsearchOperations;
public ESEquipmentCategoryDto saveWithImmediateRefresh(ESEquipmentCategoryDto dto) {
ESEquipmentCategoryDto saved = equipmentCategoryDao.save(dto);
// 手动触发索引刷新
elasticsearchOperations.indexOps(ESEquipmentCategoryDto.class).refresh();
return saved;
}
}
\ No newline at end of file
...@@ -67,7 +67,10 @@ public class DictParamsConverter implements Converter<String> { ...@@ -67,7 +67,10 @@ public class DictParamsConverter implements Converter<String> {
dictMap.put("D级", "5960"); dictMap.put("D级", "5960");
dictMap.put("GC1", "6002"); dictMap.put("GC1", "6002");
dictMap.put("GC2", "6003"); dictMap.put("GC2", "6003");
dictMap.put("GC3", "6005");
dictMap.put("GCD", "6004"); dictMap.put("GCD", "6004");
dictMap.put("GD1", "6006");
dictMap.put("GD2", "6007");
dictMap.put("压缩天然气", "COMPRESSED_NATURAL_GAS"); dictMap.put("压缩天然气", "COMPRESSED_NATURAL_GAS");
dictMap.put("液化天然气", "LIQUEFIED_NATURAL_GAS"); dictMap.put("液化天然气", "LIQUEFIED_NATURAL_GAS");
dictMap.put("液化石油气", "LIQUEFIED_PETROLEUM_GAS"); dictMap.put("液化石油气", "LIQUEFIED_PETROLEUM_GAS");
......
...@@ -146,6 +146,15 @@ public interface CommonMapper extends BaseMapper<EquipmentCategory> { ...@@ -146,6 +146,15 @@ public interface CommonMapper extends BaseMapper<EquipmentCategory> {
@Param("produceUnitCreditCode") String produceUnitCreditCode); @Param("produceUnitCreditCode") String produceUnitCreditCode);
/** /**
* 查询出厂编码是否重复
*
* @param factoryNum 出厂编码
* @return Integer
*/
List<Map<String, Object>> checkFactoryNumUniqueWithUseName(@Param("factoryNum") String factoryNum,
@Param("produceUnitCreditCode") String produceUnitCreditCode);
/**
* 使用登记证编号全库唯一校验 * 使用登记证编号全库唯一校验
* *
* @param useRegistrationCode * @param useRegistrationCode
......
...@@ -991,6 +991,20 @@ ...@@ -991,6 +991,20 @@
AND ibjfi."RECORD" <![CDATA[ <> ]]> #{record} AND ibjfi."RECORD" <![CDATA[ <> ]]> #{record}
</if> </if>
</select> </select>
<select id="checkFactoryNumUniqueWithUseName" resultType="java.util.Map">
SELECT
ibjui.USE_UNIT_NAME as useUnitName,
COUNT(1)
FROM idx_biz_jg_factory_info ibjfi
LEFT JOIN idx_biz_jg_register_info ibjri ON ibjfi."RECORD" = ibjri."RECORD"
LEFT JOIN idx_biz_jg_other_info joi ON joi."RECORD" = ibjfi."RECORD"
LEFT JOIN idx_biz_jg_use_info ibjui ON ibjui."RECORD" = ibjri."RECORD"
WHERE ibjri.EQU_LIST = '2000'
AND ibjri.EQU_CATEGORY = '2300'
AND ibjfi.FACTORY_NUM = #{factoryNum}
AND ibjfi.PRODUCE_UNIT_CREDIT_CODE = #{produceUnitCreditCode}
AND joi.CLAIM_STATUS = '已认领'
</select>
<select id="useRegistrationCertificateAccountUnique" resultType="java.lang.Integer"> <select id="useRegistrationCertificateAccountUnique" resultType="java.lang.Integer">
SELECT COUNT( 1 ) SELECT COUNT( 1 )
......
...@@ -1019,6 +1019,9 @@ ...@@ -1019,6 +1019,9 @@
<if test="jsonObject.factoryNum != null and jsonObject.factoryNum != ''"> <if test="jsonObject.factoryNum != null and jsonObject.factoryNum != ''">
and aa.factoryNum like concat('%',#{jsonObject.factoryNum},'%') and aa.factoryNum like concat('%',#{jsonObject.factoryNum},'%')
</if> </if>
<if test="jsonObject.productName != null and jsonObject.productName != ''">
and aa.productName like concat('%',#{jsonObject.productName},'%')
</if>
<if test="jsonObject.nextInspectDate != null and jsonObject.nextInspectDate != ''"> <if test="jsonObject.nextInspectDate != null and jsonObject.nextInspectDate != ''">
and aa.nextInspectDate =#{jsonObject.nextInspectDate} and aa.nextInspectDate =#{jsonObject.nextInspectDate}
</if> </if>
......
...@@ -54,6 +54,8 @@ public class JgTableDataExportController extends BaseController { ...@@ -54,6 +54,8 @@ public class JgTableDataExportController extends BaseController {
@GetMapping(value = "/certificate") @GetMapping(value = "/certificate")
@ApiOperation(httpMethod = "GET", value = "登记证列表数据导出", notes = "登记证列表数据导出") @ApiOperation(httpMethod = "GET", value = "登记证列表数据导出", notes = "登记证列表数据导出")
public ResponseModel<String> certificateExport(JgUseRegistrationManageDto dto, public ResponseModel<String> certificateExport(JgUseRegistrationManageDto dto,
// 区分非审批列表导出(isJG --> jg),还是审批列表导出 ,默认审批列表导出
@RequestParam(value = "isJG", defaultValue = "false") Boolean isJG,
@RequestParam(value = "ids", required = false) String ids, @RequestParam(value = "ids", required = false) String ids,
@RequestParam(value = "sort", required = false) String sort) { @RequestParam(value = "sort", required = false) String sort) {
String uuid = UUID.randomUUID().toString(); String uuid = UUID.randomUUID().toString();
...@@ -61,7 +63,7 @@ public class JgTableDataExportController extends BaseController { ...@@ -61,7 +63,7 @@ public class JgTableDataExportController extends BaseController {
RequestContextWrapper contextWrapper = RequestContextWrapper.capture(); RequestContextWrapper contextWrapper = RequestContextWrapper.capture();
new Thread(() -> { new Thread(() -> {
contextWrapper.apply(); contextWrapper.apply();
iJgTableDataExportService.certificate(uuid, dto, ids == null ? new ArrayList<>() : Arrays.asList(ids.split(",")), sort); iJgTableDataExportService.certificate(uuid, dto, isJG, ids == null ? new ArrayList<>() : Arrays.asList(ids.split(",")), sort);
}).start(); }).start();
return ResponseHelper.buildResponse("后台处理中,请注意下载!"); return ResponseHelper.buildResponse("后台处理中,请注意下载!");
} }
......
...@@ -168,11 +168,7 @@ public class JgUseRegistrationManageController extends BaseController { ...@@ -168,11 +168,7 @@ public class JgUseRegistrationManageController extends BaseController {
@RequestParam(value = "sort", required = false) String sort, @RequestParam(value = "sort", required = false) String sort,
@RequestParam(value = "current") int current, @RequestParam(value = "current") int current,
@RequestParam(value = "size") int size) { @RequestParam(value = "size") int size) {
Page<JgUseRegistrationManageDto> page = new Page<JgUseRegistrationManageDto>(); return ResponseHelper.buildResponse(jgUseRegistrationManageServiceImpl.queryForJgUseRegistrationManagePageForJG(dto, sort, current, size));
page.setCurrent(current);
page.setSize(size);
ReginParams info = getSelectedOrgInfo();
return ResponseHelper.buildResponse(jgUseRegistrationManageServiceImpl.queryForJgUseRegistrationManagePageForJG(page, dto, sort, info.getCompany().getOrgCode()));
} }
/** /**
* 列表分页查询-大屏监督管理使用 * 列表分页查询-大屏监督管理使用
......
...@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; ...@@ -5,6 +5,7 @@ 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.common.api.dao.ESEquipmentCategory; 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.common.api.dto.ESEquipmentCategoryDto;
import com.yeejoin.amos.boot.module.common.biz.service.impl.EquipmentCategoryService;
import com.yeejoin.amos.boot.module.jg.api.dto.ReminderItemDto; import com.yeejoin.amos.boot.module.jg.api.dto.ReminderItemDto;
import com.yeejoin.amos.boot.module.jg.biz.reminder.biz.factory.GradeStrategyFactory; import com.yeejoin.amos.boot.module.jg.biz.reminder.biz.factory.GradeStrategyFactory;
import com.yeejoin.amos.boot.module.jg.biz.reminder.core.event.EquipCreateOrEditEvent; import com.yeejoin.amos.boot.module.jg.biz.reminder.core.event.EquipCreateOrEditEvent;
...@@ -18,6 +19,7 @@ import com.yeejoin.amos.boot.module.ymt.api.entity.IdxBizJgUseInfo; ...@@ -18,6 +19,7 @@ import com.yeejoin.amos.boot.module.ymt.api.entity.IdxBizJgUseInfo;
import com.yeejoin.amos.boot.module.ymt.api.enums.EquipmentClassifityEnum; import com.yeejoin.amos.boot.module.ymt.api.enums.EquipmentClassifityEnum;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.scheduling.annotation.Async; import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
...@@ -44,6 +46,9 @@ public class EquipQualityScoreUpdateService implements IQualityScoreUpdate { ...@@ -44,6 +46,9 @@ public class EquipQualityScoreUpdateService implements IQualityScoreUpdate {
private final GradeStrategyFactory gradeStrategyFactory; private final GradeStrategyFactory gradeStrategyFactory;
@Autowired
EquipmentCategoryService equipmentCategoryService;
@Override @Override
public Boolean support(EquipCreateOrEditEvent.EquipType equipType) { public Boolean support(EquipCreateOrEditEvent.EquipType equipType) {
return EquipCreateOrEditEvent.EquipType.equip.equals(equipType); return EquipCreateOrEditEvent.EquipType.equip.equals(equipType);
...@@ -61,7 +66,7 @@ public class EquipQualityScoreUpdateService implements IQualityScoreUpdate { ...@@ -61,7 +66,7 @@ public class EquipQualityScoreUpdateService implements IQualityScoreUpdate {
Integer level = this.getReminderLevel(bizType, record); Integer level = this.getReminderLevel(bizType, record);
op.ifPresent(equipmentCategory -> { op.ifPresent(equipmentCategory -> {
equipmentCategory.setDataQualityScore(level); equipmentCategory.setDataQualityScore(level);
equipmentCategoryDao.save(equipmentCategory); equipmentCategoryService.saveWithImmediateRefresh(equipmentCategory);
}); });
LambdaUpdateWrapper<IdxBizJgUseInfo> updateWrapper = new LambdaUpdateWrapper<>(); LambdaUpdateWrapper<IdxBizJgUseInfo> updateWrapper = new LambdaUpdateWrapper<>();
updateWrapper.eq(IdxBizJgUseInfo::getRecord, record); updateWrapper.eq(IdxBizJgUseInfo::getRecord, record);
......
...@@ -19,7 +19,7 @@ public interface IJgTableDataExportService { ...@@ -19,7 +19,7 @@ public interface IJgTableDataExportService {
void gen(String jsonName, String voName, String tableName); void gen(String jsonName, String voName, String tableName);
void certificate(String uuid, JgUseRegistrationManageDto dto, List<String> ids, String sort); void certificate(String uuid, JgUseRegistrationManageDto dto, Boolean isJG, List<String> ids, String sort);
void maintenance(HttpServletResponse response, List<String> ids); void maintenance(HttpServletResponse response, List<String> ids);
......
...@@ -223,6 +223,7 @@ public class CommonServiceImpl implements ICommonService { ...@@ -223,6 +223,7 @@ public class CommonServiceImpl implements ICommonService {
@Autowired @Autowired
@Lazy @Lazy
JgEquipTransferServiceImpl jgEquipTransferServiceImpl; JgEquipTransferServiceImpl jgEquipTransferServiceImpl;
@Lazy
@Autowired @Autowired
JgReformNoticeServiceImpl jgReformNoticeService; JgReformNoticeServiceImpl jgReformNoticeService;
@Autowired @Autowired
......
...@@ -2290,8 +2290,12 @@ public class DataDockServiceImpl { ...@@ -2290,8 +2290,12 @@ public class DataDockServiceImpl {
JSONObject inspectionDetectionInfoJO = (JSONObject) JSON.toJSON(inspectionDetectionInfo); JSONObject inspectionDetectionInfoJO = (JSONObject) JSON.toJSON(inspectionDetectionInfo);
jsonObject.putAll(inspectionDetectionInfoJO); jsonObject.putAll(inspectionDetectionInfoJO);
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
jsonObject.put("inspectDate", sdf.format(inspectionDetectionInfo.getInspectDate())); jsonObject.put("inspectDate", Optional.ofNullable(inspectionDetectionInfo.getInspectDate())
jsonObject.put("nextInspectDate", sdf.format(inspectionDetectionInfo.getNextInspectDate())); .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("orgBranchCode", paramsDto.getOrgBranchCode() + "_" + paramsDto.getOrgBranchName());
jsonObject.put("projectContraption", projectContraption.getProjectContraption()); jsonObject.put("projectContraption", projectContraption.getProjectContraption());
jsonObject.put("projectContraptionNo", projectContraption.getProjectContraptionNo()); jsonObject.put("projectContraptionNo", projectContraption.getProjectContraptionNo());
......
...@@ -24,6 +24,7 @@ import com.yeejoin.amos.boot.biz.common.service.impl.DataDictionaryServiceImpl; ...@@ -24,6 +24,7 @@ import com.yeejoin.amos.boot.biz.common.service.impl.DataDictionaryServiceImpl;
import com.yeejoin.amos.boot.biz.common.utils.*; import com.yeejoin.amos.boot.biz.common.utils.*;
import com.yeejoin.amos.boot.module.common.api.dao.ESEquipmentCategory; 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.common.api.dto.ESEquipmentCategoryDto;
import com.yeejoin.amos.boot.module.common.biz.service.impl.EquipmentCategoryService;
import com.yeejoin.amos.boot.module.jg.api.dto.*; import com.yeejoin.amos.boot.module.jg.api.dto.*;
import com.yeejoin.amos.boot.module.jg.api.entity.*; import com.yeejoin.amos.boot.module.jg.api.entity.*;
import com.yeejoin.amos.boot.module.jg.api.enums.*; import com.yeejoin.amos.boot.module.jg.api.enums.*;
...@@ -66,6 +67,7 @@ import org.elasticsearch.search.sort.SortOrder; ...@@ -66,6 +67,7 @@ import org.elasticsearch.search.sort.SortOrder;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Lazy;
import org.springframework.core.io.Resource; import org.springframework.core.io.Resource;
import org.springframework.data.redis.core.RedisTemplate; import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.core.ValueOperations; import org.springframework.data.redis.core.ValueOperations;
...@@ -243,6 +245,8 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste ...@@ -243,6 +245,8 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
@Autowired @Autowired
ESEquipmentCategory esEquipmentCategory; ESEquipmentCategory esEquipmentCategory;
@Autowired @Autowired
EquipmentCategoryService equipmentCategoryService;
@Autowired
ICommonService commonService; ICommonService commonService;
@Autowired @Autowired
CommonMapper commonMapper; CommonMapper commonMapper;
...@@ -308,6 +312,8 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste ...@@ -308,6 +312,8 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
private IdxBizJgProjectContraptionServiceImplService idxBizJgProjectContraptionService; private IdxBizJgProjectContraptionServiceImplService idxBizJgProjectContraptionService;
@Value("classpath:/json/urlInfo.json") @Value("classpath:/json/urlInfo.json")
private Resource urlInfo; private Resource urlInfo;
@Lazy
@Autowired @Autowired
private CommonServiceImpl commonServiceImpl; private CommonServiceImpl commonServiceImpl;
...@@ -998,10 +1004,23 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste ...@@ -998,10 +1004,23 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
} }
} }
private void checkFactoryNumUnique(String factoryNum, String produceUnitCreditCode, StringBuilder result) { private void checkFactoryNumUnique(String factoryNum, String produceUnitCreditCode,String produceUnitName, StringBuilder result) {
// 车用气瓶业务里面的 出厂编号/产品编码 校验唯一性(产品编号在车用气瓶范围内全局唯一) // 车用气瓶业务里面的 出厂编号/产品编码 校验唯一性(产品编号在车用气瓶范围内全局唯一)
if (commonMapper.checkFactoryNumUnique(factoryNum, null, produceUnitCreditCode) > 0) { List<Map<String, Object>> unitList = commonMapper.checkFactoryNumUniqueWithUseName(factoryNum, produceUnitCreditCode);
result.append("出厂编号/产品编码在该企业中已存在!"); String duplicateUnits = unitList.stream()
.filter(m -> {
Object count = m.get("count");
return count != null && Integer.parseInt(String.valueOf(count)) > 0;
})
.map(m -> String.valueOf(m.get("useUnitName")))
.filter(Objects::nonNull)
.distinct()
.collect(Collectors.joining(","));
if (!duplicateUnits.isEmpty()) {
result.append(String.format(
"制造单位[%s]生产的出厂编号为[%s]的气瓶,已被[%s]录入系统,请核实!",
produceUnitName, factoryNum, duplicateUnits
));
} }
} }
...@@ -3277,7 +3296,7 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste ...@@ -3277,7 +3296,7 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
String sourceRecord = equipmentClassForm.get(RECORD).toString(); String sourceRecord = equipmentClassForm.get(RECORD).toString();
// bug-21203 // bug-21203
if (equipmentInfoForm.containsKey("DATA_SOURCE")) { if (equipmentInfoForm.containsKey("DATA_SOURCE")) {
String dataSourceCopy = equipmentInfoForm.get("DATA_SOURCE").toString(); String dataSourceCopy = dataSource;
if (dataSourceCopy.startsWith("jg_his_black")) { if (dataSourceCopy.startsWith("jg_his_black")) {
dataSource = "jg_his_black_" + sourceRecord; dataSource = "jg_his_black_" + sourceRecord;
} else if (dataSourceCopy.startsWith("jg_his")) { } else if (dataSourceCopy.startsWith("jg_his")) {
...@@ -3480,134 +3499,136 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste ...@@ -3480,134 +3499,136 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
List<IdxBizJgMainParts> mainPartsList = new ArrayList<>(); List<IdxBizJgMainParts> mainPartsList = new ArrayList<>();
List<IdxBizJgProtectionDevices> protectionDevicesList = new ArrayList<>(); List<IdxBizJgProtectionDevices> protectionDevicesList = new ArrayList<>();
// 电梯 if (!equipmentParamsForm.isEmpty()){
if (EquipmentClassifityEnum.DT.getCode().equals(equList)) { // 电梯
IdxBizJgTechParamsElevator elevator = JSON.parseObject(JSON.toJSONString(equipmentParamsForm), IdxBizJgTechParamsElevator.class); if (EquipmentClassifityEnum.DT.getCode().equals(equList)) {
if (!ValidationUtil.isEmpty(elevator)) { IdxBizJgTechParamsElevator elevator = JSON.parseObject(JSON.toJSONString(equipmentParamsForm), IdxBizJgTechParamsElevator.class);
elevator.setRecord(record); if (!ValidationUtil.isEmpty(elevator)) {
elevator.setRecDate(date); elevator.setRecord(record);
elevator.setSequenceNbr(OPERATESAVE.equals(operateType) ? null : String.valueOf(equipmentParamsForm.get("ELEVATOR_SEQ"))); elevator.setRecDate(date);
iIdxBizJgTechParamsElevatorService.saveOrUpdateData(elevator); elevator.setSequenceNbr(OPERATESAVE.equals(operateType) ? null : String.valueOf(equipmentParamsForm.get("ELEVATOR_SEQ")));
} iIdxBizJgTechParamsElevatorService.saveOrUpdateData(elevator);
} }
// 厂车
else if (EquipmentClassifityEnum.CC.getCode().equals(equList)) {
IdxBizJgTechParamsVehicle vehicle = JSON.parseObject(JSON.toJSONString(equipmentParamsForm), IdxBizJgTechParamsVehicle.class);
if (!ValidationUtil.isEmpty(vehicle)) {
vehicle.setRecord(record);
vehicle.setRecDate(date);
vehicle.setSequenceNbr(OPERATESAVE.equals(operateType) ? null : String.valueOf(equipmentParamsForm.get("VEHICLE_SEQ")));
iIdxBizJgTechParamsVehicleService.saveOrUpdateData(vehicle);
} }
// 厂车
else if (EquipmentClassifityEnum.CC.getCode().equals(equList)) {
IdxBizJgTechParamsVehicle vehicle = JSON.parseObject(JSON.toJSONString(equipmentParamsForm), IdxBizJgTechParamsVehicle.class);
if (!ValidationUtil.isEmpty(vehicle)) {
vehicle.setRecord(record);
vehicle.setRecDate(date);
vehicle.setSequenceNbr(OPERATESAVE.equals(operateType) ? null : String.valueOf(equipmentParamsForm.get("VEHICLE_SEQ")));
iIdxBizJgTechParamsVehicleService.saveOrUpdateData(vehicle);
}
// 主要零部件 // 主要零部件
List<String> subFormMainPartsList = new ArrayList<>(); List<String> subFormMainPartsList = new ArrayList<>();
subFormMainPartsList.add("subForm_sey164b51a"); subFormMainPartsList.add("subForm_sey164b51a");
subFormMainPartsList.add("subForm_tef7yf5fbr"); subFormMainPartsList.add("subForm_tef7yf5fbr");
mainPartsList = this.getAccessoryEntity(equipmentParamsForm, subFormMainPartsList, EQUIP_MAINPARTS_FORM_ID, record, date, operateType); mainPartsList = this.getAccessoryEntity(equipmentParamsForm, subFormMainPartsList, EQUIP_MAINPARTS_FORM_ID, record, date, operateType);
}
// 索道
else if (EquipmentClassifityEnum.KYSD.getCode().equals(equList)) {
IdxBizJgTechParamsRopeway ropeway = JSON.parseObject(JSON.toJSONString(equipmentParamsForm), IdxBizJgTechParamsRopeway.class);
if (!ValidationUtil.isEmpty(ropeway)) {
ropeway.setRecord(record);
ropeway.setRecDate(date);
ropeway.setSequenceNbr(OPERATESAVE.equals(operateType) ? null : String.valueOf(equipmentParamsForm.get("ROPEWAY_SEQ")));
iIdxBizJgTechParamsRopewayService.saveOrUpdateData(ropeway);
} }
// 索道
else if (EquipmentClassifityEnum.KYSD.getCode().equals(equList)) {
IdxBizJgTechParamsRopeway ropeway = JSON.parseObject(JSON.toJSONString(equipmentParamsForm), IdxBizJgTechParamsRopeway.class);
if (!ValidationUtil.isEmpty(ropeway)) {
ropeway.setRecord(record);
ropeway.setRecDate(date);
ropeway.setSequenceNbr(OPERATESAVE.equals(operateType) ? null : String.valueOf(equipmentParamsForm.get("ROPEWAY_SEQ")));
iIdxBizJgTechParamsRopewayService.saveOrUpdateData(ropeway);
}
// 主要零部件 // 主要零部件
List<String> subFormMainPartsList = new ArrayList<>(); List<String> subFormMainPartsList = new ArrayList<>();
subFormMainPartsList.add("subForm_5fi0jewuyh"); subFormMainPartsList.add("subForm_5fi0jewuyh");
mainPartsList = this.getAccessoryEntity(equipmentParamsForm, subFormMainPartsList, EQUIP_MAINPARTS_FORM_ID, record, date, operateType); mainPartsList = this.getAccessoryEntity(equipmentParamsForm, subFormMainPartsList, EQUIP_MAINPARTS_FORM_ID, record, date, operateType);
}
// 游乐设施
else if (EquipmentClassifityEnum.YLSS.getCode().equals(equList)) {
IdxBizJgTechParamsRides rides = JSON.parseObject(JSON.toJSONString(equipmentParamsForm), IdxBizJgTechParamsRides.class);
if (!ValidationUtil.isEmpty(rides)) {
rides.setRecord(record);
rides.setRecDate(date);
rides.setSequenceNbr(OPERATESAVE.equals(operateType) ? null : String.valueOf(equipmentParamsForm.get("RIDES_SEQ")));
iIdxBizJgTechParamsRidesService.saveOrUpdateData(rides);
} }
} // 游乐设施
// 锅炉 else if (EquipmentClassifityEnum.YLSS.getCode().equals(equList)) {
else if (EquipmentClassifityEnum.GL.getCode().equals(equList)) { IdxBizJgTechParamsRides rides = JSON.parseObject(JSON.toJSONString(equipmentParamsForm), IdxBizJgTechParamsRides.class);
IdxBizJgTechParamsBoiler boiler = JSON.parseObject(JSON.toJSONString(equipmentParamsForm), IdxBizJgTechParamsBoiler.class); if (!ValidationUtil.isEmpty(rides)) {
if (!ValidationUtil.isEmpty(boiler)) { rides.setRecord(record);
boiler.setRecord(record); rides.setRecDate(date);
boiler.setRecDate(date); rides.setSequenceNbr(OPERATESAVE.equals(operateType) ? null : String.valueOf(equipmentParamsForm.get("RIDES_SEQ")));
boiler.setSequenceNbr(OPERATESAVE.equals(operateType) ? null : String.valueOf(equipmentParamsForm.get("BOILER_SEQ"))); iIdxBizJgTechParamsRidesService.saveOrUpdateData(rides);
iIdxBizJgTechParamsBoilerService.saveOrUpdateData(boiler); }
} }
// 锅炉
else if (EquipmentClassifityEnum.GL.getCode().equals(equList)) {
IdxBizJgTechParamsBoiler boiler = JSON.parseObject(JSON.toJSONString(equipmentParamsForm), IdxBizJgTechParamsBoiler.class);
if (!ValidationUtil.isEmpty(boiler)) {
boiler.setRecord(record);
boiler.setRecDate(date);
boiler.setSequenceNbr(OPERATESAVE.equals(operateType) ? null : String.valueOf(equipmentParamsForm.get("BOILER_SEQ")));
iIdxBizJgTechParamsBoilerService.saveOrUpdateData(boiler);
}
// 主要零部件 // 主要零部件
List<String> subFormMainPartsList = new ArrayList<>(); List<String> subFormMainPartsList = new ArrayList<>();
subFormMainPartsList.add("subForm_1hh88r4m69"); subFormMainPartsList.add("subForm_1hh88r4m69");
mainPartsList = this.getAccessoryEntity(equipmentParamsForm, subFormMainPartsList, EQUIP_MAINPARTS_FORM_ID, record, date, operateType); mainPartsList = this.getAccessoryEntity(equipmentParamsForm, subFormMainPartsList, EQUIP_MAINPARTS_FORM_ID, record, date, operateType);
}
// 压力容器
else if (EquipmentClassifityEnum.YLRQ.getCode().equals(equList)) {
IdxBizJgTechParamsVessel vessel = JSON.parseObject(JSON.toJSONString(equipmentParamsForm), IdxBizJgTechParamsVessel.class);
if (!ValidationUtil.isEmpty(vessel)) {
vessel.setRecord(record);
vessel.setRecDate(date);
String VIN = ValidationUtil.isEmpty(equipmentInfoForm.get("identificationCode")) ? "" : (String) equipmentInfoForm.get("identificationCode");
vessel.setVin(VIN);
vessel.setSequenceNbr(OPERATESAVE.equals(operateType) ? null : String.valueOf(equipmentParamsForm.get("VESSEL_SEQ")));
iIdxBizJgTechParamsVesselService.saveOrUpdateData(vessel);
} }
// 压力容器
else if (EquipmentClassifityEnum.YLRQ.getCode().equals(equList)) {
IdxBizJgTechParamsVessel vessel = JSON.parseObject(JSON.toJSONString(equipmentParamsForm), IdxBizJgTechParamsVessel.class);
if (!ValidationUtil.isEmpty(vessel)) {
vessel.setRecord(record);
vessel.setRecDate(date);
String VIN = ValidationUtil.isEmpty(equipmentInfoForm.get("identificationCode")) ? "" : (String) equipmentInfoForm.get("identificationCode");
vessel.setVin(VIN);
vessel.setSequenceNbr(OPERATESAVE.equals(operateType) ? null : String.valueOf(equipmentParamsForm.get("VESSEL_SEQ")));
iIdxBizJgTechParamsVesselService.saveOrUpdateData(vessel);
}
// 主要零部件 // 主要零部件
List<String> subFormMainPartsList = new ArrayList<>(); List<String> subFormMainPartsList = new ArrayList<>();
subFormMainPartsList.add("subForm_fie04854f2"); subFormMainPartsList.add("subForm_fie04854f2");
mainPartsList = this.getAccessoryEntity(equipmentParamsForm, subFormMainPartsList, EQUIP_MAINPARTS_FORM_ID, record, date, operateType); mainPartsList = this.getAccessoryEntity(equipmentParamsForm, subFormMainPartsList, EQUIP_MAINPARTS_FORM_ID, record, date, operateType);
// 安全附件 // 安全附件
List<String> subFormProtectionDevicesList = new ArrayList<>(); List<String> subFormProtectionDevicesList = new ArrayList<>();
subFormProtectionDevicesList.add("subForm_d4xdzhsgdj"); subFormProtectionDevicesList.add("subForm_d4xdzhsgdj");
protectionDevicesList = this.getAccessoryEntity(equipmentParamsForm, subFormProtectionDevicesList, EQUIP_PROTECTIONDEVICES_FORM_ID, record, date, operateType); protectionDevicesList = this.getAccessoryEntity(equipmentParamsForm, subFormProtectionDevicesList, EQUIP_PROTECTIONDEVICES_FORM_ID, record, date, operateType);
}
// 压力管道
else if (EquipmentClassifityEnum.YLGD.getCode().equals(equList)) {
IdxBizJgTechParamsPipeline pipeline = JSON.parseObject(JSON.toJSONString(equipmentParamsForm), IdxBizJgTechParamsPipeline.class);
if (!ValidationUtil.isEmpty(pipeline)) {
pipeline.setRecord(record);
pipeline.setRecDate(date);
pipeline.setSequenceNbr(OPERATESAVE.equals(operateType) ? null : String.valueOf(equipmentParamsForm.get("PIPELINE_SEQ")));
iIdxBizJgTechParamsPipelineService.saveOrUpdateData(pipeline);
} }
// 压力管道
else if (EquipmentClassifityEnum.YLGD.getCode().equals(equList)) {
IdxBizJgTechParamsPipeline pipeline = JSON.parseObject(JSON.toJSONString(equipmentParamsForm), IdxBizJgTechParamsPipeline.class);
if (!ValidationUtil.isEmpty(pipeline)) {
pipeline.setRecord(record);
pipeline.setRecDate(date);
pipeline.setSequenceNbr(OPERATESAVE.equals(operateType) ? null : String.valueOf(equipmentParamsForm.get("PIPELINE_SEQ")));
iIdxBizJgTechParamsPipelineService.saveOrUpdateData(pipeline);
}
// 主要零部件 // 主要零部件
List<String> subFormMainPartsList = new ArrayList<>(); List<String> subFormMainPartsList = new ArrayList<>();
subFormMainPartsList.add("subForm_9n7nu55z8r"); subFormMainPartsList.add("subForm_9n7nu55z8r");
mainPartsList = this.getAccessoryEntity(equipmentParamsForm, subFormMainPartsList, EQUIP_MAINPARTS_FORM_ID, record, date, operateType); mainPartsList = this.getAccessoryEntity(equipmentParamsForm, subFormMainPartsList, EQUIP_MAINPARTS_FORM_ID, record, date, operateType);
}
// 起重机械
else if (EquipmentClassifityEnum.QZJX.getCode().equals(equList)) {
IdxBizJgTechParamsLifting lifting = JSON.parseObject(JSON.toJSONString(equipmentParamsForm), IdxBizJgTechParamsLifting.class);
if (!ValidationUtil.isEmpty(lifting)) {
lifting.setRecord(record);
lifting.setRecDate(date);
lifting.setSequenceNbr(OPERATESAVE.equals(operateType) ? null : String.valueOf(equipmentParamsForm.get("LIFTING_SEQ")));
iIdxBizJgTechParamsLiftingService.saveOrUpdateData(lifting);
} }
// 起重机械
else if (EquipmentClassifityEnum.QZJX.getCode().equals(equList)) {
IdxBizJgTechParamsLifting lifting = JSON.parseObject(JSON.toJSONString(equipmentParamsForm), IdxBizJgTechParamsLifting.class);
if (!ValidationUtil.isEmpty(lifting)) {
lifting.setRecord(record);
lifting.setRecDate(date);
lifting.setSequenceNbr(OPERATESAVE.equals(operateType) ? null : String.valueOf(equipmentParamsForm.get("LIFTING_SEQ")));
iIdxBizJgTechParamsLiftingService.saveOrUpdateData(lifting);
}
// 主要零部件 // 主要零部件
List<String> subFormMainPartsList = new ArrayList<>(); List<String> subFormMainPartsList = new ArrayList<>();
subFormMainPartsList.add("subForm_bqirdyvztt"); subFormMainPartsList.add("subForm_bqirdyvztt");
mainPartsList = this.getAccessoryEntity(equipmentParamsForm, subFormMainPartsList, EQUIP_MAINPARTS_FORM_ID, record, date, operateType); mainPartsList = this.getAccessoryEntity(equipmentParamsForm, subFormMainPartsList, EQUIP_MAINPARTS_FORM_ID, record, date, operateType);
// 安全附件 // 安全附件
List<String> subFormProtectionDevicesList = new ArrayList<>(); List<String> subFormProtectionDevicesList = new ArrayList<>();
subFormProtectionDevicesList.add("subForm_29yy3pdzhl"); subFormProtectionDevicesList.add("subForm_29yy3pdzhl");
subFormProtectionDevicesList.add("subForm_h5h4x0zhur"); subFormProtectionDevicesList.add("subForm_h5h4x0zhur");
protectionDevicesList = this.getAccessoryEntity(equipmentParamsForm, subFormProtectionDevicesList, EQUIP_PROTECTIONDEVICES_FORM_ID, record, date, operateType); protectionDevicesList = this.getAccessoryEntity(equipmentParamsForm, subFormProtectionDevicesList, EQUIP_PROTECTIONDEVICES_FORM_ID, record, date, operateType);
}
} }
// 八大类技术参数和主要零部件和安全附件表 // 八大类技术参数和主要零部件和安全附件表
...@@ -3668,7 +3689,7 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste ...@@ -3668,7 +3689,7 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
Date nextInspectDate = (Date) map.get("NEXT_INSPECT_DATE"); Date nextInspectDate = (Date) map.get("NEXT_INSPECT_DATE");
dto.setNEXT_INSPECT_DATE(DateUtil.parse(DateUtil.format(nextInspectDate, DatePattern.NORM_DATE_PATTERN)).getTime()); dto.setNEXT_INSPECT_DATE(DateUtil.parse(DateUtil.format(nextInspectDate, DatePattern.NORM_DATE_PATTERN)).getTime());
} }
esEquipmentCategory.save(dto); equipmentCategoryService.saveWithImmediateRefresh(dto);
} }
} }
...@@ -3927,7 +3948,8 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste ...@@ -3927,7 +3948,8 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
useInfo.setRecord(record); useInfo.setRecord(record);
useInfo.setRecDate(new Date()); useInfo.setRecDate(new Date());
useInfo.setCreateDate(new Date()); useInfo.setCreateDate(new Date());
useInfo.setDataSource("his".equals(equipInfoDto.getDataSource()) ? "jg_his" : "jg");// 区分历史设备和新增设备 String source = equipInfoDto.getDataSource();
useInfo.setDataSource("his".equals(source) ? "jg_his" : "black".equals(source) ? "jg_his_black" : "jg");// 区分历史设备和新增设备
useInfo.setEquState(null); useInfo.setEquState(null);
useInfo.setIsIntoManagement("his".equals(equipInfoDto.getDataSource()));// 历史气瓶导入为已纳管设备 useInfo.setIsIntoManagement("his".equals(equipInfoDto.getDataSource()));// 历史气瓶导入为已纳管设备
// 历史气瓶导入设备状态为在用 // 历史气瓶导入设备状态为在用
...@@ -3965,7 +3987,10 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste ...@@ -3965,7 +3987,10 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
factoryInfo.setInsUseMaintainExplain(insUseMaintainExplain); factoryInfo.setInsUseMaintainExplain(insUseMaintainExplain);
factoryInfo.setOtherAccessoriesFact(otherAccessoriesFact); factoryInfo.setOtherAccessoriesFact(otherAccessoriesFact);
factoryInfo.setFactSupervisionInspectionReport(factSupervisionInspectionReport); factoryInfo.setFactSupervisionInspectionReport(factSupervisionInspectionReport);
factoryInfo.setProduceDate(DateUtil.parse(data.getProduceDate(), "yyyy-MM-dd")); Optional.ofNullable(data.getProduceDate())
.filter(s -> !s.trim().isEmpty())
.map(d -> DateUtil.parse(d, "yyyy-MM-dd"))
.ifPresent(factoryInfo::setProduceDate);
factoryInfo.setImported(Optional.ofNullable(data.getImported()).orElse("0")); factoryInfo.setImported(Optional.ofNullable(data.getImported()).orElse("0"));
factoryInfoList.add(factoryInfo); factoryInfoList.add(factoryInfo);
...@@ -3997,13 +4022,17 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste ...@@ -3997,13 +4022,17 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
inspectionDetectionInfo.setRecDate(new Date()); inspectionDetectionInfo.setRecDate(new Date());
inspectionDetectionInfo.setInspectType("ZZJDJY"); inspectionDetectionInfo.setInspectType("ZZJDJY");
inspectionDetectionInfo.setInspectConclusion("6040");// 默认合格 inspectionDetectionInfo.setInspectConclusion("6040");// 默认合格
inspectionDetectionInfo.setInspectDate(DateUtil.parse(data.getInspectDate(), "yyyy-MM-dd"));
// 根据条件确定增加的年数 // 根据条件确定增加的年数
inspectionDetectionInfo.setNextInspectDate(Date.from( Optional.ofNullable(data.getInspectDate())
LocalDate.parse(data.getInspectDate(), DateTimeFormatter.ofPattern("yyyy-MM-dd")) .filter(s -> !s.trim().isEmpty())
.plusYears(SPECIAL_CYLINDER.getCode().equals(equipInfoDto.getEquDefineCode()) ? 3 : 4) .map(dateStr -> LocalDate.parse(dateStr, DateTimeFormatter.ofPattern("yyyy-MM-dd")))
.atStartOfDay(ZoneId.systemDefault()) .ifPresent(inspectDate -> {
.toInstant())); inspectionDetectionInfo.setInspectDate(Date.from(inspectDate.atStartOfDay(ZoneId.systemDefault()).toInstant()));
// 计算下次检测日期(加 3 年或 4 年)
int plusYears = SPECIAL_CYLINDER.getCode().equals(equipInfoDto.getEquDefineCode()) ? 3 : 4;
LocalDate nextInspectDate = inspectDate.plusYears(plusYears);
inspectionDetectionInfo.setNextInspectDate(Date.from(nextInspectDate.atStartOfDay(ZoneId.systemDefault()).toInstant()));
});
inspectionDetectionInfoList.add(inspectionDetectionInfo); inspectionDetectionInfoList.add(inspectionDetectionInfo);
// 其他信息 // 其他信息
...@@ -4075,8 +4104,13 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste ...@@ -4075,8 +4104,13 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
changeRecordEq.setProductCode(factoryInfo.getFactoryNum());// 产品编号 changeRecordEq.setProductCode(factoryInfo.getFactoryNum());// 产品编号
certificateChangeRecordEqService.save(changeRecordEq); certificateChangeRecordEqService.save(changeRecordEq);
} }
String nextInspectDateStr = Optional.ofNullable(inspectionDetectionInfo.getNextInspectDate())
.map(date -> date.toInstant()
.atZone(ZoneId.systemDefault())
.toLocalDate()
.format(DateTimeFormatter.ofPattern("yyyy-MM-dd")))
.orElse(null);
Map<String, Object> equipMap = MapBuilder.<String, Object>create() Map<String, Object> equipMap = MapBuilder.<String, Object>create()
.put("equDefineName", equipInfoDto.getEquDefine())
.put("factoryNum", factoryInfo.getFactoryNum()) .put("factoryNum", factoryInfo.getFactoryNum())
.put("chargingMedium", data.getChargingMedium()) .put("chargingMedium", data.getChargingMedium())
.put("productName", data.getProductName()) .put("productName", data.getProductName())
...@@ -4084,20 +4118,16 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste ...@@ -4084,20 +4118,16 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
.put("produceDate", esEquipmentDto.getPRODUCE_DATE()) .put("produceDate", esEquipmentDto.getPRODUCE_DATE())
.put("nominalWorkingPressure", data.getNominalWorkingPressure()) .put("nominalWorkingPressure", data.getNominalWorkingPressure())
.put("singleBottleVolume", data.getSingleBottleVolume()) .put("singleBottleVolume", data.getSingleBottleVolume())
.put("singleBottleVolume", data.getSingleBottleVolume())
.put("inspectDate", data.getInspectDate()) .put("inspectDate", data.getInspectDate())
.put("equList", equipInfoDto.getEquListCode()) .put("equList", equipInfoDto.getEquListCode())
.put("equListName", equipInfoDto.getEquList()) .put("equListName", equipInfoDto.getEquList())
.put("equCategory", equipInfoDto.getEquCategoryCode())
.put("equCategoryName", equipInfoDto.getEquCategory())
.put("equDefine", equipInfoDto.getEquDefineCode()) .put("equDefine", equipInfoDto.getEquDefineCode())
.put("equDefineName", equipInfoDto.getEquDefine()) .put("equDefineName", equipInfoDto.getEquDefine())
.put("equCategoryName", equipInfoDto.getEquCategory())
.put("manageType", "unit") .put("manageType", "unit")
.put("equCategory", equipInfoDto.getEquCategoryCode())
.put("record", esEquipmentDto.getSEQUENCE_NBR()) .put("record", esEquipmentDto.getSEQUENCE_NBR())
.put("nextInspectDate", inspectionDetectionInfo.getNextInspectDate().toInstant() .put("nextInspectDate", nextInspectDateStr)
.atZone(ZoneId.systemDefault())
.toLocalDate()
.format(DateTimeFormatter.ofPattern("yyyy-MM-dd")))
.put("useInnerCode", useInfo.getUseInnerCode()) .put("useInnerCode", useInfo.getUseInnerCode())
.put("informationSituation", data.getInformationSituation()) .put("informationSituation", data.getInformationSituation())
.build(); .build();
...@@ -4470,12 +4500,12 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste ...@@ -4470,12 +4500,12 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
log.info("解析第{}行数据:{}", rowIndex, JSON.toJSONString(data)); log.info("解析第{}行数据:{}", rowIndex, JSON.toJSONString(data));
// 检查各字段是否为空,如果为空则追加错误信息 // 检查各字段是否为空,如果为空则追加错误信息
checkNotBlank(data.getProductName(), "设备名称不能为空;", result); checkNotBlank(data.getProductName(), "设备名称不能为空;", result);
checkNotBlank(data.getBrandName(), "品牌名称不能为空;", result); //checkNotBlank(data.getBrandName(), "品牌名称不能为空;", result);
checkNotBlank(data.getEquType(), "设备型号不能为空;", result); // checkNotBlank(data.getEquType(), "设备型号不能为空;", result);
checkNotBlank(data.getUseInnerCode(), "单位内部编号不能为空;", result); //checkNotBlank(data.getUseInnerCode(), "单位内部编号不能为空;", result);
if (useInnerCodeList.contains(data.getUseInnerCode())) { // if (useInnerCodeList.contains(data.getUseInnerCode())) {
result.append("单位内部编号不能重复;"); // result.append("单位内部编号不能重复;");
} // }
checkNotBlank(data.getWhetherVehicleCylinder(), "是否车用气瓶不能为空;", result); checkNotBlank(data.getWhetherVehicleCylinder(), "是否车用气瓶不能为空;", result);
checkNotBlank(data.getEquCodeType(), "是否有设备代码不能为空;", result); checkNotBlank(data.getEquCodeType(), "是否有设备代码不能为空;", result);
if ("1".equals(data.getEquCodeType())) { if ("1".equals(data.getEquCodeType())) {
...@@ -4496,35 +4526,39 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste ...@@ -4496,35 +4526,39 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
} else { } else {
data.setEquCode(""); data.setEquCode("");
} }
checkNotBlank(data.getDesignUnitCreditCode(), "设计单位统一社会信用代码不能为空;", result); //checkNotBlank(data.getDesignUnitCreditCode(), "设计单位统一社会信用代码不能为空;", result);
checkNotBlank(data.getDesignUnitName(), "设计单位名称不能为空;", result); //checkNotBlank(data.getDesignUnitName(), "设计单位名称不能为空;", result);
Optional.ofNullable(data.getDesignDate()).ifPresent(v -> checkDateFormatCorrect(v, "设计日期格式不正确;", result)); Optional.ofNullable(data.getDesignDate()).ifPresent(v -> checkDateFormatCorrect(v, "设计日期格式不正确;", result));
Optional.ofNullable(data.getAppraisalDate()).ifPresent(v -> checkDateFormatCorrect(v, "设计文件鉴定日期格式不正确;", result)); Optional.ofNullable(data.getAppraisalDate()).ifPresent(v -> checkDateFormatCorrect(v, "设计文件鉴定日期格式不正确;", result));
checkNotBlank(data.getProduceUnitCreditCode(), "制造单位统一社会信用代码不能为空;", result); checkNotBlank(data.getProduceUnitCreditCode(), "制造单位统一社会信用代码不能为空;", result);
checkNotBlank(data.getProduceUnitName(), "制造单位名称不能为空;", result); checkNotBlank(data.getProduceUnitName(), "制造单位名称不能为空;", result);
checkNotBlank(data.getProduceLicenseNum(), "制造许可编号不能为空;", result); // checkNotBlank(data.getProduceLicenseNum(), "制造许可编号不能为空;", result);
checkNotBlank(data.getFactoryNum(), "出厂编号/产品编码不能为空;", result); checkNotBlank(data.getFactoryNum(), "出厂编号/产品编码不能为空;", result);
if ("0".equals(data.getWhetherVehicleCylinder())) { if ("0".equals(data.getWhetherVehicleCylinder())) {
checkNotBlank(data.getCylinderCategory(), "气瓶分类不能为空;", result); checkNotBlank(data.getCylinderCategory(), "气瓶分类不能为空;", result);
checkFactoryNumUnique(data.getFactoryNum(), data.getProduceUnitCreditCode(), result); if (!StringUtils.isEmpty(data.getFactoryNum())){
checkFactoryNumUnique(data.getFactoryNum(), data.getProduceUnitCreditCode(),data.getProduceUnitName(), result);
}
} else { } else {
checkFactoryNumUniquenessForVehicleCylinder(data.getFactoryNum(), result); if (!StringUtils.isEmpty(data.getFactoryNum())){
checkFactoryNumUniquenessForVehicleCylinder(data.getFactoryNum(), result);
}
} }
checkNotBlank(data.getProduceDate(), "制造日期不能为空;", result); // checkNotBlank(data.getProduceDate(), "制造日期不能为空;", result);
Optional.ofNullable(data.getProduceDate()).ifPresent(v -> checkDateFormatCorrect(v, "制造日期格式不正确;", result)); Optional.ofNullable(data.getProduceDate()).ifPresent(v -> checkDateFormatCorrect(v, "制造日期格式不正确;", result));
checkNotBlank(data.getInspectOrgName(), "检测机构名称不能为空;", result); //checkNotBlank(data.getInspectOrgName(), "检测机构名称不能为空;", result);
checkNotBlank(data.getInspectOrgCode(), "检测机构代码不能为空;", result); //checkNotBlank(data.getInspectOrgCode(), "检测机构代码不能为空;", result);
//checkInspectOrg(data.getInspectOrgCode(), result);//查询检验检测机构 //checkInspectOrg(data.getInspectOrgCode(), result);//查询检验检测机构
checkNotBlank(data.getInspectStaff(), "检测人员名称不能为空;", result); //checkNotBlank(data.getInspectStaff(), "检测人员名称不能为空;", result);
checkNotBlank(data.getInspectDate(), "检测日期不能为空;", result); //checkNotBlank(data.getInspectDate(), "检测日期不能为空;", result);
checkNotBlank(data.getInspectReportNo(), "检验报告编号不能为空;", result); //checkNotBlank(data.getInspectReportNo(), "检验报告编号不能为空;", result);
Optional.ofNullable(data.getInspectDate()).ifPresent(v -> checkDateFormatCorrect(v, "检测日期格式不正确;", result)); Optional.ofNullable(data.getInspectDate()).ifPresent(v -> checkDateFormatCorrect(v, "检测日期格式不正确;", result));
checkNotBlank(data.getSingleBottleVolume(), "单瓶容积不能为空;", result); //checkNotBlank(data.getSingleBottleVolume(), "单瓶容积不能为空;", result);
checkNotBlank(data.getChargingMedium(), "充装介质不能为空;", result); //checkNotBlank(data.getChargingMedium(), "充装介质不能为空;", result);
checkNotBlank(data.getNominalWorkingPressure(), "公称工作压力不能为空;", result); //checkNotBlank(data.getNominalWorkingPressure(), "公称工作压力不能为空;", result);
checkNotBlank(data.getInformationSituation(), "信息化管理情况(二维码、电子标签、无)不能为空;", result); //checkNotBlank(data.getInformationSituation(), "信息化管理情况(二维码、电子标签、无)不能为空;", result);
// 信息化管理情况校验 // 信息化管理情况校验
checkInformatManageInfo(data, result); //checkInformatManageInfo(data, result);
// 如果存在错误信息,则抛出 BadRequest 异常 // 如果存在错误信息,则抛出 BadRequest 异常
if (result.length() > 0) { if (result.length() > 0) {
result.insert(0, "Excel第[" + rowIndex + "]行 -> "); result.insert(0, "Excel第[" + rowIndex + "]行 -> ");
......
...@@ -250,15 +250,15 @@ public class JgTableDataExportServiceImpl implements IJgTableDataExportService { ...@@ -250,15 +250,15 @@ public class JgTableDataExportServiceImpl implements IJgTableDataExportService {
* 登记证列表数据导出 * 登记证列表数据导出
*/ */
@Override @Override
public void certificate(String uuid, JgUseRegistrationManageDto dto, List<String> ids, String sort) { public void certificate(String uuid, JgUseRegistrationManageDto dto, Boolean isJG, List<String> ids, String sort) {
RequestContextWrapper contextWrapper = RequestContextWrapper.capture(); RequestContextWrapper contextWrapper = RequestContextWrapper.capture();
List<CertificateVo> exportData; List<CertificateVo> exportData;
if (ids.isEmpty()) { if (ids.isEmpty()) {
// 查询首页数据 // 查询首页数据
int currentPage = 1; int currentPage = 1;
Page<JgUseRegistrationManageDto> firstPage = jgUseRegistrationManageServiceImpl.buildFilter(dto, currentPage, PAGE_SIZE); Page<JgUseRegistrationManageDto> dtoPage = isJG ? jgUseRegistrationManageServiceImpl.queryForJgUseRegistrationManagePageForJG(dto, sort, currentPage, PAGE_SIZE)
Page<JgUseRegistrationManageDto> dtoPage = jgUseRegistrationManageServiceImpl.queryForJgUseRegistrationManagePage(firstPage, dto, sort); : jgUseRegistrationManageServiceImpl.queryForJgUseRegistrationManagePage(jgUseRegistrationManageServiceImpl.buildFilter(dto, currentPage, PAGE_SIZE), dto, sort);
long total = dtoPage.getTotal(); long total = dtoPage.getTotal();
int totalPage = (int) Math.ceil((double) total / PAGE_SIZE); int totalPage = (int) Math.ceil((double) total / PAGE_SIZE);
...@@ -276,8 +276,8 @@ public class JgTableDataExportServiceImpl implements IJgTableDataExportService { ...@@ -276,8 +276,8 @@ public class JgTableDataExportServiceImpl implements IJgTableDataExportService {
CompletableFuture<List<String>> future = CompletableFuture.supplyAsync(() -> { CompletableFuture<List<String>> future = CompletableFuture.supplyAsync(() -> {
// 恢复上下文到子线程 // 恢复上下文到子线程
contextWrapper.apply(); contextWrapper.apply();
Page<JgUseRegistrationManageDto> page = jgUseRegistrationManageServiceImpl.buildFilter(dto, pageIndex, PAGE_SIZE); Page<JgUseRegistrationManageDto> resultPage = isJG ? jgUseRegistrationManageServiceImpl.queryForJgUseRegistrationManagePageForJG(dto, sort, pageIndex, PAGE_SIZE)
Page<JgUseRegistrationManageDto> resultPage = jgUseRegistrationManageServiceImpl.queryForJgUseRegistrationManagePage(page, dto, sort); : jgUseRegistrationManageServiceImpl.queryForJgUseRegistrationManagePage(jgUseRegistrationManageServiceImpl.buildFilter(dto, pageIndex, PAGE_SIZE), dto, sort);
return resultPage.getRecords().stream() return resultPage.getRecords().stream()
.map(JgUseRegistrationManageDto::getSequenceNbr) .map(JgUseRegistrationManageDto::getSequenceNbr)
.map(String::valueOf) .map(String::valueOf)
...@@ -325,14 +325,18 @@ public class JgTableDataExportServiceImpl implements IJgTableDataExportService { ...@@ -325,14 +325,18 @@ public class JgTableDataExportServiceImpl implements IJgTableDataExportService {
if ("压力管道".equals(data.getEquList())) { if ("压力管道".equals(data.getEquList())) {
List<IdxBizJgProjectContraption> contraptions = idxBizJgProjectContraptionService.queryProConByCertSeq(data.getSequenceNbr()); List<IdxBizJgProjectContraption> contraptions = idxBizJgProjectContraptionService.queryProConByCertSeq(data.getSequenceNbr());
for (IdxBizJgProjectContraption obj : contraptions) { for (IdxBizJgProjectContraption obj : contraptions) {
BeanUtil.copyProperties(obj, data); CertificateVo newData = new CertificateVo();
exportData.add(data); BeanUtil.copyProperties(data, newData);
BeanUtil.copyProperties(obj, newData);
exportData.add(newData);
} }
} else { } else {
List<JSONObject> jsonObjects = jgUseRegistrationManageServiceImpl.queryEquByCertificateSeq(Long.valueOf(data.getSequenceNbr())); List<JSONObject> jsonObjects = jgUseRegistrationManageServiceImpl.queryEquByCertificateSeq(Long.valueOf(data.getSequenceNbr()));
for (JSONObject obj : jsonObjects) { for (JSONObject obj : jsonObjects) {
BeanUtil.copyProperties(obj, data); CertificateVo newData = new CertificateVo();
exportData.add(data); BeanUtil.copyProperties(data, newData);
BeanUtil.copyProperties(obj, newData);
exportData.add(newData);
} }
} }
}); });
......
...@@ -319,15 +319,16 @@ public class JgUseRegistrationManageServiceImpl extends BaseService<JgUseRegistr ...@@ -319,15 +319,16 @@ public class JgUseRegistrationManageServiceImpl extends BaseService<JgUseRegistr
return jgUseRegistrationManageMapper.queryForPage(page, dto, sortMap); return jgUseRegistrationManageMapper.queryForPage(page, dto, sortMap);
} }
public Page<JgUseRegistrationManageDto> queryForJgUseRegistrationManagePageForJG(Page<JgUseRegistrationManageDto> page, public Page<JgUseRegistrationManageDto> queryForJgUseRegistrationManagePageForJG(JgUseRegistrationManageDto dto, String sort, int current, int size) {
JgUseRegistrationManageDto dto, Page<JgUseRegistrationManageDto> page = new Page<JgUseRegistrationManageDto>();
String sort, String orgCode) { page.setCurrent(current);
page.setSize(size);
SortVo sortMap = commonServiceImpl.sortFieldConversion(sort); SortVo sortMap = commonServiceImpl.sortFieldConversion(sort);
if (ApplicationFormTypeEnum.BF.getBusinessCode().equals(dto.getApplyType()) && (!CylinderTypeEnum.CYLINDER.getCode().equals(dto.getEquCategoryCode()) || dto.getRegType().equals(BusinessTypeEnum.JG_VEHICLE_GAS_APPLICATION.getName()))){ if (ApplicationFormTypeEnum.BF.getBusinessCode().equals(dto.getApplyType()) && (!CylinderTypeEnum.CYLINDER.getCode().equals(dto.getEquCategoryCode()) || dto.getRegType().equals(BusinessTypeEnum.JG_VEHICLE_GAS_APPLICATION.getName()))){
dto.setCertificateStatus(null); dto.setCertificateStatus(null);
dto.setIsScrap("0"); dto.setIsScrap("0");
} }
return jgUseRegistrationManageMapper.queryForPageForJG(page, dto, sortMap, orgCode); return jgUseRegistrationManageMapper.queryForPageForJG(page, dto, sortMap, getSelectedOrgInfo().getCompany().getOrgCode());
} }
public Page<JgUseRegistrationManageDto> getRecords(Page<JgUseRegistrationManageDto> page, JgUseRegistrationManageDto dto, String cityCode) { public Page<JgUseRegistrationManageDto> getRecords(Page<JgUseRegistrationManageDto> page, JgUseRegistrationManageDto dto, String cityCode) {
......
...@@ -4172,7 +4172,8 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD ...@@ -4172,7 +4172,8 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
if (registerInfo != null) { if (registerInfo != null) {
registerInfo.setUseOrgCode(jgUseRegistration.getUseRegistrationCode()); registerInfo.setUseOrgCode(jgUseRegistration.getUseRegistrationCode());
registerInfo.setEquCodeType(String.valueOf(map.get("equCodeType"))); registerInfo.setEquCodeType(String.valueOf(map.get("equCodeType")));
if(submitType.equals("tempSubmit")){ // 新提交或暂存后提交需生成设备代码
if(ValidationUtil.isEmpty(submitType) || "tempSubmit".equals(submitType)){
equCode = ObjectUtils.isEmpty(map.get("equCode")) && !StringUtils.isEmpty(jgUseRegistration.getReceiveCompanyCode()) equCode = ObjectUtils.isEmpty(map.get("equCode")) && !StringUtils.isEmpty(jgUseRegistration.getReceiveCompanyCode())
? this.getEquCode(registerInfo, jgUseRegistration.getReceiveCompanyCode()) ? this.getEquCode(registerInfo, jgUseRegistration.getReceiveCompanyCode())
: String.valueOf(map.get("equCode")); : String.valueOf(map.get("equCode"));
...@@ -4335,6 +4336,7 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD ...@@ -4335,6 +4336,7 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
.build()); .build());
} }
} }
eventPublisher.publish(new EquipCreateOrEditEvent(this, BusinessTypeEnum.JG_NEW_EQUIP.name(), Sets.newHashSet(equipId), EquipCreateOrEditEvent.EquipType.equip));
return this.baseMapper.getDetailById(jgUseRegistration.getSequenceNbr()); return this.baseMapper.getDetailById(jgUseRegistration.getSequenceNbr());
} catch (BadRequest | LocalBadRequest e) { } catch (BadRequest | LocalBadRequest e) {
log.error(e.getMessage(), e); log.error(e.getMessage(), e);
......
...@@ -616,7 +616,7 @@ public class JgVehicleInformationServiceImpl extends BaseService<JgVehicleInform ...@@ -616,7 +616,7 @@ public class JgVehicleInformationServiceImpl extends BaseService<JgVehicleInform
// todo 本来FillingEditPermForCurrentUser已赋值但是此业务也使用的key companyType故新赋值key // todo 本来FillingEditPermForCurrentUser已赋值但是此业务也使用的key companyType故新赋值key
re.put("companyType2", CommonServiceImpl.getCompanyType(companyBo)); re.put("companyType2", CommonServiceImpl.getCompanyType(companyBo));
// 赋值数据质量等级 // 赋值数据质量等级
commonService.setDataQualityScore2Json(re, sequenceNbr + "", BusinessTypeEnum.JG_VEHICLE_GAS_APPLICATION); // commonService.setDataQualityScore2Json(re, sequenceNbr + "", BusinessTypeEnum.JG_VEHICLE_GAS_APPLICATION);
return re; return re;
} }
...@@ -1872,7 +1872,7 @@ public class JgVehicleInformationServiceImpl extends BaseService<JgVehicleInform ...@@ -1872,7 +1872,7 @@ public class JgVehicleInformationServiceImpl extends BaseService<JgVehicleInform
String firstUseOrgCode = (String) eqLists.stream().findFirst().orElseThrow(() -> new BadRequest("设备列表为空,无法获取第一个设备信息")).get("useOrgCode"); String firstUseOrgCode = (String) eqLists.stream().findFirst().orElseThrow(() -> new BadRequest("设备列表为空,无法获取第一个设备信息")).get("useOrgCode");
String firstVin = (String) eqLists.stream().findFirst().orElseThrow(() -> new BadRequest("设备列表为空,无法获取第一个设备信息")).get("vin"); String firstVin = (String) eqLists.stream().findFirst().orElseThrow(() -> new BadRequest("设备列表为空,无法获取第一个设备信息")).get("vin");
boolean isOrgCodeConsistent = useRegistrationCode.equals(firstUseOrgCode); boolean isOrgCodeConsistent = useRegistrationCode.equals(firstUseOrgCode);
boolean isVinConsistent = identificationCode.equals(firstVin); boolean isVinConsistent = "null".equals(identificationCode) && ValidationUtil.isEmpty(firstVin) || identificationCode.equals(firstVin);
return isSameChargingMedium && isSameVin && isOrgCodeConsistent && isVinConsistent; return isSameChargingMedium && isSameVin && isOrgCodeConsistent && isVinConsistent;
}) })
.orElseThrow(() -> new BadRequest("使用登记证号、车辆VIN码与所选设备不一致,请重新选择设备!")); .orElseThrow(() -> new BadRequest("使用登记证号、车辆VIN码与所选设备不一致,请重新选择设备!"));
...@@ -1890,11 +1890,11 @@ public class JgVehicleInformationServiceImpl extends BaseService<JgVehicleInform ...@@ -1890,11 +1890,11 @@ public class JgVehicleInformationServiceImpl extends BaseService<JgVehicleInform
.collect(Collectors.toList()) .collect(Collectors.toList())
); );
if (inspectionDetectionInfoList.stream().anyMatch(info -> // if (inspectionDetectionInfoList.stream().anyMatch(info ->
ObjectUtils.isEmpty(info) || ObjectUtils.isEmpty(info.getInspectType()) || // ObjectUtils.isEmpty(info) || ObjectUtils.isEmpty(info.getInspectType()) ||
ObjectUtils.isEmpty(info.getInspectConclusion()) || ObjectUtils.isEmpty(info.getInspectOrgCode()))) { // ObjectUtils.isEmpty(info.getInspectConclusion()) || ObjectUtils.isEmpty(info.getInspectOrgCode()))) {
throw new BadRequest("请补充设备检验检测信息后提交!"); // throw new BadRequest("请补充设备检验检测信息后提交!");
} // }
vehicleInfoDto.setNextInspectionDate(inspectionDetectionInfoList.stream() vehicleInfoDto.setNextInspectionDate(inspectionDetectionInfoList.stream()
.map(IdxBizJgInspectionDetectionInfo::getNextInspectDate) .map(IdxBizJgInspectionDetectionInfo::getNextInspectDate)
...@@ -2008,8 +2008,14 @@ public class JgVehicleInformationServiceImpl extends BaseService<JgVehicleInform ...@@ -2008,8 +2008,14 @@ public class JgVehicleInformationServiceImpl extends BaseService<JgVehicleInform
vehicleInformation.setRegDate(new Date()); vehicleInformation.setRegDate(new Date());
vehicleInformation.setCreateUserName(reginParams.getUserModel().getRealName()); vehicleInformation.setCreateUserName(reginParams.getUserModel().getRealName());
vehicleInformation.setGasNum(equipmentLists.size()); vehicleInformation.setGasNum(equipmentLists.size());
BigDecimal totalVolume = equipmentLists.stream() BigDecimal totalVolume = Optional.ofNullable(equipmentLists)
.map(x -> new BigDecimal(String.valueOf(x.get("singleBottleVolume")))) .orElse(Collections.emptyList())
.stream()
.map(x -> x.get("singleBottleVolume"))
.filter(Objects::nonNull) // 过滤 null 值
.map(Object::toString)
.filter(s -> !s.trim().isEmpty()) // 过滤空字符串
.map(BigDecimal::new)
.reduce(BigDecimal.ZERO, BigDecimal::add); .reduce(BigDecimal.ZERO, BigDecimal::add);
vehicleInformation.setVolume(totalVolume.toPlainString()); vehicleInformation.setVolume(totalVolume.toPlainString());
vehicleInformation.setFillingMedium(equipmentLists.stream() vehicleInformation.setFillingMedium(equipmentLists.stream()
...@@ -2138,7 +2144,10 @@ public class JgVehicleInformationServiceImpl extends BaseService<JgVehicleInform ...@@ -2138,7 +2144,10 @@ public class JgVehicleInformationServiceImpl extends BaseService<JgVehicleInform
// 保存关联设备信息 // 保存关联设备信息
jgVehicleInformationEqService.saveBatch(equipList); jgVehicleInformationEqService.saveBatch(equipList);
} }
Set<String> recordSet = equipmentLists.stream()
.map(v -> (String) v.get("record"))
.collect(Collectors.toSet());
eventPublisher.publish(new EquipCreateOrEditEvent(this, BusinessTypeEnum.JG_NEW_EQUIP.name(), recordSet, EquipCreateOrEditEvent.EquipType.equip));
return Collections.singletonList(vehicleInformation); return Collections.singletonList(vehicleInformation);
} }
......
...@@ -46,7 +46,8 @@ ...@@ -46,7 +46,8 @@
DATA_SOURCE, DATA_SOURCE,
USE_UNIT_NAME, USE_UNIT_NAME,
USE_DATE, USE_DATE,
DATA_QUALITY_SCORE DATA_QUALITY_SCORE,
IS_FIRST_MERGE as isFirstMerge
FROM FROM
IDX_BIZ_JG_PROJECT_CONTRAPTION ibjpc IDX_BIZ_JG_PROJECT_CONTRAPTION ibjpc
WHERE WHERE
......
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