Commit 4ab2d5e8 authored by suhuiguang's avatar suhuiguang

Merge branch 'develop_tzs_register' of…

Merge branch 'develop_tzs_register' of http://39.100.92.250:5000/moa/amos-boot-biz into develop_tzs_register
parents 4e6f6e9c be59a8be
package com.yeejoin.amos.boot.module.jg.api.dto;
import com.yeejoin.amos.boot.module.ymt.api.dto.EquipmentCategoryDto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
/**
* 装备分类
*
* @author system_generator
* @date 2021-10-20
*/
@Data
@ApiModel(value="EquipmentClassifyDto", description="装备分类")
public class EquipmentClassifyDto extends EquipmentCategoryDto implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "children")
private List<EquipmentClassifyDto> children;
}
......@@ -7,9 +7,11 @@ import com.yeejoin.amos.boot.biz.common.bo.CompanyBo;
import com.yeejoin.amos.boot.module.common.api.dto.DPFilterParamDto;
import com.yeejoin.amos.boot.module.jg.api.bo.JgBizCountDataBO;
import com.yeejoin.amos.boot.module.jg.api.dto.DynamicColumnDto;
import com.yeejoin.amos.boot.module.jg.api.dto.EquipmentClassifyDto;
import com.yeejoin.amos.boot.module.jg.api.dto.ReportAnalysisSearchDTO;
import com.yeejoin.amos.boot.module.ymt.api.entity.EquipmentCategory;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import java.util.List;
import java.util.Map;
......@@ -230,5 +232,32 @@ public interface CommonMapper extends BaseMapper<EquipmentCategory> {
@Param("record") String record);
void updateEnterpriseSafetyStatus(@Param("useUnitCodeList") Set<String> useUnitCodeList);
@Select("WITH RECURSIVE category_tree AS (\n" +
" SELECT \n" +
" tt.id,\n" +
" tt.code,\n" +
" tt.name,\n" +
" ifnull((SELECT code FROM tz_equipment_category WHERE id = tt.parent_id), 0) parent_id,\n" +
" 1 AS level -- 定义当前级别为1\n" +
" FROM \n" +
" tz_equipment_category tt\n" +
" WHERE \n" +
" code = #{parentCode}\n" +
" UNION ALL\n" +
" -- 递归成员:从子节点继续查找\n" +
" SELECT \n" +
" child.id,\n" +
" child.code,\n" +
" child.name,\n" +
" (SELECT code FROM tz_equipment_category WHERE id = child.parent_id) parent_id,\n" +
" parent.level + 1 \n" +
" FROM \n" +
" tz_equipment_category child\n" +
" INNER JOIN \n" +
" category_tree parent ON child.parent_id = parent.id\n" +
")\n" +
"SELECT * FROM category_tree ORDER BY level;")
List<EquipmentClassifyDto> getEquClassifyByCode(String parentCode);
}
......@@ -9,6 +9,7 @@ import com.yeejoin.amos.boot.biz.common.bo.CompanyBo;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import com.yeejoin.amos.boot.module.jg.api.dto.CodeGenerateDto;
import com.yeejoin.amos.boot.module.jg.api.dto.EquipmentClassifyDto;
import com.yeejoin.amos.boot.module.jg.api.dto.UseFlagParamDto;
import com.yeejoin.amos.boot.module.jg.api.entity.JgRegistrationHistory;
import com.yeejoin.amos.boot.module.jg.api.entity.JgUseRegistrationManage;
......@@ -681,4 +682,17 @@ public class CommonController extends BaseController {
public Integer checkFactoryNumUniquenessForVehicleCylinder(@RequestParam("factoryNum") String factoryNum) {
return commonService.checkFactoryNumUniquenessForVehicleCylinder(factoryNum,null);
}
/**
* 根据父级code查询子设备分类
*
* @param parentCode 父级code
* @return list
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/getEquClassifyByCode")
@ApiOperation(httpMethod = "GET", value = "根据父级code查询子设备分类", notes = "根据父级code查询子设备分类")
public ResponseModel<List<EquipmentClassifyDto>> getEquClassifyByCode(@RequestParam(value = "parentCode") String parentCode) {
return ResponseHelper.buildResponse(commonService.getEquClassifyByCode(parentCode));
}
}
......@@ -6,8 +6,13 @@ 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.biz.event.CancellationEvent;
import com.yeejoin.amos.boot.module.jg.biz.service.ICommonService;
import com.yeejoin.amos.boot.module.jg.biz.service.impl.IdxBizJgRegisterInfoServiceImpl;
import com.yeejoin.amos.boot.module.jg.biz.service.impl.IdxBizJgUseInfoServiceImpl;
import com.yeejoin.amos.boot.module.ymt.api.entity.IdxBizJgRegisterInfo;
import com.yeejoin.amos.boot.module.ymt.api.entity.IdxBizJgUseInfo;
import com.yeejoin.amos.boot.module.ymt.api.mapper.IdxBizJgRegisterInfoMapper;
import com.yeejoin.amos.boot.module.ymt.api.mapper.IdxBizJgUseInfoMapper;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.event.EventListener;
......@@ -26,24 +31,21 @@ import java.util.concurrent.LinkedBlockingQueue;
*/
@Component
@Slf4j
@RequiredArgsConstructor
public class CancellationEventListener {
@Value("${cancellation.deal.thread.number:1}")
private int threadNumber;
private ICommonService commonService;
private final ICommonService commonService;
private ESEquipmentCategory esEquipmentCategoryDao;
private final ESEquipmentCategory esEquipmentCategoryDao;
private IdxBizJgUseInfoMapper idxBizJgUseInfoMapper;
private final IdxBizJgUseInfoServiceImpl idxBizJgUseInfoService;
private BlockingQueue<String> queue = new LinkedBlockingQueue<>();
private final IdxBizJgRegisterInfoServiceImpl idxBizJgRegisterInfoService;
public CancellationEventListener(ICommonService commonService, ESEquipmentCategory esEquipmentCategoryDao, IdxBizJgUseInfoMapper idxBizJgUseInfoMapper) {
this.commonService = commonService;
this.esEquipmentCategoryDao = esEquipmentCategoryDao;
this.idxBizJgUseInfoMapper = idxBizJgUseInfoMapper;
}
private BlockingQueue<String> queue = new LinkedBlockingQueue<>();
@EventListener(value = CancellationEvent.class)
public void handleTransactionalEvent(CancellationEvent event) {
......@@ -75,18 +77,28 @@ public class CancellationEventListener {
Boolean inUsed = commonService.checkEquipIsUsed(record);
// 无引用则进行修改纳管状态为未纳管
if (!inUsed) {
// 更新已纳管为未纳管-数据库
LambdaUpdateWrapper<IdxBizJgUseInfo> updateWrapper = new LambdaUpdateWrapper<>();
updateWrapper.eq(IdxBizJgUseInfo::getRecord, record);
updateWrapper.set(IdxBizJgUseInfo::getIsIntoManagement, false);
idxBizJgUseInfoMapper.update(null, updateWrapper);
// 更新已纳管为未纳管-es
// 更新已纳管为未纳管 - 数据库
idxBizJgUseInfoService.lambdaUpdate()
.eq(IdxBizJgUseInfo::getRecord, record)
.set(IdxBizJgUseInfo::getIsIntoManagement, false)
.update();
// 清除系统自动生成的设备代码`equCode`
boolean isRegisterUpdated = idxBizJgRegisterInfoService.lambdaUpdate()
.eq(IdxBizJgRegisterInfo::getRecord, record)
.eq(IdxBizJgRegisterInfo::getEquCodeType, "2")
.set(IdxBizJgRegisterInfo::getEquCode, null)
.update();
// 同步修改ES数据
Optional<ESEquipmentCategoryDto> optional = esEquipmentCategoryDao.findById(record);
if (optional.isPresent()) {
ESEquipmentCategoryDto esEquipmentCategoryDto = optional.get();
optional.ifPresent(esEquipmentCategoryDto -> {
esEquipmentCategoryDto.setIS_INTO_MANAGEMENT(false);
if (isRegisterUpdated) {
esEquipmentCategoryDto.setEQU_CODE(null);
}
esEquipmentCategoryDao.save(esEquipmentCategoryDto);
}
});
}
}
}
......@@ -6,6 +6,7 @@ import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.yeejoin.amos.boot.biz.common.bo.CompanyBo;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.amos.boot.module.jg.api.dto.EquipmentClassifyDto;
import com.yeejoin.amos.boot.module.jg.api.dto.InstanceRuntimeData;
import com.yeejoin.amos.boot.module.jg.api.dto.UseFlagParamDto;
import com.yeejoin.amos.boot.module.jg.api.entity.JgUseRegistrationManage;
......@@ -241,4 +242,6 @@ public interface ICommonService {
List<EquipmentCategoryDto> equipmentClassificationNoPipeline(String type);
List<EquipmentCategoryDto> getEquDefineByParentId(String parentId);
List<EquipmentClassifyDto> getEquClassifyByCode(String parentCode);
}
......@@ -792,7 +792,7 @@ public class CommonServiceImpl implements ICommonService {
result.forEach(x -> convertAndAddToUnitList(x, unitList));
}
// 使用单位追加 三环认领的(业主可能未注册系统,别人帮忙认领的,帮忙认领后会保存一份原使用单位的数据到字典)
if ("使用单位".equals(type)) {
if ("使用单位".equals(type) && "gasCylindersForCars".equals(business)) {
List<DictionarieValueModel> result = Systemctl.dictionarieClient.dictValues("OLD_USE_UNIT").getResult();
result.forEach(x -> convertAndAddToUnitList(x, unitList));
}
......@@ -2122,6 +2122,39 @@ public class CommonServiceImpl implements ICommonService {
return equipmentCategoryMapper.getEquDefineByParentId(parentId);
}
@Override
public List<EquipmentClassifyDto> getEquClassifyByCode(String parentCode) {
List<EquipmentClassifyDto> equipmentCategoryDtos = commonMapper.getEquClassifyByCode(parentCode);
if (ValidationUtil.isEmpty(equipmentCategoryDtos)) {
return new ArrayList<>();
}
Map<String, EquipmentClassifyDto> idToDtoMap = equipmentCategoryDtos.stream()
.collect(Collectors.toMap(EquipmentClassifyDto::getCode, dto -> dto));
List<EquipmentClassifyDto> rootNodes = equipmentCategoryDtos.stream()
.filter(dto -> dto.getParentId().equals("0"))
.collect(Collectors.toList());
equipmentCategoryDtos.forEach(dto -> {
String parentId = dto.getParentId();
if (!ValidationUtil.isEmpty(parentId)) {
EquipmentClassifyDto parent = idToDtoMap.get(parentId);
if (parent != null) {
if (parent.getChildren() == null) {
parent.setChildren(new ArrayList<>());
}
parent.getChildren().add(dto);
}
}
});
return rootNodes.stream()
.flatMap(root -> root.getChildren().stream())
.collect(Collectors.toList());
}
/**
* 排序 :页面列表排序功能支持,将 "字段,ascend" 或 "字段,descend" 转化为对应JSONObject
*
......
......@@ -220,7 +220,7 @@ public class IdxBizJgProjectContraptionServiceImpl extends BaseService<IdxBizJgP
*/
private void judgeCheckResult(IdxBizJgProjectContraption record) {
record.setDisableBasicButton(true);
if("8200".equals(record.getEquCategory()) || "8100".equals(record.getEquCategory())){
if ("8200".equals(record.getEquCategory()) || "8100".equals(record.getEquCategory()) || "8300".equals(record.getEquCategory())) {
int notNullCount = this.baseMapper.selectCheckCountByNotNull(String.valueOf(record.getSequenceNbr()));
long total = this.baseMapper.selectEquipCount(String.valueOf(record.getSequenceNbr()));
if(total==notNullCount && total !=0){
......@@ -346,8 +346,8 @@ public class IdxBizJgProjectContraptionServiceImpl extends BaseService<IdxBizJgP
}
public void exportSummaryBasicInfo(String sequenceNbr, HttpServletResponse response, String category) {
//长输/公共管道汇总
if ("8200".equals(category) || "8100".equals(category)) {
// 长输/公共管道/工业管道汇总
if ("8200".equals(category) || "8100".equals(category) || "8300".equals(category)) {
// 总数
double total;
// 每页显示条数,默认 10
......
......@@ -850,12 +850,15 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
*/
private void checkCarNumberUniquenessWithHisCC(LinkedHashMap<?, ?> equipmentInfoForm, String record, String dataSource) {
if (dataSource.contains("his") && EquipmentClassifityEnum.CC.getCode().equals(equipmentInfoForm.get(EQU_LIST)) && !ValidationUtil.isEmpty(equipmentInfoForm.get(CAR_NUMBER))) {
Integer count = idxBizJgRegisterInfoService.lambdaQuery()
.eq(IdxBizJgRegisterInfo::getCarNumber, equipmentInfoForm.get(CAR_NUMBER))
.ne(!StringUtils.isEmpty(record), IdxBizJgRegisterInfo::getRecord, record)
.count();
if (count > 0) {
throw new BadRequest("车牌号已存在,请重新输入!");
String carNumber = String.valueOf(equipmentInfoForm.get(CAR_NUMBER));
if (!"无".equals(carNumber)) {
Integer count = idxBizJgRegisterInfoService.lambdaQuery()
.eq(IdxBizJgRegisterInfo::getCarNumber, carNumber)
.ne(!StringUtils.isEmpty(record), IdxBizJgRegisterInfo::getRecord, record)
.count();
if (count > 0) {
throw new BadRequest("车牌号已存在,请重新输入!");
}
}
}
}
......
......@@ -88,6 +88,8 @@ import org.typroject.tyboot.core.restful.utils.ResponseModel;
import javax.servlet.http.HttpServletResponse;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.net.URLEncoder;
import java.text.SimpleDateFormat;
import java.time.LocalDate;
......@@ -103,7 +105,6 @@ import java.util.stream.IntStream;
import java.util.stream.Stream;
import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream;
import static java.util.stream.Collectors.toList;
import static java.util.stream.Collectors.toSet;
......@@ -310,7 +311,7 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
}
public void updateEquipMessage(String currentDocumentId, JgUseRegistration jgUseRegistration, JSONObject map,
IdxBizJgRegisterInfo registerInfo, IdxBizJgOtherInfo otherInfo, Boolean flag, String useRegistrationCode) {
IdxBizJgRegisterInfo registerInfo, IdxBizJgOtherInfo otherInfo, Boolean flag, String useRegistrationCode, Map<String, Object> equipment) {
String useOrgCode = jgUseRegistration.getUseRegistrationCode();
// 市
List<LinkedHashMap> city = (List<LinkedHashMap>) redisUtils.get("CITY");
......@@ -371,7 +372,7 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
// 更新使用信息
useInfoMapper.update(useInfo, lambda);
// 更新检验检测信息
this.updateOrCreateInspectionDetection(map, jgUseRegistration, registerInfo);
this.updateOrCreateInspectionDetection(equipment, jgUseRegistration, registerInfo);
// 更新注册登记信息表
LambdaUpdateWrapper<IdxBizJgRegisterInfo> IdxBizJgRegLambda = new UpdateWrapper<IdxBizJgRegisterInfo>().lambda();
IdxBizJgRegLambda.eq(IdxBizJgRegisterInfo::getRecord, map.get("equipId"))
......@@ -398,20 +399,20 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
createCode(map, jgUseRegistration, registerInfo, useInfo, otherInfo);
}
private void updateOrCreateInspectionDetection(JSONObject map, JgUseRegistration jgUseRegistration, IdxBizJgRegisterInfo registerInfo) {
private void updateOrCreateInspectionDetection(Map<String, Object> equipment, JgUseRegistration jgUseRegistration, IdxBizJgRegisterInfo registerInfo) {
InspectionDetectionInfo inspectionDetectionInfo = new InspectionDetectionInfo();
BeanUtil.copyProperties(map, inspectionDetectionInfo);
String record = map.get("equipId").toString();
BeanUtil.copyProperties(equipment, inspectionDetectionInfo);
String record = equipment.get("record").toString();
if("unit".equals(jgUseRegistration.getManageType()) && registerInfo.getEquList().equals(EquipmentClassifityEnum.YLGD.getCode())){
// 压力管道逻辑,根据设备record + 检验报告编号判定唯一一条检验流水,有进行更新,无则进行插入
inspectionDetectionInfo.setInspectConclusion((String) map.get("inspectConclusionCode"));
inspectionDetectionInfo.setInspectConclusion((String) equipment.get("inspectConclusionCode"));
saveEquipOfPieLineInspectData(record, inspectionDetectionInfo);
} else {
// 其他逻辑
if (map.get("jySeq") != null) {
if (equipment.get("jySeq") != null) {
// 更新逻辑
InspectionDetectionInfo inspectionDetectionInfoDb = inspectionDetectionInfoMapper.selectById(map.get("jySeq").toString());
InspectionDetectionInfo inspectionDetectionInfoDb = inspectionDetectionInfoMapper.selectById(equipment.get("jySeq").toString());
Bean.copyExistPropertis(inspectionDetectionInfo, inspectionDetectionInfoDb);
inspectionDetectionInfoMapper.updateById(inspectionDetectionInfoDb);
} else {
......@@ -779,6 +780,15 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
.collect(Collectors.toSet())
: Collections.emptySet();
if (EquipmentClassifityEnum.YLGD.getCode().equals(equListCode)) {
equipmentLists.forEach(equip -> {
if ((equip.get("inspectReportNo") == null || equip.get("inspectReportNo").toString().isEmpty()) ||
(equip.get("inspectOrgCode") == null || equip.get("inspectOrgCode").toString().isEmpty())) {
throw new BadRequest("检验信息不能为空,请完善检验信息后进行登记!");
}
});
}
List<Map<String, Object>> filteredEquipmentLists = equipmentLists.stream()
.filter(equipment -> !excludedRecords.contains(equipment.get("record")))
.collect(Collectors.toList());
......@@ -1092,7 +1102,8 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
// equipment.put("inspectOrgName", mapData.getOrDefault("inspectOrgName", ""));
// equipment.put("inspectConclusion", inspectConclusionName);
// 更新设备信息 && 生成使用登记证编号 && 同步es
processMapData(sequenceNbr, mapData, jgUseRegistration, jgRegistrationHistory, registerInfo, otherInfo, taskV2Model, jsonObject, flag, useRegistrationCode, isMerge);
processMapData(sequenceNbr, mapData, jgUseRegistration, jgRegistrationHistory, registerInfo, otherInfo, taskV2Model,
jsonObject, flag, useRegistrationCode, equipment, isMerge);
// 查询设备制造信息
LambdaQueryWrapper<IdxBizJgFactoryInfo> factoryInfoWrapper = new LambdaQueryWrapper<>();
factoryInfoWrapper.eq(IdxBizJgFactoryInfo::getRecord, equId);
......@@ -1175,7 +1186,12 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
contraption.setProjectContraptionParentId(jgUseRegistration.getProjectContraptionId());
jgProjectContraptionService.updateById(contraption);
});
jgProjectContraption.setPipelineLength((Double.parseDouble((String) mapData.get("pipelineLength"))));
Object pipelineLengthObj = mapData.get("pipelineLength");
jgProjectContraption.setPipelineLength(
pipelineLengthObj instanceof Number
? ((Number) pipelineLengthObj).doubleValue()
: Double.parseDouble(String.valueOf(pipelineLengthObj))
);
}
// 更新 jgProjectContraption 数据
jgProjectContraptionService.updateById(jgProjectContraption);
......@@ -1469,7 +1485,8 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
// 更新代办
TaskV2Model taskV2Model = updateAgency(jgUseRegistration);
processMapData(sequenceNbr, mapData, jgUseRegistration, jgRegistrationHistory, registerInfo, otherInfo, taskV2Model, jsonObject, Boolean.FALSE, null, Boolean.FALSE);
processMapData(sequenceNbr, mapData, jgUseRegistration, jgRegistrationHistory, registerInfo, otherInfo, taskV2Model,
jsonObject, Boolean.FALSE, null, null, Boolean.FALSE);
// 生成证书管理表记录
generateRegistrationManage(jgUseRegistration, registerInfo, Boolean.FALSE, null);
......@@ -1496,11 +1513,12 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
private void processMapData(Long sequenceNbr, JSONObject mapData, JgUseRegistration jgUseRegistration,
JgRegistrationHistory jgRegistrationHistory, IdxBizJgRegisterInfo registerInfo, IdxBizJgOtherInfo otherInfo,
TaskV2Model taskV2Model, JSONObject jsonObject, Boolean flag, String useRegistrationCode, Boolean isMerge) {
TaskV2Model taskV2Model, JSONObject jsonObject, Boolean flag, String useRegistrationCode,
Map<String, Object> equipment, boolean isMerge) {
jgUseRegistration.setSupervisoryCode(otherInfo.getSupervisoryCode());
// 更新设备信息
updateEquipMessage(String.valueOf(sequenceNbr), jgUseRegistration, mapData, registerInfo, otherInfo, flag, useRegistrationCode);
updateEquipMessage(String.valueOf(sequenceNbr), jgUseRegistration, mapData, registerInfo, otherInfo, flag, useRegistrationCode, equipment);
// 生成使用登记证编号
if (!ObjectUtils.isEmpty(jgUseRegistration.getSupervisoryCode())) {
if ("unit".equals(jgUseRegistration.getManageType())) {
......@@ -1513,6 +1531,7 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
LambdaUpdateWrapper<IdxBizJgRegisterInfo> lambda = new UpdateWrapper<IdxBizJgRegisterInfo>().lambda();
lambda.eq(IdxBizJgRegisterInfo::getRecord, registerInfo.getRecord());
lambda.set(true, IdxBizJgRegisterInfo::getUseOrgCode, code);
lambda.set(isMerge, IdxBizJgRegisterInfo::getEquCode, registerInfo.getEquCode());
// 新增页面选择无设备代码后,在审批通过后自动生成设备代码
this.justGenerateEquCode(lambda, registerInfo, jgUseRegistration.getReceiveCompanyCode(), mapData, jgRegistrationHistory);
idxBizJgRegisterInfoService.update(lambda);
......@@ -1521,6 +1540,7 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
LambdaUpdateWrapper<IdxBizJgRegisterInfo> lambda = new UpdateWrapper<IdxBizJgRegisterInfo>().lambda();
lambda.eq(IdxBizJgRegisterInfo::getRecord, registerInfo.getRecord());
lambda.set(true, IdxBizJgRegisterInfo::getUseOrgCode, jgUseRegistration.getUseRegistrationCode());
lambda.set(isMerge, IdxBizJgRegisterInfo::getEquCode, registerInfo.getEquCode());
// 新增页面选择无设备代码后,在审批通过后自动生成设备代码
this.justGenerateEquCode(lambda, registerInfo, jgUseRegistration.getReceiveCompanyCode(), mapData, jgRegistrationHistory);
idxBizJgRegisterInfoService.update(lambda);
......@@ -3337,12 +3357,15 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
// 场车设备校验车牌号的唯一性
if (EquipmentClassifityEnum.CC.getCode().equals(map.get("EQU_LIST_CODE"))) {
Integer count = idxBizJgRegisterInfoService.lambdaQuery()
.eq(IdxBizJgRegisterInfo::getCarNumber, map.get(carNumber))
.ne(!com.baomidou.mybatisplus.core.toolkit.StringUtils.isEmpty(equipId), IdxBizJgRegisterInfo::getRecord, equipId)
.count();
if (count > 0) {
throw new BadRequest("车牌号已存在,请重新输入!");
String carNum = String.valueOf(map.get(carNumber));
if (!"无".equals(carNum)) {
Integer count = idxBizJgRegisterInfoService.lambdaQuery()
.eq(IdxBizJgRegisterInfo::getCarNumber, carNum)
.ne(!StringUtils.isEmpty(equipId), IdxBizJgRegisterInfo::getRecord, equipId)
.count();
if (count > 0) {
throw new BadRequest("车牌号已存在,请重新输入!");
}
}
}
......@@ -4022,11 +4045,12 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
List<Map<String, Object>> equList = this.getBaseMapper()
.selectPieLineListByOfCanReg(uniqueContraptionList);
// 计算管道长度总和
double totalPipelineLength = equList.stream()
double totalPipelineLength = BigDecimal.valueOf(equList.stream()
.map(map -> map.get("pipeLength"))
.filter(Objects::nonNull)
.mapToDouble(value -> Double.parseDouble((String) value))
.sum();
.sum()).setScale(2, RoundingMode.HALF_UP).doubleValue();
MapBuilder<String, Object> resultBuilder = MapBuilder.<String, Object>create()
.put("equipmentLists", equList)
.put("projectContraption", projectContraption.getProjectContraption())
......
......@@ -100,5 +100,6 @@ public interface EquipmentCategoryMapper extends BaseMapper<EquipmentCategory> {
@Select("SELECT * FROM tz_equipment_category WHERE parent_id = #{parentId}")
List<EquipmentCategoryDto> getEquDefineByParentId(String parentId);
}
......@@ -249,7 +249,7 @@
(select USC_UNIT_NAME from idx_biz_jg_construction_info jci where ibjui.RECORD = jci.RECORD ORDER BY jci."USC_DATE" DESC limit 1) as uscUnitName,
to_char((select USC_DATE from idx_biz_jg_construction_info jci where ibjui.RECORD = jci.RECORD ORDER BY jci."USC_DATE" DESC limit 1),'YYYY-MM-DD') as uscDate,
ibjdi."DESIGN_UNIT_NAME" AS designUnitName,
to_char(ibjui."USE_DATE",'YYYY-MM-DD') AS useDate,
ibjui."USE_DATE" AS useDate,
ibjui."RECORD" AS record
FROM idx_biz_jg_use_info ibjui
LEFT JOIN idx_biz_jg_tech_params_pipeline ibjtpp ON ibjui.RECORD = ibjtpp.RECORD
......
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