完善调度员考核后台

This commit is contained in:
TS-QD1 2023-05-12 18:17:20 +08:00
parent cd52b39410
commit 256f7276b1
27 changed files with 1417 additions and 72 deletions

View File

@ -1,6 +1,8 @@
package com.cm.bigdata.controller.apis.kpi;
import com.cm.bigdata.monitor.KpiUpdateMonitor;
import com.cm.bigdata.pojo.dtos.kpi.KpiKhxzWgyDTO;
import com.cm.bigdata.pojo.vos.kpi.KpiWgyVO;
import com.cm.bigdata.service.kpi.IKpiKhxzService;
import com.cm.common.base.AbstractController;
import com.cm.common.constants.ISystemConstant;
@ -11,6 +13,8 @@ import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;
import java.util.Map;
@ -32,15 +36,32 @@ public class KpiKhxzController extends AbstractController {
return new SuccessResult();
}
@GetMapping("update/kh-year/{khYear}/kh-month/{khMonth}")
public void resetUpdateProcess() {
KpiUpdateMonitor.getInstance().setTaskCount(0);
}
@GetMapping("get-update-percent")
public SuccessResultData<Double> getUpdatePercent() {
return new SuccessResultData<>(KpiUpdateMonitor.getInstance().getPercent());
}
@GetMapping("list-wgy")
public List<Map<String, Object>> listWgy() {
public List<KpiKhxzWgyDTO> listWgy() {
Map<String, Object> queryMap = requestParams();
return kpiKhxzService.listWgy(queryMap);
}
@GetMapping("export-wgy")
public void exportWgy(HttpServletResponse httpServletResponse) throws IOException {
Map<String, Object> queryMap = requestParams();
kpiKhxzService.exportWgy(httpServletResponse, queryMap);
}
@PutMapping("update-wgy/{wgyLevel}")
public synchronized SuccessResult updateWgy(@PathVariable("wgyLevel") Integer wgyLevel, @RequestBody KpiWgyVO kpiWgyVO) {
kpiKhxzService.updateWgy(wgyLevel, kpiWgyVO);
return new SuccessResult();
}
}

View File

@ -0,0 +1,10 @@
package com.cm.bigdata.dao.kpi;
import java.util.List;
import java.util.Map;
public interface IKpiConfigDao {
List<Map<String, String>> listConfig();
}

View File

@ -1,13 +0,0 @@
package com.cm.bigdata.dao.kpi;
import org.springframework.stereotype.Repository;
import java.util.List;
import java.util.Map;
@Repository
public interface IKpiKhxzDao {
List<Map<String, Object>> listWgy(Map<String, Object> queryMap);
}

View File

@ -0,0 +1,21 @@
package com.cm.bigdata.dao.kpi;
import org.springframework.stereotype.Repository;
import java.util.List;
import java.util.Map;
@Repository
public interface IKpiKhxzDdyDao {
void save(Map<String, Object> saveParams);
void delete(Map<String, Object> params);
List<String> listUserId(Map<String, Object> params);
void updateC(Map<String, Object> updateParams);
void updateEF(Map<String, Object> updateParams);
}

View File

@ -1,5 +1,6 @@
package com.cm.bigdata.dao.kpi;
import com.cm.bigdata.pojo.dtos.kpi.KpiKhxzWgyDTO;
import org.apache.ibatis.annotations.MapKey;
import org.springframework.stereotype.Repository;
@ -13,8 +14,7 @@ public interface IKpiKhxzWgyDao {
void delete(Map<String, Object> params);
@MapKey("id")
List<Map<String, Object>> listWgy(Map<String, Object> params);
List<KpiKhxzWgyDTO> listWgy(Map<String, Object> params);
List<String> listUserId(Map<String, Object> params);
@ -22,4 +22,6 @@ public interface IKpiKhxzWgyDao {
void updateEGIKRT(Map<String, Object> params);
void update(Map<String, Object> params);
}

View File

@ -0,0 +1,4 @@
package com.cm.bigdata.pojo.dtos.kpi;
public class KpiKhxzDdyDTO {
}

View File

@ -0,0 +1,4 @@
package com.cm.bigdata.pojo.dtos.kpi;
public class KpiKhxzWgy3DTO {
}

View File

@ -0,0 +1,782 @@
package com.cm.bigdata.pojo.dtos.kpi;
import javax.validation.constraints.Size;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.util.Date;
import com.alibaba.excel.annotation.ExcelIgnore;
import com.alibaba.excel.annotation.ExcelProperty;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.annotations.ApiModelProperty;
import org.hibernate.validator.constraints.Length;
/**
* 4级网格员考核细则
*
* @TableName kpi_khxz_wgy_3
*/
public class KpiKhxzWgyDTO implements Serializable {
/**
*
*/
@ExcelIgnore
private Long id;
/**
* 街道ID
*/
@ExcelIgnore
private String areaId;
/**
* 社区ID
*/
@ExcelIgnore
private String communityId;
/**
* 用户ID
*/
@ExcelIgnore
private String userId;
/**
* 考核年度
*/
@ExcelIgnore
private Integer khYear;
/**
* 考核月份
*/
@ExcelIgnore
private Integer khMonth;
@ExcelProperty(value = {"序号"}, index = 0)
@JsonProperty("A")
private Integer a;
/**
* 姓名
*/
@ExcelProperty(value = {"姓名"}, index = 1)
@JsonProperty("B")
private String b;
/**
* 片区巡查
*/
@ExcelProperty(value = {"片区巡查40分"}, index = 2)
@JsonProperty("C")
private Double c;
/**
* 基础分
*/
@ExcelProperty(value = {"巡查上报、案件受理过程质量", "基础分"}, index = 3)
@JsonProperty("D")
private Integer d;
/**
* 本月应报案件数
*/
@ExcelProperty(value = {"巡查上报、案件受理过程质量", "本月应报案件数"}, index = 4)
@JsonProperty("E")
private Integer e;
/**
* 本月单个案件分值
*/
@ExcelProperty(value = {"巡查上报、案件受理过程质量", "本月单个案件分值"}, index = 5)
@JsonProperty("F")
private Double f;
/**
* 实报案件数量
*/
@ExcelProperty(value = {"巡查上报、案件受理过程质量", "本月实报案件", "数量"}, index = 6)
@JsonProperty("G")
private Integer g;
/**
* 实报案件得分
*/
@ExcelProperty(value = {"巡查上报、案件受理过程质量", "本月实报案件", "得分"}, index = 7)
@JsonProperty("H")
private Double h;
/**
* 少报案件数量
*/
@ExcelProperty(value = {"巡查上报、案件受理过程质量", "本月少报案件", "数量"}, index = 8)
@JsonProperty("I")
private Integer i;
/**
* 少报案件得分
*/
@ExcelProperty(value = {"巡查上报、案件受理过程质量", "本月少报案件", "得分"}, index = 9)
@JsonProperty("J")
private Double j;
/**
* 多报案件数量
*/
@ExcelProperty(value = {"巡查上报、案件受理过程质量", "本月多报案件", "数量"}, index = 10)
@JsonProperty("K")
private Integer k;
/**
* 多报案件得分
*/
@ExcelProperty(value = {"巡查上报、案件受理过程质量", "本月多报案件", "得分"}, index = 11)
@JsonProperty("L")
private Double l;
/**
* 应上报却未上报案件
*/
@ExcelProperty(value = {"巡查上报、案件受理过程质量", "凡属下列情况之一经核准予以扣分", "应上报却未上报案件"}, index = 12)
@JsonProperty("M")
private Integer m;
/**
* 应上报却未上报案件意见
*/
@ExcelIgnore
private String reasonM;
/**
* 平台立案上报不标准不及时的
*/
@ExcelProperty(value = {"巡查上报、案件受理过程质量", "凡属下列情况之一经核准予以扣分", "平台立案上报不标准不及时的"}, index = 13)
@JsonProperty("N")
private Integer n;
/**
* 平台立案上报不标准不及时的原因
*/
@ExcelIgnore
private String reasonN;
/**
* 恶意退单
*/
@ExcelProperty(value = {"巡查上报、案件受理过程质量", "凡属下列情况之一经核准予以扣分", "恶意退单"}, index = 14)
@JsonProperty("O")
private Integer o;
/**
* 恶意退单原因
*/
@ExcelIgnore
private String reasonO;
/**
* 扣分其它情况
*/
@ExcelProperty(value = {"巡查上报、案件受理过程质量", "凡属下列情况之一经核准予以扣分", "其它情况"}, index = 15)
@JsonProperty("P")
private Integer p;
/**
* 扣分其它情况说明
*/
@ExcelIgnore
private String reasonP;
/**
* 结案情况得分
*/
@ExcelProperty(value = {"案件处置实效(指挥协调实效)", "结案情况得分"}, index = 16)
@JsonProperty("Q")
private Double q;
/**
* 督查次数
*/
@ExcelProperty(value = {"案件处置实效(指挥协调实效)", "督察案件结案情况", "督查次数"}, index = 17)
@JsonProperty("R")
private Integer r;
/**
* 督查次数原因
*/
@ExcelIgnore
private String reasonR;
/**
* 督查扣分
*/
@ExcelProperty(value = {"案件处置实效(指挥协调实效)", "督察案件结案情况", "督查扣分"}, index = 18)
@JsonProperty("S")
private Double s;
/**
* 网格员24小时未核查扣分
*/
@ExcelProperty(value = {"案件处置实效(指挥协调实效)", "案件处置过程质量", "网格员24小时未核查扣分"}, index = 19)
@JsonProperty("T")
private Double t;
/**
* 反馈虚假信息
*/
@ExcelProperty(value = {"案件处置实效(指挥协调实效)", "案件处置过程质量", "反馈虚假信息"}, index = 20)
@JsonProperty("U")
private Double u;
/**
* 反馈虚假信息原因
*/
@ExcelIgnore
private String reasonU;
/**
* 其他情况
*/
@ExcelProperty(value = {"案件处置实效(指挥协调实效)", "案件处置过程质量", "其他情况"}, index = 21)
@JsonProperty("V")
private Double v;
/**
* 其他情况原因
*/
@ExcelIgnore
private String reasonV;
/**
* 人口信息录入
*/
@ExcelProperty(value = {"人口信息管理", "人口信息录入"}, index = 22)
@JsonProperty("W")
private Double w;
/**
* 人口信息录入原因
*/
@ExcelIgnore
private String reasonW;
/**
* 人口信息质量管理
*/
@ExcelProperty(value = {"人口信息管理", "人口信息质量管理"}, index = 23)
@JsonProperty("X")
private Double x;
/**
* 人口信息质量管理原因
*/
@ExcelIgnore
private String reasonX;
/**
* 人口信息维护
*/
@ExcelProperty(value = {"人口信息管理", "人口信息维护"}, index = 24)
@JsonProperty("Y")
private Double y;
/**
* 人口信息维护原因
*/
@ExcelIgnore
private String reasonY;
/**
* 抽查情况
*/
@ExcelProperty(value = {"人口信息管理", "抽查情况"}, index = 25)
@JsonProperty("Z")
private Double z;
/**
* 抽查情况原因
*/
@ExcelIgnore
private String reasonZ;
/**
* 党建信息上报
*/
@ExcelProperty(value = {"党组织建设", "党建信息上报"}, index = 26)
@JsonProperty("AA")
private Double aA;
/**
* 党建信息上报原因
*/
@ExcelIgnore
private String reasonAA;
/**
* 党建信息质量管理
*/
@ExcelProperty(value = {"党组织建设", "党建信息质量管理"}, index = 27)
@JsonProperty("AB")
private Double aB;
/**
* 党建信息质量管理原因
*/
@ExcelIgnore
private String reasonAB;
/**
* 党建信息维护
*/
@ExcelProperty(value = {"党组织建设", "党建信息维护"}, index = 28)
@JsonProperty("AC")
private Double aC;
/**
* 党建信息维护原因
*/
@ExcelIgnore
private String reasonAC;
/**
* 抽查情况
*/
@ExcelProperty(value = {"党组织建设", "抽查情况"}, index = 29)
@JsonProperty("AD")
private Double aD;
/**
* 抽查情况原因
*/
@ExcelIgnore
private String reasonAD;
/**
* 总得分
*/
@ExcelProperty(value = {"总得分"}, index = 30)
@JsonProperty("AE")
private Double aE;
/**
* 应发绩效工资
*/
@ExcelProperty(value = {"应发绩效工资"}, index = 31)
@JsonProperty("AF")
private Double aF;
/**
* 实发绩效工资
*/
@ExcelProperty(value = {"实发绩效工资"}, index = 32)
@JsonProperty("AG")
private Double aG;
/**
* 修改时间
*/
@ExcelIgnore
private Date gmtModified;
/**
* 修改人
*/
@ExcelIgnore
private String modifier;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getAreaId() {
return areaId;
}
public void setAreaId(String areaId) {
this.areaId = areaId;
}
public String getCommunityId() {
return communityId;
}
public void setCommunityId(String communityId) {
this.communityId = communityId;
}
public String getUserId() {
return userId;
}
public void setUserId(String userId) {
this.userId = userId;
}
public Integer getKhYear() {
return khYear;
}
public void setKhYear(Integer khYear) {
this.khYear = khYear;
}
public Integer getKhMonth() {
return khMonth;
}
public void setKhMonth(Integer khMonth) {
this.khMonth = khMonth;
}
public Integer getA() {
return a;
}
public void setA(Integer a) {
this.a = a;
}
public String getB() {
return b;
}
public void setB(String b) {
this.b = b;
}
public Double getC() {
return c;
}
public void setC(Double c) {
this.c = c;
}
public Integer getD() {
return d;
}
public void setD(Integer d) {
this.d = d;
}
public Integer getE() {
return e;
}
public void setE(Integer e) {
this.e = e;
}
public Double getF() {
return f;
}
public void setF(Double f) {
this.f = f;
}
public Integer getG() {
return g;
}
public void setG(Integer g) {
this.g = g;
}
public Double getH() {
return h;
}
public void setH(Double h) {
this.h = h;
}
public Integer getI() {
return i;
}
public void setI(Integer i) {
this.i = i;
}
public Double getJ() {
return j;
}
public void setJ(Double j) {
this.j = j;
}
public Integer getK() {
return k;
}
public void setK(Integer k) {
this.k = k;
}
public Double getL() {
return l;
}
public void setL(Double l) {
this.l = l;
}
public Integer getM() {
return m;
}
public void setM(Integer m) {
this.m = m;
}
public String getReasonM() {
return reasonM;
}
public void setReasonM(String reasonM) {
this.reasonM = reasonM;
}
public Integer getN() {
return n;
}
public void setN(Integer n) {
this.n = n;
}
public String getReasonN() {
return reasonN;
}
public void setReasonN(String reasonN) {
this.reasonN = reasonN;
}
public Integer getO() {
return o;
}
public void setO(Integer o) {
this.o = o;
}
public String getReasonO() {
return reasonO;
}
public void setReasonO(String reasonO) {
this.reasonO = reasonO;
}
public Integer getP() {
return p;
}
public void setP(Integer p) {
this.p = p;
}
public String getReasonP() {
return reasonP;
}
public void setReasonP(String reasonP) {
this.reasonP = reasonP;
}
public Double getQ() {
return q;
}
public void setQ(Double q) {
this.q = q;
}
public Integer getR() {
return r;
}
public void setR(Integer r) {
this.r = r;
}
public String getReasonR() {
return reasonR;
}
public void setReasonR(String reasonR) {
this.reasonR = reasonR;
}
public Double getS() {
return s;
}
public void setS(Double s) {
this.s = s;
}
public Double getT() {
return t;
}
public void setT(Double t) {
this.t = t;
}
public Double getU() {
return u;
}
public void setU(Double u) {
this.u = u;
}
public String getReasonU() {
return reasonU;
}
public void setReasonU(String reasonU) {
this.reasonU = reasonU;
}
public Double getV() {
return v;
}
public void setV(Double v) {
this.v = v;
}
public String getReasonV() {
return reasonV;
}
public void setReasonV(String reasonV) {
this.reasonV = reasonV;
}
public Double getW() {
return w;
}
public void setW(Double w) {
this.w = w;
}
public String getReasonW() {
return reasonW;
}
public void setReasonW(String reasonW) {
this.reasonW = reasonW;
}
public Double getX() {
return x;
}
public void setX(Double x) {
this.x = x;
}
public String getReasonX() {
return reasonX;
}
public void setReasonX(String reasonX) {
this.reasonX = reasonX;
}
public Double getY() {
return y;
}
public void setY(Double y) {
this.y = y;
}
public String getReasonY() {
return reasonY;
}
public void setReasonY(String reasonY) {
this.reasonY = reasonY;
}
public Double getZ() {
return z;
}
public void setZ(Double z) {
this.z = z;
}
public String getReasonZ() {
return reasonZ;
}
public void setReasonZ(String reasonZ) {
this.reasonZ = reasonZ;
}
public Double getaA() {
return aA;
}
public void setaA(Double aA) {
this.aA = aA;
}
public String getReasonAA() {
return reasonAA;
}
public void setReasonAA(String reasonAA) {
this.reasonAA = reasonAA;
}
public Double getaB() {
return aB;
}
public void setaB(Double aB) {
this.aB = aB;
}
public String getReasonAB() {
return reasonAB;
}
public void setReasonAB(String reasonAB) {
this.reasonAB = reasonAB;
}
public Double getaC() {
return aC;
}
public void setaC(Double aC) {
this.aC = aC;
}
public String getReasonAC() {
return reasonAC;
}
public void setReasonAC(String reasonAC) {
this.reasonAC = reasonAC;
}
public Double getaD() {
return aD;
}
public void setaD(Double aD) {
this.aD = aD;
}
public String getReasonAD() {
return reasonAD;
}
public void setReasonAD(String reasonAD) {
this.reasonAD = reasonAD;
}
public Double getaE() {
return aE;
}
public void setaE(Double aE) {
this.aE = aE;
}
public Double getaF() {
return aF;
}
public void setaF(Double aF) {
this.aF = aF;
}
public Double getaG() {
return aG;
}
public void setaG(Double aG) {
this.aG = aG;
}
public Date getGmtModified() {
return gmtModified;
}
public void setGmtModified(Date gmtModified) {
this.gmtModified = gmtModified;
}
public String getModifier() {
return modifier;
}
public void setModifier(String modifier) {
this.modifier = modifier;
}
}

View File

@ -19,6 +19,7 @@ public class CasePO {
private String gmtInspect;
private Integer isSelf;
private String reportUserId;
private String assignUserId;
private String handleUserId;
private String inspectUserId;
private String inspectScore;
@ -170,6 +171,14 @@ public class CasePO {
this.reportUserId = reportUserId;
}
public String getAssignUserId() {
return assignUserId;
}
public void setAssignUserId(String assignUserId) {
this.assignUserId = assignUserId;
}
public String getHandleUserId() {
return handleUserId;
}

View File

@ -0,0 +1,18 @@
package com.cm.bigdata.pojo.vos.kpi;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
public class KpiWgyVO {
private List<Map<String, Object>> datas;
public List<Map<String, Object>> getDatas() {
return datas == null ? new ArrayList<>() : datas;
}
public void setDatas(List<Map<String, Object>> datas) {
this.datas = datas;
}
}

View File

@ -1,5 +1,10 @@
package com.cm.bigdata.service.kpi;
import com.cm.bigdata.pojo.dtos.kpi.KpiKhxzWgyDTO;
import com.cm.bigdata.pojo.vos.kpi.KpiWgyVO;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;
import java.util.Map;
@ -8,7 +13,11 @@ public interface IKpiKhxzService {
void update(Integer khYear, Integer khMonth);
List<Map<String, Object>> listWgy(Map<String, Object> queryMap);
List<KpiKhxzWgyDTO> listWgy(Map<String, Object> queryMap);
void exportWgy(HttpServletResponse httpServletResponse, Map<String, Object> queryMap) throws IOException;
void updateWgy(Integer wgyLevel, KpiWgyVO kpiWgyVO);
}

View File

@ -28,6 +28,7 @@ public interface IKpiService {
*/
void updateNPersonDayCount(String departmentId, String startTime, String endTime);
void updateNPersonDayCount(String roleId, Integer khYear, Integer khMonth);
/**
* 更新
@ -67,4 +68,5 @@ public interface IKpiService {
List<CommunityBossDayCountDTO> listCommunityBossDayCountByUserId(String userId, Integer year, Integer month, Integer level);
}

View File

@ -1,14 +1,22 @@
package com.cm.bigdata.service.kpi.impl;
import com.cm.bigdata.dao.kpi.IKpiKhxzDao;
import com.cm.bigdata.dao.kpi.IKpiKhxzWgyDao;
import com.cm.bigdata.monitor.KpiUpdateMonitor;
import com.cm.bigdata.pojo.dtos.kpi.KpiKhxzWgyDTO;
import com.cm.bigdata.pojo.dtos.kpi.NPersonCaseDayCountDTO;
import com.cm.bigdata.pojo.vos.kpi.KpiWgyVO;
import com.cm.bigdata.service.kpi.IKpiKhxzService;
import com.cm.bigdata.service.kpi.IKpiService;
import com.cm.bigdata.service.kpi.task.KpiKhxzWgyTask;
import com.cm.bigdata.utils.ExcelExportUtil;
import com.cm.common.base.AbstractService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ExecutorService;
@ -18,7 +26,7 @@ import java.util.concurrent.Executors;
public class KpiKhxzServiceImpl extends AbstractService implements IKpiKhxzService {
@Autowired
private IKpiKhxzDao kpiKhxzDao;
private IKpiKhxzWgyDao kpiKhxzWgyDao;
@Autowired
private IKpiService kpiService;
@ -35,23 +43,43 @@ public class KpiKhxzServiceImpl extends AbstractService implements IKpiKhxzServi
// 更新案件1任务
kpiService.updateCaseCount();
KpiUpdateMonitor.getInstance().complete();
// 更新4级网格员日统计1任务
kpiService.updateCommunityBossDayCount(khYear, khMonth, 3);
KpiUpdateMonitor.getInstance().complete();
// 更新4级网格员4任务
kpiKhxzWgyTask.update(khYear, khMonth, 3);
// 更新5级网格员日统计1任务
kpiService.updateCommunityBossDayCount(khYear, khMonth, 4);
KpiUpdateMonitor.getInstance().complete();
// 更新5级网格员4个任务
kpiKhxzWgyTask.update(khYear, khMonth, 4);
// 更新专管员调度员日统计1任务
kpiService.updateNPersonDayCount("72bff485-69be-4570-9f30-ff65fdbe5251", khYear, khMonth);
KpiUpdateMonitor.getInstance().complete();
});
}
@Override
public List<Map<String, Object>> listWgy(Map<String, Object> queryMap) {
return kpiKhxzDao.listWgy(queryMap);
public List<KpiKhxzWgyDTO> listWgy(Map<String, Object> queryMap) {
return kpiKhxzWgyDao.listWgy(queryMap);
}
@Override
public void exportWgy(HttpServletResponse httpServletResponse, Map<String, Object> queryMap) throws IOException {
List<KpiKhxzWgyDTO> wgys = listWgy(queryMap);
ExcelExportUtil.simple(httpServletResponse, "网格员考核细则", wgys, KpiKhxzWgyDTO.class);
}
@Override
public void updateWgy(Integer wgyLevel, KpiWgyVO kpiWgyVO) {
kpiWgyVO.getDatas().forEach(params -> {
params.put("wgyLevel", wgyLevel);
kpiKhxzWgyDao.update(params);
});
}
}

View File

@ -114,9 +114,13 @@ public class KpiServiceImpl implements IKpiService {
@Override
public void updateNPersonDayCount(String departmentId, String startTime, String endTime) {
updateNPersonDayCount(departmentId, KpiUtil.ZGY_ROLE_ID, startTime, endTime);
}
private void updateNPersonDayCount(String departmentId, String roleId, String startTime, String endTime) {
Map<String, Object> params = new HashMap<>();
// 专管员
params.put("roleId", "bc405346-8714-4ded-89ac-9cc4d755f66a");
// 专管员调度员
params.put("roleId", roleId);
params.put("departmentId", departmentId);
List<UserPO> userPOS = userService.listPO(params);
if (userPOS.isEmpty()) {
@ -149,12 +153,26 @@ public class KpiServiceImpl implements IKpiService {
queryParams.put("isSignout", isSignout);
queryParams.put("isSignoutEarly", isSignoutEarly);
queryParams.put("workDistance", workDistance);
if (StringUtils.equals(roleId, KpiUtil.DDY_ROLE_ID)) {
queryParams.put("dayScore", KpiScoreUtil.getDdyDayScore(isSignin, isSigninLate, isSignout, isSignoutEarly, isHoliday));
}
if (StringUtils.equals(roleId, KpiUtil.ZGY_ROLE_ID)) {
queryParams.put("dayScore", KpiScoreUtil.getZgyDayScore(isSignin, isSigninLate, isSignout, isSignoutEarly, isHoliday));
}
queryParams.put("isHoliday", isHoliday);
kpiDao.saveNPersonDayCount(queryParams);
});
});
}
@Override
public void updateNPersonDayCount(String roleId, Integer year, Integer month) {
DateTime dateTime = DateTime.parse(String.format("%04d-%02d", year, month), DateTimeFormat.forPattern("yyyy-MM"));
String startTime = dateTime.dayOfMonth().withMinimumValue().toString(DateTimeFormat.forPattern(ISystemConstant.DATE_FORMATTER_YYYY_MM_DD));
String endTime = dateTime.dayOfMonth().withMaximumValue().toString(DateTimeFormat.forPattern(ISystemConstant.DATE_FORMATTER_YYYY_MM_DD));
updateNPersonDayCount(null, roleId, startTime, endTime);
}
private List<String> listDate(String startTime, String endTime) {
LocalDateTime startLocalDateTime = LocalDateTime.now();
LocalDateTime endLocalDateTime = LocalDateTime.now();
@ -234,6 +252,7 @@ public class KpiServiceImpl implements IKpiService {
for (ReportCaseAssignPO reportCaseAssignPO : reportCaseAssignPOS) {
if (StringUtils.equals(reportCasePO.getReportCaseId(), reportCaseAssignPO.getCaseId())) {
params.put("gmtAssign", reportCaseAssignPO.getGmtCreate());
params.put("assignUserId", reportCaseAssignPO.getCreator());
params.put("handleEndTimeLong", reportCaseAssignPO.getHandleTime());
// 截至时间
LocalDateTime assignDateTime = LocalDateTime.parse(reportCaseAssignPO.getGmtCreate().substring(0, 19), DATE_TIME_FORMATTER);

View File

@ -0,0 +1,72 @@
package com.cm.bigdata.service.kpi.task;
import com.cm.bigdata.dao.kpi.IKpiDao;
import com.cm.bigdata.dao.kpi.IKpiKhxzDdyDao;
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.KpiKhxzDdyERunnable;
import com.cm.bigdata.utils.KpiUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
@Service
public class KpiKhxzDdyTask {
@Autowired
private IKpiDao kpiDao;
@Autowired
private IKpiKhxzDdyDao kpiKhxzDdyDao;
@Autowired
private IUserService userService;
private ExecutorService executorService = Executors.newFixedThreadPool(10);
public void update(int khYear, int khMonth) {
deleteBase(khYear, khMonth);
updateBase(khYear, khMonth);
List<String> userIds = listUserId(khYear, khMonth);
if (userIds.isEmpty()) {
return;
}
executorService.execute(new KpiKhxzDdyCRunnable(kpiKhxzDdyDao, kpiDao, khYear, khMonth, userIds));
executorService.execute(new KpiKhxzDdyERunnable(kpiKhxzDdyDao, kpiDao, khYear, khMonth, userIds));
}
private void deleteBase(int khYear, int khMonth) {
Map<String, Object> params = new HashMap<>();
params.put("khYear", khYear);
params.put("khMonth", khMonth);
kpiKhxzDdyDao.delete(params);
}
private void updateBase(int khYear, int khMonth) {
// 调度员
Map<String, Object> params = new HashMap<>();
params.put("roleId", KpiUtil.DDY_ROLE_ID);
List<UserPO> userPOS = userService.listPO(params);
userPOS.forEach(userPO -> {
Map<String, Object> saveParams = new HashMap<>();
saveParams.put("khYear", khYear);
saveParams.put("khMonth", khMonth);
saveParams.put("userId", userPO.getUserId());
saveParams.put("userUsername", userPO.getUserUsername());
saveParams.put("B", userPO.getUserName());
kpiKhxzDdyDao.save(saveParams);
});
}
private List<String> listUserId(int khYear, int khMonth) {
Map<String, Object> params = new HashMap<>();
params.put("khYear", khYear);
params.put("khMonth", khMonth);
return kpiKhxzDdyDao.listUserId(params);
}
}

View File

@ -36,7 +36,6 @@ public class KpiKhxzWgyTask {
@Autowired
private ICommunityBossService communityBossService;
private ExecutorService executorService = Executors.newFixedThreadPool(10);
public void update(int khYear, int khMonth, int wgyLevel) {

View File

@ -0,0 +1,60 @@
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.NPersonDayCountPO;
import com.cm.bigdata.utils.KpiUtil;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class KpiKhxzDdyCRunnable implements Runnable{
private IKpiKhxzDdyDao kpiKhxzDdyDao;
private IKpiDao kpiDao;
private int khYear;
private int khMonth;
private List<String> userIds;
public KpiKhxzDdyCRunnable(IKpiKhxzDdyDao kpiKhxzDdyDao, IKpiDao kpiDao, int khYear, int khMonth, List<String> userIds) {
this.kpiKhxzDdyDao = kpiKhxzDdyDao;
this.kpiDao = kpiDao;
this.khYear = khYear;
this.khMonth = khMonth;
this.userIds = userIds;
}
@Override
public void run() {
List<String> dates = KpiUtil.listDate(khYear, khMonth);
Map<String, Object> params = new HashMap<>();
userIds.forEach(userId -> {
params.put("userId", userId);
params.put("startTime", dates.get(0));
params.put("endTime", dates.get(dates.size() - 1));
List<NPersonDayCountPO> nPersonDayCountPOS = kpiDao.listNPersonDayCountPO(params);
int workDay = 0;
double totalDayScore = 0D;
for (NPersonDayCountPO nPersonDayCountPO : nPersonDayCountPOS) {
totalDayScore += nPersonDayCountPO.getDayScore();
int isHoliday = nPersonDayCountPO.getIsHoliday();
if (isHoliday == 1) {
continue;
}
workDay++;
}
double totalScore = workDay == 0 ? 0D : totalDayScore / workDay;
// 保存总分
Map<String, Object> updateParams = new HashMap<>();
updateParams.put("khYear", khYear);
updateParams.put("khMonth", khMonth);
updateParams.put("userId", userId);
updateParams.put("C", totalScore);
kpiKhxzDdyDao.updateC(updateParams);
});
KpiUpdateMonitor.getInstance().complete();
}
}

View File

@ -0,0 +1,45 @@
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 KpiKhxzDdyERunnable implements Runnable {
private IKpiKhxzDdyDao kpiKhxzDdyDao;
private IKpiDao kpiDao;
private int khYear;
private int khMonth;
private List<String> userIds;
public KpiKhxzDdyERunnable(IKpiKhxzDdyDao kpiKhxzDdyDao, IKpiDao kpiDao, int khYear, int khMonth, List<String> userIds) {
this.kpiKhxzDdyDao = kpiKhxzDdyDao;
this.kpiDao = kpiDao;
this.khYear = khYear;
this.khMonth = khMonth;
this.userIds = userIds;
}
@Override
public void run() {
Map<String, Object> params = new HashMap<>();
userIds.forEach(userId -> {
params.put("assignUserId", userId);
List<CasePO> casePOS = kpiDao.listCase(params);
Map<String, Object> 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();
}
}

View File

@ -13,6 +13,7 @@ public class ExcelExportUtil {
response.setContentType("application/vnd.ms-excel");
response.setCharacterEncoding("utf-8");
String exportName = URLEncoder.encode(fileName, "utf-8");
response.setHeader("Access-Control-Expose-Headers", "Content-Disposition");
response.setHeader("Content-disposition", "attachment;filename=" + exportName + ".xlsx");
EasyExcel.write(response.getOutputStream(), clazz).sheet("sheet1").doWrite(dataList);
}

View File

@ -5,6 +5,11 @@ public class KpiScoreUtil {
private static double WGY_SIGNIN_SCORE = 10D;
private static double WGY_SIGNOUT_SCORE = 10D;
private static double WGY_DISTANCE_SCORE = 20D;
private static double DDY_SIGNIN_SCORE = 15D;
private static double DDY_SIGNOUT_SCORE = 15D;
private static double ZGY_SIGNIN_SCORE = 15D;
private static double ZGY_SIGNOUT_SCORE = 15D;
public static double getWgyDayScore(int isSignin, int isSigninLate, int isSignout, int isSignoutEarly, double workDistance, int isHoliday) {
if (isHoliday == 1) {
@ -25,5 +30,35 @@ public class KpiScoreUtil {
return signinScore + signoutScore + distanceScore;
}
public static double getDdyDayScore(int isSignin, int isSigninLate, int isSignout, int isSignoutEarly, int isHoliday) {
if (isHoliday == 1) {
return 0;
}
double signinScore = 0D;
double signoutScore = 0D;
if (isSignin == 1) {
signinScore += isSigninLate == 1 ? DDY_SIGNIN_SCORE / 2 : DDY_SIGNIN_SCORE;
}
if (isSignout == 1) {
signoutScore += isSignoutEarly == 1 ? DDY_SIGNOUT_SCORE / 2 : DDY_SIGNOUT_SCORE;
}
return signinScore + signoutScore;
}
public static double getZgyDayScore(int isSignin, int isSigninLate, int isSignout, int isSignoutEarly, int isHoliday) {
if (isHoliday == 1) {
return 0;
}
double signinScore = 0D;
double signoutScore = 0D;
if (isSignin == 1) {
signinScore += isSigninLate == 1 ? ZGY_SIGNIN_SCORE / 2 : ZGY_SIGNIN_SCORE;
}
if (isSignout == 1) {
signoutScore += isSignoutEarly == 1 ? ZGY_SIGNOUT_SCORE / 2 : ZGY_SIGNOUT_SCORE;
}
return signinScore + signoutScore;
}
}

View File

@ -19,6 +19,9 @@ import java.util.*;
public class KpiUtil {
public static String DDY_ROLE_ID = "72bff485-69be-4570-9f30-ff65fdbe5251";
public static String ZGY_ROLE_ID = "bc405346-8714-4ded-89ac-9cc4d755f66a";
public static boolean isdateTimeIn24Hours(String date1, DateTime date2) {
date1 = date1.split("\\.")[0];
DateTime date1DateTime = DateTime.parse(date1, DateTimeFormat.forPattern(ISystemConstant.DATE_FORMATTER_YYYY_MM_DD_HH_MM_SS));

View File

@ -57,6 +57,22 @@
sru.role_id = #{roleId}
)
</if>
<if test="roleIds != null and roleIds.size > 0">
AND
EXISTS (
SELECT
1
FROM
sys_role_user sru
WHERE
su.user_id = sru.user_id
AND
sru.role_id IN
<foreach collection="roleIds" index="index" open="(" separator="," close=")">
#{roleIds[${index}]}
</foreach>
)
</if>
</select>
</mapper>

View File

@ -0,0 +1,13 @@
<?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.cm.bigdata.dao.kpi.IKpiConfigDao">
<select id="listConfig" parameterType="map">
SELECT
config_key,
config_value
FROM
kpi_config
</select>
</mapper>

View File

@ -0,0 +1,72 @@
<?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.cm.bigdata.dao.kpi.IKpiKhxzDdyDao">
<resultMap id="kpiKhxzDdyDTO" type="com.cm.bigdata.pojo.dtos.kpi.KpiKhxzDdyDTO">
</resultMap>
<insert id="save" parameterType="map">
INSERT INTO kpi_khxz_ddy (
kh_year,
kh_month,
user_id,
user_username,
B
) VALUES (
#{khYear},
#{khMonth},
#{userId},
#{userUsername},
#{B}
)
</insert>
<delete id="delete" parameterType="map">
DELETE FROM
kpi_khxz_ddy
WHERE
kh_year = #{khYear}
AND
kh_month = #{khMonth}
</delete>
<select id="listUserId" parameterType="map" resultType="java.lang.String">
SELECT
user_id
FROM
kpi_khxz_ddy
WHERE
kh_year = #{khYear}
AND
kh_month = #{khMonth}
</select>
<update id="updateC" parameterType="map">
UPDATE
kpi_khxz_ddy
SET
C = #{C}
WHERE
kh_year = #{khYear}
AND
kh_month = #{khMonth}
AND
user_id = #{userId}
</update>
<update id="updateEF" parameterType="map">
UPDATE
kpi_khxz_ddy
SET
E = #{E},
F = #{F}
WHERE
kh_year = #{khYear}
AND
kh_month = #{khMonth}
AND
user_id = #{userId}
</update>
</mapper>

View File

@ -1,43 +0,0 @@
<?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.cm.bigdata.dao.kpi.IKpiKhxzDao">
<select id="listWgy" parameterType="map" resultType="map">
SELECT
*
FROM
kpi_khxz_wgy_${wgyLevel}
<where>
<if test="areaId != null and areaId != ''">
area_id = #{areaId}
</if>
<if test="communityId != null and communityId != ''">
AND
community_id = #{communityId}
</if>
<if test="keywords != null and keywords != ''">
AND (
B LIKE CONCAT('%', #{keywords}, '%')
OR
user_username LIKE CONCAT('%', #{keywords}, '%')
)
</if>
<if test="khYear != null and khYear != ''">
AND
kh_year = #{khYear}
</if>
AND
<if test="khMonth != null and khMonth != ''">
kh_month = #{khMonth}
</if>
<if test="userIds != null and userIds.size > 0">
AND
user_id IN
<foreach collection="userIds" index="index" open="(" separator="," close=")">
#{userIds[${index}]}
</foreach>
</if>
</where>
</select>
</mapper>

View File

@ -2,6 +2,65 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.cm.bigdata.dao.kpi.IKpiKhxzWgyDao">
<resultMap id="kpiKhxzWgyDTO" type="com.cm.bigdata.pojo.dtos.kpi.KpiKhxzWgyDTO">
<result column="id" property="id"/>
<result column="area_id" property="areaId"/>
<result column="community_id" property="communityId"/>
<result column="user_id" property="userId"/>
<result column="kh_year" property="khYear"/>
<result column="kh_month" property="khMonth"/>
<result column="A" property="a"/>
<result column="B" property="b"/>
<result column="C" property="c"/>
<result column="D" property="d"/>
<result column="E" property="e"/>
<result column="F" property="f"/>
<result column="G" property="g"/>
<result column="H" property="h"/>
<result column="I" property="i"/>
<result column="J" property="j"/>
<result column="K" property="k"/>
<result column="L" property="l"/>
<result column="M" property="m"/>
<result column="reasonM" property="reasonM"/>
<result column="N" property="n"/>
<result column="reasonN" property="reasonN"/>
<result column="O" property="o"/>
<result column="reasonO" property="reasonO"/>
<result column="P" property="p"/>
<result column="reasonP" property="reasonP"/>
<result column="Q" property="q"/>
<result column="R" property="r"/>
<result column="reasonR" property="reasonR"/>
<result column="S" property="s"/>
<result column="T" property="t"/>
<result column="U" property="u"/>
<result column="reasonU" property="reasonU"/>
<result column="V" property="v"/>
<result column="reasonV" property="reasonV"/>
<result column="W" property="w"/>
<result column="reasonW" property="reasonW"/>
<result column="X" property="x"/>
<result column="reasonX" property="reasonX"/>
<result column="Y" property="y"/>
<result column="reasonY" property="reasonY"/>
<result column="Z" property="z"/>
<result column="reasonZ" property="reasonZ"/>
<result column="AA" property="aA"/>
<result column="reasonAA" property="reasonAA"/>
<result column="AB" property="aB"/>
<result column="reasonAB" property="reasonAB"/>
<result column="AC" property="aC"/>
<result column="reasonAC" property="reasonAC"/>
<result column="AD" property="aD"/>
<result column="reasonAD" property="reasonAD"/>
<result column="AE" property="aE"/>
<result column="AF" property="aF"/>
<result column="AG" property="aG"/>
<result column="gmt_modified" property="gmtModified"/>
<result column="modifier" property="modifier"/>
</resultMap>
<insert id="save" parameterType="map">
INSERT INTO kpi_khxz_wgy_${wgyLevel}(
area_id,
@ -31,15 +90,42 @@
kh_month = #{khMonth}
</delete>
<select id="listWgy" parameterType="map" resultType="map">
<select id="listWgy" parameterType="map" resultMap="kpiKhxzWgyDTO">
SELECT
*
FROM
kpi_khxz_wgy_${wgyLevel}
WHERE
kh_year = #{khYear}
<where>
<if test="areaId != null and areaId != ''">
area_id = #{areaId}
</if>
<if test="communityId != null and communityId != ''">
AND
community_id = #{communityId}
</if>
<if test="keywords != null and keywords != ''">
AND (
B LIKE CONCAT('%', #{keywords}, '%')
OR
user_username LIKE CONCAT('%', #{keywords}, '%')
)
</if>
<if test="khYear != null and khYear != ''">
AND
kh_year = #{khYear}
</if>
AND
<if test="khMonth != null and khMonth != ''">
kh_month = #{khMonth}
</if>
<if test="userIds != null and userIds.size > 0">
AND
user_id IN
<foreach collection="userIds" index="index" open="(" separator="," close=")">
#{userIds[${index}]}
</foreach>
</if>
</where>
</select>
<select id="listUserId" parameterType="map" resultType="java.lang.String">
@ -84,5 +170,54 @@
user_id = #{userId}
</update>
<insert id="update" parameterType="map">
UPDATE
kpi_khxz_wgy_${wgyLevel}
SET
F = #{F},
H = #{H},
J = #{J},
L = #{L},
M = #{M},
reasonM = #{reasonM},
N = #{N},
reasonN = #{reasonN},
O = #{O},
reasonO = #{reasonO},
P = #{P},
Q = #{Q},
reasonQ = #{reasonQ},
R = #{R},
reasonR = #{reasonR},
U = #{U},
reasonU = #{reasonU},
V = #{V},
reasonV = #{reasonV},
W = #{W},
reasonW = #{reasonW},
X = #{X},
reasonX = #{reasonX},
Y = #{Y},
reasonY = #{reasonY},
Z = #{Z},
reasonZ = #{reasonZ},
AA = #{AA},
reasonAA = #{reasonAA},
AB = #{AB},
reasonAB = #{reasonAB},
AC = #{AC},
reasonAC = #{reasonAC},
AD = #{AD},
reasonAD = #{reasonAD},
AE = #{AE},
AG = #{AG}
WHERE
kh_year = #{khYear}
AND
kh_month = #{khMonth}
AND
user_id = #{userId}
</insert>
</mapper>

View File

@ -41,6 +41,7 @@
<result column="gmt_inspect" property="gmtInspect"/>
<result column="is_self" property="isSelf"/>
<result column="report_user_id" property="reportUserId"/>
<result column="assign_user_id" property="assignUserId"/>
<result column="handle_user_id" property="handleUserId"/>
<result column="inspect_user_id" property="inspectUserId"/>
<result column="inspect_score" property="inspectScore"/>
@ -241,6 +242,7 @@
is_inspect,
is_self,
report_user_id,
assign_user_id,
handle_user_id,
inspect_user_id,
inspect_score,
@ -273,6 +275,7 @@
#{isInspect},
#{isSelf},
#{reportUserId},
#{assignUserId},
#{handleUserId},
#{inspectUserId},
#{inspectScore},
@ -304,6 +307,7 @@
gmt_inspect = #{gmtInspect},
is_self = #{isSelf},
report_user_id = #{reportUserId},
assign_user_id = #{assignUserId},
handle_user_id = #{handleUserId},
inspect_user_id = #{inspectUserId},
inspect_score = #{inspectScore},
@ -342,6 +346,7 @@
gmt_inspect,
is_self,
report_user_id,
assign_user_id,
handle_user_id,
inspect_user_id,
inspect_score,
@ -374,6 +379,10 @@
AND
report_user_id = #{reportUserId}
</if>
<if test="assignUserId != null and assignUserId != ''">
AND
assign_user_id = #{assignUserId}
</if>
<if test="handleUserId != null and handleUserId != ''">
AND
handle_user_id = #{handleUserId}
@ -428,6 +437,7 @@
gmt_inspect,
is_self,
report_user_id,
assign_user_id,
handle_user_id,
inspect_user_id,
inspect_score,
@ -450,6 +460,17 @@
AND
report_user_id = #{reportUserId}
</if>
<if test="assignUserId != null and assignUserId != ''">
AND
assign_user_id = #{assignUserId}
</if>
<if test="assignUserIds != null and assignUserIds.size > 0">
AND
assign_user_id IN
<foreach collection="assignUserIds" index="index" open="(" separator="," close=")">
#{assignUserIds[${index}]}
</foreach>
</if>
<if test="handleUserId != null and handleUserId != ''">
AND
handle_user_id = #{handleUserId}