Commit 5e0a6bbcd4acff7850aaf1d1f7267b1fe4c60a58

Authored by guzijian
1 parent f84a8a36

feat: 针对报表数据做修改。

Bsth-admin/src/main/java/com/ruoyi/common/SignStatusEnum.java
1 1 package com.ruoyi.common;
2 2  
  3 +import static com.ruoyi.common.ConstDriverProperties.BC_TYPE_OUT;
  4 +
3 5 /**
4   - * 签到状态枚举
  6 + * 签到状态枚举 大屏
  7 + *
5 8 * @author 20412
6 9 */
7 10 public enum SignStatusEnum {
8   - SIGN_STATUS_ZONE_ENUM(0,"今日签到正常"),
9   - SIGN_STATUS_EMPTY_ENUM(1,"今日打卡未签"),
10   - SIGN_STATUS_DELAY_ENUM(2,"今日签到迟到"),
11   - SIGN_STATUS_WINE_ENUM(3,"今日酒测异常");
  11 + SIGN_STATUS_ZONE_ENUM(0, "正常"),
  12 + SIGN_STATUS_EMPTY_ENUM(1, "未签"),
  13 + SIGN_STATUS_DELAY_ENUM(2, ""),
  14 + SIGN_STATUS_WINE_ENUM(3, "酒精测试超标");
12 15  
13 16  
14   - SignStatusEnum(Integer status,String description){
  17 + SignStatusEnum(Integer status, String description) {
15 18 this.status = status;
16 19 this.description = description;
17 20 }
  21 +
18 22 private String description;
19 23 private Integer status;
20 24  
21 25 public Integer getStatus() {
22   - return status;
  26 + return this.status;
  27 + }
  28 +
  29 + public String getDescription() {
  30 + return this.description;
  31 + }
  32 +
  33 + public String getDescription(String bcType) {
  34 + if (BC_TYPE_OUT.equals(bcType)) {
  35 + return "迟到";
  36 + } else {
  37 + return "晚签";
  38 + }
23 39 }
24 40 }
... ...
Bsth-admin/src/main/java/com/ruoyi/in/service/impl/SignInServiceImpl.java
... ... @@ -641,7 +641,7 @@ public class SignInServiceImpl implements ISignInService {
641 641 LocalDateTime nowTime = ConstDateUtil.getLocalDateTimeByLongTime(now);
642 642 long nowBetween = ChronoUnit.MINUTES.between(endTime, nowTime);
643 643 globalIndex.setIndex(0);
644   - // 单数据 且不在范围内
  644 + // 单数据 且不在范围内
645 645 if (BC_TYPE_IN.equals(dto.get(0).getBcType())) {
646 646 if (!(Math.abs(nowBetween) <= 60)) {
647 647 signIn.setRemark(SIGN_OUT_TIMEOUT);
... ...
Bsth-admin/src/main/java/com/ruoyi/service/ReportService.java
... ... @@ -4,7 +4,6 @@ import cn.hutool.core.collection.CollectionUtil;
4 4 import com.ruoyi.common.global.Result;
5 5 import com.ruoyi.common.global.ResultCode;
6 6 import com.ruoyi.common.utils.SecurityUtils;
7   -import com.ruoyi.common.utils.StringUtils;
8 7 import com.ruoyi.driver.mapper.DriverMapper;
9 8 import com.ruoyi.driver.mapper.DriverSchedulingMapper;
10 9 import com.ruoyi.eexception.mapper.EquipmentExceptionMapper;
... ... @@ -17,6 +16,7 @@ import com.ruoyi.pojo.vo.PersonSignDataResponseVo;
17 16 import com.ruoyi.system.domain.SysNotice;
18 17 import com.ruoyi.system.service.ISysNoticeService;
19 18 import com.ruoyi.utils.ConstDateUtil;
  19 +import com.ruoyi.utils.ToolUtils;
20 20 import org.springframework.beans.BeanUtils;
21 21 import org.springframework.beans.factory.annotation.Autowired;
22 22 import org.springframework.stereotype.Service;
... ... @@ -190,23 +190,26 @@ public class ReportService {
190 190 }
191 191  
192 192 private void handlerResultMap(@NotBlank String date, Map<String, List<DriverScheduling>> resultMap, List<DriverScheduling> schedulingList) {
193   - for (DriverScheduling item : schedulingList) {
194   - String key = date + item.getJobCode();
  193 + for (DriverScheduling scheduling : schedulingList) {
  194 + String key = date + scheduling.getJobCode();
  195 + // TODO 特殊处理
  196 + ToolUtils.updateReport(scheduling);
195 197 if (Objects.isNull(resultMap.get(key))) {
196   - resultMap.put(key, new ArrayList<>(Arrays.asList(item)));
  198 + resultMap.put(key, new ArrayList<>(Arrays.asList(scheduling)));
197 199 } else {
198   - resultMap.get(key).add(item);
  200 + resultMap.get(key).add(scheduling);
199 201 }
200 202 }
201 203 }
202 204  
203 205 private void handlerResultMap(Map<String, List<DriverScheduling>> resultMap, List<DriverScheduling> schedulingList) {
204   - for (DriverScheduling item : schedulingList) {
205   - String key = item.getScheduleDate() + item.getJobCode();
  206 + for (DriverScheduling scheduling : schedulingList) {
  207 + String key = scheduling.getScheduleDate() + scheduling.getJobCode();
  208 + ToolUtils.updateReport(scheduling);
206 209 if (Objects.isNull(resultMap.get(key))) {
207   - resultMap.put(key, new ArrayList<>(Arrays.asList(item)));
  210 + resultMap.put(key, new ArrayList<>(Arrays.asList(scheduling)));
208 211 } else {
209   - resultMap.get(key).add(item);
  212 + resultMap.get(key).add(scheduling);
210 213 }
211 214 }
212 215 }
... ... @@ -247,6 +250,7 @@ public class ReportService {
247 250 List<ReportDetailResponseVo> responseVos = new ArrayList<>();
248 251 List<DriverScheduling> toDay = schedulingMapper.queryToDay(vo.getDate(), vo.getName(), vo.getJobCode(), vo.getLineName());
249 252 for (DriverScheduling scheduling : toDay) {
  253 + ToolUtils.updateReport(scheduling);
250 254 ReportDetailResponseVo reportDetailResponseVo = new ReportDetailResponseVo();
251 255 handlerReportDetail(reportDetailResponseVo, scheduling);
252 256 responseVos.add(reportDetailResponseVo);
... ...
Bsth-admin/src/main/java/com/ruoyi/service/SchedulingService.java
... ... @@ -3,7 +3,6 @@ package com.ruoyi.service;
3 3 import cn.hutool.core.collection.CollectionUtil;
4 4 import com.ruoyi.common.cache.NowSchedulingCache;
5 5 import com.ruoyi.common.utils.DateUtils;
6   -import com.ruoyi.driver.domain.Driver;
7 6 import com.ruoyi.driver.mapper.DriverSchedulingMapper;
8 7 import com.ruoyi.in.domain.SignIn;
9 8 import com.ruoyi.in.mapper.SignInMapper;
... ... @@ -13,6 +12,7 @@ import com.ruoyi.domain.DriverScheduling;
13 12 import com.ruoyi.pojo.request.ReportViewRequestVo;
14 13 import com.ruoyi.pojo.response.ReportViewResponseVo;
15 14 import com.ruoyi.utils.ConstDateUtil;
  15 +import com.ruoyi.utils.ToolUtils;
16 16 import org.springframework.beans.BeanUtils;
17 17 import org.springframework.beans.factory.annotation.Autowired;
18 18 import org.springframework.stereotype.Service;
... ... @@ -30,6 +30,7 @@ import static com.ruoyi.common.ConstDriverProperties.BC_TYPE_OUT;
30 30 import static com.ruoyi.common.ConstSignInConstSignInProperties.*;
31 31 import static com.ruoyi.common.ErrorTypeProperties.*;
32 32 import static com.ruoyi.common.ReportProperties.NOW;
  33 +import static com.ruoyi.common.SignStatusEnum.SIGN_STATUS_DELAY_ENUM;
33 34  
34 35 /**
35 36 * @author 20412
... ... @@ -148,7 +149,7 @@ public class SchedulingService {
148 149 if (nowBetween < -60L) {
149 150 sb.append(EARLY);
150 151 } else {
151   - sb.append(DELAY);
  152 + sb.append(SIGN_STATUS_DELAY_ENUM.getDescription(scheduling.getBcType()));
152 153 }
153 154 // 在规定时间就还原remark
154 155 } else {
... ... @@ -276,6 +277,7 @@ public class SchedulingService {
276 277 for (DriverScheduling scheduling : toDay) {
277 278 String key = vo.getDate() + scheduling.getJobCode();
278 279 if (Objects.isNull(orangeMap.get(key))) {
  280 + ToolUtils.updateReport(scheduling);
279 281 orangeMap.put(key, new ArrayList<>(Arrays.asList(scheduling)));
280 282 } else {
281 283 orangeMap.get(key).add(scheduling);
... ...
Bsth-admin/src/main/java/com/ruoyi/utils/ToolUtils.java
1 1 package com.ruoyi.utils;
2 2  
3 3 import com.ruoyi.common.utils.uuid.UUID;
  4 +import com.ruoyi.domain.DriverScheduling;
4 5 import com.ruoyi.domain.RuleAttendanceMain;
5 6 import com.ruoyi.pojo.dto.RuleSchedulingDto;
6 7 import com.ruoyi.scheduling.domain.RuleScheduling;
7 8 import org.springframework.beans.BeanUtils;
8 9  
  10 +import java.util.Date;
  11 +import java.util.Objects;
  12 +
  13 +import static com.ruoyi.common.ConstDriverProperties.BC_TYPE_IN;
  14 +import static com.ruoyi.common.ConstDriverProperties.BC_TYPE_OUT;
  15 +import static com.ruoyi.common.ConstSignInConstSignInProperties.SIGN_TIME_OUT_EX_NUM;
9 16 import static com.ruoyi.common.RuleSchedulingProperties.TOMORROW_NO;
  17 +import static com.ruoyi.common.SignStatusEnum.SIGN_STATUS_DELAY_ENUM;
  18 +import static com.ruoyi.common.SignStatusEnum.SIGN_STATUS_ZONE_ENUM;
10 19  
11 20 public class ToolUtils {
12 21  
... ... @@ -29,4 +38,39 @@ public class ToolUtils {
29 38 BeanUtils.copyProperties(dto, main);
30 39 }
31 40 }
  41 +
  42 + /**
  43 + * 更新报表记录
  44 + * @param scheduling
  45 + */
  46 + public static void updateReport(DriverScheduling scheduling) {
  47 + // TODO UPDATE 这里是特殊处理 青浦后续修改了签到规则
  48 + // 原先正负一小时内 修改为计划签到前一小时内超过就迟到,业主很急就不修改签到规则改为直接修改报表数据
  49 + // 签到
  50 + if (BC_TYPE_OUT.equals(scheduling.getBcType()) && !Objects.isNull(scheduling.getSignTime()) && SIGN_STATUS_ZONE_ENUM.getStatus().equals(scheduling.getExType())) {
  51 + // 实际签到时间
  52 + Date date = scheduling.getSignTime();
  53 + // 计划签到时间
  54 + Long fcsjT = scheduling.getFcsjT();
  55 + if (date.getTime() > fcsjT) {
  56 + scheduling.setExType(SIGN_TIME_OUT_EX_NUM);
  57 + scheduling.setRemark(SIGN_STATUS_DELAY_ENUM.getDescription(scheduling.getBcType()));
  58 + }
  59 + }
  60 + // 签退客户说把时间约定在正负一小时以内
  61 + // 签退
  62 + if (BC_TYPE_IN.equals(scheduling.getBcType()) && !Objects.isNull(scheduling.getSignTime()) && SIGN_STATUS_ZONE_ENUM.getStatus().equals(scheduling.getExType())) {
  63 + // 实际签退时间
  64 + Date date = scheduling.getSignTime();
  65 + // 计划签退时间
  66 + Long zdsjT = scheduling.getZdsjT();
  67 + // 一小时内约束
  68 + if ( date.getTime() - zdsjT > 60 * 60 * 1000 ) {
  69 + scheduling.setExType(SIGN_TIME_OUT_EX_NUM);
  70 + scheduling.setRemark(SIGN_STATUS_DELAY_ENUM.getDescription(scheduling.getBcType()));
  71 + }
  72 + }
  73 + }
  74 +
  75 +
32 76 }
... ...