diff --git a/src/main/java/com/cm/bigdata/dao/kpi/IKpiKhxzDdyDao.java b/src/main/java/com/cm/bigdata/dao/kpi/IKpiKhxzDdyDao.java index ca1b3ab..6632b86 100644 --- a/src/main/java/com/cm/bigdata/dao/kpi/IKpiKhxzDdyDao.java +++ b/src/main/java/com/cm/bigdata/dao/kpi/IKpiKhxzDdyDao.java @@ -1,7 +1,6 @@ package com.cm.bigdata.dao.kpi; import com.cm.bigdata.pojo.dtos.kpi.KpiKhxzDdyDTO; -import com.cm.bigdata.pojo.dtos.kpi.KpiKhxzZnbmDTO; import org.springframework.stereotype.Repository; import java.util.List; @@ -18,7 +17,7 @@ public interface IKpiKhxzDdyDao { void updateC(Map updateParams); - void updateEF(Map updateParams); + void updateEFN(Map updateParams); List list(Map params); diff --git a/src/main/java/com/cm/bigdata/pojo/dtos/kpi/KpiKhxzDdyDTO.java b/src/main/java/com/cm/bigdata/pojo/dtos/kpi/KpiKhxzDdyDTO.java index 676fc58..79f2097 100644 --- a/src/main/java/com/cm/bigdata/pojo/dtos/kpi/KpiKhxzDdyDTO.java +++ b/src/main/java/com/cm/bigdata/pojo/dtos/kpi/KpiKhxzDdyDTO.java @@ -78,24 +78,31 @@ public class KpiKhxzDdyDTO implements Serializable { @JsonProperty("D") private Double d; /** + * 基础分 + */ + @ApiModelProperty("基础分") + @ExcelProperty(value = {"网格案件调度情况", "处理量"}, index = 4) + @JsonProperty("N") + private Double n; + /** * 案件调度数量 */ @ApiModelProperty("案件调度数量") - @ExcelProperty(value = {"网格案件调度情况", "案件调度", "数量"}, index = 4) + @ExcelProperty(value = {"网格案件调度情况", "案件调度", "数量"}, index = 5) @JsonProperty("E") private Integer e; /** * 案件调度扣分 */ @ApiModelProperty("案件调度扣分") - @ExcelProperty(value = {"网格案件调度情况", "案件调度", "扣分"}, index = 5) + @ExcelProperty(value = {"网格案件调度情况", "案件调度", "扣分"}, index = 6) @JsonProperty("F") private Double f; /** * 应调度却未及时调度 */ @ApiModelProperty("应调度却未及时调度") - @ExcelProperty(value = {"网格案件调度情况", "案件调度过程质量", "应调度却未及时调度"}, index = 6) + @ExcelProperty(value = {"网格案件调度情况", "案件调度过程质量", "应调度却未及时调度"}, index = 7) @JsonProperty("G") private Double g; /** @@ -110,7 +117,7 @@ public class KpiKhxzDdyDTO implements Serializable { * 未及时调度案件造成严重影响 */ @ApiModelProperty("未及时调度案件造成严重影响") - @ExcelProperty(value = {"网格案件调度情况", "案件调度过程质量", "未及时调度案件造成严重影响"}, index = 7) + @ExcelProperty(value = {"网格案件调度情况", "案件调度过程质量", "未及时调度案件造成严重影响"}, index = 8) @JsonProperty("H") private Double h; /** @@ -125,7 +132,7 @@ public class KpiKhxzDdyDTO implements Serializable { * 其它情况 */ @ApiModelProperty("其它情况") - @ExcelProperty(value = {"网格案件调度情况", "案件调度过程质量", "其它情况"}, index = 8) + @ExcelProperty(value = {"网格案件调度情况", "案件调度过程质量", "其它情况"}, index = 9) @JsonProperty("I") private Double i; /** @@ -140,7 +147,7 @@ public class KpiKhxzDdyDTO implements Serializable { * 组织评价 */ @ApiModelProperty("组织评价") - @ExcelProperty(value = {"其他工作考核", "组织评价"}, index = 9) + @ExcelProperty(value = {"其他工作考核", "组织评价"}, index = 10) @JsonProperty("J") private Double j; /** @@ -155,21 +162,21 @@ public class KpiKhxzDdyDTO implements Serializable { * 总得分 */ @ApiModelProperty("总得分") - @ExcelProperty(value = {"总得分"}, index = 10) + @ExcelProperty(value = {"总得分"}, index = 11) @JsonProperty("K") private Double k; /** * 应发绩效工资 */ @ApiModelProperty("应发绩效工资") - @ExcelProperty(value = {"应发绩效工资"}, index = 11) + @ExcelProperty(value = {"应发绩效工资"}, index = 12) @JsonProperty("L") private Double l; /** * 实发绩效工资 */ @ApiModelProperty("实发绩效工资") - @ExcelProperty(value = {"实发绩效工资"}, index = 12) + @ExcelProperty(value = {"实发绩效工资"}, index = 13) @JsonProperty("M") private Double m; /** @@ -257,6 +264,14 @@ public class KpiKhxzDdyDTO implements Serializable { this.d = d; } + public Double getN() { + return n; + } + + public void setN(Double n) { + this.n = n; + } + public Integer getE() { return e; } 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 7185292..ddec4b7 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 @@ -59,7 +59,7 @@ public class KpiKhxzWgyDTO implements Serializable { /** * 姓名 */ - @ExcelProperty(value = {"姓名"}, index = 1) + @ExcelProperty(value = {"姓名(网格数)"}, index = 1) @JsonProperty("B") private String b; /** @@ -314,9 +314,9 @@ public class KpiKhxzWgyDTO implements Serializable { /** * 应发绩效工资 */ - @ExcelProperty(value = {"应发绩效工资"}, index = 31) + @ExcelProperty(value = {"应发(浮动)绩效工资"}, index = 31) @JsonProperty("AF") - private Double aF; + private String aF; /** * 实发绩效工资 */ @@ -764,11 +764,11 @@ public class KpiKhxzWgyDTO implements Serializable { this.aE = aE; } - public Double getaF() { + public String getaF() { return aF; } - public void setaF(Double aF) { + public void setaF(String aF) { this.aF = aF; } diff --git a/src/main/java/com/cm/bigdata/service/kpi/impl/KpiKhxzServiceImpl.java b/src/main/java/com/cm/bigdata/service/kpi/impl/KpiKhxzServiceImpl.java index a65f093..ceb2e2b 100644 --- a/src/main/java/com/cm/bigdata/service/kpi/impl/KpiKhxzServiceImpl.java +++ b/src/main/java/com/cm/bigdata/service/kpi/impl/KpiKhxzServiceImpl.java @@ -176,6 +176,17 @@ public class KpiKhxzServiceImpl extends AbstractService implements IKpiKhxzServi @Override public void exportWgy(HttpServletResponse httpServletResponse, Map queryMap) throws IOException { List wgys = listWgy(queryMap); + for (int i = 0; i < wgys.size(); i++) { + KpiKhxzWgyDTO kpiKhxzWgyDTO = wgys.get(i); + kpiKhxzWgyDTO.setA(i + 1); + kpiKhxzWgyDTO.setB(kpiKhxzWgyDTO.getB() + "(" + kpiKhxzWgyDTO.getGridCount() + ")"); + Double score = kpiKhxzWgyDTO.getaE(); + if (score <= 100 && score >= 85) { + kpiKhxzWgyDTO.setaF(333 * kpiKhxzWgyDTO.getGridCount() + "(" + 500 * kpiKhxzWgyDTO.getGridCount() + ")"); + } else { + kpiKhxzWgyDTO.setaF(333 * kpiKhxzWgyDTO.getGridCount() + "(0)"); + } + } ExcelExportUtil.simple(httpServletResponse, "网格员考核细则", wgys, KpiKhxzWgyDTO.class); } 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 bdfec33..017eb6a 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 @@ -331,17 +331,18 @@ public class KpiServiceImpl implements IKpiService { String handleEndTime = assignDateTime.plusHours((int) (reportCaseAssignPO.getHandleTime() * 24)).toString(DATE_TIME_FORMATTER); params.put("handleEndTime", handleEndTime); // 如果是自处理,处理人为上报人 - if (StringUtils.equals(reportCasePO.getIsSelf(), "1")) { - params.put("handleUserId", reportCasePO.getCreator()); - } else { - params.put("handleUserId", reportCaseAssignPO.getHandleUserId()); - } +// if (StringUtils.equals(reportCasePO.getIsSelf(), "1")) { +// params.put("handleUserId", reportCasePO.getCreator()); +// } else { +// params.put("handleUserId", reportCaseAssignPO.getHandleUserId()); +// } break; } } // 案件处理 for (ReportCaseHandlePO reportCaseHandlePO : reportCaseHandlePOS) { if (StringUtils.equals(reportCasePO.getReportCaseId(), reportCaseHandlePO.getCaseId())) { + params.put("handleUserId", reportCaseHandlePO.getCreator()); params.put("gmtHandle", reportCaseHandlePO.getGmtModified()); params.put("isTimeout", reportCaseHandlePO.getHandleTimeout()); break; diff --git a/src/main/java/com/cm/bigdata/service/kpi/task/KpiKhxzDdyTask.java b/src/main/java/com/cm/bigdata/service/kpi/task/KpiKhxzDdyTask.java index 0162db9..ae701b4 100644 --- a/src/main/java/com/cm/bigdata/service/kpi/task/KpiKhxzDdyTask.java +++ b/src/main/java/com/cm/bigdata/service/kpi/task/KpiKhxzDdyTask.java @@ -6,7 +6,7 @@ import com.cm.bigdata.monitor.KpiUpdateMonitor; import com.cm.bigdata.pojo.pos.kpi.UserPO; import com.cm.bigdata.service.kpi.IUserService; import com.cm.bigdata.service.kpi.task.sub.KpiKhxzDdyCRunnable; -import com.cm.bigdata.service.kpi.task.sub.KpiKhxzDdyEFRunnable; +import com.cm.bigdata.service.kpi.task.sub.KpiKhxzDdyEFNRunnable; import com.cm.bigdata.utils.KpiUtil; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -39,7 +39,7 @@ public class KpiKhxzDdyTask { return; } executorService.execute(new KpiKhxzDdyCRunnable(kpiKhxzDdyDao, kpiDao, khYear, khMonth, userIds)); - executorService.execute(new KpiKhxzDdyEFRunnable(kpiKhxzDdyDao, kpiDao, khYear, khMonth, userIds)); + executorService.execute(new KpiKhxzDdyEFNRunnable(kpiKhxzDdyDao, kpiDao, khYear, khMonth, userIds)); } private void deleteBase(int khYear, int khMonth) { diff --git a/src/main/java/com/cm/bigdata/service/kpi/task/sub/KpiKhxzDdyEFNRunnable.java b/src/main/java/com/cm/bigdata/service/kpi/task/sub/KpiKhxzDdyEFNRunnable.java new file mode 100644 index 0000000..b5eaf19 --- /dev/null +++ b/src/main/java/com/cm/bigdata/service/kpi/task/sub/KpiKhxzDdyEFNRunnable.java @@ -0,0 +1,74 @@ +package com.cm.bigdata.service.kpi.task.sub; + +import com.cm.bigdata.dao.kpi.IKpiDao; +import com.cm.bigdata.dao.kpi.IKpiKhxzDdyDao; +import com.cm.bigdata.monitor.KpiUpdateMonitor; +import com.cm.bigdata.pojo.pos.kpi.CasePO; +import com.cm.common.constants.ISystemConstant; +import org.joda.time.Hours; +import org.joda.time.LocalDateTime; +import org.joda.time.format.DateTimeFormat; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class KpiKhxzDdyEFNRunnable implements Runnable { + + private IKpiKhxzDdyDao kpiKhxzDdyDao; + private IKpiDao kpiDao; + private int khYear; + private int khMonth; + private List userIds; + + public KpiKhxzDdyEFNRunnable(IKpiKhxzDdyDao kpiKhxzDdyDao, IKpiDao kpiDao, int khYear, int khMonth, List userIds) { + this.kpiKhxzDdyDao = kpiKhxzDdyDao; + this.kpiDao = kpiDao; + this.khYear = khYear; + this.khMonth = khMonth; + this.userIds = userIds; + } + + @Override + public void run() { + Map params = new HashMap<>(); + params.put("assignYearMonth", String.format("%04d-%02d", khYear, khMonth)); + Map handleParams = new HashMap<>(); + handleParams.put("handleYearMonth", String.format("%04d-%02d", khYear, khMonth)); + userIds.forEach(userId -> { + params.put("assignUserId", userId); + List casePOS = kpiDao.listCase(params); + try { + // 调度员处理完成的案件:由调度员处理(包含自处理和转派的案件) + handleParams.put("handleUserId", userId); + List handleCasePOS = kpiDao.listCase(handleParams); + + Map updateParams = new HashMap<>(); + updateParams.put("khYear", khYear); + updateParams.put("khMonth", khMonth); + updateParams.put("userId", userId); + // 超时转派扣分 + int assignIn24HoursCount = 0; + int notAssignIn24HoursCount = 0; + for (CasePO casePO : casePOS) { + LocalDateTime reportDateTime = LocalDateTime.parse(casePO.getGmtReport().substring(0, 18), DateTimeFormat.forPattern(ISystemConstant.DATE_FORMATTER_YYYY_MM_DD_HH_MM_SS)); + LocalDateTime assignDateTime = LocalDateTime.parse(casePO.getGmtAssign().substring(0, 18), DateTimeFormat.forPattern(ISystemConstant.DATE_FORMATTER_YYYY_MM_DD_HH_MM_SS)); + int hours = Hours.hoursBetween(reportDateTime, assignDateTime).getHours(); + if (hours > 24) { + notAssignIn24HoursCount++; + } else { + assignIn24HoursCount++; + } + } + updateParams.put("E", notAssignIn24HoursCount); + updateParams.put("F", notAssignIn24HoursCount * 10); + updateParams.put("N", handleCasePOS.size()); + kpiKhxzDdyDao.updateEFN(updateParams); + } catch (Exception e) { + e.printStackTrace(); + } + }); + KpiUpdateMonitor.getInstance().complete(); + } + +} diff --git a/src/main/java/com/cm/bigdata/service/kpi/task/sub/KpiKhxzDdyEFRunnable.java b/src/main/java/com/cm/bigdata/service/kpi/task/sub/KpiKhxzDdyEFRunnable.java deleted file mode 100644 index 5a88bdc..0000000 --- a/src/main/java/com/cm/bigdata/service/kpi/task/sub/KpiKhxzDdyEFRunnable.java +++ /dev/null @@ -1,46 +0,0 @@ -package com.cm.bigdata.service.kpi.task.sub; - -import com.cm.bigdata.dao.kpi.IKpiDao; -import com.cm.bigdata.dao.kpi.IKpiKhxzDdyDao; -import com.cm.bigdata.monitor.KpiUpdateMonitor; -import com.cm.bigdata.pojo.pos.kpi.CasePO; - -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -public class KpiKhxzDdyEFRunnable implements Runnable { - - private IKpiKhxzDdyDao kpiKhxzDdyDao; - private IKpiDao kpiDao; - private int khYear; - private int khMonth; - private List userIds; - - public KpiKhxzDdyEFRunnable(IKpiKhxzDdyDao kpiKhxzDdyDao, IKpiDao kpiDao, int khYear, int khMonth, List userIds) { - this.kpiKhxzDdyDao = kpiKhxzDdyDao; - this.kpiDao = kpiDao; - this.khYear = khYear; - this.khMonth = khMonth; - this.userIds = userIds; - } - - @Override - public void run() { - Map params = new HashMap<>(); - params.put("assignYearMonth", String.format("%04d-%02d", khYear, khMonth)); - userIds.forEach(userId -> { - params.put("assignUserId", userId); - List casePOS = kpiDao.listCase(params); - Map updateParams = new HashMap<>(); - updateParams.put("khYear", khYear); - updateParams.put("khMonth", khMonth); - updateParams.put("userId", userId); - updateParams.put("E", casePOS.size()); - updateParams.put("F", casePOS.size() * 10); - kpiKhxzDdyDao.updateEF(updateParams); - }); - KpiUpdateMonitor.getInstance().complete(); - } - -} diff --git a/src/main/java/com/cm/bigdata/service/kpi/task/sub/KpiKhxzWgzCDEFGHRunnable.java b/src/main/java/com/cm/bigdata/service/kpi/task/sub/KpiKhxzWgzCDEFGHRunnable.java index f9fead6..fd4d7d1 100644 --- a/src/main/java/com/cm/bigdata/service/kpi/task/sub/KpiKhxzWgzCDEFGHRunnable.java +++ b/src/main/java/com/cm/bigdata/service/kpi/task/sub/KpiKhxzWgzCDEFGHRunnable.java @@ -38,31 +38,24 @@ public class KpiKhxzWgzCDEFGHRunnable implements Runnable { kpiKhxzWgzDTOS.forEach(kpiKhxzWgzDTO -> { Map communityBossMap = new HashMap<>(); communityBossMap.put("communityBossParentUserId", kpiKhxzWgzDTO.getUserId()); - // 直属下级网格员 + // 4及网格员 List communityBossPOS = communityBossService.listPO(communityBossMap); - List communityBossUserIds = communityBossPOS.stream().map(CommunityBossPO::getCommunityBossUserId).collect(Collectors.toList()); + List communityBossIds = communityBossPOS.stream().map(CommunityBossPO::getCommunityBossId).collect(Collectors.toList()); List kpiKhxzWgyDTOS = new ArrayList<>(); - if (!communityBossUserIds.isEmpty()) { - // 下级的直属下级 + if (!communityBossIds.isEmpty()) { + // 5级网格员 communityBossMap.clear(); - communityBossMap.put("communityBossParentUserIds", communityBossUserIds); + communityBossMap.put("communityBossParentIds", communityBossIds); List communityBossPOS1 = communityBossService.listPO(communityBossMap); List communityBossUserIds1 = communityBossPOS1.stream().map(CommunityBossPO::getCommunityBossUserId).collect(Collectors.toList()); - // 合并用户ID - communityBossUserIds.addAll(communityBossUserIds1); - List userIds = communityBossUserIds; - Map wgyParams = new HashMap<>(); wgyParams.put("areaId", kpiKhxzWgzDTO.getAreaId()); wgyParams.put("communityId", kpiKhxzWgzDTO.getCommunityId()); wgyParams.put("khYear", khYear); wgyParams.put("khMonth", khMonth); - wgyParams.put("userIds", userIds); - wgyParams.put("wgyLevel", 3); - kpiKhxzWgyDTOS.addAll(kpiKhxzWgyDao.listWgy(wgyParams)); + wgyParams.put("userIds", communityBossUserIds1); wgyParams.put("wgyLevel", 4); - List kpiKhxzWgyDTOS1 = kpiKhxzWgyDao.listWgy(wgyParams); - kpiKhxzWgyDTOS.addAll(kpiKhxzWgyDTOS1); + kpiKhxzWgyDTOS.addAll(kpiKhxzWgyDao.listWgy(wgyParams)); } int unPassCount = 0; int unReportCompleteCount = 0; diff --git a/src/main/resources/mybatis/db2-mapper/kpi/community-boss-mapper.xml b/src/main/resources/mybatis/db2-mapper/kpi/community-boss-mapper.xml index 1d48e1a..562f2fd 100644 --- a/src/main/resources/mybatis/db2-mapper/kpi/community-boss-mapper.xml +++ b/src/main/resources/mybatis/db2-mapper/kpi/community-boss-mapper.xml @@ -55,6 +55,17 @@ AND community_boss_level = #{communityBossLevel} + + AND + community_boss_parent_id = #{communityBossParentId} + + + AND + community_boss_parent_id IN + + #{communityBossParentIds[${index}]} + + AND community_boss_parent_user_id = #{communityBossParentUserId}; diff --git a/src/main/resources/mybatis/mapper/kpi/kpi-khxz-ddy-mapper.xml b/src/main/resources/mybatis/mapper/kpi/kpi-khxz-ddy-mapper.xml index 845b12d..7e434a0 100644 --- a/src/main/resources/mybatis/mapper/kpi/kpi-khxz-ddy-mapper.xml +++ b/src/main/resources/mybatis/mapper/kpi/kpi-khxz-ddy-mapper.xml @@ -75,12 +75,13 @@ user_id = #{userId} - + UPDATE kpi_khxz_ddy SET E = #{E}, - F = #{F} + F = #{F}, + N = #{N} WHERE kh_year = #{khYear} AND