Commit 6368e3cd authored by chenzhao's avatar chenzhao

Merge remote-tracking branch 'origin/develop_tzs_register' into develop_tzs_register

parents 26c42ec1 77944399
package com.yeejoin.amos.api.openapi.controller; package com.yeejoin.amos.api.openapi.controller;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.yeejoin.amos.api.openapi.face.model.ElevatorModel;
import com.yeejoin.amos.api.openapi.feign.TzsJgServiceFeignClient; import com.yeejoin.amos.api.openapi.feign.TzsJgServiceFeignClient;
import com.yeejoin.amos.boot.module.cylinder.api.dto.PageParam; import com.yeejoin.amos.boot.module.cylinder.api.dto.PageParam;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
...@@ -17,8 +15,6 @@ import org.typroject.tyboot.core.restful.doc.TycloudOperation; ...@@ -17,8 +15,6 @@ 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 java.util.Date; import java.util.Date;
import java.util.List;
import java.util.Map;
/** /**
* 特种设备监管controller * 特种设备监管controller
...@@ -42,11 +38,11 @@ public class YuLinDataDockController { ...@@ -42,11 +38,11 @@ public class YuLinDataDockController {
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/getElevatorInfo") @GetMapping(value = "/getElevatorInfo")
@ApiOperation(httpMethod = "GET", value = "查询电梯信息列表", notes = "查询电梯信息列表") @ApiOperation(httpMethod = "GET", value = "查询电梯信息列表", notes = "查询电梯信息列表")
public ResponseModel<IPage<ElevatorModel>> getElevatorInfo(@RequestParam(value = "equCode", required = false) String equCode, public ResponseModel<Object> getElevatorInfo(@RequestParam(value = "equCode", required = false) String equCode,
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") Date startTime, @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") Date startTime,
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") Date endTime, @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") Date endTime,
PageParam pageParam) { PageParam pageParam) {
return ResponseHelper.buildResponse(jgServiceFeignClient.getElevatorInfo(equCode, startTime, endTime, pageParam)); return ResponseHelper.buildResponse(jgServiceFeignClient.getElevatorInfo(equCode, startTime, endTime, pageParam.getCurrent(), pageParam.getSize()));
} }
/** /**
...@@ -60,11 +56,11 @@ public class YuLinDataDockController { ...@@ -60,11 +56,11 @@ public class YuLinDataDockController {
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/getCylinderInfo") @GetMapping(value = "/getCylinderInfo")
@ApiOperation(httpMethod = "GET", value = "根据时间范围查询液化石油气瓶档案", notes = "根据时间范围查询液化石油气瓶档案") @ApiOperation(httpMethod = "GET", value = "根据时间范围查询液化石油气瓶档案", notes = "根据时间范围查询液化石油气瓶档案")
public ResponseModel<IPage<ElevatorModel>> getCylinderInfo(@RequestParam(value = "equCode", required = false) String equCode, public ResponseModel<Object> getCylinderInfo(@RequestParam(value = "equCode", required = false) String equCode,
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") Date startTime, @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") Date startTime,
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") Date endTime, @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") Date endTime,
PageParam pageParam) { PageParam pageParam) {
return ResponseHelper.buildResponse(jgServiceFeignClient.getCylinderInfo(equCode, startTime, endTime, pageParam)); return ResponseHelper.buildResponse(jgServiceFeignClient.getCylinderInfo(equCode, startTime, endTime, pageParam.getCurrent(), pageParam.getSize()));
} }
/** /**
...@@ -75,7 +71,7 @@ public class YuLinDataDockController { ...@@ -75,7 +71,7 @@ public class YuLinDataDockController {
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/getVehicleCylinderInfo") @GetMapping(value = "/getVehicleCylinderInfo")
@ApiOperation(httpMethod = "GET", value = "车用气气瓶档案", notes = "车用气气瓶档案") @ApiOperation(httpMethod = "GET", value = "车用气气瓶档案", notes = "车用气气瓶档案")
public ResponseModel<List<Map<String, Object>>> getVehicleCylinderInfo(@RequestParam(value = "useCode") String useCode) { public ResponseModel<Object> getVehicleCylinderInfo(@RequestParam(value = "useCode") String useCode) {
return ResponseHelper.buildResponse(jgServiceFeignClient.getVehicleCylinderInfo(useCode)); return ResponseHelper.buildResponse(jgServiceFeignClient.getVehicleCylinderInfo(useCode));
} }
...@@ -86,7 +82,7 @@ public class YuLinDataDockController { ...@@ -86,7 +82,7 @@ public class YuLinDataDockController {
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/getCylinderStationInfo") @GetMapping(value = "/getCylinderStationInfo")
@ApiOperation(httpMethod = "GET", value = "查询气站信息", notes = "查询气站信息") @ApiOperation(httpMethod = "GET", value = "查询气站信息", notes = "查询气站信息")
public ResponseModel<List<Map<String, Object>>> getCylinderStationInfo() { public ResponseModel<Object> getCylinderStationInfo() {
return ResponseHelper.buildResponse(jgServiceFeignClient.getCylinderStationInfo()); return ResponseHelper.buildResponse(jgServiceFeignClient.getCylinderStationInfo());
} }
} }
package com.yeejoin.amos.api.openapi.feign; package com.yeejoin.amos.api.openapi.feign;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.yeejoin.amos.api.openapi.dto.XiAnEquipInfoExcelDto; import com.yeejoin.amos.api.openapi.dto.XiAnEquipInfoExcelDto;
import com.yeejoin.amos.api.openapi.face.model.ElevatorModel;
import com.yeejoin.amos.boot.biz.common.feign.FeignConfiguration; import com.yeejoin.amos.boot.biz.common.feign.FeignConfiguration;
import com.yeejoin.amos.boot.module.cylinder.api.dto.PageParam; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.springframework.cloud.openfeign.FeignClient; import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import org.typroject.tyboot.core.restful.utils.ResponseModel; import org.typroject.tyboot.core.restful.utils.ResponseModel;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -44,11 +41,13 @@ public interface TzsJgServiceFeignClient { ...@@ -44,11 +41,13 @@ public interface TzsJgServiceFeignClient {
* @param endTime 结束时间 * @param endTime 结束时间
* @return 电梯数据 * @return 电梯数据
*/ */
@RequestMapping(value = "/equipment-register/getElevatorInfo", method = RequestMethod.GET) @GetMapping(value = "/equipment-register/getElevatorInfo")
IPage<ElevatorModel> getElevatorInfo(@RequestParam("equCode") String equCode, ResponseModel<Page<Map<String, Object>>> getElevatorInfo(@RequestParam("equCode") String equCode,
@RequestParam("startTime") Date startTime, @RequestParam("startTime") @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") Date startTime,
@RequestParam("startTime") Date endTime, @RequestParam("endTime") @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") Date endTime,
PageParam pageParam); @RequestParam(value = "current") int current,
@RequestParam(value = "size") int size
);
/** /**
* 根据时间范围查询液化石油气瓶档案 * 根据时间范围查询液化石油气瓶档案
...@@ -58,11 +57,13 @@ public interface TzsJgServiceFeignClient { ...@@ -58,11 +57,13 @@ public interface TzsJgServiceFeignClient {
* @param endTime 结束时间 * @param endTime 结束时间
* @return 电梯数据 * @return 电梯数据
*/ */
@RequestMapping(value = "/equipment-register/getCylinderInfo", method = RequestMethod.GET) @GetMapping(value = "/equipment-register/getCylinderInfo")
IPage<ElevatorModel> getCylinderInfo(@RequestParam("equCode") String equCode, ResponseModel<Page<Map<String, Object>>> getCylinderInfo(@RequestParam("equCode") String equCode,
@RequestParam("startTime") Date startTime, @RequestParam("startTime") @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") Date startTime,
@RequestParam("startTime") Date endTime, @RequestParam("endTime") @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") Date endTime,
PageParam pageParam); @RequestParam(value = "current") int current,
@RequestParam(value = "size") int size
);
/** /**
* 查询气站信息 * 查询气站信息
...@@ -70,10 +71,12 @@ public interface TzsJgServiceFeignClient { ...@@ -70,10 +71,12 @@ public interface TzsJgServiceFeignClient {
* @return * @return
*/ */
@RequestMapping(value = "/equipment-register/getCylinderStationInfo", method = RequestMethod.GET) @RequestMapping(value = "/equipment-register/getCylinderStationInfo", method = RequestMethod.GET)
List<Map<String, Object>> getCylinderStationInfo(); ResponseModel<List<Map<String, Object>>> getCylinderStationInfo();
@GetMapping(value = "/equipment-register/getVehicleCylinderInfo")
ResponseModel<List<Map<String, Object>>> getVehicleCylinderInfo(@RequestParam("useCode") String useCode);
@RequestMapping(value = "/equipment-register/getVehicleCylinderInfo", method = RequestMethod.GET)
List<Map<String, Object>> getVehicleCylinderInfo(String useCode);
/** /**
* 批量保存西安上传的设备数据 * 批量保存西安上传的设备数据
......
...@@ -133,54 +133,136 @@ ...@@ -133,54 +133,136 @@
tzs_jg_use_registration ur tzs_jg_use_registration ur
</sql> </sql>
<select id="getListPage" resultType="java.util.Map"> <sql id="page-list-sub-pipline">
select select
* ur.sequence_nbr as sequenceNbr,
ur.audit_status as auditStatus,
date_format(ur.reg_date,'%Y-%m-%d') as regDate,
ur.use_unit_name as useUnitName,
ur.status,
ur.receive_org_name as receiveOrgName,
ur.use_address as place,
ur.instance_id as instanceId,
ur.apply_no as applyNo,
ur.next_execute_ids as nextExecuteIds,
ur.promoter,
ur.use_registration_code as useRegistrationCode,
date_format(ur.audit_pass_date,'%Y-%m-%d') as auditPassDate,
date_format(ur.create_date,'%Y-%m-%d') as createDate,
ur.receive_org_name as receiveOrgName,
ur.next_execute_user_ids as nextExecuteUserIds,
ur.next_task_id as nextTaskId,
ur.create_user_id as createUserId,
ur.rec_date as recDate,
ur.manage_type as manageType,
ur.reg_type as regType,
ur.is_delete,
ur.create_date,
ur.receive_company_code,
ur.use_unit_credit_code,
ur.transfer_to_user_ids,
ur.supervision_org_code,
ur.use_address as fullAddress,
ur.cancel_reason as cancelReason,
ur.project_contraption_id as projectContraptionId,
(select group_concat(re.equ_id) from tzs_jg_use_registration_eq re where ur.sequence_nbr = re.equip_transfer_id) as equipId,
(SELECT
ibjpc.supervisory_code
from
idx_biz_jg_project_contraption ibjpc where ibjpc.sequence_nbr = ur.project_contraption_id) as supervisoryCode,
(SELECT
group_concat(DISTINCT other.CODE96333)
from
idx_biz_jg_register_info jri
LEFT JOIN idx_biz_jg_other_info other on jri.RECORD = other.RECORD where jri.RECORD in (select re.equ_id from tzs_jg_use_registration_eq re where ur.sequence_nbr = re.equip_transfer_id)) as code96333 ,
(SELECT
group_concat(jri.PRODUCT_NAME)
from
idx_biz_jg_register_info jri where jri.RECORD in (select re.equ_id from tzs_jg_use_registration_eq re where ur.sequence_nbr = re.equip_transfer_id)) as productName,
(SELECT
ibjpc.equ_code
from
idx_biz_jg_project_contraption ibjpc where ibjpc.sequence_nbr = ur.project_contraption_id) as equCode,
(SELECT
group_concat(DISTINCT jri.EQU_LIST)
from
idx_biz_jg_register_info jri where jri.RECORD in (select re.equ_id from tzs_jg_use_registration_eq re where ur.sequence_nbr = re.equip_transfer_id)) as equListCode,
(SELECT
group_concat(DISTINCT jri.EQU_CATEGORY)
from
idx_biz_jg_register_info jri where jri.RECORD in (select re.equ_id from tzs_jg_use_registration_eq re where ur.sequence_nbr = re.equip_transfer_id)) as equCategoryCode,
(SELECT
group_concat(DISTINCT jri."EQU_DEFINE")
from
idx_biz_jg_register_info jri where jri.RECORD in (select re.equ_id from tzs_jg_use_registration_eq re where ur.sequence_nbr = re.equip_transfer_id)) as equDefineCode,
(SELECT
group_concat(DISTINCT c.name)
from
idx_biz_jg_register_info jri,tz_equipment_category c where jri.EQU_LIST = c.code and jri.RECORD in (select re.equ_id from tzs_jg_use_registration_eq re where ur.sequence_nbr = re.equip_transfer_id)) as equListName,
(SELECT
group_concat(DISTINCT c.name)
from
idx_biz_jg_register_info jri,tz_equipment_category c where jri.EQU_CATEGORY = c.code and jri.RECORD in (select re.equ_id from tzs_jg_use_registration_eq re where ur.sequence_nbr = re.equip_transfer_id)) as equCategory,
(SELECT
group_concat(DISTINCT c.name)
from
idx_biz_jg_register_info jri,tz_equipment_category c where jri.EQU_DEFINE = c.code and jri.RECORD in (select re.equ_id from tzs_jg_use_registration_eq re where ur.sequence_nbr = re.equip_transfer_id)) as equDefine,
(SELECT
group_concat(DISTINCT ibjsi.ORG_BRANCH_NAME)
from
idx_biz_jg_supervision_info ibjsi where ibjsi.RECORD in (select re.equ_id from tzs_jg_use_registration_eq re where ur.sequence_nbr = re.equip_transfer_id)) as orgBranchName
from from
( tzs_jg_use_registration ur
<include refid="page-list-sub-select"/> </sql>
)
<select id="getListPage" resultType="java.util.Map">
SELECT * FROM (
-- 查询 equListCode = '8000' 的情况
SELECT *
FROM (
<include refid="page-list-sub-select"/>
)
<where> <where>
is_delete = 0 is_delete = 0
AND equListCode <![CDATA[<>]]>'8000'
<if test="dto.equList != null and dto.equList != ''"> <if test="dto.equList != null and dto.equList != ''">
and equListCode= #{dto.equList} AND equListCode = #{dto.equList}
</if> </if>
<if test="dto.equCategory != null and dto.equCategory != ''"> <if test="dto.equCategory != null and dto.equCategory != ''">
and equCategoryCode = #{dto.equCategory} AND equCategoryCode = #{dto.equCategory}
</if> </if>
<if test="dto.equDefine != null and dto.equDefine != ''"> <if test="dto.equDefine != null and dto.equDefine != ''">
and equDefineCode = #{dto.equDefine} AND equDefineCode = #{dto.equDefine}
</if> </if>
<if test="dto.status != null and dto.status != ''"> <if test="dto.status != null and dto.status != ''">
and status = #{dto.status} AND status = #{dto.status}
</if> </if>
<if test="dto.applicationDate != null"> <if test="dto.applicationDate != null">
and create_date like concat('%',DATE_FORMAT(#{dto.applicationDate},'%Y-%m-%d'),'%') AND create_date LIKE CONCAT('%', DATE_FORMAT(#{dto.applicationDate}, '%Y-%m-%d'), '%')
</if> </if>
<if test="dto.equCode != null and dto.equCode != ''"> <if test="dto.equCode != null and dto.equCode != ''">
and equCode like concat('%',#{dto.equCode},'%') AND equCode LIKE CONCAT('%', #{dto.equCode}, '%')
</if> </if>
<if test="dto.code96333 != null and dto.code96333 != ''"> <if test="dto.code96333 != null and dto.code96333 != ''">
and code96333 like concat('%',#{dto.code96333},'%') AND code96333 LIKE CONCAT('%', #{dto.code96333}, '%')
</if> </if>
<if test="dto.supervisoryCode != null and dto.supervisoryCode != ''"> <if test="dto.supervisoryCode != null and dto.supervisoryCode != ''">
and supervisoryCode like concat('%',#{dto.supervisoryCode},'%') AND supervisoryCode LIKE CONCAT('%', #{dto.supervisoryCode}, '%')
</if> </if>
<if test="dto.fullAddress != null and dto.fullAddress != ''"> <if test="dto.fullAddress != null and dto.fullAddress != ''">
AND fullAddress LIKE CONCAT('%', #{dto.fullAddress}, '%') AND fullAddress LIKE CONCAT('%', #{dto.fullAddress}, '%')
</if> </if>
<if test="dto.useUnitName != null and dto.useUnitName != ''"> <if test="dto.useUnitName != null and dto.useUnitName != ''">
and useUnitName like concat('%',#{dto.useUnitName},'%') AND useUnitName LIKE CONCAT('%', #{dto.useUnitName}, '%')
</if> </if>
<if test="dto.applyNo != null and dto.applyNo != ''"> <if test="dto.applyNo != null and dto.applyNo != ''">
and applyNo like concat('%',#{dto.applyNo},'%') AND applyNo LIKE CONCAT('%', #{dto.applyNo}, '%')
</if> </if>
<if test="dto.useRegistrationCode != null and dto.useRegistrationCode != ''"> <if test="dto.useRegistrationCode != null and dto.useRegistrationCode != ''">
and useRegistrationCode like concat('%',#{dto.useRegistrationCode},'%') AND useRegistrationCode LIKE CONCAT('%', #{dto.useRegistrationCode}, '%')
</if> </if>
<if test="dto.useUnitCode != null and dto.useUnitCode != ''"> <if test="dto.useUnitCode != null and dto.useUnitCode != ''">
and use_unit_credit_code = #{dto.useUnitCode} AND use_unit_credit_code = #{dto.useUnitCode}
</if> </if>
<if test="dto.orgBranchCode != null and dto.orgBranchCode != ''"> <if test="dto.orgBranchCode != null and dto.orgBranchCode != ''">
and supervisionOrgCode like concat(#{dto.orgBranchCode},'%') and supervisionOrgCode like concat(#{dto.orgBranchCode},'%')
...@@ -189,25 +271,91 @@ ...@@ -189,25 +271,91 @@
AND auditPassDate BETWEEN #{dto.auditPassDateStart} AND #{dto.auditPassDateEnd} AND auditPassDate BETWEEN #{dto.auditPassDateStart} AND #{dto.auditPassDateEnd}
</if> </if>
<if test="dto.dataType == 'supervision' "> <if test="dto.dataType == 'supervision' ">
<choose> <choose>
<when test="client == 'jgAudit'"> <when test="client == 'jgAudit'">
AND AND (receive_company_code = #{dto.receiveCompanyCode}
( OR transfer_to_user_ids LIKE CONCAT('%', #{dto.currentUserId}, '%'))
receive_company_code = #{dto.receiveCompanyCode} </when>
OR transfer_to_user_ids LIKE concat ('%',#{dto.currentUserId}, '%') <otherwise>
) AND supervision_org_code LIKE CONCAT(#{dto.supervisionOrgCode}, '%')
</when> </otherwise>
<otherwise> </choose>
and supervision_org_code LIKE concat (#{dto.supervisionOrgCode}, '%') AND status <![CDATA[<>]]> '使用单位待提交'
</otherwise>
</choose>
AND status <![CDATA[<>]]> '使用单位待提交'
</if> </if>
<if test="dto.dataType == 'company' "> <if test="dto.dataType == 'company' ">
AND (use_unit_credit_code = #{dto.unitCode} or transfer_to_user_ids LIKE concat ('%',#{dto.currentUserId}, '%')) AND (use_unit_credit_code = #{dto.unitCode} OR transfer_to_user_ids LIKE CONCAT ('%',#{dto.currentUserId}, '%'))
</if> </if>
</where> </where>
order by
UNION ALL
-- 查询 equListCode != '8000' 的情况
SELECT *
FROM (
<include refid="page-list-sub-pipline"/>
)
<where>
is_delete = 0
AND equListCode = '8000'
<if test="dto.equList != null and dto.equList != ''">
AND #{dto.equList} = ANY(string_to_array(equListCode, ','))
</if>
<if test="dto.equCategory != null and dto.equCategory != ''">
AND equCategoryCode = #{dto.equCategory}
</if>
<if test="dto.equDefine != null and dto.equDefine != ''">
AND equDefineCode = #{dto.equDefine}
</if>
<if test="dto.status != null and dto.status != ''">
AND status = #{dto.status}
</if>
<if test="dto.applicationDate != null">
AND create_date LIKE CONCAT('%', DATE_FORMAT(#{dto.applicationDate}, '%Y-%m-%d'), '%')
</if>
<if test="dto.equCode != null and dto.equCode != ''">
AND equCode LIKE CONCAT('%', #{dto.equCode}, '%')
</if>
<if test="dto.code96333 != null and dto.code96333 != ''">
AND code96333 LIKE CONCAT('%', #{dto.code96333}, '%')
</if>
<if test="dto.supervisoryCode != null and dto.supervisoryCode != ''">
AND supervisoryCode LIKE CONCAT('%', #{dto.supervisoryCode}, '%')
</if>
<if test="dto.fullAddress != null and dto.fullAddress != ''">
AND fullAddress LIKE CONCAT('%', #{dto.fullAddress}, '%')
</if>
<if test="dto.useUnitName != null and dto.useUnitName != ''">
AND useUnitName LIKE CONCAT('%', #{dto.useUnitName}, '%')
</if>
<if test="dto.applyNo != null and dto.applyNo != ''">
AND applyNo LIKE CONCAT('%', #{dto.applyNo}, '%')
</if>
<if test="dto.useRegistrationCode != null and dto.useRegistrationCode != ''">
AND useRegistrationCode LIKE CONCAT('%', #{dto.useRegistrationCode}, '%')
</if>
<if test="dto.useUnitCode != null and dto.useUnitCode != ''">
AND use_unit_credit_code = #{dto.useUnitCode}
</if>
<if test="dto.auditPassDateStart != null and dto.auditPassDateEnd != null">
AND auditPassDate BETWEEN #{dto.auditPassDateStart} AND #{dto.auditPassDateEnd}
</if>
<if test="dto.dataType == 'supervision' ">
<choose>
<when test="client == 'jgAudit'">
AND (receive_company_code = #{dto.receiveCompanyCode}
OR transfer_to_user_ids LIKE CONCAT('%', #{dto.currentUserId}, '%'))
</when>
<otherwise>
AND supervision_org_code LIKE CONCAT(#{dto.supervisionOrgCode}, '%')
</otherwise>
</choose>
AND status <![CDATA[<>]]> '使用单位待提交'
</if>
<if test="dto.dataType == 'company' ">
AND (use_unit_credit_code = #{dto.unitCode} OR transfer_to_user_ids LIKE CONCAT ('%',#{dto.currentUserId}, '%'))
</if>
</where>
) AS combined_results
ORDER BY
<choose> <choose>
<when test="sort != null"> <when test="sort != null">
${sort.field} ${sort.sortType} ${sort.field} ${sort.sortType}
...@@ -999,7 +1147,7 @@ ...@@ -999,7 +1147,7 @@
</select> </select>
<select id="getCylinderInfoList" resultType="java.util.Map"> <select id="getCylinderInfoList" resultType="java.util.Map">
<include refid="list-cylinder"/> <include refid="list-cylinder"/>
WHERE ri."EQU_CATEGORY" = '2300' and ui."DATA_SOURCE" like 'jg%' WHERE ri."EQU_CATEGORY" = '2300'
and ui.record in and ui.record in
<foreach collection="records" item="record" open="(" close=")" separator=","> <foreach collection="records" item="record" open="(" close=")" separator=",">
#{record} #{record}
......
package com.yeejoin.amos.boot.module.jg.biz.controller; package com.yeejoin.amos.boot.module.jg.biz.controller;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
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.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.biz.service.IIdxBizJgRegisterInfoService; import com.yeejoin.amos.boot.module.jg.biz.service.IIdxBizJgRegisterInfoService;
import com.yeejoin.amos.boot.module.ymt.api.entity.PageParam;
import com.yeejoin.amos.feign.systemctl.model.DictionarieValueModel; import com.yeejoin.amos.feign.systemctl.model.DictionarieValueModel;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
...@@ -22,7 +20,6 @@ import org.typroject.tyboot.core.foundation.enumeration.UserType; ...@@ -22,7 +20,6 @@ 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.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
...@@ -301,12 +298,12 @@ public class IdxBizJqEquipmentRegisterController extends BaseController { ...@@ -301,12 +298,12 @@ public class IdxBizJqEquipmentRegisterController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/getElevatorInfo") @GetMapping(value = "/getElevatorInfo")
@ApiOperation(httpMethod = "GET", value = "查询电梯信息列表", notes = "查询电梯信息列表") @ApiOperation(httpMethod = "GET", value = "查询电梯信息列表", notes = "查询电梯信息列表")
public ResponseModel<IPage<Map<String, Object>>> getElevatorInfo(@RequestParam(value = "equCode", required = false) String equCode, public ResponseModel<Page<Map<String, Object>>> getElevatorInfo(@RequestParam(value = "equCode", required = false) String equCode,
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") Date startTime, @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") Date startTime,
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") Date endTime, @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") Date endTime,
PageParam pageParam) { @RequestParam(value = "current") int current,
@RequestParam(value = "size") int size) {
return ResponseHelper.buildResponse(idxBizJgRegisterInfoService.getElevatorInfo(equCode, startTime, endTime, pageParam)); return ResponseHelper.buildResponse(idxBizJgRegisterInfoService.getElevatorInfo(equCode, startTime, endTime, current, size));
} }
/** /**
...@@ -344,12 +341,12 @@ public class IdxBizJqEquipmentRegisterController extends BaseController { ...@@ -344,12 +341,12 @@ public class IdxBizJqEquipmentRegisterController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/getCylinderInfo") @GetMapping(value = "/getCylinderInfo")
@ApiOperation(httpMethod = "GET", value = "根据时间范围查询液化石油气瓶档案", notes = "根据时间范围查询液化石油气瓶档案") @ApiOperation(httpMethod = "GET", value = "根据时间范围查询液化石油气瓶档案", notes = "根据时间范围查询液化石油气瓶档案")
public ResponseModel<IPage<Map<String, Object>>> getCylinderInfo(@RequestParam(value = "equCode", required = false) String equCode, public ResponseModel<Page<Map<String, Object>>> getCylinderInfo(@RequestParam(value = "equCode", required = false) String equCode,
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") Date startTime, @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") Date startTime,
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") Date endTime, @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") Date endTime,
PageParam pageParam) { @RequestParam(value = "current") int current,
@RequestParam(value = "size") int size) {
return ResponseHelper.buildResponse(idxBizJgRegisterInfoService.getCylinderInfo(equCode, startTime, endTime, pageParam)); return ResponseHelper.buildResponse(idxBizJgRegisterInfoService.getCylinderInfo(equCode, startTime, endTime, current, size));
} }
/** /**
......
package com.yeejoin.amos.boot.module.jg.biz.service; package com.yeejoin.amos.boot.module.jg.biz.service;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
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.bo.ReginParams;
import com.yeejoin.amos.boot.module.ymt.api.entity.PageParam;
import com.yeejoin.amos.feign.systemctl.model.DictionarieValueModel; import com.yeejoin.amos.feign.systemctl.model.DictionarieValueModel;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import org.typroject.tyboot.core.restful.utils.ResponseModel; import org.typroject.tyboot.core.restful.utils.ResponseModel;
...@@ -60,13 +58,13 @@ public interface IIdxBizJgRegisterInfoService { ...@@ -60,13 +58,13 @@ public interface IIdxBizJgRegisterInfoService {
*/ */
List<Map<String, Object>> getProjectContraptionList(String useUnitCreditCode); List<Map<String, Object>> getProjectContraptionList(String useUnitCreditCode);
Page<Map<String, Object>> getElevatorInfo(String equCode, Date startTime, Date endTime, PageParam pageParam); Page<Map<String, Object>> getElevatorInfo(String equCode, Date startTime, Date endTime, int current, int size);
List<Map<String, Object>> getCylinderStationInfo(); List<Map<String, Object>> getCylinderStationInfo();
List<Map<String, Object>> getVehicleCylinderInfo(String useCode); List<Map<String, Object>> getVehicleCylinderInfo(String useCode);
IPage<Map<String, Object>> getCylinderInfo(String equCode, Date startTime, Date endTime, PageParam pageParam); Page<Map<String, Object>> getCylinderInfo(String equCode, Date startTime, Date endTime, int current, int size);
void initUserExpirationReminderOnce(); void initUserExpirationReminderOnce();
......
...@@ -1563,10 +1563,10 @@ public class DataDockServiceImpl { ...@@ -1563,10 +1563,10 @@ public class DataDockServiceImpl {
String equListCode = String.valueOf(equipInfo.get("EQU_LIST")); String equListCode = String.valueOf(equipInfo.get("EQU_LIST"));
String equCategoryCode = String.valueOf(equipInfo.get("EQU_CATEGORY")); String equCategoryCode = String.valueOf(equipInfo.get("EQU_CATEGORY"));
String equDefineCode = String.valueOf(equipInfo.get("EQU_DEFINE")); String equDefineCode = String.valueOf(equipInfo.get("EQU_DEFINE"));
String receiveOrgCode = String.valueOf(equipInfo.get("RECEIVE_ORG_CODE")); String receiveOrgCode = Optional.ofNullable(equipInfo.get("RECEIVE_ORG_CODE")).map(String::valueOf).orElse(null);
String inspectUnitCreditCode = Optional.ofNullable(equLists.get(0).getInspectOrgCode()).orElse(""); String inspectUnitCreditCode = Optional.ofNullable(equLists.get(0).getInspectOrgCode()).orElse("");
String inspectUnitName = Optional.ofNullable(equLists.get(0).getInspectOrgName()).orElse(""); String inspectUnitName = Optional.ofNullable(equLists.get(0).getInspectOrgName()).orElse("");
String useOrgCode = String.valueOf(equipInfo.get("USE_ORG_CODE")); String useOrgCode = Optional.ofNullable(equipInfo.get("USE_ORG_CODE")).map(String::valueOf).orElse(null);
String province = String.valueOf(equipInfo.get("province")); String province = String.valueOf(equipInfo.get("province"));
String city = String.valueOf(equipInfo.get("city")); String city = String.valueOf(equipInfo.get("city"));
String county = String.valueOf(equipInfo.get("county")); String county = String.valueOf(equipInfo.get("county"));
...@@ -1598,8 +1598,16 @@ public class DataDockServiceImpl { ...@@ -1598,8 +1598,16 @@ public class DataDockServiceImpl {
.setOrgBranchName(orgBranchCode.split("_").length > 1 ? orgBranchCode.split("_")[1] : "") .setOrgBranchName(orgBranchCode.split("_").length > 1 ? orgBranchCode.split("_")[1] : "")
.setUseOrgCode(useOrgCode) .setUseOrgCode(useOrgCode)
.setVehicleApanage(String.valueOf(equipInfo.get("VEHICLE_APANAGE"))) .setVehicleApanage(String.valueOf(equipInfo.get("VEHICLE_APANAGE")))
.setReceiveOrgCode(receiveOrgCode.split("_")[0]) .setReceiveOrgCode(Optional.ofNullable(receiveOrgCode)
.setReceiveOrgName(receiveOrgCode.split("_")[1]) .map(code -> code.split("_"))
.filter(parts -> parts.length > 0)
.map(parts -> parts[0])
.orElse(null))
.setReceiveOrgName(Optional.ofNullable(receiveOrgCode)
.map(code -> code.split("_"))
.filter(parts -> parts.length > 1)
.map(parts -> parts[1])
.orElse(null))
.setProjectContraption(String.valueOf(equipInfo.get("PROJECT_CONTRAPTION"))) .setProjectContraption(String.valueOf(equipInfo.get("PROJECT_CONTRAPTION")))
.setProjectContraptionNo(String.valueOf(equipInfo.get("PROJECT_CONTRAPTION_NO"))) .setProjectContraptionNo(String.valueOf(equipInfo.get("PROJECT_CONTRAPTION_NO")))
.setProductPhoto(toJSONString(equipInfo.get("PRODUCT_PHOTO"))) .setProductPhoto(toJSONString(equipInfo.get("PRODUCT_PHOTO")))
......
...@@ -625,15 +625,17 @@ public class DataHandlerServiceImpl { ...@@ -625,15 +625,17 @@ public class DataHandlerServiceImpl {
projectContraptionService.saveBatch(projectContraptionList); projectContraptionService.saveBatch(projectContraptionList);
} }
// 更新设备es的装置id、使用信息的装置id // 更新设备es的装置id、使用信息的装置id
projectContraptionIdRecordsMap.forEach((k, v) -> { projectContraptionIdRecordsMap.forEach((k,v)->{
IdxBizJgProjectContraption idxBizJgProjectContraption = projectContraptionService.getById(k);
Iterable<ESEquipmentCategoryDto> equipmentCategories = esEquipmentCategory.findAllById(v); Iterable<ESEquipmentCategoryDto> equipmentCategories = esEquipmentCategory.findAllById(v);
equipmentCategories.forEach(e -> e.setProjectContraptionId(k + "")); equipmentCategories.forEach(e-> e.setProjectContraptionId(k + ""));
esEquipmentCategory.saveAll(equipmentCategories); esEquipmentCategory.saveAll(equipmentCategories);
Collection<IdxBizJgUseInfo> useInfos = useInfoService.listByIds(v); Collection<IdxBizJgUseInfo> useInfos = useInfoService.getUseInfoListByEquIds(v);
useInfos.forEach(u -> { useInfos.forEach(u->{
LambdaUpdateWrapper<IdxBizJgUseInfo> updateWrapper = new LambdaUpdateWrapper<>(); LambdaUpdateWrapper<IdxBizJgUseInfo> updateWrapper = new LambdaUpdateWrapper<>();
updateWrapper.eq(IdxBizJgUseInfo::getRecord, u.getRecord()); updateWrapper.eq(IdxBizJgUseInfo::getRecord, u.getRecord());
updateWrapper.set(IdxBizJgUseInfo::getProjectContraptionId, u.getProjectContraptionId()); updateWrapper.set(IdxBizJgUseInfo::getProjectContraptionId, k);
updateWrapper.set(IdxBizJgUseInfo::getProjectContraption, idxBizJgProjectContraption.getProjectContraption());
useInfoService.update(updateWrapper); useInfoService.update(updateWrapper);
}); });
}); });
...@@ -824,10 +826,14 @@ public class DataHandlerServiceImpl { ...@@ -824,10 +826,14 @@ public class DataHandlerServiceImpl {
eqs.forEach(eq -> { eqs.forEach(eq -> {
Optional<ESEquipmentCategoryDto> equInfosWithEs = esEquipmentCategory.findById(eq.getEquId()); Optional<ESEquipmentCategoryDto> equInfosWithEs = esEquipmentCategory.findById(eq.getEquId());
equInfosWithEs.ifPresent(equInfoEs -> { equInfosWithEs.ifPresent(equInfoEs -> {
LambdaUpdateWrapper<IdxBizJgUseInfo> updateWrapper = new LambdaUpdateWrapper<>(); if(StringUtils.isNotEmpty(equInfoEs.getProjectContraptionId())){
updateWrapper.eq(IdxBizJgUseInfo::getRecord, equInfoEs.getSEQUENCE_NBR()); IdxBizJgProjectContraption idxBizJgProjectContraption = projectContraptionService.getById(equInfoEs.getProjectContraptionId());
updateWrapper.set(IdxBizJgUseInfo::getProjectContraptionId, equInfoEs.getProjectContraptionId()); LambdaUpdateWrapper<IdxBizJgUseInfo> updateWrapper = new LambdaUpdateWrapper<>();
useInfoService.update(updateWrapper); updateWrapper.eq(IdxBizJgUseInfo::getRecord, equInfoEs.getSEQUENCE_NBR());
updateWrapper.set(IdxBizJgUseInfo::getProjectContraptionId, idxBizJgProjectContraption.getSequenceNbr());
updateWrapper.set(IdxBizJgUseInfo::getProjectContraption, idxBizJgProjectContraption.getProjectContraption());
useInfoService.update(updateWrapper);
}
}); });
}); });
List<JgInstallationNoticeEq> eqsAfter = jgInstallationNoticeEqMapper.selectPCIdNeErrorPieLineInUseInfo(); List<JgInstallationNoticeEq> eqsAfter = jgInstallationNoticeEqMapper.selectPCIdNeErrorPieLineInUseInfo();
......
...@@ -134,11 +134,13 @@ public class IdxBizJgProjectContraptionServiceImpl extends BaseService<IdxBizJgP ...@@ -134,11 +134,13 @@ public class IdxBizJgProjectContraptionServiceImpl extends BaseService<IdxBizJgP
List<IdxBizJgUseInfo> useInfos = useInfoService.lambdaQuery().select(IdxBizJgUseInfo::getRecord).eq(IdxBizJgUseInfo::getProjectContraptionId, sequenceNbr).list(); List<IdxBizJgUseInfo> useInfos = useInfoService.lambdaQuery().select(IdxBizJgUseInfo::getRecord).eq(IdxBizJgUseInfo::getProjectContraptionId, sequenceNbr).list();
// 删除idx设备表信息 + 删除对应es数据 // 删除idx设备表信息 + 删除对应es数据
List<String> records = useInfos.stream().map(IdxBizJgUseInfo::getRecord).collect(Collectors.toList()); List<String> records = useInfos.stream().map(IdxBizJgUseInfo::getRecord).collect(Collectors.toList());
if (records.isEmpty()) return Boolean.TRUE; if (!records.isEmpty()){
Map<String, Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
map.put("recordList", records); map.put("recordList", records);
map.put("equList", PipelineEnum.PRESSURE_PIPELINE.getCode()); map.put("equList", PipelineEnum.PRESSURE_PIPELINE.getCode());
registerInfoService.batchDeleteByRecord(map); registerInfoService.batchDeleteByRecord(map);
}
// 删除装置表信息 // 删除装置表信息
this.removeById(sequenceNbr); this.removeById(sequenceNbr);
return Boolean.TRUE; return Boolean.TRUE;
......
...@@ -84,6 +84,8 @@ import org.typroject.tyboot.core.restful.utils.ResponseModel; ...@@ -84,6 +84,8 @@ import org.typroject.tyboot.core.restful.utils.ResponseModel;
import java.io.IOException; import java.io.IOException;
import java.lang.reflect.Field; import java.lang.reflect.Field;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.sql.Timestamp; import java.sql.Timestamp;
import java.text.ParseException; import java.text.ParseException;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
...@@ -502,11 +504,13 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste ...@@ -502,11 +504,13 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
projectContraption.setEquCategoryName(equCategoryName); projectContraption.setEquCategoryName(equCategoryName);
projectContraption.setEquDefineName(equDefineName); projectContraption.setEquDefineName(equDefineName);
projectContraption.setPipelineLength( projectContraption.setPipelineLength(
pipelineList.stream() BigDecimal.valueOf(pipelineList.stream()
.map(pipeline -> pipeline.get("pipeLength")) .map(pipeline -> pipeline.get("pipeLength"))
.filter(Objects::nonNull) .filter(Objects::nonNull)
.mapToDouble(pipeLength -> Double.parseDouble(String.valueOf(pipeLength))) .mapToDouble(pipeLength -> Double.parseDouble(String.valueOf(pipeLength)))
.sum() .sum())
.setScale(2, RoundingMode.HALF_UP)
.doubleValue()
); );
projectContraption.setUscUnitName(companyInfoMap.get("companyName").toString()); projectContraption.setUscUnitName(companyInfoMap.get("companyName").toString());
...@@ -4413,9 +4417,8 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste ...@@ -4413,9 +4417,8 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
} }
@Override @Override
public Page<Map<String, Object>> getElevatorInfo(String equCode, Date startTime, Date endTime, PageParam public Page<Map<String, Object>> getElevatorInfo(String equCode, Date startTime, Date endTime, int current, int size) {
pageParam) { Page<Map<String, Object>> result = new Page<>(current, size);
Page<Map<String, Object>> result = new Page<>(pageParam.getCurrent(), pageParam.getSize());
SearchRequest request = new SearchRequest(); SearchRequest request = new SearchRequest();
request.indices("idx_biz_view_jg_all"); request.indices("idx_biz_view_jg_all");
SearchSourceBuilder builder = new SearchSourceBuilder(); SearchSourceBuilder builder = new SearchSourceBuilder();
...@@ -4446,8 +4449,8 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste ...@@ -4446,8 +4449,8 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
builder.query(boolMust); builder.query(boolMust);
builder.sort("REC_DATE", SortOrder.DESC); builder.sort("REC_DATE", SortOrder.DESC);
builder.from((pageParam.getCurrent() - 1) * pageParam.getSize()); builder.from((current - 1) * size);
builder.size(pageParam.getSize()); builder.size(size);
request.source(builder); request.source(builder);
List<Map<String, Object>> elevatorModelVoList = Collections.emptyList(); List<Map<String, Object>> elevatorModelVoList = Collections.emptyList();
try { try {
...@@ -4464,7 +4467,7 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste ...@@ -4464,7 +4467,7 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
elevatorModelVoList = jgUseRegistrationMapper.getElevatorModeList(equIds); elevatorModelVoList = jgUseRegistrationMapper.getElevatorModeList(equIds);
} }
result.setRecords(convertKeysToCamelCase(elevatorModelVoList)); result.setRecords(convertKeysToCamelCase(elevatorModelVoList));
result.setTotal(response.getHits().getTotalHits().value); result.setTotal(Objects.requireNonNull(response.getHits().getTotalHits()).value);
} catch (IOException e) { } catch (IOException e) {
throw new RuntimeException(e); throw new RuntimeException(e);
} }
...@@ -4482,9 +4485,8 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste ...@@ -4482,9 +4485,8 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
} }
@Override @Override
public IPage<Map<String, Object>> getCylinderInfo(String equCode, Date startTime, Date endTime, PageParam public Page<Map<String, Object>> getCylinderInfo(String equCode, Date startTime, Date endTime, int current, int size) {
pageParam) { Page<Map<String, Object>> result = new Page<>(current, size);
Page<Map<String, Object>> result = new Page<>(pageParam.getCurrent(), pageParam.getSize());
SearchRequest request = new SearchRequest(); SearchRequest request = new SearchRequest();
request.indices("idx_biz_view_jg_all"); request.indices("idx_biz_view_jg_all");
SearchSourceBuilder builder = new SearchSourceBuilder(); SearchSourceBuilder builder = new SearchSourceBuilder();
...@@ -4515,8 +4517,8 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste ...@@ -4515,8 +4517,8 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
builder.query(boolMust); builder.query(boolMust);
builder.sort("REC_DATE", SortOrder.DESC); builder.sort("REC_DATE", SortOrder.DESC);
builder.from((pageParam.getCurrent() - 1) * pageParam.getSize()); builder.from((current - 1) * size);
builder.size(pageParam.getSize()); builder.size(size);
request.source(builder); request.source(builder);
List<Map<String, Object>> cylinderInfoList = Collections.emptyList(); List<Map<String, Object>> cylinderInfoList = Collections.emptyList();
try { try {
...@@ -4539,7 +4541,7 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste ...@@ -4539,7 +4541,7 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
cylinderInfoList.forEach(i -> i.computeIfPresent("chargingMedium", (key, value) -> fillingMediumMap.get(value))); cylinderInfoList.forEach(i -> i.computeIfPresent("chargingMedium", (key, value) -> fillingMediumMap.get(value)));
} }
result.setRecords(convertKeysToCamelCase(cylinderInfoList)); result.setRecords(convertKeysToCamelCase(cylinderInfoList));
result.setTotal(response.getHits().getTotalHits().value); result.setTotal(Objects.requireNonNull(response.getHits().getTotalHits()).value);
} catch (IOException e) { } catch (IOException e) {
throw new RuntimeException(e); throw new RuntimeException(e);
} }
......
...@@ -89,6 +89,8 @@ import org.typroject.tyboot.core.restful.utils.ResponseModel; ...@@ -89,6 +89,8 @@ import org.typroject.tyboot.core.restful.utils.ResponseModel;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.io.ByteArrayOutputStream; import java.io.ByteArrayOutputStream;
import java.io.IOException; import java.io.IOException;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.net.URLEncoder; import java.net.URLEncoder;
import java.text.ParseException; import java.text.ParseException;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
...@@ -1923,7 +1925,9 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN ...@@ -1923,7 +1925,9 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN
result.fluentPut("deviceList", deviceList) result.fluentPut("deviceList", deviceList)
.fluentPut("projectContraption", projectContraption.getProjectContraption()) .fluentPut("projectContraption", projectContraption.getProjectContraption())
.fluentPut("projectContraptionNo", projectContraption.getProjectContraptionNo()) .fluentPut("projectContraptionNo", projectContraption.getProjectContraptionNo())
.fluentPut("pipelineLength", projectContraption.getPipelineLength()) .fluentPut("pipelineLength", BigDecimal.valueOf(projectContraption.getPipelineLength())
.setScale(2, RoundingMode.HALF_UP)
.doubleValue())
.fluentPut("projectContraptionId", projectContraptionSeq); .fluentPut("projectContraptionId", projectContraptionSeq);
if (!ValidationUtil.isEmpty(projectContraption.getCity())) { if (!ValidationUtil.isEmpty(projectContraption.getCity())) {
result.fluentPut("city", projectContraption.getCity() + "_" + projectContraption.getCityName()); result.fluentPut("city", projectContraption.getCity() + "_" + projectContraption.getCityName());
......
...@@ -544,6 +544,7 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD ...@@ -544,6 +544,7 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
IdxBizJgOtherInfo otherInfo = otherInfoMapper.selectOne(otherLambda); IdxBizJgOtherInfo otherInfo = otherInfoMapper.selectOne(otherLambda);
String supervisoryCode = otherInfo.getSupervisoryCode(); String supervisoryCode = otherInfo.getSupervisoryCode();
jgUseRegistration.setSupervisoryCode(supervisoryCode); jgUseRegistration.setSupervisoryCode(supervisoryCode);
jgUseRegistration.setManageType("set");
if (!ObjectUtils.isEmpty(map.get("otherAccessories"))) { if (!ObjectUtils.isEmpty(map.get("otherAccessories"))) {
jgUseRegistration.setOtherAccessories(JSONObject.toJSONString(map.get("otherAccessories"))); jgUseRegistration.setOtherAccessories(JSONObject.toJSONString(map.get("otherAccessories")));
...@@ -759,7 +760,8 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD ...@@ -759,7 +760,8 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
lambda.select(JgUseRegistrationEq::getEquId); lambda.select(JgUseRegistrationEq::getEquId);
List<JgUseRegistrationEq> eqList = jgRelationEquipMapper.selectList(lambda); List<JgUseRegistrationEq> eqList = jgRelationEquipMapper.selectList(lambda);
// 在使用单位待提交、一级受理已驳回、使用单位已撤回后清除关联的设备,保证可以再次新提单子选择相同的设备进行提交及原有单子的提交校验数据准备 // 在使用单位待提交、一级受理已驳回、使用单位已撤回后清除关联的设备,保证可以再次新提单子选择相同的设备进行提交及原有单子的提交校验数据准备
if (NOT_FLOWING_STATE.contains(useRegistrationDb.getStatus())) { if (NOT_FLOWING_STATE.contains(useRegistrationDb.getStatus()) ||
FlowStatusEnum.TO_BE_DISCARD.getName().equals(data.getStatus())) {
List<String> records = eqList.stream().map(JgUseRegistrationEq::getEquId).collect(toList()); List<String> records = eqList.stream().map(JgUseRegistrationEq::getEquId).collect(toList());
//合并的管道只需要子工程装置管道集合 //合并的管道只需要子工程装置管道集合
if (Objects.nonNull(data.getOriginProjectContraptionIds()) && if (Objects.nonNull(data.getOriginProjectContraptionIds()) &&
...@@ -2505,21 +2507,22 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD ...@@ -2505,21 +2507,22 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
throw new BadRequest("没有查询到汇总信息!"); throw new BadRequest("没有查询到汇总信息!");
} }
JSONArray allEquipment = new JSONArray(); JSONArray allEquipment = new JSONArray();
// 用Set存储已添加的equCode,防止重复添加
Set<String> addedEquCodes = new HashSet<>();
registrationHistoryList.forEach(historyList -> { registrationHistoryList.forEach(historyList -> {
JSONObject jsonObject = JSONObject.parseObject(historyList.getChangeData()); JSONObject jsonObject = JSONObject.parseObject(historyList.getChangeData());
JSONArray equipmentLists = (JSONArray) jsonObject.get("equipmentLists"); JSONArray equipmentLists = "安装告知".equals(type)
if("安装告知".equals(type)){ ? (JSONArray) jsonObject.get("deviceList")
equipmentLists =(JSONArray) jsonObject.get("deviceList"); : (JSONArray) jsonObject.get("equipmentLists");
}
// 填充投用年月 final String useDateValue = jsonObject.getString("useDate");
String useDateValue = (String) jsonObject.get("useDate");
if (CollectionUtils.isNotEmpty(equipmentLists)) { if (CollectionUtils.isNotEmpty(equipmentLists)) {
equipmentLists = equipmentLists.stream() equipmentLists.stream()
.map(obj -> (JSONObject) obj) .map(obj -> (JSONObject) obj)
.peek(equipmentItem -> equipmentItem.put("useDate", timeToMonths(useDateValue))) .peek(equipmentItem -> equipmentItem.put("useDate", timeToMonths(useDateValue)))
.filter(equipmentItem -> this.checkEquStatusInUse(equipmentItem.getString("record"))) .filter(equipmentItem -> this.checkEquStatusInUse(equipmentItem.getString("record")))
.collect(Collectors.toCollection(JSONArray::new)); .filter(equipmentItem -> addedEquCodes.add(equipmentItem.getString("equCode")))
allEquipment.addAll(equipmentLists); .forEach(allEquipment::add);
} }
}); });
total = allEquipment.size(); total = allEquipment.size();
...@@ -2980,10 +2983,9 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD ...@@ -2980,10 +2983,9 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
jgUseRegistration.setCancelUserId(RequestContext.getExeUserId()); jgUseRegistration.setCancelUserId(RequestContext.getExeUserId());
jgUseRegistration.setNextExecuteUserIds(""); jgUseRegistration.setNextExecuteUserIds("");
jgUseRegistration.setPromoter(""); jgUseRegistration.setPromoter("");
jgUseRegistration.setStatus(FlowStatusEnum.TO_BE_DISCARD.getName());
List<JgUseRegistrationEq> eqList = getJgUseRegistrationEqs(jgUseRegistration); List<JgUseRegistrationEq> eqList = getJgUseRegistrationEqs(jgUseRegistration);
List<String> records = eqList.stream().map(JgUseRegistrationEq::getEquId).collect(Collectors.toList()); List<String> records = eqList.stream().map(JgUseRegistrationEq::getEquId).collect(Collectors.toList());
jgUseRegistration.setStatus(FlowStatusEnum.TO_BE_DISCARD.getName());
// 单位办理 // 单位办理
if ("unit".equals(jgUseRegistration.getManageType())){ if ("unit".equals(jgUseRegistration.getManageType())){
...@@ -3007,53 +3009,58 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD ...@@ -3007,53 +3009,58 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
if (!ValidationUtil.isEmpty(jgUseRegistration.getProjectContraptionId())) { if (!ValidationUtil.isEmpty(jgUseRegistration.getProjectContraptionId())) {
idxBizJgProjectContraptionMapper.delete(new LambdaQueryWrapper<IdxBizJgProjectContraption>().eq(IdxBizJgProjectContraption::getSequenceNbr,jgUseRegistration.getProjectContraptionId())); idxBizJgProjectContraptionMapper.delete(new LambdaQueryWrapper<IdxBizJgProjectContraption>().eq(IdxBizJgProjectContraption::getSequenceNbr,jgUseRegistration.getProjectContraptionId()));
} }
} } else{
else{ //判断是否管道
if (jgUseRegistration.getUseRegistrationCode().startsWith("管")) { if (FlowStatusEnum.TO_BE_FINISHED.getName().equals(oldStatus) &&
jgUseRegistration.getUseRegistrationCode().startsWith("管")) {
JgUseRegistration lastUseRegistration = jgUseRegistrationMapper.selectOne(new LambdaQueryWrapper<JgUseRegistration>() JgUseRegistration lastUseRegistration = jgUseRegistrationMapper.selectOne(new LambdaQueryWrapper<JgUseRegistration>()
.select(JgUseRegistration::getApplyNo) .select(JgUseRegistration::getApplyNo)
.eq(JgUseRegistration::getProjectContraptionId, jgUseRegistration.getProjectContraptionId()) .eq(JgUseRegistration::getProjectContraptionId, jgUseRegistration.getProjectContraptionId())
.ne(JgUseRegistration::getStatus, "已作废") .ne(JgUseRegistration::getStatus, "已作废")
.eq(JgUseRegistration::getIsDelete, false) .eq(JgUseRegistration::getIsDelete, false)
.orderByDesc(JgUseRegistration::getRecDate) .orderByDesc(JgUseRegistration::getApplyNo)
.last("limit 1")); .last("limit 1"));
if (lastUseRegistration != null && !lastUseRegistration.getApplyNo().equals(jgUseRegistration.getApplyNo())){ if (lastUseRegistration != null && !lastUseRegistration.getApplyNo().equals(jgUseRegistration.getApplyNo())) {
throw new BadRequest("作废失败,该使用登记证下有合并工程装置,请先作废最新单据后再作废此单据!"); throw new BadRequest("作废失败,该使用登记证下有合并工程装置,请先作废最新单据后再作废此单据!");
} }
if (jgUseRegistration.getProjectContraptionId() == null) {
throw new BadRequest("该作废单据没有工程装置,请联系管理员处理此单据:"+ jgUseRegistration.getApplyNo());
}
}
if (jgUseRegistration.getProjectContraptionId() != null) {
//2.合并后作废 //2.合并后作废
if (!jgUseRegistration.getOriginProjectContraptionIds().contains(jgUseRegistration.getProjectContraptionId())){ if (!jgUseRegistration.getOriginProjectContraptionIds().contains(jgUseRegistration.getProjectContraptionId())){
eqList.forEach(v->{ eqList.stream()
// 1.根据eq关系表中保存的原工程装置与设备关系还原use_info和ES .filter(v -> jgUseRegistration.getOriginProjectContraptionIds().contains(v.getOriginProjectContraptionId()))
esEquipmentCategory.findById(v.getEquId()).ifPresent(equInfoEs -> { .forEach(v -> esEquipmentCategory.findById(v.getEquId()).ifPresent(equInfoEs -> {
equInfoEs.setProjectContraptionId(v.getOriginProjectContraptionId()); equInfoEs.setProjectContraptionId(v.getOriginProjectContraptionId());
esEquipmentCategory.save(equInfoEs); esEquipmentCategory.save(equInfoEs);
});
LambdaQueryWrapper<IdxBizJgUseInfo> lambda = new QueryWrapper<IdxBizJgUseInfo>().lambda(); LambdaQueryWrapper<IdxBizJgUseInfo> lambda = new QueryWrapper<IdxBizJgUseInfo>().lambda();
lambda.eq(IdxBizJgUseInfo::getRecord, String.valueOf(v.getEquId())); lambda.eq(IdxBizJgUseInfo::getRecord, String.valueOf(v.getEquId()));
IdxBizJgUseInfo useInfo = useInfoMapper.selectOne(lambda); IdxBizJgUseInfo useInfo = useInfoMapper.selectOne(lambda);
useInfo.setProjectContraptionId(v.getOriginProjectContraptionId()); useInfo.setProjectContraptionId(v.getOriginProjectContraptionId());
useInfoMapper.updateById(useInfo); useInfoMapper.updateById(useInfo);
IdxBizJgProjectContraption originProjectContraption = jgProjectContraptionService.getById(v.getOriginProjectContraptionId()); IdxBizJgProjectContraption originProjectContraption = jgProjectContraptionService.getById(v.getOriginProjectContraptionId());
//还原 原工程装置下equCode和监管码 //还原 原工程装置下equCode和监管码
LambdaUpdateWrapper<IdxBizJgRegisterInfo> updateWrapper = new UpdateWrapper<IdxBizJgRegisterInfo>().lambda() LambdaUpdateWrapper<IdxBizJgRegisterInfo> updateWrapper = new UpdateWrapper<IdxBizJgRegisterInfo>().lambda()
.eq(IdxBizJgRegisterInfo::getRecord, v.getEquId()); .eq(IdxBizJgRegisterInfo::getRecord, v.getEquId());
IdxBizJgRegisterInfo idxBizJgRegisterInfo = new IdxBizJgRegisterInfo(); IdxBizJgRegisterInfo idxBizJgRegisterInfo = new IdxBizJgRegisterInfo();
idxBizJgRegisterInfo.setEquCode(originProjectContraption.getEquCode()); idxBizJgRegisterInfo.setEquCode(originProjectContraption.getEquCode());
idxBizJgRegisterInfoMapper.update(idxBizJgRegisterInfo, updateWrapper); idxBizJgRegisterInfoMapper.update(idxBizJgRegisterInfo, updateWrapper);
LambdaUpdateWrapper<IdxBizJgOtherInfo> otherInfoLambdaUpdateWrapper = new UpdateWrapper<IdxBizJgOtherInfo>().lambda() LambdaUpdateWrapper<IdxBizJgOtherInfo> otherInfoLambdaUpdateWrapper = new UpdateWrapper<IdxBizJgOtherInfo>().lambda()
.eq(IdxBizJgOtherInfo::getRecord, v.getEquId()); .eq(IdxBizJgOtherInfo::getRecord, v.getEquId());
IdxBizJgOtherInfo idxBizJgOtherInfo = new IdxBizJgOtherInfo(); IdxBizJgOtherInfo idxBizJgOtherInfo = new IdxBizJgOtherInfo();
idxBizJgOtherInfo.setSupervisoryCode(originProjectContraption.getSupervisoryCode()); idxBizJgOtherInfo.setSupervisoryCode(originProjectContraption.getSupervisoryCode());
otherInfoMapper.update(idxBizJgOtherInfo, otherInfoLambdaUpdateWrapper); otherInfoMapper.update(idxBizJgOtherInfo, otherInfoLambdaUpdateWrapper);
}); }));
//2.根据工程装置ID查询工程装置父级,重置工程装置父级为空 //2.根据工程装置ID查询工程装置父级,重置工程装置父级为空
jgProjectContraptionService.update( jgProjectContraptionService.update(
new LambdaUpdateWrapper<IdxBizJgProjectContraption>() new LambdaUpdateWrapper<IdxBizJgProjectContraption>()
.eq(IdxBizJgProjectContraption::getProjectContraptionParentId, jgUseRegistration.getProjectContraptionId()) .in(BaseEntity::getSequenceNbr, Arrays.asList(jgUseRegistration.getOriginProjectContraptionIds().split(",")))
.set(IdxBizJgProjectContraption::getProjectContraptionParentId, null) .set(IdxBizJgProjectContraption::getProjectContraptionParentId, null)
); );
JgRegistrationHistory history = jgRegistrationHistoryService.queryLatestRegistrationHistory(Long.valueOf(jgUseRegistration.getProjectContraptionId())); JgRegistrationHistory history = jgRegistrationHistoryService.queryLatestRegistrationHistory(Long.valueOf(jgUseRegistration.getProjectContraptionId()));
...@@ -3063,42 +3070,71 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD ...@@ -3063,42 +3070,71 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
.map(Boolean.class::cast) .map(Boolean.class::cast)
.orElse(false); .orElse(false);
//合并到无证总工程 //合并到无证总工程
IdxBizJgProjectContraption projectContraption = jgProjectContraptionService.getById(jgUseRegistration.getProjectContraptionId());
if (isFirstMerge) { if (isFirstMerge) {
IdxBizJgProjectContraption projectContraption = jgProjectContraptionService.getById(jgUseRegistration.getProjectContraptionId());
projectContraption.setIsIntoManagement(false); projectContraption.setIsIntoManagement(false);
projectContraption.setIsFirstMerge(true); projectContraption.setIsFirstMerge(true);
projectContraption.setSupervisoryCode(null); projectContraption.setSupervisoryCode(null);
projectContraption.setEquCode(null); projectContraption.setEquCode(null);
projectContraption.setUseRegistrationCode(null); projectContraption.setUseRegistrationCode(null);
jgProjectContraptionService.updateById(projectContraption); projectContraption.setPipelineLength(0.0);
// 处理非批量导入数据,更新关联业务状态
processElseDataByStatus(oldStatus, jgUseRegistration); processElseDataByStatus(oldStatus, jgUseRegistration);
this.rollBackForPieLine(jgUseRegistration); // 统一处理设备的纳管状态【注册事务提交后的操作】
registerAfterCommitTask(records);
}else{
// 查询原工程装置及 useInfo 记录
List<String> originProjectContraptionIds = Arrays.asList(jgUseRegistration.getOriginProjectContraptionIds().split(","));
List<IdxBizJgProjectContraption> originProjectContraptionList = jgProjectContraptionService.lambdaQuery()
.in(BaseEntity::getSequenceNbr, originProjectContraptionIds)
.list();
records = idxBizJgUseInfoService.lambdaQuery()
.select(IdxBizJgUseInfo::getRecord)
.in(IdxBizJgUseInfo::getProjectContraptionId, originProjectContraptionIds)
.list()
.stream()
.map(IdxBizJgUseInfo::getRecord)
.collect(Collectors.toList());
// 统一处理设备的纳管状态
registerAfterCommitTask(records); registerAfterCommitTask(records);
}
//作废合并到有证
else{
processElseDataByStatus(oldStatus, jgUseRegistration); processElseDataByStatus(oldStatus, jgUseRegistration);
if (FlowStatusEnum.TO_BE_FINISHED.getName().equals(oldStatus)) {
// 计算管道长度并更新
double originPipelineLength = originProjectContraptionList.stream()
.map(IdxBizJgProjectContraption::getPipelineLength)
.filter(Objects::nonNull)
.mapToDouble(Double::doubleValue)
.sum();
projectContraption.setPipelineLength(projectContraption.getPipelineLength() - originPipelineLength);
}
} }
jgProjectContraptionService.updateById(projectContraption);
} }
} }
//1.子工程装置作废,正常逻辑 //1.子工程装置作废,正常逻辑
else { else {
// 统一处理设备的纳管状态【注册事务提交后的操作】
registerAfterCommitTask(records); registerAfterCommitTask(records);
processElseDataByStatus(oldStatus, jgUseRegistration); processElseDataByStatus(oldStatus, jgUseRegistration);
// 2.已完成压力管道清空装置表的使用登记证编号、删除装置的检验信息
this.rollBackForPieLine(jgUseRegistration); this.rollBackForPieLine(jgUseRegistration);
} }
} }
//气瓶 //气瓶
else { else {
// 处理非批量导入数据,更新关联业务状态
processElseDataByStatus(oldStatus, jgUseRegistration); processElseDataByStatus(oldStatus, jgUseRegistration);
// 统一处理设备的纳管状态【注册事务提交后的操作】
registerAfterCommitTask(records); registerAfterCommitTask(records);
} }
} }
} }
//台套办理 //台套办理
else { else {
// 处理非批量导入数据,更新关联业务状态
processElseDataByStatus(oldStatus, jgUseRegistration); processElseDataByStatus(oldStatus, jgUseRegistration);
// 统一处理设备的纳管状态【注册事务提交后的操作】
registerAfterCommitTask(records); registerAfterCommitTask(records);
} }
this.updateById(jgUseRegistration); this.updateById(jgUseRegistration);
......
...@@ -313,111 +313,48 @@ ...@@ -313,111 +313,48 @@
</select> </select>
<select id="countContraptionInUseTimesForDeleteByIntoManagement" resultType="java.lang.Integer"> <select id="countContraptionInUseTimesForDeleteByIntoManagement" resultType="java.lang.Integer">
SELECT SELECT SUM(inUseNumber) FROM (
SUM(inUseNumber) SELECT COUNT(DISTINCT A.sequence_nbr) AS inUseNumber FROM tzs_jg_equip_transfer A
FROM ( LEFT JOIN tzs_jg_equip_transfer_eq b ON b.equip_transfer_id = A.sequence_nbr
SELECT LEFT JOIN idx_biz_jg_use_info C ON b.equ_id = C.record
COUNT(1) AS inUseNumber WHERE C.project_contraption_id = #{projectContraptionId}
FROM tzs_jg_equip_transfer a AND A.is_delete = 0
LEFT JOIN tzs_jg_equip_transfer_eq b ON b.equip_transfer_id=a.sequence_nbr AND A.apply_status != '6617'
LEFT JOIN idx_biz_jg_use_info c ON b.equ_id=c.record UNION
WHERE c.project_contraption_id = #{projectContraptionId} SELECT COUNT(1) AS inUseNumber FROM tzs_jg_use_registration A
AND a.is_delete = 0 WHERE A.project_contraption_id = #{projectContraptionId}
AND ( a.apply_status != '6617') AND A.is_delete = 0
UNION AND A.status != '已作废'
SELECT UNION
COUNT(1) AS inUseNumber SELECT COUNT(DISTINCT A.sequence_nbr) AS inUseNumber FROM tzs_jg_change_registration_unit A
FROM LEFT JOIN tzs_jg_change_registration_unit_eq b ON b.unit_change_registration_id = A.sequence_nbr
tzs_jg_use_registration a LEFT JOIN idx_biz_jg_use_info C ON b.equ_id = C.record
WHERE a.project_contraption_id = #{projectContraptionId} WHERE C.project_contraption_id = #{projectContraptionId}
AND a.is_delete = 0 AND A.is_delete = 0
AND ( a.status != '已作废') AND A.status != '已作废'
UNION UNION
SELECT SELECT COUNT(DISTINCT A.sequence_nbr) AS inUseNumber FROM tzs_jg_enable_disable A
COUNT(1) AS inUseNumber LEFT JOIN tzs_jg_enable_disable_eq b ON b.enable_disable_apply_id = A.sequence_nbr
FROM tzs_jg_change_registration_unit a LEFT JOIN idx_biz_jg_use_info C ON b.equ_id = C.record
LEFT JOIN tzs_jg_change_registration_unit_eq b ON b.unit_change_registration_id=a.sequence_nbr WHERE C.project_contraption_id = #{projectContraptionId}
LEFT JOIN idx_biz_jg_use_info c ON b.equ_id=c.record AND A.is_delete = 0
WHERE c.project_contraption_id = #{projectContraptionId} AND A.audit_status != '已作废'
AND a.is_delete = 0 UNION
AND ( a.status != '已作废') SELECT COUNT(DISTINCT A.sequence_nbr) AS inUseNumber FROM tzs_jg_scrap_cancel A
UNION LEFT JOIN tzs_jg_scrap_cancel_eq b ON b.equip_transfer_id = A.sequence_nbr
SELECT LEFT JOIN idx_biz_jg_use_info C ON b.equ_id = C.record
COUNT(1) AS inUseNumber WHERE C.project_contraption_id = #{projectContraptionId}
FROM tzs_jg_enable_disable a AND A.is_delete = 0
LEFT JOIN tzs_jg_enable_disable_eq b ON b.enable_disable_apply_id=a.sequence_nbr AND A.audit_status != '使用单位已撤回'
LEFT JOIN idx_biz_jg_use_info c ON b.equ_id=c.record UNION
WHERE c.project_contraption_id = #{projectContraptionId} SELECT COUNT(1) AS inUseNumber FROM tzs_jg_installation_notice A
AND a.is_delete = 0 WHERE A.project_contraption_id = #{projectContraptionId}
AND ( a.audit_status != '已作废') AND A.notice_status != '6617'
UNION UNION
SELECT SELECT COUNT(1) AS inUseNumber FROM tz_jyjc_inspection_application A
COUNT(1) AS inUseNumber WHERE A.project_contraption_id = #{projectContraptionId}
FROM tzs_jg_scrap_cancel a AND A.status != '6617'
LEFT JOIN tzs_jg_scrap_cancel_eq b ON b.equip_transfer_id=a.sequence_nbr ) AS result
LEFT JOIN idx_biz_jg_use_info c ON b.equ_id=c.record
WHERE c.project_contraption_id = #{projectContraptionId}
AND a.is_delete = 0
AND ( a.audit_status != '使用单位已撤回')
UNION
SELECT
COUNT(1) AS inUseNumber
FROM tzs_jg_change_registration_transfer a
LEFT JOIN tzs_jg_change_registration_transfer_eq b ON b.equip_transfer_id=a.sequence_nbr
LEFT JOIN idx_biz_jg_use_info c ON b.equ_id=c.record
WHERE c.project_contraption_id = #{projectContraptionId}
AND a.is_delete = 0
AND ( a.audit_status != '使用单位已撤回')
UNION
SELECT
COUNT(1) AS inUseNumber
FROM tzs_jg_change_registration_name a
LEFT JOIN tzs_jg_change_registration_name_eq b ON b.name_change_registration_id=a.sequence_nbr
LEFT JOIN idx_biz_jg_use_info c ON b.equ_id=c.record
WHERE c.project_contraption_id = #{projectContraptionId}
AND a.is_delete = 0
AND ( a.audit_status != '使用单位已撤回')
UNION
SELECT
COUNT(1) AS inUseNumber
FROM
tzs_jg_installation_notice a
WHERE a.project_contraption_id = #{projectContraptionId}
AND (a.notice_status != '6617')
UNION
SELECT
COUNT(1) AS inUseNumber
FROM tzs_jg_maintain_notice a
LEFT JOIN tzs_jg_maintain_notice_eq b ON b.equip_transfer_id=a.sequence_nbr
LEFT JOIN idx_biz_jg_use_info c ON b.equ_id=c.record
WHERE c.project_contraption_id = #{projectContraptionId}
AND a.is_delete = 0
AND ( a.notice_status != '6617')
UNION
SELECT
COUNT(1) AS inUseNumber
FROM tzs_jg_reform_notice a
LEFT JOIN tzs_jg_reform_notice_eq b ON b.equip_transfer_id=a.sequence_nbr
LEFT JOIN idx_biz_jg_use_info c ON b.equ_id=c.record
WHERE c.project_contraption_id = #{projectContraptionId}
AND a.is_delete = 0
AND ( a.notice_status != '6617')
UNION
SELECT
COUNT(1) AS inUseNumber
FROM tzs_jg_transfer_notice a
LEFT JOIN tzs_jg_transfer_notice_eq b ON b.equip_transfer_id=a.sequence_nbr
LEFT JOIN idx_biz_jg_use_info c ON b.equ_id=c.record
WHERE c.project_contraption_id = #{projectContraptionId}
AND a.is_delete = 0
AND ( a.notice_status != '6617')
UNION
SELECT
COUNT(1) AS inUseNumber
FROM tz_jyjc_inspection_application a
WHERE a.project_contraption_id = #{projectContraptionId}
AND ( a.status != '6617')
)
</select> </select>
<select id="countContraptionInUseTimesForDeleteByIntoManagementBatch" resultMap="projectContraptionResultMap"> <select id="countContraptionInUseTimesForDeleteByIntoManagementBatch" resultMap="projectContraptionResultMap">
......
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