Commit 7583ea0a authored by suhuiguang's avatar suhuiguang

Merge branch 'develop_tzs_register' of…

Merge branch 'develop_tzs_register' of http://39.100.92.250:5000/moa/amos-boot-biz into develop_tzs_register
parents 2f3c0df6 05a03175
...@@ -3,6 +3,7 @@ package com.yeejoin.amos.boot.module.common.api.dto; ...@@ -3,6 +3,7 @@ package com.yeejoin.amos.boot.module.common.api.dto;
import lombok.Data; import lombok.Data;
import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotBlank;
import java.util.List;
/** /**
* 大屏筛选过滤对象 * 大屏筛选过滤对象
...@@ -43,7 +44,7 @@ public class DPFilterParamDto { ...@@ -43,7 +44,7 @@ public class DPFilterParamDto {
*/ */
private String searchType; private String searchType;
/** /**
* 1生产单位 2使用单位 3充装单位 4检验检测机构 * 1生产单位 2使用单位 3充装单位 4检验机构 5检测机构
*/ */
private String companyType; private String companyType;
/** /**
...@@ -94,4 +95,12 @@ public class DPFilterParamDto { ...@@ -94,4 +95,12 @@ public class DPFilterParamDto {
private String equipType; private String equipType;
private String phone; private String phone;
private String superviseKey;
private List<String> region;
private String regionStr;
/**
* 监管机构组织机构代码
*/
private String superviseOrgCode;
} }
...@@ -21,7 +21,7 @@ public enum UnitTypeEnum { ...@@ -21,7 +21,7 @@ public enum UnitTypeEnum {
CZDW("充装单位","1231","3","充装单位"), CZDW("充装单位","1231","3","充装单位"),
//检验检测机构 //检验检测机构
JYJG("检验机构","1233-1","4","检验机构"), JYJG("检验机构","1233-1","4","检验机构"),
JCJG("检测机构","1233-2","4","检测机构"), JCJG("检测机构", "1233-2", "5", "检测机构"),
; ;
String name; String name;
......
...@@ -6,7 +6,7 @@ import java.util.*; ...@@ -6,7 +6,7 @@ import java.util.*;
@Getter @Getter
public enum UserPostEnum { public enum UserPostEnum {
//type 1生产单位 2使用单位 3充装单位 4检验检测机构 // type 1生产单位 2使用单位 3充装单位 4检验机构 5检测机构
//主要负责人 //主要负责人
ZYFZR("主要负责人","6548","1,2,3"), ZYFZR("主要负责人","6548","1,2,3"),
//质量安全总监 //质量安全总监
...@@ -14,11 +14,11 @@ public enum UserPostEnum { ...@@ -14,11 +14,11 @@ public enum UserPostEnum {
//质量安全员 //质量安全员
ZLAQY("质量安全员","6551","1"), ZLAQY("质量安全员","6551","1"),
//作业人员 //作业人员
ZYRY("作业人员","6552","1,2,3,4"), ZYRY("作业人员", "6552", "1,2,3,4,5"),
//检验人员 //检验人员
ZJRY("检验人员","66151","1,4"), ZJRY("检验人员", "66151", "1,4,5"),
//检测人员 //检测人员
JCRY("检测人员","66152","1,4"), JCRY("检测人员", "66152", "1,4,5"),
//安全总监 //安全总监
AQZJ("安全总监","6547","2,3"), AQZJ("安全总监","6547","2,3"),
//安全员 //安全员
...@@ -50,8 +50,7 @@ public enum UserPostEnum { ...@@ -50,8 +50,7 @@ public enum UserPostEnum {
//质量保证体系人员(非字典表字段,后期修改code) //质量保证体系人员(非字典表字段,后期修改code)
ZLBZTXRY("质量保证体系人员","6619","1,3,4"), ZLBZTXRY("质量保证体系人员", "6619", "1,3,4,5");
;
String name; String name;
String code; String code;
......
...@@ -6,6 +6,9 @@ import io.swagger.annotations.ApiModel; ...@@ -6,6 +6,9 @@ import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;
import java.util.Date; import java.util.Date;
import java.util.Map; import java.util.Map;
...@@ -52,6 +55,9 @@ public class SafetyProblemTracingDto extends BaseDto { ...@@ -52,6 +55,9 @@ public class SafetyProblemTracingDto extends BaseDto {
@ApiModelProperty(value = "问题产生查询结束时间") @ApiModelProperty(value = "问题产生查询结束时间")
private Date problemTimeEnd; private Date problemTimeEnd;
@ApiModelProperty(value = "问题时间区间")
private ProblemTimeRange problemTimeRange;
@ApiModelProperty(value = "主体单位名称") @ApiModelProperty(value = "主体单位名称")
private String principalUnit; private String principalUnit;
...@@ -156,4 +162,18 @@ public class SafetyProblemTracingDto extends BaseDto { ...@@ -156,4 +162,18 @@ public class SafetyProblemTracingDto extends BaseDto {
@ApiModelProperty(value = "制造日期") @ApiModelProperty(value = "制造日期")
private String productDate; private String productDate;
@Data
@Getter
@Setter
public static class ProblemTimeRange {
@JsonFormat(pattern = "yyyy-MM-dd")
@ApiModelProperty(value = "问题产生查询开始时间")
private Date beginDate;
@JsonFormat(pattern = "yyyy-MM-dd")
@ApiModelProperty(value = "问题产生查询结束时间")
private Date endDate;
}
} }
...@@ -1115,7 +1115,7 @@ ...@@ -1115,7 +1115,7 @@
SELECT "RECORD","NEXT_INSPECT_DATE",rowNum1 SELECT "RECORD","NEXT_INSPECT_DATE",rowNum1
FROM FROM
( (
SELECT ROW_NUMBER () OVER ( PARTITION BY "RECORD" ORDER BY "NEXT_INSPECT_DATE" DESC) AS rowNum1,"RECORD", "NEXT_INSPECT_DATE" SELECT ROW_NUMBER () OVER ( PARTITION BY "RECORD" ORDER BY "INSPECT_DATE" DESC) AS rowNum1,"RECORD", "NEXT_INSPECT_DATE"
FROM FROM
idx_biz_jg_inspection_detection_info where "NEXT_INSPECT_DATE" is not null idx_biz_jg_inspection_detection_info where "NEXT_INSPECT_DATE" is not null
) d ) d
......
...@@ -380,6 +380,312 @@ ...@@ -380,6 +380,312 @@
</select> </select>
<select id="getListPage1" resultType="java.util.Map"> <select id="getListPage1" resultType="java.util.Map">
<choose>
<!-- 情况1:有设备过滤条件 -->
<when test="dto.equList != null or dto.equCategory != null or dto.equDefine != null or
dto.equCode != null or dto.code96333 != null or dto.supervisoryCode != null">
WITH filtered_main_ids AS (
SELECT DISTINCT fu.sequence_nbr
FROM tzs_jg_use_registration fu
LEFT JOIN tzs_jg_use_registration_eq re ON fu.sequence_nbr = re.equip_transfer_id
LEFT JOIN idx_biz_jg_register_info jri ON re.equ_id = jri."RECORD"
LEFT JOIN idx_biz_jg_other_info other ON jri."RECORD" = other."RECORD"
WHERE fu.is_delete = '0'
<!-- 公共主表过滤条件 -->
<if test="dto.status != null and dto.status != ''">
AND fu.status = #{dto.status}
</if>
<if test="dto.applicationDate != null">
AND DATE(fu.create_date) = DATE(#{dto.applicationDate})
</if>
<if test="dto.fullAddress != null and dto.fullAddress != ''">
AND fu.use_address LIKE CONCAT('%', #{dto.fullAddress}, '%')
</if>
<if test="dto.useUnitName != null and dto.useUnitName != ''">
AND fu.use_unit_name LIKE CONCAT('%', #{dto.useUnitName}, '%')
</if>
<if test="dto.applyNo != null and dto.applyNo != ''">
AND fu.apply_no LIKE CONCAT(#{dto.applyNo}, '%')
</if>
<if test="dto.useRegistrationCode != null and dto.useRegistrationCode != ''">
AND fu.use_registration_code LIKE CONCAT(#{dto.useRegistrationCode}, '%')
</if>
<if test="dto.useUnitCode != null and dto.useUnitCode != ''">
AND fu.use_unit_credit_code = #{dto.useUnitCode}
</if>
<if test="dto.orgBranchCode != null and dto.orgBranchCode != ''">
<choose>
<when test="client == 'jgLook'">
AND fu.supervision_org_code LIKE CONCAT(#{dto.orgBranchCode}, '%')
</when>
<otherwise>
AND fu.supervision_org_code = #{dto.orgBranchCode}
</otherwise>
</choose>
</if>
<if test="dto.auditPassDateStart != null and dto.auditPassDateEnd != null">
AND fu.audit_pass_date BETWEEN #{dto.auditPassDateStart} AND #{dto.auditPassDateEnd}
</if>
<if test="dto.dataType == 'supervision' ">
<choose>
<when test="client == 'jgAudit'">
AND (fu.receive_company_code = #{dto.receiveCompanyCode}
OR fu.transfer_to_user_ids LIKE CONCAT('%', #{dto.currentUserId}, '%'))
</when>
<otherwise>
AND fu.supervision_org_code LIKE CONCAT(#{dto.supervisionOrgCode}, '%')
</otherwise>
</choose>
AND fu.status != '使用单位待提交'
</if>
<if test="dto.dataType == 'company' ">
AND (fu.use_unit_credit_code = #{dto.unitCode}
OR fu.transfer_to_user_ids LIKE CONCAT('%', #{dto.currentUserId}, '%'))
</if>
<!-- 设备表过滤条件 -->
<if test="dto.equList != null and dto.equList != ''">
AND jri.EQU_LIST = #{dto.equList}
</if>
<if test="dto.equCategory != null and dto.equCategory != ''">
AND jri.EQU_CATEGORY = #{dto.equCategory}
</if>
<if test="dto.equDefine != null and dto.equDefine != ''">
AND jri.EQU_DEFINE = #{dto.equDefine}
</if>
<if test="dto.equCode != null and dto.equCode != ''">
AND jri.EQU_CODE LIKE CONCAT(#{dto.equCode}, '%')
</if>
<if test="dto.code96333 != null and dto.code96333 != ''">
AND other.CODE96333 LIKE CONCAT(#{dto.code96333}, '%')
</if>
<if test="dto.supervisoryCode != null and dto.supervisoryCode != ''">
AND other.supervisory_code LIKE CONCAT(#{dto.supervisoryCode}, '%')
</if>
)
SELECT
fu.sequence_nbr AS sequenceNbr,
fu.audit_status AS auditStatus,
DATE_FORMAT(fu.reg_date,'%Y-%m-%d') AS regDate,
fu.use_unit_name AS useUnitName,
fu.supervision_org_code AS supervisionOrgCode,
fu.status,
fu.receive_org_name AS receiveOrgName,
fu.use_address AS place,
fu.instance_id AS instanceId,
fu.apply_no AS applyNo,
fu.next_execute_ids AS nextExecuteIds,
fu.promoter,
fu.use_registration_code AS useRegistrationCode,
DATE_FORMAT(fu.audit_pass_date,'%Y-%m-%d') AS auditPassDate,
DATE_FORMAT(fu.create_date,'%Y-%m-%d') AS createDate,
fu.receive_org_name AS receiveOrgName,
fu.next_execute_user_ids AS nextExecuteUserIds,
fu.next_task_id AS nextTaskId,
fu.create_user_id AS createUserId,
fu.rec_date AS recDate,
fu.manage_type AS manageType,
fu.reg_type AS regType,
fu.is_delete,
fu.create_date,
fu.receive_company_code,
fu.use_unit_credit_code,
fu.transfer_to_user_ids,
fu.supervision_org_code,
fu.use_address AS fullAddress,
fu.cancel_reason AS cancelReason,
fu.project_contraption_id AS projectContraptionId,
COALESCE(GROUP_CONCAT(DISTINCT re.equ_id), '') AS equipId,
COALESCE(GROUP_CONCAT(DISTINCT other.supervisory_code), '') AS supervisoryCode,
COALESCE(GROUP_CONCAT(DISTINCT other.CODE96333), '') AS code96333,
COALESCE(GROUP_CONCAT(DISTINCT jri.PRODUCT_NAME), '') AS productName,
COALESCE(GROUP_CONCAT(DISTINCT jri.EQU_CODE), '') AS equCode,
COALESCE(GROUP_CONCAT(DISTINCT jri.EQU_LIST), '') AS equListCode,
COALESCE(GROUP_CONCAT(DISTINCT jri.EQU_CATEGORY), '') AS equCategoryCode,
COALESCE(GROUP_CONCAT(DISTINCT jri.EQU_DEFINE), '') AS equDefineCode,
COALESCE(GROUP_CONCAT(DISTINCT c_list.name), '') AS equListName,
COALESCE(GROUP_CONCAT(DISTINCT c_cate.name), '') AS equCategory,
COALESCE(GROUP_CONCAT(DISTINCT c_def.name), '') AS equDefine
FROM filtered_main_ids fm
JOIN tzs_jg_use_registration fu ON fm.sequence_nbr = fu.sequence_nbr
LEFT JOIN tzs_jg_use_registration_eq re ON fu.sequence_nbr = re.equip_transfer_id
LEFT JOIN idx_biz_jg_register_info jri ON re.equ_id = jri."RECORD"
LEFT JOIN idx_biz_jg_other_info other ON jri."RECORD" = other."RECORD"
LEFT JOIN tz_equipment_category c_list ON jri.EQU_LIST = c_list.code
LEFT JOIN tz_equipment_category c_cate ON jri.EQU_CATEGORY = c_cate.code
LEFT JOIN tz_equipment_category c_def ON jri.EQU_DEFINE = c_def.code
GROUP BY fu.sequence_nbr
ORDER BY
<choose>
<when test="sort != null and sort.field != null and sort.sortType != null">
<choose>
<when test="sort.field == 'create_date'">fu.create_date</when>
<when test="sort.field == 'apply_no'">fu.apply_no</when>
<when test="sort.field == 'reg_date'">fu.reg_date</when>
<when test="sort.field == 'audit_pass_date'">fu.audit_pass_date</when>
<otherwise>${sort.field}</otherwise>
</choose>
${sort.sortType}
</when>
<otherwise>
fu.create_date DESC, fu.apply_no DESC
</otherwise>
</choose>
LIMIT #{size} OFFSET #{offset}
</when>
<!-- 情况2:无设备过滤条件 -->
<otherwise>
WITH paginated_ids AS (
SELECT sequence_nbr
FROM tzs_jg_use_registration fu
WHERE fu.is_delete = '0'
<!-- 公共主表过滤条件 -->
<if test="dto.status != null and dto.status != ''">
AND fu.status = #{dto.status}
</if>
<if test="dto.applicationDate != null">
AND DATE(fu.create_date) = DATE(#{dto.applicationDate})
</if>
<if test="dto.fullAddress != null and dto.fullAddress != ''">
AND fu.use_address LIKE CONCAT('%', #{dto.fullAddress}, '%')
</if>
<if test="dto.useUnitName != null and dto.useUnitName != ''">
AND fu.use_unit_name LIKE CONCAT('%', #{dto.useUnitName}, '%')
</if>
<if test="dto.applyNo != null and dto.applyNo != ''">
AND fu.apply_no LIKE CONCAT(#{dto.applyNo}, '%')
</if>
<if test="dto.useRegistrationCode != null and dto.useRegistrationCode != ''">
AND fu.use_registration_code LIKE CONCAT(#{dto.useRegistrationCode}, '%')
</if>
<if test="dto.useUnitCode != null and dto.useUnitCode != ''">
AND fu.use_unit_credit_code = #{dto.useUnitCode}
</if>
<if test="dto.orgBranchCode != null and dto.orgBranchCode != ''">
<choose>
<when test="client == 'jgLook'">
AND fu.supervision_org_code LIKE CONCAT(#{dto.orgBranchCode}, '%')
</when>
<otherwise>
AND fu.supervision_org_code = #{dto.orgBranchCode}
</otherwise>
</choose>
</if>
<if test="dto.auditPassDateStart != null and dto.auditPassDateEnd != null">
AND fu.audit_pass_date BETWEEN #{dto.auditPassDateStart} AND #{dto.auditPassDateEnd}
</if>
<if test="dto.dataType == 'supervision' ">
<choose>
<when test="client == 'jgAudit'">
AND (fu.receive_company_code = #{dto.receiveCompanyCode}
OR fu.transfer_to_user_ids LIKE CONCAT('%', #{dto.currentUserId}, '%'))
</when>
<otherwise>
AND fu.supervision_org_code LIKE CONCAT(#{dto.supervisionOrgCode}, '%')
</otherwise>
</choose>
AND fu.status != '使用单位待提交'
</if>
<if test="dto.dataType == 'company' ">
AND (fu.use_unit_credit_code = #{dto.unitCode}
OR fu.transfer_to_user_ids LIKE CONCAT('%', #{dto.currentUserId}, '%'))
</if>
ORDER BY
<choose>
<when test="sort != null and sort.field != null and sort.sortType != null">
<choose>
<when test="sort.field == 'create_date'">fu.create_date</when>
<when test="sort.field == 'apply_no'">fu.apply_no</when>
<when test="sort.field == 'reg_date'">fu.reg_date</when>
<when test="sort.field == 'audit_pass_date'">fu.audit_pass_date</when>
<otherwise>${sort.field}</otherwise>
</choose>
${sort.sortType}
</when>
<otherwise>
fu.create_date DESC, fu.apply_no DESC
</otherwise>
</choose>
LIMIT #{size} OFFSET #{offset}
)
SELECT
fu.sequence_nbr AS sequenceNbr,
fu.audit_status AS auditStatus,
DATE_FORMAT(fu.reg_date,'%Y-%m-%d') AS regDate,
fu.use_unit_name AS useUnitName,
fu.supervision_org_code AS supervisionOrgCode,
fu.status,
fu.receive_org_name AS receiveOrgName,
fu.use_address AS place,
fu.instance_id AS instanceId,
fu.apply_no AS applyNo,
fu.next_execute_ids AS nextExecuteIds,
fu.promoter,
fu.use_registration_code AS useRegistrationCode,
DATE_FORMAT(fu.audit_pass_date,'%Y-%m-%d') AS auditPassDate,
DATE_FORMAT(fu.create_date,'%Y-%m-%d') AS createDate,
fu.receive_org_name AS receiveOrgName,
fu.next_execute_user_ids AS nextExecuteUserIds,
fu.next_task_id AS nextTaskId,
fu.create_user_id AS createUserId,
fu.rec_date AS recDate,
fu.manage_type AS manageType,
fu.reg_type AS regType,
fu.is_delete,
fu.create_date,
fu.receive_company_code,
fu.use_unit_credit_code,
fu.transfer_to_user_ids,
fu.supervision_org_code,
fu.use_address AS fullAddress,
fu.cancel_reason AS cancelReason,
fu.project_contraption_id AS projectContraptionId,
COALESCE(GROUP_CONCAT(DISTINCT re.equ_id), '') AS equipId,
COALESCE(GROUP_CONCAT(DISTINCT other.supervisory_code), '') AS supervisoryCode,
COALESCE(GROUP_CONCAT(DISTINCT other.CODE96333), '') AS code96333,
COALESCE(GROUP_CONCAT(DISTINCT jri.PRODUCT_NAME), '') AS productName,
COALESCE(GROUP_CONCAT(DISTINCT jri.EQU_CODE), '') AS equCode,
COALESCE(GROUP_CONCAT(DISTINCT jri.EQU_LIST), '') AS equListCode,
COALESCE(GROUP_CONCAT(DISTINCT jri.EQU_CATEGORY), '') AS equCategoryCode,
COALESCE(GROUP_CONCAT(DISTINCT jri.EQU_DEFINE), '') AS equDefineCode,
COALESCE(GROUP_CONCAT(DISTINCT c_list.name), '') AS equListName,
COALESCE(GROUP_CONCAT(DISTINCT c_cate.name), '') AS equCategory,
COALESCE(GROUP_CONCAT(DISTINCT c_def.name), '') AS equDefine
FROM paginated_ids pi
JOIN tzs_jg_use_registration fu ON pi.sequence_nbr = fu.sequence_nbr
LEFT JOIN tzs_jg_use_registration_eq re ON fu.sequence_nbr = re.equip_transfer_id
LEFT JOIN idx_biz_jg_register_info jri ON re.equ_id = jri."RECORD"
LEFT JOIN idx_biz_jg_other_info other ON jri."RECORD" = other."RECORD"
LEFT JOIN tz_equipment_category c_list ON jri.EQU_LIST = c_list.code
LEFT JOIN tz_equipment_category c_cate ON jri.EQU_CATEGORY = c_cate.code
LEFT JOIN tz_equipment_category c_def ON jri.EQU_DEFINE = c_def.code
GROUP BY fu.sequence_nbr
ORDER BY
<choose>
<when test="sort != null and sort.field != null and sort.sortType != null">
<choose>
<when test="sort.field == 'create_date'">fu.create_date</when>
<when test="sort.field == 'apply_no'">fu.apply_no</when>
<when test="sort.field == 'reg_date'">fu.reg_date</when>
<when test="sort.field == 'audit_pass_date'">fu.audit_pass_date</when>
<otherwise>${sort.field}</otherwise>
</choose>
${sort.sortType}
</when>
<otherwise>
fu.create_date DESC, fu.apply_no DESC
</otherwise>
</choose>
</otherwise>
</choose>
</select>
<select id="getListPage2" resultType="java.util.Map">
WITH filtered_ur AS ( WITH filtered_ur AS (
SELECT SELECT
sequence_nbr, sequence_nbr,
......
...@@ -33,11 +33,13 @@ ...@@ -33,11 +33,13 @@
<if test="problemModel.problemTypeCode != null and problemModel.problemTypeCode != ''"> <if test="problemModel.problemTypeCode != null and problemModel.problemTypeCode != ''">
and spt.problem_type_code = #{problemModel.problemTypeCode} and spt.problem_type_code = #{problemModel.problemTypeCode}
</if> </if>
<if test="problemModel.problemTimeStart != null"> <if test="problemModel.problemTimeRange != null and problemModel.problemTimeRange.beginDate != null">
and to_char(spt.problem_time, 'YYYY-MM-DD') <![CDATA[>=]]> to_char(#{problemModel.problemTimeStart}::timestamp, 'YYYY-MM-DD') and to_char(spt.problem_time, 'YYYY-MM-DD') <![CDATA[>=]]>
to_char(#{problemModel.problemTimeRange.beginDate}::timestamp, 'YYYY-MM-DD')
</if> </if>
<if test="problemModel.problemTimeEnd != null"> <if test="problemModel.problemTimeRange != null and problemModel.problemTimeRange.endDate != null">
and to_char(spt.problem_time, 'YYYY-MM-DD') <![CDATA[<=]]> to_char(#{problemModel.problemTimeEnd}::timestamp, 'YYYY-MM-DD') and to_char(spt.problem_time, 'YYYY-MM-DD') <![CDATA[<=]]>
to_char(#{problemModel.problemTimeRange.endDate}::timestamp, 'YYYY-MM-DD')
</if> </if>
<if test="problemModel.problemDesc != null and problemModel.problemDesc != ''"> <if test="problemModel.problemDesc != null and problemModel.problemDesc != ''">
and spt.problem_desc like CONCAT('%', #{problemModel.problemDesc}, '%') and spt.problem_desc like CONCAT('%', #{problemModel.problemDesc}, '%')
...@@ -61,7 +63,7 @@ ...@@ -61,7 +63,7 @@
and spt.problem_status_code = #{problemModel.hiddenDangersLevel} and spt.problem_status_code = #{problemModel.hiddenDangersLevel}
</if> </if>
<if test="problemModel.regionCode != null and problemModel.regionCode != ''"> <if test="problemModel.regionCode != null and problemModel.regionCode != ''">
and spt.region_code like CONCAT(#{problemModel.regionCode}, '%') and spt.region_code like CONCAT('%',#{problemModel.regionCode}, '%')
</if> </if>
<if test="problemModel.problemStatusCode != null and problemModel.problemStatusCode != ''"> <if test="problemModel.problemStatusCode != null and problemModel.problemStatusCode != ''">
and spt.problem_status_code = #{problemModel.problemStatusCode} and spt.problem_status_code = #{problemModel.problemStatusCode}
......
...@@ -15,6 +15,7 @@ import org.typroject.tyboot.core.restful.utils.ResponseModel; ...@@ -15,6 +15,7 @@ import org.typroject.tyboot.core.restful.utils.ResponseModel;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.io.IOException; import java.io.IOException;
import java.util.List;
/** /**
* 用于业务变更过程中历史数据处理的控制层 * 用于业务变更过程中历史数据处理的控制层
...@@ -273,9 +274,8 @@ public class DataHandlerController extends BaseController { ...@@ -273,9 +274,8 @@ public class DataHandlerController extends BaseController {
/** /**
* @apiNote 场车车牌号刷入ES
*
* @return * @return
* @apiNote 场车车牌号刷入ES
*/ */
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "PUT", value = "场车车牌号刷入ES", notes = "场车车牌号刷入ES") @ApiOperation(httpMethod = "PUT", value = "场车车牌号刷入ES", notes = "场车车牌号刷入ES")
...@@ -285,47 +285,43 @@ public class DataHandlerController extends BaseController { ...@@ -285,47 +285,43 @@ public class DataHandlerController extends BaseController {
} }
/** /**
* @apiNote 删除ES和数据库中状态≠已认领的设备
*
* @return * @return
* @apiNote 删除ES和数据库中状态≠已认领的设备
*/ */
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "PUT", value = "删除ES和数据库中状态≠已认领的设备(备份后谨慎操作,不可恢复)", notes = "删除ES和数据库中状态≠已认领的设备(备份后谨慎操作,不可恢复)") @ApiOperation(httpMethod = "PUT", value = "删除ES和数据库中状态≠已认领的设备(备份后谨慎操作,不可恢复)", notes = "删除ES和数据库中状态≠已认领的设备(备份后谨慎操作,不可恢复)")
@PutMapping(value = "/equip/deleteEquipWithStatusNotInClaimed") @PutMapping(value = "/equip/deleteEquipWithStatusNotInClaimed")
public ResponseModel<Integer> deleteEquipWithStatusNotInClaimed(@RequestParam(value = "indices",defaultValue = "idx_biz_view_jg_all") String indices, public ResponseModel<Integer> deleteEquipWithStatusNotInClaimed(@RequestParam(value = "indices", defaultValue = "idx_biz_view_jg_all") String indices,
@RequestParam(value = "isDelete",defaultValue = "false") boolean isDelete) throws InterruptedException { @RequestParam(value = "isDelete", defaultValue = "false") boolean isDelete) throws InterruptedException {
return ResponseHelper.buildResponse(dataHandlerService.deleteEquipWithStatusNotInClaimed(indices, isDelete)); return ResponseHelper.buildResponse(dataHandlerService.deleteEquipWithStatusNotInClaimed(indices, isDelete));
} }
/** /**
* @apiNote 删除数据库中状态≠已认领的设备
*
* @return * @return
* @apiNote 删除数据库中状态≠已认领的设备
*/ */
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "PUT", value = "删除数据库中状态≠已认领的设备", notes = "删除数据库中状态≠已认领的设备") @ApiOperation(httpMethod = "PUT", value = "删除数据库中状态≠已认领的设备", notes = "删除数据库中状态≠已认领的设备")
@PutMapping(value = "/equip/deleteEquipExistDB") @PutMapping(value = "/equip/deleteEquipExistDB")
public ResponseModel<Integer> deleteEquipExistDB(@RequestParam(value = "isDelete",defaultValue = "false") boolean isDelete) { public ResponseModel<Integer> deleteEquipExistDB(@RequestParam(value = "isDelete", defaultValue = "false") boolean isDelete) {
return ResponseHelper.buildResponse(dataHandlerService.deleteEquipExistDB(isDelete)); return ResponseHelper.buildResponse(dataHandlerService.deleteEquipExistDB(isDelete));
} }
/** /**
* @apiNote 修改SupervisionInfo中ORG_BRANCH_CODE=%50*X%的数据
*
* @return * @return
* @apiNote 修改SupervisionInfo中ORG_BRANCH_CODE=%50*X%的数据
*/ */
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "PUT", value = "修改SupervisionInfo中ORG_BRANCH_CODE=%50*X%的数据", notes = "修改SupervisionInfo中ORG_BRANCH_CODE=%50*X%的数据") @ApiOperation(httpMethod = "PUT", value = "修改SupervisionInfo中ORG_BRANCH_CODE=%50*X%的数据", notes = "修改SupervisionInfo中ORG_BRANCH_CODE=%50*X%的数据")
@PutMapping(value = "/equip/modifySupervisionOrgBranchCode") @PutMapping(value = "/equip/modifySupervisionOrgBranchCode")
public ResponseModel<Integer> modifySupervisionOrgBranchCode(@RequestParam(value = "isModify",defaultValue = "false") boolean isModify) { public ResponseModel<Integer> modifySupervisionOrgBranchCode(@RequestParam(value = "isModify", defaultValue = "false") boolean isModify) {
return ResponseHelper.buildResponse(dataHandlerService.modifySupervisionOrgBranchCode(isModify)); return ResponseHelper.buildResponse(dataHandlerService.modifySupervisionOrgBranchCode(isModify));
} }
/** /**
* @apiNote 删除导入管道未纳管的数据
*
* @return * @return
* @apiNote 删除导入管道未纳管的数据
*/ */
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "PUT", value = "删除导入管道未纳管的数据", notes = "删除导入管道未纳管的数据") @ApiOperation(httpMethod = "PUT", value = "删除导入管道未纳管的数据", notes = "删除导入管道未纳管的数据")
...@@ -336,4 +332,12 @@ public class DataHandlerController extends BaseController { ...@@ -336,4 +332,12 @@ public class DataHandlerController extends BaseController {
@RequestParam(value = "isDelete", defaultValue = "false") boolean isDelete) throws IOException { @RequestParam(value = "isDelete", defaultValue = "false") boolean isDelete) throws IOException {
return ResponseHelper.buildResponse(dataHandlerService.deleteImportedPipelineData(uscUnitCreditCode, projectContraption, dataSource, isDelete)); return ResponseHelper.buildResponse(dataHandlerService.deleteImportedPipelineData(uscUnitCreditCode, projectContraption, dataSource, isDelete));
} }
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@ApiOperation(httpMethod = "GET", value = "生成主键", notes = "生成主键")
@GetMapping(value = "/generateSeq")
public ResponseModel<List<Long>> generateSeq(@ApiParam(value = "生成的数量,默认10条", defaultValue = "10")
@RequestParam(value = "num", defaultValue = "10") String num) {
return ResponseHelper.buildResponse(dataHandlerService.generateSeq(num));
}
} }
\ No newline at end of file
...@@ -394,12 +394,11 @@ public class JgUseRegistrationController extends BaseController { ...@@ -394,12 +394,11 @@ public class JgUseRegistrationController extends BaseController {
} }
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "POST",value = "查询工程装置下的所有做过安装告知但是未做使用登记的管道",notes = "查询工程装置下的所有做过安装告知但是未做使用登记的管道") @ApiOperation(httpMethod = "POST", value = "查询工程装置下的所有做过安装告知但是未做使用登记的管道", notes = "查询工程装置下的所有做过安装告知但是未做使用登记的管道")
@PostMapping(value = "/getDeviceListByProjectContraptionSeq") @PostMapping(value = "/getDeviceListByProjectContraptionSeq")
public ResponseModel<Object> getDeviceListByProjectContraption(@RequestBody JSONObject map) { public ResponseModel<Object> getDeviceListByProjectContraption(@RequestBody JSONObject map) {
String projectContraptionSeq = map.getString("record"); String projectContraptionSeq = map.getString("record");
JSONArray idsArray = map.getJSONArray("originProjectContraptionIds"); String[] originProjectContraptionIds = Optional.ofNullable(map.getString("originProjectContraptionIds")).map(str -> str.split(",")).orElse(new String[0]);
String[] originProjectContraptionIds = idsArray.toArray(new String[0]);
return ResponseHelper.buildResponse(jgUseRegistrationServiceImpl.getDeviceListByProjectContraption(projectContraptionSeq, originProjectContraptionIds)); return ResponseHelper.buildResponse(jgUseRegistrationServiceImpl.getDeviceListByProjectContraption(projectContraptionSeq, originProjectContraptionIds));
} }
......
...@@ -69,6 +69,7 @@ import org.springframework.util.ObjectUtils; ...@@ -69,6 +69,7 @@ import org.springframework.util.ObjectUtils;
import org.springframework.util.StopWatch; import org.springframework.util.StopWatch;
import org.typroject.tyboot.core.foundation.context.RequestContext; import org.typroject.tyboot.core.foundation.context.RequestContext;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil; import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import java.io.IOException; import java.io.IOException;
import java.lang.reflect.Method; import java.lang.reflect.Method;
import java.math.BigDecimal; import java.math.BigDecimal;
...@@ -82,6 +83,7 @@ import java.util.concurrent.atomic.AtomicInteger; ...@@ -82,6 +83,7 @@ import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicReference; import java.util.concurrent.atomic.AtomicReference;
import java.util.function.Function; import java.util.function.Function;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import static com.alibaba.fastjson.JSON.toJSONString; import static com.alibaba.fastjson.JSON.toJSONString;
import static com.yeejoin.amos.boot.module.jg.biz.service.impl.JgInstallationNoticeServiceImpl.CONSTRUCTION_TYPE; import static com.yeejoin.amos.boot.module.jg.biz.service.impl.JgInstallationNoticeServiceImpl.CONSTRUCTION_TYPE;
import static com.yeejoin.amos.boot.module.jg.biz.service.impl.JgInstallationNoticeServiceImpl.CONSTRUCTION_TYPE_NAME; import static com.yeejoin.amos.boot.module.jg.biz.service.impl.JgInstallationNoticeServiceImpl.CONSTRUCTION_TYPE_NAME;
...@@ -2064,14 +2066,20 @@ public class DataHandlerServiceImpl { ...@@ -2064,14 +2066,20 @@ public class DataHandlerServiceImpl {
return map; return map;
} }
public Integer deleteImportedPipelineData(String uscUnitCreditCode, String projectContraption, String dataSource, boolean isDelete) throws IOException { public Integer deleteImportedPipelineData(String uscUnitCreditCode, String projectContraption,
String dataSource, boolean isDelete) throws IOException {
List<String> records = this.queryImportedPipelineRecords(uscUnitCreditCode, projectContraption, dataSource); List<String> records = this.queryImportedPipelineRecords(uscUnitCreditCode, projectContraption, dataSource);
if (records.isEmpty()) { if (records.isEmpty()) {
return 0; return 0;
} }
if (isDelete) { if (isDelete) {
superviseInfoMapper.deleteDataAll(records); int batchSize = 1000;
deleteFromEs(records); for (int i = 0; i < records.size(); i += batchSize) {
int end = Math.min(i + batchSize, records.size());
List<String> batch = records.subList(i, end);
superviseInfoMapper.deleteDataAll(batch);
deleteFromEs(batch);
}
} }
return records.size(); return records.size();
} }
...@@ -2132,4 +2140,12 @@ public class DataHandlerServiceImpl { ...@@ -2132,4 +2140,12 @@ public class DataHandlerServiceImpl {
return dto; return dto;
}).collect(Collectors.toList()); }).collect(Collectors.toList());
} }
public List<Long> generateSeq(String num) {
List<Long> result = new ArrayList<>();
for (long l = Long.parseLong(num); l > 0; l--) {
result.add(sequence.nextId());
}
return result;
}
} }
...@@ -135,9 +135,12 @@ public class JgMaintenanceContractServiceImpl extends BaseService<JgMaintenanceC ...@@ -135,9 +135,12 @@ public class JgMaintenanceContractServiceImpl extends BaseService<JgMaintenanceC
companyType = companyTypeMap.get("companyType").toString(); companyType = companyTypeMap.get("companyType").toString();
} }
if ("supervision".equals(companyLevel)) { if ("supervision".equals(companyLevel)) {
// 监管单位用"接收机构统一使用代码"匹配 // 监管单位查询
dto.setReceiveOrgCodeFilter(company.getCompanyCode()); if (client.equals("jgLook")) {
dto.setOrgBranchCode(company.getOrgCode()); dto.setOrgBranchCode(company.getOrgCode());
} else { // 接收机构查询
dto.setReceiveOrgCodeFilter(company.getCompanyCode());
}
} else if ("company".equals(companyLevel)) { } else if ("company".equals(companyLevel)) {
if (companyType.contains(CompanyTypeEnum.USE.getCode()) || companyType.contains(CompanyTypeEnum.INDIVIDUAL.getCode())) { if (companyType.contains(CompanyTypeEnum.USE.getCode()) || companyType.contains(CompanyTypeEnum.INDIVIDUAL.getCode())) {
// 使用单位用"使用单位统一信用代码"匹配数据 // 使用单位用"使用单位统一信用代码"匹配数据
......
...@@ -26,10 +26,7 @@ import org.springframework.stereotype.Service; ...@@ -26,10 +26,7 @@ import org.springframework.stereotype.Service;
import org.typroject.tyboot.component.emq.EmqKeeper; import org.typroject.tyboot.component.emq.EmqKeeper;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil; import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import java.util.Date; import java.util.*;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors; import java.util.stream.Collectors;
/** /**
* 安全追溯问题生成服务实现类 * 安全追溯问题生成服务实现类
...@@ -123,36 +120,110 @@ public class SafetyProblemTracingGenServiceImpl{ ...@@ -123,36 +120,110 @@ public class SafetyProblemTracingGenServiceImpl{
public void update3MaintenanceCheck() { public void update3MaintenanceCheck() {
logger.info("开始修正数据"); logger.info("开始修正数据");
List<String> oldAllRecords = idxBizJgOtherInfoService.getBaseMapper() Set<String> realOutOfMaintenanceRecord = commonMapper.queryOutOfMaintenanceRecord().stream().map(m -> m.get("RECORD").toString()).collect(Collectors.toSet());
.selectList(new LambdaQueryWrapper<IdxBizJgOtherInfo>() Set<String> realOutOfInspectRecord = commonMapper.queryOutOfInspectionRecord().stream().map(m -> m.get("RECORD").toString()).collect(Collectors.toSet());
.eq(IdxBizJgOtherInfo::getStatus, SafetyProblemStatusEnum.UNHANDLED.getCode())) // 需要修正业务表+es的数据
.stream() List<String> correctData = Lists.newArrayList();
.map(IdxBizJgOtherInfo::getRecord) // 1.处理维保超期错误数据
.collect(Collectors.toList()); List<String> outOfMaintenanceErrorData = handleOutOfMaintenanceErrorData(realOutOfMaintenanceRecord);
logger.info("总的旧数据条数:{}",oldAllRecords.size()); // 2.处理检验超期错误数据
List<Map<String, Object>> outOfMaintenanceRecords = commonMapper.queryOutOfMaintenanceRecord(); List<String> outOfInspectionErrorData = handleOutOfInspectionErrorData(realOutOfInspectRecord);
List<String> realRecordsMain = outOfMaintenanceRecords.stream().map(m -> m.get("RECORD").toString()).collect(Collectors.toList()); // 3.修正业务表+es数据状态
List<Map<String, Object>> outOfInspectionRecords = commonMapper.queryOutOfInspectionRecord(); if (ValidationUtil.isEmpty(outOfMaintenanceErrorData) && ValidationUtil.isEmpty(outOfInspectionErrorData)) {
List<String> realRecordsInsp = outOfInspectionRecords.stream().map(m -> m.get("RECORD").toString()).collect(Collectors.toList()); // 没有需要修正的数据
realRecordsMain.addAll(realRecordsInsp); return;
logger.info("正常数据条数:{}", realRecordsMain.size()); }
List<String> errorRecord = oldAllRecords.stream().filter(item -> !realRecordsMain.contains(item)).collect(Collectors.toList());
logger.info("异常数据条数---------------:{}",errorRecord.size()); Set<String> maintenanceSet = new HashSet<>(ValidationUtil.isEmpty(outOfMaintenanceErrorData) ? Collections.emptyList() : outOfMaintenanceErrorData);
Set<String> inspectionSet = new HashSet<>(ValidationUtil.isEmpty(outOfInspectionErrorData) ? Collections.emptyList() : outOfInspectionErrorData);
if (!maintenanceSet.isEmpty() && inspectionSet.isEmpty()) {
// 仅有维保备案错误数据
correctData.addAll(maintenanceSet);
} else if (maintenanceSet.isEmpty() && !inspectionSet.isEmpty()) {
// 仅有检验超期错误数据
correctData.addAll(inspectionSet);
} else if (!maintenanceSet.isEmpty()) {
// 再次查询维保备案这些数据有没有检验超期的问题
maintenanceSet.removeAll(realOutOfInspectRecord);
// 没有则可以愉快地更新设备状态为正常
correctData.addAll(maintenanceSet);
// 再次查询检验这些数据有没有维保超期问题
inspectionSet.retainAll(realOutOfMaintenanceRecord);
// 没有则可以愉快地更新设备状态为正常
correctData.addAll(inspectionSet);
}
idxBizJgOtherInfoService.lambdaUpdate().set(IdxBizJgOtherInfo::getStatus, null)
.in(IdxBizJgOtherInfo::getRecord, correctData).update();
Iterable<ESEquipmentCategoryDto> equipEsDtoIter = esEquipmentCategory.findAllById(correctData);
for (ESEquipmentCategoryDto equipEsDto : equipEsDtoIter) {
equipEsDto.setProblemStatus(null);
}
esEquipmentCategory.saveAll(equipEsDtoIter);
logger.info("修改正数据条数:{}", correctData.size());
}
private List<String> handleOutOfMaintenanceErrorData(Set<String> realOutOfMaintenanceRecord) {
// 设备表到今日维保超期设备realOutOfMaintenanceRecord
if (ValidationUtil.isEmpty(realOutOfMaintenanceRecord)) {
return Lists.newArrayList();
}
List<SafetyProblemTracing> problemList = safetyProblemTracingService.list(new LambdaQueryWrapper<SafetyProblemTracing>()
.select(SafetyProblemTracing::getSourceId)
.eq(SafetyProblemTracing::getProblemStatusCode, SafetyProblemStatusEnum.UNHANDLED.getCode())
.eq(SafetyProblemTracing::getProblemTypeCode, SafetyProblemTypeEnum.WBCQ.getProblemTypeCode())
.eq(SafetyProblemTracing::getIsDelete,Boolean.FALSE)
);
if (ValidationUtil.isEmpty(problemList)) {
return Lists.newArrayList();
}
// 追溯问题表中未处理的维保超期设备
List<String> outOfMaintenanceEquipIds = problemList.stream().map(SafetyProblemTracing::getSourceId).collect(Collectors.toList());
// 未超期但错误生成的维保超期设备
outOfMaintenanceEquipIds.removeIf(realOutOfMaintenanceRecord::contains);
if (ValidationUtil.isEmpty(outOfMaintenanceEquipIds)) {
return Lists.newArrayList();
}
safetyProblemTracingService.lambdaUpdate() safetyProblemTracingService.lambdaUpdate()
.set(SafetyProblemTracing::getProblemStatusCode, SafetyProblemStatusEnum.HANDLED.getCode()) .set(SafetyProblemTracing::getProblemStatusCode, SafetyProblemStatusEnum.HANDLED.getCode())
.set(SafetyProblemTracing::getProblemStatus, SafetyProblemStatusEnum.HANDLED.getName()) .set(SafetyProblemTracing::getProblemStatus, SafetyProblemStatusEnum.HANDLED.getName())
.in(SafetyProblemTracing::getSourceId, errorRecord) .in(SafetyProblemTracing::getSourceId, outOfMaintenanceEquipIds)
.eq(SafetyProblemTracing::getProblemTypeCode, SafetyProblemTypeEnum.WBCQ.getProblemTypeCode()) .eq(SafetyProblemTracing::getProblemTypeCode, SafetyProblemTypeEnum.WBCQ.getProblemTypeCode())
.eq(SafetyProblemTracing::getIsDelete,Boolean.FALSE) .eq(SafetyProblemTracing::getIsDelete,Boolean.FALSE)
.update(); .update();
idxBizJgOtherInfoService.lambdaUpdate().set(IdxBizJgOtherInfo::getStatus, null) return outOfMaintenanceEquipIds;
.in(IdxBizJgOtherInfo::getRecord, errorRecord).update(); }
Iterable<ESEquipmentCategoryDto> equipEsDtoIter = esEquipmentCategory.findAllById(errorRecord);
for (ESEquipmentCategoryDto equipEsDto : equipEsDtoIter) { private List<String> handleOutOfInspectionErrorData(Set<String> realOutOfInspectRecord) {
equipEsDto.setProblemStatus(null); // 设备表到今日检验超期设备realOutOfInspectRecord
if (ValidationUtil.isEmpty(realOutOfInspectRecord)) {
return Lists.newArrayList();
} }
esEquipmentCategory.saveAll(equipEsDtoIter); List<SafetyProblemTracing> problemList = safetyProblemTracingService.list(new LambdaQueryWrapper<SafetyProblemTracing>()
logger.info("修改正数据条数:{}",errorRecord.size()); .select(SafetyProblemTracing::getSourceId)
.eq(SafetyProblemTracing::getProblemStatusCode, SafetyProblemStatusEnum.UNHANDLED.getCode())
.eq(SafetyProblemTracing::getProblemTypeCode, SafetyProblemTypeEnum.JYCQ.getProblemTypeCode())
.eq(SafetyProblemTracing::getIsDelete,Boolean.FALSE)
);
if (ValidationUtil.isEmpty(problemList)) {
return Lists.newArrayList();
}
// 追溯问题表中未处理的检验超期设备
List<String> outOfInspectionEquipIds = problemList.stream().map(SafetyProblemTracing::getSourceId).collect(Collectors.toList());
// 未超期但错误生成的检验超期设备
outOfInspectionEquipIds.removeIf(realOutOfInspectRecord::contains);
if (ValidationUtil.isEmpty(outOfInspectionEquipIds)) {
return Lists.newArrayList();
}
safetyProblemTracingService.lambdaUpdate()
.set(SafetyProblemTracing::getProblemStatusCode, SafetyProblemStatusEnum.HANDLED.getCode())
.set(SafetyProblemTracing::getProblemStatus, SafetyProblemStatusEnum.HANDLED.getName())
.in(SafetyProblemTracing::getSourceId, outOfInspectionEquipIds)
.eq(SafetyProblemTracing::getProblemTypeCode, SafetyProblemTypeEnum.JYCQ.getProblemTypeCode())
.eq(SafetyProblemTracing::getIsDelete,Boolean.FALSE)
.update();
return outOfInspectionEquipIds;
} }
private void updateEquipAndSendMessage(List<Map<String, Object>> mapList, SafetyProblemTypeEnum safetyProblemTypeEnum) { private void updateEquipAndSendMessage(List<Map<String, Object>> mapList, SafetyProblemTypeEnum safetyProblemTypeEnum) {
......
...@@ -1688,7 +1688,9 @@ public class JyjcInspectionApplicationServiceImpl extends BaseService<JyjcInspec ...@@ -1688,7 +1688,9 @@ public class JyjcInspectionApplicationServiceImpl extends BaseService<JyjcInspec
wrapper.eq(StringUtils.isNotBlank(projectContraption), IdxBizJgProjectContraption::getProjectContraption, projectContraption); wrapper.eq(StringUtils.isNotBlank(projectContraption), IdxBizJgProjectContraption::getProjectContraption, projectContraption);
wrapper.eq(IdxBizJgProjectContraption::getIsFirstMerge, false); wrapper.eq(IdxBizJgProjectContraption::getIsFirstMerge, false);
wrapper.isNull(IdxBizJgProjectContraption::getProjectContraptionParentId); wrapper.isNull(IdxBizJgProjectContraption::getProjectContraptionParentId);
wrapper.last("and (length(use_registration_code) = 0 or use_registration_code is null) order by rec_date desc"); wrapper.isNotNull(IdxBizJgProjectContraption::getUseRegistrationCode);
wrapper.ne(IdxBizJgProjectContraption::getUseRegistrationCode, "");
wrapper.last("order by create_date desc");
IPage<IdxBizJgProjectContraption> projectContraptionPage = jgProjectContraptionMapper.selectPage(page, wrapper); IPage<IdxBizJgProjectContraption> projectContraptionPage = jgProjectContraptionMapper.selectPage(page, wrapper);
projectContraptionPage.getRecords().forEach(pro -> pro.setDataQualityScore(commonService.castDataQualityScore2Name(pro.getDataQualityScore(), pro.getIsIntoManagement()))); projectContraptionPage.getRecords().forEach(pro -> pro.setDataQualityScore(commonService.castDataQualityScore2Name(pro.getDataQualityScore(), pro.getIsIntoManagement())));
return projectContraptionPage; return projectContraptionPage;
......
...@@ -158,6 +158,13 @@ ...@@ -158,6 +158,13 @@
<if test="paramDto.phone != null and paramDto.phone != ''"> <if test="paramDto.phone != null and paramDto.phone != ''">
AND tui.phone LIKE concat ( '%', #{paramDto.phone}, '%' ) AND tui.phone LIKE concat ( '%', #{paramDto.phone}, '%' )
</if> </if>
<if test="paramDto.superviseOrgCode!=null and paramDto.superviseOrgCode!='' ">
AND bei.supervise_org_code LIKE CONCAT('%',#{paramDto.superviseOrgCode},'%')
</if>
<if test="paramDto.regionStr!=null and paramDto.regionStr!='' ">
AND CONCAT_WS('/', bei.province,bei.city,bei.district) LIKE CONCAT('%',#{paramDto.regionStr},'%')
</if>
order by tui.create_date desc
</select> </select>
<select id="count" resultType="java.lang.Integer"> <select id="count" resultType="java.lang.Integer">
select count(1) from idx_biz_jg_other_info where INFORMATION_SITUATION NOTNULL select count(1) from idx_biz_jg_other_info where INFORMATION_SITUATION NOTNULL
......
...@@ -45,6 +45,14 @@ public class StCommonController extends BaseController { ...@@ -45,6 +45,14 @@ public class StCommonController extends BaseController {
return ResponseHelper.buildResponse(regionList); return ResponseHelper.buildResponse(regionList);
} }
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/4level/region-tree")
@ApiOperation(httpMethod = "GET", value = "获取用户regionCode", notes = "获取用户regionCode")
public ResponseModel<List<RegionModel>> getReginTreeFor4Level(@RequestParam(value = "regionCode") Integer regionCode) {
List<RegionModel> regionList = commonService.getReginTreeFor4Level(regionCode);
return ResponseHelper.buildResponse(regionList);
}
/** /**
* 获取设备类型 * 获取设备类型
* @return Map * @return Map
......
...@@ -112,6 +112,10 @@ public class EnterpriseBizServiceImpl { ...@@ -112,6 +112,10 @@ public class EnterpriseBizServiceImpl {
} }
} }
} }
if (!StringUtils.isEmpty(tzBaseEnterpriseInfoDto.getRegion())) {
String region = tzBaseEnterpriseInfoDto.getRegion();
tzBaseEnterpriseInfoDto.setRegion(region.replace(",", "/"));
}
IPage<TzBaseEnterpriseInfoDto> tzBaseEnterpriseInfoDtoIPage = enterpriseBizMapper.pageList2(page, tzBaseEnterpriseInfoDto, orgCodeList, unitTypeList); IPage<TzBaseEnterpriseInfoDto> tzBaseEnterpriseInfoDtoIPage = enterpriseBizMapper.pageList2(page, tzBaseEnterpriseInfoDto, orgCodeList, unitTypeList);
if (ValidationUtil.isEmpty(tzBaseEnterpriseInfoDtoIPage.getRecords())) { if (ValidationUtil.isEmpty(tzBaseEnterpriseInfoDtoIPage.getRecords())) {
logger.info("查询到的数据为空"); logger.info("查询到的数据为空");
......
...@@ -355,7 +355,7 @@ public class EquipmentStaticsServiceImpl { ...@@ -355,7 +355,7 @@ public class EquipmentStaticsServiceImpl {
* 所属地区 * 所属地区
*/ */
if (StringUtils.isNotEmpty(dpFilterParamForDetailDto.getUsePlace())) { if (StringUtils.isNotEmpty(dpFilterParamForDetailDto.getUsePlace())) {
boolMust.must(QueryBuilders.wildcardQuery("USE_PLACE", "*" + dpFilterParamForDetailDto.getUsePlace() + "*")); boolMust.must(QueryBuilders.wildcardQuery("USE_PLACE", "*" + dpFilterParamForDetailDto.getUsePlace().replace(",", "/") + "*"));
} }
/** /**
* 设备状态 * 设备状态
......
...@@ -8,9 +8,10 @@ import com.yeejoin.amos.boot.biz.common.dto.CountDto; ...@@ -8,9 +8,10 @@ import com.yeejoin.amos.boot.biz.common.dto.CountDto;
import com.yeejoin.amos.boot.module.common.api.constant.TZSCommonConstant; import com.yeejoin.amos.boot.module.common.api.constant.TZSCommonConstant;
import com.yeejoin.amos.boot.module.common.api.dto.DPFilterParamDto; import com.yeejoin.amos.boot.module.common.api.dto.DPFilterParamDto;
import com.yeejoin.amos.boot.module.common.api.dto.DPFilterParamForDetailDto; import com.yeejoin.amos.boot.module.common.api.dto.DPFilterParamForDetailDto;
import com.yeejoin.amos.boot.module.common.api.enums.ReginStepEnum;
import com.yeejoin.amos.boot.module.common.api.enums.CylinderTypeEnum; import com.yeejoin.amos.boot.module.common.api.enums.CylinderTypeEnum;
import com.yeejoin.amos.boot.module.common.api.enums.ReginStepEnum;
import com.yeejoin.amos.boot.module.jg.api.enums.DPMapStatisticsItemEnum; import com.yeejoin.amos.boot.module.jg.api.enums.DPMapStatisticsItemEnum;
import com.yeejoin.amos.boot.module.statistics.api.enums.StatisticalAnalysisEnum;
import com.yeejoin.amos.boot.module.statistics.api.mapper.CommonBaseMapper; import com.yeejoin.amos.boot.module.statistics.api.mapper.CommonBaseMapper;
import com.yeejoin.amos.boot.module.statistics.api.mapper.ZLStatisticsMapper; import com.yeejoin.amos.boot.module.statistics.api.mapper.ZLStatisticsMapper;
import com.yeejoin.amos.boot.module.statistics.api.vo.EquCategoryVo; import com.yeejoin.amos.boot.module.statistics.api.vo.EquCategoryVo;
...@@ -216,7 +217,7 @@ public class StCommonServiceImpl { ...@@ -216,7 +217,7 @@ public class StCommonServiceImpl {
long num = 0; long num = 0;
CountRequest request = new CountRequest(); CountRequest request = new CountRequest();
//request.indices("idx_biz_view_jg_all"); //request.indices("idx_biz_view_jg_all");
request.indices("idx_biz_equipment_info"); request.indices(StatisticalAnalysisEnum.equip.getKey());
BoolQueryBuilder boolMust = QueryBuilders.boolQuery(); BoolQueryBuilder boolMust = QueryBuilders.boolQuery();
if (isOrgBranchCodeExactMatch) { if (isOrgBranchCodeExactMatch) {
// 按照管辖机构区域信息精确查询 // 按照管辖机构区域信息精确查询
...@@ -254,7 +255,7 @@ public class StCommonServiceImpl { ...@@ -254,7 +255,7 @@ public class StCommonServiceImpl {
public long staticsCenterMapCountDataForEquip(Map<String, Object> result, long cylinderNum, String orgCode, Boolean supervisoryFlag, Boolean isMatchSupervisoryCode, Boolean isOrgBranchCodeExactMatch) { public long staticsCenterMapCountDataForEquip(Map<String, Object> result, long cylinderNum, String orgCode, Boolean supervisoryFlag, Boolean isMatchSupervisoryCode, Boolean isOrgBranchCodeExactMatch) {
SearchRequest request = new SearchRequest(); SearchRequest request = new SearchRequest();
// request.indices("idx_biz_view_jg_all"); // request.indices("idx_biz_view_jg_all");
request.indices("idx_biz_equipment_info"); request.indices(StatisticalAnalysisEnum.equip.getKey());
BoolQueryBuilder boolMust = QueryBuilders.boolQuery(); BoolQueryBuilder boolMust = QueryBuilders.boolQuery();
if (isOrgBranchCodeExactMatch) { if (isOrgBranchCodeExactMatch) {
// 按照管辖机构区域信息精确查询 // 按照管辖机构区域信息精确查询
...@@ -433,6 +434,10 @@ public class StCommonServiceImpl { ...@@ -433,6 +434,10 @@ public class StCommonServiceImpl {
return buildTree(regionModels.stream().filter(r-> Integer.parseInt(StringUtils.trim(r.getLevel())) <=3).collect(Collectors.toList()), r->r.getRegionCode().equals(regionCode)); return buildTree(regionModels.stream().filter(r-> Integer.parseInt(StringUtils.trim(r.getLevel())) <=3).collect(Collectors.toList()), r->r.getRegionCode().equals(regionCode));
} }
public List<RegionModel> getReginTreeFor4Level(Integer regionCode) {
return buildTree(regionModels.stream().filter(r -> Integer.parseInt(StringUtils.trim(r.getLevel())) <= 4).collect(Collectors.toList()), r -> r.getRegionCode().equals(regionCode));
}
public List<RegionModel> buildTree(List<RegionModel> regions, public List<RegionModel> buildTree(List<RegionModel> regions,
Predicate<RegionModel> rootCondition) { Predicate<RegionModel> rootCondition) {
// 防御性拷贝避免修改原始数据 // 防御性拷贝避免修改原始数据
......
...@@ -22,6 +22,7 @@ import com.yeejoin.amos.boot.module.common.api.enums.UserPostEnum; ...@@ -22,6 +22,7 @@ import com.yeejoin.amos.boot.module.common.api.enums.UserPostEnum;
import com.yeejoin.amos.boot.module.statistcs.biz.utils.JsonUtils; import com.yeejoin.amos.boot.module.statistcs.biz.utils.JsonUtils;
import com.yeejoin.amos.boot.module.statistcs.biz.utils.QueryBuilderUtils; import com.yeejoin.amos.boot.module.statistcs.biz.utils.QueryBuilderUtils;
import com.yeejoin.amos.boot.module.statistics.api.enums.InformationManageTypeEnum; import com.yeejoin.amos.boot.module.statistics.api.enums.InformationManageTypeEnum;
import com.yeejoin.amos.boot.module.statistics.api.enums.StatisticalAnalysisEnum;
import com.yeejoin.amos.boot.module.statistics.api.feign.TzsServiceFeignClient; import com.yeejoin.amos.boot.module.statistics.api.feign.TzsServiceFeignClient;
import com.yeejoin.amos.boot.module.statistics.api.mapper.AlertStatisticsMapper; import com.yeejoin.amos.boot.module.statistics.api.mapper.AlertStatisticsMapper;
import com.yeejoin.amos.boot.module.statistics.api.mapper.TzsCustomFilterMapper; import com.yeejoin.amos.boot.module.statistics.api.mapper.TzsCustomFilterMapper;
...@@ -33,6 +34,9 @@ import com.yeejoin.amos.boot.module.ymt.api.entity.IdxBizJgOtherInfo; ...@@ -33,6 +34,9 @@ import com.yeejoin.amos.boot.module.ymt.api.entity.IdxBizJgOtherInfo;
import com.yeejoin.amos.boot.module.ymt.api.enums.EquimentEnum; import com.yeejoin.amos.boot.module.ymt.api.enums.EquimentEnum;
import com.yeejoin.amos.boot.module.ymt.api.enums.EquipmentClassifityEnum; import com.yeejoin.amos.boot.module.ymt.api.enums.EquipmentClassifityEnum;
import com.yeejoin.amos.boot.module.ymt.api.mapper.EquipmentCategoryMapper; import com.yeejoin.amos.boot.module.ymt.api.mapper.EquipmentCategoryMapper;
import com.yeejoin.amos.component.feign.model.FeignClientResult;
import com.yeejoin.amos.feign.privilege.Privilege;
import com.yeejoin.amos.feign.privilege.model.CompanyModel;
import com.yeejoin.amos.feign.systemctl.model.RegionModel; import com.yeejoin.amos.feign.systemctl.model.RegionModel;
import org.apache.commons.compress.utils.Lists; import org.apache.commons.compress.utils.Lists;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
...@@ -88,7 +92,7 @@ public class ZLDPStatisticsServiceImpl { ...@@ -88,7 +92,7 @@ public class ZLDPStatisticsServiceImpl {
private final EquipmentCategoryMapper equipmentCategoryMapper; private final EquipmentCategoryMapper equipmentCategoryMapper;
@Autowired @Autowired
private TzsCustomFilterMapper tzsCustomFilterMapper; private TzsCustomFilterMapper tzsCustomFilterMapper;
// 设备纳管 纳管:true 未纳管:false // 设备纳管 纳管:true 未纳管:false
public static final String IS_INTO_MANAGEMENT = "IS_INTO_MANAGEMENT"; public static final String IS_INTO_MANAGEMENT = "IS_INTO_MANAGEMENT";
...@@ -862,7 +866,7 @@ public class ZLDPStatisticsServiceImpl { ...@@ -862,7 +866,7 @@ public class ZLDPStatisticsServiceImpl {
Page<JSONObject> result = new Page<>(map.getInteger("number"), map.getInteger("size")); Page<JSONObject> result = new Page<>(map.getInteger("number"), map.getInteger("size"));
SearchRequest request = new SearchRequest(); SearchRequest request = new SearchRequest();
// request.indices("idx_biz_view_jg_all"); // request.indices("idx_biz_view_jg_all");
request.indices("idx_biz_equipment_info"); request.indices(StatisticalAnalysisEnum.equip.getKey());
SearchSourceBuilder builder = new SearchSourceBuilder(); SearchSourceBuilder builder = new SearchSourceBuilder();
builder.trackTotalHits(true); builder.trackTotalHits(true);
BoolQueryBuilder boolMust = QueryBuilders.boolQuery(); BoolQueryBuilder boolMust = QueryBuilders.boolQuery();
...@@ -877,7 +881,7 @@ public class ZLDPStatisticsServiceImpl { ...@@ -877,7 +881,7 @@ public class ZLDPStatisticsServiceImpl {
if (!ObjectUtils.isEmpty(map.getString("USE_PLACE"))) { if (!ObjectUtils.isEmpty(map.getString("USE_PLACE"))) {
BoolQueryBuilder query = QueryBuilders.boolQuery(); BoolQueryBuilder query = QueryBuilders.boolQuery();
String test = QueryParser.escape(map.getString("USE_PLACE")); String test = QueryParser.escape(map.getString("USE_PLACE"));
test = test.replace(",","/"); test = test.replace(",", "/");
query.must(QueryBuilders.wildcardQuery("USE_PLACE", "*" + test + "*")); query.must(QueryBuilders.wildcardQuery("USE_PLACE", "*" + test + "*"));
boolMust.must(query); boolMust.must(query);
} }
...@@ -891,6 +895,11 @@ public class ZLDPStatisticsServiceImpl { ...@@ -891,6 +895,11 @@ public class ZLDPStatisticsServiceImpl {
boolMust.must(QueryBuilders.prefixQuery("ORG_BRANCH_CODE", map.getString("ORG_BRANCH_CODE"))); boolMust.must(QueryBuilders.prefixQuery("ORG_BRANCH_CODE", map.getString("ORG_BRANCH_CODE")));
} }
if (!ObjectUtils.isEmpty(map.getString("USE_PLACE_CODE"))) {
String USE_PLACE_CODE = QueryParser.escape(map.getString("USE_PLACE_CODE").replace(",", "#"));
boolMust.must(QueryBuilders.boolQuery().must(QueryBuilders.wildcardQuery("USE_PLACE_CODE", "*" + USE_PLACE_CODE + "*")));
}
if (!ObjectUtils.isEmpty(map.getString("superviseUnitName"))) { if (!ObjectUtils.isEmpty(map.getString("superviseUnitName"))) {
BoolQueryBuilder query = QueryBuilders.boolQuery(); BoolQueryBuilder query = QueryBuilders.boolQuery();
String test = QueryParser.escape(map.getString("superviseUnitName")); String test = QueryParser.escape(map.getString("superviseUnitName"));
...@@ -1175,6 +1184,19 @@ public class ZLDPStatisticsServiceImpl { ...@@ -1175,6 +1184,19 @@ public class ZLDPStatisticsServiceImpl {
if(StringUtils.isEmpty(orgCode)){ if(StringUtils.isEmpty(orgCode)){
return new Page<>(); return new Page<>();
} }
if (paramDto.getSuperviseKey() != null) {
if (paramDto.getSuperviseKey().contains("_")) {
paramDto.setSuperviseOrgCode(stCommonService.getAndSetOrgCode(paramDto.getSuperviseKey().split("_")[0]));
} else {
FeignClientResult<CompanyModel> result = Privilege.companyClient.seleteOne(Long.valueOf(paramDto.getSuperviseKey()));
if (result.getResult() != null) {
paramDto.setSuperviseOrgCode(result.getResult().getOrgCode());
}
}
}
if (!ObjectUtils.isEmpty(paramDto.getRegion())) {
paramDto.setRegionStr(String.join("/", paramDto.getRegion()));
}
List<String> unitTypeList = UnitTypeEnum.getNameListByType(paramDto.getCompanyType()); List<String> unitTypeList = UnitTypeEnum.getNameListByType(paramDto.getCompanyType());
Page<Map<String, Object>> result = screenMapper.getPersonPage(page, paramDto, orgCode, unitTypeList); Page<Map<String, Object>> result = screenMapper.getPersonPage(page, paramDto, orgCode, unitTypeList);
List<EquipmentCategoryDto> equipmentCategoryDtos = equipmentCategoryMapper.selectClassify(); List<EquipmentCategoryDto> equipmentCategoryDtos = equipmentCategoryMapper.selectClassify();
......
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