Commit a74ad91d authored by 刘林's avatar 刘林

fix(jg):超设计使用年限功能开发

parent 15332f3c
...@@ -6,7 +6,6 @@ import com.yeejoin.amos.boot.biz.common.dto.BaseDto; ...@@ -6,7 +6,6 @@ import com.yeejoin.amos.boot.biz.common.dto.BaseDto;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import java.util.Date; import java.util.Date;
/** /**
* *
* *
...@@ -54,4 +53,12 @@ public class JgOverDesignServiceLifeEqDto extends BaseDto { ...@@ -54,4 +53,12 @@ public class JgOverDesignServiceLifeEqDto extends BaseDto {
@ApiModelProperty(value = "使用登记编号") @ApiModelProperty(value = "使用登记编号")
private String useRegistrationCode; private String useRegistrationCode;
@ApiModelProperty(value = "设备种类")
private String equList;
@ApiModelProperty(value = "设备类别")
private String equCategory;
@ApiModelProperty(value = "设备品种")
private String equDefine;
} }
...@@ -165,4 +165,10 @@ public class JgOverDesignServiceLife extends BaseEntity { ...@@ -165,4 +165,10 @@ public class JgOverDesignServiceLife extends BaseEntity {
*/ */
@TableField("create_date") @TableField("create_date")
private Date createDate; private Date createDate;
/**
* 使用登记证
*/
@TableField("use_registration_code")
private String useRegistrationCode;
} }
...@@ -95,12 +95,6 @@ public class JgOverDesignServiceLifeEq extends BaseEntity { ...@@ -95,12 +95,6 @@ public class JgOverDesignServiceLifeEq extends BaseEntity {
private Date safetyAssessmentDate; private Date safetyAssessmentDate;
/** /**
* 延期使用年限
*/
@TableField("delay_service_life")
private String delayServiceLife;
/**
* 设备种类 * 设备种类
*/ */
@TableField("equ_list") @TableField("equ_list")
......
package com.yeejoin.amos.boot.module.jg.api.mapper; package com.yeejoin.amos.boot.module.jg.api.mapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.module.jg.api.dto.CompanyEquipCountDto; import com.yeejoin.amos.boot.module.jg.api.dto.CompanyEquipCountDto;
import com.yeejoin.amos.boot.module.jg.api.dto.JgChangeRegistrationTransferDto;
import com.yeejoin.amos.boot.module.jg.api.dto.JgOverDesignServiceLifeDto;
import com.yeejoin.amos.boot.module.jg.api.entity.JgOverDesignServiceLife; import com.yeejoin.amos.boot.module.jg.api.entity.JgOverDesignServiceLife;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yeejoin.amos.boot.module.jg.api.vo.SortVo;
import org.apache.ibatis.annotations.Param;
import java.util.List; import java.util.List;
import java.util.Map;
/** /**
* Mapper 接口 * Mapper 接口
...@@ -14,4 +20,9 @@ import java.util.List; ...@@ -14,4 +20,9 @@ import java.util.List;
public interface JgOverDesignServiceLifeMapper extends BaseMapper<JgOverDesignServiceLife> { public interface JgOverDesignServiceLifeMapper extends BaseMapper<JgOverDesignServiceLife> {
List<CompanyEquipCountDto> queryForFlowingEquipList(); List<CompanyEquipCountDto> queryForFlowingEquipList();
Page<Map<String, Object>> getListPage(@Param("page")Page<Map<String, Object>> page,
@Param("sort") SortVo sortMap,
@Param("dto") JgOverDesignServiceLifeDto dto ,
@Param("type") String type);
} }
...@@ -4,11 +4,103 @@ ...@@ -4,11 +4,103 @@
<select id="queryForFlowingEquipList" resultType="com.yeejoin.amos.boot.module.jg.api.dto.CompanyEquipCountDto"> <select id="queryForFlowingEquipList" resultType="com.yeejoin.amos.boot.module.jg.api.dto.CompanyEquipCountDto">
select a.use_unit_credit_code as companyCode, select a.use_unit_credit_code as companyCode,
group_concat(b.equ_id) as records GROUP_CONCAT(b.equ_id) as records
from tzs_jg_over_design_service_life a, from TZS_JG_OVER_DESIGN_SERVICE_LIFE a,
tzs_jg_over_design_service_life_eq b TZS_JG_OVER_DESIGN_SERVICE_LIFE_EQ b
where a.sequence_nbr = b.over_design_id where a.sequence_nbr = b.over_design_id
and a.status in ('待受理') and a.status in ('待受理')
GROUP BY a.use_unit_credit_code GROUP BY a.use_unit_credit_code
</select> </select>
<sql id="page_list">
WITH crteq_limited AS (
SELECT *,ROW_NUMBER() OVER (PARTITION BY over_design_id ORDER BY rec_date desc) as rn
FROM TZS_JG_OVER_DESIGN_SERVICE_LIFE_EQ)
SELECT
ovds.sequence_nbr as sequenceNbr,
DATE_FORMAT(ovds.rec_date,'%Y-%m-%d') as regDate,
DATE_FORMAT(ovds.create_date,'%Y-%m-%d') as createDate,
ovds.status,
ovds.receive_org_name as receiveOrgName,
ovds.apply_no as applyNo,
ovds.next_execute_ids AS nextExecuteIds,
ovds.promoter,
DATE_FORMAT(ovds.rec_date,'%Y-%m-%d') as recDate,
ovds.instance_id as instanceId,
GROUP_CONCAT(ovdseq.use_registration_code) as useRegistrationCode,
ovds.next_execute_user_ids as nextExecuteUserIds,
ovds.create_user_id as createUserId,
ovds.next_task_id as nextTaskId,
ovds.USE_UNIT_NAME as useUnitName,
jri.PRODUCT_NAME as productName,
jri.EQU_CODE as equCode,
concat(use."PROVINCE_NAME", '', use."CITY_NAME", '', use."COUNTY_NAME", '', use."STREET_NAME") as allAddress,
(SELECT name from tz_equipment_category WHERE code = jri.EQU_LIST) AS equList,
(SELECT name from tz_equipment_category where code = jri.EQU_CATEGORY) as equCategory,
(SELECT name from tz_equipment_category where code = jri.EQU_DEFINE) as equDefine
FROM TZS_JG_OVER_DESIGN_SERVICE_LIFE ovds
LEFT JOIN crteq_limited ovdseq ON ovds.sequence_nbr = ovdseq.over_design_id AND ovdseq.rn = 1
LEFT JOIN idx_biz_jg_register_info jri on ovdseq.equ_id = jri.RECORD
LEFT JOIN idx_biz_jg_use_info use on ovdseq.equ_id = use.RECORD
</sql>
<select id="getListPage" resultType="java.util.Map">
<include refid="page_list"/>
<where>
and ovds.is_delete = 0
<if test="dto.equCategory != null and dto.equCategory != ''">
and jri.EQU_CATEGORY = #{dto.equCategory}
</if>
<if test="dto.status != null and dto.status != ''">
and ovds.status like concat('%', #{dto.status},'%')
</if>
<if test="dto.createDate != null">
and ovds.create_date like concat('%',DATE_FORMAT(#{dto.createDate},'%Y-%m-%d'),'%')
</if>
<if test="dto.equCode != null and dto.equCode != ''">
and jri.EQU_CODE like concat('%',#{dto.equCode},'%')
</if>
<if test="dto.useUnitCreditCode != null and dto.useUnitCreditCode != ''">
and ovds.use_unit_credit_code = #{dto.useUnitCreditCode}
</if>
<if test="dto.equList != null and dto.equList != ''">
AND jri."EQU_LIST" = #{dto.equList}
</if>
<if test="dto.equCategory != null and dto.equCategory != ''">
AND jri."equ_category" = #{dto.equCategory}
</if>
<if test="dto.equDefine != null and dto.equDefine != ''">
AND jri."EQU_DEFINE" = #{dto.equDefine}
</if>
<if test="dto.equCode != null and dto.equCode != ''">
AND jri."EQU_CODE" like concat('%',#{dto.equCode},'%')
</if>
<if test="dto.useRegistrationCode != null and dto.useRegistrationCode != ''">
AND ovds.use_registration_code like concat('%',#{dto.useRegistrationCode},'%')
</if>
<if test="dto.supervisoryCode != null and dto.supervisoryCode != ''">
AND oi.SUPERVISORY_CODE like concat('%',#{dto.supervisoryCode},'%')
</if>
<if test="dto.receiveOrgCode != null and dto.receiveOrgCode != ''">
and (ovds.receive_company_code = #{dto.receiveOrgCode} or ovds.transfer_to_user_ids like concat('%',#{currentUserId},'%'))
</if>
<if test="type == 'supervision'">
AND (ovds.receive_company_code = #{dto.unitCode} or ovds.transfer_to_user_ids like concat('%',#{currentUserId},'%'))
AND ovds.instance_id <![CDATA[<>]]> ''
</if>
<if test="type == 'company'">
AND ovds.use_unit_credit_code = #{dto.unitCode}
</if>
<if test="dto.applyNo != null and dto.applyNo != ''">
and ovds.apply_no like concat('%',#{dto.applyNo},'%')
</if>
<if test="dto.productName != null and dto.productName != ''">
and jri.PRODUCT_NAME like concat('%',#{dto.productName},'%')
</if>
</where>
order by
<if test="sort != null">
ovds.${sort.field} ${sort.sortType},
</if>
ovds.create_date DESC, ovds.apply_no DESC
</select>
</mapper> </mapper>
...@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page; ...@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
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.utils.RedisKey; 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.jg.api.dto.JgOverDesignServiceLifeDto;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
...@@ -22,6 +23,8 @@ import org.typroject.tyboot.core.restful.doc.TycloudOperation; ...@@ -22,6 +23,8 @@ import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.foundation.enumeration.UserType; import org.typroject.tyboot.core.foundation.enumeration.UserType;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.Map;
import java.util.Optional;
/** /**
* *
...@@ -106,26 +109,17 @@ public class JgOverDesignServiceLifeController extends BaseController { ...@@ -106,26 +109,17 @@ public class JgOverDesignServiceLifeController extends BaseController {
* @return * @return
*/ */
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/getList") @GetMapping("/getPageList")
@ApiOperation(httpMethod = "GET",value = "分页查询", notes = "分页查询") @ApiOperation(httpMethod = "GET", value = "分页查询", notes = "分页查询")
public ResponseModel<Page<JgOverDesignServiceLife>> queryForPage(@RequestParam(value = "current") int current, @RequestParam public ResponseModel<Page<Map<String, Object>>> queryForPage(@RequestParam("current") int current,
(value = "size") int size) { @RequestParam("size") int size,
Page<JgOverDesignServiceLife> page = new Page<JgOverDesignServiceLife>(); @RequestParam(value = "sort", required = false) String sort,
page.setCurrent(current); JgOverDesignServiceLifeDto dto) {
page.setSize(size); ReginParams reginParams = getSelectedOrgInfo();
return ResponseHelper.buildResponse(jgOverDesignServiceLifeServiceImpl.queryForJgOverDesignServiceLifePage(page)); dto.setUseUnitCreditCode(Optional.ofNullable(reginParams.getCompany().getCompanyCode())
} .map(code -> code.contains("_") ? code.split("_")[1] : code)
.orElse(""));
/** return ResponseHelper.buildResponse(jgOverDesignServiceLifeServiceImpl.getPageList(new Page<>(current, size), sort, dto, reginParams.getCompany().getCompanyType()));
* 列表全部数据查询
*
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET",value = "列表全部数据查询", notes = "列表全部数据查询")
@GetMapping(value = "/list")
public ResponseModel<List<JgOverDesignServiceLife>> selectForList() {
return ResponseHelper.buildResponse(jgOverDesignServiceLifeServiceImpl.queryForJgOverDesignServiceLifeList());
} }
/** /**
...@@ -143,7 +137,6 @@ public class JgOverDesignServiceLifeController extends BaseController { ...@@ -143,7 +137,6 @@ public class JgOverDesignServiceLifeController extends BaseController {
return ResponseHelper.buildResponse("ok"); return ResponseHelper.buildResponse("ok");
} }
/** /**
* 执行流程 * 执行流程
* *
......
...@@ -7,8 +7,12 @@ import com.yeejoin.amos.boot.module.ymt.api.entity.IdxBizJgDesignInfo; ...@@ -7,8 +7,12 @@ import com.yeejoin.amos.boot.module.ymt.api.entity.IdxBizJgDesignInfo;
import com.yeejoin.amos.boot.module.ymt.api.mapper.IdxBizJgDesignInfoMapper; import com.yeejoin.amos.boot.module.ymt.api.mapper.IdxBizJgDesignInfoMapper;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.typroject.tyboot.core.rdbms.service.BaseService; import org.typroject.tyboot.core.rdbms.service.BaseService;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.*;
import java.util.function.Function;
import java.util.stream.Collectors;
/** /**
* 安全追溯-设计信息表服务实现类 * 安全追溯-设计信息表服务实现类
...@@ -17,9 +21,9 @@ import java.util.List; ...@@ -17,9 +21,9 @@ import java.util.List;
* @date 2023-08-17 * @date 2023-08-17
*/ */
@Service @Service
public class IdxBizJgDesignInfoServiceImpl extends BaseService<IdxBizJgDesignInfoDto,IdxBizJgDesignInfo,IdxBizJgDesignInfoMapper> implements IIdxBizJgDesignInfoService { public class IdxBizJgDesignInfoServiceImpl extends BaseService<IdxBizJgDesignInfoDto, IdxBizJgDesignInfo, IdxBizJgDesignInfoMapper> implements IIdxBizJgDesignInfoService {
public boolean saveOrUpdateData(IdxBizJgDesignInfo designInfo){ public boolean saveOrUpdateData(IdxBizJgDesignInfo designInfo) {
return this.saveOrUpdate(designInfo); return this.saveOrUpdate(designInfo);
} }
...@@ -32,4 +36,22 @@ public class IdxBizJgDesignInfoServiceImpl extends BaseService<IdxBizJgDesignInf ...@@ -32,4 +36,22 @@ public class IdxBizJgDesignInfoServiceImpl extends BaseService<IdxBizJgDesignInf
public IdxBizJgDesignInfo getOneData(String record) { public IdxBizJgDesignInfo getOneData(String record) {
return this.getOne(new QueryWrapper<IdxBizJgDesignInfo>().eq("RECORD", record)); return this.getOne(new QueryWrapper<IdxBizJgDesignInfo>().eq("RECORD", record));
} }
public List<IdxBizJgDesignInfo> checkOverDesignRegNum(List<String> records) {
if (records == null || records.isEmpty()) {
return Collections.emptyList();
}
List<IdxBizJgDesignInfo> allRecords = list(new QueryWrapper<IdxBizJgDesignInfo>()
.lambda().in(IdxBizJgDesignInfo::getRecord, records)
.orderByDesc(IdxBizJgDesignInfo::getRecDate));
return new ArrayList<>(allRecords.stream()
.collect(Collectors.toMap(
IdxBizJgDesignInfo::getRecord,
Function.identity(),
(existing, replacement) -> existing,
LinkedHashMap::new
))
.values());
}
} }
\ No newline at end of file
...@@ -26,6 +26,7 @@ import com.yeejoin.amos.boot.module.jg.biz.context.EquipUsedCheckStrategyContext ...@@ -26,6 +26,7 @@ import com.yeejoin.amos.boot.module.jg.biz.context.EquipUsedCheckStrategyContext
import com.yeejoin.amos.boot.module.jg.biz.context.FlowingEquipRedisContext; import com.yeejoin.amos.boot.module.jg.biz.context.FlowingEquipRedisContext;
import com.yeejoin.amos.boot.module.jg.biz.feign.TzsServiceFeignClient; import com.yeejoin.amos.boot.module.jg.biz.feign.TzsServiceFeignClient;
import com.yeejoin.amos.boot.module.jg.biz.service.ICmWorkflowService; import com.yeejoin.amos.boot.module.jg.biz.service.ICmWorkflowService;
import com.yeejoin.amos.boot.module.ymt.api.entity.IdxBizJgDesignInfo;
import com.yeejoin.amos.boot.module.ymt.api.entity.IdxBizJgInspectionDetectionInfo; import com.yeejoin.amos.boot.module.ymt.api.entity.IdxBizJgInspectionDetectionInfo;
import com.yeejoin.amos.boot.module.ymt.api.entity.IdxBizJgRegisterInfo; import com.yeejoin.amos.boot.module.ymt.api.entity.IdxBizJgRegisterInfo;
import com.yeejoin.amos.boot.module.ymt.api.enums.ApplicationFormTypeEnum; import com.yeejoin.amos.boot.module.ymt.api.enums.ApplicationFormTypeEnum;
...@@ -95,19 +96,14 @@ public class JgOverDesignServiceLifeServiceImpl extends BaseService<JgOverDesign ...@@ -95,19 +96,14 @@ public class JgOverDesignServiceLifeServiceImpl extends BaseService<JgOverDesign
private TzsServiceFeignClient tzsServiceFeignClient; private TzsServiceFeignClient tzsServiceFeignClient;
@Autowired @Autowired
private ICmWorkflowService workflowService; private ICmWorkflowService workflowService;
@Autowired
private IdxBizJgDesignInfoServiceImpl idxBizJgDesignInfoServiceImpl;
/** /**
* 分页查询 * 分页查询
*/ */
public Page<JgOverDesignServiceLife> queryForJgOverDesignServiceLifePage(Page<JgOverDesignServiceLife> page) { public Page<Map<String, Object>> getPageList(Page<Map<String, Object>> page, String sort, JgOverDesignServiceLifeDto dto, String companyType) {
return this.queryForPage(page, null, false); return this.baseMapper.getListPage(page, commonService.sortFieldConversion(sort), dto, companyType);
}
/**
* 列表查询 示例
*/
public List<JgOverDesignServiceLife> queryForJgOverDesignServiceLifeList() {
return this.queryForList("" , false);
} }
/** /**
...@@ -124,7 +120,7 @@ public class JgOverDesignServiceLifeServiceImpl extends BaseService<JgOverDesign ...@@ -124,7 +120,7 @@ public class JgOverDesignServiceLifeServiceImpl extends BaseService<JgOverDesign
if(SUBMIT_TYPE_FLOW.equals(map.get("submit"))){ if(SUBMIT_TYPE_FLOW.equals(map.get("submit"))){
JSONArray useRegistrationFormFile = map.getJSONArray("useRegistrationFormFile"); JSONArray useRegistrationFormFile = map.getJSONArray("useRegistrationFormFile");
if(CollUtil.isEmpty(useRegistrationFormFile)){ if(CollUtil.isEmpty(useRegistrationFormFile)){
throw new BadRequest("特种设备使用登记变更证明(签章后)为空"); throw new BadRequest("特种设备超设计使用年限变更证明(签章后)为空,请上传后再提交!");
} }
} }
JgOverDesignServiceLifeDto overDesignDto = JSON.parseObject(JSON.toJSONString(map), JgOverDesignServiceLifeDto.class); JgOverDesignServiceLifeDto overDesignDto = JSON.parseObject(JSON.toJSONString(map), JgOverDesignServiceLifeDto.class);
...@@ -155,9 +151,23 @@ public class JgOverDesignServiceLifeServiceImpl extends BaseService<JgOverDesign ...@@ -155,9 +151,23 @@ public class JgOverDesignServiceLifeServiceImpl extends BaseService<JgOverDesign
ObjectUtils.isEmpty(info.getInspectConclusion()) || ObjectUtils.isEmpty(info.getInspectOrgCode()))) { ObjectUtils.isEmpty(info.getInspectConclusion()) || ObjectUtils.isEmpty(info.getInspectOrgCode()))) {
throw new BadRequest("请补充设备检验检测信息后提交!"); throw new BadRequest("请补充设备检验检测信息后提交!");
} }
List<IdxBizJgDesignInfo> designInfoList = idxBizJgDesignInfoServiceImpl.checkOverDesignRegNum(
equipmentLists.stream()
.map(v -> (String) v.get("record"))
.collect(Collectors.toList())
);
if (designInfoList.stream().anyMatch(info -> info.getOverDesignRegNum() >= 2)) {
throw new BadRequest("请补充设备检验检测信息后提交!");
}
overDesignDto.setCreateDate(new Date()); overDesignDto.setCreateDate(new Date());
overDesignDto.setPromoter(reginParams.getUserModel().getUserId()); overDesignDto.setPromoter(reginParams.getUserModel().getUserId());
List<String> registrationNoList = equipmentLists.stream()
.map(objectMap -> objectMap.get("useRegistrationCode"))
.filter(Objects::nonNull)
.map(Object::toString)
.collect(Collectors.toList());
if ("个人主体".equals(company.getCompanyType())) { if ("个人主体".equals(company.getCompanyType())) {
overDesignDto.setUseUnitName(company.getCompanyName().split("_")[1]); overDesignDto.setUseUnitName(company.getCompanyName().split("_")[1]);
overDesignDto.setUseUnitCreditCode(company.getCompanyCode().split("_")[1]); overDesignDto.setUseUnitCreditCode(company.getCompanyCode().split("_")[1]);
...@@ -181,7 +191,7 @@ public class JgOverDesignServiceLifeServiceImpl extends BaseService<JgOverDesign ...@@ -181,7 +191,7 @@ public class JgOverDesignServiceLifeServiceImpl extends BaseService<JgOverDesign
BeanUtils.copyProperties(overDesignDto, overDesignServiceLife); BeanUtils.copyProperties(overDesignDto, overDesignServiceLife);
overDesignServiceLife.setCreateUserId(reginParams.getUserModel().getUserId()); overDesignServiceLife.setCreateUserId(reginParams.getUserModel().getUserId());
overDesignServiceLife.setCreateUserName(reginParams.getUserModel().getRealName()); overDesignServiceLife.setCreateUserName(reginParams.getUserModel().getRealName());
overDesignServiceLife.setUseRegistrationCode(String.join(",", registrationNoList));
boolean hasId = StringUtils.isEmpty(overDesignDto.getSequenceNbr()); boolean hasId = StringUtils.isEmpty(overDesignDto.getSequenceNbr());
//新增 //新增
if (hasId) { if (hasId) {
......
...@@ -122,5 +122,5 @@ public class IdxBizJgDesignInfo extends TzsBaseEntity { ...@@ -122,5 +122,5 @@ public class IdxBizJgDesignInfo extends TzsBaseEntity {
* 超设计使用变更登记次数(默认0,最多2次) * 超设计使用变更登记次数(默认0,最多2次)
*/ */
@TableField("\"OVER_DESIGN_REG_NUM\"") @TableField("\"OVER_DESIGN_REG_NUM\"")
private String overDesignRegNum; private Integer overDesignRegNum;
} }
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