diff --git a/lib/EmergencyService/zdxtEmergencyAppService/src/main/java/com/zdxt/app/controller/AppComprehensiveAnalysisController.java b/lib/EmergencyService/zdxtEmergencyAppService/src/main/java/com/zdxt/app/controller/AppComprehensiveAnalysisController.java new file mode 100644 index 00000000..b0458d7e --- /dev/null +++ b/lib/EmergencyService/zdxtEmergencyAppService/src/main/java/com/zdxt/app/controller/AppComprehensiveAnalysisController.java @@ -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(); + } +} diff --git a/lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/java/com/zdxt/code/domain/ComprehensiveAnalysis.java b/lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/java/com/zdxt/code/domain/ComprehensiveAnalysis.java new file mode 100644 index 00000000..dcfa38fc --- /dev/null +++ b/lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/java/com/zdxt/code/domain/ComprehensiveAnalysis.java @@ -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 comprehensiveAnalysisList; + private List checkCategoryList; + private List companyOrgTypeList; + private List 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 getComprehensiveAnalysisList() { + return comprehensiveAnalysisList; + } + + public void setComprehensiveAnalysisList(List 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 getCheckCategoryList() { + return checkCategoryList; + } + + public void setCheckCategoryList(List checkCategoryList) { + this.checkCategoryList = checkCategoryList; + } + + public List getCompanyOrgTypeList() { + return companyOrgTypeList; + } + + public void setCompanyOrgTypeList(List companyOrgTypeList) { + this.companyOrgTypeList = companyOrgTypeList; + } + + public List getComplaintTypeList() { + return complaintTypeList; + } + + public void setComplaintTypeList(List 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; + } +} diff --git a/lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/java/com/zdxt/code/mapper/ComprehensiveAnalysisMapper.java b/lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/java/com/zdxt/code/mapper/ComprehensiveAnalysisMapper.java new file mode 100644 index 00000000..b54cca0c --- /dev/null +++ b/lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/java/com/zdxt/code/mapper/ComprehensiveAnalysisMapper.java @@ -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 primarySectionA(ComprehensiveAnalysis comprehensiveAnalysis); + + /** + * 获取执法记录,关联企业信息(环比时段) + * @param comprehensiveAnalysis + * @return + */ + List huanSectionA(ComprehensiveAnalysis comprehensiveAnalysis); + + + /** + * 获取执法记录,关联企业信息(同比时段) + * @param comprehensiveAnalysis + * @return + */ + List tongSectionA(ComprehensiveAnalysis comprehensiveAnalysis); + + /** + * 评价数量 + * @param comprehensiveAnalysis + * @return + */ + Integer evaluateCount(ComprehensiveAnalysis comprehensiveAnalysis); + + /** + * 检查计划数量 + * @param comprehensiveAnalysis + * @return + */ + Integer plantCount(ComprehensiveAnalysis comprehensiveAnalysis); + + /** + * 投诉数量 + * @param comprehensiveAnalysis + * @return + */ + List complaintTypeList(ComprehensiveAnalysis comprehensiveAnalysis); +} diff --git a/lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/java/com/zdxt/code/service/ComprehensiveAnalysisService.java b/lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/java/com/zdxt/code/service/ComprehensiveAnalysisService.java new file mode 100644 index 00000000..74047918 --- /dev/null +++ b/lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/java/com/zdxt/code/service/ComprehensiveAnalysisService.java @@ -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); +} diff --git a/lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/java/com/zdxt/code/service/impl/ComplaintStatisticsImpl.java b/lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/java/com/zdxt/code/service/impl/ComplaintStatisticsImpl.java index 3681f207..7bd59e15 100644 --- a/lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/java/com/zdxt/code/service/impl/ComplaintStatisticsImpl.java +++ b/lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/java/com/zdxt/code/service/impl/ComplaintStatisticsImpl.java @@ -3,11 +3,9 @@ package com.zdxt.code.service.impl; import cn.hutool.core.util.StrUtil; import com.zdxt.auth.project.system.dept.service.IDeptService; import com.zdxt.auth.project.system.dict.mapper.DictDataMapper; -import com.zdxt.code.domain.ComplaintStatistics; -import com.zdxt.code.domain.EnterpriseComplaint; -import com.zdxt.code.domain.SearchType; -import com.zdxt.code.domain.StatisticsIndicator; +import com.zdxt.code.domain.*; import com.zdxt.code.mapper.ComplaintStatisticsMapper; +import com.zdxt.code.mapper.EnforcementRegistrationMapper; import com.zdxt.code.service.ComplaintStatisticsService; import com.zdxt.domain.auth.Dept; import com.zdxt.domain.auth.DictData; @@ -27,6 +25,8 @@ public class ComplaintStatisticsImpl implements ComplaintStatisticsService { private IDeptService iDeptService; @Autowired private DictDataMapper dictDataMapper; + @Autowired + private EnforcementRegistrationMapper enforcementRegistrationMapper; @Override public List selectComplaintStatisticsList(ComplaintStatistics complaintStatistics){ return complaintStatisticsMapper.selectComplaintStatisticsList(complaintStatistics); @@ -92,8 +92,8 @@ public class ComplaintStatisticsImpl implements ComplaintStatisticsService { } } }else {//检查事项投诉 - List departmentIdList = Arrays.asList(enterpriseComplaint.getComplaintDepartmentIds().split(",")); - for (String s : departmentIdList) { + EnforcementRegistration enforcementRegistration=enforcementRegistrationMapper.selectEnforcementRegistrationById(enterpriseComplaint.getRelId()); +// List departmentIdList = Arrays.asList(enterpriseComplaint.getComplaintDepartmentIds().split(",")); ComplaintStatistics complaintStatistics = new ComplaintStatistics(); complaintStatistics.setCid(enterpriseComplaint.getId()); if (enterpriseComplaint.getRelId() != null && !"".equals(enterpriseComplaint.getRelId())) { @@ -124,13 +124,9 @@ public class ComplaintStatisticsImpl implements ComplaintStatisticsService { if (enterpriseComplaint.getEnterpriseAddress() != null && !"".equals(enterpriseComplaint.getEnterpriseAddress())) { complaintStatistics.setEnterpriseAddress(enterpriseComplaint.getEnterpriseAddress()); } - complaintStatistics.setComplaintDepartmentId(s); - String sName = iDeptService.selectDeptById(s).getDeptName(); - if (sName != null && !"".equals(sName)) { - complaintStatistics.setComplaintDepartment(sName); - } + complaintStatistics.setComplaintDepartmentId(enforcementRegistration.getBureauDeptId()); + complaintStatistics.setComplaintDepartment(enterpriseComplaint.getBureauDeptName()); complaintStatisticsMapper.insertComplaintStatistics(complaintStatistics); - } } System.out.println("同步到投诉统计表"); } diff --git a/lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/java/com/zdxt/code/service/impl/ComprehensiveAnalysisServiceImpl.java b/lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/java/com/zdxt/code/service/impl/ComprehensiveAnalysisServiceImpl.java new file mode 100644 index 00000000..462a1787 --- /dev/null +++ b/lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/java/com/zdxt/code/service/impl/ComprehensiveAnalysisServiceImpl.java @@ -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 primaryRegistrationList = comprehensiveAnalysisMapper.primarySectionA(c); + List tongRegistrationList = comprehensiveAnalysisMapper.tongSectionA(c); + List 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 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 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 getCheckCategoryList(List registrationList) { + int num = registrationList.size(); + List checkCategoryList = new ArrayList<>(); + /*Map 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 dictDataList = dictDataMapper.selectDictDataByType("check_category"); + for (DictData dictData : dictDataList) { + ComprehensiveAnalysis comprehensiveAnalysis = new ComprehensiveAnalysis(); + List 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 getCompanyOrgTypeList(List registrationList) { + //企业类型数组 + List companyOrgTypeList = new ArrayList<>(); + //企业类型字典 + List dictDataList = dictDataMapper.selectDictDataByType("enterpriseType"); + //筛出社会统一信用代码为空 + List 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> enterpriseMap = registrationList.stream().collect(Collectors.groupingBy(item -> item.getEnterpriseNumber())); + List 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 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 getComplaintTypeList(List complaintList) { + int num = complaintList.size(); + List dictDataList = dictDataMapper.selectDictDataByType("caseType"); + List complaintTypeList = new ArrayList<>(); + for (DictData dictData : dictDataList) { + if (!dictData.getDictLabel().equals("其他")) { + ComprehensiveAnalysis comprehensiveAnalysis = new ComprehensiveAnalysis(); + List 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; + } + +} diff --git a/lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/java/com/zdxt/code/service/impl/EnterpriseComplaintServiceImpl.java b/lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/java/com/zdxt/code/service/impl/EnterpriseComplaintServiceImpl.java index 4d73dea0..5947f9f4 100644 --- a/lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/java/com/zdxt/code/service/impl/EnterpriseComplaintServiceImpl.java +++ b/lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/java/com/zdxt/code/service/impl/EnterpriseComplaintServiceImpl.java @@ -183,7 +183,7 @@ public class EnterpriseComplaintServiceImpl implements IEnterpriseComplaintServi //默认工单为已受理 enterpriseComplaint.setStatus(0); //TODO 暂时注释,后续启用 -// complaintStatisticsService.insertComplaintStatistics(enterpriseComplaint); + complaintStatisticsService.insertComplaintStatistics(enterpriseComplaint); int i = enterpriseComplaintMapper.insertEnterpriseComplaint(enterpriseComplaint); List proCodeList = new ArrayList<>(); if (i > 0) { diff --git a/lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/resources/mapper/ComprehensiveAnalysisMapper.xml b/lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/resources/mapper/ComprehensiveAnalysisMapper.xml new file mode 100644 index 00000000..df128249 --- /dev/null +++ b/lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/resources/mapper/ComprehensiveAnalysisMapper.xml @@ -0,0 +1,178 @@ + + + + + + + + + + + + + + + + + \ No newline at end of file