处理绩效考核网格员那件数据对不上问题
This commit is contained in:
parent
5649bf07a3
commit
363a8d3f72
@ -152,6 +152,11 @@ public class KpiKhxzController extends AbstractController {
|
||||
kpiKhxzService.updateWgy4(year, month);
|
||||
}
|
||||
|
||||
@GetMapping("sync-wgy4/{year}/{month}/{userId}")
|
||||
public void syncWgy4(@PathVariable("year") Integer year, @PathVariable("month") Integer month, @PathVariable("userId") String userId) {
|
||||
kpiKhxzService.updateWgy4(year, month, userId);
|
||||
}
|
||||
|
||||
@GetMapping("sync-ddy/{year}/{month}")
|
||||
public void syncDdy(@PathVariable("year") Integer year, @PathVariable("month") Integer month) throws IOException {
|
||||
kpiKhxzService.updateDdy(year, month);
|
||||
@ -172,6 +177,11 @@ public class KpiKhxzController extends AbstractController {
|
||||
kpiKhxzService.updateWgy4Task(year, month);
|
||||
}
|
||||
|
||||
@GetMapping("sync-wgy4-task/{year}/{month}/{userId}")
|
||||
public void syncWgy4Task(@PathVariable("year") Integer year, @PathVariable("month") Integer month, @PathVariable("userId") String userId) throws IOException {
|
||||
kpiKhxzService.updateWgy4Task(year, month, userId);
|
||||
}
|
||||
|
||||
@GetMapping("sync-ddy-task/{year}/{month}")
|
||||
public void syncDdyTask(@PathVariable("year") Integer year, @PathVariable("month") Integer month) throws IOException {
|
||||
kpiKhxzService.updateDdyTask(year, month);
|
||||
|
@ -10,9 +10,16 @@ import java.util.List;
|
||||
public interface IBasePopulationInfoService {
|
||||
|
||||
List<BasePopulationInfoCountPO> listPopulationSaveCountByUserIds(List<String> userIds);
|
||||
List<BasePopulationInfoCountPO> listPopulationSaveCountByUserId(String userId);
|
||||
|
||||
List<BasePopulationInfoCountPO> listPopulationSaveCountByUserIdsAndDay(List<String> userIds, String date);
|
||||
|
||||
List<BasePopulationInfoCountPO> listPopulationUpdateCountByUserIdAndDay(String userId, String date);
|
||||
|
||||
|
||||
List<BasePopulationInfoCountPO> listPopulationSaveCountByUserIdAndDay(String userId, String date);
|
||||
|
||||
|
||||
List<BasePopulationInfoCountPO> listPopulationUpdateCountByUserIdsAndDay(List<String> userIds, String date);
|
||||
|
||||
SuccessResultList<List<BasePopulationInfoDTO>> listPagePopulationSaveByUserIdAndStartTimeAndEndTime(String userId, String startTime, String endTime, ListPage page);
|
||||
|
@ -18,6 +18,8 @@ public interface IKpiKhxzService {
|
||||
|
||||
void updateWgy4(Integer khYear, Integer khMonth);
|
||||
|
||||
void updateWgy4(Integer year, Integer month, String userId);
|
||||
|
||||
void updateDdy(Integer khYear, Integer khMonth);
|
||||
|
||||
void updateZgy(Integer khYear, Integer khMonth);
|
||||
@ -26,6 +28,9 @@ public interface IKpiKhxzService {
|
||||
|
||||
void updateWgy4Task(Integer khYear, Integer khMonth);
|
||||
|
||||
void updateWgy4Task(Integer year, Integer month, String userId);
|
||||
|
||||
|
||||
void updateDdyTask(Integer khYear, Integer khMonth);
|
||||
|
||||
void updateZfGaTask(Integer khYear, Integer khMonth);
|
||||
|
@ -18,8 +18,12 @@ public interface IKpiService {
|
||||
*/
|
||||
void updateCommunityBossDayCount(String areaId, String communityId, String startTime, String endTime, int level);
|
||||
|
||||
void updateCommunityBossDayCount(String areaId, String communityId, String startTime, String endTime, int level, String userId);
|
||||
|
||||
void updateCommunityBossDayCount(int year, int month, int level);
|
||||
|
||||
void updateCommunityBossDayCount(int year, int month, int level, String userId);
|
||||
|
||||
/**
|
||||
* 更新N员
|
||||
* 更新N员
|
||||
|
@ -9,4 +9,5 @@ public interface ILeaveService {
|
||||
|
||||
List<LeavePO> listPOByUserIdsAndDay(List<String> userIds, String day);
|
||||
|
||||
List<LeavePO> listPOByUserIdAndDay(String userId, String day);
|
||||
}
|
||||
|
@ -12,8 +12,12 @@ import java.util.List;
|
||||
public interface IUserSignService {
|
||||
List<UserSigninPO> listInPOByUserIdsAndDay(List<String> userIds, String day);
|
||||
|
||||
List<UserSigninPO> listInPOByUserIdsAndDay(String userId, String day);
|
||||
|
||||
List<UserSignoutPO> listOutPOByUserIdsAndDay(List<String> userIds, String day);
|
||||
|
||||
List<UserSignoutPO> listOutPOByUserIdsAndDay(String userId, String day);
|
||||
|
||||
SuccessResultList<List<UserSigninDTO>> listInByUserIdAndStartTimeAndEndTimeAndIsLate(String userId, String startTime, String endTime, Integer isLate, ListPage page);
|
||||
|
||||
SuccessResultList<List<UserSignoutDTO>> listOutByUserIdAndStartTimeAndEndTimeAndIsEarly(String userId, String startTime, String endTime, Integer isEarly, ListPage page);
|
||||
|
@ -29,6 +29,13 @@ public class BasePopulationInfoServiceImpl implements IBasePopulationInfoService
|
||||
return basePopulationInfoDao.listPopulationSaveCount(params);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<BasePopulationInfoCountPO> listPopulationSaveCountByUserId(String userId) {
|
||||
Map<String, Object> params = new HashMap<>();
|
||||
params.put("userId", userId);
|
||||
return basePopulationInfoDao.listPopulationSaveCount(params);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<BasePopulationInfoCountPO> listPopulationSaveCountByUserIdsAndDay(List<String> userIds, String date) {
|
||||
Map<String, Object> params = new HashMap<>();
|
||||
@ -37,6 +44,22 @@ public class BasePopulationInfoServiceImpl implements IBasePopulationInfoService
|
||||
return basePopulationInfoDao.listPopulationSaveCount(params);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<BasePopulationInfoCountPO> listPopulationUpdateCountByUserIdAndDay(String userId, String date) {
|
||||
Map<String, Object> params = new HashMap<>();
|
||||
params.put("day", date);
|
||||
params.put("userId", userId);
|
||||
return basePopulationInfoDao.listPopulationSaveCount(params);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<BasePopulationInfoCountPO> listPopulationSaveCountByUserIdAndDay(String userId, String date) {
|
||||
Map<String, Object> params = new HashMap<>();
|
||||
params.put("day", date);
|
||||
params.put("userId", userId);
|
||||
return basePopulationInfoDao.listPopulationSaveCount(params);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<BasePopulationInfoCountPO> listPopulationUpdateCountByUserIdsAndDay(List<String> userIds, String date) {
|
||||
Map<String, Object> params = new HashMap<>();
|
||||
|
@ -126,6 +126,11 @@ public class KpiKhxzServiceImpl extends AbstractService implements IKpiKhxzServi
|
||||
KpiUpdateMonitor.getInstance().complete();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateWgy4(Integer year, Integer month, String userId) {
|
||||
kpiService.updateCommunityBossDayCount(year, month, 4, userId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateDdy(Integer khYear, Integer khMonth) {
|
||||
kpiService.updateNPersonDayCount(KpiUtil.DDY_ROLE_ID, khYear, khMonth);
|
||||
@ -148,6 +153,11 @@ public class KpiKhxzServiceImpl extends AbstractService implements IKpiKhxzServi
|
||||
kpiKhxzWgyTask.update(khYear, khMonth, 4);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateWgy4Task(Integer year, Integer month, String userId) {
|
||||
kpiKhxzWgyTask.update(year, month, 4, userId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateDdyTask(Integer khYear, Integer khMonth) {
|
||||
kpiKhxzDdyTask.update(khYear, khMonth);
|
||||
|
@ -176,6 +176,117 @@ public class KpiServiceImpl implements IKpiService {
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateCommunityBossDayCount(String areaId, String communityId, String startTime, String endTime, int level, String userId) {
|
||||
// communityBoss表中的level位1-4,对应的是2-5级网格员
|
||||
final int communityBossLevel = level;
|
||||
List<String> dates = listDate(startTime, endTime);
|
||||
List<String> holidays = kpiHolidayService.listFormat(KpiUtil.years(dates));
|
||||
Map<String, Integer> userGridCountMap = KpiUtil.mapUserGridCount(userGridService, userId);
|
||||
// 当前季度的开始时间
|
||||
LocalDateTime startLocalDateTime = LocalDateTime.parse(startTime, DateTimeFormat.forPattern(ISystemConstant.DATE_FORMATTER_YYYY_MM_DD));
|
||||
LocalDateTime startQuarterLocalDateTime = startLocalDateTime.withMonthOfYear(((startLocalDateTime.getMonthOfYear() - 1) / 3) * 3 + 1);
|
||||
String startQuarterTime = startQuarterLocalDateTime.toString(DateTimeFormat.forPattern(ISystemConstant.DATE_FORMATTER_YYYY_MM_DD));
|
||||
dates.forEach(date -> {
|
||||
int isHoliday = KpiUtil.hasValueInList(holidays, date) ? 1 : 0;
|
||||
Map<String, List<UserSigninPO>> userSigninMap = KpiUtil.mapSignin(userSignService, userId, date);
|
||||
Map<String, List<UserSignoutPO>> userSignoutMap = KpiUtil.mapSignout(userSignService, userId, date);
|
||||
Map<String, Integer> populationCountMap = KpiUtil.mapPopulationCount(basePopulationInfoService, userId);
|
||||
Map<String, Integer> populationSaveCountMap = KpiUtil.mapPopulationSaveCount(basePopulationInfoService, userId, date);
|
||||
Map<String, Integer> populationUpdateCountMap = KpiUtil.mapPopulationUpdateCount(basePopulationInfoService, userId, date);
|
||||
Map<String, LeavePO> leaveMap = KpiUtil.mapLeave(leaveService, userId, date);
|
||||
// 删除当日数据
|
||||
deleteCommunityBossDayCount(date, communityBossLevel, userId);
|
||||
List<UserSigninPO> userSigninPO = userSigninMap.get(userId);
|
||||
int isSignin = userSigninPO == null || userSigninPO.size() == 0 ? 0 : 1;
|
||||
int isSigninLate = userSigninPO == null || userSigninPO.size() == 0 ? 0 : userSigninPO.get(0).getIsLate();
|
||||
List<UserSignoutPO> userSignoutPOS = userSignoutMap.get(userId);
|
||||
int isSignout = userSignoutPOS == null || userSignoutPOS.size() == 0 ? 0 : 1;
|
||||
int isSignoutEarly = userSignoutPOS == null || userSignoutPOS.size() == 0 ? 0 : userSignoutPOS.get(0).getIsEarly();
|
||||
double workDistance = KpiUtil.calculateWorkDistance(userLocationService, userId, date);
|
||||
int populationCount = populationCountMap.get(userId) == null ? 0 : populationCountMap.get(userId);
|
||||
int savePopulationCount = populationSaveCountMap.get(userId) == null ? 0 : populationSaveCountMap.get(userId);
|
||||
int updatePopulationCount = populationUpdateCountMap.get(userId) == null ? 0 : populationUpdateCountMap.get(userId);
|
||||
// 新增
|
||||
Map<String, Object> queryParams = new HashMap<>();
|
||||
queryParams.put("userId", userId);
|
||||
queryParams.put("dayDate", date);
|
||||
queryParams.put("isSignin", isSignin);
|
||||
queryParams.put("isSigninLate", isSigninLate);
|
||||
queryParams.put("isSignout", isSignout);
|
||||
queryParams.put("isSignoutEarly", isSignoutEarly);
|
||||
|
||||
queryParams.put("workDistance", workDistance);
|
||||
queryParams.put("populationCount", populationCount);
|
||||
queryParams.put("savePopulationCount", savePopulationCount);
|
||||
queryParams.put("updatePopulationCount", updatePopulationCount);
|
||||
queryParams.put("isHoliday", isHoliday);
|
||||
// 网格数量
|
||||
queryParams.put("gridCount", userGridCountMap.get(userId));
|
||||
|
||||
// 请假情况
|
||||
int isLeave = 0;
|
||||
int isLeaveSelf = 0;
|
||||
int isLeaveSelfOverLimitInQuarter = 0;
|
||||
double leaveTimelongInDay = 0D;
|
||||
LeavePO leave = leaveMap.get(userId);
|
||||
if (leave != null) {
|
||||
isLeave = 1;
|
||||
isLeaveSelf = leave.getIsSelf();
|
||||
|
||||
// 请假开始时间
|
||||
String leaveTime = leave.getLeaveTime();
|
||||
Double leaveTimeLong = Double.valueOf(leave.getLeaveTimeLong());
|
||||
if (StringUtils.contains(leaveTime, date)) {
|
||||
// 开始时间是当天并且小于1天
|
||||
if (leaveTimeLong < 1) {
|
||||
leaveTimelongInDay = leaveTimeLong;
|
||||
} else {
|
||||
leaveTimelongInDay = 1;
|
||||
}
|
||||
} else {
|
||||
// 开始时间不是当天
|
||||
DateTime leaveTimeDateTime = DateTime.parse(leaveTime, DateTimeFormat.forPattern(ISystemConstant.DATE_FORMATTER_YYYY_MM_DD));
|
||||
int leaveDayIndex = 0;
|
||||
for (int i = 0; i < leaveTimeLong; i++) {
|
||||
String newDateTime = leaveTimeDateTime.plusDays(i + 1).toString(DateTimeFormat.forPattern(ISystemConstant.DATE_FORMATTER_YYYY_MM_DD));
|
||||
if (StringUtils.contains(newDateTime, date)) {
|
||||
leaveDayIndex = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (leaveTimeLong - (leaveDayIndex + 1) < 1) {
|
||||
leaveTimelongInDay = leaveTimeLong;
|
||||
} else {
|
||||
leaveTimelongInDay = 1;
|
||||
}
|
||||
}
|
||||
// 获取当前季度的私假请假天数
|
||||
Map<String, Object> sumLeaveMap = new HashMap<>();
|
||||
sumLeaveMap.put("userId", userId);
|
||||
sumLeaveMap.put("startDay", startQuarterTime);
|
||||
sumLeaveMap.put("endDay", date);
|
||||
sumLeaveMap.put("isLeave", 1);
|
||||
sumLeaveMap.put("isLeaveSelf", 1);
|
||||
sumLeaveMap.put("level", level);
|
||||
Integer leaveTimelongInQuarter = kpiDao.sumLeaveTimelong(sumLeaveMap);
|
||||
leaveTimelongInQuarter = leaveTimelongInQuarter == null ? 0 : leaveTimelongInQuarter;
|
||||
// 私假天数大于4天
|
||||
if (leaveTimelongInQuarter > 4) {
|
||||
isLeaveSelfOverLimitInQuarter = 1;
|
||||
}
|
||||
}
|
||||
queryParams.put("isLeave", isLeave);
|
||||
queryParams.put("isLeaveSelf", isLeaveSelf);
|
||||
queryParams.put("leaveTimelongInDay", leaveTimelongInDay);
|
||||
|
||||
// 计算当日总分,旷工不算,私假超过4天不算
|
||||
queryParams.put("dayScore", KpiScoreUtil.getWgyDayScore(isSignin, isSigninLate, isSignout, isSignoutEarly, workDistance, isLeave, isLeaveSelf, isLeaveSelfOverLimitInQuarter, isHoliday));
|
||||
queryParams.put("level", communityBossLevel);
|
||||
kpiDao.saveCommunityBossDayCount(queryParams);
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateCommunityBossDayCount(int year, int month, int level) {
|
||||
DateTime dateTime = DateTime.parse(String.format("%04d-%02d", year, month), DateTimeFormat.forPattern("yyyy-MM"));
|
||||
@ -184,6 +295,14 @@ public class KpiServiceImpl implements IKpiService {
|
||||
updateCommunityBossDayCount(null, null, startTime, endTime, level);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateCommunityBossDayCount(int year, int month, int level, String userId) {
|
||||
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));
|
||||
updateCommunityBossDayCount(null, null, startTime, endTime, level, userId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateNPersonDayCount(String departmentId, String startTime, String endTime) {
|
||||
updateNPersonDayCount(departmentId, KpiUtil.ZGY_ROLE_ID, startTime, endTime);
|
||||
@ -375,6 +494,14 @@ public class KpiServiceImpl implements IKpiService {
|
||||
kpiDao.deleteCommunityBossDayCount(params);
|
||||
}
|
||||
|
||||
private void deleteCommunityBossDayCount(String date, int level, String userId) {
|
||||
Map<String, Object> params = new HashMap<>(4);
|
||||
params.put("dayDate", date);
|
||||
params.put("level", level);
|
||||
params.put("userId", userId);
|
||||
kpiDao.deleteCommunityBossDayCount(params);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<CommunityCaseCountDTO> listCommunityCaseCount(String areaId, String communityId, String startTime, String endTime) {
|
||||
Map<String, Object> params = new HashMap<>();
|
||||
|
@ -3,6 +3,7 @@ package com.cm.bigdata.service.kpi.impl;
|
||||
import com.cm.bigdata.dao2.kpi.ILeaveDao;
|
||||
import com.cm.bigdata.pojo.pos.kpi.LeavePO;
|
||||
import com.cm.bigdata.service.kpi.ILeaveService;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@ -29,4 +30,16 @@ public class LeaveServiceImpl implements ILeaveService {
|
||||
params.put("leaveState", 1);
|
||||
return leaveDao.listPO(params);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<LeavePO> listPOByUserIdAndDay(String userId, String day) {
|
||||
if (StringUtils.isBlank(userId)) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
Map<String, Object> params = new HashMap<>();
|
||||
params.put("userId", userId);
|
||||
params.put("day", day);
|
||||
params.put("leaveState", 1);
|
||||
return leaveDao.listPO(params);
|
||||
}
|
||||
}
|
||||
|
@ -31,6 +31,14 @@ public class UserSignServiceImpl implements IUserSignService {
|
||||
return userSignDao.listInPO(params);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<UserSigninPO> listInPOByUserIdsAndDay(String userId, String day) {
|
||||
Map<String, Object> params = new HashMap<>();
|
||||
params.put("creator", userId);
|
||||
params.put("day", day);
|
||||
return userSignDao.listInPO(params);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<UserSignoutPO> listOutPOByUserIdsAndDay(List<String> userIds, String day) {
|
||||
Map<String, Object> params = new HashMap<>();
|
||||
@ -39,6 +47,14 @@ public class UserSignServiceImpl implements IUserSignService {
|
||||
return userSignDao.listOutPO(params);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<UserSignoutPO> listOutPOByUserIdsAndDay(String userId, String day) {
|
||||
Map<String, Object> params = new HashMap<>();
|
||||
params.put("creator", userId);
|
||||
params.put("day", day);
|
||||
return userSignDao.listOutPO(params);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SuccessResultList<List<UserSigninDTO>> listInByUserIdAndStartTimeAndEndTimeAndIsLate(String userId, String startTime, String endTime, Integer isLate, ListPage page) {
|
||||
Map<String, Object> params = new HashMap<>();
|
||||
|
@ -11,7 +11,9 @@ import com.cm.bigdata.service.kpi.IKpiService;
|
||||
import com.cm.bigdata.service.kpi.IUserGridService;
|
||||
import com.cm.bigdata.service.kpi.IUserService;
|
||||
import com.cm.bigdata.service.kpi.task.sub.KpiKhxzWgyCRunnable;
|
||||
import com.cm.bigdata.service.kpi.task.sub.KpiKhxzWgyCUserRunnable;
|
||||
import com.cm.bigdata.service.kpi.task.sub.KpiKhxzWgyEGIKRTRunnable;
|
||||
import com.cm.bigdata.service.kpi.task.sub.KpiKhxzWgyEGIKRTUserRunnable;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
@ -54,6 +56,13 @@ public class KpiKhxzWgyTask {
|
||||
executorService.execute(new KpiKhxzWgyEGIKRTRunnable(userGridService, kpiKhxzWgyDao, kpiHolidayDao, kpiDao, khYear, khMonth, wgyLevel, userIds));
|
||||
}
|
||||
|
||||
public void update(int khYear, int khMonth, int wgyLevel, String userId) {
|
||||
deleteBaseWgy(khYear, khMonth, wgyLevel, userId);
|
||||
updateBaseWgy(khYear, khMonth, wgyLevel, userId);
|
||||
executorService.execute(new KpiKhxzWgyCUserRunnable(kpiKhxzWgyDao, kpiDao, khYear, khMonth, wgyLevel, userId));
|
||||
executorService.execute(new KpiKhxzWgyEGIKRTUserRunnable(userGridService, kpiKhxzWgyDao, kpiHolidayDao, kpiDao, khYear, khMonth, wgyLevel, userId));
|
||||
}
|
||||
|
||||
private void deleteBaseWgy(int khYear, int khMonth, int wgyLevel) {
|
||||
Map<String, Object> params = new HashMap<>();
|
||||
params.put("khYear", khYear);
|
||||
@ -63,6 +72,15 @@ public class KpiKhxzWgyTask {
|
||||
KpiUpdateMonitor.getInstance().complete();
|
||||
}
|
||||
|
||||
private void deleteBaseWgy(int khYear, int khMonth, int wgyLevel, String userId) {
|
||||
Map<String, Object> params = new HashMap<>();
|
||||
params.put("khYear", khYear);
|
||||
params.put("khMonth", khMonth);
|
||||
params.put("wgyLevel", wgyLevel);
|
||||
params.put("userId", userId);
|
||||
kpiKhxzWgyDao.delete(params);
|
||||
}
|
||||
|
||||
private void updateBaseWgy(int khYear, int khMonth, int wgyLevel) {
|
||||
Map<String, Object> params = new HashMap<>();
|
||||
params.put("communityBossLevel", wgyLevel);
|
||||
@ -106,6 +124,49 @@ public class KpiKhxzWgyTask {
|
||||
KpiUpdateMonitor.getInstance().complete();
|
||||
}
|
||||
|
||||
private void updateBaseWgy(int khYear, int khMonth, int wgyLevel, String userId) {
|
||||
Map<String, Object> params = new HashMap<>();
|
||||
params.put("communityBossLevel", wgyLevel);
|
||||
// 删除
|
||||
params.put("wgyLevel", wgyLevel);
|
||||
params.put("khYear", khYear);
|
||||
params.put("khMonth", khMonth);
|
||||
params.put("communityBossUserId", userId);
|
||||
List<CommunityBossDTO> communityBossDTOS = communityBossService.list(params);
|
||||
if (communityBossDTOS.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
List<String> userIds = communityBossDTOS.stream().map(CommunityBossDTO::getCommunityBossUserId).filter(StringUtils::isNotBlank).collect(Collectors.toList());
|
||||
List<UserPO> userPOS = userService.listPO(userIds);
|
||||
userPOS.forEach(userPO -> {
|
||||
String areaId = null;
|
||||
String communityId = null;
|
||||
for (CommunityBossDTO communityBossDTO : communityBossDTOS) {
|
||||
if (StringUtils.equals(userPO.getUserId(), communityBossDTO.getCommunityBossUserId())) {
|
||||
areaId = communityBossDTO.getAreaId();
|
||||
communityId = communityBossDTO.getCommunityId();
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (StringUtils.isEmpty(areaId)) {
|
||||
return;
|
||||
}
|
||||
// 网格数量
|
||||
Integer gridCount = userGridService.countUserGrid(userPO.getUserId());
|
||||
Map<String, Object> saveParams = new HashMap<>();
|
||||
saveParams.put("areaId", areaId);
|
||||
saveParams.put("communityId", communityId);
|
||||
saveParams.put("userId", userPO.getUserId());
|
||||
saveParams.put("userUsername", userPO.getUserUsername());
|
||||
saveParams.put("B", userPO.getUserName());
|
||||
saveParams.put("khYear", khYear);
|
||||
saveParams.put("khMonth", khMonth);
|
||||
saveParams.put("wgyLevel", wgyLevel);
|
||||
saveParams.put("gridCount", gridCount);
|
||||
kpiKhxzWgyDao.save(saveParams);
|
||||
});
|
||||
}
|
||||
|
||||
private List<String> listUserIds(int khYear, int khMonth, int wgyLevel) {
|
||||
Map<String, Object> params = new HashMap<>();
|
||||
params.put("khYear", khYear);
|
||||
|
@ -0,0 +1,63 @@
|
||||
package com.cm.bigdata.service.kpi.task.sub;
|
||||
|
||||
import com.cm.bigdata.dao.kpi.IKpiDao;
|
||||
import com.cm.bigdata.dao.kpi.IKpiKhxzWgyDao;
|
||||
import com.cm.bigdata.monitor.KpiUpdateMonitor;
|
||||
import com.cm.bigdata.pojo.pos.kpi.CommunityBossDayCountPO;
|
||||
import com.cm.bigdata.utils.KpiUtil;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class KpiKhxzWgyCUserRunnable implements Runnable {
|
||||
|
||||
private IKpiKhxzWgyDao kpiKhxzWgyDao;
|
||||
private IKpiDao kpiDao;
|
||||
private Integer year;
|
||||
private Integer month;
|
||||
private Integer level;
|
||||
private String userId;
|
||||
|
||||
public KpiKhxzWgyCUserRunnable(IKpiKhxzWgyDao kpiKhxzWgyDao, IKpiDao kpiDao, Integer year, Integer month, Integer level, String userId) {
|
||||
this.kpiKhxzWgyDao = kpiKhxzWgyDao;
|
||||
this.kpiDao = kpiDao;
|
||||
this.year = year;
|
||||
this.month = month;
|
||||
this.level = level;
|
||||
this.userId = userId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
List<String> dates = KpiUtil.listDate(year, month);
|
||||
Map<String, Object> params = new HashMap<>();
|
||||
params.put("level", level);
|
||||
params.put("userId", userId);
|
||||
params.put("startTime", dates.get(0));
|
||||
params.put("endTime", dates.get(dates.size() - 1));
|
||||
List<CommunityBossDayCountPO> communityBossDayCountPOS = kpiDao.listCommunityBossDayCountPO(params);
|
||||
// 实际工作天数,不算矿工
|
||||
int workDay = 0;
|
||||
double totalDayScore = 0D;
|
||||
for (CommunityBossDayCountPO communityBossDayCountPO : communityBossDayCountPOS) {
|
||||
// 如果是假期不记录
|
||||
int isHoliday = communityBossDayCountPO.getIsHoliday();
|
||||
if (isHoliday == 1) {
|
||||
continue;
|
||||
}
|
||||
totalDayScore += communityBossDayCountPO.getDayScore();
|
||||
workDay++;
|
||||
}
|
||||
double totalScore = workDay == 0 ? 0D : totalDayScore / workDay;
|
||||
// 保存总分
|
||||
Map<String, Object> updateParams = new HashMap<>();
|
||||
updateParams.put("khYear", year);
|
||||
updateParams.put("khMonth", month);
|
||||
updateParams.put("wgyLevel", level);
|
||||
updateParams.put("userId", userId);
|
||||
updateParams.put("C", totalScore);
|
||||
kpiKhxzWgyDao.updateC(updateParams);
|
||||
}
|
||||
|
||||
}
|
@ -41,8 +41,8 @@ public class KpiKhxzWgyEGIKRTRunnable implements Runnable {
|
||||
public void run() {
|
||||
List<HolidayPO> holidayPOS = listHoliday();
|
||||
List<List<KpiUtil.DayWeek>> dayWeeks = KpiUtil.listDayWeekOfMonth(year, month);
|
||||
List<List<KpiUtil.DayWeek>> shouldReportDayWeeks = listShouldReportDayWeek(holidayPOS, dayWeeks);
|
||||
updateEGIKRT(userIds, shouldReportDayWeeks);
|
||||
List<List<KpiUtil.DayWeek>>[] reportDayWeeks = listShouldReportDayWeek(holidayPOS, dayWeeks);
|
||||
updateEGIKRT(userIds, reportDayWeeks[0], reportDayWeeks[1]);
|
||||
KpiUpdateMonitor.getInstance().complete();
|
||||
}
|
||||
|
||||
@ -53,7 +53,8 @@ public class KpiKhxzWgyEGIKRTRunnable implements Runnable {
|
||||
* @param dayWeeks
|
||||
* @return [应报,实报,少报,多报]
|
||||
*/
|
||||
public static List<List<KpiUtil.DayWeek>> listShouldReportDayWeek(List<HolidayPO> holidayPOS, List<List<KpiUtil.DayWeek>> dayWeeks) {
|
||||
public static List<List<KpiUtil.DayWeek>>[] listShouldReportDayWeek(List<HolidayPO> holidayPOS, List<List<KpiUtil.DayWeek>> dayWeeks) {
|
||||
List<List<KpiUtil.DayWeek>> unShouldReportDayWeeks = new ArrayList<>();
|
||||
List<List<KpiUtil.DayWeek>> shouldReportDayWeeks = new ArrayList<>();
|
||||
for (List<KpiUtil.DayWeek> dws : dayWeeks) {
|
||||
int workdayCount = 0;
|
||||
@ -75,21 +76,22 @@ public class KpiKhxzWgyEGIKRTRunnable implements Runnable {
|
||||
// 工作天数大于三天,需要上报
|
||||
if (workdayCount > 3) {
|
||||
shouldReportDayWeeks.add(dws);
|
||||
} else {
|
||||
unShouldReportDayWeeks.add(dws);
|
||||
}
|
||||
}
|
||||
return shouldReportDayWeeks;
|
||||
return new List[]{shouldReportDayWeeks, unShouldReportDayWeeks};
|
||||
}
|
||||
|
||||
private void updateEGIKRT(List<String> userIds, List<List<KpiUtil.DayWeek>> shouldReportDayWeeks) {
|
||||
int shouldCount = shouldReportDayWeeks.size();
|
||||
private void updateEGIKRT(List<String> userIds, List<List<KpiUtil.DayWeek>> shouldReportDayWeeks, List<List<KpiUtil.DayWeek>> unShouldReportDayWeeks) {
|
||||
userIds.forEach(userId -> {
|
||||
try {
|
||||
int shouldCount = shouldReportDayWeeks.size();
|
||||
// 网格数量
|
||||
Integer gridCount = userGridService.countUserGrid(userId);
|
||||
int totalShouldCount = shouldCount * gridCount;
|
||||
// 每周上报
|
||||
int weekReportCount = 0;
|
||||
// 实报
|
||||
int realityCount = 0;
|
||||
// 少报
|
||||
int lackCount = 0;
|
||||
// 多报
|
||||
@ -98,6 +100,34 @@ public class KpiKhxzWgyEGIKRTRunnable implements Runnable {
|
||||
int urgeCount = 0;
|
||||
// 超时检查数量
|
||||
int inspectTimeoutCount = 0;
|
||||
// 非必须上报周内上报案件算多报
|
||||
for (List<KpiUtil.DayWeek> unShouldReportDayWeek : unShouldReportDayWeeks) {
|
||||
String startTime = unShouldReportDayWeek.get(0).getDate();
|
||||
String endTime = unShouldReportDayWeek.get(unShouldReportDayWeek.size() - 1).getDate();
|
||||
Map<String, Object> params = new HashMap<>();
|
||||
params.put("reportUserId", userId);
|
||||
params.put("startTime", startTime);
|
||||
params.put("endTime", endTime);
|
||||
List<CasePO> casePOS = kpiDao.listCase(params);
|
||||
for (CasePO casePO : casePOS) {
|
||||
// 自处理
|
||||
Integer isSelf = casePO.getIsSelf();
|
||||
// 不是自处理,上报就算处理
|
||||
if (isSelf == 0) {
|
||||
exceedCount++;
|
||||
continue;
|
||||
}
|
||||
// 检查过了,算多报
|
||||
String gmtInspect = casePO.getGmtInspect();
|
||||
if (StringUtils.isBlank(gmtInspect)) {
|
||||
continue;
|
||||
}
|
||||
// 检查时间复合规定
|
||||
if (KpiUtil.isDateBetween(gmtInspect.substring(0, 10), startTime, endTime)) {
|
||||
exceedCount++;
|
||||
}
|
||||
}
|
||||
}
|
||||
for (List<KpiUtil.DayWeek> shouldReportDayWeek : shouldReportDayWeeks) {
|
||||
String startTime = shouldReportDayWeek.get(0).getDate();
|
||||
String endTime = shouldReportDayWeek.get(shouldReportDayWeek.size() - 1).getDate();
|
||||
@ -106,8 +136,8 @@ public class KpiKhxzWgyEGIKRTRunnable implements Runnable {
|
||||
params.put("startTime", startTime);
|
||||
params.put("endTime", endTime);
|
||||
List<CasePO> casePOS = kpiDao.listCase(params);
|
||||
// 本周是否有上报数据
|
||||
boolean isWeekReport = false;
|
||||
// 实报
|
||||
int realityCount = 0;
|
||||
for (CasePO casePO : casePOS) {
|
||||
urgeCount += casePO.getTotalUrge();
|
||||
// 自处理
|
||||
@ -115,7 +145,6 @@ public class KpiKhxzWgyEGIKRTRunnable implements Runnable {
|
||||
// 不是自处理,上报就算处理
|
||||
if (isSelf == 0) {
|
||||
realityCount++;
|
||||
isWeekReport = true;
|
||||
continue;
|
||||
}
|
||||
// 处理时间
|
||||
@ -132,15 +161,14 @@ public class KpiKhxzWgyEGIKRTRunnable implements Runnable {
|
||||
if (KpiUtil.isdateTimeIn24Hours(gmtHandle, gmtInspect)) {
|
||||
inspectTimeoutCount++;
|
||||
}
|
||||
if (KpiUtil.isDateBetween(gmtInspect, startTime, endTime)) {
|
||||
if (KpiUtil.isDateBetween(gmtInspect.substring(0, 10), startTime, endTime)) {
|
||||
realityCount++;
|
||||
isWeekReport = true;
|
||||
}
|
||||
}
|
||||
// 每周上报数量由网格数量决定
|
||||
weekReportCount += isWeekReport ? gridCount : 0;
|
||||
lackCount = Math.max(totalShouldCount - weekReportCount, 0);
|
||||
exceedCount = Math.max(realityCount - totalShouldCount, 0);
|
||||
weekReportCount += Math.min(gridCount, realityCount);
|
||||
lackCount += Math.max(gridCount - realityCount, 0);
|
||||
exceedCount += Math.max(realityCount - gridCount, 0);
|
||||
}
|
||||
Map<String, Object> updateParams = new HashMap<>();
|
||||
updateParams.put("E", totalShouldCount);
|
||||
@ -154,6 +182,9 @@ public class KpiKhxzWgyEGIKRTRunnable implements Runnable {
|
||||
updateParams.put("wgyLevel", level);
|
||||
updateParams.put("userId", userId);
|
||||
kpiKhxzWgyDao.updateEGIKRT(updateParams);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,192 @@
|
||||
package com.cm.bigdata.service.kpi.task.sub;
|
||||
|
||||
import com.cm.bigdata.dao.kpi.IKpiDao;
|
||||
import com.cm.bigdata.dao.kpi.IKpiHolidayDao;
|
||||
import com.cm.bigdata.dao.kpi.IKpiKhxzWgyDao;
|
||||
import com.cm.bigdata.monitor.KpiUpdateMonitor;
|
||||
import com.cm.bigdata.pojo.pos.kpi.CasePO;
|
||||
import com.cm.bigdata.pojo.pos.kpi.HolidayPO;
|
||||
import com.cm.bigdata.service.kpi.IUserGridService;
|
||||
import com.cm.bigdata.utils.KpiUtil;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class KpiKhxzWgyEGIKRTUserRunnable implements Runnable {
|
||||
|
||||
private IUserGridService userGridService;
|
||||
private IKpiKhxzWgyDao kpiKhxzWgyDao;
|
||||
private IKpiHolidayDao kpiHolidayDao;
|
||||
private IKpiDao kpiDao;
|
||||
private int year;
|
||||
private int month;
|
||||
private int level;
|
||||
private String userId;
|
||||
|
||||
public KpiKhxzWgyEGIKRTUserRunnable(IUserGridService userGridService, IKpiKhxzWgyDao kpiKhxzWgyDao, IKpiHolidayDao kpiHolidayDao, IKpiDao kpiDao, int year, int month, int level, String userId) {
|
||||
this.userGridService = userGridService;
|
||||
this.kpiKhxzWgyDao = kpiKhxzWgyDao;
|
||||
this.kpiHolidayDao = kpiHolidayDao;
|
||||
this.kpiDao = kpiDao;
|
||||
this.year = year;
|
||||
this.month = month;
|
||||
this.level = level;
|
||||
this.userId = userId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
List<HolidayPO> holidayPOS = listHoliday();
|
||||
List<List<KpiUtil.DayWeek>> dayWeeks = KpiUtil.listDayWeekOfMonth(year, month);
|
||||
List<List<KpiUtil.DayWeek>>[] reportDayWeeks = listShouldReportDayWeek(holidayPOS, dayWeeks);
|
||||
updateEGIKRT(userId, reportDayWeeks[0], reportDayWeeks[1]);
|
||||
KpiUpdateMonitor.getInstance().complete();
|
||||
}
|
||||
|
||||
/**
|
||||
* 上报统计数组
|
||||
*
|
||||
* @param holidayPOS
|
||||
* @param dayWeeks
|
||||
* @return [应报,实报,少报,多报]
|
||||
*/
|
||||
public static List<List<KpiUtil.DayWeek>>[] listShouldReportDayWeek(List<HolidayPO> holidayPOS, List<List<KpiUtil.DayWeek>> dayWeeks) {
|
||||
List<List<KpiUtil.DayWeek>> unShouldReportDayWeeks = new ArrayList<>();
|
||||
List<List<KpiUtil.DayWeek>> shouldReportDayWeeks = new ArrayList<>();
|
||||
for (List<KpiUtil.DayWeek> dws : dayWeeks) {
|
||||
int workdayCount = 0;
|
||||
for (KpiUtil.DayWeek dayWeek : dws) {
|
||||
boolean isHoliday = false;
|
||||
for (HolidayPO holidayPO : holidayPOS) {
|
||||
String holiday = String.format("%04d-%02d-%02d", holidayPO.getHolidayYear(), holidayPO.getHolidayMonth(), holidayPO.getHolidayDay());
|
||||
if (StringUtils.equals(dayWeek.getDate(), holiday)) {
|
||||
dayWeek.setHoliday(true);
|
||||
isHoliday = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (isHoliday) {
|
||||
continue;
|
||||
}
|
||||
workdayCount++;
|
||||
}
|
||||
// 工作天数大于三天,需要上报
|
||||
if (workdayCount > 3) {
|
||||
shouldReportDayWeeks.add(dws);
|
||||
} else {
|
||||
unShouldReportDayWeeks.add(dws);
|
||||
}
|
||||
}
|
||||
return new List[]{shouldReportDayWeeks, unShouldReportDayWeeks};
|
||||
}
|
||||
|
||||
private void updateEGIKRT(String userId, List<List<KpiUtil.DayWeek>> shouldReportDayWeeks, List<List<KpiUtil.DayWeek>> unShouldReportDayWeeks) {
|
||||
int shouldCount = shouldReportDayWeeks.size();
|
||||
// 网格数量
|
||||
Integer gridCount = userGridService.countUserGrid(userId);
|
||||
int totalShouldCount = shouldCount * gridCount;
|
||||
// 每周上报
|
||||
int weekReportCount = 0;
|
||||
// 少报
|
||||
int lackCount = 0;
|
||||
// 多报
|
||||
int exceedCount = 0;
|
||||
// 督办次数
|
||||
int urgeCount = 0;
|
||||
// 超时检查数量
|
||||
int inspectTimeoutCount = 0;
|
||||
// 非必须上报周内上报案件算多报
|
||||
for (List<KpiUtil.DayWeek> unShouldReportDayWeek : unShouldReportDayWeeks) {
|
||||
String startTime = unShouldReportDayWeek.get(0).getDate();
|
||||
String endTime = unShouldReportDayWeek.get(unShouldReportDayWeek.size() - 1).getDate();
|
||||
Map<String, Object> params = new HashMap<>();
|
||||
params.put("reportUserId", userId);
|
||||
params.put("startTime", startTime);
|
||||
params.put("endTime", endTime);
|
||||
List<CasePO> casePOS = kpiDao.listCase(params);
|
||||
for (CasePO casePO : casePOS) {
|
||||
// 自处理
|
||||
Integer isSelf = casePO.getIsSelf();
|
||||
// 不是自处理,上报就算处理
|
||||
if (isSelf == 0) {
|
||||
exceedCount++;
|
||||
continue;
|
||||
}
|
||||
// 检查过了,算多报
|
||||
String gmtInspect = casePO.getGmtInspect();
|
||||
if (StringUtils.isBlank(gmtInspect)) {
|
||||
continue;
|
||||
}
|
||||
// 检查时间复合规定
|
||||
if (KpiUtil.isDateBetween(gmtInspect.substring(0, 10), startTime, endTime)) {
|
||||
exceedCount++;
|
||||
}
|
||||
}
|
||||
}
|
||||
for (List<KpiUtil.DayWeek> shouldReportDayWeek : shouldReportDayWeeks) {
|
||||
String startTime = shouldReportDayWeek.get(0).getDate();
|
||||
String endTime = shouldReportDayWeek.get(shouldReportDayWeek.size() - 1).getDate();
|
||||
Map<String, Object> params = new HashMap<>();
|
||||
params.put("reportUserId", userId);
|
||||
params.put("startTime", startTime);
|
||||
params.put("endTime", endTime);
|
||||
List<CasePO> casePOS = kpiDao.listCase(params);
|
||||
// 实报
|
||||
int realityCount = 0;
|
||||
for (CasePO casePO : casePOS) {
|
||||
urgeCount += casePO.getTotalUrge();
|
||||
// 自处理
|
||||
Integer isSelf = casePO.getIsSelf();
|
||||
// 不是自处理,上报就算处理
|
||||
if (isSelf == 0) {
|
||||
realityCount++;
|
||||
continue;
|
||||
}
|
||||
// 处理时间
|
||||
String gmtHandle = casePO.getGmtHandle();
|
||||
if (StringUtils.isBlank(gmtHandle)) {
|
||||
continue;
|
||||
}
|
||||
// 检查时间
|
||||
String gmtInspect = casePO.getGmtInspect();
|
||||
if (StringUtils.isBlank(gmtInspect)) {
|
||||
continue;
|
||||
}
|
||||
// 处理时间和检查时间超过24小时
|
||||
if (KpiUtil.isdateTimeIn24Hours(gmtHandle, gmtInspect)) {
|
||||
inspectTimeoutCount++;
|
||||
}
|
||||
if (KpiUtil.isDateBetween(gmtInspect.substring(0, 10), startTime, endTime)) {
|
||||
realityCount++;
|
||||
}
|
||||
}
|
||||
// 每周上报数量由网格数量决定
|
||||
weekReportCount += Math.min(gridCount, realityCount);
|
||||
lackCount += Math.max(gridCount - realityCount, 0);
|
||||
exceedCount += Math.max(realityCount - gridCount, 0);
|
||||
}
|
||||
Map<String, Object> updateParams = new HashMap<>();
|
||||
updateParams.put("E", totalShouldCount);
|
||||
updateParams.put("G", weekReportCount);
|
||||
updateParams.put("I", lackCount);
|
||||
updateParams.put("K", exceedCount);
|
||||
updateParams.put("R", urgeCount);
|
||||
updateParams.put("T", inspectTimeoutCount * 0.1);
|
||||
updateParams.put("khYear", year);
|
||||
updateParams.put("khMonth", month);
|
||||
updateParams.put("wgyLevel", level);
|
||||
updateParams.put("userId", userId);
|
||||
kpiKhxzWgyDao.updateEGIKRT(updateParams);
|
||||
}
|
||||
|
||||
private List<HolidayPO> listHoliday() {
|
||||
Map<String, Object> params = new HashMap<>();
|
||||
params.put("holidayYear", year);
|
||||
params.put("holidayMonth", month);
|
||||
return kpiHolidayDao.list(params);
|
||||
}
|
||||
|
||||
}
|
@ -38,11 +38,10 @@ public class KpiUtil {
|
||||
if (StringUtils.isBlank(date)) {
|
||||
return false;
|
||||
}
|
||||
date = date.split("\\.")[0];
|
||||
DateTime dateTime = DateTime.parse(date, DateTimeFormat.forPattern(ISystemConstant.DATE_FORMATTER_YYYY_MM_DD_HH_MM_SS));
|
||||
DateTime dateTime = DateTime.parse(date, DateTimeFormat.forPattern(ISystemConstant.DATE_FORMATTER_YYYY_MM_DD));
|
||||
DateTime startDateTime = DateTime.parse(startDate, DateTimeFormat.forPattern(ISystemConstant.DATE_FORMATTER_YYYY_MM_DD));
|
||||
DateTime endDateTime = DateTime.parse(endDate, DateTimeFormat.forPattern(ISystemConstant.DATE_FORMATTER_YYYY_MM_DD));
|
||||
return dateTime.isAfter(startDateTime) && dateTime.isBefore(endDateTime);
|
||||
return (dateTime.isEqual(startDateTime) || dateTime.isAfter(startDateTime)) && (dateTime.isEqual(endDateTime) || dateTime.isBefore(endDateTime));
|
||||
}
|
||||
|
||||
public static boolean hasValueInList(List<String> values, String checkValue) {
|
||||
@ -83,6 +82,13 @@ public class KpiUtil {
|
||||
return userGridMap;
|
||||
}
|
||||
|
||||
public static Map<String, Integer> mapUserGridCount(IUserGridService userGridService, String userId) {
|
||||
Map<String, Integer> userGridMap = new HashMap<>();
|
||||
Integer count = userGridService.countUserGrid(userId);
|
||||
userGridMap.put(userId, count);
|
||||
return userGridMap;
|
||||
}
|
||||
|
||||
public static Map<String, LeavePO> mapLeave(ILeaveService leaveService, List<String> userIds, String day) {
|
||||
List<LeavePO> leavePOS = leaveService.listPOByUserIdsAndDay(userIds, day);
|
||||
Map<String, LeavePO> leavePOMap = new HashMap<>();
|
||||
@ -92,6 +98,15 @@ public class KpiUtil {
|
||||
return leavePOMap;
|
||||
}
|
||||
|
||||
public static Map<String, LeavePO> mapLeave(ILeaveService leaveService, String userId, String day) {
|
||||
List<LeavePO> leavePOS = leaveService.listPOByUserIdAndDay(userId, day);
|
||||
Map<String, LeavePO> leavePOMap = new HashMap<>();
|
||||
leavePOS.forEach(leavePO -> {
|
||||
leavePOMap.put(leavePO.getGmtCreate(), leavePO);
|
||||
});
|
||||
return leavePOMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* 签到map
|
||||
*
|
||||
@ -113,6 +128,27 @@ public class KpiUtil {
|
||||
return userSigninMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* 签到map
|
||||
*
|
||||
* @param userSigninService
|
||||
* @param userIds
|
||||
* @return
|
||||
*/
|
||||
public static Map<String, List<UserSigninPO>> mapSignin(IUserSignService userSignService, String userId, String day) {
|
||||
List<UserSigninPO> userSigninDTOS = userSignService.listInPOByUserIdsAndDay(userId, day);
|
||||
Map<String, List<UserSigninPO>> userSigninMap = new HashMap<>();
|
||||
userSigninDTOS.forEach(userSigninPO -> {
|
||||
List<UserSigninPO> userSigninDTOList = userSigninMap.get(userSigninPO.getCreator());
|
||||
if (userSigninDTOList == null) {
|
||||
userSigninDTOList = new ArrayList<>();
|
||||
}
|
||||
userSigninDTOList.add(userSigninPO);
|
||||
userSigninMap.put(userSigninPO.getCreator(), userSigninDTOList);
|
||||
});
|
||||
return userSigninMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* 签退map
|
||||
*
|
||||
@ -134,6 +170,20 @@ public class KpiUtil {
|
||||
return userSigninMap;
|
||||
}
|
||||
|
||||
public static Map<String, List<UserSignoutPO>> mapSignout(IUserSignService userSignService, String userId, String day) {
|
||||
List<UserSignoutPO> userSignoutDTOS = userSignService.listOutPOByUserIdsAndDay(userId, day);
|
||||
Map<String, List<UserSignoutPO>> userSigninMap = new HashMap<>();
|
||||
userSignoutDTOS.forEach(userSignoutPO -> {
|
||||
List<UserSignoutPO> userSignoutDTOList = userSigninMap.get(userSignoutPO.getCreator());
|
||||
if (userSignoutDTOList == null) {
|
||||
userSignoutDTOList = new ArrayList<>();
|
||||
}
|
||||
userSignoutDTOList.add(userSignoutPO);
|
||||
userSigninMap.put(userSignoutPO.getCreator(), userSignoutDTOList);
|
||||
});
|
||||
return userSigninMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* 计算工作距离
|
||||
*
|
||||
@ -171,6 +221,15 @@ public class KpiUtil {
|
||||
return map;
|
||||
}
|
||||
|
||||
public static Map<String, Integer> mapPopulationCount(IBasePopulationInfoService basePopulationInfoService, String userId) {
|
||||
List<BasePopulationInfoCountPO> basePopulationInfoCountPOS = basePopulationInfoService.listPopulationSaveCountByUserId(userId);
|
||||
Map<String, Integer> map = new HashMap<>();
|
||||
basePopulationInfoCountPOS.forEach(basePopulationInfoCountPO -> {
|
||||
map.put(basePopulationInfoCountPO.getUserId(), basePopulationInfoCountPO.getTotal());
|
||||
});
|
||||
return map;
|
||||
}
|
||||
|
||||
public static Map<String, Integer> mapPopulationSaveCount(IBasePopulationInfoService basePopulationInfoService, List<String> userIds, String date) {
|
||||
List<BasePopulationInfoCountPO> basePopulationInfoCountPOS = basePopulationInfoService.listPopulationSaveCountByUserIdsAndDay(userIds, date);
|
||||
Map<String, Integer> map = new HashMap<>();
|
||||
@ -180,6 +239,15 @@ public class KpiUtil {
|
||||
return map;
|
||||
}
|
||||
|
||||
public static Map<String, Integer> mapPopulationSaveCount(IBasePopulationInfoService basePopulationInfoService, String userId, String date) {
|
||||
List<BasePopulationInfoCountPO> basePopulationInfoCountPOS = basePopulationInfoService.listPopulationSaveCountByUserIdAndDay(userId, date);
|
||||
Map<String, Integer> map = new HashMap<>();
|
||||
basePopulationInfoCountPOS.forEach(basePopulationInfoCountPO -> {
|
||||
map.put(basePopulationInfoCountPO.getUserId(), basePopulationInfoCountPO.getTotal());
|
||||
});
|
||||
return map;
|
||||
}
|
||||
|
||||
public static Map<String, Integer> mapPopulationUpdateCount(IBasePopulationInfoService basePopulationInfoService, List<String> userIds, String date) {
|
||||
List<BasePopulationInfoCountPO> basePopulationInfoCountPOS = basePopulationInfoService.listPopulationUpdateCountByUserIdsAndDay(userIds, date);
|
||||
Map<String, Integer> map = new HashMap<>();
|
||||
@ -189,6 +257,15 @@ public class KpiUtil {
|
||||
return map;
|
||||
}
|
||||
|
||||
public static Map<String, Integer> mapPopulationUpdateCount(IBasePopulationInfoService basePopulationInfoService, String userId, String date) {
|
||||
List<BasePopulationInfoCountPO> basePopulationInfoCountPOS = basePopulationInfoService.listPopulationUpdateCountByUserIdAndDay(userId, date);
|
||||
Map<String, Integer> map = new HashMap<>();
|
||||
basePopulationInfoCountPOS.forEach(basePopulationInfoCountPO -> {
|
||||
map.put(basePopulationInfoCountPO.getUserId(), basePopulationInfoCountPO.getTotal());
|
||||
});
|
||||
return map;
|
||||
}
|
||||
|
||||
public static List<List<DayWeek>> listDayWeekOfMonth(int year, int month) {
|
||||
DateTime dateTime = DateTime.parse(String.format("%04d-%02d", year, month), DateTimeFormat.forPattern("yyyy-MM"));
|
||||
DateTime.Property dayOfMonth = dateTime.dayOfMonth();
|
||||
@ -202,7 +279,7 @@ public class KpiUtil {
|
||||
String day = dayDateTime.toString(DateTimeFormat.forPattern(ISystemConstant.DATE_FORMATTER_YYYY_MM_DD));
|
||||
DayWeek dayWeek = new DayWeek(day, weekOfMonth, dayDateTime.dayOfWeek().get());
|
||||
currentWeekDays.add(dayWeek);
|
||||
if (dayWeek.getDayOfWeek() == 7 || (i == monthEndDay - 1)) {
|
||||
if (dayWeek.getDayOfWeek() == 7 || (i == monthEndDay)) {
|
||||
dayWeeks.add(currentWeekDays);
|
||||
weekOfMonth++;
|
||||
currentWeekDays = new ArrayList<>();
|
||||
|
@ -62,6 +62,10 @@
|
||||
AND
|
||||
LEFT(gmt_create, 10) = #{day}
|
||||
</if>
|
||||
<if test="userId != null and userId != ''">
|
||||
AND
|
||||
creator = #{userId}
|
||||
</if>
|
||||
<if test="userIds != null and userIds.size > 0">
|
||||
AND
|
||||
creator IN
|
||||
|
@ -112,6 +112,10 @@
|
||||
ccb.is_delete = 0
|
||||
AND
|
||||
su.is_delete = 0
|
||||
<if test="communityBossUserId != null and communityBossUserId != ''">
|
||||
AND
|
||||
ccb.community_boss_user_id = #{communityBossUserId}
|
||||
</if>
|
||||
<if test="areaId != null and areaId != ''">
|
||||
AND
|
||||
ccb.area_id = #{areaId}
|
||||
|
@ -38,6 +38,10 @@
|
||||
city_leave
|
||||
WHERE
|
||||
is_delete = 0
|
||||
<if test="userId != null and userId != ''">
|
||||
AND
|
||||
creator = #{userId}
|
||||
</if>
|
||||
<if test="userIds != null and userIds.size > 0">
|
||||
AND
|
||||
creator IN
|
||||
|
@ -72,6 +72,10 @@
|
||||
AND
|
||||
LEFT(gmt_create, 10) = #{day}
|
||||
</if>
|
||||
<if test="creator != null and creator != ''">
|
||||
AND
|
||||
creator = #{creator}
|
||||
</if>
|
||||
<if test="creators != null and creators.size > 0">
|
||||
AND
|
||||
creator IN
|
||||
@ -101,6 +105,10 @@
|
||||
AND
|
||||
LEFT(gmt_create, 10) = #{day}
|
||||
</if>
|
||||
<if test="creator != null and creator != ''">
|
||||
AND
|
||||
creator = #{creator}
|
||||
</if>
|
||||
<if test="creators != null and creators.size > 0">
|
||||
AND
|
||||
creator IN
|
||||
|
@ -92,6 +92,10 @@
|
||||
kh_year = #{khYear}
|
||||
AND
|
||||
kh_month = #{khMonth}
|
||||
<if test="userId != null and userId != ''">
|
||||
AND
|
||||
user_id = #{userId}
|
||||
</if>
|
||||
</delete>
|
||||
|
||||
<select id="listWgy" parameterType="map" resultMap="kpiKhxzWgyDTO">
|
||||
|
@ -230,6 +230,10 @@
|
||||
kpi_community_boss_${level}_day_count
|
||||
WHERE
|
||||
day_date = #{dayDate}
|
||||
<if test="userId != null and userId != ''">
|
||||
AND
|
||||
user_id = #{userId}
|
||||
</if>
|
||||
</delete>
|
||||
|
||||
<!-- 修改网格员日统计 -->
|
||||
@ -653,11 +657,11 @@
|
||||
</if>
|
||||
<if test="startTime != null and startTime != ''">
|
||||
AND
|
||||
gmt_report <![CDATA[ >= ]]> #{startTime}
|
||||
LEFT(gmt_report, 10) <![CDATA[ >= ]]> #{startTime}
|
||||
</if>
|
||||
<if test="endTime != null and endTime != ''">
|
||||
AND
|
||||
gmt_report <![CDATA[ <= ]]> #{endTime}
|
||||
LEFT(gmt_report, 10) <![CDATA[ <= ]]> #{endTime}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
Loading…
Reference in New Issue
Block a user