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; ...@@ -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.common.api.dto.DPFilterParamDto;
import com.yeejoin.amos.boot.module.jg.api.bo.JgBizCountDataBO; 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.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.jg.api.dto.ReportAnalysisSearchDTO;
import com.yeejoin.amos.boot.module.ymt.api.entity.EquipmentCategory; import com.yeejoin.amos.boot.module.ymt.api.entity.EquipmentCategory;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -230,5 +232,32 @@ public interface CommonMapper extends BaseMapper<EquipmentCategory> { ...@@ -230,5 +232,32 @@ public interface CommonMapper extends BaseMapper<EquipmentCategory> {
@Param("record") String record); @Param("record") String record);
void updateEnterpriseSafetyStatus(@Param("useUnitCodeList") Set<String> useUnitCodeList); 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; ...@@ -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.bo.ReginParams;
import com.yeejoin.amos.boot.biz.common.controller.BaseController; 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.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.dto.UseFlagParamDto;
import com.yeejoin.amos.boot.module.jg.api.entity.JgRegistrationHistory; import com.yeejoin.amos.boot.module.jg.api.entity.JgRegistrationHistory;
import com.yeejoin.amos.boot.module.jg.api.entity.JgUseRegistrationManage; import com.yeejoin.amos.boot.module.jg.api.entity.JgUseRegistrationManage;
...@@ -681,4 +682,17 @@ public class CommonController extends BaseController { ...@@ -681,4 +682,17 @@ public class CommonController extends BaseController {
public Integer checkFactoryNumUniquenessForVehicleCylinder(@RequestParam("factoryNum") String factoryNum) { public Integer checkFactoryNumUniquenessForVehicleCylinder(@RequestParam("factoryNum") String factoryNum) {
return commonService.checkFactoryNumUniquenessForVehicleCylinder(factoryNum,null); 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; ...@@ -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.common.api.dto.ESEquipmentCategoryDto;
import com.yeejoin.amos.boot.module.jg.biz.event.CancellationEvent; 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.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.entity.IdxBizJgUseInfo;
import com.yeejoin.amos.boot.module.ymt.api.mapper.IdxBizJgRegisterInfoMapper;
import com.yeejoin.amos.boot.module.ymt.api.mapper.IdxBizJgUseInfoMapper; import com.yeejoin.amos.boot.module.ymt.api.mapper.IdxBizJgUseInfoMapper;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.event.EventListener; import org.springframework.context.event.EventListener;
...@@ -26,24 +31,21 @@ import java.util.concurrent.LinkedBlockingQueue; ...@@ -26,24 +31,21 @@ import java.util.concurrent.LinkedBlockingQueue;
*/ */
@Component @Component
@Slf4j @Slf4j
@RequiredArgsConstructor
public class CancellationEventListener { public class CancellationEventListener {
@Value("${cancellation.deal.thread.number:1}") @Value("${cancellation.deal.thread.number:1}")
private int threadNumber; 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) { private BlockingQueue<String> queue = new LinkedBlockingQueue<>();
this.commonService = commonService;
this.esEquipmentCategoryDao = esEquipmentCategoryDao;
this.idxBizJgUseInfoMapper = idxBizJgUseInfoMapper;
}
@EventListener(value = CancellationEvent.class) @EventListener(value = CancellationEvent.class)
public void handleTransactionalEvent(CancellationEvent event) { public void handleTransactionalEvent(CancellationEvent event) {
...@@ -75,18 +77,28 @@ public class CancellationEventListener { ...@@ -75,18 +77,28 @@ public class CancellationEventListener {
Boolean inUsed = commonService.checkEquipIsUsed(record); Boolean inUsed = commonService.checkEquipIsUsed(record);
// 无引用则进行修改纳管状态为未纳管 // 无引用则进行修改纳管状态为未纳管
if (!inUsed) { if (!inUsed) {
// 更新已纳管为未纳管-数据库 // 更新已纳管为未纳管 - 数据库
LambdaUpdateWrapper<IdxBizJgUseInfo> updateWrapper = new LambdaUpdateWrapper<>(); idxBizJgUseInfoService.lambdaUpdate()
updateWrapper.eq(IdxBizJgUseInfo::getRecord, record); .eq(IdxBizJgUseInfo::getRecord, record)
updateWrapper.set(IdxBizJgUseInfo::getIsIntoManagement, false); .set(IdxBizJgUseInfo::getIsIntoManagement, false)
idxBizJgUseInfoMapper.update(null, updateWrapper); .update();
// 更新已纳管为未纳管-es
// 清除系统自动生成的设备代码`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); Optional<ESEquipmentCategoryDto> optional = esEquipmentCategoryDao.findById(record);
if (optional.isPresent()) { optional.ifPresent(esEquipmentCategoryDto -> {
ESEquipmentCategoryDto esEquipmentCategoryDto = optional.get();
esEquipmentCategoryDto.setIS_INTO_MANAGEMENT(false); esEquipmentCategoryDto.setIS_INTO_MANAGEMENT(false);
if (isRegisterUpdated) {
esEquipmentCategoryDto.setEQU_CODE(null);
}
esEquipmentCategoryDao.save(esEquipmentCategoryDto); esEquipmentCategoryDao.save(esEquipmentCategoryDto);
} });
} }
} }
} }
...@@ -6,6 +6,7 @@ import com.alibaba.fastjson.JSONArray; ...@@ -6,6 +6,7 @@ import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.yeejoin.amos.boot.biz.common.bo.CompanyBo; 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.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.InstanceRuntimeData;
import com.yeejoin.amos.boot.module.jg.api.dto.UseFlagParamDto; import com.yeejoin.amos.boot.module.jg.api.dto.UseFlagParamDto;
import com.yeejoin.amos.boot.module.jg.api.entity.JgUseRegistrationManage; import com.yeejoin.amos.boot.module.jg.api.entity.JgUseRegistrationManage;
...@@ -241,4 +242,6 @@ public interface ICommonService { ...@@ -241,4 +242,6 @@ public interface ICommonService {
List<EquipmentCategoryDto> equipmentClassificationNoPipeline(String type); List<EquipmentCategoryDto> equipmentClassificationNoPipeline(String type);
List<EquipmentCategoryDto> getEquDefineByParentId(String parentId); List<EquipmentCategoryDto> getEquDefineByParentId(String parentId);
List<EquipmentClassifyDto> getEquClassifyByCode(String parentCode);
} }
...@@ -792,7 +792,7 @@ public class CommonServiceImpl implements ICommonService { ...@@ -792,7 +792,7 @@ public class CommonServiceImpl implements ICommonService {
result.forEach(x -> convertAndAddToUnitList(x, unitList)); 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(); List<DictionarieValueModel> result = Systemctl.dictionarieClient.dictValues("OLD_USE_UNIT").getResult();
result.forEach(x -> convertAndAddToUnitList(x, unitList)); result.forEach(x -> convertAndAddToUnitList(x, unitList));
} }
...@@ -2122,6 +2122,39 @@ public class CommonServiceImpl implements ICommonService { ...@@ -2122,6 +2122,39 @@ public class CommonServiceImpl implements ICommonService {
return equipmentCategoryMapper.getEquDefineByParentId(parentId); 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 * 排序 :页面列表排序功能支持,将 "字段,ascend" 或 "字段,descend" 转化为对应JSONObject
* *
......
...@@ -220,7 +220,7 @@ public class IdxBizJgProjectContraptionServiceImpl extends BaseService<IdxBizJgP ...@@ -220,7 +220,7 @@ public class IdxBizJgProjectContraptionServiceImpl extends BaseService<IdxBizJgP
*/ */
private void judgeCheckResult(IdxBizJgProjectContraption record) { private void judgeCheckResult(IdxBizJgProjectContraption record) {
record.setDisableBasicButton(true); 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())); int notNullCount = this.baseMapper.selectCheckCountByNotNull(String.valueOf(record.getSequenceNbr()));
long total = this.baseMapper.selectEquipCount(String.valueOf(record.getSequenceNbr())); long total = this.baseMapper.selectEquipCount(String.valueOf(record.getSequenceNbr()));
if(total==notNullCount && total !=0){ if(total==notNullCount && total !=0){
...@@ -346,8 +346,8 @@ public class IdxBizJgProjectContraptionServiceImpl extends BaseService<IdxBizJgP ...@@ -346,8 +346,8 @@ public class IdxBizJgProjectContraptionServiceImpl extends BaseService<IdxBizJgP
} }
public void exportSummaryBasicInfo(String sequenceNbr, HttpServletResponse response, String category) { 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; double total;
// 每页显示条数,默认 10 // 每页显示条数,默认 10
......
...@@ -850,12 +850,15 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste ...@@ -850,12 +850,15 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
*/ */
private void checkCarNumberUniquenessWithHisCC(LinkedHashMap<?, ?> equipmentInfoForm, String record, String dataSource) { 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))) { if (dataSource.contains("his") && EquipmentClassifityEnum.CC.getCode().equals(equipmentInfoForm.get(EQU_LIST)) && !ValidationUtil.isEmpty(equipmentInfoForm.get(CAR_NUMBER))) {
Integer count = idxBizJgRegisterInfoService.lambdaQuery() String carNumber = String.valueOf(equipmentInfoForm.get(CAR_NUMBER));
.eq(IdxBizJgRegisterInfo::getCarNumber, equipmentInfoForm.get(CAR_NUMBER)) if (!"无".equals(carNumber)) {
.ne(!StringUtils.isEmpty(record), IdxBizJgRegisterInfo::getRecord, record) Integer count = idxBizJgRegisterInfoService.lambdaQuery()
.count(); .eq(IdxBizJgRegisterInfo::getCarNumber, carNumber)
if (count > 0) { .ne(!StringUtils.isEmpty(record), IdxBizJgRegisterInfo::getRecord, record)
throw new BadRequest("车牌号已存在,请重新输入!"); .count();
if (count > 0) {
throw new BadRequest("车牌号已存在,请重新输入!");
}
} }
} }
} }
......
...@@ -100,5 +100,6 @@ public interface EquipmentCategoryMapper extends BaseMapper<EquipmentCategory> { ...@@ -100,5 +100,6 @@ public interface EquipmentCategoryMapper extends BaseMapper<EquipmentCategory> {
@Select("SELECT * FROM tz_equipment_category WHERE parent_id = #{parentId}") @Select("SELECT * FROM tz_equipment_category WHERE parent_id = #{parentId}")
List<EquipmentCategoryDto> getEquDefineByParentId(String parentId); List<EquipmentCategoryDto> getEquDefineByParentId(String parentId);
} }
...@@ -249,7 +249,7 @@ ...@@ -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, (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, 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, 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 ibjui."RECORD" AS record
FROM idx_biz_jg_use_info ibjui FROM idx_biz_jg_use_info ibjui
LEFT JOIN idx_biz_jg_tech_params_pipeline ibjtpp ON ibjui.RECORD = ibjtpp.RECORD 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