Commit d367cae8 authored by suhuiguang's avatar suhuiguang

feat(jg):行政审批局

1.大屏统计办理时效统计,统计维度由接收机构的单位orgcode调整为使用单位的管辖和使用办理的设备数情况统计保持一致
parent 35fd5b93
......@@ -3560,7 +3560,7 @@
from
privilege_company
where
company_code = #{receiveCompanyCode}
company_code = #{receiveCompanyCode} and is_deleted = false
</select>
<select id="querySupervisionCompanyCode" resultType="java.lang.String">
......
package com.yeejoin.amos.boot.module.statistics.api.mapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
/**
* Mapper 接口
......@@ -14,4 +15,13 @@ public interface CommonBaseMapper {
String getOrgCodeByCompanyCode(String companyCode);
String getCompanyCodeByOrgCode(String orgCode);
/**
* 按照 地市或者区县查询对应行政区划seq
*
* @param receiveCompanyCode 地市或者区县companyCode
* @return 地市对应行政区划seq
*/
String selectCompanyRegionSeq(@Param("receiveCompanyCode") String receiveCompanyCode);
}
......@@ -74,7 +74,6 @@ public interface JGStatisticsMapper {
/**
* 告知类业务平均办理时效,统计维度:接收机构所在的行政区域;
* 由于告知类,接收机构为监管机构,receive_company_org_code为监管机构的orgCode,故还保持使用receive_company_org_code匹配orgCode即可
* @param dpFilterParamDto 过滤条件
* @param orgCode 登录人或者选择区域转换后的orgCode
* @return 告知类业务平均办理时效
......
......@@ -9,4 +9,13 @@
<select id="getCompanyCodeByOrgCode" resultType="java.lang.String">
select company_code from privilege_company where org_code = #{orgCode} limit 1
</select>
<select id="selectCompanyRegionSeq" resultType="java.lang.String">
select
region_seq
from
privilege_company
where
company_code = #{receiveCompanyCode} and is_deleted = false
</select>
</mapper>
......@@ -669,67 +669,119 @@
<select id="queryNoticeAvgDayByReceiveCompany" resultType="com.yeejoin.amos.boot.biz.common.dto.CountDto">
SELECT
round(avg(T.handle_date::date - T.notice_date::date + 1),1) as strValue,
T.receive_company_org_code AS keyStr
T.receive_org_credit_code AS keyStr
FROM
tzs_jg_installation_notice T
WHERE
T.notice_status = 6616
and bi.supervise_org_code like concat(#{orgCode}, '%')
<choose>
<when test='dto.cityCode != null and dto.cityCode == "610000"'>
and 1=1
</when>
<otherwise>
<if test="dto.companyCodes != null and dto.companyCodes.size > 0" >
and T.receive_org_credit_code = ANY(ARRAY[
<foreach collection="dto.companyCodes" item="companyCode" separator=",">
#{companyCode}
</foreach>
])
</if>
</otherwise>
</choose>
<if test="dto.beginDate !=null and dto.beginDate !=''">
and date_ge(CAST(T.notice_date as date),#{dto.beginDate})
</if>
<if test="dto.endDate !=null and dto.endDate !=''">
and date_le(CAST(T.notice_date as date),#{dto.endDate})
</if>
GROUP BY T.receive_company_org_code
GROUP BY T.receive_org_credit_code
union all
SELECT
round(avg(T.accept_date::date - T.notice_date::date + 1),1) as strValue,
T.receive_company_org_code AS keyStr
T.receive_company_code AS keyStr
FROM
tzs_jg_maintain_notice T
WHERE
T.notice_status = 6616
and bi.supervise_org_code like concat(#{orgCode}, '%')
<choose>
<when test='dto.cityCode != null and dto.cityCode == "610000"'>
and 1=1
</when>
<otherwise>
<if test="dto.companyCodes != null and dto.companyCodes.size > 0" >
and T.receive_company_code = ANY(ARRAY[
<foreach collection="dto.companyCodes" item="companyCode" separator=",">
#{companyCode}
</foreach>
])
</if>
</otherwise>
</choose>
<if test="dto.beginDate !=null and dto.beginDate !=''">
and date_ge(CAST(T.notice_date as date),#{dto.beginDate})
</if>
<if test="dto.endDate !=null and dto.endDate !=''">
and date_le(CAST(T.notice_date as date),#{dto.endDate})
</if>
GROUP BY T.receive_company_org_code
GROUP BY T.receive_company_code
union all
SELECT
round(avg(T.accept_date::date - T.notice_date::date + 1),1) as strValue,
T.receive_company_org_code AS keyStr
T.receive_company_code AS keyStr
FROM
tzs_jg_reform_notice T
WHERE
T.notice_status = 6616
and bi.supervise_org_code like concat(#{orgCode}, '%')
<choose>
<when test='dto.cityCode != null and dto.cityCode == "610000"'>
and 1=1
</when>
<otherwise>
<if test="dto.companyCodes != null and dto.companyCodes.size > 0" >
and T.receive_company_code = ANY(ARRAY[
<foreach collection="dto.companyCodes" item="companyCode" separator=",">
#{companyCode}
</foreach>
])
</if>
</otherwise>
</choose>
<if test="dto.beginDate !=null and dto.beginDate !=''">
and date_ge(CAST(T.notice_date as date),#{dto.beginDate})
</if>
<if test="dto.endDate !=null and dto.endDate !=''">
and date_le(CAST(T.notice_date as date),#{dto.endDate})
</if>
GROUP BY T.receive_company_org_code
GROUP BY T.receive_company_code
union all
SELECT
round(avg(T.handle_date::date - T.notice_date::date + 1),1) as strValue,
T.receive_company_org_code AS keyStr
T.receive_company_code AS keyStr
FROM
tzs_jg_transfer_notice T
WHERE
T.notice_status = 6616
and bi.supervise_org_code like concat(#{orgCode}, '%')
<choose>
<when test='dto.cityCode != null and dto.cityCode == "610000"'>
and 1=1
</when>
<otherwise>
<if test="dto.companyCodes != null and dto.companyCodes.size > 0" >
and T.receive_company_code = ANY(ARRAY[
<foreach collection="dto.companyCodes" item="companyCode" separator=",">
#{companyCode}
</foreach>
])
</if>
</otherwise>
</choose>
<if test="dto.beginDate !=null and dto.beginDate !=''">
and date_ge(CAST(T.notice_date as date),#{dto.beginDate})
</if>
<if test="dto.endDate !=null and dto.endDate !=''">
and date_le(CAST(T.notice_date as date),#{dto.endDate})
</if>
GROUP BY T.receive_company_org_code
GROUP BY T.receive_company_code
</select>
<select id="queryUseAvgDayByReceiveCompany" resultType="com.yeejoin.amos.boot.biz.common.dto.CountDto">
SELECT
......@@ -744,11 +796,13 @@
and 1=1
</when>
<otherwise>
<if test="dto.companyCodes != null and dto.companyCodes.size > 0" >
and T.receive_company_code = ANY(ARRAY[
<foreach collection="dto.companyCodes" item="companyCode" separator=",">
#{companyCode}
</foreach>
])
</if>
</otherwise>
</choose>
<if test="dto.beginDate !=null and dto.beginDate !=''">
......@@ -771,11 +825,13 @@
and 1=1
</when>
<otherwise>
<if test="dto.companyCodes != null and dto.companyCodes.size > 0" >
and T.receive_company_code = ANY(ARRAY[
<foreach collection="dto.companyCodes" item="companyCode" separator=",">
#{companyCode}
</foreach>
])
</if>
</otherwise>
</choose>
<if test="dto.beginDate !=null and dto.beginDate !=''">
......@@ -799,11 +855,13 @@
and 1=1
</when>
<otherwise>
<if test="dto.companyCodes != null and dto.companyCodes.size > 0" >
and crn.receive_company_code = ANY(ARRAY[
<foreach collection="dto.companyCodes" item="companyCode" separator=",">
#{companyCode}
</foreach>
])
</if>
</otherwise>
</choose>
and crn.apply_date is not null
......@@ -823,14 +881,27 @@
tzs_jg_change_registration_reform T
WHERE
T.audit_status = '已完成'
and bi.supervise_org_code like concat(#{orgCode},'%')
<choose>
<when test='dto.cityCode != null and dto.cityCode == "610000"'>
and 1=1
</when>
<otherwise>
<if test="dto.companyCodes != null and dto.companyCodes.size > 0" >
and T.receive_company_code = ANY(ARRAY[
<foreach collection="dto.companyCodes" item="companyCode" separator=",">
#{companyCode}
</foreach>
])
</if>
</otherwise>
</choose>
<if test="dto.beginDate !=null and dto.beginDate !=''">
and date_ge(CAST(T.reg_date as date),#{dto.beginDate})
</if>
<if test="dto.endDate !=null and dto.endDate !=''">
and date_le(CAST(T.reg_date as date),#{dto.endDate})
</if>
GROUP BY T.receive_company_org_code
GROUP BY T.receive_company_code
union all
SELECT
round(avg(T.audit_pass_date::date - T.reg_date::date + 1),1) as strValue,
......@@ -844,11 +915,13 @@
and 1=1
</when>
<otherwise>
<if test="dto.companyCodes != null and dto.companyCodes.size > 0" >
and T.receive_company_code = ANY(ARRAY[
<foreach collection="dto.companyCodes" item="companyCode" separator=",">
#{companyCode}
</foreach>
])
</if>
</otherwise>
</choose>
<if test="dto.beginDate !=null and dto.beginDate !=''">
......@@ -871,11 +944,13 @@
and 1=1
</when>
<otherwise>
<if test="dto.companyCodes != null and dto.companyCodes.size > 0" >
and T.receive_org_code = ANY(ARRAY[
<foreach collection="dto.companyCodes" item="companyCode" separator=",">
#{companyCode}
</foreach>
])
</if>
</otherwise>
</choose>
<if test="dto.beginDate !=null and dto.beginDate !=''">
......@@ -898,11 +973,13 @@
and 1=1
</when>
<otherwise>
<if test="dto.companyCodes != null and dto.companyCodes.size > 0" >
and T.receive_org_code = ANY(ARRAY[
<foreach collection="dto.companyCodes" item="companyCode" separator=",">
#{companyCode}
</foreach>
])
</if>
</otherwise>
</choose>
<if test="dto.beginDate !=null and dto.beginDate !=''">
......@@ -921,7 +998,7 @@
(
SELECT
crn.sequence_nbr,
crn.receive_org_code,
crn.receive_company_code,
crn.audit_pass_date,
crn.apply_date
FROM
......@@ -933,11 +1010,13 @@
and 1=1
</when>
<otherwise>
<if test="dto.companyCodes != null and dto.companyCodes.size > 0" >
and crn.receive_company_code = ANY(ARRAY[
<foreach collection="dto.companyCodes" item="companyCode" separator=",">
#{companyCode}
</foreach>
])
</if>
</otherwise>
</choose>
<if test="dto.beginDate !=null and dto.beginDate !=''">
......@@ -953,12 +1032,12 @@
<select id="queryCancelAvgDayByReceiveCompany" resultType="com.yeejoin.amos.boot.biz.common.dto.CountDto">
SELECT
round(avg(T.audit_pass_date::date - T.create_date::date + 1),1) as strValue,
T.receive_company_code AS keyStr
T.receive_org_code AS keyStr
FROM
(
SELECT
crn.sequence_nbr,
crn.receive_org_code as receive_company_code,
crn.receive_org_code,
crn.audit_pass_date,
crn.create_date
FROM
......@@ -970,11 +1049,13 @@
and 1=1
</when>
<otherwise>
and crn.receive_company_code = ANY(ARRAY[
<if test="dto.companyCodes != null and dto.companyCodes.size > 0" >
and crn.receive_org_code = ANY(ARRAY[
<foreach collection="dto.companyCodes" item="companyCode" separator=",">
#{companyCode}
</foreach>
])
</if>
</otherwise>
</choose>
<if test="dto.beginDate !=null and dto.beginDate !=''">
......@@ -984,7 +1065,7 @@
and date_le(CAST(T.create_date as date),#{dto.endDate})
</if>
) T
GROUP BY T.receive_company_code
GROUP BY T.receive_org_code
</select>
<select id="selectAZNoticeDetailList" resultType="java.util.Map">
SELECT
......
......@@ -1313,9 +1313,9 @@ public class JGDPStatisticsServiceImpl {
List<String> yData = new ArrayList<>();
regionModels.forEach(r -> {
xData.add(r.getRegionName());
String orgCode = stCommonService.getAndSetOrgCode(r.getRegionCode().toString());
if (!ValidationUtil.isEmpty(orgCode)) {
yData.add(this.avgAndSumDealDate(countDtos.stream().filter(c -> c.getKeyStr().contains(orgCode)).collect(Collectors.toList())));
String selfAndChildRegion = stCommonService.getSelfAndChildRegion(r);
if (!ValidationUtil.isEmpty(selfAndChildRegion)) {
yData.add(this.avgAndSumDealDate(countDtos.stream().filter(c -> selfAndChildRegion.contains(stCommonService.castCompanyCode2RegionCode(c.getKeyStr()))).collect(Collectors.toList())));
} else {
yData.add("0");
}
......
......@@ -22,6 +22,7 @@ import com.yeejoin.amos.boot.module.ymt.api.mapper.EquipTechParamPipelineMapper;
import com.yeejoin.amos.boot.module.ymt.api.mapper.EquipmentCategoryMapper;
import com.yeejoin.amos.feign.systemctl.Systemctl;
import com.yeejoin.amos.feign.systemctl.model.RegionModel;
import lombok.Getter;
import org.apache.commons.lang3.StringUtils;
import org.apache.lucene.queryparser.classic.QueryParser;
import org.apache.lucene.search.join.ScoreMode;
......@@ -77,23 +78,24 @@ public class StCommonServiceImpl {
*/
public final static String REGION_LEVEL_THIRD = "3";
private CommonBaseMapper commonMapper;
private final CommonBaseMapper commonMapper;
private RestHighLevelClient restHighLevelClient;
private final RestHighLevelClient restHighLevelClient;
private TZSCommonServiceImpl tzsCommonService;
private final TZSCommonServiceImpl tzsCommonService;
private EquipTechParamPipelineMapper techParamsPipelineMapper;
private final EquipTechParamPipelineMapper techParamsPipelineMapper;
private EquipmentCategoryMapper equipmentCategoryMapper;
private final EquipmentCategoryMapper equipmentCategoryMapper;
private ZLStatisticsMapper zlStatisticsMapper;
private final ZLStatisticsMapper zlStatisticsMapper;
private static Map<String, String> regionCodeOrgCodeMap = new ConcurrentHashMap<>();
@Getter
private static final Map<String, String> regionCodeOrgCodeMap = new ConcurrentHashMap<>();
private static Map<Integer, RegionModel> regionCodeRegionMap = new ConcurrentHashMap<>();
private static List<RegionModel> regionModels = new ArrayList<>();
private static final List<RegionModel> regionModels = new ArrayList<>();
private static List<EquipmentCategoryDto> equipmentCategoryDtos;
......@@ -111,10 +113,6 @@ public class StCommonServiceImpl {
this.tzsCommonService = tzsCommonService;
}
public static Map<String, String> getRegionCodeOrgCodeMap() {
return regionCodeOrgCodeMap;
}
public static List<EquipmentCategoryDto> getEquipmentCategory() {
return equipmentCategoryDtos;
}
......@@ -156,9 +154,18 @@ public class StCommonServiceImpl {
public String getAndSetOrgCode(DPFilterParamDto dpFilterParamDto) {
String cityCode = dpFilterParamDto.getCityCode();
this.setChildCompanyCodeByRegion(cityCode, dpFilterParamDto);
return getAndSetOrgCode(cityCode);
}
/**
* 按照regionCode查询区域下的公司
* @param cityCode 区域
* @param dpFilterParamDto 过滤条件
*/
private void setChildCompanyCodeByRegion(String cityCode, DPFilterParamDto dpFilterParamDto) {
}
public String getAndSetOrgCode(String cityCode) {
String orgCode = regionCodeOrgCodeMap.get(cityCode);
if (orgCode == null) {
......@@ -551,4 +558,25 @@ public class StCommonServiceImpl {
children.forEach(child -> buildSubtree(child, parentCodeMap));
}
}
/**
* 获取本级及子级区域code
* @param region 区域
* @return 本级及子级区域code
*/
public String getSelfAndChildRegion(RegionModel region) {
return null;
}
/**
* 将单位code转行政区划
* @param companyCode 单位code
* @return 单位所在行政区划
*/
public CharSequence castCompanyCode2RegionCode(String companyCode) {
String regionSeq = commonMapper.selectCompanyRegionSeq(companyCode);
Optional<RegionModel> optionalRegionModel = regionModels.stream().filter(r-> String.valueOf(r.getSequenceNbr()).equals(regionSeq)).findFirst();
optionalRegionModel.orElseThrow(()->new RuntimeException(""));
return null;
}
}
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