17 changed files with 960 additions and 50 deletions
@ -0,0 +1,120 @@ |
|||
package com.zdxt.enforcementcode.controller.web.supervision.report; |
|||
|
|||
|
|||
import cn.dev33.satoken.annotation.SaIgnore; |
|||
import com.zdxt.enforcementcode.domain.bo.DashboardTrendStatAreaBo; |
|||
import com.zdxt.enforcementcode.domain.bo.DashboardTrendStatDomainBo; |
|||
import com.zdxt.enforcementcode.domain.bo.ScanDataSituationBo; |
|||
import com.zdxt.enforcementcode.domain.vo.DashboardTrendStatAreaVo; |
|||
import com.zdxt.enforcementcode.domain.vo.DashboardTrendStatDomainVo; |
|||
import com.zdxt.enforcementcode.domain.vo.ScanDataSituationVo; |
|||
import com.zdxt.enforcementcode.report.IScanDataSituationService; |
|||
import jakarta.servlet.http.HttpServletResponse; |
|||
import lombok.RequiredArgsConstructor; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.dromara.common.excel.utils.ExcelUtil; |
|||
import org.dromara.common.mybatis.core.page.PageQuery; |
|||
import org.dromara.common.mybatis.core.page.TableDataInfo; |
|||
import org.springframework.validation.annotation.Validated; |
|||
import org.springframework.web.bind.annotation.GetMapping; |
|||
import org.springframework.web.bind.annotation.PostMapping; |
|||
import org.springframework.web.bind.annotation.RequestMapping; |
|||
import org.springframework.web.bind.annotation.RestController; |
|||
|
|||
import java.util.List; |
|||
|
|||
|
|||
/** |
|||
* 各区,各领域扫码情况 |
|||
*/ |
|||
@SaIgnore |
|||
@Slf4j |
|||
@Validated |
|||
@RequiredArgsConstructor |
|||
@RestController |
|||
@RequestMapping("/web/supervision/report/scanDataSituation") |
|||
public class ScanDataSituationController { |
|||
|
|||
|
|||
private final IScanDataSituationService scanDataSituationService; |
|||
|
|||
/** |
|||
* 各区扫码情况 |
|||
* @param bo |
|||
* @param pageQuery |
|||
* @return |
|||
*/ |
|||
@GetMapping("/areaList") |
|||
public TableDataInfo<ScanDataSituationVo> selectScanDataSituationAreaPageList(ScanDataSituationBo bo, PageQuery pageQuery) { |
|||
return scanDataSituationService.selectScanDataSituationAreaPageList( pageQuery,bo); |
|||
} |
|||
|
|||
/** |
|||
* 各区扫码情况明细 |
|||
* @param bo |
|||
* @param pageQuery |
|||
* @return |
|||
*/ |
|||
@GetMapping("/areaDetailsList") |
|||
public TableDataInfo<ScanDataSituationVo> selectScanDataSituationAreaDetailsPageList(ScanDataSituationBo bo, PageQuery pageQuery) { |
|||
return scanDataSituationService.selectScanDataSituationAreaDetailsPageList( pageQuery,bo); |
|||
} |
|||
|
|||
/** |
|||
* 各区扫码情-导出Excel |
|||
*/ |
|||
@PostMapping("/exportArea") |
|||
public void export(ScanDataSituationBo bo, HttpServletResponse response) { |
|||
try { |
|||
List<ScanDataSituationVo> list = scanDataSituationService.selectScanDataSituationAreaList(bo); |
|||
ExcelUtil.exportExcel(list, "各区扫码情", ScanDataSituationVo.class, response); |
|||
} catch (Exception e) { |
|||
log.error("导出各区扫码情Excel异常", e); |
|||
response.reset(); |
|||
response.setContentType("application/json; charset=utf-8"); |
|||
try { |
|||
response.getWriter().write("{\"code\":500,\"msg\":\"导出失败: " + e.getMessage() + "\"}"); |
|||
} catch (Exception ignored) { |
|||
log.error("响应重置异常", ignored); |
|||
} |
|||
} |
|||
} |
|||
|
|||
/** |
|||
* 各领域扫码情况 |
|||
*/ |
|||
@GetMapping("/domainList") |
|||
public TableDataInfo<ScanDataSituationVo> queryTrendBehaviorDomainPageList(ScanDataSituationBo bo, PageQuery pageQuery) { |
|||
return scanDataSituationService.selectScanDataSituationDomainPageList(pageQuery,bo); |
|||
} |
|||
|
|||
/** |
|||
* 各领域扫码情况明细 |
|||
* @param bo |
|||
* @param pageQuery |
|||
* @return |
|||
*/ |
|||
@GetMapping("/domainDetailsList") |
|||
public TableDataInfo<ScanDataSituationVo> selectScanDataSituationDomainDetailsPageList(ScanDataSituationBo bo, PageQuery pageQuery) { |
|||
return scanDataSituationService.selectScanDataSituationDomainDetailsPageList(pageQuery,bo); |
|||
} |
|||
/** |
|||
* 各领域扫码情况-导出Excel |
|||
*/ |
|||
@PostMapping("/exportDomain") |
|||
public void exportDomain(ScanDataSituationBo bo, HttpServletResponse response) { |
|||
try { |
|||
List<ScanDataSituationVo> list = scanDataSituationService.selectScanDataSituationDomainList(bo); |
|||
ExcelUtil.exportExcel(list, "各领域扫码情况", ScanDataSituationVo.class, response); |
|||
} catch (Exception e) { |
|||
log.error("导出各领域扫码情况Excel异常", e); |
|||
response.reset(); |
|||
response.setContentType("application/json; charset=utf-8"); |
|||
try { |
|||
response.getWriter().write("{\"code\":500,\"msg\":\"导出失败: " + e.getMessage() + "\"}"); |
|||
} catch (Exception ignored) { |
|||
log.error("响应重置异常", ignored); |
|||
} |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,55 @@ |
|||
package com.zdxt.enforcementcode.domain.bo; |
|||
|
|||
|
|||
import lombok.Data; |
|||
|
|||
import java.util.Date; |
|||
|
|||
@Data |
|||
public class ScanDataSituationBo { |
|||
|
|||
/** |
|||
* 区id |
|||
*/ |
|||
private String districtCode; |
|||
|
|||
/** |
|||
* 区名称 |
|||
*/ |
|||
private String districtName; |
|||
|
|||
/** |
|||
* 领域id |
|||
*/ |
|||
private String domainId; |
|||
|
|||
/** |
|||
* 领域名称 |
|||
*/ |
|||
private String domainName; |
|||
|
|||
/** |
|||
* 年 |
|||
*/ |
|||
private String year; |
|||
|
|||
/** |
|||
* 季度 |
|||
*/ |
|||
private String quarter; |
|||
|
|||
/** |
|||
* 月 |
|||
*/ |
|||
private String month; |
|||
|
|||
/** |
|||
* 开始时间 |
|||
*/ |
|||
private Date startTime; |
|||
|
|||
/** |
|||
* 结束时间 |
|||
*/ |
|||
private Date endTime; |
|||
} |
|||
@ -0,0 +1,96 @@ |
|||
package com.zdxt.enforcementcode.domain.vo; |
|||
|
|||
|
|||
import cn.idev.excel.annotation.ExcelIgnoreUnannotated; |
|||
import cn.idev.excel.annotation.ExcelProperty; |
|||
import lombok.Data; |
|||
|
|||
@Data |
|||
@ExcelIgnoreUnannotated |
|||
public class ScanDataSituationVo { |
|||
|
|||
/** |
|||
* 区编码 |
|||
*/ |
|||
@ExcelProperty(value = "区编码") |
|||
private String districtCode; |
|||
|
|||
/** |
|||
* 区名称 |
|||
*/ |
|||
@ExcelProperty(value = "区名称") |
|||
private String districtName; |
|||
|
|||
/** |
|||
* 领域id |
|||
*/ |
|||
@ExcelProperty(value = "领域id") |
|||
private String domainId; |
|||
|
|||
/** |
|||
* 领域名称 |
|||
*/ |
|||
@ExcelProperty(value = "领域名称") |
|||
private String domainName; |
|||
|
|||
/** |
|||
* 街道编码 |
|||
*/ |
|||
@ExcelProperty(value = "街道编码") |
|||
private String streetCode; |
|||
|
|||
/** |
|||
* 街道名称 |
|||
*/ |
|||
@ExcelProperty(value = "街道名称") |
|||
private String streetName; |
|||
|
|||
/** |
|||
* 商户主体数量 |
|||
*/ |
|||
@ExcelProperty(value = "商户主体数量") |
|||
private Long enterpriseCount; |
|||
|
|||
/** |
|||
* 行政执法数量 |
|||
*/ |
|||
@ExcelProperty(value = "行政执法数量") |
|||
private Long xzzfCount; |
|||
|
|||
/** |
|||
* 行政执法数量排名 |
|||
*/ |
|||
@ExcelProperty(value = "行政执法数量排名") |
|||
private Long xzzfslpm; |
|||
|
|||
/** |
|||
* 行政执法数量占比 |
|||
*/ |
|||
@ExcelProperty(value = "行政执法数量占比") |
|||
private Double xzzfslzb; |
|||
|
|||
/** |
|||
* 非行政执法数量 |
|||
*/ |
|||
@ExcelProperty(value = "非行政执法数量") |
|||
private Long fxzzfsl; |
|||
|
|||
/** |
|||
* 非行政执法数量排名 |
|||
*/ |
|||
@ExcelProperty(value = "非行政执法数量排名") |
|||
private Long fxzzfslpm; |
|||
|
|||
/** |
|||
* 非行政执法数量占比 |
|||
*/ |
|||
@ExcelProperty(value = "非行政执法数量占比") |
|||
private Double fxzzfslzb; |
|||
|
|||
/** |
|||
* 执法总数 |
|||
*/ |
|||
@ExcelProperty(value = "执法总数") |
|||
private Long totalCount; |
|||
|
|||
} |
|||
@ -0,0 +1,29 @@ |
|||
package com.zdxt.enforcementcode.mapper; |
|||
|
|||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|||
import com.zdxt.enforcementcode.domain.bo.EnforcementRegistrationBo; |
|||
import com.zdxt.enforcementcode.domain.bo.ScanDataSituationBo; |
|||
import com.zdxt.enforcementcode.domain.vo.EnforcementRegistrationVo; |
|||
import com.zdxt.enforcementcode.domain.vo.ScanDataSituationVo; |
|||
import org.apache.ibatis.annotations.Param; |
|||
|
|||
import java.util.List; |
|||
|
|||
public interface ScanDataSituationMapper { |
|||
|
|||
Page<ScanDataSituationVo> selectScanDataSituationAreaPageList(@Param("page") Page<ScanDataSituationVo> page, |
|||
@Param("bo") ScanDataSituationBo bo); |
|||
|
|||
List<ScanDataSituationVo> selectScanDataSituationAreaList(@Param("bo") ScanDataSituationBo bo); |
|||
|
|||
Page<ScanDataSituationVo> selectScanDataSituationAreaDetailsPageList(@Param("page") Page<ScanDataSituationVo> page, |
|||
@Param("bo") ScanDataSituationBo bo); |
|||
|
|||
Page<ScanDataSituationVo> selectScanDataSituationDomainPageList(@Param("page") Page<ScanDataSituationVo> page, |
|||
@Param("bo") ScanDataSituationBo bo); |
|||
|
|||
List<ScanDataSituationVo> selectScanDataSituationDomainList(@Param("bo") ScanDataSituationBo bo); |
|||
|
|||
Page<ScanDataSituationVo> selectScanDataSituationDomainDetailsPageList(@Param("page") Page<ScanDataSituationVo> page, |
|||
@Param("bo") ScanDataSituationBo bo); |
|||
} |
|||
@ -0,0 +1,26 @@ |
|||
package com.zdxt.enforcementcode.report; |
|||
|
|||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|||
import com.zdxt.enforcementcode.domain.bo.ScanDataSituationBo; |
|||
import com.zdxt.enforcementcode.domain.vo.ScanDataSituationVo; |
|||
import org.apache.ibatis.annotations.Param; |
|||
import org.dromara.common.mybatis.core.page.PageQuery; |
|||
import org.dromara.common.mybatis.core.page.TableDataInfo; |
|||
|
|||
import java.util.List; |
|||
|
|||
public interface IScanDataSituationService { |
|||
|
|||
|
|||
TableDataInfo<ScanDataSituationVo> selectScanDataSituationAreaPageList(PageQuery pageQuery,ScanDataSituationBo bo); |
|||
|
|||
List<ScanDataSituationVo> selectScanDataSituationAreaList(ScanDataSituationBo bo); |
|||
|
|||
TableDataInfo<ScanDataSituationVo> selectScanDataSituationAreaDetailsPageList(PageQuery pageQuery,ScanDataSituationBo bo); |
|||
|
|||
TableDataInfo<ScanDataSituationVo> selectScanDataSituationDomainPageList(PageQuery pageQuery, ScanDataSituationBo bo); |
|||
|
|||
List<ScanDataSituationVo> selectScanDataSituationDomainList(ScanDataSituationBo bo); |
|||
|
|||
TableDataInfo<ScanDataSituationVo> selectScanDataSituationDomainDetailsPageList(PageQuery pageQuery, ScanDataSituationBo bo); |
|||
} |
|||
@ -0,0 +1,55 @@ |
|||
package com.zdxt.enforcementcode.report.impl; |
|||
|
|||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|||
import com.zdxt.enforcementcode.domain.bo.ScanDataSituationBo; |
|||
import com.zdxt.enforcementcode.domain.vo.ScanDataSituationVo; |
|||
import com.zdxt.enforcementcode.mapper.ScanDataSituationMapper; |
|||
import com.zdxt.enforcementcode.report.IScanDataSituationService; |
|||
import lombok.RequiredArgsConstructor; |
|||
import org.dromara.common.mybatis.core.page.PageQuery; |
|||
import org.dromara.common.mybatis.core.page.TableDataInfo; |
|||
import org.springframework.stereotype.Service; |
|||
|
|||
import java.util.List; |
|||
|
|||
@Service |
|||
@RequiredArgsConstructor |
|||
public class ScanDataSituationServiceImpl implements IScanDataSituationService { |
|||
|
|||
private final ScanDataSituationMapper scanDataSituationMapper; |
|||
|
|||
@Override |
|||
public TableDataInfo<ScanDataSituationVo> selectScanDataSituationAreaPageList(PageQuery pageQuery, ScanDataSituationBo bo) { |
|||
Page<ScanDataSituationVo> page=scanDataSituationMapper.selectScanDataSituationAreaPageList(pageQuery.build(),bo); |
|||
return TableDataInfo.build(page); |
|||
} |
|||
|
|||
@Override |
|||
public List<ScanDataSituationVo> selectScanDataSituationAreaList(ScanDataSituationBo bo) { |
|||
return scanDataSituationMapper.selectScanDataSituationAreaList(bo); |
|||
} |
|||
|
|||
@Override |
|||
public TableDataInfo<ScanDataSituationVo> selectScanDataSituationAreaDetailsPageList(PageQuery pageQuery, ScanDataSituationBo bo) { |
|||
Page<ScanDataSituationVo> page=scanDataSituationMapper.selectScanDataSituationAreaDetailsPageList(pageQuery.build(),bo); |
|||
return TableDataInfo.build(page); |
|||
} |
|||
|
|||
|
|||
@Override |
|||
public TableDataInfo<ScanDataSituationVo> selectScanDataSituationDomainPageList(PageQuery pageQuery, ScanDataSituationBo bo) { |
|||
Page<ScanDataSituationVo> page=scanDataSituationMapper.selectScanDataSituationDomainPageList(pageQuery.build(),bo); |
|||
return TableDataInfo.build(page); |
|||
} |
|||
|
|||
@Override |
|||
public List<ScanDataSituationVo> selectScanDataSituationDomainList(ScanDataSituationBo bo) { |
|||
return scanDataSituationMapper.selectScanDataSituationDomainList(bo); |
|||
} |
|||
|
|||
@Override |
|||
public TableDataInfo<ScanDataSituationVo> selectScanDataSituationDomainDetailsPageList(PageQuery pageQuery, ScanDataSituationBo bo) { |
|||
Page<ScanDataSituationVo> page=scanDataSituationMapper.selectScanDataSituationDomainDetailsPageList(pageQuery.build(),bo); |
|||
return TableDataInfo.build(page); |
|||
} |
|||
} |
|||
@ -0,0 +1,503 @@ |
|||
<?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"> |
|||
<mapper namespace="com.zdxt.enforcementcode.mapper.ScanDataSituationMapper"> |
|||
|
|||
<sql id="selectScanDataSituationAreaSql"> |
|||
select |
|||
district_code as districtCode, |
|||
district_name as districtName, |
|||
enterprise_count as enterpriseCount, |
|||
xzzf_count as xzzfCount, |
|||
rank()over (order by xzzf_count desc ) as xzzfslpm, |
|||
ROUND(xzzf_count*100.0/nullif(SUM(xzzf_count)over(),0),2) as xzzfslzb, |
|||
fxzzf_count as fxzzfsl, |
|||
rank()over (order by fxzzf_count desc ) as fxzzfslpm, |
|||
ROUND(fxzzf_count*100.0/nullif(SUM(fxzzf_count)over(),0),2) as fxzzfslzb, |
|||
(xzzf_count+fxzzf_count) as totalCount |
|||
from |
|||
( |
|||
select |
|||
t3.code as district_code, |
|||
t3.name as district_name, |
|||
coalesce (ent.ent_cnt,0) as enterprise_count, |
|||
coalesce (xz.xz_cnt,0) as xzzf_count, |
|||
coalesce (fxz.fxz_cnt,0) as fxzzf_count |
|||
from |
|||
dashboard_area_info t3 |
|||
<!-- 1) 商事主体数量(户):通过企业地址截取区名归集,不再走 sys_dept.dept_id--> |
|||
left join ( |
|||
select |
|||
t4.code as code, |
|||
COUNT(1) as ent_cnt |
|||
from |
|||
enterprise_information t1 |
|||
join dashboard_area_info t4 on |
|||
t1.enterprise_address like CONCAT('%' ,t4.name,'%') |
|||
where |
|||
t1.is_delete = 0 |
|||
and t4.level = 3 |
|||
and t4.is_delete = '0' |
|||
group by |
|||
t4.code |
|||
) ent on |
|||
t3.code = ent.code |
|||
<!-- 2) 行政执法数量(条):enforcement_registration 按区聚合--> |
|||
left join ( |
|||
select |
|||
t2.area_node as code, |
|||
COUNT(1) as xz_cnt |
|||
from |
|||
enforcement_registration t1 |
|||
left join sys_dept t2 on |
|||
t1.bureau_dept_id = t2.dept_id |
|||
where |
|||
t1.is_delete = 0 |
|||
and t1.is_submit = 1 |
|||
and t1.enterprise_name is not null |
|||
and t1.enterprise_number is not null |
|||
<!--and year(t1.enforcement_time) = '2026'--> |
|||
<if test = "bo.year != null"> |
|||
AND YEAR(t1.enforcement_time) = #{bo.year} |
|||
</if> |
|||
<if test = "bo.quarter != null"> |
|||
AND QUARTER(t1.enforcement_time) = #{bo.quarter} |
|||
</if> |
|||
<if test = "bo.month != null"> |
|||
AND MONTH(t1.enforcement_time) = #{bo.month} |
|||
</if> |
|||
<if test = "bo.startTime != null"> |
|||
AND DATE_FORMAT(t1.enforcement_time,'%Y-%m-%d') >= DATE_FORMAT(#{bo.startTime},'%Y-%m-%d') |
|||
<!--and DATE_FORMAT(t1.enforcement_time,'%Y-%m') = DATE_FORMAT(#{bo.enforcementTime},'%Y-%m')--> |
|||
</if> |
|||
<if test = "bo.endTime != null"> |
|||
AND DATE_FORMAT(t1.enforcement_time,'%Y-%m-%d') <= DATE_FORMAT(#{bo.endTime},'%Y-%m-%d') |
|||
</if> |
|||
and t2.area_node is not null |
|||
group by |
|||
t2.area_node |
|||
) xz on |
|||
t3.code = xz.code |
|||
<!-- 3) 非行政执法数量:non_enforcement_registration 按区聚合--> |
|||
left join ( |
|||
select |
|||
t2.area_node as code, |
|||
COUNT(1) as fxz_cnt |
|||
from |
|||
non_enforcement_registration t1 |
|||
left join sys_dept t2 on |
|||
t1.bureau_dept_id = t2.dept_id |
|||
where |
|||
t1.has_delete = 0 |
|||
<!--and year(t1.enforcement_time) = '2026'--> |
|||
<if test = "bo.year != null"> |
|||
AND YEAR(t1.enforcement_time) = #{bo.year} |
|||
</if> |
|||
<if test = "bo.quarter != null"> |
|||
AND QUARTER(t1.enforcement_time) = #{bo.quarter} |
|||
</if> |
|||
<if test = "bo.month != null"> |
|||
AND MONTH(t1.enforcement_time) = #{bo.month} |
|||
</if> |
|||
<if test = "bo.startTime != null"> |
|||
AND DATE_FORMAT(t1.enforcement_time,'%Y-%m-%d') >= DATE_FORMAT(#{bo.startTime},'%Y-%m-%d') |
|||
</if> |
|||
<if test = "bo.endTime != null"> |
|||
AND DATE_FORMAT(t1.enforcement_time,'%Y-%m-%d') <= DATE_FORMAT(#{bo.endTime},'%Y-%m-%d') |
|||
</if> |
|||
and t2.area_node is not null |
|||
group by |
|||
t2.area_node |
|||
) fxz on |
|||
t3.code = fxz.code |
|||
where |
|||
t3.level = 3 |
|||
and t3.is_delete = '0' |
|||
<if test = "bo.districtCode != null and bo.districtCode != ''" > |
|||
AND t3.code = #{bo.districtCode} |
|||
</if> |
|||
<if test = "bo.districtName != null and bo.districtName != ''" > |
|||
AND t3.name = #{bo.districtName} |
|||
</if> |
|||
) base |
|||
<!--#where base.district_name ='宝安区'--> |
|||
order by |
|||
xzzfslpm |
|||
</sql> |
|||
|
|||
<select id="selectScanDataSituationAreaPageList" resultType="com.zdxt.enforcementcode.domain.vo.ScanDataSituationVo"> |
|||
<include refid="selectScanDataSituationAreaSql"/> |
|||
</select> |
|||
|
|||
<select id="selectScanDataSituationAreaList" resultType="com.zdxt.enforcementcode.domain.vo.ScanDataSituationVo"> |
|||
<include refid="selectScanDataSituationAreaSql"/> |
|||
</select> |
|||
|
|||
|
|||
<select id="selectScanDataSituationAreaDetailsPageList" resultType="com.zdxt.enforcementcode.domain.vo.ScanDataSituationVo"> |
|||
select |
|||
street_code as streetCode, |
|||
street_name as streetName, |
|||
enterprise_count as enterpriseCount, |
|||
xzzf_count as xzzfCount, |
|||
rank()over (order by xzzf_count desc ) as xzzfslpm, |
|||
ROUND(xzzf_count*100.0/nullif(SUM(xzzf_count)over(),0),2) as xzzfslzb, |
|||
fxzzf_count as fxzzfsl, |
|||
rank()over (order by fxzzf_count desc ) as fxzzfslpm, |
|||
ROUND(fxzzf_count*100.0/nullif(SUM(fxzzf_count)over(),0),2) as fxzzfslzb, |
|||
(xzzf_count + fxzzf_count) as totalCount |
|||
from |
|||
( |
|||
select |
|||
t3.code as street_code, |
|||
t3.name as street_name, |
|||
coalesce (ent.ent_cnt,0) as enterprise_count, |
|||
coalesce (xz.xz_cnt,0) as xzzf_count, |
|||
coalesce (fxz.fxz_cnt,0) as fxzzf_count |
|||
from |
|||
dashboard_area_info t3 |
|||
<!-- 1) 商事主体数量:enterprise_information 企业地址匹配街道名--> |
|||
left join ( |
|||
select |
|||
t4.code as code, |
|||
COUNT(1) as ent_cnt |
|||
from |
|||
enterprise_information t1 |
|||
join dashboard_area_info t4 on |
|||
t1.enterprise_address like CONCAT('%' ,t4.name,'%') |
|||
where |
|||
t1.is_delete = 0 |
|||
and t4.level = 4 |
|||
and t4.is_delete = '0' |
|||
<if test="bo.districtCode!=null and bo.districtCode!=''"> |
|||
and t4.parent_code =#{bo.districtCode} |
|||
</if> |
|||
GROUP BY t4.code |
|||
) ent on |
|||
t3.code = ent.code |
|||
<!-- 2) 行政执法数量:enforcement_registration 自带 enterprise_address,直接匹配街道名--> |
|||
left join ( |
|||
select |
|||
t4.code as code, |
|||
COUNT(1) as xz_cnt |
|||
from |
|||
enforcement_registration t1 |
|||
join dashboard_area_info t4 on |
|||
t1.enterprise_address like CONCAT('%',t4.name,'%') |
|||
where |
|||
t1.is_delete = 0 |
|||
and t1.is_submit = 1 |
|||
and t1.enterprise_name is not null |
|||
and t1.enterprise_number is not null |
|||
AND t4.level = 4 |
|||
and t4.is_delete = '0' |
|||
<!--and year(t1.enforcement_time) ='2026'--> |
|||
<if test = "bo.year != null"> |
|||
AND YEAR(t1.enforcement_time) = #{bo.year} |
|||
</if> |
|||
<if test = "bo.quarter != null"> |
|||
AND QUARTER(t1.enforcement_time) = #{bo.quarter} |
|||
</if> |
|||
<if test = "bo.month != null"> |
|||
AND MONTH(t1.enforcement_time) = #{bo.month} |
|||
</if> |
|||
<if test = "bo.startTime != null"> |
|||
AND DATE_FORMAT(t1.enforcement_time,'%y-%m-%d') >= DATE_FORMAT(#{bo.startTime},'%y-%m-%d') |
|||
</if> |
|||
<if test = "bo.endTime != null"> |
|||
AND DATE_FORMAT(t1.enforcement_time,'%y-%m-%d') <= DATE_FORMAT(#{bo.endTime},'%y-%m-%d') |
|||
</if> |
|||
<if test="bo.districtCode!=null and bo.districtCode!=''"> |
|||
and t4.parent_code =#{bo.districtCode} |
|||
</if> |
|||
GROUP BY t4.code |
|||
) xz on |
|||
t3.code = xz.code |
|||
<!-- 3) 非行政执法数量:non_enforcement_registration 自带 enterprise_address,直接匹配街道名--> |
|||
left join ( |
|||
select |
|||
t4.code as code, |
|||
COUNT(1) as fxz_cnt |
|||
from |
|||
non_enforcement_registration t1 |
|||
join dashboard_area_info t4 on |
|||
t1.enterprise_address like CONCAT('%',t4.name,'%') |
|||
where |
|||
t1.has_delete = 0 |
|||
and t4.level = 4 |
|||
and t4.is_delete = '0' |
|||
<!--and year(t1.enforcement_time) ='2026'--> |
|||
<if test = "bo.year != null"> |
|||
AND YEAR(t1.enforcement_time) = #{bo.year} |
|||
</if> |
|||
<if test = "bo.quarter != null"> |
|||
AND QUARTER(t1.enforcement_time) = #{bo.quarter} |
|||
</if> |
|||
<if test = "bo.month != null"> |
|||
AND MONTH(t1.enforcement_time) = #{bo.month} |
|||
</if> |
|||
<if test = "bo.startTime != null"> |
|||
AND DATE_FORMAT(t1.enforcement_time,'%y-%m-%d') >= DATE_FORMAT(#{bo.startTime},'%y-%m-%d') |
|||
</if> |
|||
<if test = "bo.endTime != null"> |
|||
AND DATE_FORMAT(t1.enforcement_time,'%y-%m-%d') <= DATE_FORMAT(#{bo.endTime},'%y-%m-%d') |
|||
</if> |
|||
<if test="bo.districtCode!=null and bo.districtCode!=''"> |
|||
and t4.parent_code =#{bo.districtCode} |
|||
</if> |
|||
GROUP BY t4.code |
|||
) fxz on |
|||
t3.code = fxz.code |
|||
where |
|||
t3.level = 4 |
|||
and t3.is_delete = '0' |
|||
<if test="bo.districtCode!=null and bo.districtCode!=''"> |
|||
and t3.parent_code =#{bo.districtCode} |
|||
</if> |
|||
) base |
|||
order by |
|||
xzzfslpm |
|||
</select> |
|||
|
|||
|
|||
<sql id="selectScanDataSituationDomainSql"> |
|||
select |
|||
domain_id as domainId, |
|||
domain_name as domainName, |
|||
xzzf_count as xzzfCount, |
|||
rank() over (order by xzzf_count desc) as xzzfslpm, |
|||
ROUND(xzzf_count * 100.0 / nullif(SUM(xzzf_count)over(), 0), 2) as xzzfslzb, |
|||
fxzzf_count as fxzzfsl, |
|||
rank() over (order by fxzzf_count desc ) as fxzzfslpm, |
|||
ROUND(fxzzf_count * 100.0 / nullif(SUM(fxzzf_count)over(), 0), 2) as fxzzfslzb, |
|||
(xzzf_count + fxzzf_count) as totalCount |
|||
from |
|||
( |
|||
select |
|||
distinct t1.domain_id, |
|||
t1.domain_name, |
|||
coalesce (xz.xz_cnt,0) as xzzf_count, |
|||
coalesce (fxz.fxz_cnt,0) as fxzzf_count |
|||
from |
|||
dashboard_domain_dept t1 |
|||
<!-- 新增:关联 sys_dept 定位部门所属区--> |
|||
left join sys_dept t2 on |
|||
t1.dept_id = t2.dept_id |
|||
<!-- 1) 行政执法数量:按领域聚合(限定某区)--> |
|||
left join ( |
|||
select |
|||
t4.domain_id, |
|||
COUNT(1) as xz_cnt |
|||
from |
|||
enforcement_registration t2 |
|||
left join dashboard_domain_dept t4 on |
|||
t2.bureau_dept_id = t4.dept_id |
|||
left join sys_dept t5 on |
|||
t2.bureau_dept_id = t5.dept_id |
|||
where |
|||
t2.is_delete = 0 |
|||
and t2.is_submit = 1 |
|||
and t2.enterprise_name is not null |
|||
and t2.enterprise_number is not null |
|||
and t4.domain_id is not null |
|||
<if test = "bo.year != null"> |
|||
AND YEAR(t2.enforcement_time) = #{bo.year} |
|||
</if> |
|||
<if test = "bo.quarter != null"> |
|||
AND QUARTER(t2.enforcement_time) = #{bo.quarter} |
|||
</if> |
|||
<if test = "bo.month != null"> |
|||
AND MONTH(t2.enforcement_time) = #{bo.month} |
|||
</if> |
|||
<if test = "bo.startTime != null"> |
|||
AND DATE_FORMAT(t2.enforcement_time,'%y-%m-%d') >= DATE_FORMAT(#{bo.startTime},'%y-%m-%d') |
|||
</if> |
|||
<if test = "bo.endTime != null"> |
|||
AND DATE_FORMAT(t2.enforcement_time,'%y-%m-%d') <= DATE_FORMAT(#{bo.endTime},'%y-%m-%d') |
|||
</if> |
|||
<if test="bo.districtCode !=null and bo.districtCode!=''"> |
|||
and t5.area_node =#{bo.districtCode} |
|||
</if> |
|||
|
|||
group by |
|||
t4.domain_id |
|||
) xz on |
|||
t1.domain_id = xz.domain_id |
|||
<!--2) 非行政执法数量:按领域聚合(限定某区)--> |
|||
left join ( |
|||
select |
|||
t4.domain_id, |
|||
COUNT(1) as fxz_cnt |
|||
from |
|||
non_enforcement_registration t2 |
|||
left join dashboard_domain_dept t4 on |
|||
t2.bureau_dept_id = t4.dept_id |
|||
left join sys_dept t5 on |
|||
t2.bureau_dept_id = t5.dept_id |
|||
where |
|||
t2.has_delete = 0 |
|||
and t4.domain_id is not null |
|||
<if test = "bo.year != null"> |
|||
AND YEAR(t2.enforcement_time) = #{bo.year} |
|||
</if> |
|||
<if test = "bo.quarter != null"> |
|||
AND QUARTER(t2.enforcement_time) = #{bo.quarter} |
|||
</if> |
|||
<if test = "bo.month != null"> |
|||
AND MONTH(t2.enforcement_time) = #{bo.month} |
|||
</if> |
|||
<if test = "bo.startTime != null"> |
|||
AND DATE_FORMAT(t2.enforcement_time,'%y-%m-%d') >= DATE_FORMAT(#{bo.startTime},'%y-%m-%d') |
|||
</if> |
|||
<if test = "bo.endTime != null"> |
|||
AND DATE_FORMAT(t2.enforcement_time,'%y-%m-%d') <= DATE_FORMAT(#{bo.endTime},'%y-%m-%d') |
|||
</if> |
|||
|
|||
<if test="bo.districtCode !=null and bo.districtCode!=''"> |
|||
and t5.area_node =#{bo.districtCode} |
|||
</if> |
|||
group by |
|||
t4.domain_id |
|||
) fxz on |
|||
t1.domain_id = fxz.domain_id |
|||
<where> |
|||
<if test="bo.districtCode !=null and bo.districtCode!=''"> |
|||
and t2.area_node =#{bo.districtCode} |
|||
</if> |
|||
<if test="bo.domainId!=null and bo.domainId!=''"> |
|||
and t1.domain_id=#{bo.domainId} |
|||
</if> |
|||
</where> |
|||
) base |
|||
order by |
|||
xzzfslpm |
|||
</sql> |
|||
|
|||
<select id="selectScanDataSituationDomainPageList" resultType="com.zdxt.enforcementcode.domain.vo.ScanDataSituationVo"> |
|||
<include refid="selectScanDataSituationDomainSql"/> |
|||
</select> |
|||
|
|||
<select id="selectScanDataSituationDomainList" resultType="com.zdxt.enforcementcode.domain.vo.ScanDataSituationVo"> |
|||
<include refid="selectScanDataSituationDomainSql"/> |
|||
</select> |
|||
|
|||
|
|||
<select id="selectScanDataSituationDomainDetailsPageList" resultType="com.zdxt.enforcementcode.domain.vo.ScanDataSituationVo"> |
|||
select |
|||
domain_id as domainId, |
|||
domain_name as domainName, |
|||
district_code as districtCode, |
|||
district_name as districtName, |
|||
xzzf_count as xzzfCount, |
|||
rank () over (order by xzzf_count desc ) as xzzfslpm, |
|||
ROUND(xzzf_count * 100.0 / nullif(SUM(xzzf_count)over(), 0), 2) as xzzfslzb, |
|||
fxzzf_count as fxzzfsl, |
|||
rank() over (order by fxzzf_count desc ) as fxzzfslpm, |
|||
ROUND(fxzzf_count * 100.0 / nullif(SUM(fxzzf_count)over(), 0), 2) as fxzzfslzb, |
|||
(xzzf_count + fxzzf_count) as totalCount |
|||
from |
|||
( |
|||
select |
|||
<if test="bo.domainId!=null and bo.domainId!=''"> |
|||
#{bo.domainId} AS domain_id, |
|||
</if> |
|||
( |
|||
select |
|||
t9.domain_name |
|||
from |
|||
dashboard_domain_dept t9 |
|||
<where> |
|||
<if test="bo.domainId!=null and bo.domainId!=''"> |
|||
t9.domain_id =#{bo.domainId} |
|||
</if> |
|||
</where> |
|||
limit 1 ) as domain_name, |
|||
t1.code as district_code, |
|||
t1.name as district_name, |
|||
coalesce(xz.xz_cnt, 0) as xzzf_count, |
|||
coalesce(fxz.fxz_cnt, 0) as fxzzf_count |
|||
from |
|||
dashboard_area_info t1 |
|||
<!-- 1) 行政执法数量:固定领域,按区聚合--> |
|||
left join ( |
|||
select |
|||
t3.area_node as code, |
|||
COUNT(1) as xz_cnt |
|||
from |
|||
enforcement_registration t2 |
|||
inner join dashboard_domain_dept t4 on |
|||
t2.bureau_dept_id = t4.dept_id |
|||
inner join sys_dept t3 on |
|||
t2.bureau_dept_id = t3.dept_id |
|||
where |
|||
t2.is_delete = 0 |
|||
and t2.is_submit = 1 |
|||
and t2.enterprise_name is not null |
|||
and t2.enterprise_number is not null |
|||
<if test = "bo.year != null"> |
|||
AND YEAR(t2.enforcement_time) = #{bo.year} |
|||
</if> |
|||
<if test = "bo.quarter != null"> |
|||
AND QUARTER(t2.enforcement_time) = #{bo.quarter} |
|||
</if> |
|||
<if test = "bo.month != null"> |
|||
AND MONTH(t2.enforcement_time) = #{bo.month} |
|||
</if> |
|||
<if test = "bo.startTime != null"> |
|||
AND DATE_FORMAT(t2.enforcement_time,'%y-%m-%d') >= DATE_FORMAT(#{bo.startTime},'%y-%m-%d') |
|||
</if> |
|||
<if test = "bo.endTime != null"> |
|||
AND DATE_FORMAT(t2.enforcement_time,'%y-%m-%d') <= DATE_FORMAT(#{bo.endTime},'%y-%m-%d') |
|||
</if> |
|||
<if test="bo.domainId !=null and bo.domainId!=''"> |
|||
and t4.domain_id =#{bo.domainId} |
|||
</if> |
|||
and t3.area_node is not null |
|||
group by |
|||
t3.area_node |
|||
) xz on |
|||
t1.code = xz.code |
|||
<!--2) 非行政执法数量:固定领域,按区聚合--> |
|||
left join ( |
|||
select |
|||
t3.area_node as code, |
|||
COUNT(1) as fxz_cnt |
|||
from |
|||
non_enforcement_registration t2 |
|||
inner join dashboard_domain_dept t4 on |
|||
t2.bureau_dept_id = t4.dept_id |
|||
inner join sys_dept t3 on |
|||
t2.bureau_dept_id = t3.dept_id |
|||
where |
|||
t2.has_delete = 0 |
|||
<if test = "bo.year != null"> |
|||
AND YEAR(t2.enforcement_time) = #{bo.year} |
|||
</if> |
|||
<if test = "bo.quarter != null"> |
|||
AND QUARTER(t2.enforcement_time) = #{bo.quarter} |
|||
</if> |
|||
<if test = "bo.month != null"> |
|||
AND MONTH(t2.enforcement_time) = #{bo.month} |
|||
</if> |
|||
<if test = "bo.startTime != null"> |
|||
AND DATE_FORMAT(t2.enforcement_time,'%y-%m-%d') >= DATE_FORMAT(#{bo.startTime},'%y-%m-%d') |
|||
</if> |
|||
<if test = "bo.endTime != null"> |
|||
AND DATE_FORMAT(t2.enforcement_time,'%y-%m-%d') <= DATE_FORMAT(#{bo.endTime},'%y-%m-%d') |
|||
</if> |
|||
<if test="bo.domainId !=null and bo.domainId!=''"> |
|||
and t4.domain_id =#{bo.domainId} |
|||
</if> |
|||
and t3.area_node is not null |
|||
group by |
|||
t3.area_node |
|||
) fxz on |
|||
t1.code = fxz.code |
|||
where |
|||
t1.level = 3 |
|||
and t1.is_delete = '0' ) base |
|||
order by |
|||
xzzfslpm |
|||
</select> |
|||
</mapper> |
|||
Loading…
Reference in new issue