Commit 5e0a6bbcd4acff7850aaf1d1f7267b1fe4c60a58

Authored by guzijian
1 parent f84a8a36

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

Bsth-admin/src/main/java/com/ruoyi/common/SignStatusEnum.java
1 package com.ruoyi.common; 1 package com.ruoyi.common;
2 2
  3 +import static com.ruoyi.common.ConstDriverProperties.BC_TYPE_OUT;
  4 +
3 /** 5 /**
4 - * 签到状态枚举 6 + * 签到状态枚举 大屏
  7 + *
5 * @author 20412 8 * @author 20412
6 */ 9 */
7 public enum SignStatusEnum { 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 this.status = status; 18 this.status = status;
16 this.description = description; 19 this.description = description;
17 } 20 }
  21 +
18 private String description; 22 private String description;
19 private Integer status; 23 private Integer status;
20 24
21 public Integer getStatus() { 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,7 +641,7 @@ public class SignInServiceImpl implements ISignInService {
641 LocalDateTime nowTime = ConstDateUtil.getLocalDateTimeByLongTime(now); 641 LocalDateTime nowTime = ConstDateUtil.getLocalDateTimeByLongTime(now);
642 long nowBetween = ChronoUnit.MINUTES.between(endTime, nowTime); 642 long nowBetween = ChronoUnit.MINUTES.between(endTime, nowTime);
643 globalIndex.setIndex(0); 643 globalIndex.setIndex(0);
644 - // 单数据 且不在范围内 644 + // 单数据 且不在范围内
645 if (BC_TYPE_IN.equals(dto.get(0).getBcType())) { 645 if (BC_TYPE_IN.equals(dto.get(0).getBcType())) {
646 if (!(Math.abs(nowBetween) <= 60)) { 646 if (!(Math.abs(nowBetween) <= 60)) {
647 signIn.setRemark(SIGN_OUT_TIMEOUT); 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,7 +4,6 @@ import cn.hutool.core.collection.CollectionUtil;
4 import com.ruoyi.common.global.Result; 4 import com.ruoyi.common.global.Result;
5 import com.ruoyi.common.global.ResultCode; 5 import com.ruoyi.common.global.ResultCode;
6 import com.ruoyi.common.utils.SecurityUtils; 6 import com.ruoyi.common.utils.SecurityUtils;
7 -import com.ruoyi.common.utils.StringUtils;  
8 import com.ruoyi.driver.mapper.DriverMapper; 7 import com.ruoyi.driver.mapper.DriverMapper;
9 import com.ruoyi.driver.mapper.DriverSchedulingMapper; 8 import com.ruoyi.driver.mapper.DriverSchedulingMapper;
10 import com.ruoyi.eexception.mapper.EquipmentExceptionMapper; 9 import com.ruoyi.eexception.mapper.EquipmentExceptionMapper;
@@ -17,6 +16,7 @@ import com.ruoyi.pojo.vo.PersonSignDataResponseVo; @@ -17,6 +16,7 @@ import com.ruoyi.pojo.vo.PersonSignDataResponseVo;
17 import com.ruoyi.system.domain.SysNotice; 16 import com.ruoyi.system.domain.SysNotice;
18 import com.ruoyi.system.service.ISysNoticeService; 17 import com.ruoyi.system.service.ISysNoticeService;
19 import com.ruoyi.utils.ConstDateUtil; 18 import com.ruoyi.utils.ConstDateUtil;
  19 +import com.ruoyi.utils.ToolUtils;
20 import org.springframework.beans.BeanUtils; 20 import org.springframework.beans.BeanUtils;
21 import org.springframework.beans.factory.annotation.Autowired; 21 import org.springframework.beans.factory.annotation.Autowired;
22 import org.springframework.stereotype.Service; 22 import org.springframework.stereotype.Service;
@@ -190,23 +190,26 @@ public class ReportService { @@ -190,23 +190,26 @@ public class ReportService {
190 } 190 }
191 191
192 private void handlerResultMap(@NotBlank String date, Map<String, List<DriverScheduling>> resultMap, List<DriverScheduling> schedulingList) { 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 if (Objects.isNull(resultMap.get(key))) { 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 } else { 199 } else {
198 - resultMap.get(key).add(item); 200 + resultMap.get(key).add(scheduling);
199 } 201 }
200 } 202 }
201 } 203 }
202 204
203 private void handlerResultMap(Map<String, List<DriverScheduling>> resultMap, List<DriverScheduling> schedulingList) { 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 if (Objects.isNull(resultMap.get(key))) { 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 } else { 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,6 +250,7 @@ public class ReportService {
247 List<ReportDetailResponseVo> responseVos = new ArrayList<>(); 250 List<ReportDetailResponseVo> responseVos = new ArrayList<>();
248 List<DriverScheduling> toDay = schedulingMapper.queryToDay(vo.getDate(), vo.getName(), vo.getJobCode(), vo.getLineName()); 251 List<DriverScheduling> toDay = schedulingMapper.queryToDay(vo.getDate(), vo.getName(), vo.getJobCode(), vo.getLineName());
249 for (DriverScheduling scheduling : toDay) { 252 for (DriverScheduling scheduling : toDay) {
  253 + ToolUtils.updateReport(scheduling);
250 ReportDetailResponseVo reportDetailResponseVo = new ReportDetailResponseVo(); 254 ReportDetailResponseVo reportDetailResponseVo = new ReportDetailResponseVo();
251 handlerReportDetail(reportDetailResponseVo, scheduling); 255 handlerReportDetail(reportDetailResponseVo, scheduling);
252 responseVos.add(reportDetailResponseVo); 256 responseVos.add(reportDetailResponseVo);
Bsth-admin/src/main/java/com/ruoyi/service/SchedulingService.java
@@ -3,7 +3,6 @@ package com.ruoyi.service; @@ -3,7 +3,6 @@ package com.ruoyi.service;
3 import cn.hutool.core.collection.CollectionUtil; 3 import cn.hutool.core.collection.CollectionUtil;
4 import com.ruoyi.common.cache.NowSchedulingCache; 4 import com.ruoyi.common.cache.NowSchedulingCache;
5 import com.ruoyi.common.utils.DateUtils; 5 import com.ruoyi.common.utils.DateUtils;
6 -import com.ruoyi.driver.domain.Driver;  
7 import com.ruoyi.driver.mapper.DriverSchedulingMapper; 6 import com.ruoyi.driver.mapper.DriverSchedulingMapper;
8 import com.ruoyi.in.domain.SignIn; 7 import com.ruoyi.in.domain.SignIn;
9 import com.ruoyi.in.mapper.SignInMapper; 8 import com.ruoyi.in.mapper.SignInMapper;
@@ -13,6 +12,7 @@ import com.ruoyi.domain.DriverScheduling; @@ -13,6 +12,7 @@ import com.ruoyi.domain.DriverScheduling;
13 import com.ruoyi.pojo.request.ReportViewRequestVo; 12 import com.ruoyi.pojo.request.ReportViewRequestVo;
14 import com.ruoyi.pojo.response.ReportViewResponseVo; 13 import com.ruoyi.pojo.response.ReportViewResponseVo;
15 import com.ruoyi.utils.ConstDateUtil; 14 import com.ruoyi.utils.ConstDateUtil;
  15 +import com.ruoyi.utils.ToolUtils;
16 import org.springframework.beans.BeanUtils; 16 import org.springframework.beans.BeanUtils;
17 import org.springframework.beans.factory.annotation.Autowired; 17 import org.springframework.beans.factory.annotation.Autowired;
18 import org.springframework.stereotype.Service; 18 import org.springframework.stereotype.Service;
@@ -30,6 +30,7 @@ import static com.ruoyi.common.ConstDriverProperties.BC_TYPE_OUT; @@ -30,6 +30,7 @@ import static com.ruoyi.common.ConstDriverProperties.BC_TYPE_OUT;
30 import static com.ruoyi.common.ConstSignInConstSignInProperties.*; 30 import static com.ruoyi.common.ConstSignInConstSignInProperties.*;
31 import static com.ruoyi.common.ErrorTypeProperties.*; 31 import static com.ruoyi.common.ErrorTypeProperties.*;
32 import static com.ruoyi.common.ReportProperties.NOW; 32 import static com.ruoyi.common.ReportProperties.NOW;
  33 +import static com.ruoyi.common.SignStatusEnum.SIGN_STATUS_DELAY_ENUM;
33 34
34 /** 35 /**
35 * @author 20412 36 * @author 20412
@@ -148,7 +149,7 @@ public class SchedulingService { @@ -148,7 +149,7 @@ public class SchedulingService {
148 if (nowBetween < -60L) { 149 if (nowBetween < -60L) {
149 sb.append(EARLY); 150 sb.append(EARLY);
150 } else { 151 } else {
151 - sb.append(DELAY); 152 + sb.append(SIGN_STATUS_DELAY_ENUM.getDescription(scheduling.getBcType()));
152 } 153 }
153 // 在规定时间就还原remark 154 // 在规定时间就还原remark
154 } else { 155 } else {
@@ -276,6 +277,7 @@ public class SchedulingService { @@ -276,6 +277,7 @@ public class SchedulingService {
276 for (DriverScheduling scheduling : toDay) { 277 for (DriverScheduling scheduling : toDay) {
277 String key = vo.getDate() + scheduling.getJobCode(); 278 String key = vo.getDate() + scheduling.getJobCode();
278 if (Objects.isNull(orangeMap.get(key))) { 279 if (Objects.isNull(orangeMap.get(key))) {
  280 + ToolUtils.updateReport(scheduling);
279 orangeMap.put(key, new ArrayList<>(Arrays.asList(scheduling))); 281 orangeMap.put(key, new ArrayList<>(Arrays.asList(scheduling)));
280 } else { 282 } else {
281 orangeMap.get(key).add(scheduling); 283 orangeMap.get(key).add(scheduling);
Bsth-admin/src/main/java/com/ruoyi/utils/ToolUtils.java
1 package com.ruoyi.utils; 1 package com.ruoyi.utils;
2 2
3 import com.ruoyi.common.utils.uuid.UUID; 3 import com.ruoyi.common.utils.uuid.UUID;
  4 +import com.ruoyi.domain.DriverScheduling;
4 import com.ruoyi.domain.RuleAttendanceMain; 5 import com.ruoyi.domain.RuleAttendanceMain;
5 import com.ruoyi.pojo.dto.RuleSchedulingDto; 6 import com.ruoyi.pojo.dto.RuleSchedulingDto;
6 import com.ruoyi.scheduling.domain.RuleScheduling; 7 import com.ruoyi.scheduling.domain.RuleScheduling;
7 import org.springframework.beans.BeanUtils; 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 import static com.ruoyi.common.RuleSchedulingProperties.TOMORROW_NO; 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 public class ToolUtils { 20 public class ToolUtils {
12 21
@@ -29,4 +38,39 @@ public class ToolUtils { @@ -29,4 +38,39 @@ public class ToolUtils {
29 BeanUtils.copyProperties(dto, main); 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 }