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;
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.boot.module.cylinder.api.dto.PageParam;
import io.swagger.annotations.Api;
......@@ -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.ResponseModel;
import java.util.Date;
import java.util.List;
import java.util.Map;
/**
* 特种设备监管controller
......@@ -42,11 +38,11 @@ public class YuLinDataDockController {
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/getElevatorInfo")
@ApiOperation(httpMethod = "GET", value = "查询电梯信息列表", notes = "查询电梯信息列表")
public ResponseModel<IPage<ElevatorModel>> 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 endTime,
PageParam pageParam) {
return ResponseHelper.buildResponse(jgServiceFeignClient.getElevatorInfo(equCode, startTime, endTime, pageParam));
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 endTime,
PageParam pageParam) {
return ResponseHelper.buildResponse(jgServiceFeignClient.getElevatorInfo(equCode, startTime, endTime, pageParam.getCurrent(), pageParam.getSize()));
}
/**
......@@ -60,11 +56,11 @@ public class YuLinDataDockController {
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/getCylinderInfo")
@ApiOperation(httpMethod = "GET", value = "根据时间范围查询液化石油气瓶档案", notes = "根据时间范围查询液化石油气瓶档案")
public ResponseModel<IPage<ElevatorModel>> 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 endTime,
PageParam pageParam) {
return ResponseHelper.buildResponse(jgServiceFeignClient.getCylinderInfo(equCode, startTime, endTime, pageParam));
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 endTime,
PageParam pageParam) {
return ResponseHelper.buildResponse(jgServiceFeignClient.getCylinderInfo(equCode, startTime, endTime, pageParam.getCurrent(), pageParam.getSize()));
}
/**
......@@ -75,7 +71,7 @@ public class YuLinDataDockController {
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/getVehicleCylinderInfo")
@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));
}
......@@ -86,7 +82,7 @@ public class YuLinDataDockController {
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/getCylinderStationInfo")
@ApiOperation(httpMethod = "GET", value = "查询气站信息", notes = "查询气站信息")
public ResponseModel<List<Map<String, Object>>> getCylinderStationInfo() {
public ResponseModel<Object> getCylinderStationInfo() {
return ResponseHelper.buildResponse(jgServiceFeignClient.getCylinderStationInfo());
}
}
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.face.model.ElevatorModel;
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.format.annotation.DateTimeFormat;
import org.springframework.web.bind.annotation.*;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import java.util.Date;
import java.util.List;
import java.util.Map;
......@@ -44,11 +41,13 @@ public interface TzsJgServiceFeignClient {
* @param endTime 结束时间
* @return 电梯数据
*/
@RequestMapping(value = "/equipment-register/getElevatorInfo", method = RequestMethod.GET)
IPage<ElevatorModel> getElevatorInfo(@RequestParam("equCode") String equCode,
@RequestParam("startTime") Date startTime,
@RequestParam("startTime") Date endTime,
PageParam pageParam);
@GetMapping(value = "/equipment-register/getElevatorInfo")
ResponseModel<Page<Map<String, Object>>> getElevatorInfo(@RequestParam("equCode") String equCode,
@RequestParam("startTime") @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") Date startTime,
@RequestParam("endTime") @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") Date endTime,
@RequestParam(value = "current") int current,
@RequestParam(value = "size") int size
);
/**
* 根据时间范围查询液化石油气瓶档案
......@@ -58,11 +57,13 @@ public interface TzsJgServiceFeignClient {
* @param endTime 结束时间
* @return 电梯数据
*/
@RequestMapping(value = "/equipment-register/getCylinderInfo", method = RequestMethod.GET)
IPage<ElevatorModel> getCylinderInfo(@RequestParam("equCode") String equCode,
@RequestParam("startTime") Date startTime,
@RequestParam("startTime") Date endTime,
PageParam pageParam);
@GetMapping(value = "/equipment-register/getCylinderInfo")
ResponseModel<Page<Map<String, Object>>> getCylinderInfo(@RequestParam("equCode") String equCode,
@RequestParam("startTime") @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") Date startTime,
@RequestParam("endTime") @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") Date endTime,
@RequestParam(value = "current") int current,
@RequestParam(value = "size") int size
);
/**
* 查询气站信息
......@@ -70,10 +71,12 @@ public interface TzsJgServiceFeignClient {
* @return
*/
@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 @@
tzs_jg_use_registration ur
</sql>
<select id="getListPage" resultType="java.util.Map">
select
*
<sql id="page-list-sub-pipline">
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
(
<include refid="page-list-sub-select"/>
)
tzs_jg_use_registration ur
</sql>
<select id="getListPage" resultType="java.util.Map">
SELECT * FROM (
-- 查询 equListCode = '8000' 的情况
SELECT *
FROM (
<include refid="page-list-sub-select"/>
)
<where>
is_delete = 0
AND equListCode <![CDATA[<>]]>'8000'
<if test="dto.equList != null and dto.equList != ''">
and equListCode= #{dto.equList}
AND equListCode = #{dto.equList}
</if>
<if test="dto.equCategory != null and dto.equCategory != ''">
and equCategoryCode = #{dto.equCategory}
AND equCategoryCode = #{dto.equCategory}
</if>
<if test="dto.equDefine != null and dto.equDefine != ''">
and equDefineCode = #{dto.equDefine}
AND equDefineCode = #{dto.equDefine}
</if>
<if test="dto.status != null and dto.status != ''">
and status = #{dto.status}
AND status = #{dto.status}
</if>
<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 test="dto.equCode != null and dto.equCode != ''">
and equCode like concat('%',#{dto.equCode},'%')
AND equCode LIKE CONCAT('%', #{dto.equCode}, '%')
</if>
<if test="dto.code96333 != null and dto.code96333 != ''">
and code96333 like concat('%',#{dto.code96333},'%')
AND code96333 LIKE CONCAT('%', #{dto.code96333}, '%')
</if>
<if test="dto.supervisoryCode != null and dto.supervisoryCode != ''">
and supervisoryCode like concat('%',#{dto.supervisoryCode},'%')
AND supervisoryCode LIKE CONCAT('%', #{dto.supervisoryCode}, '%')
</if>
<if test="dto.fullAddress != null and dto.fullAddress != ''">
AND fullAddress LIKE CONCAT('%', #{dto.fullAddress}, '%')
AND fullAddress LIKE CONCAT('%', #{dto.fullAddress}, '%')
</if>
<if test="dto.useUnitName != null and dto.useUnitName != ''">
and useUnitName like concat('%',#{dto.useUnitName},'%')
AND useUnitName LIKE CONCAT('%', #{dto.useUnitName}, '%')
</if>
<if test="dto.applyNo != null and dto.applyNo != ''">
and applyNo like concat('%',#{dto.applyNo},'%')
AND applyNo LIKE CONCAT('%', #{dto.applyNo}, '%')
</if>
<if test="dto.useRegistrationCode != null and dto.useRegistrationCode != ''">
and useRegistrationCode like concat('%',#{dto.useRegistrationCode},'%')
AND useRegistrationCode LIKE CONCAT('%', #{dto.useRegistrationCode}, '%')
</if>
<if test="dto.useUnitCode != null and dto.useUnitCode != ''">
and use_unit_credit_code = #{dto.useUnitCode}
AND use_unit_credit_code = #{dto.useUnitCode}
</if>
<if test="dto.orgBranchCode != null and dto.orgBranchCode != ''">
and supervisionOrgCode like concat(#{dto.orgBranchCode},'%')
......@@ -189,25 +271,91 @@
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[<>]]> '使用单位待提交'
<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}, '%'))
AND (use_unit_credit_code = #{dto.unitCode} OR transfer_to_user_ids LIKE CONCAT ('%',#{dto.currentUserId}, '%'))
</if>
</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>
<when test="sort != null">
${sort.field} ${sort.sortType}
......@@ -999,7 +1147,7 @@
</select>
<select id="getCylinderInfoList" resultType="java.util.Map">
<include refid="list-cylinder"/>
WHERE ri."EQU_CATEGORY" = '2300' and ui."DATA_SOURCE" like 'jg%'
WHERE ri."EQU_CATEGORY" = '2300'
and ui.record in
<foreach collection="records" item="record" open="(" close=")" separator=",">
#{record}
......
package com.yeejoin.amos.boot.module.jg.biz.controller;
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.bo.CompanyBo;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
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.ymt.api.entity.PageParam;
import com.yeejoin.amos.feign.systemctl.model.DictionarieValueModel;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
......@@ -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.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.InputStream;
......@@ -301,12 +298,12 @@ public class IdxBizJqEquipmentRegisterController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/getElevatorInfo")
@ApiOperation(httpMethod = "GET", value = "查询电梯信息列表", notes = "查询电梯信息列表")
public ResponseModel<IPage<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 endTime,
PageParam pageParam) {
return ResponseHelper.buildResponse(idxBizJgRegisterInfoService.getElevatorInfo(equCode, startTime, endTime, pageParam));
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 endTime,
@RequestParam(value = "current") int current,
@RequestParam(value = "size") int size) {
return ResponseHelper.buildResponse(idxBizJgRegisterInfoService.getElevatorInfo(equCode, startTime, endTime, current, size));
}
/**
......@@ -344,12 +341,12 @@ public class IdxBizJqEquipmentRegisterController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/getCylinderInfo")
@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 endTime,
PageParam pageParam) {
return ResponseHelper.buildResponse(idxBizJgRegisterInfoService.getCylinderInfo(equCode, startTime, endTime, pageParam));
@RequestParam(value = "current") int current,
@RequestParam(value = "size") int size) {
return ResponseHelper.buildResponse(idxBizJgRegisterInfoService.getCylinderInfo(equCode, startTime, endTime, current, size));
}
/**
......
package com.yeejoin.amos.boot.module.jg.biz.service;
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.bo.ReginParams;
import com.yeejoin.amos.boot.module.ymt.api.entity.PageParam;
import com.yeejoin.amos.feign.systemctl.model.DictionarieValueModel;
import org.springframework.web.multipart.MultipartFile;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
......@@ -60,13 +58,13 @@ public interface IIdxBizJgRegisterInfoService {
*/
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>> 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();
......
......@@ -1563,10 +1563,10 @@ public class DataDockServiceImpl {
String equListCode = String.valueOf(equipInfo.get("EQU_LIST"));
String equCategoryCode = String.valueOf(equipInfo.get("EQU_CATEGORY"));
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 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 city = String.valueOf(equipInfo.get("city"));
String county = String.valueOf(equipInfo.get("county"));
......@@ -1598,8 +1598,16 @@ public class DataDockServiceImpl {
.setOrgBranchName(orgBranchCode.split("_").length > 1 ? orgBranchCode.split("_")[1] : "")
.setUseOrgCode(useOrgCode)
.setVehicleApanage(String.valueOf(equipInfo.get("VEHICLE_APANAGE")))
.setReceiveOrgCode(receiveOrgCode.split("_")[0])
.setReceiveOrgName(receiveOrgCode.split("_")[1])
.setReceiveOrgCode(Optional.ofNullable(receiveOrgCode)
.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")))
.setProjectContraptionNo(String.valueOf(equipInfo.get("PROJECT_CONTRAPTION_NO")))
.setProductPhoto(toJSONString(equipInfo.get("PRODUCT_PHOTO")))
......
......@@ -625,15 +625,17 @@ public class DataHandlerServiceImpl {
projectContraptionService.saveBatch(projectContraptionList);
}
// 更新设备es的装置id、使用信息的装置id
projectContraptionIdRecordsMap.forEach((k, v) -> {
projectContraptionIdRecordsMap.forEach((k,v)->{
IdxBizJgProjectContraption idxBizJgProjectContraption = projectContraptionService.getById(k);
Iterable<ESEquipmentCategoryDto> equipmentCategories = esEquipmentCategory.findAllById(v);
equipmentCategories.forEach(e -> e.setProjectContraptionId(k + ""));
equipmentCategories.forEach(e-> e.setProjectContraptionId(k + ""));
esEquipmentCategory.saveAll(equipmentCategories);
Collection<IdxBizJgUseInfo> useInfos = useInfoService.listByIds(v);
useInfos.forEach(u -> {
Collection<IdxBizJgUseInfo> useInfos = useInfoService.getUseInfoListByEquIds(v);
useInfos.forEach(u->{
LambdaUpdateWrapper<IdxBizJgUseInfo> updateWrapper = new LambdaUpdateWrapper<>();
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);
});
});
......@@ -824,10 +826,14 @@ public class DataHandlerServiceImpl {
eqs.forEach(eq -> {
Optional<ESEquipmentCategoryDto> equInfosWithEs = esEquipmentCategory.findById(eq.getEquId());
equInfosWithEs.ifPresent(equInfoEs -> {
LambdaUpdateWrapper<IdxBizJgUseInfo> updateWrapper = new LambdaUpdateWrapper<>();
updateWrapper.eq(IdxBizJgUseInfo::getRecord, equInfoEs.getSEQUENCE_NBR());
updateWrapper.set(IdxBizJgUseInfo::getProjectContraptionId, equInfoEs.getProjectContraptionId());
useInfoService.update(updateWrapper);
if(StringUtils.isNotEmpty(equInfoEs.getProjectContraptionId())){
IdxBizJgProjectContraption idxBizJgProjectContraption = projectContraptionService.getById(equInfoEs.getProjectContraptionId());
LambdaUpdateWrapper<IdxBizJgUseInfo> updateWrapper = new LambdaUpdateWrapper<>();
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();
......
......@@ -134,11 +134,13 @@ public class IdxBizJgProjectContraptionServiceImpl extends BaseService<IdxBizJgP
List<IdxBizJgUseInfo> useInfos = useInfoService.lambdaQuery().select(IdxBizJgUseInfo::getRecord).eq(IdxBizJgUseInfo::getProjectContraptionId, sequenceNbr).list();
// 删除idx设备表信息 + 删除对应es数据
List<String> records = useInfos.stream().map(IdxBizJgUseInfo::getRecord).collect(Collectors.toList());
if (records.isEmpty()) return Boolean.TRUE;
Map<String, Object> map = new HashMap<>();
map.put("recordList", records);
map.put("equList", PipelineEnum.PRESSURE_PIPELINE.getCode());
registerInfoService.batchDeleteByRecord(map);
if (!records.isEmpty()){
Map<String, Object> map = new HashMap<>();
map.put("recordList", records);
map.put("equList", PipelineEnum.PRESSURE_PIPELINE.getCode());
registerInfoService.batchDeleteByRecord(map);
}
// 删除装置表信息
this.removeById(sequenceNbr);
return Boolean.TRUE;
......
......@@ -84,6 +84,8 @@ import org.typroject.tyboot.core.restful.utils.ResponseModel;
import java.io.IOException;
import java.lang.reflect.Field;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.sql.Timestamp;
import java.text.ParseException;
import java.text.SimpleDateFormat;
......@@ -502,11 +504,13 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
projectContraption.setEquCategoryName(equCategoryName);
projectContraption.setEquDefineName(equDefineName);
projectContraption.setPipelineLength(
pipelineList.stream()
.map(pipeline -> pipeline.get("pipeLength"))
.filter(Objects::nonNull)
.mapToDouble(pipeLength -> Double.parseDouble(String.valueOf(pipeLength)))
.sum()
BigDecimal.valueOf(pipelineList.stream()
.map(pipeline -> pipeline.get("pipeLength"))
.filter(Objects::nonNull)
.mapToDouble(pipeLength -> Double.parseDouble(String.valueOf(pipeLength)))
.sum())
.setScale(2, RoundingMode.HALF_UP)
.doubleValue()
);
projectContraption.setUscUnitName(companyInfoMap.get("companyName").toString());
......@@ -4413,9 +4417,8 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
}
@Override
public Page<Map<String, Object>> getElevatorInfo(String equCode, Date startTime, Date endTime, PageParam
pageParam) {
Page<Map<String, Object>> result = new Page<>(pageParam.getCurrent(), pageParam.getSize());
public Page<Map<String, Object>> getElevatorInfo(String equCode, Date startTime, Date endTime, int current, int size) {
Page<Map<String, Object>> result = new Page<>(current, size);
SearchRequest request = new SearchRequest();
request.indices("idx_biz_view_jg_all");
SearchSourceBuilder builder = new SearchSourceBuilder();
......@@ -4446,8 +4449,8 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
builder.query(boolMust);
builder.sort("REC_DATE", SortOrder.DESC);
builder.from((pageParam.getCurrent() - 1) * pageParam.getSize());
builder.size(pageParam.getSize());
builder.from((current - 1) * size);
builder.size(size);
request.source(builder);
List<Map<String, Object>> elevatorModelVoList = Collections.emptyList();
try {
......@@ -4464,7 +4467,7 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
elevatorModelVoList = jgUseRegistrationMapper.getElevatorModeList(equIds);
}
result.setRecords(convertKeysToCamelCase(elevatorModelVoList));
result.setTotal(response.getHits().getTotalHits().value);
result.setTotal(Objects.requireNonNull(response.getHits().getTotalHits()).value);
} catch (IOException e) {
throw new RuntimeException(e);
}
......@@ -4482,9 +4485,8 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
}
@Override
public IPage<Map<String, Object>> getCylinderInfo(String equCode, Date startTime, Date endTime, PageParam
pageParam) {
Page<Map<String, Object>> result = new Page<>(pageParam.getCurrent(), pageParam.getSize());
public Page<Map<String, Object>> getCylinderInfo(String equCode, Date startTime, Date endTime, int current, int size) {
Page<Map<String, Object>> result = new Page<>(current, size);
SearchRequest request = new SearchRequest();
request.indices("idx_biz_view_jg_all");
SearchSourceBuilder builder = new SearchSourceBuilder();
......@@ -4515,8 +4517,8 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
builder.query(boolMust);
builder.sort("REC_DATE", SortOrder.DESC);
builder.from((pageParam.getCurrent() - 1) * pageParam.getSize());
builder.size(pageParam.getSize());
builder.from((current - 1) * size);
builder.size(size);
request.source(builder);
List<Map<String, Object>> cylinderInfoList = Collections.emptyList();
try {
......@@ -4539,7 +4541,7 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
cylinderInfoList.forEach(i -> i.computeIfPresent("chargingMedium", (key, value) -> fillingMediumMap.get(value)));
}
result.setRecords(convertKeysToCamelCase(cylinderInfoList));
result.setTotal(response.getHits().getTotalHits().value);
result.setTotal(Objects.requireNonNull(response.getHits().getTotalHits()).value);
} catch (IOException e) {
throw new RuntimeException(e);
}
......
......@@ -89,6 +89,8 @@ import org.typroject.tyboot.core.restful.utils.ResponseModel;
import javax.servlet.http.HttpServletResponse;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.net.URLEncoder;
import java.text.ParseException;
import java.text.SimpleDateFormat;
......@@ -1923,7 +1925,9 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN
result.fluentPut("deviceList", deviceList)
.fluentPut("projectContraption", projectContraption.getProjectContraption())
.fluentPut("projectContraptionNo", projectContraption.getProjectContraptionNo())
.fluentPut("pipelineLength", projectContraption.getPipelineLength())
.fluentPut("pipelineLength", BigDecimal.valueOf(projectContraption.getPipelineLength())
.setScale(2, RoundingMode.HALF_UP)
.doubleValue())
.fluentPut("projectContraptionId", projectContraptionSeq);
if (!ValidationUtil.isEmpty(projectContraption.getCity())) {
result.fluentPut("city", projectContraption.getCity() + "_" + projectContraption.getCityName());
......
......@@ -544,6 +544,7 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
IdxBizJgOtherInfo otherInfo = otherInfoMapper.selectOne(otherLambda);
String supervisoryCode = otherInfo.getSupervisoryCode();
jgUseRegistration.setSupervisoryCode(supervisoryCode);
jgUseRegistration.setManageType("set");
if (!ObjectUtils.isEmpty(map.get("otherAccessories"))) {
jgUseRegistration.setOtherAccessories(JSONObject.toJSONString(map.get("otherAccessories")));
......@@ -759,7 +760,8 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
lambda.select(JgUseRegistrationEq::getEquId);
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());
//合并的管道只需要子工程装置管道集合
if (Objects.nonNull(data.getOriginProjectContraptionIds()) &&
......@@ -2505,21 +2507,22 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
throw new BadRequest("没有查询到汇总信息!");
}
JSONArray allEquipment = new JSONArray();
// 用Set存储已添加的equCode,防止重复添加
Set<String> addedEquCodes = new HashSet<>();
registrationHistoryList.forEach(historyList -> {
JSONObject jsonObject = JSONObject.parseObject(historyList.getChangeData());
JSONArray equipmentLists = (JSONArray) jsonObject.get("equipmentLists");
if("安装告知".equals(type)){
equipmentLists =(JSONArray) jsonObject.get("deviceList");
}
// 填充投用年月
String useDateValue = (String) jsonObject.get("useDate");
JSONArray equipmentLists = "安装告知".equals(type)
? (JSONArray) jsonObject.get("deviceList")
: (JSONArray) jsonObject.get("equipmentLists");
final String useDateValue = jsonObject.getString("useDate");
if (CollectionUtils.isNotEmpty(equipmentLists)) {
equipmentLists = equipmentLists.stream()
equipmentLists.stream()
.map(obj -> (JSONObject) obj)
.peek(equipmentItem -> equipmentItem.put("useDate", timeToMonths(useDateValue)))
.filter(equipmentItem -> this.checkEquStatusInUse(equipmentItem.getString("record")))
.collect(Collectors.toCollection(JSONArray::new));
allEquipment.addAll(equipmentLists);
.filter(equipmentItem -> addedEquCodes.add(equipmentItem.getString("equCode")))
.forEach(allEquipment::add);
}
});
total = allEquipment.size();
......@@ -2980,10 +2983,9 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
jgUseRegistration.setCancelUserId(RequestContext.getExeUserId());
jgUseRegistration.setNextExecuteUserIds("");
jgUseRegistration.setPromoter("");
jgUseRegistration.setStatus(FlowStatusEnum.TO_BE_DISCARD.getName());
List<JgUseRegistrationEq> eqList = getJgUseRegistrationEqs(jgUseRegistration);
List<String> records = eqList.stream().map(JgUseRegistrationEq::getEquId).collect(Collectors.toList());
jgUseRegistration.setStatus(FlowStatusEnum.TO_BE_DISCARD.getName());
// 单位办理
if ("unit".equals(jgUseRegistration.getManageType())){
......@@ -3007,53 +3009,58 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
if (!ValidationUtil.isEmpty(jgUseRegistration.getProjectContraptionId())) {
idxBizJgProjectContraptionMapper.delete(new LambdaQueryWrapper<IdxBizJgProjectContraption>().eq(IdxBizJgProjectContraption::getSequenceNbr,jgUseRegistration.getProjectContraptionId()));
}
}
else{
if (jgUseRegistration.getUseRegistrationCode().startsWith("管")) {
} else{
//判断是否管道
if (FlowStatusEnum.TO_BE_FINISHED.getName().equals(oldStatus) &&
jgUseRegistration.getUseRegistrationCode().startsWith("管")) {
JgUseRegistration lastUseRegistration = jgUseRegistrationMapper.selectOne(new LambdaQueryWrapper<JgUseRegistration>()
.select(JgUseRegistration::getApplyNo)
.eq(JgUseRegistration::getProjectContraptionId, jgUseRegistration.getProjectContraptionId())
.ne(JgUseRegistration::getStatus, "已作废")
.eq(JgUseRegistration::getIsDelete, false)
.orderByDesc(JgUseRegistration::getRecDate)
.orderByDesc(JgUseRegistration::getApplyNo)
.last("limit 1"));
if (lastUseRegistration != null && !lastUseRegistration.getApplyNo().equals(jgUseRegistration.getApplyNo())){
if (lastUseRegistration != null && !lastUseRegistration.getApplyNo().equals(jgUseRegistration.getApplyNo())) {
throw new BadRequest("作废失败,该使用登记证下有合并工程装置,请先作废最新单据后再作废此单据!");
}
if (jgUseRegistration.getProjectContraptionId() == null) {
throw new BadRequest("该作废单据没有工程装置,请联系管理员处理此单据:"+ jgUseRegistration.getApplyNo());
}
}
if (jgUseRegistration.getProjectContraptionId() != null) {
//2.合并后作废
if (!jgUseRegistration.getOriginProjectContraptionIds().contains(jgUseRegistration.getProjectContraptionId())){
eqList.forEach(v->{
// 1.根据eq关系表中保存的原工程装置与设备关系还原use_info和ES
esEquipmentCategory.findById(v.getEquId()).ifPresent(equInfoEs -> {
equInfoEs.setProjectContraptionId(v.getOriginProjectContraptionId());
esEquipmentCategory.save(equInfoEs);
});
LambdaQueryWrapper<IdxBizJgUseInfo> lambda = new QueryWrapper<IdxBizJgUseInfo>().lambda();
lambda.eq(IdxBizJgUseInfo::getRecord, String.valueOf(v.getEquId()));
IdxBizJgUseInfo useInfo = useInfoMapper.selectOne(lambda);
useInfo.setProjectContraptionId(v.getOriginProjectContraptionId());
useInfoMapper.updateById(useInfo);
IdxBizJgProjectContraption originProjectContraption = jgProjectContraptionService.getById(v.getOriginProjectContraptionId());
//还原 原工程装置下equCode和监管码
LambdaUpdateWrapper<IdxBizJgRegisterInfo> updateWrapper = new UpdateWrapper<IdxBizJgRegisterInfo>().lambda()
.eq(IdxBizJgRegisterInfo::getRecord, v.getEquId());
IdxBizJgRegisterInfo idxBizJgRegisterInfo = new IdxBizJgRegisterInfo();
idxBizJgRegisterInfo.setEquCode(originProjectContraption.getEquCode());
idxBizJgRegisterInfoMapper.update(idxBizJgRegisterInfo, updateWrapper);
LambdaUpdateWrapper<IdxBizJgOtherInfo> otherInfoLambdaUpdateWrapper = new UpdateWrapper<IdxBizJgOtherInfo>().lambda()
.eq(IdxBizJgOtherInfo::getRecord, v.getEquId());
IdxBizJgOtherInfo idxBizJgOtherInfo = new IdxBizJgOtherInfo();
idxBizJgOtherInfo.setSupervisoryCode(originProjectContraption.getSupervisoryCode());
otherInfoMapper.update(idxBizJgOtherInfo, otherInfoLambdaUpdateWrapper);
});
//2.根据工程装置ID查询工程装置父级,重置工程装置父级为空
eqList.stream()
.filter(v -> jgUseRegistration.getOriginProjectContraptionIds().contains(v.getOriginProjectContraptionId()))
.forEach(v -> esEquipmentCategory.findById(v.getEquId()).ifPresent(equInfoEs -> {
equInfoEs.setProjectContraptionId(v.getOriginProjectContraptionId());
esEquipmentCategory.save(equInfoEs);
LambdaQueryWrapper<IdxBizJgUseInfo> lambda = new QueryWrapper<IdxBizJgUseInfo>().lambda();
lambda.eq(IdxBizJgUseInfo::getRecord, String.valueOf(v.getEquId()));
IdxBizJgUseInfo useInfo = useInfoMapper.selectOne(lambda);
useInfo.setProjectContraptionId(v.getOriginProjectContraptionId());
useInfoMapper.updateById(useInfo);
IdxBizJgProjectContraption originProjectContraption = jgProjectContraptionService.getById(v.getOriginProjectContraptionId());
//还原 原工程装置下equCode和监管码
LambdaUpdateWrapper<IdxBizJgRegisterInfo> updateWrapper = new UpdateWrapper<IdxBizJgRegisterInfo>().lambda()
.eq(IdxBizJgRegisterInfo::getRecord, v.getEquId());
IdxBizJgRegisterInfo idxBizJgRegisterInfo = new IdxBizJgRegisterInfo();
idxBizJgRegisterInfo.setEquCode(originProjectContraption.getEquCode());
idxBizJgRegisterInfoMapper.update(idxBizJgRegisterInfo, updateWrapper);
LambdaUpdateWrapper<IdxBizJgOtherInfo> otherInfoLambdaUpdateWrapper = new UpdateWrapper<IdxBizJgOtherInfo>().lambda()
.eq(IdxBizJgOtherInfo::getRecord, v.getEquId());
IdxBizJgOtherInfo idxBizJgOtherInfo = new IdxBizJgOtherInfo();
idxBizJgOtherInfo.setSupervisoryCode(originProjectContraption.getSupervisoryCode());
otherInfoMapper.update(idxBizJgOtherInfo, otherInfoLambdaUpdateWrapper);
}));
//2.根据工程装置ID查询工程装置父级,重置工程装置父级为空
jgProjectContraptionService.update(
new LambdaUpdateWrapper<IdxBizJgProjectContraption>()
.eq(IdxBizJgProjectContraption::getProjectContraptionParentId, jgUseRegistration.getProjectContraptionId())
.in(BaseEntity::getSequenceNbr, Arrays.asList(jgUseRegistration.getOriginProjectContraptionIds().split(",")))
.set(IdxBizJgProjectContraption::getProjectContraptionParentId, null)
);
JgRegistrationHistory history = jgRegistrationHistoryService.queryLatestRegistrationHistory(Long.valueOf(jgUseRegistration.getProjectContraptionId()));
......@@ -3063,42 +3070,71 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
.map(Boolean.class::cast)
.orElse(false);
//合并到无证总工程
IdxBizJgProjectContraption projectContraption = jgProjectContraptionService.getById(jgUseRegistration.getProjectContraptionId());
if (isFirstMerge) {
IdxBizJgProjectContraption projectContraption = jgProjectContraptionService.getById(jgUseRegistration.getProjectContraptionId());
projectContraption.setIsIntoManagement(false);
projectContraption.setIsFirstMerge(true);
projectContraption.setSupervisoryCode(null);
projectContraption.setEquCode(null);
projectContraption.setUseRegistrationCode(null);
jgProjectContraptionService.updateById(projectContraption);
projectContraption.setPipelineLength(0.0);
// 处理非批量导入数据,更新关联业务状态
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);
}
//作废合并到有证
else{
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.子工程装置作废,正常逻辑
else {
// 统一处理设备的纳管状态【注册事务提交后的操作】
registerAfterCommitTask(records);
processElseDataByStatus(oldStatus, jgUseRegistration);
// 2.已完成压力管道清空装置表的使用登记证编号、删除装置的检验信息
this.rollBackForPieLine(jgUseRegistration);
}
}
//气瓶
else {
// 处理非批量导入数据,更新关联业务状态
processElseDataByStatus(oldStatus, jgUseRegistration);
// 统一处理设备的纳管状态【注册事务提交后的操作】
registerAfterCommitTask(records);
}
}
}
//台套办理
else {
// 处理非批量导入数据,更新关联业务状态
processElseDataByStatus(oldStatus, jgUseRegistration);
// 统一处理设备的纳管状态【注册事务提交后的操作】
registerAfterCommitTask(records);
}
this.updateById(jgUseRegistration);
......
......@@ -313,111 +313,48 @@
</select>
<select id="countContraptionInUseTimesForDeleteByIntoManagement" resultType="java.lang.Integer">
SELECT
SUM(inUseNumber)
FROM (
SELECT
COUNT(1) AS inUseNumber
FROM tzs_jg_equip_transfer a
LEFT JOIN tzs_jg_equip_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.apply_status != '6617')
UNION
SELECT
COUNT(1) AS inUseNumber
FROM
tzs_jg_use_registration a
WHERE a.project_contraption_id = #{projectContraptionId}
AND a.is_delete = 0
AND ( a.status != '已作废')
UNION
SELECT
COUNT(1) AS inUseNumber
FROM tzs_jg_change_registration_unit a
LEFT JOIN tzs_jg_change_registration_unit_eq b ON b.unit_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.status != '已作废')
UNION
SELECT
COUNT(1) AS inUseNumber
FROM tzs_jg_enable_disable a
LEFT JOIN tzs_jg_enable_disable_eq b ON b.enable_disable_apply_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_scrap_cancel a
LEFT JOIN tzs_jg_scrap_cancel_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_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 SUM(inUseNumber) FROM (
SELECT COUNT(DISTINCT A.sequence_nbr) AS inUseNumber FROM tzs_jg_equip_transfer A
LEFT JOIN tzs_jg_equip_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.apply_status != '6617'
UNION
SELECT COUNT(1) AS inUseNumber FROM tzs_jg_use_registration A
WHERE A.project_contraption_id = #{projectContraptionId}
AND A.is_delete = 0
AND A.status != '已作废'
UNION
SELECT COUNT(DISTINCT A.sequence_nbr) AS inUseNumber FROM tzs_jg_change_registration_unit A
LEFT JOIN tzs_jg_change_registration_unit_eq b ON b.unit_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.status != '已作废'
UNION
SELECT COUNT(DISTINCT A.sequence_nbr) AS inUseNumber FROM tzs_jg_enable_disable A
LEFT JOIN tzs_jg_enable_disable_eq b ON b.enable_disable_apply_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(DISTINCT A.sequence_nbr) AS inUseNumber FROM tzs_jg_scrap_cancel A
LEFT JOIN tzs_jg_scrap_cancel_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_installation_notice A
WHERE A.project_contraption_id = #{projectContraptionId}
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'
) AS result
</select>
<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