Commit f504744097c262a14adfdc9a29464ef872493cb6
1 parent
cc8441d5
feat: 新增签到查询过滤
Showing
2 changed files
with
49 additions
and
10 deletions
ruoyi-admin/src/main/java/com/ruoyi/pojo/request/ReportViewRequestVo.java
| @@ -46,4 +46,7 @@ public class ReportViewRequestVo { | @@ -46,4 +46,7 @@ public class ReportViewRequestVo { | ||
| 46 | @ApiModelProperty("导出天还是月 0 无 1 天 2 月") | 46 | @ApiModelProperty("导出天还是月 0 无 1 天 2 月") |
| 47 | Integer exportFlag; | 47 | Integer exportFlag; |
| 48 | 48 | ||
| 49 | + @ApiModelProperty("查询各个阶段超时的人员 0 全部 1 第一次打卡 2 第二卡打卡 3 第三次打卡 4 第四次打卡") | ||
| 50 | + Integer stage; | ||
| 51 | + | ||
| 49 | } | 52 | } |
ruoyi-admin/src/main/java/com/ruoyi/service/SchedulingService.java
| @@ -57,7 +57,7 @@ public class SchedulingService { | @@ -57,7 +57,7 @@ public class SchedulingService { | ||
| 57 | 57 | ||
| 58 | List<DriverScheduling> dto = null; | 58 | List<DriverScheduling> dto = null; |
| 59 | for (int i = 0; i > -2; i--) { | 59 | for (int i = 0; i > -2; i--) { |
| 60 | - dto = nowSchedulingCache.getCacheSchedulingMapValueByHKey(ConstDateUtil.formatDate(ConstDateUtil.getTheSpecifiedNumberOfDaysOfTime(i)),jobCode); | 60 | + dto = nowSchedulingCache.getCacheSchedulingMapValueByHKey(ConstDateUtil.formatDate(ConstDateUtil.getTheSpecifiedNumberOfDaysOfTime(i)), jobCode); |
| 61 | if (!CollectionUtil.isEmpty(dto)) { | 61 | if (!CollectionUtil.isEmpty(dto)) { |
| 62 | dto.sort(Comparator.comparing(DriverScheduling::getZdsjT)); | 62 | dto.sort(Comparator.comparing(DriverScheduling::getZdsjT)); |
| 63 | if (i == -1) { | 63 | if (i == -1) { |
| @@ -168,7 +168,6 @@ public class SchedulingService { | @@ -168,7 +168,6 @@ public class SchedulingService { | ||
| 168 | } | 168 | } |
| 169 | 169 | ||
| 170 | private List<ReportViewResponseVo> getMonthReportTableResponseVo(ReportViewRequestVo requestVo, HttpServletResponse response) { | 170 | private List<ReportViewResponseVo> getMonthReportTableResponseVo(ReportViewRequestVo requestVo, HttpServletResponse response) { |
| 171 | - // TODO | ||
| 172 | // 获取当月到目前为止的所有数据 | 171 | // 获取当月到目前为止的所有数据 |
| 173 | List<String> dayList = getAllDaysOfTheMonth(); | 172 | List<String> dayList = getAllDaysOfTheMonth(); |
| 174 | // for (String date : dayList) { | 173 | // for (String date : dayList) { |
| @@ -197,8 +196,25 @@ public class SchedulingService { | @@ -197,8 +196,25 @@ public class SchedulingService { | ||
| 197 | private List<ReportViewResponseVo> getDayReportTableResponseVo(ReportViewRequestVo vo, HttpServletResponse response) { | 196 | private List<ReportViewResponseVo> getDayReportTableResponseVo(ReportViewRequestVo vo, HttpServletResponse response) { |
| 198 | // 签到数据 | 197 | // 签到数据 |
| 199 | List<DriverScheduling> toDay = schedulingMapper.queryToDay(vo.getDate(), vo.getName(), vo.getJobCode(), vo.getLineName()); | 198 | List<DriverScheduling> toDay = schedulingMapper.queryToDay(vo.getDate(), vo.getName(), vo.getJobCode(), vo.getLineName()); |
| 199 | + toDay.sort(Comparator.comparing(DriverScheduling::getFcsjT)); | ||
| 200 | // 转换日期 + jobCode为key | 200 | // 转换日期 + jobCode为key |
| 201 | Map<String, List<DriverScheduling>> orangeMap = new HashMap<>(1200); | 201 | Map<String, List<DriverScheduling>> orangeMap = new HashMap<>(1200); |
| 202 | + transformMapByDriverScheduling(vo, toDay, orangeMap); | ||
| 203 | + Map<String, ReportViewResponseVo> resultMap = new HashMap<>(1200); | ||
| 204 | + for (String key : orangeMap.keySet()) { | ||
| 205 | + List<DriverScheduling> list = orangeMap.get(key); | ||
| 206 | + // 过滤 vo | ||
| 207 | + if (filterReportVoList(vo.getStage(), list)) { | ||
| 208 | + continue; | ||
| 209 | + } | ||
| 210 | + ReportViewResponseVo vo1 = new ReportViewResponseVo(); | ||
| 211 | + handlerScheduling(list, vo1); | ||
| 212 | + resultMap.put(key, vo1); | ||
| 213 | + } | ||
| 214 | + return new ArrayList<>(resultMap.values()); | ||
| 215 | + } | ||
| 216 | + | ||
| 217 | + private static void transformMapByDriverScheduling(ReportViewRequestVo vo, List<DriverScheduling> toDay, Map<String, List<DriverScheduling>> orangeMap) { | ||
| 202 | for (DriverScheduling scheduling : toDay) { | 218 | for (DriverScheduling scheduling : toDay) { |
| 203 | String key = vo.getDate() + scheduling.getJobCode(); | 219 | String key = vo.getDate() + scheduling.getJobCode(); |
| 204 | if (Objects.isNull(orangeMap.get(key))) { | 220 | if (Objects.isNull(orangeMap.get(key))) { |
| @@ -207,14 +223,34 @@ public class SchedulingService { | @@ -207,14 +223,34 @@ public class SchedulingService { | ||
| 207 | orangeMap.get(key).add(scheduling); | 223 | orangeMap.get(key).add(scheduling); |
| 208 | } | 224 | } |
| 209 | } | 225 | } |
| 210 | - Map<String, ReportViewResponseVo> resultMap = new HashMap<>(1200); | ||
| 211 | - for (String key : orangeMap.keySet()) { | ||
| 212 | - List<DriverScheduling> list = orangeMap.get(key); | ||
| 213 | - ReportViewResponseVo vo1 = new ReportViewResponseVo(); | ||
| 214 | - handlerScheduling(list, vo1); | ||
| 215 | - resultMap.put(key, vo1); | 226 | + } |
| 227 | + | ||
| 228 | + private boolean filterReportVoList(Integer stage, List<DriverScheduling> list) { | ||
| 229 | + if (!stage.equals(0)) { | ||
| 230 | + return handleReportScrollViewTable(stage, list); | ||
| 216 | } | 231 | } |
| 217 | - return new ArrayList<>(resultMap.values()); | 232 | + return false; |
| 233 | + } | ||
| 234 | + | ||
| 235 | + private boolean handleReportScrollViewTable(Integer stage, List<DriverScheduling> list) { | ||
| 236 | + if (list.size() < stage) { | ||
| 237 | + return true; | ||
| 238 | + } | ||
| 239 | + | ||
| 240 | + if (Objects.isNull(list.get(stage - 1).getSignTime())) { | ||
| 241 | + return false; | ||
| 242 | + } | ||
| 243 | + | ||
| 244 | + DriverScheduling scheduling = list.get(stage - 1); | ||
| 245 | + // 获取两个 Date 对象之间的时间差(以毫秒为单位) | ||
| 246 | + long timeDifferenceInMillis = scheduling.getSignTime().getTime() - (scheduling.getBcType().equals(BC_TYPE_OUT) ? scheduling.getFcsjT() : scheduling.getZdsjT()); | ||
| 247 | + // 相差十五分钟 | ||
| 248 | + if (timeDifferenceInMillis > 0 && timeDifferenceInMillis < (60 * 1000 * 15)) { | ||
| 249 | + return true; | ||
| 250 | + } else if (timeDifferenceInMillis < 0) { | ||
| 251 | + return true; | ||
| 252 | + } | ||
| 253 | + return false; | ||
| 218 | } | 254 | } |
| 219 | 255 | ||
| 220 | private static void handlerScheduling(List<DriverScheduling> list, ReportViewResponseVo vo) { | 256 | private static void handlerScheduling(List<DriverScheduling> list, ReportViewResponseVo vo) { |
| @@ -252,6 +288,6 @@ public class SchedulingService { | @@ -252,6 +288,6 @@ public class SchedulingService { | ||
| 252 | } | 288 | } |
| 253 | 289 | ||
| 254 | public List<DriverScheduling> queryToDay(String date) { | 290 | public List<DriverScheduling> queryToDay(String date) { |
| 255 | - return schedulingMapper.queryToDay(date,null,null,null); | 291 | + return schedulingMapper.queryToDay(date, null, null, null); |
| 256 | } | 292 | } |
| 257 | } | 293 | } |