案件处理、调度员调度24小时排除节假日
This commit is contained in:
parent
610aad4f88
commit
fb1a3d7613
@ -11,4 +11,6 @@ public interface IKpiHolidayDao {
|
||||
|
||||
List<HolidayPO> list(Map<String, Object> params);
|
||||
|
||||
Integer count(Map<String, Object> params);
|
||||
|
||||
}
|
||||
|
@ -193,6 +193,10 @@ public class KpiKhxzServiceImpl extends AbstractService implements IKpiKhxzServi
|
||||
Double score = kpiKhxzWgyDTO.getaE();
|
||||
if (score <= 100 && score >= 85) {
|
||||
kpiKhxzWgyDTO.setaF(333 * kpiKhxzWgyDTO.getGridCount() + "(" + 500 * kpiKhxzWgyDTO.getGridCount() + ")");
|
||||
} else if (score >= 75) {
|
||||
kpiKhxzWgyDTO.setaF(333 * kpiKhxzWgyDTO.getGridCount() + "(" + 333 * kpiKhxzWgyDTO.getGridCount() + ")");
|
||||
} else if (score >= 60) {
|
||||
kpiKhxzWgyDTO.setaF(333 * kpiKhxzWgyDTO.getGridCount() + "(" + 233 * kpiKhxzWgyDTO.getGridCount() + ")");
|
||||
} else {
|
||||
kpiKhxzWgyDTO.setaF(333 * kpiKhxzWgyDTO.getGridCount() + "(0)");
|
||||
}
|
||||
|
@ -42,7 +42,7 @@ public class KpiKhxzWgyEGIKRTRunnable implements Runnable {
|
||||
List<HolidayPO> holidayPOS = listHoliday();
|
||||
List<List<KpiUtil.DayWeek>> dayWeeks = KpiUtil.listDayWeekOfMonth(year, month);
|
||||
List<List<KpiUtil.DayWeek>>[] reportDayWeeks = listShouldReportDayWeek(holidayPOS, dayWeeks);
|
||||
updateEGIKRT(userIds, reportDayWeeks[0], reportDayWeeks[1]);
|
||||
updateEGIKRT(userIds, reportDayWeeks[0], reportDayWeeks[1], holidayPOS);
|
||||
KpiUpdateMonitor.getInstance().complete();
|
||||
}
|
||||
|
||||
@ -83,7 +83,7 @@ public class KpiKhxzWgyEGIKRTRunnable implements Runnable {
|
||||
return new List[]{shouldReportDayWeeks, unShouldReportDayWeeks};
|
||||
}
|
||||
|
||||
private void updateEGIKRT(List<String> userIds, List<List<KpiUtil.DayWeek>> shouldReportDayWeeks, List<List<KpiUtil.DayWeek>> unShouldReportDayWeeks) {
|
||||
private void updateEGIKRT(List<String> userIds, List<List<KpiUtil.DayWeek>> shouldReportDayWeeks, List<List<KpiUtil.DayWeek>> unShouldReportDayWeeks, List<HolidayPO> holidayPOS) {
|
||||
userIds.forEach(userId -> {
|
||||
try {
|
||||
int shouldCount = shouldReportDayWeeks.size();
|
||||
@ -128,7 +128,8 @@ public class KpiKhxzWgyEGIKRTRunnable implements Runnable {
|
||||
continue;
|
||||
}
|
||||
// 处理时间和检查时间超过24小时
|
||||
if (!KpiUtil.isdateTimeIn24Hours(gmtHandle, gmtInspect)) {
|
||||
// 排除期间的假期
|
||||
if (!KpiUtil.isdateTimeIn24HoursNoHoliday(gmtHandle, gmtInspect, holidayPOS)) {
|
||||
inspectTimeoutCount++;
|
||||
}
|
||||
exceedCount++;
|
||||
@ -164,7 +165,7 @@ public class KpiKhxzWgyEGIKRTRunnable implements Runnable {
|
||||
continue;
|
||||
}
|
||||
// 处理时间和检查时间超过24小时
|
||||
if (!KpiUtil.isdateTimeIn24Hours(gmtHandle, gmtInspect)) {
|
||||
if (!KpiUtil.isdateTimeIn24HoursNoHoliday(gmtHandle, gmtInspect, holidayPOS)) {
|
||||
inspectTimeoutCount++;
|
||||
}
|
||||
realityCount++;
|
||||
|
@ -42,7 +42,7 @@ public class KpiKhxzWgyEGIKRTUserRunnable implements Runnable {
|
||||
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]);
|
||||
updateEGIKRT(userId, reportDayWeeks[0], reportDayWeeks[1], holidayPOS);
|
||||
KpiUpdateMonitor.getInstance().complete();
|
||||
}
|
||||
|
||||
@ -83,7 +83,7 @@ public class KpiKhxzWgyEGIKRTUserRunnable implements Runnable {
|
||||
return new List[]{shouldReportDayWeeks, unShouldReportDayWeeks};
|
||||
}
|
||||
|
||||
private void updateEGIKRT(String userId, List<List<KpiUtil.DayWeek>> shouldReportDayWeeks, List<List<KpiUtil.DayWeek>> unShouldReportDayWeeks) {
|
||||
private void updateEGIKRT(String userId, List<List<KpiUtil.DayWeek>> shouldReportDayWeeks, List<List<KpiUtil.DayWeek>> unShouldReportDayWeeks, List<HolidayPO> holidayPOS) {
|
||||
int shouldCount = shouldReportDayWeeks.size();
|
||||
// 网格数量
|
||||
Integer gridCount = userGridService.countUserGrid(userId);
|
||||
@ -126,7 +126,7 @@ public class KpiKhxzWgyEGIKRTUserRunnable implements Runnable {
|
||||
continue;
|
||||
}
|
||||
// 处理时间和检查时间超过24小时
|
||||
if (!KpiUtil.isdateTimeIn24Hours(gmtHandle, gmtInspect)) {
|
||||
if (!KpiUtil.isdateTimeIn24HoursNoHoliday(gmtHandle, gmtInspect, holidayPOS)) {
|
||||
inspectTimeoutCount++;
|
||||
}
|
||||
// 检查时间复合规定
|
||||
@ -163,7 +163,7 @@ public class KpiKhxzWgyEGIKRTUserRunnable implements Runnable {
|
||||
continue;
|
||||
}
|
||||
// 处理时间和检查时间超过24小时
|
||||
if (!KpiUtil.isdateTimeIn24Hours(gmtHandle, gmtInspect)) {
|
||||
if (!KpiUtil.isdateTimeIn24HoursNoHoliday(gmtHandle, gmtInspect, holidayPOS)) {
|
||||
inspectTimeoutCount++;
|
||||
}
|
||||
realityCount++;
|
||||
|
@ -1,7 +1,9 @@
|
||||
package com.cm.bigdata.task;
|
||||
|
||||
import com.cm.bigdata.dao.kpi.IKpiDao;
|
||||
import com.cm.bigdata.dao.kpi.IKpiHolidayDao;
|
||||
import com.cm.bigdata.pojo.pos.kpi.CaseAssignPO;
|
||||
import com.cm.bigdata.pojo.pos.kpi.HolidayPO;
|
||||
import com.cm.bigdata.pojo.pos.kpi.ReportCasePO;
|
||||
import com.cm.bigdata.service.kpi.IReportCaseService;
|
||||
import com.cm.common.utils.DateUtil;
|
||||
@ -34,6 +36,8 @@ public class BigDataTask {
|
||||
private IKpiDao kpiDao;
|
||||
@Autowired
|
||||
private IReportCaseService reportCaseService;
|
||||
@Autowired
|
||||
private IKpiHolidayDao kpiHolidayDao;
|
||||
|
||||
|
||||
// 每10分钟执行一次
|
||||
@ -67,6 +71,8 @@ public class BigDataTask {
|
||||
List<CaseAssignPO> updates = new ArrayList<>();
|
||||
// 已经删除的数据
|
||||
List<String> deleteCaseIds = new ArrayList<>();
|
||||
// 是否是假期
|
||||
boolean isHoliday = isHoliday(nowDateTime);
|
||||
reportCasePOS.forEach(reportCasePO -> {
|
||||
if (reportCasePO.getIsDelete() == 1) {
|
||||
deleteCaseIds.add(reportCasePO.getReportCaseId());
|
||||
@ -91,6 +97,10 @@ public class BigDataTask {
|
||||
// 判断是否超过24小时
|
||||
LocalDateTime gmtCreateDateTime = LocalDateTime.parse(existCaseAssignPO.getGmtCreate().substring(0, 18), dateTimeFormatter);
|
||||
if (Hours.hoursBetween(gmtCreateDateTime, nowDateTime).getHours() >= 24) {
|
||||
// 如果当天是假期,不记录
|
||||
if (isHoliday) {
|
||||
return;
|
||||
}
|
||||
// 超过24小时标记为已超时
|
||||
caseAssignPO.setGmtModified(DateUtil.getTime());
|
||||
caseAssignPO.setIsTimeout(1);
|
||||
@ -126,4 +136,17 @@ public class BigDataTask {
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isHoliday(LocalDateTime nowDateTime) {
|
||||
Map<String, Object> params = new HashMap<>();
|
||||
params.put("holidayYear", nowDateTime.getYear());
|
||||
params.put("holidayMonth", nowDateTime.getMonthOfYear());
|
||||
List<HolidayPO> holidayPOS = kpiHolidayDao.list(params);
|
||||
for (HolidayPO holidayPO : holidayPOS) {
|
||||
if (holidayPO.getHolidayDay() == nowDateTime.getDayOfMonth()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
package com.cm.bigdata.utils;
|
||||
|
||||
import com.cm.bigdata.dao.kpi.IKpiHolidayDao;
|
||||
import com.cm.bigdata.dao2.kpi.IUserGridDao;
|
||||
import com.cm.bigdata.pojo.pos.kpi.*;
|
||||
import com.cm.bigdata.service.kpi.*;
|
||||
@ -9,6 +10,8 @@ import com.cm.common.utils.point.PointUtil;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.joda.time.DateTime;
|
||||
import org.joda.time.Hours;
|
||||
import org.joda.time.LocalDate;
|
||||
import org.joda.time.LocalDateTime;
|
||||
import org.joda.time.format.DateTimeFormat;
|
||||
|
||||
import java.util.*;
|
||||
@ -20,20 +23,37 @@ public class KpiUtil {
|
||||
public static String ZF_DEPARTMENT_ID = "1d74dfc8-f3a3-4517-87fe-7acf7891bab4";
|
||||
public static String GA_DEPARTMENT_ID = "2da5c4db-209b-4c28-bf35-153535fdfc78";
|
||||
|
||||
public static boolean isdateTimeIn24Hours(String date1, DateTime date2) {
|
||||
public static boolean isdateTimeIn24Hours(String date1, LocalDateTime date2) {
|
||||
date1 = date1.split("\\.")[0];
|
||||
DateTime date1DateTime = DateTime.parse(date1, DateTimeFormat.forPattern(ISystemConstant.DATE_FORMATTER_YYYY_MM_DD_HH_MM_SS));
|
||||
LocalDateTime date1DateTime = LocalDateTime.parse(date1, DateTimeFormat.forPattern(ISystemConstant.DATE_FORMATTER_YYYY_MM_DD_HH_MM_SS));
|
||||
return Hours.hoursBetween(date1DateTime, date2).getHours() < 24;
|
||||
}
|
||||
|
||||
public static boolean isdateTimeIn24Hours(String date1, String date2) {
|
||||
date1 = date1.split("\\.")[0];
|
||||
date2 = date2.split("\\.")[0];
|
||||
DateTime date1DateTime = DateTime.parse(date1, DateTimeFormat.forPattern(ISystemConstant.DATE_FORMATTER_YYYY_MM_DD_HH_MM_SS));
|
||||
DateTime date2DateTime = DateTime.parse(date2, DateTimeFormat.forPattern(ISystemConstant.DATE_FORMATTER_YYYY_MM_DD_HH_MM_SS));
|
||||
LocalDateTime date1DateTime = LocalDateTime.parse(date1, DateTimeFormat.forPattern(ISystemConstant.DATE_FORMATTER_YYYY_MM_DD_HH_MM_SS));
|
||||
LocalDateTime date2DateTime = LocalDateTime.parse(date2, DateTimeFormat.forPattern(ISystemConstant.DATE_FORMATTER_YYYY_MM_DD_HH_MM_SS));
|
||||
return Hours.hoursBetween(date1DateTime, date2DateTime).getHours() < 24;
|
||||
}
|
||||
|
||||
public static boolean isdateTimeIn24HoursNoHoliday(String date1, String date2, List<HolidayPO> holidayPOS) {
|
||||
date1 = date1.split("\\.")[0];
|
||||
date2 = date2.split("\\.")[0];
|
||||
LocalDateTime date1DateTime = LocalDateTime.parse(date1, DateTimeFormat.forPattern(ISystemConstant.DATE_FORMATTER_YYYY_MM_DD_HH_MM_SS));
|
||||
LocalDateTime date2DateTime = LocalDateTime.parse(date2, DateTimeFormat.forPattern(ISystemConstant.DATE_FORMATTER_YYYY_MM_DD_HH_MM_SS));
|
||||
LocalDateTime now = LocalDateTime.now();
|
||||
int holidayCount = 0;
|
||||
for (HolidayPO holidayPO : holidayPOS) {
|
||||
String holiday = String.format("%04d-%02d-%02d %02d:%02d:%02d", holidayPO.getHolidayYear(), holidayPO.getHolidayMonth(), holidayPO.getHolidayDay(), now.hourOfDay().get(), now.minuteOfHour().get(), now.secondOfMinute().get());
|
||||
LocalDateTime holidayDateTime = LocalDateTime.parse(holiday, DateTimeFormat.forPattern(ISystemConstant.DATE_FORMATTER_YYYY_MM_DD_HH_MM_SS));
|
||||
if (date1DateTime.isBefore(holidayDateTime) && date2DateTime.isAfter(holidayDateTime)) {
|
||||
holidayCount++;
|
||||
}
|
||||
}
|
||||
return Hours.hoursBetween(date1DateTime, date2DateTime).getHours() - holidayCount * 24 < 24;
|
||||
}
|
||||
|
||||
public static boolean isDateBetween(String date, String startDate, String endDate) {
|
||||
if (StringUtils.isBlank(date)) {
|
||||
return false;
|
||||
|
@ -33,4 +33,37 @@
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="count" parameterType="map" resultType="java.lang.Integer">
|
||||
SELECT
|
||||
COUNT(*)
|
||||
FROM
|
||||
kpi_holiday
|
||||
<where>
|
||||
<if test="holidayYears != null and holidayYears.size > 0">
|
||||
holiday_year IN
|
||||
<foreach collection="holidayYears" index="index" open="(" separator="," close=")">
|
||||
#{holidayYears[${index}]}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="holidayYear != null">
|
||||
AND
|
||||
holiday_year = #{holidayYear}
|
||||
</if>
|
||||
<if test="holidayMonth != null">
|
||||
AND
|
||||
holiday_month = #{holidayMonth}
|
||||
</if>
|
||||
<if test="startYear != null and startMonth != null">
|
||||
AND
|
||||
holiday_year <![CDATA[>=]]> #{startYear} AND holiday_month <![CDATA[>=]]> #{startMonth}
|
||||
</if>
|
||||
<if test="endYear != null and endMonth != null">
|
||||
AND
|
||||
holiday_year <![CDATA[<=]]> #{endYear} AND holiday_month <![CDATA[<=]]> #{endMonth}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
|
||||
|
||||
</mapper>
|
Loading…
Reference in New Issue
Block a user