Commit 4280fcf0fb075cd80f80d3a0d9f512ad758276f3

Authored by liujun001
1 parent df625c0c

蓝斯二期

Bsth-admin/src/main/java/com/ruoyi/BsthApplication.java
1 1 package com.ruoyi;
2 2  
  3 +import com.ruoyi.utils.SpringApplicationUtil;
3 4 import org.slf4j.Logger;
4 5 import org.slf4j.LoggerFactory;
5 6 import org.springframework.boot.SpringApplication;
... ... @@ -27,9 +28,11 @@ public class BsthApplication {
27 28  
28 29 private final static Logger log = LoggerFactory.getLogger(BsthApplication.class);
29 30  
  31 +
30 32 public static void main(String[] args) throws UnknownHostException {
31 33 // System.setProperty("spring.devtools.restart.enabled", "false");
32 34 ConfigurableApplicationContext app = SpringApplication.run(BsthApplication.class, args);
  35 + SpringApplicationUtil.setApplicationContext(app);
33 36 Environment env = app.getEnvironment();
34 37 log.info("(♥◠‿◠)ノ゙ 岗前检测后台启动成功 ლ(´ڡ`ლ)゙ \n" +
35 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 5 import com.ruoyi.pojo.response.ResponseSchedulingDto;
6 6 import com.ruoyi.utils.ConstDateUtil;
7 7 import org.apache.commons.collections4.CollectionUtils;
  8 +import org.apache.commons.lang3.time.DateUtils;
8 9 import org.slf4j.Logger;
9 10 import org.slf4j.LoggerFactory;
10 11 import org.springframework.beans.factory.annotation.Autowired;
... ... @@ -43,7 +44,7 @@ public class SchedulingCache {
43 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 48 log.info("项目启动加载中获取实时班次并存入缓存-----");
48 49 this.redisCache = redisCache;
49 50 schedulingInit(property);
... ... @@ -57,21 +58,23 @@ public class SchedulingCache {
57 58 String formatNowDate = ConstDateUtil.formatDate(new Date());
58 59 String url = getUrl(formatNowDate, property);
59 60 log.info("初始化排班数据:{}", formatNowDate);
60   - saveSchedulingToCache(url, formatNowDate);
  61 + saveSchedulingToCache(url, formatNowDate, null, null);
61 62 String formatYesterdayDate = ConstDateUtil.formatDate(ConstDateUtil.getTheSpecifiedNumberOfDaysOfTime(-1));
62 63 log.info("初始化排班数据:{}", formatYesterdayDate);
63 64 url = getUrlOld(formatYesterdayDate, property);
64   - saveSchedulingToCache(url, formatYesterdayDate);
  65 + saveSchedulingToCache(url, formatYesterdayDate, null, null);
65 66 }
66 67  
67 68 public String getUrl(String formatNowDate, SchedulerProperty property) {
68 69 String url = null;
  70 + Date date = new Date();
  71 + long timestamp1 = DateUtils.addHours(date, -1).getTime();
69 72 long timestamp = System.currentTimeMillis();
70 73 // String formatDate = ConstDateUtil.formatDate(ConstDateUtil.getTheSpecifiedNumberOfDaysOfTime(-1));
71 74 // 获取排班请求
72 75 String key = "Scheduling:timeStr:" + formatNowDate;
73 76 try {
74   - long timestampValue = timestamp;
  77 + long timestampValue = timestamp1;
75 78 if (!redisCache.hasKey(key)) {
76 79 redisCache.setCacheObject(key, "1", 30, TimeUnit.HOURS);
77 80 timestampValue = 0;
... ... @@ -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 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 146 Map<String, List<ResponseSchedulingDto>> driverSchedulingMap = new HashMap<>(200);
149 147 // 按照员工工号来获取排班信息
... ... @@ -177,7 +175,7 @@ public class SchedulingCache {
177 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 179 List<ResponseSchedulingDto> originSchedulingList = null;
182 180 int index = 0;
183 181 int size = 0;
... ... @@ -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 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 9 import com.arcsoft.face.enums.ErrorInfo;
10 10 import com.ruoyi.exception.InterruptException;
11 11 import lombok.extern.slf4j.Slf4j;
  12 +import org.apache.commons.lang3.StringUtils;
  13 +import org.springframework.beans.factory.annotation.Value;
12 14 import org.springframework.context.annotation.Bean;
13 15 import org.springframework.stereotype.Component;
14 16  
... ... @@ -24,8 +26,14 @@ import java.util.Objects;
24 26 public class FaceEngineConfig {
25 27 private FaceEngine faceEngine;
26 28  
  29 + @Value("${spring.profiles.active}")
  30 + private String profilesActive;
  31 +
27 32 @Bean
28 33 public FaceEngine createFaceEngine(BsthSystemConfig bsthSystemConfig) {
  34 + if(isDev()){
  35 + return null;
  36 + }
29 37 FaceEngine faceEngine = new FaceEngine(bsthSystemConfig.getFaceLibPath());
30 38 // FaceEngine faceEngine = new FaceEngine("D:\\\\arcsoft_lib");
31 39 //激活引擎
... ... @@ -76,4 +84,8 @@ public class FaceEngineConfig {
76 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 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 78 @GetMapping(value = "/key/info/local")
69 79 @ApiOperation("/key/info/local")
70 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 36 import com.ruoyi.equipment.service.IEquipmentService;
37 37 import com.ruoyi.exception.InterruptException;
38 38 import com.ruoyi.framework.security.filter.JwtAuthenticationTokenFilter;
  39 +import com.ruoyi.in.domain.CalDriverScheduling;
39 40 import com.ruoyi.in.domain.SignIn;
40 41 import com.ruoyi.in.domain.SignInV1;
41 42 import com.ruoyi.in.service.ISignInService;
... ... @@ -167,20 +168,20 @@ public class DssDriverController extends BaseController {
167 168  
168 169 SignInResponseVo vo = new SignInResponseVo();
169 170 if (Objects.nonNull(signInV1)) {
170   - BeanUtils.copyProperties(signInV1,vo);
  171 + BeanUtils.copyProperties(signInV1, vo);
171 172  
172 173 vo.setDeviceId(signIn.getDeviceId());
173 174 vo.setSiteName(signInV1.getEquipment().getName());
174 175 vo.setName(signInV1.getDriver().getPersonnelName());
175 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 178 responseResult.setMsg(Convert.toStr(ajaxResult.get(AjaxResult.MSG_TAG)));
178 179 return responseResult;
179 180 }
180 181 }
181 182  
182 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 185 log.error("签到信息异常,传入的参数为:[{}]", dto, e);
185 186 return ResponseResult.error();
186 187 }
... ... @@ -210,7 +211,7 @@ public class DssDriverController extends BaseController {
210 211  
211 212 SignInResponseVo vo = new SignInResponseVo();
212 213 if (Objects.nonNull(signInV1)) {
213   - BeanUtils.copyProperties(signInV1,vo);
  214 + BeanUtils.copyProperties(signInV1, vo);
214 215  
215 216 vo.setDeviceId(signIn.getDeviceId());
216 217 vo.setSiteName(signInV1.getEquipment().getName());
... ... @@ -243,8 +244,12 @@ public class DssDriverController extends BaseController {
243 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 253 return ResponseResult.success(convertGetWineRecordVo(dataSignIn));
249 254 }
250 255  
... ... @@ -509,6 +514,7 @@ public class DssDriverController extends BaseController {
509 514  
510 515 signIn.setCreateTime(dto.getSignTime());
511 516 signIn.setType(1);
  517 + signIn.setSingnIn("4");
512 518  
513 519 if (Objects.nonNull(dto.getTestValue())) {
514 520 signIn.setAlcoholFlag(ConstSignInConstSignInProperties.ALCOHOL_FLAG_YES);
... ... @@ -600,7 +606,7 @@ public class DssDriverController extends BaseController {
600 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 610 DssSignVo vo = new DssSignVo();
605 611 vo.setTestId(Convert.toStr(responseVo.getId()));
606 612  
... ... @@ -611,7 +617,7 @@ public class DssDriverController extends BaseController {
611 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 621 vo.setResult(result);
616 622  
617 623 return vo;
... ... @@ -622,13 +628,14 @@ public class DssDriverController extends BaseController {
622 628 }
623 629  
624 630 private GetWineRecordVo convertGetWineRecordVo(SignIn signIn) {
  631 + GetWineRecordVo vo = new GetWineRecordVo();
625 632 if (Objects.isNull(signIn)) {
626   - return null;
  633 + vo.setCheck(true);
  634 + return vo;
627 635 }
628   - GetWineRecordVo vo = new GetWineRecordVo();
629 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 640 Integer count = redisCache.getCacheObject(key);
634 641 if (Objects.nonNull(count) && SIGN_IN_ERROR_COUNT.compareTo(count) <= 0) {
... ... @@ -640,27 +647,27 @@ public class DssDriverController extends BaseController {
640 647 return vo;
641 648 }
642 649  
643   - private LinggangScheduling convertScheduling(GetBusPlanListDTO dto) {
  650 + private LinggangScheduling convertScheduling(GetBusPlanListDTO dto) {
644 651 LinggangScheduling scheduling = new LinggangScheduling();
645 652 if (Objects.equals(1, dto.getDateType())) {
646 653 scheduling.setStartScheduleDate(DateUtil.shortDate(DateUtils.addDays(new Date(), 1)));
647 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 657 try {
651 658 scheduling.setFcsjT(DateUtil.YYYY_MM_DD_LINK.parse(timeStr).getTime());
652 659 } catch (ParseException e) {
653   - log.error("格式化时间错误",e);
  660 + log.error("格式化时间错误", e);
654 661 }
655 662 } else if (Objects.equals(0, dto.getDateType())) {
656 663 scheduling.setStartScheduleDate(DateUtil.shortDate(new Date()));
657 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 667 try {
661 668 scheduling.setFcsjT(DateUtil.YYYY_MM_DD_LINK.parse(timeStr).getTime());
662 669 } catch (ParseException e) {
663   - log.error("格式化时间错误",e);
  670 + log.error("格式化时间错误", e);
664 671 }
665 672 } else {
666 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 28 private String remark;
29 29 @TableField(exist = false)
30 30 private String siteName;
31   -
32   - private Integer alcoholCount;
33 31 /**
34 32 * 不是当前表的属性
35 33 */
... ... @@ -58,4 +56,6 @@ public class DriverScheduling {
58 56  
59 57 @TableField(exist = false)
60 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 168 if(Objects.isNull(linggangScheduling)){
169 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 178 @Override
... ...
Bsth-admin/src/main/java/com/ruoyi/in/service/SignInServiceV1.java
... ... @@ -2,11 +2,17 @@ package com.ruoyi.in.service;
2 2  
3 3 import com.baomidou.mybatisplus.extension.service.IService;
4 4 import com.ruoyi.common.core.domain.AjaxResult;
  5 +import com.ruoyi.in.domain.CalDriverScheduling;
5 6 import com.ruoyi.in.domain.SignIn;
6 7 import com.ruoyi.in.domain.SignInV1;
7 8  
8 9 import java.io.IOException;
  10 +import java.util.Date;
9 11  
10 12 public interface SignInServiceV1 extends IService<SignInV1> {
11 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 1 package com.ruoyi.in.service.impl;
2 2  
  3 +import cn.hutool.core.convert.Convert;
3 4 import com.alibaba.fastjson2.JSON;
4 5 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
5 6 import com.ruoyi.common.ConstDriverProperties;
... ... @@ -13,10 +14,12 @@ import com.ruoyi.common.core.redis.RedisCache;
13 14 import com.ruoyi.common.redispre.GlobalRedisPreName;
14 15 import com.ruoyi.common.utils.DateUtils;
15 16 import com.ruoyi.common.utils.StringUtils;
  17 +import com.ruoyi.common.utils.file.FileUtils;
16 18 import com.ruoyi.common.utils.ip.IpUtils;
17 19 import com.ruoyi.common.utils.uuid.Seq;
18 20 import com.ruoyi.common.utils.uuid.UUID;
19 21 import com.ruoyi.domain.DriverScheduling;
  22 +import com.ruoyi.domain.sign.in.resource.LinggangSignInResource;
20 23 import com.ruoyi.driver.domain.Driver;
21 24 import com.ruoyi.driver.mapper.DriverMapper;
22 25 import com.ruoyi.equipment.domain.Equipment;
... ... @@ -32,7 +35,9 @@ import com.ruoyi.scheduling.service.SchedulingServiceV1;
32 35 import com.ruoyi.service.BigViewServiceV1;
33 36 import com.ruoyi.service.SchedulingService;
34 37 import com.ruoyi.service.ThreadJobService;
  38 +import com.ruoyi.service.sign.in.resource.LinggangSignInResourceService;
35 39 import com.ruoyi.utils.ConstDateUtil;
  40 +import com.ruoyi.utils.UploadUtil;
36 41 import lombok.extern.slf4j.Slf4j;
37 42 import org.apache.commons.collections4.CollectionUtils;
38 43 import org.apache.commons.io.FilenameUtils;
... ... @@ -75,6 +80,10 @@ public class SignInServiceV1Impl extends ServiceImpl&lt;SignInMapperV1, SignInV1&gt; i
75 80  
76 81 @Autowired
77 82 private RedisCache redisCache;
  83 + @Autowired
  84 + private UploadUtil uploadUtil;
  85 + @Autowired
  86 + private LinggangSignInResourceService signInResourceService;
78 87  
79 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 132 } else if (Objects.equals(2, signIn.getType())) {
124 133 calDriverScheduling = findSchedulingByDateTime(schedulings, dateTime, ConstDriverProperties.BC_TYPE_IN);
125 134 } else {
  135 + calDriverScheduling = findSchedulingByDateTime(schedulings, dateTime, ConstDriverProperties.BC_TYPE_OUT);
  136 +
126 137 if (checkAlcoholIntake(signIn.getAlcoholIntake())) {
127   - AjaxResult ajaxResult = bigViewServiceV1.getAjaxResultByDriverSignInfo(signIn,signInV1,calDriverScheduling.getDriverScheduling());
  138 + AjaxResult ajaxResult = bigViewServiceV1.getAjaxResultByDriverSignInfo(signIn, signInV1, calDriverScheduling.getDriverScheduling());
128 139 if (Objects.nonNull(ajaxResult)) {
129 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 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 217 switchAndChooseAlcohol(signIn, driver, scheduling);
147 218  
148 219 } else {
149   - log.info("签到的数据为:[{}]",scheduling);
  220 + log.info("签到的数据为:[{}]", scheduling);
150 221 SignInV1 sourceSign = getById(scheduling.getSignInId());
151 222 if (Objects.nonNull(sourceSign)) {
152 223 switchAndChooseTime(signIn, scheduling, dateTime);
... ... @@ -156,16 +227,62 @@ public class SignInServiceV1Impl extends ServiceImpl&lt;SignInMapperV1, SignInV1&gt; i
156 227  
157 228 signInV1.setSignIn(signIn);
158 229  
  230 +
  231 +
159 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 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 282 signInV1.setId(signInV1.getId());
166 283 // 更新考勤
167 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 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 264 public void runScheduling(long timeLong) {
265 265 long timestamp = System.currentTimeMillis();
266 266 Date date = new Date(timeLong);
  267 +// date = DateUtils.addHours(date,-1);
267 268 String formatDate = DateUtil.YYYY_MM_DD.format(date);
268 269 String timeOut = DateUtil.HH_MM_ss.format(date);
269 270  
... ... @@ -273,7 +274,8 @@ public class DriverJob implements InitializingBean {
273 274  
274 275 log.info("开始获取{}的排班数据", formatDate);
275 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 279 int type = isSameDay ? 1 : 100;
278 280  
279 281 LinggangScheduling scheduling = new LinggangScheduling();
... ... @@ -281,24 +283,30 @@ public class DriverJob implements InitializingBean {
281 283 scheduling.setEndScheduleDate(DateUtils.addDays(scheduling.getStartScheduleDate(), 1));
282 284  
283 285 Set<Long> idSets = null;
  286 + String key = "Scheduling:timeStr:" + formatDate;
284 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 289 scheduling.setType(100);
292 290 List<LinggangScheduling> linggangSchedulings = schedulingService.list(scheduling);
293 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 310 } else {
303 311 try {
304 312 log.info("url:[{}];formatDate:[{}];timestamp:[{}]", url, formatDate, timestamp);
... ... @@ -313,7 +321,7 @@ public class DriverJob implements InitializingBean {
313 321  
314 322 String requestId = JwtAuthenticationTokenFilter.getRequestIdOfMDCValue();
315 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 326 if (isSameDay) {
319 327 deleteScheduling();
... ... @@ -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 422 JwtAuthenticationTokenFilter.putMDC("job", requestId);
415 423 log.info("开始拉取排班:{};[{}]", dateKey, getSchedulingInfoUrl);
416   - List<ResponseSchedulingDto> originSchedulingList = schedulingCache.requestScheduling(getSchedulingInfoUrl);
  424 + List<ResponseSchedulingDto> originSchedulingList = schedulingCache.requestScheduling(getSchedulingInfoUrl, redisCache, redisKey);
417 425 log.info("originSchedulingList:[{}]", JSON.toJSONString(originSchedulingList));
418 426 Map<String, List<ResponseSchedulingDto>> driverSchedulingMap = new HashMap<>(200);
419 427 // 以员工号为key存入排班集合
... ...
Bsth-admin/src/main/java/com/ruoyi/service/BigViewServiceV1.java
... ... @@ -7,6 +7,7 @@ import com.ruoyi.in.domain.SignIn;
7 7 import com.ruoyi.in.domain.SignInV1;
8 8 import com.ruoyi.pojo.vo.bigViewVo.FleetState;
9 9 import com.ruoyi.pojo.vo.bigViewVo.LineInfo;
  10 +import com.ruoyi.scheduling.domain.DriverSchedulingV1;
10 11  
11 12 import java.util.Date;
12 13  
... ... @@ -28,7 +29,7 @@ public interface BigViewServiceV1 {
28 29 * @param signIn
29 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 50 import org.springframework.stereotype.Component;
51 51 import org.springframework.transaction.PlatformTransactionManager;
52 52 import org.springframework.transaction.TransactionStatus;
53   -import org.springframework.transaction.annotation.Transactional;
54 53 import org.springframework.transaction.support.DefaultTransactionDefinition;
55 54 import org.springframework.web.client.RestTemplate;
56 55 import sun.misc.BASE64Decoder;
... ... @@ -490,7 +489,6 @@ public class ThreadJobService {
490 489 * @param timeOut
491 490 */
492 491 @Async
493   - @Transactional(rollbackFor = {Exception.class})
494 492 public synchronized void asyncComputedScheduling(Map<String, List<ResponseSchedulingDto>> originSchedulingMap, String timeOut, Date date, int type, Set<Long> idSets, String requestId) {
495 493 JwtAuthenticationTokenFilter.putMDC("job", requestId);
496 494 // //查询当天是否保存过考情表 如果不存在则保存
... ... @@ -619,7 +617,10 @@ public class ThreadJobService {
619 617 if(CollectionUtils.isNotEmpty(schedulings1)){
620 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 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 13 import com.ruoyi.pojo.vo.bigViewVo.FleetInfoVo;
14 14 import com.ruoyi.pojo.vo.bigViewVo.FleetState;
15 15 import com.ruoyi.pojo.vo.bigViewVo.LineInfo;
  16 +import com.ruoyi.scheduling.domain.DriverSchedulingV1;
16 17 import com.ruoyi.scheduling.service.SchedulingServiceV1;
17 18 import com.ruoyi.service.BigViewServiceV1;
18 19 import com.ruoyi.template.service.IFleetLineTemplateService;
... ... @@ -92,20 +93,26 @@ public class BigViewServiceV1Impl implements BigViewServiceV1 {
92 93 }
93 94  
94 95 @Override
95   - public AjaxResult getAjaxResultByDriverSignInfo(SignIn signIn,SignInV1 signInV1,DriverScheduling scheduling) {
  96 + public AjaxResult getAjaxResultByDriverSignInfo(SignIn signIn, SignInV1 signInV1, DriverScheduling driverScheduling) {
96 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 104 Integer count = redisCache.getCacheObject(key1);
  105 +
  106 + if (Objects.isNull(driverScheduling.getAlcoholCount())) {
  107 + driverScheduling.setAlcoholCount(2);
  108 + }
100 109 if (Objects.isNull(count) || count.equals(0)) {
101 110 count = 1;
102 111 redisCache.setCacheObject(key, count, 1, TimeUnit.DAYS);
103   - redisCache.setCacheObject(key1, count, 1, TimeUnit.DAYS);
104 112 } else {
105 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 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 12 import com.ruoyi.domain.driver.NewDriver;
13 13 import com.ruoyi.service.driver.NewDriverService;
14 14 import com.ruoyi.service.dss.FaceService;
  15 +import com.ruoyi.utils.SpringApplicationUtil;
15 16 import lombok.extern.slf4j.Slf4j;
16 17 import org.apache.commons.collections4.CollectionUtils;
17 18 import org.apache.commons.io.IOUtils;
... ... @@ -38,8 +39,6 @@ public class FaceServiceImpl implements FaceService {
38 39 @Autowired
39 40 private NewDriverService newDriverService;
40 41 @Autowired
41   - private FaceEngine faceEngine;
42   - @Autowired
43 42 private BsthSystemConfig bsthSystemConfig;
44 43  
45 44  
... ... @@ -126,7 +125,7 @@ public class FaceServiceImpl implements FaceService {
126 125  
127 126 //特征比对
128 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 130 if (errorCode != ErrorInfo.MOK.getValue()) {
132 131 log.error("人脸对比失败:[{}]", dr);
... ... @@ -137,7 +136,7 @@ public class FaceServiceImpl implements FaceService {
137 136  
138 137 private FaceFeature generateFaceFeature(NewDriver driver, ImageInfo image) {
139 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 140 if (errorCode != ErrorInfo.MOK.getValue()) {
142 141 log.error("人脸对比失败,请检查数据:[{}];错误代码:[{}]", driver, errorCode);
143 142 return null;
... ... @@ -150,7 +149,7 @@ public class FaceServiceImpl implements FaceService {
150 149 }
151 150  
152 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 153 if (errorCode != ErrorInfo.MOK.getValue()) {
155 154 log.error("提取对比特征失败,请检查数据:[{}];错误代码:[{}]", driver, errorCode);
156 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 165 getCompanyInfo:
166 166 # 获取排班信息
167 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 170 getSchedulingInfoPlan: http://58.34.47.74:9089/webservice/rest/schedule/sch_jk/%s/%s?timestamp=%d&nonce=%s&password=%s&sign=%s
170 171 config:
171 172 password: c4dd3d8cb9a82f6d6a625818618b28ca7bebb464
... ...
Bsth-admin/src/main/resources/logback.xml
... ... @@ -5,7 +5,7 @@
5 5 />
6 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 11 <appender name="console" class="ch.qos.logback.core.ConsoleAppender">
... ...