Commit 4280fcf0fb075cd80f80d3a0d9f512ad758276f3

Authored by liujun001
1 parent df625c0c

蓝斯二期

Bsth-admin/src/main/java/com/ruoyi/BsthApplication.java
1 package com.ruoyi; 1 package com.ruoyi;
2 2
  3 +import com.ruoyi.utils.SpringApplicationUtil;
3 import org.slf4j.Logger; 4 import org.slf4j.Logger;
4 import org.slf4j.LoggerFactory; 5 import org.slf4j.LoggerFactory;
5 import org.springframework.boot.SpringApplication; 6 import org.springframework.boot.SpringApplication;
@@ -27,9 +28,11 @@ public class BsthApplication { @@ -27,9 +28,11 @@ public class BsthApplication {
27 28
28 private final static Logger log = LoggerFactory.getLogger(BsthApplication.class); 29 private final static Logger log = LoggerFactory.getLogger(BsthApplication.class);
29 30
  31 +
30 public static void main(String[] args) throws UnknownHostException { 32 public static void main(String[] args) throws UnknownHostException {
31 // System.setProperty("spring.devtools.restart.enabled", "false"); 33 // System.setProperty("spring.devtools.restart.enabled", "false");
32 ConfigurableApplicationContext app = SpringApplication.run(BsthApplication.class, args); 34 ConfigurableApplicationContext app = SpringApplication.run(BsthApplication.class, args);
  35 + SpringApplicationUtil.setApplicationContext(app);
33 Environment env = app.getEnvironment(); 36 Environment env = app.getEnvironment();
34 log.info("(♥◠‿◠)ノ゙ 岗前检测后台启动成功 ლ(´ڡ`ლ)゙ \n" + 37 log.info("(♥◠‿◠)ノ゙ 岗前检测后台启动成功 ლ(´ڡ`ლ)゙ \n" +
35 " .-------. ____ __ \n" + 38 " .-------. ____ __ \n" +
Bsth-admin/src/main/java/com/ruoyi/common/cache/SchedulingCache.java
@@ -5,6 +5,7 @@ import com.ruoyi.common.core.redis.RedisCache; @@ -5,6 +5,7 @@ import com.ruoyi.common.core.redis.RedisCache;
5 import com.ruoyi.pojo.response.ResponseSchedulingDto; 5 import com.ruoyi.pojo.response.ResponseSchedulingDto;
6 import com.ruoyi.utils.ConstDateUtil; 6 import com.ruoyi.utils.ConstDateUtil;
7 import org.apache.commons.collections4.CollectionUtils; 7 import org.apache.commons.collections4.CollectionUtils;
  8 +import org.apache.commons.lang3.time.DateUtils;
8 import org.slf4j.Logger; 9 import org.slf4j.Logger;
9 import org.slf4j.LoggerFactory; 10 import org.slf4j.LoggerFactory;
10 import org.springframework.beans.factory.annotation.Autowired; 11 import org.springframework.beans.factory.annotation.Autowired;
@@ -43,7 +44,7 @@ public class SchedulingCache { @@ -43,7 +44,7 @@ public class SchedulingCache {
43 private static final ConcurrentHashMap<String, Map<String, List<ResponseSchedulingDto>>> CONCURRENT_HASH_MAP = new ConcurrentHashMap<>(); 44 private static final ConcurrentHashMap<String, Map<String, List<ResponseSchedulingDto>>> CONCURRENT_HASH_MAP = new ConcurrentHashMap<>();
44 45
45 46
46 - public SchedulingCache(SchedulerProperty property,RedisCache redisCache) { 47 + public SchedulingCache(SchedulerProperty property, RedisCache redisCache) {
47 log.info("项目启动加载中获取实时班次并存入缓存-----"); 48 log.info("项目启动加载中获取实时班次并存入缓存-----");
48 this.redisCache = redisCache; 49 this.redisCache = redisCache;
49 schedulingInit(property); 50 schedulingInit(property);
@@ -57,21 +58,23 @@ public class SchedulingCache { @@ -57,21 +58,23 @@ public class SchedulingCache {
57 String formatNowDate = ConstDateUtil.formatDate(new Date()); 58 String formatNowDate = ConstDateUtil.formatDate(new Date());
58 String url = getUrl(formatNowDate, property); 59 String url = getUrl(formatNowDate, property);
59 log.info("初始化排班数据:{}", formatNowDate); 60 log.info("初始化排班数据:{}", formatNowDate);
60 - saveSchedulingToCache(url, formatNowDate); 61 + saveSchedulingToCache(url, formatNowDate, null, null);
61 String formatYesterdayDate = ConstDateUtil.formatDate(ConstDateUtil.getTheSpecifiedNumberOfDaysOfTime(-1)); 62 String formatYesterdayDate = ConstDateUtil.formatDate(ConstDateUtil.getTheSpecifiedNumberOfDaysOfTime(-1));
62 log.info("初始化排班数据:{}", formatYesterdayDate); 63 log.info("初始化排班数据:{}", formatYesterdayDate);
63 url = getUrlOld(formatYesterdayDate, property); 64 url = getUrlOld(formatYesterdayDate, property);
64 - saveSchedulingToCache(url, formatYesterdayDate); 65 + saveSchedulingToCache(url, formatYesterdayDate, null, null);
65 } 66 }
66 67
67 public String getUrl(String formatNowDate, SchedulerProperty property) { 68 public String getUrl(String formatNowDate, SchedulerProperty property) {
68 String url = null; 69 String url = null;
  70 + Date date = new Date();
  71 + long timestamp1 = DateUtils.addHours(date, -1).getTime();
69 long timestamp = System.currentTimeMillis(); 72 long timestamp = System.currentTimeMillis();
70 // String formatDate = ConstDateUtil.formatDate(ConstDateUtil.getTheSpecifiedNumberOfDaysOfTime(-1)); 73 // String formatDate = ConstDateUtil.formatDate(ConstDateUtil.getTheSpecifiedNumberOfDaysOfTime(-1));
71 // 获取排班请求 74 // 获取排班请求
72 String key = "Scheduling:timeStr:" + formatNowDate; 75 String key = "Scheduling:timeStr:" + formatNowDate;
73 try { 76 try {
74 - long timestampValue = timestamp; 77 + long timestampValue = timestamp1;
75 if (!redisCache.hasKey(key)) { 78 if (!redisCache.hasKey(key)) {
76 redisCache.setCacheObject(key, "1", 30, TimeUnit.HOURS); 79 redisCache.setCacheObject(key, "1", 30, TimeUnit.HOURS);
77 timestampValue = 0; 80 timestampValue = 0;
@@ -136,14 +139,9 @@ public class SchedulingCache { @@ -136,14 +139,9 @@ public class SchedulingCache {
136 } 139 }
137 140
138 141
139 - private Map<String, List<ResponseSchedulingDto>> saveSchedulingToCache(String getSchedulingInfoUrl, String dateKey) { 142 + private Map<String, List<ResponseSchedulingDto>> saveSchedulingToCache(String getSchedulingInfoUrl, String dateKey, RedisCache redisCache, String redisKey) {
140 log.info("开始拉取排班:{}", dateKey); 143 log.info("开始拉取排班:{}", dateKey);
141 - List<ResponseSchedulingDto> originSchedulingList = new RestTemplate().exchange(  
142 - getSchedulingInfoUrl,  
143 - HttpMethod.GET,  
144 - null,  
145 - new ParameterizedTypeReference<List<ResponseSchedulingDto>>() {  
146 - }).getBody(); 144 + List<ResponseSchedulingDto> originSchedulingList = requestScheduling(getSchedulingInfoUrl, redisCache, redisKey);
147 145
148 Map<String, List<ResponseSchedulingDto>> driverSchedulingMap = new HashMap<>(200); 146 Map<String, List<ResponseSchedulingDto>> driverSchedulingMap = new HashMap<>(200);
149 // 按照员工工号来获取排班信息 147 // 按照员工工号来获取排班信息
@@ -177,7 +175,7 @@ public class SchedulingCache { @@ -177,7 +175,7 @@ public class SchedulingCache {
177 return driverSchedulingMap; 175 return driverSchedulingMap;
178 } 176 }
179 177
180 - public List<ResponseSchedulingDto> requestScheduling(String getSchedulingInfoUrl) { 178 + public List<ResponseSchedulingDto> requestScheduling(String getSchedulingInfoUrl, RedisCache redisCache, String key) {
181 List<ResponseSchedulingDto> originSchedulingList = null; 179 List<ResponseSchedulingDto> originSchedulingList = null;
182 int index = 0; 180 int index = 0;
183 int size = 0; 181 int size = 0;
@@ -197,6 +195,11 @@ public class SchedulingCache { @@ -197,6 +195,11 @@ public class SchedulingCache {
197 } 195 }
198 } 196 }
199 197
  198 +
  199 + if (size > 0 && Objects.nonNull(redisCache)) {
  200 + redisCache.setCacheObject(key, "1", 30, TimeUnit.HOURS);
  201 + }
  202 +
200 return originSchedulingList; 203 return originSchedulingList;
201 } 204 }
202 205
Bsth-admin/src/main/java/com/ruoyi/config/FaceEngineConfig.java
@@ -9,6 +9,8 @@ import com.arcsoft.face.enums.DetectOrient; @@ -9,6 +9,8 @@ import com.arcsoft.face.enums.DetectOrient;
9 import com.arcsoft.face.enums.ErrorInfo; 9 import com.arcsoft.face.enums.ErrorInfo;
10 import com.ruoyi.exception.InterruptException; 10 import com.ruoyi.exception.InterruptException;
11 import lombok.extern.slf4j.Slf4j; 11 import lombok.extern.slf4j.Slf4j;
  12 +import org.apache.commons.lang3.StringUtils;
  13 +import org.springframework.beans.factory.annotation.Value;
12 import org.springframework.context.annotation.Bean; 14 import org.springframework.context.annotation.Bean;
13 import org.springframework.stereotype.Component; 15 import org.springframework.stereotype.Component;
14 16
@@ -24,8 +26,14 @@ import java.util.Objects; @@ -24,8 +26,14 @@ import java.util.Objects;
24 public class FaceEngineConfig { 26 public class FaceEngineConfig {
25 private FaceEngine faceEngine; 27 private FaceEngine faceEngine;
26 28
  29 + @Value("${spring.profiles.active}")
  30 + private String profilesActive;
  31 +
27 @Bean 32 @Bean
28 public FaceEngine createFaceEngine(BsthSystemConfig bsthSystemConfig) { 33 public FaceEngine createFaceEngine(BsthSystemConfig bsthSystemConfig) {
  34 + if(isDev()){
  35 + return null;
  36 + }
29 FaceEngine faceEngine = new FaceEngine(bsthSystemConfig.getFaceLibPath()); 37 FaceEngine faceEngine = new FaceEngine(bsthSystemConfig.getFaceLibPath());
30 // FaceEngine faceEngine = new FaceEngine("D:\\\\arcsoft_lib"); 38 // FaceEngine faceEngine = new FaceEngine("D:\\\\arcsoft_lib");
31 //激活引擎 39 //激活引擎
@@ -76,4 +84,8 @@ public class FaceEngineConfig { @@ -76,4 +84,8 @@ public class FaceEngineConfig {
76 faceEngine.unInit(); 84 faceEngine.unInit();
77 } 85 }
78 } 86 }
  87 +
  88 + public boolean isDev(){
  89 + return StringUtils.equals("druid-dev",profilesActive);
  90 + }
79 } 91 }
Bsth-admin/src/main/java/com/ruoyi/controller/RefreshController.java
@@ -65,6 +65,16 @@ public class RefreshController { @@ -65,6 +65,16 @@ public class RefreshController {
65 return ResponseResult.success(); 65 return ResponseResult.success();
66 } 66 }
67 67
  68 + @GetMapping(value = "/scheduling/{dateStr}")
  69 + @ApiOperation("scheduling")
  70 +// @PreAuthorize("@ss.hasPermi('refresh:scheduling')")
  71 + public ResponseResult<Boolean> scheduling(@PathVariable String dateStr) throws ParseException {
  72 + Date date = DateUtil.YYYY_MM_DD_LINK_HH_MM_SS.parse(dateStr);
  73 + driverJob.runScheduling(date.getTime());
  74 +
  75 + return ResponseResult.success();
  76 + }
  77 +
68 @GetMapping(value = "/key/info/local") 78 @GetMapping(value = "/key/info/local")
69 @ApiOperation("/key/info/local") 79 @ApiOperation("/key/info/local")
70 @PreAuthorize("@ss.hasPermi('refresh:key:info:local')") 80 @PreAuthorize("@ss.hasPermi('refresh:key:info:local')")
Bsth-admin/src/main/java/com/ruoyi/controller/dss/DssDriverController.java
@@ -36,6 +36,7 @@ import com.ruoyi.equipment.domain.Equipment; @@ -36,6 +36,7 @@ import com.ruoyi.equipment.domain.Equipment;
36 import com.ruoyi.equipment.service.IEquipmentService; 36 import com.ruoyi.equipment.service.IEquipmentService;
37 import com.ruoyi.exception.InterruptException; 37 import com.ruoyi.exception.InterruptException;
38 import com.ruoyi.framework.security.filter.JwtAuthenticationTokenFilter; 38 import com.ruoyi.framework.security.filter.JwtAuthenticationTokenFilter;
  39 +import com.ruoyi.in.domain.CalDriverScheduling;
39 import com.ruoyi.in.domain.SignIn; 40 import com.ruoyi.in.domain.SignIn;
40 import com.ruoyi.in.domain.SignInV1; 41 import com.ruoyi.in.domain.SignInV1;
41 import com.ruoyi.in.service.ISignInService; 42 import com.ruoyi.in.service.ISignInService;
@@ -167,20 +168,20 @@ public class DssDriverController extends BaseController { @@ -167,20 +168,20 @@ public class DssDriverController extends BaseController {
167 168
168 SignInResponseVo vo = new SignInResponseVo(); 169 SignInResponseVo vo = new SignInResponseVo();
169 if (Objects.nonNull(signInV1)) { 170 if (Objects.nonNull(signInV1)) {
170 - BeanUtils.copyProperties(signInV1,vo); 171 + BeanUtils.copyProperties(signInV1, vo);
171 172
172 vo.setDeviceId(signIn.getDeviceId()); 173 vo.setDeviceId(signIn.getDeviceId());
173 vo.setSiteName(signInV1.getEquipment().getName()); 174 vo.setSiteName(signInV1.getEquipment().getName());
174 vo.setName(signInV1.getDriver().getPersonnelName()); 175 vo.setName(signInV1.getDriver().getPersonnelName());
175 vo.setPosts(signInV1.getPosts()); 176 vo.setPosts(signInV1.getPosts());
176 - ResponseResult<DssSignVo> responseResult = ResponseResult.success(convertSignInVo(vo, dto, dictData,signInV1)); 177 + ResponseResult<DssSignVo> responseResult = ResponseResult.success(convertSignInVo(vo, dto, dictData, signInV1));
177 responseResult.setMsg(Convert.toStr(ajaxResult.get(AjaxResult.MSG_TAG))); 178 responseResult.setMsg(Convert.toStr(ajaxResult.get(AjaxResult.MSG_TAG)));
178 return responseResult; 179 return responseResult;
179 } 180 }
180 } 181 }
181 182
182 return ResponseResult.error(Convert.toInt(ajaxResult.get(AjaxResult.CODE_TAG)), Convert.toStr(ajaxResult.get(AjaxResult.MSG_TAG))); 183 return ResponseResult.error(Convert.toInt(ajaxResult.get(AjaxResult.CODE_TAG)), Convert.toStr(ajaxResult.get(AjaxResult.MSG_TAG)));
183 - } catch ( IOException e) { 184 + } catch (IOException e) {
184 log.error("签到信息异常,传入的参数为:[{}]", dto, e); 185 log.error("签到信息异常,传入的参数为:[{}]", dto, e);
185 return ResponseResult.error(); 186 return ResponseResult.error();
186 } 187 }
@@ -210,7 +211,7 @@ public class DssDriverController extends BaseController { @@ -210,7 +211,7 @@ public class DssDriverController extends BaseController {
210 211
211 SignInResponseVo vo = new SignInResponseVo(); 212 SignInResponseVo vo = new SignInResponseVo();
212 if (Objects.nonNull(signInV1)) { 213 if (Objects.nonNull(signInV1)) {
213 - BeanUtils.copyProperties(signInV1,vo); 214 + BeanUtils.copyProperties(signInV1, vo);
214 215
215 vo.setDeviceId(signIn.getDeviceId()); 216 vo.setDeviceId(signIn.getDeviceId());
216 vo.setSiteName(signInV1.getEquipment().getName()); 217 vo.setSiteName(signInV1.getEquipment().getName());
@@ -243,8 +244,12 @@ public class DssDriverController extends BaseController { @@ -243,8 +244,12 @@ public class DssDriverController extends BaseController {
243 return ResponseResult.error(TipEnum.TIP_401.getCode(), TipEnum.TIP_401.getMsg()); 244 return ResponseResult.error(TipEnum.TIP_401.getCode(), TipEnum.TIP_401.getMsg());
244 } 245 }
245 246
246 - SignIn signIn = convertSignIn(dto);  
247 - SignIn dataSignIn = signInService.getLastOne(signIn); 247 + CalDriverScheduling calDriverScheduling = signInServiceV1.findSchedulingByDateTime(dto.getStaffCode(), new Date(), 1);
  248 + if(Objects.isNull(calDriverScheduling) || Objects.isNull(calDriverScheduling.getDriverScheduling()) || Objects.isNull(calDriverScheduling.getDriverScheduling().getSignInId())){
  249 + return ResponseResult.success(convertGetWineRecordVo(null));
  250 + }
  251 +
  252 + SignIn dataSignIn = signInService.getById(calDriverScheduling.getDriverScheduling().getSignInId());
248 return ResponseResult.success(convertGetWineRecordVo(dataSignIn)); 253 return ResponseResult.success(convertGetWineRecordVo(dataSignIn));
249 } 254 }
250 255
@@ -509,6 +514,7 @@ public class DssDriverController extends BaseController { @@ -509,6 +514,7 @@ public class DssDriverController extends BaseController {
509 514
510 signIn.setCreateTime(dto.getSignTime()); 515 signIn.setCreateTime(dto.getSignTime());
511 signIn.setType(1); 516 signIn.setType(1);
  517 + signIn.setSingnIn("4");
512 518
513 if (Objects.nonNull(dto.getTestValue())) { 519 if (Objects.nonNull(dto.getTestValue())) {
514 signIn.setAlcoholFlag(ConstSignInConstSignInProperties.ALCOHOL_FLAG_YES); 520 signIn.setAlcoholFlag(ConstSignInConstSignInProperties.ALCOHOL_FLAG_YES);
@@ -600,7 +606,7 @@ public class DssDriverController extends BaseController { @@ -600,7 +606,7 @@ public class DssDriverController extends BaseController {
600 return resource; 606 return resource;
601 } 607 }
602 608
603 - private DssSignVo convertSignInVo(SignInResponseVo responseVo, DssSignDTO dto, SysDictData dictData,SignInV1 signInV1) { 609 + private DssSignVo convertSignInVo(SignInResponseVo responseVo, DssSignDTO dto, SysDictData dictData, SignInV1 signInV1) {
604 DssSignVo vo = new DssSignVo(); 610 DssSignVo vo = new DssSignVo();
605 vo.setTestId(Convert.toStr(responseVo.getId())); 611 vo.setTestId(Convert.toStr(responseVo.getId()));
606 612
@@ -611,7 +617,7 @@ public class DssDriverController extends BaseController { @@ -611,7 +617,7 @@ public class DssDriverController extends BaseController {
611 vo.setTestResult(1); 617 vo.setTestResult(1);
612 } 618 }
613 619
614 - Integer result = Objects.equals(1,signInV1.getSignIn().getStatus())?0:1; 620 + Integer result = Objects.equals(1, signInV1.getSignIn().getStatus()) ? 0 : 1;
615 vo.setResult(result); 621 vo.setResult(result);
616 622
617 return vo; 623 return vo;
@@ -622,13 +628,14 @@ public class DssDriverController extends BaseController { @@ -622,13 +628,14 @@ public class DssDriverController extends BaseController {
622 } 628 }
623 629
624 private GetWineRecordVo convertGetWineRecordVo(SignIn signIn) { 630 private GetWineRecordVo convertGetWineRecordVo(SignIn signIn) {
  631 + GetWineRecordVo vo = new GetWineRecordVo();
625 if (Objects.isNull(signIn)) { 632 if (Objects.isNull(signIn)) {
626 - return null; 633 + vo.setCheck(true);
  634 + return vo;
627 } 635 }
628 - GetWineRecordVo vo = new GetWineRecordVo();  
629 vo.setCheckTime(signIn.getCreateTime()); 636 vo.setCheckTime(signIn.getCreateTime());
630 637
631 - String key = REDIS_SIGN_IN_DRIVER_ALCOHOL_OVERFLOW + ConstDateUtil.formatDate("yyyyMMdd") + ":" + signIn.getJobCode(); 638 + String key = REDIS_SIGN_IN_DRIVER_ALCOHOL_OVERFLOW + ConstDateUtil.formatDate("yyyyMMdd") + ":" + signIn.getJobCode()+":"+signIn.getSchedulingId();
632 639
633 Integer count = redisCache.getCacheObject(key); 640 Integer count = redisCache.getCacheObject(key);
634 if (Objects.nonNull(count) && SIGN_IN_ERROR_COUNT.compareTo(count) <= 0) { 641 if (Objects.nonNull(count) && SIGN_IN_ERROR_COUNT.compareTo(count) <= 0) {
@@ -640,27 +647,27 @@ public class DssDriverController extends BaseController { @@ -640,27 +647,27 @@ public class DssDriverController extends BaseController {
640 return vo; 647 return vo;
641 } 648 }
642 649
643 - private LinggangScheduling convertScheduling(GetBusPlanListDTO dto) { 650 + private LinggangScheduling convertScheduling(GetBusPlanListDTO dto) {
644 LinggangScheduling scheduling = new LinggangScheduling(); 651 LinggangScheduling scheduling = new LinggangScheduling();
645 if (Objects.equals(1, dto.getDateType())) { 652 if (Objects.equals(1, dto.getDateType())) {
646 scheduling.setStartScheduleDate(DateUtil.shortDate(DateUtils.addDays(new Date(), 1))); 653 scheduling.setStartScheduleDate(DateUtil.shortDate(DateUtils.addDays(new Date(), 1)));
647 scheduling.setEndScheduleDate(DateUtils.addDays(scheduling.getStartScheduleDate(), 1)); 654 scheduling.setEndScheduleDate(DateUtils.addDays(scheduling.getStartScheduleDate(), 1));
648 655
649 - String timeStr = DateUtil.YYYY_MM_DD_LINK.format(scheduling.getEndScheduleDate())+" 06:00:00"; 656 + String timeStr = DateUtil.YYYY_MM_DD_LINK.format(scheduling.getEndScheduleDate()) + " 06:00:00";
650 try { 657 try {
651 scheduling.setFcsjT(DateUtil.YYYY_MM_DD_LINK.parse(timeStr).getTime()); 658 scheduling.setFcsjT(DateUtil.YYYY_MM_DD_LINK.parse(timeStr).getTime());
652 } catch (ParseException e) { 659 } catch (ParseException e) {
653 - log.error("格式化时间错误",e); 660 + log.error("格式化时间错误", e);
654 } 661 }
655 } else if (Objects.equals(0, dto.getDateType())) { 662 } else if (Objects.equals(0, dto.getDateType())) {
656 scheduling.setStartScheduleDate(DateUtil.shortDate(new Date())); 663 scheduling.setStartScheduleDate(DateUtil.shortDate(new Date()));
657 scheduling.setEndScheduleDate(DateUtils.addDays(scheduling.getStartScheduleDate(), 1)); 664 scheduling.setEndScheduleDate(DateUtils.addDays(scheduling.getStartScheduleDate(), 1));
658 665
659 - String timeStr = DateUtil.YYYY_MM_DD_LINK.format(scheduling.getEndScheduleDate())+" 06:00:00"; 666 + String timeStr = DateUtil.YYYY_MM_DD_LINK.format(scheduling.getEndScheduleDate()) + " 06:00:00";
660 try { 667 try {
661 scheduling.setFcsjT(DateUtil.YYYY_MM_DD_LINK.parse(timeStr).getTime()); 668 scheduling.setFcsjT(DateUtil.YYYY_MM_DD_LINK.parse(timeStr).getTime());
662 } catch (ParseException e) { 669 } catch (ParseException e) {
663 - log.error("格式化时间错误",e); 670 + log.error("格式化时间错误", e);
664 } 671 }
665 } else { 672 } else {
666 scheduling.setStartScheduleDate(DateUtil.shortDate(new Date())); 673 scheduling.setStartScheduleDate(DateUtil.shortDate(new Date()));
Bsth-admin/src/main/java/com/ruoyi/controller/dss2/DssDriverV2Controller.java 0 → 100644
  1 +package com.ruoyi.controller.dss2;
  2 +
  3 +import cn.hutool.core.convert.Convert;
  4 +import cn.hutool.crypto.asymmetric.Sign;
  5 +import com.ruoyi.common.ConstSignInConstSignInProperties;
  6 +import com.ruoyi.common.core.domain.AjaxResult;
  7 +import com.ruoyi.common.core.domain.entity.SysDictData;
  8 +import com.ruoyi.domain.driver.NewDriver;
  9 +import com.ruoyi.domain.dss.sign.vo.DssSignVo;
  10 +import com.ruoyi.domain.dss2.driver.dto.DssDetailSignV2DTO;
  11 +import com.ruoyi.domain.dss2.driver.dto.DssSignV2DTO;
  12 +import com.ruoyi.domain.dss2.driver.vo.DssSignInV2Vo;
  13 +import com.ruoyi.driver.service.IDriverService;
  14 +import com.ruoyi.in.domain.CalDriverScheduling;
  15 +import com.ruoyi.in.domain.SignIn;
  16 +import com.ruoyi.in.domain.SignInV1;
  17 +import com.ruoyi.in.service.ISignInService;
  18 +import com.ruoyi.in.service.SignInServiceV1;
  19 +import com.ruoyi.in.service.impl.SignInServiceImpl;
  20 +import com.ruoyi.pojo.response.SignInResponseVo;
  21 +import com.ruoyi.service.BigViewServiceV1;
  22 +import com.ruoyi.service.driver.NewDriverService;
  23 +import com.ruoyi.system.service.ISysDictDataService;
  24 +import io.swagger.annotations.Api;
  25 +import io.swagger.annotations.ApiOperation;
  26 +import lombok.extern.slf4j.Slf4j;
  27 +import org.springframework.beans.BeanUtils;
  28 +import org.springframework.beans.factory.annotation.Autowired;
  29 +import org.springframework.validation.BindingResult;
  30 +import org.springframework.web.bind.annotation.PostMapping;
  31 +import org.springframework.web.bind.annotation.RequestBody;
  32 +import org.springframework.web.bind.annotation.RequestMapping;
  33 +import org.springframework.web.bind.annotation.RestController;
  34 +import com.ruoyi.common.core.domain.ResponseResult;
  35 +
  36 +import java.util.Date;
  37 +import java.util.Objects;
  38 +
  39 +@RestController
  40 +@Slf4j
  41 +@RequestMapping("/dss/v2")
  42 +@Api(tags = "【蓝斯二期】设备信息")
  43 +public class DssDriverV2Controller {
  44 +
  45 + @Autowired
  46 + private SignInServiceV1 signInServiceV1;
  47 + @Autowired
  48 + private ISysDictDataService sysDictDataService;
  49 + @Autowired
  50 + private BigViewServiceV1 bigViewServiceV1;
  51 + @Autowired
  52 + private ISignInService signInService;
  53 + @Autowired
  54 + private NewDriverService newDriverService;
  55 +
  56 + @ApiOperation("线下签到")
  57 + @PostMapping("/offline/sign/in/add")
  58 + public ResponseResult<DssSignVo> addSign(@RequestBody DssSignV2DTO signV2DTO, BindingResult bindingResult) {
  59 + if (bindingResult.hasErrors()) {
  60 + return ResponseResult.error(bindingResult.getFieldError().getDefaultMessage());
  61 + }
  62 +
  63 + NewDriver driver = newDriverService.getOne(signV2DTO.getAuditJobCode());
  64 + if (Objects.isNull(driver)) {
  65 + return ResponseResult.error("无法查找到审核人员");
  66 + }
  67 +
  68 +
  69 + SignIn signIn = convertSignIn(signV2DTO);
  70 + signIn.setCreateBy(Convert.toStr(driver.getId()));
  71 + AjaxResult ajaxResult = signInServiceV1.addSignInOffice(signIn);
  72 +
  73 + if (Objects.nonNull(ajaxResult) && ajaxResult.isSuccess()) {
  74 + SysDictData sysDictData = new SysDictData();
  75 + sysDictData.setDictType("drinking");
  76 + SysDictData dictData = sysDictDataService.getOne(sysDictData);
  77 +
  78 + SignInV1 signInV1 = (SignInV1) ajaxResult.get(AjaxResult.DATA_TAG);
  79 +
  80 + SignInResponseVo vo = new SignInResponseVo();
  81 + if (Objects.nonNull(signInV1)) {
  82 + BeanUtils.copyProperties(signInV1, vo);
  83 +
  84 + vo.setDeviceId(signIn.getDeviceId());
  85 +
  86 + vo.setName(signInV1.getDriver().getPersonnelName());
  87 + vo.setPosts(signInV1.getPosts());
  88 + ResponseResult<DssSignVo> responseResult = ResponseResult.success(convertSignInVo(vo, signV2DTO, dictData, signInV1));
  89 + responseResult.setMsg(Convert.toStr(ajaxResult.get(AjaxResult.MSG_TAG)));
  90 + return responseResult;
  91 + }
  92 + }
  93 +
  94 + return ResponseResult.error(Convert.toInt(ajaxResult.get(AjaxResult.CODE_TAG)), Convert.toStr(ajaxResult.get(AjaxResult.MSG_TAG)));
  95 + }
  96 +
  97 + @ApiOperation("签到详情")
  98 + @PostMapping("/offline/sign/in")
  99 + public ResponseResult<DssSignInV2Vo> detailSignIn(@RequestBody DssDetailSignV2DTO signV2DTO, BindingResult bindingResult) {
  100 + if (bindingResult.hasErrors()) {
  101 + return ResponseResult.error(bindingResult.getFieldError().getDefaultMessage());
  102 + }
  103 +
  104 + Date date = signV2DTO.getDate();
  105 + if (Objects.isNull(date)) {
  106 + date = new Date();
  107 + }
  108 +
  109 + CalDriverScheduling calDriverScheduling = signInServiceV1.findSchedulingByDateTime(signV2DTO.getJobCode(), date, 1);
  110 + if (Objects.isNull(calDriverScheduling) || Objects.isNull(calDriverScheduling.getDriverScheduling())
  111 + || Objects.isNull(calDriverScheduling.getDriverScheduling().getSignInId())) {
  112 + return ResponseResult.success();
  113 + }
  114 + SignIn signIn = signInService.getById(calDriverScheduling.getDriverScheduling().getSignInId());
  115 + if (Objects.isNull(signIn)) {
  116 + return ResponseResult.success();
  117 + }
  118 + DssSignInV2Vo vo = convertDssSignInV2Vo(signIn);
  119 + return ResponseResult.success(vo);
  120 + }
  121 +
  122 +
  123 + private SignIn convertSignIn(DssSignV2DTO dto) {
  124 + SignIn signIn = new SignIn();
  125 +// signIn.setImage();
  126 + signIn.setJobCode(dto.getStaffCode());
  127 +
  128 + signIn.setCreateTime(dto.getSignTime());
  129 + signIn.setType(1);
  130 +
  131 + if (Objects.nonNull(dto.getTestValue())) {
  132 + signIn.setAlcoholFlag(ConstSignInConstSignInProperties.ALCOHOL_FLAG_YES);
  133 + signIn.setAlcoholIntake(Convert.toBigDecimal(dto.getTestValue()));
  134 + }
  135 + signIn.setSingnIn("104");
  136 + signIn.setImage(dto.getImageContent());
  137 +
  138 +// SysDictData sysDictData = querySystData(null,"drunkenness");
  139 +// if(Objects.nonNull(sysDictData)){
  140 +//
  141 +// }
  142 +
  143 + return signIn;
  144 + }
  145 +
  146 +
  147 + private DssSignVo convertSignInVo(SignInResponseVo responseVo, DssSignV2DTO dto, SysDictData dictData, SignInV1 signInV1) {
  148 + DssSignVo vo = new DssSignVo();
  149 + vo.setTestId(Convert.toStr(responseVo.getId()));
  150 +
  151 +
  152 + Integer testResult = bigViewServiceV1.isSignStatusZoneEnum(signInV1.getSignIn()) ? 2 : 0;
  153 + vo.setTestResult(testResult);
  154 + if (Objects.isNull(dictData) || Objects.equals(testResult, 0) && dto.getTestValue() > Convert.toLong(dictData.getDictValue())) {
  155 + vo.setTestResult(1);
  156 + }
  157 +
  158 + Integer result = Objects.equals(1, signInV1.getSignIn().getStatus()) ? 0 : 1;
  159 + vo.setResult(result);
  160 +
  161 + return vo;
  162 + }
  163 +
  164 + private DssSignInV2Vo convertDssSignInV2Vo(SignIn signIn) {
  165 + DssSignInV2Vo vo = new DssSignInV2Vo();
  166 + vo.setId(Convert.toInt(signIn.getId()));
  167 + vo.setStatus(signIn.getStatus());
  168 + vo.setType(signIn.getType());
  169 + vo.setExType(signIn.getExType());
  170 + vo.setAlcoholIntake(Convert.toStr(signIn.getAlcoholIntake()));
  171 + vo.setAlcoholFlag(signIn.getAlcoholFlag());
  172 + vo.setJobCode(signIn.getJobCode());
  173 + vo.setSignInDate(signIn.getCreateTime());
  174 +
  175 + return vo;
  176 + }
  177 +}
Bsth-admin/src/main/java/com/ruoyi/domain/DriverScheduling.java
@@ -28,8 +28,6 @@ public class DriverScheduling { @@ -28,8 +28,6 @@ public class DriverScheduling {
28 private String remark; 28 private String remark;
29 @TableField(exist = false) 29 @TableField(exist = false)
30 private String siteName; 30 private String siteName;
31 -  
32 - private Integer alcoholCount;  
33 /** 31 /**
34 * 不是当前表的属性 32 * 不是当前表的属性
35 */ 33 */
@@ -58,4 +56,6 @@ public class DriverScheduling { @@ -58,4 +56,6 @@ public class DriverScheduling {
58 56
59 @TableField(exist = false) 57 @TableField(exist = false)
60 private long minTime; 58 private long minTime;
  59 + @TableField(value = "alcohol_count")
  60 + private Integer alcoholCount;
61 } 61 }
Bsth-admin/src/main/java/com/ruoyi/domain/dss2/driver/dto/DssDetailSignV2DTO.java 0 → 100644
  1 +package com.ruoyi.domain.dss2.driver.dto;
  2 +
  3 +import com.alibaba.fastjson2.JSON;
  4 +import com.fasterxml.jackson.annotation.JsonFormat;
  5 +import io.swagger.annotations.ApiModel;
  6 +import io.swagger.annotations.ApiModelProperty;
  7 +import lombok.Data;
  8 +import lombok.experimental.Accessors;
  9 +
  10 +import javax.validation.constraints.NotEmpty;
  11 +import java.util.Date;
  12 +
  13 +@Data
  14 +@ApiModel(value = "查询人员签到")
  15 +@Accessors(chain = true)
  16 +public class DssDetailSignV2DTO {
  17 + @NotEmpty(message = "工号不能为空")
  18 + @ApiModelProperty(value = "工号")
  19 + private String jobCode;
  20 +
  21 + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
  22 + @ApiModelProperty(value = "查询时间,yyyy-MM-dd HH:mm:ss")
  23 + private Date date;
  24 +
  25 + @Override
  26 + public String toString() {
  27 + return JSON.toJSONString(this);
  28 + }
  29 +}
Bsth-admin/src/main/java/com/ruoyi/domain/dss2/driver/dto/DssSignV2DTO.java 0 → 100644
  1 +package com.ruoyi.domain.dss2.driver.dto;
  2 +
  3 +import com.alibaba.fastjson2.JSON;
  4 +import com.fasterxml.jackson.annotation.JsonFormat;
  5 +import com.ruoyi.domain.dss.sign.dto.DssSignHealthDataDTO;
  6 +import com.ruoyi.domain.dss.sign.dto.DssSignQuestionRecordDTO;
  7 +import io.swagger.annotations.ApiModel;
  8 +import io.swagger.annotations.ApiModelProperty;
  9 +import lombok.Data;
  10 +import lombok.EqualsAndHashCode;
  11 +import lombok.experimental.Accessors;
  12 +
  13 +import javax.validation.constraints.NotEmpty;
  14 +import javax.validation.constraints.NotNull;
  15 +import java.math.BigDecimal;
  16 +import java.util.Date;
  17 +
  18 +@Data
  19 +@ApiModel(value = "人员线下签到")
  20 +@Accessors(chain = true)
  21 +@EqualsAndHashCode(callSuper = false)
  22 +public class DssSignV2DTO {
  23 +
  24 + @NotEmpty(message = "司机工号 不能为空")
  25 + @ApiModelProperty(value = "司机工号", required = true)
  26 + private String staffCode;
  27 +
  28 + @NotEmpty(message = "审核人员工号 不能为空")
  29 + @ApiModelProperty(value = "审核人员工号", required = true)
  30 + private String auditJobCode;
  31 +
  32 + @NotNull(message = "时间不能为空")
  33 + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
  34 + @ApiModelProperty(value = "时间", required = true)
  35 + private Date signTime;
  36 +
  37 +
  38 + @ApiModelProperty(value = "酒测记录值")
  39 + private Integer testValue;
  40 +
  41 + @ApiModelProperty(value = "体温度值,null表示不需岗前检测")
  42 + private BigDecimal temperature;
  43 +
  44 + @ApiModelProperty(value = "情绪类型")
  45 + private Integer emotion;
  46 +
  47 + @ApiModelProperty(value = "问卷渠道")
  48 + private String channelCode;
  49 +
  50 + @ApiModelProperty(value = "健康数据有效性; 0:否,1:是")
  51 + private String healthCheck;
  52 +
  53 + @ApiModelProperty(value = "健康数据")
  54 + private DssSignHealthDataDTO healthData;
  55 +
  56 + @ApiModelProperty(value = "答题记录")
  57 + private DssSignQuestionRecordDTO questionRecord;
  58 + @ApiModelProperty(value = "图片内容Base64")
  59 + private String imageContent;
  60 +
  61 +
  62 + @Override
  63 + public String toString() {
  64 + String imageContent = this.getImageContent();
  65 + this.setImageContent(null);
  66 + String str = JSON.toJSONString(this);
  67 + this.setImageContent(imageContent);
  68 + return str;
  69 + }
  70 +}
Bsth-admin/src/main/java/com/ruoyi/domain/dss2/driver/vo/DssSignInV2Vo.java 0 → 100644
  1 +package com.ruoyi.domain.dss2.driver.vo;
  2 +
  3 +import com.alibaba.fastjson2.JSON;
  4 +import com.fasterxml.jackson.annotation.JsonFormat;
  5 +import io.swagger.annotations.ApiModel;
  6 +import io.swagger.annotations.ApiModelProperty;
  7 +import lombok.AllArgsConstructor;
  8 +import lombok.Data;
  9 +import lombok.NoArgsConstructor;
  10 +import lombok.experimental.Accessors;
  11 +
  12 +import java.util.Date;
  13 +
  14 +@Data
  15 +@NoArgsConstructor
  16 +@AllArgsConstructor
  17 +@Accessors(chain = true)
  18 +@ApiModel(value = "人员签到-详情VO")
  19 +public class DssSignInV2Vo {
  20 + @ApiModelProperty(value = "ID", example = "1")
  21 + private Integer id;
  22 +
  23 + @ApiModelProperty(value = "工号")
  24 + private String jobCode;
  25 +
  26 + @ApiModelProperty(value = "签到结果 1 成功 2 异常", example = "1")
  27 + private Integer status;
  28 +
  29 + @ApiModelProperty(value = "酒精测试 1 已测试 2 未测试", example = "1")
  30 + private Integer alcoholFlag;
  31 +
  32 + @ApiModelProperty(value = "签到签退 1 签到成功 2 签退成功", example = "1")
  33 + private Integer type;
  34 +
  35 + @ApiModelProperty(value = "酒精摄入量")
  36 + private String alcoholIntake;
  37 +
  38 + @ApiModelProperty(value = "异常类型:0=无异常,1=超时异常,2=无排班异常,3=酒精超标异常,44饮酒", example = "1")
  39 + private Integer exType;
  40 +
  41 + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
  42 + @ApiModelProperty(value = "签到时间,yyyy-MM-dd HH:mm:ss")
  43 + private Date signInDate;
  44 +
  45 + @Override
  46 + public String toString() {
  47 + return JSON.toJSONString(this);
  48 + }
  49 +}
Bsth-admin/src/main/java/com/ruoyi/domain/scheduling/LinggangScheduling.java
@@ -168,11 +168,11 @@ public class LinggangScheduling { @@ -168,11 +168,11 @@ public class LinggangScheduling {
168 if(Objects.isNull(linggangScheduling)){ 168 if(Objects.isNull(linggangScheduling)){
169 return false; 169 return false;
170 } 170 }
171 - return Objects.equals(this.getScheduleDate(),linggangScheduling.getScheduleDate()) && Objects.equals(this.lineName,linggangScheduling.getLineName())  
172 - && Objects.equals(this.jobCode,linggangScheduling.getJobCode()) && Objects.equals(this.name,linggangScheduling.getName()) && Objects.equals(this.posts,linggangScheduling.getPosts())  
173 - && Objects.equals(this.lpName,linggangScheduling.getLpName()) && Objects.equals(this.nbbm,linggangScheduling.getNbbm()) && Objects.equals(this.getBcType(),linggangScheduling.getBcType())  
174 - && Objects.equals(this.fcsjT,linggangScheduling.getFcsjT()) && Objects.equals(this.zdsjT,linggangScheduling.getZdsjT()) && Objects.equals(this.qdzcode,linggangScheduling.getQdzcode())  
175 - && Objects.equals(this.zdzcode,linggangScheduling.getZdzcode()) && Objects.equals(this.type,linggangScheduling.getType()); 171 + return Objects.equals(this.getScheduleDate(),linggangScheduling.getScheduleDate())
  172 + && Objects.equals(this.jobCode,linggangScheduling.getJobCode())
  173 + && Objects.equals(this.getBcType(),linggangScheduling.getBcType())
  174 + && Objects.equals(this.getNbbm(),linggangScheduling.getNbbm())
  175 + && Objects.equals(this.fcsjT,linggangScheduling.getFcsjT());
176 } 176 }
177 177
178 @Override 178 @Override
Bsth-admin/src/main/java/com/ruoyi/in/service/SignInServiceV1.java
@@ -2,11 +2,17 @@ package com.ruoyi.in.service; @@ -2,11 +2,17 @@ package com.ruoyi.in.service;
2 2
3 import com.baomidou.mybatisplus.extension.service.IService; 3 import com.baomidou.mybatisplus.extension.service.IService;
4 import com.ruoyi.common.core.domain.AjaxResult; 4 import com.ruoyi.common.core.domain.AjaxResult;
  5 +import com.ruoyi.in.domain.CalDriverScheduling;
5 import com.ruoyi.in.domain.SignIn; 6 import com.ruoyi.in.domain.SignIn;
6 import com.ruoyi.in.domain.SignInV1; 7 import com.ruoyi.in.domain.SignInV1;
7 8
8 import java.io.IOException; 9 import java.io.IOException;
  10 +import java.util.Date;
9 11
10 public interface SignInServiceV1 extends IService<SignInV1> { 12 public interface SignInServiceV1 extends IService<SignInV1> {
11 AjaxResult addsignInV1(SignIn signIn) throws IOException; 13 AjaxResult addsignInV1(SignIn signIn) throws IOException;
  14 +
  15 + AjaxResult addSignInOffice(SignIn signIn);
  16 +
  17 + CalDriverScheduling findSchedulingByDateTime(String job, Date date,Integer type);
12 } 18 }
Bsth-admin/src/main/java/com/ruoyi/in/service/impl/SignInServiceV1Impl.java
1 package com.ruoyi.in.service.impl; 1 package com.ruoyi.in.service.impl;
2 2
  3 +import cn.hutool.core.convert.Convert;
3 import com.alibaba.fastjson2.JSON; 4 import com.alibaba.fastjson2.JSON;
4 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; 5 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
5 import com.ruoyi.common.ConstDriverProperties; 6 import com.ruoyi.common.ConstDriverProperties;
@@ -13,10 +14,12 @@ import com.ruoyi.common.core.redis.RedisCache; @@ -13,10 +14,12 @@ import com.ruoyi.common.core.redis.RedisCache;
13 import com.ruoyi.common.redispre.GlobalRedisPreName; 14 import com.ruoyi.common.redispre.GlobalRedisPreName;
14 import com.ruoyi.common.utils.DateUtils; 15 import com.ruoyi.common.utils.DateUtils;
15 import com.ruoyi.common.utils.StringUtils; 16 import com.ruoyi.common.utils.StringUtils;
  17 +import com.ruoyi.common.utils.file.FileUtils;
16 import com.ruoyi.common.utils.ip.IpUtils; 18 import com.ruoyi.common.utils.ip.IpUtils;
17 import com.ruoyi.common.utils.uuid.Seq; 19 import com.ruoyi.common.utils.uuid.Seq;
18 import com.ruoyi.common.utils.uuid.UUID; 20 import com.ruoyi.common.utils.uuid.UUID;
19 import com.ruoyi.domain.DriverScheduling; 21 import com.ruoyi.domain.DriverScheduling;
  22 +import com.ruoyi.domain.sign.in.resource.LinggangSignInResource;
20 import com.ruoyi.driver.domain.Driver; 23 import com.ruoyi.driver.domain.Driver;
21 import com.ruoyi.driver.mapper.DriverMapper; 24 import com.ruoyi.driver.mapper.DriverMapper;
22 import com.ruoyi.equipment.domain.Equipment; 25 import com.ruoyi.equipment.domain.Equipment;
@@ -32,7 +35,9 @@ import com.ruoyi.scheduling.service.SchedulingServiceV1; @@ -32,7 +35,9 @@ import com.ruoyi.scheduling.service.SchedulingServiceV1;
32 import com.ruoyi.service.BigViewServiceV1; 35 import com.ruoyi.service.BigViewServiceV1;
33 import com.ruoyi.service.SchedulingService; 36 import com.ruoyi.service.SchedulingService;
34 import com.ruoyi.service.ThreadJobService; 37 import com.ruoyi.service.ThreadJobService;
  38 +import com.ruoyi.service.sign.in.resource.LinggangSignInResourceService;
35 import com.ruoyi.utils.ConstDateUtil; 39 import com.ruoyi.utils.ConstDateUtil;
  40 +import com.ruoyi.utils.UploadUtil;
36 import lombok.extern.slf4j.Slf4j; 41 import lombok.extern.slf4j.Slf4j;
37 import org.apache.commons.collections4.CollectionUtils; 42 import org.apache.commons.collections4.CollectionUtils;
38 import org.apache.commons.io.FilenameUtils; 43 import org.apache.commons.io.FilenameUtils;
@@ -75,6 +80,10 @@ public class SignInServiceV1Impl extends ServiceImpl&lt;SignInMapperV1, SignInV1&gt; i @@ -75,6 +80,10 @@ public class SignInServiceV1Impl extends ServiceImpl&lt;SignInMapperV1, SignInV1&gt; i
75 80
76 @Autowired 81 @Autowired
77 private RedisCache redisCache; 82 private RedisCache redisCache;
  83 + @Autowired
  84 + private UploadUtil uploadUtil;
  85 + @Autowired
  86 + private LinggangSignInResourceService signInResourceService;
78 87
79 private static final FastDateFormat HHMM = FastDateFormat.getInstance("HH:mm"); 88 private static final FastDateFormat HHMM = FastDateFormat.getInstance("HH:mm");
80 89
@@ -123,12 +132,74 @@ public class SignInServiceV1Impl extends ServiceImpl&lt;SignInMapperV1, SignInV1&gt; i @@ -123,12 +132,74 @@ public class SignInServiceV1Impl extends ServiceImpl&lt;SignInMapperV1, SignInV1&gt; i
123 } else if (Objects.equals(2, signIn.getType())) { 132 } else if (Objects.equals(2, signIn.getType())) {
124 calDriverScheduling = findSchedulingByDateTime(schedulings, dateTime, ConstDriverProperties.BC_TYPE_IN); 133 calDriverScheduling = findSchedulingByDateTime(schedulings, dateTime, ConstDriverProperties.BC_TYPE_IN);
125 } else { 134 } else {
  135 + calDriverScheduling = findSchedulingByDateTime(schedulings, dateTime, ConstDriverProperties.BC_TYPE_OUT);
  136 +
126 if (checkAlcoholIntake(signIn.getAlcoholIntake())) { 137 if (checkAlcoholIntake(signIn.getAlcoholIntake())) {
127 - AjaxResult ajaxResult = bigViewServiceV1.getAjaxResultByDriverSignInfo(signIn,signInV1,calDriverScheduling.getDriverScheduling()); 138 + AjaxResult ajaxResult = bigViewServiceV1.getAjaxResultByDriverSignInfo(signIn, signInV1, calDriverScheduling.getDriverScheduling());
128 if (Objects.nonNull(ajaxResult)) { 139 if (Objects.nonNull(ajaxResult)) {
129 return ajaxResult; 140 return ajaxResult;
130 } 141 }
131 } 142 }
  143 +
  144 + }
  145 +
  146 + if (Objects.isNull(calDriverScheduling.getDriverScheduling())) {
  147 + log.info("当天没有满足要求的数据:dateTime:[{}],signIn:[{}],scheduling:[{}]", dateTime, signIn, JSON.toJSONString(scheduling));
  148 + saveSignOfNoScheduling(signIn, ErrorTypeProperties.WORK_DAY_ERROR);
  149 + return AjaxResult.success(ErrorTypeProperties.WORK_DAY_ERROR);
  150 + }
  151 +
  152 + scheduling = calDriverScheduling.getDriverScheduling();
  153 + signInV1.setDriverScheduling(calDriverScheduling.getDriverScheduling());
  154 +
  155 + if (Objects.isNull(scheduling.getSignInId())) {
  156 + switchAndChooseTime(signIn, scheduling, dateTime);
  157 + switchAndChooseAlcohol(signIn, driver, scheduling);
  158 +
  159 + } else {
  160 + log.info("签到的数据为:[{}]", scheduling);
  161 + SignInV1 sourceSign = getById(scheduling.getSignInId());
  162 + if (Objects.nonNull(sourceSign)) {
  163 + switchAndChooseTime(signIn, scheduling, dateTime);
  164 + switchAndChooseAlcohol(signIn, driver, scheduling);
  165 + }
  166 + }
  167 +
  168 + signInV1.setSignIn(signIn);
  169 +
  170 + return saveData(signIn, scheduling, calDriverScheduling, driver, signInV1);
  171 + }
  172 +
  173 + @Override
  174 + public AjaxResult addSignInOffice(SignIn signIn) {
  175 + SignInV1 signInV1 = new SignInV1();
  176 + signInV1.setSignIn(signIn);
  177 +
  178 + // 查询员工信息
  179 + Driver driver = driverMapper.getDriverInfoByJobCode(signIn.getJobCode());
  180 + if (Objects.isNull(driver)) {
  181 + log.info("这个工号的员工不存在:[{}]", signIn);
  182 + return AjaxResult.warn("这个工号的员工不存在!");
  183 + }
  184 + signInV1.setDriver(driver);
  185 +
  186 + if (Objects.isNull(signIn.getCreateTime())) {
  187 + signIn.setCreateTime(DateUtils.getNowDate());
  188 + }
  189 +
  190 + long dateTime = signIn.getCreateTime().getTime();
  191 + Date date = DateUtils.shortDate(new Date(dateTime));
  192 + DriverScheduling scheduling = null;
  193 + CalDriverScheduling calDriverScheduling = null;
  194 +
  195 + List<DriverSchedulingV1> schedulings = schedulingServiceV1.queryByJobCodeAndSchedulingDate(signIn.getJobCode(), date);
  196 + if (CollectionUtils.isEmpty(schedulings)) {
  197 + saveSignOfNoScheduling(signIn, ErrorTypeProperties.WORK_DAY_ERROR);
  198 + switchAndChooseAlcohol(signIn, driver, null);
  199 + return saveData(signIn, null, null, driver, signInV1);
  200 + } else if (Objects.equals(2, signIn.getType())) {
  201 + calDriverScheduling = findSchedulingByDateTime(schedulings, dateTime, ConstDriverProperties.BC_TYPE_IN);
  202 + } else {
132 calDriverScheduling = findSchedulingByDateTime(schedulings, dateTime, ConstDriverProperties.BC_TYPE_OUT); 203 calDriverScheduling = findSchedulingByDateTime(schedulings, dateTime, ConstDriverProperties.BC_TYPE_OUT);
133 } 204 }
134 205
@@ -146,7 +217,7 @@ public class SignInServiceV1Impl extends ServiceImpl&lt;SignInMapperV1, SignInV1&gt; i @@ -146,7 +217,7 @@ public class SignInServiceV1Impl extends ServiceImpl&lt;SignInMapperV1, SignInV1&gt; i
146 switchAndChooseAlcohol(signIn, driver, scheduling); 217 switchAndChooseAlcohol(signIn, driver, scheduling);
147 218
148 } else { 219 } else {
149 - log.info("签到的数据为:[{}]",scheduling); 220 + log.info("签到的数据为:[{}]", scheduling);
150 SignInV1 sourceSign = getById(scheduling.getSignInId()); 221 SignInV1 sourceSign = getById(scheduling.getSignInId());
151 if (Objects.nonNull(sourceSign)) { 222 if (Objects.nonNull(sourceSign)) {
152 switchAndChooseTime(signIn, scheduling, dateTime); 223 switchAndChooseTime(signIn, scheduling, dateTime);
@@ -156,16 +227,62 @@ public class SignInServiceV1Impl extends ServiceImpl&lt;SignInMapperV1, SignInV1&gt; i @@ -156,16 +227,62 @@ public class SignInServiceV1Impl extends ServiceImpl&lt;SignInMapperV1, SignInV1&gt; i
156 227
157 signInV1.setSignIn(signIn); 228 signInV1.setSignIn(signIn);
158 229
  230 +
  231 +
159 return saveData(signIn, scheduling, calDriverScheduling, driver, signInV1); 232 return saveData(signIn, scheduling, calDriverScheduling, driver, signInV1);
160 } 233 }
161 234
162 - private AjaxResult saveData(SignIn signIn, DriverScheduling scheduling, CalDriverScheduling calDriverScheduling, Driver driver, SignInV1 signInV1) { 235 + @Override
  236 + public CalDriverScheduling findSchedulingByDateTime(String job, Date date, Integer type) {
  237 + long dateTime = date.getTime();
  238 + List<DriverSchedulingV1> schedulings = schedulingServiceV1.queryByJobCodeAndSchedulingDate(job, date);
  239 + if (CollectionUtils.isEmpty(schedulings)) {
  240 + return null;
  241 + } else if (Objects.equals(2, type)) {
  242 + return findSchedulingByDateTime(schedulings, dateTime, ConstDriverProperties.BC_TYPE_IN);
  243 + } else {
  244 + return findSchedulingByDateTime(schedulings, dateTime, ConstDriverProperties.BC_TYPE_OUT);
  245 + }
  246 + }
163 247
  248 + private AjaxResult saveData(SignIn signIn, DriverScheduling scheduling, CalDriverScheduling calDriverScheduling, Driver driver, SignInV1 signInV1) {
  249 + String videoContent = signIn.getImage();
  250 + signIn.setImage(null);
164 signInMapper.insertSignIn(signIn); 251 signInMapper.insertSignIn(signIn);
  252 +
  253 + if (org.apache.commons.lang3.StringUtils.isNotEmpty(signIn.getImage())) {
  254 +
  255 + signIn.setImage(null);
  256 + }
  257 + if(org.apache.commons.lang3.StringUtils.isNotEmpty(videoContent)){
  258 + StringBuilder builder = new StringBuilder();
  259 + builder.append("sign");
  260 + builder.append(File.separator);
  261 + builder.append("images");
  262 + builder.append(File.separator);
  263 + builder.append("offline");
  264 + builder.append(File.separator);
  265 + builder.append(signIn.getId());
  266 + builder.append(File.separator);
  267 + builder.append(java.util.UUID.randomUUID().toString().replace("-", ""));
  268 + builder.append(".mp4");
  269 +
  270 + uploadUtil.uploadVideoOfBase64(videoContent, builder.toString());
  271 +
  272 + LinggangSignInResource signInResource = new LinggangSignInResource();
  273 + signInResource.setSignId(signIn.getId());
  274 + signInResource.setResourceType(2);
  275 + signInResource.setTime(new Date(scheduling.getFcsjT()));
  276 + signInResource.setCreateTime(new Date());
  277 + signInResource.setPath(builder.toString());
  278 + signInResource.setIndex1(4);
  279 + signInResource.setCreateBy(Convert.toLong(signIn.getCreateBy()));
  280 + signInResourceService.save(signInResource);
  281 + }
165 signInV1.setId(signInV1.getId()); 282 signInV1.setId(signInV1.getId());
166 // 更新考勤 283 // 更新考勤
167 if (Objects.nonNull(calDriverScheduling)) { 284 if (Objects.nonNull(calDriverScheduling)) {
168 - schedulingService.computedSignInBySignIn(scheduling, calDriverScheduling.getIndex(), signIn,true); 285 + schedulingService.computedSignInBySignIn(scheduling, calDriverScheduling.getIndex(), signIn, true);
169 } 286 }
170 287
171 if (TempCache.checkJobCodeExist(signIn.getJobCode())) { 288 if (TempCache.checkJobCodeExist(signIn.getJobCode())) {
Bsth-admin/src/main/java/com/ruoyi/job/DriverJob.java
@@ -264,6 +264,7 @@ public class DriverJob implements InitializingBean { @@ -264,6 +264,7 @@ public class DriverJob implements InitializingBean {
264 public void runScheduling(long timeLong) { 264 public void runScheduling(long timeLong) {
265 long timestamp = System.currentTimeMillis(); 265 long timestamp = System.currentTimeMillis();
266 Date date = new Date(timeLong); 266 Date date = new Date(timeLong);
  267 +// date = DateUtils.addHours(date,-1);
267 String formatDate = DateUtil.YYYY_MM_DD.format(date); 268 String formatDate = DateUtil.YYYY_MM_DD.format(date);
268 String timeOut = DateUtil.HH_MM_ss.format(date); 269 String timeOut = DateUtil.HH_MM_ss.format(date);
269 270
@@ -273,7 +274,8 @@ public class DriverJob implements InitializingBean { @@ -273,7 +274,8 @@ public class DriverJob implements InitializingBean {
273 274
274 log.info("开始获取{}的排班数据", formatDate); 275 log.info("开始获取{}的排班数据", formatDate);
275 boolean isSameDay = DateUtils.isSameDay(new Date(), date); 276 boolean isSameDay = DateUtils.isSameDay(new Date(), date);
276 - String url = isSameDay ? GET_SCHEDULING_INFO_URL : getSchedulingInfoPlan; 277 + int hour = date.getHours();
  278 + String url = isSameDay ? hour < 5 ? property.getGetSchedulingInfo() : GET_SCHEDULING_INFO_URL : getSchedulingInfoPlan;
277 int type = isSameDay ? 1 : 100; 279 int type = isSameDay ? 1 : 100;
278 280
279 LinggangScheduling scheduling = new LinggangScheduling(); 281 LinggangScheduling scheduling = new LinggangScheduling();
@@ -281,24 +283,30 @@ public class DriverJob implements InitializingBean { @@ -281,24 +283,30 @@ public class DriverJob implements InitializingBean {
281 scheduling.setEndScheduleDate(DateUtils.addDays(scheduling.getStartScheduleDate(), 1)); 283 scheduling.setEndScheduleDate(DateUtils.addDays(scheduling.getStartScheduleDate(), 1));
282 284
283 Set<Long> idSets = null; 285 Set<Long> idSets = null;
  286 + String key = "Scheduling:timeStr:" + formatDate;
284 if (isSameDay) { 287 if (isSameDay) {
285 - String key = "Scheduling:timeStr:" + formatDate;  
286 - long timestampValu = timestamp;  
287 - if (!redisCache.hasKey(key)) {  
288 - redisCache.setCacheObject(key, "1", 30, TimeUnit.HOURS);  
289 - timestampValu = 0;  
290 - } 288 + long timestampValu = DateUtils.addHours(date, -1).getTime();
291 scheduling.setType(100); 289 scheduling.setType(100);
292 List<LinggangScheduling> linggangSchedulings = schedulingService.list(scheduling); 290 List<LinggangScheduling> linggangSchedulings = schedulingService.list(scheduling);
293 idSets = linggangSchedulings.stream().map(LinggangScheduling::getId).collect(Collectors.toSet()); 291 idSets = linggangSchedulings.stream().map(LinggangScheduling::getId).collect(Collectors.toSet());
294 292
295 - try {  
296 - log.info("url:[{}];formatDate:[{}];timestamp:[{}]", url, formatDate, timestamp);  
297 - getSchedulingInfoUrl = String.format(url, "77", formatDate, timestampValu, timestamp, NONCE, PASSWORD, getSHA1(getStringStringMap(String.valueOf(timestamp))));  
298 - } catch (Exception e) {  
299 - throw new RuntimeException(e);  
300 - } 293 + if (hour < 5) {
  294 + try {
  295 + log.info("url:[{}];formatDate:[{}];timestamp:[{}]", url, formatDate, timestamp);
  296 + getSchedulingInfoUrl = String.format(url, "77", formatDate, timestamp, NONCE, PASSWORD, getSHA1(getStringStringMap(String.valueOf(timestamp))));
  297 + } catch (Exception e) {
  298 + throw new RuntimeException(e);
  299 + }
  300 + } else {
  301 + try {
  302 + timestampValu = 0;
  303 + log.info("url:[{}];formatDate:[{}];timestamp:[{}]", url, formatDate, timestamp);
  304 + getSchedulingInfoUrl = String.format(url, "77", formatDate, timestampValu, timestamp, NONCE, PASSWORD, getSHA1(getStringStringMap(String.valueOf(timestamp))));
  305 + } catch (Exception e) {
  306 + throw new RuntimeException(e);
  307 + }
301 308
  309 + }
302 } else { 310 } else {
303 try { 311 try {
304 log.info("url:[{}];formatDate:[{}];timestamp:[{}]", url, formatDate, timestamp); 312 log.info("url:[{}];formatDate:[{}];timestamp:[{}]", url, formatDate, timestamp);
@@ -313,7 +321,7 @@ public class DriverJob implements InitializingBean { @@ -313,7 +321,7 @@ public class DriverJob implements InitializingBean {
313 321
314 String requestId = JwtAuthenticationTokenFilter.getRequestIdOfMDCValue(); 322 String requestId = JwtAuthenticationTokenFilter.getRequestIdOfMDCValue();
315 // 获取排班信息并存入redis 323 // 获取排班信息并存入redis
316 - saveSchedulingToRedis(getSchedulingInfoUrl, formatDate, timeOut, date, type, idSets, requestId); 324 + saveSchedulingToRedis(getSchedulingInfoUrl, formatDate, timeOut, date, type, idSets, requestId, redisCache, key);
317 // 删除两天前排班信息 325 // 删除两天前排班信息
318 if (isSameDay) { 326 if (isSameDay) {
319 deleteScheduling(); 327 deleteScheduling();
@@ -410,10 +418,10 @@ public class DriverJob implements InitializingBean { @@ -410,10 +418,10 @@ public class DriverJob implements InitializingBean {
410 } 418 }
411 419
412 420
413 - public Map<String, List<ResponseSchedulingDto>> saveSchedulingToRedis(String getSchedulingInfoUrl, String dateKey, String timeOut, Date date, int type, Set<Long> idSets, String requestId) { 421 + public Map<String, List<ResponseSchedulingDto>> saveSchedulingToRedis(String getSchedulingInfoUrl, String dateKey, String timeOut, Date date, int type, Set<Long> idSets, String requestId, RedisCache redisCache, String redisKey) {
414 JwtAuthenticationTokenFilter.putMDC("job", requestId); 422 JwtAuthenticationTokenFilter.putMDC("job", requestId);
415 log.info("开始拉取排班:{};[{}]", dateKey, getSchedulingInfoUrl); 423 log.info("开始拉取排班:{};[{}]", dateKey, getSchedulingInfoUrl);
416 - List<ResponseSchedulingDto> originSchedulingList = schedulingCache.requestScheduling(getSchedulingInfoUrl); 424 + List<ResponseSchedulingDto> originSchedulingList = schedulingCache.requestScheduling(getSchedulingInfoUrl, redisCache, redisKey);
417 log.info("originSchedulingList:[{}]", JSON.toJSONString(originSchedulingList)); 425 log.info("originSchedulingList:[{}]", JSON.toJSONString(originSchedulingList));
418 Map<String, List<ResponseSchedulingDto>> driverSchedulingMap = new HashMap<>(200); 426 Map<String, List<ResponseSchedulingDto>> driverSchedulingMap = new HashMap<>(200);
419 // 以员工号为key存入排班集合 427 // 以员工号为key存入排班集合
Bsth-admin/src/main/java/com/ruoyi/service/BigViewServiceV1.java
@@ -7,6 +7,7 @@ import com.ruoyi.in.domain.SignIn; @@ -7,6 +7,7 @@ import com.ruoyi.in.domain.SignIn;
7 import com.ruoyi.in.domain.SignInV1; 7 import com.ruoyi.in.domain.SignInV1;
8 import com.ruoyi.pojo.vo.bigViewVo.FleetState; 8 import com.ruoyi.pojo.vo.bigViewVo.FleetState;
9 import com.ruoyi.pojo.vo.bigViewVo.LineInfo; 9 import com.ruoyi.pojo.vo.bigViewVo.LineInfo;
  10 +import com.ruoyi.scheduling.domain.DriverSchedulingV1;
10 11
11 import java.util.Date; 12 import java.util.Date;
12 13
@@ -28,7 +29,7 @@ public interface BigViewServiceV1 { @@ -28,7 +29,7 @@ public interface BigViewServiceV1 {
28 * @param signIn 29 * @param signIn
29 * @return com.ruoyi.common.core.domain.AjaxResult 30 * @return com.ruoyi.common.core.domain.AjaxResult
30 */ 31 */
31 - AjaxResult getAjaxResultByDriverSignInfo(SignIn signIn,SignInV1 signInV1,DriverScheduling scheduling); 32 + AjaxResult getAjaxResultByDriverSignInfo(SignIn signIn, SignInV1 signInV1, DriverScheduling driverScheduling);
32 33
33 /*** 34 /***
34 * 是否是早签 35 * 是否是早签
Bsth-admin/src/main/java/com/ruoyi/service/ThreadJobService.java
@@ -50,7 +50,6 @@ import org.springframework.scheduling.annotation.EnableAsync; @@ -50,7 +50,6 @@ import org.springframework.scheduling.annotation.EnableAsync;
50 import org.springframework.stereotype.Component; 50 import org.springframework.stereotype.Component;
51 import org.springframework.transaction.PlatformTransactionManager; 51 import org.springframework.transaction.PlatformTransactionManager;
52 import org.springframework.transaction.TransactionStatus; 52 import org.springframework.transaction.TransactionStatus;
53 -import org.springframework.transaction.annotation.Transactional;  
54 import org.springframework.transaction.support.DefaultTransactionDefinition; 53 import org.springframework.transaction.support.DefaultTransactionDefinition;
55 import org.springframework.web.client.RestTemplate; 54 import org.springframework.web.client.RestTemplate;
56 import sun.misc.BASE64Decoder; 55 import sun.misc.BASE64Decoder;
@@ -490,7 +489,6 @@ public class ThreadJobService { @@ -490,7 +489,6 @@ public class ThreadJobService {
490 * @param timeOut 489 * @param timeOut
491 */ 490 */
492 @Async 491 @Async
493 - @Transactional(rollbackFor = {Exception.class})  
494 public synchronized void asyncComputedScheduling(Map<String, List<ResponseSchedulingDto>> originSchedulingMap, String timeOut, Date date, int type, Set<Long> idSets, String requestId) { 492 public synchronized void asyncComputedScheduling(Map<String, List<ResponseSchedulingDto>> originSchedulingMap, String timeOut, Date date, int type, Set<Long> idSets, String requestId) {
495 JwtAuthenticationTokenFilter.putMDC("job", requestId); 493 JwtAuthenticationTokenFilter.putMDC("job", requestId);
496 // //查询当天是否保存过考情表 如果不存在则保存 494 // //查询当天是否保存过考情表 如果不存在则保存
@@ -619,7 +617,10 @@ public class ThreadJobService { @@ -619,7 +617,10 @@ public class ThreadJobService {
619 if(CollectionUtils.isNotEmpty(schedulings1)){ 617 if(CollectionUtils.isNotEmpty(schedulings1)){
620 System.out.println("bbbbbbbbbbb"); 618 System.out.println("bbbbbbbbbbb");
621 } 619 }
622 - schedulingService.saveBatch(schedulings); 620 + for (LinggangScheduling linggangScheduling : schedulings) {
  621 + schedulingService.save(linggangScheduling);
  622 + }
  623 +
623 } 624 }
624 } 625 }
625 String dateStr1 = DateUtil.YYYY_MM_DD_LINK.format(date); 626 String dateStr1 = DateUtil.YYYY_MM_DD_LINK.format(date);
Bsth-admin/src/main/java/com/ruoyi/service/impl/BigViewServiceV1Impl.java
@@ -13,6 +13,7 @@ import com.ruoyi.in.service.SignInServiceV1; @@ -13,6 +13,7 @@ import com.ruoyi.in.service.SignInServiceV1;
13 import com.ruoyi.pojo.vo.bigViewVo.FleetInfoVo; 13 import com.ruoyi.pojo.vo.bigViewVo.FleetInfoVo;
14 import com.ruoyi.pojo.vo.bigViewVo.FleetState; 14 import com.ruoyi.pojo.vo.bigViewVo.FleetState;
15 import com.ruoyi.pojo.vo.bigViewVo.LineInfo; 15 import com.ruoyi.pojo.vo.bigViewVo.LineInfo;
  16 +import com.ruoyi.scheduling.domain.DriverSchedulingV1;
16 import com.ruoyi.scheduling.service.SchedulingServiceV1; 17 import com.ruoyi.scheduling.service.SchedulingServiceV1;
17 import com.ruoyi.service.BigViewServiceV1; 18 import com.ruoyi.service.BigViewServiceV1;
18 import com.ruoyi.template.service.IFleetLineTemplateService; 19 import com.ruoyi.template.service.IFleetLineTemplateService;
@@ -92,20 +93,26 @@ public class BigViewServiceV1Impl implements BigViewServiceV1 { @@ -92,20 +93,26 @@ public class BigViewServiceV1Impl implements BigViewServiceV1 {
92 } 93 }
93 94
94 @Override 95 @Override
95 - public AjaxResult getAjaxResultByDriverSignInfo(SignIn signIn,SignInV1 signInV1,DriverScheduling scheduling) { 96 + public AjaxResult getAjaxResultByDriverSignInfo(SignIn signIn, SignInV1 signInV1, DriverScheduling driverScheduling) {
96 String key = StringUtils.join(REDIS_SIGN_IN_DRIVER_ALCOHOL_OVERFLOW, ConstDateUtil.FAST_YYYY_MM_DD.format(new Date()), ":", signIn.getJobCode()); 97 String key = StringUtils.join(REDIS_SIGN_IN_DRIVER_ALCOHOL_OVERFLOW, ConstDateUtil.FAST_YYYY_MM_DD.format(new Date()), ":", signIn.getJobCode());
97 - String key1 = StringUtils.join(REDIS_SIGN_IN_DRIVER_ALCOHOL_OVERFLOW, ConstDateUtil.FAST_YYYY_MM_DD.format(new Date()), ":", signIn.getJobCode(),":",scheduling.getId()); 98 + if (Objects.isNull(driverScheduling)) {
  99 + return null;
  100 + }
  101 + String key1 = StringUtils.join(key, ":", driverScheduling.getId());
98 // 驾驶员酒精测试连续超标两次则提示换人 102 // 驾驶员酒精测试连续超标两次则提示换人
  103 + redisCache.getCacheObject(key);
99 Integer count = redisCache.getCacheObject(key1); 104 Integer count = redisCache.getCacheObject(key1);
  105 +
  106 + if (Objects.isNull(driverScheduling.getAlcoholCount())) {
  107 + driverScheduling.setAlcoholCount(2);
  108 + }
100 if (Objects.isNull(count) || count.equals(0)) { 109 if (Objects.isNull(count) || count.equals(0)) {
101 count = 1; 110 count = 1;
102 redisCache.setCacheObject(key, count, 1, TimeUnit.DAYS); 111 redisCache.setCacheObject(key, count, 1, TimeUnit.DAYS);
103 - redisCache.setCacheObject(key1, count, 1, TimeUnit.DAYS);  
104 } else { 112 } else {
105 redisCache.setCacheObject(key, ++count, 1, TimeUnit.DAYS); 113 redisCache.setCacheObject(key, ++count, 1, TimeUnit.DAYS);
106 - redisCache.setCacheObject(key1, ++count, 1, TimeUnit.DAYS);  
107 } 114 }
108 - if (SIGN_IN_ERROR_COUNT.compareTo(count) <= 0) { 115 + if (driverScheduling.getAlcoholCount() - count <= 0) {
109 116
110 return AjaxResult.success(SIGN_IN_ERROR + ": " + (StringUtils.isEmpty(signIn.getRemark()) ? "" : signIn.getRemark()) + "酒精测试不通过" + count + "次请更换车辆驾驶员。", signInV1); 117 return AjaxResult.success(SIGN_IN_ERROR + ": " + (StringUtils.isEmpty(signIn.getRemark()) ? "" : signIn.getRemark()) + "酒精测试不通过" + count + "次请更换车辆驾驶员。", signInV1);
111 } 118 }
Bsth-admin/src/main/java/com/ruoyi/service/impl/dss/FaceServiceImpl.java
@@ -12,6 +12,7 @@ import com.ruoyi.config.BsthSystemConfig; @@ -12,6 +12,7 @@ import com.ruoyi.config.BsthSystemConfig;
12 import com.ruoyi.domain.driver.NewDriver; 12 import com.ruoyi.domain.driver.NewDriver;
13 import com.ruoyi.service.driver.NewDriverService; 13 import com.ruoyi.service.driver.NewDriverService;
14 import com.ruoyi.service.dss.FaceService; 14 import com.ruoyi.service.dss.FaceService;
  15 +import com.ruoyi.utils.SpringApplicationUtil;
15 import lombok.extern.slf4j.Slf4j; 16 import lombok.extern.slf4j.Slf4j;
16 import org.apache.commons.collections4.CollectionUtils; 17 import org.apache.commons.collections4.CollectionUtils;
17 import org.apache.commons.io.IOUtils; 18 import org.apache.commons.io.IOUtils;
@@ -38,8 +39,6 @@ public class FaceServiceImpl implements FaceService { @@ -38,8 +39,6 @@ public class FaceServiceImpl implements FaceService {
38 @Autowired 39 @Autowired
39 private NewDriverService newDriverService; 40 private NewDriverService newDriverService;
40 @Autowired 41 @Autowired
41 - private FaceEngine faceEngine;  
42 - @Autowired  
43 private BsthSystemConfig bsthSystemConfig; 42 private BsthSystemConfig bsthSystemConfig;
44 43
45 44
@@ -126,7 +125,7 @@ public class FaceServiceImpl implements FaceService { @@ -126,7 +125,7 @@ public class FaceServiceImpl implements FaceService {
126 125
127 //特征比对 126 //特征比对
128 FaceSimilar faceSimilar = new FaceSimilar(); 127 FaceSimilar faceSimilar = new FaceSimilar();
129 - int errorCode = faceEngine.compareFaceFeature(targetFaceFeature, sourceFaceFeature, faceSimilar); 128 + int errorCode = SpringApplicationUtil.getBean(FaceEngine.class).compareFaceFeature(targetFaceFeature, sourceFaceFeature, faceSimilar);
130 129
131 if (errorCode != ErrorInfo.MOK.getValue()) { 130 if (errorCode != ErrorInfo.MOK.getValue()) {
132 log.error("人脸对比失败:[{}]", dr); 131 log.error("人脸对比失败:[{}]", dr);
@@ -137,7 +136,7 @@ public class FaceServiceImpl implements FaceService { @@ -137,7 +136,7 @@ public class FaceServiceImpl implements FaceService {
137 136
138 private FaceFeature generateFaceFeature(NewDriver driver, ImageInfo image) { 137 private FaceFeature generateFaceFeature(NewDriver driver, ImageInfo image) {
139 List<FaceInfo> faceInfoList = new ArrayList<>(); 138 List<FaceInfo> faceInfoList = new ArrayList<>();
140 - int errorCode = faceEngine.detectFaces(image.getImageData(), image.getWidth(), image.getHeight(), image.getImageFormat(), faceInfoList); 139 + int errorCode = SpringApplicationUtil.getBean(FaceEngine.class).detectFaces(image.getImageData(), image.getWidth(), image.getHeight(), image.getImageFormat(), faceInfoList);
141 if (errorCode != ErrorInfo.MOK.getValue()) { 140 if (errorCode != ErrorInfo.MOK.getValue()) {
142 log.error("人脸对比失败,请检查数据:[{}];错误代码:[{}]", driver, errorCode); 141 log.error("人脸对比失败,请检查数据:[{}];错误代码:[{}]", driver, errorCode);
143 return null; 142 return null;
@@ -150,7 +149,7 @@ public class FaceServiceImpl implements FaceService { @@ -150,7 +149,7 @@ public class FaceServiceImpl implements FaceService {
150 } 149 }
151 150
152 FaceFeature faceFeature = new FaceFeature(); 151 FaceFeature faceFeature = new FaceFeature();
153 - errorCode = faceEngine.extractFaceFeature(image.getImageData(), image.getWidth(), image.getHeight(), image.getImageFormat(), faceInfoList.get(0), faceFeature); 152 + errorCode = SpringApplicationUtil.getBean(FaceEngine.class).extractFaceFeature(image.getImageData(), image.getWidth(), image.getHeight(), image.getImageFormat(), faceInfoList.get(0), faceFeature);
154 if (errorCode != ErrorInfo.MOK.getValue()) { 153 if (errorCode != ErrorInfo.MOK.getValue()) {
155 log.error("提取对比特征失败,请检查数据:[{}];错误代码:[{}]", driver, errorCode); 154 log.error("提取对比特征失败,请检查数据:[{}];错误代码:[{}]", driver, errorCode);
156 return null; 155 return null;
Bsth-admin/src/main/java/com/ruoyi/utils/SpringApplicationUtil.java 0 → 100644
  1 +package com.ruoyi.utils;
  2 +
  3 +import org.springframework.context.ConfigurableApplicationContext;
  4 +
  5 +public class SpringApplicationUtil {
  6 + private static ConfigurableApplicationContext applicationContext;
  7 +
  8 + public static void setApplicationContext(ConfigurableApplicationContext app) {
  9 + SpringApplicationUtil.applicationContext = app;
  10 + }
  11 +
  12 + public static <T> T getBean(Class<T> tClass) {
  13 + return SpringApplicationUtil.applicationContext.getBean(tClass);
  14 + }
  15 +}
Bsth-admin/src/main/resources/application-druid-devTest.yml
@@ -165,7 +165,8 @@ api: @@ -165,7 +165,8 @@ api:
165 getCompanyInfo: 165 getCompanyInfo:
166 # 获取排班信息 166 # 获取排班信息
167 getSchedulingInfo: http://58.34.47.74:9089/webservice/rest/schedule_real/sch_jk/%s/%s?timestamp=%d&nonce=%s&password=%s&sign=%s 167 getSchedulingInfo: http://58.34.47.74:9089/webservice/rest/schedule_real/sch_jk/%s/%s?timestamp=%d&nonce=%s&password=%s&sign=%s
168 - getSchedulingInfoNew: http://58.34.47.74:9089/webservice/rest/schedule_real/sch_jk/%s/%s?timestamp=%d&nonce=%s&password=%s&sign=%s 168 + getSchedulingInfoNew: http://58.34.47.74:9089/webservice/rest/schedule_real/sch_jk4modify/%s/%s/%d?timestamp=%d&nonce=%s&password=%s&sign=%s
  169 + getSchedulingInfoNew1: http://58.34.47.74:9089/webservice/rest/schedule_real/sch_jk/%s/%s?timestamp=%d&nonce=%s&password=%s&sign=%s
169 getSchedulingInfoPlan: http://58.34.47.74:9089/webservice/rest/schedule/sch_jk/%s/%s?timestamp=%d&nonce=%s&password=%s&sign=%s 170 getSchedulingInfoPlan: http://58.34.47.74:9089/webservice/rest/schedule/sch_jk/%s/%s?timestamp=%d&nonce=%s&password=%s&sign=%s
170 config: 171 config:
171 password: c4dd3d8cb9a82f6d6a625818618b28ca7bebb464 172 password: c4dd3d8cb9a82f6d6a625818618b28ca7bebb464
Bsth-admin/src/main/resources/logback.xml
@@ -5,7 +5,7 @@ @@ -5,7 +5,7 @@
5 /> 5 />
6 <!-- <property name="log.path" value="/home/ruoyi/logs" />--> 6 <!-- <property name="log.path" value="/home/ruoyi/logs" />-->
7 <!-- 日志输出格式 --> 7 <!-- 日志输出格式 -->
8 - <property name="log.pattern" value="%d{HH:mm:ss.SSS}[%X{userId}][%X{requestId}][%thread][%logger{20}]-[%method,%line]-%msg%n" /> 8 + <property name="log.pattern" value="%d{yyyyMMdd HH:mm:ss.SSS}[%X{userId}][%X{requestId}][%thread][%logger{20}]-[%method,%line]-%msg%n" />
9 9
10 <!-- 控制台输出 --> 10 <!-- 控制台输出 -->
11 <appender name="console" class="ch.qos.logback.core.ConsoleAppender"> 11 <appender name="console" class="ch.qos.logback.core.ConsoleAppender">