处理绩效考核网格员那件数据对不上问题

This commit is contained in:
TS-QD1 2023-08-07 16:36:40 +08:00
parent 5649bf07a3
commit 363a8d3f72
22 changed files with 754 additions and 82 deletions

View File

@ -152,6 +152,11 @@ public class KpiKhxzController extends AbstractController {
kpiKhxzService.updateWgy4(year, month); 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}") @GetMapping("sync-ddy/{year}/{month}")
public void syncDdy(@PathVariable("year") Integer year, @PathVariable("month") Integer month) throws IOException { public void syncDdy(@PathVariable("year") Integer year, @PathVariable("month") Integer month) throws IOException {
kpiKhxzService.updateDdy(year, month); kpiKhxzService.updateDdy(year, month);
@ -172,6 +177,11 @@ public class KpiKhxzController extends AbstractController {
kpiKhxzService.updateWgy4Task(year, month); 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}") @GetMapping("sync-ddy-task/{year}/{month}")
public void syncDdyTask(@PathVariable("year") Integer year, @PathVariable("month") Integer month) throws IOException { public void syncDdyTask(@PathVariable("year") Integer year, @PathVariable("month") Integer month) throws IOException {
kpiKhxzService.updateDdyTask(year, month); kpiKhxzService.updateDdyTask(year, month);

View File

@ -10,9 +10,16 @@ import java.util.List;
public interface IBasePopulationInfoService { public interface IBasePopulationInfoService {
List<BasePopulationInfoCountPO> listPopulationSaveCountByUserIds(List<String> userIds); List<BasePopulationInfoCountPO> listPopulationSaveCountByUserIds(List<String> userIds);
List<BasePopulationInfoCountPO> listPopulationSaveCountByUserId(String userId);
List<BasePopulationInfoCountPO> listPopulationSaveCountByUserIdsAndDay(List<String> userIds, String date); 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); List<BasePopulationInfoCountPO> listPopulationUpdateCountByUserIdsAndDay(List<String> userIds, String date);
SuccessResultList<List<BasePopulationInfoDTO>> listPagePopulationSaveByUserIdAndStartTimeAndEndTime(String userId, String startTime, String endTime, ListPage page); SuccessResultList<List<BasePopulationInfoDTO>> listPagePopulationSaveByUserIdAndStartTimeAndEndTime(String userId, String startTime, String endTime, ListPage page);

View File

@ -18,6 +18,8 @@ public interface IKpiKhxzService {
void updateWgy4(Integer khYear, Integer khMonth); void updateWgy4(Integer khYear, Integer khMonth);
void updateWgy4(Integer year, Integer month, String userId);
void updateDdy(Integer khYear, Integer khMonth); void updateDdy(Integer khYear, Integer khMonth);
void updateZgy(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 khYear, Integer khMonth);
void updateWgy4Task(Integer year, Integer month, String userId);
void updateDdyTask(Integer khYear, Integer khMonth); void updateDdyTask(Integer khYear, Integer khMonth);
void updateZfGaTask(Integer khYear, Integer khMonth); void updateZfGaTask(Integer khYear, Integer khMonth);

View File

@ -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);
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);
void updateCommunityBossDayCount(int year, int month, int level, String userId);
/** /**
* 更新N员 * 更新N员
* 更新N员 * 更新N员

View File

@ -9,4 +9,5 @@ public interface ILeaveService {
List<LeavePO> listPOByUserIdsAndDay(List<String> userIds, String day); List<LeavePO> listPOByUserIdsAndDay(List<String> userIds, String day);
List<LeavePO> listPOByUserIdAndDay(String userId, String day);
} }

View File

@ -12,8 +12,12 @@ import java.util.List;
public interface IUserSignService { public interface IUserSignService {
List<UserSigninPO> listInPOByUserIdsAndDay(List<String> userIds, String day); 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(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<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); SuccessResultList<List<UserSignoutDTO>> listOutByUserIdAndStartTimeAndEndTimeAndIsEarly(String userId, String startTime, String endTime, Integer isEarly, ListPage page);

View File

@ -29,6 +29,13 @@ public class BasePopulationInfoServiceImpl implements IBasePopulationInfoService
return basePopulationInfoDao.listPopulationSaveCount(params); 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 @Override
public List<BasePopulationInfoCountPO> listPopulationSaveCountByUserIdsAndDay(List<String> userIds, String date) { public List<BasePopulationInfoCountPO> listPopulationSaveCountByUserIdsAndDay(List<String> userIds, String date) {
Map<String, Object> params = new HashMap<>(); Map<String, Object> params = new HashMap<>();
@ -37,6 +44,22 @@ public class BasePopulationInfoServiceImpl implements IBasePopulationInfoService
return basePopulationInfoDao.listPopulationSaveCount(params); 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 @Override
public List<BasePopulationInfoCountPO> listPopulationUpdateCountByUserIdsAndDay(List<String> userIds, String date) { public List<BasePopulationInfoCountPO> listPopulationUpdateCountByUserIdsAndDay(List<String> userIds, String date) {
Map<String, Object> params = new HashMap<>(); Map<String, Object> params = new HashMap<>();

View File

@ -126,6 +126,11 @@ public class KpiKhxzServiceImpl extends AbstractService implements IKpiKhxzServi
KpiUpdateMonitor.getInstance().complete(); KpiUpdateMonitor.getInstance().complete();
} }
@Override
public void updateWgy4(Integer year, Integer month, String userId) {
kpiService.updateCommunityBossDayCount(year, month, 4, userId);
}
@Override @Override
public void updateDdy(Integer khYear, Integer khMonth) { public void updateDdy(Integer khYear, Integer khMonth) {
kpiService.updateNPersonDayCount(KpiUtil.DDY_ROLE_ID, khYear, 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); kpiKhxzWgyTask.update(khYear, khMonth, 4);
} }
@Override
public void updateWgy4Task(Integer year, Integer month, String userId) {
kpiKhxzWgyTask.update(year, month, 4, userId);
}
@Override @Override
public void updateDdyTask(Integer khYear, Integer khMonth) { public void updateDdyTask(Integer khYear, Integer khMonth) {
kpiKhxzDdyTask.update(khYear, khMonth); kpiKhxzDdyTask.update(khYear, khMonth);

View File

@ -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 @Override
public void updateCommunityBossDayCount(int year, int month, int level) { public void updateCommunityBossDayCount(int year, int month, int level) {
DateTime dateTime = DateTime.parse(String.format("%04d-%02d", year, month), DateTimeFormat.forPattern("yyyy-MM")); 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); 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 @Override
public void updateNPersonDayCount(String departmentId, String startTime, String endTime) { public void updateNPersonDayCount(String departmentId, String startTime, String endTime) {
updateNPersonDayCount(departmentId, KpiUtil.ZGY_ROLE_ID, startTime, endTime); updateNPersonDayCount(departmentId, KpiUtil.ZGY_ROLE_ID, startTime, endTime);
@ -375,6 +494,14 @@ public class KpiServiceImpl implements IKpiService {
kpiDao.deleteCommunityBossDayCount(params); 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 @Override
public List<CommunityCaseCountDTO> listCommunityCaseCount(String areaId, String communityId, String startTime, String endTime) { public List<CommunityCaseCountDTO> listCommunityCaseCount(String areaId, String communityId, String startTime, String endTime) {
Map<String, Object> params = new HashMap<>(); Map<String, Object> params = new HashMap<>();

View File

@ -3,6 +3,7 @@ package com.cm.bigdata.service.kpi.impl;
import com.cm.bigdata.dao2.kpi.ILeaveDao; import com.cm.bigdata.dao2.kpi.ILeaveDao;
import com.cm.bigdata.pojo.pos.kpi.LeavePO; import com.cm.bigdata.pojo.pos.kpi.LeavePO;
import com.cm.bigdata.service.kpi.ILeaveService; import com.cm.bigdata.service.kpi.ILeaveService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -29,4 +30,16 @@ public class LeaveServiceImpl implements ILeaveService {
params.put("leaveState", 1); params.put("leaveState", 1);
return leaveDao.listPO(params); 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);
}
} }

View File

@ -31,6 +31,14 @@ public class UserSignServiceImpl implements IUserSignService {
return userSignDao.listInPO(params); 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 @Override
public List<UserSignoutPO> listOutPOByUserIdsAndDay(List<String> userIds, String day) { public List<UserSignoutPO> listOutPOByUserIdsAndDay(List<String> userIds, String day) {
Map<String, Object> params = new HashMap<>(); Map<String, Object> params = new HashMap<>();
@ -39,6 +47,14 @@ public class UserSignServiceImpl implements IUserSignService {
return userSignDao.listOutPO(params); 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 @Override
public SuccessResultList<List<UserSigninDTO>> listInByUserIdAndStartTimeAndEndTimeAndIsLate(String userId, String startTime, String endTime, Integer isLate, ListPage page) { public SuccessResultList<List<UserSigninDTO>> listInByUserIdAndStartTimeAndEndTimeAndIsLate(String userId, String startTime, String endTime, Integer isLate, ListPage page) {
Map<String, Object> params = new HashMap<>(); Map<String, Object> params = new HashMap<>();

View File

@ -11,7 +11,9 @@ import com.cm.bigdata.service.kpi.IKpiService;
import com.cm.bigdata.service.kpi.IUserGridService; import com.cm.bigdata.service.kpi.IUserGridService;
import com.cm.bigdata.service.kpi.IUserService; import com.cm.bigdata.service.kpi.IUserService;
import com.cm.bigdata.service.kpi.task.sub.KpiKhxzWgyCRunnable; 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.KpiKhxzWgyEGIKRTRunnable;
import com.cm.bigdata.service.kpi.task.sub.KpiKhxzWgyEGIKRTUserRunnable;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -54,6 +56,13 @@ public class KpiKhxzWgyTask {
executorService.execute(new KpiKhxzWgyEGIKRTRunnable(userGridService, kpiKhxzWgyDao, kpiHolidayDao, kpiDao, khYear, khMonth, wgyLevel, userIds)); 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) { private void deleteBaseWgy(int khYear, int khMonth, int wgyLevel) {
Map<String, Object> params = new HashMap<>(); Map<String, Object> params = new HashMap<>();
params.put("khYear", khYear); params.put("khYear", khYear);
@ -63,6 +72,15 @@ public class KpiKhxzWgyTask {
KpiUpdateMonitor.getInstance().complete(); 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) { private void updateBaseWgy(int khYear, int khMonth, int wgyLevel) {
Map<String, Object> params = new HashMap<>(); Map<String, Object> params = new HashMap<>();
params.put("communityBossLevel", wgyLevel); params.put("communityBossLevel", wgyLevel);
@ -106,6 +124,49 @@ public class KpiKhxzWgyTask {
KpiUpdateMonitor.getInstance().complete(); 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) { private List<String> listUserIds(int khYear, int khMonth, int wgyLevel) {
Map<String, Object> params = new HashMap<>(); Map<String, Object> params = new HashMap<>();
params.put("khYear", khYear); params.put("khYear", khYear);

View File

@ -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);
}
}

View File

@ -41,8 +41,8 @@ public class KpiKhxzWgyEGIKRTRunnable implements Runnable {
public void run() { public void run() {
List<HolidayPO> holidayPOS = listHoliday(); List<HolidayPO> holidayPOS = listHoliday();
List<List<KpiUtil.DayWeek>> dayWeeks = KpiUtil.listDayWeekOfMonth(year, month); List<List<KpiUtil.DayWeek>> dayWeeks = KpiUtil.listDayWeekOfMonth(year, month);
List<List<KpiUtil.DayWeek>> shouldReportDayWeeks = listShouldReportDayWeek(holidayPOS, dayWeeks); List<List<KpiUtil.DayWeek>>[] reportDayWeeks = listShouldReportDayWeek(holidayPOS, dayWeeks);
updateEGIKRT(userIds, shouldReportDayWeeks); updateEGIKRT(userIds, reportDayWeeks[0], reportDayWeeks[1]);
KpiUpdateMonitor.getInstance().complete(); KpiUpdateMonitor.getInstance().complete();
} }
@ -53,7 +53,8 @@ public class KpiKhxzWgyEGIKRTRunnable implements Runnable {
* @param dayWeeks * @param dayWeeks
* @return [应报实报少报多报] * @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<>(); List<List<KpiUtil.DayWeek>> shouldReportDayWeeks = new ArrayList<>();
for (List<KpiUtil.DayWeek> dws : dayWeeks) { for (List<KpiUtil.DayWeek> dws : dayWeeks) {
int workdayCount = 0; int workdayCount = 0;
@ -75,85 +76,115 @@ public class KpiKhxzWgyEGIKRTRunnable implements Runnable {
// 工作天数大于三天需要上报 // 工作天数大于三天需要上报
if (workdayCount > 3) { if (workdayCount > 3) {
shouldReportDayWeeks.add(dws); 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) { private void updateEGIKRT(List<String> userIds, List<List<KpiUtil.DayWeek>> shouldReportDayWeeks, List<List<KpiUtil.DayWeek>> unShouldReportDayWeeks) {
int shouldCount = shouldReportDayWeeks.size();
userIds.forEach(userId -> { userIds.forEach(userId -> {
// 网格数量 try {
Integer gridCount = userGridService.countUserGrid(userId); int shouldCount = shouldReportDayWeeks.size();
int totalShouldCount = shouldCount * gridCount; // 网格数量
// 每周上报 Integer gridCount = userGridService.countUserGrid(userId);
int weekReportCount = 0; int totalShouldCount = shouldCount * gridCount;
// 实报 // 每周上报
int realityCount = 0; int weekReportCount = 0;
// 少报 // 少报
int lackCount = 0; int lackCount = 0;
// 多报 // 多报
int exceedCount = 0; int exceedCount = 0;
// 督办次数 // 督办次数
int urgeCount = 0; int urgeCount = 0;
// 超时检查数量 // 超时检查数量
int inspectTimeoutCount = 0; int inspectTimeoutCount = 0;
for (List<KpiUtil.DayWeek> shouldReportDayWeek : shouldReportDayWeeks) { // 非必须上报周内上报案件算多报
String startTime = shouldReportDayWeek.get(0).getDate(); for (List<KpiUtil.DayWeek> unShouldReportDayWeek : unShouldReportDayWeeks) {
String endTime = shouldReportDayWeek.get(shouldReportDayWeek.size() - 1).getDate(); String startTime = unShouldReportDayWeek.get(0).getDate();
Map<String, Object> params = new HashMap<>(); String endTime = unShouldReportDayWeek.get(unShouldReportDayWeek.size() - 1).getDate();
params.put("reportUserId", userId); Map<String, Object> params = new HashMap<>();
params.put("startTime", startTime); params.put("reportUserId", userId);
params.put("endTime", endTime); params.put("startTime", startTime);
List<CasePO> casePOS = kpiDao.listCase(params); params.put("endTime", endTime);
// 本周是否有上报数据 List<CasePO> casePOS = kpiDao.listCase(params);
boolean isWeekReport = false; for (CasePO casePO : casePOS) {
for (CasePO casePO : casePOS) { // 自处理
urgeCount += casePO.getTotalUrge(); Integer isSelf = casePO.getIsSelf();
// 自处理 // 不是自处理上报就算处理
Integer isSelf = casePO.getIsSelf(); if (isSelf == 0) {
// 不是自处理上报就算处理 exceedCount++;
if (isSelf == 0) { continue;
realityCount++; }
isWeekReport = true; // 检查过了算多报
continue; String gmtInspect = casePO.getGmtInspect();
} if (StringUtils.isBlank(gmtInspect)) {
// 处理时间 continue;
String gmtHandle = casePO.getGmtHandle(); }
if (StringUtils.isBlank(gmtHandle)) { // 检查时间复合规定
continue; if (KpiUtil.isDateBetween(gmtInspect.substring(0, 10), startTime, endTime)) {
} exceedCount++;
// 检查时间 }
String gmtInspect = casePO.getGmtInspect();
if (StringUtils.isBlank(gmtInspect)) {
continue;
}
// 处理时间和检查时间超过24小时
if (KpiUtil.isdateTimeIn24Hours(gmtHandle, gmtInspect)) {
inspectTimeoutCount++;
}
if (KpiUtil.isDateBetween(gmtInspect, startTime, endTime)) {
realityCount++;
isWeekReport = true;
} }
} }
// 每周上报数量由网格数量决定 for (List<KpiUtil.DayWeek> shouldReportDayWeek : shouldReportDayWeeks) {
weekReportCount += isWeekReport ? gridCount : 0; String startTime = shouldReportDayWeek.get(0).getDate();
lackCount = Math.max(totalShouldCount - weekReportCount, 0); String endTime = shouldReportDayWeek.get(shouldReportDayWeek.size() - 1).getDate();
exceedCount = Math.max(realityCount - totalShouldCount, 0); 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);
} catch (Exception e) {
e.printStackTrace();
} }
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);
}); });
} }

View File

@ -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);
}
}

View File

@ -38,11 +38,10 @@ public class KpiUtil {
if (StringUtils.isBlank(date)) { if (StringUtils.isBlank(date)) {
return false; return false;
} }
date = date.split("\\.")[0]; DateTime dateTime = DateTime.parse(date, DateTimeFormat.forPattern(ISystemConstant.DATE_FORMATTER_YYYY_MM_DD));
DateTime dateTime = DateTime.parse(date, DateTimeFormat.forPattern(ISystemConstant.DATE_FORMATTER_YYYY_MM_DD_HH_MM_SS));
DateTime startDateTime = DateTime.parse(startDate, 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)); 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) { public static boolean hasValueInList(List<String> values, String checkValue) {
@ -83,6 +82,13 @@ public class KpiUtil {
return userGridMap; 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) { public static Map<String, LeavePO> mapLeave(ILeaveService leaveService, List<String> userIds, String day) {
List<LeavePO> leavePOS = leaveService.listPOByUserIdsAndDay(userIds, day); List<LeavePO> leavePOS = leaveService.listPOByUserIdsAndDay(userIds, day);
Map<String, LeavePO> leavePOMap = new HashMap<>(); Map<String, LeavePO> leavePOMap = new HashMap<>();
@ -92,6 +98,15 @@ public class KpiUtil {
return leavePOMap; 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 * 签到map
* *
@ -113,6 +128,27 @@ public class KpiUtil {
return userSigninMap; 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 * 签退map
* *
@ -134,6 +170,20 @@ public class KpiUtil {
return userSigninMap; 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; 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) { public static Map<String, Integer> mapPopulationSaveCount(IBasePopulationInfoService basePopulationInfoService, List<String> userIds, String date) {
List<BasePopulationInfoCountPO> basePopulationInfoCountPOS = basePopulationInfoService.listPopulationSaveCountByUserIdsAndDay(userIds, date); List<BasePopulationInfoCountPO> basePopulationInfoCountPOS = basePopulationInfoService.listPopulationSaveCountByUserIdsAndDay(userIds, date);
Map<String, Integer> map = new HashMap<>(); Map<String, Integer> map = new HashMap<>();
@ -180,6 +239,15 @@ public class KpiUtil {
return map; 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) { public static Map<String, Integer> mapPopulationUpdateCount(IBasePopulationInfoService basePopulationInfoService, List<String> userIds, String date) {
List<BasePopulationInfoCountPO> basePopulationInfoCountPOS = basePopulationInfoService.listPopulationUpdateCountByUserIdsAndDay(userIds, date); List<BasePopulationInfoCountPO> basePopulationInfoCountPOS = basePopulationInfoService.listPopulationUpdateCountByUserIdsAndDay(userIds, date);
Map<String, Integer> map = new HashMap<>(); Map<String, Integer> map = new HashMap<>();
@ -189,6 +257,15 @@ public class KpiUtil {
return map; 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) { 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 dateTime = DateTime.parse(String.format("%04d-%02d", year, month), DateTimeFormat.forPattern("yyyy-MM"));
DateTime.Property dayOfMonth = dateTime.dayOfMonth(); DateTime.Property dayOfMonth = dateTime.dayOfMonth();
@ -202,7 +279,7 @@ public class KpiUtil {
String day = dayDateTime.toString(DateTimeFormat.forPattern(ISystemConstant.DATE_FORMATTER_YYYY_MM_DD)); String day = dayDateTime.toString(DateTimeFormat.forPattern(ISystemConstant.DATE_FORMATTER_YYYY_MM_DD));
DayWeek dayWeek = new DayWeek(day, weekOfMonth, dayDateTime.dayOfWeek().get()); DayWeek dayWeek = new DayWeek(day, weekOfMonth, dayDateTime.dayOfWeek().get());
currentWeekDays.add(dayWeek); currentWeekDays.add(dayWeek);
if (dayWeek.getDayOfWeek() == 7 || (i == monthEndDay - 1)) { if (dayWeek.getDayOfWeek() == 7 || (i == monthEndDay)) {
dayWeeks.add(currentWeekDays); dayWeeks.add(currentWeekDays);
weekOfMonth++; weekOfMonth++;
currentWeekDays = new ArrayList<>(); currentWeekDays = new ArrayList<>();

View File

@ -62,6 +62,10 @@
AND AND
LEFT(gmt_create, 10) = #{day} LEFT(gmt_create, 10) = #{day}
</if> </if>
<if test="userId != null and userId != ''">
AND
creator = #{userId}
</if>
<if test="userIds != null and userIds.size > 0"> <if test="userIds != null and userIds.size > 0">
AND AND
creator IN creator IN

View File

@ -112,6 +112,10 @@
ccb.is_delete = 0 ccb.is_delete = 0
AND AND
su.is_delete = 0 su.is_delete = 0
<if test="communityBossUserId != null and communityBossUserId != ''">
AND
ccb.community_boss_user_id = #{communityBossUserId}
</if>
<if test="areaId != null and areaId != ''"> <if test="areaId != null and areaId != ''">
AND AND
ccb.area_id = #{areaId} ccb.area_id = #{areaId}

View File

@ -38,6 +38,10 @@
city_leave city_leave
WHERE WHERE
is_delete = 0 is_delete = 0
<if test="userId != null and userId != ''">
AND
creator = #{userId}
</if>
<if test="userIds != null and userIds.size > 0"> <if test="userIds != null and userIds.size > 0">
AND AND
creator IN creator IN

View File

@ -72,6 +72,10 @@
AND AND
LEFT(gmt_create, 10) = #{day} LEFT(gmt_create, 10) = #{day}
</if> </if>
<if test="creator != null and creator != ''">
AND
creator = #{creator}
</if>
<if test="creators != null and creators.size > 0"> <if test="creators != null and creators.size > 0">
AND AND
creator IN creator IN
@ -101,6 +105,10 @@
AND AND
LEFT(gmt_create, 10) = #{day} LEFT(gmt_create, 10) = #{day}
</if> </if>
<if test="creator != null and creator != ''">
AND
creator = #{creator}
</if>
<if test="creators != null and creators.size > 0"> <if test="creators != null and creators.size > 0">
AND AND
creator IN creator IN

View File

@ -92,6 +92,10 @@
kh_year = #{khYear} kh_year = #{khYear}
AND AND
kh_month = #{khMonth} kh_month = #{khMonth}
<if test="userId != null and userId != ''">
AND
user_id = #{userId}
</if>
</delete> </delete>
<select id="listWgy" parameterType="map" resultMap="kpiKhxzWgyDTO"> <select id="listWgy" parameterType="map" resultMap="kpiKhxzWgyDTO">

View File

@ -230,6 +230,10 @@
kpi_community_boss_${level}_day_count kpi_community_boss_${level}_day_count
WHERE WHERE
day_date = #{dayDate} day_date = #{dayDate}
<if test="userId != null and userId != ''">
AND
user_id = #{userId}
</if>
</delete> </delete>
<!-- 修改网格员日统计 --> <!-- 修改网格员日统计 -->
@ -652,12 +656,12 @@
is_inspect = #{isInspect} is_inspect = #{isInspect}
</if> </if>
<if test="startTime != null and startTime != ''"> <if test="startTime != null and startTime != ''">
AND AND
gmt_report <![CDATA[ >= ]]> #{startTime} LEFT(gmt_report, 10) <![CDATA[ >= ]]> #{startTime}
</if> </if>
<if test="endTime != null and endTime != ''"> <if test="endTime != null and endTime != ''">
AND AND
gmt_report <![CDATA[ <= ]]> #{endTime} LEFT(gmt_report, 10) <![CDATA[ <= ]]> #{endTime}
</if> </if>
</where> </where>
</select> </select>