Commit 87a988014d8deb1878d80afb4c3956fc03e9abbe

Authored by guzijian
1 parent f1152152

fix: 新增显示字段

Showing 20 changed files with 205 additions and 67 deletions
ruoyi-admin/src/main/java/com/ruoyi/common/ConstSignInConstSignInProperties.java
... ... @@ -13,6 +13,9 @@ public interface ConstSignInConstSignInProperties {
13 13 String SIGN_NO_SCHEDULING_EX_NUM_STRING = "无排班异常";
14 14 Integer SIGN_ALCOHOL_EX_NUM = 3;
15 15 String SIGN_ALCOHOL_EX_NUM_STRING = "酒精超标异常";
  16 +
  17 + String HAVE_EX = "有异常";
  18 + String NO_EX = "无异常";
16 19 /**
17 20 * 未完成人脸注册
18 21 */
... ...
ruoyi-admin/src/main/java/com/ruoyi/common/ReportProperties.java
1 1 package com.ruoyi.common;
2 2  
3 3 public interface ReportProperties {
  4 + Integer NOW = 0;
4 5 Integer DAY = 1;
5 6 Integer MONTH = 2;
6 7 }
... ...
ruoyi-admin/src/main/java/com/ruoyi/common/cache/SchedulingCache.java
... ... @@ -47,12 +47,10 @@ public class SchedulingCache {
47 47 String url = getUrl(formatNowDate);
48 48 log.info("初始化排班数据:{}", formatNowDate);
49 49 saveSchedulingToCache(url, formatNowDate);
50   - log.info("开始获取{}的排班数据", formatNowDate);
51 50 String formatYesterdayDate = ConstDateUtil.formatDate(ConstDateUtil.getTheSpecifiedNumberOfDaysOfTime(-1));
52   - url = getUrl(formatYesterdayDate);
53 51 log.info("初始化排班数据:{}", formatYesterdayDate);
  52 + url = getUrl(formatYesterdayDate);
54 53 saveSchedulingToCache(url, formatYesterdayDate);
55   - log.info("开始获取{}的排班数据", formatYesterdayDate);
56 54 }
57 55  
58 56 private String getUrl(String formatNowDate) {
... ... @@ -175,6 +173,14 @@ public class SchedulingCache {
175 173 cacheScheduling.remove(key);
176 174 }
177 175  
  176 + public List<String> getKeys(){
  177 + return new ArrayList<>(cacheScheduling.keySet());
  178 + }
  179 +
  180 + public Integer size(){
  181 + return cacheScheduling.size();
  182 + }
  183 +
178 184 public List<ResponseSchedulingDto> getCacheSchedulingMapValueByHKey(String key, String HKey) {
179 185 if (Objects.isNull(cacheScheduling.get(key))) {
180 186 return null;
... ...
ruoyi-admin/src/main/java/com/ruoyi/controller/ReportController.java
... ... @@ -10,6 +10,7 @@ import com.ruoyi.service.ReportService;
10 10 import io.swagger.annotations.Api;
11 11 import io.swagger.annotations.ApiOperation;
12 12 import io.swagger.annotations.ApiParam;
  13 +import org.springframework.validation.annotation.Validated;
13 14 import org.springframework.web.bind.annotation.*;
14 15  
15 16 import javax.annotation.Resource;
... ... @@ -36,6 +37,12 @@ public class ReportController {
36 37 return AjaxResult.success(reportService.getReportScrollViewTable(requestVo,response));
37 38 }
38 39  
  40 + @ApiOperation("获取详情")
  41 + @GetMapping("/detail")
  42 + public AjaxResult getDetail(HttpServletResponse response, @ApiParam @ModelAttribute @Validated ReportViewRequestVo requestVo) {
  43 + return AjaxResult.success(reportService.getReportDetail(requestVo,response));
  44 + }
  45 +
39 46  
40 47 @ApiOperation("异常报表集合查询")
41 48 @GetMapping("/error/list")
... ...
ruoyi-admin/src/main/java/com/ruoyi/driver/mapper/DriverSchedulingMapper.java
... ... @@ -17,7 +17,7 @@ public interface DriverSchedulingMapper {
17 17 void insertRoster(@Param("list") List<DriverScheduling> list);
18 18  
19 19  
20   - List<DriverScheduling> queryToDay(@Param("date") String date, @Param("jobCode") String jobCode);
  20 + List<DriverScheduling> queryToDay(@Param("date") String date, @Param("name") String name,@Param("jobCode") String jobCode,@Param("lineName")String lineName );
21 21  
22 22 void updateRoster(@Param("scheduling") DriverScheduling scheduling, @Param("signInId") Long id, @Param("exType") Integer exType);
23 23  
... ...
ruoyi-admin/src/main/java/com/ruoyi/driver/service/impl/DriverServiceImpl.java
... ... @@ -324,18 +324,18 @@ public class DriverServiceImpl implements IDriverService {
324 324 if (BC_TYPE_OUT.equals(item.getBcType()) && !CollectionUtil.isEmpty(drivers)) {
325 325 // 售票员无需酒精测试
326 326 if (item.getPosts().equals(PERSONNEL_POSTS_DRIVER))
327   - vo = new DriverResponseVo(item.getTimestamps(), drivers.get(0), SIGN_IN_STRING, alcoholFlag, schedulingFlag);
  327 + vo = new DriverResponseVo(item.getTimestamps(), drivers.get(0), SIGN_IN_STRING, alcoholFlag, schedulingFlag,item.getNbbm(),item.getLpName());
328 328 else
329   - vo = new DriverResponseVo(item.getTimestamps(), drivers.get(0), SIGN_IN_STRING, !alcoholFlag, schedulingFlag);
  329 + vo = new DriverResponseVo(item.getTimestamps(), drivers.get(0), SIGN_IN_STRING, !alcoholFlag, schedulingFlag,item.getNbbm(),item.getLpName());
330 330 } else if (BC_TYPE_IN.equals(item.getBcType()) && !CollectionUtil.isEmpty(drivers)) {
331   - vo = new DriverResponseVo(item.getTimestamps(), drivers.get(0), SIGN_IN_OUT_STRING, !alcoholFlag, !schedulingFlag);
  331 + vo = new DriverResponseVo(item.getTimestamps(), drivers.get(0), SIGN_IN_OUT_STRING, !alcoholFlag, !schedulingFlag,item.getNbbm(),item.getLpName());
332 332 }
333 333 }
334 334 // 更新信息
335 335 for (Driver item : drivers) {
336 336 // 无排班
337 337 if (Objects.isNull(vo)) {
338   - vos.add(new DriverResponseVo(null, item, null, null, false));
  338 + vos.add(new DriverResponseVo(null, item, null, null, false,null,null));
339 339 } else {
340 340 vos.add(vo);
341 341 }
... ...
ruoyi-admin/src/main/java/com/ruoyi/in/service/impl/SignInServiceImpl.java
... ... @@ -114,7 +114,7 @@ public class SignInServiceImpl implements ISignInService {
114 114 if (Objects.isNull(driver)) return AjaxResult.error("这个工号的员工不存在!");
115 115 // 查询地址
116 116 Equipment equipment = equipmentMapper.selectEquipmentByDeviceId(signIn.getDeviceId());
117   - SignInResponseVo vo = getSignInResponseVo(signIn, equipment);
  117 + SignInResponseVo vo = getSignInResponseVo(driver, signIn, equipment);
118 118 signIn.setCreateTime(new Date());
119 119 signIn.setRemark("");
120 120 // 签到检查 酒精检查 超时检查 排班检查
... ... @@ -188,7 +188,7 @@ public class SignInServiceImpl implements ISignInService {
188 188 if (Objects.isNull(driver)) return AjaxResult.warn("这个工号的员工不存在!");
189 189 // 查询地址
190 190 Equipment equipment = equipmentMapper.selectEquipmentByDeviceId(signIn.getDeviceId());
191   - SignInResponseVo vo = getSignInResponseVo(signIn, equipment);
  191 + SignInResponseVo vo = getSignInResponseVo(driver,signIn, equipment);
192 192 signIn.setCreateTime(new Date());
193 193 signIn.setRemark("");
194 194 GlobalIndex globalIndex = new GlobalIndex();
... ... @@ -224,7 +224,7 @@ public class SignInServiceImpl implements ISignInService {
224 224 return SIGN_IN_SUCCESS.equals(signIn.getStatus()) ? AjaxResult.success(SIGN_IN_SUCCESS_STRING, vo) : AjaxResult.success(SIGN_IN_ERROR + ":" + signIn.getRemark(), vo);
225 225 }
226 226  
227   - private SignInResponseVo getSignInResponseVo(SignIn signIn, Equipment equipment) {
  227 + private SignInResponseVo getSignInResponseVo(Driver driver, SignIn signIn, Equipment equipment) {
228 228 SignInResponseVo vo = new SignInResponseVo(signIn);
229 229 if (Objects.isNull(equipment)) {
230 230 equipment = new Equipment();
... ... @@ -232,6 +232,8 @@ public class SignInServiceImpl implements ISignInService {
232 232 vo.setAddress(equipment.getAddress());
233 233 vo.setDeviceId(signIn.getDeviceId());
234 234 vo.setSiteName(equipment.getSiteName());
  235 + vo.setName(driver.getPersonnelName());
  236 + vo.setPosts(driver.getPosts());
235 237 return vo;
236 238 }
237 239  
... ... @@ -287,7 +289,6 @@ public class SignInServiceImpl implements ISignInService {
287 289 case "售票员":
288 290 String key = ConstDateUtil.formatDate(now);
289 291 // 查询工号对应的排班 司售人员
290   - dto = schedulingService.queryScheduling(signIn.getJobCode(), now);
291 292 log.debug("签到key:{},排班数据:{}", key, dto);
292 293 if (CollectionUtil.isEmpty(dto)) {
293 294 signIn.setRemark(signIn.getRemark() + WORK_DAY_ERROR);
... ... @@ -364,8 +365,8 @@ public class SignInServiceImpl implements ISignInService {
364 365 globalIndex.setIndex(currentScheduling.getIndex());
365 366 result = false;
366 367 }
367   - // 当前最近无记录|签到,type:签到 -> 签到超时给上
368   - else if (currentScheduling.getBcType().equals(BC_TYPE_OUT)) {
  368 + // 当前最近无记录|签到,type:签到|签退 -> 签到超时给上
  369 + else {
369 370 signIn.setRemark(SIGN_IN_TIMEOUT);
370 371 globalIndex.setIndex(currentScheduling.getIndex());
371 372 result = false;
... ... @@ -374,14 +375,14 @@ public class SignInServiceImpl implements ISignInService {
374 375 // 签退一个逻辑 当前无记录
375 376 if (currentScheduling.getBcType().equals(BC_TYPE_IN) && Objects.isNull(currentScheduling.getSignInId())) {
376 377 DriverSignRecommendation lastClosestTimestamp = schedulingService.computedTheCurrentClosestTimestamp(dto, now, -1);
377   - // 上一次无记|签退,type:签到 当前时间小于最近签退时间 -> 签到超时
  378 + // 上一次无记|签退,type:签到 当前时间小于最近签退时间 -> 签到异常
378 379 if (nowBetween < -60L && Objects.isNull(lastClosestTimestamp.getSignInId()) && signIn.getType().equals(SIGN_OUT)) {
379 380 signIn.setRemark(SIGN_IN_TIMEOUT);
380 381 globalIndex.setIndex(lastClosestTimestamp.getIndex());
381 382 result = false;
382 383 }
383   - // 当前无记|签退 , type:签退 ——> 超时签退
384   - else if (signIn.getType().equals(SIGN_OUT)) {
  384 + // 当前无记|签退 , type:签退|签到 ——> 签退异常
  385 + else {
385 386 signIn.setRemark(SIGN_OUT_TIMEOUT);
386 387 globalIndex.setIndex(currentScheduling.getIndex());
387 388 result = false;
... ...
ruoyi-admin/src/main/java/com/ruoyi/job/DriverJob.java
... ... @@ -213,10 +213,23 @@ public class DriverJob implements InitializingBean {
213 213 }
214 214 // 获取排班信息并存入redis
215 215 saveSchedulingToRedis(getSchedulingInfoUrl, formatDate);
216   -
  216 + // 删除两天前排班信息
  217 + deleteScheduling();
217 218 log.info("获取{}的排班数据完毕", formatDate);
218 219 }
219 220  
  221 + private void deleteScheduling() {
  222 + String nowKey = DRIVER_SCHEDULING_PRE + ConstDateUtil.formatDate(new Date());
  223 + String yesterdayKey = DRIVER_SCHEDULING_PRE + ConstDateUtil.formatDate(ConstDateUtil.getTheSpecifiedNumberOfDaysOfTime(-1));
  224 + List<String> keys = SCHEDULING_CACHE.getKeys();
  225 + for (int i = 0; i < keys.size(); i++) {
  226 + if (nowKey.equals(keys.get(i)) || yesterdayKey.equals(keys.get(i))){
  227 + continue;
  228 + }
  229 + SCHEDULING_CACHE.removeCacheSchedulingByKey(keys.get(i));
  230 + }
  231 + }
  232 +
220 233 /**
221 234 * 计算是否全部设备完成了对应的用户人脸注册
222 235 */
... ...
ruoyi-admin/src/main/java/com/ruoyi/pojo/DriverSignRecommendation.java
... ... @@ -19,6 +19,9 @@ public class DriverSignRecommendation {
19 19 private Long timestamps;
20 20 private Long signInId;
21 21 private Integer exType;
  22 + private String nbbm;
  23 + private String lpName;
  24 + private String lineName;
22 25  
23 26 public DriverSignRecommendation() {
24 27 }
... ... @@ -30,5 +33,8 @@ public class DriverSignRecommendation {
30 33 this.setSignInId(dto.getSignInId());
31 34 this.setPosts(dto.getPosts());
32 35 this.setExType(dto.getExType());
  36 + this.setLineName(dto.getLineName());
  37 + this.setNbbm(dto.getNbbm());
  38 + this.setLpName(dto.getLpName());
33 39 }
34 40 }
... ...
ruoyi-admin/src/main/java/com/ruoyi/pojo/GlobalIndex.java
... ... @@ -8,5 +8,5 @@ import lombok.Data;
8 8 @Data
9 9 public class GlobalIndex {
10 10 private Integer index;
11   - public GlobalIndex(){this.index = -1;}
  11 + public GlobalIndex(){this.index = 0;}
12 12 }
... ...
ruoyi-admin/src/main/java/com/ruoyi/pojo/request/ReportViewRequestVo.java
... ... @@ -4,7 +4,7 @@ import io.swagger.annotations.ApiModel;
4 4 import io.swagger.annotations.ApiModelProperty;
5 5 import lombok.Data;
6 6  
7   -import java.util.List;
  7 +import javax.validation.constraints.NotBlank;
8 8  
9 9 /**
10 10 * 接收前端查询vo
... ... @@ -15,18 +15,24 @@ import java.util.List;
15 15 @Data
16 16 public class ReportViewRequestVo {
17 17  
18   - private List<String> ids;
19 18 /**
20 19 * 员工工号
21 20 */
22 21 @ApiModelProperty("员工工号")
  22 + @NotBlank
23 23 private String jobCode;
24 24 /**
25 25 * 日期
26 26 */
27 27 @ApiModelProperty("日期")
  28 + @NotBlank
28 29 private String date;
29 30 /**
  31 + * 日期
  32 + */
  33 + @ApiModelProperty("日期")
  34 + private String lineName;
  35 + /**
30 36 * 签到状态
31 37 */
32 38 @ApiModelProperty("签到状态")
... ... @@ -37,7 +43,7 @@ public class ReportViewRequestVo {
37 43 @ApiModelProperty("姓名")
38 44 String name;
39 45  
40   - @ApiModelProperty("导出天还是月 1 天 2 月")
  46 + @ApiModelProperty("导出天还是月 0 无 1 天 2 月")
41 47 Integer exportFlag;
42 48  
43 49 }
... ...
ruoyi-admin/src/main/java/com/ruoyi/pojo/response/DriverResponseVo.java
... ... @@ -20,10 +20,16 @@ public class DriverResponseVo extends Driver {
20 20 private String planAction;
21 21 @ApiModelProperty("是否有排班(true:有,false:没有)")
22 22 private Boolean schedulingFlag;
23   - @ApiModelProperty("打卡时间")
  23 + @ApiModelProperty("计划打卡时间")
24 24 private Long signTime;
  25 + @ApiModelProperty("车辆自编号")
  26 + private String nbbm;
  27 + @ApiModelProperty("路牌")
  28 + private String lpName;
25 29  
26   - public DriverResponseVo(Long signTime, Driver driver,String planAction,Boolean checkAlcohol,Boolean schedulingFlag){
  30 + public DriverResponseVo(Long signTime, Driver driver,String planAction,Boolean checkAlcohol,Boolean schedulingFlag,String nbbm,String lpName){
  31 + this.setNbbm(nbbm);
  32 + this.setLpName(lpName);
27 33 this.setSignTime(signTime);
28 34 this.setSchedulingFlag(schedulingFlag);
29 35 this.setCheckAlcohol(checkAlcohol);
... ... @@ -55,8 +61,6 @@ public class DriverResponseVo extends Driver {
55 61 this.setUpdateBy(driver.getUpdateBy());
56 62 this.setUpdateTime(driver.getUpdateTime());
57 63 this.setRemark(driver.getRemark());
58   -
59   -
60 64 }
61 65 public DriverResponseVo(){}
62 66 }
... ...
ruoyi-admin/src/main/java/com/ruoyi/pojo/response/DriverSignInRecordResponseVo.java 0 → 100644
  1 +package com.ruoyi.pojo.response;
  2 +
  3 +import lombok.Data;
  4 +
  5 +import java.util.Date;
  6 +
  7 +@Data
  8 +public class DriverSignInRecordResponseVo {
  9 + private String jobCode;
  10 + private String name;
  11 + private String posts;
  12 + private Date scheduleDate;
  13 + private String lineName;
  14 + private String lpName;
  15 + private String nbbm;
  16 + private String bcType;
  17 + private Date signInTime;
  18 + private Integer type;
  19 + private String remark;
  20 + private Long signInId;
  21 + private Integer exType;
  22 +}
... ...
ruoyi-admin/src/main/java/com/ruoyi/pojo/response/ExportReportViewResponseVo.java
1 1 package com.ruoyi.pojo.response;
2 2  
  3 +import com.alibaba.excel.annotation.ExcelProperty;
3 4 import io.swagger.annotations.ApiModel;
  5 +import io.swagger.annotations.ApiModelProperty;
4 6 import lombok.Data;
5 7  
  8 +import java.util.Date;
  9 +
6 10 /**
7 11 * @author 20412
8 12 */
9 13 @Data
10 14 @ApiModel("报表对象表")
11 15 public class ExportReportViewResponseVo {
  16 + @ExcelProperty(value = "工号")
  17 + private String jobCode;
  18 + @ExcelProperty(value = "姓名")
  19 + private String name;
  20 + @ExcelProperty(value = "工种")
  21 + private String posts;
  22 +
  23 + @ExcelProperty(value = "线路")
  24 + private String lineName;
  25 +
  26 + @ApiModelProperty("车队名称")
  27 + @ExcelProperty(value = "车队名称")
  28 + private String fleetName;
  29 +
  30 + @ExcelProperty(value = "车辆自编号")
  31 + private String nbbm;
  32 +
  33 + @ExcelProperty(value = "计划签到时间")
  34 + private Date planSignInTime;
  35 + @ExcelProperty(value = "实际签到时间")
  36 + private Date actualSignInTime;
  37 + @ExcelProperty(value = "签到结果")
  38 + private String signInResultString;
  39 + @ExcelProperty(value = "计划签退时间")
  40 + private Date planSignOutTime;
  41 + @ExcelProperty(value = "实际签退时间")
  42 + private Date actualSignOutTime;
  43 + @ExcelProperty(value = "签退结果")
  44 + private String signOutResultString;
  45 +
  46 +
  47 + @ExcelProperty(value = "分班计划签到时间")
  48 + private Date secondPlanSignInTime;
  49 + @ExcelProperty(value = "分班实际签到时间")
  50 + private Date secondActualSignInTime;
  51 + @ExcelProperty(value = "分班签到结果")
  52 + private String secondSignInResultString;
  53 + @ExcelProperty(value = "分班计划签退时间")
  54 + private Date secondPlanSignOutTime;
  55 + @ExcelProperty(value = "分班实际签退时间")
  56 + private Date secondActualSignOutTime;
  57 + @ExcelProperty(value = "分班签退结果")
  58 + private String secondSignOutResultString;
  59 +
  60 + @ExcelProperty(value = "排班日期")
  61 + private Date schedulingDate;
  62 +
12 63 }
... ...
ruoyi-admin/src/main/java/com/ruoyi/pojo/response/ReportDetailResponseVo.java 0 → 100644
  1 +package com.ruoyi.pojo.response;
  2 +
  3 +import io.swagger.annotations.ApiModel;
  4 +import lombok.Data;
  5 +
  6 +@Data
  7 +@ApiModel("签到报表查看详情vo")
  8 +public class ReportDetailResponseVo {
  9 +}
... ...
ruoyi-admin/src/main/java/com/ruoyi/pojo/response/ReportViewResponseVo.java
1 1 package com.ruoyi.pojo.response;
2 2  
3   -import com.alibaba.excel.annotation.ExcelIgnore;
4 3 import com.alibaba.excel.annotation.ExcelProperty;
5   -import com.alibaba.excel.annotation.write.style.ColumnWidth;
6   -import com.alibaba.excel.annotation.write.style.ContentRowHeight;
7   -import com.alibaba.excel.converters.string.StringImageConverter;
8   -import com.fasterxml.jackson.annotation.JsonFormat;
9   -import com.ruoyi.pojo.converter.AlcoholFlagConverter;
10   -import com.ruoyi.pojo.converter.SignInConvert;
11 4 import com.ruoyi.pojo.converter.SignInStatusConverter;
12   -import com.ruoyi.pojo.converter.SignInTypeConverter;
13   -import com.ruoyi.pojo.converter.common.ImageConverter;
14 5 import io.swagger.annotations.ApiModel;
15 6 import io.swagger.annotations.ApiModelProperty;
16 7 import lombok.Data;
17 8 import org.springframework.format.annotation.DateTimeFormat;
18 9  
19   -import java.math.BigDecimal;
20   -import java.net.URL;
21 10 import java.util.Date;
22 11  
23 12 /**
... ... @@ -45,6 +34,9 @@ public class ReportViewResponseVo {
45 34 @ApiModelProperty("车辆自编号")
46 35 private String nbbm;
47 36  
  37 + @ApiModelProperty("车辆自编号")
  38 + private String lpName;
  39 +
48 40 private Integer planSignInCount;
49 41 private Integer actualSignInCount;
50 42 private Integer planSignOutCount;
... ... @@ -52,10 +44,11 @@ public class ReportViewResponseVo {
52 44  
53 45 @ExcelProperty(value = "签到状态", converter = SignInStatusConverter.class)
54 46 @ApiModelProperty("签到状态")
55   - private Integer status;
  47 + private String exString;
56 48  
57 49 @ApiModelProperty("排班日期")
58   - private Date schedulingDate;
  50 + @DateTimeFormat(pattern = "yyyy-MM-dd")
  51 + private Date scheduleDate;
59 52  
60 53 @ApiModelProperty("备注")
61 54 private String remark;
... ...
ruoyi-admin/src/main/java/com/ruoyi/service/ReportService.java
... ... @@ -2,10 +2,12 @@ package com.ruoyi.service;
2 2  
3 3 import com.ruoyi.driver.domain.Driver;
4 4 import com.ruoyi.driver.mapper.DriverMapper;
  5 +import com.ruoyi.driver.mapper.DriverSchedulingMapper;
5 6 import com.ruoyi.eexception.domain.EquipmentException;
6 7 import com.ruoyi.eexception.mapper.EquipmentExceptionMapper;
7 8 import com.ruoyi.in.domain.SignIn;
8 9 import com.ruoyi.in.mapper.SignInMapper;
  10 +import com.ruoyi.pojo.entity.DriverScheduling;
9 11 import com.ruoyi.pojo.request.ReportViewRequestVo;
10 12 import com.ruoyi.pojo.request.ReportErrorRequestVo;
11 13 import com.ruoyi.pojo.response.ReportErrorResponseVo;
... ... @@ -14,6 +16,7 @@ import com.ruoyi.pojo.response.ReportViewResponseVo;
14 16 import org.springframework.beans.factory.annotation.Autowired;
15 17 import org.springframework.stereotype.Service;
16 18  
  19 +import javax.annotation.Resource;
17 20 import javax.servlet.http.HttpServletResponse;
18 21 import java.text.SimpleDateFormat;
19 22 import java.util.*;
... ... @@ -37,9 +40,12 @@ public class ReportService {
37 40 @Autowired
38 41 private DriverMapper driverMapper;
39 42  
40   - @Autowired
  43 + @Resource
41 44 private SchedulingService schedulingService;
42 45  
  46 + @Autowired
  47 + private DriverSchedulingMapper schedulingMapper;
  48 +
43 49 /**
44 50 * 查询报表信息
45 51 */
... ... @@ -121,4 +127,9 @@ public class ReportService {
121 127  
122 128 return null;
123 129 }
  130 +
  131 + public List<DriverScheduling> getReportDetail(ReportViewRequestVo vo, HttpServletResponse response) {
  132 + List<DriverScheduling> toDay = schedulingMapper.queryToDay(vo.getDate(), vo.getName(), vo.getJobCode(), vo.getLineName());
  133 + return null;
  134 + }
124 135 }
... ...
ruoyi-admin/src/main/java/com/ruoyi/service/SchedulingService.java
1 1 package com.ruoyi.service;
2 2  
  3 +import cn.hutool.core.collection.CollectionUtil;
3 4 import com.ruoyi.driver.mapper.DriverSchedulingMapper;
4 5 import com.ruoyi.in.domain.SignIn;
5 6 import com.ruoyi.in.mapper.SignInMapper;
... ... @@ -25,8 +26,7 @@ import static com.ruoyi.common.ConstDriverProperties.BC_TYPE_OUT;
25 26 import static com.ruoyi.common.ConstSignInConstSignInProperties.*;
26 27 import static com.ruoyi.common.ErrorTypeProperties.SIGN_IN_TIMEOUT;
27 28 import static com.ruoyi.common.ErrorTypeProperties.SIGN_OUT_TIMEOUT;
28   -import static com.ruoyi.common.ReportProperties.DAY;
29   -import static com.ruoyi.common.ReportProperties.MONTH;
  29 +import static com.ruoyi.common.ReportProperties.NOW;
30 30  
31 31 /**
32 32 * @author 20412
... ... @@ -51,17 +51,15 @@ public class SchedulingService {
51 51 // TODO 查表变成缓存查询
52 52 List<DriverScheduling> dto = null;
53 53 for (int i = 0; i > -2; i--) {
54   - dto = schedulingMapper.queryToDay(ConstDateUtil.formatDate(ConstDateUtil.getTheSpecifiedNumberOfDaysOfTime(i)), jobCode);
55   - if (!Objects.isNull(dto)) {
  54 + dto = schedulingMapper.queryToDay(ConstDateUtil.formatDate(ConstDateUtil.getTheSpecifiedNumberOfDaysOfTime(i)), null, jobCode, null);
  55 + if (!CollectionUtil.isEmpty(dto)) {
56 56 dto.sort(Comparator.comparing(DriverScheduling::getZdsjT));
57 57 if (i == -1) {
58 58 LocalDateTime zdsjT = ConstDateUtil.getLocalDateTimeByLongTime(dto.get(dto.size() - 1).getZdsjT());
59 59 LocalDateTime nowTime = ConstDateUtil.getLocalDateTimeByLongTime(now);
60 60 long range = ChronoUnit.MINUTES.between(zdsjT, nowTime);
61   - // 判定存在排班
62   - if (range <= 120L) {
63   - return dto;
64   - } else {
  61 + // 判定存在排班 前天的最后一次打卡时间超过2小时,排班为null
  62 + if (range > 120L) {
65 63 dto = null;
66 64 }
67 65 }
... ... @@ -143,8 +141,8 @@ public class SchedulingService {
143 141  
144 142 public List<ReportViewResponseVo> queryReportTableResponseVo(ReportViewRequestVo requestVo, HttpServletResponse response) {
145 143 // 处理天
146   - if (requestVo.getExportFlag().equals(DAY)) {
147   - return getDayReportTableResponseVo(requestVo.getDate(), response);
  144 + if (requestVo.getExportFlag().equals(NOW)) {
  145 + return getDayReportTableResponseVo(requestVo, response);
148 146 }
149 147 // // 处理月
150 148 // else if (requestVo.getExportFlag().equals(MONTH)) {
... ... @@ -158,9 +156,9 @@ public class SchedulingService {
158 156 // TODO
159 157 // 获取当月到目前为止的所有数据
160 158 List<String> dayList = getAllDaysOfTheMonth();
161   - for (String date : dayList) {
162   - getDayReportTableResponseVo(date, response);
163   - }
  159 +// for (String date : dayList) {
  160 +// getDayReportTableResponseVo(date, response);
  161 +// }
164 162 return null;
165 163 }
166 164  
... ... @@ -181,13 +179,13 @@ public class SchedulingService {
181 179 }
182 180  
183 181  
184   - private List<ReportViewResponseVo> getDayReportTableResponseVo(String date, HttpServletResponse response) {
  182 + private List<ReportViewResponseVo> getDayReportTableResponseVo(ReportViewRequestVo vo, HttpServletResponse response) {
185 183 // 签到数据
186   - List<DriverScheduling> toDay = schedulingMapper.queryToDay(date, null);
  184 + List<DriverScheduling> toDay = schedulingMapper.queryToDay(vo.getDate(), vo.getName(), vo.getJobCode(), vo.getLineName());
187 185 // 转换日期 + jobCode为key
188 186 Map<String, List<DriverScheduling>> orangeMap = new HashMap<>(1200);
189 187 for (DriverScheduling scheduling : toDay) {
190   - String key = date + scheduling.getJobCode();
  188 + String key = vo.getDate() + scheduling.getJobCode();
191 189 if (Objects.isNull(orangeMap.get(key))) {
192 190 orangeMap.put(key, new ArrayList<>(Arrays.asList(scheduling)));
193 191 } else {
... ... @@ -197,9 +195,9 @@ public class SchedulingService {
197 195 Map<String, ReportViewResponseVo> resultMap = new HashMap<>(1200);
198 196 for (String key : orangeMap.keySet()) {
199 197 List<DriverScheduling> list = orangeMap.get(key);
200   - ReportViewResponseVo vo = new ReportViewResponseVo();
201   - handleScheduling(list, vo);
202   - resultMap.put(key, vo);
  198 + ReportViewResponseVo vo1 = new ReportViewResponseVo();
  199 + handleScheduling(list, vo1);
  200 + resultMap.put(key, vo1);
203 201 }
204 202 return new ArrayList<>(resultMap.values());
205 203 }
... ... @@ -209,7 +207,6 @@ public class SchedulingService {
209 207 int actualSignInCount = 0;
210 208 int planSignOutCount = 0;
211 209 int actualSignOutCount = 0;
212   - Boolean exFlag = false;
213 210 BeanUtils.copyProperties(list.get(0), vo);
214 211 for (DriverScheduling scheduling : list) {
215 212 // 获取计划签到|签退次数
... ... @@ -225,8 +222,11 @@ public class SchedulingService {
225 222 }
226 223 }
227 224 // 判断是否异常
228   -// if (scheduling.getSignInId())
229   - exFlag = true;
  225 + if (!SIGN_NO_EX_NUM.equals(scheduling.getExType())) {
  226 + vo.setExString(HAVE_EX);
  227 + } else {
  228 + vo.setExString(NO_EX);
  229 + }
230 230 }
231 231 vo.setPlanSignInCount(planSignInCount);
232 232 vo.setPlanSignOutCount(planSignOutCount);
... ...
ruoyi-admin/src/main/java/com/ruoyi/service/ThreadJobService.java
... ... @@ -253,7 +253,7 @@ public class ThreadJobService {
253 253 @Transactional(rollbackFor = {Exception.class})
254 254 public void asyncComputedScheduling(Map<String, List<ResponseSchedulingDto>> originSchedulingMap) {
255 255 //查询当天是否保存过考情表 如果存在则保存
256   - List<DriverScheduling> dto = schedulingMapper.queryToDay(ConstDateUtil.formatDate("yyyy-MM-dd"), null);
  256 + List<DriverScheduling> dto = schedulingMapper.queryToDay(ConstDateUtil.formatDate("yyyy-MM-dd"), null,null,null);
257 257 if (!CollectionUtil.isEmpty(dto) || originSchedulingMap.size() == 0) {
258 258 // log.info("今天已获取过考勤数据");
259 259 return;
... ...
ruoyi-admin/src/main/resources/mapper/driver_scheduling/DriverSchedulingMapper.xml
... ... @@ -43,19 +43,24 @@
43 43 job_code = values(job_code)
44 44 </insert>
45 45 <update id="updateRoster">
46   - update scheduling set sign_in_id = #{signInId}
  46 + update scheduling
  47 + set sign_in_id = #{signInId},
  48 + ex_type = #{exType}
47 49 where id = #{scheduling.id}
48 50 </update>
49 51  
50 52 <select id="queryToDay" resultType="com.ruoyi.pojo.entity.DriverScheduling" resultMap="Scheduling">
51 53 select * from
52   - scheduling
  54 + scheduling
53 55 where schedule_date = #{date}
54 56 <if test="jobCode !=null and jobCode != ''">
55 57 and job_code = #{jobCode}
56 58 </if>
57   - <if test="jobCode ==null or jobCode == ''">
58   - limit 1
  59 + <if test="name !=null and name != ''">
  60 + and `name` = #{name}
  61 + </if>
  62 + <if test="lineName !=null and lineName != ''">
  63 + and line_name = #{lineName}
59 64 </if>
60 65  
61 66 </select>
... ...