Commit 721e118d authored by tianbo's avatar tianbo

feat(jg): 添加装置和管道查询功能并优化报废流程

- 在 JgScrapCancelController 中添加查询装置下非报废管道的接口 - 新增查询可用装置列表的分页接口 - 在 JgScrapCancelMapper 中添加 selectPipeLinePage 和 queryJgProjectContraptionPage 方法 - 实现 SQL 查询语句支持装置和管道数据过滤 - 优化报废流程中的设备重复使用检查逻辑 - 区分压力管道和普通气瓶的重复检查策略
parent dff7c98e
package com.yeejoin.amos.boot.module.jg.api.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.module.common.api.dto.DPFilterParamDto;
import com.yeejoin.amos.boot.module.jg.api.dto.CompanyEquipCountDto;
......@@ -9,10 +10,12 @@ import com.yeejoin.amos.boot.module.jg.api.dto.JgScrapCancelDto;
import com.yeejoin.amos.boot.module.jg.api.entity.JgScrapCancel;
import com.yeejoin.amos.boot.module.jg.api.vo.SortVo;
import com.yeejoin.amos.boot.module.jg.api.vo.tableDataExportVo.ScrapCancelVo;
import com.yeejoin.amos.boot.module.ymt.api.dto.IdxBizJgProjectContraptionDto;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map;
import java.util.Set;
/**
* 设备报废注销 Mapper 接口
......@@ -55,4 +58,8 @@ public interface JgScrapCancelMapper extends BaseMapper<JgScrapCancel> {
List<Map<String, Object>> getScrappedDeviceCount(@Param("dpFilterParamDto") DPFilterParamDto dpFilterParamDto);
List<CompanyEquipCountDto> queryForFlowingEquipList();
IPage<Map<String, Object>> selectPipeLinePage(@Param("page") Page<Map<String, Object>> page, @Param("projectContraptionId") String projectContraptionId, @Param("filters") Map<String, Object> filters);
IPage<IdxBizJgProjectContraptionDto> queryJgProjectContraptionPage(Page<IdxBizJgProjectContraptionDto> page, String useUnitCreditCode, Set<String> proIds, @Param("filters") Map<String, Object> filters);
}
......@@ -309,4 +309,64 @@
and a.audit_status in ('三级待受理', '二级待受理', '一级待受理')
GROUP BY a.use_unit_code
</select>
<select id="selectPipeLinePage" resultType="java.util.Map">
select * from (
<include refid="com.yeejoin.amos.boot.module.jg.api.mapper.JgEnableDisableMapper.page-list-pipeline"/>
WHERE
ui."PROJECT_CONTRAPTION_ID" = #{projectContraptionId}
and ui."EQU_STATE" != '3'
<if test="filters != null and filters.pipelineNumber != null and filters.pipelineNumber != ''">
and pp."PIPELINE_NUMBER" like concat('%', #{filters.pipelineNumber},'%')
</if>
<if test="filters != null and filters.productName != null and filters.productName != ''">
and pp."PIPE_NAME" like concat('%', #{filters.productName},'%')
</if>
)
ORDER BY REC_DATE DESC
</select>
<select id="queryJgProjectContraptionPage"
resultType="com.yeejoin.amos.boot.module.ymt.api.dto.IdxBizJgProjectContraptionDto">
select
pc.sequence_nbr,
pc.project_contraption,
pc.project_contraption_no,
pc.address,
pc.supervisory_code,
pc.use_registration_code,
pc.province_name,
pc.city_name,
pc.county_name,
pc.street_name,
m.use_registration_code
from
idx_biz_jg_project_contraption pc,
tzs_jg_use_registration_manage m
where
pc.is_into_management = true
and pc.use_registration_code = m.use_registration_code
and m.is_delete = '0'
and pc.use_unit_credit_code=#{useUnitCreditCode}
and (pc.project_contraption_parent_id is null or pc.project_contraption_parent_id = '')
and pc.equ_category = '8300'
<if test="proIds != null and proIds.size() > 0">
and pc.sequence_nbr not in
<foreach collection="proIds" item="projectContraptionId" open="(" close=")" separator=",">
#{projectContraptionId}
</foreach>
</if>
<if test="filters != null">
<if test="filters.projectContraption != null and filters.projectContraption != ''">
and pc.project_contraption like concat('%', #{filters.projectContraption},'%')
</if>
<if test="filters.projectContraptionNo != null and filters.projectContraptionNo != ''">
and pc.project_contraption_no like concat('%', #{filters.projectContraptionNo},'%')
</if>
<if test="filters.useRegistrationCode != null and filters.useRegistrationCode != ''">
and m.use_registration_code like concat('%', #{filters.useRegistrationCode},'%')
</if>
</if>
order by pc.sequence_nbr Desc
</select>
</mapper>
......@@ -2,12 +2,15 @@ package com.yeejoin.amos.boot.module.jg.biz.controller;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import com.yeejoin.amos.boot.module.jg.api.dto.JgScrapCancelDto;
import com.yeejoin.amos.boot.module.jg.api.enums.WorkFlowStatusEnum;
import com.yeejoin.amos.boot.module.jg.api.service.IJgInstallationNoticeService;
import com.yeejoin.amos.boot.module.jg.biz.service.impl.JgEnableDisableServiceImpl;
import com.yeejoin.amos.boot.module.jg.biz.service.impl.JgScrapCancelServiceImpl;
import com.yeejoin.amos.boot.module.ymt.api.dto.IdxBizJgProjectContraptionDto;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
......@@ -38,6 +41,9 @@ public class JgScrapCancelController extends BaseController {
@Autowired
IJgInstallationNoticeService iJgInstallationNoticeService;
@Autowired
JgEnableDisableServiceImpl jgEnableDisableServiceImpl;
@TycloudOperation(ApiLevel = UserType.AGENCY)
@PostMapping(value = "/save")
......@@ -174,4 +180,46 @@ public class JgScrapCancelController extends BaseController {
jgScrapCancelService.handleScrapCancelWrongData(applyNo);
return ResponseHelper.buildResponse("ok");
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/pipeline/page")
@ApiOperation(value = "查询装置下非报废的管道", notes = "查询装置下非报废的管道")
public ResponseModel<IPage<Map<String, Object>>> findPipeLinePage(
@RequestParam(value = "current") int current,
@RequestParam(value = "size") int size,
@RequestParam String projectContraptionId,
@RequestParam Map<String, Object> filters) {
Page<Map<String, Object>> page = new Page<>();
page.setCurrent(current);
page.setSize(size);
IPage<Map<String, Object>> re = jgScrapCancelService.findPipeLinePage(page, projectContraptionId, filters);
return ResponseHelper.buildResponse(re);
}
/**
* 查询可用装置列表
*
* @param current 当前页
* @param size 每页数
* @return page
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/projectContraptionPage")
@ApiOperation(value = "查询可用装置列表", notes = "查询可用装置列表")
public ResponseModel<IPage<IdxBizJgProjectContraptionDto>> getProjectContraptionPage(@RequestParam(required = false) String sequenceNbr,
@RequestParam(value = "current") int current,
@RequestParam(value = "size") int size,
@RequestParam(required = false, value = "useRegistrationCode") String useRegistrationCode,
@RequestParam(required = false, value = "projectContraption") String projectContraption,
@RequestParam(required = false, value = "projectContraptionNo") String projectContraptionNo) {
Page<IdxBizJgProjectContraptionDto> page = new Page<>();
page.setCurrent(current);
page.setSize(size);
Map<String, Object> filters = new HashMap<>();
filters.put("useRegistrationCode", useRegistrationCode);
filters.put("projectContraption", projectContraption);
filters.put("projectContraptionNo", projectContraptionNo);
IPage<IdxBizJgProjectContraptionDto> re = jgScrapCancelService.getJgProjectContraptionPage(getSelectedOrgInfo().getCompany().getCompanyCode(), page, sequenceNbr, filters);
return ResponseHelper.buildResponse(re);
}
}
package com.yeejoin.amos.boot.module.jg.biz.service.impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.map.MapUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
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;
......@@ -15,6 +17,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.SnowflakeIdUtil;
import com.yeejoin.amos.boot.module.common.api.enums.CylinderTypeEnum;
import com.yeejoin.amos.boot.module.common.api.service.ICompensateFlowDataOfRedis;
import com.yeejoin.amos.boot.module.common.biz.refresh.DataRefreshEvent;
import com.yeejoin.amos.boot.module.jg.api.dto.*;
import com.yeejoin.amos.boot.module.jg.api.entity.*;
......@@ -32,7 +35,7 @@ import com.yeejoin.amos.boot.module.jg.biz.context.FlowingEquipRedisContext;
import com.yeejoin.amos.boot.module.jg.biz.edit.permission.FillingEditPermForCurrentUser;
import com.yeejoin.amos.boot.module.jg.biz.event.publisher.EventPublisher;
import com.yeejoin.amos.boot.module.jg.biz.feign.TzsServiceFeignClient;
import com.yeejoin.amos.boot.module.common.api.service.ICompensateFlowDataOfRedis;
import com.yeejoin.amos.boot.module.ymt.api.dto.IdxBizJgProjectContraptionDto;
import com.yeejoin.amos.boot.module.ymt.api.enums.ApplicationFormTypeEnum;
import com.yeejoin.amos.boot.module.ymt.api.enums.EquimentEnum;
import com.yeejoin.amos.boot.module.ymt.api.enums.EquipmentClassifityEnum;
......@@ -65,6 +68,8 @@ import java.util.*;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
import static java.util.stream.Collectors.toSet;
/**
* 设备报废注销服务实现类
*
......@@ -201,13 +206,11 @@ public class JgScrapCancelServiceImpl extends BaseService<JgScrapCancelDto, JgSc
try {
ReginParams reginParams = this.getSelectedOrgInfo();
Map<String, Object> noticeParams = (Map) mapParams.get(PAGE_KEY);
String[] receiveOrg = String.valueOf(noticeParams.get("receiveOrgCreditCode")).split("_");
String equListCode = MapUtil.getStr(noticeParams, "equListCode");
String equCategoryCode = MapUtil.getStr(noticeParams, "EQU_CATEGORY_CODE");
noticeParams.remove("record");
String[] taskName = new String[]{"流程结束"};
JgScrapCancelDto model = JSON.parseObject(JSON.toJSONString(noticeParams), JgScrapCancelDto.class);
model.setReceiveOrgCode(receiveOrg[0]);
model.setReceiveCompanyCode(receiveOrg[0]);
model.setReceiveOrgName(receiveOrg[1]);
// 字段转换
convertField(model);
// 获取告知单号 调整之前YZBF为ZX,
......@@ -232,10 +235,18 @@ public class JgScrapCancelServiceImpl extends BaseService<JgScrapCancelDto, JgSc
if (SUBMIT_TYPE_FLOW.equals(submitType)) {
CompanyBo company = reginParams.getCompany();
List<JgScrapCancelEq> JgScrapCancelEqList = getCancelEqs(noticeParams);
this.repeatUsedEquipCheck(JgScrapCancelEqList,
CompanyTypeEnum.INDIVIDUAL.getName().equals(company.getCompanyType()) ?
company.getCompanyCode().split("_")[1] :
company.getCompanyCode());
// 压力管道或普通气瓶(车用气瓶equCategoryCode前端上送23T0)
if (EquipmentClassifityEnum.YLGD.getCode().equals(equListCode) || (CylinderTypeEnum.CYLINDER.getCode().equals(equCategoryCode))) {
this.repeatUsedEquipCheck(JgScrapCancelEqList,
CompanyTypeEnum.INDIVIDUAL.getName().equals(company.getCompanyType()) ?
company.getCompanyCode().split("_")[1] :
company.getCompanyCode());
} else {
this.repeatUsedCertificationCheck(JgScrapCancelEqList,
CompanyTypeEnum.INDIVIDUAL.getName().equals(company.getCompanyType()) ?
company.getCompanyCode().split("_")[1] :
company.getCompanyCode());
}
// 发起流程
ActWorkflowBatchDTO actWorkflowBatchDTO = new ActWorkflowBatchDTO();
List<ActWorkflowStartDTO> list = new ArrayList<>();
......@@ -310,10 +321,11 @@ public class JgScrapCancelServiceImpl extends BaseService<JgScrapCancelDto, JgSc
}
private List<JgScrapCancelEq> getCancelEqs(Map<String, Object> noticeParams) {
String equListCode = MapUtil.getStr(noticeParams, "equListCode");
List<JgScrapCancelEq> JgScrapCancelEqList = new ArrayList<>();
// 判断是否是报废气瓶业务处理
if (CancelTypeEnum.SCRAPPED.getCode().equals(noticeParams.get("cancelType")) &&
CylinderTypeEnum.CYLINDER.getCode().equals(noticeParams.get("EQU_CATEGORY_CODE"))) {
if ((CancelTypeEnum.SCRAPPED.getCode().equals(noticeParams.get("cancelType")) &&
CylinderTypeEnum.CYLINDER.getCode().equals(noticeParams.get("EQU_CATEGORY_CODE"))) || EquipmentClassifityEnum.YLGD.getCode().equals(equListCode)) {
List<Map<String, Object>> list = (List<Map<String, Object>>) noticeParams.get("equipments");
for (Map<String, Object> equip : list) {
JgScrapCancelEq jgScrapCancelEq = new JgScrapCancelEq();
......@@ -323,7 +335,7 @@ public class JgScrapCancelServiceImpl extends BaseService<JgScrapCancelDto, JgSc
} else {
List<Map<String, Object>> certificates;
// 证列表
if (CylinderTypeEnum.SPECIAL_CYLINDER.getCode().equals(noticeParams.get("EQU_CATEGORY_CODE"))) {
if (CylinderTypeEnum.SPECIAL_CYLINDER.getCode().equals(noticeParams.get("EQU_CATEGORY_CODE"))) { // 前端EQU_CATEGORY_CODE=23T0是标识车用气瓶(前端下拉把车用气瓶品种作为类别了)
certificates = (List<Map<String, Object>>) noticeParams.get("cylCertificates");
} else {
certificates = (List<Map<String, Object>>) noticeParams.get("certificates");
......@@ -340,11 +352,16 @@ public class JgScrapCancelServiceImpl extends BaseService<JgScrapCancelDto, JgSc
return JgScrapCancelEqList;
}
private void repeatUsedEquipCheck(List<JgScrapCancelEq> eqList, String companyCode) {
private void repeatUsedCertificationCheck(List<JgScrapCancelEq> eqList, String companyCode) {
eqList.forEach(cancelEq -> EquipUsedCheckStrategyContext.getUsedStrategy(PAGE_KEY)
.registrationRepeatUsedCheck(cancelEq.getEquId(), companyCode));
}
private void repeatUsedEquipCheck(List<JgScrapCancelEq> eqList, String companyCode) {
eqList.forEach(cancelEq -> EquipUsedCheckStrategyContext.getUsedStrategy(PAGE_KEY)
.equipRepeatUsedCheck(cancelEq.getEquId(), companyCode));
}
/**
* 删除 redis校验重复引用设备的数据
*/
......@@ -373,8 +390,8 @@ public class JgScrapCancelServiceImpl extends BaseService<JgScrapCancelDto, JgSc
*/
private void setUseRegisterInfo(JgScrapCancel jgScrapCancel, Map<String, Object> noticeParams) {
// 判断是否是报废气瓶业务处理
if (CancelTypeEnum.SCRAPPED.getCode().equals(noticeParams.get("cancelType")) &&
CylinderTypeEnum.CYLINDER.getCode().equals(noticeParams.get("EQU_CATEGORY_CODE"))) {
if ((CancelTypeEnum.SCRAPPED.getCode().equals(noticeParams.get("cancelType")) &&
CylinderTypeEnum.CYLINDER.getCode().equals(noticeParams.get("EQU_CATEGORY_CODE"))) || EquipmentClassifityEnum.YLGD.getCode().equals(noticeParams.get("equListCode"))) {
// 证ids
List<String> certificates = (List<String>) noticeParams.get("sequenceNbrs");
LambdaQueryWrapper<JgUseRegistrationManage> lambdaQueryWrapper = new LambdaQueryWrapper<>();
......@@ -406,8 +423,8 @@ public class JgScrapCancelServiceImpl extends BaseService<JgScrapCancelDto, JgSc
private void saveEquip(Map<String, Object> noticeParams, JgScrapCancel jgScrapCancel) {
List<JgScrapCancelEq> JgScrapCancelEqList = new ArrayList<>();
// 判断是否是报废气瓶业务处理
if (CancelTypeEnum.SCRAPPED.getCode().equals(noticeParams.get("cancelType")) &&
CylinderTypeEnum.CYLINDER.getCode().equals(noticeParams.get("EQU_CATEGORY_CODE"))) {
if ((CancelTypeEnum.SCRAPPED.getCode().equals(noticeParams.get("cancelType")) &&
CylinderTypeEnum.CYLINDER.getCode().equals(noticeParams.get("EQU_CATEGORY_CODE"))) || EquipmentClassifityEnum.YLRQ.getCode().equals(noticeParams.get("EQU_LIST_CODE"))) {
List<Map<String, Object>> list = (List<Map<String, Object>>) noticeParams.get("equipments");
for (Map<String, Object> equip : list) {
JgScrapCancelEq jgScrapCancelEq = new JgScrapCancelEq();
......@@ -531,9 +548,9 @@ public class JgScrapCancelServiceImpl extends BaseService<JgScrapCancelDto, JgSc
@GlobalTransactional(rollbackFor = Exception.class)
public JgScrapCancelDto updateInfo(String submitType, JgScrapCancelDto jgScrapCancelDto, String op, JSONObject pageData) {
try {
String equListCode = MapUtil.getStr(pageData, "equListCode");
String equCategoryCode = MapUtil.getStr(pageData, "EQU_CATEGORY_CODE");
if (Objects.isNull(jgScrapCancelDto) || StringUtils.isEmpty(submitType)) {
throw new IllegalArgumentException("参数不能为空");
}
......@@ -545,9 +562,17 @@ public class JgScrapCancelServiceImpl extends BaseService<JgScrapCancelDto, JgSc
ReginParams reginParams = JSONObject.parseObject(redisUtils.get(RedisKey.buildReginKey(RequestContext.getExeUserId(), RequestContext.getToken())).toString(), ReginParams.class);
CompanyBo company = reginParams.getCompany();
List<JgScrapCancelEq> JgScrapCancelEqList = getCancelEqs(pageData);
this.repeatUsedEquipCheck(JgScrapCancelEqList, CompanyTypeEnum.INDIVIDUAL.getName().equals(company.getCompanyType()) ?
company.getCompanyCode().split("_")[1] :
company.getCompanyCode());
if (EquipmentClassifityEnum.YLGD.getCode().equals(equListCode) || (CylinderTypeEnum.CYLINDER.getCode().equals(equCategoryCode))) {
this.repeatUsedEquipCheck(JgScrapCancelEqList,
CompanyTypeEnum.INDIVIDUAL.getName().equals(company.getCompanyType()) ?
company.getCompanyCode().split("_")[1] :
company.getCompanyCode());
} else {
this.repeatUsedCertificationCheck(JgScrapCancelEqList,
CompanyTypeEnum.INDIVIDUAL.getName().equals(company.getCompanyType()) ?
company.getCompanyCode().split("_")[1] :
company.getCompanyCode());
}
// 更新并提交
// 发起流程
if (!StringUtils.hasText(jgScrapCancelDto.getInstanceId())) {
......@@ -1160,4 +1185,27 @@ public class JgScrapCancelServiceImpl extends BaseService<JgScrapCancelDto, JgSc
this.createResume(jgScrapCancel, taskV2Model.getRoutePath());
this.getBaseMapper().updateById(jgScrapCancel);
}
public IPage<Map<String, Object>> findPipeLinePage(Page<Map<String, Object>> page, String projectContraptionId, Map<String, Object> filters) {
IPage<Map<String, Object>> re = this.getBaseMapper().selectPipeLinePage(page, projectContraptionId, filters);
re.getRecords().forEach(item -> item.put("inspectReport", Optional.ofNullable(item.get("inspectReport")).map(r->JSON.parse(r.toString())).orElse(null)));
return re;
}
public IPage<IdxBizJgProjectContraptionDto> getJgProjectContraptionPage(String useUnitCreditCode, Page<IdxBizJgProjectContraptionDto> page, String sequenceNbr, Map<String, Object> filters) {
// 兼容个人业务
if (useUnitCreditCode.contains("_")) {
useUnitCreditCode = useUnitCreditCode.split("_")[1];
}
// 查询流程中的装置
List<JgScrapCancel> flowIngPros = this.list(new LambdaQueryWrapper<JgScrapCancel>().notIn(JgScrapCancel::getAuditStatus, NOT_FLOWING_STATE).select(BaseEntity::getSequenceNbr, JgScrapCancel::getProjectContraptionId));
Set<String> proIds = flowIngPros.stream().map(JgScrapCancel::getProjectContraptionId).collect(toSet());
proIds.remove(null);
proIds.remove("");
// 编辑时要有自己
if (org.apache.commons.lang3.StringUtils.isNotEmpty(sequenceNbr)) {
proIds.remove(sequenceNbr);
}
return this.getBaseMapper().queryJgProjectContraptionPage(page, useUnitCreditCode, proIds, filters);
}
}
package com.yeejoin.amos.boot.module.ymt.api.dto;
import com.alibaba.fastjson.JSONArray;
import com.baomidou.mybatisplus.annotation.TableField;
import com.yeejoin.amos.boot.biz.common.dto.BaseDto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import com.yeejoin.amos.boot.biz.common.dto.BaseDto;
import lombok.Data;
import lombok.EqualsAndHashCode;
......
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