Commit 7f65dd8c authored by 刘林's avatar 刘林

Merge remote-tracking branch 'origin/develop_tzs_register_to_0715' into…

Merge remote-tracking branch 'origin/develop_tzs_register_to_0715' into develop_tzs_register_to_0715
parents 6d671b7a d7633dd2
package com.yeejoin.amos.boot.module.jg.api.mapper; package com.yeejoin.amos.boot.module.jg.api.mapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.module.jg.api.dto.CompanyEquipCountDto;
import com.yeejoin.amos.boot.module.jg.api.dto.JgChangeRegistrationNameDto; import com.yeejoin.amos.boot.module.jg.api.dto.JgChangeRegistrationNameDto;
import com.yeejoin.amos.boot.module.jg.api.entity.JgChangeRegistrationName; import com.yeejoin.amos.boot.module.jg.api.entity.JgChangeRegistrationName;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
...@@ -30,4 +31,6 @@ public interface JgChangeRegistrationNameMapper extends BaseMapper<JgChangeRegis ...@@ -30,4 +31,6 @@ public interface JgChangeRegistrationNameMapper extends BaseMapper<JgChangeRegis
@Param("roleIds") List<String> roleIds, @Param("roleIds") List<String> roleIds,
@Param("companyCode") String companyCode, @Param("companyCode") String companyCode,
@Param("currentUserId") String exeUserId); @Param("currentUserId") String exeUserId);
List<CompanyEquipCountDto> queryForFlowingEquipList();
} }
...@@ -16,6 +16,13 @@ public interface IEquipUsedCheck { ...@@ -16,6 +16,13 @@ public interface IEquipUsedCheck {
void equipRepeatUsedCheck(String record, String companyCode); void equipRepeatUsedCheck(String record, String companyCode);
/** /**
* 并发校验(页面同时提交或者页面同时打开多个时,某些使用登记证都是为使用状态)校验使用登记证流程在用状态及更新不在用为再使用状态
* @param record 设备唯一标识
* @param companyCode 登录人的公司代码
*/
void registrationRepeatUsedCheck(String record, String companyCode);
/**
* 删除流程中的数据,释放redis空间(异常处理及驳回到发起节点、撤回到发起节点、完成时时进行) * 删除流程中的数据,释放redis空间(异常处理及驳回到发起节点、撤回到发起节点、完成时时进行)
* @param records 设备唯一标识 * @param records 设备唯一标识
* @param companyCode 登录人的公司代码 * @param companyCode 登录人的公司代码
......
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yeejoin.amos.boot.module.jg.api.mapper.JgChangeRegistrationNameMapper"> <mapper namespace="com.yeejoin.amos.boot.module.jg.api.mapper.JgChangeRegistrationNameMapper">
<select id="getEquipInfoByOrgCode" resultType="java.util.Map">
<select id="getEquipInfoByOrgCode" resultType="java.util.Map"> SELECT u.RECORD AS equipId,
SELECT o.SUPERVISORY_CODE AS supervisoryCode,
u.RECORD AS equipId, b.USE_ORG_CODE AS useOrgCode
o.SUPERVISORY_CODE AS supervisoryCode, FROM idx_biz_jg_use_info u
b.USE_ORG_CODE AS useOrgCode LEFT JOIN idx_biz_jg_register_info b ON u.RECORD = b.RECORD
FROM LEFT JOIN idx_biz_jg_other_info o ON u.RECORD = o.RECORD
idx_biz_jg_use_info u WHERE USE_UNIT_CREDIT_CODE = #{code}
LEFT JOIN idx_biz_jg_register_info b ON u.RECORD = b.RECORD
LEFT JOIN idx_biz_jg_other_info o ON u.RECORD = o.RECORD
WHERE
USE_UNIT_CREDIT_CODE = #{code}
</select> </select>
<delete id="deleteByChangeRegistrationId"> <delete id="deleteByChangeRegistrationId">
delete from tzs_jg_change_registration_name_eq where name_change_registration_id = #{changeRegistrationId} delete
from tzs_jg_change_registration_name_eq
where name_change_registration_id = #{changeRegistrationId}
</delete> </delete>
<select id="getListPage" resultType="java.util.Map"> <select id="getListPage" resultType="java.util.Map">
select ur.sequence_nbr as sequenceNbr, select ur.sequence_nbr as sequenceNbr,
ur.instance_id as instanceId, ur.instance_id as instanceId,
ur.audit_status as auditStatus, ur.audit_status as auditStatus,
ur.apply_no as applyNo, ur.apply_no as applyNo,
DATE_FORMAT(ur.rec_date,'%Y-%m-%d') as recDate, DATE_FORMAT(ur.rec_date,'%Y-%m-%d') as recDate,
DATE_FORMAT(ur.create_date,'%Y-%m-%d') as createDate, DATE_FORMAT(ur.create_date,'%Y-%m-%d') as createDate,
DATE_FORMAT(ur.audit_pass_date,'%Y-%m-%d') as auditPassDate, DATE_FORMAT(ur.audit_pass_date,'%Y-%m-%d') as auditPassDate,
ur.receive_org_code as receiveOrgCode, ur.receive_org_code as receiveOrgCode,
ur.receive_org_name as receiveOrgName, ur.receive_org_name as receiveOrgName,
ur.receive_company_code as receiveCompanyCode, ur.receive_company_code as receiveCompanyCode,
ur.use_unit_name as useUnitName, ur.use_unit_name as useUnitName,
ur.new_use_unit_name AS newUseUnitName, ur.new_use_unit_name AS newUseUnitName,
ur.promoter, ur.promoter,
ur.create_user_id as createUserId, ur.create_user_id as createUserId,
ur.next_executor_ids as nextExecutorIds, ur.next_executor_ids as nextExecutorIds,
ur.next_execute_user_ids as nextExecuteUserIds, ur.next_execute_user_ids as nextExecuteUserIds,
ur.next_task_id as nextTaskId, ur.next_task_id as nextTaskId,
(SELECT group_concat(use_registration_code) from tzs_jg_use_registration_manage where sequence_nbr in (SELECT (SELECT group_concat(use_registration_code) from tzs_jg_use_registration_manage where sequence_nbr in (SELECT
certificate_seq from tzs_jg_change_registration_name_eq where name_change_registration_id = ur.sequence_nbr)) as certificateCodes certificate_seq from tzs_jg_change_registration_name_eq where name_change_registration_id = ur.sequence_nbr)) as
from tzs_jg_change_registration_name ur certificateCodes
<where> from tzs_jg_change_registration_name ur
and ur.is_delete = 0 <where>
<if test="dto.auditStatus != null and dto.auditStatus != ''"> and ur.is_delete = 0
and ur.audit_status = #{dto.auditStatus} <if test="dto.auditStatus != null and dto.auditStatus != ''">
</if> and ur.audit_status = #{dto.auditStatus}
<if test="dto.useUnitName != null and dto.useUnitName != ''"> </if>
and ur.use_unit_name like concat('%',#{dto.useUnitName}, '%') <if test="dto.useUnitName != null and dto.useUnitName != ''">
</if> and ur.use_unit_name like concat('%',#{dto.useUnitName}, '%')
<if test="dto.newUseUnitName != null and dto.newUseUnitName != ''"> </if>
and ur.new_use_unit_name like concat('%',#{dto.newUseUnitName}, '%') <if test="dto.newUseUnitName != null and dto.newUseUnitName != ''">
</if> and ur.new_use_unit_name like concat('%',#{dto.newUseUnitName}, '%')
<if test="dto.applyNo != null and dto.applyNo != ''"> </if>
and ur.apply_no like concat('%',#{dto.applyNo},'%') <if test="dto.applyNo != null and dto.applyNo != ''">
</if> and ur.apply_no like concat('%',#{dto.applyNo},'%')
<if test="dto.applicationDate != null"> </if>
AND ur.create_date like concat('%',DATE_FORMAT(#{dto.applicationDate},'%Y-%m-%d'),'%') <if test="dto.applicationDate != null">
AND ur.create_date like concat('%',DATE_FORMAT(#{dto.applicationDate},'%Y-%m-%d'),'%')
</if>
<if test="dto.receiveOrgCode != null and dto.receiveOrgCode != ''">
AND ur.receive_org_code = #{dto.receiveOrgCode}
</if>
<if test="roleIds != null and dto.type == 'supervision'">
<foreach collection='roleIds' item='role' open='and (' close=')' separator='or'>
ur.instance_status like concat('%',#{role},'%')
</foreach>
</if>
<if test="dto.type == 'supervision'">
AND (ur.receive_company_code = #{companyCode} or ur.transfer_to_user_ids LIKE concat ('%',
#{currentUserId}, '%'))
AND ur.instance_id is not null
</if>
<if test="dto.type == 'company'">
and (ur.use_unit_credit_code = #{dto.useUnitCreditCode} or ur.transfer_to_user_ids LIKE concat ('%',
#{currentUserId}, '%'))
</if>
</where>
order by
<if test="sort != null">
ur.${sort.field} ${sort.sortType},
</if> </if>
<if test="dto.receiveOrgCode != null and dto.receiveOrgCode != ''">
AND ur.receive_org_code = #{dto.receiveOrgCode}
</if>
<if test="roleIds != null and dto.type == 'supervision'">
<foreach collection='roleIds' item='role' open='and (' close=')' separator='or'>
ur.instance_status like concat('%',#{role},'%')
</foreach>
</if>
<if test="dto.type == 'supervision'">
AND (ur.receive_company_code = #{companyCode} or ur.transfer_to_user_ids LIKE concat ('%', #{currentUserId}, '%'))
AND ur.instance_id is not null
</if>
<if test="dto.type == 'company'">
and (ur.use_unit_credit_code = #{dto.useUnitCreditCode} or ur.transfer_to_user_ids LIKE concat ('%', #{currentUserId}, '%'))
</if>
</where>
order by
<if test="sort != null">
ur.${sort.field} ${sort.sortType},
</if>
ur.rec_date desc ur.rec_date desc
</select> </select>
<delete id="deleteHistoryInfoById"> <delete id="deleteHistoryInfoById">
delete from tzs_jg_registration_history where current_document_id = #{code} delete
from tzs_jg_registration_history
where current_document_id = #{code}
</delete> </delete>
<select id="queryForFlowingEquipList" resultType="com.yeejoin.amos.boot.module.jg.api.dto.CompanyEquipCountDto">
select a.use_unit_credit_code as companyCode,
group_concat(b.certificate_seq) as records
from tzs_jg_change_registration_name a,
tzs_jg_change_registration_name_eq b
where a.sequence_nbr = b.name_change_registration_id
and a.audit_status in ('三级待受理', '二级待受理', '一级待受理')
GROUP BY a.use_unit_credit_code
</select>
</mapper> </mapper>
...@@ -36,12 +36,40 @@ public abstract class BaseEquipUsedCheckService implements IEquipUsedCheck { ...@@ -36,12 +36,40 @@ public abstract class BaseEquipUsedCheckService implements IEquipUsedCheck {
boolean isLocked = lock.tryLock(0, 180, TimeUnit.SECONDS); boolean isLocked = lock.tryLock(0, 180, TimeUnit.SECONDS);
if (!isLocked) { if (!isLocked) {
log.error("设备:{}在被其他业务使用,加锁失败", record); log.error("设备:{}在被其他业务使用,加锁失败", record);
throw new BadRequest("存在其他业务在使用设备,请刷新后重试!"); throw new BadRequest("设备已被其他流程使用,请刷新后重试!");
} }
RBucket<Set<String>> RBucket = getRedisClient().getBucket(this.getFlowingEquipRedisKey(companyCode, getApplyBizType())); RBucket<Set<String>> RBucket = getRedisClient().getBucket(this.getFlowingEquipRedisKey(companyCode, getApplyBizType()));
Set<String> equipListOfUsed = RBucket.get(); Set<String> equipListOfUsed = RBucket.get();
if (equipListOfUsed != null && equipListOfUsed.contains(record)) { if (equipListOfUsed != null && equipListOfUsed.contains(record)) {
throw new BadRequest("存在设备正在被其他流程使用,不允许重复提交!"); throw new BadRequest("设备已被其他流程使用,不允许重复提交!");
}
if (equipListOfUsed == null || equipListOfUsed.isEmpty()) {
equipListOfUsed = new TreeSet<>();
}
equipListOfUsed.add(record);
getRedisClient().getBucket(this.getFlowingEquipRedisKey(companyCode, getApplyBizType())).set(equipListOfUsed);
FlowingEquipRedisContext.setRedisKeyInfo(new FlowingEquipRedisKeyDTO(this.getFlowingEquipRedisKey(companyCode, getApplyBizType()), Collections.singletonList(record)));
} catch (InterruptedException e) {
e.printStackTrace();
} finally {
if (lock.isHeldByCurrentThread()) {
lock.unlock();
}
}
}
@Override
public void registrationRepeatUsedCheck(String record, String companyCode) {
RLock lock = getRedisClient().getLock(this.getRepeatUsedCheckLockKey(companyCode, getApplyBizType(), record));
try {
boolean isLocked = lock.tryLock(0, 180, TimeUnit.SECONDS);
if (!isLocked) {
log.error("使用登记证:{}在被其他业务使用,加锁失败", record);
throw new BadRequest("使用登记证已被其他流程使用,请刷新后重试!");
}
RBucket<Set<String>> RBucket = getRedisClient().getBucket(this.getFlowingEquipRedisKey(companyCode, getApplyBizType()));
Set<String> equipListOfUsed = RBucket.get();
if (equipListOfUsed != null && equipListOfUsed.contains(record)) {
throw new BadRequest("使用登记证已被其他流程使用,不允许重复提交!");
} }
if (equipListOfUsed == null || equipListOfUsed.isEmpty()) { if (equipListOfUsed == null || equipListOfUsed.isEmpty()) {
equipListOfUsed = new TreeSet<>(); equipListOfUsed = new TreeSet<>();
......
...@@ -100,7 +100,6 @@ public class DPStatisticsServiceImpl { ...@@ -100,7 +100,6 @@ public class DPStatisticsServiceImpl {
private final static String REGION_NAME = "regionName"; private final static String REGION_NAME = "regionName";
@Autowired @Autowired
private EquipmentCategoryMapper equipmentCategoryMapper; private EquipmentCategoryMapper equipmentCategoryMapper;
...@@ -239,55 +238,47 @@ public class DPStatisticsServiceImpl { ...@@ -239,55 +238,47 @@ public class DPStatisticsServiceImpl {
public Map<String, Object> getCenterMapCountDataForGlobal(DPFilterParamDto dpFilterParamDto) { public Map<String, Object> getCenterMapCountDataForGlobal(DPFilterParamDto dpFilterParamDto) {
Map<String, Object> result = new HashMap<>(); Map<String, Object> result = new HashMap<>();
String orgCode = this.getAndSetOrgCode(dpFilterParamDto.getCityCode());
// 1.气瓶数量统计 // 1.气瓶数量统计
long cylinderNum = this.staticsCenterMapCountDataForCylinder(result, dpFilterParamDto); long cylinderNum = this.staticsCenterMapCountDataForCylinder(result, orgCode);
//1.8大类设备数量统计,压力容器里包括气瓶所以需要特殊处理,在统计压力容器时去掉气瓶的数量 //1.8大类设备数量统计,压力容器里包括气瓶所以需要特殊处理,在统计压力容器时去掉气瓶的数量
this.staticsCenterMapCountDataForEquip(result, dpFilterParamDto, cylinderNum); this.staticsCenterMapCountDataForEquip(result, cylinderNum, orgCode);
//2.压力管道长度统计 //2.压力管道长度统计
this.staticsCenterMapCountDataForPipeline(result, dpFilterParamDto); this.staticsCenterMapCountDataForPipeline(result, orgCode);
//3.单位数量统计 //3.单位数量统计
this.staticsCenterMapCountDataForCompany(result, dpFilterParamDto); this.staticsCenterMapCountDataForCompany(result, orgCode);
//4.人员数量统计 //4.人员数量统计
this.staticsCenterMapCountDataForPerson(result, dpFilterParamDto); this.staticsCenterMapCountDataForPerson(result, dpFilterParamDto, orgCode);
return result; return result;
} }
public Map<String, Object> getCenterMapOverviewData(DPFilterParamDto dpFilterParamDto) { private Map<String, Object> getCenterMapOverviewData(DPFilterParamDto dpFilterParamDto) {
Map<String, Object> result = new HashMap<>(); Map<String, Object> result = new HashMap<>();
// 1.气瓶数量统计 String orgCode = this.getAndSetOrgCode(dpFilterParamDto.getCityCode());
long cylinderNum = this.staticsCenterMapCountDataForCylinder(result, dpFilterParamDto); // 0. 气瓶数量统计
//1.8大类设备数量统计,压力容器里包括气瓶所以需要特殊处理,在统计压力容器时去掉气瓶的数量 long cylinderNum = this.staticsCenterMapCountDataForCylinder(result, orgCode);
this.staticsCenterMapCountDataForEquip(result, dpFilterParamDto, cylinderNum); // 1. 8大类设备数量统计,压力容器里包括气瓶所以需要特殊处理,在统计压力容器时去掉气瓶的数量
//2.压力管道长度统计 this.staticsCenterMapCountDataForEquip(result, cylinderNum, orgCode);
this.staticsCenterMapCountDataForPipeline(result, dpFilterParamDto); // 2. 压力管道长度统计
//3.人员数量统计 this.staticsCenterMapCountDataForPipeline(result, orgCode);
this.staticsCenterMapCountDataForPerson(result, dpFilterParamDto); // 3. 人员数量统计
this.staticsCenterMapCountDataForPerson(result, dpFilterParamDto, orgCode);
return result; return result;
} }
private void staticsCenterMapCountDataForPerson(Map<String, Object> result, DPFilterParamDto dpFilterParamDto) { private void staticsCenterMapCountDataForPerson(Map<String, Object> result, DPFilterParamDto dpFilterParamDto, String orgCode) {
String orgCode = regionCodeOrgCodeMap.get(dpFilterParamDto.getCityCode());
if (orgCode == null) { if (orgCode == null) {
orgCode = commonMapper.getOrgCodeByCompanyCode(dpFilterParamDto.getCityCode()); result.put(DPMapStatisticsItemEnum.OPERATORS.getCode(), 0);
if (orgCode == null) { return;
result.put(DPMapStatisticsItemEnum.OPERATORS.getCode(), 0);
return;
}
regionCodeOrgCodeMap.put(dpFilterParamDto.getCityCode(), orgCode);
} }
Long num = userInfoMapper.countUserByPostAndAreaCode(orgCode, "6552", dpFilterParamDto.getCityCode()); Long num = userInfoMapper.countUserByPostAndAreaCode(orgCode, "6552", dpFilterParamDto.getCityCode());
result.put(DPMapStatisticsItemEnum.OPERATORS.getCode(), num); result.put(DPMapStatisticsItemEnum.OPERATORS.getCode(), num);
} }
private void staticsCenterMapCountDataForCompany(Map<String, Object> result, DPFilterParamDto dpFilterParamDto) { private void staticsCenterMapCountDataForCompany(Map<String, Object> result, String orgCode) {
String orgCode = regionCodeOrgCodeMap.get(dpFilterParamDto.getCityCode());
if (orgCode == null) { if (orgCode == null) {
orgCode = commonMapper.getOrgCodeByCompanyCode(dpFilterParamDto.getCityCode()); setDefaultCompanyCountData(result);
if (orgCode == null) { return;
setDefaultCompanyCountData(result);
return;
}
regionCodeOrgCodeMap.put(dpFilterParamDto.getCityCode(), orgCode);
} }
List<CountDto> countDtos = enterpriseInfoMapper.countByUnitTypeAndOrgCode(orgCode); List<CountDto> countDtos = enterpriseInfoMapper.countByUnitTypeAndOrgCode(orgCode);
result.put(DPMapStatisticsItemEnum.USERS_UNITS.getCode(), countDtos.stream().filter(c -> c.getKeyStr().contains(COMPANY_TYPE_USE)).mapToInt(CountDto::getIntValue).sum()); result.put(DPMapStatisticsItemEnum.USERS_UNITS.getCode(), countDtos.stream().filter(c -> c.getKeyStr().contains(COMPANY_TYPE_USE)).mapToInt(CountDto::getIntValue).sum());
...@@ -296,13 +287,13 @@ public class DPStatisticsServiceImpl { ...@@ -296,13 +287,13 @@ public class DPStatisticsServiceImpl {
result.put(DPMapStatisticsItemEnum.GAS_UNITS.getCode(), countDtos.stream().filter(c -> c.getKeyStr().contains(COMPANY_TYPE_FILLING)).mapToInt(CountDto::getIntValue).sum()); result.put(DPMapStatisticsItemEnum.GAS_UNITS.getCode(), countDtos.stream().filter(c -> c.getKeyStr().contains(COMPANY_TYPE_FILLING)).mapToInt(CountDto::getIntValue).sum());
} }
private long staticsCenterMapCountDataForCylinder(Map<String, Object> result, DPFilterParamDto dpFilterParamDto) { private long staticsCenterMapCountDataForCylinder(Map<String, Object> result, String orgCode) {
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");
BoolQueryBuilder boolMust = QueryBuilders.boolQuery(); BoolQueryBuilder boolMust = QueryBuilders.boolQuery();
// 区域信息模糊查询 // 按照管辖机构区域信息模糊查询
boolMust.must(QueryBuilders.wildcardQuery("USE_PLACE_CODE", "*" + dpFilterParamDto.getCityCode() + "*")); boolMust.must(QueryBuilders.wildcardQuery("ORG_BRANCH_CODE.keyword", orgCode + "*"));
// 设备类别精确查询气瓶 // 设备类别精确查询气瓶
boolMust.must(QueryBuilders.termsQuery("EQU_CATEGORY_CODE", EQU_CATEGORY_CYLINDER)); boolMust.must(QueryBuilders.termsQuery("EQU_CATEGORY_CODE", EQU_CATEGORY_CYLINDER));
// 纳管状态为已纳管 // 纳管状态为已纳管
...@@ -318,8 +309,8 @@ public class DPStatisticsServiceImpl { ...@@ -318,8 +309,8 @@ public class DPStatisticsServiceImpl {
return num; return num;
} }
private void staticsCenterMapCountDataForPipeline(Map<String, Object> result, DPFilterParamDto dpFilterParamDto) { private void staticsCenterMapCountDataForPipeline(Map<String, Object> result, String orgCode) {
String length = techParamsPipelineMapper.sumPipeLengthByArea(dpFilterParamDto.getCityCode()); String length = techParamsPipelineMapper.sumPipeLengthByOrgCode(orgCode);
BigDecimal lengthDecimal = new BigDecimal(length); BigDecimal lengthDecimal = new BigDecimal(length);
if (lengthDecimal.compareTo(BigDecimal.ZERO) > 0) { if (lengthDecimal.compareTo(BigDecimal.ZERO) > 0) {
length = lengthDecimal.divide(new BigDecimal("1000"), 3, RoundingMode.HALF_UP).toPlainString(); length = lengthDecimal.divide(new BigDecimal("1000"), 3, RoundingMode.HALF_UP).toPlainString();
...@@ -328,12 +319,12 @@ public class DPStatisticsServiceImpl { ...@@ -328,12 +319,12 @@ public class DPStatisticsServiceImpl {
} }
private void staticsCenterMapCountDataForEquip(Map<String, Object> result, DPFilterParamDto dpFilterParamDto, long cylinderNum) { private void staticsCenterMapCountDataForEquip(Map<String, Object> result, long cylinderNum, String orgCode) {
SearchRequest request = new SearchRequest(); SearchRequest request = new SearchRequest();
request.indices("idx_biz_view_jg_all"); request.indices("idx_biz_view_jg_all");
BoolQueryBuilder boolMust = QueryBuilders.boolQuery(); BoolQueryBuilder boolMust = QueryBuilders.boolQuery();
// 区域信息模糊查询 // 按照管辖机构区域信息模糊查询
boolMust.must(QueryBuilders.wildcardQuery("USE_PLACE_CODE", "*" + dpFilterParamDto.getCityCode() + "*")); boolMust.must(QueryBuilders.wildcardQuery("ORG_BRANCH_CODE.keyword", orgCode + "*"));
// 纳管状态为已纳管 // 纳管状态为已纳管
boolMust.must(QueryBuilders.termQuery("IS_INTO_MANAGEMENT", true)); boolMust.must(QueryBuilders.termQuery("IS_INTO_MANAGEMENT", true));
SearchSourceBuilder builder = new SearchSourceBuilder(); SearchSourceBuilder builder = new SearchSourceBuilder();
......
...@@ -1363,17 +1363,17 @@ private SafetyProblemTracingMapper safetyProblemTracingMapper; ...@@ -1363,17 +1363,17 @@ private SafetyProblemTracingMapper safetyProblemTracingMapper;
String queryType = map.getString("QUERY_TYPE"); String queryType = map.getString("QUERY_TYPE");
if (!ObjectUtils.isEmpty(queryType)) { if (!ObjectUtils.isEmpty(queryType)) {
// 查询 安装告知【可告知设备列表】【USE_UNIT_CREDIT_CODE=== null || ""】 // 查询 安装告知【可告知设备列表】【USE_UNIT_CREDIT_CODE=== null || ""】
if (ValidationUtil.equals(queryType, "AZ")) { if (ValidationUtil.equals(queryType, "AZ")) {//安装
BoolQueryBuilder nullOrEmptyQuery = QueryBuilders.boolQuery() BoolQueryBuilder nullOrEmptyQuery = QueryBuilders.boolQuery()
.mustNot(QueryBuilders.wildcardQuery("USE_UNIT_CREDIT_CODE", "*")); .mustNot(QueryBuilders.wildcardQuery("USE_UNIT_CREDIT_CODE", "*"));
boolMust.must(nullOrEmptyQuery); boolMust.must(nullOrEmptyQuery);
this.setRepeatUsedCheckFilterParam(boolMust, companyCode, "installNotice"); this.setRepeatUsedCheckFilterParam(boolMust, companyCode, "installNotice");
} else if (ValidationUtil.equals(queryType, "WB")) { } else if (ValidationUtil.equals(queryType, "WB")) {//维保
// 查询 维保备案【可绑定设备列表】【(EQU_STATE=== null || "")】 // 查询 维保备案【可绑定设备列表】【(EQU_STATE=== null || "")】
BoolQueryBuilder wbBuilder = QueryBuilders.boolQuery(); BoolQueryBuilder wbBuilder = QueryBuilders.boolQuery();
wbBuilder.mustNot(QueryBuilders.existsQuery("EQU_STATE")); wbBuilder.mustNot(QueryBuilders.existsQuery("EQU_STATE"));
boolMust.must(wbBuilder); boolMust.must(wbBuilder);
} else if (ValidationUtil.equals(queryType, "SY")) { } else if (ValidationUtil.equals(queryType, "SY")) {//使用
// 查询 使用登记【可选设备列表】【(EQU_STATUS=== null || "" ) && (USE_ORG_CODE(使用登记证编号) ==="" || null)】 // 查询 使用登记【可选设备列表】【(EQU_STATUS=== null || "" ) && (USE_ORG_CODE(使用登记证编号) ==="" || null)】
BoolQueryBuilder syBuilder = QueryBuilders.boolQuery(); BoolQueryBuilder syBuilder = QueryBuilders.boolQuery();
syBuilder.mustNot(QueryBuilders.existsQuery("EQU_STATE")); syBuilder.mustNot(QueryBuilders.existsQuery("EQU_STATE"));
...@@ -1393,6 +1393,7 @@ private SafetyProblemTracingMapper safetyProblemTracingMapper; ...@@ -1393,6 +1393,7 @@ private SafetyProblemTracingMapper safetyProblemTracingMapper;
syBuilder.must(QueryBuilders.wildcardQuery("USE_ORG_CODE", "*")); syBuilder.must(QueryBuilders.wildcardQuery("USE_ORG_CODE", "*"));
boolMust.must(syBuilder); boolMust.must(syBuilder);
} }
// this.setRepeatUsedCheckFilterByType(boolMust,companyCode,queryType);
} }
// 通用匹配规则,其他条件构建 // 通用匹配规则,其他条件构建
...@@ -1635,6 +1636,44 @@ private SafetyProblemTracingMapper safetyProblemTracingMapper; ...@@ -1635,6 +1636,44 @@ private SafetyProblemTracingMapper safetyProblemTracingMapper;
return result; return result;
} }
private void setRepeatUsedCheckFilterByType(BoolQueryBuilder boolMust, String companyCode, String queryType) {
if("AZ".equals(queryType)){//安装告知
this.setRepeatUsedCheckFilterParam(boolMust, companyCode, "installNotice");
}else if("GZ_GZ".equals(queryType)){//改造告知
this.setRepeatUsedCheckFilterParam(boolMust, companyCode, "renovationNoticeNew");
}else if("GZ_WX".equals(queryType)){//维修告知
this.setRepeatUsedCheckFilterParam(boolMust, companyCode, "maintainInfo");
}else if("GZ_YZ".equals(queryType)){//移装告知
this.setRepeatUsedCheckFilterParam(boolMust, companyCode, "transferNotice");
}else if("SY".equals(queryType)){//使用登记
this.setRepeatUsedCheckFilterParam(boolMust, companyCode, "useRegister");
}else if("DJ_GZ".equals(queryType)){//改造变更登记
this.setRepeatUsedCheckFilterParam(boolMust, companyCode, "changeRegistration");
}else if("DJ_YZ".equals(queryType)){//移装变更登记
this.setRepeatUsedCheckFilterParam(boolMust, companyCode, "changeRegistrationTransfer");
}else if("DJ_DW".equals(queryType)){//单位变更登记
this.setRepeatUsedCheckFilterParam(boolMust, companyCode, "unitChange");
}else if("DJ_GM".equals(queryType)){//更名变更登记
this.setRepeatUsedCheckFilterParam(boolMust, companyCode, "changeName");
}else if("BF_YZ".equals(queryType)){//注销
this.setRepeatUsedCheckFilterParam(boolMust, companyCode, "");
}else if("BF_ZX".equals(queryType)){//报废
this.setRepeatUsedCheckFilterParam(boolMust, companyCode, "");
}else if("SB_QY".equals(queryType)){//启用
this.setRepeatUsedCheckFilterParam(boolMust, companyCode, "");
}else if("SB_TY".equals(queryType)){//停用
this.setRepeatUsedCheckFilterParam(boolMust, companyCode, "");
}else if("WB_BA".equals(queryType)){//维保备案
this.setRepeatUsedCheckFilterParam(boolMust, companyCode, "maintenanceFiling");
}else if("SB_YJ".equals(queryType)){//设备移交
this.setRepeatUsedCheckFilterParam(boolMust, companyCode, "equipmentHandover");
}else if("QP_BG".equals(queryType)){//车用气瓶变更
this.setRepeatUsedCheckFilterParam(boolMust, companyCode, "vehicleGasCylinderChange");
}else if("QP_DJ".equals(queryType)){//车用气瓶登记
this.setRepeatUsedCheckFilterParam(boolMust, companyCode, "vehicleInformation");
}
}
/** /**
* 设备注册信息分页查询 * 设备注册信息分页查询
* *
......
package com.yeejoin.amos.boot.module.jg.biz.service.impl;
import com.yeejoin.amos.boot.module.jg.api.dto.CompanyEquipCountDto;
import com.yeejoin.amos.boot.module.jg.api.mapper.JgChangeRegistrationNameMapper;
import com.yeejoin.amos.boot.module.jg.api.mapper.JgChangeRegistrationUnitMapper;
import lombok.extern.slf4j.Slf4j;
import org.redisson.api.RBucket;
import org.redisson.api.RedissonClient;
import org.springframework.stereotype.Component;
import java.util.Arrays;
import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;
/**
* @author Administrator
*/
@Component
@Slf4j
public class JgChangeRegistrationNameRegistrationUsedCheckImpl extends BaseEquipUsedCheckService {
private RedissonClient redissonClient;
private String bizType = "changeName";
private JgChangeRegistrationNameMapper mapper;
public JgChangeRegistrationNameRegistrationUsedCheckImpl(RedissonClient redissonClient, JgChangeRegistrationNameMapper mapper) {
this.redissonClient = redissonClient;
this.mapper = mapper;
}
@Override
public RedissonClient getRedisClient() {
return redissonClient;
}
@Override
public String getApplyBizType() {
return bizType;
}
@Override
public void init() {
// 初始化在流程中设备数据
List<CompanyEquipCountDto> companyEquipCountDtos = mapper.queryForFlowingEquipList();
companyEquipCountDtos.forEach(c -> {
RBucket<Set<String>> rBucket = redissonClient.getBucket(getFlowingEquipRedisKey(c.getCompanyCode(), bizType));
rBucket.set(Arrays.stream(c.getRecords().split(",")).collect(Collectors.toSet()));
});
}
}
...@@ -322,7 +322,7 @@ public class JgChangeRegistrationReformServiceImpl extends BaseService<JgChangeR ...@@ -322,7 +322,7 @@ public class JgChangeRegistrationReformServiceImpl extends BaseService<JgChangeR
} catch (Exception e) { } catch (Exception e) {
log.error(e.getMessage(), e); log.error(e.getMessage(), e);
this.rollBackForDelRedisData(); this.rollBackForDelRedisData();
throw new BadRequest("使用登记保存失败!"); throw new BadRequest("保存失败!");
} finally { } finally {
FlowingEquipRedisContext.clean(); FlowingEquipRedisContext.clean();
} }
......
...@@ -421,7 +421,7 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN ...@@ -421,7 +421,7 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN
} catch (Exception e) { } catch (Exception e) {
log.error(e.getMessage(), e); log.error(e.getMessage(), e);
this.rollBackForDelRedisData(); this.rollBackForDelRedisData();
throw new BadRequest("安装告知保存失败!"); throw new BadRequest("保存失败!");
} finally { } finally {
FlowingEquipRedisContext.clean(); FlowingEquipRedisContext.clean();
} }
...@@ -642,7 +642,7 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN ...@@ -642,7 +642,7 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN
} catch (Exception e) { } catch (Exception e) {
log.error(e.getMessage(), e); log.error(e.getMessage(), e);
this.rollBackForDelRedisData(); this.rollBackForDelRedisData();
throw new BadRequest("安装告知保存失败!"); throw new BadRequest("保存失败!");
} finally { } finally {
FlowingEquipRedisContext.clean(); FlowingEquipRedisContext.clean();
} }
......
...@@ -353,7 +353,7 @@ public class JgMaintainNoticeServiceImpl extends BaseService<JgMaintainNoticeDto ...@@ -353,7 +353,7 @@ public class JgMaintainNoticeServiceImpl extends BaseService<JgMaintainNoticeDto
} catch (Exception e) { } catch (Exception e) {
log.error(e.getMessage(), e); log.error(e.getMessage(), e);
this.rollBackForDelRedisData(); this.rollBackForDelRedisData();
throw new BadRequest("安装告知保存失败!"); throw new BadRequest("保存失败!");
} finally { } finally {
FlowingEquipRedisContext.clean(); FlowingEquipRedisContext.clean();
} }
...@@ -538,7 +538,7 @@ public class JgMaintainNoticeServiceImpl extends BaseService<JgMaintainNoticeDto ...@@ -538,7 +538,7 @@ public class JgMaintainNoticeServiceImpl extends BaseService<JgMaintainNoticeDto
} catch (Exception e) { } catch (Exception e) {
log.error(e.getMessage(), e); log.error(e.getMessage(), e);
this.rollBackForDelRedisData(); this.rollBackForDelRedisData();
throw new BadRequest("安装告知保存失败!"); throw new BadRequest("保存失败!");
} finally { } finally {
FlowingEquipRedisContext.clean(); FlowingEquipRedisContext.clean();
} }
......
...@@ -268,7 +268,7 @@ public class JgReformNoticeServiceImpl extends BaseService<JgReformNoticeDto, Jg ...@@ -268,7 +268,7 @@ public class JgReformNoticeServiceImpl extends BaseService<JgReformNoticeDto, Jg
} catch (Exception e) { } catch (Exception e) {
log.error(e.getMessage(), e); log.error(e.getMessage(), e);
this.rollBackForDelRedisData(); this.rollBackForDelRedisData();
throw new BadRequest("安装告知保存失败!"); throw new BadRequest("改造告知保存失败!");
} finally { } finally {
FlowingEquipRedisContext.clean(); FlowingEquipRedisContext.clean();
} }
...@@ -471,7 +471,7 @@ public class JgReformNoticeServiceImpl extends BaseService<JgReformNoticeDto, Jg ...@@ -471,7 +471,7 @@ public class JgReformNoticeServiceImpl extends BaseService<JgReformNoticeDto, Jg
} catch (Exception e) { } catch (Exception e) {
log.error(e.getMessage(), e); log.error(e.getMessage(), e);
this.rollBackForDelRedisData(); this.rollBackForDelRedisData();
throw new BadRequest("安装告知保存失败!"); throw new BadRequest("知保存失败!");
} finally { } finally {
FlowingEquipRedisContext.clean(); FlowingEquipRedisContext.clean();
} }
......
...@@ -404,7 +404,7 @@ public class JgTransferNoticeServiceImpl extends BaseService<JgTransferNoticeDto ...@@ -404,7 +404,7 @@ public class JgTransferNoticeServiceImpl extends BaseService<JgTransferNoticeDto
} catch (Exception e) { } catch (Exception e) {
log.error(e.getMessage(), e); log.error(e.getMessage(), e);
this.rollBackForDelRedisData(); this.rollBackForDelRedisData();
throw new BadRequest("安装告知保存失败!"); throw new BadRequest("保存失败!");
} finally { } finally {
FlowingEquipRedisContext.clean(); FlowingEquipRedisContext.clean();
} }
...@@ -483,7 +483,7 @@ public class JgTransferNoticeServiceImpl extends BaseService<JgTransferNoticeDto ...@@ -483,7 +483,7 @@ public class JgTransferNoticeServiceImpl extends BaseService<JgTransferNoticeDto
} catch (Exception e) { } catch (Exception e) {
log.error(e.getMessage(), e); log.error(e.getMessage(), e);
this.rollBackForDelRedisData(); this.rollBackForDelRedisData();
throw new BadRequest("安装告知保存失败!"); throw new BadRequest("保存失败!");
} finally { } finally {
FlowingEquipRedisContext.clean(); FlowingEquipRedisContext.clean();
} }
......
...@@ -607,7 +607,7 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD ...@@ -607,7 +607,7 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
} catch (Exception e) { } catch (Exception e) {
log.error(e.getMessage(), e); log.error(e.getMessage(), e);
this.rollBackForDelRedisData(); this.rollBackForDelRedisData();
throw new BadRequest("使用登记保存失败!"); throw new BadRequest("保存失败!");
} finally { } finally {
FlowingEquipRedisContext.clean(); FlowingEquipRedisContext.clean();
} }
...@@ -814,7 +814,7 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD ...@@ -814,7 +814,7 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
} catch (Exception e) { } catch (Exception e) {
log.error(e.getMessage(), e); log.error(e.getMessage(), e);
this.rollBackForDelRedisData(); this.rollBackForDelRedisData();
throw new BadRequest("使用登记保存失败!"); throw new BadRequest("保存失败!");
} finally { } finally {
FlowingEquipRedisContext.clean(); FlowingEquipRedisContext.clean();
} }
...@@ -2796,7 +2796,7 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD ...@@ -2796,7 +2796,7 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
} catch (Exception e) { } catch (Exception e) {
log.error(e.getMessage(), e); log.error(e.getMessage(), e);
this.rollBackForDelRedisData(); this.rollBackForDelRedisData();
throw new BadRequest("使用登记保存失败!"); throw new BadRequest("保存失败!");
} finally { } finally {
FlowingEquipRedisContext.clean(); FlowingEquipRedisContext.clean();
} }
......
...@@ -84,15 +84,18 @@ public class DPSubServiceImpl { ...@@ -84,15 +84,18 @@ public class DPSubServiceImpl {
} }
Object apiResult = null; Object apiResult = null;
long s = System.currentTimeMillis();
if (!ValidationUtil.isEmpty(api)) { if (!ValidationUtil.isEmpty(api)) {
long s = System.currentTimeMillis();
ResponseModel responseModel = this.getApiResult((JSONObject) api, !ValidationUtil.isEmpty(resultConvert) ? resultConvert.toString() : null); ResponseModel responseModel = this.getApiResult((JSONObject) api, !ValidationUtil.isEmpty(resultConvert) ? resultConvert.toString() : null);
if (!ValidationUtil.isEmpty(responseModel.getResult())) { if (!ValidationUtil.isEmpty(responseModel.getResult())) {
apiResult = responseModel.getResult(); apiResult = responseModel.getResult();
} }
long e = System.currentTimeMillis();
log.info("{}tab页获取详情接口,共耗时:{} 毫秒", tab.get("displayName"), (e - s));
} }
if (!ValidationUtil.isEmpty(formSeq)) { if (!ValidationUtil.isEmpty(formSeq)) {
long s = System.currentTimeMillis();
FormSceneModel formPage = Morphic.formSceneClient.seleteOne(formSeq).getResult(); FormSceneModel formPage = Morphic.formSceneClient.seleteOne(formSeq).getResult();
// 1、排除表单隐藏字段 // 1、排除表单隐藏字段
JSONArray children = (JSONArray) JsonValueUtils.getValueByKey(JSONObject.parseObject(formPage.getContent()), "children", "children"); JSONArray children = (JSONArray) JsonValueUtils.getValueByKey(JSONObject.parseObject(formPage.getContent()), "children", "children");
......
...@@ -16,8 +16,8 @@ public interface EquipTechParamPipelineMapper extends BaseMapper<EquipTechParamP ...@@ -16,8 +16,8 @@ public interface EquipTechParamPipelineMapper extends BaseMapper<EquipTechParamP
/** /**
* 统计压力管道长度 * 统计压力管道长度
* *
* @param cityCode 区域code * @param orgCode 区域code对应的管辖机构
* @return 数量 * @return 数量
*/ */
String sumPipeLengthByArea(String cityCode); String sumPipeLengthByOrgCode(String orgCode);
} }
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
WHERE WHERE
RECORD = #{record} RECORD = #{record}
</select> </select>
<select id="sumPipeLengthByArea" resultType="java.lang.String"> <select id="sumPipeLengthByOrgCode" resultType="java.lang.String">
select select
COALESCE(round(sum(p."PIPE_LENGTH"), 2),0) as PIPE_LENGTH COALESCE(round(sum(p."PIPE_LENGTH"), 2),0) as PIPE_LENGTH
from from
...@@ -33,18 +33,18 @@ ...@@ -33,18 +33,18 @@
( (
SELECT SELECT
ri."RECORD", ri."RECORD",
concat(ui.PROVINCE,'#', ui.CITY,'#', ui.COUNTY) as areaCode si."ORG_BRANCH_CODE" as orgBranchCode
FROM "idx_biz_jg_register_info" ri, FROM
idx_biz_jg_use_info ui "idx_biz_jg_register_info" ri,
idx_biz_jg_use_info ui,
idx_biz_jg_supervision_info si
where where
ri."EQU_LIST" = '8000' ri."EQU_LIST" = '8000'
and ri."RECORD" = ui."RECORD" and ri."RECORD" = ui."RECORD"
and ui."PROVINCE" <![CDATA[<>]]> '' and ui.IS_INTO_MANAGEMENT =true
and ui."CITY" <![CDATA[<>]]>'' and ri."RECORD" = si."RECORD"
and ui."COUNTY" <![CDATA[<>]]> ''
and ui.IS_INTO_MANAGEMENT =true
) a ) a
where where
p."RECORD" = a."RECORD" and a.areaCode like concat('%',#{cityCode}, '%') p."RECORD" = a."RECORD" and a.orgBranchCode like concat(#{orgCode}, '%')
</select> </select>
</mapper> </mapper>
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