Commit decaea49f3f3b5006c37db66a1e9c79cb40d3902

Authored by liujun001
1 parent c18b21e5

蓝斯二期

Showing 31 changed files with 682 additions and 192 deletions
Bsth-admin/sql/DDL.sql
1   -ALTER TABLE key_work_location ADD type1 INT NULL COMMENT '状态:1 是归还;0是借出;2是初始状态';
  1 +ALTER TABLE equipment_exception ADD sign_id INT NULL COMMENT '打卡表ID';
2 2  
3 3  
4   -ALTER TABLE scheduling ADD alcohol_count INT DEFAULT 2 NULL COMMENT '酒测次数';
  4 +ALTER TABLE equipment_exception_report ADD sign_in varchar(100) NULL COMMENT '签到类型 1 人脸 2 刷卡 3 其他 4 酒精;104 线下酒测';
5 5  
6 6  
7   -ALTER TABLE key_work_location ADD `time` DATETIME NULL;
... ...
Bsth-admin/src/main/java/com/ruoyi/controller/app/AppSignExceptionController.java
... ... @@ -68,6 +68,7 @@ public class AppSignExceptionController extends BaseController {
68 68 signIn.setStartCreateTime(DateUtils.addMonths(signIn.getEndCreateTime(), -2));
69 69  
70 70 }
  71 + signIn.setSingnIn("104");
71 72  
72 73  
73 74 List<SignIn> signIns = signInService.list(signIn);
... ... @@ -90,6 +91,9 @@ public class AppSignExceptionController extends BaseController {
90 91 }
91 92  
92 93 Set<Long> schedulingIds = signIns.stream().map(SignIn::getSchedulingId).collect(Collectors.toSet());
  94 +
  95 + LinggangScheduling linggangScheduling = new LinggangScheduling();
  96 +
93 97 List<LinggangScheduling> schedulings = schedulingService.list(null, schedulingIds);
94 98  
95 99 EquipmentExceptionReport report = new EquipmentExceptionReport();
... ...
Bsth-admin/src/main/java/com/ruoyi/controller/dss/KeyBoxController.java
... ... @@ -290,10 +290,10 @@ public class KeyBoxController extends BaseController {
290 290 Set<String> plateNums = carInfos.stream().map(CarInfo::getPlateNum).filter(obj -> StringUtils.isNotEmpty(obj)).collect(Collectors.toSet());
291 291 if (CollectionUtils.isNotEmpty(plateNums)) {
292 292 keyInfos = keyInfoService.listPlateNums(plateNums);
293   - if(CollectionUtils.isNotEmpty(keyInfos)){
294   - keyInfos = keyInfos.stream().map(k->{
295   - Optional<CarInfo> optCar = carInfos.stream().filter(c->Objects.equals(k.getPlateNum(),c.getPlateNum())).findFirst();
296   - optCar.ifPresent(c->k.setNmmb(c.getNbbm()));
  293 + if (CollectionUtils.isNotEmpty(keyInfos)) {
  294 + keyInfos = keyInfos.stream().map(k -> {
  295 + Optional<CarInfo> optCar = carInfos.stream().filter(c -> Objects.equals(k.getPlateNum(), c.getPlateNum())).findFirst();
  296 + optCar.ifPresent(c -> k.setNmmb(c.getNbbm()));
297 297  
298 298 return k;
299 299 }).collect(Collectors.toList());
... ... @@ -304,7 +304,7 @@ public class KeyBoxController extends BaseController {
304 304  
305 305 Equipment equipment = equipmentService.getOneByDeviceId(dto.getDevice());
306 306 LinggangVenueInfo venueInfo = null;
307   - if(Objects.nonNull(equipment)){
  307 + if (Objects.nonNull(equipment)) {
308 308 venueInfo = venueInfoService.getById(equipment.getYardId());
309 309 }
310 310  
... ... @@ -314,7 +314,7 @@ public class KeyBoxController extends BaseController {
314 314 // return ResponseResult.error404();
315 315 // }
316 316  
317   - List<LinggangKeyWorkLocation> locations = convert(dto, schedulings, driver, keyInfos, 1,venueInfo);
  317 + List<LinggangKeyWorkLocation> locations = convert(dto, schedulings, driver, keyInfos, 1, venueInfo);
318 318 ResponseResult<Boolean> responseResult = linggangKeyWorkLocationService.saveAndDel(locations);
319 319 if (Objects.isNull(responseResult)) {
320 320 return ResponseResult.error();
... ... @@ -361,10 +361,10 @@ public class KeyBoxController extends BaseController {
361 361 Set<String> plateNums = carInfos.stream().map(CarInfo::getPlateNum).filter(obj -> StringUtils.isNotEmpty(obj)).collect(Collectors.toSet());
362 362 if (CollectionUtils.isNotEmpty(plateNums)) {
363 363 keyInfos = keyInfoService.listPlateNums(plateNums);
364   - if(CollectionUtils.isNotEmpty(keyInfos)){
365   - keyInfos = keyInfos.stream().map(k->{
366   - Optional<CarInfo> optCar = carInfos.stream().filter(c->Objects.equals(k.getPlateNum(),c.getPlateNum())).findFirst();
367   - optCar.ifPresent(c->k.setNmmb(c.getNbbm()));
  364 + if (CollectionUtils.isNotEmpty(keyInfos)) {
  365 + keyInfos = keyInfos.stream().map(k -> {
  366 + Optional<CarInfo> optCar = carInfos.stream().filter(c -> Objects.equals(k.getPlateNum(), c.getPlateNum())).findFirst();
  367 + optCar.ifPresent(c -> k.setNmmb(c.getNbbm()));
368 368  
369 369 return k;
370 370 }).collect(Collectors.toList());
... ... @@ -375,10 +375,10 @@ public class KeyBoxController extends BaseController {
375 375  
376 376 Equipment equipment = equipmentService.getOneByDeviceId(dto.getDevice());
377 377 LinggangVenueInfo venueInfo = null;
378   - if(Objects.nonNull(equipment)){
  378 + if (Objects.nonNull(equipment)) {
379 379 venueInfo = venueInfoService.getById(equipment.getYardId());
380 380 }
381   - List<LinggangKeyWorkLocation> locations = convert(dto, schedulings, driver, keyInfos, 0,venueInfo);
  381 + List<LinggangKeyWorkLocation> locations = convert(dto, schedulings, driver, keyInfos, 0, venueInfo);
382 382 // List<LinggangKeyWorkLocation> errorLocations = locations.stream().filter(l -> Objects.isNull(l.getKeyInfoId())).collect(Collectors.toList());
383 383 // locations = locations.stream().filter(l -> Objects.nonNull(l.getKeyInfoId())).collect(Collectors.toList());
384 384 ResponseResult<Boolean> responseResult = linggangKeyWorkLocationService.saveAndDel(locations);
... ... @@ -567,14 +567,14 @@ public class KeyBoxController extends BaseController {
567 567 LinggangScheduling scheduling = new LinggangScheduling();
568 568 scheduling.setJobCode(dto.getStaffCode());
569 569  
570   - scheduling.setStartScheduleDate(DateUtil.shortDate(dto.getTime()));
571   - scheduling.setEndScheduleDate(org.apache.commons.lang3.time.DateUtils.addDays(scheduling.getStartScheduleDate(), 1));
  570 + scheduling.setScheduleDate(DateUtil.shortDate(dto.getTime()));
  571 +
572 572 // String bcType = Objects.equals(0, dto.getEventType()) ? ConstDriverProperties.BC_TYPE_OUT : Objects.equals(1, dto.getEventType()) ? ConstDriverProperties.BC_TYPE_IN : "other";
573 573 String bcType = ConstDriverProperties.BC_TYPE_OUT;
574 574 scheduling.setBcType(bcType);
575 575 scheduling.setType(1);
576 576  
577   - List<LinggangScheduling> linggangSchedulings = schedulingService.list(scheduling);
  577 + List<LinggangScheduling> linggangSchedulings = schedulingService.listByTime(scheduling);
578 578 if (CollectionUtils.isEmpty(linggangSchedulings)) {
579 579 return null;
580 580 }
... ... @@ -604,10 +604,44 @@ public class KeyBoxController extends BaseController {
604 604 * @return com.ruoyi.domain.key.location.LinggangKeyWorkLocation
605 605 */
606 606 private LinggangKeyWorkLocation queryKeyWorkLocation(LinggangScheduling scheduling, WorkPlateV2DTO dto) {
  607 + CarInfo carInfo = carInfoService.getOneByNbbm(scheduling.getNbbm());
  608 + if (Objects.isNull(carInfo)) {
  609 + return null;
  610 + }
  611 +
  612 + List<KeyInfo> keyInfos = keyInfoService.listPlateNum(carInfo.getPlateNum());
  613 + if (CollectionUtils.isEmpty(keyInfos)) {
  614 + return null;
  615 + }
  616 +
607 617 LinggangKeyWorkLocation workLocation = new LinggangKeyWorkLocation();
608   - workLocation.setKeyInfoId(scheduling.getKeyInfoId());
609   - workLocation.setSchedulingId(scheduling.getId());
610   - return linggangKeyWorkLocationService.getOne(workLocation);
  618 + workLocation.setKeyInfoId(keyInfos.get(0).getId());
  619 + workLocation.setMaxCreateDate(dto.getTime());
  620 +
  621 + List<LinggangKeyWorkLocation> lists = linggangKeyWorkLocationService.getTenByKeyIdAndTime(workLocation);
  622 + int size = CollectionUtils.size(lists);
  623 + if (0 == size) {
  624 + return null;
  625 + } else if (1 == size) {
  626 + LinggangKeyWorkLocation keyWorkLocation = lists.get(0);
  627 + return Objects.equals(keyWorkLocation.getType1(), 2) || Objects.equals(keyWorkLocation.getType1(), 1) ? keyWorkLocation : null;
  628 + }
  629 + LinggangKeyWorkLocation keyWorkLocation = lists.get(0);
  630 + if (Objects.equals(keyWorkLocation.getType1(), 2)) {
  631 + //初始化的数据
  632 + keyWorkLocation = lists.get(1);
  633 + }
  634 + if (Objects.equals(keyWorkLocation.getType1(), 1)) {
  635 + //已归还的钥匙
  636 + return keyWorkLocation;
  637 + } else if (Objects.equals(keyWorkLocation.getType1(), 2)) {
  638 + //连续两条都是初始化数据,则取初始化数据
  639 + return lists.get(0);
  640 + }
  641 + //钥匙没有归还,返回空
  642 + return null;
  643 +// workLocation.setSchedulingId(scheduling.getId());
  644 +// return linggangKeyWorkLocationService.getOne(workLocation);
611 645 }
612 646  
613 647  
... ... @@ -788,7 +822,7 @@ public class KeyBoxController extends BaseController {
788 822 return vo;
789 823 }
790 824  
791   - private List<LinggangKeyWorkLocation> convert(TakeKeyDTO dto, List<LinggangKeyWorkLocation> schedulings, NewDriver driver, List<KeyInfo> keyInfos, int ty,LinggangVenueInfo venueInfo) {
  825 + private List<LinggangKeyWorkLocation> convert(TakeKeyDTO dto, List<LinggangKeyWorkLocation> schedulings, NewDriver driver, List<KeyInfo> keyInfos, int ty, LinggangVenueInfo venueInfo) {
792 826 if (CollectionUtils.isEmpty(dto.getKeyItem())) {
793 827 return Collections.emptyList();
794 828 }
... ... @@ -827,7 +861,7 @@ public class KeyBoxController extends BaseController {
827 861 location.setCreateBy(Convert.toLong(driver.getId()));
828 862 }
829 863  
830   - if(Objects.nonNull(venueInfo)){
  864 + if (Objects.nonNull(venueInfo)) {
831 865 location.setYardId(venueInfo.getId());
832 866 location.setYardName(venueInfo.getName());
833 867 }
... ...
Bsth-admin/src/main/java/com/ruoyi/controller/dss/RemindDriverKeyLocalController.java
1 1 package com.ruoyi.controller.dss;
2 2  
  3 +import cn.hutool.core.convert.Convert;
3 4 import com.ruoyi.common.core.controller.BaseController;
4 5 import com.ruoyi.common.core.domain.ResponseResult;
5 6 import com.ruoyi.domain.OrderEntity;
  7 +import com.ruoyi.domain.caiinfo.CarInfo;
6 8 import com.ruoyi.domain.dss.key.location.vo.RemindKeyInfoLocalVo;
7 9 import com.ruoyi.domain.dss.scheling.dto.RemindDriverReportDTO;
8 10 import com.ruoyi.domain.dss.scheling.vo.RemindDriverReportVo;
  11 +import com.ruoyi.domain.key.info.KeyInfo;
9 12 import com.ruoyi.domain.key.location.LinggangKeyWorkLocation;
10 13 import com.ruoyi.domain.scheduling.LinggangScheduling;
11 14 import com.ruoyi.equipment.domain.Equipment;
12 15 import com.ruoyi.equipment.service.IEquipmentService;
  16 +import com.ruoyi.service.carinfo.CarInfoService;
  17 +import com.ruoyi.service.key.info.KeyInfoService;
13 18 import com.ruoyi.service.key.location.LinggangKeyWorkLocationService;
14 19 import com.ruoyi.service.scheduling.LinggangSchedulingService;
  20 +import com.ruoyi.utils.DateUtil;
15 21 import io.swagger.annotations.Api;
16 22 import io.swagger.annotations.ApiOperation;
17 23 import lombok.extern.slf4j.Slf4j;
... ... @@ -45,6 +51,10 @@ public class RemindDriverKeyLocalController extends BaseController {
45 51 private LinggangKeyWorkLocationService linggangKeyWorkLocationService;
46 52 @Autowired
47 53 private IEquipmentService equipmentService;
  54 + @Autowired
  55 + private CarInfoService carInfoService;
  56 + @Autowired
  57 + private KeyInfoService keyInfoService;
48 58  
49 59 @ApiOperation("司机提醒信息")
50 60 @PostMapping(value = "/remind/driver/key/local/report")
... ... @@ -55,7 +65,7 @@ public class RemindDriverKeyLocalController extends BaseController {
55 65  
56 66 LinggangScheduling scheduling = new LinggangScheduling();
57 67 scheduling.setJobCode(request.getJobCode());
58   -
  68 + scheduling.setScheduleDate(request.getDate());
59 69 scheduling.setStartScheduleDate(request.getDate());
60 70 scheduling.setEndScheduleDate(DateUtils.addDays(request.getDate(), 1));
61 71  
... ... @@ -67,73 +77,115 @@ public class RemindDriverKeyLocalController extends BaseController {
67 77 List<LinggangScheduling> linggangSchedulings = linggangSchedulingService.list(scheduling, orderEntity);
68 78 int size = CollectionUtils.size(linggangSchedulings);
69 79  
70   - List<LinggangKeyWorkLocation> linggangKeyWorkLocations = null;
71   - List<Equipment> equipments = null;
72   -
  80 + List<KeyInfo> keyInfos = null;
  81 + List<CarInfo> carInfos = null;
73 82 if (0 < size) {
74   - Set<Long> schedulingIds = linggangSchedulings.stream().map(LinggangScheduling::getId).collect(Collectors.toSet());
75   - linggangKeyWorkLocations = linggangKeyWorkLocationService.listRecent(null, schedulingIds);
76   - if (CollectionUtils.isNotEmpty(linggangKeyWorkLocations)) {
77   - Set<String> deviceIds = linggangKeyWorkLocations.stream().map(LinggangKeyWorkLocation::getDevice).collect(Collectors.toSet());
78   - equipments = equipmentService.listNameAndIDBydeviceIds(deviceIds);
79   - }
  83 + Set<String> nbbms = linggangSchedulings.stream().map(LinggangScheduling::getNbbm).collect(Collectors.toSet());
  84 + carInfos = carInfoService.list(nbbms);
80 85 }
81   - RemindDriverReportVo reportVo = new RemindDriverReportVo();
82   - reportVo.setCount(linggangSchedulings.stream().filter(ls -> StringUtils.equalsAnyIgnoreCase(ls.getBcType(), "out")).count());
83 86  
84   - if (CollectionUtils.isNotEmpty(linggangKeyWorkLocations)) {
85   - List<RemindKeyInfoLocalVo> remindKeyInfoLocalVoList = new ArrayList<>();
86   - for (int i = 0; i < size; i = i + 2) {
87   - RemindKeyInfoLocalVo localVo = new RemindKeyInfoLocalVo();
88   - localVo.setNbbm(linggangSchedulings.get(i).getNbbm());
89   - int index = i;
  87 + if (CollectionUtils.isNotEmpty(carInfos)) {
  88 + Set<String> plateNums = carInfos.stream().map(CarInfo::getPlateNum).collect(Collectors.toSet());
  89 + keyInfos = keyInfoService.listPlateNums(plateNums);
  90 + }
90 91  
91   - Optional<LinggangKeyWorkLocation> optional = linggangKeyWorkLocations.stream().filter(kl -> Objects.equals(kl.getSchedulingId(), linggangSchedulings.get(index).getId())).findFirst();
92   - if (optional.isPresent()) {
93   - localVo.setKeyInfoStatus(optional.get().getType());
94   - localVo.setYardName(optional.get().getYardName());
  92 + int carSize = CollectionUtils.size(carInfos);
  93 + int keyInfoSize = CollectionUtils.size(keyInfos);
95 94  
96   - if (CollectionUtils.isNotEmpty(equipments)) {
97   - Optional<LinggangKeyWorkLocation> finalOptional = optional;
98   - Optional<Equipment> equipmentOptional = equipments.stream().filter(e -> Objects.equals(e.getDeviceId(), finalOptional.get().getDevice())).findFirst();
99   - equipmentOptional.ifPresent(equipment -> localVo.setEquipmentName(equipment.getName()));
100   - if (i == 0) {
  95 + RemindDriverReportVo reportVo = new RemindDriverReportVo();
  96 + List<LinggangScheduling> values = linggangSchedulings.stream().filter(ls -> StringUtils.equalsAnyIgnoreCase(ls.getBcType(), "out")).collect(Collectors.toList());
  97 + size = CollectionUtils.size(values);
  98 + reportVo.setCount(Convert.toLong(size));
101 99  
  100 + if (size > 0) {
  101 + List<RemindKeyInfoLocalVo> remindKeyInfoLocalVoList = new ArrayList<>();
  102 + for (int i = 0; i < size; i++) {
  103 + RemindKeyInfoLocalVo localVo = new RemindKeyInfoLocalVo();
  104 + localVo.setNbbm(values.get(i).getNbbm());
  105 +
  106 + LinggangKeyWorkLocation workLocation = new LinggangKeyWorkLocation();
  107 + if (carSize > 0 && keyInfoSize > 0) {
  108 + int index = i;
  109 + Optional<CarInfo> optionalCarInfo = carInfos.stream().filter(c -> Objects.equals(c.getNbbm(), values.get(index).getNbbm())).findFirst();
  110 + if (optionalCarInfo.isPresent()) {
  111 + Optional<KeyInfo> optional = keyInfos.stream().filter(k -> Objects.equals(k.getPlateNum(), optionalCarInfo.get().getPlateNum())).findFirst();
  112 + optional.ifPresent(k -> workLocation.setKeyInfoId(k.getId()));
  113 + }
  114 + }
  115 + List<LinggangKeyWorkLocation> keyWorkLocations = null;
  116 + if (Objects.nonNull(workLocation.getKeyInfoId())) {
  117 + workLocation.setMaxCreateDate(new Date());
  118 + keyWorkLocations = linggangKeyWorkLocationService.getTenByKeyIdAndTime(workLocation);
  119 + }
  120 + if (CollectionUtils.isNotEmpty(keyWorkLocations)) {
  121 + int klSize = CollectionUtils.size(keyWorkLocations);
  122 + LinggangKeyWorkLocation sourceKL200 = null;
  123 + LinggangKeyWorkLocation sourceKL1 = null;
  124 + LinggangKeyWorkLocation sourceKL0 = null;
  125 + for (int j = 0; j < klSize; j++) {
  126 + if (Objects.equals(keyWorkLocations.get(j).getType1(), 2) && Objects.isNull(sourceKL200)) {
  127 + sourceKL200 = keyWorkLocations.get(j);
  128 + sourceKL200.setIndex(j);
  129 + } else if (Objects.equals(keyWorkLocations.get(j).getType1(), 1) && Objects.isNull(sourceKL1)) {
  130 + sourceKL1 = keyWorkLocations.get(j);
  131 + sourceKL1.setIndex(j);
  132 + } else if (Objects.equals(keyWorkLocations.get(j).getType1(), 0) && Objects.isNull(sourceKL0)) {
  133 + sourceKL0 = keyWorkLocations.get(j);
  134 + sourceKL0.setIndex(j);
  135 + } else if (Objects.nonNull(sourceKL200) && Objects.nonNull(sourceKL0) && Objects.nonNull(sourceKL1)) {
  136 + break;
102 137 }
103 138 }
104 139  
105   - if (i + 1 < size) {
106   - optional = linggangKeyWorkLocations.stream().filter(kl -> Objects.equals(kl.getSchedulingId(), linggangSchedulings.get(index).getId())).findFirst();
107   - if (optional.isPresent()) {
108   - localVo.setReturnYardName(optional.get().getYardName());
109   - if (CollectionUtils.isNotEmpty(equipments)) {
110   - Optional<LinggangKeyWorkLocation> finalOptional = optional;
111   - Optional<Equipment> equipmentOptional = equipments.stream().filter(e -> Objects.equals(e.getDeviceId(), finalOptional.get().getDevice())).findFirst();
112   - equipmentOptional.ifPresent(equipment -> localVo.setReturnEquipmentName(equipment.getName()));
  140 + if (Objects.nonNull(sourceKL0) && Objects.nonNull(sourceKL1) && Objects.nonNull(sourceKL0.getIndex()) && Objects.nonNull(sourceKL1.getIndex())) {
  141 + if (sourceKL0.getIndex() > sourceKL1.getIndex()) {
  142 + localVo.setKeyInfoStatus(0);
  143 + Equipment equipment = equipmentService.getOneByDeviceId(sourceKL1.getDevice());
  144 + if (Objects.nonNull(equipment)) {
  145 + localVo.setEquipmentName(equipment.getName());
  146 + localVo.setYardName(sourceKL0.getYardName());
113 147 }
  148 +
  149 + } else {
  150 + localVo.setKeyInfoStatus(1);
114 151 }
  152 + } else if (Objects.nonNull(sourceKL1) && Objects.nonNull(sourceKL1.getIndex())) {
  153 + localVo.setKeyInfoStatus(0);
  154 + Equipment equipment = equipmentService.getOneByDeviceId(sourceKL1.getDevice());
  155 + if (Objects.nonNull(equipment)) {
  156 + localVo.setEquipmentName(equipment.getName());
  157 + localVo.setYardName(equipment.getYardName());
  158 + }
  159 +
  160 + } else if (Objects.nonNull(sourceKL0) && Objects.nonNull(sourceKL0.getIndex())) {
  161 + localVo.setKeyInfoStatus(1);
  162 + } else if (Objects.nonNull(sourceKL200) && Objects.nonNull(sourceKL200.getIndex())) {
  163 + localVo.setKeyInfoStatus(16);
  164 + } else {
  165 + localVo.setKeyInfoStatus(255);
115 166 }
  167 + setReturnInfo(sourceKL200, localVo);
  168 + remindKeyInfoLocalVoList.add(localVo);
116 169 }
117   - remindKeyInfoLocalVoList.add(localVo);
118 170 }
119   - Optional<LinggangScheduling> opt = linggangSchedulings.stream().filter(f -> Objects.nonNull(f.getSignInId())).max(Comparator.comparing(LinggangScheduling::getFcsjT));
120   - if (opt.isPresent()) {
121   - Optional<LinggangKeyWorkLocation> optional = linggangKeyWorkLocations.stream().filter(kl -> Objects.equals(kl.getSchedulingId(), opt.get().getId())).findFirst();
122   - if (optional.isPresent()) {
123   - Optional<Equipment> equipmentOptional = equipments.stream().filter(e -> Objects.equals(e.getDeviceId(), optional.get().getDevice())).findFirst();
124   - equipmentOptional.ifPresent(equipment -> reportVo.setCurrentKeyLocaltion(equipment.getName()));
125   - }
126   - } else {
127   - Optional<LinggangKeyWorkLocation> optional = linggangKeyWorkLocations.stream().filter(kl -> Objects.equals(kl.getSchedulingId(), linggangSchedulings.get(0).getId())).findFirst();
128   - if (optional.isPresent()) {
129   - Optional<Equipment> equipmentOptional = equipments.stream().filter(e -> Objects.equals(e.getDeviceId(), optional.get().getDevice())).findFirst();
130   - equipmentOptional.ifPresent(equipment -> reportVo.setCurrentKeyLocaltion(equipment.getName()));
131   - }
  171 + if(CollectionUtils.isNotEmpty(remindKeyInfoLocalVoList)) {
  172 + reportVo.setRemindKeyInfoLocalVoList(remindKeyInfoLocalVoList);
  173 + reportVo.setCurrentKeyLocaltion(remindKeyInfoLocalVoList.get(0).getEquipmentName());
132 174 }
133   -
134   - reportVo.setRemindKeyInfoLocalVoList(remindKeyInfoLocalVoList);
135 175 }
136 176  
137 177 return ResponseResult.success(reportVo);
138 178 }
  179 +
  180 + private void setReturnInfo(LinggangKeyWorkLocation sourceKL200, RemindKeyInfoLocalVo localVo) {
  181 + if (Objects.isNull(sourceKL200) || Objects.isNull(localVo)) {
  182 + return;
  183 + }
  184 + Equipment equipment = equipmentService.getOneByDeviceId(sourceKL200.getDevice());
  185 + if (Objects.isNull(equipment)) {
  186 + return;
  187 + }
  188 + localVo.setReturnEquipmentName(equipment.getName());
  189 + localVo.setReturnYardName(sourceKL200.getYardName());
  190 + }
139 191 }
... ...
Bsth-admin/src/main/java/com/ruoyi/controller/dss2/DssDriverV2Controller.java
... ... @@ -24,6 +24,7 @@ import com.ruoyi.system.service.ISysDictDataService;
24 24 import io.swagger.annotations.Api;
25 25 import io.swagger.annotations.ApiOperation;
26 26 import lombok.extern.slf4j.Slf4j;
  27 +import org.apache.commons.lang3.StringUtils;
27 28 import org.springframework.beans.BeanUtils;
28 29 import org.springframework.beans.factory.annotation.Autowired;
29 30 import org.springframework.validation.BindingResult;
... ... @@ -133,7 +134,13 @@ public class DssDriverV2Controller {
133 134 signIn.setAlcoholIntake(Convert.toBigDecimal(dto.getTestValue()));
134 135 }
135 136 signIn.setSingnIn("104");
136   - signIn.setImage(dto.getImageContent());
  137 + if (StringUtils.isNotEmpty(dto.getImageContent())) {
  138 + signIn.setImage(dto.getImageContent());
  139 + signIn.setResourceType(1);
  140 + } else if (StringUtils.isNotEmpty(dto.getVideoContent())) {
  141 + signIn.setImage(dto.getImageContent());
  142 + signIn.setResourceType(2);
  143 + }
137 144  
138 145 // SysDictData sysDictData = querySystData(null,"drunkenness");
139 146 // if(Objects.nonNull(sysDictData)){
... ...
Bsth-admin/src/main/java/com/ruoyi/controller/sign/in/exception/report/EquipmentExceptionReportController.java
... ... @@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
5 5 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
6 6 import com.ruoyi.common.core.controller.BaseController;
7 7 import com.ruoyi.common.core.domain.ResponseResult;
  8 +import com.ruoyi.common.utils.DateUtils;
8 9 import com.ruoyi.common.utils.poi.ExcelUtil;
9 10 import com.ruoyi.domain.OrderEntity;
10 11 import com.ruoyi.domain.driver.NewDriver;
... ... @@ -21,6 +22,7 @@ import com.ruoyi.service.sign.in.exception.report.EquipmentExceptionReportServic
21 22 import io.swagger.annotations.Api;
22 23 import io.swagger.annotations.ApiOperation;
23 24 import org.apache.commons.collections4.CollectionUtils;
  25 +import org.apache.commons.lang3.StringUtils;
24 26 import org.springframework.beans.BeanUtils;
25 27 import org.springframework.beans.factory.annotation.Autowired;
26 28 import org.springframework.security.access.prepost.PreAuthorize;
... ... @@ -29,6 +31,7 @@ import org.springframework.web.bind.annotation.*;
29 31  
30 32 import javax.servlet.http.HttpServletResponse;
31 33 import javax.validation.Valid;
  34 +import java.text.ParseException;
32 35 import java.util.*;
33 36 import java.util.stream.Collectors;
34 37  
... ... @@ -63,16 +66,19 @@ public class EquipmentExceptionReportController extends BaseController {
63 66 logger.error("没有查到用户信息:[{}]", request);
64 67 return null;
65 68 }
66   - NewDriver d1 = new NewDriver();
67   - d1.setFleetName(driver.getFleetName());
68   - List<NewDriver> drivers1 = driverService.list(d1);
69   - if (CollectionUtils.isEmpty(drivers1)) {
70   - logger.error("该车队没有人员:[{}],[{}]", request, d1);
71   - }
72   -
73   - driverJobs = drivers1.stream().map(NewDriver::getJobCode).collect(Collectors.toSet());
74   - request.setDriverJobs(driverJobs);
  69 +// NewDriver d1 = new NewDriver();
  70 +// d1.setFleetName(driver.getFleetName());
  71 +// List<NewDriver> drivers1 = driverService.list(d1);
  72 +// if (CollectionUtils.isEmpty(drivers1)) {
  73 +// logger.error("该车队没有人员:[{}],[{}]", request, d1);
  74 +// }
  75 +//
  76 +// driverJobs = drivers1.stream().map(NewDriver::getJobCode).collect(Collectors.toSet());
  77 +// request.setDriverJobs(driverJobs);
75 78 }
  79 + Set<String> notSignIn = new HashSet<>();
  80 + notSignIn.add("104");
  81 + request.setNotSignIn(notSignIn);
76 82  
77 83  
78 84 IPage<EquipmentExceptionReportVO> voiPage = listLimit(request, orderEntity, page, pageLimit, model);
... ... @@ -111,13 +117,13 @@ public class EquipmentExceptionReportController extends BaseController {
111 117 EquipmentExceptionReport source = equipmentExceptionReportService.getById(id);
112 118 NewDriver driver = driverService.getOne(source.getJobCode());
113 119 SignIn signIn = signInService.getById(source.getSignId());
114   - EquipmentExceptionReportVO vo = convert(source);
  120 + EquipmentExceptionReportVO vo = convert(source);
115 121  
116   - if(Objects.nonNull(driver)){
  122 + if (Objects.nonNull(driver)) {
117 123 vo.setJobCodeName(driver.getPersonnelName());
118 124 }
119 125  
120   - if(Objects.nonNull(signIn)){
  126 + if (Objects.nonNull(signIn)) {
121 127 vo.setAlcoholIntake(signIn.getAlcoholIntake());
122 128 vo.setCreateTime(signIn.getCreateTime());
123 129 }
... ... @@ -168,8 +174,8 @@ public class EquipmentExceptionReportController extends BaseController {
168 174 @PostMapping(value = "/update/status")
169 175 public ResponseResult<Boolean> updateStatus(@RequestBody EquipmentExceptionReportUpdateStatusDTO dto) {
170 176 NewDriver driver = driverService.getOneByPhone(dto.getTelPhone());
171   - if(Objects.isNull(driver)){
172   - return ResponseResult.error("根据手机号没有找到相关的用户:[{}]",dto);
  177 + if (Objects.isNull(driver)) {
  178 + return ResponseResult.error("根据手机号没有找到相关的用户:[{}]", dto);
173 179 }
174 180 EquipmentExceptionReport entity = new EquipmentExceptionReport();
175 181 entity.setId(dto.getId());
... ... @@ -195,6 +201,13 @@ public class EquipmentExceptionReportController extends BaseController {
195 201 return java.util.Optional.ofNullable(source).map(sc -> {
196 202 EquipmentExceptionReport target = new EquipmentExceptionReport();
197 203 BeanUtils.copyProperties(sc, target);
  204 + if (StringUtils.isNotEmpty(source.getTimeStr())) {
  205 + try {
  206 + target.setCreateTime(DateUtils.YYYY_MM_DD_HH_MM_SS.parse(source.getTimeStr()));
  207 + } catch (ParseException e) {
  208 + throw new RuntimeException(e);
  209 + }
  210 + }
198 211 return target;
199 212 }).orElse(null);
200 213 }
... ...
Bsth-admin/src/main/java/com/ruoyi/domain/driver/NewDriver.java
... ... @@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.annotation.TableField;
5 5 import com.baomidou.mybatisplus.annotation.TableId;
6 6 import com.baomidou.mybatisplus.annotation.TableName;
7 7 import com.ruoyi.common.annotation.Excel;
  8 +import io.swagger.annotations.ApiModelProperty;
8 9 import lombok.Data;
9 10 import lombok.EqualsAndHashCode;
10 11 import lombok.experimental.Accessors;
... ... @@ -164,8 +165,13 @@ public class NewDriver {
164 165 @Excel(name = "图片版本号")
165 166 private java.lang.String imageVersion;
166 167  
  168 + @ApiModelProperty("审计岗,0不是审计岗,1是酒驾审计岗")
  169 + private Integer audit;
  170 +
167 171 @TableField(exist = false)
168 172 private float imageScore;
  173 + @TableField(exist = false)
  174 + private Collection<String> lineNames;
169 175  
170 176 public Integer getInteger() {
171 177 return integer1;
... ... @@ -175,22 +181,22 @@ public class NewDriver {
175 181 this.integer1 = integer1;
176 182 }
177 183  
178   - public Collection<Integer> getPostValue(){
  184 + public Collection<Integer> getPostValue() {
179 185  
180   - Set<Integer> postValue = new HashSet<>();
181   - if(StringUtils.indexOf(this.posts,"管理员") > -1){
  186 + Set<Integer> postValue = new HashSet<>();
  187 + if (StringUtils.indexOf(this.posts, "管理员") > -1) {
182 188 postValue.add(3);
183 189 }
184 190  
185   - if(StringUtils.indexOf(this.posts,"司机") > -1){
  191 + if (StringUtils.indexOf(this.posts, "司机") > -1) {
186 192 postValue.add(2);
187 193 }
188 194  
189   - if(StringUtils.indexOf(this.posts,"移车员") > -1){
  195 + if (StringUtils.indexOf(this.posts, "移车员") > -1) {
190 196 postValue.add(4);
191 197 }
192 198  
193   - if(CollectionUtils.isEmpty(postValue)){
  199 + if (CollectionUtils.isEmpty(postValue)) {
194 200 postValue.add(1);
195 201 }
196 202  
... ...
Bsth-admin/src/main/java/com/ruoyi/domain/dss2/driver/dto/DssSignV2DTO.java
... ... @@ -58,6 +58,9 @@ public class DssSignV2DTO {
58 58 @ApiModelProperty(value = "图片内容Base64")
59 59 private String imageContent;
60 60  
  61 + @ApiModelProperty(value = "视频内容Base64")
  62 + private String videoContent;
  63 +
61 64  
62 65 @Override
63 66 public String toString() {
... ...
Bsth-admin/src/main/java/com/ruoyi/domain/key/location/LinggangKeyWorkLocation.java
... ... @@ -127,6 +127,10 @@ public class LinggangKeyWorkLocation {
127 127 private Collection<Integer> keyInfoIds;
128 128 @TableField(exist = false)
129 129 private String jobCode;
  130 + @TableField(exist = false)
  131 + private Date maxCreateDate;
  132 + @TableField(exist = false)
  133 + private Integer index;
130 134  
131 135 public boolean importEquals(LinggangKeyWorkLocation location) {
132 136 if (Objects.isNull(location)) {
... ...
Bsth-admin/src/main/java/com/ruoyi/domain/scheduling/LinggangScheduling.java
... ... @@ -148,6 +148,8 @@ public class LinggangScheduling {
148 148  
149 149 @TableField(value = "alcohol_count")
150 150 private Integer alcoholCount;
  151 + @TableField(value = "scheduling_type")
  152 + private Integer schedulingType;
151 153  
152 154  
153 155 @TableField(exist = false)
... ... @@ -162,6 +164,7 @@ public class LinggangScheduling {
162 164 @TableField(exist = false)
163 165 private long zdsjTVal;
164 166  
  167 +
165 168 public String getCheZhanCode(){
166 169 return StringUtils.join(qdzcode,"@",zdzcode,"@",jobCode,"@");
167 170 }
... ...
Bsth-admin/src/main/java/com/ruoyi/domain/sign/in/exception/report/EquipmentExceptionReport.java
... ... @@ -15,6 +15,7 @@ import lombok.extern.slf4j.Slf4j;
15 15 import java.math.BigDecimal;
16 16 import java.util.Collection;
17 17 import java.util.Date;
  18 +import java.util.Set;
18 19  
19 20  
20 21 @Data
... ... @@ -132,10 +133,14 @@ public class EquipmentExceptionReport {
132 133 @Excel(name = "是否删除,0 未删除;1是删除")
133 134 private java.lang.Boolean delFlag;
134 135  
135   - /***签到ID*/
136   - @Excel(name = "签到ID")
  136 +
137 137 private java.lang.Long signId;
138 138  
  139 + private String signIn;
  140 +
  141 + @TableField(exist = false)
  142 + private Collection<String> notSignIn;
  143 +
139 144 @TableField(exist = false)
140 145 private Collection<String> driverJobs;
141 146  
... ...
Bsth-admin/src/main/java/com/ruoyi/domain/sign/in/exception/report/dto/EquipmentExceptionReportQueryDTO.java
... ... @@ -91,6 +91,9 @@ public class EquipmentExceptionReportQueryDTO implements java.io.Serializable {
91 91 @ApiModelProperty(value = "需要查询的工号集合")
92 92 private Collection<String> driverJobs;
93 93  
  94 + private String timeStr;
  95 + private Collection<String> notSignIn;
  96 +
94 97  
95 98 public void clearStrEmpty() {
96 99 if (org.apache.commons.lang3.StringUtils.isEmpty(this.title)) {
... ...
Bsth-admin/src/main/java/com/ruoyi/domain/sign/in/exception/report/vo/EquipmentExceptionReportVO.java
1 1 package com.ruoyi.domain.sign.in.exception.report.vo;
2 2  
  3 +import com.fasterxml.jackson.annotation.JsonFormat;
3 4 import io.swagger.annotations.ApiModel;
4 5 import io.swagger.annotations.ApiModelProperty;
5 6  
... ... @@ -41,6 +42,7 @@ public class EquipmentExceptionReportVO implements java.io.Serializable {
41 42 private Integer status;
42 43 /***上报时间*/
43 44 @ApiModelProperty(value = "上报时间")
  45 + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
44 46 private java.util.Date createTime;
45 47 /***备注*/
46 48 @ApiModelProperty(value = "备注")
... ...
Bsth-admin/src/main/java/com/ruoyi/driver/domain/Driver.java
... ... @@ -140,6 +140,14 @@ public class Driver extends BaseEntity implements Serializable {
140 140 @ApiModelProperty("车队名称")
141 141 @Excel( name ="车队名称")
142 142 private String fleetName;
  143 + @ApiModelProperty("审计岗,0不是审计岗,1是酒驾审计岗")
  144 + private Integer audit;
  145 +
  146 + private String faceFeature;
  147 +
  148 + private String imageVersion;
  149 +
  150 +
143 151  
144 152  
145 153 @Override
... ...
Bsth-admin/src/main/java/com/ruoyi/driver/service/impl/DriverServiceImpl.java
... ... @@ -2,6 +2,7 @@ package com.ruoyi.driver.service.impl;
2 2  
3 3 import cn.hutool.core.collection.CollectionUtil;
4 4 import cn.hutool.http.HttpUtil;
  5 +import com.alibaba.fastjson2.JSON;
5 6 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
6 7 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
7 8 import com.github.pagehelper.util.StringUtil;
... ... @@ -10,8 +11,10 @@ import com.ruoyi.common.cache.SchedulingCache;
10 11 import com.ruoyi.common.cache.TempCache;
11 12 import com.ruoyi.common.config.RuoYiConfig;
12 13 import com.ruoyi.common.core.domain.AjaxResult;
  14 +import com.ruoyi.common.core.domain.ResponseResult;
13 15 import com.ruoyi.common.core.domain.entity.SysDictData;
14 16 import com.ruoyi.common.core.redis.RedisCache;
  17 +import com.ruoyi.common.core.text.Convert;
15 18 import com.ruoyi.common.exception.file.InvalidExtensionException;
16 19 import com.ruoyi.common.global.Result;
17 20 import com.ruoyi.common.global.ResultCode;
... ... @@ -38,13 +41,16 @@ import com.ruoyi.pojo.response.personnel.TokenResponseVo;
38 41 import com.ruoyi.service.RuleAttendanceMainService;
39 42 import com.ruoyi.service.SchedulingService;
40 43 import com.ruoyi.service.ThreadJobService;
  44 +import com.ruoyi.service.dss.FaceService;
41 45 import com.ruoyi.system.domain.SysNotice;
42 46 import com.ruoyi.system.service.ISysDictDataService;
43 47 import com.ruoyi.system.service.ISysNoticeService;
44 48 import com.ruoyi.utils.ConstDateUtil;
45 49 import com.ruoyi.utils.ListUtils;
  50 +import com.ruoyi.utils.SpringApplicationUtil;
46 51 import org.apache.commons.collections4.CollectionUtils;
47 52 import org.apache.commons.io.FilenameUtils;
  53 +import org.apache.commons.io.IOUtils;
48 54 import org.apache.commons.lang3.RandomUtils;
49 55 import org.apache.commons.lang3.StringUtils;
50 56 import org.slf4j.Logger;
... ... @@ -53,12 +59,14 @@ import org.springframework.beans.factory.annotation.Autowired;
53 59 import org.springframework.beans.factory.annotation.Value;
54 60 import org.springframework.stereotype.Service;
55 61 import org.springframework.web.multipart.MultipartFile;
  62 +import sun.misc.BASE64Encoder;
56 63  
57 64 import javax.annotation.Resource;
58 65 import javax.servlet.ServletOutputStream;
59 66 import javax.servlet.http.HttpServletRequest;
60 67 import javax.servlet.http.HttpServletResponse;
61 68 import java.io.File;
  69 +import java.io.FileInputStream;
62 70 import java.io.IOException;
63 71 import java.io.InputStream;
64 72 import java.nio.file.Paths;
... ... @@ -181,7 +189,7 @@ public class DriverServiceImpl extends ServiceImpl&lt;DriverMapper, Driver&gt; impleme
181 189 if (source.isCombationVal()) {
182 190 drivers = drivers.stream().map(d -> {
183 191  
184   - d.setImage(sysDictDataService.combationValue(d.getImage(),source));
  192 + d.setImage(sysDictDataService.combationValue(d.getImage(), source));
185 193  
186 194 return d;
187 195 }).collect(Collectors.toList());
... ... @@ -255,6 +263,20 @@ public class DriverServiceImpl extends ServiceImpl&lt;DriverMapper, Driver&gt; impleme
255 263 @Override
256 264 public int insertDriver(Driver driver) {
257 265 driver.setUpdateTime(new Date());
  266 + if (StringUtils.isNotEmpty(driver.getImage())) {
  267 + String faceFeature = calimageContentFaceFeature(driver.getImage());
  268 + if (StringUtils.isNotEmpty(faceFeature)) {
  269 + driver.setFaceFeature(faceFeature);
  270 + if (StringUtils.isNotEmpty(driver.getImageVersion())) {
  271 + driver.setImageVersion("0.01");
  272 + } else {
  273 + Float imageVersion = Convert.toFloat(driver.getImageVersion()) + 0.01F;
  274 + driver.setImageVersion(imageVersion.toString());
  275 + }
  276 + }
  277 +
  278 + }
  279 +
258 280 return driverMapper.insertDriver(driver);
259 281 }
260 282  
... ... @@ -270,13 +292,27 @@ public class DriverServiceImpl extends ServiceImpl&lt;DriverMapper, Driver&gt; impleme
270 292 // 修改排班表scheduling 以及缓存信息
271 293 List<DriverScheduling> driverSchedulings = cache.getCacheScheduling(ConstDateUtil.getStringNowLocalDate("-")).get(driver.getJobCode());
272 294 // 只改变车队信息 其他信息由调度接口 和 人事系统决定 本来是不修改的但是人事数据有问题
273   - if(CollectionUtils.isNotEmpty(driverSchedulings)) {
  295 + if (CollectionUtils.isNotEmpty(driverSchedulings)) {
274 296 for (DriverScheduling scheduling : driverSchedulings) {
275 297 if (StringUtil.isNotEmpty(driver.getFleetName())) {
276 298 scheduling.setFleetName(driver.getFleetName());
277 299 }
278 300 }
279 301 }
  302 + if (StringUtils.isNotEmpty(driver.getImage())) {
  303 + String faceFeature = calimageContentFaceFeature(driver.getImage());
  304 + if (StringUtils.isNotEmpty(faceFeature)) {
  305 + Driver sourceDriver = selectDriverById(driver.getId());
  306 +
  307 +
  308 + driver.setFaceFeature(faceFeature);
  309 + Float imageVersion = Convert.toFloat(sourceDriver.getImageVersion()) + 0.01F;
  310 + driver.setImageVersion(imageVersion.toString());
  311 + log.info("[{}]", JSON.toJSONString(driver));
  312 + }
  313 +
  314 + }
  315 +
280 316 return driverMapper.updateDriver(driver);
281 317 }
282 318  
... ... @@ -359,7 +395,7 @@ public class DriverServiceImpl extends ServiceImpl&lt;DriverMapper, Driver&gt; impleme
359 395 }
360 396  
361 397 @Override
362   - public AjaxResult uploadImage(MultipartFile file,Integer id) throws InvalidExtensionException, IOException {
  398 + public AjaxResult uploadImage(MultipartFile file, Integer id) throws InvalidExtensionException, IOException {
363 399 // 上传并返回新文件名称
364 400 // 上传文件路径
365 401 String baseUrl = RuoYiConfig.getUploadPath() + headImagePre;
... ... @@ -367,10 +403,10 @@ public class DriverServiceImpl extends ServiceImpl&lt;DriverMapper, Driver&gt; impleme
367 403 FileUploadUtils.assertAllowed(file, MimeTypeUtils.DEFAULT_ALLOWED_EXTENSION);
368 404 // 后期可以通过请求头拿到对应的工号
369 405 String fileName = FilenameUtils.getBaseName(file.getOriginalFilename()) + "." + FileUploadUtils.getExtension(file);
370   - if(Objects.nonNull(id)){
371   - fileName = StringUtils.join(id,"/",fileName);
372   - }else{
373   - fileName = StringUtils.join("head/", RandomUtils.nextInt(1,90000),"/",fileName);
  406 + if (Objects.nonNull(id)) {
  407 + fileName = StringUtils.join(id, "/", fileName);
  408 + } else {
  409 + fileName = StringUtils.join("head/", RandomUtils.nextInt(1, 90000), "/", fileName);
374 410 }
375 411 String urlFileName = fileName;
376 412 String absPath = FileUploadUtils.getAbsoluteFile(baseUrl, fileName).getAbsolutePath();
... ... @@ -378,8 +414,7 @@ public class DriverServiceImpl extends ServiceImpl&lt;DriverMapper, Driver&gt; impleme
378 414 file.transferTo(Paths.get(absPath));
379 415  
380 416 SysDictData source = sysDictDataService.getResourceBaseUrl();
381   - String url = sysDictDataService.combationValue(urlFileName,source);
382   -
  417 + String url = sysDictDataService.combationValue(urlFileName, source);
383 418  
384 419 AjaxResult ajax = AjaxResult.success();
385 420 ajax.put("url", url);
... ... @@ -784,4 +819,17 @@ public class DriverServiceImpl extends ServiceImpl&lt;DriverMapper, Driver&gt; impleme
784 819  
785 820 return new File(RuoYiConfig.getProfile() + File.separator + image.replace("/profile", ""));
786 821 }
  822 +
  823 + private String calimageContentFaceFeature(String imagePath) {
  824 + String baseUrl = RuoYiConfig.getUploadPath() + headImagePre;
  825 + try {
  826 + String path = FileUploadUtils.getAbsoluteFile(baseUrl, imagePath).getAbsolutePath();
  827 + ResponseResult<String> responseResult = SpringApplicationUtil.getBean(FaceService.class).getFaceFeatureImagePath(path);
  828 + return Objects.nonNull(responseResult) && responseResult.isSuccess() ? responseResult.getData() : null;
  829 + } catch (IOException e) {
  830 + throw new RuntimeException(e);
  831 + }
  832 + }
  833 +
  834 +
787 835 }
... ...
Bsth-admin/src/main/java/com/ruoyi/eexception/domain/EquipmentException.java
... ... @@ -61,4 +61,6 @@ public class EquipmentException extends BaseEntity
61 61 private Date planTime;
62 62  
63 63 private Integer signType;
  64 +
  65 + private Long signId;
64 66 }
... ...
Bsth-admin/src/main/java/com/ruoyi/in/service/impl/SignInServiceV1Impl.java
... ... @@ -262,7 +262,7 @@ public class SignInServiceV1Impl extends ServiceImpl&lt;SignInMapperV1, SignInV1&gt; i
262 262 signIn.setImage(null);
263 263  
264 264 signIn.setExType1(signIn.getExType());
265   - Integer type = Objects.isNull(signIn.getExType()) ? 0 : signIn.getExType() > 0 ? 1 : 0;
  265 + Integer type = Objects.isNull(signIn.getExType()) ? 0 : bigViewServiceV1.isSignStatusWineEnum(signIn) ? 3 : signIn.getExType() > 0 ? 1 : 0;
266 266 signIn.setExType(type);
267 267  
268 268 signInMapper.insertSignIn(signIn);
... ... @@ -271,7 +271,7 @@ public class SignInServiceV1Impl extends ServiceImpl&lt;SignInMapperV1, SignInV1&gt; i
271 271  
272 272 signIn.setImage(null);
273 273 }
274   - if (org.apache.commons.lang3.StringUtils.isNotEmpty(videoContent)) {
  274 + if (org.apache.commons.lang3.StringUtils.isNotEmpty(videoContent) && Objects.equals(signIn.getResourceType(), 2)) {
275 275 StringBuilder builder = new StringBuilder();
276 276 builder.append("sign");
277 277 builder.append(File.separator);
... ... @@ -292,7 +292,31 @@ public class SignInServiceV1Impl extends ServiceImpl&lt;SignInMapperV1, SignInV1&gt; i
292 292 signInResource.setTime(new Date(scheduling.getFcsjT()));
293 293 signInResource.setCreateTime(new Date());
294 294 signInResource.setPath(builder.toString());
295   - signInResource.setIndex1(4);
  295 + signInResource.setIndex1(20);
  296 + signInResource.setCreateBy(Convert.toLong(signIn.getCreateBy()));
  297 + signInResourceService.save(signInResource);
  298 + } else if (org.apache.commons.lang3.StringUtils.isNotEmpty(videoContent)) {
  299 + StringBuilder builder = new StringBuilder();
  300 + builder.append("sign");
  301 + builder.append(File.separator);
  302 + builder.append("images");
  303 + builder.append(File.separator);
  304 + builder.append("offline");
  305 + builder.append(File.separator);
  306 + builder.append(signIn.getId());
  307 + builder.append(File.separator);
  308 + builder.append(java.util.UUID.randomUUID().toString().replace("-", ""));
  309 + builder.append(".jpg");
  310 +
  311 + uploadUtil.uploadVideoOfBase64(videoContent, builder.toString());
  312 +
  313 + LinggangSignInResource signInResource = new LinggangSignInResource();
  314 + signInResource.setSignId(signIn.getId());
  315 + signInResource.setResourceType(1);
  316 + signInResource.setTime(new Date(scheduling.getFcsjT()));
  317 + signInResource.setCreateTime(new Date());
  318 + signInResource.setPath(builder.toString());
  319 + signInResource.setIndex1(10);
296 320 signInResource.setCreateBy(Convert.toLong(signIn.getCreateBy()));
297 321 signInResourceService.save(signInResource);
298 322 }
... ... @@ -306,10 +330,13 @@ public class SignInServiceV1Impl extends ServiceImpl&lt;SignInMapperV1, SignInV1&gt; i
306 330 TempCache.updateSignStatus(signIn.getJobCode());
307 331 }
308 332  
309   - LambdaUpdateWrapper<SignInV1> updateWrapper = new LambdaUpdateWrapper<>();
310   - updateWrapper.set(SignInV1::getSchedulingId, scheduling.getId());
311   - updateWrapper.eq(SignInV1::getId, signIn.getId());
312   - update(updateWrapper);
  333 + if (Objects.nonNull(scheduling)) {
  334 + LambdaUpdateWrapper<SignInV1> updateWrapper = new LambdaUpdateWrapper<>();
  335 +
  336 + updateWrapper.set(SignInV1::getSchedulingId, scheduling.getId());
  337 + updateWrapper.eq(SignInV1::getId, signIn.getId());
  338 + update(updateWrapper);
  339 + }
313 340 // 异常保存到异常异常中
314 341 threadJobService.asyncInsertExceptionRecord(signIn, driver, scheduling);
315 342  
... ...
Bsth-admin/src/main/java/com/ruoyi/pojo/response/EquipmentExceptionResponseVo.java
... ... @@ -18,4 +18,6 @@ public class EquipmentExceptionResponseVo extends EquipmentException {
18 18 */
19 19 private String siteName;
20 20  
  21 + private String name;
  22 +
21 23 }
... ...
Bsth-admin/src/main/java/com/ruoyi/scheduling/service/SchedulingServiceV1.java
... ... @@ -14,4 +14,6 @@ public interface SchedulingServiceV1 extends IService&lt;DriverSchedulingV1&gt; {
14 14 List<DriverSchedulingV1> queryByNbbmAndDate(String nbbm, Date date);
15 15  
16 16 SchedulingDateEntity switchSchedulingDate(Date date);
  17 +
  18 +
17 19 }
... ...
Bsth-admin/src/main/java/com/ruoyi/service/ThreadJobService.java
... ... @@ -4,6 +4,7 @@ package com.ruoyi.service;
4 4 import cn.hutool.core.collection.CollectionUtil;
5 5 import cn.hutool.core.convert.Convert;
6 6 import cn.hutool.http.HttpUtil;
  7 +import cn.hutool.json.JSONUtil;
7 8 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
8 9 import com.ruoyi.common.cache.NowSchedulingCache;
9 10 import com.ruoyi.common.cache.TempCache;
... ... @@ -16,6 +17,7 @@ import com.ruoyi.config.domain.LineConfig;
16 17 import com.ruoyi.config.service.ILineConfigService;
17 18 import com.ruoyi.domain.DriverScheduling;
18 19 import com.ruoyi.domain.RuleAttendanceMain;
  20 +import com.ruoyi.domain.driver.NewDriver;
19 21 import com.ruoyi.domain.scheduling.LinggangScheduling;
20 22 import com.ruoyi.domain.sign.in.exception.report.EquipmentExceptionReport;
21 23 import com.ruoyi.driver.domain.Driver;
... ... @@ -33,6 +35,7 @@ import com.ruoyi.in.domain.SignIn;
33 35 import com.ruoyi.job.DriverJob;
34 36 import com.ruoyi.pojo.GlobalIndex;
35 37 import com.ruoyi.pojo.response.ResponseSchedulingDto;
  38 +import com.ruoyi.service.driver.NewDriverService;
36 39 import com.ruoyi.service.key.location.LinggangKeyWorkLocationService;
37 40 import com.ruoyi.service.scheduling.LinggangSchedulingService;
38 41 import com.ruoyi.service.sign.in.exception.report.EquipmentExceptionReportService;
... ... @@ -40,6 +43,7 @@ import com.ruoyi.system.domain.SysNotice;
40 43 import com.ruoyi.system.service.ISysNoticeService;
41 44 import com.ruoyi.utils.ConstDateUtil;
42 45 import com.ruoyi.utils.DateUtil;
  46 +import com.ruoyi.utils.HttpClientUtil;
43 47 import lombok.extern.slf4j.Slf4j;
44 48 import org.apache.commons.collections4.CollectionUtils;
45 49 import org.springframework.beans.BeanUtils;
... ... @@ -128,6 +132,13 @@ public class ThreadJobService {
128 132 private RestTemplate restTemplate;
129 133 @Autowired
130 134 private LinggangKeyWorkLocationService keyWorkLocationService;
  135 + @Autowired
  136 + private LinggangSchedulingService linggangSchedulingService;
  137 + @Autowired
  138 + private NewDriverService newDriverService;
  139 +
  140 + @Value("${bsth.process.sign.url}")
  141 + private String processSignExceptionURL;
131 142  
132 143  
133 144 /**
... ... @@ -193,6 +204,7 @@ public class ThreadJobService {
193 204 exception.setRemark(signIn.getRemark());
194 205 exception.setCreateTime(signIn.getCreateTime());
195 206 exception.setFleetName(driver.getFleetName());
  207 + exception.setSignId(signIn.getId());
196 208 if (Objects.nonNull(scheduling)) {
197 209 exception.setNbbm(scheduling.getNbbm());
198 210 exception.setLineName(scheduling.getLineName());
... ... @@ -200,6 +212,13 @@ public class ThreadJobService {
200 212 }
201 213 exception.setSignType(signIn.getType());
202 214 exceptionMapper.insertEquipmentException(exception);
  215 +
  216 + EquipmentExceptionReport exceptionReport = new EquipmentExceptionReport();
  217 + BeanUtils.copyProperties(exception, exceptionReport);
  218 + exceptionReport.setSignId(signIn.getId());
  219 + exceptionReport.setSignIn(signIn.getSingnIn());
  220 + equipmentExceptionReportService.save(exceptionReport);
  221 +
203 222 // 发送通知
204 223 sendNotice(signIn, driver, scheduling);
205 224 }
... ... @@ -218,6 +237,7 @@ public class ThreadJobService {
218 237 exception.setRemark(signIn.getRemark());
219 238 exception.setCreateTime(signIn.getCreateTime());
220 239 exception.setFleetName(driver.getFleetName());
  240 + exception.setSignId(signIn.getId());
221 241 if (CollectionUtil.isNotEmpty(dto) && dto.size() > 0) {
222 242 DriverScheduling scheduling = dto.get(globalIndex.getIndex());
223 243 exception.setNbbm(scheduling.getNbbm());
... ... @@ -293,6 +313,69 @@ public class ThreadJobService {
293 313 notice.setUpdateTime(DateUtils.getNowDate());
294 314 noticeService.insertNotice(notice);
295 315 }
  316 +
  317 + sendNoice(signIn, driver, item);
  318 + }
  319 +
  320 + private void sendNoice(SignIn signIn, Driver driver, DriverScheduling item) {
  321 + if (SIGN_ALCOHOL_EX_NUM.equals(signIn.getExType())) {
  322 + LinggangScheduling linggangScheduling = new LinggangScheduling();
  323 + linggangScheduling.setQdzcode(item.getQdzCode());
  324 + linggangScheduling.setBcType("out");
  325 + linggangScheduling.setStartScheduleDate(DateUtils.addDays(signIn.getCreateTime(), -1));
  326 + linggangScheduling.setEndScheduleDate(DateUtils.addDays(signIn.getCreateTime(), 1));
  327 + linggangScheduling.setSchedulingType(1);
  328 + List<LinggangScheduling> linggangSchedulings = linggangSchedulingService.list(linggangScheduling);
  329 +
  330 + Set<String> lineNames = null;
  331 + List<NewDriver> newDrivers = null;
  332 + if (CollectionUtils.isNotEmpty(linggangSchedulings)) {
  333 + lineNames = linggangSchedulings.stream().map(LinggangScheduling::getLineName).filter(org.apache.commons.lang3.StringUtils::isNotEmpty).collect(Collectors.toSet());
  334 + }
  335 + if (CollectionUtils.isNotEmpty(lineNames)) {
  336 + NewDriver newDriver = new NewDriver();
  337 + newDriver.setAudit(1);
  338 + newDriver.setLineNames(lineNames);
  339 + newDrivers = newDriverService.list(newDriver);
  340 + }
  341 +
  342 + if (CollectionUtils.isNotEmpty(newDrivers)) {
  343 + for (NewDriver newDriver : newDrivers) {
  344 + Map<String, Object> map = new HashMap<>();
  345 + map.put("noticeIssuer", "运控中心");
  346 + map.put("noticeRecipient", "05-" + newDriver.getJobCode());
  347 + map.put("noticeTitle", "异常通知");
  348 + map.put("noticeSubtitle", "");
  349 +
  350 + StringBuilder builder = new StringBuilder();
  351 + builder
  352 + .append("工号:").append(item.getJobCode()).append(",姓名:").append(item.getName()).append(",工种:")
  353 + .append(item.getPosts()).append(",排班:")
  354 + .append((Objects.isNull(item.getScheduleDate()) ? "无排班" : "有排班")).append(",打卡时间:")
  355 + .append(ConstDateUtil.formatDate("yyyy-MM-dd HH:mm:ss", signIn.getCreateTime()))
  356 + .append(",酒精测试超标,当前测试值达到").append(signIn.getAlcoholIntake()).append("mg/100ml。属于").append(getResultString(signIn.getAlcoholIntake()));
  357 +
  358 + map.put("noticeContent", builder.toString());
  359 + map.put("phone", newDriver.getTelphone());
  360 + map.put("smscontent", builder.toString());
  361 + map.put("noticeType", "岗前检查");
  362 + map.put("remark", "schedulingId=" + item.getId() + "&signId=" + signIn.getId());
  363 + map.put("signId", signIn.getId());
  364 + map.put("associatedId", item.getId());
  365 +
  366 + Map<String, Object> paramMap = new HashMap<>();
  367 + paramMap.put("schedulingId", item.getId());
  368 + map.put("params", paramMap);
  369 +
  370 + String key = SignatureUtils.generateSignature(map, "your_secret_key_here");
  371 + map.put("signature", key);
  372 +
  373 + String result = HttpUtil.get(processSignExceptionURL, map, 10000);
  374 + log.info("processSignExceptionURL:[{}],paramMap:[{}],result:[{}]", processSignExceptionURL, JSONUtil.toJsonStr(map), result);
  375 + }
  376 +
  377 + }
  378 + }
296 379 }
297 380  
298 381 private String getResultString(BigDecimal alcoholIntake) {
... ...
Bsth-admin/src/main/java/com/ruoyi/service/dss/FaceService.java
1 1 package com.ruoyi.service.dss;
2 2  
  3 +import com.ruoyi.common.core.domain.ResponseResult;
3 4 import com.ruoyi.domain.driver.NewDriver;
4 5  
5 6 /**
... ... @@ -16,4 +17,11 @@ public interface FaceService {
16 17 */
17 18 NewDriver checkFace(NewDriver driver);
18 19  
  20 + String getBase64ImagePath(String path);
  21 +
  22 + String getBase64ImageContent(String content);
  23 +
  24 + ResponseResult<String> getFaceFeatureImageContent(String content);
  25 + ResponseResult<String> getFaceFeatureImagePath(String path);
  26 +
19 27 }
... ...
Bsth-admin/src/main/java/com/ruoyi/service/impl/driver/NewDriverServiceImpl.java
... ... @@ -73,7 +73,9 @@ public class NewDriverServiceImpl extends ServiceImpl&lt;NewDriverMapper, NewDriver
73 73  
74 74 @Override
75 75 public List<NewDriver> list(NewDriver entity) {
76   - return list(new LambdaQueryWrapper<>(entity));
  76 + LambdaQueryWrapper<NewDriver> wrapper = new LambdaQueryWrapper<>(entity);
  77 + chooseLineNames(entity, wrapper);
  78 + return list(wrapper);
77 79 }
78 80  
79 81 @Override
... ... @@ -570,5 +572,11 @@ public class NewDriverServiceImpl extends ServiceImpl&lt;NewDriverMapper, NewDriver
570 572 }
571 573 }
572 574  
  575 + private void chooseLineNames(NewDriver driver, LambdaQueryWrapper<NewDriver> wrapper) {
  576 + if (Objects.nonNull(driver) && CollectionUtils.isNotEmpty(driver.getLineNames())) {
  577 + wrapper.in(NewDriver::getLineName, driver.getLineNames());
  578 + }
  579 + }
  580 +
573 581  
574 582 }
575 583 \ No newline at end of file
... ...
Bsth-admin/src/main/java/com/ruoyi/service/impl/dss/FaceServiceImpl.java
1 1 package com.ruoyi.service.impl.dss;
2 2  
  3 +import cn.hutool.core.convert.Convert;
  4 +import com.alibaba.fastjson2.JSON;
3 5 import com.arcsoft.face.FaceEngine;
4 6 import com.arcsoft.face.FaceFeature;
5 7 import com.arcsoft.face.FaceInfo;
... ... @@ -7,11 +9,14 @@ import com.arcsoft.face.FaceSimilar;
7 9 import com.arcsoft.face.enums.ErrorInfo;
8 10 import com.arcsoft.face.toolkit.ImageFactory;
9 11 import com.arcsoft.face.toolkit.ImageInfo;
  12 +import com.ruoyi.common.core.domain.ResponseResult;
10 13 import com.ruoyi.common.utils.file.FileUploadUtils;
  14 +import com.ruoyi.common.utils.sign.Base64;
11 15 import com.ruoyi.config.BsthSystemConfig;
12 16 import com.ruoyi.domain.driver.NewDriver;
13 17 import com.ruoyi.service.driver.NewDriverService;
14 18 import com.ruoyi.service.dss.FaceService;
  19 +import com.ruoyi.utils.HttpClientUtil;
15 20 import com.ruoyi.utils.SpringApplicationUtil;
16 21 import lombok.extern.slf4j.Slf4j;
17 22 import org.apache.commons.collections4.CollectionUtils;
... ... @@ -19,12 +24,12 @@ import org.apache.commons.io.IOUtils;
19 24 import org.apache.commons.lang3.StringUtils;
20 25 import org.springframework.beans.factory.annotation.Autowired;
21 26 import org.springframework.stereotype.Service;
  27 +import sun.misc.BASE64Encoder;
22 28  
23 29 import javax.imageio.ImageIO;
24 30 import java.awt.image.BufferedImage;
25   -import java.io.ByteArrayInputStream;
26   -import java.io.File;
27   -import java.io.IOException;
  31 +import java.io.*;
  32 +import java.nio.charset.StandardCharsets;
28 33 import java.util.*;
29 34  
30 35 import static com.arcsoft.face.toolkit.ImageFactory.getRGBData;
... ... @@ -40,6 +45,8 @@ public class FaceServiceImpl implements FaceService {
40 45 private NewDriverService newDriverService;
41 46 @Autowired
42 47 private BsthSystemConfig bsthSystemConfig;
  48 + @Autowired
  49 + private HttpClientUtil httpClientUtil;
43 50  
44 51  
45 52 @Override
... ... @@ -51,6 +58,65 @@ public class FaceServiceImpl implements FaceService {
51 58 return checkFace(drivers, driver);
52 59 }
53 60  
  61 + @Override
  62 + public String getBase64ImagePath(String path) {
  63 + String imageContent = convertFileToBase64(path);
  64 + return StringUtils.isEmpty(imageContent) ? null : imageContent;
  65 + }
  66 +
  67 + @Override
  68 + public String getBase64ImageContent(String content) {
  69 + return convertBase64(content.getBytes(StandardCharsets.UTF_8));
  70 + }
  71 +
  72 + @Override
  73 + public ResponseResult<String> getFaceFeatureImageContent(String content) {
  74 + String json = null;
  75 + Map<String, Object> parentMap = new HashMap<>();
  76 + try {
  77 +
  78 + parentMap.put("method", "getfacelitefeature");
  79 + parentMap.put("faceid", "1");
  80 + String faceValue = FileUploadUtils.choosePrictureContent(content);
  81 + parentMap.put("data", faceValue);
  82 +
  83 + json = httpClientUtil.doPost(bsthSystemConfig.getFaceFeatureURL(), parentMap, null);
  84 + if (StringUtils.isEmpty(json)) {
  85 + log.warn("获取面部特征失败,请检查数据:[{}],[{}],[{}]", json,bsthSystemConfig.getFaceFeatureURL(), JSON.toJSONString(parentMap));
  86 + return ResponseResult.error("获取面部特征失败,请稍后再试");
  87 + }
  88 + json = StringUtils.substringAfter(json, "{");
  89 + json = StringUtils.substringBeforeLast(json, "}");
  90 + String[] results = StringUtils.split(json, ",");
  91 + Map<String, String> resultMap = new HashMap<>();
  92 + for (String result : results) {
  93 + result = StringUtils.replace(result, "\\\"", "");
  94 + String key = StringUtils.trim(StringUtils.substringBefore(result, ":"));
  95 + String value = StringUtils.trim(StringUtils.substringAfter(result, ":"));
  96 + resultMap.put(key, value);
  97 + }
  98 +
  99 +
  100 + if (!StringUtils.equalsIgnoreCase(resultMap.get("result"), "ok")) {
  101 + log.warn("获取面部特征不成功,,请检查数据:[{}],[{}],[{}]", json,bsthSystemConfig.getFaceFeatureURL(), JSON.toJSONString(parentMap));
  102 + return ResponseResult.error("获取面部特征失败,请稍后再试");
  103 + }
  104 + String faceFeature = Convert.toStr(resultMap.get("strlitefeature"));
  105 + ResponseResult<String> responseResult =ResponseResult.success();
  106 + responseResult.setData(faceFeature);
  107 + return responseResult;
  108 + } catch (Exception e) {
  109 + log.error("获取面部特征异常,返回的结果是:[{}],[{}],[{}]", json,bsthSystemConfig.getFaceFeatureURL(), JSON.toJSONString(parentMap), e);
  110 + return ResponseResult.error("获取面部特征异常,请稍后再试");
  111 + }
  112 + }
  113 +
  114 + @Override
  115 + public ResponseResult<String> getFaceFeatureImagePath(String path) {
  116 + String content = getBase64ImagePath(path);
  117 + return getFaceFeatureImageContent(content);
  118 + }
  119 +
54 120 private NewDriver checkFace(List<NewDriver> drivers, NewDriver sourceDriver) {
55 121 if (CollectionUtils.isEmpty(drivers)) {
56 122 return null;
... ... @@ -143,7 +209,7 @@ public class FaceServiceImpl implements FaceService {
143 209 }
144 210  
145 211 int size = CollectionUtils.size(faceInfoList);
146   - if(size == 0){
  212 + if (size == 0) {
147 213 log.error("人脸对比失败,没有人脸特征数据:[{}];错误代码:[{}]", driver, errorCode);
148 214 return null;
149 215 }
... ... @@ -157,4 +223,27 @@ public class FaceServiceImpl implements FaceService {
157 223 return faceFeature;
158 224 }
159 225  
  226 + public String convertFileToBase64(String imgPath) {
  227 + byte[] data = null;
  228 + InputStream in = null;
  229 + // 读取图片字节数组
  230 + try {
  231 + in = new FileInputStream(imgPath);
  232 + System.out.println("文件大小(字节)=" + in.available());
  233 + data = new byte[in.available()];
  234 + in.read(data);
  235 + } catch (IOException e) {
  236 + log.error("转换图片异常:[{}]", imgPath, e);
  237 + return null;
  238 + } finally {
  239 + IOUtils.closeQuietly(in);
  240 + }
  241 + return convertBase64(data);
  242 + }
  243 +
  244 + private String convertBase64(byte[] data) {
  245 + // 对字节数组进行Base64编码,得到Base64编码的字符串
  246 + return Base64.encode(data);
  247 + }
  248 +
160 249 }
... ...
Bsth-admin/src/main/java/com/ruoyi/service/impl/key/location/LinggangKeyWorkLocationServiceImpl.java
... ... @@ -298,6 +298,24 @@ public class LinggangKeyWorkLocationServiceImpl extends ServiceImpl&lt;LinggangKeyW
298 298 }
299 299  
300 300 @Override
  301 + public LinggangKeyWorkLocation getOneByKeyIdAndTime(LinggangKeyWorkLocation entity) {
  302 + LambdaQueryWrapper<LinggangKeyWorkLocation> wrapper = new LambdaQueryWrapper<>(entity);
  303 + wrapper.le(LinggangKeyWorkLocation::getCreateTime,entity.getMaxCreateDate());
  304 + wrapper.orderByDesc(LinggangKeyWorkLocation::getCreateTime);
  305 + wrapper.last("limit 1");
  306 + return getOne(wrapper);
  307 + }
  308 +
  309 + @Override
  310 + public List<LinggangKeyWorkLocation> getTenByKeyIdAndTime(LinggangKeyWorkLocation entity) {
  311 + LambdaQueryWrapper<LinggangKeyWorkLocation> wrapper = new LambdaQueryWrapper<>(entity);
  312 + wrapper.le(LinggangKeyWorkLocation::getCreateTime,entity.getMaxCreateDate());
  313 + wrapper.orderByDesc(LinggangKeyWorkLocation::getCreateTime);
  314 + wrapper.last("limit 10");
  315 + return list(wrapper);
  316 + }
  317 +
  318 + @Override
301 319 public Integer countId(LinggangKeyWorkLocation entity) {
302 320 LambdaQueryWrapper<LinggangKeyWorkLocation> wrapper = new LambdaQueryWrapper<>(entity);
303 321 wrapper.select(LinggangKeyWorkLocation::getId);
... ... @@ -886,6 +904,7 @@ public class LinggangKeyWorkLocationServiceImpl extends ServiceImpl&lt;LinggangKeyW
886 904 if (Objects.equals(sc.getBcType(), BC_TYPE_OUT)) {
887 905 location.setType(3);
888 906 }
  907 + location.setCreateTime(new Date());
889 908 location.setType1(2);
890 909 return location;
891 910  
... ...
Bsth-admin/src/main/java/com/ruoyi/service/impl/scheduling/LinggangSchedulingServiceImpl.java
... ... @@ -10,22 +10,24 @@ import com.ruoyi.common.utils.DateUtils;
10 10 import com.ruoyi.domain.OrderEntity;
11 11 import com.ruoyi.domain.scheduling.LinggangScheduling;
12 12 import com.ruoyi.mapper.scheduling.LinggangSchedulingMapper;
  13 +import com.ruoyi.scheduling.domain.DriverSchedulingV1;
  14 +import com.ruoyi.scheduling.domain.SchedulingDateEntity;
  15 +import com.ruoyi.scheduling.service.SchedulingServiceV1;
13 16 import com.ruoyi.service.scheduling.LinggangSchedulingService;
14 17 import org.apache.commons.collections4.CollectionUtils;
15 18 import org.apache.commons.lang3.StringUtils;
16 19 import org.springframework.beans.factory.annotation.Autowired;
17 20 import org.springframework.stereotype.Service;
18 21  
19   -import java.util.Collection;
20   -import java.util.Collections;
21   -import java.util.List;
22   -import java.util.Objects;
  22 +import java.util.*;
23 23  
24 24 @Service
25 25 /** Service实现类*/
26 26 public class LinggangSchedulingServiceImpl extends ServiceImpl<LinggangSchedulingMapper, LinggangScheduling> implements LinggangSchedulingService {
27 27 @Autowired
28 28 private LinggangSchedulingMapper linggangSchedulingMapper;
  29 + @Autowired
  30 + private SchedulingServiceV1 schedulingServiceV1;
29 31  
30 32 /**
31 33 * 分页查询
... ... @@ -72,7 +74,13 @@ public class LinggangSchedulingServiceImpl extends ServiceImpl&lt;LinggangSchedulin
72 74  
73 75 @Override
74 76 public List<LinggangScheduling> list(LinggangScheduling entity, OrderEntity orderEntity) {
  77 + String scheDateStr = null;
  78 + if(Objects.nonNull(entity.getScheduleDate())){
  79 + scheDateStr= DateUtils.YYYY_MM_DD.format(entity.getScheduleDate());
  80 + }
  81 + entity.setScheduleDate(null);
75 82 LambdaQueryWrapper<LinggangScheduling> wrapper = new LambdaQueryWrapper<>(entity);
  83 + switchScheduleDateLike(wrapper,scheDateStr);
76 84 switchScheduleDate(wrapper, entity);
77 85 if (Objects.nonNull(orderEntity)) {
78 86 orderColumn(wrapper, orderEntity);
... ... @@ -109,6 +117,25 @@ public class LinggangSchedulingServiceImpl extends ServiceImpl&lt;LinggangSchedulin
109 117  
110 118 return list(wrapper);
111 119 }
  120 +
  121 + @Override
  122 + public List<LinggangScheduling> listByTime(LinggangScheduling entity) {
  123 + SchedulingDateEntity en = schedulingServiceV1.switchSchedulingDate(entity.getScheduleDate());
  124 + entity.setStartScheduleDate(en.getStartDate());
  125 + entity.setEndScheduleDate(en.getEndDate());
  126 +
  127 + Date date = entity.getScheduleDate();
  128 + entity.setScheduleDate(null);
  129 + LambdaQueryWrapper<LinggangScheduling> wrapper = new LambdaQueryWrapper<>(entity);
  130 +
  131 + wrapper.and(wr -> {
  132 + String dateStr = DateUtils.YYYY_MM_DD.format(date);
  133 + wr.likeRight(LinggangScheduling::getScheduleDate, dateStr).or().between(LinggangScheduling::getFcsjT, entity.getStartScheduleDate().getTime(), entity.getEndScheduleDate().getTime());
  134 + });
  135 + wrapper.orderByAsc(LinggangScheduling::getFcsjT);
  136 +
  137 + return list(wrapper);
  138 + }
112 139 // @Override
113 140 // public List<LinggangScheduling> listOfSelect(LinggangScheduling entity) {
114 141 // LambdaQueryWrapper<LinggangScheduling> wrapper = new LambdaQueryWrapper<>(entity);
... ... @@ -343,4 +370,5 @@ public class LinggangSchedulingServiceImpl extends ServiceImpl&lt;LinggangSchedulin
343 370 wrapper.likeRight(LinggangScheduling::getScheduleDate,scheduleDateStr);
344 371 }
345 372 }
  373 +
346 374 }
347 375 \ No newline at end of file
... ...
Bsth-admin/src/main/java/com/ruoyi/service/impl/sign/in/exception/report/EquipmentExceptionReportServiceImpl.java
... ... @@ -52,6 +52,7 @@ public class EquipmentExceptionReportServiceImpl extends ServiceImpl&lt;EquipmentEx
52 52 public IPage<EquipmentExceptionReport> pageList(Page<EquipmentExceptionReport> page, EquipmentExceptionReport entity, OrderEntity orderEntity) {
53 53 LambdaQueryWrapper<EquipmentExceptionReport> countWrapper = new LambdaQueryWrapper<>(entity);
54 54 countWrapper.select(EquipmentExceptionReport::getId);
  55 + combationNotINSignIds(countWrapper,entity);
55 56 if (CollectionUtils.isNotEmpty(entity.getDriverJobs())) {
56 57 countWrapper.in(EquipmentExceptionReport::getJobCode, entity.getDriverJobs());
57 58 }
... ... @@ -64,6 +65,7 @@ public class EquipmentExceptionReportServiceImpl extends ServiceImpl&lt;EquipmentEx
64 65 if (CollectionUtils.isNotEmpty(entity.getDriverJobs())) {
65 66 selectWrapper.in(EquipmentExceptionReport::getJobCode, entity.getDriverJobs());
66 67 }
  68 + combationNotINSignIds(selectWrapper,entity);
67 69  
68 70 orderColumn(selectWrapper, orderEntity);
69 71 lists = list(selectWrapper);
... ... @@ -86,21 +88,20 @@ public class EquipmentExceptionReportServiceImpl extends ServiceImpl&lt;EquipmentEx
86 88  
87 89 entity.setFleetName(null);
88 90 entity.setLineName(null);
89   - LambdaQueryWrapper<EquipmentExceptionReport> wrapper = new LambdaQueryWrapper<>(entity);
90   - if(CollectionUtils.isNotEmpty(entity.getSignIds())){
91   - wrapper.in(EquipmentExceptionReport::getSignId,entity.getSignIds());
  91 + LambdaQueryWrapper<EquipmentExceptionReport> wrapper = new LambdaQueryWrapper<>(entity);
  92 + if (CollectionUtils.isNotEmpty(entity.getSignIds())) {
  93 + wrapper.in(EquipmentExceptionReport::getSignId, entity.getSignIds());
92 94 }
93 95  
94   - if(StringUtils.isNotEmpty(lineName)){
95   - wrapper.like(EquipmentExceptionReport::getLineName,lineName);
  96 + if (StringUtils.isNotEmpty(lineName)) {
  97 + wrapper.like(EquipmentExceptionReport::getLineName, lineName);
96 98 }
97 99  
98   - if(StringUtils.isNotEmpty(fleetName)){
99   - wrapper.like(EquipmentExceptionReport::getFleetName,fleetName);
  100 + if (StringUtils.isNotEmpty(fleetName)) {
  101 + wrapper.like(EquipmentExceptionReport::getFleetName, fleetName);
100 102 }
101 103  
102 104  
103   -
104 105 return list(wrapper);
105 106 }
106 107 // @Override
... ... @@ -175,14 +176,14 @@ public class EquipmentExceptionReportServiceImpl extends ServiceImpl&lt;EquipmentEx
175 176 }
176 177  
177 178 LinggangScheduling scheduling = schedulingService.getById(signIn.getSchedulingId());
178   - if(Objects.isNull(scheduling)){
179   - log.error("没有找到打卡信息[{}]",signIn);
  179 + if (Objects.isNull(scheduling)) {
  180 + log.error("没有找到打卡信息[{}]", signIn);
180 181 return false;
181 182 }
182 183  
183 184 NewDriver driver = driverService.getOne(signIn.getJobCode());
184   - if(Objects.isNull(driver)){
185   - log.error("没有找到用户信息[{}]",signIn);
  185 + if (Objects.isNull(driver)) {
  186 + log.error("没有找到用户信息[{}]", signIn);
186 187 return false;
187 188 }
188 189  
... ... @@ -328,4 +329,10 @@ public class EquipmentExceptionReportServiceImpl extends ServiceImpl&lt;EquipmentEx
328 329 wrapper.orderByDesc(EquipmentExceptionReport::getId);
329 330 }
330 331 }
  332 +
  333 + private static void combationNotINSignIds(LambdaQueryWrapper<EquipmentExceptionReport> wrapper, EquipmentExceptionReport entity) {
  334 + if (CollectionUtils.isNotEmpty(entity.getNotSignIn())) {
  335 + wrapper.notIn(EquipmentExceptionReport::getSignIn, entity.getNotSignIn()).or().isNull(EquipmentExceptionReport::getSignIn);
  336 + }
  337 + }
331 338 }
332 339 \ No newline at end of file
... ...
Bsth-admin/src/main/java/com/ruoyi/service/key/location/LinggangKeyWorkLocationService.java
... ... @@ -33,12 +33,12 @@ public interface LinggangKeyWorkLocationService extends IService&lt;LinggangKeyWork
33 33  
34 34 List<LinggangKeyWorkLocation> listRecent(Collection<Integer> keyIds, Date date);
35 35  
36   - List<LinggangKeyWorkLocation> listRecent(LinggangKeyWorkLocation entity,Collection<Integer> keyIds, Date date);
  36 + List<LinggangKeyWorkLocation> listRecent(LinggangKeyWorkLocation entity, Collection<Integer> keyIds, Date date);
37 37  
38 38 /**
39 39 * 带条件查询
40 40 */
41   - List<LinggangKeyWorkLocation> listOfLtEqScheduleDate(LinggangKeyWorkLocation entity,Date scheduleDate);
  41 + List<LinggangKeyWorkLocation> listOfLtEqScheduleDate(LinggangKeyWorkLocation entity, Date scheduleDate);
42 42  
43 43 // List<LinggangKeyWorkLocation> listOfIds(java.util.Collection<java.lang.Long> ids);
44 44 // /***
... ... @@ -51,6 +51,13 @@ public interface LinggangKeyWorkLocationService extends IService&lt;LinggangKeyWork
51 51 */
52 52 LinggangKeyWorkLocation getOne(LinggangKeyWorkLocation entity);
53 53  
  54 + /**
  55 + * 条件查询只返回一条数据的方法
  56 + */
  57 + LinggangKeyWorkLocation getOneByKeyIdAndTime(LinggangKeyWorkLocation entity);
  58 +
  59 + List<LinggangKeyWorkLocation> getTenByKeyIdAndTime(LinggangKeyWorkLocation entity);
  60 +
54 61 Integer countId(LinggangKeyWorkLocation entity);
55 62  
56 63 /**
... ... @@ -75,12 +82,12 @@ public interface LinggangKeyWorkLocationService extends IService&lt;LinggangKeyWork
75 82 * @param locations
76 83 * @return com.ruoyi.common.core.domain.ResponseResult<T>
77 84 */
78   - ResponseResult<Boolean> updateTakeKey(List<LinggangKeyWorkLocation> locations, LinggangKeyWorkLocation.LinggangKeyWorkLocationTypeEnum typeEnum);
  85 + ResponseResult<Boolean> updateTakeKey(List<LinggangKeyWorkLocation> locations, LinggangKeyWorkLocation.LinggangKeyWorkLocationTypeEnum typeEnum);
79 86  
80   - ResponseResult<Boolean> saveAndDel(List<LinggangKeyWorkLocation> locations);
  87 + ResponseResult<Boolean> saveAndDel(List<LinggangKeyWorkLocation> locations);
81 88  
82 89 boolean deleteById(Long id);
83 90  
84   - boolean removeBySchedulingId(Set<Long> schedulingId );
  91 + boolean removeBySchedulingId(Set<Long> schedulingId);
85 92  
86 93 }
87 94 \ No newline at end of file
... ...
Bsth-admin/src/main/java/com/ruoyi/service/scheduling/LinggangSchedulingService.java
... ... @@ -31,6 +31,8 @@ public interface LinggangSchedulingService extends IService&lt;LinggangScheduling&gt;
31 31  
32 32 List<LinggangScheduling> listNbbm(LinggangScheduling entity,Collection<String> nbbm);
33 33  
  34 + List<LinggangScheduling> listByTime(LinggangScheduling entity);
  35 +
34 36 // List<LinggangScheduling> listOfIds(java.util.Collection<java.lang.Integer> ids);
35 37 // /***
36 38 // *用于页面选择
... ...
Bsth-admin/src/main/resources/application-druid-dev.yml
... ... @@ -221,6 +221,9 @@ bsth:
221 221 path: D:/work/code/jienengjiancha/bsth-alcohol-sign/Bsth-admin/src/main/resources/libs/WIN64
222 222 faceFeature:
223 223 url: http://222.76.217.238:8880/fcgi-bin/entry.fcgi/system
  224 + process:
  225 + sign:
  226 + url: http://127.0.0.1:9103/commonOpenDataApi/sendAppAndSmsNotice
224 227 skip:
225 228 url: /big/view/queryNumberByType;/big/view/queryLineInfo/*;/big/view/querySignDetails;/report/list/**;/system/dict/data/**;/app/version/check/**;/app/checkDeviceHeart;/app/download;"/driver/**;/in/**;/eexception/**;/equipment/**;/report/**;/login;/register;/captchaImage;/dss/Driver/Auth;/test/**;/login/no/code;/actuator/health;/upload/image/**;
226 229  
... ...
Bsth-admin/src/main/resources/mapper/driver/DriverMapper.xml
... ... @@ -24,6 +24,7 @@
24 24 <result property="lineCode" column="line_code"/>
25 25 <result property="updateTime" column="update_time"/>
26 26 <result property="fleetName" column="fleet_name"/>
  27 + <result property="imageVersion" column="image_version"/>
27 28 </resultMap>
28 29 <resultMap id="PeopleResult" type="com.ruoyi.pojo.vo.PeopleResponseVo">
29 30  
... ... @@ -35,32 +36,35 @@
35 36 </resultMap>
36 37 <sql id="selectDriverVo">
37 38 select id,
38   - job_code,
39   - company_code,
40   - branche_company_code,
41   - personnel_name,
42   - papers_code,
43   - ic_card_code,
44   - personnel_type,
45   - posts,
46   - card,
47   - telphone,
48   - ic_rfid,
49   - id_rfid,
50   - tag_rfid,
51   - remark,
52   - line_name,
53   - line_code,
54   - face_sign_in,
55   - image,
56   - update_time,
57   - sign_in_equipment,
58   - fleet_name
  39 + job_code,
  40 + company_code,
  41 + branche_company_code,
  42 + personnel_name,
  43 + papers_code,
  44 + ic_card_code,
  45 + personnel_type,
  46 + posts,
  47 + card,
  48 + telphone,
  49 + ic_rfid,
  50 + id_rfid,
  51 + tag_rfid,
  52 + remark,
  53 + line_name,
  54 + line_code,
  55 + face_sign_in,
  56 + image,
  57 + update_time,
  58 + sign_in_equipment,
  59 + fleet_name,
  60 + image_version
59 61 from driver
60 62 </sql>
61 63 <sql id="insertDriverVo">
62 64 job_code
63   - , company_code, branche_company_code, personnel_name, papers_code, ic_card_code, personnel_type, posts, card, telphone, ic_rfid, id_rfid, tag_rfid, remark, line_name, line_code,face_sign_in,image,update_time,sign_in_equipment,fleet_name
  65 + , company_code, branche_company_code, personnel_name, papers_code, ic_card_code, personnel_type, posts, card,
  66 + telphone, ic_rfid, id_rfid, tag_rfid, remark, line_name,
  67 + line_code,face_sign_in,image,update_time,sign_in_equipment,fleet_name
64 68 </sql>
65 69  
66 70 <select id="selectDriverList" parameterType="Driver" resultMap="DriverResult">
... ... @@ -182,22 +186,22 @@
182 186 </select>
183 187 <select id="queryAttendanceInfoById" resultType="com.ruoyi.pojo.vo.PeopleResponseVo" resultMap="PeopleResult">
184 188 SELECT driver.job_code,
185   - driver.personnel_name,
186   - driver.posts,
187   - driver.fleet_name,
188   - rule_setting_driver.start_date
  189 + driver.personnel_name,
  190 + driver.posts,
  191 + driver.fleet_name,
  192 + rule_setting_driver.start_date
189 193 FROM driver,
190   - rule_setting_driver
  194 + rule_setting_driver
191 195 WHERE driver.job_code = rule_setting_driver.job_code
192   - and rule_setting_driver.setting_id = #{id}
  196 + and rule_setting_driver.setting_id = #{id}
193 197 </select>
194 198 <select id="queryAttendanceInfoAll" resultType="com.ruoyi.pojo.vo.PeopleResponseVo" resultMap="PeopleResult">
195 199 SELECT job_code,
196   - personnel_name,
197   - posts,
198   - fleet_name
  200 + personnel_name,
  201 + posts,
  202 + fleet_name
199 203 FROM driver
200   --- WHERE driver.posts != "驾驶员" and driver.posts != "售票员"
  204 + -- WHERE driver.posts != "驾驶员" and driver.posts != "售票员"
201 205 </select>
202 206 <select id="queryEmptyJob" resultType="java.lang.String">
203 207 SELECT
... ... @@ -238,6 +242,8 @@
238 242 <if test="image != null">image,</if>
239 243 <if test="updateTime != null">update_time,</if>
240 244 <if test="fleetName != null">fleet_name</if>
  245 + <if test="faceFeature != null">face_Feature</if>
  246 + <if test="imageVersion != null">image_version</if>
241 247 </trim>
242 248 <trim prefix="values (" suffix=")" suffixOverrides=",">
243 249 <if test="jobCode != null and jobCode != ''">#{jobCode},</if>
... ... @@ -260,6 +266,8 @@
260 266 <if test="image != null">#{image},</if>
261 267 <if test="updateTime != null">#{updateTime},</if>
262 268 <if test="fleetName != null">#{fleetName}</if>
  269 + <if test="faceFeature != null">#{faceFeature}</if>
  270 + <if test="imageVersion != null">#{imageVersion}</if>
263 271 </trim>
264 272 on duplicate key update
265 273 job_code = values(job_code)
... ... @@ -287,7 +295,9 @@
287 295 <if test="faceSignIn != null">face_sign_in = #{faceSignIn},</if>
288 296 <if test="image != null">image = #{image},</if>
289 297 <if test="signInEquipment != null">sign_in_equipment = #{signInEquipment},</if>
290   - <if test="fleetName != null">fleet_name = #{fleetName}</if>
  298 + <if test="fleetName != null">fleet_name = #{fleetName},</if>
  299 + <if test="faceFeature != null">face_Feature = #{faceFeature},</if>
  300 + <if test="imageVersion != null">image_version = #{imageVersion}</if>
291 301 </trim>
292 302 where id = #{id}
293 303 </update>
... ... @@ -295,31 +305,31 @@
295 305 update driver
296 306 set face_sign_in = 0
297 307 WHERE face_sign_in != 1 and job_code in (
298   - SELECT job_code
299   - FROM driver_face_device_id,equipment
300   - WHERE equipment.`status` = 1 and driver_face_device_id.device_id = equipment.device_id
301   - GROUP BY job_code
302   - HAVING COUNT(*) = #{count}
303   - );
  308 + SELECT job_code
  309 + FROM driver_face_device_id,equipment
  310 + WHERE equipment.`status` = 1 and driver_face_device_id.device_id = equipment.device_id
  311 + GROUP BY job_code
  312 + HAVING COUNT(*) = #{count}
  313 + );
304 314 update driver
305 315 set face_sign_in = 0
306 316 WHERE face_sign_in = 1
307   - and job_code in (SELECT job_code
308   - FROM driver_face_device_id,
309   - equipment
310   - WHERE equipment.`status` = 1
311   - and driver_face_device_id.device_id = equipment.device_id
312   - GROUP BY job_code
313   - HAVING COUNT(*) = #{count});
  317 + and job_code in (SELECT job_code
  318 + FROM driver_face_device_id,
  319 + equipment
  320 + WHERE equipment.`status` = 1
  321 + and driver_face_device_id.device_id = equipment.device_id
  322 + GROUP BY job_code
  323 + HAVING COUNT(*) = #{count});
314 324 update driver
315 325 set face_sign_in = 2
316 326 WHERE face_sign_in != 1 and job_code not in (
317   - SELECT job_code
318   - FROM driver_face_device_id,equipment
319   - WHERE equipment.`status` = 1 and driver_face_device_id.device_id = equipment.device_id
320   - GROUP BY job_code
321   - HAVING COUNT(*) = #{count}
322   - );
  327 + SELECT job_code
  328 + FROM driver_face_device_id,equipment
  329 + WHERE equipment.`status` = 1 and driver_face_device_id.device_id = equipment.device_id
  330 + GROUP BY job_code
  331 + HAVING COUNT(*) = #{count}
  332 + );
323 333 </update>
324 334 <update id="updateSignStatusDriversByJobCodes">
325 335 <foreach collection="list" item="item" separator=";">
... ...
Bsth-admin/src/main/resources/mapper/eexception/EquipmentExceptionMapper.xml
... ... @@ -120,7 +120,7 @@
120 120 </if>
121 121 <if test="jobCode != null and jobCode != ''">and driver.job_code = #{jobCode}</if>
122 122 <if test="exType != null ">and ex_type = #{exType}</if>
123   - <if test="id != null ">and equipment_exception.id #{id}</if>
  123 + <if test="id != null ">and equipment_exception.id = #{id}</if>
124 124 <if test="date != null ">
125 125 and
126 126 equipment_exception.create_time &gt;= CONCAT(#{date}, ' 02:30:00')
... ... @@ -155,6 +155,7 @@
155 155 <if test="lineName != null and lineName != ''">line_name,</if>
156 156 <if test="planTime != null">plan_time,</if>
157 157 <if test="signType != null">sign_type,</if>
  158 + <if test="signId != null">sign_id,</if>
158 159 </trim>
159 160 <trim prefix="values (" suffix=")" suffixOverrides=",">
160 161 <if test="title != null">#{title},</if>
... ... @@ -170,6 +171,7 @@
170 171 <if test="lineName != null and lineName != ''">#{lineName},</if>
171 172 <if test="planTime != null ">#{planTime},</if>
172 173 <if test="signType != null ">#{signType},</if>
  174 + <if test="signId != null ">#{signId},</if>
173 175 </trim>
174 176 </insert>
175 177  
... ...