diff --git a/src/main/java/com/cm/bigdata/dao/kpi/IKpiDao.java b/src/main/java/com/cm/bigdata/dao/kpi/IKpiDao.java index 16d85c8..b7c581b 100644 --- a/src/main/java/com/cm/bigdata/dao/kpi/IKpiDao.java +++ b/src/main/java/com/cm/bigdata/dao/kpi/IKpiDao.java @@ -55,4 +55,6 @@ public interface IKpiDao { Integer sumLeaveTimelong(Map sumLeaveMap); Integer complexCount(Map params); + + List complexCountPO(Map params); } diff --git a/src/main/java/com/cm/bigdata/pojo/dtos/kpi/KpiKhxzWgyDTO.java b/src/main/java/com/cm/bigdata/pojo/dtos/kpi/KpiKhxzWgyDTO.java index dfbea1b..abdbb46 100644 --- a/src/main/java/com/cm/bigdata/pojo/dtos/kpi/KpiKhxzWgyDTO.java +++ b/src/main/java/com/cm/bigdata/pojo/dtos/kpi/KpiKhxzWgyDTO.java @@ -337,6 +337,10 @@ public class KpiKhxzWgyDTO implements Serializable { @ExcelProperty(value = {"评价"}, index = 36) @JsonProperty("AH") private String aH; + + @ExcelProperty(value = {"特殊案件数量"}, index = 37) + @JsonProperty("complex") + private Integer complex; /** * 修改时间 */ @@ -352,10 +356,6 @@ public class KpiKhxzWgyDTO implements Serializable { @ExcelIgnore private String communityName; - @ExcelIgnore - private Integer complex; - - public Long getId() { return id; } diff --git a/src/main/java/com/cm/bigdata/pojo/dtos/kpi/KpiKhxzZfGaDTO.java b/src/main/java/com/cm/bigdata/pojo/dtos/kpi/KpiKhxzZfGaDTO.java index 516797a..47aa133 100644 --- a/src/main/java/com/cm/bigdata/pojo/dtos/kpi/KpiKhxzZfGaDTO.java +++ b/src/main/java/com/cm/bigdata/pojo/dtos/kpi/KpiKhxzZfGaDTO.java @@ -217,6 +217,10 @@ public class KpiKhxzZfGaDTO implements Serializable { @ExcelProperty(value = {"实发绩效工资(元)"}, index = 14) @JsonProperty("O") private Double o; + + @ExcelProperty(value = {"特殊案件数量"}, index = 15) + @JsonProperty("complex") + private Integer complex; /** * 修改时间 */ @@ -469,4 +473,12 @@ public class KpiKhxzZfGaDTO implements Serializable { public void setModifier(String modifier) { this.modifier = modifier; } + + public Integer getComplex() { + return complex; + } + + public void setComplex(Integer complex) { + this.complex = complex; + } } diff --git a/src/main/java/com/cm/bigdata/pojo/dtos/kpi/KpiKhxzZnbmDTO.java b/src/main/java/com/cm/bigdata/pojo/dtos/kpi/KpiKhxzZnbmDTO.java index e82843e..e32dc3c 100644 --- a/src/main/java/com/cm/bigdata/pojo/dtos/kpi/KpiKhxzZnbmDTO.java +++ b/src/main/java/com/cm/bigdata/pojo/dtos/kpi/KpiKhxzZnbmDTO.java @@ -208,6 +208,10 @@ public class KpiKhxzZnbmDTO implements Serializable { @ExcelProperty(value = {"实发绩效工资(元)"}, index = 15) @JsonProperty("P") private Double p; + + @ExcelProperty(value = {"特殊案件数量"}, index = 16) + @JsonProperty("complex") + private Integer complex; /** * 修改时间 */ @@ -452,4 +456,12 @@ public class KpiKhxzZnbmDTO implements Serializable { public void setModifier(String modifier) { this.modifier = modifier; } + + public Integer getComplex() { + return complex; + } + + public void setComplex(Integer complex) { + this.complex = complex; + } } diff --git a/src/main/java/com/cm/bigdata/pojo/pos/kpi/CommunityBossDayCountPO.java b/src/main/java/com/cm/bigdata/pojo/pos/kpi/CommunityBossDayCountPO.java index bf2a7a3..9dd360e 100644 --- a/src/main/java/com/cm/bigdata/pojo/pos/kpi/CommunityBossDayCountPO.java +++ b/src/main/java/com/cm/bigdata/pojo/pos/kpi/CommunityBossDayCountPO.java @@ -1,8 +1,5 @@ package com.cm.bigdata.pojo.pos.kpi; -import lombok.Data; -import lombok.ToString; - public class CommunityBossDayCountPO { private Long id; @@ -21,6 +18,7 @@ public class CommunityBossDayCountPO { private Integer updatePopulationCount; private Integer isHoliday; private Double dayScore; + private Integer complexCount; public Long getId() { return id; @@ -149,4 +147,12 @@ public class CommunityBossDayCountPO { public void setDayScore(Double dayScore) { this.dayScore = dayScore; } + + public Integer getComplexCount() { + return complexCount; + } + + public void setComplexCount(Integer complexCount) { + this.complexCount = complexCount; + } } diff --git a/src/main/java/com/cm/bigdata/pojo/pos/kpi/NPersonDayCountPO.java b/src/main/java/com/cm/bigdata/pojo/pos/kpi/NPersonDayCountPO.java index bd22d21..108b25d 100644 --- a/src/main/java/com/cm/bigdata/pojo/pos/kpi/NPersonDayCountPO.java +++ b/src/main/java/com/cm/bigdata/pojo/pos/kpi/NPersonDayCountPO.java @@ -13,6 +13,7 @@ public class NPersonDayCountPO { private Double workDistance; private Integer isHoliday; private Double dayScore; + private Integer complexCount; public Long getId() { return id; @@ -101,4 +102,12 @@ public class NPersonDayCountPO { public void setDayScore(Double dayScore) { this.dayScore = dayScore; } + + public Integer getComplexCount() { + return complexCount; + } + + public void setComplexCount(Integer complexCount) { + this.complexCount = complexCount; + } } diff --git a/src/main/java/com/cm/bigdata/service/kpi/IKpiService.java b/src/main/java/com/cm/bigdata/service/kpi/IKpiService.java index d7f1105..bc3031b 100644 --- a/src/main/java/com/cm/bigdata/service/kpi/IKpiService.java +++ b/src/main/java/com/cm/bigdata/service/kpi/IKpiService.java @@ -1,6 +1,8 @@ package com.cm.bigdata.service.kpi; import com.cm.bigdata.pojo.dtos.kpi.*; +import com.cm.bigdata.pojo.pos.kpi.CasePO; +import com.cm.bigdata.pojo.pos.kpi.ReportCasePO; import javax.servlet.http.HttpServletResponse; import java.io.IOException; @@ -73,4 +75,8 @@ public interface IKpiService { List listNPersonCaseDayCountByUserId(String userId, Integer year, Integer month); + List listInPOByUserIdsAndDay(List userIds, String day); + + List listInPOByUserIdsAndDay(String userId, String date); + } diff --git a/src/main/java/com/cm/bigdata/service/kpi/impl/KpiServiceImpl.java b/src/main/java/com/cm/bigdata/service/kpi/impl/KpiServiceImpl.java index f00a981..643866a 100644 --- a/src/main/java/com/cm/bigdata/service/kpi/impl/KpiServiceImpl.java +++ b/src/main/java/com/cm/bigdata/service/kpi/impl/KpiServiceImpl.java @@ -83,7 +83,7 @@ public class KpiServiceImpl implements IKpiService { Map populationUpdateCountMap = KpiUtil.mapPopulationUpdateCount(populationInfoService, userIds, date); Map leaveMap = KpiUtil.mapLeave(leaveService, userIds, date); // 获取复杂案件数量 - Map> complexMap = KpiUtil.complexCount(reportCaseService, userIds, date); + Map> complexMap = KpiUtil.complexCount(this, userIds, date); // 删除当日数据 deleteCommunityBossDayCount(date, communityBossLevel); @@ -100,8 +100,8 @@ public class KpiServiceImpl implements IKpiService { int savePopulationCount = populationSaveCountMap.get(userId) == null ? 0 : populationSaveCountMap.get(userId); int updatePopulationCount = populationUpdateCountMap.get(userId) == null ? 0 : populationUpdateCountMap.get(userId); // 复杂案件 - List reportCasePOS = complexMap.get(userId); - int complexCount = reportCasePOS == null || reportCasePOS.size() == 0 ? 0 : reportCasePOS.size(); + List casePOS = complexMap.get(userId); + int complexCount = casePOS == null || casePOS.size() == 0 ? 0 : casePOS.size(); // 新增 Map queryParams = new HashMap<>(); @@ -211,7 +211,7 @@ public class KpiServiceImpl implements IKpiService { Map populationUpdateCountMap = KpiUtil.mapPopulationUpdateCount(populationInfoService, userId, date); Map leaveMap = KpiUtil.mapLeave(leaveService, userId, date); // 获取复杂案件数量 - Map> complexMap = KpiUtil.complexCount(reportCaseService, userId, date); + Map> complexMap = KpiUtil.complexCount(this, userId, date); // 删除当日数据 deleteCommunityBossDayCount(date, communityBossLevel, userId); @@ -226,8 +226,8 @@ public class KpiServiceImpl implements IKpiService { int savePopulationCount = populationSaveCountMap.get(userId) == null ? 0 : populationSaveCountMap.get(userId); int updatePopulationCount = populationUpdateCountMap.get(userId) == null ? 0 : populationUpdateCountMap.get(userId); // 复杂案件 - List reportCasePOS = complexMap.get(userId); - int complexCount = reportCasePOS == null || reportCasePOS.size() == 0 ? 0 : reportCasePOS.size(); + List casePOList = complexMap.get(userId); + int complexCount = casePOList == null || casePOList.size() == 0 ? 0 : casePOList.size(); // 新增 Map queryParams = new HashMap<>(); @@ -352,6 +352,8 @@ public class KpiServiceImpl implements IKpiService { int isHoliday = KpiUtil.hasValueInList(holidays, date) ? 1 : 0; Map> userSigninMap = KpiUtil.mapSignin(userSignService, userIds, date); Map> userSignoutMap = KpiUtil.mapSignout(userSignService, userIds, date); + // 获取复杂案件数量 + Map> complexMap = KpiUtil.complexCount(this, userIds, date); // 删除当日数据 deleteNPersonDayCount(roleId, date); userPOS.forEach(userPO -> { @@ -363,6 +365,11 @@ public class KpiServiceImpl implements IKpiService { int isSignout = userSignoutPOS == null || userSignoutPOS.size() == 0 ? 0 : 1; int isSignoutEarly = userSignoutPOS == null || userSignoutPOS.size() == 0 ? 0 : userSignoutPOS.get(0).getIsEarly(); double workDistance = KpiUtil.calculateWorkDistance(userLocationService, userId, date); + + // 复杂案件 + List casePOS = complexMap.get(userId); + int complexCount = casePOS == null || casePOS.size() == 0 ? 0 : casePOS.size(); + // 新增 Map queryParams = new HashMap<>(); queryParams.put("userId", userId); @@ -373,6 +380,7 @@ public class KpiServiceImpl implements IKpiService { queryParams.put("isSignout", isSignout); queryParams.put("isSignoutEarly", isSignoutEarly); queryParams.put("workDistance", workDistance); + queryParams.put("complexCount", complexCount); if (StringUtils.equals(roleId, KpiUtil.DDY_ROLE_ID)) { queryParams.put("dayScore", KpiScoreUtil.getDdyDayScore(isSignin, isSigninLate, isSignout, isSignoutEarly, isHoliday)); } @@ -789,6 +797,22 @@ public class KpiServiceImpl implements IKpiService { }).collect(Collectors.toList()); } + @Override + public List listInPOByUserIdsAndDay(List userIds, String day) { + Map params = new HashMap<>(); + params.put("handleUserIds", userIds); + params.put("handleYearMonth", day); + return kpiDao.complexCountPO(params); + } + + @Override + public List listInPOByUserIdsAndDay(String userId, String day) { + Map params = new HashMap<>(); + params.put("handleUserId", userId); + params.put("handleYearMonth", day); + return kpiDao.complexCountPO(params); + } + private Integer countCase(Map params) { return kpiDao.countCase(params); } diff --git a/src/main/java/com/cm/bigdata/service/kpi/task/sub/KpiKhxzZfGaDEFRunnable.java b/src/main/java/com/cm/bigdata/service/kpi/task/sub/KpiKhxzZfGaDEFRunnable.java index f1eb193..a137608 100644 --- a/src/main/java/com/cm/bigdata/service/kpi/task/sub/KpiKhxzZfGaDEFRunnable.java +++ b/src/main/java/com/cm/bigdata/service/kpi/task/sub/KpiKhxzZfGaDEFRunnable.java @@ -41,12 +41,16 @@ public class KpiKhxzZfGaDEFRunnable implements Runnable { inspectCount++; } } + + List casePOList = kpiDao.complexCountPO(params); + Map updateParams = new HashMap<>(); updateParams.put("khYear", khYear); updateParams.put("khMonth", khMonth); updateParams.put("userId", userId); updateParams.put("D", unInspectCount); updateParams.put("E", inspectCount); + updateParams.put("complex", casePOList.size()); double F = inspectCount * 50 + unInspectCount * 50 * 0.6; updateParams.put("F", F); kpiKhxzZfGaDao.updateDEF(updateParams); diff --git a/src/main/java/com/cm/bigdata/service/kpi/task/sub/KpiKhxzZnbmCDEFGLMRunnable.java b/src/main/java/com/cm/bigdata/service/kpi/task/sub/KpiKhxzZnbmCDEFGLMRunnable.java index 588f978..d9df5ff 100644 --- a/src/main/java/com/cm/bigdata/service/kpi/task/sub/KpiKhxzZnbmCDEFGLMRunnable.java +++ b/src/main/java/com/cm/bigdata/service/kpi/task/sub/KpiKhxzZnbmCDEFGLMRunnable.java @@ -47,6 +47,9 @@ public class KpiKhxzZnbmCDEFGLMRunnable implements Runnable { unInspectCount++; } } + + List casePOList = kpiDao.complexCountPO(params); + Map updateParams = new HashMap<>(); updateParams.put("C", handleCount); updateParams.put("D", inspectCount); @@ -64,6 +67,7 @@ public class KpiKhxzZnbmCDEFGLMRunnable implements Runnable { updateParams.put("khYear", khYear); updateParams.put("khMonth", khMonth); updateParams.put("userId", userId); + updateParams.put("complex", casePOList.size()); kpiKhxzZnbmDao.updateCDEFGLM(updateParams); }); KpiUpdateMonitor.getInstance().complete(); diff --git a/src/main/java/com/cm/bigdata/utils/KpiUtil.java b/src/main/java/com/cm/bigdata/utils/KpiUtil.java index dac7d29..000a928 100644 --- a/src/main/java/com/cm/bigdata/utils/KpiUtil.java +++ b/src/main/java/com/cm/bigdata/utils/KpiUtil.java @@ -169,16 +169,16 @@ public class KpiUtil { return userSigninMap; } - public static Map> complexCount(IReportCaseService reportCaseService, String userId, String day) { - List reportCasePOList = reportCaseService.listInPOByUserIdsAndDay(userId, day); - Map> complexMap = new HashMap<>(); - reportCasePOList.forEach(reportCasePO -> { - List userSigninDTOList = complexMap.get(reportCasePO.getCreator()); + public static Map> complexCount(IKpiService kpiService, String userId, String day) { + List casePOList = kpiService.listInPOByUserIdsAndDay(userId, day); + Map> complexMap = new HashMap<>(); + casePOList.forEach(casePO -> { + List userSigninDTOList = complexMap.get(casePO.getHandleUserId()); if (userSigninDTOList == null) { userSigninDTOList = new ArrayList<>(); } - userSigninDTOList.add(reportCasePO); - complexMap.put(reportCasePO.getCreator(), userSigninDTOList); + userSigninDTOList.add(casePO); + complexMap.put(casePO.getHandleUserId(), userSigninDTOList); }); return complexMap; } @@ -322,16 +322,16 @@ public class KpiUtil { return dayWeeks; } - public static Map> complexCount(IReportCaseService reportCaseService, List userIds, String day) { - List reportCasePOList = reportCaseService.listInPOByUserIdsAndDay(userIds, day); - Map> complexMap = new HashMap<>(); - reportCasePOList.forEach(reportCasePO -> { - List reportCasePOS = complexMap.get(reportCasePO.getCreator()); + public static Map> complexCount(IKpiService kpiService, List userIds, String day) { + List casePOList = kpiService.listInPOByUserIdsAndDay(userIds, day); + Map> complexMap = new HashMap<>(); + casePOList.forEach(casePO -> { + List reportCasePOS = complexMap.get(casePO.getHandleUserId()); if (reportCasePOS == null) { reportCasePOS = new ArrayList<>(); } - reportCasePOS.add(reportCasePO); - complexMap.put(reportCasePO.getCreator(), reportCasePOS); + reportCasePOS.add(casePO); + complexMap.put(casePO.getHandleUserId(), reportCasePOS); }); return complexMap; } diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index 0e50c11..9a2a4a8 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -22,27 +22,27 @@ spring: druid: db1: # url: jdbc:mysql://192.168.0.151:3306/db_btgxq_bigdata?useUnicode=true&characterEncoding=utf8&characterSetResults=utf8&autoReconnect=true&failOverReadOnly=false&useSSL=false - url: jdbc:mysql://localhost:3306/db_btgxq?useUnicode=true&characterEncoding=utf8&characterSetResults=utf8&autoReconnect=true&failOverReadOnly=false&useSSL=false + url: jdbc:mysql://192.168.0.151:3306/db_btgxq?useUnicode=true&characterEncoding=utf8&characterSetResults=utf8&autoReconnect=true&failOverReadOnly=false&useSSL=false db-type: mysql driver-class-name: com.mysql.jdbc.Driver username: root - password: 123456 + password: root mapper-locations: classpath*:mybatis/mapper/**/*.xml db2: # url: jdbc:mysql://192.168.0.151:3306/db_btgxq_city?useUnicode=true&characterEncoding=utf8&characterSetResults=utf8&autoReconnect=true&failOverReadOnly=false&useSSL=false - url: jdbc:mysql://localhost:3306/db_btgxq?useUnicode=true&characterEncoding=utf8&characterSetResults=utf8&autoReconnect=true&failOverReadOnly=false&useSSL=false + url: jdbc:mysql://192.168.0.151:3306/db_btgxq?useUnicode=true&characterEncoding=utf8&characterSetResults=utf8&autoReconnect=true&failOverReadOnly=false&useSSL=false db-type: mysql driver-class-name: com.mysql.jdbc.Driver username: root - password: 123456 + password: root mapper-locations: classpath*:mybatis/db2-mapper/**/*.xml db3: # url: jdbc:mysql://192.168.0.151:3306/db_baotou_city?useUnicode=true&characterEncoding=utf8&characterSetResults=utf8&autoReconnect=true&failOverReadOnly=false&useSSL=false - url: jdbc:mysql://localhost:3306/db_btgxq?useUnicode=true&characterEncoding=utf8&characterSetResults=utf8&autoReconnect=true&failOverReadOnly=false&useSSL=false + url: jdbc:mysql://192.168.0.151:3306/db_btgxq?useUnicode=true&characterEncoding=utf8&characterSetResults=utf8&autoReconnect=true&failOverReadOnly=false&useSSL=false db-type: mysql driver-class-name: com.mysql.jdbc.Driver username: root - password: 123456 + password: root mapper-locations: classpath*:mybatis/db3-mapper/**/*.xml initial-size: 2 min-idle: 2 @@ -138,9 +138,9 @@ access-control: logging: file: E:\Users\TS-QD1\Desktop\UploadFiles\logs\bigdata\logs.log level: - root: debug - org.mybatis: debug - com.cm: debug + root: error + org.mybatis: error + com.cm: error # 访问其他项目 server-other: diff --git a/src/main/resources/mybatis/mapper/kpi/kpi-khxz-zfga-mapper.xml b/src/main/resources/mybatis/mapper/kpi/kpi-khxz-zfga-mapper.xml index 8aa3ac1..d01d60b 100644 --- a/src/main/resources/mybatis/mapper/kpi/kpi-khxz-zfga-mapper.xml +++ b/src/main/resources/mybatis/mapper/kpi/kpi-khxz-zfga-mapper.xml @@ -31,6 +31,7 @@ + @@ -90,7 +91,8 @@ SET D = #{D}, E = #{E}, - F = #{F} + F = #{F}, + complex = #{complex} WHERE kh_year = #{khYear} AND diff --git a/src/main/resources/mybatis/mapper/kpi/kpi-khxz-znbm-mapper.xml b/src/main/resources/mybatis/mapper/kpi/kpi-khxz-znbm-mapper.xml index 47d8792..c68706c 100644 --- a/src/main/resources/mybatis/mapper/kpi/kpi-khxz-znbm-mapper.xml +++ b/src/main/resources/mybatis/mapper/kpi/kpi-khxz-znbm-mapper.xml @@ -30,6 +30,7 @@ + @@ -80,7 +81,8 @@ F = #{F}, G = #{G}, L = #{L}, - M = #{M} + M = #{M}, + complex = #{complex} WHERE kh_year = #{khYear} AND diff --git a/src/main/resources/mybatis/mapper/kpi/kpi-mapper.xml b/src/main/resources/mybatis/mapper/kpi/kpi-mapper.xml index f0508ad..f0082f7 100644 --- a/src/main/resources/mybatis/mapper/kpi/kpi-mapper.xml +++ b/src/main/resources/mybatis/mapper/kpi/kpi-mapper.xml @@ -34,6 +34,7 @@ + @@ -311,7 +312,8 @@ is_signout_early, work_distance, is_holiday, - day_score + day_score, + complex_count ) VALUES ( #{userId}, #{roleId}, @@ -322,7 +324,8 @@ #{isSignoutEarly}, #{workDistance}, #{isHoliday}, - #{dayScore} + #{dayScore}, + #{complexCount} ) @@ -733,4 +736,68 @@ + + \ No newline at end of file