Commit 7b653de2 authored by 刘林's avatar 刘林

fix(jg):车用气瓶暂存功能

parent 2c2ad606
...@@ -233,34 +233,35 @@ public class JgVehicleInformationServiceImpl extends BaseService<JgVehicleInform ...@@ -233,34 +233,35 @@ public class JgVehicleInformationServiceImpl extends BaseService<JgVehicleInform
vehicleInfoDto.setUseRegistrationFormUrl(String.valueOf(vehicle.get("useRegistrationFormUrl"))); vehicleInfoDto.setUseRegistrationFormUrl(String.valueOf(vehicle.get("useRegistrationFormUrl")));
} }
List<Map<String, Object>> equipmentLists = (List<Map<String, Object>>) map.get("equipmentLists"); List<Map<String, Object>> equipmentLists = (List<Map<String, Object>>) map.get("equipmentLists");
if (CollectionUtils.isEmpty(equipmentLists) ||
equipmentLists.stream().map(v -> (String) v.get("chargingMedium")).distinct().count() != 1) {
throw new BadRequest(CollectionUtils.isEmpty(equipmentLists) ? "请选择设备信息!" : "请选择相同充装介质设备!");
}
if (SUBMIT_TYPE_FLOW.equals(submit)) { if (SUBMIT_TYPE_FLOW.equals(submit)) {
if (CollectionUtils.isEmpty(equipmentLists) ||
equipmentLists.stream().map(v -> (String) v.get("chargingMedium")).distinct().count() != 1) {
throw new BadRequest(CollectionUtils.isEmpty(equipmentLists) ? "请选择设备信息!" : "请选择相同充装介质设备!");
}
// 检查设备是否已经在使用 // 检查设备是否已经在使用
// 个人主体的身份证(6600_620422199903010258) 特殊处理 只取_后的身份证号码 // 个人主体的身份证(6600_620422199903010258) 特殊处理 只取_后的身份证号码
this.repeatUsedEquipCheck(equipmentLists, this.repeatUsedEquipCheck(equipmentLists,
CompanyTypeEnum.INDIVIDUAL.getName().equals(company.getCompanyType()) ? company.getCompanyCode().split("_")[1] : company.getCompanyCode()); CompanyTypeEnum.INDIVIDUAL.getName().equals(company.getCompanyType()) ? company.getCompanyCode().split("_")[1] : company.getCompanyCode());
} List<IdxBizJgInspectionDetectionInfo> inspectionDetectionInfoList = idxBizJgInspectionDetectionInfoService.checkInspectionInfo(
List<IdxBizJgInspectionDetectionInfo> inspectionDetectionInfoList = idxBizJgInspectionDetectionInfoService.checkInspectionInfo( equipmentLists.stream()
equipmentLists.stream() .map(v -> (String) v.get("record"))
.map(v -> (String) v.get("record")) .collect(Collectors.toList())
.collect(Collectors.toList()) );
);
if (inspectionDetectionInfoList.stream().anyMatch(info ->
ObjectUtils.isEmpty(info) || ObjectUtils.isEmpty(info.getInspectType()) ||
ObjectUtils.isEmpty(info.getInspectConclusion()) || ObjectUtils.isEmpty(info.getInspectOrgCode()))) {
throw new BadRequest("请补充设备检验检测信息后提交!");
}
if (inspectionDetectionInfoList.stream().anyMatch(info -> vehicleInfoDto.setNextInspectionDate(inspectionDetectionInfoList.stream()
ObjectUtils.isEmpty(info) || ObjectUtils.isEmpty(info.getInspectType()) || .map(IdxBizJgInspectionDetectionInfo::getNextInspectDate)
ObjectUtils.isEmpty(info.getInspectConclusion()) || ObjectUtils.isEmpty(info.getInspectOrgCode()))) { .filter(Objects::nonNull)
throw new BadRequest("请补充设备检验检测信息后提交!"); .min(Date::compareTo)
.orElse(null));
} }
vehicleInfoDto.setNextInspectionDate(inspectionDetectionInfoList.stream()
.map(IdxBizJgInspectionDetectionInfo::getNextInspectDate)
.filter(Objects::nonNull)
.min(Date::compareTo)
.orElse(null));
vehicleInfoDto.setCreateDate(new Date()); vehicleInfoDto.setCreateDate(new Date());
vehicleInfoDto.setPromoter(reginParams.getUserModel().getUserId()); vehicleInfoDto.setPromoter(reginParams.getUserModel().getUserId());
...@@ -351,12 +352,19 @@ public class JgVehicleInformationServiceImpl extends BaseService<JgVehicleInform ...@@ -351,12 +352,19 @@ public class JgVehicleInformationServiceImpl extends BaseService<JgVehicleInform
vehicleInformation.setRegDate(new Date()); vehicleInformation.setRegDate(new Date());
vehicleInformation.setUseDate(Optional.ofNullable(String.valueOf(map.get("useDate"))).orElse("")); vehicleInformation.setUseDate(Optional.ofNullable(String.valueOf(map.get("useDate"))).orElse(""));
vehicleInformation.setCreateUserName(reginParams.getUserModel().getRealName()); vehicleInformation.setCreateUserName(reginParams.getUserModel().getRealName());
vehicleInformation.setGasNum(equipmentLists.size()); vehicleInformation.setGasNum(Optional.ofNullable(equipmentLists).map(List::size).orElse(0));
BigDecimal totalVolume = equipmentLists.stream() BigDecimal totalVolume = Optional.ofNullable(equipmentLists)
.orElse(Collections.emptyList())
.stream()
.map(x -> new BigDecimal(String.valueOf(x.get("singleBottleVolume")))) .map(x -> new BigDecimal(String.valueOf(x.get("singleBottleVolume"))))
.reduce(BigDecimal.ZERO, BigDecimal::add); .reduce(BigDecimal.ZERO, BigDecimal::add);
vehicleInformation.setVolume(totalVolume.toPlainString()); vehicleInformation.setVolume(totalVolume.toPlainString());
vehicleInformation.setFillingMedium(equipmentLists.get(0).get("chargingMedium") + "");
String fillingMedium = Optional.ofNullable(equipmentLists)
.filter(list -> !list.isEmpty())
.map(list -> String.valueOf(list.get(0).get("chargingMedium")))
.orElse("");
vehicleInformation.setFillingMedium(fillingMedium);
boolean hasId = StringUtils.isEmpty(vehicleInfoDto.getSequenceNbr()); boolean hasId = StringUtils.isEmpty(vehicleInfoDto.getSequenceNbr());
//新增 //新增
......
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