Commit 3fe0aa2b authored by 韩桐桐's avatar 韩桐桐

feat(jg):工程装置查询

parent 5ab75785
...@@ -45,7 +45,7 @@ public interface JgInstallationNoticeMapper extends CustomBaseMapper<JgInstallat ...@@ -45,7 +45,7 @@ public interface JgInstallationNoticeMapper extends CustomBaseMapper<JgInstallat
List<InstallationVo> queryInstallationInIds(@Param("ids") List<String> ids); List<InstallationVo> queryInstallationInIds(@Param("ids") List<String> ids);
List<Map<String, Object>> getDeviceListByProjectContraption(@Param("projectContraption") String projectContraption); List<Map<String, Object>> getDeviceListByProjectContraption(@Param("projectContraptionSeq") String projectContraptionSeq);
Map<String, Object> getPipelineEquInfoByRecord(@Param("record") String record); Map<String, Object> getPipelineEquInfoByRecord(@Param("record") String record);
} }
...@@ -87,5 +87,5 @@ public interface IJgInstallationNoticeService extends IService<JgInstallationNot ...@@ -87,5 +87,5 @@ public interface IJgInstallationNoticeService extends IService<JgInstallationNot
Boolean historyDataRepair(); Boolean historyDataRepair();
Object getDeviceListByProjectContraption(String projectContraption); Object getDeviceListByProjectContraption(String projectContraptionSeq);
} }
...@@ -268,8 +268,8 @@ ...@@ -268,8 +268,8 @@
<where> <where>
ri."EQU_CATEGORY" = '8300' ri."EQU_CATEGORY" = '8300'
and ui."DATA_SOURCE" like 'jg%' and ui."DATA_SOURCE" not like 'jg_his%' and ui."DATA_SOURCE" like 'jg%' and ui."DATA_SOURCE" not like 'jg_his%'
<if test="projectContraption != null and projectContraption != ''"> <if test="projectContraptionSeq != null and projectContraptionSeq != ''">
and ui."PROJECT_CONTRAPTION" = #{projectContraption} and ui."PROJECT_CONTRAPTION_ID" = #{projectContraptionSeq}
</if> </if>
-- 排除 已经做过安装告知的 -- 排除 已经做过安装告知的
AND NOT EXISTS ( AND NOT EXISTS (
......
package com.yeejoin.amos.boot.module.jg.biz.controller; package com.yeejoin.amos.boot.module.jg.biz.controller;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
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.biz.service.impl.IdxBizJgProjectContraptionServiceImpl; import com.yeejoin.amos.boot.module.jg.biz.service.impl.IdxBizJgProjectContraptionServiceImpl;
import com.yeejoin.amos.boot.module.ymt.api.dto.IdxBizJgProjectContraptionDto; import com.yeejoin.amos.boot.module.ymt.api.dto.IdxBizJgProjectContraptionDto;
import com.yeejoin.amos.boot.module.ymt.api.entity.IdxBizJgProjectContraption;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -12,8 +15,9 @@ import org.typroject.tyboot.core.foundation.enumeration.UserType; ...@@ -12,8 +15,9 @@ import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.restful.doc.TycloudOperation; import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.restful.utils.ResponseHelper; import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel; import org.typroject.tyboot.core.restful.utils.ResponseModel;
import javax.servlet.http.HttpServletRequest;
import java.util.List; import java.util.List;
import java.util.Map;
/** /**
* 管道工程装置表 * 管道工程装置表
...@@ -64,13 +68,53 @@ public class IdxBizJgProjectContraptionController extends BaseController { ...@@ -64,13 +68,53 @@ public class IdxBizJgProjectContraptionController extends BaseController {
*/ */
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@DeleteMapping(value = "/{sequenceNbr}") @DeleteMapping(value = "/{sequenceNbr}")
@ApiOperation(httpMethod = "DELETE", value = "根据sequenceNbr删除管道工程装置表", notes = "根据sequenceNbr删除管道工程装置表") @ApiOperation(httpMethod = "DELETE", value = "根据sequenceNbr删除管道工程装置表及设备信息", notes = "根据sequenceNbr删除管道工程装置表及设备信息")
public ResponseModel<Boolean> deleteBySequenceNbr(HttpServletRequest request, @PathVariable(value = "sequenceNbr") Long sequenceNbr){ public ResponseModel<Boolean> deleteBySequenceNbr(@PathVariable(value = "sequenceNbr") Long sequenceNbr) {
return ResponseHelper.buildResponse(idxBizJgProjectContraptionServiceImpl.removeById(sequenceNbr)); return ResponseHelper.buildResponse(idxBizJgProjectContraptionServiceImpl.deleteProjectAndEquInfoBySeq(sequenceNbr));
} }
/** /**
* 根据sequenceNbr查询 * 根据入参 分页查询(当前)单位下的工程管道
*
* @param params - isIntoManagement 是否是否纳管 true/false
* - useRegistrationCode 使用登记编号 string()
* - regCodeIsNull 使用登记编号是否为空 true/false
* @param current 当前页
* @param size 每页大小
* @return result
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/pageByParams")
@ApiOperation(httpMethod = "GET", value = "根据入参 分页查询(当前)单位下的工程管道", notes = "根据入参 分页查询(当前)单位下的工程管道")
public ResponseModel<IPage<IdxBizJgProjectContraption>> proConPageByParams(
@RequestParam Map<String, String> params,
@RequestParam(value = "current") int current,
@RequestParam(value = "size") int size) {
Page<IdxBizJgProjectContraption> page = new Page<>();
page.setCurrent(current);
page.setSize(size);
ReginParams reginParams = getSelectedOrgInfo();
return ResponseHelper.buildResponse(idxBizJgProjectContraptionServiceImpl.proConPageByParams(params, page, reginParams));
}
/**
* 根据入参 列表查询(当前)单位下的工程管道
*
* @param params - isIntoManagement 是否是否纳管 true/false
* - useRegistrationCode 使用登记编号 string()
* - regCodeIsNull 使用登记编号是否为空 true/false
* @return result
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/listByParams")
@ApiOperation(httpMethod = "GET", value = "根据入参 列表查询(当前)单位下的工程管道", notes = "根据入参 列表查询(当前)单位下的工程管道")
public ResponseModel<List<IdxBizJgProjectContraption>> proConListByParams(@RequestParam Map<String, String> params) {
ReginParams reginParams = getSelectedOrgInfo();
return ResponseHelper.buildResponse(idxBizJgProjectContraptionServiceImpl.proConListByParams(params, reginParams));
}
/**
* 根据sequenceNbr查询
* *
* @param sequenceNbr 主键 * @param sequenceNbr 主键
* @return * @return
......
...@@ -173,8 +173,8 @@ public class JgInstallationNoticeController extends BaseController { ...@@ -173,8 +173,8 @@ public class JgInstallationNoticeController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "查询工程装置下的所有未做安装告知、不在安装告知流程、安装告知作废的设备", @ApiOperation(httpMethod = "GET", value = "查询工程装置下的所有未做安装告知、不在安装告知流程、安装告知作废的设备",
notes = "查询工程装置下的所有未做安装告知、不在安装告知流程、安装告知作废的设备") notes = "查询工程装置下的所有未做安装告知、不在安装告知流程、安装告知作废的设备")
@GetMapping(value = "/getDeviceListByProjectContraption") @GetMapping(value = "/getDeviceListByProjectContraptionSeq")
public ResponseModel<Object> getDeviceListByProjectContraption(@RequestParam("projectContraption") String projectContraption) { public ResponseModel<Object> getDeviceListByProjectContraption(@RequestParam("projectContraptionSeq") String projectContraptionSeq) {
return ResponseHelper.buildResponse(iJgInstallationNoticeService.getDeviceListByProjectContraption(projectContraption)); return ResponseHelper.buildResponse(iJgInstallationNoticeService.getDeviceListByProjectContraption(projectContraptionSeq));
} }
} }
package com.yeejoin.amos.boot.module.jg.biz.service; package com.yeejoin.amos.boot.module.jg.biz.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.amos.boot.module.ymt.api.entity.IdxBizJgProjectContraption; import com.yeejoin.amos.boot.module.ymt.api.entity.IdxBizJgProjectContraption;
import java.util.List;
import java.util.Map;
/** /**
* 管道工程装置表接口类 * 管道工程装置表接口类
* *
...@@ -10,4 +16,10 @@ import com.yeejoin.amos.boot.module.ymt.api.entity.IdxBizJgProjectContraption; ...@@ -10,4 +16,10 @@ import com.yeejoin.amos.boot.module.ymt.api.entity.IdxBizJgProjectContraption;
*/ */
public interface IIdxBizJgProjectContraptionService { public interface IIdxBizJgProjectContraptionService {
boolean saveOrUpdateData(IdxBizJgProjectContraption projectContraption); boolean saveOrUpdateData(IdxBizJgProjectContraption projectContraption);
Boolean deleteProjectAndEquInfoBySeq(Long sequenceNbr);
IPage<IdxBizJgProjectContraption> proConPageByParams(Map<String, String> params, Page<IdxBizJgProjectContraption> page, ReginParams reginParams);
List<IdxBizJgProjectContraption> proConListByParams(Map<String, String> params, ReginParams reginParams);
} }
\ No newline at end of file
package com.yeejoin.amos.boot.module.jg.biz.service.impl; package com.yeejoin.amos.boot.module.jg.biz.service.impl;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; 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.biz.service.IIdxBizJgProjectContraptionService; 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.dto.IdxBizJgProjectContraptionDto;
import com.yeejoin.amos.boot.module.ymt.api.entity.IdxBizJgProjectContraption; 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 com.yeejoin.amos.boot.module.ymt.api.mapper.IdxBizJgProjectContraptionMapper;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.rdbms.service.BaseService; import org.typroject.tyboot.core.rdbms.service.BaseService;
import javax.annotation.Resource;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/** /**
* 管道工程装置表服务实现类 * 管道工程装置表服务实现类
...@@ -17,23 +28,124 @@ import java.util.List; ...@@ -17,23 +28,124 @@ import java.util.List;
* @date 2024-12-11 * @date 2024-12-11
*/ */
@Service @Service
public class IdxBizJgProjectContraptionServiceImpl extends BaseService<IdxBizJgProjectContraptionDto,IdxBizJgProjectContraption, IdxBizJgProjectContraptionMapper> implements IIdxBizJgProjectContraptionService { public class IdxBizJgProjectContraptionServiceImpl extends BaseService<IdxBizJgProjectContraptionDto, IdxBizJgProjectContraption, IdxBizJgProjectContraptionMapper> implements IIdxBizJgProjectContraptionService {
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";
public static final String PROJECT_CONTRAPTION = "projectContraption";
public static final String EQU_CATEGORY = "equCategory";
public static final String EQU_DEFINE = "equDefine";
public static final String PROJECT_CONTRAPTION_NO = "projectContraptionNo";
@Resource
private IdxBizJgUseInfoServiceImpl useInfoService;
@Resource
private IdxBizJgRegisterInfoServiceImpl registerInfoService;
@Override @Override
public boolean saveOrUpdateData(IdxBizJgProjectContraption projectContraption) { public boolean saveOrUpdateData(IdxBizJgProjectContraption projectContraption) {
return this.saveOrUpdate(projectContraption); return this.saveOrUpdate(projectContraption);
} }
/** /**
* 根据工程装置seq物理删除装置表数据和对应设备信息(数据库+es)
*
* @param sequenceNbr 工程装置表seq
* @return result
*/
@Override
@Transactional(rollbackFor = Exception.class)
public Boolean deleteProjectAndEquInfoBySeq(Long sequenceNbr) {
List<IdxBizJgUseInfo> useInfos = useInfoService.lambdaQuery().select(IdxBizJgUseInfo::getRecord).eq(IdxBizJgUseInfo::getProjectContraptionId, sequenceNbr).list();
// 删除idx设备表信息 + 删除对应es数据
List<String> records = useInfos.stream().map(IdxBizJgUseInfo::getRecord).collect(Collectors.toList());
if (records.isEmpty()) return Boolean.TRUE;
Map<String, Object> map = new HashMap<>();
map.put("recordList", records);
registerInfoService.batchDeleteByRecord(map);
// 删除装置表信息
this.removeById(sequenceNbr);
return Boolean.TRUE;
}
/**
* 根据入参 分页查询(当前)单位下的工程管道
*
* @param params 查询参数 Map
* @param page 分页
* @param reginParams 当前登录人信息
* @return result
*/
@Override
public IPage<IdxBizJgProjectContraption> proConPageByParams(Map<String, String> params, Page<IdxBizJgProjectContraption> page, ReginParams reginParams) {
CompanyBo company = reginParams.getCompany();
String companyType = company.getCompanyType();
String companyCode = company.getCompanyCode();
// 是否是否纳管:true - 已纳管 false-未纳管
boolean isIntoManagement = Boolean.parseBoolean(params.get(IS_INTO_MANAGEMENT));
// 使用登记编号
String useRegistrationCode = params.get(USE_REGISTRATION_CODE);
// 使用登记编号是否为空 true/false
String regCodeIsNull = params.get(REG_CODE_IS_NULL);
// 工程装置名称
String projectContraption = params.get(PROJECT_CONTRAPTION);
// 工程装置编号
String projectContraptionNo = params.get(PROJECT_CONTRAPTION_NO);
// 设备类别code
String equCategory = params.get(EQU_CATEGORY);
// 设备类品种code
String equDefine = params.get(EQU_DEFINE);
return 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)
.eq(!ValidationUtil.isEmpty(params.get(IS_INTO_MANAGEMENT)), IdxBizJgProjectContraption::getIsIntoManagement, isIntoManagement)
.eq(!ValidationUtil.isEmpty(useRegistrationCode), IdxBizJgProjectContraption::getUseRegistrationCode, useRegistrationCode)
.eq(!ValidationUtil.isEmpty(equCategory), IdxBizJgProjectContraption::getEquCategory, equCategory)
.eq(!ValidationUtil.isEmpty(equDefine), IdxBizJgProjectContraption::getEquCategory, equDefine)
.like(!ValidationUtil.isEmpty(projectContraption), IdxBizJgProjectContraption::getProjectContraption, projectContraption)
.like(!ValidationUtil.isEmpty(projectContraptionNo), IdxBizJgProjectContraption::getProjectContraptionNo, projectContraptionNo)
.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);
}
@Override
public List<IdxBizJgProjectContraption> proConListByParams(Map<String, String> params, ReginParams reginParams) {
CompanyBo company = reginParams.getCompany();
String companyType = company.getCompanyType();
String companyCode = company.getCompanyCode();
// 是否是否纳管:true - 已纳管 false-未纳管
boolean isIntoManagement = Boolean.parseBoolean(params.get(IS_INTO_MANAGEMENT));
// 使用登记编号
String useRegistrationCode = params.get(USE_REGISTRATION_CODE);
// 使用登记编号是否为空 true/false
String regCodeIsNull = params.get(REG_CODE_IS_NULL);
return 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)
.eq(!ValidationUtil.isEmpty(params.get(IS_INTO_MANAGEMENT)), IdxBizJgProjectContraption::getIsIntoManagement, isIntoManagement)
.eq(!ValidationUtil.isEmpty(useRegistrationCode), IdxBizJgProjectContraption::getUseRegistrationCode, useRegistrationCode)
.isNull(!ValidationUtil.isEmpty(regCodeIsNull) && Boolean.TRUE.equals(Boolean.valueOf(regCodeIsNull)), IdxBizJgProjectContraption::getUseRegistrationCode)
.isNotNull(!ValidationUtil.isEmpty(regCodeIsNull) && Boolean.FALSE.equals(Boolean.valueOf(regCodeIsNull)), IdxBizJgProjectContraption::getUseRegistrationCode)
.list();
}
/**
* 分页查询 * 分页查询
*/ */
public Page<IdxBizJgProjectContraptionDto> queryForIdxBizJgProjectContraptionPage(Page<IdxBizJgProjectContraptionDto> page) { public Page<IdxBizJgProjectContraptionDto> queryForIdxBizJgProjectContraptionPage(Page<IdxBizJgProjectContraptionDto> page) {
return this.queryForPage(page, null, false); return this.queryForPage(page, null, false);
} }
/** /**
* 列表查询 示例 * 列表查询 示例
*/ */
public List<IdxBizJgProjectContraptionDto> queryForIdxBizJgProjectContraptionList() { public List<IdxBizJgProjectContraptionDto> queryForIdxBizJgProjectContraptionList() {
return this.queryForList("" , false); return this.queryForList("", false);
} }
} }
\ No newline at end of file
...@@ -1764,12 +1764,12 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN ...@@ -1764,12 +1764,12 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN
/** /**
* 查询工程装置下的所有未做安装告知、不在安装告知流程、安装告知作废的设备 * 查询工程装置下的所有未做安装告知、不在安装告知流程、安装告知作废的设备
* *
* @param projectContraption 工程装置名称 * @param projectContraptionSeq 工程装置seq
* @return 设备列表 * @return 设备列表
*/ */
@Override @Override
public Object getDeviceListByProjectContraption(String projectContraption) { public Object getDeviceListByProjectContraption(String projectContraptionSeq) {
List<Map<String, Object>> deviceList = this.baseMapper.getDeviceListByProjectContraption(projectContraption); List<Map<String, Object>> deviceList = this.baseMapper.getDeviceListByProjectContraption(projectContraptionSeq);
return new JSONObject().fluentPut("deviceList", deviceList); return new JSONObject().fluentPut("deviceList", deviceList);
} }
......
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