Browse Source

监督端-首页统计

dev-V1.0.1
niujiyi 5 months ago
parent
commit
1cee367a1d
  1. 142
      zdxt-modules/zdxt-enforcement-code/src/main/java/com/zdxt/enforcementcode/controller/web/supervision/StatisticalPanelCityController.java
  2. 388
      zdxt-modules/zdxt-enforcement-code/src/main/java/com/zdxt/enforcementcode/controller/web/supervision/StatisticalPanelController.java
  3. 121
      zdxt-modules/zdxt-enforcement-code/src/main/java/com/zdxt/enforcementcode/controller/web/supervision/StatisticalPanelDistrictController.java
  4. 229
      zdxt-modules/zdxt-enforcement-code/src/main/java/com/zdxt/enforcementcode/domain/bo/SixAnalysisParamsBo.java
  5. 223
      zdxt-modules/zdxt-enforcement-code/src/main/java/com/zdxt/enforcementcode/domain/bo/StatisticsIndicatorPartBo.java
  6. 23
      zdxt-modules/zdxt-enforcement-code/src/main/java/com/zdxt/enforcementcode/domain/vo/EnterpriseComplaintVo.java
  7. 223
      zdxt-modules/zdxt-enforcement-code/src/main/java/com/zdxt/enforcementcode/domain/vo/StatisticsIndicatorPartVo.java
  8. 33
      zdxt-modules/zdxt-enforcement-code/src/main/java/com/zdxt/enforcementcode/mapper/StatisticalPanelCityMapper.java
  9. 31
      zdxt-modules/zdxt-enforcement-code/src/main/java/com/zdxt/enforcementcode/mapper/StatisticalPanelDistrictMapper.java
  10. 162
      zdxt-modules/zdxt-enforcement-code/src/main/java/com/zdxt/enforcementcode/mapper/StatisticalPanelMapper.java
  11. 35
      zdxt-modules/zdxt-enforcement-code/src/main/java/com/zdxt/enforcementcode/service/IStatisticalPaneCityService.java
  12. 33
      zdxt-modules/zdxt-enforcement-code/src/main/java/com/zdxt/enforcementcode/service/IStatisticalPaneDistrictService.java
  13. 53
      zdxt-modules/zdxt-enforcement-code/src/main/java/com/zdxt/enforcementcode/service/IStatisticalPaneService.java
  14. 432
      zdxt-modules/zdxt-enforcement-code/src/main/java/com/zdxt/enforcementcode/service/impl/StatisticalPaneServiceCityImpl.java
  15. 553
      zdxt-modules/zdxt-enforcement-code/src/main/java/com/zdxt/enforcementcode/service/impl/StatisticalPaneServiceDistrictImpl.java
  16. 130
      zdxt-modules/zdxt-enforcement-code/src/main/java/com/zdxt/enforcementcode/service/impl/StatisticalPaneServiceImpl.java
  17. 390
      zdxt-modules/zdxt-enforcement-code/src/main/resources/mapper/enforcementcode/StatisticalPanelCityMapper.xml
  18. 404
      zdxt-modules/zdxt-enforcement-code/src/main/resources/mapper/enforcementcode/StatisticalPanelDistrictMapper.xml
  19. 2007
      zdxt-modules/zdxt-enforcement-code/src/main/resources/mapper/enforcementcode/StatisticalPanelMapper.xml
  20. 24
      zdxt-modules/zdxt-system/src/main/java/org/dromara/system/domain/bo/SysDeptBo.java
  21. 18
      zdxt-modules/zdxt-system/src/main/java/org/dromara/system/domain/vo/SysDeptVo.java
  22. 6
      zdxt-modules/zdxt-system/src/main/java/org/dromara/system/domain/vo/SysUserVo.java
  23. 13
      zdxt-modules/zdxt-system/src/main/java/org/dromara/system/mapper/SysDeptMapper.java
  24. 15
      zdxt-modules/zdxt-system/src/main/java/org/dromara/system/service/ISysDeptService.java
  25. 7
      zdxt-modules/zdxt-system/src/main/java/org/dromara/system/service/ISysUserService.java
  26. 21
      zdxt-modules/zdxt-system/src/main/java/org/dromara/system/service/impl/SysDeptServiceImpl.java
  27. 86
      zdxt-modules/zdxt-system/src/main/java/org/dromara/system/service/impl/SysUserServiceImpl.java
  28. 127
      zdxt-modules/zdxt-system/src/main/resources/mapper/system/SysDeptMapper.xml

142
zdxt-modules/zdxt-enforcement-code/src/main/java/com/zdxt/enforcementcode/controller/web/supervision/StatisticalPanelCityController.java

@ -0,0 +1,142 @@
package com.zdxt.enforcementcode.controller.web.supervision;
import cn.dev33.satoken.annotation.SaIgnore;
import com.zdxt.enforcementcode.domain.bo.SixAnalysisParamsBo;
import com.zdxt.enforcementcode.service.IStatisticalPaneCityService;
import lombok.RequiredArgsConstructor;
import org.dromara.common.core.domain.R;
import org.dromara.common.satoken.utils.LoginHelper;
import org.dromara.system.domain.vo.SysDeptVo;
import org.dromara.system.service.ISysDeptService;
import org.dromara.system.service.ISysUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.ui.Model;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import java.util.Map;
/**
* 监督端-各市直执法单位综合分析
*
*/
@Validated
@RequiredArgsConstructor
@RestController
@RequestMapping("/web/supervision/statisticalPanelCity")
public class StatisticalPanelCityController {
@Autowired
private IStatisticalPaneCityService statisticalPaneCityService;
@Autowired private ISysDeptService sysDeptService;
@Autowired private ISysUserService sysUserService;
/*------------------------------------------综合分析-新版--------------------------------*/
@GetMapping("/city-direct")
public String cityDirect(Model model) {
//UserBean ub = sysDeptService.getCurrentUser();
SysDeptVo sysDeptVo = sysDeptService.selectDeptById(LoginHelper.getDeptId());
if (java.util.Objects.toString(sysDeptVo.getZzDisplayPath(), "").contains("深圳市司法局")) {
// 市司法局
model.addAttribute("roleFlag",99);
} else if (java.util.Objects.toString(sysDeptVo.getZzDisplayPath(), "").contains("司法局")) {
// 区司法局
model.addAttribute("roleFlag",9);
} else {
sysDeptVo = sysDeptService.iterationDeptParentToBureau(LoginHelper.getDeptId());
if (null == sysDeptVo) {
model.addAttribute("roleFlag",99);
} else if (4 == sysDeptVo.getZone()) {
// 街道
model.addAttribute("roleFlag",4);
} else if (3 == sysDeptVo.getZone()) {
// 区直
model.addAttribute("roleFlag",3);
} else if (1 == sysDeptVo.getZone()) {
// 市值
model.addAttribute("roleFlag",1);
}
}
return "project/code/statistical-new/city-direct";
}
/** 监督端-市数据 */
@SaIgnore
@PostMapping("/collectStatistics")
@ResponseBody
public R<Map<String, Object>> analysisLawUnion(@RequestBody SixAnalysisParamsBo params){
// 全市行政检查数量
params.setDeptId(params.getBureauDeptId());
Map<String, Object> resMap = statisticalPaneCityService.collectStatistics(params);
return R.ok("联合检查", resMap);
}
/** 被执法企业次数排行 */
@SaIgnore
@PostMapping("/queryEnfEntSort")
@ResponseBody
public R<List<Map<String, String>>> queryEnfEntSort(@RequestBody SixAnalysisParamsBo params){
// 全市行政检查数量
params.setDeptId(params.getBureauDeptId());
List<Map<String, String>> resMap = statisticalPaneCityService.queryEnfEntSort(params);
return R.ok("被执法企业次数排行", resMap);
}
/** 执法单位执法数量排行 */
@SaIgnore
@PostMapping("/queryEnforcementSort")
@ResponseBody
public R<List<Map<String, String>>> queryEnforcementSort(@RequestBody SixAnalysisParamsBo params){
// 全市行政检查数量
params.setDeptId(params.getBureauDeptId());
List<Map<String, String>> resMap = statisticalPaneCityService.queryEnforcementSort(params);
return R.ok("执法单位执法数量排行", resMap);
}
/** 被投诉单位次数排行 */
@SaIgnore
@PostMapping("/queryEntCSort")
@ResponseBody
public R<List<Map<String, String>>> queryEntCSort(@RequestBody SixAnalysisParamsBo params){
// 全市行政检查数量
params.setDeptId(params.getBureauDeptId());
List<Map<String, String>> resMap = statisticalPaneCityService.queryEntCSort(params);
return R.ok("被投诉单位次数排行", resMap);
}
/** 委托执法数量及占比 */
@SaIgnore
@PostMapping("/queryAutoRate")
@ResponseBody
public R<Map<String, Long>> queryAutoRate(@RequestBody SixAnalysisParamsBo params){
// 全市行政检查数量
params.setDeptId(params.getBureauDeptId());
Map<String, Long> resMap = statisticalPaneCityService.queryAutoRate(params);
return R.ok("委托执法数量及占比", resMap);
}
/** 联合检查单位排行 */
@SaIgnore
@PostMapping("/queryUnionSort")
@ResponseBody
public R<List<Map<String, String>>> queryUnionSort(@RequestBody SixAnalysisParamsBo params){
// 全市行政检查数量
params.setDeptId(params.getBureauDeptId());
List<Map<String, String>> resMap = statisticalPaneCityService.queryEnfEntSort(params);
return R.ok("被执法企业次数排行", resMap);
}
/** 执法人员涉企检查数是排行 */
@SaIgnore
@PostMapping("/queryLawEntSort")
@ResponseBody
public R<List<Map<String, String>>> queryLawEntSort(@RequestBody SixAnalysisParamsBo params){
// 全市行政检查数量
params.setDeptId(params.getBureauDeptId());
List<Map<String, String>> resMap = statisticalPaneCityService.queryEnforcementSort(params);
return R.ok("执法单位执法数量排行", resMap);
}
}

388
zdxt-modules/zdxt-enforcement-code/src/main/java/com/zdxt/enforcementcode/controller/web/supervision/StatisticalPanelController.java

@ -0,0 +1,388 @@
package com.zdxt.enforcementcode.controller.web.supervision;
import cn.dev33.satoken.annotation.SaIgnore;
import com.zdxt.enforcementcode.domain.bo.SixAnalysisParamsBo;
import com.zdxt.enforcementcode.service.IStatisticalPaneService;
import lombok.RequiredArgsConstructor;
import org.dromara.common.core.domain.R;
import org.dromara.common.satoken.utils.LoginHelper;
import org.dromara.system.domain.bo.SysDeptBo;
import org.dromara.system.domain.vo.SysDeptVo;
import org.dromara.system.domain.vo.SysDictDataVo;
import org.dromara.system.domain.vo.SysUserVo;
import org.dromara.system.service.ISysDeptService;
import org.dromara.system.service.ISysDictDataService;
import org.dromara.system.service.ISysUserService;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* 监督端-首页统计面板
*
*/
@Validated
@RequiredArgsConstructor
@RestController
@RequestMapping("/web/supervision/statisticalPanel")
public class StatisticalPanelController {
private final IStatisticalPaneService statisticalPaneService;
private final ISysUserService sysUserService ;
private final ISysDeptService sysDeptService ;
private final ISysDictDataService sysDictDataService ;
/**
*
* 监督端-全市新增检查数量 + 联合检查统计 + 单条检查统计
*
* @param params
* */
@PostMapping("/analysisEnterprisesCoordination")
@ResponseBody
public R<Map<String,Object>> analysisEnterprisesCoordination(@RequestBody(required = false) SixAnalysisParamsBo params){
Map<String, Object> resMap = new HashMap<String, Object>();
// 判断是不是司法局的人
resMap.put("hasAll", 0);
SysUserVo ub = sysUserService.getCurrentUser();
SysDeptVo deptBean = sysDeptService.selectDeptById(ub.getDeptId());
if (java.util.Objects.toString(deptBean.getZzDisplayPath(), "").contains("深圳市司法局")) {
// 市司法局
resMap.put("roleFlag", 99);
resMap.put("roleDept", deptBean.getDeptName());
} else if (java.util.Objects.toString(deptBean.getZzDisplayPath(), "").contains("司法局")) {
// 区司法局
deptBean = sysDeptService.iterationDeptParentToBureau(ub.getDeptId());
resMap.put("roleFlag", 9);
String deptName = deptBean.getDeptName();
deptName = deptBean.getDeptName().replace("深圳市","").replace("司法局","");
resMap.put("roleDept", deptName);
} else {
deptBean = sysDeptService.iterationDeptParentToBureau(ub.getDeptId());
if (null == deptBean) {
resMap.put("roleFlag", 99);
resMap.put("roleDept", "");
} else if (4 == deptBean.getZone()) {
// 街道
resMap.put("roleFlag", 4);
resMap.put("roleDept", deptBean.getDeptName());
} else if (3 == deptBean.getZone()) {
// 区直
resMap.put("roleFlag", 3);
resMap.put("roleDept", deptBean.getDeptName());
} else if (1 == deptBean.getZone()) {
// 市值
resMap.put("roleFlag", 1);
resMap.put("roleDept", deptBean.getDeptName());
}
// 迭代判断是否是区直
}
// 全市行政检查数量
Integer all_num = statisticalPaneService.analysisEnterprisesAll(params);
Integer non_num = statisticalPaneService.analysis_non_enterprisesIns(params);
resMap.put("allNum", all_num);
resMap.put("nonNum", non_num);
// 全市行政联合检查数量
Integer union_num = statisticalPaneService.analysisEnterprisesUnion(params);
double union_rr_num = statisticalPaneService.analysisEnterprisesUnionRr(params);
double union_yoy_num = statisticalPaneService.analysisEnterprisesUnionYoy(params);
String union_rr = this.setPercentage((union_num - union_rr_num) / union_rr_num);
String union_yoy = this.setPercentage((union_num - union_yoy_num) / union_yoy_num);
String union_per = this.setPercentage((double)union_num / all_num);
resMap.put("unionNum", union_num);
resMap.put("unionRr", union_rr);
resMap.put("unionYoy", union_yoy);
resMap.put("unionPer", union_per);
// 全市行政单条检查数量
Integer single_num = statisticalPaneService.analysisEnterprisesSingle(params);
double single_rr_num = statisticalPaneService.analysisEnterprisesSingleRr(params);
double single_yoy_num = statisticalPaneService.analysisEnterprisesSingleYoy(params);
String single_rr = this.setPercentage((single_num - single_rr_num) / single_rr_num);
String single_yoy = this.setPercentage((single_num - single_yoy_num) / single_yoy_num);
String single_per = this.setPercentage((double)single_num / all_num);
resMap.put("singleNum", single_num);
resMap.put("singleRr", single_rr);
resMap.put("singleYoy", single_yoy);
resMap.put("singlePer", single_per);
// 执法压减数据
Integer cut_num = all_num - (union_num + single_num);
String cut_per = this.setPercentage((double)cut_num / all_num);
resMap.put("cutNum", cut_num);
resMap.put("cutPer", cut_per);
return R.ok(resMap);
}
private String setPercentage(Double percentage) {
if (percentage == 0 || percentage.isNaN() || percentage.isInfinite()) {
return "0.0";
} else {
String s = percentage * 100 + "";
if (s.length() > s.indexOf(".") + 3) {
percentage = Double.valueOf(s.substring(0, s.indexOf(".") + 3));
} else {
percentage = Double.valueOf(s);
}
return Double.valueOf(String.format("%.2f", percentage)).toString();
}
}
/**
*
* 监督端-被查企业 - 统计
*
*
* */
@SaIgnore
@PostMapping("/analysisEnterprises")
@ResponseBody
public R <Map<String,Object>> analysisEnterprises(@RequestBody SixAnalysisParamsBo params){
Integer num = statisticalPaneService.analysisEnterprises(params);
double ent_rr_num = statisticalPaneService.analysisEnterprisesRr(params);
double ent_yoy_num = statisticalPaneService.analysisEnterprisesYoy(params);
String rr = this.setPercentage((num - ent_rr_num) / ent_rr_num);
String yoy = this.setPercentage((num - ent_yoy_num) / ent_yoy_num);
Map<String, Object> resMap = new HashMap<String, Object>();
resMap.put("num", num);
resMap.put("rr", rr);
resMap.put("yoy", yoy);
return R.ok(resMap);
}
/**
*
* 监督端-所有非行政检查数量
*
* */
@SaIgnore
@PostMapping("/analysisEnterprisesNonAll")
@ResponseBody
public R<Integer> analysisEnterprisesNonAll(@RequestBody SixAnalysisParamsBo params){
Integer num = statisticalPaneService.analysisEnterprisesNonAll(params);
return R.ok(num);
}
/** 监督端-行政检查类型 - 统计 */
@SaIgnore
@PostMapping("/analysisRegistrationType")
@ResponseBody
public R <List<Map<String,Object>>> analysisRegistrationType(@RequestBody SixAnalysisParamsBo params){
List<Map<String, Object>> resMaps = statisticalPaneService.analysisRegistrationType(params);
return R.ok(resMaps);
}
/** 监督端-非行政检查类型 - 统计 */
@SaIgnore
@PostMapping("/analysisNonRegistrationType")
@ResponseBody
public R <List<Map<String,Object>>> analysisNonRegistrationType(@RequestBody SixAnalysisParamsBo params){
//SysDictDataVo dictParams = new SysDictDataVo();
//dictParams.setDictType("no_check_category");
List<SysDictDataVo> dicts = sysDictDataService.selectDictDataByType("no_check_category");
List<Map<String, Object>> sourceMap = statisticalPaneService.analysisNonRegistrationType(params);
Integer nonAll = statisticalPaneService.analysis_non_enterprisesIns(params);
List<Map<String, Object>> resMaps = new ArrayList<>();
for (SysDictDataVo dd : dicts) {
Map<String, Object> tmp = new HashMap<>();
tmp.put("dict_label", dd.getDictLabel());
tmp.put("num", 0);
tmp.put("per", "0.0");
for (Map<String, Object> smap : sourceMap) {
if (dd.getDictLabel().equals(smap.get("dict_label"))) {
double num = Double.parseDouble(smap.get("num").toString());
String per = this.setPercentage((num / nonAll));
tmp.put("num", num);
tmp.put("per", per);
break;
}
}
resMaps.add(tmp);
}
return R.ok(resMaps);
}
/** 监督端-行政时间维度 */
@SaIgnore
@PostMapping("/analysisTime")
@ResponseBody
public R <Map<String,Object>> analysisEnterprisesInsTime(@RequestBody SixAnalysisParamsBo params){
List<Map<String, Object>> insMaps = statisticalPaneService.analysisEnterprisesInsTime(params);
List<Map<String, Object>> entMaps = statisticalPaneService.analysisEnterprisesTime(params);
List<String> times = new ArrayList<>();
List<String> ins = new ArrayList<>();
List<String> ent = new ArrayList<>();
if (insMaps.size()<=entMaps.size()) {
for(int i=0 ; i<insMaps.size() ; i++) {
times.add(insMaps.get(i).get("time").toString());
ins.add(insMaps.get(i).get("num").toString());
ent.add(entMaps.get(i).get("num").toString());
}
} else {
for(int i=0 ; i<entMaps.size() ; i++) {
times.add(insMaps.get(i).get("time").toString());
ins.add(insMaps.get(i).get("num").toString());
ent.add(entMaps.get(i).get("num").toString());
}
}
Map<String, Object> resMap = new HashMap<>();
resMap.put("times", times);
resMap.put("ins", ins);
resMap.put("ent", ent);
return R.ok(resMap);
}
/** 监督端-非行政-时间维度 */
@SaIgnore
@PostMapping("/nonAnalysisTime")
@ResponseBody
public R <Map<String,Object>> analysisNonEnterprisesInsTime(@RequestBody SixAnalysisParamsBo params){
List<Map<String, Object>> insMaps = statisticalPaneService.analysisNonEnterprisesInsTime(params);
List<Map<String, Object>> entMaps = statisticalPaneService.analysisEnterprisesTime(params);
List<String> times = new ArrayList<>();
List<String> ins = new ArrayList<>();
List<String> ent = new ArrayList<>();
if (insMaps.size()<=entMaps.size()) {
for(int i=0 ; i<insMaps.size() ; i++) {
times.add(insMaps.get(i).get("time").toString());
ins.add(insMaps.get(i).get("num").toString());
ent.add(entMaps.get(i).get("num").toString());
}
} else {
for(int i=0 ; i<entMaps.size() ; i++) {
times.add(insMaps.get(i).get("time").toString());
ins.add(insMaps.get(i).get("num").toString());
ent.add(entMaps.get(i).get("num").toString());
}
}
Map<String, Object> resMap = new HashMap<>();
resMap.put("times", times);
resMap.put("ins", ins);
resMap.put("ent", ent);
return R.ok(resMap);
}
/** 监督端-按区的行政/非行政 - 统计 */
@SaIgnore
@PostMapping("/areaRegistration")
@ResponseBody
public R<Map<String,Object>> areaRegistration(@RequestBody SixAnalysisParamsBo params){
Map<String, Object> resMap = new HashMap<String, Object>();
SysDeptBo deptParams = new SysDeptBo();
deptParams.setZone(2);
deptParams.setDeptName(LoginHelper.getDeptName());
deptParams.setDeptId(LoginHelper.getDeptId());
List<SysDeptVo> depts = sysDeptService.selectDepts(deptParams);
if (depts == null || depts.isEmpty()) {
return R.fail("未找到相关部门信息");
}
params.setDeptId(depts.get(0).getDeptId());
resMap.put("area", deptParams.getDeptName());
// 全市行政检查数量
Integer all_num = statisticalPaneService.analysisEnterprisesAll(params);
params.setParams(null);
resMap.put("allNum", all_num);
// 全市行政联合检查数量
Integer union_num = statisticalPaneService.analysisEnterprisesUnion(params);
String union_per = this.setPercentage((double)union_num / all_num);
resMap.put("unionNum", union_num);
resMap.put("unionPer", union_per);
// 全市行政单条检查数量
Integer single_num = statisticalPaneService.analysisEnterprisesSingle(params);
String single_per = this.setPercentage((double)single_num / all_num);
resMap.put("singleNum", single_num);
resMap.put("singlePer", single_per);
// 执法压减数据
Integer cut_num = all_num - (union_num + single_num);
String cut_per = this.setPercentage((double)cut_num / all_num);
resMap.put("cutNum", cut_num);
resMap.put("cutPer", cut_per);
// 被检查企业数
params.setQy(deptParams.getDeptName());
// Integer ent_all_num = statisticalPaneService.analysisEnterprisesCountAll(params);
Integer ent_num = statisticalPaneService.analysisEnterprises(params);
// String ent_per = this.setPercentage((double)ent_num / ent_all_num);
resMap.put("entNum", ent_num);
// resMap.put("entPer", ent_per);
// 投诉
Integer com_num = statisticalPaneService.analysisEnterprisesComplaint(params);
// String com_per = this.setPercentage((double)com_num / all_num);
resMap.put("comNum", com_num);
// resMap.put("comPer", com_per);
// 非行政执法
Map<String, Object> resNonTyps = new HashMap<>();
List<SysDictDataVo> checkCategory = sysDictDataService.selectDictDataByType("no_check_category");
List<Map<String, Object>> nonTypes = statisticalPaneService.analysisNonRegistrationType(params);
Integer nonAll = statisticalPaneService.analysis_non_enterprisesIns(params);
resMap.put("njcNum", nonAll);
for (SysDictDataVo dictData : checkCategory) {
Map<String, Object> tmp = new HashMap<>();
tmp.put("label", dictData.getDictLabel());
tmp.put("num", 0);
tmp.put("per", 0.0);
for (Map<String, Object> map : nonTypes) {
if (map.get("dict_label").toString().equals(dictData.getDictLabel())) {
double num = Double.parseDouble(map.get("num").toString());
String per = this.setPercentage((num / nonAll));
tmp.put("num", num);
tmp.put("per", per);
}
}
resNonTyps.put("key_"+dictData.getDictValue(), tmp);
}
resMap.put("resNonTyps", resNonTyps);
return R.ok(resMap);
}
/**
* 查询部门接口
*/
@SaIgnore
@PostMapping("/queryDept")
@ResponseBody
public R<List<SysDeptVo>> queryDept(@RequestBody SysDeptBo bo){
List<SysDeptVo> deptBeans = sysDeptService.selectDepts(bo);
return R.ok("部门列表", deptBeans);
}
@SaIgnore
@PostMapping("/queryDeptLength")
@ResponseBody
public R<List<SysDeptVo>> queryDeptLength(@RequestBody SysDeptBo bo){
return R.ok("部门列表长度", sysDeptService.selectDepts(bo));
}
@SaIgnore
@PostMapping("/queryStreetAndDistrict")
@ResponseBody
public R<List<SysDeptVo>> queryStreetAndDistrict(@RequestBody SysDeptBo bo){
List<SysDeptVo> deptBeans = sysDeptService.getStreetAndDistrictList(bo);
return R.ok("部门列表-街道和区直", deptBeans);
}
}

121
zdxt-modules/zdxt-enforcement-code/src/main/java/com/zdxt/enforcementcode/controller/web/supervision/StatisticalPanelDistrictController.java

@ -0,0 +1,121 @@
package com.zdxt.enforcementcode.controller.web.supervision;
import cn.dev33.satoken.annotation.SaIgnore;
import com.zdxt.enforcementcode.domain.bo.SixAnalysisParamsBo;
import com.zdxt.enforcementcode.service.IStatisticalPaneDistrictService;
import lombok.RequiredArgsConstructor;
import org.dromara.common.core.domain.R;
import org.dromara.common.satoken.utils.LoginHelper;
import org.dromara.system.domain.vo.SysDeptVo;
import org.dromara.system.service.ISysDeptService;
import org.dromara.system.service.ISysUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import java.util.Map;
/**
* 监督端-各区综合统计
*/
@Validated
@RequiredArgsConstructor
@RestController
@RequestMapping("/web/supervision/statisticalPanelDistrict")
public class StatisticalPanelDistrictController {
@Autowired
private IStatisticalPaneDistrictService statisticalPaneDistrictService;
@Autowired private ISysDeptService sysDeptService;
@Autowired private ISysUserService sysUserService;
/*------------------------------------------综合分析-新版--------------------------------*/
@GetMapping("/district-direct")
public String districtDirect(Model model) {
//UserBean ub = userApi.getCurrentUser();
SysDeptVo deptBean = sysDeptService.selectDeptById(LoginHelper.getDeptId());
if (java.util.Objects.toString(deptBean.getZzDisplayPath(), "").contains("深圳市司法局")) {
// 市司法局
model.addAttribute("roleFlag",99);
} else if (java.util.Objects.toString(deptBean.getZzDisplayPath(), "").contains("司法局")) {
// 区司法局
model.addAttribute("roleFlag",9);
} else {
deptBean = sysDeptService.iterationDeptParentToBureau(LoginHelper.getDeptId());
if (null == deptBean) {
model.addAttribute("roleFlag",99);
} else if (4 == deptBean.getZone()) {
// 街道
model.addAttribute("roleFlag",4);
} else if (3 == deptBean.getZone()) {
// 区直
model.addAttribute("roleFlag",3);
} else if (1 == deptBean.getZone()) {
// 市值
model.addAttribute("roleFlag",1);
}
}
return "project/code/statistical-new/district-direct";
}
/** 市数据 */
@SaIgnore
@PostMapping("/collectStatistics")
@ResponseBody
public R<Map<String, Object>> analysisLawUnion(@RequestBody SixAnalysisParamsBo params){
// 全市行政检查数量
params.setDeptId(params.getBureauDeptId());
Map<String, Object> resMap = statisticalPaneDistrictService.collectStatistics(params);
return R.ok("联合检查", resMap);
}
/** 被执法企业次数排行 */
@SaIgnore
@PostMapping("/queryEnfEntSort")
@ResponseBody
public R<List<Map<String, String>>> queryEnfEntSort(@RequestBody SixAnalysisParamsBo params){
// 全市行政检查数量
params.setDeptId(params.getBureauDeptId());
List<Map<String, String>> resMap = statisticalPaneDistrictService.queryEnfEntSort(params);
return R.ok("被执法企业次数排行", resMap);
}
/** 执法单位执法数量排行 */
@SaIgnore
@PostMapping("/queryEnforcementSort")
@ResponseBody
public R<List<Map<String, String>>> queryEnforcementSort(@RequestBody SixAnalysisParamsBo params){
// 全市行政检查数量
params.setDeptId(params.getBureauDeptId());
List<Map<String, String>> resMap = statisticalPaneDistrictService.queryEnforcementSort(params);
return R.ok("执法单位执法数量排行", resMap);
}
/** 被投诉单位次数排行 */
@SaIgnore
@PostMapping("/queryEntCSort")
@ResponseBody
public R<List<Map<String, String>>> queryEntCSort(@RequestBody SixAnalysisParamsBo params){
// 全市行政检查数量
params.setDeptId(params.getBureauDeptId());
List<Map<String, String>> resMap = statisticalPaneDistrictService.queryEntCSort(params);
return R.ok("被投诉单位次数排行", resMap);
}
/** 委托执法数量及占比 */
@SaIgnore
@PostMapping("/queryAutoRate")
@ResponseBody
public R<Map<String, Long>> queryAutoRate(@RequestBody SixAnalysisParamsBo params){
// 全市行政检查数量
params.setDeptId(params.getBureauDeptId());
Map<String, Long> resMap = statisticalPaneDistrictService.queryAutoRate(params);
return R.ok("委托执法数量及占比", resMap);
}
}

229
zdxt-modules/zdxt-enforcement-code/src/main/java/com/zdxt/enforcementcode/domain/bo/SixAnalysisParamsBo.java

@ -0,0 +1,229 @@
package com.zdxt.enforcementcode.domain.bo;
import lombok.Data;
import java.util.List;
import java.util.Map;
@Data
public class SixAnalysisParamsBo {
private Long userId;
private String bureauDeptId;
private String bureauDeptName;
/** 0:联合检查, 1:单独检查, null:所有检查 */
private String uniteCheck;
/** 1:市, 3:区 */
private Integer zone;
/** 区域传入 字典类型 */
private String qy;
private String jd;
/** 是否委托执法 */
private Integer hasAuto;
/** 开始时间 */
private String beginTime;
/** 结束时间 */
private String endTime;
/** 时间类型:year,quarter,month,day */
private String dateType;
private Integer year;
private Integer quarter;
private Integer month;
private Integer day;
private String fmtDate;
private Integer isReg;
/** 0:行政投诉; 1:非行政投诉 */
private Integer recordType;
/** 所属区 */
private String area;
private Integer pageSize;
private List<String> filterDepts;
/**
* 部门ID
*/
private String deptId;
/**数据权限参数 */
private Map<String, Object> params;
public String getArea() {
return area;
}
public void setArea(String area) {
this.area = area;
}
public Integer getRecordType() {
return recordType;
}
public void setRecordType(Integer recordType) {
this.recordType = recordType;
}
public Integer getHasAuto() {
return hasAuto;
}
public void setHasAuto(Integer hasAuto) {
this.hasAuto = hasAuto;
}
public List<String> getFilterDepts() {
return filterDepts;
}
public void setFilterDepts(List<String> filterDepts) {
this.filterDepts = filterDepts;
}
public String getFmtDate() {
return fmtDate;
}
public void setFmtDate(String fmtDate) {
this.fmtDate = fmtDate;
}
public Integer getZone() {
return zone;
}
public void setZone(Integer zone) {
this.zone = zone;
}
public Integer getPageSize() {
return pageSize;
}
public void setPageSize(Integer pageSize) {
this.pageSize = pageSize;
}
// Map<String, Object> params = new HashMap<String, Object>();
//
// public Map<String, Object> getParams() {
// return params;
// }
//
// public void setParams(Map<String, Object> params) {
// this.params = params;
// }
public Integer getIsReg() {
return isReg;
}
public void setIsReg(Integer isReg) {
this.isReg = isReg;
}
public Long getUserId() {
return userId;
}
public void setUserId(Long userId) {
this.userId = userId;
}
public String getBureauDeptId() {
return bureauDeptId;
}
public void setBureauDeptId(String bureauDeptId) {
this.bureauDeptId = bureauDeptId;
}
public String getBureauDeptName() {
return bureauDeptName;
}
public void setBureauDeptName(String bureauDeptName) {
this.bureauDeptName = bureauDeptName;
}
public String getUniteCheck() {
return uniteCheck;
}
public void setUniteCheck(String uniteCheck) {
this.uniteCheck = uniteCheck;
}
public String getQy() {
return qy;
}
public void setQy(String qy) {
this.qy = qy;
}
public String getJd() {
return jd;
}
public void setJd(String jd) {
this.jd = jd;
}
public String getBeginTime() {
return beginTime;
}
public void setBeginTime(String beginTime) {
this.beginTime = beginTime;
}
public String getEndTime() {
return endTime;
}
public void setEndTime(String endTime) {
this.endTime = endTime;
}
public String getDateType() {
return dateType;
}
public void setDateType(String dateType) {
this.dateType = dateType;
}
public Integer getYear() {
return year;
}
public void setYear(Integer year) {
this.year = year;
}
public Integer getQuarter() {
return quarter;
}
public void setQuarter(Integer quarter) {
this.quarter = quarter;
}
public Integer getMonth() {
return month;
}
public void setMonth(Integer month) {
this.month = month;
}
public Integer getDay() {
return day;
}
public void setDay(Integer day) {
this.day = day;
}
}

223
zdxt-modules/zdxt-enforcement-code/src/main/java/com/zdxt/enforcementcode/domain/bo/StatisticsIndicatorPartBo.java

@ -0,0 +1,223 @@
package com.zdxt.enforcementcode.domain.bo;
import java.util.List;
public class StatisticsIndicatorPartBo{
private String name;
private Integer number;
private Integer huan;
private Integer tong;
/**
* 同比-新字段
*/
private Double tongValue;
/**
* 环比-新字段
*/
private Double huanValue;
private Integer complaint;
List<StatisticsIndicatorPartBo> statisticsIndicatorPartList;
/**
* 类型
*/
private String type;
/**
* 总数量
*/
private Integer total;
/**
* 年度
*/
private String year;
/**
* 季度
*/
private Integer quarter;
/**
* 月度
*/
private String month;
/**
* 机构统一信用代码
*/
private String creditCode;
private String beginTime;
private String endTime;
/**
* 是否全部数据权限
*/
private String isAllData;
/**
* 区 搜索条件
*/
private String region;
/**
* 街道 搜索条件
*/
private String street;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Integer getNumber() {
return number;
}
public void setNumber(Integer number) {
this.number = number;
}
public Integer getHuan() {
return huan;
}
public void setHuan(Integer huan) {
this.huan = huan;
}
public Integer getTong() {
return tong;
}
public void setTong(Integer tong) {
this.tong = tong;
}
public Integer getComplaint() {
return complaint;
}
public void setComplaint(Integer complaint) {
this.complaint = complaint;
}
public List<StatisticsIndicatorPartBo> getStatisticsIndicatorPartList() {
return statisticsIndicatorPartList;
}
public void setStatisticsIndicatorPartList(List<StatisticsIndicatorPartBo> statisticsIndicatorPartList) {
this.statisticsIndicatorPartList = statisticsIndicatorPartList;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public Integer getTotal() {
return total;
}
public void setTotal(Integer total) {
this.total = total;
}
public String getYear() {
return year;
}
public void setYear(String year) {
this.year = year;
}
public Integer getQuarter() {
return quarter;
}
public void setQuarter(Integer quarter) {
this.quarter = quarter;
}
public String getMonth() {
return month;
}
public void setMonth(String month) {
this.month = month;
}
public String getCreditCode() {
return creditCode;
}
public void setCreditCode(String creditCode) {
this.creditCode = creditCode;
}
public String getBeginTime() {
return beginTime;
}
public void setBeginTime(String beginTime) {
this.beginTime = beginTime;
}
public String getEndTime() {
return endTime;
}
public void setEndTime(String endTime) {
this.endTime = endTime;
}
public Double getTongValue() {
return tongValue;
}
public void setTongValue(Double tongValue) {
this.tongValue = tongValue;
}
public Double getHuanValue() {
return huanValue;
}
public void setHuanValue(Double huanValue) {
this.huanValue = huanValue;
}
public String getRegion() {
return region;
}
public void setRegion(String region) {
this.region = region;
}
public String getStreet() {
return street;
}
public void setStreet(String street) {
this.street = street;
}
public String getIsAllData() {
return isAllData;
}
public void setIsAllData(String isAllData) {
this.isAllData = isAllData;
}
}

23
zdxt-modules/zdxt-enforcement-code/src/main/java/com/zdxt/enforcementcode/domain/vo/EnterpriseComplaintVo.java

@ -79,49 +79,49 @@ public class EnterpriseComplaintVo implements Serializable {
private String caseType;
/**
*
*
*/
@ExcelProperty(value = "")
private Long authorization;
/**
*
*
*/
@ExcelProperty(value = "")
private Long comOrOpi;
/**
*
*
*/
@ExcelProperty(value = "")
private String enterpriseAddress;
/**
*
*
*/
@ExcelProperty(value = "")
private String proWoCode;
/**
*
*
*/
@ExcelProperty(value = "")
private Long status;
/**
*
*
*/
@ExcelProperty(value = "")
private Date evaluateTime;
/**
*
*
*/
@ExcelProperty(value = "")
private String enterpriseNumber;
/**
*
*
*/
@ExcelProperty(value = "")
private String enterpriseName;
@ -181,5 +181,12 @@ public class EnterpriseComplaintVo implements Serializable {
@ExcelProperty(value = "数据类型 0行政 1 非行政")
private Long recordType;
/**
* 创建时间
*/
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@ExcelProperty(value = "创建时间")
private Date createTime;
}

223
zdxt-modules/zdxt-enforcement-code/src/main/java/com/zdxt/enforcementcode/domain/vo/StatisticsIndicatorPartVo.java

@ -0,0 +1,223 @@
package com.zdxt.enforcementcode.domain.vo;
import java.util.List;
public class StatisticsIndicatorPartVo {
private String name;
private Integer number;
private Integer huan;
private Integer tong;
/**
* 同比-新字段
*/
private Double tongValue;
/**
* 环比-新字段
*/
private Double huanValue;
private Integer complaint;
List<StatisticsIndicatorPartVo> statisticsIndicatorPartList;
/**
* 类型
*/
private String type;
/**
* 总数量
*/
private Integer total;
/**
* 年度
*/
private String year;
/**
* 季度
*/
private Integer quarter;
/**
* 月度
*/
private String month;
/**
* 机构统一信用代码
*/
private String creditCode;
private String beginTime;
private String endTime;
/**
* 是否全部数据权限
*/
private String isAllData;
/**
* 区 搜索条件
*/
private String region;
/**
* 街道 搜索条件
*/
private String street;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Integer getNumber() {
return number;
}
public void setNumber(Integer number) {
this.number = number;
}
public Integer getHuan() {
return huan;
}
public void setHuan(Integer huan) {
this.huan = huan;
}
public Integer getTong() {
return tong;
}
public void setTong(Integer tong) {
this.tong = tong;
}
public Integer getComplaint() {
return complaint;
}
public void setComplaint(Integer complaint) {
this.complaint = complaint;
}
public List<StatisticsIndicatorPartVo> getStatisticsIndicatorPartList() {
return statisticsIndicatorPartList;
}
public void setStatisticsIndicatorPartList(List<StatisticsIndicatorPartVo> statisticsIndicatorPartList) {
this.statisticsIndicatorPartList = statisticsIndicatorPartList;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public Integer getTotal() {
return total;
}
public void setTotal(Integer total) {
this.total = total;
}
public String getYear() {
return year;
}
public void setYear(String year) {
this.year = year;
}
public Integer getQuarter() {
return quarter;
}
public void setQuarter(Integer quarter) {
this.quarter = quarter;
}
public String getMonth() {
return month;
}
public void setMonth(String month) {
this.month = month;
}
public String getCreditCode() {
return creditCode;
}
public void setCreditCode(String creditCode) {
this.creditCode = creditCode;
}
public String getBeginTime() {
return beginTime;
}
public void setBeginTime(String beginTime) {
this.beginTime = beginTime;
}
public String getEndTime() {
return endTime;
}
public void setEndTime(String endTime) {
this.endTime = endTime;
}
public Double getTongValue() {
return tongValue;
}
public void setTongValue(Double tongValue) {
this.tongValue = tongValue;
}
public Double getHuanValue() {
return huanValue;
}
public void setHuanValue(Double huanValue) {
this.huanValue = huanValue;
}
public String getRegion() {
return region;
}
public void setRegion(String region) {
this.region = region;
}
public String getStreet() {
return street;
}
public void setStreet(String street) {
this.street = street;
}
public String getIsAllData() {
return isAllData;
}
public void setIsAllData(String isAllData) {
this.isAllData = isAllData;
}
}

33
zdxt-modules/zdxt-enforcement-code/src/main/java/com/zdxt/enforcementcode/mapper/StatisticalPanelCityMapper.java

@ -0,0 +1,33 @@
package com.zdxt.enforcementcode.mapper;
import com.zdxt.enforcementcode.domain.EnforcementRegistration;
import com.zdxt.enforcementcode.domain.EnterpriseComplaint;
import com.zdxt.enforcementcode.domain.EnterpriseEvaluate;
import com.zdxt.enforcementcode.domain.bo.SixAnalysisParamsBo;
import com.zdxt.enforcementcode.domain.vo.EnforcementRegistrationVo;
import com.zdxt.enforcementcode.domain.vo.EnterpriseComplaintVo;
import com.zdxt.enforcementcode.domain.vo.EnterpriseEvaluateVo;
import java.util.List;
import java.util.Map;
public interface StatisticalPanelCityMapper {
/** 所有行政执法 */
List<EnforcementRegistrationVo> query_law_all(SixAnalysisParamsBo params);
List<EnterpriseComplaintVo> query_complaint_all(SixAnalysisParamsBo params);
List<EnterpriseEvaluateVo> query_evaluate_all(SixAnalysisParamsBo params);
long query_ent_count(SixAnalysisParamsBo params);
List<Map<String, String>> query_category_count(SixAnalysisParamsBo params);
List<Map<String, String>> query_law_field_count(SixAnalysisParamsBo params);
List<Map<String, String>> query_enforce_type_count(SixAnalysisParamsBo params);
List<Map<String, String>> query_enfEnt_sort(SixAnalysisParamsBo params);
List<Map<String, String>> query_enforcement_sort(SixAnalysisParamsBo params);
List<Map<String, String>> query_entC_sort(SixAnalysisParamsBo params);
long query_auto_rate(SixAnalysisParamsBo params);
List<String> queryDeptAllByBureauDeptId(String bureauDeptId);
List<String> queryDuplicateUnionNosByUnion(SixAnalysisParamsBo params);
List<Map<String, String>> queryBureauDeptByUnion(List<String> unionNos);
}

31
zdxt-modules/zdxt-enforcement-code/src/main/java/com/zdxt/enforcementcode/mapper/StatisticalPanelDistrictMapper.java

@ -0,0 +1,31 @@
package com.zdxt.enforcementcode.mapper;
import com.zdxt.enforcementcode.domain.bo.SixAnalysisParamsBo;
import com.zdxt.enforcementcode.domain.vo.EnforcementRegistrationVo;
import com.zdxt.enforcementcode.domain.vo.EnterpriseComplaintVo;
import com.zdxt.enforcementcode.domain.vo.EnterpriseEvaluateVo;
import java.util.List;
import java.util.Map;
public interface StatisticalPanelDistrictMapper {
/** 所有行政执法 */
List<EnforcementRegistrationVo> query_law_all(SixAnalysisParamsBo params);
List<EnterpriseComplaintVo> query_complaint_all(SixAnalysisParamsBo params);
List<EnterpriseEvaluateVo> query_evaluate_all(SixAnalysisParamsBo params);
long query_ent_count(SixAnalysisParamsBo params);
List<String> query_ent_address(SixAnalysisParamsBo params);
List<Map<String, String>> query_category_count(SixAnalysisParamsBo params);
List<Map<String, String>> query_law_field_count(SixAnalysisParamsBo params);
List<Map<String, String>> query_enforce_type_count(SixAnalysisParamsBo params);
List<Map<String, String>> query_enfEnt_sort(SixAnalysisParamsBo params);
List<Map<String, String>> query_enforcement_sort(SixAnalysisParamsBo params);
List<Map<String, String>> query_entC_sort(SixAnalysisParamsBo params);
long query_auto_rate(SixAnalysisParamsBo params);
List<String> queryDeptAllByBureauDeptId(String bureauDeptId);
List<String> queryDuplicateUnionNosByUnion(SixAnalysisParamsBo params);
List<Map<String, String>> queryBureauDeptByUnion(List<String> unionNos);
}

162
zdxt-modules/zdxt-enforcement-code/src/main/java/com/zdxt/enforcementcode/mapper/StatisticalPanelMapper.java

@ -0,0 +1,162 @@
package com.zdxt.enforcementcode.mapper;
import com.zdxt.enforcementcode.domain.bo.SixAnalysisParamsBo;
import com.zdxt.enforcementcode.domain.vo.EnterpriseInformationVo;
import com.zdxt.enforcementcode.domain.vo.StatisticsIndicatorPartVo;
import java.util.List;
import java.util.Map;
public interface StatisticalPanelMapper {
/**
* 统计执法部门数量
* @param statisticsIndicatorPart
* @return
*/
Integer statisticalPanelDept(StatisticsIndicatorPartVo statisticsIndicatorPart);
/**
* 统计执法人员数量
* @param statisticsIndicatorPart
* @return
*/
Integer statisticalPanelUser(StatisticsIndicatorPartVo statisticsIndicatorPart);
/**
* 统计执法人员数量
* @param statisticsIndicatorPart
* @return
*/
Integer statisticalPanelOneselfDeptUser(StatisticsIndicatorPartVo statisticsIndicatorPart);
/**
* 查询检查计划总数量
* @param statisticsIndicatorPart
* @return
*/
Integer statisticalPanelProgramTotal(StatisticsIndicatorPartVo statisticsIndicatorPart);
/**
* 查询本单位检查计划数量
* @param statisticsIndicatorPart
* @return
*/
Integer statisticalPanelProgramWithDept(StatisticsIndicatorPartVo statisticsIndicatorPart);
/**
* 查询本单位检查计划数量以部门分组计数
* @param statisticsIndicatorPart
* @return
*/
Integer statisticalPanelProgramGroupByDept(StatisticsIndicatorPartVo statisticsIndicatorPart);
/**
* 获取执法记录,关联企业信息(本时段)
* @param params
* @return
* 注:企业名称使用的执法表内非企业表
*/
Integer staisticalRegistration(SixAnalysisParamsBo params);
Double staisticalRegistration_rr(SixAnalysisParamsBo params);
Double staisticalRegistration_yoy(SixAnalysisParamsBo params);
/**
* 获取执法记录,关联企业信息(本时段)
* @param params
* @return
* 注:企业名称使用的执法表内非企业表
*/
Integer staisticalLawEnforcement(SixAnalysisParamsBo params);
Double staisticalLawEnforcement_rr(SixAnalysisParamsBo params);
Double staisticalLawEnforcement_yoy(SixAnalysisParamsBo params);
/**
* 获取执法投诉统计表,关联企业信息(本时段)
* @param params
* @return
* 字段:企业信息、投诉类型
*/
Integer staisticalComplaint(SixAnalysisParamsBo params);
Double staisticalComplaint_rr(SixAnalysisParamsBo params);
Double staisticalComplaint_yoy(SixAnalysisParamsBo params);
/**
* 获取执法预警本企业,关联企业信息(本时段)
* @param params
* @return
*/
Integer staisticalWarning(SixAnalysisParamsBo params);
Double staisticalWarning_rr(SixAnalysisParamsBo params);
Double staisticalWarning_yoy(SixAnalysisParamsBo params);
/**
* 获取企业信息(本时段)
* @param params
* @return
*/
Integer staisticalEnterprise(SixAnalysisParamsBo params);
Double staisticalEnterprise_rr(SixAnalysisParamsBo params);
Double staisticalEnterprise_yoy(SixAnalysisParamsBo params);
/** 排行 */
List<Map<String, Object>> staisticalRegistration_order(SixAnalysisParamsBo params);
List<Map<String, Object>> staisticalComplaint_order(SixAnalysisParamsBo params);
List<Map<String, Object>> staisticalBureau_order(SixAnalysisParamsBo params);
/** 检查类别 */
List<Map<String, Object>> staisticalCheck_category(SixAnalysisParamsBo params);
/** 满意类别 */
List<Map<String, Object>> staisticalEvaluate_category(SixAnalysisParamsBo params);
/** 投诉率类别 */
List<Map<String, Object>> staisticalComplaint_category(SixAnalysisParamsBo params);
/** 企业类别 */
List<EnterpriseInformationVo> staisticalEnterprise_category(SixAnalysisParamsBo params);
/** 投诉类型 */
List<Map<String, Object>> staisticalEnforce_type(SixAnalysisParamsBo params);
/** 行政检查数量 */
Integer analysis_enterprises_all(SixAnalysisParamsBo params);
/** 非行政检查数量 */
Integer analysis_enterprises_non_all(SixAnalysisParamsBo params);
/** 联合检查 */
Integer analysis_enterprises_union(SixAnalysisParamsBo params);
Double analysis_enterprises_union_rr(SixAnalysisParamsBo params);
Double analysis_enterprises_union_yoy(SixAnalysisParamsBo params);
/** 单条检查 */
Integer analysis_enterprises_single(SixAnalysisParamsBo params);
Double analysis_enterprises_single_rr(SixAnalysisParamsBo params);
Double analysis_enterprises_single_yoy(SixAnalysisParamsBo params);
Integer analysis_non_enterprisesIns(SixAnalysisParamsBo params);
Integer analysis_enterprisesIns_all(SixAnalysisParamsBo params);
/** 检查预告 */
Integer analysis_insNotice(SixAnalysisParamsBo params);
Double analysis_insNotice_rr(SixAnalysisParamsBo params);
Double analysis_insNotice_yoy(SixAnalysisParamsBo params);
/** 涉企投诉 */
Integer analysis_enterprisesComplaint(SixAnalysisParamsBo params);
Double analysis_enterprisesComplaint_rr(SixAnalysisParamsBo params);
Double analysis_enterprisesComplaint_yoy(SixAnalysisParamsBo params);
/** 被查企业 */
Integer analysis_enterprises(SixAnalysisParamsBo params);
Double analysis_enterprises_rr(SixAnalysisParamsBo params);
Double analysis_enterprises_yoy(SixAnalysisParamsBo params);
Integer analysis_non_enterprises(SixAnalysisParamsBo params);
Integer analysis_enterprises_countAll(SixAnalysisParamsBo params);
/** 时间维度 */
List<Map<String, Object>> analysis_enterprisesIns_time(SixAnalysisParamsBo params);
List<Map<String, Object>> analysis_non_enterprisesIns_time(SixAnalysisParamsBo params);
List<Map<String, Object>> analysis_enterprises_time(SixAnalysisParamsBo params);
/** 非行政检查类型 */
List<Map<String, Object>> analysis_non_registration_type(SixAnalysisParamsBo params);
List<Map<String, Object>> analysis_registration_type(SixAnalysisParamsBo params);
}

35
zdxt-modules/zdxt-enforcement-code/src/main/java/com/zdxt/enforcementcode/service/IStatisticalPaneCityService.java

@ -0,0 +1,35 @@
package com.zdxt.enforcementcode.service;
import com.zdxt.enforcementcode.domain.bo.SixAnalysisParamsBo;
import com.zdxt.enforcementcode.domain.vo.EnforcementRegistrationVo;
import com.zdxt.enforcementcode.domain.vo.EnterpriseComplaintVo;
import com.zdxt.enforcementcode.domain.vo.EnterpriseEvaluateVo;
import java.util.List;
import java.util.Map;
public interface IStatisticalPaneCityService {
/** 所有行政检查数量 */
Map<String, Object> collectStatistics(SixAnalysisParamsBo params);
/** 被执法企业次数排行 */
List<Map<String, String>> queryEnfEntSort(SixAnalysisParamsBo params);
/** 执法单位执法数量排行 */
List<Map<String, String>> queryEnforcementSort(SixAnalysisParamsBo params);
/** 被投诉单位次数排行 */
List<Map<String, String>> queryEntCSort(SixAnalysisParamsBo params);
/** 委托执法数量及占比 */
Map<String, Long> queryAutoRate(SixAnalysisParamsBo params);
List<EnforcementRegistrationVo> queryLawAll(SixAnalysisParamsBo params);
List<EnterpriseComplaintVo> queryComplaintAll(SixAnalysisParamsBo params);
long queryEntCount(SixAnalysisParamsBo params);
List<Map<String, String>> queryCategoryCount(SixAnalysisParamsBo params);
List<Map<String, String>> queryLawFieldCount(SixAnalysisParamsBo params);
List<Map<String, String>> queryEnforceTypeCount(SixAnalysisParamsBo params);
List<EnterpriseEvaluateVo> queryEvaluateAll(SixAnalysisParamsBo params);
}

33
zdxt-modules/zdxt-enforcement-code/src/main/java/com/zdxt/enforcementcode/service/IStatisticalPaneDistrictService.java

@ -0,0 +1,33 @@
package com.zdxt.enforcementcode.service;
import com.zdxt.enforcementcode.domain.bo.SixAnalysisParamsBo;
import com.zdxt.enforcementcode.domain.vo.EnforcementRegistrationVo;
import com.zdxt.enforcementcode.domain.vo.EnterpriseComplaintVo;
import com.zdxt.enforcementcode.domain.vo.EnterpriseEvaluateVo;
import java.util.List;
import java.util.Map;
public interface IStatisticalPaneDistrictService {
/** 所有行政检查数量 */
Map<String, Object> collectStatistics(SixAnalysisParamsBo params);
/** 被执法企业次数排行 */
List<Map<String, String>> queryEnfEntSort(SixAnalysisParamsBo params);
/** 执法单位执法数量排行 */
List<Map<String, String>> queryEnforcementSort(SixAnalysisParamsBo params);
/** 被投诉单位次数排行 */
List<Map<String, String>> queryEntCSort(SixAnalysisParamsBo params);
/** 委托执法数量及占比 */
Map<String, Long> queryAutoRate(SixAnalysisParamsBo params);
List<EnforcementRegistrationVo> queryLawAll(SixAnalysisParamsBo params);
List<EnterpriseComplaintVo> queryComplaintAll(SixAnalysisParamsBo params);
long queryEntCount(SixAnalysisParamsBo params);
List<Map<String, String>> queryCategoryCount(SixAnalysisParamsBo params);
List<Map<String, String>> queryLawFieldCount(SixAnalysisParamsBo params);
List<Map<String, String>> queryEnforceTypeCount(SixAnalysisParamsBo params);
List<EnterpriseEvaluateVo> queryEvaluateAll(SixAnalysisParamsBo params);
}

53
zdxt-modules/zdxt-enforcement-code/src/main/java/com/zdxt/enforcementcode/service/IStatisticalPaneService.java

@ -0,0 +1,53 @@
package com.zdxt.enforcementcode.service;
import com.zdxt.enforcementcode.domain.bo.SixAnalysisParamsBo;
import java.util.List;
import java.util.Map;
public interface IStatisticalPaneService {
/** 所有行政检查数量 */
Integer analysisEnterprisesAll(SixAnalysisParamsBo params);
Integer analysis_non_enterprisesIns(SixAnalysisParamsBo params);
/** 联合检查统计 */
Integer analysisEnterprisesUnion(SixAnalysisParamsBo params);
Double analysisEnterprisesUnionRr(SixAnalysisParamsBo params);
Double analysisEnterprisesUnionYoy(SixAnalysisParamsBo params);
/** 单条检查统计 */
Integer analysisEnterprisesSingle(SixAnalysisParamsBo params);
Double analysisEnterprisesSingleRr(SixAnalysisParamsBo params);
Double analysisEnterprisesSingleYoy(SixAnalysisParamsBo params);
/** 被查企业 */
Integer analysisEnterprises(SixAnalysisParamsBo params);
Double analysisEnterprisesRr(SixAnalysisParamsBo params);
Double analysisEnterprisesYoy(SixAnalysisParamsBo params);
Integer analysis_non_enterprises(SixAnalysisParamsBo params);
Integer analysisEnterprisesCountAll(SixAnalysisParamsBo params);
/** 所有非行政检查数量 */
Integer analysisEnterprisesNonAll(SixAnalysisParamsBo params);
/** 非行政检查类型 */
List<Map<String, Object>> analysisNonRegistrationType(SixAnalysisParamsBo params);
List<Map<String, Object>> analysisRegistrationType(SixAnalysisParamsBo params);
/** 时间维度 */
List<Map<String, Object>> analysisEnterprisesInsTime(SixAnalysisParamsBo params);
List<Map<String, Object>> analysisNonEnterprisesInsTime(SixAnalysisParamsBo params);
List<Map<String, Object>> analysisEnterprisesTime(SixAnalysisParamsBo params);
/** 涉企投诉 */
Integer analysisEnterprisesComplaint(SixAnalysisParamsBo params);
Double analysisEnterprisesComplaintRr(SixAnalysisParamsBo params);
Double analysisEnterprisesComplaintYoy(SixAnalysisParamsBo params);
}

432
zdxt-modules/zdxt-enforcement-code/src/main/java/com/zdxt/enforcementcode/service/impl/StatisticalPaneServiceCityImpl.java

@ -0,0 +1,432 @@
package com.zdxt.enforcementcode.service.impl;
import com.zdxt.enforcementcode.common.annotation.DataScope;
import com.zdxt.enforcementcode.domain.EnforcementRegistration;
import com.zdxt.enforcementcode.domain.EnterpriseComplaint;
import com.zdxt.enforcementcode.domain.EnterpriseEvaluate;
import com.zdxt.enforcementcode.domain.bo.SixAnalysisParamsBo;
import com.zdxt.enforcementcode.domain.vo.EnforcementRegistrationVo;
import com.zdxt.enforcementcode.domain.vo.EnterpriseComplaintVo;
import com.zdxt.enforcementcode.domain.vo.EnterpriseEvaluateVo;
import com.zdxt.enforcementcode.mapper.StatisticalPanelCityMapper;
import com.zdxt.enforcementcode.service.IStatisticalPaneCityService;
import org.dromara.common.core.utils.StringUtils;
import org.dromara.system.domain.SysDictData;
import org.dromara.system.domain.bo.SysDictDataBo;
import org.dromara.system.domain.vo.SysDictDataVo;
import org.dromara.system.service.ISysDeptService;
import org.dromara.system.service.ISysDictDataService;
import org.dromara.system.service.ISysUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.time.LocalDate;
import java.time.YearMonth;
import java.time.ZoneId;
import java.util.*;
import java.util.function.Function;
import java.util.stream.Collectors;
/**
* 年度:year!==null,quarter==null,month==null
* 季度:year!==null,quarter!==null,month==null
* 月度:year!==null,quarter!==null,month!==null
*/
@Service
public class StatisticalPaneServiceCityImpl implements IStatisticalPaneCityService {
@Autowired private StatisticalPanelCityMapper statisticalPanelCityMapper;
@Autowired private ISysDictDataService sysDictDataService;
@Autowired private ISysUserService sysUserService;
@Autowired private ISysDeptService sysDeptService;
@Override
@DataScope(deptAlias = "r",userAlias = "r",deptField = "bureau_dept_id")
public Map<String, Object> collectStatistics(SixAnalysisParamsBo params) {
Map<String, Object> resMap = new HashMap<String, Object>();
String begin_tiem = params.getBeginTime();
String end_tiem = params.getEndTime();
// 获取所有当前选中部门下的所有部门id
List<String> deptIds = new ArrayList<>();
if (StringUtils.isNotEmpty(params.getBureauDeptId())) {
deptIds = statisticalPanelCityMapper.queryDeptAllByBureauDeptId(params.getBureauDeptId());
}
if (deptIds.size() > 0) params.setFilterDepts(deptIds);
// params.setZone(1);
// List<EnforcementRegistration> allLawRegs = statisticalPanelCityMapper.query_law_all(params);
List<EnforcementRegistrationVo> allLawRegs = this.queryLawAll(params);
Map<String, Double> singleLaw = new HashMap<>();
resMap.put("singleLaw", singleLaw);
// 单独执法
singleLaw.put("count", 0D);
singleLaw.put("yesterday", 0D);
singleLaw.put("thisMonth", 0D);
singleLaw.put("lastMonth", 0D);
singleLaw.put("lastYearMonth", 0D);
singleLaw.put("mom", 0D);
singleLaw.put("yoy", 0D);
// 联合执法
Map<String, Double> unionLaw = new HashMap<>();
resMap.put("unionLaw", unionLaw);
long unionAllNum = 0L;
long unionAll_day = 0L;
long unionAll_month = 0L;
unionLaw.put("count", 0D);
unionLaw.put("yesterday", 0D);
unionLaw.put("thisMonth", 0D);
unionLaw.put("lastMonth", 0D);
unionLaw.put("lastYearMonth", 0D);
unionLaw.put("mom", 0D);
unionLaw.put("yoy", 0D);
// 入企压减率
Map<String, Double> entEeduction = new HashMap<>();
resMap.put("entEeduction", entEeduction);
entEeduction.put("count", 0.0);
entEeduction.put("yesterday", 0.0);
entEeduction.put("thisMonth", 0.0);
entEeduction.put("rate", 0.0);
// 被检查企业
Map<String, Double> enfEnt = new HashMap<>();
resMap.put("enfEnt", enfEnt);
Set<String> entNumSets = new HashSet<String>();
enfEnt.put("count", 0D);
enfEnt.put("yesterday", 0D);
enfEnt.put("thisMonth", 0D);
enfEnt.put("lastMonth", 0D);
enfEnt.put("lastYearMonth", 0D);
enfEnt.put("mom", 0D);
enfEnt.put("yoy", 0D);
// 投诉
Map<String, Double> entComplaint = new HashMap<>();
resMap.put("entComplaint", entComplaint);
entComplaint.put("count", 0D);
entComplaint.put("yesterday", 0D);
entComplaint.put("thisMonth", 0D);
entComplaint.put("lastMonth", 0D);
entComplaint.put("lastYearMonth", 0D);
entComplaint.put("mom", 0D);
entComplaint.put("yoy", 0D);
entComplaint.put("completed", 0D);
entComplaint.put("unCompleted", 0D);
// 所有企业
Map<String, Double> ent = new HashMap<>();
resMap.put("ent", ent);
ent.put("count", 0D);
ent.put("yesterday", 0D);
ent.put("thisMonth", 0D);
entComplaint.put("lastMonth", 0D);
entComplaint.put("lastYearMonth", 0D);
ent.put("mom", 0D);
ent.put("yoy", 0D);
LocalDate today = LocalDate.now();
LocalDate yesterday = today.minusDays(1);
YearMonth thisMonth = YearMonth.now();
YearMonth lastMonth = thisMonth.minusMonths(1);
YearMonth lastYearMonth = thisMonth.minusYears(1);
Set<String> unionNumSets = new HashSet<>();
// 1. 提取所有 unionNo, 并统计出出现次数
Map<String, Long> countMap = allLawRegs.stream().map(EnforcementRegistrationVo::getUnionNo).filter(Objects::nonNull).collect(Collectors.groupingBy(Function.identity(), Collectors.counting()));
// 2. 获取 唯一 uniqueUnionNos 集合 和 重复 duplicateUnionNos 集合
Set<String> uniqueUnionNos = new HashSet<>();
Set<String> duplicateUnionNos = new HashSet<>();
for (Map.Entry<String, Long> entry : countMap.entrySet()) {
if (entry.getValue() == 1) {
// 以为集合
uniqueUnionNos.add(entry.getKey());
} else if (entry.getValue() > 1) {
// 重复集合
duplicateUnionNos.add(entry.getKey());
}
}
for (EnforcementRegistrationVo e : allLawRegs) {
if (e.getEnforcementTime() == null) continue;
LocalDate date = e.getEnforcementTime().toInstant().atZone(ZoneId.systemDefault()).toLocalDate();
// 单独执法
if (e.getUnionNo() == null || e.getUnionNo().isEmpty() || e.getHasUnion() == 0 || uniqueUnionNos.contains(e.getUnionNo())) {
singleLaw.computeIfPresent("count", (k, v) -> v + 1);
if (date.equals(yesterday)) singleLaw.computeIfPresent("yesterday", (k, v) -> v + 1);
if (YearMonth.from(date).equals(thisMonth)) singleLaw.computeIfPresent("thisMonth", (k, v) -> v + 1);
if (YearMonth.from(date).equals(lastYearMonth)) singleLaw.computeIfPresent("lastYearMonth", (k, v) -> v + 1);
if (YearMonth.from(date).equals(lastMonth)) singleLaw.computeIfPresent("lastMonth", (k, v) -> v + 1);
}
// 联合执法
if (e.getUnionNo() != null && !e.getUnionNo().isEmpty() && e.getHasUnion() == 1 && duplicateUnionNos.contains(e.getUnionNo()) && !unionNumSets.contains(e.getUnionNo())) {
unionNumSets.add(e.getUnionNo());
unionLaw.computeIfPresent("count", (k, v) -> v + 1);
if (date.equals(yesterday)) unionLaw.computeIfPresent("yesterday", (k, v) -> v + 1);
if (YearMonth.from(date).equals(thisMonth)) unionLaw.computeIfPresent("thisMonth", (k, v) -> v + 1);
if (YearMonth.from(date).equals(lastYearMonth)) unionLaw.computeIfPresent("lastYearMonth", (k, v) -> v + 1);
if (YearMonth.from(date).equals(lastMonth)) unionLaw.computeIfPresent("lastMonth", (k, v) -> v + 1);
}
// 联合执法总条数(用来算压减率的)
if (e.getUnionNo() != null && !e.getUnionNo().isEmpty() && e.getHasUnion() == 1) {
unionAllNum++;
if (date.equals(yesterday)) unionAll_day++;;
if (YearMonth.from(date).equals(thisMonth)) unionAll_month++;
}
// 被执法企业
if (e.getEnterpriseNumber() != null && !e.getEnterpriseNumber().isEmpty() && !entNumSets.contains(e.getEnterpriseNumber())) {
entNumSets.add(e.getEnterpriseNumber());
enfEnt.computeIfPresent("count", (k, v) -> v + 1);
if (date.equals(yesterday)) enfEnt.computeIfPresent("yesterday", (k, v) -> v + 1);
if (YearMonth.from(date).equals(thisMonth)) enfEnt.computeIfPresent("thisMonth", (k, v) -> v + 1);
if (YearMonth.from(date).equals(lastYearMonth)) enfEnt.computeIfPresent("lastYearMonth", (k, v) -> v + 1);
if (YearMonth.from(date).equals(lastMonth)) enfEnt.computeIfPresent("lastMonth", (k, v) -> v + 1);
}
}
double yoy_rate = 0.0;
double mom_rate = 0.0;
// 单独执法 同比/环比
yoy_rate = (singleLaw.get("thisMonth") - singleLaw.get("lastYearMonth")) / singleLaw.get("lastYearMonth") * 100;
mom_rate = (singleLaw.get("thisMonth") - singleLaw.get("lastMonth")) / singleLaw.get("lastMonth") * 100;
singleLaw.put("yoy", Double.isNaN(yoy_rate)?0:yoy_rate);
singleLaw.put("mom", Double.isNaN(mom_rate)?0:mom_rate);
// 联合执法 同比/环比
yoy_rate = (unionLaw.get("thisMonth") - unionLaw.get("lastYearMonth")) / unionLaw.get("lastYearMonth") * 100;
mom_rate = (unionLaw.get("thisMonth") - unionLaw.get("lastMonth")) / unionLaw.get("lastMonth") * 100;
unionLaw.put("yoy", Double.isNaN(yoy_rate)?0:yoy_rate);
unionLaw.put("mom", Double.isNaN(mom_rate)?0:mom_rate);
// 被执法企业 同比/环比
yoy_rate = (enfEnt.get("thisMonth") - enfEnt.get("lastYearMonth")) / enfEnt.get("lastYearMonth") * 100;
mom_rate = (enfEnt.get("thisMonth") - enfEnt.get("lastMonth")) / enfEnt.get("lastMonth") * 100;
enfEnt.put("yoy", Double.isNaN(yoy_rate)?0:yoy_rate);
enfEnt.put("mom", Double.isNaN(mom_rate)?0:mom_rate);
// 入企压减率 联合执法总数 - 分组数 / 总条数
entEeduction.put("count", Double.valueOf(unionAllNum - duplicateUnionNos.size()));
entEeduction.put("yesterday", Double.valueOf(unionAll_day - unionLaw.get("yesterday")));
entEeduction.put("thisMonth", Double.valueOf(unionAll_month - unionLaw.get("thisMonth")));
double rate = (double)(unionAllNum - duplicateUnionNos.size()) / allLawRegs.size() * 100;
entEeduction.put("rate", Double.isNaN(rate)?0:rate);
// 涉企投诉量
// List<EnterpriseComplaint> complaints = statisticalPanelCityMapper.query_complaint_all(params);
// 权限要单独写
List<EnterpriseComplaintVo> complaints = this.queryComplaintAll(params);
entComplaint.put("count", Double.valueOf(complaints.size()));
for (EnterpriseComplaintVo c : complaints) {
if (c.getEnforcementTime() == null) continue;
LocalDate date = c.getCreateTime().toInstant().atZone(ZoneId.systemDefault()).toLocalDate();
// entComplaint.computeIfPresent("count", (k, v) -> v + 1);
if (date.equals(yesterday)) entComplaint.computeIfPresent("yesterday", (k, v) -> v + 1);
if (YearMonth.from(date).equals(thisMonth)) entComplaint.computeIfPresent("thisMonth", (k, v) -> v + 1);
if (YearMonth.from(date).equals(lastYearMonth)) entComplaint.computeIfPresent("lastYearMonth", (k, v) -> v + 1);
if (YearMonth.from(date).equals(lastMonth)) entComplaint.computeIfPresent("lastMonth", (k, v) -> v + 1);
// 已办结
if (null == c.getStatus() || 2 == c.getStatus()) entComplaint.computeIfPresent("completed", (k, v) -> v + 1);
}
// 未办结
entComplaint.put("unCompleted", complaints.size() - entComplaint.get("completed"));
// 企业数量
// 所有企业(去重)
params.setFmtDate(null);
long ent_count = this.queryEntCount(params);
ent.put("count", Double.valueOf(ent_count));
// 所有企业-昨日(去重)
params.setBeginTime(yesterday.toString());
params.setEndTime(today.toString());
long ent_yesterday = this.queryEntCount(params);
ent.put("yesterday", Double.valueOf(ent_yesterday));
// 所有企业-本月(去重)
params.setBeginTime(thisMonth.toString()+"-01");
params.setEndTime(null);
long ent_thisMonth = this.queryEntCount(params);
ent.put("thisMonth", Double.valueOf(ent_thisMonth));
// 行政执法类别及占比
SysDictDataBo dictParam1s = new SysDictDataBo();
dictParam1s.setDictType("law_enforce_category");
List<SysDictDataVo> categoryDicts = sysDictDataService.selectDictDataList(dictParam1s);
params.setBeginTime(begin_tiem);
params.setEndTime(end_tiem);
List<Map<String, String>> categorys = this.queryCategoryCount(params);
List<Map<String, String>> res_categorys = new ArrayList<>();
long total_category = 0;
for (SysDictDataVo dict : categoryDicts) {
Map<String, String> res_category = new HashMap<>();
res_category.put(dict.getDictLabel(), "0");
for (Map<String, String> category : categorys) {
String key = category.get("law_enforce_category");
String val = category.get("cnt");
if (dict.getDictValue().equals(key)) {
res_category.put(dict.getDictLabel(), val);
total_category += Double.parseDouble(val);
break;
}
}
res_categorys.add(res_category);
}
resMap.put("lawCategory", res_categorys);
resMap.put("lawCategoryTotal", total_category);
// 重点领域类别及占比
SysDictDataBo dictParam2s = new SysDictDataBo();
dictParam2s.setDictType("law_field");
List<SysDictDataVo> lawFieldDicts = sysDictDataService.selectDictDataList(dictParam2s);
params.setBeginTime(begin_tiem);
params.setEndTime(end_tiem);
List<Map<String, String>> lawFields = this.queryLawFieldCount(params);
List<Map<String, String>> res_lawFields = new ArrayList<>();
long total_lawField = 0;
for (SysDictDataVo dict : lawFieldDicts) {
Map<String, String> res_lawField = new HashMap<>();
res_lawField.put(dict.getDictLabel(), "0");
for (Map<String, String> lawField : lawFields) {
String key = lawField.get("law_field");
String val = lawField.get("cnt");
if (dict.getDictValue().equals(key)) {
res_lawField.put(dict.getDictLabel(), val);
total_lawField += Double.parseDouble(val);
break;
}
}
res_lawFields.add(res_lawField);
}
resMap.put("lawField", res_lawFields);
resMap.put("lawFieldTotal", total_lawField);
// 行政执法投诉类别及占比
SysDictDataBo dictParam3s = new SysDictDataBo();
dictParam3s.setDictType("caseType");
List<SysDictDataVo> caseTypeDicts = sysDictDataService.selectDictDataList(dictParam3s);
params.setBeginTime(begin_tiem);
params.setEndTime(end_tiem);
// 权限要单独写
List<Map<String, String>> caseTypes = this.queryEnforceTypeCount(params);
List<Map<String, String>> res_caseTypes = new ArrayList<>();
long total_caseType = 0;
for (SysDictDataVo dict : caseTypeDicts) {
Map<String, String> res_caseType = new HashMap<>();
res_caseType.put(dict.getDictLabel(), "0");
for (Map<String, String> caseType : caseTypes) {
String key = caseType.get("enforce_type");
String val = caseType.get("cnt");
if (dict.getDictValue().equals(key)) {
res_caseType.put(dict.getDictLabel(), val);
total_caseType += Double.parseDouble(val);
break;
}
}
res_caseTypes.add(res_caseType);
}
resMap.put("caseType", res_caseTypes);
resMap.put("totalCaseType", total_caseType);
// 评价
Map<String, Long> evaMap = new HashMap<>();
evaMap.put("high", 0L);
evaMap.put("mid", 0L);
evaMap.put("low", 0L);
List<EnterpriseEvaluateVo> allEvaluates = this.queryEvaluateAll(params);
for (EnterpriseEvaluateVo eva : allEvaluates) {
if (null != eva.getSatisfactionLevel() && 1 == eva.getSatisfactionLevel()) { evaMap.computeIfPresent("low", (k, v) -> v + 1); continue; }
if (null != eva.getSatisfactionLevel() && 2 == eva.getSatisfactionLevel()) { evaMap.computeIfPresent("mid", (k, v) -> v + 1); continue; }
if (null != eva.getSatisfactionLevel() && 3 == eva.getSatisfactionLevel()) { evaMap.computeIfPresent("high", (k, v) -> v + 1); continue; }
}
evaMap.put("un", allEvaluates.size() - (evaMap.get("low")+evaMap.get("mid")+evaMap.get("high")));
resMap.put("eva", evaMap);
return resMap;
}
/** 排序 */
// 被执法企业次数排行
@Override
@DataScope(deptAlias = "r",userAlias = "r",deptField = "bureau_dept_id")
public List<Map<String, String>> queryEnfEntSort(SixAnalysisParamsBo params) {
return statisticalPanelCityMapper.query_enfEnt_sort(params);
}
// 执法单位执法数量排行
@Override
@DataScope(deptAlias = "r",userAlias = "r",deptField = "bureau_dept_id")
public List<Map<String, String>> queryEnforcementSort(SixAnalysisParamsBo params) {
// 获取所有当前选中部门下的所有部门id
List<String> deptIds = new ArrayList<>();
if (StringUtils.isNotEmpty(params.getBureauDeptId())) {
deptIds = statisticalPanelCityMapper.queryDeptAllByBureauDeptId(params.getBureauDeptId());
}
if (deptIds.size() > 0) {
params.setFilterDepts(deptIds);
List<String> unionNos = statisticalPanelCityMapper.queryDuplicateUnionNosByUnion(params);
List<Map<String, String>> result = new ArrayList<>();
if (unionNos.size() > 0) {
List<Map<String, String>> bureauDepts = statisticalPanelCityMapper.queryBureauDeptByUnion(unionNos);
// 按 bureau_dept_id 分组统计数量
result = bureauDepts.stream().collect(Collectors.groupingBy(m -> (String) m.get("law_enforcement_id"),Collectors.counting())).entrySet().stream().sorted(Map.Entry.<String, Long>comparingByValue().reversed()).map(e -> {
// 找到同组的一个名称
String name = bureauDepts.stream().filter(m -> e.getKey().equals(m.get("law_enforcement_id"))).findFirst().map(m -> (String) m.get("law_enforcement")).orElse(null);
Map<String, String> r = new HashMap<>();
r.put("bureau_dept_name", name);
r.put("cnt", e.getValue().toString());
return r;
}).limit(params.getPageSize()).collect(Collectors.toList());
}
return result;
}
return statisticalPanelCityMapper.query_enforcement_sort(params);
}
// 被投诉单位次数排行
@Override
@DataScope(deptAlias = "r",userAlias = "r",deptField = "bureau_dept_id")
public List<Map<String, String>> queryEntCSort(SixAnalysisParamsBo params) {
return statisticalPanelCityMapper.query_entC_sort(params);
}
// 委托执法数量及占比
@Override
@DataScope(deptAlias = "r",userAlias = "r",deptField = "bureau_dept_id")
public Map<String, Long> queryAutoRate(SixAnalysisParamsBo params) {
// 获取所有当前选中部门下的所有部门id
List<String> deptIds = new ArrayList<>();
if (StringUtils.isNotEmpty(params.getBureauDeptId())) {
deptIds = statisticalPanelCityMapper.queryDeptAllByBureauDeptId(params.getBureauDeptId());
}
if (deptIds.size() > 0) params.setFilterDepts(deptIds);
long total = statisticalPanelCityMapper.query_auto_rate(params);
params.setHasAuto(1);
long autoCnt = statisticalPanelCityMapper.query_auto_rate(params);
Map<String, Long> resMap = new HashMap<>();
resMap.put("total", total);
resMap.put("autoCnt", autoCnt);
resMap.put("unAutoCnt", total - autoCnt);
return resMap;
}
@Override
public List<EnforcementRegistrationVo> queryLawAll(SixAnalysisParamsBo params) {
return statisticalPanelCityMapper.query_law_all(params);
}
@Override
public List<EnterpriseComplaintVo> queryComplaintAll(SixAnalysisParamsBo params) {
return statisticalPanelCityMapper.query_complaint_all(params);
}
public long queryEntCount(SixAnalysisParamsBo params) {
return statisticalPanelCityMapper.query_ent_count(params);
}
@Override
public List<Map<String, String>> queryCategoryCount(SixAnalysisParamsBo params) {
return statisticalPanelCityMapper.query_category_count(params);
}
@Override
public List<Map<String, String>> queryLawFieldCount(SixAnalysisParamsBo params) {
return statisticalPanelCityMapper.query_law_field_count(params);
}
@Override
public List<Map<String, String>> queryEnforceTypeCount(SixAnalysisParamsBo params) {
return statisticalPanelCityMapper.query_enforce_type_count(params);
}
@Override
public List<EnterpriseEvaluateVo> queryEvaluateAll(SixAnalysisParamsBo params) {
return statisticalPanelCityMapper.query_evaluate_all(params);
}
}

553
zdxt-modules/zdxt-enforcement-code/src/main/java/com/zdxt/enforcementcode/service/impl/StatisticalPaneServiceDistrictImpl.java

@ -0,0 +1,553 @@
package com.zdxt.enforcementcode.service.impl;
import com.zdxt.enforcementcode.common.annotation.DataScope;
import com.zdxt.enforcementcode.domain.EnforcementRegistration;
import com.zdxt.enforcementcode.domain.EnterpriseComplaint;
import com.zdxt.enforcementcode.domain.bo.SixAnalysisParamsBo;
import com.zdxt.enforcementcode.domain.vo.EnforcementRegistrationVo;
import com.zdxt.enforcementcode.domain.vo.EnterpriseComplaintVo;
import com.zdxt.enforcementcode.domain.vo.EnterpriseEvaluateVo;
import com.zdxt.enforcementcode.mapper.StatisticalPanelDistrictMapper;
import com.zdxt.enforcementcode.service.IStatisticalPaneDistrictService;
import org.dromara.common.core.utils.StringUtils;
import org.dromara.system.domain.bo.SysDictDataBo;
import org.dromara.system.domain.vo.SysDictDataVo;
import org.dromara.system.service.ISysDeptService;
import org.dromara.system.service.ISysDictDataService;
import org.dromara.system.service.ISysUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.time.LocalDate;
import java.time.YearMonth;
import java.time.ZoneId;
import java.util.*;
import java.util.function.Function;
import java.util.stream.Collectors;
/**
* 年度:year!==null,quarter==null,month==null
* 季度:year!==null,quarter!==null,month==null
* 月度:year!==null,quarter!==null,month!==null
*/
@Service
public class StatisticalPaneServiceDistrictImpl implements IStatisticalPaneDistrictService {
@Autowired private StatisticalPanelDistrictMapper statisticalPanelDistrictMapper;
@Autowired private ISysDictDataService sysDictDataService;
@Autowired private ISysUserService sysUserService;
@Autowired private ISysDeptService sysDeptService;
@Override
@DataScope(deptAlias = "r",userAlias = "r",deptField = "bureau_dept_id")
public Map<String, Object> collectStatistics(SixAnalysisParamsBo params) {
Map<String, Object> resMap = new HashMap<String, Object>();
String begin_tiem = params.getBeginTime();
String end_tiem = params.getEndTime();
// // 判断是不是司法局的人
// resMap.put("hasAll", 0);
// UserBean ub = userApi.getCurrentUser();
// DeptBean deptBean = deptApi.getDeptById(ub.getDeptId());
// if (java.util.Objects.toString(deptBean.getZzDisplayPath(), "").contains("深圳市司法局")) {
// // 市司法局
// resMap.put("roleFlag", 99);
// resMap.put("roleDept", deptBean.getDeptName());
// } else if (java.util.Objects.toString(deptBean.getZzDisplayPath(), "").contains("司法局")) {
// // 区司法局
// resMap.put("roleFlag", 9);
// String deptName = deptBean.getDeptName().replace("深圳市","").replace("司法局","");
// resMap.put("roleDept", deptName);
// } else {
// deptBean = deptApi.iterationDeptParentToBureau(ub.getDeptId());
// if (4 == deptBean.getZone()) {
// // 街道
// resMap.put("roleFlag", 4);
// resMap.put("roleDept", deptBean.getDeptName());
// } else if (3 == deptBean.getZone()) {
// // 区直
// resMap.put("roleFlag", 3);
// resMap.put("roleDept", deptBean.getDeptName());
// } else if (1 == deptBean.getZone()) {
// // 市值
// resMap.put("roleFlag", 1);
// resMap.put("roleDept", deptBean.getDeptName());
// }
// // 迭代判断是否是区直
// }
// 获取所有当前选中部门下的所有部门id
List<String> deptIds = new ArrayList<>();
if (StringUtils.isNotEmpty(params.getBureauDeptId())) {
deptIds = statisticalPanelDistrictMapper.queryDeptAllByBureauDeptId(params.getBureauDeptId());
}
if (deptIds.size() > 0) params.setFilterDepts(deptIds);
List<EnforcementRegistrationVo> allLawRegs = this.queryLawAll(params);
Map<String, Double> singleLaw = new HashMap<>();
resMap.put("singleLaw", singleLaw);
// 单独执法
singleLaw.put("count", 0D);
singleLaw.put("yesterday", 0D);
singleLaw.put("thisMonth", 0D);
singleLaw.put("lastMonth", 0D);
singleLaw.put("lastYearMonth", 0D);
singleLaw.put("mom", 0D);
singleLaw.put("yoy", 0D);
// 联合执法
Map<String, Double> unionLaw = new HashMap<>();
resMap.put("unionLaw", unionLaw);
long unionAllNum = 0L;
long unionAll_day = 0L;
long unionAll_month = 0L;
unionLaw.put("count", 0D);
unionLaw.put("yesterday", 0D);
unionLaw.put("thisMonth", 0D);
unionLaw.put("lastMonth", 0D);
unionLaw.put("lastYearMonth", 0D);
unionLaw.put("mom", 0D);
unionLaw.put("yoy", 0D);
// 入企压减率
Map<String, Double> entEeduction = new HashMap<>();
resMap.put("entEeduction", entEeduction);
entEeduction.put("count", 0.0);
entEeduction.put("yesterday", 0.0);
entEeduction.put("thisMonth", 0.0);
entEeduction.put("rate", 0.0);
// 被检查企业
Map<String, Double> enfEnt = new HashMap<>();
resMap.put("enfEnt", enfEnt);
Set<String> entNumSets = new HashSet<String>();
enfEnt.put("count", 0D);
enfEnt.put("yesterday", 0D);
enfEnt.put("thisMonth", 0D);
enfEnt.put("lastMonth", 0D);
enfEnt.put("lastYearMonth", 0D);
enfEnt.put("mom", 0D);
enfEnt.put("yoy", 0D);
// 投诉
Map<String, Double> entComplaint = new HashMap<>();
resMap.put("entComplaint", entComplaint);
entComplaint.put("count", 0D);
entComplaint.put("yesterday", 0D);
entComplaint.put("thisMonth", 0D);
entComplaint.put("lastMonth", 0D);
entComplaint.put("lastYearMonth", 0D);
entComplaint.put("mom", 0D);
entComplaint.put("yoy", 0D);
entComplaint.put("completed", 0D);
entComplaint.put("unCompleted", 0D);
// 所有企业
Map<String, Double> ent = new HashMap<>();
resMap.put("ent", ent);
ent.put("count", 0D);
ent.put("yesterday", 0D);
ent.put("thisMonth", 0D);
entComplaint.put("lastMonth", 0D);
entComplaint.put("lastYearMonth", 0D);
ent.put("mom", 0D);
ent.put("yoy", 0D);
// 执法投诉
Map<String, Double> law_comp = new HashMap<>();
resMap.put("law_comp", law_comp);
law_comp.put("count", 0D);
law_comp.put("yesterday", 0D);
law_comp.put("thisMonth", 0D);
law_comp.put("lastMonth", 0D);
law_comp.put("lastYearMonth", 0D);
law_comp.put("completed", 0D); // 已办结
law_comp.put("mom", 0D);
law_comp.put("yoy", 0D);
List<String> districtList = Arrays.asList("罗湖", "福田", "盐田", "南山", "宝安", "龙岗", "龙华", "坪山", "光明", "大鹏", "深汕");
Map<String, Map<String, Integer>> districtMap = new HashMap<>();
LocalDate today = LocalDate.now();
LocalDate yesterday = today.minusDays(1);
YearMonth thisMonth = YearMonth.now();
YearMonth lastMonth = thisMonth.minusMonths(1);
YearMonth lastYearMonth = thisMonth.minusYears(1);
Set<String> unionNumSets = new HashSet<>();
// 1. 提取所有 unionNo, 并统计出出现次数
Map<String, Long> countMap = allLawRegs.stream().map(EnforcementRegistrationVo::getUnionNo).filter(Objects::nonNull).collect(Collectors.groupingBy(Function.identity(), Collectors.counting()));
// 2. 获取 唯一 uniqueUnionNos 集合 和 重复 duplicateUnionNos 集合
Set<String> uniqueUnionNos = new HashSet<>();
Set<String> duplicateUnionNos = new HashSet<>();
for (Map.Entry<String, Long> entry : countMap.entrySet()) {
if (entry.getValue() == 1) {
// 以为集合
uniqueUnionNos.add(entry.getKey());
} else if (entry.getValue() > 1) {
// 重复集合
duplicateUnionNos.add(entry.getKey());
}
}
for (EnforcementRegistrationVo e : allLawRegs) {
if (e.getEnforcementTime() == null) continue;
// 1. 自动匹配区名
String dist = Optional.ofNullable(e.getDistrict()).map(String::trim).orElse(""); // 处理为null的情况
String matchedDistrict = districtList.stream().filter(dist::contains).findFirst().orElse("其他"); // 不匹配时归类为 "其他"
// 如果第一次出现“其他”,要初始化一个 map
districtMap.putIfAbsent(matchedDistrict, new HashMap<>());
LocalDate date = e.getEnforcementTime().toInstant().atZone(ZoneId.systemDefault()).toLocalDate();
// 单独执法
if (e.getUnionNo() == null || e.getUnionNo().isEmpty() || e.getHasUnion() == 0 || uniqueUnionNos.contains(e.getUnionNo())) {
singleLaw.computeIfPresent("count", (k, v) -> v + 1);
if (date.equals(yesterday)) singleLaw.computeIfPresent("yesterday", (k, v) -> v + 1);
if (YearMonth.from(date).equals(thisMonth)) singleLaw.computeIfPresent("thisMonth", (k, v) -> v + 1);
if (YearMonth.from(date).equals(lastYearMonth)) singleLaw.computeIfPresent("lastYearMonth", (k, v) -> v + 1);
if (YearMonth.from(date).equals(lastMonth)) singleLaw.computeIfPresent("lastMonth", (k, v) -> v + 1);
Map<String, Integer> subMap = districtMap.get(matchedDistrict);
subMap.merge("singleLaw", 1, Integer::sum);
}
// 联合执法
if (e.getUnionNo() != null && !e.getUnionNo().isEmpty() && e.getHasUnion() == 1 && duplicateUnionNos.contains(e.getUnionNo()) && !unionNumSets.contains(e.getUnionNo())) {
unionNumSets.add(e.getUnionNo());
unionLaw.computeIfPresent("count", (k, v) -> v + 1);
if (date.equals(yesterday)) unionLaw.computeIfPresent("yesterday", (k, v) -> v + 1);
if (YearMonth.from(date).equals(thisMonth)) unionLaw.computeIfPresent("thisMonth", (k, v) -> v + 1);
if (YearMonth.from(date).equals(lastYearMonth)) unionLaw.computeIfPresent("lastYearMonth", (k, v) -> v + 1);
if (YearMonth.from(date).equals(lastMonth)) unionLaw.computeIfPresent("lastMonth", (k, v) -> v + 1);
Map<String, Integer> subMap = districtMap.get(matchedDistrict);
subMap.merge("unionLaw", 1, Integer::sum);
}
// 联合执法总条数(用来算压减率的)
if (e.getUnionNo() != null && !e.getUnionNo().isEmpty() && e.getHasUnion() == 1) {
unionAllNum++;
if (date.equals(yesterday)) unionAll_day++;;
if (YearMonth.from(date).equals(thisMonth)) unionAll_month++;
Map<String, Integer> subMap = districtMap.get(matchedDistrict);
subMap.merge("unionAllNum", 1, Integer::sum);
}
// 被执法企业
if (e.getEnterpriseNumber() != null && !e.getEnterpriseNumber().isEmpty() && !entNumSets.contains(e.getEnterpriseNumber())) {
entNumSets.add(e.getEnterpriseNumber());
enfEnt.computeIfPresent("count", (k, v) -> v + 1);
if (date.equals(yesterday)) enfEnt.computeIfPresent("yesterday", (k, v) -> v + 1);
if (YearMonth.from(date).equals(thisMonth)) enfEnt.computeIfPresent("thisMonth", (k, v) -> v + 1);
if (YearMonth.from(date).equals(lastYearMonth)) enfEnt.computeIfPresent("lastYearMonth", (k, v) -> v + 1);
if (YearMonth.from(date).equals(lastMonth)) enfEnt.computeIfPresent("lastMonth", (k, v) -> v + 1);
Map<String, Integer> subMap = districtMap.get(matchedDistrict);
subMap.merge("enfEnt", 1, Integer::sum);
}
}
double yoy_rate = 0.0;
double mom_rate = 0.0;
// 单独执法 同比/环比
yoy_rate = (singleLaw.get("thisMonth") - singleLaw.get("lastYearMonth")) / singleLaw.get("lastYearMonth") * 100;
mom_rate = (singleLaw.get("thisMonth") - singleLaw.get("lastMonth")) / singleLaw.get("lastMonth") * 100;
singleLaw.put("yoy", Double.isNaN(yoy_rate) || Double.isInfinite(yoy_rate)?0:yoy_rate);
singleLaw.put("mom", Double.isNaN(mom_rate) || Double.isInfinite(mom_rate)?0:mom_rate);
// 联合执法 同比/环比
yoy_rate = (unionLaw.get("thisMonth") - unionLaw.get("lastYearMonth")) / unionLaw.get("lastYearMonth") * 100;
mom_rate = (unionLaw.get("thisMonth") - unionLaw.get("lastMonth")) / unionLaw.get("lastMonth") * 100;
unionLaw.put("yoy", Double.isNaN(yoy_rate) || Double.isInfinite(yoy_rate)?0:yoy_rate);
unionLaw.put("mom", Double.isNaN(mom_rate) || Double.isInfinite(mom_rate)?0:mom_rate);
// 被执法企业 同比/环比
yoy_rate = (enfEnt.get("thisMonth") - enfEnt.get("lastYearMonth")) / enfEnt.get("lastYearMonth") * 100;
mom_rate = (enfEnt.get("thisMonth") - enfEnt.get("lastMonth")) / enfEnt.get("lastMonth") * 100;
enfEnt.put("yoy", Double.isNaN(yoy_rate) || Double.isInfinite(yoy_rate)?0:yoy_rate);
enfEnt.put("mom", Double.isNaN(mom_rate) || Double.isInfinite(mom_rate)?0:mom_rate);
// 入企压减率 联合执法总数 - 分组数 / 总条数
entEeduction.put("count", Double.valueOf(unionAllNum - duplicateUnionNos.size()));
entEeduction.put("yesterday", Double.valueOf(unionAll_day - unionLaw.get("yesterday")));
entEeduction.put("thisMonth", Double.valueOf(unionAll_month - unionLaw.get("thisMonth")));
double rate = (double)(unionAllNum - duplicateUnionNos.size()) / allLawRegs.size() * 100;
entEeduction.put("rate", Double.isNaN(rate) || Double.isInfinite(rate)?0:rate);
districtMap.forEach((district, subMap) -> {
// 防御性:子 map 为空直接跳过
if (subMap == null) return;
// 取出 singleLaw 和 unionLaw,缺失就按 0 处理
int unionAllNum_tmp = subMap.getOrDefault("unionAllNum", 0);
int unionLawa_tmp = subMap.getOrDefault("unionLaw", 0);
// 计算差值
int entEeduction_tmp = unionAllNum_tmp - unionLawa_tmp;
// 写回子 map
subMap.put("entEeduction", entEeduction_tmp);
});
// 涉企投诉量
// List<EnterpriseComplaint> complaints = statisticalPanelDistrictMapper.query_complaint_all(params);
// 权限要单独写
List<EnterpriseComplaintVo> complaints = this.queryComplaintAll(params);
entComplaint.put("count", Double.valueOf(complaints.size()));
for (EnterpriseComplaintVo c : complaints) {
if (c.getEnforcementTime() == null) continue;
LocalDate date = c.getCreateTime().toInstant().atZone(ZoneId.systemDefault()).toLocalDate();
// entComplaint.computeIfPresent("count", (k, v) -> v + 1);
if (date.equals(yesterday)) entComplaint.computeIfPresent("yesterday", (k, v) -> v + 1);
if (YearMonth.from(date).equals(thisMonth)) entComplaint.computeIfPresent("thisMonth", (k, v) -> v + 1);
if (YearMonth.from(date).equals(lastYearMonth)) entComplaint.computeIfPresent("lastYearMonth", (k, v) -> v + 1);
if (YearMonth.from(date).equals(lastMonth)) entComplaint.computeIfPresent("lastMonth", (k, v) -> v + 1);
// 已办结
if (null == c.getStatus() || 2 == c.getStatus()) entComplaint.computeIfPresent("completed", (k, v) -> v + 1);
if (null == c.getRecordType() || c.getRecordType() == 0) {
LocalDate law_date = c.getCreateTime().toInstant().atZone(ZoneId.systemDefault()).toLocalDate();
law_comp.computeIfPresent("count", (k, v) -> v + 1);
// 同比/环比
if (YearMonth.from(law_date).equals(thisMonth)) law_comp.computeIfPresent("thisMonth", (k, v) -> v + 1);
if (YearMonth.from(law_date).equals(lastYearMonth)) law_comp.computeIfPresent("lastYearMonth", (k, v) -> v + 1);
if (YearMonth.from(law_date).equals(lastMonth)) law_comp.computeIfPresent("lastMonth", (k, v) -> v + 1);
yoy_rate = (law_comp.get("thisMonth") - law_comp.get("lastYearMonth")) / law_comp.get("lastYearMonth") * 100;
mom_rate = (law_comp.get("thisMonth") - law_comp.get("lastMonth")) / law_comp.get("lastMonth") * 100;
law_comp.put("yoy", Double.isNaN(yoy_rate) || Double.isInfinite(yoy_rate)?0:yoy_rate);
law_comp.put("mom", Double.isNaN(mom_rate) || Double.isInfinite(mom_rate)?0:mom_rate);
if (null == c.getStatus() || 2 == c.getStatus()) law_comp.computeIfPresent("completed", (k, v) -> v + 1);
}
// 1. 自动匹配区名
String dist = Optional.ofNullable(c.getEnterpriseAddress()).map(String::trim).orElse(""); // 处理为null的情况
String matchedDistrict = districtList.stream().filter(dist::contains).findFirst().orElse("其他"); // 不匹配时归类为 "其他"
// 如果第一次出现“其他”,要初始化一个 map
districtMap.putIfAbsent(matchedDistrict, new HashMap<>());
Map<String, Integer> subMap = districtMap.get(matchedDistrict);
subMap.merge("compAddress", 1, Integer::sum);
}
// 未办结
entComplaint.put("unCompleted", complaints.size() - entComplaint.get("completed"));
// 企业数量
// 所有企业(去重)
params.setFmtDate(null);
// long ent_count = this.queryEntCount(params);
List<String> ent_address = this.queryEntAddress(params);
for(String address : ent_address){
// 1. 自动匹配区名
String dist = Optional.ofNullable(address).map(String::trim).orElse(""); // 处理为null的情况
String matchedDistrict = districtList.stream().filter(dist::contains).findFirst().orElse("其他"); // 不匹配时归类为 "其他"
// 如果第一次出现“其他”,要初始化一个 map
districtMap.putIfAbsent(matchedDistrict, new HashMap<>());
Map<String, Integer> subMap = districtMap.get(matchedDistrict);
subMap.merge("entAddress", 1, Integer::sum);
}
long ent_count = ent_address.size();
ent.put("count", Double.valueOf(ent_count));
// 所有企业-昨日(去重)
params.setBeginTime(yesterday.toString());
params.setEndTime(today.toString());
long ent_yesterday = this.queryEntCount(params);
ent.put("yesterday", Double.valueOf(ent_yesterday));
// 所有企业-本月(去重)
params.setBeginTime(thisMonth.toString()+"-01");
params.setEndTime(null);
long ent_thisMonth = this.queryEntCount(params);
ent.put("thisMonth", Double.valueOf(ent_thisMonth));
// 行政执法类别及占比
SysDictDataBo dictParam1s = new SysDictDataBo();
dictParam1s.setDictType("law_enforce_category");
List<SysDictDataVo> categoryDicts = sysDictDataService.selectDictDataList(dictParam1s);
params.setBeginTime(begin_tiem);
params.setEndTime(end_tiem);
List<Map<String, String>> categorys = this.queryCategoryCount(params);
List<Map<String, String>> res_categorys = new ArrayList<>();
long total_category = 0;
for (SysDictDataVo dict : categoryDicts) {
Map<String, String> res_category = new HashMap<>();
res_category.put(dict.getDictLabel(), "0");
for (Map<String, String> category : categorys) {
String key = category.get("law_enforce_category");
String val = category.get("cnt");
if (dict.getDictValue().equals(key)) {
res_category.put(dict.getDictLabel(), val);
total_category += Double.parseDouble(val);
break;
}
}
res_categorys.add(res_category);
}
resMap.put("lawCategory", res_categorys);
resMap.put("lawCategoryTotal", total_category);
// 重点领域类别及占比
SysDictDataBo dictParam2s = new SysDictDataBo();
dictParam2s.setDictType("law_field");
List<SysDictDataVo> lawFieldDicts = sysDictDataService.selectDictDataList(dictParam2s);
params.setBeginTime(begin_tiem);
params.setEndTime(end_tiem);
List<Map<String, String>> lawFields = this.queryLawFieldCount(params);
List<Map<String, String>> res_lawFields = new ArrayList<>();
long total_lawField = 0;
for (SysDictDataVo dict : lawFieldDicts) {
Map<String, String> res_lawField = new HashMap<>();
res_lawField.put(dict.getDictLabel(), "0");
for (Map<String, String> lawField : lawFields) {
String key = lawField.get("law_field");
String val = lawField.get("cnt");
if (dict.getDictValue().equals(key)) {
res_lawField.put(dict.getDictLabel(), val);
total_lawField += Double.parseDouble(val);
break;
}
}
res_lawFields.add(res_lawField);
}
resMap.put("lawField", res_lawFields);
resMap.put("lawFieldTotal", total_lawField);
// 行政执法投诉类别及占比
SysDictDataBo dictParam3s = new SysDictDataBo();
dictParam3s.setDictType("caseType");
List<SysDictDataVo> caseTypeDicts = sysDictDataService.selectDictDataList(dictParam3s);
params.setBeginTime(begin_tiem);
params.setEndTime(end_tiem);
// 权限要单独写
List<Map<String, String>> caseTypes = this.queryEnforceTypeCount(params);
List<Map<String, String>> res_caseTypes = new ArrayList<>();
long total_caseType = 0;
for (SysDictDataVo dict : caseTypeDicts) {
Map<String, String> res_caseType = new HashMap<>();
res_caseType.put(dict.getDictLabel(), "0");
for (Map<String, String> caseType : caseTypes) {
String key = caseType.get("enforce_type");
String val = caseType.get("cnt");
if (dict.getDictValue().equals(key)) {
res_caseType.put(dict.getDictLabel(), val);
total_caseType += Double.parseDouble(val);
break;
}
}
res_caseTypes.add(res_caseType);
}
resMap.put("caseType", res_caseTypes);
resMap.put("totalCaseType", total_caseType);
// 评价
Map<String, Long> evaMap = new HashMap<>();
evaMap.put("high", 0L); // 满意
evaMap.put("mid", 0L); // 较满意
evaMap.put("low", 0L); // 不满意
evaMap.put("def", 0L); // 未评价
List<EnterpriseEvaluateVo> allEvaluates = this.queryEvaluateAll(params);
for (EnterpriseEvaluateVo eva : allEvaluates) {
if (null != eva.getSatisfactionLevel() && 1 == eva.getSatisfactionLevel()) {
evaMap.computeIfPresent("low", (k, v) -> v + 1); continue;
} else if (null != eva.getSatisfactionLevel() && 2 == eva.getSatisfactionLevel()) {
evaMap.computeIfPresent("mid", (k, v) -> v + 1); continue;
} else if (null != eva.getSatisfactionLevel() && 3 == eva.getSatisfactionLevel()) {
evaMap.computeIfPresent("high", (k, v) -> v + 1); continue;
} else {
evaMap.computeIfPresent("def", (k, v) -> v + 1); continue;
}
}
evaMap.put("un", allEvaluates.size() - (evaMap.get("low")+evaMap.get("mid")+evaMap.get("high")));
resMap.put("eva", evaMap);
resMap.put("district", districtMap);
return resMap;
}
/** 排序 */
// 被执法企业次数排行
@Override
@DataScope(deptAlias = "r",userAlias = "r",deptField = "bureau_dept_id")
public List<Map<String, String>> queryEnfEntSort(SixAnalysisParamsBo params) {
return statisticalPanelDistrictMapper.query_enfEnt_sort(params);
}
// 执法单位执法数量排行
@Override
@DataScope(deptAlias = "r",userAlias = "r",deptField = "bureau_dept_id")
public List<Map<String, String>> queryEnforcementSort(SixAnalysisParamsBo params) {
// 获取所有当前选中部门下的所有部门id
List<String> deptIds = new ArrayList<>();
if (StringUtils.isNotEmpty(params.getBureauDeptId())) {
deptIds = statisticalPanelDistrictMapper.queryDeptAllByBureauDeptId(params.getBureauDeptId());
}
if (deptIds.size() > 0) {
params.setFilterDepts(deptIds);
List<String> unionNos = statisticalPanelDistrictMapper.queryDuplicateUnionNosByUnion(params);
List<Map<String, String>> result = new ArrayList<>();
if (unionNos.size() > 0) {
List<Map<String, String>> bureauDepts = statisticalPanelDistrictMapper.queryBureauDeptByUnion(unionNos);
// 按 bureau_dept_id 分组统计数量
result = bureauDepts.stream().collect(Collectors.groupingBy(m -> (String) m.get("law_enforcement_id"),Collectors.counting())).entrySet().stream().sorted(Map.Entry.<String, Long>comparingByValue().reversed()).map(e -> {
// 找到同组的一个名称
String name = bureauDepts.stream().filter(m -> e.getKey().equals(m.get("law_enforcement_id"))).findFirst().map(m -> (String) m.get("law_enforcement")).orElse(null);
Map<String, String> r = new HashMap<>();
r.put("bureau_dept_name", name);
r.put("cnt", e.getValue().toString());
return r;
}).limit(params.getPageSize()).collect(Collectors.toList());
}
return result;
}
return statisticalPanelDistrictMapper.query_enforcement_sort(params);
}
// 被投诉单位次数排行
@Override
@DataScope(deptAlias = "r",userAlias = "r",deptField = "bureau_dept_id")
public List<Map<String, String>> queryEntCSort(SixAnalysisParamsBo params) {
return statisticalPanelDistrictMapper.query_entC_sort(params);
}
// 委托执法数量及占比
@Override
@DataScope(deptAlias = "r",userAlias = "r",deptField = "bureau_dept_id")
public Map<String, Long> queryAutoRate(SixAnalysisParamsBo params) {
// 获取所有当前选中部门下的所有部门id
List<String> deptIds = new ArrayList<>();
if (StringUtils.isNotEmpty(params.getBureauDeptId())) {
deptIds = statisticalPanelDistrictMapper.queryDeptAllByBureauDeptId(params.getBureauDeptId());
}
if (deptIds.size() > 0) params.setFilterDepts(deptIds);
long total = statisticalPanelDistrictMapper.query_auto_rate(params);
params.setHasAuto(1);
long autoCnt = statisticalPanelDistrictMapper.query_auto_rate(params);
Map<String, Long> resMap = new HashMap<>();
resMap.put("total", total);
resMap.put("autoCnt", autoCnt);
resMap.put("unAutoCnt", total - autoCnt);
return resMap;
}
@Override
public List<EnforcementRegistrationVo> queryLawAll(SixAnalysisParamsBo params) {
return statisticalPanelDistrictMapper.query_law_all(params);
}
@Override
public List<EnterpriseComplaintVo> queryComplaintAll(SixAnalysisParamsBo params) {
return statisticalPanelDistrictMapper.query_complaint_all(params);
}
public long queryEntCount(SixAnalysisParamsBo params) {
return statisticalPanelDistrictMapper.query_ent_count(params);
}
public List<String> queryEntAddress(SixAnalysisParamsBo params) {
return statisticalPanelDistrictMapper.query_ent_address(params);
}
@Override
public List<Map<String, String>> queryCategoryCount(SixAnalysisParamsBo params) {
return statisticalPanelDistrictMapper.query_category_count(params);
}
@Override
public List<Map<String, String>> queryLawFieldCount(SixAnalysisParamsBo params) {
return statisticalPanelDistrictMapper.query_law_field_count(params);
}
@Override
public List<Map<String, String>> queryEnforceTypeCount(SixAnalysisParamsBo params) {
return statisticalPanelDistrictMapper.query_enforce_type_count(params);
}
@Override
public List<EnterpriseEvaluateVo> queryEvaluateAll(SixAnalysisParamsBo params) {
return statisticalPanelDistrictMapper.query_evaluate_all(params);
}
}

130
zdxt-modules/zdxt-enforcement-code/src/main/java/com/zdxt/enforcementcode/service/impl/StatisticalPaneServiceImpl.java

@ -0,0 +1,130 @@
package com.zdxt.enforcementcode.service.impl;
import com.zdxt.enforcementcode.domain.bo.SixAnalysisParamsBo;
import com.zdxt.enforcementcode.mapper.StatisticalPanelMapper;
import com.zdxt.enforcementcode.service.IStatisticalPaneService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Map;
@Slf4j
@RequiredArgsConstructor
@Service
public class StatisticalPaneServiceImpl implements IStatisticalPaneService {
@Autowired
private StatisticalPanelMapper statisticalPanelMapper;
/** 所有行政检查数量 */
@Override
public Integer analysisEnterprisesAll(SixAnalysisParamsBo params) {
return statisticalPanelMapper.analysis_enterprises_all(params);
}
@Override
public Integer analysis_non_enterprisesIns(SixAnalysisParamsBo params) {
return statisticalPanelMapper.analysis_non_enterprisesIns(params);
}
@Override
public Integer analysisEnterprisesUnion(SixAnalysisParamsBo params) {
return statisticalPanelMapper.analysis_enterprises_union(params);
}
@Override
public Double analysisEnterprisesUnionRr(SixAnalysisParamsBo params) {
return statisticalPanelMapper.analysis_enterprises_union_rr(params);
}
@Override
public Double analysisEnterprisesUnionYoy(SixAnalysisParamsBo params) {
return statisticalPanelMapper.analysis_enterprises_union_yoy(params);
}
@Override
public Integer analysisEnterprisesSingle(SixAnalysisParamsBo params) {
return statisticalPanelMapper.analysis_enterprises_single(params);
}
@Override
public Double analysisEnterprisesSingleRr(SixAnalysisParamsBo params) {
return statisticalPanelMapper.analysis_enterprises_single_rr(params);
}
@Override
public Double analysisEnterprisesSingleYoy(SixAnalysisParamsBo params) {
return statisticalPanelMapper.analysis_enterprises_single_yoy(params);
}
@Override
public Integer analysisEnterprises(SixAnalysisParamsBo params) {
return statisticalPanelMapper.analysis_enterprises(params);
}
@Override
public Double analysisEnterprisesRr(SixAnalysisParamsBo params) {
return statisticalPanelMapper.analysis_enterprises_rr(params);
}
@Override
public Double analysisEnterprisesYoy(SixAnalysisParamsBo params) {
return statisticalPanelMapper.analysis_enterprises_yoy(params);
}
@Override
public Integer analysis_non_enterprises(SixAnalysisParamsBo params) {
return statisticalPanelMapper.analysis_non_enterprises(params);
}
@Override
public Integer analysisEnterprisesCountAll(SixAnalysisParamsBo params) {
return statisticalPanelMapper.analysis_enterprises_countAll(params);
}
@Override
public Integer analysisEnterprisesNonAll(SixAnalysisParamsBo params) {
return statisticalPanelMapper.analysis_enterprises_non_all(params);
}
@Override
public List<Map<String, Object>> analysisNonRegistrationType(SixAnalysisParamsBo params) {
return statisticalPanelMapper.analysis_non_registration_type(params);
}
@Override
public List<Map<String, Object>> analysisRegistrationType(SixAnalysisParamsBo params) {
return statisticalPanelMapper.analysis_registration_type(params);
}
@Override
public List<Map<String, Object>> analysisEnterprisesInsTime(SixAnalysisParamsBo params) {
return statisticalPanelMapper.analysis_enterprisesIns_time(params);
}
@Override
public List<Map<String, Object>> analysisNonEnterprisesInsTime(SixAnalysisParamsBo params) {
return statisticalPanelMapper.analysis_non_enterprisesIns_time(params);
}
@Override
public List<Map<String, Object>> analysisEnterprisesTime(SixAnalysisParamsBo params) {
return statisticalPanelMapper.analysis_enterprises_time(params);
}
@Override
public Integer analysisEnterprisesComplaint(SixAnalysisParamsBo params) {
return statisticalPanelMapper.analysis_enterprisesComplaint(params);
}
@Override
public Double analysisEnterprisesComplaintRr(SixAnalysisParamsBo params) {
return statisticalPanelMapper.analysis_enterprisesComplaint_rr(params);
}
@Override
public Double analysisEnterprisesComplaintYoy(SixAnalysisParamsBo params) {
return statisticalPanelMapper.analysis_enterprisesComplaint_yoy(params);
}
}

390
zdxt-modules/zdxt-enforcement-code/src/main/resources/mapper/enforcementcode/StatisticalPanelCityMapper.xml

@ -0,0 +1,390 @@
<?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.StatisticalPanelCityMapper">
<resultMap type="com.zdxt.enforcementcode.domain.EnforcementRegistration" id="EnforcementRegistrationResult">
<result property="id" column="id" />
<result property="lawEnforcement" column="law_enforcement" />
<result property="lawEnforcementId" column="law_enforcement_id" />
<result property="enterpriseId" column="enterprise_id" />
<result property="enterpriseName" column="enterprise_name" />
<result property="enterpriseNumber" column="enterprise_number" />
<result property="enforcementTime" column="enforcement_time" />
<result property="createTime" column="create_time" />
<result property="createBy" column="create_by" />
<result property="lawEnforcer" column="law_enforcer" />
<result property="lawEnforcerId" column="law_enforcer_id" />
<result property="lawEnforcerTel" column="law_enforcer_tel" />
<result property="lawEnforcerTwo" column="law_enforcer_two" />
<result property="lawEnforcerIdTwo" column="law_enforcer_id_two" />
<result property="lawEnforcerTelTwo" column="law_enforcer_tel_two" />
<result property="subsidiaryer" column="subsidiaryer" />
<result property="subsidiaryerId" column="subsidiaryer_id" />
<result property="subsidiaryerTel" column="subsidiaryer_tel" />
<result property="lawEnforcementItem" column="law_enforcement_item" />
<result property="lawEnforcementItemText" column="law_enforcement_item_text" />
<result property="lawEnforcementBasis" column="law_enforcement_basis" />
<result property="lawEnforcementBasisText" column="law_enforcement_basis_text" />
<result property="remark" column="remark" />
<result property="reslut" column="reslut" />
<result property="userId" column="user_id" />
<result property="deptId" column="dept_id" />
<result property="isDelete" column="is_delete" />
<result property="status" column="status" />
<result property="lawEnforcementCode" column="law_enforcement_code" />
<result property="isComplaint" column="is_complaint" />
<result property="isSubmit" column="is_submit" />
<result property="uniteCheck" column="unite_check" />
<result property="enforce" column="enforce" />
<result property="checkCss" column="check_css" />
<result property="enforceReason" column="enforce_reason" />
<result property="lawField" column="law_field" />
<result property="checkCategory" column="check_category" />
<result property="bureauDeptId" column="bureau_dept_id" />
<result property="bureauDeptName" column="bureau_dept_name" />
<result property="isEvaluate" column="is_evaluate" />
<result property="lawId" column="law_id" />
<result property="lawText" column="law_text" />
<result property="numLeft" column="numLeft" />
<result property="numRight" column="numRight" />
<result property="unionNo" column="union_no" />
<result property="hasUnion" column="has_union" />
<result property="hasAuto" column="has_auto" />
<result property="lawEnforceCategory" column="law_enforce_category" />
<result property="entrustDeptId" column="entrust_dept_id" />
<result property="entrustDeptName" column="entrust_dept_name" />
<result property="enterpriseAddress" column="enterprise_address" />
<result property="district" column="district" />
<result property="street" column="street" />
</resultMap>
<resultMap type="com.zdxt.enforcementcode.domain.EnterpriseComplaint" id="EnterpriseComplaintResult">
<result property="id" column="id" />
<result property="relId" column="rel_id" />
<result property="enforceType" column="enforce_type" />
<result property="problemDescription" column="problem_description" />
<result property="enterpriseAddress" column="enterprise_address" />
<result property="linkman" column="linkman" />
<result property="linkmanTel" column="linkman_tel" />
<result property="comOrOpi" column="com_or_opi" />
<result property="authorization" column="authorization" />
<result property="createTime" column="create_time" />
<result property="proWoCode" column="pro_wo_code" />
<result property="enterpriseNumber" column="enterprise_number" />
<result property="enterpriseName" column="enterprise_name" />
<result property="status" column="status" />
<result property="evaluateTime" column="evaluate_time" />
<result property="complaintDepartments" column="complaint_departments" />
<result property="complaintDepartmentIds" column="complaint_department_ids" />
<result property="enforcementTime" column="enforcement_time" />
<result property="handleTime" column="handle_time" />
<result property="complaintType" column="complaint_type" />
<result property="complaintItemCodes" column="complaint_item_codes" />
<result property="complaintItemNames" column="complaint_item_names" />
<result property="complaintRecordItem" column="complaint_record_item" />
<result property="recordType" column="record_type" />
</resultMap>
<resultMap type="com.zdxt.enforcementcode.domain.EnterpriseEvaluate" id="EnterpriseEvaluateResult">
<result property="id" column="id" />
<result property="enforcementName" column="enforcement_name" />
<result property="enforcementId" column="enforcement_id" />
<result property="evaluateDescription" column="evaluate_description" />
<result property="linkman" column="linkman" />
<result property="linkmanTel" column="linkman_tel" />
<result property="authorization" column="authorization" />
<result property="createTime" column="create_time" />
<result property="enterpriseNumber" column="enterprise_number" />
<result property="enterpriseName" column="enterprise_name" />
<result property="inspectionEfficiency" column="inspection_efficiency" />
<result property="checkEffect" column="check_effect" />
<result property="checkQuality" column="check_quality" />
<result property="serviceExperience" column="service_experience" />
<result property="checkEffectiveness" column="check_effectiveness" />
<result property="proceduralLegality" column="procedural_legality" />
<result property="batchId" column="batch_id" />
<result property="satisfactionLevel" column="satisfaction_level" />
<result property="otherProblemSwitch" column="other_problem_switch" />
<result property="problem1" column="problem1" />
<result property="problem2" column="problem2" />
<result property="problem3" column="problem3" />
<result property="problem4" column="problem4" />
<result property="problem5" column="problem5" />
<result property="checkAttitude" column="check_attitude" />
</resultMap>
<resultMap type="com.zdxt.enforcementcode.domain.vo.StatisticsIndicatorPartVo" id="StatisticalVoResult">
<result property="createTime" column="create_time" />
<result property="userId" column="user_id" />
<result property="deptId" column="dept_id" />
<result property="name" column="name" />
</resultMap>
<sql id="selectEnforcementRegistrationVo">
r.id,
r.law_enforcement as lawEnforcement,
r.law_enforcement_id as lawEnforcementId,
r.enforce,
r.enterprise_id as enterpriseId,
r.enterprise_name as enterpriseName,
r.enterprise_number as enterpriseNumber,
r.enforcement_time as enforcementTime,
r.create_time as createTime,
r.create_by as createBy,
r.law_enforcer,
r.law_enforcer_id as lawEnforcerId,
r.law_enforcer_tel as lawEnforcerTel,
r.law_enforcer_two as lawEnforcerTwo,
r.law_enforcer_id_two as lawEnforcerIdTwo,
r.law_enforcer_tel_two as lawEnforcerTelTwo,
r.subsidiaryer,
r.subsidiaryer_id as subsidiaryerId,
r.subsidiaryer_tel as subsidiaryerTel,
r.law_enforcement_item as lawEnforcementItem,
r.law_enforcement_item_text as lawEnforcementItemText,
r.law_enforcement_basis as lawEnforcementBasis,
r.law_enforcement_basis_text as lawEnforcementBasisText,
r.remark,
r.reslut,
r.user_id as userId,
r.dept_id as deptId,
r.is_delete as isDelete,
status,
r.law_enforcement_code as lawEnforcementCode,
r.is_complaint as isComplaint,
is_submit as isSubmit,
r.unite_check as uniteCheck,
r.check_css as checkCss,
r.enforce_reason as enforceReason,
r.law_field as lawField,
r.check_category as checkCategory,
r.bureau_dept_id as bureauDeptId,
r.bureau_dept_name as bureauDeptName,
r.is_evaluate as isEvaluate,
r.law_id as lawId,
r.law_text as lawText,
r.has_union as hasUnion,
r.has_auto as hasAuto,
r.union_no as unionNo,
r.law_enforce_category as lawEnforceCategory,
r.entrust_dept_id as entrustDeptId,
r.entrust_dept_name as entrustDeptName,
r.enterprise_address as enterpriseAddress,
r.district,
r.street
</sql>
<sql id="selectEnterpriseComplaintVo">
c.id,
c.rel_id as relId,
c.enforce_type as enforceType,
c.problem_description as problemDescription,
c.enterprise_address as enterpriseAddress,
c.linkman,
c.linkman_tel as linkmanTel,
c.com_or_opi as comOrOpi,
c.authorization,
c.create_time as createTime,
c.pro_wo_code as proWoCode,
c.enterprise_number as enterpriseNumber,
c.enterprise_name as enterpriseName,
c.status,
c.evaluate_time as evaluateTime,
c.complaint_departments as complaintDepartments,
c.complaint_department_ids as complaintDepartmentIds,
c.enforcement_time as enforcementTime,
c.handle_time as handleTime,
c.complaint_type as complaintType,
c.complaint_item_codes as complaintItemCodes,
c.complaint_item_names as complaintItemNames,
c.complaint_record_item as complaintRecordItem,
c.record_type as recordType
</sql>
<sql id="selectEnterpriseEvaluateVo">
e.id,
e.enforcement_name as enforcementName,
e.enforcement_id as enforcementId,
e.evaluate_description as evaluateDescription,
e.linkman,
e.linkman_tel as linkmanTel,
e.authorization,
e.create_time,
e.inspection_efficiency as inspectionEfficiency,
e.check_effect as checkEffect,
check_quality as checkQuality,
e.service_experience as serviceExperience,
e.check_effectiveness as checkEffectiveness,
e.procedural_legality as proceduralLegality,
e.batch_id as batchId,
e.satisfaction_level as satisfactionLevel,
e.other_problem_switch as otherProblemSwitch,
e.problem1,
problem2,
e.problem3,
e.problem4,
e.problem5,
e.check_attitude as checkAttitude
</sql>
<!-- 所有行政检查数量 -->
<select id="query_law_all" parameterType="com.zdxt.enforcementcode.domain.bo.SixAnalysisParamsBo" resultType="com.zdxt.enforcementcode.domain.vo.EnforcementRegistrationVo">
select <include refid="selectEnforcementRegistrationVo"/> FROM enforcement_registration r
WHERE r.is_submit = 1
<if test="beginTime != null and beginTime != ''"> and DATE_FORMAT(r.enforcement_time,'%Y-%m-%d') >= DATE_FORMAT(#{beginTime},'%Y-%m-%d') </if>
<if test="endTime != null and endTime != ''"> and DATE_FORMAT(#{endTime},'%Y-%m-%d') >= DATE_FORMAT(r.enforcement_time,'%Y-%m-%d') </if>
<if test="zone == 1">and r.zone = 1</if>
<if test="zone == 2">and r.zone = 2</if>
<if test="filterDepts != null and filterDepts.size() > 0">
and r.bureau_dept_id in <foreach collection="filterDepts" item="bureau_dept_id" open="(" separator="," close=")"> #{bureau_dept_id} </foreach>
</if>
and r.enterprise_number is not null
<if test="params.dataScope != null and params.dataScope != ''"> ${params.dataScope} </if>
order by r.enforcement_time desc
</select>
<!-- 所有投诉数量 -->
<select id="query_complaint_all" parameterType="com.zdxt.enforcementcode.domain.bo.SixAnalysisParamsBo" resultType="com.zdxt.enforcementcode.domain.vo.EnterpriseComplaintVo">
select <include refid="selectEnterpriseComplaintVo"/> FROM enterprise_complaint c
<where>
<if test="beginTime != null and beginTime != ''"> and c.create_time &gt;= #{beginTime} </if>
<if test="endTime != null and endTime != ''"> and c.create_time &lt; #{endTime} </if>
<if test="bureauDeptId != null and bureauDeptId != ''"> and FIND_IN_SET(#{bureauDeptId}, c.complaint_department_ids) </if>
</where>
</select>
<!-- 所有企业数量 -->
<select id="query_ent_count" parameterType="com.zdxt.enforcementcode.domain.bo.SixAnalysisParamsBo" resultType="long">
select count(1)
from (
SELECT enterprise_number FROM enterprise_information e WHERE e.enterprise_number IS NOT NULL
<if test="beginTime != null and beginTime != ''"> and e.establishment_time &gt;= #{beginTime} </if>
<if test="endTime != null and endTime != ''"> and e.establishment_time &lt; #{endTime} </if>
) t
</select>
<!-- 所有行政执法类别 -->
<select id="query_category_count" parameterType="com.zdxt.enforcementcode.domain.bo.SixAnalysisParamsBo" resultType="map">
SELECT r.law_enforce_category, CAST(COUNT(1) AS CHAR) AS cnt FROM enforcement_registration r WHERE enforcement_time IS NOT null and r.bureau_dept_name is not null and r.is_submit = 1 and r.law_enforcement_id is not null and r.enterprise_name is not null and r.enterprise_number is not null and r.law_enforcer is not null and r.law_enforcer_two is not null and r.is_complaint is not null and r.check_category is not null and r.bureau_dept_id is not null
<if test="beginTime != null and beginTime != ''"> and r.enforcement_time &gt;= #{beginTime} </if>
<if test="endTime != null and endTime != ''"> and r.enforcement_time &lt; #{endTime} </if>
<if test="zone == 1">and r.zone = 1</if>
<if test="filterDepts != null and filterDepts.size() > 0">
and r.bureau_dept_id in <foreach collection="filterDepts" item="bureau_dept_id" open="(" separator="," close=")"> #{bureau_dept_id} </foreach>
</if>
<if test="params.dataScope != null and params.dataScope != ''"> ${params.dataScope} </if>
GROUP BY r.law_enforce_category ORDER BY cnt DESC;
</select>
<!-- 所有重点领域类 -->
<select id="query_law_field_count" parameterType="com.zdxt.enforcementcode.domain.bo.SixAnalysisParamsBo" resultType="map">
SELECT r.law_field, CAST(COUNT(1) AS CHAR) AS cnt FROM enforcement_registration r WHERE enforcement_time IS NOT null and r.bureau_dept_name is not null and r.is_submit = 1 and r.law_enforcement_id is not null and r.enterprise_name is not null and r.enterprise_number is not null and r.law_enforcer is not null and r.law_enforcer_two is not null and r.is_complaint is not null and r.check_category is not null and r.bureau_dept_id is not null and law_field is not null
<if test="beginTime != null and beginTime != ''"> and r.enforcement_time &gt;= #{beginTime} </if>
<if test="endTime != null and endTime != ''"> and r.enforcement_time &lt; #{endTime} </if>
<if test="zone == 1">and r.zone = 1</if>
<if test="filterDepts != null and filterDepts.size() > 0">
and r.bureau_dept_id in <foreach collection="filterDepts" item="bureau_dept_id" open="(" separator="," close=")"> #{bureau_dept_id} </foreach>
</if>
<if test="params.dataScope != null and params.dataScope != ''"> ${params.dataScope} </if>
GROUP BY r.law_field ORDER BY cnt DESC;
</select>
<!-- 行政执法投诉类别 -->
<select id="query_enforce_type_count" parameterType="com.zdxt.enforcementcode.domain.bo.SixAnalysisParamsBo" resultType="map">
SELECT CAST(c.enforce_type AS CHAR) AS enforce_type, CAST(COUNT(1) AS CHAR) AS cnt FROM enterprise_complaint c where c.enforce_type is not null
<if test="beginTime != null and beginTime != ''"> and c.create_time &gt;= #{beginTime} </if>
<if test="endTime != null and endTime != ''"> and c.create_time &lt; #{endTime} </if>
<if test="bureauDeptId != null and bureauDeptId != ''"> and FIND_IN_SET(#{bureauDeptId}, c.complaint_department_ids) </if>
GROUP BY c.enforce_type ORDER BY cnt DESC;
</select>
<!-- 行政执法投诉评价 -->
<select id="query_evaluate_all" parameterType="com.zdxt.enforcementcode.domain.bo.SixAnalysisParamsBo" resultType="com.zdxt.enforcementcode.domain.vo.EnterpriseEvaluateVo">
select <include refid="selectEnterpriseEvaluateVo"/> from enterprise_evaluate e left join enforcement_registration r on r.id = e.enforcement_id where r.bureau_dept_name is not null and r.is_submit = 1 and r.law_enforcement_id is not null and r.enterprise_name is not null and r.enterprise_number is not null and r.law_enforcer is not null and r.law_enforcer_two is not null and r.is_complaint is not null and r.check_category is not null and r.bureau_dept_id is not null
<if test="beginTime != null and beginTime != ''"> and e.create_time &gt;= #{beginTime} </if>
<if test="endTime != null and endTime != ''"> and e.create_time &lt; #{endTime} </if>
<if test="zone == 1">and r.zone = 1</if>
<if test="filterDepts != null and filterDepts.size() > 0">
and r.bureau_dept_id in <foreach collection="filterDepts" item="bureau_dept_id" open="(" separator="," close=")"> #{bureau_dept_id} </foreach>
</if>
<if test="params.dataScope != null and params.dataScope != ''"> ${params.dataScope} </if>
</select>
<!-- 被执法企业次数排行 -->
<select id="query_enfEnt_sort" parameterType="com.zdxt.enforcementcode.domain.bo.SixAnalysisParamsBo" resultType="map">
SELECT r.enterprise_name, count(1) as cnt FROM enforcement_registration r WHERE r.bureau_dept_name is not null and r.is_submit = 1 and r.law_enforcement_id is not null and r.enterprise_name is not null and r.enterprise_number is not null and r.law_enforcer is not null and r.law_enforcer_two is not null and r.is_complaint is not null and r.check_category is not null and r.bureau_dept_id is not null
<if test="beginTime != null and beginTime != ''"> and r.enforcement_time &gt;= #{beginTime} </if>
<if test="endTime != null and endTime != ''"> and r.enforcement_time &lt; #{endTime} </if>
<if test="zone == 1">and r.zone = 1</if>
<if test="bureauDeptId != null and bureauDeptId != ''"> and r.bureau_dept_id = #{bureauDeptId} </if>
<if test="filterDepts != null and filterDepts.size() > 0">
and r.bureau_dept_id in <foreach collection="filterDepts" item="bureau_dept_id" open="(" separator="," close=")"> #{bureau_dept_id} </foreach>
</if>
<if test="params.dataScope != null and params.dataScope != ''"> ${params.dataScope} </if>
GROUP BY r.enterprise_number order by cnt desc limit #{pageSize}
</select>
<!-- 执法单位执法数量排行 -->
<select id="query_enforcement_sort" parameterType="com.zdxt.enforcementcode.domain.bo.SixAnalysisParamsBo" resultType="map">
SELECT r.bureau_dept_name, count(1) as cnt FROM enforcement_registration r WHERE r.bureau_dept_name is not null and r.is_submit = 1 and r.law_enforcement_id is not null and r.enterprise_name is not null and r.enterprise_number is not null and r.law_enforcer is not null and r.law_enforcer_two is not null and r.is_complaint is not null and r.check_category is not null and r.bureau_dept_id is not null
<if test="beginTime != null and beginTime != ''"> and r.enforcement_time &gt;= #{beginTime} </if>
<if test="endTime != null and endTime != ''"> and r.enforcement_time &lt; #{endTime} </if>
<if test="zone == 1">and r.zone = 1</if>
<if test="filterDepts != null and filterDepts.size() > 0">
and r.bureau_dept_id in <foreach collection="filterDepts" item="bureau_dept_id" open="(" separator="," close=")"> #{bureau_dept_id} </foreach>
</if>
<if test="params.dataScope != null and params.dataScope != ''"> ${params.dataScope} </if>
GROUP BY r.bureau_dept_id order by cnt desc limit #{pageSize}
</select>
<!-- 被投诉单位次数排行 -->
<select id="query_entC_sort" parameterType="com.zdxt.enforcementcode.domain.bo.SixAnalysisParamsBo" resultType="map">
SELECT c.complaint_departments, count(1) as cnt FROM enterprise_complaint c WHERE c.complaint_department_ids IS NOT NULL and c.complaint_departments is not null
<if test="beginTime != null and beginTime != ''"> and c.create_time &gt;= #{beginTime} </if>
<if test="endTime != null and endTime != ''"> and c.create_time &lt; #{endTime} </if>
<if test="bureauDeptId != null and bureauDeptId != ''"> and FIND_IN_SET(#{bureauDeptId}, c.complaint_department_ids) </if>
GROUP BY c.complaint_department_ids order by cnt desc limit #{pageSize}
</select>
<!-- 委托执法数量及占比 -->
<select id="query_auto_rate" parameterType="com.zdxt.enforcementcode.domain.bo.SixAnalysisParamsBo" resultType="long">
SELECT count(1) as cnt FROM enforcement_registration r WHERE r.bureau_dept_name is not null and r.is_submit = 1 and r.law_enforcement_id is not null and r.enterprise_name is not null and r.enterprise_number is not null and r.law_enforcer is not null and r.law_enforcer_two is not null and r.is_complaint is not null and r.check_category is not null and r.bureau_dept_id is not null
<if test="beginTime != null and beginTime != ''"> and r.enforcement_time &gt;= #{beginTime} </if>
<if test="endTime != null and endTime != ''"> and r.enforcement_time &lt; #{endTime} </if>
<if test="zone == 1">and r.zone = 1</if>
<if test="hasAuto != null">and r.has_auto = #{hasAuto}</if>
<if test="filterDepts != null and filterDepts.size() > 0">
and r.bureau_dept_id in <foreach collection="filterDepts" item="bureau_dept_id" open="(" separator="," close=")"> #{bureau_dept_id} </foreach>
</if>
<if test="params.dataScope != null and params.dataScope != ''"> ${params.dataScope} </if>
</select>
<!-- 获取被选取的所有部门id -->
<select id="queryDeptAllByBureauDeptId" parameterType="string" resultType="string">
select dept_id from sys_dept where FIND_IN_SET(#{bureauDeptId}, ancestors) or dept_id = #{bureauDeptId}
</select>
<!-- 获取联合执法的执法单位信息 -->
<select id="queryDuplicateUnionNosByUnion" parameterType="com.zdxt.enforcementcode.domain.bo.SixAnalysisParamsBo" resultType="string">
select r.union_no from enforcement_registration r where union_no is not null and r.bureau_dept_name is not null and r.is_submit = 1 and r.law_enforcement_id is not null and r.enterprise_name is not null and r.enterprise_number is not null and r.law_enforcer is not null and r.law_enforcer_two is not null and r.is_complaint is not null and r.check_category is not null and r.bureau_dept_id is not null
<if test="beginTime != null and beginTime != ''"> and r.enforcement_time &gt;= #{beginTime} </if>
<if test="endTime != null and endTime != ''"> and r.enforcement_time &lt; #{endTime} </if>
<if test="filterDepts != null and filterDepts.size() > 0">
and r.bureau_dept_id in <foreach collection="filterDepts" item="bureau_dept_id" open="(" separator="," close=")"> #{bureau_dept_id} </foreach>
</if>
group by r.union_no having count(1) > 1
</select>
<!-- 获取联合执法的执法单位信息 -->
<select id="queryBureauDeptByUnion" parameterType="string" resultType="map">
select er.law_enforcement_id, er.law_enforcement from enforcement_registration er where er.law_enforcement_id is not null
<if test="unionNos != null and unionNos.size() > 0">
and er.union_no in <foreach collection="unionNos" item="unionNo" open="(" separator="," close=")"> #{unionNo} </foreach>
</if>
</select>
</mapper>

404
zdxt-modules/zdxt-enforcement-code/src/main/resources/mapper/enforcementcode/StatisticalPanelDistrictMapper.xml

@ -0,0 +1,404 @@
<?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.StatisticalPanelDistrictMapper">
<resultMap type="com.zdxt.enforcementcode.domain.EnforcementRegistration" id="EnforcementRegistrationResult">
<result property="id" column="id" />
<result property="lawEnforcement" column="law_enforcement" />
<result property="lawEnforcementId" column="law_enforcement_id" />
<result property="enterpriseId" column="enterprise_id" />
<result property="enterpriseName" column="enterprise_name" />
<result property="enterpriseNumber" column="enterprise_number" />
<result property="enforcementTime" column="enforcement_time" />
<result property="createTime" column="create_time" />
<result property="createBy" column="create_by" />
<result property="lawEnforcer" column="law_enforcer" />
<result property="lawEnforcerId" column="law_enforcer_id" />
<result property="lawEnforcerTel" column="law_enforcer_tel" />
<result property="lawEnforcerTwo" column="law_enforcer_two" />
<result property="lawEnforcerIdTwo" column="law_enforcer_id_two" />
<result property="lawEnforcerTelTwo" column="law_enforcer_tel_two" />
<result property="subsidiaryer" column="subsidiaryer" />
<result property="subsidiaryerId" column="subsidiaryer_id" />
<result property="subsidiaryerTel" column="subsidiaryer_tel" />
<result property="lawEnforcementItem" column="law_enforcement_item" />
<result property="lawEnforcementItemText" column="law_enforcement_item_text" />
<result property="lawEnforcementBasis" column="law_enforcement_basis" />
<result property="lawEnforcementBasisText" column="law_enforcement_basis_text" />
<result property="remark" column="remark" />
<result property="reslut" column="reslut" />
<result property="userId" column="user_id" />
<result property="deptId" column="dept_id" />
<result property="isDelete" column="is_delete" />
<result property="status" column="status" />
<result property="lawEnforcementCode" column="law_enforcement_code" />
<result property="isComplaint" column="is_complaint" />
<result property="isSubmit" column="is_submit" />
<result property="uniteCheck" column="unite_check" />
<result property="enforce" column="enforce" />
<result property="checkCss" column="check_css" />
<result property="enforceReason" column="enforce_reason" />
<result property="lawField" column="law_field" />
<result property="checkCategory" column="check_category" />
<result property="bureauDeptId" column="bureau_dept_id" />
<result property="bureauDeptName" column="bureau_dept_name" />
<result property="isEvaluate" column="is_evaluate" />
<result property="lawId" column="law_id" />
<result property="lawText" column="law_text" />
<result property="numLeft" column="numLeft" />
<result property="numRight" column="numRight" />
<result property="unionNo" column="union_no" />
<result property="hasUnion" column="has_union" />
<result property="hasAuto" column="has_auto" />
<result property="lawEnforceCategory" column="law_enforce_category" />
<result property="entrustDeptId" column="entrust_dept_id" />
<result property="entrustDeptName" column="entrust_dept_name" />
<result property="enterpriseAddress" column="enterprise_address" />
<result property="district" column="district" />
<result property="street" column="street" />
</resultMap>
<resultMap type="com.zdxt.enforcementcode.domain.EnterpriseComplaint" id="EnterpriseComplaintResult">
<result property="id" column="id" />
<result property="relId" column="rel_id" />
<result property="enforceType" column="enforce_type" />
<result property="problemDescription" column="problem_description" />
<result property="enterpriseAddress" column="enterprise_address" />
<result property="linkman" column="linkman" />
<result property="linkmanTel" column="linkman_tel" />
<result property="comOrOpi" column="com_or_opi" />
<result property="authorization" column="authorization" />
<result property="createTime" column="create_time" />
<result property="proWoCode" column="pro_wo_code" />
<result property="enterpriseNumber" column="enterprise_number" />
<result property="enterpriseName" column="enterprise_name" />
<result property="status" column="status" />
<result property="evaluateTime" column="evaluate_time" />
<result property="complaintDepartments" column="complaint_departments" />
<result property="complaintDepartmentIds" column="complaint_department_ids" />
<result property="enforcementTime" column="enforcement_time" />
<result property="handleTime" column="handle_time" />
<result property="complaintType" column="complaint_type" />
<result property="complaintItemCodes" column="complaint_item_codes" />
<result property="complaintItemNames" column="complaint_item_names" />
<result property="complaintRecordItem" column="complaint_record_item" />
<result property="recordType" column="record_type" />
</resultMap>
<resultMap type="com.zdxt.enforcementcode.domain.EnterpriseEvaluate" id="EnterpriseEvaluateResult">
<result property="id" column="id" />
<result property="enforcementName" column="enforcement_name" />
<result property="enforcementId" column="enforcement_id" />
<result property="evaluateDescription" column="evaluate_description" />
<result property="linkman" column="linkman" />
<result property="linkmanTel" column="linkman_tel" />
<result property="authorization" column="authorization" />
<result property="createTime" column="create_time" />
<result property="enterpriseNumber" column="enterprise_number" />
<result property="enterpriseName" column="enterprise_name" />
<result property="inspectionEfficiency" column="inspection_efficiency" />
<result property="checkEffect" column="check_effect" />
<result property="checkQuality" column="check_quality" />
<result property="serviceExperience" column="service_experience" />
<result property="checkEffectiveness" column="check_effectiveness" />
<result property="proceduralLegality" column="procedural_legality" />
<result property="batchId" column="batch_id" />
<result property="satisfactionLevel" column="satisfaction_level" />
<result property="otherProblemSwitch" column="other_problem_switch" />
<result property="problem1" column="problem1" />
<result property="problem2" column="problem2" />
<result property="problem3" column="problem3" />
<result property="problem4" column="problem4" />
<result property="problem5" column="problem5" />
<result property="checkAttitude" column="check_attitude" />
</resultMap>
<resultMap type="com.zdxt.enforcementcode.domain.vo.StatisticsIndicatorPartVo" id="StatisticalVoResult">
<result property="createTime" column="create_time" />
<result property="userId" column="user_id" />
<result property="deptId" column="dept_id" />
<result property="name" column="name" />
</resultMap>
<sql id="selectEnforcementRegistrationVo">
r.id,
r.law_enforcement as lawEnforcement,
r.law_enforcement_id as lawEnforcementId,
r.enforce,
r.enterprise_id as enterpriseId,
r.enterprise_name as enterpriseName,
r.enterprise_number as enterpriseNumber,
r.enforcement_time as enforcementTime,
r.create_time as createTime,
r.create_by as createBy,
r.law_enforcer,
r.law_enforcer_id as lawEnforcerId,
r.law_enforcer_tel as lawEnforcerTel,
r.law_enforcer_two as lawEnforcerTwo,
r.law_enforcer_id_two as lawEnforcerIdTwo,
r.law_enforcer_tel_two as lawEnforcerTelTwo,
r.subsidiaryer,
r.subsidiaryer_id as subsidiaryerId,
r.subsidiaryer_tel as subsidiaryerTel,
r.law_enforcement_item as lawEnforcementItem,
r.law_enforcement_item_text as lawEnforcementItemText,
r.law_enforcement_basis as lawEnforcementBasis,
r.law_enforcement_basis_text as lawEnforcementBasisText,
r.remark,
r.reslut,
r.user_id as userId,
r.dept_id as deptId,
r.is_delete as isDelete,
status,
r.law_enforcement_code as lawEnforcementCode,
r.is_complaint as isComplaint,
is_submit as isSubmit,
r.unite_check as uniteCheck,
r.check_css as checkCss,
r.enforce_reason as enforceReason,
r.law_field as lawField,
r.check_category as checkCategory,
r.bureau_dept_id as bureauDeptId,
r.bureau_dept_name as bureauDeptName,
r.is_evaluate as isEvaluate,
r.law_id as lawId,
r.law_text as lawText,
r.has_union as hasUnion,
r.has_auto as hasAuto,
r.union_no as unionNo,
r.law_enforce_category as lawEnforceCategory,
r.entrust_dept_id as entrustDeptId,
r.entrust_dept_name as entrustDeptName,
r.enterprise_address as enterpriseAddress,
r.district,
r.street
</sql>
<sql id="selectEnterpriseComplaintVo">
c.id,
c.rel_id as relId,
c.enforce_type as enforceType,
c.problem_description as problemDescription,
c.enterprise_address as enterpriseAddress,
c.linkman,
c.linkman_tel as linkmanTel,
c.com_or_opi as comOrOpi,
c.authorization,
c.create_time as createTime,
c.pro_wo_code as proWoCode,
c.enterprise_number as enterpriseNumber,
c.enterprise_name as enterpriseName,
c.status,
c.evaluate_time as evaluateTime,
c.complaint_departments as complaintDepartments,
c.complaint_department_ids as complaintDepartmentIds,
c.enforcement_time as enforcementTime,
c.handle_time as handleTime,
c.complaint_type as complaintType,
c.complaint_item_codes as complaintItemCodes,
c.complaint_item_names as complaintItemNames,
c.complaint_record_item as complaintRecordItem,
c.record_type as recordType
</sql>
<sql id="selectEnterpriseEvaluateVo">
e.id,
e.enforcement_name as enforcementName,
e.enforcement_id as enforcementId,
e.evaluate_description as evaluateDescription,
e.linkman,
e.linkman_tel as linkmanTel,
e.authorization,
e.create_time,
e.inspection_efficiency as inspectionEfficiency,
e.check_effect as checkEffect,
check_quality as checkQuality,
e.service_experience as serviceExperience,
e.check_effectiveness as checkEffectiveness,
e.procedural_legality as proceduralLegality,
e.batch_id as batchId,
e.satisfaction_level as satisfactionLevel,
e.other_problem_switch as otherProblemSwitch,
e.problem1,
problem2,
e.problem3,
e.problem4,
e.problem5,
e.check_attitude as checkAttitude
</sql>
<!-- 所有行政检查数量 -->
<select id="query_law_all" parameterType="com.zdxt.enforcementcode.domain.bo.SixAnalysisParamsBo" resultType="com.zdxt.enforcementcode.domain.vo.EnforcementRegistrationVo">
select <include refid="selectEnforcementRegistrationVo"/> FROM enforcement_registration r
WHERE r.is_submit = 1
<if test="beginTime != null and beginTime != ''"> and DATE_FORMAT(r.enforcement_time,'%Y-%m-%d') >= DATE_FORMAT(#{beginTime},'%Y-%m-%d') </if>
<if test="endTime != null and endTime != ''"> and DATE_FORMAT(#{endTime},'%Y-%m-%d') >= DATE_FORMAT(r.enforcement_time,'%Y-%m-%d') </if>
<if test="zone == 1">and r.zone = 1</if>
<if test="zone == 2">and r.zone is null</if>
<if test="filterDepts != null and filterDepts.size() > 0">
and r.bureau_dept_id in <foreach collection="filterDepts" item="bureau_dept_id" open="(" separator="," close=")"> #{bureau_dept_id} </foreach>
</if>
and r.enterprise_number is not null
<if test="params.dataScope != null and params.dataScope != ''"> ${params.dataScope} </if>
order by r.enforcement_time desc
</select>
<!-- 所有投诉数量 -->
<select id="query_complaint_all" parameterType="com.zdxt.enforcementcode.domain.bo.SixAnalysisParamsBo" resultType="com.zdxt.enforcementcode.domain.vo.EnterpriseComplaintVo">
select <include refid="selectEnterpriseComplaintVo"/> FROM enterprise_complaint c
<where>
<if test="beginTime != null and beginTime != ''"> and c.create_time &gt;= #{beginTime} </if>
<if test="endTime != null and endTime != ''"> and c.create_time &lt; #{endTime} </if>
<if test="recordType != null and recordType != ''"> and c.record_type = #{recordType}</if>
<if test="bureauDeptId != null and bureauDeptId != ''"> and FIND_IN_SET(#{bureauDeptId}, c.complaint_department_ids) </if>
</where>
</select>
<!-- 所有企业数量 -->
<select id="query_ent_count" parameterType="com.zdxt.enforcementcode.domain.bo.SixAnalysisParamsBo" resultType="long">
select count(1)
from (
SELECT enterprise_number FROM enterprise_information e WHERE e.enterprise_number IS NOT NULL
<if test="beginTime != null and beginTime != ''"> and e.establishment_time &gt;= #{beginTime} </if>
<if test="endTime != null and endTime != ''"> and e.establishment_time &lt; #{endTime} </if>
) t
</select>
<!-- 所有企业数量 -->
<select id="query_ent_address" parameterType="com.zdxt.enforcementcode.domain.bo.SixAnalysisParamsBo" resultType="string">
SELECT enterprise_address FROM enterprise_information e WHERE e.enterprise_address IS NOT NULL
<if test="beginTime != null and beginTime != ''"> and e.establishment_time &gt;= #{beginTime} </if>
<if test="endTime != null and endTime != ''"> and e.establishment_time &lt; #{endTime} </if>
</select>
<!-- 所有行政执法类别 -->
<select id="query_category_count" parameterType="com.zdxt.enforcementcode.domain.bo.SixAnalysisParamsBo" resultType="map">
SELECT r.law_enforce_category, CAST(COUNT(1) AS CHAR) AS cnt FROM enforcement_registration r WHERE enforcement_time IS NOT null and r.bureau_dept_name is not null and r.is_submit = 1 and r.law_enforcement_id is not null and r.enterprise_name is not null and r.enterprise_number is not null and r.law_enforcer is not null and r.law_enforcer_two is not null and r.is_complaint is not null and r.check_category is not null and r.bureau_dept_id is not null
<if test="beginTime != null and beginTime != ''"> and r.enforcement_time &gt;= #{beginTime} </if>
<if test="endTime != null and endTime != ''"> and r.enforcement_time &lt; #{endTime} </if>
<if test="zone == 1">and r.zone = 1</if>
<if test="zone == 2">and r.zone is null</if>
<if test="filterDepts != null and filterDepts.size() > 0">
and r.bureau_dept_id in <foreach collection="filterDepts" item="bureau_dept_id" open="(" separator="," close=")"> #{bureau_dept_id} </foreach>
</if>
<if test="params.dataScope != null and params.dataScope != ''"> ${params.dataScope} </if>
GROUP BY r.law_enforce_category ORDER BY cnt DESC;
</select>
<!-- 所有重点领域类 -->
<select id="query_law_field_count" parameterType="com.zdxt.enforcementcode.domain.bo.SixAnalysisParamsBo" resultType="map">
SELECT r.law_field, CAST(COUNT(1) AS CHAR) AS cnt FROM enforcement_registration r WHERE enforcement_time IS NOT null and r.bureau_dept_name is not null and r.is_submit = 1 and r.law_enforcement_id is not null and r.enterprise_name is not null and r.enterprise_number is not null and r.law_enforcer is not null and r.law_enforcer_two is not null and r.is_complaint is not null and r.check_category is not null and r.bureau_dept_id is not null and law_field is not null
<if test="beginTime != null and beginTime != ''"> and r.enforcement_time &gt;= #{beginTime} </if>
<if test="endTime != null and endTime != ''"> and r.enforcement_time &lt; #{endTime} </if>
<if test="zone == 1">and r.zone = 1</if>
<if test="zone == 2">and r.zone is null</if>
<if test="filterDepts != null and filterDepts.size() > 0">
and r.bureau_dept_id in <foreach collection="filterDepts" item="bureau_dept_id" open="(" separator="," close=")"> #{bureau_dept_id} </foreach>
</if>
<if test="params.dataScope != null and params.dataScope != ''"> ${params.dataScope} </if>
GROUP BY r.law_field ORDER BY cnt DESC;
</select>
<!-- 行政执法投诉类别 -->
<select id="query_enforce_type_count" parameterType="com.zdxt.enforcementcode.domain.bo.SixAnalysisParamsBo" resultType="map">
SELECT CAST(c.enforce_type AS CHAR) AS enforce_type, CAST(COUNT(1) AS CHAR) AS cnt FROM enterprise_complaint c where c.enforce_type is not null
<if test="beginTime != null and beginTime != ''"> and c.create_time &gt;= #{beginTime} </if>
<if test="endTime != null and endTime != ''"> and c.create_time &lt; #{endTime} </if>
<if test="bureauDeptId != null and bureauDeptId != ''"> and FIND_IN_SET(#{bureauDeptId}, c.complaint_department_ids) </if>
GROUP BY c.enforce_type ORDER BY cnt DESC;
</select>
<!-- 行政执法投诉评价 -->
<select id="query_evaluate_all" parameterType="com.zdxt.enforcementcode.domain.bo.SixAnalysisParamsBo" resultType="com.zdxt.enforcementcode.domain.vo.EnterpriseEvaluateVo">
select <include refid="selectEnterpriseEvaluateVo"/> from enterprise_evaluate e left join enforcement_registration r on r.id = e.enforcement_id where r.bureau_dept_name is not null and r.is_submit = 1 and r.law_enforcement_id is not null and r.enterprise_name is not null and r.enterprise_number is not null and r.law_enforcer is not null and r.law_enforcer_two is not null and r.is_complaint is not null and r.check_category is not null and r.bureau_dept_id is not null
<if test="beginTime != null and beginTime != ''"> and e.create_time &gt;= #{beginTime} </if>
<if test="endTime != null and endTime != ''"> and e.create_time &lt; #{endTime} </if>
<if test="zone == 1">and r.zone = 1</if>
<if test="zone == 2">and r.zone is null</if>
<if test="filterDepts != null and filterDepts.size() > 0">
and r.bureau_dept_id in <foreach collection="filterDepts" item="bureau_dept_id" open="(" separator="," close=")"> #{bureau_dept_id} </foreach>
</if>
<if test="params.dataScope != null and params.dataScope != ''"> ${params.dataScope} </if>
</select>
<!-- 被执法企业次数排行 -->
<select id="query_enfEnt_sort" parameterType="com.zdxt.enforcementcode.domain.bo.SixAnalysisParamsBo" resultType="map">
SELECT r.enterprise_name, count(1) as cnt FROM enforcement_registration r WHERE r.bureau_dept_name is not null and r.is_submit = 1 and r.law_enforcement_id is not null and r.enterprise_name is not null and r.enterprise_number is not null and r.law_enforcer is not null and r.law_enforcer_two is not null and r.is_complaint is not null and r.check_category is not null and r.bureau_dept_id is not null
<if test="beginTime != null and beginTime != ''"> and r.enforcement_time &gt;= #{beginTime} </if>
<if test="endTime != null and endTime != ''"> and r.enforcement_time &lt; #{endTime} </if>
<if test="zone == 1">and r.zone = 1</if>
<if test="zone == 2">and r.zone is null</if>
<if test="bureauDeptId != null and bureauDeptId != ''"> and r.bureau_dept_id = #{bureauDeptId} </if>
<if test="filterDepts != null and filterDepts.size() > 0">
and r.bureau_dept_id in <foreach collection="filterDepts" item="bureau_dept_id" open="(" separator="," close=")"> #{bureau_dept_id} </foreach>
</if>
<if test="params.dataScope != null and params.dataScope != ''"> ${params.dataScope} </if>
GROUP BY r.enterprise_number order by cnt desc limit #{pageSize}
</select>
<!-- 执法单位执法数量排行 -->
<select id="query_enforcement_sort" parameterType="com.zdxt.enforcementcode.domain.bo.SixAnalysisParamsBo" resultType="map">
SELECT r.bureau_dept_name, count(1) as cnt FROM enforcement_registration r WHERE r.bureau_dept_name is not null and r.is_submit = 1 and r.law_enforcement_id is not null and r.enterprise_name is not null and r.enterprise_number is not null and r.law_enforcer is not null and r.law_enforcer_two is not null and r.is_complaint is not null and r.check_category is not null and r.bureau_dept_id is not null
<if test="beginTime != null and beginTime != ''"> and r.enforcement_time &gt;= #{beginTime} </if>
<if test="endTime != null and endTime != ''"> and r.enforcement_time &lt; #{endTime} </if>
<if test="zone == 1">and r.zone = 1</if>
<if test="zone == 2">and r.zone is null</if>
<if test="filterDepts != null and filterDepts.size() > 0">
and r.bureau_dept_id in <foreach collection="filterDepts" item="bureau_dept_id" open="(" separator="," close=")"> #{bureau_dept_id} </foreach>
</if>
<if test="params.dataScope != null and params.dataScope != ''"> ${params.dataScope} </if>
GROUP BY r.bureau_dept_id order by cnt desc limit #{pageSize}
</select>
<!-- 被投诉单位次数排行 -->
<select id="query_entC_sort" parameterType="com.zdxt.enforcementcode.domain.bo.SixAnalysisParamsBo" resultType="map">
SELECT c.complaint_departments, count(1) as cnt FROM enterprise_complaint c WHERE c.complaint_department_ids IS NOT NULL and c.complaint_departments is not null
<if test="beginTime != null and beginTime != ''"> and c.create_time &gt;= #{beginTime} </if>
<if test="endTime != null and endTime != ''"> and c.create_time &lt; #{endTime} </if>
<if test="bureauDeptId != null and bureauDeptId != ''"> and FIND_IN_SET(#{bureauDeptId}, c.complaint_department_ids) </if>
GROUP BY c.complaint_department_ids order by cnt desc limit #{pageSize}
</select>
<!-- 委托执法数量及占比 -->
<select id="query_auto_rate" parameterType="com.zdxt.enforcementcode.domain.bo.SixAnalysisParamsBo" resultType="long">
SELECT count(1) as cnt FROM enforcement_registration r WHERE r.bureau_dept_name is not null and r.is_submit = 1 and r.law_enforcement_id is not null and r.enterprise_name is not null and r.enterprise_number is not null and r.law_enforcer is not null and r.law_enforcer_two is not null and r.is_complaint is not null and r.check_category is not null and r.bureau_dept_id is not null
<if test="beginTime != null and beginTime != ''"> and r.enforcement_time &gt;= #{beginTime} </if>
<if test="endTime != null and endTime != ''"> and r.enforcement_time &lt; #{endTime} </if>
<if test="zone == 1">and r.zone = 1</if>
<if test="zone == 2">and r.zone is null</if>
<if test="hasAuto != null">and r.has_auto = #{hasAuto}</if>
<if test="filterDepts != null and filterDepts.size() > 0">
and r.bureau_dept_id in <foreach collection="filterDepts" item="bureau_dept_id" open="(" separator="," close=")"> #{bureau_dept_id} </foreach>
</if>
<if test="params.dataScope != null and params.dataScope != ''"> ${params.dataScope} </if>
</select>
<!-- 获取被选取的所有部门id -->
<select id="queryDeptAllByBureauDeptId" parameterType="string" resultType="string">
select dept_id from sys_dept where FIND_IN_SET(#{bureauDeptId}, ancestors) or dept_id = #{bureauDeptId}
</select>
<!-- 获取联合执法的执法单位信息 -->
<select id="queryDuplicateUnionNosByUnion" parameterType="com.zdxt.enforcementcode.domain.bo.SixAnalysisParamsBo" resultType="string">
select r.union_no from enforcement_registration r where union_no is not null and r.bureau_dept_name is not null and r.is_submit = 1 and r.law_enforcement_id is not null and r.enterprise_name is not null and r.enterprise_number is not null and r.law_enforcer is not null and r.law_enforcer_two is not null and r.is_complaint is not null and r.check_category is not null and r.bureau_dept_id is not null
<if test="beginTime != null and beginTime != ''"> and r.enforcement_time &gt;= #{beginTime} </if>
<if test="endTime != null and endTime != ''"> and r.enforcement_time &lt; #{endTime} </if>
<if test="filterDepts != null and filterDepts.size() > 0">
and r.bureau_dept_id in <foreach collection="filterDepts" item="bureau_dept_id" open="(" separator="," close=")"> #{bureau_dept_id} </foreach>
</if>
group by r.union_no having count(1) > 1
</select>
<!-- 获取联合执法的执法单位信息 -->
<select id="queryBureauDeptByUnion" parameterType="string" resultType="map">
select er.law_enforcement_id, er.law_enforcement from enforcement_registration er where er.law_enforcement_id is not null
<if test="unionNos != null and unionNos.size() > 0">
and er.union_no in <foreach collection="unionNos" item="unionNo" open="(" separator="," close=")"> #{unionNo} </foreach>
</if>
</select>
</mapper>

2007
zdxt-modules/zdxt-enforcement-code/src/main/resources/mapper/enforcementcode/StatisticalPanelMapper.xml

File diff suppressed because it is too large

24
zdxt-modules/zdxt-system/src/main/java/org/dromara/system/domain/bo/SysDeptBo.java

@ -10,6 +10,8 @@ import lombok.EqualsAndHashCode;
import org.dromara.common.mybatis.core.domain.BaseEntity;
import org.dromara.system.domain.SysDept;
import java.util.List;
/**
* 部门业务对象 sys_dept
*
@ -73,6 +75,11 @@ public class SysDeptBo extends BaseEntity {
*/
private String status;
/**
* 是否删除
*/
private String isDeleted;
/**
* 归属部门id(部门树)
*/
@ -80,5 +87,20 @@ public class SysDeptBo extends BaseEntity {
private String zzDisplayPath;
private int zone;
private Integer zone;
/**
* 区域列表(用于批量查询)
*/
private List<Integer> zoneList;
/**
* 租户编码
*/
private String tenantCode;
/**
* 部门类型
*/
private String deptType;
}

18
zdxt-modules/zdxt-system/src/main/java/org/dromara/system/domain/vo/SysDeptVo.java

@ -125,5 +125,23 @@ public class SysDeptVo implements Serializable {
*/
private String deptType;
/**
* 所属机构
*/
private String organization;
/**
* 所属机构
*/
private String organizationId;
/**
* 创建者
*/
private String createBy;
/**
* 删除标志(0代表存在 2代表删除)
*/
private String delFlag;
}

6
zdxt-modules/zdxt-system/src/main/java/org/dromara/system/domain/vo/SysUserVo.java

@ -164,4 +164,10 @@ public class SysUserVo implements Serializable {
* 区别是否执法人员
*/
private Boolean lawOfficer;
/**
* 部门
*/
private SysDeptVo dept;
}

13
zdxt-modules/zdxt-system/src/main/java/org/dromara/system/mapper/SysDeptMapper.java

@ -10,6 +10,7 @@ import org.dromara.common.mybatis.annotation.DataPermission;
import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
import org.dromara.common.mybatis.helper.DataBaseHelper;
import org.dromara.system.domain.SysDept;
import org.dromara.system.domain.bo.SysDeptBo;
import org.dromara.system.domain.vo.SysDeptVo;
import java.util.List;
@ -169,4 +170,16 @@ public interface SysDeptMapper extends BaseMapperPlus<SysDept, SysDeptVo> {
SysDeptVo selectDeptById(String deptId);
/**
* 查询部门管理数据
*
* @param bo 部门信息
* @return 部门信息集合
*/
List<SysDeptVo> selectDepts(SysDeptBo bo);
List<SysDeptVo> selectChildrenDept(SysDeptBo bo);
}

15
zdxt-modules/zdxt-system/src/main/java/org/dromara/system/service/ISysDeptService.java

@ -198,5 +198,20 @@ public interface ISysDeptService {
*/
List<SysDeptVo> selectDeptListWithAncestors(SysDeptBo dept);
/**
* 搜索部门
*
* @param bo 部门查询条件
* @return 匹配部门列表
*/
List<SysDeptVo> selectDepts(SysDeptBo bo);
/**
* 获取街道和区县列表
*
* @param bo 部门查询条件
* @return 匹配街道和区县列表
*/
List<SysDeptVo> getStreetAndDistrictList(SysDeptBo bo);
}

7
zdxt-modules/zdxt-system/src/main/java/org/dromara/system/service/ISysUserService.java

@ -256,4 +256,11 @@ public interface ISysUserService {
* @return 用户对象信息
*/
List<SysUserVo> selectUserListByLoginName(String loginName);
/**
* 获取当前用户信息
*
* @return 用户信息
*/
SysUserVo getCurrentUser();
}

21
zdxt-modules/zdxt-system/src/main/java/org/dromara/system/service/impl/SysDeptServiceImpl.java

@ -8,6 +8,7 @@ import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import lombok.RequiredArgsConstructor;
@ -33,7 +34,6 @@ import org.dromara.system.mapper.SysRoleMapper;
import org.dromara.system.mapper.SysUserMapper;
import org.dromara.system.service.ISysDeptService;
import org.dromara.system.service.ISysDictTypeService;
import org.dromara.system.service.ISysDictTypeService;
import org.springframework.cache.annotation.CacheEvict;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.cache.annotation.Caching;
@ -41,8 +41,6 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.*;
import java.util.function.Function;
import java.util.stream.Collectors;
import java.util.stream.Collectors;
/**
@ -240,6 +238,8 @@ public class SysDeptServiceImpl implements ISysDeptService, DeptService {
x.in(SysDept::getDeptId, deptIds);
});
}
lqw.like(StringUtils.isNotBlank(bo.getDeptType()), SysDept::getDeptType, bo.getDeptType());
lqw.eq(ObjectUtil.isNotNull(bo.getZone()) && bo.getZone() != 0, SysDept::getZone, bo.getZone());
return lqw;
}
@ -717,4 +717,19 @@ public class SysDeptServiceImpl implements ISysDeptService, DeptService {
return matchedDepts;
}
@Override
public List<SysDeptVo> selectDepts(SysDeptBo bo) {
List<SysDeptVo> depts = baseMapper.selectDepts(bo);
return depts;
}
@Override
public List<SysDeptVo> getStreetAndDistrictList(SysDeptBo bo) {
List<SysDeptVo> deptList = baseMapper.selectChildrenDept(bo);
return deptList;
}
}

86
zdxt-modules/zdxt-system/src/main/java/org/dromara/system/service/impl/SysUserServiceImpl.java

@ -27,10 +27,7 @@ import org.dromara.system.domain.SysUserPost;
import org.dromara.system.domain.SysUserRole;
import org.dromara.system.domain.bo.QuerySysUserBo;
import org.dromara.system.domain.bo.SysUserBo;
import org.dromara.system.domain.vo.SysPostVo;
import org.dromara.system.domain.vo.SysRoleVo;
import org.dromara.system.domain.vo.SysUserExportVo;
import org.dromara.system.domain.vo.SysUserVo;
import org.dromara.system.domain.vo.*;
import org.dromara.system.mapper.*;
import org.dromara.system.service.ISysUserService;
import org.springframework.cache.annotation.CacheEvict;
@ -814,6 +811,87 @@ public class SysUserServiceImpl implements ISysUserService, UserService {
return baseMapper.selectVoList(lqw);
}
/**
* 获取当前用户信息
*
* @return 用户信息
*/
@Override
public SysUserVo getCurrentUser() {
//User sysUser = ShiroUtils.getSysUser();
//if (null == sysUser) { return null; }
SysUserVo userBean = new SysUserVo();
userBean.setDeptId(LoginHelper.getDeptId());
//userBean.setEmail(LoginHelper.getEmail());
userBean.setLoginName(LoginHelper.getUsername());
//userBean.setParentId(LoginHelper.getParentId());
//userBean.setPhonenumber(LoginHelper.getPhonenumber());
//userBean.setRoleId(LoginHelper.getRoleId());
//userBean.setSex(LoginHelper.getSex());
userBean.setUserId(LoginHelper.getUserId());
userBean.setUserName(LoginHelper.getUsername());
SysUserVo user = baseMapper.selectUserById(LoginHelper.getUserId());
if (user == null) {
return userBean;
}
userBean.setLawCertificateNum(user.getLawCertificateNum());
String[] deptIdArr = new String[]{};
// 设置部门信息
SysDeptVo dept = deptMapper.selectDeptById(LoginHelper.getDeptId());
SysDeptVo deptBean = new SysDeptVo();
//属性赋值
// BeanUtil.copyProperties(sysUser.getDept(),deptBean);
BeanUtil.copyProperties(dept,deptBean);
if (BeanUtil.isNotEmpty(dept)){
deptIdArr = dept.getAncestors()!=null?dept.getAncestors().split(","):new String[]{};
if("0".equals(dept.getDeptType())){
//判断当前人所处部门是否为机构
judgeType(deptBean,dept);
}else{
//当前人所处单位不为机构时,查询他所有上级上级部门
for (int i = 0; i < deptIdArr.length; i++) {
//根据部门id查询详细信息
SysDeptVo dept1 = null;
//字符串为空时不执行转换
if(!"null".equals(deptIdArr[i])){dept1 = deptMapper.selectDeptById(deptIdArr[i]);}
if(BeanUtil.isNotEmpty(dept1)){
//设置机构信息
judgeType(deptBean,dept1);
}
}
}
}
//部门机构信息
userBean.setDept(deptBean);
// 设置角色信息
List<SysRoleVo> roleBeanList = new ArrayList<>();
if (user.getRoles() != null) {
for (SysRoleVo role : user.getRoles()) {
SysRoleVo roleBean = new SysRoleVo();
BeanUtil.copyProperties(role, roleBean);
roleBeanList.add(roleBean);
}
}
userBean.setRoles(roleBeanList);
return userBean;
}
/**
* 判断是否为机构
* @param deptBeanDataSource
* @param dept
*/
public void judgeType(SysDeptVo deptBeanDataSource,SysDeptVo dept){
if("0".equals(dept.getDeptType())){
//机构名称
deptBeanDataSource.setOrganization(dept.getDeptName());
//机构id
deptBeanDataSource.setOrganizationId(dept.getDeptId());
}
}
}

127
zdxt-modules/zdxt-system/src/main/resources/mapper/system/SysDeptMapper.xml

@ -20,4 +20,131 @@
select * from sys_dept
where dept_id = #{deptId}
</select>
<sql id="selectDeptVo">
select
d.dept_id as deptId,
d.parent_id as parentId,
d.ancestors,
d.dept_name as deptName,
d.order_num as orderNum,
d.leader,
d.phone,
d.email,
d.status,
d.del_flag as delFlag,
d.create_by as createBy,
d.create_time as createTime,
dept_type as deptType,
d.kingdee_org_id as kingdeeOrgId,
d.kingdee_org_parent_id as kingdeeOrgParentId,
tenant_code as tenantCode,
organizationId,
organizationParentId,
zzLevel,
code,
mappingUnitParentId,
updateAt,
createAt,
description,
effectOn,
sequence,
isDeleted,
zzDisplayPath,
`name`,
guid,
zzIsLeaf,
isDisabled,
fullname,
isMappingUnit,
srzUnitId,
taskId,
creditcode,
zone,
simpleName,
isStatutoryOrg,
isActive,
unitStatusCode,
unitStatus,
unitType,
xzqhCode,
xzqh,
isCGManager,
isBureauOffice,
unitTypeCode,
dwxzCode,
dwxz,
unitSysTypeCode,
unitSysType,
dwxtlbms,
unitLevelCode,
unitLevel
from
sys_dept d
</sql>
<select id="selectDepts" parameterType="org.dromara.system.domain.bo.SysDeptBo" resultType="org.dromara.system.domain.vo.SysDeptVo">
<include refid="selectDeptVo"/>
where d.del_flag = '0'
<if test='deptId != null and deptId != ""'>
AND dept_id = #{deptId}
</if>
<if test='parentId != null and parentId != ""'>
AND parent_id = #{parentId}
</if>
<if test="deptName != null and deptName != ''">
AND dept_name like concat('%', #{deptName}, '%')
</if>
<if test="isDeleted != null and isDeleted != ''">
AND isDeleted = #{isDeleted}
</if>
<if test="status != null and status != ''">
AND status = #{status}
</if>
<if test="deptType != null and deptType != ''">
AND dept_type = #{deptType}
</if>
<if test="zoneList != null ">
AND zone in
<foreach collection="zoneList" item="item" index="index"
separator="," open="(" close=")">
#{item}
</foreach>
</if>
<if test="zone != null">
AND zone = #{zone}
</if>
<if test="zzDisplayPath != null and zzDisplayPath != ''">
AND zzDisplayPath = #{zzDisplayPath}
</if>
<!-- 租户数据过滤 -->
<!-- <if test="tenantCode != null and tenantCode != ''">
AND d.tenant_code = #{tenantCode}
</if>-->
<!-- 数据范围过滤 -->
<!-- <if test="params.dataScope != null and params.dataScope != ''">
${params.dataScope}
</if>
-->
order by d.parent_id, d.order_num
</select>
<select id="selectChildrenDept" parameterType="org.dromara.system.domain.bo.SysDeptBo" resultType="org.dromara.system.domain.vo.SysDeptVo">
select * from sys_dept where find_in_set(#{deptId}, ancestors)
<if test="deptType != null">
AND dept_type = #{deptType}
</if>
<if test="status != null">
AND status = #{status}
</if>
<if test="zoneList != null ">
and creditcode is not null
AND zone in
<foreach collection="zoneList" item="item" index="index"
separator="," open="(" close=")">
#{item}
</foreach>
</if>
</select>
</mapper>

Loading…
Cancel
Save