Commit 5b7ec4a0 authored by Lambertliu's avatar Lambertliu

fix(jg):管道添加功能开发

parent 82b91c9f
......@@ -122,7 +122,7 @@ public class IdxBizJgProjectContraptionController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/details")
@ApiOperation(httpMethod = "GET", value = "根据sequenceNbr查询单个管道工程装置表", notes = "根据sequenceNbr查询单个管道工程装置表")
public ResponseModel<Map<String, Object>> selectOne(@RequestParam("sequenceNbr") Long sequenceNbr) {
public ResponseModel<Map<String, Map<String, Object>>> selectOne(@RequestParam("sequenceNbr") String sequenceNbr) {
return ResponseHelper.buildResponse(idxBizJgProjectContraptionServiceImpl.details(sequenceNbr));
}
......
......@@ -6,20 +6,21 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
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.enums.CompanyTypeEnum;
import com.yeejoin.amos.boot.module.jg.api.enums.EquipSourceEnum;
import com.yeejoin.amos.boot.module.jg.biz.service.IIdxBizJgProjectContraptionService;
import com.yeejoin.amos.boot.module.ymt.api.dto.IdxBizJgProjectContraptionDto;
import com.yeejoin.amos.boot.module.ymt.api.entity.IdxBizJgProjectContraption;
import com.yeejoin.amos.boot.module.ymt.api.entity.IdxBizJgUseInfo;
import com.yeejoin.amos.boot.module.ymt.api.mapper.IdxBizJgProjectContraptionMapper;
import lombok.var;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.ObjectUtils;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.rdbms.service.BaseService;
import javax.annotation.Resource;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.*;
import java.util.stream.Collectors;
/**
......@@ -31,6 +32,8 @@ import java.util.stream.Collectors;
@Service
public class IdxBizJgProjectContraptionServiceImpl extends BaseService<IdxBizJgProjectContraptionDto, IdxBizJgProjectContraption, IdxBizJgProjectContraptionMapper> implements IIdxBizJgProjectContraptionService {
public static final String[] jsonFields = {"PRODUCT_PHOTO", "OTHER_ACCESSORIES", "PRODUCT_QUALIFICATION_CERTIFICATE", "START_LATITUDE_LONGITUDE",
"END_LATITUDE_LONGITUDE"};
public static final String IS_INTO_MANAGEMENT = "isIntoManagement";
public static final String USE_REGISTRATION_CODE = "useRegistrationCode";
public static final String REG_CODE_IS_NULL = "regCodeIsNull";
......@@ -38,11 +41,14 @@ public class IdxBizJgProjectContraptionServiceImpl extends BaseService<IdxBizJgP
public static final String EQU_CATEGORY = "equCategory";
public static final String EQU_DEFINE = "equDefine";
public static final String PROJECT_CONTRAPTION_NO = "projectContraptionNo";
// 设备基本信息表单id
private static final String EQUIP_INFO_FORM_ID = "equipInfo";
@Resource
private IdxBizJgUseInfoServiceImpl useInfoService;
@Resource
private IdxBizJgRegisterInfoServiceImpl registerInfoService;
@Autowired
private CommonServiceImpl commonServiceImpl;
@Override
public boolean saveOrUpdateData(IdxBizJgProjectContraption projectContraption) {
......@@ -97,8 +103,7 @@ public class IdxBizJgProjectContraptionServiceImpl extends BaseService<IdxBizJgP
String equCategory = params.get(EQU_CATEGORY);
// 设备类品种code
String equDefine = params.get(EQU_DEFINE);
return lambdaQuery()
IPage<IdxBizJgProjectContraption> pageList = lambdaQuery()
.eq(CompanyTypeEnum.CONSTRUCTION.getName().equals(companyType), IdxBizJgProjectContraption::getUscUnitCreditCode, companyCode)
.eq(CompanyTypeEnum.USE.getName().equals(companyType), IdxBizJgProjectContraption::getUseUnitCreditCode, companyCode)
.eq(CompanyTypeEnum.INDIVIDUAL.getName().equals(companyType), IdxBizJgProjectContraption::getUseUnitCreditCode, companyCode.split("_").length > 1 ? companyCode.split("_")[1] : companyCode)
......@@ -111,6 +116,23 @@ public class IdxBizJgProjectContraptionServiceImpl extends BaseService<IdxBizJgP
.isNull(!ValidationUtil.isEmpty(regCodeIsNull) && Boolean.TRUE.equals(Boolean.valueOf(regCodeIsNull)), IdxBizJgProjectContraption::getUseRegistrationCode)
.isNotNull(!ValidationUtil.isEmpty(regCodeIsNull) && Boolean.FALSE.equals(Boolean.valueOf(regCodeIsNull)), IdxBizJgProjectContraption::getUseRegistrationCode)
.page(page);
pageList.getRecords().forEach(record -> {
record.setDataSourceName(EquipSourceEnum.getDataSourceName(record.getDataSource()));
record.setFullAddress(record.getProvinceName()+record.getCityName()+record.getCountyName()+record.getStreetName()+record.getAddress());
record.setCan_edit(this.checkContraptionIsCanEdit(record.getSequenceNbr()));
record.setCan_delete(this.checkContraptionIsCanDelete(record.getSequenceNbr()));
});
return pageList;
}
private Boolean checkContraptionIsCanEdit(Long projectContraptionId) {
Integer inUseTime = this.baseMapper.countContraptionInUseTimesForEdit(projectContraptionId);
return inUseTime <= 0;
}
private Boolean checkContraptionIsCanDelete(Long projectContraptionId) {
Integer inUseTime = this.baseMapper.countContraptionInUseTimesForDelete(projectContraptionId);
return inUseTime <= 0;
}
@Override
......@@ -150,18 +172,22 @@ public class IdxBizJgProjectContraptionServiceImpl extends BaseService<IdxBizJgP
return this.queryForList("", false);
}
public Map<String, Object> details(Long sequenceNbr) {
JSONObject result = new JSONObject();
if (!ObjectUtils.isEmpty(sequenceNbr)) {
Map<String, Object> projectContraptionMap = this.getBaseMapper().getDetail(sequenceNbr);
if (projectContraptionMap != null) {
List<Map<String, Object>> detailList = this.getBaseMapper().selectEquipList((Long) projectContraptionMap.get("sequenceNbr"));
result.putAll(projectContraptionMap);
result.put("detailList", detailList);
new DefaultUseRegisterResult(result).getData();
new FillingEditPermForCurrentUser(result).getData();
}
public Map<String, Map<String, Object>> details(String sequenceNbr) {
Map<String, Map<String, Object>> resultMap = new HashMap<>();
if (ObjectUtils.isEmpty(sequenceNbr)) {
resultMap.put(EQUIP_INFO_FORM_ID, Collections.emptyMap());
return resultMap;
}
return result;
var baseMapper = this.getBaseMapper();
Map<String, Object> projectContraptionMap = Optional.ofNullable(baseMapper.getDetail(sequenceNbr))
.map(map -> {
commonServiceImpl.convertStringToJsonobject(map, jsonFields);
map.put("pipelineList", baseMapper.selectEquipList((String) map.get("SEQUENCE_NBR")));
return map;
})
.orElse(Collections.emptyMap());
resultMap.put(EQUIP_INFO_FORM_ID, projectContraptionMap);
return resultMap;
}
}
\ No newline at end of file
......@@ -390,9 +390,9 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
}
LinkedHashMap equipmentInfoForm = (LinkedHashMap) checkAndCast(paramMap.get(EQUIP_INFO_FORM_ID));
String dataSource = (String) equipmentInfoForm.get(DATA_SOURCE);
String equ_category = (String) equipmentInfoForm.get(EQU_CATEGORY);
String equCategory = (String) equipmentInfoForm.get(EQU_CATEGORY);
//管道添加设备
if ("8300".equals(equ_category)) {
if ("8300".equals(equCategory)) {
return this.pipelineEquipCreateOrUpdate(paramMap);
}
if(dataSource.contains("black")){
......@@ -411,14 +411,9 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
private ResponseModel pipelineEquipCreateOrUpdate(Map<String, Object> paramMap) {
try {
// 获取表单数据并进行类型检查
LinkedHashMap equipmentClassForm = castToLinkedHashMap(paramMap.get(EQUIP_CLASS_FORM_ID));
LinkedHashMap equipmentInfoForm = castToLinkedHashMap(paramMap.get(EQUIP_INFO_FORM_ID));
LinkedHashMap equipmentParamsForm = castToLinkedHashMap(paramMap.get(EQUIP_PARAMS_FORM_ID));
String submitType = String.valueOf(paramMap.get("submitType"));
Long sequenceNbr = (Long) equipmentInfoForm.get(SEQUENCE_NBR);
// 保存管道数据
sequenceNbr = batchSubmitOrUpdatePipeline(equipmentClassForm, equipmentInfoForm, equipmentParamsForm, submitType);
return ResponseHelper.buildResponse(sequenceNbr);
return ResponseHelper.buildResponse(batchSubmitOrUpdatePipeline(equipmentInfoForm, submitType));
} catch (Exception e) {
log.error("操作失败,数据异常: {}", e.getMessage(), e);
handleError(e, String.valueOf(paramMap.getOrDefault(SEQUENCE_NBR, "未知序号")));
......@@ -441,7 +436,7 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
throw new IllegalArgumentException("参数类型错误,期望 LinkedHashMap 类型: " + obj);
}
private Long batchSubmitOrUpdatePipeline(LinkedHashMap equipmentClassForm, LinkedHashMap equipmentInfoForm, LinkedHashMap equipmentParamsForm, String submitType) {
private Long batchSubmitOrUpdatePipeline(LinkedHashMap equipmentInfoForm, String submitType) {
Date date = new Date();
String operateType = ValidationUtil.isEmpty(equipmentInfoForm.get(SEQUENCE_NBR)) ? OPERATESAVE : OPERATEEDIT;
// 设备是否复制而来,复制来的设备走新增
......@@ -449,6 +444,25 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
operateType = isCopy ? OPERATESAVE : operateType;
// 新增设备保存时 : 历史设备=》dataSource为"his" jg新录入设备dataSource为"jg"
String dataSource = this.getDataSource(operateType, equipmentInfoForm);
Long sequenceNbr = OPERATESAVE.equals(operateType)
? sequence.nextId()
: Optional.ofNullable(equipmentInfoForm.get(SEQUENCE_NBR))
.map(String::valueOf)
.map(Long::valueOf)
.orElseThrow(() -> new IllegalArgumentException("Invalid SEQUENCE_NBR value"));
if ("edit".equals(submitType)) {
List<String> records = idxBizJgUseInfoService.lambdaQuery()
.select(IdxBizJgUseInfo::getRecord)
.eq(IdxBizJgUseInfo::getProjectContraptionId, sequenceNbr)
.list()
.stream()
.map(IdxBizJgUseInfo::getRecord)
.collect(Collectors.toList());
idxBizJgRegisterInfoService.batchDeleteByRecord(MapBuilder.<String, Object>create()
.put("recordList", records)
.build());
}
List<Map<String, Object>> pipelineList = (List<Map<String, Object>>) equipmentInfoForm.get(PIPELINE_LIST);
......@@ -459,7 +473,11 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
// 单位类型
Map<String, Object> companyInfoMap = jgInstallationNoticeService.getCompanyType();
String companyTypeStr = companyInfoMap.get("companyType").toString();
Long sequenceNbr = OPERATESAVE.equals(operateType) ? UUID.randomUUID().getMostSignificantBits() : (Long) equipmentInfoForm.get(SEQUENCE_NBR);
if (CollectionUtils.isEmpty(pipelineList) || pipelineList.size() != pipelineList.stream()
.map(v -> (String) v.get("pipelineNumber")).distinct().count()) {
throw new BadRequest(CollectionUtils.isEmpty(pipelineList) ? "请填写管道信息!" : "同一工程装置下管道编号不能重复!");
}
// 工程装置信息
IdxBizJgProjectContraption projectContraption = JSON.parseObject(toJSONString(equipmentInfoForm), IdxBizJgProjectContraption.class);
......@@ -473,14 +491,18 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
projectContraption.setEquListName(equListName);
projectContraption.setEquCategoryName(equCategoryName);
projectContraption.setEquDefineName(equDefineName);
projectContraption.setPipelineLength(pipelineList.stream()
.mapToDouble(pipeline -> Double.parseDouble((String) pipeline.get("pipeLength")))
.sum());
projectContraption.setPipelineLength(
pipelineList.stream()
.map(pipeline -> pipeline.get("pipeLength"))
.filter(Objects::nonNull)
.mapToDouble(pipeLength -> Double.parseDouble(String.valueOf(pipeLength)))
.sum()
);
projectContraption.setUscUnitName(companyInfoMap.get("companyName").toString());
projectContraption.setUscUnitCreditCode(companyInfoMap.get("creditCode").toString());
idxBizJgProjectContraptionService.saveOrUpdateData(projectContraption);
List<IdxBizJgUseInfo> useInfoList = new ArrayList<>(10);
List<IdxBizJgDesignInfo> designInfoList = new ArrayList<>(10);
List<IdxBizJgFactoryInfo> factoryInfoList = new ArrayList<>(10);
......@@ -494,7 +516,7 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
//设备信息
for (Map<String, Object> pipeline : pipelineList) {
String record = OPERATESAVE.equals(operateType) ? UUID.randomUUID().toString() : pipeline.get(RECORD).toString();
String record = UUID.randomUUID().toString();
if (isCopy) {
String sourceRecord = pipeline.get(RECORD).toString();
// bug-21203
......@@ -519,20 +541,20 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
inspectionDetectionInfo.setInspectOrgName((String) mapOrDefault.getOrDefault("useUnit", inspectionDetectionInfo.getInspectOrgName()));
inspectionDetectionInfo.setRecord(record);
inspectionDetectionInfo.setRecDate(date);
inspectionDetectionInfo.setSequenceNbr(null);
if (inspectionDetectionInfo.getNextInspectDate() != null) {
inspectionDetectionInfo.setNextInspectDate(DateUtil.parse(DateUtil.format(inspectionDetectionInfo.getNextInspectDate(), DatePattern.NORM_DATE_PATTERN)));
}
inspectionDetectionInfo.setSequenceNbr(OPERATESAVE.equals(operateType) ? null : String.valueOf(equipmentInfoForm.get("INSPECTIONDETECTIONINFO_SEQ")));
inspectionDetectionInfoList.add(inspectionDetectionInfo);
// 使用信息
IdxBizJgUseInfo useInfo = JSON.parseObject(toJSONString(pipeline), IdxBizJgUseInfo.class);
// 使用信息
useInfo.setRecord(record);
useInfo.setSequenceNbr(null);
useInfo.setRecDate(date);
useInfo.setDataSource(dataSource);
useInfo.setIsIntoManagement(Boolean.FALSE);
useInfo.setSequenceNbr(OPERATESAVE.equals(operateType) ? null : String.valueOf(equipmentInfoForm.get("USEINFO_SEQ")));
if (companyTypeStr.contains(CompanyTypeEnum.USE.getCode()) || companyTypeStr.contains(CompanyTypeEnum.INDIVIDUAL.getCode())) {
useInfo.setUseUnitCreditCode(companyInfoMap.get("creditCode").toString());
useInfo.setUseUnitName(companyInfoMap.get("companyName").toString());
......@@ -555,14 +577,14 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
IdxBizJgDesignInfo designInfo = JSON.parseObject(toJSONString(pipeline), IdxBizJgDesignInfo.class);
designInfo.setRecord(record);
designInfo.setRecDate(date);
designInfo.setSequenceNbr(OPERATESAVE.equals(operateType) ? null : String.valueOf(equipmentInfoForm.get("DESIGNINFO_SEQ")));
designInfo.setSequenceNbr(null);
designInfoList.add(designInfo);
// 制造信息
IdxBizJgFactoryInfo factoryInfo = JSON.parseObject(toJSONString(pipeline), IdxBizJgFactoryInfo.class);
factoryInfo.setRecord(record);
factoryInfo.setRecDate(date);
factoryInfo.setSequenceNbr(OPERATESAVE.equals(operateType) ? null : String.valueOf(equipmentInfoForm.get("FACTORYINFO_SEQ")));
factoryInfo.setSequenceNbr(null);
factoryInfoList.add(factoryInfo);
// 施工信息
......@@ -583,36 +605,32 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
constructionInfo.setUscUnitName("");
}
}
constructionInfo.setSequenceNbr(OPERATESAVE.equals(operateType) ? null : String.valueOf(equipmentInfoForm.get("CONSTRUCTIONINFO_SEQ")));
constructionInfo.setSequenceNbr(null);
constructionInfoList.add(constructionInfo);
// 注册登记信息
IdxBizJgRegisterInfo registerInfo = JSON.parseObject(toJSONString(equipmentInfoForm), IdxBizJgRegisterInfo.class);
registerInfo.setRecord(record);
registerInfo.setRecDate(date);
registerInfo.setSequenceNbr(null);
registerInfo.setRegisterState(this.getRegCode());
registerInfo.setSequenceNbr(OPERATESAVE.equals(operateType) ? null : String.valueOf(equipmentInfoForm.get("REGISTERINFO_SEQ")));
// 补丁:saveOrUpdate在update数据时不会更新字段为null的字段,但是编辑设备的代码时,从有改成无,equCode解析成null,但是此时需要将equcode删掉
registerInfo.setEquCode(ObjectUtils.isEmpty(registerInfo.getEquCode()) ? "" : registerInfo.getEquCode());
// copy设备 =》 使用登记证号置空
String useOrgCode = ValidationUtil.isEmpty(equipmentInfoForm.get("useRegistrationCode")) ? "" : String.valueOf(equipmentInfoForm.get("useRegistrationCode"));
registerInfo.setUseOrgCode(isCopy && !"1".equals(equipmentInfoForm.get("WHETHER_VEHICLE_CYLINDER")) ? "" : useOrgCode);
registerInfoList.add(registerInfo);
// 监督管理
IdxBizJgSupervisionInfo supervisionInfo = JSON.parseObject(toJSONString(pipeline), IdxBizJgSupervisionInfo.class);
supervisionInfo.setRecord(record);
supervisionInfo.setRecDate(date);
supervisionInfo.setSequenceNbr(OPERATESAVE.equals(operateType) ? null : String.valueOf(equipmentInfoForm.get("SUPERVISIONINFO_SEQ")));
supervisionInfo.setSequenceNbr(null);
supervisionInfoList.add(supervisionInfo);
// 其他信息
IdxBizJgOtherInfo otherInfo = JSON.parseObject(toJSONString(pipeline), IdxBizJgOtherInfo.class);
otherInfo.setRecord(record);
otherInfo.setSequenceNbr(null);
otherInfo.setClaimStatus("已认领");
otherInfo.setRecDate(date);
otherInfo.setSequenceNbr(OPERATESAVE.equals(operateType) ? null : String.valueOf(equipmentInfoForm.get("OTHERINFO_SEQ")));
if (isCopy) {
// 监管码置空
otherInfo.setSupervisoryCode("");
......@@ -623,11 +641,11 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
otherInfoList.add(otherInfo);
//管道技术参数
IdxBizJgTechParamsPipeline pipelineInfo = JSON.parseObject(toJSONString(equipmentParamsForm), IdxBizJgTechParamsPipeline.class);
IdxBizJgTechParamsPipeline pipelineInfo = JSON.parseObject(toJSONString(pipeline), IdxBizJgTechParamsPipeline.class);
if (!ValidationUtil.isEmpty(pipelineInfo)) {
pipelineInfo.setRecord(record);
pipelineInfo.setRecDate(date);
pipelineInfo.setSequenceNbr(OPERATESAVE.equals(operateType) ? null : String.valueOf(equipmentParamsForm.get("PIPELINE_SEQ")));
pipelineInfo.setSequenceNbr(null);
paramsPipelineList.add(pipelineInfo);
}
......@@ -646,6 +664,12 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
esEquipmentDto.setEQU_DEFINE_CODE(registerInfo.getEquDefine());
esEquipmentDto.setEQU_DEFINE(equListName);
esEquipmentDto.setSTATUS("已认领");
esEquipmentDto.setUSC_UNIT_CREDIT_CODE(projectContraption.getUscUnitCreditCode());
esEquipmentDto.setUSC_UNIT_NAME(projectContraption.getUscUnitName());
esEquipmentDto.setPROJECT_CONTRAPTION(projectContraption.getProjectContraption());
if (inspectionDetectionInfo.getNextInspectDate() != null) {
esEquipmentDto.setNEXT_INSPECT_DATE(inspectionDetectionInfo.getNextInspectDate().getTime());
}
esEquipmentCategoryList.add(esEquipmentDto);
}
idxBizJgUseInfoService.saveOrUpdateBatch(useInfoList);
......@@ -2384,7 +2408,6 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
String param = QueryParser.escape(map.getString(EQU_CATEGORY));
pBuilder.must(QueryBuilders.matchPhraseQuery(EQU_CATEGORY, "*" + param + "*"));
boolMust.must(pBuilder);
}
if (!ObjectUtils.isEmpty(map.getString("USE_PLACE"))) {
BoolQueryBuilder pBuilder = QueryBuilders.boolQuery();
......@@ -2463,6 +2486,11 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
String test = QueryParser.escape(map.getString(EQU_CATEGORY_CODE));
pBuilder.must(QueryBuilders.termQuery(EQU_CATEGORY_CODE, test));
boolMust.must(pBuilder);
} else {
BoolQueryBuilder pBuilder = QueryBuilders.boolQuery();
String test = QueryParser.escape("8300");//不查管道,管道新菜单查询
pBuilder.mustNot(QueryBuilders.termQuery(EQU_CATEGORY_CODE, test));
boolMust.must(pBuilder);
}
// 是否车用气瓶
if (!ObjectUtils.isEmpty(map.getString(WHETHER_VEHICLE_CYLINDER))) {
......
......@@ -224,4 +224,28 @@ public class IdxBizJgProjectContraption extends BaseEntity {
*/
@TableField("data_source")
private String dataSource;
/**
* 数据来源名字
*/
@TableField(exist = false)
private String dataSourceName;
/**
* 是否可编辑
*/
@TableField(exist = false)
private Boolean can_edit;
/**
* 是否可删除
*/
@TableField(exist = false)
private Boolean can_delete;
/**
* 使用地址
*/
@TableField(exist = false)
private String fullAddress;
}
......@@ -111,19 +111,19 @@ public class IdxBizJgTechParamsPipeline extends TzsBaseEntity {
private String endPosition;
/**
*
* 设计-介质
*/
@TableField("\"PRESSURE\"")
private String pressure;
/**
*
* 设计-介质
*/
@TableField("\"TEMPERATURE\"")
private String temperature;
/**
*
* 设计-介质
*/
@TableField("\"MEDIUM\"")
private String medium;
......
......@@ -14,7 +14,22 @@ import java.util.Map;
*/
public interface IdxBizJgProjectContraptionMapper extends BaseMapper<IdxBizJgProjectContraption> {
Map<String, Object> getDetail(@Param("sequenceNbr")Long sequenceNbr);
Map<String, Object> getDetail(@Param("sequenceNbr") String sequenceNbr);
List<Map<String, Object>> selectEquipList(@Param("sequenceNbr")Long sequenceNbr);
List<Map<String, Object>> selectEquipList(@Param("sequenceNbr") String sequenceNbr);
/**
* 统计工程装置的引用次数(非待提交、非已撤回、非已驳回)
*
* @param projectContraptionId 工程装置唯一标识
* @return 被引用次数 > 0 则设备不可编辑
*/
Integer countContraptionInUseTimesForEdit(@Param("projectContraptionId") Long projectContraptionId);
/**
* 统计设备被引用的次数(只有存在就算引用-作废除外)
* @param projectContraptionId 设备唯一标识
* @return 被引用次数 > 0 则设备不可删除
*/
Integer countContraptionInUseTimesForDelete(@Param("projectContraptionId") Long projectContraptionId);
}
......@@ -6,7 +6,12 @@
SELECT
SEQUENCE_NBR,
USE_UNIT_CREDIT_CODE,
EQU_LIST,
EQU_CATEGORY,
EQU_DEFINE,
EQU_LIST_NAME,
EQU_CATEGORY_NAME,
EQU_DEFINE_NAME,
CITY,
COUNTY,
PRODUCT_QUALIFICATION_CERTIFICATE,
......@@ -34,14 +39,11 @@
END_LATITUDE_LONGITUDE,
IS_INTO_MANAGEMENT,
REC_DATE,
EQU_CATEGORY,
PROJECT_CONTRAPTION_NO,
USC_UNIT_NAME,
SUPERVISORY_CODE,
EQU_LIST,
PROVINCE_NAME,
DATA_SOURCE,
EQU_DEFINE_NAME,
USE_UNIT_NAME
FROM
IDX_BIZ_JG_PROJECT_CONTRAPTION ibjpc
......@@ -51,7 +53,7 @@
<select id="selectEquipList" resultType="java.util.Map">
SELECT
ibjtpp."PIPE_NAME" as productName,
ibjtpp."PIPE_NAME" as pipeName,
ibjtpp."PIPELINE_NUMBER" as pipelineNumber,
ibjtpp."DEVICE_LEVEL" as deviceLevel,
ibjtpp."NOMINAL_DIAMETER" as nominalDiameter,
......@@ -60,6 +62,9 @@
ibjtpp."PRESSURE" as pressure,
ibjtpp."TEMPERATURE" as temperature,
ibjtpp."MEDIUM" as medium,
ibjtpp."WORK_PRESSURE" as workPressure,
ibjtpp."WORK_TEMPERATURE" as workTemperature,
ibjtpp."WORK_MEDIUM" as workMedium,
ibjtpp."REMARKS" as remarks,
ibjidi."INSPECT_ORG_NAME" as inspectOrgName,
ibjidi."INSPECT_CONCLUSION" as inspectConclusion,
......@@ -67,7 +72,8 @@
ibjdi."DESIGN_UNIT_NAME" as designUnitName,
ibjci."USC_UNIT_NAME" as uscUnitName,
ibjci."USC_DATE" as uscDate,
ibjui."USE_DATE" as useDate
ibjui."USE_DATE" as useDate,
ibjui."RECORD" as record
FROM
idx_biz_jg_use_info ibjui
LEFT JOIN idx_biz_jg_supervision_info ibjsi ON ibjui.RECORD = ibjsi.RECORD
......@@ -80,4 +86,46 @@
WHERE
ibjui.project_contraption_id = #{sequenceNbr}
</select>
<select id="countContraptionInUseTimesForEdit" resultType="java.lang.Integer">
SELECT
SUM(inUseNumber)
FROM (
SELECT
COUNT(1) as inUseNumber
FROM
tzs_jg_use_registration a
WHERE a.project_contraption_id = #{projectContraptionId}
AND a.is_delete = 0
AND (a.status <![CDATA[ <> ]]> '使用单位待提交' and a.status <![CDATA[ <> ]]> '一级受理已驳回' and a.status <![CDATA[ <> ]]> '使用单位已撤回' and a.status <![CDATA[ <> ]]> '已作废')
UNION
SELECT
COUNT(1) as inUseNumber
FROM
tzs_jg_installation_notice a
WHERE a.project_contraption_id = #{projectContraptionId}
AND (a.notice_status <![CDATA[ <> ]]> '6614' and a.notice_status <![CDATA[ <> ]]> '6615' and a.notice_status <![CDATA[ <> ]]> '6610' and a.notice_status <![CDATA[ <> ]]> '6617')
)
</select>
<select id="countContraptionInUseTimesForDelete" resultType="java.lang.Integer">
SELECT
SUM(inUseNumber)
FROM (
SELECT
COUNT(1) AS inUseNumber
FROM
tzs_jg_use_registration a
WHERE a.project_contraption_id = #{projectContraptionId}
AND a.is_delete = 0
AND ( a.status <![CDATA[ <> ]]> '已作废')
UNION
SELECT
COUNT(1) AS inUseNumber
FROM
tzs_jg_installation_notice a
WHERE a.project_contraption_id = #{projectContraptionId}
AND (a.notice_status <![CDATA[ <> ]]> '6617')
)
</select>
</mapper>
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