增加考核细则后台功能
This commit is contained in:
parent
256f7276b1
commit
ff1985b4fb
21
src/main/java/com/cm/bigdata/dao/kpi/IKpiKhxzWgzDao.java
Normal file
21
src/main/java/com/cm/bigdata/dao/kpi/IKpiKhxzWgzDao.java
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
package com.cm.bigdata.dao.kpi;
|
||||||
|
|
||||||
|
import com.cm.bigdata.pojo.dtos.kpi.KpiKhxzWgzDTO;
|
||||||
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
@Repository
|
||||||
|
public interface IKpiKhxzWgzDao {
|
||||||
|
|
||||||
|
void save(Map<String, Object> params);
|
||||||
|
|
||||||
|
void delete(Map<String, Object> params);
|
||||||
|
|
||||||
|
void updateCDEFGH(Map<String, Object> updateParams);
|
||||||
|
|
||||||
|
List<KpiKhxzWgzDTO> list(Map<String, Object> params);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
21
src/main/java/com/cm/bigdata/dao/kpi/IKpiKhxzZfGaDao.java
Normal file
21
src/main/java/com/cm/bigdata/dao/kpi/IKpiKhxzZfGaDao.java
Normal 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 IKpiKhxzZfGaDao {
|
||||||
|
|
||||||
|
void save(Map<String, Object> params);
|
||||||
|
|
||||||
|
void delete(Map<String, Object> params);
|
||||||
|
|
||||||
|
List<String> listUserId(Map<String, Object> params);
|
||||||
|
|
||||||
|
void updateC(Map<String, Object> updateParams);
|
||||||
|
|
||||||
|
void updateDEF(Map<String, Object> updateParams);
|
||||||
|
|
||||||
|
}
|
@ -10,6 +10,7 @@ public class CommunityBossDTO {
|
|||||||
private String communityBossParentUserId;
|
private String communityBossParentUserId;
|
||||||
private Integer communityBossLevel;
|
private Integer communityBossLevel;
|
||||||
private String userName;
|
private String userName;
|
||||||
|
private String userUsername;
|
||||||
private String communityId;
|
private String communityId;
|
||||||
private String communityName;
|
private String communityName;
|
||||||
|
|
||||||
@ -77,6 +78,14 @@ public class CommunityBossDTO {
|
|||||||
this.userName = userName;
|
this.userName = userName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getUserUsername() {
|
||||||
|
return userUsername;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUserUsername(String userUsername) {
|
||||||
|
this.userUsername = userUsername;
|
||||||
|
}
|
||||||
|
|
||||||
public String getCommunityId() {
|
public String getCommunityId() {
|
||||||
return communityId;
|
return communityId;
|
||||||
}
|
}
|
||||||
|
@ -1,4 +0,0 @@
|
|||||||
package com.cm.bigdata.pojo.dtos.kpi;
|
|
||||||
|
|
||||||
public class KpiKhxzWgy3DTO {
|
|
||||||
}
|
|
@ -0,0 +1,90 @@
|
|||||||
|
package com.cm.bigdata.pojo.dtos.kpi;
|
||||||
|
|
||||||
|
import com.alibaba.excel.annotation.ExcelIgnore;
|
||||||
|
import com.alibaba.excel.annotation.ExcelProperty;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
|
||||||
|
public class KpiKhxzWgzDTO {
|
||||||
|
|
||||||
|
@ExcelIgnore
|
||||||
|
private Long id;
|
||||||
|
@ExcelIgnore
|
||||||
|
private String areaId;
|
||||||
|
@ExcelIgnore
|
||||||
|
private String communityId;
|
||||||
|
@ExcelIgnore
|
||||||
|
private String userId;
|
||||||
|
@ExcelIgnore
|
||||||
|
private String userUsername;
|
||||||
|
@ExcelIgnore
|
||||||
|
private Integer khYear;
|
||||||
|
@ExcelIgnore
|
||||||
|
private Integer khMonth;
|
||||||
|
@ExcelProperty(index = 1)
|
||||||
|
@JsonProperty("B")
|
||||||
|
private String b;
|
||||||
|
|
||||||
|
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 String getUserUsername() {
|
||||||
|
return userUsername;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUserUsername(String userUsername) {
|
||||||
|
this.userUsername = userUsername;
|
||||||
|
}
|
||||||
|
|
||||||
|
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 String getB() {
|
||||||
|
return b;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setB(String b) {
|
||||||
|
this.b = b;
|
||||||
|
}
|
||||||
|
}
|
@ -58,9 +58,9 @@ public class KpiKhxzServiceImpl extends AbstractService implements IKpiKhxzServi
|
|||||||
// 更新5级网格员,4个任务
|
// 更新5级网格员,4个任务
|
||||||
kpiKhxzWgyTask.update(khYear, khMonth, 4);
|
kpiKhxzWgyTask.update(khYear, khMonth, 4);
|
||||||
|
|
||||||
// 更新专管员、调度员日统计,1任务
|
// // 更新专管员、调度员日统计,1任务
|
||||||
kpiService.updateNPersonDayCount("72bff485-69be-4570-9f30-ff65fdbe5251", khYear, khMonth);
|
// kpiService.updateNPersonDayCount("72bff485-69be-4570-9f30-ff65fdbe5251", khYear, khMonth);
|
||||||
KpiUpdateMonitor.getInstance().complete();
|
// KpiUpdateMonitor.getInstance().complete();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,10 +2,11 @@ package com.cm.bigdata.service.kpi.task;
|
|||||||
|
|
||||||
import com.cm.bigdata.dao.kpi.IKpiDao;
|
import com.cm.bigdata.dao.kpi.IKpiDao;
|
||||||
import com.cm.bigdata.dao.kpi.IKpiKhxzDdyDao;
|
import com.cm.bigdata.dao.kpi.IKpiKhxzDdyDao;
|
||||||
|
import com.cm.bigdata.monitor.KpiUpdateMonitor;
|
||||||
import com.cm.bigdata.pojo.pos.kpi.UserPO;
|
import com.cm.bigdata.pojo.pos.kpi.UserPO;
|
||||||
import com.cm.bigdata.service.kpi.IUserService;
|
import com.cm.bigdata.service.kpi.IUserService;
|
||||||
import com.cm.bigdata.service.kpi.task.sub.KpiKhxzDdyCRunnable;
|
import com.cm.bigdata.service.kpi.task.sub.KpiKhxzDdyCRunnable;
|
||||||
import com.cm.bigdata.service.kpi.task.sub.KpiKhxzDdyERunnable;
|
import com.cm.bigdata.service.kpi.task.sub.KpiKhxzDdyEFRunnable;
|
||||||
import com.cm.bigdata.utils.KpiUtil;
|
import com.cm.bigdata.utils.KpiUtil;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
@ -26,17 +27,18 @@ public class KpiKhxzDdyTask {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private IUserService userService;
|
private IUserService userService;
|
||||||
|
|
||||||
private ExecutorService executorService = Executors.newFixedThreadPool(10);
|
private ExecutorService executorService = Executors.newFixedThreadPool(2);
|
||||||
|
|
||||||
public void update(int khYear, int khMonth) {
|
public void update(int khYear, int khMonth) {
|
||||||
deleteBase(khYear, khMonth);
|
deleteBase(khYear, khMonth);
|
||||||
updateBase(khYear, khMonth);
|
updateBase(khYear, khMonth);
|
||||||
List<String> userIds = listUserId(khYear, khMonth);
|
List<String> userIds = listUserId(khYear, khMonth);
|
||||||
if (userIds.isEmpty()) {
|
if (userIds.isEmpty()) {
|
||||||
|
KpiUpdateMonitor.getInstance().complete();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
executorService.execute(new KpiKhxzDdyCRunnable(kpiKhxzDdyDao, kpiDao, khYear, khMonth, userIds));
|
executorService.execute(new KpiKhxzDdyCRunnable(kpiKhxzDdyDao, kpiDao, khYear, khMonth, userIds));
|
||||||
executorService.execute(new KpiKhxzDdyERunnable(kpiKhxzDdyDao, kpiDao, khYear, khMonth, userIds));
|
executorService.execute(new KpiKhxzDdyEFRunnable(kpiKhxzDdyDao, kpiDao, khYear, khMonth, userIds));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void deleteBase(int khYear, int khMonth) {
|
private void deleteBase(int khYear, int khMonth) {
|
||||||
|
@ -36,13 +36,14 @@ public class KpiKhxzWgyTask {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private ICommunityBossService communityBossService;
|
private ICommunityBossService communityBossService;
|
||||||
|
|
||||||
private ExecutorService executorService = Executors.newFixedThreadPool(10);
|
private ExecutorService executorService = Executors.newFixedThreadPool(2);
|
||||||
|
|
||||||
public void update(int khYear, int khMonth, int wgyLevel) {
|
public void update(int khYear, int khMonth, int wgyLevel) {
|
||||||
deleteBaseWgy(khYear, khMonth, wgyLevel);
|
deleteBaseWgy(khYear, khMonth, wgyLevel);
|
||||||
updateBaseWgy(khYear, khMonth, wgyLevel);
|
updateBaseWgy(khYear, khMonth, wgyLevel);
|
||||||
List<String> userIds = listUserIds(khYear, khMonth, wgyLevel);
|
List<String> userIds = listUserIds(khYear, khMonth, wgyLevel);
|
||||||
if (userIds.isEmpty()) {
|
if (userIds.isEmpty()) {
|
||||||
|
KpiUpdateMonitor.getInstance().complete();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
executorService.execute(new KpiKhxzWgyCRunnable(kpiKhxzWgyDao, kpiDao, khYear, khMonth, wgyLevel, userIds));
|
executorService.execute(new KpiKhxzWgyCRunnable(kpiKhxzWgyDao, kpiDao, khYear, khMonth, wgyLevel, userIds));
|
||||||
|
@ -0,0 +1,68 @@
|
|||||||
|
package com.cm.bigdata.service.kpi.task;
|
||||||
|
|
||||||
|
import com.cm.bigdata.dao.kpi.IKpiKhxzWgyDao;
|
||||||
|
import com.cm.bigdata.dao.kpi.IKpiKhxzWgzDao;
|
||||||
|
import com.cm.bigdata.monitor.KpiUpdateMonitor;
|
||||||
|
import com.cm.bigdata.pojo.dtos.kpi.CommunityBossDTO;
|
||||||
|
import com.cm.bigdata.pojo.dtos.kpi.KpiKhxzWgzDTO;
|
||||||
|
import com.cm.bigdata.service.kpi.ICommunityBossService;
|
||||||
|
import com.cm.bigdata.service.kpi.IUserService;
|
||||||
|
import com.cm.bigdata.service.kpi.task.sub.KpiKhxzWgzCDEFGHRunnable;
|
||||||
|
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 KpiKhxzWgzTask {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ICommunityBossService communityBossService;
|
||||||
|
@Autowired
|
||||||
|
private IUserService userService;
|
||||||
|
@Autowired
|
||||||
|
private IKpiKhxzWgzDao kpiKhxzWgzDao;
|
||||||
|
@Autowired
|
||||||
|
private IKpiKhxzWgyDao kpiKhxzWgyDao;
|
||||||
|
private ExecutorService executorService = Executors.newFixedThreadPool(2);
|
||||||
|
|
||||||
|
private void update(int khYear, int khMonth) {
|
||||||
|
deleteBase(khYear, khMonth);
|
||||||
|
updateBase(khYear, khMonth);
|
||||||
|
List<KpiKhxzWgzDTO> kpiKhxzWgzDTOS = kpiKhxzWgzDao.list(new HashMap<>());
|
||||||
|
if (kpiKhxzWgzDTOS.isEmpty()) {
|
||||||
|
KpiUpdateMonitor.getInstance().complete();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
executorService.execute(new KpiKhxzWgzCDEFGHRunnable(kpiKhxzWgzDao, kpiKhxzWgyDao, khYear, khMonth, kpiKhxzWgzDTOS));
|
||||||
|
}
|
||||||
|
|
||||||
|
private void deleteBase(int khYear, int khMonth) {
|
||||||
|
Map<String, Object> params = new HashMap<>();
|
||||||
|
params.put("khYear", khYear);
|
||||||
|
params.put("khMonth", khMonth);
|
||||||
|
kpiKhxzWgzDao.delete(params);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void updateBase(int khYear, int khMonth) {
|
||||||
|
Map<String, Object> params = new HashMap<>();
|
||||||
|
params.put("communityBossLevel", 2);
|
||||||
|
List<CommunityBossDTO> communityBossDTOS = communityBossService.list(params);
|
||||||
|
communityBossDTOS.forEach(communityBossDTO -> {
|
||||||
|
Map<String, Object> saveParams = new HashMap<>();
|
||||||
|
saveParams.put("areaId", communityBossDTO.getAreaId());
|
||||||
|
saveParams.put("communityId", communityBossDTO.getCommunityId());
|
||||||
|
saveParams.put("userId", communityBossDTO.getCommunityBossUserId());
|
||||||
|
saveParams.put("userUsername", communityBossDTO.getUserUsername());
|
||||||
|
saveParams.put("khYear", khYear);
|
||||||
|
saveParams.put("khMonth", khMonth);
|
||||||
|
saveParams.put("B", communityBossDTO.getUserName());
|
||||||
|
kpiKhxzWgzDao.save(saveParams);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,76 @@
|
|||||||
|
package com.cm.bigdata.service.kpi.task;
|
||||||
|
|
||||||
|
import com.cm.bigdata.dao.kpi.IKpiDao;
|
||||||
|
import com.cm.bigdata.dao.kpi.IKpiKhxzZfGaDao;
|
||||||
|
import com.cm.bigdata.monitor.KpiUpdateMonitor;
|
||||||
|
import com.cm.bigdata.pojo.pos.kpi.UserPO;
|
||||||
|
import com.cm.bigdata.service.kpi.IDepartmentService;
|
||||||
|
import com.cm.bigdata.service.kpi.IUserService;
|
||||||
|
import com.cm.bigdata.service.kpi.task.sub.KpiKhxzZfGaCRunnable;
|
||||||
|
import com.cm.bigdata.service.kpi.task.sub.KpiKhxzZfGaDEFRunnable;
|
||||||
|
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 KpiKhxzZfGaTask {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IKpiKhxzZfGaDao kpiKhxzZfGaDao;
|
||||||
|
@Autowired
|
||||||
|
private IKpiDao kpiDao;
|
||||||
|
@Autowired
|
||||||
|
private IUserService userService;
|
||||||
|
private ExecutorService executorService = Executors.newFixedThreadPool(2);
|
||||||
|
|
||||||
|
public void update(int khYear, int khMonth) {
|
||||||
|
deleteBase(khYear, khMonth);
|
||||||
|
updateBase(KpiUtil.GA_DEPARTMENT_ID, khYear, khMonth);
|
||||||
|
updateBase(KpiUtil.ZF_DEPARTMENT_ID, khYear, khMonth);
|
||||||
|
List<String> userIds = listUserId(khYear, khMonth);
|
||||||
|
if (userIds.isEmpty()) {
|
||||||
|
KpiUpdateMonitor.getInstance().complete();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
executorService.execute(new KpiKhxzZfGaCRunnable(kpiKhxzZfGaDao, kpiDao, khYear, khMonth, userIds));
|
||||||
|
executorService.execute(new KpiKhxzZfGaDEFRunnable(kpiKhxzZfGaDao, 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);
|
||||||
|
kpiKhxzZfGaDao.delete(params);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void updateBase(String departmentId, int khYear, int khMonth) {
|
||||||
|
Map<String, Object> params = new HashMap<>();
|
||||||
|
// 执法局
|
||||||
|
params.put("departmentId", departmentId);
|
||||||
|
List<UserPO> userPOS = userService.listPO(params);
|
||||||
|
userPOS.forEach(userPO -> {
|
||||||
|
Map<String, Object> saveParams = new HashMap<>();
|
||||||
|
saveParams.put("departmentId", departmentId);
|
||||||
|
saveParams.put("userId", userPO.getUserId());
|
||||||
|
saveParams.put("userUsername", userPO.getUserId());
|
||||||
|
saveParams.put("B", userPO.getUserName());
|
||||||
|
saveParams.put("khYear", khYear);
|
||||||
|
saveParams.put("khMonth", khMonth);
|
||||||
|
kpiKhxzZfGaDao.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 kpiKhxzZfGaDao.listUserId(params);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -9,7 +9,7 @@ import java.util.HashMap;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
public class KpiKhxzDdyERunnable implements Runnable {
|
public class KpiKhxzDdyEFRunnable implements Runnable {
|
||||||
|
|
||||||
private IKpiKhxzDdyDao kpiKhxzDdyDao;
|
private IKpiKhxzDdyDao kpiKhxzDdyDao;
|
||||||
private IKpiDao kpiDao;
|
private IKpiDao kpiDao;
|
||||||
@ -17,7 +17,7 @@ public class KpiKhxzDdyERunnable implements Runnable {
|
|||||||
private int khMonth;
|
private int khMonth;
|
||||||
private List<String> userIds;
|
private List<String> userIds;
|
||||||
|
|
||||||
public KpiKhxzDdyERunnable(IKpiKhxzDdyDao kpiKhxzDdyDao, IKpiDao kpiDao, int khYear, int khMonth, List<String> userIds) {
|
public KpiKhxzDdyEFRunnable(IKpiKhxzDdyDao kpiKhxzDdyDao, IKpiDao kpiDao, int khYear, int khMonth, List<String> userIds) {
|
||||||
this.kpiKhxzDdyDao = kpiKhxzDdyDao;
|
this.kpiKhxzDdyDao = kpiKhxzDdyDao;
|
||||||
this.kpiDao = kpiDao;
|
this.kpiDao = kpiDao;
|
||||||
this.khYear = khYear;
|
this.khYear = khYear;
|
||||||
@ -28,6 +28,7 @@ public class KpiKhxzDdyERunnable implements Runnable {
|
|||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
Map<String, Object> params = new HashMap<>();
|
Map<String, Object> params = new HashMap<>();
|
||||||
|
params.put("assignYearMonth", String.format("%04d-%02d", khYear, khMonth));
|
||||||
userIds.forEach(userId -> {
|
userIds.forEach(userId -> {
|
||||||
params.put("assignUserId", userId);
|
params.put("assignUserId", userId);
|
||||||
List<CasePO> casePOS = kpiDao.listCase(params);
|
List<CasePO> casePOS = kpiDao.listCase(params);
|
@ -0,0 +1,64 @@
|
|||||||
|
package com.cm.bigdata.service.kpi.task.sub;
|
||||||
|
|
||||||
|
import com.cm.bigdata.dao.kpi.IKpiKhxzWgyDao;
|
||||||
|
import com.cm.bigdata.dao.kpi.IKpiKhxzWgzDao;
|
||||||
|
import com.cm.bigdata.monitor.KpiUpdateMonitor;
|
||||||
|
import com.cm.bigdata.pojo.dtos.kpi.KpiKhxzWgyDTO;
|
||||||
|
import com.cm.bigdata.pojo.dtos.kpi.KpiKhxzWgzDTO;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
public class KpiKhxzWgzCDEFGHRunnable implements Runnable {
|
||||||
|
|
||||||
|
private IKpiKhxzWgzDao kpiKhxzWgzDao;
|
||||||
|
private IKpiKhxzWgyDao kpiKhxzWgyDao;
|
||||||
|
private int khYear;
|
||||||
|
private int khMonth;
|
||||||
|
private List<KpiKhxzWgzDTO> kpiKhxzWgzDTOS;
|
||||||
|
|
||||||
|
public KpiKhxzWgzCDEFGHRunnable(IKpiKhxzWgzDao kpiKhxzWgzDao, IKpiKhxzWgyDao kpiKhxzWgyDao, int khYear, int khMonth, List<KpiKhxzWgzDTO> kpiKhxzWgzDTOS) {
|
||||||
|
this.kpiKhxzWgzDao = kpiKhxzWgzDao;
|
||||||
|
this.kpiKhxzWgyDao = kpiKhxzWgyDao;
|
||||||
|
this.khYear = khYear;
|
||||||
|
this.khMonth = khMonth;
|
||||||
|
this.kpiKhxzWgzDTOS = kpiKhxzWgzDTOS;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
kpiKhxzWgzDTOS.forEach(kpiKhxzWgzDTO -> {
|
||||||
|
Map<String, Object> wgyParams = new HashMap<>();
|
||||||
|
wgyParams.put("areaId", kpiKhxzWgzDTO.getAreaId());
|
||||||
|
wgyParams.put("communityId", kpiKhxzWgzDTO.getCommunityId());
|
||||||
|
List<KpiKhxzWgyDTO> kpiKhxzWgyDTOS = kpiKhxzWgyDao.listWgy(wgyParams);
|
||||||
|
int unPassCount = 0;
|
||||||
|
int unReportCompleteCount = 0;
|
||||||
|
for (KpiKhxzWgyDTO kpiKhxzWgyDTO : kpiKhxzWgyDTOS) {
|
||||||
|
Double c = kpiKhxzWgyDTO.getC();
|
||||||
|
if (c < 40 * 0.6) {
|
||||||
|
unPassCount++;
|
||||||
|
}
|
||||||
|
// 有少报案件记录
|
||||||
|
if (kpiKhxzWgyDTO.getI() > 0) {
|
||||||
|
unReportCompleteCount++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
double defaultC = 20D;
|
||||||
|
double defaultF = 50D;
|
||||||
|
Map<String, Object> updateParams = new HashMap<>();
|
||||||
|
updateParams.put("khYear", khYear);
|
||||||
|
updateParams.put("khMonth", khMonth);
|
||||||
|
updateParams.put("userId", kpiKhxzWgzDTO.getUserId());
|
||||||
|
updateParams.put("C", defaultC);
|
||||||
|
updateParams.put("D", unPassCount);
|
||||||
|
updateParams.put("E", unPassCount * 10);
|
||||||
|
updateParams.put("F", defaultF);
|
||||||
|
updateParams.put("G", unReportCompleteCount);
|
||||||
|
updateParams.put("H", unReportCompleteCount * 10);
|
||||||
|
kpiKhxzWgzDao.updateCDEFGH(updateParams);
|
||||||
|
});
|
||||||
|
KpiUpdateMonitor.getInstance().complete();
|
||||||
|
}
|
||||||
|
}
|
@ -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.IKpiKhxzZfGaDao;
|
||||||
|
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 KpiKhxzZfGaCRunnable implements Runnable{
|
||||||
|
|
||||||
|
private IKpiKhxzZfGaDao kpiKhxzZfGaDao;
|
||||||
|
private IKpiDao kpiDao;
|
||||||
|
private int khYear;
|
||||||
|
private int khMonth;
|
||||||
|
private List<String> userIds;
|
||||||
|
|
||||||
|
public KpiKhxzZfGaCRunnable(IKpiKhxzZfGaDao kpiKhxzZfGaDao, IKpiDao kpiDao, int khYear, int khMonth, List<String> userIds) {
|
||||||
|
this.kpiKhxzZfGaDao = kpiKhxzZfGaDao;
|
||||||
|
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);
|
||||||
|
kpiKhxzZfGaDao.updateC(updateParams);
|
||||||
|
});
|
||||||
|
KpiUpdateMonitor.getInstance().complete();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,55 @@
|
|||||||
|
package com.cm.bigdata.service.kpi.task.sub;
|
||||||
|
|
||||||
|
import com.cm.bigdata.dao.kpi.IKpiDao;
|
||||||
|
import com.cm.bigdata.dao.kpi.IKpiKhxzZfGaDao;
|
||||||
|
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 KpiKhxzZfGaDEFRunnable implements Runnable {
|
||||||
|
|
||||||
|
private IKpiKhxzZfGaDao kpiKhxzZfGaDao;
|
||||||
|
private IKpiDao kpiDao;
|
||||||
|
private int khYear;
|
||||||
|
private int khMonth;
|
||||||
|
private List<String> userIds;
|
||||||
|
|
||||||
|
public KpiKhxzZfGaDEFRunnable(IKpiKhxzZfGaDao kpiKhxzZfGaDao, IKpiDao kpiDao, int khYear, int khMonth, List<String> userIds) {
|
||||||
|
this.kpiKhxzZfGaDao = kpiKhxzZfGaDao;
|
||||||
|
this.kpiDao = kpiDao;
|
||||||
|
this.khYear = khYear;
|
||||||
|
this.khMonth = khMonth;
|
||||||
|
this.userIds = userIds;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
Map<String, Object> params = new HashMap<>();
|
||||||
|
params.put("handleYearMonth", String.format("%04d-%02d", khYear, khMonth));
|
||||||
|
userIds.forEach(userId -> {
|
||||||
|
params.put("handleUserId", userId);
|
||||||
|
int unInspectCount = 0;
|
||||||
|
int inspectCount = 0;
|
||||||
|
List<CasePO> casePOS = kpiDao.listCase(params);
|
||||||
|
for (CasePO casePO : casePOS) {
|
||||||
|
if (casePO.getIsInspect() == 0) {
|
||||||
|
unInspectCount++;
|
||||||
|
} else {
|
||||||
|
inspectCount++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Map<String, Object> 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("F", inspectCount * 200 + unInspectCount * 200 * 0.6);
|
||||||
|
kpiKhxzZfGaDao.updateDEF(updateParams);
|
||||||
|
});
|
||||||
|
KpiUpdateMonitor.getInstance().complete();
|
||||||
|
}
|
||||||
|
}
|
@ -21,6 +21,8 @@ public class KpiUtil {
|
|||||||
|
|
||||||
public static String DDY_ROLE_ID = "72bff485-69be-4570-9f30-ff65fdbe5251";
|
public static String DDY_ROLE_ID = "72bff485-69be-4570-9f30-ff65fdbe5251";
|
||||||
public static String ZGY_ROLE_ID = "bc405346-8714-4ded-89ac-9cc4d755f66a";
|
public static String ZGY_ROLE_ID = "bc405346-8714-4ded-89ac-9cc4d755f66a";
|
||||||
|
public static String ZF_DEPARTMENT_ID = "1d74dfc8-f3a3-4517-87fe-7acf7891bab4";
|
||||||
|
public static String GA_DEPARTMENT_ID = "2da5c4db-209b-4c28-bf35-153535fdfc78";
|
||||||
|
|
||||||
public static boolean isdateTimeIn24Hours(String date1, DateTime date2) {
|
public static boolean isdateTimeIn24Hours(String date1, DateTime date2) {
|
||||||
date1 = date1.split("\\.")[0];
|
date1 = date1.split("\\.")[0];
|
||||||
|
@ -27,6 +27,7 @@
|
|||||||
<result column="community_id" property="communityId"/>
|
<result column="community_id" property="communityId"/>
|
||||||
<result column="community_name" property="communityName"/>
|
<result column="community_name" property="communityName"/>
|
||||||
<result column="user_name" property="userName"/>
|
<result column="user_name" property="userName"/>
|
||||||
|
<result column="user_username" property="userUsername"/>
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<select id="listPO" parameterType="map" resultMap="communityBossPO">
|
<select id="listPO" parameterType="map" resultMap="communityBossPO">
|
||||||
@ -67,7 +68,8 @@
|
|||||||
ccb.community_boss_level,
|
ccb.community_boss_level,
|
||||||
ccb.area_id,
|
ccb.area_id,
|
||||||
ccb.area_name,
|
ccb.area_name,
|
||||||
su.user_name
|
su.user_name,
|
||||||
|
su.user_username
|
||||||
FROM
|
FROM
|
||||||
city_community_boss_community ccbc
|
city_community_boss_community ccbc
|
||||||
INNER JOIN
|
INNER JOIN
|
||||||
|
70
src/main/resources/mybatis/mapper/kpi/IKpiKhxzWgzDao.xml
Normal file
70
src/main/resources/mybatis/mapper/kpi/IKpiKhxzWgzDao.xml
Normal file
@ -0,0 +1,70 @@
|
|||||||
|
<?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.IKpiKhxzWgzDao">
|
||||||
|
|
||||||
|
<resultMap id="kpiKhxzWgzDTO" type="com.cm.bigdata.pojo.dtos.kpi.KpiKhxzWgzDTO">
|
||||||
|
<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="user_username" property="userUsername"/>
|
||||||
|
<result column="kh_year" property="khYear"/>
|
||||||
|
<result column="kh_month" property="khMonth"/>
|
||||||
|
<result column="B" property="b"/>
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<insert id="save" parameterType="map">
|
||||||
|
INSERT INTO kpi_khxz_wgz (
|
||||||
|
area_id,
|
||||||
|
community_id,
|
||||||
|
user_id,
|
||||||
|
user_username,
|
||||||
|
kh_year,
|
||||||
|
kh_month,
|
||||||
|
B
|
||||||
|
) VALUES (
|
||||||
|
#{areaId},
|
||||||
|
#{communityId},
|
||||||
|
#{userId},
|
||||||
|
#{userUsername},
|
||||||
|
#{khYear},
|
||||||
|
#{khMonth},
|
||||||
|
#{B}
|
||||||
|
)
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
<delete id="delete" parameterType="map">
|
||||||
|
DELETE FROM
|
||||||
|
kpi_khxz_wgz
|
||||||
|
WHERE
|
||||||
|
kh_year = #{khYear}
|
||||||
|
AND
|
||||||
|
kh_month = #{khMonth}
|
||||||
|
</delete>
|
||||||
|
|
||||||
|
<update id="updateCDEFGH" parameterType="map">
|
||||||
|
UPDATE
|
||||||
|
kpi_khxz_wgz
|
||||||
|
SET
|
||||||
|
C = #{C},
|
||||||
|
D = #{D},
|
||||||
|
E = #{E},
|
||||||
|
F = #{F},
|
||||||
|
G = #{G},
|
||||||
|
H = #{H}
|
||||||
|
WHERE
|
||||||
|
kh_year = #{khYear}
|
||||||
|
AND
|
||||||
|
kh_month = #{khMonth}
|
||||||
|
AND
|
||||||
|
user_id = #{userId}
|
||||||
|
</update>
|
||||||
|
|
||||||
|
<select id="list" parameterType="map" resultMap="kpiKhxzWgzDTO">
|
||||||
|
SELECT
|
||||||
|
*
|
||||||
|
FROM
|
||||||
|
kpi_khxz_wgz
|
||||||
|
</select>
|
||||||
|
|
||||||
|
</mapper>
|
@ -0,0 +1,71 @@
|
|||||||
|
<?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.IKpiKhxzZfGaDao">
|
||||||
|
|
||||||
|
<insert id="save" parameterType="map">
|
||||||
|
INSERT INTO kpi_khxz_zf_ga (
|
||||||
|
department_id,
|
||||||
|
user_id,
|
||||||
|
user_username,
|
||||||
|
kh_year,
|
||||||
|
kh_month,
|
||||||
|
B
|
||||||
|
) VALUES (
|
||||||
|
#{departmentId},
|
||||||
|
#{userId},
|
||||||
|
#{userUsername},
|
||||||
|
#{khYear},
|
||||||
|
#{khMonth},
|
||||||
|
#{B}
|
||||||
|
)
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
<delete id="delete" parameterType="map">
|
||||||
|
DELETE FROM
|
||||||
|
kpi_khxz_zf_ga
|
||||||
|
WHERE
|
||||||
|
kh_year = #{khYear}
|
||||||
|
AND
|
||||||
|
kh_month = #{khMonth}
|
||||||
|
</delete>
|
||||||
|
|
||||||
|
<select id="listUserId" parameterType="map" resultType="java.lang.String">
|
||||||
|
SELECT
|
||||||
|
user_id
|
||||||
|
FROM
|
||||||
|
kpi_khxz_zf_ga
|
||||||
|
WHERE
|
||||||
|
kh_year = #{khYear}
|
||||||
|
AND
|
||||||
|
kh_month = #{khMonth}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<update id="updateC" parameterType="map">
|
||||||
|
UPDATE
|
||||||
|
kpi_khxz_zf_ga
|
||||||
|
SET
|
||||||
|
C = #{C}
|
||||||
|
WHERE
|
||||||
|
kh_year = #{khYear}
|
||||||
|
AND
|
||||||
|
kh_month = #{khMonth}
|
||||||
|
AND
|
||||||
|
user_id = #{userId}
|
||||||
|
</update>
|
||||||
|
|
||||||
|
<update id="updateDEF" parameterType="map">
|
||||||
|
UPDATE
|
||||||
|
kpi_khxz_zf_ga
|
||||||
|
SET
|
||||||
|
D = #{D},
|
||||||
|
E = #{E},
|
||||||
|
F = #{F}
|
||||||
|
WHERE
|
||||||
|
kh_year = #{khYear}
|
||||||
|
AND
|
||||||
|
kh_month = #{khMonth}
|
||||||
|
AND
|
||||||
|
user_id = #{userId}
|
||||||
|
</update>
|
||||||
|
|
||||||
|
</mapper>
|
@ -471,10 +471,18 @@
|
|||||||
#{assignUserIds[${index}]}
|
#{assignUserIds[${index}]}
|
||||||
</foreach>
|
</foreach>
|
||||||
</if>
|
</if>
|
||||||
|
<if test="assignYearMonth != null and assignYearMonth != ''">
|
||||||
|
AND
|
||||||
|
LEFT(gmt_assign, 7) = #{assignYearMonth}
|
||||||
|
</if>
|
||||||
<if test="handleUserId != null and handleUserId != ''">
|
<if test="handleUserId != null and handleUserId != ''">
|
||||||
AND
|
AND
|
||||||
handle_user_id = #{handleUserId}
|
handle_user_id = #{handleUserId}
|
||||||
</if>
|
</if>
|
||||||
|
<if test="handleYearMonth != null and handleYearMonth != ''">
|
||||||
|
AND
|
||||||
|
LEFT(gmt_handle, 7) = #{handleYearMonth}
|
||||||
|
</if>
|
||||||
<if test="areaId != null and areaId != ''">
|
<if test="areaId != null and areaId != ''">
|
||||||
AND
|
AND
|
||||||
area_id = #{areaId}
|
area_id = #{areaId}
|
||||||
|
Loading…
Reference in New Issue
Block a user