Browse Source

CIM-大屏指标查询

dev-V1.0.8
niujiyi 2 months ago
parent
commit
299c0a2290
  1. 93
      zdxt-modules/zdxt-enforcement-code/src/main/java/com/zdxt/enforcementcode/common/util/TbHbUtils.java
  2. 184
      zdxt-modules/zdxt-enforcement-code/src/main/java/com/zdxt/enforcementcode/controller/cim/CimDashboardOverviewController.java
  3. 5
      zdxt-modules/zdxt-enforcement-code/src/main/java/com/zdxt/enforcementcode/domain/bo/CimDashboardOverviewQueryBo.java
  4. 93
      zdxt-modules/zdxt-enforcement-code/src/main/java/com/zdxt/enforcementcode/domain/vo/CimDashboardOverviewVo.java
  5. 67
      zdxt-modules/zdxt-enforcement-code/src/main/java/com/zdxt/enforcementcode/mapper/CimDashboardOverviewMapper.java
  6. 68
      zdxt-modules/zdxt-enforcement-code/src/main/java/com/zdxt/enforcementcode/service/ICimDashboardOverviewService.java
  7. 101
      zdxt-modules/zdxt-enforcement-code/src/main/java/com/zdxt/enforcementcode/service/impl/CimDashboardOverviewServiceImpl.java
  8. 605
      zdxt-modules/zdxt-enforcement-code/src/main/resources/mapper/enforcementcode/CimDashboardOverviewMapper.xml

93
zdxt-modules/zdxt-enforcement-code/src/main/java/com/zdxt/enforcementcode/common/util/TbHbUtils.java

@ -0,0 +1,93 @@
package com.zdxt.enforcementcode.common.util;
import java.util.Calendar;
import java.util.Date;
import java.util.function.Function;
/**
* 同比、环比计算工具类
*
* <pre>
* 用法示例:
* TbHbUtils.TbHbResult result = TbHbUtils.calculate(
* monthTime -> {
* bo.setMonthTime(monthTime);
* return service.getEnfRegistrationCountByMonth(bo);
* },
* currentTime
* );
* vo.setXzzfs(result.currentCount); // 当前数量
* vo.setXzzfsTb(result.tb); // 同比增长率
* vo.setXzzfsHb(result.hb); // 环比增长率
* </pre>
*/
public class TbHbUtils {
/**
* 同比环比结果
*/
public static class TbHbResult {
/** 当前月数量 */
public final Long currentCount;
/** 去年同月数量 */
public final Long lastYearCount;
/** 上月数量 */
public final Long lastMonthCount;
/** 同比增长率(百分比,保留一位小数,如 15.5 表示 +15.5%) */
public final Double tb;
/** 环比增长率(百分比,保留一位小数,如 -3.2 表示 -3.2%) */
public final Double hb;
public TbHbResult(Long currentCount, Long lastYearCount, Long lastMonthCount,
Double tb, Double hb) {
this.currentCount = currentCount;
this.lastYearCount = lastYearCount;
this.lastMonthCount = lastMonthCount;
this.tb = tb;
this.hb = hb;
}
}
/**
* 计算同比、环比增长率
*
* @param countByMonth 传入月份时间,返回该月统计数量的函数
* @param currentTime 当前时间(基准月)
* @return TbHbResult 包含当前数量、同比、环比
*/
public static TbHbResult calculate(Function<Date, Long> countByMonth, Date currentTime) {
// 当前月数量
Long currentCount = countByMonth.apply(currentTime);
// 去年同月
Calendar cal = Calendar.getInstance();
cal.setTime(currentTime);
cal.add(Calendar.YEAR, -1);
Long lastYearCount = countByMonth.apply(cal.getTime());
// 上月
cal.setTime(currentTime);
cal.add(Calendar.MONTH, -1);
Long lastMonthCount = countByMonth.apply(cal.getTime());
Double tb = calculateRate(currentCount, lastYearCount);
Double hb = calculateRate(currentCount, lastMonthCount);
return new TbHbResult(currentCount, lastYearCount, lastMonthCount, tb, hb);
}
/**
* 计算增长率
*
* @param current 当前值
* @param previous 上期值(同比时为去年同月,环比时为上月)
* @return 增长率百分比(保留一位小数),上期为0或null时:当前有值返回100.0,否则返回0.0
*/
public static Double calculateRate(Long current, Long previous) {
long cur = current != null ? current : 0L;
if (previous != null && previous > 0) {
return Math.round((cur - previous) * 1000.0 / previous) / 10.0;
}
return cur > 0 ? 100.0 : 0.0;
}
}

184
zdxt-modules/zdxt-enforcement-code/src/main/java/com/zdxt/enforcementcode/controller/cim/CimDashboardOverviewController.java

@ -2,6 +2,7 @@ package com.zdxt.enforcementcode.controller.cim;
import cn.dev33.satoken.annotation.SaIgnore;
import com.zdxt.enforcementcode.common.util.TbHbUtils;
import com.zdxt.enforcementcode.domain.bo.CimDashboardOverviewQueryBo;
import com.zdxt.enforcementcode.domain.vo.CimDashboardOverviewVo;
import com.zdxt.enforcementcode.service.ICimDashboardOverviewService;
@ -121,14 +122,14 @@ public class CimDashboardOverviewController {
Long ddbmzfCount=cimDashboardOverviewService.getSepDeptLawCount(bo);
vo.setDdbmzf(ddbmzfCount);
//联合执法
Long lhzfCount= cimDashboardOverviewService.getUnionLawCount(bo);
vo.setLhzf(lhzfCount);
Long lhzfsCount= cimDashboardOverviewService.getUnionLawCount(bo);
vo.setLhzfs(lhzfsCount);
//被执法企业
Long bzfqyCount= cimDashboardOverviewService.getSubLawEntCount(bo);
vo.setBzfqy(bzfqyCount);
//入企压减率
Long xzzfCount= cimDashboardOverviewService.getEnfRegistrationCount(bo);
vo.setRqyjl(xzzfCount-(lhzfCount+ddbmzfCount));
vo.setRqyjl(xzzfCount-(lhzfsCount+ddbmzfCount));
//执法人员数
//执法单位数
@ -297,7 +298,7 @@ public class CimDashboardOverviewController {
/**
* Cim大屏- 获取 总览概览
* Cim大屏- 获取 总览概览 (行政执法数,行政检查案件数,行政处罚案件数,行政强制案件数) + 同比 + 环比
* (月)
* @param bo
* @return
@ -310,39 +311,150 @@ public class CimDashboardOverviewController {
Date time = new Date(System.currentTimeMillis());
bo.setMonthTime(time);
// 当前月行政执法数
Long currentCount = cimDashboardOverviewService.getEnfRegistrationCountByMonth(bo);
vo.setXzzfs(currentCount);
// ====== 行政执法数同比(与去年同月比较)======
Calendar cal = Calendar.getInstance();
cal.setTime(time);
cal.add(Calendar.YEAR, -1);
Date lastYearTime = cal.getTime();
bo.setMonthTime(lastYearTime);
Long lastYearCount = cimDashboardOverviewService.getEnfRegistrationCountByMonth(bo);
if (lastYearCount != null && lastYearCount > 0) {
double tbRate = (currentCount - lastYearCount) * 100.0 / lastYearCount;
// 保留一位小数
vo.setXzzfsTb(Math.round(tbRate * 10.0) / 10.0);
} else {
// 去年同期无数据,同比增长率记为100
vo.setXzzfsTb(currentCount > 0 ? 100.0 : 0.0);
}
// ====== 行政执法数环比(与上月比较)======
cal.setTime(time);
cal.add(Calendar.MONTH, -1);
Date lastMonthTime = cal.getTime();
bo.setMonthTime(lastMonthTime);
Long lastMonthCount = cimDashboardOverviewService.getEnfRegistrationCountByMonth(bo);
if (lastMonthCount != null && lastMonthCount > 0) {
double hbRate = (currentCount - lastMonthCount) * 100.0 / lastMonthCount;
vo.setXzzfsHb(Math.round(hbRate * 10.0) / 10.0);
} else {
vo.setXzzfsHb(currentCount > 0 ? 100.0 : 0.0);
}
// 行政执法数 + 同比 + 环比
TbHbUtils.TbHbResult tbHb = TbHbUtils.calculate(
monthTime -> {
bo.setMonthTime(monthTime);
return cimDashboardOverviewService.getEnfRegistrationCountByMonth(bo);
},
time
);
vo.setXzzfs(tbHb.currentCount);
vo.setXzzfsTb(tbHb.tb);
vo.setXzzfsHb(tbHb.hb);
// 行政检查案件数 + 同比 + 环比
TbHbUtils.TbHbResult checkCasetbHb = TbHbUtils.calculate(
monthTime -> {
bo.setMonthTime(monthTime);
return cimDashboardOverviewService.getCheckCaseCount(bo);
},
time
);
vo.setXzjcajs(checkCasetbHb.currentCount);
vo.setXzjcajsTb(checkCasetbHb.tb);
vo.setXzjcajsHb(checkCasetbHb.hb);
// 行政处罚数 + 同比 + 环比
TbHbUtils.TbHbResult xzcfajsTbHb = TbHbUtils.calculate(
monthTime -> {
bo.setMonthTime(monthTime);
return cimDashboardOverviewService.getPenaltyCaseCount(bo);
},
time
);
vo.setXzcfajs(xzcfajsTbHb.currentCount);
vo.setXzcfajsTb(xzcfajsTbHb.tb);
vo.setXzcfajsHb(xzcfajsTbHb.hb);
// 行政强制案件数 + 同比 + 环比
TbHbUtils.TbHbResult xzqzajsTbHb = TbHbUtils.calculate(
monthTime -> {
bo.setMonthTime(monthTime);
return cimDashboardOverviewService.getCompulsoryCaseCount( bo);
},
time
);
vo.setXzqzajs(xzqzajsTbHb.currentCount);
vo.setXzqzajsTb(xzqzajsTbHb.tb);
vo.setXzqzajsHb(xzqzajsTbHb.hb);
return R.ok(vo);
}
/**
* Cim大屏- 获取各区行政执法数,行政执法案件数
* (月)
*/
@GetMapping("/getAreaEnfRegistrationAndCaseCount")
public R<List<CimDashboardOverviewVo>> getAreaEnfRegistrationAndCaseCount(CimDashboardOverviewQueryBo bo){
// 获取当前系统时间
Date time = new Date(System.currentTimeMillis());
bo.setMonthTime(time);
List<CimDashboardOverviewVo> vo= cimDashboardOverviewService.getAreaEnfRegistrationAndCaseCount(bo);
return R.ok(vo);
}
/**
* Cim大屏- 获取各区行政执法数,行政执法案件数明细
* (月)
*/
@SaIgnore
@GetMapping("/getAreaEnfRegistrationAndCaseCountDetails")
public R<List<CimDashboardOverviewVo>> getAreaEnfRegistrationAndCaseCountDetails(CimDashboardOverviewQueryBo bo){
// 获取当前系统时间
Date time = new Date(System.currentTimeMillis());
bo.setMonthTime(time);
List<CimDashboardOverviewVo> vo= cimDashboardOverviewService.getAreaEnfRegistrationAndCaseCountDetails(bo);
return R.ok(vo);
}
/**
* Cim大屏- 获取领域行政执法数,行政执法案件数
* (月)
* @param bo
* @return
*/
@GetMapping("/getFieldEnfRegistrationAndCaseCount")
public R<List<CimDashboardOverviewVo>> getFieldEnfRegistrationAndCaseCount(CimDashboardOverviewQueryBo bo){
// 获取当前系统时间
Date time = new Date(System.currentTimeMillis());
bo.setMonthTime(time);
List<CimDashboardOverviewVo> vo= cimDashboardOverviewService.getFieldEnfRegistrationAndCaseCount(bo);
return R.ok(vo);
}
/**
* Cim大屏- 获取领域行政执法数,行政执法案件数明细
*(月)
* @param bo
* @return
*/
@GetMapping("/getFieldEnfRegistrationAndCaseCountDetails")
public R<List<CimDashboardOverviewVo>> getFieldEnfRegistrationAndCaseCountDetails(CimDashboardOverviewQueryBo bo){
// 获取当前系统时间
Date time = new Date(System.currentTimeMillis());
bo.setMonthTime(time);
List<CimDashboardOverviewVo> vo= cimDashboardOverviewService.getFieldEnfRegistrationAndCaseCountDetails(bo);
return R.ok(vo);
}
/**
* Cim大屏- 获取重点企业数(月)
*
*/
@GetMapping("/getKeyEnterprises")
public R<List<CimDashboardOverviewVo>> getKeyEnterprises(CimDashboardOverviewQueryBo bo){
// 获取当前系统时间
Date time = new Date(System.currentTimeMillis());
bo.setMonthTime(time);
List<CimDashboardOverviewVo> vo= cimDashboardOverviewService.getKeyEnterprises(bo);
return R.ok(vo);
}
/**
* Cim大屏- 获取重点企业行政执法明细(日)
*/
@GetMapping("/getKeyEnterpriseEnfRegDetails")
public R<List<CimDashboardOverviewVo>> getKeyEnterpriseEnfRegDetails(CimDashboardOverviewQueryBo bo){
// 获取当前系统时间
Date time = new Date(System.currentTimeMillis());
bo.setDayTime(time);
List<CimDashboardOverviewVo> vo= cimDashboardOverviewService.getKeyEnterpriseEnfRegDetails(bo);
return R.ok(vo);
}
/**
* Cim大屏-获取涉企登记趋势(月)
*/
@GetMapping("/getEnfRegistrationTrend")
public R<List<CimDashboardOverviewVo>> getEnfRegistrationTrend(CimDashboardOverviewQueryBo bo){
// 获取当前系统时间
Date time = new Date(System.currentTimeMillis());
bo.setMonthTime(time);
List<CimDashboardOverviewVo> vo= cimDashboardOverviewService.getEnfRegistrationTrend(bo);
return R.ok(vo);
}
}

5
zdxt-modules/zdxt-enforcement-code/src/main/java/com/zdxt/enforcementcode/domain/bo/CimDashboardOverviewQueryBo.java

@ -35,4 +35,9 @@ public class CimDashboardOverviewQueryBo {
*/
private Date yearTime;
/**
* 企业统一信用代码
*/
private String enterpriseNumber;
}

93
zdxt-modules/zdxt-enforcement-code/src/main/java/com/zdxt/enforcementcode/domain/vo/CimDashboardOverviewVo.java

@ -3,6 +3,8 @@ package com.zdxt.enforcementcode.domain.vo;
import lombok.Data;
import java.util.Date;
@Data
public class CimDashboardOverviewVo {
@ -68,9 +70,9 @@ public class CimDashboardOverviewVo {
private Long ddbmzf;
/**
* 联合执法
* 联合执法数
*/
private Long lhzf;
private Long lhzfs;
/**
* 被执法企业
@ -142,6 +144,11 @@ public class CimDashboardOverviewVo {
*/
private String enterpriseName;
/**
* 企业地址
*/
private String enterpriseAddress;
/**
* 执法部门ID
*/
@ -151,4 +158,86 @@ public class CimDashboardOverviewVo {
* 执法部门名称
*/
private String bureauDeptName;
/**
* 执法案件数
*/
private Long zfajs;
/**
* 行政检查案件数
*/
private Long xzjcajs;
/**
* 行政检查案件数同比
*/
private Double xzjcajsTb;
/**
* 行政检查案件数环比
*/
private Double xzjcajsHb;
/**
* 行政处罚案件数
*/
private Long xzcfajs;
/**
* 行政处罚案件数同比
*/
private Double xzcfajsTb;
/**
* 行政处罚案件数环比
*/
private Double xzcfajsHb;
/**
* 行政强制案件数
*/
private Long xzqzajs;
/**
* 行政强制案件数同比
*/
private Double xzqzajsTb;
/**
* 行政强制案件数环比
*/
private Double xzqzajsHb;
/**
* 执法时间
*/
private Date enforcementTime;
/**
* 执法事项
*/
private String lawEnforcementItemText;
/**
* 执法人员(多人)
*/
private String lawEnforcerTwo;
/**
* 执法人员
*/
private String lawEnforcer;
/**
* 执法部门
*/
private String lawEnforcement;
/**
* 统计月份
*/
private String statMonth;
}

67
zdxt-modules/zdxt-enforcement-code/src/main/java/com/zdxt/enforcementcode/mapper/CimDashboardOverviewMapper.java

@ -153,4 +153,71 @@ public interface CimDashboardOverviewMapper {
* 获取高频检查企业 (月)
*/
List<CimDashboardOverviewVo> getHighCheckEnt(CimDashboardOverviewQueryBo bo);
/**
* 获取行政检查案件数(月)
* @param bo
* @return
*/
Long getCheckCaseCount(CimDashboardOverviewQueryBo bo);
/**
* 获取行政处罚案件数(月)
* @param bo
* @return
*/
Long getPenaltyCaseCount(CimDashboardOverviewQueryBo bo);
/**
* 获取强制措施案件数(月)
* @param bo
* @return
*/
Long getCompulsoryCaseCount(CimDashboardOverviewQueryBo bo);
/**
* 获取各区行政执法数,行政执法案件数(月)
* @param bo
* @return
*/
List<CimDashboardOverviewVo> getAreaEnfRegistrationAndCaseCount(CimDashboardOverviewQueryBo bo);
/**
* 获取各区行政执法数,行政执法案件数明细(月)
* @param bo
* @return
*/
List<CimDashboardOverviewVo> getAreaEnfRegistrationAndCaseCountDetails(CimDashboardOverviewQueryBo bo);
/**
* 获取领域行政执法数,行政执法案件数(月)
* @param bo
* @return
*/
List<CimDashboardOverviewVo> getFieldEnfRegistrationAndCaseCount(CimDashboardOverviewQueryBo bo);
/**
* 获取领域行政执法数,行政执法案件数明细(月)
* @param bo
* @return
*/
List<CimDashboardOverviewVo> getFieldEnfRegistrationAndCaseCountDetails(CimDashboardOverviewQueryBo bo);
/**
* 获取重点企业数(月)
**/
List<CimDashboardOverviewVo> getKeyEnterprises(CimDashboardOverviewQueryBo bo);
/**
* 获取重点企业行政执法明细(日)
**/
List<CimDashboardOverviewVo> getKeyEnterpriseEnfRegDetails(CimDashboardOverviewQueryBo bo);
/**
* 获取涉企登记趋势(月)
**/
List<CimDashboardOverviewVo> getEnfRegistrationTrend(CimDashboardOverviewQueryBo bo);
}

68
zdxt-modules/zdxt-enforcement-code/src/main/java/com/zdxt/enforcementcode/service/ICimDashboardOverviewService.java

@ -158,4 +158,72 @@ public interface ICimDashboardOverviewService {
* 获取高频检查企业 (月)
*/
List<CimDashboardOverviewVo> getHighCheckEnt(CimDashboardOverviewQueryBo bo);
/**
* 获取行政检查案件数(月)
* @param bo
* @return
*/
Long getCheckCaseCount(CimDashboardOverviewQueryBo bo);
/**
* 获取行政处罚案件数(月)
* @param bo
* @return
*/
Long getPenaltyCaseCount(CimDashboardOverviewQueryBo bo);
/**
* 获取强制措施案件数(月)
* @param bo
* @return
*/
Long getCompulsoryCaseCount(CimDashboardOverviewQueryBo bo);
/**
* 获取各区行政执法数,行政执法案件数(月)
* @param bo
* @return
*/
List<CimDashboardOverviewVo> getAreaEnfRegistrationAndCaseCount(CimDashboardOverviewQueryBo bo);
/**
* 获取各区行政执法数,行政执法案件数明细(月)
* @param bo
* @return
*/
List<CimDashboardOverviewVo> getAreaEnfRegistrationAndCaseCountDetails(CimDashboardOverviewQueryBo bo);
/**
* 获取领域行政执法数,行政执法案件数(月)
* @param bo
* @return
*/
List<CimDashboardOverviewVo> getFieldEnfRegistrationAndCaseCount(CimDashboardOverviewQueryBo bo);
/**
* 获取领域行政执法数,行政执法案件数明细(月)
* @param bo
* @return
*/
List<CimDashboardOverviewVo> getFieldEnfRegistrationAndCaseCountDetails(CimDashboardOverviewQueryBo bo);
/**
* 获取重点企业数(月)
**/
List<CimDashboardOverviewVo> getKeyEnterprises(CimDashboardOverviewQueryBo bo);
/**
* 获取重点企业行政执法明细(日)
**/
List<CimDashboardOverviewVo> getKeyEnterpriseEnfRegDetails(CimDashboardOverviewQueryBo bo);
/**
* 获取涉企登记趋势(月)
**/
List<CimDashboardOverviewVo> getEnfRegistrationTrend(CimDashboardOverviewQueryBo bo);
}

101
zdxt-modules/zdxt-enforcement-code/src/main/java/com/zdxt/enforcementcode/service/impl/CimDashboardOverviewServiceImpl.java

@ -248,5 +248,106 @@ public class CimDashboardOverviewServiceImpl implements ICimDashboardOverviewSer
return cimDashboardOverviewMapper.getHighCheckEnt(bo);
}
/**
* 获取检查案件数(月)
* @param bo
* @return
*/
@Override
public Long getCheckCaseCount(CimDashboardOverviewQueryBo bo) {
return cimDashboardOverviewMapper.getCheckCaseCount(bo);
}
/**
* 获取处罚案件数(月)
* @param bo
* @return
*/
@Override
public Long getPenaltyCaseCount(CimDashboardOverviewQueryBo bo) {
return cimDashboardOverviewMapper.getPenaltyCaseCount( bo);
}
/**
* 获取强制案件数(月)
* @param bo
* @return
*/
@Override
public Long getCompulsoryCaseCount(CimDashboardOverviewQueryBo bo) {
return cimDashboardOverviewMapper.getCompulsoryCaseCount( bo);
}
/**
* 获取各区行政检查数和案件数(月)
* @param bo
* @return
*/
@Override
public List<CimDashboardOverviewVo> getAreaEnfRegistrationAndCaseCount(CimDashboardOverviewQueryBo bo) {
return cimDashboardOverviewMapper.getAreaEnfRegistrationAndCaseCount(bo);
}
/**
* 获取各区行政检查数和案件数(月)详情
* @param bo
* @return
*/
@Override
public List<CimDashboardOverviewVo> getAreaEnfRegistrationAndCaseCountDetails(CimDashboardOverviewQueryBo bo) {
return cimDashboardOverviewMapper.getAreaEnfRegistrationAndCaseCountDetails( bo);
}
/**
* 获取各领域行政检查数和案件数(月)
* @param bo
* @return
*/
@Override
public List<CimDashboardOverviewVo> getFieldEnfRegistrationAndCaseCount(CimDashboardOverviewQueryBo bo) {
return cimDashboardOverviewMapper.getFieldEnfRegistrationAndCaseCount( bo);
}
/**
* 获取各领域行政检查数和案件数(月)详情
* @param bo
* @return
*/
@Override
public List<CimDashboardOverviewVo> getFieldEnfRegistrationAndCaseCountDetails(CimDashboardOverviewQueryBo bo) {
return cimDashboardOverviewMapper.getFieldEnfRegistrationAndCaseCountDetails( bo);
}
/**
* 获取重点企业数(月)
* @param bo
* @return
*/
@Override
public List<CimDashboardOverviewVo> getKeyEnterprises(CimDashboardOverviewQueryBo bo) {
return cimDashboardOverviewMapper.getKeyEnterprises( bo);
}
/**
* 获取重点企业行政执法明细(日)
* @param bo
* @return
*/
@Override
public List<CimDashboardOverviewVo> getKeyEnterpriseEnfRegDetails(CimDashboardOverviewQueryBo bo) {
return cimDashboardOverviewMapper.getKeyEnterpriseEnfRegDetails( bo);
}
/**
* 获取涉企登记趋势(月)
* @param bo
* @return
*/
@Override
public List<CimDashboardOverviewVo> getEnfRegistrationTrend(CimDashboardOverviewQueryBo bo) {
return cimDashboardOverviewMapper.getEnfRegistrationTrend(bo);
}
}

605
zdxt-modules/zdxt-enforcement-code/src/main/resources/mapper/enforcementcode/CimDashboardOverviewMapper.xml

@ -52,6 +52,9 @@
<if test="code !=null and code!=''">
and t3.code = #{code}
</if>
<if test="enterpriseNumber !=null and enterpriseNumber !=''">
and t1.enterprise_number = #{enterpriseNumber}
</if>
</where>
</select>
@ -70,6 +73,12 @@
<if test="dayTime !=null">
and DATE_FORMAT(t1.enforcement_time,'%Y-%m-%d') = DATE_FORMAT(#{dayTime},'%Y-%m-%d')
</if>
<if test="monthTime !=null">
and DATE_FORMAT(t1.enforcement_time,'%Y-%m-%d') = DATE_FORMAT(#{monthTime},'%Y-%m-%d')
</if>
<if test="enterpriseNumber !=null and enterpriseNumber !=''">
and t1.enterprise_number = #{enterpriseNumber}
</if>
<if test="code !=null and code!=''">
and t3.code = #{code}
</if>
@ -299,6 +308,12 @@
<if test="code !=null and code!=''">
and t3.code = #{code}
</if>
<if test="monthTime !=null">
and DATE_FORMAT(t1.enforcement_time,'%Y-%m') = DATE_FORMAT(#{monthTime},'%Y-%m')
</if>
<if test="enterpriseNumber !=null and enterpriseNumber !=''">
and t1.enterprise_number = #{enterpriseNumber}
</if>"
</where>
GROUP BY t1.union_no
HAVING COUNT(1) &gt; 1
@ -804,4 +819,594 @@
t3.code ,
t3.name
</select>
<!-- 获取行政检查案件数(月) -->
<select id="getCheckCaseCount" resultType="java.lang.Long" parameterType="com.zdxt.enforcementcode.domain.bo.CimDashboardOverviewQueryBo">
select
count(1) xzjcajs
from
sxt_jcdzb107522 t1
<where>
<if test="monthTime !=null">
and DATE_FORMAT(t1.INSPECTION_END_DATE,'%Y-%m')= DATE_FORMAT(#{monthTime},'%Y-%m')
</if>
</where>
</select>
<!-- 获取行政处罚案件数 (月) -->
<select id="getPenaltyCaseCount" resultType="java.lang.Long" parameterType="com.zdxt.enforcementcode.domain.bo.CimDashboardOverviewQueryBo">
select
count(1) as xzcfajs
from
sxt_xzcfajjbxx026705 t1
<where>
<if test="monthTime !=null">
and DATE_FORMAT(t1.c201010, '%Y-%m') = DATE_FORMAT(#{monthTime}, '%Y-%m')
</if>
</where>
</select>
<!-- 获取行政强制案件数 (月) -->
<select id="getCompulsoryCaseCount" resultType="java.lang.Long" parameterType="com.zdxt.enforcementcode.domain.bo.CimDashboardOverviewQueryBo">
select
count(1) as xzcfajs
from
sxt_xzcfajjbxx026705 t1
<where>
<if test="monthTime !=null">
and DATE_FORMAT(t1.c201010, '%Y-%m') = DATE_FORMAT(#{monthTime}, '%Y-%m')
</if>
</where>
</select>
<!-- 获取各区行政检查数,案件数(月) -->
<select id="getAreaEnfRegistrationAndCaseCount" resultType="com.zdxt.enforcementcode.domain.vo.CimDashboardOverviewVo" parameterType="com.zdxt.enforcementcode.domain.bo.CimDashboardOverviewQueryBo">
select
t1.name ,
IFNULL(t2.zfajs, 0) as zfajs,
IFNULL(t3.xzzfs, 0) as xzzfs
from
dashboard_area_info t1
left join (
select
t1.name,
sum(t1.sl) zfajs
from
(
select
t1.district_name as name,
count(t1.case_code) as sl
from
(
select
t.case_code,
case
when t.inspection_addr_code = '罗湖区' or left(t.inspection_addr_code, 6) = '440303' then '罗湖区'
when t.inspection_addr_code = '福田区' or left(t.inspection_addr_code, 6) = '440304' then '福田区'
when t.inspection_addr_code = '南山区' or left(t.inspection_addr_code, 6) = '440305' then '南山区'
when t.inspection_addr_code = '宝安区' or left(t.inspection_addr_code, 6) = '440306' then '宝安区'
when t.inspection_addr_code = '龙岗区' or left(t.inspection_addr_code, 6) = '440307' then '龙岗区'
when t.inspection_addr_code = '盐田区' or left(t.inspection_addr_code, 6) = '440308' then '盐田区'
when t.inspection_addr_code = '龙华区' or left(t.inspection_addr_code, 6) = '440309' then '龙华区'
when t.inspection_addr_code = '坪山区' or left(t.inspection_addr_code, 6) = '440310' then '坪山区'
when t.inspection_addr_code = '光明区' or left(t.inspection_addr_code, 6) = '440311' then '光明区'
when t.inspection_addr_code = '深圳市' or left(t.inspection_addr_code, 6) = '440300' then '深圳市'
when t.inspection_addr_code = '深汕特别合作区' or left(t.inspection_addr_code, 6) = '441521' then '深汕特别合作区'
when t.inspection_addr_code = '大鹏新区' then '大鹏新区'
else '未知区域'
end as district_name
from
sxt_jcdzb107522 t
<where>
<if test="monthTime !=null">
and DATE_FORMAT(t.INSPECTION_END_DATE, '%Y-%m')= DATE_FORMAT(#{monthTime}, '%Y-%m')
</if>
</where>
) t1
group by
t1.district_name
union all
select
t1.name,
count(t3.c201001) as sl
from
dashboard_area_info t1
left join sys_dept t2 on
t1.code = t2.area_node
left join sxt_xzcfajjbxx026705 t3 on
t2.dept_name = t3.C201003
<where>
t1.`level` = 3
<if test="monthTime!=null">
and DATE_FORMAT(t3.c201010, '%Y-%m') = DATE_FORMAT(#{monthTime}, '%Y-%m')
</if>
</where>
group by
t1.name
union all
select
t1.name,
count(t3.c301003) as sl
from
dashboard_area_info t1
left join sys_dept t2 on
t1.code = t2.area_node
left join sxt_xzqzjbxx173774 t3 on
t2.dept_name = t3.c301004
<where>
t1.`level` = 3
<if test="monthTime!=null">
and DATE_FORMAT(t3.add_time, '%Y-%m') = DATE_FORMAT(#{monthTime}, '%Y-%m')
</if>
</where>
group by
t1.name) t1
group by
t1.name )t2
on
t1.name = t2.name
left join (
select
t3.name,
count(1) as xzzfs
from
enforcement_registration t1
left join sys_dept t2 on
t1.bureau_dept_id = t2.dept_id
left join dashboard_area_info t3 on
t2.area_node = t3.code
<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 t3.`level` = 3
<if test="monthTime!=null">
and DATE_FORMAT(t1.enforcement_time, '%Y-%m') = DATE_FORMAT(#{monthTime}, '%Y-%m')
</if>
</where>
group by
t3.name ) t3
on
t1.name = t3.name
where
t1.`level` = 3
</select>
<!-- 获取各区行政检查数,案件数明细(月) -->
<select id="getAreaEnfRegistrationAndCaseCountDetails" resultType="com.zdxt.enforcementcode.domain.vo.CimDashboardOverviewVo" parameterType="com.zdxt.enforcementcode.domain.bo.CimDashboardOverviewQueryBo">
select
t1.name,
IFNULL(t5.xzzfs, 0) as xzzfs,
IFNULL(t2.xzjcajs, 0) as xzjcajs,
IFNULL(t3.xzcfajs, 0) as xzcfajs,
IFNULL(t4.xzqzajs, 0) as xzqzajs
from
dashboard_area_info t1
left join (
select
t1.district_name as name,
count(t1.case_code) as xzjcajs
from
(
select
t.case_code,
case
when t.inspection_addr_code = '罗湖区' or left(t.inspection_addr_code, 6) = '440303' then '罗湖区'
when t.inspection_addr_code = '福田区' or left(t.inspection_addr_code, 6) = '440304' then '福田区'
when t.inspection_addr_code = '南山区' or left(t.inspection_addr_code, 6) = '440305' then '南山区'
when t.inspection_addr_code = '宝安区' or left(t.inspection_addr_code, 6) = '440306' then '宝安区'
when t.inspection_addr_code = '龙岗区' or left(t.inspection_addr_code, 6) = '440307' then '龙岗区'
when t.inspection_addr_code = '盐田区' or left(t.inspection_addr_code, 6) = '440308' then '盐田区'
when t.inspection_addr_code = '龙华区' or left(t.inspection_addr_code, 6) = '440309' then '龙华区'
when t.inspection_addr_code = '坪山区' or left(t.inspection_addr_code, 6) = '440310' then '坪山区'
when t.inspection_addr_code = '光明区' or left(t.inspection_addr_code, 6) = '440311' then '光明区'
when t.inspection_addr_code = '深圳市' or left(t.inspection_addr_code, 6) = '440300' then '深圳市'
when t.inspection_addr_code = '深汕特别合作区' or left(t.inspection_addr_code, 6) = '441521' then '深汕特别合作区'
when t.inspection_addr_code = '大鹏新区' then '大鹏新区'
else '未知区域'
end as district_name
from
sxt_jcdzb107522 t
<where>
<if test="monthTime !=null">
and DATE_FORMAT(t.INSPECTION_END_DATE, '%Y-%m')= DATE_FORMAT(#{monthTime}, '%Y-%m')
</if>
</where>
) t1
group by
t1.district_name
) t2 on t1.name=t2.name
left join
(select
t1.name,
count(t3.c201001) as xzcfajs
from
dashboard_area_info t1
left join sys_dept t2 on
t1.code = t2.area_node
left join sxt_xzcfajjbxx026705 t3 on
t2.dept_name = t3.C201003
<where>
t1.`level` = 3
<if test="monthTime!=null">
and DATE_FORMAT(t3.c201010, '%Y-%m') = DATE_FORMAT(#{monthTime}, '%Y-%m')
</if>
</where>
group by
t1.name) t3 on t1.name=t3.name
left join (
select
t1.name,
count(t3.c301003) as xzqzajs
from
dashboard_area_info t1
left join sys_dept t2 on
t1.code = t2.area_node
left join sxt_xzqzjbxx173774 t3 on
t2.dept_name = t3.c301004
<where>
t1.`level` = 3
<if test="monthTime!=null">
and DATE_FORMAT(t3.add_time, '%Y-%m') = DATE_FORMAT(#{monthTime}, '%Y-%m')
</if>
</where>
group by
t1.name) t4 on t1.name =t4.name
left join (
select
t3.name,
count(1) as xzzfs
from
enforcement_registration t1
left join sys_dept t2 on
t1.bureau_dept_id = t2.dept_id
left join dashboard_area_info t3 on
t2.area_node = t3.code
<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 t3.`level` = 3
<if test="monthTime!=null">
and DATE_FORMAT(t1.enforcement_time, '%Y-%m') = DATE_FORMAT(#{monthTime},'%Y-%m')
</if>
</where>
group by
t3.name ) t5
on t1.name = t5.name
where t1.level=3
</select>
<!-- 获取领域行政执法数,行政执法案件数(月) -->
<select id="getFieldEnfRegistrationAndCaseCount" resultType="com.zdxt.enforcementcode.domain.vo.CimDashboardOverviewVo" parameterType="com.zdxt.enforcementcode.domain.bo.CimDashboardOverviewQueryBo">
select
distinct
t1.domain_id as code,
t1.domain_name as name,
IFNULL(t2.zfajs, 0) as zfajs,
IFNULL(t3.xzzfs, 0) as xzzfs
from
dashboard_domain_dept t1
left join (
select
t1.code ,
t1.name ,
SUM(T1.sl) as zfajs
from
(
<!-- 行政检查-->
select
t3.domain_id as code,
t3.domain_name as name,
count(t1.CASE_CODE) as sl
from
sxt_jcdzb107522 t1
inner join sys_dept t2 on
t1.SUB_NAME = t2.dept_name
inner join dashboard_domain_dept t3 on
t2.dept_id = t3.dept_id
<where>
<if test="monthTime !=null">
and DATE_FORMAT(t1.INSPECTION_END_DATE, '%Y-%m') = DATE_FORMAT(#{monthTime}, '%Y-%m')
</if>
</where>
group by
t3.domain_id ,
t3.domain_name
union all
<!-- 行政处罚-->
select
t1.domain_id as code,
t1.domain_name as name,
count(t3.c201001) as sl
from
dashboard_domain_dept t1
left join sys_dept t2 on
t1.dept_id = t2.dept_id
left join sxt_xzcfajjbxx026705 t3 on
t2.dept_name = t3.C201003
<where>
<if test="monthTime!=null">
and DATE_FORMAT(t3.c201010, '%Y-%m') = DATE_FORMAT(#{monthTime}, '%Y-%m')
</if>
</where>
group by
t1.domain_id ,
t1.domain_name
union all
<!-- 行政强制-->
select
t1.domain_id as code,
t1.domain_name as name,
count(t3.c301003) as sl
from
dashboard_domain_dept t1
left join sys_dept t2 on
t1.dept_id = t2.dept_id
left join sxt_xzqzjbxx173774 t3 on
t2.dept_name = t3.c301004
<where>
<if test="monthTime!=null">
and DATE_FORMAT(t3.add_time, '%Y-%m') = DATE_FORMAT(#{monthTime}, '%Y-%m')
</if>
</where>
group by
t1.domain_id ,
t1.domain_name) t1
group by
t1.code ,
t1.name )t2
on
t1.domain_id = t2.code
left join (
<!-- 行政执法-->
select
t3.domain_id as code,
t3.domain_name as name,
count(1) as xzzfs
from
enforcement_registration t1
inner join sys_dept t2 on
t1.bureau_dept_id = t2.dept_id
inner join dashboard_domain_dept t3 on
t2.dept_id = t3.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
<if test="monthTime!=null">
and DATE_FORMAT(t1.enforcement_time, '%Y-%m') = DATE_FORMAT(#{monthTime}, '%Y-%m')
</if>
</where>
group by
t3.domain_id ,
t3.domain_name) t3
on
t1.domain_id = t3.code
</select>
<!-- 获取领域行政执法数,行政执法案件数明细(月) -->
<select id="getFieldEnfRegistrationAndCaseCountDetails" resultType="com.zdxt.enforcementcode.domain.vo.CimDashboardOverviewVo" parameterType="com.zdxt.enforcementcode.domain.bo.CimDashboardOverviewQueryBo">
select
distinct
t1.domain_id as code,
t1.domain_name as name,
IFNULL(t2.xzjcajs, 0) as xzjcajs,
IFNULL(t3.xzcfajs, 0) as xzcfajs,
IFNULL(t4.xzqzajs, 0) as xzqzajs,
IFNULL(t5.xzzfs, 0) as xzzfs
from
dashboard_domain_dept t1
left join (
<!--行政检查-->
select
t3.domain_id as code,
t3.domain_name as name,
count(t1.CASE_CODE) as xzjcajs
from
sxt_jcdzb107522 t1
inner join sys_dept t2 on
t1.SUB_NAME = t2.dept_name
inner join dashboard_domain_dept t3 on
t2.dept_id = t3.dept_id
<where>
<if test="monthTime!=null">
and DATE_FORMAT(t1.INSPECTION_END_DATE, '%Y-%m') = DATE_FORMAT(#{monthTime}, '%Y-%m')
</if>
</where>
group by
t3.domain_id ,
t3.domain_name) t2
on
t1.domain_id = t2.code
left join (
<!-- 行政处罚-->
select
t1.domain_id as code,
t1.domain_name as name,
count(t3.c201001) as xzcfajs
from
dashboard_domain_dept t1
left join sys_dept t2 on
t1.dept_id = t2.dept_id
left join sxt_xzcfajjbxx026705 t3 on
t2.dept_name = t3.C201003
<where>
<if test="monthTime!=null">
and DATE_FORMAT(t3.c201010, '%Y-%m') = DATE_FORMAT(#{monthTime}, '%Y-%m')
</if>
</where>
group by
t1.domain_id ,
t1.domain_name) t3
on
t1.domain_id = t3.code
left join (
<!-- 行政强制-->
select
t1.domain_id as code,
t1.domain_name as name,
count(t3.c301003) as xzqzajs
from
dashboard_domain_dept t1
left join sys_dept t2 on
t1.dept_id = t2.dept_id
left join sxt_xzqzjbxx173774 t3 on
t2.dept_name = t3.c301004
<where>
<if test="monthTime!=null">
and DATE_FORMAT(t3.add_time, '%Y-%m') = DATE_FORMAT(#{monthTime}, '%Y-%m')
</if>
</where>
group by
t1.domain_id ,
t1.domain_name) t4
on
t1.domain_id = t4.code
left join (
<!-- 行政执法-->
select
t3.domain_id as code,
t3.domain_name as name,
count(1) as xzzfs
from
enforcement_registration t1
inner join sys_dept t2 on
t1.bureau_dept_id = t2.dept_id
inner join dashboard_domain_dept t3 on
t2.dept_id = t3.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
<if test="monthTime!=null">
and DATE_FORMAT(t1.enforcement_time, '%Y-%m') = DATE_FORMAT(#{monthTime}, '%Y-%m')
</if>
</where>
group by
t3.domain_id ,
t3.domain_name) t5
on
t1.domain_id = t5.code
</select>
<!-- 获取重点企业数(月) -->
<select id="getKeyEnterprises" resultType="com.zdxt.enforcementcode.domain.vo.CimDashboardOverviewVo" parameterType="com.zdxt.enforcementcode.domain.bo.CimDashboardOverviewQueryBo">
select
t2.enterprise_number as enterpriseNumber,
t2.enterprise_name as enterpriseName,
t1.enterprise_address as enterpriseAddress,
t2.xzzfs
from
enterprise_information t1
inner join (
select
t1.enterprise_number ,
t1.enterprise_name,
count(1)as xzzfs
from
enforcement_registration t1
<where>
t1.is_delete = 0
and t1.is_submit = 1
and t1.enterprise_number is not null
and t1.enterprise_name is not null
<if test="monthTime!=null">
and DATE_FORMAT(t1.enforcement_time, '%Y-%m') = DATE_FORMAT(#{monthTime}, '%Y-%m')
</if>
</where>
group by
t1.enterprise_number ,
t1.enterprise_name
order by
xzzfs desc
limit 100) t2
on
t1.enterprise_number = t2.enterprise_number
</select>
<!--获取重点企业行政执法明细(日) -->
<select id="getKeyEnterpriseEnfRegDetails" resultType="com.zdxt.enforcementcode.domain.vo.CimDashboardOverviewVo" parameterType="com.zdxt.enforcementcode.domain.bo.CimDashboardOverviewQueryBo" >
select
t1.enterprise_number as enterpriseNumber,
t1.enterprise_name as enterpriseName,
t1.law_enforcement as lawEnforcement,
t1.law_enforcer as lawEnforcer,
t1.law_enforcer_two as lawEnforcerTwo,
t1.law_enforcement_item_text as lawEnforcementItemText,
t1.enforcement_time as enforcementTime
from
enforcement_registration t1
<where>
t1.is_delete = 0
and t1.is_submit = 1
and t1.enterprise_number is not null
and t1.enterprise_name is not null
<if test="dayTime !=null">
and DATE_FORMAT(t1.enforcement_time, '%Y-%m-%d') = DATE_FORMAT(#{dayTime}, '%Y-%m-%d')
</if>
<if test="enterpriseNumber !=null">
and t1.enterprise_number = #{enterpriseNumber}
</if>
</where>
</select>
<!-- 获取涉企登记趋势(月) -->
<select id="getEnfRegistrationTrend" resultType="com.zdxt.enforcementcode.domain.vo.CimDashboardOverviewVo" parameterType="com.zdxt.enforcementcode.domain.bo.CimDashboardOverviewQueryBo">
SELECT
enterprise_number as enterpriseNumber,
enterprise_name as enterpriseName,
stat_month as statMonth,
SUM(xzzfs) AS xzzfs,
SUM(lhzfs) AS lhzfs,
SUM(fxzzfs) AS fxzzfs
FROM (
SELECT
t1.enterprise_number,
t1.enterprise_name,
DATE_FORMAT(t1.enforcement_time , '%Y-%m') AS stat_month,
1 AS xzzfs,
IF(t1.has_union = 1 AND t1.union_no IS NOT NULL, 1, 0) AS lhzfs,
0 AS fxzzfs
FROM
enforcement_registration t1
<where>
t1.is_delete = 0
AND t1.is_submit = 1
AND t1.enterprise_number IS NOT NULL
AND t1.enterprise_name IS NOT NULL
<if test="monthTime !=null">
AND DATE_FORMAT(t1.enforcement_time , '%Y-%m') = DATE_FORMAT(#{monthTime}, '%Y-%m')
</if>
<if test="enterpriseNumber !=null">
AND t1.enterprise_number = #{enterpriseNumber}
</if>
</where>
UNION ALL
SELECT
t1.enterprise_number,
t1.enterprise_name,
DATE_FORMAT(t1.enforcement_time , '%Y-%m') AS stat_month,
0 AS xzzfs,
0 AS lhzfs,
1 AS fxzzfs
FROM
non_enforcement_registration t1
<where>
t1.has_delete = 0
<if test="monthTime !=null">
AND DATE_FORMAT(t1.enforcement_time , '%Y-%m') = DATE_FORMAT(#{monthTime}, '%Y-%m')
</if>
<if test="enterpriseNumber !=null">
AND t1.enterprise_number = #{enterpriseNumber}
</if>
</where>
) temp
GROUP BY enterprise_number, enterprise_name, stat_month
</select>
</mapper>

Loading…
Cancel
Save