Commit ac1fb4cc authored by 刘林's avatar 刘林

fix(jg):工程装置编号校验

parent 744cc4b2
...@@ -3,6 +3,7 @@ package com.yeejoin.amos.boot.module.jg.biz.service.impl; ...@@ -3,6 +3,7 @@ package com.yeejoin.amos.boot.module.jg.biz.service.impl;
import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollUtil; import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.map.MapUtil;
import cn.hutool.core.text.CharSequenceUtil; import cn.hutool.core.text.CharSequenceUtil;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
...@@ -23,6 +24,7 @@ import com.yeejoin.amos.boot.biz.common.utils.RedisKey; ...@@ -23,6 +24,7 @@ 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.module.common.api.dao.ESEquipmentCategory; import com.yeejoin.amos.boot.module.common.api.dao.ESEquipmentCategory;
import com.yeejoin.amos.boot.module.common.biz.refresh.DataRefreshEvent; import com.yeejoin.amos.boot.module.common.biz.refresh.DataRefreshEvent;
import com.yeejoin.amos.boot.module.jg.api.dto.EquipRequestParamsDto;
import com.yeejoin.amos.boot.module.jg.api.entity.JgUseRegistrationManage; import com.yeejoin.amos.boot.module.jg.api.entity.JgUseRegistrationManage;
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.enums.EquipSourceEnum; import com.yeejoin.amos.boot.module.jg.api.enums.EquipSourceEnum;
...@@ -142,7 +144,6 @@ public class IdxBizJgProjectContraptionServiceImplService extends BaseEntityServ ...@@ -142,7 +144,6 @@ public class IdxBizJgProjectContraptionServiceImplService extends BaseEntityServ
private JgUseRegistrationManageServiceImpl registrationManageService; private JgUseRegistrationManageServiceImpl registrationManageService;
@Autowired @Autowired
private CommonMapper commonMapper; private CommonMapper commonMapper;
@Autowired @Autowired
private EventPublisher eventPublisher; private EventPublisher eventPublisher;
...@@ -188,6 +189,25 @@ public class IdxBizJgProjectContraptionServiceImplService extends BaseEntityServ ...@@ -188,6 +189,25 @@ public class IdxBizJgProjectContraptionServiceImplService extends BaseEntityServ
} }
/** /**
* 检查本单位下工程装置名称和工程装置编号是不是一一对应的
* 不对应抛出异常
*
* @param paramsDto
*/
void checkTheUnitProConMatching(EquipRequestParamsDto paramsDto) {
Integer existsConflictNum = this.lambdaQuery().eq(IdxBizJgProjectContraption::getUseUnitCreditCode, paramsDto.getCompanyCode()).eq(IdxBizJgProjectContraption::getUseUnitName, paramsDto.getCompanyName())
.eq(IdxBizJgProjectContraption::getIsIntoManagement, Boolean.TRUE)
.eq(IdxBizJgProjectContraption::getIsDelete, Boolean.FALSE)
.and(wrapper -> wrapper.ne(IdxBizJgProjectContraption::getProjectContraptionNo, paramsDto.getProjectContraptionNo()).eq(IdxBizJgProjectContraption::getProjectContraption, paramsDto.getProjectContraption())
.or().eq(IdxBizJgProjectContraption::getProjectContraptionNo, paramsDto.getProjectContraptionNo()).ne(IdxBizJgProjectContraption::getProjectContraption, paramsDto.getProjectContraption())
)
.count();
if (existsConflictNum > 0) {
throw new BadRequest("工程装置名称或编号与本单位下的已存在的数据冲突!");
}
}
/**
* 根据工程装置seq物理删除装置表数据和对应设备信息(数据库+es) * 根据工程装置seq物理删除装置表数据和对应设备信息(数据库+es)
* *
* @param sequenceNbr 工程装置表seq * @param sequenceNbr 工程装置表seq
...@@ -765,6 +785,11 @@ public class IdxBizJgProjectContraptionServiceImplService extends BaseEntityServ ...@@ -765,6 +785,11 @@ public class IdxBizJgProjectContraptionServiceImplService extends BaseEntityServ
public IdxBizJgProjectContraption saveFirstMergeProjectContraption(IdxBizJgProjectContraptionDto model) { public IdxBizJgProjectContraption saveFirstMergeProjectContraption(IdxBizJgProjectContraptionDto model) {
// 单位类型 // 单位类型
Map<String, Object> companyInfoMap = jgInstallationNoticeService.getCompanyType(); Map<String, Object> companyInfoMap = jgInstallationNoticeService.getCompanyType();
this.checkTheUnitProConMatching(EquipRequestParamsDto.builder()
.projectContraptionNo(model.getProjectContraptionNo())
.projectContraption(model.getProjectContraption())
.companyCode(MapUtil.getStr(companyInfoMap,"creditCode"))
.build());
IdxBizJgProjectContraption projectContraption = JSON.parseObject(toJSONString(model), IdxBizJgProjectContraption.class); IdxBizJgProjectContraption projectContraption = JSON.parseObject(toJSONString(model), IdxBizJgProjectContraption.class);
String equListName = jgVehicleInformationMapper.getEquCategoryNameByCode(model.getEquListCode()); String equListName = jgVehicleInformationMapper.getEquCategoryNameByCode(model.getEquListCode());
String equCategoryName = jgVehicleInformationMapper.getEquCategoryNameByCode(model.getEquCategoryCode()); String equCategoryName = jgVehicleInformationMapper.getEquCategoryNameByCode(model.getEquCategoryCode());
...@@ -779,8 +804,8 @@ public class IdxBizJgProjectContraptionServiceImplService extends BaseEntityServ ...@@ -779,8 +804,8 @@ public class IdxBizJgProjectContraptionServiceImplService extends BaseEntityServ
projectContraption.setEquCategoryName(equCategoryName); projectContraption.setEquCategoryName(equCategoryName);
projectContraption.setEquDefineName(equDefineName); projectContraption.setEquDefineName(equDefineName);
projectContraption.setPipelineLength(0.0); projectContraption.setPipelineLength(0.0);
projectContraption.setUseUnitName(companyInfoMap.get("companyName").toString()); projectContraption.setUseUnitName(MapUtil.getStr(companyInfoMap,"companyName"));
projectContraption.setUseUnitCreditCode(companyInfoMap.get("creditCode").toString()); projectContraption.setUseUnitCreditCode(MapUtil.getStr(companyInfoMap,"creditCode"));
this.saveOrUpdateData(projectContraption); this.saveOrUpdateData(projectContraption);
return projectContraption; return projectContraption;
} }
......
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