Commit 4894ff986b66e86479097107a330b388421aa260

Authored by guzijian
1 parent 9881ea9e

fix: 新增异常处理接口

Showing 46 changed files with 1688 additions and 75 deletions
ruoyi-admin/src/main/java/com/ruoyi/common/ConstEquipmentProperties.java
... ... @@ -20,9 +20,21 @@ public interface ConstEquipmentProperties {
20 20 /**
21 21 * 处理中
22 22 */
23   - Integer EQUIPMENT_PROCESS_FLOW_ACTIVE = 3;
  23 + Integer EQUIPMENT_PROCESS_FLOW_ACTIVE = 2;
24 24 /**
25 25 * 处理完成
26 26 */
27   - Integer EQUIPMENT_PROCESS_FLOW_COMPLETE = 3;
  27 + Integer EQUIPMENT_PROCESS_FLOW_COMPLETE = 1;
  28 + /**
  29 + * 设备脱机
  30 + */
  31 + String DEVICE_OFFLINE = "脱机";
  32 + /**
  33 + * 设备在线
  34 + */
  35 + String DEVICE_ONLINE = "在线";
  36 + /**
  37 + * 脱机判断5分钟
  38 + */
  39 + Long DEVICE_OFFLINE_TIME = 5L;
28 40 }
... ...
ruoyi-admin/src/main/java/com/ruoyi/common/ErrorTypeProperties.java
... ... @@ -9,4 +9,5 @@ public interface ErrorTypeProperties {
9 9 String ALCOHOL_SIGN_IN_ERROR = "酒精测试超标,";
10 10 String WORK_DAY_ERROR = "当天没有排班,";
11 11 String SIGN_IN_TIMEOUT = "签到超时,";
  12 +
12 13 }
... ...
ruoyi-admin/src/main/java/com/ruoyi/common/cache/SchedulingCache.java 0 → 100644
  1 +package com.ruoyi.common.cache;
  2 +
  3 +import com.ruoyi.job.DriverJob;
  4 +import com.ruoyi.pojo.response.ResponseScheduling;
  5 +import com.ruoyi.utils.ConstDateUtil;
  6 +import org.slf4j.Logger;
  7 +import org.slf4j.LoggerFactory;
  8 +import org.springframework.beans.factory.annotation.Value;
  9 +import org.springframework.core.ParameterizedTypeReference;
  10 +import org.springframework.http.HttpMethod;
  11 +import org.springframework.stereotype.Component;
  12 +import org.springframework.web.client.RestTemplate;
  13 +
  14 +import javax.annotation.Resource;
  15 +import java.security.MessageDigest;
  16 +import java.util.*;
  17 +import java.util.concurrent.ConcurrentHashMap;
  18 +import java.util.stream.Collectors;
  19 +
  20 +import static com.ruoyi.common.redispre.GlobalRedisPreName.DRIVER_SCHEDULING_PRE;
  21 +
  22 +/**
  23 + * 排班缓存
  24 + *
  25 + * @author 20412
  26 + */
  27 +@Component
  28 +public class SchedulingCache {
  29 +
  30 + Logger log = LoggerFactory.getLogger(SchedulingCache.class);
  31 +
  32 + // @Value("${api.url.getSchedulingInfoNew}")
  33 + private static final String getSchedulingInfoUrl = "http://101.95.136.206:9089/webservice/rest/schedule_real/sch_jk_db/%s/%s?timestamp=%d&nonce=%s&password=%s&sign=%s";
  34 + // @Value("${api.config.nonce}")
  35 + private static final String NONCE = "adfsad";
  36 + // @Value("${api.config.password}")
  37 + private static final String PASSWORD = "c4dd3d8cb9a82f6d6a625818618b28ca7bebb464";
  38 + @Resource
  39 + private SchedulingCache schedulingCache;
  40 + private static ConcurrentHashMap<String, Map<String, List<ResponseScheduling>>> cacheScheduling = new ConcurrentHashMap<>();
  41 +
  42 + public SchedulingCache() {
  43 + log.info("项目启动加载中-----");
  44 +// schedulingInit();
  45 + }
  46 +
  47 + private void schedulingInit() {
  48 + String formatNowDate = ConstDateUtil.formatDate(new Date());
  49 + String url = getUrl(formatNowDate);
  50 + log.info("初始化排班数据:{}", formatNowDate);
  51 + saveSchedulingToRedis(url, formatNowDate);
  52 + log.info("开始获取{}的排班数据", formatNowDate);
  53 + String formatYesterdayDate = ConstDateUtil.formatDate(ConstDateUtil.getTheSpecifiedNumberOfDaysOfTime(-1));
  54 + url = getUrl(formatYesterdayDate);
  55 + log.info("初始化排班数据:{}", formatYesterdayDate);
  56 + saveSchedulingToRedis(url, formatYesterdayDate);
  57 + log.info("开始获取{}的排班数据", formatYesterdayDate);
  58 + }
  59 +
  60 + private String getUrl(String formatNowDate) {
  61 + String url = null;
  62 + long timestamp = System.currentTimeMillis();
  63 +// String formatDate = ConstDateUtil.formatDate(ConstDateUtil.getTheSpecifiedNumberOfDaysOfTime(-1));
  64 + // 获取排班请求
  65 + try {
  66 + url = String.format(getSchedulingInfoUrl, "99", formatNowDate, timestamp, NONCE, PASSWORD, getSHA1(getStringStringMap(String.valueOf(timestamp))));
  67 + } catch (Exception e) {
  68 + throw new RuntimeException(e);
  69 + }
  70 + return url;
  71 + }
  72 +
  73 + /**
  74 + * 获取签名
  75 + *
  76 + * @param map
  77 + * @return
  78 + * @throws Exception
  79 + */
  80 + private String getSHA1(Map<String, String> map) throws Exception {
  81 + try {
  82 + String[] array = new String[map.size()];
  83 + map.values().toArray(array);
  84 + StringBuffer sb = new StringBuffer();
  85 + // 字符串排序
  86 + Arrays.sort(array);
  87 + for (int i = 0; i < array.length; i++) {
  88 + sb.append(array[i]);
  89 + }
  90 + String str = sb.toString();
  91 + // SHA1签名生成
  92 + MessageDigest md = MessageDigest.getInstance("SHA-1");
  93 + md.update(str.getBytes());
  94 + byte[] digest = md.digest();
  95 + StringBuffer hexstr = new StringBuffer();
  96 + String shaHex = "";
  97 + for (int i = 0; i < digest.length; i++) {
  98 + shaHex = Integer.toHexString(digest[i] & 0xFF);
  99 + if (shaHex.length() < 2) {
  100 + hexstr.append(0);
  101 + }
  102 + hexstr.append(shaHex);
  103 + }
  104 + return hexstr.toString();
  105 + } catch (Exception e) {
  106 + throw e;
  107 + }
  108 +
  109 +
  110 + }
  111 +
  112 +
  113 + private Map<String, List<ResponseScheduling>> saveSchedulingToRedis(String getSchedulingInfoUrl, String dateKey) {
  114 + log.info("开始拉取排班:{}", dateKey);
  115 + List<ResponseScheduling> originSchedulingList = new RestTemplate().exchange(
  116 + getSchedulingInfoUrl,
  117 + HttpMethod.GET,
  118 + null,
  119 + new ParameterizedTypeReference<List<ResponseScheduling>>() {
  120 + }).getBody();
  121 +
  122 + Map<String, List<ResponseScheduling>> driverSchedulingMap = new HashMap<>(200);
  123 + // 按照员工工号来获取排班信息
  124 + originSchedulingList = originSchedulingList.stream()
  125 + .map(subItem -> {
  126 + subItem.setJobCode(subItem.getJsy().split("/")[0]);
  127 + return subItem;
  128 + }).collect(Collectors.toList());
  129 + // 以员工号为key存入排班集合
  130 + originSchedulingList.stream().forEach(item -> {
  131 + // 员工号为key
  132 + String jobCode = item.getJsy().split("/")[0];
  133 + String salePersonJobCode = item.getSpy().split("/").length > 0 ? item.getSpy().split("/")[0] : null;
  134 + item.setJobCode(jobCode);
  135 + splitSaveScheduling(driverSchedulingMap, jobCode, item);
  136 + splitSaveScheduling(driverSchedulingMap, salePersonJobCode, item);
  137 + });
  138 + // 排序
  139 + List<String> keys = new ArrayList<>(driverSchedulingMap.keySet());
  140 + for (String key : keys) {
  141 + List<ResponseScheduling> schedulingList = driverSchedulingMap.get(key);
  142 + schedulingList.sort(Comparator.comparing(ResponseScheduling::getFcsjT));
  143 + }
  144 + // 存入数据库
  145 +// DRIVER_SERVICE.saveDriverScheduling(originSchedulingList);
  146 + // 存入redis
  147 + setCacheScheduling(DRIVER_SCHEDULING_PRE + dateKey, driverSchedulingMap);
  148 +// REDIS_CACHE.setCacheMap(DRIVER_SCHEDULING_PRE + dateKey, driverSchedulingMap, 2, TimeUnit.DAYS);
  149 + log.info("拉取排班完毕:{}", dateKey);
  150 + return driverSchedulingMap;
  151 + }
  152 +
  153 + private void splitSaveScheduling(Map<String, List<ResponseScheduling>> driverSchedulingMap, String jobCode, ResponseScheduling item) {
  154 + if (!Objects.isNull(jobCode))
  155 + if (Objects.isNull(driverSchedulingMap.get(jobCode))) {
  156 + List<ResponseScheduling> oneDriverScheduling = new ArrayList<>();
  157 + oneDriverScheduling.add(item);
  158 + driverSchedulingMap.put(jobCode, oneDriverScheduling);
  159 + } else {
  160 + driverSchedulingMap.get(jobCode).add(item);
  161 + }
  162 + }
  163 +
  164 + private Map<String, String> getStringStringMap(String timestamp) {
  165 + Map<String, String> configMap = new HashMap<>(5);
  166 + configMap.put("timestamp", String.valueOf(timestamp));
  167 + configMap.put("nonce", NONCE);
  168 + configMap.put("password", PASSWORD);
  169 + return configMap;
  170 + }
  171 +
  172 + public void setCacheScheduling(String key, Map<String, List<ResponseScheduling>> mapValue) {
  173 + cacheScheduling.put(key, mapValue);
  174 + }
  175 +
  176 + public void removeCacheSchedulingByKey(String key) {
  177 + cacheScheduling.remove(key);
  178 + }
  179 +
  180 + public List<ResponseScheduling> getCacheSchedulingMapValueByHKey(String key, String HKey) {
  181 + if (Objects.isNull(cacheScheduling.get(key))) {
  182 + return null;
  183 + }
  184 + List<ResponseScheduling> list = cacheScheduling.get(key).get(HKey);
  185 +
  186 + return Objects.isNull(list) ? null : list;
  187 + }
  188 +
  189 + public List<String> getHKeysByKey(String key) {
  190 + return new ArrayList<>(cacheScheduling.get(key).keySet());
  191 + }
  192 +
  193 +}
... ...
ruoyi-admin/src/main/java/com/ruoyi/controller/ApplicationUpdateController.java
1 1 package com.ruoyi.controller;
2 2  
3 3 import com.ruoyi.common.core.domain.AjaxResult;
  4 +import com.ruoyi.common.global.Result;
  5 +import com.ruoyi.pojo.request.HeartPackageVo;
4 6 import com.ruoyi.service.AppService;
5 7 import io.swagger.annotations.Api;
6 8 import io.swagger.annotations.ApiOperation;
  9 +import io.swagger.annotations.ApiParam;
  10 +import org.springframework.validation.annotation.Validated;
7 11 import org.springframework.web.bind.annotation.*;
8 12 import org.springframework.web.multipart.MultipartFile;
9 13  
... ... @@ -56,4 +60,11 @@ public class ApplicationUpdateController {
56 60 }
57 61 }
58 62  
  63 + @GetMapping("/checkDeviceHeart")
  64 + @ApiOperation("设备心跳检测")
  65 + public Result<?> checkAppHeart(@Validated @ApiParam @ModelAttribute HeartPackageVo vo){
  66 + appService.checkAppHeart(vo);
  67 + return Result.OK();
  68 + }
  69 +
59 70 }
... ...
ruoyi-admin/src/main/java/com/ruoyi/controller/ReportController.java
... ... @@ -36,7 +36,7 @@ public class ReportController {
36 36 return AjaxResult.success(reportService.handlerList(reportService.getReportScrollViewTable(requestVo)));
37 37 }
38 38  
39   - @ApiOperation("签到报表集合查询")
  39 + @ApiOperation("签到报表大屏集合查询")
40 40 @GetMapping("/bigView")
41 41 public AjaxResult bigView(@ApiParam @ModelAttribute ReportViewRequestVo requestVo) {
42 42 return AjaxResult.success(reportService.getReportScrollViewTable(requestVo));
... ...
ruoyi-admin/src/main/java/com/ruoyi/driver/controller/DriverController.java
... ... @@ -9,6 +9,7 @@ import com.ruoyi.common.global.ResultCode;
9 9 import com.ruoyi.pojo.request.DriverSignInRequestVo;
10 10 import com.ruoyi.pojo.request.FaceRegistrationFeedbackVo;
11 11 import com.ruoyi.pojo.request.FaceUpdateReqVo;
  12 +import com.ruoyi.pojo.response.DriverResponseVo;
12 13 import io.swagger.annotations.Api;
13 14 import io.swagger.annotations.ApiOperation;
14 15 import io.swagger.annotations.ApiParam;
... ... @@ -65,7 +66,7 @@ public class DriverController extends BaseController {
65 66 @ApiOperation(value = "查询驾驶员信息列表", notes = "查询驾驶员信息列表")
66 67 public TableDataInfo list(Driver driver) {
67 68 startPage();
68   - List<Driver> list = driverService.selectDriverList(driver);
  69 + List<DriverResponseVo> list = driverService.selectDriverList(driver);
69 70 return getDataTable(list);
70 71 }
71 72  
... ... @@ -89,8 +90,8 @@ public class DriverController extends BaseController {
89 90 @PostMapping("/export")
90 91 @ApiOperation("导出驾驶员信息列表")
91 92 public void export(HttpServletResponse response, Driver driver) {
92   - List<Driver> list = driverService.selectDriverList(driver);
93   - ExcelUtil<Driver> util = new ExcelUtil<Driver>(Driver.class);
  93 + List<DriverResponseVo> list = driverService.selectDriverList(driver);
  94 + ExcelUtil<DriverResponseVo> util = new ExcelUtil<>(DriverResponseVo.class);
94 95 util.exportExcel(response, list, "驾驶员信息数据");
95 96 }
96 97  
... ... @@ -221,4 +222,10 @@ public class DriverController extends BaseController {
221 222 return AjaxResult.success("清除成功");
222 223 }
223 224  
  225 + @GetMapping("/questionFeedback")
  226 + @ApiOperation("人脸识别反馈")
  227 + public Result<?> questionFeedback() {
  228 +
  229 + return null;
  230 + }
224 231 }
... ...
ruoyi-admin/src/main/java/com/ruoyi/driver/domain/Driver.java
... ... @@ -149,4 +149,5 @@ public class Driver extends BaseEntity {
149 149 @Excel( name ="车队名称")
150 150 private String fleetName;
151 151  
  152 +
152 153 }
... ...
ruoyi-admin/src/main/java/com/ruoyi/driver/service/IDriverService.java
... ... @@ -9,6 +9,7 @@ import com.ruoyi.common.global.Result;
9 9 import com.ruoyi.driver.domain.Driver;
10 10 import com.ruoyi.pojo.request.DriverSignInRequestVo;
11 11 import com.ruoyi.pojo.request.FaceUpdateReqVo;
  12 +import com.ruoyi.pojo.response.DriverResponseVo;
12 13 import com.ruoyi.pojo.response.ResponseScheduling;
13 14 import org.apache.ibatis.annotations.Param;
14 15 import org.springframework.web.multipart.MultipartFile;
... ... @@ -38,7 +39,7 @@ public interface IDriverService
38 39 * @param driver 驾驶员信息
39 40 * @return 驾驶员信息集合
40 41 */
41   - public List<Driver> selectDriverList(Driver driver);
  42 + public List<DriverResponseVo> selectDriverList(Driver driver);
42 43  
43 44 /**
44 45 * 新增驾驶员信息
... ...
ruoyi-admin/src/main/java/com/ruoyi/driver/service/impl/DriverServiceImpl.java
... ... @@ -8,6 +8,7 @@ import java.util.*;
8 8 import java.util.stream.Collectors;
9 9  
10 10 import cn.hutool.http.HttpUtil;
  11 +import com.ruoyi.common.cache.SchedulingCache;
11 12 import com.ruoyi.common.config.RuoYiConfig;
12 13 import com.ruoyi.common.core.domain.AjaxResult;
13 14 import com.ruoyi.common.core.redis.RedisCache;
... ... @@ -23,6 +24,7 @@ import com.ruoyi.job.DriverJob;
23 24 import com.ruoyi.pojo.domain.EquipmentDriverExpand;
24 25 import com.ruoyi.pojo.request.DriverSignInRequestVo;
25 26 import com.ruoyi.pojo.request.FaceUpdateReqVo;
  27 +import com.ruoyi.pojo.response.DriverResponseVo;
26 28 import com.ruoyi.pojo.response.ResponseScheduling;
27 29 import com.ruoyi.service.ThreadJobService;
28 30 import com.ruoyi.utils.ConstDateUtil;
... ... @@ -39,6 +41,7 @@ import com.ruoyi.driver.domain.Driver;
39 41 import com.ruoyi.driver.service.IDriverService;
40 42 import org.springframework.web.multipart.MultipartFile;
41 43  
  44 +import javax.annotation.Resource;
42 45 import javax.servlet.ServletOutputStream;
43 46 import javax.servlet.http.HttpServletRequest;
44 47 import javax.servlet.http.HttpServletResponse;
... ... @@ -60,6 +63,9 @@ public class DriverServiceImpl implements IDriverService {
60 63  
61 64 private Logger log = LoggerFactory.getLogger(DriverServiceImpl.class);
62 65  
  66 + @Resource
  67 + private SchedulingCache schedulingCache;
  68 +
63 69 @Autowired
64 70 private EquipmentMapper equipmentMapper;
65 71 @Value("${api.url.getSchedulingInfo}")
... ... @@ -103,15 +109,19 @@ public class DriverServiceImpl implements IDriverService {
103 109 * @return 驾驶员信息
104 110 */
105 111 @Override
106   - public List<Driver> selectDriverList(Driver driver) {
  112 + public List<DriverResponseVo> selectDriverList(Driver driver) {
107 113 List<Driver> drivers = driverMapper.selectDriverList(driver);
  114 + List<DriverResponseVo> vos = new ArrayList<>(drivers.size());
  115 + // 从缓存中获取排班记录
  116 +// List<ResponseScheduling> schedulingList = schedulingCache.getCacheSchedulingMapValueByHKey(ConstDateUtil.formatDate(new Date()), driver.getJobCode());
108 117 List<EquipmentDriverExpand> list = equipmentMapper.querySignListByJobCode(drivers);
109 118 for (Driver item : drivers) {
110 119 // 查询对应工号的注册设备号 然后用,拼接展示在前端
111 120 List<String> collect = list.stream().filter(todo -> item.getJobCode().equals(todo.getJobCode())).map(EquipmentDriverExpand::getDeviceId).collect(Collectors.toList());
112 121 item.setSignInEquipment(StringUtils.join(collect));
  122 + vos.add(new DriverResponseVo(item));
113 123 }
114   - return drivers;
  124 + return vos;
115 125 }
116 126  
117 127 /**
... ... @@ -167,7 +177,7 @@ public class DriverServiceImpl implements IDriverService {
167 177 @Override
168 178 public AjaxResult getDriverSchedulingInfo(String schedulingDate, String jobCode) {
169 179 String key = DRIVER_SCHEDULING_PRE + schedulingDate;
170   - List<ResponseScheduling> cacheMapValue = redisCache.getCacheMapValue(key, jobCode);
  180 + List<ResponseScheduling> cacheMapValue = schedulingCache.getCacheSchedulingMapValueByHKey(key, jobCode);
171 181 log.info("获取到排班数据:{}", cacheMapValue);
172 182 // 优先从缓存中读取
173 183 if (cacheMapValue != null && cacheMapValue.size() > 0) {
... ... @@ -175,13 +185,14 @@ public class DriverServiceImpl implements IDriverService {
175 185 }
176 186 // 获取昨天的排班数据
177 187 String yesterdayKey = DRIVER_SCHEDULING_PRE + ConstDateUtil.formatDate(ConstDateUtil.getTheSpecifiedNumberOfDaysOfTime(-1));
178   - cacheMapValue = redisCache.getCacheMapValue(yesterdayKey, jobCode);
  188 + cacheMapValue = schedulingCache.getCacheSchedulingMapValueByHKey(yesterdayKey, jobCode);
179 189 if (cacheMapValue != null && cacheMapValue.size() > 0) {
180   - String yesterdayDate = ConstDateUtil.formatDate(new Date(cacheMapValue.get(cacheMapValue.size() - 1).getZdsjT()));
181   - if (yesterdayDate.equals(schedulingDate)) {
  190 + String endSignTime = ConstDateUtil.formatDate(new Date(cacheMapValue.get(cacheMapValue.size() - 1).getZdsjT()));
  191 + if (endSignTime.equals(schedulingDate)) {
182 192 return AjaxResult.success(cacheMapValue);
183 193 }
184 194 }
  195 +
185 196 // 没有再次请求地址获取值
186 197 long timestamp = System.currentTimeMillis();
187 198 // 请求资源地址格式化
... ... @@ -203,7 +214,8 @@ public class DriverServiceImpl implements IDriverService {
203 214  
204 215 @Override
205 216 public AjaxResult getDriverSchedulingAll() {
206   - return AjaxResult.success(redisCache.getHashKeys(DRIVER_SCHEDULING_PRE + ConstDateUtil.formatDate("yyyyMMdd")));
  217 +// return AjaxResult.success(redisCache.getHashKeys(DRIVER_SCHEDULING_PRE + ConstDateUtil.formatDate("yyyyMMdd")));
  218 + return AjaxResult.success(schedulingCache.getHKeysByKey(DRIVER_SCHEDULING_PRE + ConstDateUtil.formatDate("yyyyMMdd")));
207 219 }
208 220  
209 221 @Override
... ... @@ -287,6 +299,7 @@ public class DriverServiceImpl implements IDriverService {
287 299  
288 300 @Override
289 301 public Result<?> updateFaceByJob(HttpServletRequest request, FaceUpdateReqVo vo) {
  302 + log.info("接收到人事数据:{}", vo);
290 303 // 获取校验
291 304 String header = request.getHeader("X-TOKEN-AUTHORIZATION");
292 305 if (!PERSONNEL_API_KEY.equals(header)) {
... ... @@ -327,7 +340,7 @@ public class DriverServiceImpl implements IDriverService {
327 340 try {
328 341 driver.setImage(getNewImageUrl(item.getJobCode(), item.getImageUrl()));
329 342 } catch (IOException e) {
330   - log.info(e.getMessage());
  343 + log.error(e.getMessage());
331 344 throw new RuntimeException(e);
332 345 }
333 346 driver.setPersonnelName(item.getName());
... ... @@ -345,7 +358,7 @@ public class DriverServiceImpl implements IDriverService {
345 358 try {
346 359 driver.setImage(getNewImageUrl(item.getJobCode(), item.getImageUrl()));
347 360 } catch (IOException e) {
348   - log.info(e.getMessage());
  361 + log.error(e.getMessage());
349 362 throw new RuntimeException(e);
350 363 }
351 364 driver.setPersonnelName(item.getName());
... ... @@ -357,6 +370,7 @@ public class DriverServiceImpl implements IDriverService {
357 370  
358 371 @Override
359 372 public void saveDriverSignInfo(DriverSignInRequestVo vo) {
  373 + log.info("开始进行人员数据更新");
360 374 Driver driver = new Driver();
361 375 driver.setJobCode(vo.getJobCode());
362 376 driver.setPersonnelName(vo.getName());
... ... @@ -371,12 +385,10 @@ public class DriverServiceImpl implements IDriverService {
371 385 }
372 386 driver.setImage(fileName);
373 387 driver.setUpdateTime(new Date());
374   - int result = driverMapper.insertDriver(driver);
375   - if (result == 0) {
376   - driverMapper.updateSignStatusDriversByJobCodes(new ArrayList<>(Arrays.asList(driver)));
377   - driverMapper.deleteDeviceIdAssociatedJobCode(new ArrayList<>(Arrays.asList(driver.getJobCode())));
378   - }
379   - log.info("开始上传签到图片");
  388 + driverMapper.updateSignStatusDriversByJobCodes(new ArrayList<>(Arrays.asList(driver)));
  389 + driverMapper.deleteDeviceIdAssociatedJobCode(new ArrayList<>(Arrays.asList(driver.getJobCode())));
  390 + log.info("进行人员数据更新完毕");
  391 + log.info("开始上传人脸图片");
380 392 // 异步上传文件
381 393 threadJobService.asyncStartUploadBase64Image(filePath, base64);
382 394 }
... ... @@ -409,12 +421,12 @@ public class DriverServiceImpl implements IDriverService {
409 421 } catch (IOException e) {
410 422 throw new RuntimeException(e);
411 423 }
412   - log.debug("图片开始上传");
  424 + log.info("图片开始上传");
413 425 // 获取图片数据
414 426 InputStream is = HttpUtil.createGet(url).execute().bodyStream();
415 427 // 上传图片
416 428 ThreadJobService.uploadImage(is, filePath);
417   - log.debug("图片上传完毕");
  429 + log.info("图片上传完毕");
418 430 return fileName;
419 431 }
420 432  
... ...
ruoyi-admin/src/main/java/com/ruoyi/eexception/controller/EquipmentExceptionController.java
... ... @@ -33,6 +33,7 @@ import com.ruoyi.common.core.page.TableDataInfo;
33 33 @RestController
34 34 @RequestMapping("/eexception/eexception")
35 35 @Api(tags = "设备异常接口")
  36 +@Deprecated
36 37 public class EquipmentExceptionController extends BaseController
37 38 {
38 39 @Autowired
... ...
ruoyi-admin/src/main/java/com/ruoyi/equipment/domain/Equipment.java
... ... @@ -9,6 +9,8 @@ import org.apache.commons.lang3.builder.ToStringStyle;
9 9 import com.ruoyi.common.annotation.Excel;
10 10 import com.ruoyi.common.core.domain.BaseEntity;
11 11  
  12 +import java.util.Date;
  13 +
12 14 /**
13 15 * 设备信息对象 equipment
14 16 *
... ... @@ -53,10 +55,14 @@ public class Equipment extends BaseEntity
53 55 @Excel(name = "设备图片")
54 56 @ApiModelProperty("设备图片")
55 57 private String image;
56   -
57 58 /** 设备号 */
58 59 @Excel(name = "设备号")
59 60 @ApiModelProperty("设备号")
60 61 private String deviceId;
  62 + /** 设备在线状态 */
  63 + @ApiModelProperty("设备在线状态")
  64 + private String onlineClient;
  65 + @ApiModelProperty("上次心跳响应时间")
  66 + private Date lastHeartRes;
61 67  
62 68 }
... ...
ruoyi-admin/src/main/java/com/ruoyi/equipment/mapper/EquipmentMapper.java
... ... @@ -4,6 +4,7 @@ import java.util.List;
4 4  
5 5 import com.ruoyi.driver.domain.Driver;
6 6 import com.ruoyi.equipment.domain.Equipment;
  7 +import com.ruoyi.global_exception.domain.GlobalException;
7 8 import com.ruoyi.pojo.domain.EquipmentDriverExpand;
8 9 import org.apache.ibatis.annotations.Param;
9 10  
... ... @@ -70,4 +71,9 @@ public interface EquipmentMapper
70 71 List<EquipmentDriverExpand> querySignListByJobCode(@Param("drivers") List<Driver> drivers);
71 72  
72 73 Equipment queryEquipmentByDeviceId(@Param("deviceId") String deviceId);
  74 +
  75 + void updateEquipments(@Param("list")List<Equipment> list);
  76 +
  77 + void updateEquipmentByDeviceId(Equipment equipment);
  78 +
73 79 }
... ...
ruoyi-admin/src/main/java/com/ruoyi/equipment/service/impl/EquipmentServiceImpl.java
... ... @@ -4,12 +4,15 @@ import java.util.List;
4 4 import com.ruoyi.common.utils.DateUtils;
5 5 import com.ruoyi.common.utils.SecurityUtils;
6 6 import com.ruoyi.common.utils.StringUtils;
  7 +import com.ruoyi.pojo.equipment.EquipmentOnline;
7 8 import org.springframework.beans.factory.annotation.Autowired;
8 9 import org.springframework.stereotype.Service;
9 10 import com.ruoyi.equipment.mapper.EquipmentMapper;
10 11 import com.ruoyi.equipment.domain.Equipment;
11 12 import com.ruoyi.equipment.service.IEquipmentService;
12 13  
  14 +import javax.annotation.Resource;
  15 +
13 16 /**
14 17 * 设备信息Service业务层处理
15 18 *
... ... @@ -22,6 +25,9 @@ public class EquipmentServiceImpl implements IEquipmentService
22 25 @Autowired
23 26 private EquipmentMapper equipmentMapper;
24 27  
  28 + @Resource
  29 + private EquipmentOnline client;
  30 +
25 31 /**
26 32 * 查询设备信息
27 33 *
... ... @@ -56,7 +62,7 @@ public class EquipmentServiceImpl implements IEquipmentService
56 62 public int insertEquipment(Equipment equipment)
57 63 {
58 64 equipment.setCreateTime(DateUtils.getNowDate());
59   -// equipment.setCreateBy(SecurityUtils.getUsername());
  65 + equipment.setCreateBy(SecurityUtils.getUsername());
60 66 if (!StringUtils.isNotEmpty(equipment.getDeviceId())){
61 67 throw new RuntimeException("设备号不能为空");
62 68 }
... ... @@ -73,7 +79,7 @@ public class EquipmentServiceImpl implements IEquipmentService
73 79 public int updateEquipment(Equipment equipment)
74 80 {
75 81 equipment.setUpdateTime(DateUtils.getNowDate());
76   - equipment.setUpdateBy(SecurityUtils.getUsername());
  82 + equipment.setUpdateBy(SecurityUtils.getUsername());
77 83 return equipmentMapper.updateEquipment(equipment);
78 84 }
79 85  
... ...
ruoyi-admin/src/main/java/com/ruoyi/global_exception/controller/GlobalExceptionController.java 0 → 100644
  1 +package com.ruoyi.global_exception.controller;
  2 +
  3 +import java.util.List;
  4 +import javax.servlet.http.HttpServletResponse;
  5 +
  6 +import com.ruoyi.common.global.Result;
  7 +import com.ruoyi.pojo.request.GlobalExceptionRequestVo;
  8 +import io.swagger.annotations.Api;
  9 +import io.swagger.annotations.ApiOperation;
  10 +import io.swagger.annotations.ApiParam;
  11 +import org.springframework.security.access.prepost.PreAuthorize;
  12 +import org.springframework.beans.factory.annotation.Autowired;
  13 +import org.springframework.validation.annotation.Validated;
  14 +import org.springframework.web.bind.annotation.GetMapping;
  15 +import org.springframework.web.bind.annotation.PostMapping;
  16 +import org.springframework.web.bind.annotation.PutMapping;
  17 +import org.springframework.web.bind.annotation.DeleteMapping;
  18 +import org.springframework.web.bind.annotation.PathVariable;
  19 +import org.springframework.web.bind.annotation.RequestBody;
  20 +import org.springframework.web.bind.annotation.RequestMapping;
  21 +import org.springframework.web.bind.annotation.RestController;
  22 +import com.ruoyi.common.annotation.Log;
  23 +import com.ruoyi.common.core.controller.BaseController;
  24 +import com.ruoyi.common.core.domain.AjaxResult;
  25 +import com.ruoyi.common.enums.BusinessType;
  26 +import com.ruoyi.global_exception.domain.GlobalException;
  27 +import com.ruoyi.global_exception.service.IGlobalExceptionService;
  28 +import com.ruoyi.common.utils.poi.ExcelUtil;
  29 +import com.ruoyi.common.core.page.TableDataInfo;
  30 +
  31 +/**
  32 + * global_exceptionController
  33 + *
  34 + * @author global_exception
  35 + * @date 2023-08-14
  36 + */
  37 +@RestController
  38 +@RequestMapping("/global_exception/global_exception")
  39 +@Api(tags = "异常管理")
  40 +public class GlobalExceptionController extends BaseController
  41 +{
  42 + @Autowired
  43 + private IGlobalExceptionService globalExceptionService;
  44 +
  45 + /**
  46 + * 查询global_exception列表
  47 + */
  48 + @PreAuthorize("@ss.hasPermi('global_exception:global_exception:list')")
  49 + @GetMapping("/list")
  50 + public TableDataInfo list(GlobalException globalException)
  51 + {
  52 + startPage();
  53 + List<GlobalException> list = globalExceptionService.selectGlobalExceptionList(globalException);
  54 + return getDataTable(list);
  55 + }
  56 +
  57 + /**
  58 + * 导出global_exception列表
  59 + */
  60 + @PreAuthorize("@ss.hasPermi('global_exception:global_exception:export')")
  61 + @Log(title = "global_exception", businessType = BusinessType.EXPORT)
  62 + @PostMapping("/export")
  63 + public void export(HttpServletResponse response, GlobalException globalException)
  64 + {
  65 + List<GlobalException> list = globalExceptionService.selectGlobalExceptionList(globalException);
  66 + ExcelUtil<GlobalException> util = new ExcelUtil<GlobalException>(GlobalException.class);
  67 + util.exportExcel(response, list, "global_exception数据");
  68 + }
  69 +
  70 + /**
  71 + * 获取global_exception详细信息
  72 + */
  73 + @PreAuthorize("@ss.hasPermi('global_exception:global_exception:query')")
  74 + @GetMapping(value = "/{id}")
  75 + public AjaxResult getInfo(@PathVariable("id") Long id)
  76 + {
  77 + return success(globalExceptionService.selectGlobalExceptionById(id));
  78 + }
  79 +
  80 + /**
  81 + * 新增global_exception
  82 + */
  83 + @PreAuthorize("@ss.hasPermi('global_exception:global_exception:add')")
  84 +// @Log(title = "global_exception", businessType = BusinessType.INSERT)
  85 + @ApiOperation("新增异常")
  86 + @PostMapping
  87 + public Result<?> add(@RequestBody @ApiParam @Validated GlobalExceptionRequestVo globalException)
  88 + {
  89 + return Result.OK(globalExceptionService.insertGlobalException(globalException));
  90 + }
  91 +
  92 + /**
  93 + * 修改global_exception
  94 + */
  95 + @PreAuthorize("@ss.hasPermi('global_exception:global_exception:edit')")
  96 +// @Log(title = "global_exception", businessType = BusinessType.UPDATE)
  97 + @PutMapping
  98 + public AjaxResult edit(@RequestBody GlobalException globalException)
  99 + {
  100 + return toAjax(globalExceptionService.updateGlobalException(globalException));
  101 + }
  102 +
  103 + /**
  104 + * 删除global_exception
  105 + */
  106 + @PreAuthorize("@ss.hasPermi('global_exception:global_exception:remove')")
  107 + @Log(title = "global_exception", businessType = BusinessType.DELETE)
  108 + @DeleteMapping("/{ids}")
  109 + public AjaxResult remove(@PathVariable Long[] ids)
  110 + {
  111 + return toAjax(globalExceptionService.deleteGlobalExceptionByIds(ids));
  112 + }
  113 +}
... ...
ruoyi-admin/src/main/java/com/ruoyi/global_exception/domain/GlobalException.java 0 → 100644
  1 +package com.ruoyi.global_exception.domain;
  2 +
  3 +import io.swagger.annotations.ApiModel;
  4 +import io.swagger.annotations.ApiModelProperty;
  5 +import lombok.Data;
  6 +import org.apache.commons.lang3.builder.ToStringBuilder;
  7 +import org.apache.commons.lang3.builder.ToStringStyle;
  8 +import com.ruoyi.common.annotation.Excel;
  9 +import com.ruoyi.common.core.domain.BaseEntity;
  10 +import org.springframework.format.annotation.DateTimeFormat;
  11 +
  12 +import javax.validation.constraints.NotBlank;
  13 +import javax.validation.constraints.NotEmpty;
  14 +import javax.validation.constraints.NotNull;
  15 +import java.io.Serializable;
  16 +import java.util.Date;
  17 +
  18 +/**
  19 + * global_exception对象 global_exception
  20 + *
  21 + * @author global_exception
  22 + * @date 2023-08-14
  23 + */
  24 +@ApiModel("异常对象")
  25 +@Data
  26 +public class GlobalException implements Serializable {
  27 + private static final long serialVersionUID = 1L;
  28 +
  29 + /**
  30 + * id
  31 + */
  32 + @ApiModelProperty("主键")
  33 + private Long id;
  34 +
  35 + /**
  36 + * 提交工号
  37 + */
  38 + @Excel(name = "提交工号")
  39 + @ApiModelProperty("提交工号")
  40 + @NotBlank
  41 + private String jobCode;
  42 +
  43 + /**
  44 + * 设备号
  45 + */
  46 + @Excel(name = "设备号")
  47 + @ApiModelProperty("设备号")
  48 + @NotBlank
  49 + private String deviceId;
  50 +
  51 + /**
  52 + * 问题类型
  53 + */
  54 + @Excel(name = "问题类型")
  55 + @ApiModelProperty("问题类型(1:识别异常,2:设备异常")
  56 + @NotNull
  57 + private Long type;
  58 +
  59 + /**
  60 + * 处理情况
  61 + */
  62 + @Excel(name = "处理情况")
  63 + @ApiModelProperty("处理情况 (3:未处理,2:处理中,1:已处理")
  64 + @NotNull
  65 + private Integer handle;
  66 +
  67 + @ApiModelProperty("创建时间")
  68 + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
  69 + private Date createTime;
  70 + @ApiModelProperty("修改时间")
  71 + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
  72 + private Date updateTime;
  73 + @Excel(name = "问题描述")
  74 + @ApiModelProperty("问题描述")
  75 + @NotBlank
  76 + private String remark;
  77 +
  78 +}
... ...
ruoyi-admin/src/main/java/com/ruoyi/global_exception/mapper/GlobalExceptionMapper.java 0 → 100644
  1 +package com.ruoyi.global_exception.mapper;
  2 +
  3 +import java.util.List;
  4 +import com.ruoyi.global_exception.domain.GlobalException;
  5 +import org.apache.ibatis.annotations.Param;
  6 +
  7 +/**
  8 + * global_exceptionMapper接口
  9 + *
  10 + * @author global_exception
  11 + * @date 2023-08-14
  12 + */
  13 +public interface GlobalExceptionMapper
  14 +{
  15 + /**
  16 + * 查询global_exception
  17 + *
  18 + * @param id global_exception主键
  19 + * @return global_exception
  20 + */
  21 + public GlobalException selectGlobalExceptionById(Long id);
  22 +
  23 + /**
  24 + * 查询global_exception列表
  25 + *
  26 + * @param globalException global_exception
  27 + * @return global_exception集合
  28 + */
  29 + public List<GlobalException> selectGlobalExceptionList(GlobalException globalException);
  30 +
  31 + /**
  32 + * 新增global_exception
  33 + *
  34 + * @param globalException global_exception
  35 + * @return 结果
  36 + */
  37 + public int insertGlobalException(GlobalException globalException);
  38 +
  39 + /**
  40 + * 修改global_exception
  41 + *
  42 + * @param globalException global_exception
  43 + * @return 结果
  44 + */
  45 + public int updateGlobalException(GlobalException globalException);
  46 +
  47 + /**
  48 + * 删除global_exception
  49 + *
  50 + * @param id global_exception主键
  51 + * @return 结果
  52 + */
  53 + public int deleteGlobalExceptionById(Long id);
  54 +
  55 + /**
  56 + * 批量删除global_exception
  57 + *
  58 + * @param ids 需要删除的数据主键集合
  59 + * @return 结果
  60 + */
  61 + public int deleteGlobalExceptionByIds(Long[] ids);
  62 +
  63 +}
... ...
ruoyi-admin/src/main/java/com/ruoyi/global_exception/service/IGlobalExceptionService.java 0 → 100644
  1 +package com.ruoyi.global_exception.service;
  2 +
  3 +import java.util.List;
  4 +import com.ruoyi.global_exception.domain.GlobalException;
  5 +import com.ruoyi.pojo.request.GlobalExceptionRequestVo;
  6 +
  7 +/**
  8 + * global_exceptionService接口
  9 + *
  10 + * @author global_exception
  11 + * @date 2023-08-14
  12 + */
  13 +public interface IGlobalExceptionService
  14 +{
  15 + /**
  16 + * 查询global_exception
  17 + *
  18 + * @param id global_exception主键
  19 + * @return global_exception
  20 + */
  21 + public GlobalException selectGlobalExceptionById(Long id);
  22 +
  23 + /**
  24 + * 查询global_exception列表
  25 + *
  26 + * @param globalException global_exception
  27 + * @return global_exception集合
  28 + */
  29 + public List<GlobalException> selectGlobalExceptionList(GlobalException globalException);
  30 +
  31 + /**
  32 + * 新增global_exception
  33 + *
  34 + * @param globalException global_exception
  35 + * @return 结果
  36 + */
  37 + public String insertGlobalException(GlobalExceptionRequestVo globalException);
  38 +
  39 + /**
  40 + * 修改global_exception
  41 + *
  42 + * @param globalException global_exception
  43 + * @return 结果
  44 + */
  45 + public int updateGlobalException(GlobalException globalException);
  46 +
  47 + /**
  48 + * 批量删除global_exception
  49 + *
  50 + * @param ids 需要删除的global_exception主键集合
  51 + * @return 结果
  52 + */
  53 + public int deleteGlobalExceptionByIds(Long[] ids);
  54 +
  55 + /**
  56 + * 删除global_exception信息
  57 + *
  58 + * @param id global_exception主键
  59 + * @return 结果
  60 + */
  61 + public int deleteGlobalExceptionById(Long id);
  62 +}
... ...
ruoyi-admin/src/main/java/com/ruoyi/global_exception/service/impl/GlobalExceptionServiceImpl.java 0 → 100644
  1 +package com.ruoyi.global_exception.service.impl;
  2 +
  3 +import java.util.Date;
  4 +import java.util.List;
  5 +import java.util.Objects;
  6 +
  7 +import com.ruoyi.common.utils.DateUtils;
  8 +import com.ruoyi.common.utils.SecurityUtils;
  9 +import com.ruoyi.driver.domain.Driver;
  10 +import com.ruoyi.driver.mapper.DriverMapper;
  11 +import com.ruoyi.equipment.domain.Equipment;
  12 +import com.ruoyi.equipment.mapper.EquipmentMapper;
  13 +import com.ruoyi.pojo.request.GlobalExceptionRequestVo;
  14 +import org.springframework.beans.BeanUtils;
  15 +import org.springframework.beans.factory.annotation.Autowired;
  16 +import org.springframework.stereotype.Service;
  17 +import com.ruoyi.global_exception.mapper.GlobalExceptionMapper;
  18 +import com.ruoyi.global_exception.domain.GlobalException;
  19 +import com.ruoyi.global_exception.service.IGlobalExceptionService;
  20 +
  21 +import static com.ruoyi.common.ConstEquipmentProperties.*;
  22 +
  23 +/**
  24 + * global_exceptionService业务层处理
  25 + *
  26 + * @author global_exception
  27 + * @date 2023-08-14
  28 + */
  29 +@Service
  30 +public class GlobalExceptionServiceImpl implements IGlobalExceptionService {
  31 + @Autowired
  32 + private GlobalExceptionMapper globalExceptionMapper;
  33 +
  34 + @Autowired
  35 + private DriverMapper driverMapper;
  36 +
  37 + @Autowired
  38 + private EquipmentMapper equipmentMapper;
  39 +
  40 + /**
  41 + * 查询global_exception
  42 + *
  43 + * @param id global_exception主键
  44 + * @return global_exception
  45 + */
  46 + @Override
  47 + public GlobalException selectGlobalExceptionById(Long id) {
  48 + return globalExceptionMapper.selectGlobalExceptionById(id);
  49 + }
  50 +
  51 + /**
  52 + * 查询global_exception列表
  53 + *
  54 + * @param globalException global_exception
  55 + * @return global_exception
  56 + */
  57 + @Override
  58 + public List<GlobalException> selectGlobalExceptionList(GlobalException globalException) {
  59 + return globalExceptionMapper.selectGlobalExceptionList(globalException);
  60 + }
  61 +
  62 + /**
  63 + * 新增global_exception
  64 + *
  65 + * @param globalException global_exception
  66 + * @return 结果
  67 + */
  68 + @Override
  69 + public String insertGlobalException(GlobalExceptionRequestVo globalException) {
  70 + if (Objects.isNull(driverMapper.getDriverInfoByJobCode(globalException.getJobCode()))) {
  71 + throw new RuntimeException("工号不存在");
  72 + }
  73 + Equipment equipment = new Equipment();
  74 + equipment.setDeviceId(globalException.getDeviceId());
  75 + if (Objects.isNull(equipmentMapper.selectEquipmentList(equipment))) {
  76 + throw new RuntimeException("设备号不存在");
  77 + }
  78 + if (EQUIPMENT_STATUS_ILLNESS.equals(globalException.getType())) {
  79 + equipment.setStatus(EQUIPMENT_STATUS_ILLNESS);
  80 + updateEquipment(equipment);
  81 + }
  82 + GlobalException exception = new GlobalException();
  83 + BeanUtils.copyProperties(globalException, exception);
  84 + exception.setCreateTime(DateUtils.getNowDate());
  85 + exception.setUpdateTime(DateUtils.getNowDate());
  86 + exception.setHandle(EQUIPMENT_PROCESS_FLOW_COMMIT);
  87 + if (globalExceptionMapper.insertGlobalException(exception) == 1) {
  88 + return "新增成功";
  89 + }
  90 + return "新增失败";
  91 + }
  92 +
  93 + private void updateEquipment(Equipment equipment) {
  94 + equipmentMapper.updateEquipment(equipment);
  95 + }
  96 +
  97 +
  98 + /**
  99 + * 修改global_exception
  100 + *
  101 + * @param globalException global_exception
  102 + * @return 结果
  103 + */
  104 + @Override
  105 + public int updateGlobalException(GlobalException globalException) {
  106 + globalException.setUpdateTime(DateUtils.getNowDate());
  107 + return globalExceptionMapper.updateGlobalException(globalException);
  108 + }
  109 +
  110 + /**
  111 + * 批量删除global_exception
  112 + *
  113 + * @param ids 需要删除的global_exception主键
  114 + * @return 结果
  115 + */
  116 + @Override
  117 + public int deleteGlobalExceptionByIds(Long[] ids) {
  118 + return globalExceptionMapper.deleteGlobalExceptionByIds(ids);
  119 + }
  120 +
  121 + /**
  122 + * 删除global_exception信息
  123 + *
  124 + * @param id global_exception主键
  125 + * @return 结果
  126 + */
  127 + @Override
  128 + public int deleteGlobalExceptionById(Long id) {
  129 + return globalExceptionMapper.deleteGlobalExceptionById(id);
  130 + }
  131 +}
... ...
ruoyi-admin/src/main/java/com/ruoyi/in/controller/SignInController.java
... ... @@ -49,7 +49,7 @@ public class SignInController extends BaseController {
49 49 // @PreAuthorize("@ss.hasPermi('in:in:list')")
50 50 @GetMapping("/list")
51 51 @ApiOperation("查询签到列表")
52   - public TableDataInfo list(SignIn signIn) {
  52 + public TableDataInfo list(SignInResponseVo signIn) {
53 53 startPage();
54 54 List<SignInResponseVo> list = signInService.selectSignInList(signIn);
55 55 return getDataTable(list);
... ... @@ -62,7 +62,7 @@ public class SignInController extends BaseController {
62 62 @Log(title = "签到", businessType = BusinessType.EXPORT)
63 63 @PostMapping("/export")
64 64 @ApiOperation("导出签到列表")
65   - public void export(HttpServletResponse response, SignIn signIn) {
  65 + public void export(HttpServletResponse response, SignInResponseVo signIn) {
66 66 List<SignInResponseVo> list = signInService.selectSignInList(signIn);
67 67 ExcelUtil<SignInResponseVo> util = new ExcelUtil<SignInResponseVo>(SignInResponseVo.class);
68 68 util.exportExcel(response, list, "签到数据");
... ...
ruoyi-admin/src/main/java/com/ruoyi/in/domain/SignIn.java
... ... @@ -49,6 +49,7 @@ public class SignIn extends BaseEntity {
49 49 @Excel(name = "设备地址")
50 50 @ApiModelProperty("设备ip 不用填写")
51 51 private String ip;
  52 +
52 53 /**
53 54 * 图片
54 55 */
... ... @@ -56,12 +57,14 @@ public class SignIn extends BaseEntity {
56 57 @ApiModelProperty("图片信息")
57 58 @NotBlank(message = "图片信息不能为空")
58 59 private String image;
  60 +
59 61 /**
60 62 * 签到结果
61 63 */
62 64 @Excel(name = "签到结果")
63 65 @ApiModelProperty("签到结果 1 成功 2 异常")
64 66 private Integer status;
  67 +
65 68 /**
66 69 * 签到类型
67 70 */
... ... @@ -69,6 +72,7 @@ public class SignIn extends BaseEntity {
69 72 @ApiModelProperty("签到类型 1 人脸 2 刷卡 3 其他 4 酒精 用可以多选 用,拼接 如 1,2,3,4")
70 73 @NotBlank(message = "签到类型不能为空")
71 74 private String singnIn;
  75 +
72 76 /**
73 77 * 酒精测试
74 78 */
... ... @@ -91,5 +95,14 @@ public class SignIn extends BaseEntity {
91 95 @Excel(name = "酒精摄入量")
92 96 @ApiModelProperty("酒精摄入量 52.12")
93 97 private BigDecimal alcoholIntake;
  98 + @Excel(name = "线路")
  99 + @ApiModelProperty("线路")
  100 + private String lineName;
  101 + @Excel(name = "车辆自编号")
  102 + @ApiModelProperty("车辆自编号")
  103 + private String carNum;
  104 + @Excel(name = "路牌")
  105 + @ApiModelProperty("路牌")
  106 + private String roadNum;
94 107 }
95 108  
... ...
ruoyi-admin/src/main/java/com/ruoyi/in/mapper/SignInMapper.java
... ... @@ -29,7 +29,7 @@ public interface SignInMapper
29 29 * @param signIn 签到
30 30 * @return 签到集合
31 31 */
32   - public List<SignInResponseVo> selectSignInList(SignIn signIn);
  32 + public List<SignInResponseVo> selectSignInList(SignInResponseVo signIn);
33 33  
34 34 /**
35 35 * 新增签到
... ...
ruoyi-admin/src/main/java/com/ruoyi/in/service/ISignInService.java
... ... @@ -32,7 +32,7 @@ public interface ISignInService
32 32 * @param signIn 签到
33 33 * @return 签到集合
34 34 */
35   - public List<SignInResponseVo> selectSignInList(SignIn signIn);
  35 + public List<SignInResponseVo> selectSignInList(SignInResponseVo signIn);
36 36  
37 37 /**
38 38 * 新增签到
... ...
ruoyi-admin/src/main/java/com/ruoyi/in/service/impl/SignInServiceImpl.java
... ... @@ -7,6 +7,7 @@ import java.time.LocalDateTime;
7 7 import java.time.temporal.ChronoUnit;
8 8 import java.util.*;
9 9  
  10 +import com.ruoyi.common.cache.SchedulingCache;
10 11 import com.ruoyi.common.config.RuoYiConfig;
11 12 import com.ruoyi.common.constant.Constants;
12 13 import com.ruoyi.common.core.domain.AjaxResult;
... ... @@ -36,6 +37,7 @@ import com.ruoyi.in.service.ISignInService;
36 37 import javax.annotation.Resource;
37 38  
38 39 import static com.ruoyi.common.ConstDriverProperties.PERSONNEL_POSTS_DRIVER;
  40 +import static com.ruoyi.common.ConstDriverProperties.PERSONNEL_POSTS_SALES;
39 41 import static com.ruoyi.common.ErrorTypeProperties.*;
40 42 import static com.ruoyi.common.ConstSignInConstSignInProperties.*;
41 43 import static com.ruoyi.common.redispre.GlobalRedisPreName.DRIVER_SCHEDULING_PRE;
... ... @@ -51,6 +53,9 @@ import static com.ruoyi.common.redispre.GlobalRedisPreName.REDIS_SIGN_IN_DRIVER_
51 53 public class SignInServiceImpl implements ISignInService {
52 54  
53 55 private Logger log = LoggerFactory.getLogger(SignInServiceImpl.class);
  56 +
  57 + @Resource
  58 + private SchedulingCache schedulingCache;
54 59 @Autowired
55 60 private SignInMapper signInMapper;
56 61  
... ... @@ -84,8 +89,9 @@ public class SignInServiceImpl implements ISignInService {
84 89 * @return 签到
85 90 */
86 91 @Override
87   - public List<SignInResponseVo> selectSignInList(SignIn signIn) {
88   - List<SignInResponseVo> vos = signInMapper.selectSignInList(signIn);
  92 + public List<SignInResponseVo> selectSignInList(SignInResponseVo signIn) {
  93 + SignInResponseVo vo = new SignInResponseVo(signIn);
  94 + List<SignInResponseVo> vos = signInMapper.selectSignInList(vo);
89 95 return vos;
90 96 }
91 97  
... ... @@ -126,7 +132,7 @@ public class SignInServiceImpl implements ISignInService {
126 132 }
127 133 }
128 134 if (SIGN_IN_FAIL.equals(signIn.getStatus())) {
129   - return AjaxResult.warn(SIGN_IN_ERROR + ": " + signIn.getRemark(), vo);
  135 + return AjaxResult.success(SIGN_IN_ERROR + ": " + signIn.getRemark(), vo);
130 136 }
131 137 return AjaxResult.success(SIGN_IN_SUCCESS_STRING, vo);
132 138 }
... ... @@ -181,6 +187,7 @@ public class SignInServiceImpl implements ISignInService {
181 187 signIn.setStatus(SIGN_IN_SUCCESS);
182 188 } else {
183 189 signIn.setStatus(SIGN_IN_FAIL);
  190 + signIn.setRemark(signIn.getRemark().replaceFirst(",$", "。"));
184 191 }
185 192 // base64转图片
186 193 signIn.setIp(IpUtils.getIpAddr());
... ... @@ -201,20 +208,22 @@ public class SignInServiceImpl implements ISignInService {
201 208 return result;
202 209 }
203 210 }
204   - return SIGN_IN_SUCCESS.equals(signIn.getStatus()) ? AjaxResult.success(SIGN_IN_SUCCESS_STRING, vo) : AjaxResult.warn(SIGN_IN_ERROR + signIn.getRemark(), vo);
  211 + return SIGN_IN_SUCCESS.equals(signIn.getStatus()) ? AjaxResult.success(SIGN_IN_SUCCESS_STRING, vo) : AjaxResult.success(SIGN_IN_ERROR + ":" + signIn.getRemark(), vo);
205 212 }
206 213  
207 214 private SignInResponseVo getSignInResponseVo(SignIn signIn, Equipment equipment) {
208   - SignInResponseVo vo = new SignInResponseVo();
  215 + SignInResponseVo vo = new SignInResponseVo(signIn);
209 216 if (Objects.isNull(equipment)) {
210 217 equipment = new Equipment();
211 218 }
212 219 vo.setAddress(equipment.getAddress());
213 220 vo.setDeviceId(signIn.getDeviceId());
  221 + vo.setSiteName(equipment.getSiteName());
214 222 return vo;
215 223 }
216 224  
217 225 private AjaxResult getAjaxResultByDriverSignInfo(SignIn signIn, SignInResponseVo vo) {
  226 + // TODO 待更换 缓存更新为当天签到记录
218 227 String key = REDIS_SIGN_IN_DRIVER_ALCOHOL_OVERFLOW + ConstDateUtil.formatDate("yyyyMMdd");
219 228 // 驾驶员酒精测试连续超标两次则提示换人
220 229 Integer count = redisCache.getCacheMapValue(key, signIn.getJobCode());
... ... @@ -225,7 +234,7 @@ public class SignInServiceImpl implements ISignInService {
225 234 count = redisCache.setIncrementMapValue(key, signIn.getJobCode(), 1);
226 235 }
227 236 if (SIGN_IN_ERROR_COUNT.compareTo(count) <= 0) {
228   - return AjaxResult.warn(SIGN_IN_ERROR + ": " + signIn.getRemark() + "酒精测试不通过" + count + "次请更换车辆驾驶员。", vo);
  237 + return AjaxResult.success(SIGN_IN_ERROR + ": " + signIn.getRemark() + "酒精测试不通过" + count + "次请更换车辆驾驶员。", vo);
229 238 }
230 239 return null;
231 240 }
... ... @@ -241,7 +250,7 @@ public class SignInServiceImpl implements ISignInService {
241 250 // 酒精测试校验 确定 且员工工种是驾驶员
242 251 if (ALCOHOL_FLAG_YES.equals(signIn.getAlcoholFlag()) && PERSONNEL_POSTS_DRIVER.equals(driver.getPosts())) {
243 252 if (new BigDecimal(20).compareTo(signIn.getAlcoholIntake()) <= 0) {
244   - signIn.setRemark(signIn.getRemark() + ALCOHOL_SIGN_IN_ERROR + signIn.getAlcoholIntake().toString() +"mg/100ml。");
  253 + signIn.setRemark(signIn.getRemark() + ALCOHOL_SIGN_IN_ERROR + signIn.getAlcoholIntake().toString() + "mg/100ml。");
245 254 result = false;
246 255 }
247 256 }
... ... @@ -261,32 +270,30 @@ public class SignInServiceImpl implements ISignInService {
261 270 List<ResponseScheduling> jobs = null;
262 271 switch (posts) {
263 272 case "驾驶员":
  273 + case "售票员":
264 274 String key = DRIVER_SCHEDULING_PRE + ConstDateUtil.formatDate("yyyyMMdd");
265 275 // 查询工号对应的排班 司售人员
266   - jobs = redisCache.getCacheMapValue(key, signIn.getJobCode());
267   - log.debug("签到key:{},排班数据:{}",key,jobs);
  276 + jobs = schedulingCache.getCacheSchedulingMapValueByHKey(key, signIn.getJobCode());
  277 + log.debug("签到key:{},排班数据:{}", key, jobs);
268 278 if (Objects.isNull(jobs) || jobs.size() == 0) {
269 279 // 当天的排班没有记录的话
270 280 key = DRIVER_SCHEDULING_PRE + ConstDateUtil.formatDate(ConstDateUtil.getTheSpecifiedNumberOfDaysOfTime(-1));
271   - jobs = redisCache.getCacheMapValue(key, signIn.getJobCode());
272   - if (Objects.isNull(jobs) || jobs.size() == 0){
  281 + jobs = schedulingCache.getCacheSchedulingMapValueByHKey(key, signIn.getJobCode());
  282 + if (Objects.isNull(jobs) || jobs.size() == 0) {
273 283 signIn.setRemark(signIn.getRemark() + WORK_DAY_ERROR);
274 284 result = false;
275   - }else {
  285 + } else {
276 286 ResponseScheduling responseScheduling = jobs.get(jobs.size() - 1);
277   - if (!ConstDateUtil.formatDate(new Date(responseScheduling.getZdsjT())).equals(ConstDateUtil.formatDate("yyyyMMdd"))){
  287 + if (!ConstDateUtil.formatDate(new Date(responseScheduling.getZdsjT())).equals(ConstDateUtil.formatDate("yyyyMMdd"))) {
278 288 signIn.setRemark(signIn.getRemark() + WORK_DAY_ERROR);
279   - result = false;
  289 + result = false;
280 290 }
281 291 }
  292 + } else {
  293 + // TODO 获取线路和车辆自编号和路牌
282 294  
283 295 }
284 296 break;
285   - case "1":
286   - // 查询工号对应的排班 非司售人员
287   - // 查询数据库
288   - result = true;
289   - break;
290 297 default:
291 298 break;
292 299 }
... ... @@ -301,7 +308,7 @@ public class SignInServiceImpl implements ISignInService {
301 308  
302 309 private boolean checkTimeOut(SignIn signIn, List<ResponseScheduling> driver, String posts) {
303 310 // 那发车时间和到站时间作为开始上班的时间
304   - if (PERSONNEL_POSTS_DRIVER.equals(posts)) {
  311 + if (PERSONNEL_POSTS_DRIVER.equals(posts) || PERSONNEL_POSTS_SALES.equals(posts)) {
305 312 return driverCheckTimeOut(signIn, driver);
306 313 } else {
307 314 return true;
... ...
ruoyi-admin/src/main/java/com/ruoyi/job/DriverJob.java
... ... @@ -3,9 +3,14 @@ package com.ruoyi.job;
3 3 import cn.hutool.http.HttpUtil;
4 4 import com.alibaba.fastjson2.JSON;
5 5 import com.alibaba.fastjson2.JSONArray;
  6 +import com.ruoyi.common.cache.SchedulingCache;
6 7 import com.ruoyi.common.core.redis.RedisCache;
  8 +import com.ruoyi.common.utils.StringUtils;
7 9 import com.ruoyi.driver.domain.Driver;
8 10 import com.ruoyi.driver.service.IDriverService;
  11 +import com.ruoyi.equipment.domain.Equipment;
  12 +import com.ruoyi.equipment.mapper.EquipmentMapper;
  13 +import com.ruoyi.pojo.equipment.EquipmentOnline;
9 14 import com.ruoyi.pojo.request.PersonnelRequestVo;
10 15 import com.ruoyi.pojo.request.TokenRequestVo;
11 16 import com.ruoyi.pojo.response.ResponseScheduling;
... ... @@ -13,7 +18,6 @@ import com.ruoyi.pojo.response.personnel.*;
13 18 import com.ruoyi.service.ThreadJobService;
14 19 import com.ruoyi.utils.ConstDateUtil;
15 20 import lombok.extern.slf4j.Slf4j;
16   -import org.apache.tomcat.util.bcel.Const;
17 21 import org.springframework.beans.factory.InitializingBean;
18 22 import org.springframework.beans.factory.annotation.Autowired;
19 23 import org.springframework.beans.factory.annotation.Value;
... ... @@ -27,10 +31,13 @@ import java.io.UnsupportedEncodingException;
27 31 import java.net.URLEncoder;
28 32 import java.nio.charset.StandardCharsets;
29 33 import java.security.MessageDigest;
  34 +import java.time.LocalDateTime;
  35 +import java.time.temporal.ChronoUnit;
30 36 import java.util.*;
31 37 import java.util.concurrent.TimeUnit;
32 38 import java.util.stream.Collectors;
33 39  
  40 +import static com.ruoyi.common.ConstEquipmentProperties.*;
34 41 import static com.ruoyi.common.redispre.GlobalRedisPreName.*;
35 42  
36 43 /**
... ... @@ -42,10 +49,17 @@ import static com.ruoyi.common.redispre.GlobalRedisPreName.*;
42 49 @Slf4j
43 50 public class DriverJob implements InitializingBean {
44 51  
  52 +
45 53 @Autowired
46 54 private RedisCache redisCache;
47 55  
48 56 @Resource
  57 + private SchedulingCache schedulingCache;
  58 +
  59 + @Resource
  60 + EquipmentMapper equipmentMapper;
  61 +
  62 + @Resource
49 63 private RestTemplate restTemplate;
50 64  
51 65 @Resource
... ... @@ -67,7 +81,7 @@ public class DriverJob implements InitializingBean {
67 81 @Value("${api.personnel.token.appSecret}")
68 82 private String appSecret;
69 83  
70   - @Value("${api.url.getSchedulingInfo}")
  84 + @Value("${api.url.getSchedulingInfoNew}")
71 85 private String getSchedulingInfoUrl;
72 86  
73 87 @Value("${api.config.password}")
... ... @@ -77,6 +91,8 @@ public class DriverJob implements InitializingBean {
77 91 private String nonce;
78 92  
79 93 private static ThreadJobService THREAD_JOB_SERVICE;
  94 + private static SchedulingCache SCHEDULING_CACHE;
  95 + private static EquipmentMapper EQUIPMENT_MAPPER;
80 96 private static String APP_KEY;
81 97 private static String TOKEN_URL;
82 98 private static String APP_SECRET;
... ... @@ -179,6 +195,7 @@ public class DriverJob implements InitializingBean {
179 195 * 24小时执行一次
180 196 */
181 197 public void getSchedulingInfo() {
  198 + // TODO 获取当天的签到表
182 199 long timestamp = System.currentTimeMillis();
183 200 String formatDate = ConstDateUtil.formatDate(timestamp);
184 201 // String formatDate = ConstDateUtil.formatDate(ConstDateUtil.getTheSpecifiedNumberOfDaysOfTime(-1));
... ... @@ -205,6 +222,29 @@ public class DriverJob implements InitializingBean {
205 222 DRIVER_SERVICE.updateDriverByComputed();
206 223 }
207 224  
  225 + /**
  226 + * 计算设备在线状态 5 分钟一次
  227 + */
  228 + public void computedDeviceOnlineStatus(String date) {
  229 + List<Equipment> list = EQUIPMENT_MAPPER.selectEquipmentList(null);
  230 + Long checkTime = StringUtils.isEmpty(date) ? DEVICE_OFFLINE_TIME : Long.parseLong(date);
  231 + for (Equipment equipment : list) {
  232 + if (Objects.isNull(equipment.getLastHeartRes())) {
  233 + equipment.setOnlineClient(DEVICE_OFFLINE);
  234 + } else {
  235 + LocalDateTime time = ConstDateUtil.getLocalDateTimeByLongTime(equipment.getLastHeartRes().getTime());
  236 + LocalDateTime nowTime = LocalDateTime.now();
  237 + long timeout = ChronoUnit.MINUTES.between(time, nowTime);
  238 + if (checkTime.compareTo(timeout) < 0) {
  239 + equipment.setOnlineClient(DEVICE_OFFLINE);
  240 + } else {
  241 + equipment.setOnlineClient(DEVICE_ONLINE);
  242 + }
  243 + }
  244 + }
  245 + EQUIPMENT_MAPPER.updateEquipments(list);
  246 + }
  247 +
208 248 public Map<String, List<ResponseScheduling>> saveSchedulingToRedis(String getSchedulingInfoUrl, String dateKey) {
209 249 log.info("开始拉取排班:{}", dateKey);
210 250 List<ResponseScheduling> originSchedulingList = RESTTEMPLATE.exchange(
... ... @@ -225,14 +265,10 @@ public class DriverJob implements InitializingBean {
225 265 originSchedulingList.stream().forEach(item -> {
226 266 // 员工号为key
227 267 String jobCode = item.getJsy().split("/")[0];
  268 + String salePersonJobCode = item.getSpy().split("/").length > 0 ? item.getSpy().split("/")[0] : null;
228 269 item.setJobCode(jobCode);
229   - if (Objects.isNull(driverSchedulingMap.get(jobCode))) {
230   - List<ResponseScheduling> oneDriverScheduling = new ArrayList<>();
231   - oneDriverScheduling.add(item);
232   - driverSchedulingMap.put(jobCode, oneDriverScheduling);
233   - } else {
234   - driverSchedulingMap.get(jobCode).add(item);
235   - }
  270 + splitSaveScheduling(driverSchedulingMap, jobCode, item);
  271 + splitSaveScheduling(driverSchedulingMap, salePersonJobCode, item);
236 272 });
237 273 // 排序
238 274 List<String> keys = new ArrayList<>(driverSchedulingMap.keySet());
... ... @@ -243,11 +279,23 @@ public class DriverJob implements InitializingBean {
243 279 // 存入数据库
244 280 // DRIVER_SERVICE.saveDriverScheduling(originSchedulingList);
245 281 // 存入redis
246   - REDIS_CACHE.setCacheMap(DRIVER_SCHEDULING_PRE + dateKey, driverSchedulingMap, 2, TimeUnit.DAYS);
  282 + SCHEDULING_CACHE.setCacheScheduling(DRIVER_SCHEDULING_PRE + dateKey, driverSchedulingMap);
  283 +// REDIS_CACHE.setCacheMap(DRIVER_SCHEDULING_PRE + dateKey, driverSchedulingMap, 2, TimeUnit.DAYS);
247 284 log.info("拉取排班完毕:{}", dateKey);
248 285 return driverSchedulingMap;
249 286 }
250 287  
  288 + private void splitSaveScheduling(Map<String, List<ResponseScheduling>> driverSchedulingMap, String jobCode, ResponseScheduling item) {
  289 + if (!Objects.isNull(jobCode))
  290 + if (Objects.isNull(driverSchedulingMap.get(jobCode))) {
  291 + List<ResponseScheduling> oneDriverScheduling = new ArrayList<>();
  292 + oneDriverScheduling.add(item);
  293 + driverSchedulingMap.put(jobCode, oneDriverScheduling);
  294 + } else {
  295 + driverSchedulingMap.get(jobCode).add(item);
  296 + }
  297 + }
  298 +
251 299  
252 300 public static void getDrivers(String accessToken) throws Exception {
253 301 // Map<String, String> configMap = getStringStringMap(timestamp);
... ... @@ -418,5 +466,7 @@ public class DriverJob implements InitializingBean {
418 466 TOKEN_URL = tokenUrl;
419 467 APP_KEY = appKey;
420 468 APP_SECRET = appSecret;
  469 + SCHEDULING_CACHE = schedulingCache;
  470 + EQUIPMENT_MAPPER = equipmentMapper;
421 471 }
422 472 }
... ...
ruoyi-admin/src/main/java/com/ruoyi/pojo/equipment/EquipmentOnline.java 0 → 100644
  1 +package com.ruoyi.pojo.equipment;
  2 +
  3 +import com.ruoyi.equipment.domain.Equipment;
  4 +import com.ruoyi.equipment.mapper.EquipmentMapper;
  5 +import com.ruoyi.pojo.request.HeartPackageVo;
  6 +import com.ruoyi.utils.ConstDateUtil;
  7 +import org.slf4j.Logger;
  8 +import org.slf4j.LoggerFactory;
  9 +import org.springframework.beans.factory.annotation.Autowired;
  10 +import org.springframework.stereotype.Component;
  11 +
  12 +import java.time.LocalDateTime;
  13 +import java.time.temporal.ChronoUnit;
  14 +import java.util.*;
  15 +import java.util.concurrent.ConcurrentHashMap;
  16 +
  17 +import static com.ruoyi.common.ConstEquipmentProperties.*;
  18 +
  19 +/**
  20 + * 设备在线表
  21 + *
  22 + * @author 20412
  23 + */
  24 +@Component
  25 +public class EquipmentOnline {
  26 +
  27 + Logger log = LoggerFactory.getLogger(EquipmentOnline.class);
  28 +
  29 + @Autowired
  30 + private EquipmentOnline(EquipmentMapper mapper) {
  31 + log.info("初始化设备信息");
  32 + initClient(mapper);
  33 + log.info("设备信息初始化完毕");
  34 + }
  35 +
  36 + private void initClient(EquipmentMapper mapper) {
  37 + List<Equipment> list = mapper.selectEquipmentList(null);
  38 + for (Equipment equipment : list) {
  39 + if (Objects.isNull(equipment.getLastHeartRes())) {
  40 + equipment.setOnlineClient(DEVICE_OFFLINE);
  41 + } else {
  42 + LocalDateTime time = ConstDateUtil.getLocalDateTimeByLongTime(equipment.getLastHeartRes().getTime());
  43 + LocalDateTime nowTime = LocalDateTime.now();
  44 + long timeout = ChronoUnit.MINUTES.between(time, nowTime);
  45 + if (DEVICE_OFFLINE_TIME.compareTo(timeout) < 0) {
  46 + equipment.setOnlineClient(DEVICE_OFFLINE);
  47 + } else {
  48 + equipment.setOnlineClient(DEVICE_ONLINE);
  49 + }
  50 + }
  51 + }
  52 + mapper.updateEquipments(list);
  53 + }
  54 +
  55 +
  56 +
  57 +
  58 +
  59 +
  60 +}
... ...
ruoyi-admin/src/main/java/com/ruoyi/pojo/request/GlobalExceptionRequestVo.java 0 → 100644
  1 +package com.ruoyi.pojo.request;
  2 +
  3 +import com.ruoyi.common.annotation.Excel;
  4 +import io.swagger.annotations.ApiModelProperty;
  5 +import lombok.Data;
  6 +
  7 +import javax.validation.constraints.NotBlank;
  8 +import javax.validation.constraints.NotNull;
  9 +
  10 +@Data
  11 +public class GlobalExceptionRequestVo {
  12 + /**
  13 + * id
  14 + */
  15 + @ApiModelProperty("主键")
  16 + private Long id;
  17 +
  18 + /**
  19 + * 提交工号
  20 + */
  21 + @Excel(name = "提交工号")
  22 + @ApiModelProperty("提交工号")
  23 + @NotBlank
  24 + private String jobCode;
  25 +
  26 + /**
  27 + * 设备号
  28 + */
  29 + @Excel(name = "设备号")
  30 + @ApiModelProperty("设备号")
  31 + @NotBlank
  32 + private String deviceId;
  33 +
  34 + /**
  35 + * 问题类型
  36 + */
  37 + @Excel(name = "问题类型")
  38 + @ApiModelProperty("问题类型(1:识别异常,2:设备异常")
  39 + @NotNull
  40 + private Integer type;
  41 +
  42 + @Excel(name = "问题描述")
  43 + @ApiModelProperty("问题描述")
  44 + @NotBlank
  45 + private String remark;
  46 +}
... ...
ruoyi-admin/src/main/java/com/ruoyi/pojo/request/HeartPackageVo.java 0 → 100644
  1 +package com.ruoyi.pojo.request;
  2 +
  3 +import io.swagger.annotations.ApiModel;
  4 +import io.swagger.annotations.ApiModelProperty;
  5 +import lombok.Data;
  6 +
  7 +import javax.validation.constraints.NotBlank;
  8 +
  9 +/**
  10 + * 心跳检测vo
  11 + * @author 20412
  12 + */
  13 +@Data
  14 +@ApiModel("心跳对象")
  15 +public class HeartPackageVo {
  16 + @ApiModelProperty("设备id")
  17 + @NotBlank(message = "设备id不能为空")
  18 + private String deviceId;
  19 + @ApiModelProperty("版本号")
  20 + @NotBlank(message = "版本号不能为空")
  21 + private String versionNum;
  22 +}
... ...
ruoyi-admin/src/main/java/com/ruoyi/pojo/response/DriverResponseVo.java 0 → 100644
  1 +package com.ruoyi.pojo.response;
  2 +import java.util.Date;
  3 +import com.google.common.collect.Maps;
  4 +
  5 +import com.ruoyi.driver.domain.Driver;
  6 +import io.swagger.annotations.ApiModel;
  7 +import io.swagger.annotations.ApiModelProperty;
  8 +import lombok.Data;
  9 +
  10 +/**
  11 + * @author 20412
  12 + */
  13 +@Data
  14 +@ApiModel("驾驶员对象")
  15 +public class DriverResponseVo extends Driver {
  16 +
  17 + @ApiModelProperty("是否需要酒精测试(true:需要 ,false:不需要)")
  18 + private Boolean checkAlcohol;
  19 + @ApiModelProperty("计划动作(签到,签退)")
  20 + private String planAction;
  21 +
  22 + public DriverResponseVo(Driver driver){
  23 +
  24 + this.setCheckAlcohol(false);
  25 + this.setPlanAction("签到");
  26 + this.setId(driver.getId());
  27 + this.setJobCode(driver.getJobCode());
  28 + this.setCompanyCode(driver.getCompanyCode());
  29 + this.setBrancheCompanyCode(driver.getBrancheCompanyCode());
  30 + this.setPersonnelName(driver.getPersonnelName());
  31 + this.setPapersCode(driver.getPapersCode());
  32 + this.setIcCardCode(driver.getIcCardCode());
  33 + this.setPersonnelType(driver.getPersonnelType());
  34 + this.setPosts(driver.getPosts());
  35 + this.setCard(driver.getCard());
  36 + this.setTelphone(driver.getTelphone());
  37 + this.setIcRfid(driver.getIcRfid());
  38 + this.setIdRfid(driver.getIdRfid());
  39 + this.setTagRfid(driver.getTagRfid());
  40 + this.setLineName(driver.getLineName());
  41 + this.setLineCode(driver.getLineCode());
  42 + this.setFaceSignIn(driver.getFaceSignIn());
  43 + this.setImage(driver.getImage());
  44 + this.setUpdateTime(driver.getUpdateTime());
  45 + this.setSignInEquipment(driver.getSignInEquipment());
  46 + this.setFleetName(driver.getFleetName());
  47 + this.setSearchValue(driver.getSearchValue());
  48 + this.setCreateBy(driver.getCreateBy());
  49 + this.setCreateTime(driver.getCreateTime());
  50 + this.setUpdateBy(driver.getUpdateBy());
  51 + this.setUpdateTime(driver.getUpdateTime());
  52 + this.setRemark(driver.getRemark());
  53 +
  54 +
  55 + }
  56 + public DriverResponseVo(){}
  57 +}
... ...
ruoyi-admin/src/main/java/com/ruoyi/pojo/response/SignInResponseVo.java
1 1 package com.ruoyi.pojo.response;
  2 +import java.math.BigDecimal;
  3 +import java.util.Date;
  4 +import com.google.common.collect.Maps;
2 5  
3 6 import com.alibaba.excel.annotation.ExcelIgnore;
4 7 import com.alibaba.excel.annotation.ExcelProperty;
  8 +import com.ruoyi.common.annotation.Excel;
5 9 import com.ruoyi.in.domain.SignIn;
6 10 import lombok.Data;
7 11  
... ... @@ -13,12 +17,36 @@ import lombok.Data;
13 17 public class SignInResponseVo extends SignIn {
14 18 @ExcelIgnore
15 19 String address;
16   - @ExcelIgnore
17   - String deviceId;
18   - @ExcelProperty(value = "姓名")
  20 + @Excel(name = "姓名")
19 21 String name;
20   - @ExcelProperty(value = "工种")
  22 + @Excel( name = "工种")
21 23 String posts;
  24 + @Excel( name = "场地名称")
  25 + String siteName;
  26 +
  27 + public SignInResponseVo(SignIn signIn){
  28 + this.setDeviceId(signIn.getDeviceId());
  29 + this.setId(0L);
  30 + this.setJobCode(signIn.getJobCode());
  31 + this.setIp(signIn.getIp());
  32 + this.setImage(signIn.getImage());
  33 + this.setStatus(signIn.getStatus());
  34 + this.setSingnIn(signIn.getSingnIn());
  35 + this.setAlcoholFlag(signIn.getAlcoholFlag());
  36 + this.setType(signIn.getType());
  37 + this.setAlcoholIntake(signIn.getAlcoholIntake());
  38 + this.setLineName(signIn.getLineName());
  39 + this.setCarNum(signIn.getCarNum());
  40 + this.setRoadNum(signIn.getRoadNum());
  41 + this.setSearchValue(signIn.getSearchValue());
  42 + this.setCreateBy(signIn.getCreateBy());
  43 + this.setCreateTime(signIn.getCreateTime());
  44 + this.setUpdateBy(signIn.getUpdateBy());
  45 + this.setUpdateTime(signIn.getUpdateTime());
  46 + this.setRemark(signIn.getRemark());
  47 +
22 48  
  49 + }
  50 + public SignInResponseVo(){}
23 51  
24 52 }
... ...
ruoyi-admin/src/main/java/com/ruoyi/schedulingAssociateNum/controller/RuleNumSchedulingController.java 0 → 100644
  1 +package com.ruoyi.schedulingAssociateNum.controller;
  2 +
  3 +import java.util.List;
  4 +import javax.servlet.http.HttpServletResponse;
  5 +import org.springframework.security.access.prepost.PreAuthorize;
  6 +import org.springframework.beans.factory.annotation.Autowired;
  7 +import org.springframework.web.bind.annotation.GetMapping;
  8 +import org.springframework.web.bind.annotation.PostMapping;
  9 +import org.springframework.web.bind.annotation.PutMapping;
  10 +import org.springframework.web.bind.annotation.DeleteMapping;
  11 +import org.springframework.web.bind.annotation.PathVariable;
  12 +import org.springframework.web.bind.annotation.RequestBody;
  13 +import org.springframework.web.bind.annotation.RequestMapping;
  14 +import org.springframework.web.bind.annotation.RestController;
  15 +import com.ruoyi.common.annotation.Log;
  16 +import com.ruoyi.common.core.controller.BaseController;
  17 +import com.ruoyi.common.core.domain.AjaxResult;
  18 +import com.ruoyi.common.enums.BusinessType;
  19 +import com.ruoyi.schedulingAssociateNum.domain.RuleNumScheduling;
  20 +import com.ruoyi.schedulingAssociateNum.service.IRuleNumSchedulingService;
  21 +import com.ruoyi.common.utils.poi.ExcelUtil;
  22 +import com.ruoyi.common.core.page.TableDataInfo;
  23 +
  24 +/**
  25 + * 排班规则和班次关联Controller
  26 + *
  27 + * @author 古自健
  28 + * @date 2023-08-07
  29 + */
  30 +@RestController
  31 +@RequestMapping("/schedulingAssociateNum/schedulingAssociateNum")
  32 +public class RuleNumSchedulingController extends BaseController
  33 +{
  34 + @Autowired
  35 + private IRuleNumSchedulingService ruleNumSchedulingService;
  36 +
  37 + /**
  38 + * 查询排班规则和班次关联列表
  39 + */
  40 + @PreAuthorize("@ss.hasPermi('schedulingAssociateNum:schedulingAssociateNum:list')")
  41 + @GetMapping("/list")
  42 + public TableDataInfo list(RuleNumScheduling ruleNumScheduling)
  43 + {
  44 + startPage();
  45 + List<RuleNumScheduling> list = ruleNumSchedulingService.selectRuleNumSchedulingList(ruleNumScheduling);
  46 + return getDataTable(list);
  47 + }
  48 +
  49 + /**
  50 + * 导出排班规则和班次关联列表
  51 + */
  52 + @PreAuthorize("@ss.hasPermi('schedulingAssociateNum:schedulingAssociateNum:export')")
  53 + @Log(title = "排班规则和班次关联", businessType = BusinessType.EXPORT)
  54 + @PostMapping("/export")
  55 + public void export(HttpServletResponse response, RuleNumScheduling ruleNumScheduling)
  56 + {
  57 + List<RuleNumScheduling> list = ruleNumSchedulingService.selectRuleNumSchedulingList(ruleNumScheduling);
  58 + ExcelUtil<RuleNumScheduling> util = new ExcelUtil<RuleNumScheduling>(RuleNumScheduling.class);
  59 + util.exportExcel(response, list, "排班规则和班次关联数据");
  60 + }
  61 +
  62 + /**
  63 + * 获取排班规则和班次关联详细信息
  64 + */
  65 + @PreAuthorize("@ss.hasPermi('schedulingAssociateNum:schedulingAssociateNum:query')")
  66 + @GetMapping(value = "/{id}")
  67 + public AjaxResult getInfo(@PathVariable("id") Long id)
  68 + {
  69 + return success(ruleNumSchedulingService.selectRuleNumSchedulingById(id));
  70 + }
  71 +
  72 + /**
  73 + * 新增排班规则和班次关联
  74 + */
  75 + @PreAuthorize("@ss.hasPermi('schedulingAssociateNum:schedulingAssociateNum:add')")
  76 + @Log(title = "排班规则和班次关联", businessType = BusinessType.INSERT)
  77 + @PostMapping
  78 + public AjaxResult add(@RequestBody RuleNumScheduling ruleNumScheduling)
  79 + {
  80 + return toAjax(ruleNumSchedulingService.insertRuleNumScheduling(ruleNumScheduling));
  81 + }
  82 +
  83 + /**
  84 + * 修改排班规则和班次关联
  85 + */
  86 + @PreAuthorize("@ss.hasPermi('schedulingAssociateNum:schedulingAssociateNum:edit')")
  87 + @Log(title = "排班规则和班次关联", businessType = BusinessType.UPDATE)
  88 + @PutMapping
  89 + public AjaxResult edit(@RequestBody RuleNumScheduling ruleNumScheduling)
  90 + {
  91 + return toAjax(ruleNumSchedulingService.updateRuleNumScheduling(ruleNumScheduling));
  92 + }
  93 +
  94 + /**
  95 + * 删除排班规则和班次关联
  96 + */
  97 + @PreAuthorize("@ss.hasPermi('schedulingAssociateNum:schedulingAssociateNum:remove')")
  98 + @Log(title = "排班规则和班次关联", businessType = BusinessType.DELETE)
  99 + @DeleteMapping("/{ids}")
  100 + public AjaxResult remove(@PathVariable Long[] ids)
  101 + {
  102 + return toAjax(ruleNumSchedulingService.deleteRuleNumSchedulingByIds(ids));
  103 + }
  104 +}
... ...
ruoyi-admin/src/main/java/com/ruoyi/schedulingAssociateNum/domain/RuleNumScheduling.java 0 → 100644
  1 +package com.ruoyi.schedulingAssociateNum.domain;
  2 +
  3 +import org.apache.commons.lang3.builder.ToStringBuilder;
  4 +import org.apache.commons.lang3.builder.ToStringStyle;
  5 +import com.ruoyi.common.annotation.Excel;
  6 +import com.ruoyi.common.core.domain.BaseEntity;
  7 +
  8 +/**
  9 + * 排班规则和班次关联对象 rule_num_scheduling
  10 + *
  11 + * @author 古自健
  12 + * @date 2023-08-07
  13 + */
  14 +public class RuleNumScheduling extends BaseEntity
  15 +{
  16 + private static final long serialVersionUID = 1L;
  17 +
  18 + /** 主键 */
  19 + private Long id;
  20 +
  21 + /** 班次id */
  22 + @Excel(name = "班次id")
  23 + private Long ruleNumId;
  24 +
  25 + /** 规则id集合 */
  26 + @Excel(name = "规则id集合")
  27 + private String ruleSchedulingId;
  28 +
  29 + /** 排班名称 */
  30 + @Excel(name = "排班名称")
  31 + private String matchName;
  32 +
  33 + public void setId(Long id)
  34 + {
  35 + this.id = id;
  36 + }
  37 +
  38 + public Long getId()
  39 + {
  40 + return id;
  41 + }
  42 + public void setRuleNumId(Long ruleNumId)
  43 + {
  44 + this.ruleNumId = ruleNumId;
  45 + }
  46 +
  47 + public Long getRuleNumId()
  48 + {
  49 + return ruleNumId;
  50 + }
  51 + public void setRuleSchedulingId(String ruleSchedulingId)
  52 + {
  53 + this.ruleSchedulingId = ruleSchedulingId;
  54 + }
  55 +
  56 + public String getRuleSchedulingId()
  57 + {
  58 + return ruleSchedulingId;
  59 + }
  60 + public void setMatchName(String matchName)
  61 + {
  62 + this.matchName = matchName;
  63 + }
  64 +
  65 + public String getMatchName()
  66 + {
  67 + return matchName;
  68 + }
  69 +
  70 + @Override
  71 + public String toString() {
  72 + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
  73 + .append("id", getId())
  74 + .append("ruleNumId", getRuleNumId())
  75 + .append("ruleSchedulingId", getRuleSchedulingId())
  76 + .append("matchName", getMatchName())
  77 + .toString();
  78 + }
  79 +}
... ...
ruoyi-admin/src/main/java/com/ruoyi/schedulingAssociateNum/mapper/RuleNumSchedulingMapper.java 0 → 100644
  1 +package com.ruoyi.schedulingAssociateNum.mapper;
  2 +
  3 +import java.util.List;
  4 +import com.ruoyi.schedulingAssociateNum.domain.RuleNumScheduling;
  5 +
  6 +/**
  7 + * 排班规则和班次关联Mapper接口
  8 + *
  9 + * @author 古自健
  10 + * @date 2023-08-07
  11 + */
  12 +public interface RuleNumSchedulingMapper
  13 +{
  14 + /**
  15 + * 查询排班规则和班次关联
  16 + *
  17 + * @param id 排班规则和班次关联主键
  18 + * @return 排班规则和班次关联
  19 + */
  20 + public RuleNumScheduling selectRuleNumSchedulingById(Long id);
  21 +
  22 + /**
  23 + * 查询排班规则和班次关联列表
  24 + *
  25 + * @param ruleNumScheduling 排班规则和班次关联
  26 + * @return 排班规则和班次关联集合
  27 + */
  28 + public List<RuleNumScheduling> selectRuleNumSchedulingList(RuleNumScheduling ruleNumScheduling);
  29 +
  30 + /**
  31 + * 新增排班规则和班次关联
  32 + *
  33 + * @param ruleNumScheduling 排班规则和班次关联
  34 + * @return 结果
  35 + */
  36 + public int insertRuleNumScheduling(RuleNumScheduling ruleNumScheduling);
  37 +
  38 + /**
  39 + * 修改排班规则和班次关联
  40 + *
  41 + * @param ruleNumScheduling 排班规则和班次关联
  42 + * @return 结果
  43 + */
  44 + public int updateRuleNumScheduling(RuleNumScheduling ruleNumScheduling);
  45 +
  46 + /**
  47 + * 删除排班规则和班次关联
  48 + *
  49 + * @param id 排班规则和班次关联主键
  50 + * @return 结果
  51 + */
  52 + public int deleteRuleNumSchedulingById(Long id);
  53 +
  54 + /**
  55 + * 批量删除排班规则和班次关联
  56 + *
  57 + * @param ids 需要删除的数据主键集合
  58 + * @return 结果
  59 + */
  60 + public int deleteRuleNumSchedulingByIds(Long[] ids);
  61 +}
... ...
ruoyi-admin/src/main/java/com/ruoyi/schedulingAssociateNum/service/IRuleNumSchedulingService.java 0 → 100644
  1 +package com.ruoyi.schedulingAssociateNum.service;
  2 +
  3 +import java.util.List;
  4 +import com.ruoyi.schedulingAssociateNum.domain.RuleNumScheduling;
  5 +
  6 +/**
  7 + * 排班规则和班次关联Service接口
  8 + *
  9 + * @author 古自健
  10 + * @date 2023-08-07
  11 + */
  12 +public interface IRuleNumSchedulingService
  13 +{
  14 + /**
  15 + * 查询排班规则和班次关联
  16 + *
  17 + * @param id 排班规则和班次关联主键
  18 + * @return 排班规则和班次关联
  19 + */
  20 + public RuleNumScheduling selectRuleNumSchedulingById(Long id);
  21 +
  22 + /**
  23 + * 查询排班规则和班次关联列表
  24 + *
  25 + * @param ruleNumScheduling 排班规则和班次关联
  26 + * @return 排班规则和班次关联集合
  27 + */
  28 + public List<RuleNumScheduling> selectRuleNumSchedulingList(RuleNumScheduling ruleNumScheduling);
  29 +
  30 + /**
  31 + * 新增排班规则和班次关联
  32 + *
  33 + * @param ruleNumScheduling 排班规则和班次关联
  34 + * @return 结果
  35 + */
  36 + public int insertRuleNumScheduling(RuleNumScheduling ruleNumScheduling);
  37 +
  38 + /**
  39 + * 修改排班规则和班次关联
  40 + *
  41 + * @param ruleNumScheduling 排班规则和班次关联
  42 + * @return 结果
  43 + */
  44 + public int updateRuleNumScheduling(RuleNumScheduling ruleNumScheduling);
  45 +
  46 + /**
  47 + * 批量删除排班规则和班次关联
  48 + *
  49 + * @param ids 需要删除的排班规则和班次关联主键集合
  50 + * @return 结果
  51 + */
  52 + public int deleteRuleNumSchedulingByIds(Long[] ids);
  53 +
  54 + /**
  55 + * 删除排班规则和班次关联信息
  56 + *
  57 + * @param id 排班规则和班次关联主键
  58 + * @return 结果
  59 + */
  60 + public int deleteRuleNumSchedulingById(Long id);
  61 +}
... ...
ruoyi-admin/src/main/java/com/ruoyi/schedulingAssociateNum/service/impl/RuleNumSchedulingServiceImpl.java 0 → 100644
  1 +package com.ruoyi.schedulingAssociateNum.service.impl;
  2 +
  3 +import java.util.List;
  4 +import com.ruoyi.common.utils.SecurityUtils;
  5 +import org.springframework.beans.factory.annotation.Autowired;
  6 +import org.springframework.stereotype.Service;
  7 +import com.ruoyi.schedulingAssociateNum.mapper.RuleNumSchedulingMapper;
  8 +import com.ruoyi.schedulingAssociateNum.domain.RuleNumScheduling;
  9 +import com.ruoyi.schedulingAssociateNum.service.IRuleNumSchedulingService;
  10 +
  11 +/**
  12 + * 排班规则和班次关联Service业务层处理
  13 + *
  14 + * @author 古自健
  15 + * @date 2023-08-07
  16 + */
  17 +@Service
  18 +public class RuleNumSchedulingServiceImpl implements IRuleNumSchedulingService
  19 +{
  20 + @Autowired
  21 + private RuleNumSchedulingMapper ruleNumSchedulingMapper;
  22 +
  23 + /**
  24 + * 查询排班规则和班次关联
  25 + *
  26 + * @param id 排班规则和班次关联主键
  27 + * @return 排班规则和班次关联
  28 + */
  29 + @Override
  30 + public RuleNumScheduling selectRuleNumSchedulingById(Long id)
  31 + {
  32 + return ruleNumSchedulingMapper.selectRuleNumSchedulingById(id);
  33 + }
  34 +
  35 + /**
  36 + * 查询排班规则和班次关联列表
  37 + *
  38 + * @param ruleNumScheduling 排班规则和班次关联
  39 + * @return 排班规则和班次关联
  40 + */
  41 + @Override
  42 + public List<RuleNumScheduling> selectRuleNumSchedulingList(RuleNumScheduling ruleNumScheduling)
  43 + {
  44 + return ruleNumSchedulingMapper.selectRuleNumSchedulingList(ruleNumScheduling);
  45 + }
  46 +
  47 + /**
  48 + * 新增排班规则和班次关联
  49 + *
  50 + * @param ruleNumScheduling 排班规则和班次关联
  51 + * @return 结果
  52 + */
  53 + @Override
  54 + public int insertRuleNumScheduling(RuleNumScheduling ruleNumScheduling)
  55 + {
  56 + return ruleNumSchedulingMapper.insertRuleNumScheduling(ruleNumScheduling);
  57 + }
  58 +
  59 + /**
  60 + * 修改排班规则和班次关联
  61 + *
  62 + * @param ruleNumScheduling 排班规则和班次关联
  63 + * @return 结果
  64 + */
  65 + @Override
  66 + public int updateRuleNumScheduling(RuleNumScheduling ruleNumScheduling)
  67 + {
  68 + return ruleNumSchedulingMapper.updateRuleNumScheduling(ruleNumScheduling);
  69 + }
  70 +
  71 + /**
  72 + * 批量删除排班规则和班次关联
  73 + *
  74 + * @param ids 需要删除的排班规则和班次关联主键
  75 + * @return 结果
  76 + */
  77 + @Override
  78 + public int deleteRuleNumSchedulingByIds(Long[] ids)
  79 + {
  80 + return ruleNumSchedulingMapper.deleteRuleNumSchedulingByIds(ids);
  81 + }
  82 +
  83 + /**
  84 + * 删除排班规则和班次关联信息
  85 + *
  86 + * @param id 排班规则和班次关联主键
  87 + * @return 结果
  88 + */
  89 + @Override
  90 + public int deleteRuleNumSchedulingById(Long id)
  91 + {
  92 + return ruleNumSchedulingMapper.deleteRuleNumSchedulingById(id);
  93 + }
  94 +}
... ...
ruoyi-admin/src/main/java/com/ruoyi/service/AppService.java
... ... @@ -5,7 +5,10 @@ import com.ruoyi.common.core.domain.AjaxResult;
5 5 import com.ruoyi.common.utils.StringUtils;
6 6 import com.ruoyi.common.utils.file.FileUploadUtils;
7 7 import com.ruoyi.common.utils.file.FileUtils;
  8 +import com.ruoyi.equipment.domain.Equipment;
  9 +import com.ruoyi.equipment.mapper.EquipmentMapper;
8 10 import com.ruoyi.framework.config.ServerConfig;
  11 +import com.ruoyi.pojo.request.HeartPackageVo;
9 12 import com.ruoyi.pojo.response.ApplicationResponseVo;
10 13 import com.ruoyi.upgrade.domain.VersionUpgrade;
11 14 import com.ruoyi.upgrade.mapper.VersionUpgradeMapper;
... ... @@ -18,8 +21,11 @@ import org.springframework.web.multipart.MultipartFile;
18 21 import javax.servlet.http.HttpServletResponse;
19 22 import java.io.*;
20 23 import java.nio.file.Paths;
  24 +import java.util.Date;
21 25 import java.util.Objects;
22 26  
  27 +import static com.ruoyi.common.ConstEquipmentProperties.DEVICE_ONLINE;
  28 +
23 29 /**
24 30 * 应用service
25 31 */
... ... @@ -30,6 +36,9 @@ public class AppService {
30 36 String apkPath;
31 37  
32 38 @Autowired
  39 + private EquipmentMapper equipmentMapper;
  40 +
  41 + @Autowired
33 42 private ServerConfig serverConfig;
34 43 @Autowired
35 44 private VersionUpgradeMapper versionUpgradeMapper;
... ... @@ -84,4 +93,13 @@ public class AppService {
84 93 throw new RuntimeException("不是apk文件请重新上传");
85 94 }
86 95 }
  96 +
  97 + public void checkAppHeart(HeartPackageVo vo) {
  98 + Equipment equipment = new Equipment();
  99 + equipment.setOnlineClient(DEVICE_ONLINE);
  100 + equipment.setLastHeartRes(new Date());
  101 + equipment.setDeviceId(vo.getDeviceId());
  102 + equipment.setRemark("版本号:" + vo.getVersionNum());
  103 + equipmentMapper.updateEquipmentByDeviceId(equipment);
  104 + }
87 105 }
... ...
ruoyi-admin/src/main/java/com/ruoyi/service/ReportService.java
... ... @@ -11,6 +11,7 @@ import com.ruoyi.pojo.request.ReportErrorRequestVo;
11 11 import com.ruoyi.pojo.response.ReportErrorResponseVo;
12 12 import com.ruoyi.pojo.response.ReportSignInResponseVo;
13 13 import com.ruoyi.pojo.response.ReportViewResponseVo;
  14 +import org.apache.poi.ss.formula.functions.Offset;
14 15 import org.springframework.beans.factory.annotation.Autowired;
15 16 import org.springframework.stereotype.Service;
16 17  
... ... @@ -120,7 +121,13 @@ public class ReportService {
120 121 responseVo.setCount(responseVo.getCount() + 1);
121 122 }
122 123 }
123   - return new ArrayList<>(responseMapVo.values());
  124 + ArrayList<ReportSignInResponseVo> vos = new ArrayList<>(responseMapVo.values());
  125 + for (ReportSignInResponseVo vo : vos) {
  126 + if (!Objects.isNull(vo)){
  127 + vo.getChildren().sort(Comparator.comparing(ReportSignInResponseVo::getCreateTime).reversed());
  128 + }
  129 + }
  130 + return vos;
124 131 }
125 132  
126 133 public String getDateDay(Date createTime) {
... ...
ruoyi-admin/src/main/resources/application-druid-dev.yml
... ... @@ -138,6 +138,7 @@ api:
138 138 getCompanyInfo: http://101.95.136.206:9089/webservice/rest/person/company/%d?timestamp=%&nonce=%s&password=%s&sign=%s
139 139 # 获取排班信息
140 140 getSchedulingInfo: http://101.95.136.206:9089/webservice/rest/schedule_real/sch_jk/%s/%s?timestamp=%d&nonce=%s&password=%s&sign=%s
  141 + getSchedulingInfoNew: http://101.95.136.206:9089/webservice/rest/schedule_real/sch_jk_db/%s/%s?timestamp=%d&nonce=%s&password=%s&sign=%s
141 142 config:
142 143 password: c4dd3d8cb9a82f6d6a625818618b28ca7bebb464
143 144 # 随机字符串
... ...
ruoyi-admin/src/main/resources/application-druid-prd.yml
... ... @@ -161,6 +161,7 @@ api:
161 161 getCompanyInfo: http://101.95.136.206:9089/webservice/rest/person/company/%d?timestamp=%&nonce=%s&password=%s&sign=%s
162 162 # 获取排班信息
163 163 getSchedulingInfo: http://101.95.136.206:9089/webservice/rest/schedule_real/sch_jk/%s/%s?timestamp=%d&nonce=%s&password=%s&sign=%s
  164 + getSchedulingInfoNew: http://101.95.136.206:9089/webservice/rest/schedule_real/sch_jk_db/%s/%s?timestamp=%d&nonce=%s&password=%s&sign=%s
164 165 config:
165 166 # 固定密码
166 167 password: c4dd3d8cb9a82f6d6a625818618b28ca7bebb464
... ...
ruoyi-admin/src/main/resources/application-druid-uat.yml
... ... @@ -157,6 +157,7 @@ api:
157 157 getCompanyInfo: http://101.95.136.206:9089/webservice/rest/person/company/%d?timestamp=%&nonce=%s&password=%s&sign=%s
158 158 # 获取排班信息
159 159 getSchedulingInfo: http://101.95.136.206:9089/webservice/rest/schedule_real/sch_jk/%s/%s?timestamp=%d&nonce=%s&password=%s&sign=%s
  160 + getSchedulingInfoNew: http://101.95.136.206:9089/webservice/rest/schedule_real/sch_jk_db/%s/%s?timestamp=%d&nonce=%s&password=%s&sign=%s
160 161 config:
161 162 # 固定密码
162 163 password: c4dd3d8cb9a82f6d6a625818618b28ca7bebb464
... ...
ruoyi-admin/src/main/resources/logback.xml
... ... @@ -31,7 +31,7 @@
31 31 </encoder>
32 32 <filter class="ch.qos.logback.classic.filter.LevelFilter">
33 33 <!-- 过滤的级别 -->
34   - <level>INFO</level>
  34 + <level>DEBUG</level>
35 35 <!-- 匹配时的操作:接收(记录) -->
36 36 <onMatch>ACCEPT</onMatch>
37 37 <!-- 不匹配时的操作:拒绝(不记录) -->
... ...
ruoyi-admin/src/main/resources/mapper/driver/DriverMapper.xml
... ... @@ -251,8 +251,7 @@
251 251 </update>
252 252 <update id="updateSignStatusDriversByJobCodes">
253 253 <foreach collection="list" item="item" separator=";">
254   - update driver set face_sign_in = 1,
255   - personnel_name = #{item.personnelName,jdbcType=VARCHAR},posts = #{item.posts,jdbcType=VARCHAR},image = #{item.image,jdbcType=VARCHAR},update_time = #{item.updateTime},fleet_name = #{item.fleetName},line_name = #{item.lineName}
  254 + update driver set face_sign_in = 1,update_time = #{item.updateTime}
256 255 where job_code = #{item.jobCode,jdbcType=VARCHAR}
257 256 </foreach>
258 257 </update>
... ...
ruoyi-admin/src/main/resources/mapper/equipment/EquipmentMapper.xml
... ... @@ -18,10 +18,12 @@ PUBLIC &quot;-//mybatis.org//DTD Mapper 3.0//EN&quot;
18 18 <result property="createBy" column="create_by" />
19 19 <result property="updateBy" column="update_by" />
20 20 <result property="remark" column="remark" />
  21 + <result property="lastHeartRes" column="last_heart_res" />
  22 + <result property="onlineClient" column="online_client" />
21 23 </resultMap>
22 24  
23 25 <sql id="selectEquipmentVo">
24   - select id, site_name, address, ip, status, promise, image, device_id, create_time, update_time, create_by, update_by, remark from equipment
  26 + select id, site_name, address, ip, status, promise, image, device_id, create_time, update_time, create_by, update_by, remark,last_heart_res,online_client from equipment
25 27 </sql>
26 28  
27 29 <select id="selectEquipmentList" parameterType="Equipment" resultMap="EquipmentResult">
... ... @@ -34,6 +36,7 @@ PUBLIC &quot;-//mybatis.org//DTD Mapper 3.0//EN&quot;
34 36 <if test="promise != null and promise != ''"> and promise = #{promise}</if>
35 37 <if test="image != null and image != ''"> and image = #{image}</if>
36 38 <if test="deviceId != null and deviceId != ''"> and device_id = #{deviceId}</if>
  39 + <if test="onlineClient != null and onlineClient != ''"> and online_client = #{onlineClient}</if>
37 40 </where>
38 41 order by id desc
39 42 </select>
... ... @@ -84,6 +87,8 @@ PUBLIC &quot;-//mybatis.org//DTD Mapper 3.0//EN&quot;
84 87 <if test="createBy != null">create_by,</if>
85 88 <if test="updateBy != null">update_by,</if>
86 89 <if test="remark != null">remark,</if>
  90 + <if test="lastHeartRes != null">last_heart_res,</if>
  91 + <if test="onlineClient != null">online_client,</if>
87 92 </trim>
88 93 <trim prefix="values (" suffix=")" suffixOverrides=",">
89 94 <if test="siteName != null and siteName != ''">#{siteName},</if>
... ... @@ -98,6 +103,8 @@ PUBLIC &quot;-//mybatis.org//DTD Mapper 3.0//EN&quot;
98 103 <if test="createBy != null">#{createBy},</if>
99 104 <if test="updateBy != null">#{updateBy},</if>
100 105 <if test="remark != null">#{remark},</if>
  106 + <if test="lastHeartRes != null">#{lastHeartRes},</if>
  107 + <if test="onlineClient != null">#{online_client},</if>
101 108 </trim>
102 109 </insert>
103 110  
... ... @@ -116,8 +123,42 @@ PUBLIC &quot;-//mybatis.org//DTD Mapper 3.0//EN&quot;
116 123 <if test="createBy != null">create_by = #{createBy},</if>
117 124 <if test="updateBy != null">update_by = #{updateBy},</if>
118 125 <if test="remark != null">remark = #{remark},</if>
  126 + <if test="lastHeartRes != null">last_heart_res = #{lastHeartRes},</if>
  127 + <if test="onlineClient != null">online_client = #{onlineClient},</if>
119 128 </trim>
120   - where id = #{id}
  129 + where 1 = 1
  130 + <if test="id !=null">
  131 + and id = #{id}
  132 + </if>
  133 + <if test="device_id !=null and id == null">
  134 + and device_id = #{deviceId}
  135 + </if>
  136 + </update>
  137 + <update id="updateEquipments">
  138 + <foreach collection="list" item="item">
  139 + update equipment set last_heart_res = #{item.lastHeartRes}, online_client = #{item.onlineClient}
  140 + where device_id = #{item.deviceId};
  141 + </foreach>
  142 + </update>
  143 + <update id="updateEquipmentByDeviceId">
  144 + update equipment
  145 + <trim prefix="SET" suffixOverrides=",">
  146 + <if test="siteName != null and siteName != ''">site_name = #{siteName},</if>
  147 + <if test="address != null and address != ''">address = #{address},</if>
  148 + <if test="ip != null and ip != ''">ip = #{ip},</if>
  149 + <if test="status != null">status = #{status},</if>
  150 + <if test="promise != null and promise != ''">promise = #{promise},</if>
  151 + <if test="image != null">image = #{image},</if>
  152 + <if test="deviceId != null">device_id = #{deviceId},</if>
  153 + <if test="createTime != null">create_time = #{createTime},</if>
  154 + <if test="updateTime != null">update_time = #{updateTime},</if>
  155 + <if test="createBy != null">create_by = #{createBy},</if>
  156 + <if test="updateBy != null">update_by = #{updateBy},</if>
  157 + <if test="remark != null">remark = #{remark},</if>
  158 + <if test="lastHeartRes != null">last_heart_res = #{lastHeartRes},</if>
  159 + <if test="onlineClient != null">online_client = #{onlineClient},</if>
  160 + </trim>
  161 + where device_id = #{deviceId}
121 162 </update>
122 163  
123 164 <delete id="deleteEquipmentById" parameterType="Long">
... ...
ruoyi-admin/src/main/resources/mapper/global_exception/GlobalExceptionMapper.xml 0 → 100644
  1 +<?xml version="1.0" encoding="UTF-8" ?>
  2 +<!DOCTYPE mapper
  3 +PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  4 +"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  5 +<mapper namespace="com.ruoyi.global_exception.mapper.GlobalExceptionMapper">
  6 +
  7 + <resultMap type="GlobalException" id="GlobalExceptionResult">
  8 + <result property="id" column="id" />
  9 + <result property="jobCode" column="job_code" />
  10 + <result property="deviceId" column="device_id" />
  11 + <result property="type" column="type" />
  12 + <result property="remark" column="remark" />
  13 + <result property="handle" column="handle" />
  14 + <result property="createTime" column="create_time" />
  15 + <result property="updateTime" column="update_time" />
  16 + </resultMap>
  17 +
  18 + <sql id="selectGlobalExceptionVo">
  19 + select id, job_code, device_id, type, remark, handle, create_time, update_time from global_exception
  20 + </sql>
  21 +
  22 + <select id="selectGlobalExceptionList" parameterType="GlobalException" resultMap="GlobalExceptionResult">
  23 + <include refid="selectGlobalExceptionVo"/>
  24 + <where>
  25 + <if test="jobCode != null and jobCode != ''"> and job_code = #{jobCode}</if>
  26 + <if test="deviceId != null and deviceId != ''"> and device_id = #{deviceId}</if>
  27 + <if test="type != null "> and type = #{type}</if>
  28 + <if test="handle != null "> and handle = #{handle}</if>
  29 + </where>
  30 + </select>
  31 +
  32 + <select id="selectGlobalExceptionById" parameterType="Long" resultMap="GlobalExceptionResult">
  33 + <include refid="selectGlobalExceptionVo"/>
  34 + where id = #{id}
  35 + </select>
  36 +
  37 +
  38 + <insert id="insertGlobalException" parameterType="GlobalException">
  39 + insert into global_exception
  40 + <trim prefix="(" suffix=")" suffixOverrides=",">
  41 + <if test="id != null">id,</if>
  42 + <if test="jobCode != null">job_code,</if>
  43 + <if test="deviceId != null">device_id,</if>
  44 + <if test="type != null">type,</if>
  45 + <if test="remark != null">remark,</if>
  46 + <if test="handle != null">handle,</if>
  47 + <if test="createTime != null">create_time,</if>
  48 + <if test="updateTime != null">update_time,</if>
  49 + </trim>
  50 + <trim prefix="values (" suffix=")" suffixOverrides=",">
  51 + <if test="id != null">#{id},</if>
  52 + <if test="jobCode != null">#{jobCode},</if>
  53 + <if test="deviceId != null">#{deviceId},</if>
  54 + <if test="type != null">#{type},</if>
  55 + <if test="remark != null">#{remark},</if>
  56 + <if test="handle != null">#{handle},</if>
  57 + <if test="createTime != null">#{createTime},</if>
  58 + <if test="updateTime != null">#{updateTime},</if>
  59 + </trim>
  60 + </insert>
  61 +
  62 + <update id="updateGlobalException" parameterType="GlobalException">
  63 + update global_exception
  64 + <trim prefix="SET" suffixOverrides=",">
  65 + <if test="jobCode != null">job_code = #{jobCode},</if>
  66 + <if test="deviceId != null">device_id = #{deviceId},</if>
  67 + <if test="type != null">type = #{type},</if>
  68 + <if test="remark != null">remark = #{remark},</if>
  69 + <if test="handle != null">handle = #{handle},</if>
  70 + <if test="createTime != null">create_time = #{createTime},</if>
  71 + <if test="updateTime != null">update_time = #{updateTime},</if>
  72 + </trim>
  73 + where id = #{id}
  74 + </update>
  75 +
  76 + <delete id="deleteGlobalExceptionById" parameterType="Long">
  77 + delete from global_exception where id = #{id}
  78 + </delete>
  79 +
  80 + <delete id="deleteGlobalExceptionByIds" parameterType="String">
  81 + delete from global_exception where id in
  82 + <foreach item="id" collection="array" open="(" separator="," close=")">
  83 + #{id}
  84 + </foreach>
  85 + </delete>
  86 +</mapper>
0 87 \ No newline at end of file
... ...
ruoyi-admin/src/main/resources/mapper/in/SignInMapper.xml
... ... @@ -20,6 +20,9 @@ PUBLIC &quot;-//mybatis.org//DTD Mapper 3.0//EN&quot;
20 20 <result property="remark" column="remark" />
21 21 <result property="posts" column="posts" />
22 22 <result property="name" column="personnel_name" />
  23 + <result property="lineName" column="line_name" />
  24 + <result property="carNum" column="car_num" />
  25 + <result property="roadNum" column="road_num" />
23 26 </resultMap>
24 27 <resultMap type="SignIn" id="SignInResult">
25 28 <result property="id" column="id" />
... ... @@ -36,6 +39,9 @@ PUBLIC &quot;-//mybatis.org//DTD Mapper 3.0//EN&quot;
36 39 <result property="updateTime" column="update_time" />
37 40 <result property="alcoholIntake" column="alcohol_intake" />
38 41 <result property="remark" column="remark" />
  42 + <result property="lineName" column="line_name" />
  43 + <result property="carNum" column="car_num" />
  44 + <result property="roadNum" column="road_num" />
39 45 </resultMap>
40 46  
41 47 <sql id="selectSignInVo">
... ... @@ -43,10 +49,10 @@ PUBLIC &quot;-//mybatis.org//DTD Mapper 3.0//EN&quot;
43 49 </sql>
44 50  
45 51 <select id="selectSignInList" parameterType="com.ruoyi.pojo.response.SignInResponseVo" resultMap="SignInResultVO">
46   - select sign_in.*,driver.posts,driver.personnel_name
47   - from sign_in,driver
  52 + select sign_in.*,driver.posts,driver.personnel_name,equipment.site_name
  53 + from sign_in,driver,equipment
48 54 WHERE
49   - driver.job_code = sign_in.jobCode
  55 + driver.job_code = sign_in.jobCode and equipment.device_id = sign_in.device_id
50 56 <if test="jobCode != null and jobCode != ''"> and jobCode = #{jobCode}</if>
51 57 <if test="ip != null and ip != ''"> and ip = #{ip}</if>
52 58 <if test="image != null and image != ''"> and image = #{image}</if>
... ... @@ -55,6 +61,7 @@ PUBLIC &quot;-//mybatis.org//DTD Mapper 3.0//EN&quot;
55 61 <if test="alcoholFlag != null "> and alcohol_flag = #{alcoholFlag}</if>
56 62 <if test="type != null "> and type = #{type}</if>
57 63 <if test="alcoholIntake != null "> and alcohol_intake = #{alcoholIntake}</if>
  64 + <if test="siteName != null "> and site_name = #{siteName}</if>
58 65 order by create_time desc
59 66 </select>
60 67  
... ...
ruoyi-admin/src/main/resources/mapper/schedulingAssociateNum/RuleNumSchedulingMapper.xml 0 → 100644
  1 +<?xml version="1.0" encoding="UTF-8" ?>
  2 +<!DOCTYPE mapper
  3 +PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  4 +"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  5 +<mapper namespace="com.ruoyi.schedulingAssociateNum.mapper.RuleNumSchedulingMapper">
  6 +
  7 + <resultMap type="RuleNumScheduling" id="RuleNumSchedulingResult">
  8 + <result property="id" column="id" />
  9 + <result property="ruleNumId" column="rule_num_id" />
  10 + <result property="ruleSchedulingId" column="rule_scheduling_id" />
  11 + <result property="matchName" column="match_name" />
  12 + </resultMap>
  13 +
  14 + <sql id="selectRuleNumSchedulingVo">
  15 + select id, rule_num_id, rule_scheduling_id, match_name from rule_num_scheduling
  16 + </sql>
  17 +
  18 + <select id="selectRuleNumSchedulingList" parameterType="RuleNumScheduling" resultMap="RuleNumSchedulingResult">
  19 + <include refid="selectRuleNumSchedulingVo"/>
  20 + <where>
  21 + <if test="ruleNumId != null "> and rule_num_id = #{ruleNumId}</if>
  22 + <if test="ruleSchedulingId != null and ruleSchedulingId != ''"> and rule_scheduling_id = #{ruleSchedulingId}</if>
  23 + <if test="matchName != null and matchName != ''"> and match_name like concat('%', #{matchName}, '%')</if>
  24 + </where>
  25 + </select>
  26 +
  27 + <select id="selectRuleNumSchedulingById" parameterType="Long" resultMap="RuleNumSchedulingResult">
  28 + <include refid="selectRuleNumSchedulingVo"/>
  29 + where id = #{id}
  30 + </select>
  31 +
  32 + <insert id="insertRuleNumScheduling" parameterType="RuleNumScheduling" useGeneratedKeys="true" keyProperty="id">
  33 + insert into rule_num_scheduling
  34 + <trim prefix="(" suffix=")" suffixOverrides=",">
  35 + <if test="ruleNumId != null">rule_num_id,</if>
  36 + <if test="ruleSchedulingId != null">rule_scheduling_id,</if>
  37 + <if test="matchName != null">match_name,</if>
  38 + </trim>
  39 + <trim prefix="values (" suffix=")" suffixOverrides=",">
  40 + <if test="ruleNumId != null">#{ruleNumId},</if>
  41 + <if test="ruleSchedulingId != null">#{ruleSchedulingId},</if>
  42 + <if test="matchName != null">#{matchName},</if>
  43 + </trim>
  44 + </insert>
  45 +
  46 + <update id="updateRuleNumScheduling" parameterType="RuleNumScheduling">
  47 + update rule_num_scheduling
  48 + <trim prefix="SET" suffixOverrides=",">
  49 + <if test="ruleNumId != null">rule_num_id = #{ruleNumId},</if>
  50 + <if test="ruleSchedulingId != null">rule_scheduling_id = #{ruleSchedulingId},</if>
  51 + <if test="matchName != null">match_name = #{matchName},</if>
  52 + </trim>
  53 + where id = #{id}
  54 + </update>
  55 +
  56 + <delete id="deleteRuleNumSchedulingById" parameterType="Long">
  57 + delete from rule_num_scheduling where id = #{id}
  58 + </delete>
  59 +
  60 + <delete id="deleteRuleNumSchedulingByIds" parameterType="String">
  61 + delete from rule_num_scheduling where id in
  62 + <foreach item="id" collection="array" open="(" separator="," close=")">
  63 + #{id}
  64 + </foreach>
  65 + </delete>
  66 +</mapper>
0 67 \ No newline at end of file
... ...
ruoyi-framework/src/main/java/com/ruoyi/framework/config/SecurityConfig.java
... ... @@ -111,7 +111,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter
111 111 // 过滤请求
112 112 .authorizeRequests()
113 113 // 对于登录login 注册register 验证码captchaImage 允许匿名访问
114   - .antMatchers("/app/version/check/**","/app/download","/driver/**","/in/**","/eexception/**","/equipment/**","/report/**","/login", "/register", "/captchaImage").permitAll()
  114 + .antMatchers("/app/version/check/**","/app/checkDeviceHeart","/app/download","/driver/**","/in/**","/eexception/**","/equipment/**","/report/**","/login", "/register", "/captchaImage").permitAll()
115 115 // 静态资源,可匿名访问
116 116 .antMatchers(HttpMethod.GET, "/", "/*.html", "/**/*.html", "/**/*.css", "/**/*.js", "/profile/**").permitAll()
117 117 .antMatchers("/swagger-ui.html", "/swagger-resources/**", "/webjars/**", "/*/api-docs", "/druid/**").permitAll()
... ...