完成考核细则
This commit is contained in:
parent
12217c5eb9
commit
cb9847a2da
@ -86,6 +86,11 @@ public class KpiController extends AbstractController {
|
||||
return departmentService.list();
|
||||
}
|
||||
|
||||
@GetMapping("list-znbm")
|
||||
public List<DepartmentDTO> listZnbm() {
|
||||
return departmentService.listZnbm();
|
||||
}
|
||||
|
||||
@GetMapping("list-community-case-count")
|
||||
public List<CommunityCaseCountDTO> listCommunityCaseCount(@RequestParam(name = "areaId", required = false) String areaId,
|
||||
@RequestParam(name = "communityId", required = false) String communityId,
|
||||
|
@ -36,7 +36,7 @@ public class KpiKhxzController extends AbstractController {
|
||||
return new SuccessResult();
|
||||
}
|
||||
|
||||
@GetMapping("update/kh-year/{khYear}/kh-month/{khMonth}")
|
||||
@GetMapping("reset-update-process")
|
||||
public void resetUpdateProcess() {
|
||||
KpiUpdateMonitor.getInstance().setTaskCount(0);
|
||||
}
|
||||
@ -112,8 +112,6 @@ public class KpiKhxzController extends AbstractController {
|
||||
kpiKhxzService.exportWgz(httpServletResponse, queryMap);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@PutMapping("update-wgz")
|
||||
public synchronized SuccessResult updateWgz(@RequestBody KpiUpdateVO kpiUpdateVO) {
|
||||
kpiKhxzService.updateWgz(kpiUpdateVO);
|
||||
@ -132,4 +130,10 @@ public class KpiKhxzController extends AbstractController {
|
||||
kpiKhxzService.exportZnbm(httpServletResponse, queryMap);
|
||||
}
|
||||
|
||||
@PutMapping("update-znbm")
|
||||
public synchronized SuccessResult updateZnbm(@RequestBody KpiUpdateVO kpiUpdateVO) {
|
||||
kpiKhxzService.updateZnbm(kpiUpdateVO);
|
||||
return new SuccessResult();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -21,4 +21,7 @@ public interface IKpiKhxzZnbmDao {
|
||||
void updateIJ(Map<String, Object> updateParams);
|
||||
|
||||
List<KpiKhxzZnbmDTO> list(Map<String, Object> params);
|
||||
|
||||
void update(Map<String, Object> params);
|
||||
|
||||
}
|
||||
|
@ -9,6 +9,7 @@ public class NPersonDayCountPO {
|
||||
private Integer isSigninLate;
|
||||
private Integer isSignout;
|
||||
private Integer isSignoutEarly;
|
||||
private Double workDistance;
|
||||
private Integer isHoliday;
|
||||
private Double dayScore;
|
||||
|
||||
@ -68,6 +69,14 @@ public class NPersonDayCountPO {
|
||||
this.isSignoutEarly = isSignoutEarly;
|
||||
}
|
||||
|
||||
public Double getWorkDistance() {
|
||||
return workDistance;
|
||||
}
|
||||
|
||||
public void setWorkDistance(Double workDistance) {
|
||||
this.workDistance = workDistance;
|
||||
}
|
||||
|
||||
public Integer getIsHoliday() {
|
||||
return isHoliday;
|
||||
}
|
||||
|
@ -14,5 +14,7 @@ public interface IDepartmentService {
|
||||
|
||||
List<DepartmentDTO> list();
|
||||
|
||||
List<DepartmentDTO> listZnbm();
|
||||
|
||||
|
||||
}
|
||||
|
@ -42,6 +42,5 @@ public interface IKpiKhxzService {
|
||||
|
||||
void exportZnbm(HttpServletResponse httpServletResponse, Map<String, Object> queryMap) throws IOException;
|
||||
|
||||
|
||||
|
||||
void updateZnbm(KpiUpdateVO kpiUpdateVO);
|
||||
}
|
||||
|
@ -5,11 +5,13 @@ import com.cm.bigdata.pojo.dtos.kpi.DepartmentDTO;
|
||||
import com.cm.bigdata.pojo.pos.kpi.DepartmentPO;
|
||||
import com.cm.bigdata.pojo.pos.kpi.DepartmentUserPO;
|
||||
import com.cm.bigdata.service.kpi.IDepartmentService;
|
||||
import com.cm.bigdata.utils.KpiUtil;
|
||||
import com.mchange.v2.beans.BeansUtils;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@ -41,4 +43,16 @@ public class DepartmentServiceImpl implements IDepartmentService {
|
||||
return departmentDTO;
|
||||
}).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DepartmentDTO> listZnbm() {
|
||||
Map<String, Object> params = new HashMap<>();
|
||||
params.put("departmentParentId", "0");
|
||||
params.put("excludeDepartmentIds", Arrays.asList(KpiUtil.ZF_DEPARTMENT_ID, KpiUtil.GA_DEPARTMENT_ID));
|
||||
return listPO(params).stream().map(departmentPO -> {
|
||||
DepartmentDTO departmentDTO = new DepartmentDTO();
|
||||
BeanUtils.copyProperties(departmentPO, departmentDTO);
|
||||
return departmentDTO;
|
||||
}).collect(Collectors.toList());
|
||||
}
|
||||
}
|
||||
|
@ -49,61 +49,56 @@ public class KpiKhxzServiceImpl extends AbstractService implements IKpiKhxzServi
|
||||
|
||||
@Override
|
||||
public void update(Integer khYear, Integer khMonth) {
|
||||
// KpiUpdateMonitor.getInstance().setTaskCount(0);
|
||||
// kpiService.updateCommunityBossDayCount(khYear, khMonth, 4);
|
||||
// kpiKhxzWgyTask.update(khYear, khMonth, 4);
|
||||
// kpiService.updateNPersonDayCount(KpiUtil.ZGY_ROLE_ID, khYear, khMonth);
|
||||
// kpiKhxzDdyTask.update(khYear, khMonth);
|
||||
// khKhxzZfGaTask.update(khYear, khMonth);
|
||||
// kpiKhxzWgzTask.update(khYear, khMonth);
|
||||
// kpiKhxzZnbmTask.update(khYear, khMonth);
|
||||
// 这个数要和下面的任务数之和一致
|
||||
KpiUpdateMonitor.getInstance().setTaskCount(28);
|
||||
KpiUpdateMonitor.getInstance().setTaskCount(29);
|
||||
// 开始更新
|
||||
Executors.newSingleThreadExecutor().execute(() -> {
|
||||
|
||||
// 更新案件,1任务
|
||||
kpiService.updateCaseCount();
|
||||
KpiUpdateMonitor.getInstance().complete();
|
||||
|
||||
// 更新4级网格员日统计,1任务
|
||||
kpiService.updateCommunityBossDayCount(khYear, khMonth, 3);
|
||||
KpiUpdateMonitor.getInstance().complete();
|
||||
|
||||
// 更新5级网格员日统计,1任务
|
||||
kpiService.updateCommunityBossDayCount(khYear, khMonth, 4);
|
||||
KpiUpdateMonitor.getInstance().complete();
|
||||
|
||||
// 更新调度员日统计,1任务
|
||||
kpiService.updateNPersonDayCount(KpiUtil.DDY_ROLE_ID, khYear, khMonth);
|
||||
KpiUpdateMonitor.getInstance().complete();
|
||||
|
||||
// 更新专管员,1任务
|
||||
kpiService.updateNPersonDayCount(KpiUtil.ZGY_ROLE_ID, khYear, khMonth);
|
||||
KpiUpdateMonitor.getInstance().complete();
|
||||
|
||||
// kpiKhxzWgyTask.update(khYear, khMonth, 3);
|
||||
// kpiKhxzWgyTask.update(khYear, khMonth, 4);
|
||||
// kpiKhxzDdyTask.update(khYear, khMonth);
|
||||
// khKhxzZfGaTask.update(khYear, khMonth);
|
||||
// kpiKhxzWgzTask.update(khYear, khMonth);
|
||||
// kpiKhxzZnbmTask.update(khYear, khMonth);
|
||||
|
||||
executorService.execute(() -> {
|
||||
// 更新4级网格员,4任务
|
||||
kpiKhxzWgyTask.update(khYear, khMonth, 3);
|
||||
});
|
||||
|
||||
executorService.execute(() -> {
|
||||
// 更新5级网格员,4个任务
|
||||
kpiKhxzWgyTask.update(khYear, khMonth, 4);
|
||||
});
|
||||
|
||||
executorService.execute(() -> {
|
||||
// 调度员,4任务
|
||||
kpiKhxzDdyTask.update(khYear, khMonth);
|
||||
});
|
||||
|
||||
executorService.execute(() -> {
|
||||
// 执法公安,4任务
|
||||
// 执法公安,5任务
|
||||
khKhxzZfGaTask.update(khYear, khMonth);
|
||||
});
|
||||
|
||||
executorService.execute(() -> {
|
||||
// 网格长,3任务
|
||||
kpiKhxzWgzTask.update(khYear, khMonth);
|
||||
});
|
||||
|
||||
executorService.execute(() -> {
|
||||
// 职能部门,4任务
|
||||
kpiKhxzZnbmTask.update(khYear, khMonth);
|
||||
@ -190,4 +185,11 @@ public class KpiKhxzServiceImpl extends AbstractService implements IKpiKhxzServi
|
||||
public void exportZnbm(HttpServletResponse httpServletResponse, Map<String, Object> queryMap) throws IOException {
|
||||
ExcelExportUtil.simple(httpServletResponse, "职能部门考核细则", listZnbm(queryMap), KpiKhxzZnbmDTO.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateZnbm(KpiUpdateVO kpiUpdateVO) {
|
||||
kpiUpdateVO.getDatas().forEach(params -> {
|
||||
kpiKhxzZnbmDao.update(params);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -92,6 +92,7 @@ public class KpiServiceImpl implements IKpiService {
|
||||
queryParams.put("isSigninLate", isSigninLate);
|
||||
queryParams.put("isSignout", isSignout);
|
||||
queryParams.put("isSignoutEarly", isSignoutEarly);
|
||||
|
||||
queryParams.put("workDistance", workDistance);
|
||||
queryParams.put("populationCount", populationCount);
|
||||
queryParams.put("savePopulationCount", savePopulationCount);
|
||||
@ -157,7 +158,7 @@ public class KpiServiceImpl implements IKpiService {
|
||||
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("dayScore", KpiScoreUtil.getZgyDayScore(isSignin, isSigninLate, isSignout, isSignoutEarly, workDistance, isHoliday));
|
||||
}
|
||||
queryParams.put("isHoliday", isHoliday);
|
||||
kpiDao.saveNPersonDayCount(queryParams);
|
||||
|
@ -48,6 +48,7 @@ public class KpiKhxzZfGaTask {
|
||||
params.put("khYear", khYear);
|
||||
params.put("khMonth", khMonth);
|
||||
kpiKhxzZfGaDao.delete(params);
|
||||
KpiUpdateMonitor.getInstance().complete();
|
||||
}
|
||||
|
||||
private void updateBase(String departmentId, int khYear, int khMonth) {
|
||||
@ -65,6 +66,7 @@ public class KpiKhxzZfGaTask {
|
||||
saveParams.put("khMonth", khMonth);
|
||||
kpiKhxzZfGaDao.save(saveParams);
|
||||
});
|
||||
KpiUpdateMonitor.getInstance().complete();
|
||||
}
|
||||
|
||||
private List<String> listUserId(int khYear, int khMonth) {
|
||||
|
@ -54,7 +54,7 @@ public class KpiKhxzZnbmCDEFGRunnable implements Runnable {
|
||||
updateParams.put("D", inspectCount);
|
||||
updateParams.put("E", unInspectCount);
|
||||
updateParams.put("F", inspectCount * 200D);
|
||||
updateParams.put("G", 60D / handleCount * inspectCount);
|
||||
updateParams.put("G", handleCount == 0 ? 0 : 60D / handleCount * inspectCount);
|
||||
updateParams.put("khYear", khYear);
|
||||
updateParams.put("khMonth", khMonth);
|
||||
updateParams.put("userId", userId);
|
||||
|
@ -9,6 +9,7 @@ public class KpiScoreUtil {
|
||||
private static double DDY_SIGNOUT_SCORE = 15D;
|
||||
private static double ZGY_SIGNIN_SCORE = 25D;
|
||||
private static double ZGY_SIGNOUT_SCORE = 25D;
|
||||
private static double ZGY_DISTANCE_SCORE = 50D;
|
||||
|
||||
|
||||
public static double getWgyDayScore(int isSignin, int isSigninLate, int isSignout, int isSignoutEarly, double workDistance, int isHoliday) {
|
||||
@ -24,7 +25,8 @@ public class KpiScoreUtil {
|
||||
if (isSignout == 1) {
|
||||
signoutScore += isSignoutEarly == 1 ? WGY_SIGNOUT_SCORE / 2 : WGY_SIGNOUT_SCORE;
|
||||
}
|
||||
if (workDistance > 0) {
|
||||
// 有签到、签退、或轨迹的都算有轨迹
|
||||
if (isSignin == 1 || isSignout == 1 || workDistance > 0) {
|
||||
distanceScore = WGY_DISTANCE_SCORE;
|
||||
}
|
||||
return signinScore + signoutScore + distanceScore;
|
||||
@ -45,19 +47,24 @@ public class KpiScoreUtil {
|
||||
return signinScore + signoutScore;
|
||||
}
|
||||
|
||||
public static double getZgyDayScore(int isSignin, int isSigninLate, int isSignout, int isSignoutEarly, int isHoliday) {
|
||||
public static double getZgyDayScore(int isSignin, int isSigninLate, int isSignout, int isSignoutEarly, double workDistance, int isHoliday) {
|
||||
if (isHoliday == 1) {
|
||||
return 0;
|
||||
}
|
||||
double signinScore = 0D;
|
||||
double signoutScore = 0D;
|
||||
double distanceScore = 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;
|
||||
// 有签到、签退、或轨迹的都算有轨迹
|
||||
if (isSignin == 1 || isSignout == 1 || workDistance > 0) {
|
||||
distanceScore = ZGY_DISTANCE_SCORE;
|
||||
}
|
||||
return signinScore + signoutScore + distanceScore;
|
||||
}
|
||||
|
||||
|
||||
|
@ -125,15 +125,15 @@ public class KpiUtil {
|
||||
*
|
||||
* @param userLocationService
|
||||
* @param userId
|
||||
* @param day af535c78-f0ba-4ccf-891b-cf7c6e42e9e8
|
||||
* @param day
|
||||
* @return
|
||||
*/
|
||||
public static Double calculateWorkDistance(IUserLocationService userLocationService, String userId, String day) {
|
||||
double workDistance = 0D;
|
||||
if (!StringUtils.equals(userId, "af535c78-f0ba-4ccf-891b-cf7c6e42e9e8")) {
|
||||
return workDistance;
|
||||
}
|
||||
List<UserLocationPO> userLocationPOS = userLocationService.listPOByUserIdAndDate(userId, day);
|
||||
// 由于轨迹不好统计,为了方便,只要有定位记录就算有轨迹,返回数量。后期在根据情况调整
|
||||
return (double) userLocationPOS.size();
|
||||
/**
|
||||
Point tempPoint = null;
|
||||
for (UserLocationPO userLocationPO : userLocationPOS) {
|
||||
Point point = new Point(Double.parseDouble(userLocationPO.getUserLatitude()), Double.parseDouble(userLocationPO.getUserLongitude()));
|
||||
@ -145,6 +145,7 @@ public class KpiUtil {
|
||||
tempPoint = point;
|
||||
}
|
||||
return workDistance;
|
||||
**/
|
||||
}
|
||||
|
||||
public static Map<String, Integer> mapPopulationCount(IBasePopulationInfoService basePopulationInfoService, List<String> userIds) {
|
||||
|
@ -88,6 +88,14 @@
|
||||
kh_year = #{khYear}
|
||||
AND
|
||||
kh_month = #{khMonth}
|
||||
<if test="areaId != null and areaId != ''">
|
||||
AND
|
||||
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}, '%')
|
||||
@ -114,9 +122,9 @@
|
||||
P = #{P}
|
||||
WHERE
|
||||
kh_year = #{khYear}
|
||||
AND
|
||||
AND
|
||||
kh_month = #{khMonth}
|
||||
AND
|
||||
AND
|
||||
user_id = #{userId}
|
||||
</update>
|
||||
|
||||
|
@ -109,6 +109,10 @@
|
||||
kh_year = #{khYear}
|
||||
AND
|
||||
kh_month = #{khMonth}
|
||||
<if test="departmentId != null and departmentId != ''">
|
||||
AND
|
||||
department_id = #{departmentId}
|
||||
</if>
|
||||
<if test="keywords != null and keywords != ''">
|
||||
AND (
|
||||
B LIKE CONCAT('%', #{keywords}, '%')
|
||||
@ -118,4 +122,28 @@
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<update id="update" parameterType="map">
|
||||
UPDATE
|
||||
kpi_khxz_znbm
|
||||
SET
|
||||
H = #{H},
|
||||
reasonH = #{reasonH},
|
||||
K = #{K},
|
||||
reasonK = #{reasonK},
|
||||
L = #{L},
|
||||
reasonL = #{reasonL},
|
||||
M = #{M},
|
||||
reasonM = #{reasonM},
|
||||
N = #{N},
|
||||
O = #{O},
|
||||
P = #{P}
|
||||
WHERE
|
||||
kh_year = #{khYear}
|
||||
AND
|
||||
kh_month = #{khMonth}
|
||||
AND
|
||||
user_id = #{userId}
|
||||
|
||||
</update>
|
||||
|
||||
</mapper>
|
@ -25,6 +25,7 @@
|
||||
<result column="is_signin_late" property="isSigninLate"/>
|
||||
<result column="is_signout" property="isSignout"/>
|
||||
<result column="is_signout_early" property="isSignoutEarly"/>
|
||||
<result column="work_distance" property="workDistance"/>
|
||||
<result column="is_holiday" property="isHoliday"/>
|
||||
<result column="day_score" property="dayScore"/>
|
||||
</resultMap>
|
||||
@ -156,6 +157,7 @@
|
||||
is_signin_late,
|
||||
is_signout,
|
||||
is_signout_early,
|
||||
work_distance,
|
||||
is_holiday,
|
||||
day_score
|
||||
) VALUES (
|
||||
@ -165,6 +167,7 @@
|
||||
#{isSigninLate},
|
||||
#{isSignout},
|
||||
#{isSignoutEarly},
|
||||
#{workDistance},
|
||||
#{isHoliday},
|
||||
#{dayScore}
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user