8 changed files with 804 additions and 13 deletions
@ -0,0 +1,33 @@ |
|||||
|
package com.zdxt.app.controller; |
||||
|
|
||||
|
import com.zdxt.code.domain.ComprehensiveAnalysis; |
||||
|
import com.zdxt.code.service.ComprehensiveAnalysisService; |
||||
|
import com.zdxt.common.controller.BaseController; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.stereotype.Controller; |
||||
|
import org.springframework.web.bind.annotation.GetMapping; |
||||
|
import org.springframework.web.bind.annotation.RequestMapping; |
||||
|
import org.springframework.web.bind.annotation.ResponseBody; |
||||
|
|
||||
|
@Controller |
||||
|
@RequestMapping("/app/appComprehensiveAnalysis") |
||||
|
public class AppComprehensiveAnalysisController extends BaseController { |
||||
|
@Autowired |
||||
|
private ComprehensiveAnalysisService comprehensiveAnalysisService; |
||||
|
|
||||
|
@GetMapping("/whole") |
||||
|
@ResponseBody |
||||
|
public ComprehensiveAnalysis whole(ComprehensiveAnalysis comprehensiveAnalysis){ |
||||
|
if(comprehensiveAnalysis.getSearchType().equals("user")){ |
||||
|
return comprehensiveAnalysisService.whole(comprehensiveAnalysis); |
||||
|
} else if (comprehensiveAnalysis.getSearchType().equals("bureauDept")) { |
||||
|
String s=comprehensiveAnalysisService.getBureauDeptId(comprehensiveAnalysis); |
||||
|
if(s!=null&&!s.equals("")){ |
||||
|
comprehensiveAnalysis.setUserId(null); |
||||
|
comprehensiveAnalysis.setBureauDeptId(s); |
||||
|
return comprehensiveAnalysisService.whole(comprehensiveAnalysis); |
||||
|
} |
||||
|
} |
||||
|
return new ComprehensiveAnalysis(); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,350 @@ |
|||||
|
package com.zdxt.code.domain; |
||||
|
|
||||
|
import java.math.BigDecimal; |
||||
|
import java.util.List; |
||||
|
|
||||
|
public class ComprehensiveAnalysis { |
||||
|
/** |
||||
|
* 企业社会统一信用代码 |
||||
|
*/ |
||||
|
private String enterpriseNumber; |
||||
|
/** |
||||
|
* 检查类型 |
||||
|
*/ |
||||
|
private String checkCategory; |
||||
|
private Integer checkCategoryNumber; |
||||
|
/** |
||||
|
* 企业类型 |
||||
|
*/ |
||||
|
private String companyOrgType; |
||||
|
private Integer companyOrgTypeNumber; |
||||
|
/** |
||||
|
* 投诉类型enforce_type |
||||
|
*/ |
||||
|
private String complaintType; |
||||
|
private Integer complaintTypeNumber; |
||||
|
private Integer complaintTotal; |
||||
|
/** |
||||
|
* 评论数量 |
||||
|
*/ |
||||
|
private Integer evaluateTotal; |
||||
|
/** |
||||
|
* 计划数量 |
||||
|
*/ |
||||
|
private Integer plantTotal; |
||||
|
/** |
||||
|
* 指标value或名称 |
||||
|
*/ |
||||
|
private String name; |
||||
|
/** |
||||
|
* name指标数量 |
||||
|
*/ |
||||
|
private Integer total; |
||||
|
/** |
||||
|
* name指标占比 |
||||
|
*/ |
||||
|
private Double percentage; |
||||
|
/** |
||||
|
* 环比 |
||||
|
*/ |
||||
|
private Double huanPercentage; |
||||
|
/** |
||||
|
* 同比 |
||||
|
*/ |
||||
|
private Double tongPercentage; |
||||
|
private List<ComprehensiveAnalysis> comprehensiveAnalysisList; |
||||
|
private List<ComprehensiveAnalysis> checkCategoryList; |
||||
|
private List<ComprehensiveAnalysis> companyOrgTypeList; |
||||
|
private List<ComprehensiveAnalysis> complaintTypeList; |
||||
|
|
||||
|
private Long userId; |
||||
|
private String bureauDeptId; |
||||
|
/** |
||||
|
* user or bureauDept |
||||
|
*/ |
||||
|
private String searchType; |
||||
|
/** |
||||
|
* 时间类型:year,quarter,month,day |
||||
|
*/ |
||||
|
private String dateType; |
||||
|
private Integer year; |
||||
|
private Integer quarter; |
||||
|
private Integer month; |
||||
|
private Integer day; |
||||
|
private String beginTime; |
||||
|
private String endTime; |
||||
|
|
||||
|
public String getCheckCategory() { |
||||
|
return checkCategory; |
||||
|
} |
||||
|
|
||||
|
public void setCheckCategory(String checkCategory) { |
||||
|
this.checkCategory = checkCategory; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
public String getCompanyOrgType() { |
||||
|
return companyOrgType; |
||||
|
} |
||||
|
|
||||
|
public void setCompanyOrgType(String companyOrgType) { |
||||
|
this.companyOrgType = companyOrgType; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
public String getComplaintType() { |
||||
|
return complaintType; |
||||
|
} |
||||
|
|
||||
|
public void setComplaintType(String complaintType) { |
||||
|
this.complaintType = complaintType; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
public Integer getEvaluateTotal() { |
||||
|
return evaluateTotal; |
||||
|
} |
||||
|
|
||||
|
public void setEvaluateTotal(Integer evaluateTotal) { |
||||
|
this.evaluateTotal = evaluateTotal; |
||||
|
} |
||||
|
|
||||
|
public Integer getPlantTotal() { |
||||
|
return plantTotal; |
||||
|
} |
||||
|
|
||||
|
public void setPlantTotal(Integer plantTotal) { |
||||
|
this.plantTotal = plantTotal; |
||||
|
} |
||||
|
|
||||
|
public String getName() { |
||||
|
return name; |
||||
|
} |
||||
|
|
||||
|
public void setName(String name) { |
||||
|
this.name = name; |
||||
|
} |
||||
|
|
||||
|
public Integer getTotal() { |
||||
|
return total; |
||||
|
} |
||||
|
|
||||
|
public void setTotal(Integer total) { |
||||
|
this.total = total; |
||||
|
} |
||||
|
|
||||
|
public Double getPercentage() { |
||||
|
return percentage; |
||||
|
} |
||||
|
|
||||
|
public void setPercentage(Double percentage) { |
||||
|
if (percentage == 0 || percentage.isNaN() || percentage.isInfinite()) { |
||||
|
this.percentage = (double) 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); |
||||
|
} |
||||
|
this.percentage = Double.valueOf(String.format("%.2f", percentage)); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
public Double getHuanPercentage() { |
||||
|
return huanPercentage; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* double value = 123.456; |
||||
|
* BigDecimal bd = new BigDecimal(value); |
||||
|
* bd = bd.setScale(2, BigDecimal.ROUND_HALF_UP); // 四舍五入
|
||||
|
* double result = bd.doubleValue(); |
||||
|
* |
||||
|
* @param huanPercentage |
||||
|
*/ |
||||
|
public void setHuanPercentage(Double huanPercentage) { |
||||
|
if (huanPercentage == 0 || huanPercentage.isNaN() || huanPercentage.isInfinite()) { |
||||
|
this.huanPercentage = (double) 0; |
||||
|
} else { |
||||
|
String s = huanPercentage * 100 + ""; |
||||
|
if (s.length() > s.indexOf(".") + 4) { |
||||
|
huanPercentage = Double.valueOf(s.substring(0, s.indexOf(".") + 4)); |
||||
|
} else { |
||||
|
huanPercentage = Double.valueOf(s); |
||||
|
} |
||||
|
this.huanPercentage = Double.valueOf(String.format("%.2f", huanPercentage)); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
public Double getTongPercentage() { |
||||
|
return tongPercentage; |
||||
|
} |
||||
|
|
||||
|
public void setTongPercentage(Double tongPercentage) { |
||||
|
System.out.println(tongPercentage); |
||||
|
if (tongPercentage == 0 || tongPercentage.isNaN() || tongPercentage.isInfinite()) { |
||||
|
this.tongPercentage = (double) 0; |
||||
|
} else { |
||||
|
String s = tongPercentage * 100 + ""; |
||||
|
if (s.length() > s.indexOf(".") + 3) { |
||||
|
tongPercentage = Double.valueOf(s.substring(0, s.indexOf(".") + 3)); |
||||
|
} else { |
||||
|
tongPercentage = Double.valueOf(s); |
||||
|
} |
||||
|
this.tongPercentage = Double.valueOf(String.format("%.2f", tongPercentage)); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
public List<ComprehensiveAnalysis> getComprehensiveAnalysisList() { |
||||
|
return comprehensiveAnalysisList; |
||||
|
} |
||||
|
|
||||
|
public void setComprehensiveAnalysisList(List<ComprehensiveAnalysis> comprehensiveAnalysisList) { |
||||
|
this.comprehensiveAnalysisList = comprehensiveAnalysisList; |
||||
|
} |
||||
|
|
||||
|
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 getSearchType() { |
||||
|
return searchType; |
||||
|
} |
||||
|
|
||||
|
public void setSearchType(String searchType) { |
||||
|
this.searchType = searchType; |
||||
|
} |
||||
|
|
||||
|
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; |
||||
|
} |
||||
|
|
||||
|
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 List<ComprehensiveAnalysis> getCheckCategoryList() { |
||||
|
return checkCategoryList; |
||||
|
} |
||||
|
|
||||
|
public void setCheckCategoryList(List<ComprehensiveAnalysis> checkCategoryList) { |
||||
|
this.checkCategoryList = checkCategoryList; |
||||
|
} |
||||
|
|
||||
|
public List<ComprehensiveAnalysis> getCompanyOrgTypeList() { |
||||
|
return companyOrgTypeList; |
||||
|
} |
||||
|
|
||||
|
public void setCompanyOrgTypeList(List<ComprehensiveAnalysis> companyOrgTypeList) { |
||||
|
this.companyOrgTypeList = companyOrgTypeList; |
||||
|
} |
||||
|
|
||||
|
public List<ComprehensiveAnalysis> getComplaintTypeList() { |
||||
|
return complaintTypeList; |
||||
|
} |
||||
|
|
||||
|
public void setComplaintTypeList(List<ComprehensiveAnalysis> complaintTypeList) { |
||||
|
this.complaintTypeList = complaintTypeList; |
||||
|
} |
||||
|
|
||||
|
public Integer getComplaintTotal() { |
||||
|
return complaintTotal; |
||||
|
} |
||||
|
|
||||
|
public void setComplaintTotal(Integer complaintTotal) { |
||||
|
this.complaintTotal = complaintTotal; |
||||
|
} |
||||
|
|
||||
|
public Integer getCheckCategoryNumber() { |
||||
|
return checkCategoryNumber; |
||||
|
} |
||||
|
|
||||
|
public void setCheckCategoryNumber(Integer checkCategoryNumber) { |
||||
|
this.checkCategoryNumber = checkCategoryNumber; |
||||
|
} |
||||
|
|
||||
|
public Integer getCompanyOrgTypeNumber() { |
||||
|
return companyOrgTypeNumber; |
||||
|
} |
||||
|
|
||||
|
public void setCompanyOrgTypeNumber(Integer companyOrgTypeNumber) { |
||||
|
this.companyOrgTypeNumber = companyOrgTypeNumber; |
||||
|
} |
||||
|
|
||||
|
public Integer getComplaintTypeNumber() { |
||||
|
return complaintTypeNumber; |
||||
|
} |
||||
|
|
||||
|
public void setComplaintTypeNumber(Integer complaintTypeNumber) { |
||||
|
this.complaintTypeNumber = complaintTypeNumber; |
||||
|
} |
||||
|
|
||||
|
public String getEnterpriseNumber() { |
||||
|
return enterpriseNumber; |
||||
|
} |
||||
|
|
||||
|
public void setEnterpriseNumber(String enterpriseNumber) { |
||||
|
this.enterpriseNumber = enterpriseNumber; |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,50 @@ |
|||||
|
package com.zdxt.code.mapper; |
||||
|
|
||||
|
import com.zdxt.code.domain.ComprehensiveAnalysis; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
public interface ComprehensiveAnalysisMapper { |
||||
|
/** |
||||
|
* 获取执法记录,关联企业信息(本时段) |
||||
|
* @param comprehensiveAnalysis |
||||
|
* @return |
||||
|
*/ |
||||
|
List<ComprehensiveAnalysis> primarySectionA(ComprehensiveAnalysis comprehensiveAnalysis); |
||||
|
|
||||
|
/** |
||||
|
* 获取执法记录,关联企业信息(环比时段) |
||||
|
* @param comprehensiveAnalysis |
||||
|
* @return |
||||
|
*/ |
||||
|
List<ComprehensiveAnalysis> huanSectionA(ComprehensiveAnalysis comprehensiveAnalysis); |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* 获取执法记录,关联企业信息(同比时段) |
||||
|
* @param comprehensiveAnalysis |
||||
|
* @return |
||||
|
*/ |
||||
|
List<ComprehensiveAnalysis> tongSectionA(ComprehensiveAnalysis comprehensiveAnalysis); |
||||
|
|
||||
|
/** |
||||
|
* 评价数量 |
||||
|
* @param comprehensiveAnalysis |
||||
|
* @return |
||||
|
*/ |
||||
|
Integer evaluateCount(ComprehensiveAnalysis comprehensiveAnalysis); |
||||
|
|
||||
|
/** |
||||
|
* 检查计划数量 |
||||
|
* @param comprehensiveAnalysis |
||||
|
* @return |
||||
|
*/ |
||||
|
Integer plantCount(ComprehensiveAnalysis comprehensiveAnalysis); |
||||
|
|
||||
|
/** |
||||
|
* 投诉数量 |
||||
|
* @param comprehensiveAnalysis |
||||
|
* @return |
||||
|
*/ |
||||
|
List<ComprehensiveAnalysis> complaintTypeList(ComprehensiveAnalysis comprehensiveAnalysis); |
||||
|
} |
||||
@ -0,0 +1,9 @@ |
|||||
|
package com.zdxt.code.service; |
||||
|
|
||||
|
import com.zdxt.code.domain.ComprehensiveAnalysis; |
||||
|
|
||||
|
public interface ComprehensiveAnalysisService { |
||||
|
ComprehensiveAnalysis whole(ComprehensiveAnalysis comprehensiveAnalysis); |
||||
|
|
||||
|
String getBureauDeptId(ComprehensiveAnalysis comprehensiveAnalysis); |
||||
|
} |
||||
@ -0,0 +1,175 @@ |
|||||
|
package com.zdxt.code.service.impl; |
||||
|
|
||||
|
import com.zdxt.auth.project.system.dept.mapper.DeptMapper; |
||||
|
import com.zdxt.auth.project.system.dict.mapper.DictDataMapper; |
||||
|
import com.zdxt.auth.project.system.user.mapper.UserMapper; |
||||
|
import com.zdxt.code.domain.ComprehensiveAnalysis; |
||||
|
import com.zdxt.code.mapper.ComprehensiveAnalysisMapper; |
||||
|
import com.zdxt.code.service.ComprehensiveAnalysisService; |
||||
|
import com.zdxt.domain.auth.Dept; |
||||
|
import com.zdxt.domain.auth.DictData; |
||||
|
import com.zdxt.domain.auth.User; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
|
||||
|
import java.util.*; |
||||
|
import java.util.function.Function; |
||||
|
import java.util.stream.Collectors; |
||||
|
|
||||
|
@Service |
||||
|
public class ComprehensiveAnalysisServiceImpl implements ComprehensiveAnalysisService { |
||||
|
@Autowired |
||||
|
private ComprehensiveAnalysisMapper comprehensiveAnalysisMapper; |
||||
|
@Autowired |
||||
|
private UserMapper userMapper; |
||||
|
@Autowired |
||||
|
private DeptMapper deptMapper; |
||||
|
@Autowired |
||||
|
private DictDataMapper dictDataMapper; |
||||
|
|
||||
|
@Override |
||||
|
public ComprehensiveAnalysis whole(ComprehensiveAnalysis c) { |
||||
|
ComprehensiveAnalysis comprehensiveAnalysis = new ComprehensiveAnalysis(); |
||||
|
//当前时段执法记录
|
||||
|
List<ComprehensiveAnalysis> primaryRegistrationList = comprehensiveAnalysisMapper.primarySectionA(c); |
||||
|
List<ComprehensiveAnalysis> tongRegistrationList = comprehensiveAnalysisMapper.tongSectionA(c); |
||||
|
List<ComprehensiveAnalysis> huanRegistrationList = comprehensiveAnalysisMapper.huanSectionA(c); |
||||
|
//执法总数
|
||||
|
comprehensiveAnalysis.setTotal(primaryRegistrationList.size()); |
||||
|
//执法总数同比
|
||||
|
System.out.println(primaryRegistrationList.size()); |
||||
|
System.out.println(tongRegistrationList.size()); |
||||
|
System.out.println(huanRegistrationList.size()); |
||||
|
comprehensiveAnalysis.setTongPercentage((double) (primaryRegistrationList.size() - tongRegistrationList.size()) / tongRegistrationList.size()); |
||||
|
//执法总数环比
|
||||
|
comprehensiveAnalysis.setHuanPercentage((double) (primaryRegistrationList.size() - huanRegistrationList.size()) / huanRegistrationList.size()); |
||||
|
//评价数量
|
||||
|
comprehensiveAnalysis.setEvaluateTotal(comprehensiveAnalysisMapper.evaluateCount(c)); |
||||
|
//检查计划数量
|
||||
|
comprehensiveAnalysis.setPlantTotal((comprehensiveAnalysisMapper.plantCount(c))); |
||||
|
List<ComprehensiveAnalysis> complaintList = comprehensiveAnalysisMapper.complaintTypeList(c); |
||||
|
System.out.println(complaintList.toString()); |
||||
|
//投诉总数
|
||||
|
comprehensiveAnalysis.setComplaintTotal(complaintList.size()); |
||||
|
//投诉类型列表(类型value+数量+占比)
|
||||
|
comprehensiveAnalysis.setComplaintTypeList(getComplaintTypeList(complaintList)); |
||||
|
//检查类别列表(类型value+数量+占比)
|
||||
|
comprehensiveAnalysis.setCheckCategoryList(getCheckCategoryList(primaryRegistrationList)); |
||||
|
//企业类型列表(文字+数量+占比)
|
||||
|
comprehensiveAnalysis.setCompanyOrgTypeList(getCompanyOrgTypeList(primaryRegistrationList)); |
||||
|
return comprehensiveAnalysis; |
||||
|
|
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public String getBureauDeptId(ComprehensiveAnalysis comprehensiveAnalysis) { |
||||
|
Long userId = comprehensiveAnalysis.getUserId(); |
||||
|
User user = userMapper.selectUserById(userId); |
||||
|
Dept dept = deptMapper.selectDeptById(user.getDeptId()); |
||||
|
if (dept.getCreditcode() != null && !dept.getCreditcode().equals("")) { |
||||
|
return dept.getDeptId(); |
||||
|
} else { |
||||
|
List<String> ancestorsList = Arrays.asList(dept.getAncestors().split(",")); |
||||
|
for (int i = ancestorsList.size() - 1; i >= 0; i--) { |
||||
|
Dept returnDept = deptMapper.selectDeptById(ancestorsList.get(i)); |
||||
|
if (!Objects.isNull(returnDept)) { |
||||
|
if (returnDept.getCreditcode() != null && !returnDept.getCreditcode().equals("")) { |
||||
|
return returnDept.getDeptId(); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
} |
||||
|
return null; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
public List<ComprehensiveAnalysis> getCheckCategoryList(List<ComprehensiveAnalysis> registrationList) { |
||||
|
int num = registrationList.size(); |
||||
|
List<ComprehensiveAnalysis> checkCategoryList = new ArrayList<>(); |
||||
|
/*Map<String, Long> checkCategoryMap = registrationList.stream().collect(Collectors.groupingBy(ComprehensiveAnalysis::getCheckCategory, Collectors.counting())); |
||||
|
for (String s : checkCategoryMap.keySet()) { |
||||
|
ComprehensiveAnalysis comprehensiveAnalysis = new ComprehensiveAnalysis(); |
||||
|
comprehensiveAnalysis.setCheckCategory(s); |
||||
|
comprehensiveAnalysis.setCheckCategoryNumber(Integer.parseInt(checkCategoryMap.get(s) + "")); |
||||
|
comprehensiveAnalysis.setPercentage((double)checkCategoryMap.get(s)/num); |
||||
|
checkCategoryList.add(comprehensiveAnalysis); |
||||
|
}*/ |
||||
|
List<DictData> dictDataList = dictDataMapper.selectDictDataByType("check_category"); |
||||
|
for (DictData dictData : dictDataList) { |
||||
|
ComprehensiveAnalysis comprehensiveAnalysis = new ComprehensiveAnalysis(); |
||||
|
List<ComprehensiveAnalysis> comprehensiveAnalysisList = registrationList.stream().filter(item -> item.getCheckCategory().equals(dictData.getDictValue())).collect(Collectors.toList()); |
||||
|
comprehensiveAnalysis.setCheckCategory(dictData.getDictLabel()); |
||||
|
comprehensiveAnalysis.setCheckCategoryNumber(comprehensiveAnalysisList.size()); |
||||
|
comprehensiveAnalysis.setPercentage((double) comprehensiveAnalysisList.size() / num); |
||||
|
checkCategoryList.add(comprehensiveAnalysis); |
||||
|
registrationList = registrationList.stream().filter(item -> !item.equals(dictData.getDictValue())).collect(Collectors.toList()); |
||||
|
} |
||||
|
return checkCategoryList; |
||||
|
} |
||||
|
|
||||
|
public List<ComprehensiveAnalysis> getCompanyOrgTypeList(List<ComprehensiveAnalysis> registrationList) { |
||||
|
//企业类型数组
|
||||
|
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()); |
||||
|
//企业去重
|
||||
|
Map<String, List<ComprehensiveAnalysis>> enterpriseMap = registrationList.stream().collect(Collectors.groupingBy(item -> item.getEnterpriseNumber())); |
||||
|
List<ComprehensiveAnalysis> enterpriseList = new ArrayList<>(); |
||||
|
for (String s : enterpriseMap.keySet()) { |
||||
|
enterpriseList.add(enterpriseMap.get(s).get(0)); |
||||
|
} |
||||
|
int num = 0; |
||||
|
if (companyOrgTypeIsNullList.size() > 0) { |
||||
|
num = enterpriseList.size() + 1; |
||||
|
} else { |
||||
|
num = enterpriseList.size(); |
||||
|
} |
||||
|
for (DictData dictData : dictDataList) { |
||||
|
if (!dictData.getDictLabel().equals("其他")) { |
||||
|
ComprehensiveAnalysis comprehensiveAnalysis = new ComprehensiveAnalysis(); |
||||
|
List<ComprehensiveAnalysis> r = enterpriseList.stream().filter(item -> dictData.getDictLabel().contains(item.getCompanyOrgType()) || item.getCompanyOrgType().contains(dictData.getDictLabel())).collect(Collectors.toList()); |
||||
|
comprehensiveAnalysis.setCompanyOrgType(dictData.getDictLabel()); |
||||
|
comprehensiveAnalysis.setCompanyOrgTypeNumber(r.size()); |
||||
|
comprehensiveAnalysis.setPercentage((double) r.size() / num); |
||||
|
companyOrgTypeList.add(comprehensiveAnalysis); |
||||
|
enterpriseList = enterpriseList.stream().filter(item -> !dictData.getDictLabel().contains(item.getCompanyOrgType()) && !item.getCompanyOrgType().contains(dictData.getDictLabel())).collect(Collectors.toList()); |
||||
|
} |
||||
|
} |
||||
|
ComprehensiveAnalysis comprehensiveAnalysis = new ComprehensiveAnalysis(); |
||||
|
comprehensiveAnalysis.setCompanyOrgType("其他"); |
||||
|
if (companyOrgTypeIsNullList.size() > 0) { |
||||
|
comprehensiveAnalysis.setCompanyOrgTypeNumber(enterpriseList.size() + 1); |
||||
|
} else { |
||||
|
comprehensiveAnalysis.setCompanyOrgTypeNumber(enterpriseList.size()); |
||||
|
} |
||||
|
companyOrgTypeList.add(comprehensiveAnalysis); |
||||
|
return companyOrgTypeList; |
||||
|
} |
||||
|
|
||||
|
public List<ComprehensiveAnalysis> getComplaintTypeList(List<ComprehensiveAnalysis> complaintList) { |
||||
|
int num = complaintList.size(); |
||||
|
List<DictData> dictDataList = dictDataMapper.selectDictDataByType("caseType"); |
||||
|
List<ComprehensiveAnalysis> complaintTypeList = new ArrayList<>(); |
||||
|
for (DictData dictData : dictDataList) { |
||||
|
if (!dictData.getDictLabel().equals("其他")) { |
||||
|
ComprehensiveAnalysis comprehensiveAnalysis = new ComprehensiveAnalysis(); |
||||
|
List<ComprehensiveAnalysis> comprehensiveAnalysisList = complaintList.stream().filter(item -> item.getComplaintType().equals(dictData.getDictValue())).collect(Collectors.toList()); |
||||
|
comprehensiveAnalysis.setComplaintType(dictData.getDictLabel()); |
||||
|
comprehensiveAnalysis.setComplaintTotal(comprehensiveAnalysisList.size()); |
||||
|
comprehensiveAnalysis.setPercentage((double) comprehensiveAnalysisList.size() / num); |
||||
|
complaintTypeList.add(comprehensiveAnalysis); |
||||
|
complaintList = complaintList.stream().filter(item -> !item.getComplaintType().equals(dictData.getDictValue())).collect(Collectors.toList()); |
||||
|
} |
||||
|
} |
||||
|
ComprehensiveAnalysis comprehensiveAnalysis = new ComprehensiveAnalysis(); |
||||
|
comprehensiveAnalysis.setComplaintType("其他"); |
||||
|
comprehensiveAnalysis.setComplaintTotal(complaintList.size()); |
||||
|
comprehensiveAnalysis.setPercentage((double) complaintList.size() / num); |
||||
|
complaintTypeList.add(comprehensiveAnalysis); |
||||
|
return complaintTypeList; |
||||
|
} |
||||
|
|
||||
|
} |
||||
@ -0,0 +1,178 @@ |
|||||
|
<?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.code.mapper.ComprehensiveAnalysisMapper"> |
||||
|
|
||||
|
<resultMap type="com.zdxt.code.domain.ComprehensiveAnalysis" id="ComprehensiveAnalysisResult"> |
||||
|
<result property="enterpriseNumber" column="enterprise_number" /> |
||||
|
<result property="checkCategory" column="check_category" /> |
||||
|
<result property="companyOrgType" column="company_org_type" /> |
||||
|
<result property="complaintType" column="complaint_type" /> |
||||
|
</resultMap> |
||||
|
<select id="primarySectionA" parameterType="ComprehensiveAnalysis" resultMap="ComprehensiveAnalysisResult"> |
||||
|
select r.check_category, e.company_org_type,e.enterprise_number |
||||
|
from enforcement_registration r |
||||
|
left join enterprise_information 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="bureauDeptId != null and bureauDeptId != '' ">and r.bureau_dept_id=#{bureauDeptId}</if> |
||||
|
<if test="dateType != null and dateType != '' and dateType == 'year' "> |
||||
|
and YEAR(r.create_time)=#{year} |
||||
|
</if> |
||||
|
<if test="dateType != null and dateType != '' and dateType == 'quarter' "> |
||||
|
and YEAR(r.create_time)=#{year} |
||||
|
and QUARTER(r.create_time)=#{quarter} |
||||
|
</if> |
||||
|
<if test="dateType != null and dateType != '' and dateType == 'month' "> |
||||
|
and YEAR(r.create_time)=#{year} |
||||
|
and MONTH(r.create_time)=#{month} |
||||
|
</if> |
||||
|
<if test="dateType != null and dateType != '' and dateType == 'day' "> |
||||
|
and DATE_FORMAT(r.create_time,'%Y-%m-%d') >= #{beginTime} |
||||
|
and #{endTime} >= DATE_FORMAT(r.create_time,'%Y-%m-%d') |
||||
|
</if> |
||||
|
</where> |
||||
|
</select> |
||||
|
<select id="huanSectionA" parameterType="ComprehensiveAnalysis" resultMap="ComprehensiveAnalysisResult"> |
||||
|
select r.check_category, e.company_org_type |
||||
|
from enforcement_registration r |
||||
|
left join enterprise_information 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="bureauDeptId != null and bureauDeptId != '' ">and r.bureau_dept_id=#{bureauDeptId}</if> |
||||
|
<if test="dateType != null and dateType != '' and dateType == 'year' "> |
||||
|
and YEAR(r.create_time)+1=#{year} |
||||
|
</if> |
||||
|
<if test="dateType != null and dateType != '' and dateType == 'quarter' "> |
||||
|
and YEAR(DATE_SUB(r.create_time,INTERVAL -1 quarter))=#{year} |
||||
|
and QUARTER(DATE_SUB(r.create_time,INTERVAL -1 quarter))=#{quarter} |
||||
|
</if> |
||||
|
<if test="dateType != null and dateType != '' and dateType == 'month' "> |
||||
|
and YEAR(DATE_SUB(r.create_time,INTERVAL -1 month))=#{year} |
||||
|
and MONTH(DATE_SUB(r.create_time,INTERVAL -1 month))=#{month} |
||||
|
</if> |
||||
|
<if test="dateType != null and dateType != '' and dateType == 'day' "> |
||||
|
and r.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)>=r.create_time |
||||
|
</if> |
||||
|
</where> |
||||
|
</select> |
||||
|
<select id="tongSectionA" parameterType="ComprehensiveAnalysis" resultMap="ComprehensiveAnalysisResult"> |
||||
|
select r.check_category, e.company_org_type |
||||
|
from enforcement_registration r |
||||
|
left join enterprise_information 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="bureauDeptId != null and bureauDeptId != '' ">and r.bureau_dept_id=#{bureauDeptId}</if> |
||||
|
<if test="dateType != null and dateType != '' and dateType == 'year' "> |
||||
|
and YEAR(r.create_time)+1=#{year} |
||||
|
</if> |
||||
|
<if test="dateType != null and dateType != '' and dateType == 'quarter' "> |
||||
|
and YEAR(DATE_SUB(r.create_time,INTERVAL -1 year))=#{year} |
||||
|
and QUARTER(DATE_SUB(r.create_time,INTERVAL -1 year))=#{quarter} |
||||
|
</if> |
||||
|
<if test="dateType != null and dateType != '' and dateType == 'month' "> |
||||
|
and YEAR(DATE_SUB(r.create_time,INTERVAL -1 year))=#{year} |
||||
|
and MONTH(DATE_SUB(r.create_time,INTERVAL -1 year))=#{month} |
||||
|
</if> |
||||
|
<if test="dateType != null and dateType != '' and dateType == 'day' "> |
||||
|
and DATE_FORMAT(DATE_SUB(r.create_time,INTERVAL -1 year),'%Y-%m-%d') >= #{beginTime} |
||||
|
and #{endTime} >= DATE_FORMAT(DATE_SUB(r.create_time,INTERVAL -1 year),'%Y-%m-%d') |
||||
|
</if> |
||||
|
</where> |
||||
|
</select> |
||||
|
<select id="evaluateCount" parameterType="ComprehensiveAnalysis" resultType = "java.lang.Integer"> |
||||
|
select count(*) from enforcement_registration r |
||||
|
left join enterprise_evaluate e |
||||
|
on r.id=e.enforcement_id |
||||
|
<where> |
||||
|
and r.enterprise_number is not null |
||||
|
and r.check_category is not null |
||||
|
and e.id 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="bureauDeptId != null and bureauDeptId != '' ">and r.bureau_dept_id=#{bureauDeptId}</if> |
||||
|
<if test="dateType != null and dateType != '' and dateType == 'year' "> |
||||
|
and YEAR(e.create_time)=#{year} |
||||
|
</if> |
||||
|
<if test="dateType != null and dateType != '' and dateType == 'quarter' "> |
||||
|
and YEAR(e.create_time)=#{year} |
||||
|
and QUARTER(e.create_time)=#{quarter} |
||||
|
</if> |
||||
|
<if test="dateType != null and dateType != '' and dateType == 'month' "> |
||||
|
and YEAR(e.create_time)=#{year} |
||||
|
and MONTH(e.create_time)=#{month} |
||||
|
</if> |
||||
|
<if test="dateType != null and dateType != '' and dateType == 'day' "> |
||||
|
and DATE_FORMAT(e.create_time,'%Y-%m-%d') >= #{beginTime} |
||||
|
and #{endTime} >= DATE_FORMAT(e.create_time,'%Y-%m-%d') |
||||
|
</if> |
||||
|
</where> |
||||
|
</select> |
||||
|
<select id="plantCount" parameterType="ComprehensiveAnalysis" resultType = "java.lang.Integer"> |
||||
|
select count(*) from enforcement_inspection_program |
||||
|
<where> |
||||
|
<if test="userId != null and userId != '' ">and user_id=#{userId} |
||||
|
</if> |
||||
|
<if test="bureauDeptId != null and bureauDeptId != '' ">and bureau_dept_id=#{bureauDeptId}</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> |
||||
|
</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 |
||||
|
on c.rid=r.id |
||||
|
<where> |
||||
|
and (c.rid is not null or c.complaint_department_id is not null) |
||||
|
and c.enforce_type 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="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> |
||||
|
<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> |
||||
|
</mapper> |
||||
Loading…
Reference in new issue