Browse Source

监督端-综合分析1部分接口

v6
zouyx 1 year ago
parent
commit
aca591255f
  1. 117
      lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/java/com/zdxt/code/domain/ComprehensiveAnalysis.java
  2. 88
      lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/java/com/zdxt/code/mapper/ComprehensiveAnalysisMapper.java
  3. 44
      lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/java/com/zdxt/code/service/ComprehensiveAnalysisService.java
  4. 267
      lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/java/com/zdxt/code/service/impl/ComprehensiveAnalysisServiceImpl.java
  5. 476
      lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/resources/mapper/ComprehensiveAnalysisMapper.xml

117
lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/java/com/zdxt/code/domain/ComprehensiveAnalysis.java

@ -8,6 +8,8 @@ public class ComprehensiveAnalysis {
* 企业社会统一信用代码
*/
private String enterpriseNumber;
private String enterpriseName;
private String enterpriseAddress;
/**
* 检查类型
*/
@ -23,6 +25,9 @@ public class ComprehensiveAnalysis {
*/
private String complaintType;
private Integer complaintTypeNumber;
/**
* 投诉数量
*/
private Integer complaintTotal;
/**
* 评论数量
@ -59,6 +64,7 @@ public class ComprehensiveAnalysis {
private Long userId;
private String bureauDeptId;
private String bureauDeptName;
/**
* user or bureauDept
*/
@ -73,6 +79,29 @@ public class ComprehensiveAnalysis {
private Integer day;
private String beginTime;
private String endTime;
private String qy;
private String jd;
private Integer limit;
/**
* 涉企检查数量
*/
private Integer registrationTotal;
/**
* 联合检查数量
*/
private Integer uniteTotal;
/**
* 执法检查预告数量
*/
private Integer noticeTotal;
/**
* 执法预警数量
*/
private Integer warningTotal;
/**
* 企业数量
*/
private Integer enterpriseTotal;
public String getCheckCategory() {
return checkCategory;
@ -347,4 +376,92 @@ public class ComprehensiveAnalysis {
public void setEnterpriseNumber(String enterpriseNumber) {
this.enterpriseNumber = enterpriseNumber;
}
public Integer getLimit() {
return limit;
}
public void setLimit(Integer limit) {
this.limit = limit;
}
public String getEnterpriseName() {
return enterpriseName;
}
public void setEnterpriseName(String enterpriseName) {
this.enterpriseName = enterpriseName;
}
public String getEnterpriseAddress() {
return enterpriseAddress;
}
public void setEnterpriseAddress(String enterpriseAddress) {
this.enterpriseAddress = enterpriseAddress;
}
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 Integer getRegistrationTotal() {
return registrationTotal;
}
public void setRegistrationTotal(Integer registrationTotal) {
this.registrationTotal = registrationTotal;
}
public Integer getUniteTotal() {
return uniteTotal;
}
public void setUniteTotal(Integer uniteTotal) {
this.uniteTotal = uniteTotal;
}
public Integer getNoticeTotal() {
return noticeTotal;
}
public void setNoticeTotal(Integer noticeTotal) {
this.noticeTotal = noticeTotal;
}
public Integer getWarningTotal() {
return warningTotal;
}
public void setWarningTotal(Integer warningTotal) {
this.warningTotal = warningTotal;
}
public Integer getEnterpriseTotal() {
return enterpriseTotal;
}
public void setEnterpriseTotal(Integer enterpriseTotal) {
this.enterpriseTotal = enterpriseTotal;
}
public String getBureauDeptName() {
return bureauDeptName;
}
public void setBureauDeptName(String bureauDeptName) {
this.bureauDeptName = bureauDeptName;
}
}

88
lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/java/com/zdxt/code/mapper/ComprehensiveAnalysisMapper.java

@ -9,6 +9,7 @@ public interface ComprehensiveAnalysisMapper {
* 获取执法记录关联企业信息本时段
* @param comprehensiveAnalysis
* @return
* 企业名称使用的执法表内非企业表
*/
List<ComprehensiveAnalysis> primarySectionA(ComprehensiveAnalysis comprehensiveAnalysis);
@ -47,4 +48,91 @@ public interface ComprehensiveAnalysisMapper {
* @return
*/
List<ComprehensiveAnalysis> complaintTypeList(ComprehensiveAnalysis comprehensiveAnalysis);
/**
* 获取执法预告关联企业信息本时段
* @param comprehensiveAnalysis
* @return
*/
List<ComprehensiveAnalysis> primaryNotice(ComprehensiveAnalysis comprehensiveAnalysis);
/**
* 获取执法预告关联企业信息环比时段
* @param comprehensiveAnalysis
* @return
*/
List<ComprehensiveAnalysis> huanNotice(ComprehensiveAnalysis comprehensiveAnalysis);
/**
* 获取执法预告关联企业信息同比时段
* @param comprehensiveAnalysis
* @return
*/
List<ComprehensiveAnalysis> tongNotice(ComprehensiveAnalysis comprehensiveAnalysis);
/**
* 获取执法投诉统计表关联企业信息本时段
* @param comprehensiveAnalysis
* @return
* 字段企业信息投诉类型
*/
List<ComprehensiveAnalysis> primaryComplaint(ComprehensiveAnalysis comprehensiveAnalysis);
/**
* 获取执法投诉统计表关联企业信息环比时段
* @param comprehensiveAnalysis
* @return
*/
List<ComprehensiveAnalysis> huanComplaint(ComprehensiveAnalysis comprehensiveAnalysis);
/**
* 获取执法投诉统计表关联企业信息同比时段
* @param comprehensiveAnalysis
* @return
*/
List<ComprehensiveAnalysis> tongComplaint(ComprehensiveAnalysis comprehensiveAnalysis);
/**
* 获取执法预警本企业关联企业信息本时段
* @param comprehensiveAnalysis
* @return
*/
List<ComprehensiveAnalysis> primaryWarning(ComprehensiveAnalysis comprehensiveAnalysis);
/**
* 获取执法预警本企业关联企业信息环比时段
* @param comprehensiveAnalysis
* @return
*/
List<ComprehensiveAnalysis> huanWarning(ComprehensiveAnalysis comprehensiveAnalysis);
/**
* 获取执法预警本企业关联企业信息同比时段
* @param comprehensiveAnalysis
* @return
*/
List<ComprehensiveAnalysis> tongWarning(ComprehensiveAnalysis comprehensiveAnalysis);
/**
* 获取企业信息本时段
* @param comprehensiveAnalysis
* @return
*/
List<ComprehensiveAnalysis> primaryEnterprise(ComprehensiveAnalysis comprehensiveAnalysis);
/**
* 获取企业信息环比时段
* @param comprehensiveAnalysis
* @return
*/
List<ComprehensiveAnalysis> huanEnterprise(ComprehensiveAnalysis comprehensiveAnalysis);
/**
* 获取企业信息同比时段
* @param comprehensiveAnalysis
* @return
*/
List<ComprehensiveAnalysis> tongEnterprise(ComprehensiveAnalysis comprehensiveAnalysis);
List<ComprehensiveAnalysis> complaintGetBureauDept(ComprehensiveAnalysis comprehensiveAnalysis);
}

44
lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/java/com/zdxt/code/service/ComprehensiveAnalysisService.java

@ -2,8 +2,52 @@ package com.zdxt.code.service;
import com.zdxt.code.domain.ComprehensiveAnalysis;
import java.util.List;
public interface ComprehensiveAnalysisService {
ComprehensiveAnalysis whole(ComprehensiveAnalysis comprehensiveAnalysis);
String getBureauDeptId(ComprehensiveAnalysis comprehensiveAnalysis);
/**
* web:获取六项指标同环比
*/
List<ComprehensiveAnalysis> sixIndicators(ComprehensiveAnalysis comprehensiveAnalysis);
/**
* web:获取各区域六项指标本时段
*/
List<ComprehensiveAnalysis> sixIndicatorsGroupByQY(ComprehensiveAnalysis comprehensiveAnalysis);
/**
* web:获取各街道六项指标本时段
*/
List<ComprehensiveAnalysis> sixIndicatorsGroupByJD(ComprehensiveAnalysis comprehensiveAnalysis);
/**
* web:检查类型图
*/
List<ComprehensiveAnalysis> checkCategoryList(ComprehensiveAnalysis comprehensiveAnalysis);
/**
* web:企业类型图
*/
List<ComprehensiveAnalysis> companyOrgTypeList(ComprehensiveAnalysis comprehensiveAnalysis);
/**
* web:投诉类型图
*/
List<ComprehensiveAnalysis> complaintTypeList(ComprehensiveAnalysis comprehensiveAnalysis);
/**
* web被检查企业次数排名
*/
List<ComprehensiveAnalysis> registrationNumberRankingByEnterprise(ComprehensiveAnalysis comprehensiveAnalysis);
/**
* web被投诉主体排名
*/
List<ComprehensiveAnalysis> complaintNumberRankingByBureauDept(ComprehensiveAnalysis comprehensiveAnalysis);
/**
* web主体检查次数排名
*/
List<ComprehensiveAnalysis> registrationNumberRankingByBureauDept(ComprehensiveAnalysis comprehensiveAnalysis);
}

267
lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/java/com/zdxt/code/service/impl/ComprehensiveAnalysisServiceImpl.java

@ -83,6 +83,267 @@ public class ComprehensiveAnalysisServiceImpl implements ComprehensiveAnalysisSe
}
}
/**
*
* @param comprehensiveAnalysis(区域需做前置处理转成字符串
* @return
*/
@Override
public List<ComprehensiveAnalysis> sixIndicators(ComprehensiveAnalysis comprehensiveAnalysis) {
List<ComprehensiveAnalysis> comprehensiveAnalysisList=new ArrayList<>();
//涉企检查数量
ComprehensiveAnalysis registrationCA=new ComprehensiveAnalysis();
//涉企检查数量本时段
List<ComprehensiveAnalysis> registrationNowList=comprehensiveAnalysisMapper.primarySectionA(comprehensiveAnalysis);
//涉企检查数量环比时段
List<ComprehensiveAnalysis> registrationHuanList=comprehensiveAnalysisMapper.huanSectionA(comprehensiveAnalysis);
//涉企检查数量同比时段
List<ComprehensiveAnalysis> registrationTongList=comprehensiveAnalysisMapper.tongSectionA(comprehensiveAnalysis);
registrationCA.setName("registration");
registrationCA.setTotal(registrationNowList.size());
registrationCA.setHuanPercentage((double)(registrationHuanList.size()- registrationNowList.size())/registrationHuanList.size());
registrationCA.setTongPercentage((double)(registrationTongList.size()- registrationNowList.size())/registrationTongList.size());
comprehensiveAnalysisList.add(registrationCA);
//联合检查数量
ComprehensiveAnalysis unitCA=new ComprehensiveAnalysis();
unitCA.setName("unitCheck");
comprehensiveAnalysisList.add(unitCA);
//行政检查预告
ComprehensiveAnalysis noticeCA=new ComprehensiveAnalysis();
//行政检查预告本时段
List<ComprehensiveAnalysis> noticeNowList=comprehensiveAnalysisMapper.primaryNotice(comprehensiveAnalysis);
//行政检查预告环比时段
List<ComprehensiveAnalysis> noticeHuanList=comprehensiveAnalysisMapper.huanNotice(comprehensiveAnalysis);
//行政检查预告同比时段
List<ComprehensiveAnalysis> noticeTongList=comprehensiveAnalysisMapper.tongNotice(comprehensiveAnalysis);
noticeCA.setName("notice");
noticeCA.setTotal(noticeNowList.size());
noticeCA.setHuanPercentage((double)(noticeHuanList.size()- noticeNowList.size())/ noticeHuanList.size());
noticeCA.setTongPercentage((double)(noticeTongList.size()- noticeNowList.size())/ noticeTongList.size());
comprehensiveAnalysisList.add(noticeCA);
//涉企投诉数量
ComprehensiveAnalysis complaintCA=new ComprehensiveAnalysis();
//涉企投诉数量本时段
List<ComprehensiveAnalysis> complaintNowList=comprehensiveAnalysisMapper.primaryComplaint(comprehensiveAnalysis);
//涉企投诉数量环比时段
List<ComprehensiveAnalysis> complaintHuanList=comprehensiveAnalysisMapper.huanComplaint(comprehensiveAnalysis);
//涉企投诉数量同比时段
List<ComprehensiveAnalysis> complaintTongList=comprehensiveAnalysisMapper.tongComplaint(comprehensiveAnalysis);
complaintCA.setName("complaint");
complaintCA.setTotal(complaintNowList.size());
complaintCA.setHuanPercentage((double)(complaintHuanList.size()-complaintNowList.size())/complaintHuanList.size());
complaintCA.setTongPercentage((double)(complaintTongList.size()-complaintNowList.size())/complaintTongList.size());
comprehensiveAnalysisList.add(complaintCA);
//执法预警
ComprehensiveAnalysis warningCA=new ComprehensiveAnalysis();
//执法预警本时段
List<ComprehensiveAnalysis> warningNowList=comprehensiveAnalysisMapper.primaryWarning(comprehensiveAnalysis);
//执法预警环比时段
List<ComprehensiveAnalysis> warningHuanList=comprehensiveAnalysisMapper.huanWarning(comprehensiveAnalysis);
//执法预警同比时段
List<ComprehensiveAnalysis> warningTongList=comprehensiveAnalysisMapper.tongWarning(comprehensiveAnalysis);
warningCA.setName("warning");
warningCA.setTotal(warningNowList.size());
warningCA.setHuanPercentage((double)(warningHuanList.size()- warningNowList.size())/warningHuanList.size());
warningCA.setTongPercentage((double)(warningTongList.size()-warningNowList.size())/ warningTongList.size());
comprehensiveAnalysisList.add(warningCA);
//企业数量
ComprehensiveAnalysis enterpriseCA=new ComprehensiveAnalysis();
//企业数量本时段
List<ComprehensiveAnalysis> enterpriseNowList=comprehensiveAnalysisMapper.primaryEnterprise(comprehensiveAnalysis);
//企业数量环比时段
List<ComprehensiveAnalysis> enterpriseHuanList=comprehensiveAnalysisMapper.huanEnterprise(comprehensiveAnalysis);
//企业数量同比时段
List<ComprehensiveAnalysis> enterpriseTongList=comprehensiveAnalysisMapper.tongEnterprise(comprehensiveAnalysis);
enterpriseCA.setName("complaint");
enterpriseCA.setTotal(enterpriseNowList.size());
enterpriseCA.setHuanPercentage((double)(enterpriseHuanList.size()-enterpriseNowList.size())/enterpriseHuanList.size());
enterpriseCA.setTongPercentage((double)(enterpriseTongList.size()-enterpriseNowList.size())/enterpriseTongList.size());
comprehensiveAnalysisList.add(enterpriseCA);
return comprehensiveAnalysisList;
}
@Override
public List<ComprehensiveAnalysis> sixIndicatorsGroupByQY(ComprehensiveAnalysis comprehensiveAnalysis) {
//区域数组,一个区域为一个对象
List<ComprehensiveAnalysis> comprehensiveAnalysisList=new ArrayList<>();
//涉企检查数量本时段
List<ComprehensiveAnalysis> registrationList=comprehensiveAnalysisMapper.primarySectionA(comprehensiveAnalysis).stream().filter(item->!Objects.isNull(item)&&item.getEnterpriseAddress()!=null&&!item.getEnterpriseAddress().isEmpty()).collect(Collectors.toList());
//联合检查数量
//行政检查预告本时段
List<ComprehensiveAnalysis> noticeList=comprehensiveAnalysisMapper.primaryNotice(comprehensiveAnalysis).stream().filter(item->!Objects.isNull(item)&&item.getEnterpriseAddress()!=null&&!item.getEnterpriseAddress().isEmpty()).collect(Collectors.toList());
//涉企投诉数量本时段
List<ComprehensiveAnalysis> complaintList=comprehensiveAnalysisMapper.primaryComplaint(comprehensiveAnalysis).stream().filter(item->!Objects.isNull(item)&&item.getEnterpriseAddress()!=null&&!item.getEnterpriseAddress().isEmpty()).collect(Collectors.toList());
//执法预警本时段
List<ComprehensiveAnalysis> warningList=comprehensiveAnalysisMapper.primaryWarning(comprehensiveAnalysis).stream().filter(item->!Objects.isNull(item)&&item.getEnterpriseAddress()!=null&&!item.getEnterpriseAddress().isEmpty()).collect(Collectors.toList());
//企业数量本时段
List<ComprehensiveAnalysis> enterpriseList=comprehensiveAnalysisMapper.primaryEnterprise(comprehensiveAnalysis).stream().filter(item->!Objects.isNull(item)&&item.getEnterpriseAddress()!=null&&!item.getEnterpriseAddress().isEmpty()).collect(Collectors.toList());
List<String> qyStrList=new ArrayList<>();
if(comprehensiveAnalysis.getQy()==null|| comprehensiveAnalysis.getQy().isEmpty()){
qyStrList=dictDataMapper.selectDictDataByType("address_type").stream().map(DictData::getDictLabel).collect(Collectors.toList());
}else{
qyStrList.add(comprehensiveAnalysis.getQy());
}
for(String string:qyStrList){
ComprehensiveAnalysis qyCA=new ComprehensiveAnalysis();
qyCA.setName(string);
qyCA.setRegistrationTotal(registrationList.stream().filter(item -> item.getEnterpriseAddress().startsWith("深圳市" + string.substring(0, string.indexOf("区")) + "区") || item.getEnterpriseAddress().startsWith("深圳市" + string.substring(0, string.indexOf("区")) + "新区")).collect(Collectors.toList()).size());
qyCA.setNoticeTotal(noticeList.stream().filter(item -> item.getEnterpriseAddress().startsWith("深圳市" + string.substring(0, string.indexOf("区")) + "区") || item.getEnterpriseAddress().startsWith("深圳市" + string.substring(0, string.indexOf("区")) + "新区")).collect(Collectors.toList()).size());
qyCA.setComplaintTotal(complaintList.stream().filter(item -> item.getEnterpriseAddress().startsWith("深圳市" + string.substring(0, string.indexOf("区")) + "区") || item.getEnterpriseAddress().startsWith("深圳市" + string.substring(0, string.indexOf("区")) + "新区")).collect(Collectors.toList()).size());
qyCA.setWarningTotal(warningList.stream().filter(item -> item.getEnterpriseAddress().startsWith("深圳市" + string.substring(0, string.indexOf("区")) + "区") || item.getEnterpriseAddress().startsWith("深圳市" + string.substring(0, string.indexOf("区")) + "新区")).collect(Collectors.toList()).size());
qyCA.setEnterpriseTotal(enterpriseList.stream().filter(item -> item.getEnterpriseAddress().startsWith("深圳市" + string.substring(0, string.indexOf("区")) + "区") || item.getEnterpriseAddress().startsWith("深圳市" + string.substring(0, string.indexOf("区")) + "新区")).collect(Collectors.toList()).size());
comprehensiveAnalysisList.add(qyCA);
/*
registrationList=registrationList.stream().filter(item -> !item.getEnterpriseAddress().startsWith("深圳市" + string.substring(0, string.indexOf("区")) + "区") && !item.getEnterpriseAddress().startsWith("深圳市" + string.substring(0, string.indexOf("区")) + "新区")).collect(Collectors.toList());
noticeList=noticeList.stream().filter(item -> !item.getEnterpriseAddress().startsWith("深圳市" + string.substring(0, string.indexOf("区")) + "区") && !item.getEnterpriseAddress().startsWith("深圳市" + string.substring(0, string.indexOf("区")) + "新区")).collect(Collectors.toList());
complaintList=complaintList.stream().filter(item -> !item.getEnterpriseAddress().startsWith("深圳市" + string.substring(0, string.indexOf("区")) + "区") && !item.getEnterpriseAddress().startsWith("深圳市" + string.substring(0, string.indexOf("区")) + "新区")).collect(Collectors.toList());
warningList=warningList.stream().filter(item -> !item.getEnterpriseAddress().startsWith("深圳市" + string.substring(0, string.indexOf("区")) + "区") && !item.getEnterpriseAddress().startsWith("深圳市" + string.substring(0, string.indexOf("区")) + "新区")).collect(Collectors.toList());
enterpriseList=enterpriseList.stream().filter(item -> !item.getEnterpriseAddress().startsWith("深圳市" + string.substring(0, string.indexOf("区")) + "区") && !item.getEnterpriseAddress().startsWith("深圳市" + string.substring(0, string.indexOf("区")) + "新区")).collect(Collectors.toList());
*/
}
return comprehensiveAnalysisList;
}
@Override
public List<ComprehensiveAnalysis> sixIndicatorsGroupByJD(ComprehensiveAnalysis comprehensiveAnalysis) {
//区域数组,一个区域为一个对象
List<ComprehensiveAnalysis> comprehensiveAnalysisList=new ArrayList<>();
//涉企检查数量本时段
List<ComprehensiveAnalysis> registrationList=comprehensiveAnalysisMapper.primarySectionA(comprehensiveAnalysis).stream().filter(item->!Objects.isNull(item)&&item.getEnterpriseAddress()!=null&&!item.getEnterpriseAddress().isEmpty()).collect(Collectors.toList());
//联合检查数量
//行政检查预告本时段
List<ComprehensiveAnalysis> noticeList=comprehensiveAnalysisMapper.primaryNotice(comprehensiveAnalysis).stream().filter(item->!Objects.isNull(item)&&item.getEnterpriseAddress()!=null&&!item.getEnterpriseAddress().isEmpty()).collect(Collectors.toList());
//涉企投诉数量本时段
List<ComprehensiveAnalysis> complaintList=comprehensiveAnalysisMapper.primaryComplaint(comprehensiveAnalysis).stream().filter(item->!Objects.isNull(item)&&item.getEnterpriseAddress()!=null&&!item.getEnterpriseAddress().isEmpty()).collect(Collectors.toList());
//执法预警本时段
List<ComprehensiveAnalysis> warningList=comprehensiveAnalysisMapper.primaryWarning(comprehensiveAnalysis).stream().filter(item->!Objects.isNull(item)&&item.getEnterpriseAddress()!=null&&!item.getEnterpriseAddress().isEmpty()).collect(Collectors.toList());
//企业数量本时段
List<ComprehensiveAnalysis> enterpriseList=comprehensiveAnalysisMapper.primaryEnterprise(comprehensiveAnalysis).stream().filter(item->!Objects.isNull(item)&&item.getEnterpriseAddress()!=null&&!item.getEnterpriseAddress().isEmpty()).collect(Collectors.toList());
List<String> addressStrList=new ArrayList<>();
if(comprehensiveAnalysis.getQy()==null|| comprehensiveAnalysis.getQy().isEmpty()){
List<DictData> qyList=dictDataMapper.selectDictDataByType("address_type");
for(DictData qy:qyList){
List<DictData>jdList=dictDataMapper.selectDictDataByType(qy.getDictValue());
for(DictData jd:jdList){
addressStrList.add(qy.getDictLabel()+jd.getDictLabel());
}
}
}else{
if(comprehensiveAnalysis.getJd()==null|| comprehensiveAnalysis.getJd().isEmpty()){
DictData dictData=new DictData();
dictData.setDictType("address_type");
dictData.setDictLabel(comprehensiveAnalysis.getQy());
DictData qy=dictDataMapper.selectDictData(dictData);
List<DictData> jdList=dictDataMapper.selectDictDataByType(qy.getDictValue());
for(DictData jd:jdList){
addressStrList.add(comprehensiveAnalysis.getQy()+jd.getDictLabel());
}
}else{
addressStrList.add(comprehensiveAnalysis.getQy()+comprehensiveAnalysis.getJd());
}
}
for(String string:addressStrList){
/*
System.out.println(string);
System.out.println("深圳市" + string.substring(0, string.indexOf("区")) + "区"+ string.substring(string.indexOf("区")+1));
System.out.println("深圳市" + string.substring(0, string.indexOf("区")) + "新区"+ string.substring(string.indexOf("区")+1));
*/
ComprehensiveAnalysis qyCA=new ComprehensiveAnalysis();
qyCA.setName(string);
qyCA.setRegistrationTotal(registrationList.stream().filter(item -> item.getEnterpriseAddress().startsWith("深圳市" + string.substring(0, string.indexOf("区")) + "区"+ string.substring(string.indexOf("区")+1)) || item.getEnterpriseAddress().startsWith("深圳市" + string.substring(0, string.indexOf("区")) + "新区"+ string.substring(string.indexOf("区")+1))).collect(Collectors.toList()).size());
qyCA.setNoticeTotal(noticeList.stream().filter(item -> item.getEnterpriseAddress().startsWith("深圳市" + string.substring(0, string.indexOf("区")) + "区"+ string.substring(string.indexOf("区")+1)) || item.getEnterpriseAddress().startsWith("深圳市" + string.substring(0, string.indexOf("区")) + "新区"+ string.substring(string.indexOf("区")+1))).collect(Collectors.toList()).size());
qyCA.setComplaintTotal(complaintList.stream().filter(item -> item.getEnterpriseAddress().startsWith("深圳市" + string.substring(0, string.indexOf("区")) + "区"+ string.substring(string.indexOf("区")+1)) || item.getEnterpriseAddress().startsWith("深圳市" + string.substring(0, string.indexOf("区")) + "新区"+ string.substring(string.indexOf("区")+1))).collect(Collectors.toList()).size());
qyCA.setWarningTotal(warningList.stream().filter(item -> item.getEnterpriseAddress().startsWith("深圳市" + string.substring(0, string.indexOf("区")) + "区"+ string.substring(string.indexOf("区")+1)) || item.getEnterpriseAddress().startsWith("深圳市" + string.substring(0, string.indexOf("区")) + "新区"+ string.substring(string.indexOf("区")+1))).collect(Collectors.toList()).size());
qyCA.setEnterpriseTotal(enterpriseList.stream().filter(item -> item.getEnterpriseAddress().startsWith("深圳市" + string.substring(0, string.indexOf("区")) + "区"+ string.substring(string.indexOf("区")+1)) || item.getEnterpriseAddress().startsWith("深圳市" + string.substring(0, string.indexOf("区")) + "新区"+ string.substring(string.indexOf("区")+1))).collect(Collectors.toList()).size());
comprehensiveAnalysisList.add(qyCA);
/*
registrationList=registrationList.stream().filter(item -> !item.getEnterpriseAddress().startsWith("深圳市" + string.substring(0, string.indexOf("区")) + "区"+ string.substring(string.indexOf("区")+1) && !item.getEnterpriseAddress().startsWith("深圳市" + string.substring(0, string.indexOf("区")) + "新区"+ string.substring(string.indexOf("区")+1))).collect(Collectors.toList());
noticeList=noticeList.stream().filter(item -> !item.getEnterpriseAddress().startsWith("深圳市" + string.substring(0, string.indexOf("区")) + "区"+ string.substring(string.indexOf("区")+1) && !item.getEnterpriseAddress().startsWith("深圳市" + string.substring(0, string.indexOf("区")) + "新区"+ string.substring(string.indexOf("区")+1))).collect(Collectors.toList());
complaintList=complaintList.stream().filter(item -> !item.getEnterpriseAddress().startsWith("深圳市" + string.substring(0, string.indexOf("区")) + "区"+ string.substring(string.indexOf("区")+1) && !item.getEnterpriseAddress().startsWith("深圳市" + string.substring(0, string.indexOf("区")) + "新区"+ string.substring(string.indexOf("区")+1))).collect(Collectors.toList());
warningList=warningList.stream().filter(item -> !item.getEnterpriseAddress().startsWith("深圳市" + string.substring(0, string.indexOf("区")) + "区"+ string.substring(string.indexOf("区")+1) && !item.getEnterpriseAddress().startsWith("深圳市" + string.substring(0, string.indexOf("区")) + "新区"+ string.substring(string.indexOf("区")+1))).collect(Collectors.toList());
enterpriseList=enterpriseList.stream().filter(item -> !item.getEnterpriseAddress().startsWith("深圳市" + string.substring(0, string.indexOf("区")) + "区"+ string.substring(string.indexOf("区")+1) && !item.getEnterpriseAddress().startsWith("深圳市" + string.substring(0, string.indexOf("区")) + "新区"+ string.substring(string.indexOf("区")+1))).collect(Collectors.toList());
*/
}
return comprehensiveAnalysisList;
}
@Override
public List<ComprehensiveAnalysis> checkCategoryList(ComprehensiveAnalysis comprehensiveAnalysis) {
List<ComprehensiveAnalysis> comprehensiveAnalysisList=comprehensiveAnalysisMapper.primarySectionA(comprehensiveAnalysis);
comprehensiveAnalysisList=getCheckCategoryList(comprehensiveAnalysisList);
return comprehensiveAnalysisList;
}
@Override
public List<ComprehensiveAnalysis> companyOrgTypeList(ComprehensiveAnalysis comprehensiveAnalysis) {
List<ComprehensiveAnalysis> comprehensiveAnalysisList=comprehensiveAnalysisMapper.primaryEnterprise(comprehensiveAnalysis);
comprehensiveAnalysisList=getCompanyOrgTypeList(comprehensiveAnalysisList);
return comprehensiveAnalysisList;
}
@Override
public List<ComprehensiveAnalysis> complaintTypeList(ComprehensiveAnalysis comprehensiveAnalysis) {
List<ComprehensiveAnalysis> comprehensiveAnalysisList=comprehensiveAnalysisMapper.primaryComplaint(comprehensiveAnalysis);
comprehensiveAnalysisList=getCompanyOrgTypeList(comprehensiveAnalysisList);
return comprehensiveAnalysisList;
}
/**
* 被检查企业受检次数排名
* @param comprehensiveAnalysis
* @return
*/
@Override
public List<ComprehensiveAnalysis> registrationNumberRankingByEnterprise(ComprehensiveAnalysis comprehensiveAnalysis) {
List<ComprehensiveAnalysis> comprehensiveAnalysisList=comprehensiveAnalysisMapper.primarySectionA(comprehensiveAnalysis);
Map<String, List<ComprehensiveAnalysis>> enterpriseMap=comprehensiveAnalysisList.stream().collect(Collectors.groupingBy(ComprehensiveAnalysis::getEnterpriseNumber));
Map<String, Long> registrationNumberMap=comprehensiveAnalysisList.stream().collect(Collectors.groupingBy(ComprehensiveAnalysis::getEnterpriseNumber,Collectors.counting()));
Map<String, Long> sortMap=registrationNumberMap.entrySet().stream().sorted(Map.Entry.comparingByValue(Comparator.reverseOrder()))
.collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue,
(oldValue, newValue) -> oldValue, LinkedHashMap::new));
List<ComprehensiveAnalysis> list=new ArrayList<>();
for(String string:sortMap.keySet()){
ComprehensiveAnalysis ca=new ComprehensiveAnalysis();
ca.setName(enterpriseMap.get(string).get(0).getEnterpriseName());
ca.setTotal(Integer.parseInt(sortMap.get(string)+""));
list.add(ca);
}
return list;
}
/**
* 被投诉部门排名
* @param comprehensiveAnalysis
* @return
*/
@Override
public List<ComprehensiveAnalysis> complaintNumberRankingByBureauDept(ComprehensiveAnalysis comprehensiveAnalysis) {
return comprehensiveAnalysisMapper.complaintGetBureauDept(comprehensiveAnalysis);
}
/**
* 主体检查数量排名
* @param comprehensiveAnalysis
* @return
*/
@Override
public List<ComprehensiveAnalysis> registrationNumberRankingByBureauDept(ComprehensiveAnalysis comprehensiveAnalysis) {
List<ComprehensiveAnalysis> comprehensiveAnalysisList=comprehensiveAnalysisMapper.primarySectionA(comprehensiveAnalysis);
Map<String, List<ComprehensiveAnalysis>> bureauDeptMap=comprehensiveAnalysisList.stream().collect(Collectors.groupingBy(ComprehensiveAnalysis::getBureauDeptId));
Map<String, Long> registrationNumberMap=comprehensiveAnalysisList.stream().collect(Collectors.groupingBy(ComprehensiveAnalysis::getBureauDeptId,Collectors.counting()));
Map<String, Long> sortMap=registrationNumberMap.entrySet().stream().sorted(Map.Entry.comparingByValue(Comparator.reverseOrder()))
.collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue,
(oldValue, newValue) -> oldValue, LinkedHashMap::new));
List<ComprehensiveAnalysis> list=new ArrayList<>();
for(String string:sortMap.keySet()){
ComprehensiveAnalysis ca=new ComprehensiveAnalysis();
ca.setName(bureauDeptMap.get(string).get(0).getBureauDeptName());
ca.setTotal(Integer.parseInt(sortMap.get(string)+""));
list.add(ca);
}
return list;
}
public List<ComprehensiveAnalysis> getCheckCategoryList(List<ComprehensiveAnalysis> registrationList) {
int num = registrationList.size();
List<ComprehensiveAnalysis> checkCategoryList = new ArrayList<>();
@ -112,9 +373,9 @@ public class ComprehensiveAnalysisServiceImpl implements ComprehensiveAnalysisSe
List<ComprehensiveAnalysis> companyOrgTypeList = new ArrayList<>();
//企业类型字典
List<DictData> dictDataList = dictDataMapper.selectDictDataByType("enterpriseType");
//筛出社会统一信用代码为空
List<ComprehensiveAnalysis> companyOrgTypeIsNullList = registrationList.stream().filter(item -> item.getCompanyOrgType() == null || item.getCompanyOrgType().equals("")).collect(Collectors.toList());
registrationList = registrationList.stream().filter(item -> item.getCompanyOrgType() != null && !item.getCompanyOrgType().equals("")).collect(Collectors.toList());
//筛出企业类型为空
List<ComprehensiveAnalysis> companyOrgTypeIsNullList = registrationList.stream().filter(item -> Objects.isNull(item)||item.getCompanyOrgType() == null || item.getCompanyOrgType().isEmpty()).collect(Collectors.toList());
registrationList = registrationList.stream().filter(item -> !Objects.isNull(item)&&item.getCompanyOrgType() != null && !item.getCompanyOrgType().equals("")).collect(Collectors.toList());
//企业去重
Map<String, List<ComprehensiveAnalysis>> enterpriseMap = registrationList.stream().collect(Collectors.groupingBy(item -> item.getEnterpriseNumber()));
List<ComprehensiveAnalysis> enterpriseList = new ArrayList<>();

476
lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/resources/mapper/ComprehensiveAnalysisMapper.xml

@ -6,20 +6,34 @@
<resultMap type="com.zdxt.code.domain.ComprehensiveAnalysis" id="ComprehensiveAnalysisResult">
<result property="enterpriseNumber" column="enterprise_number" />
<result property="enterpriseName" column="enterprise_name" />
<result property="enterpriseAddress" column="enterprise_address" />
<result property="checkCategory" column="check_category" />
<result property="companyOrgType" column="company_org_type" />
<result property="complaintType" column="complaint_type" />
<result property="bureauDeptId" column="bureau_dept_id" />
<result property="bureauDeptName" column="bureau_dept_name" />
</resultMap>
<select id="primarySectionA" parameterType="ComprehensiveAnalysis" resultMap="ComprehensiveAnalysisResult">
select r.check_category, e.company_org_type,e.enterprise_number
select r.check_category, e.company_org_type,r.enterprise_number,r.enterprise_name,e.enterprise_address,r.bureau_dept_id,r.bureau_dept_name
from enforcement_registration r
left join enterprise_information e
left join (select * from enterprise_information group by enterprise_number) e
on r.enterprise_number = e.enterprise_number
<where>
and r.enterprise_number is not null
and r.check_category is not null
<if test="userId != null and userId != '' ">and( r.law_enforcer_id=#{userId} or r.law_enforcer_id_two=#{userId})</if>
<if test="userId != null and userId != '' ">and( r.law_enforcer_id=#{userId} or
r.law_enforcer_id_two=#{userId})
</if>
<if test="bureauDeptId != null and bureauDeptId != '' ">and r.bureau_dept_id=#{bureauDeptId}</if>
<if test="qy != null and qy != ''">
and (e.enterprise_address like concat('深圳市',substring_index(#{qy}, "区",1), '区%')or
e.enterprise_address like concat('深圳市',substring_index(#{qy}, "区",1), '新区%'))
<if test="jd != null and jd != ''">
and (e.enterprise_address like concat('深圳市',substring_index(#{qy}, "区",1), '区',#{jd},'%')or
e.enterprise_address like concat('深圳市',substring_index(#{qy}, "区",1), '新区',#{jd},'%'))
</if>
</if>
<if test="dateType != null and dateType != '' and dateType == 'year' ">
and YEAR(r.create_time)=#{year}
</if>
@ -38,9 +52,9 @@
</where>
</select>
<select id="huanSectionA" parameterType="ComprehensiveAnalysis" resultMap="ComprehensiveAnalysisResult">
select r.check_category, e.company_org_type
select r.check_category, e.company_org_type,e.enterprise_address
from enforcement_registration r
left join enterprise_information e
left join (select * from enterprise_information group by enterprise_number) e
on r.enterprise_number = e.enterprise_number
<where>
and r.enterprise_number is not null
@ -49,6 +63,14 @@
r.law_enforcer_id_two=#{userId})
</if>
<if test="bureauDeptId != null and bureauDeptId != '' ">and r.bureau_dept_id=#{bureauDeptId}</if>
<if test="qy != null and qy != ''">
and (e.enterprise_address like concat('深圳市',substring_index(#{qy}, "区",1), '区%')or
e.enterprise_address like concat('深圳市',substring_index(#{qy}, "区",1), '新区%'))
<if test="jd != null and jd != ''">
and (e.enterprise_address like concat('深圳市',substring_index(#{qy}, "区",1), '区',#{jd},'%')or
e.enterprise_address like concat('深圳市',substring_index(#{qy}, "区",1), '新区',#{jd},'%'))
</if>
</if>
<if test="dateType != null and dateType != '' and dateType == 'year' ">
and YEAR(r.create_time)+1=#{year}
</if>
@ -67,9 +89,9 @@
</where>
</select>
<select id="tongSectionA" parameterType="ComprehensiveAnalysis" resultMap="ComprehensiveAnalysisResult">
select r.check_category, e.company_org_type
select r.check_category, e.company_org_type,e.enterprise_address
from enforcement_registration r
left join enterprise_information e
left join (select * from enterprise_information group by enterprise_number) e
on r.enterprise_number = e.enterprise_number
<where>
and r.enterprise_number is not null
@ -78,6 +100,14 @@
r.law_enforcer_id_two=#{userId})
</if>
<if test="bureauDeptId != null and bureauDeptId != '' ">and r.bureau_dept_id=#{bureauDeptId}</if>
<if test="qy != null and qy != ''">
and (e.enterprise_address like concat('深圳市',substring_index(#{qy}, "区",1), '区%')or
e.enterprise_address like concat('深圳市',substring_index(#{qy}, "区",1), '新区%'))
<if test="jd != null and jd != ''">
and (e.enterprise_address like concat('深圳市',substring_index(#{qy}, "区",1), '区',#{jd},'%')or
e.enterprise_address like concat('深圳市',substring_index(#{qy}, "区",1), '新区',#{jd},'%'))
</if>
</if>
<if test="dateType != null and dateType != '' and dateType == 'year' ">
and YEAR(r.create_time)+1=#{year}
</if>
@ -149,7 +179,8 @@
</select>
<select id="complaintTypeList" parameterType="ComprehensiveAnalysis" resultMap="ComprehensiveAnalysisResult">
select c.enforce_type as complaint_type from complaint_statistics c
left join (select id,bureau_dept_id,law_enforcer_id,law_enforcer_id_two from enforcement_registration where enterprise_number is not null and check_category is not null) r
left join (select id,bureau_dept_id,law_enforcer_id,law_enforcer_id_two from enforcement_registration where
enterprise_number is not null and check_category is not null) r
on c.rid=r.id
<where>
and (c.rid is not null or c.complaint_department_id is not null)
@ -157,7 +188,9 @@
<if test="userId != null and userId != '' ">and( r.law_enforcer_id=#{userId} or
r.law_enforcer_id_two=#{userId})
</if>
<if test="bureauDeptId != null and bureauDeptId != '' ">and( r.bureau_dept_id=#{bureauDeptId} or c.complaint_department_id=#{bureauDeptId})</if>
<if test="bureauDeptId != null and bureauDeptId != '' ">and( r.bureau_dept_id=#{bureauDeptId} or
c.complaint_department_id=#{bureauDeptId})
</if>
<if test="dateType != null and dateType != '' and dateType == 'year' ">
and YEAR(c.complaint_time)=#{year}
</if>
@ -175,4 +208,429 @@
</if>
</where>
</select>
<select id="primaryNotice" parameterType="ComprehensiveAnalysis" resultMap="ComprehensiveAnalysisResult">
select e.enterprise_address from enterprise_law_enforcement n
left join (select * from enterprise_information group by enterprise_number) e
on n.enterprise_number=e.enterprise_number
<where>
and n.enterprise_number is not null
<if test="qy != null and qy != ''">
and (e.enterprise_address like concat('深圳市',substring_index(#{qy}, "区",1), '区%')or
e.enterprise_address like concat('深圳市',substring_index(#{qy}, "区",1), '新区%'))
<if test="jd != null and jd != ''">
and (e.enterprise_address like concat('深圳市',substring_index(#{qy}, "区",1), '区',#{jd},'%')or
e.enterprise_address like concat('深圳市',substring_index(#{qy}, "区",1), '新区',#{jd},'%'))
</if>
</if>
<if test="dateType != null and dateType != '' and dateType == 'year' ">
and YEAR(n.create_time)=#{year}
</if>
<if test="dateType != null and dateType != '' and dateType == 'quarter' ">
and YEAR(n.create_time)=#{year}
and QUARTER(n.create_time)=#{quarter}
</if>
<if test="dateType != null and dateType != '' and dateType == 'month' ">
and YEAR(n.create_time)=#{year}
and MONTH(n.create_time)=#{month}
</if>
<if test="dateType != null and dateType != '' and dateType == 'day' ">
and DATE_FORMAT(n.create_time,'%Y-%m-%d') >= #{beginTime}
and #{endTime} >= DATE_FORMAT(n.create_time,'%Y-%m-%d')
</if>
</where>
</select>
<select id="huanNotice" parameterType="ComprehensiveAnalysis" resultMap="ComprehensiveAnalysisResult">
select e.enterprise_address from enterprise_law_enforcement n
left join (select * from enterprise_information group by enterprise_number) e
on n.enterprise_number=e.enterprise_number
<where>
and n.enterprise_number is not null
<if test="qy != null and qy != ''">
and (e.enterprise_address like concat('深圳市',substring_index(#{qy}, "区",1), '区%')or
e.enterprise_address like concat('深圳市',substring_index(#{qy}, "区",1), '新区%'))
<if test="jd != null and jd != ''">
and (e.enterprise_address like concat('深圳市',substring_index(#{qy}, "区",1), '区',#{jd},'%')or
e.enterprise_address like concat('深圳市',substring_index(#{qy}, "区",1), '新区',#{jd},'%'))
</if>
</if>
<if test="dateType != null and dateType != '' and dateType == 'year' ">
and YEAR(n.create_time)+1=#{year}
</if>
<if test="dateType != null and dateType != '' and dateType == 'quarter' ">
and YEAR(DATE_SUB(n.create_time,INTERVAL -1 quarter))=#{year}
and QUARTER(DATE_SUB(n.create_time,INTERVAL -1 quarter))=#{quarter}
</if>
<if test="dateType != null and dateType != '' and dateType == 'month' ">
and YEAR(DATE_SUB(n.create_time,INTERVAL -1 month))=#{year}
and MONTH(DATE_SUB(n.create_time,INTERVAL -1 month))=#{month}
</if>
<if test="dateType != null and dateType != '' and dateType == 'day' ">
and n.create_time>=DATE_SUB(beginTime,INTERVAL TO_DAY(endTime)-TO_DAY(beginTime)+1 day)
and DATE_SUB(endTime,INTERVAL TO_DAY(endTime)-TO_DAY(beginTime)+1 day)>=n.create_time
</if>
</where>
</select>
<select id="tongNotice" parameterType="ComprehensiveAnalysis" resultMap="ComprehensiveAnalysisResult">
select e.enterprise_address from enterprise_law_enforcement n
left join (select * from enterprise_information group by enterprise_number) e
on n.enterprise_number=e.enterprise_number
<where>
and n.enterprise_number is not null
<if test="qy != null and qy != ''">
and (e.enterprise_address like concat('深圳市',substring_index(#{qy}, "区",1), '区%')or
e.enterprise_address like concat('深圳市',substring_index(#{qy}, "区",1), '新区%'))
<if test="jd != null and jd != ''">
and (e.enterprise_address like concat('深圳市',substring_index(#{qy}, "区",1), '区',#{jd},'%')or
e.enterprise_address like concat('深圳市',substring_index(#{qy}, "区",1), '新区',#{jd},'%'))
</if>
</if>
<if test="dateType != null and dateType != '' and dateType == 'year' ">
and YEAR(n.create_time)+1=#{year}
</if>
<if test="dateType != null and dateType != '' and dateType == 'quarter' ">
and YEAR(DATE_SUB(n.create_time,INTERVAL -1 year))=#{year}
and QUARTER(DATE_SUB(n.create_time,INTERVAL -1 year))=#{quarter}
</if>
<if test="dateType != null and dateType != '' and dateType == 'month' ">
and YEAR(DATE_SUB(n.create_time,INTERVAL -1 year))=#{year}
and MONTH(DATE_SUB(n.create_time,INTERVAL -1 year))=#{month}
</if>
<if test="dateType != null and dateType != '' and dateType == 'day' ">
and DATE_FORMAT(DATE_SUB(n.create_time,INTERVAL -1 year),'%Y-%m-%d') >= #{beginTime}
and #{endTime} >= DATE_FORMAT(DATE_SUB(n.create_time,INTERVAL -1 year),'%Y-%m-%d')
</if>
</where>
</select>
<select id="primaryComplaint" parameterType="ComprehensiveAnalysis" resultMap="ComprehensiveAnalysisResult">
select e.enterprise_address,c.enforce_type from complaint_statistics c
left join (select * from enterprise_information group by enterprise_number) e
on c.enterprise_number=e.enterprise_number
<where>
and (c.rid is not null or c.complaint_department_id is not null)
and c.enforce_type is not null
and c.enterprise_number is not null
<if test="qy != null and qy != ''">
and (e.enterprise_address like concat('深圳市',substring_index(#{qy}, "区",1), '区%')or
e.enterprise_address like concat('深圳市',substring_index(#{qy}, "区",1), '新区%'))
<if test="jd != null and jd != ''">
and (e.enterprise_address like concat('深圳市',substring_index(#{qy}, "区",1), '区',#{jd},'%')or
e.enterprise_address like concat('深圳市',substring_index(#{qy}, "区",1), '新区',#{jd},'%'))
</if>
</if>
<if test="dateType != null and dateType != '' and dateType == 'year' ">
and YEAR(c.complaint_time)=#{year}
</if>
<if test="dateType != null and dateType != '' and dateType == 'quarter' ">
and YEAR(c.complaint_time)=#{year}
and QUARTER(c.complaint_time)=#{quarter}
</if>
<if test="dateType != null and dateType != '' and dateType == 'month' ">
and YEAR(c.complaint_time)=#{year}
and MONTH(c.complaint_time)=#{month}
</if>
<if test="dateType != null and dateType != '' and dateType == 'day' ">
and DATE_FORMAT(c.complaint_time,'%Y-%m-%d') >= #{beginTime}
and #{endTime} >= DATE_FORMAT(c.complaint_time,'%Y-%m-%d')
</if>
</where>
</select>
<select id="huanComplaint" parameterType="ComprehensiveAnalysis" resultMap="ComprehensiveAnalysisResult">
select e.enterprise_address,c.enforce_type from complaint_statistics c
left join (select * from enterprise_information group by enterprise_number) e
on c.enterprise_number=e.enterprise_number
<where>
and (c.rid is not null or c.complaint_department_id is not null)
and c.enforce_type is not null
and c.enterprise_number is not null
<if test="qy != null and qy != ''">
and (e.enterprise_address like concat('深圳市',substring_index(#{qy}, "区",1), '区%')or
e.enterprise_address like concat('深圳市',substring_index(#{qy}, "区",1), '新区%'))
<if test="jd != null and jd != ''">
and (e.enterprise_address like concat('深圳市',substring_index(#{qy}, "区",1), '区',#{jd},'%')or
e.enterprise_address like concat('深圳市',substring_index(#{qy}, "区",1), '新区',#{jd},'%'))
</if>
</if>
<if test="dateType != null and dateType != '' and dateType == 'year' ">
and YEAR(c.complaint_time)+1=#{year}
</if>
<if test="dateType != null and dateType != '' and dateType == 'quarter' ">
and YEAR(DATE_SUB(c.complaint_time,INTERVAL -1 quarter))=#{year}
and QUARTER(DATE_SUB(c.complaint_time,INTERVAL -1 quarter))=#{quarter}
</if>
<if test="dateType != null and dateType != '' and dateType == 'month' ">
and YEAR(DATE_SUB(c.complaint_time,INTERVAL -1 month))=#{year}
and MONTH(DATE_SUB(c.complaint_time,INTERVAL -1 month))=#{month}
</if>
<if test="dateType != null and dateType != '' and dateType == 'day' ">
and c.complaint_time>=DATE_SUB(beginTime,INTERVAL TO_DAY(endTime)-TO_DAY(beginTime)+1 day)
and DATE_SUB(endTime,INTERVAL TO_DAY(endTime)-TO_DAY(beginTime)+1 day)>=c.complaint_time
</if>
</where>
</select>
<select id="tongComplaint" parameterType="ComprehensiveAnalysis" resultMap="ComprehensiveAnalysisResult">
select e.enterprise_address,c.enforce_type from complaint_statistics c
left join (select * from enterprise_information group by enterprise_number) e
on c.enterprise_number=e.enterprise_number
<where>
and (c.rid is not null or c.complaint_department_id is not null)
and c.enforce_type is not null
and c.enterprise_number is not null
<if test="qy != null and qy != ''">
and (e.enterprise_address like concat('深圳市',substring_index(#{qy}, "区",1), '区%')or
e.enterprise_address like concat('深圳市',substring_index(#{qy}, "区",1), '新区%'))
<if test="jd != null and jd != ''">
and (e.enterprise_address like concat('深圳市',substring_index(#{qy}, "区",1), '区',#{jd},'%')or
e.enterprise_address like concat('深圳市',substring_index(#{qy}, "区",1), '新区',#{jd},'%'))
</if>
</if>
<if test="dateType != null and dateType != '' and dateType == 'year' ">
and YEAR(c.complaint_time)+1=#{year}
</if>
<if test="dateType != null and dateType != '' and dateType == 'quarter' ">
and YEAR(DATE_SUB(c.complaint_time,INTERVAL -1 year))=#{year}
and QUARTER(DATE_SUB(c.complaint_time,INTERVAL -1 year))=#{quarter}
</if>
<if test="dateType != null and dateType != '' and dateType == 'month' ">
and YEAR(DATE_SUB(c.complaint_time,INTERVAL -1 year))=#{year}
and MONTH(DATE_SUB(c.complaint_time,INTERVAL -1 year))=#{month}
</if>
<if test="dateType != null and dateType != '' and dateType == 'day' ">
and DATE_FORMAT(DATE_SUB(c.complaint_time,INTERVAL -1 year),'%Y-%m-%d') >= #{beginTime}
and #{endTime} >= DATE_FORMAT(DATE_SUB(c.complaint_time,INTERVAL -1 year),'%Y-%m-%d')
</if>
</where>
</select>
<select id="primaryWarning" parameterType="ComprehensiveAnalysis" resultMap="ComprehensiveAnalysisResult">
select e.enterprise_address from law_enforcement_warning_list w
left join (select * from enterprise_information group by enterprise_number) e
on w.enterprise_number=e.enterprise_number
<where>
and w.enterprise_number is not null
and warn_type = 1
<if test="qy != null and qy != ''">
and (e.enterprise_address like concat('深圳市',substring_index(#{qy}, "区",1), '区%')or
e.enterprise_address like concat('深圳市',substring_index(#{qy}, "区",1), '新区%'))
<if test="jd != null and jd != ''">
and (e.enterprise_address like concat('深圳市',substring_index(#{qy}, "区",1), '区',#{jd},'%')or
e.enterprise_address like concat('深圳市',substring_index(#{qy}, "区",1), '新区',#{jd},'%'))
</if>
</if>
<if test="dateType != null and dateType != '' and dateType == 'year' ">
and YEAR(w.create_time)=#{year}
</if>
<if test="dateType != null and dateType != '' and dateType == 'quarter' ">
and YEAR(w.create_time)=#{year}
and QUARTER(w.create_time)=#{quarter}
</if>
<if test="dateType != null and dateType != '' and dateType == 'month' ">
and YEAR(w.create_time)=#{year}
and MONTH(w.create_time)=#{month}
</if>
<if test="dateType != null and dateType != '' and dateType == 'day' ">
and DATE_FORMAT(w.create_time,'%Y-%m-%d') >= #{beginTime}
and #{endTime} >= DATE_FORMAT(w.create_time,'%Y-%m-%d')
</if>
</where>
</select>
<select id="huanWarning" parameterType="ComprehensiveAnalysis" resultMap="ComprehensiveAnalysisResult">
select e.enterprise_address from law_enforcement_warning_list w
left join (select * from enterprise_information group by enterprise_number) e
on w.enterprise_number=e.enterprise_number
<where>
and w.enterprise_number is not null
and warn_type = 1
<if test="qy != null and qy != ''">
and (e.enterprise_address like concat('深圳市',substring_index(#{qy}, "区",1), '区%')or
e.enterprise_address like concat('深圳市',substring_index(#{qy}, "区",1), '新区%'))
<if test="jd != null and jd != ''">
and (e.enterprise_address like concat('深圳市',substring_index(#{qy}, "区",1), '区',#{jd},'%')or
e.enterprise_address like concat('深圳市',substring_index(#{qy}, "区",1), '新区',#{jd},'%'))
</if>
</if>
<if test="dateType != null and dateType != '' and dateType == 'year' ">
and YEAR(w.create_time)+1=#{year}
</if>
<if test="dateType != null and dateType != '' and dateType == 'quarter' ">
and YEAR(DATE_SUB(w.create_time,INTERVAL -1 quarter))=#{year}
and QUARTER(DATE_SUB(w.create_time,INTERVAL -1 quarter))=#{quarter}
</if>
<if test="dateType != null and dateType != '' and dateType == 'month' ">
and YEAR(DATE_SUB(w.create_time,INTERVAL -1 month))=#{year}
and MONTH(DATE_SUB(w.create_time,INTERVAL -1 month))=#{month}
</if>
<if test="dateType != null and dateType != '' and dateType == 'day' ">
and w.create_time>=DATE_SUB(beginTime,INTERVAL TO_DAY(endTime)-TO_DAY(beginTime)+1 day)
and DATE_SUB(endTime,INTERVAL TO_DAY(endTime)-TO_DAY(beginTime)+1 day)>=w.create_time
</if>
</where>
</select>
<select id="tongWarning" parameterType="ComprehensiveAnalysis" resultMap="ComprehensiveAnalysisResult">
select e.enterprise_address from law_enforcement_warning_list w
left join (select * from enterprise_information group by enterprise_number) e
on w.enterprise_number=e.enterprise_number
<where>
and w.enterprise_number is not null
and warn_type = 1
<if test="qy != null and qy != ''">
and (e.enterprise_address like concat('深圳市',substring_index(#{qy}, "区",1), '区%')or
e.enterprise_address like concat('深圳市',substring_index(#{qy}, "区",1), '新区%'))
<if test="jd != null and jd != ''">
and (e.enterprise_address like concat('深圳市',substring_index(#{qy}, "区",1), '区',#{jd},'%')or
e.enterprise_address like concat('深圳市',substring_index(#{qy}, "区",1), '新区',#{jd},'%'))
</if>
</if>
<if test="dateType != null and dateType != '' and dateType == 'year' ">
and YEAR(w.create_time)+1=#{year}
</if>
<if test="dateType != null and dateType != '' and dateType == 'quarter' ">
and YEAR(DATE_SUB(w.create_time,INTERVAL -1 year))=#{year}
and QUARTER(DATE_SUB(w.create_time,INTERVAL -1 year))=#{quarter}
</if>
<if test="dateType != null and dateType != '' and dateType == 'month' ">
and YEAR(DATE_SUB(w.create_time,INTERVAL -1 year))=#{year}
and MONTH(DATE_SUB(w.create_time,INTERVAL -1 year))=#{month}
</if>
<if test="dateType != null and dateType != '' and dateType == 'day' ">
and DATE_FORMAT(DATE_SUB(w.create_time,INTERVAL -1 year),'%Y-%m-%d') >= #{beginTime}
and #{endTime} >= DATE_FORMAT(DATE_SUB(w.create_time,INTERVAL -1 year),'%Y-%m-%d')
</if>
</where>
</select>
<select id="primaryEnterprise" parameterType="ComprehensiveAnalysis" resultMap="ComprehensiveAnalysisResult">
select enterprise_address,company_org_type from enterprise_information
<where>
and is_unsubscribe is not null
and company_org_type is not null
and enterprise_address is not null
<if test="qy != null and qy != ''">
and (enterprise_address like concat('深圳市',substring_index(#{qy}, "区",1), '区%')or
enterprise_address like concat('深圳市',substring_index(#{qy}, "区",1), '新区%'))
<if test="jd != null and jd != ''">
and (enterprise_address like concat('深圳市',substring_index(#{qy}, "区",1), '区',#{jd},'%')or
enterprise_address like concat('深圳市',substring_index(#{qy}, "区",1), '新区',#{jd},'%'))
</if>
</if>
<if test="dateType != null and dateType != '' and dateType == 'year' ">
and YEAR(create_time)=#{year}
</if>
<if test="dateType != null and dateType != '' and dateType == 'quarter' ">
and YEAR(create_time)=#{year}
and QUARTER(create_time)=#{quarter}
</if>
<if test="dateType != null and dateType != '' and dateType == 'month' ">
and YEAR(create_time)=#{year}
and MONTH(create_time)=#{month}
</if>
<if test="dateType != null and dateType != '' and dateType == 'day' ">
and DATE_FORMAT(create_time,'%Y-%m-%d') >= #{beginTime}
and #{endTime} >= DATE_FORMAT(create_time,'%Y-%m-%d')
</if>
</where>
group by enterprise_number
</select>
<select id="huanEnterprise" parameterType="ComprehensiveAnalysis" resultMap="ComprehensiveAnalysisResult">
select enterprise_address,company_org_type from enterprise_information
<where>
and is_unsubscribe is not null
and company_org_type is not null
and enterprise_address is not null
<if test="qy != null and qy != ''">
and (enterprise_address like concat('深圳市',substring_index(#{qy}, "区",1), '区%')or
enterprise_address like concat('深圳市',substring_index(#{qy}, "区",1), '新区%'))
<if test="jd != null and jd != ''">
and (enterprise_address like concat('深圳市',substring_index(#{qy}, "区",1), '区',#{jd},'%')or
enterprise_address like concat('深圳市',substring_index(#{qy}, "区",1), '新区',#{jd},'%'))
</if>
</if>
<if test="dateType != null and dateType != '' and dateType == 'year' ">
and YEAR(create_time)+1=#{year}
</if>
<if test="dateType != null and dateType != '' and dateType == 'quarter' ">
and YEAR(DATE_SUB(create_time,INTERVAL -1 quarter))=#{year}
and QUARTER(DATE_SUB(create_time,INTERVAL -1 quarter))=#{quarter}
</if>
<if test="dateType != null and dateType != '' and dateType == 'month' ">
and YEAR(DATE_SUB(create_time,INTERVAL -1 month))=#{year}
and MONTH(DATE_SUB(create_time,INTERVAL -1 month))=#{month}
</if>
<if test="dateType != null and dateType != '' and dateType == 'day' ">
and create_time>=DATE_SUB(beginTime,INTERVAL TO_DAY(endTime)-TO_DAY(beginTime)+1 day)
and DATE_SUB(endTime,INTERVAL TO_DAY(endTime)-TO_DAY(beginTime)+1 day)>=create_time
</if>
</where>
group by enterprise_number
</select>
<select id="tongEnterprise" parameterType="ComprehensiveAnalysis" resultMap="ComprehensiveAnalysisResult">
select enterprise_address,company_org_type from enterprise_information
<where>
and is_unsubscribe is not null
and company_org_type is not null
and enterprise_address is not null
<if test="qy != null and qy != ''">
and (enterprise_address like concat('深圳市',substring_index(#{qy}, "区",1), '区%')or
enterprise_address like concat('深圳市',substring_index(#{qy}, "区",1), '新区%'))
<if test="jd != null and jd != ''">
and (enterprise_address like concat('深圳市',substring_index(#{qy}, "区",1), '区',#{jd},'%')or
enterprise_address like concat('深圳市',substring_index(#{qy}, "区",1), '新区',#{jd},'%'))
</if>
</if>
<if test="dateType != null and dateType != '' and dateType == 'year' ">
and YEAR(create_time)+1=#{year}
</if>
<if test="dateType != null and dateType != '' and dateType == 'quarter' ">
and YEAR(DATE_SUB(create_time,INTERVAL -1 year))=#{year}
and QUARTER(DATE_SUB(create_time,INTERVAL -1 year))=#{quarter}
</if>
<if test="dateType != null and dateType != '' and dateType == 'month' ">
and YEAR(DATE_SUB(create_time,INTERVAL -1 year))=#{year}
and MONTH(DATE_SUB(create_time,INTERVAL -1 year))=#{month}
</if>
<if test="dateType != null and dateType != '' and dateType == 'day' ">
and DATE_FORMAT(DATE_SUB(create_time,INTERVAL -1 year),'%Y-%m-%d') >= #{beginTime}
and #{endTime} >= DATE_FORMAT(DATE_SUB(create_time,INTERVAL -1 year),'%Y-%m-%d')
</if>
</where>
group by enterprise_number
</select>
<select id="complaintGetBureauDept" parameterType="ComprehensiveAnalysis" resultMap="ComprehensiveAnalysisResult">
select bureau_dept_id,bureau_dept_name,count(*) as total from(
select ( CASE WHEN c.rid IS NULL THEN c.complaint_department_id ELSE r.bureau_dept_id END ) AS bureau_dept_id,
( CASE WHEN c.rid IS NULL THEN c.complaint_department ELSE r.bureau_dept_name END ) AS bureau_dept_name
from complaint_statistics c
left join (select id,bureau_dept_id,bureau_dept_name from enforcement_registration where
enterprise_number is not null and check_category is not null) r
on c.rid=r.id
left join (select * from enterprise_information group by enterprise_number) e
on c.enterprise_number=e.enterprise_number
<where>
and (c.rid is not null or c.complaint_department_id is not null)
and c.enforce_type is not null
and c.enterprise_number is not null
<if test="qy != null and qy != ''">
and (e.enterprise_address like concat('深圳市',substring_index(#{qy}, "区",1), '区%')or
e.enterprise_address like concat('深圳市',substring_index(#{qy}, "区",1), '新区%'))
<if test="jd != null and jd != ''">
and (e.enterprise_address like concat('深圳市',substring_index(#{qy}, "区",1), '区',#{jd},'%')or
e.enterprise_address like concat('深圳市',substring_index(#{qy}, "区",1), '新区',#{jd},'%'))
</if>
</if>
<if test="dateType != null and dateType != '' and dateType == 'year' ">
and YEAR(c.complaint_time)+1=#{year}
</if>
<if test="dateType != null and dateType != '' and dateType == 'quarter' ">
and YEAR(DATE_SUB(c.complaint_time,INTERVAL -1 year))=#{year}
and QUARTER(DATE_SUB(c.complaint_time,INTERVAL -1 year))=#{quarter}
</if>
<if test="dateType != null and dateType != '' and dateType == 'month' ">
and YEAR(DATE_SUB(c.complaint_time,INTERVAL -1 year))=#{year}
and MONTH(DATE_SUB(c.complaint_time,INTERVAL -1 year))=#{month}
</if>
<if test="dateType != null and dateType != '' and dateType == 'day' ">
and DATE_FORMAT(DATE_SUB(c.complaint_time,INTERVAL -1 year),'%Y-%m-%d') >= #{beginTime}
and #{endTime} >= DATE_FORMAT(DATE_SUB(c.complaint_time,INTERVAL -1 year),'%Y-%m-%d')
</if>
</where>
)x
group by bureau_dept_id order by total desc
</select>
</mapper>
Loading…
Cancel
Save