Commit 072d50b22b31c92e346e2d896d7436039e6b0cd9
1 parent
467471bd
酒测比对失败
Showing
4 changed files
with
100 additions
and
2 deletions
Bsth-admin/src/main/java/com/ruoyi/controller/dss/DssDriverController.java
| ... | ... | @@ -3,6 +3,7 @@ package com.ruoyi.controller.dss; |
| 3 | 3 | import cn.hutool.core.convert.Convert; |
| 4 | 4 | import com.baomidou.mybatisplus.core.metadata.IPage; |
| 5 | 5 | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| 6 | +import com.ruoyi.common.ConstSignInConstSignInProperties; | |
| 6 | 7 | import com.ruoyi.common.TipEnum; |
| 7 | 8 | import com.ruoyi.common.core.controller.BaseController; |
| 8 | 9 | import com.ruoyi.common.core.domain.AjaxResult; |
| ... | ... | @@ -477,10 +478,15 @@ public class DssDriverController extends BaseController { |
| 477 | 478 | signIn.setDeviceId(dto.getDevice()); |
| 478 | 479 | // signIn.setImage(); |
| 479 | 480 | signIn.setJobCode(dto.getStaffCode()); |
| 480 | - signIn.setAlcoholIntake(Convert.toBigDecimal(dto.getTestValue())); | |
| 481 | + | |
| 481 | 482 | signIn.setCreateTime(dto.getSignTime()); |
| 482 | 483 | signIn.setType(1); |
| 483 | 484 | |
| 485 | + if(Objects.nonNull(dto.getTestValue())) { | |
| 486 | + signIn.setAlcoholFlag(ConstSignInConstSignInProperties.ALCOHOL_FLAG_YES); | |
| 487 | + signIn.setAlcoholIntake(Convert.toBigDecimal(dto.getTestValue())); | |
| 488 | + } | |
| 489 | + | |
| 484 | 490 | // SysDictData sysDictData = querySystData(null,"drunkenness"); |
| 485 | 491 | // if(Objects.nonNull(sysDictData)){ |
| 486 | 492 | // | ... | ... |
Bsth-admin/src/main/java/com/ruoyi/controller/dss/RemindDriverKeyLocalController.java
| ... | ... | @@ -2,11 +2,22 @@ package com.ruoyi.controller.dss; |
| 2 | 2 | |
| 3 | 3 | import com.ruoyi.common.core.controller.BaseController; |
| 4 | 4 | import com.ruoyi.common.core.domain.ResponseResult; |
| 5 | +import com.ruoyi.domain.OrderEntity; | |
| 6 | +import com.ruoyi.domain.dss.key.location.vo.RemindKeyInfoLocalVo; | |
| 5 | 7 | import com.ruoyi.domain.dss.scheling.dto.RemindDriverReportDTO; |
| 6 | 8 | import com.ruoyi.domain.dss.scheling.vo.RemindDriverReportVo; |
| 9 | +import com.ruoyi.domain.key.location.LinggangKeyWorkLocation; | |
| 10 | +import com.ruoyi.domain.scheduling.LinggangScheduling; | |
| 11 | +import com.ruoyi.equipment.domain.Equipment; | |
| 12 | +import com.ruoyi.equipment.service.IEquipmentService; | |
| 13 | +import com.ruoyi.service.key.location.LinggangKeyWorkLocationService; | |
| 14 | +import com.ruoyi.service.scheduling.LinggangSchedulingService; | |
| 7 | 15 | import io.swagger.annotations.Api; |
| 8 | 16 | import io.swagger.annotations.ApiOperation; |
| 9 | 17 | import lombok.extern.slf4j.Slf4j; |
| 18 | +import org.apache.commons.collections4.CollectionUtils; | |
| 19 | +import org.apache.commons.lang3.time.DateUtils; | |
| 20 | +import org.springframework.beans.factory.annotation.Autowired; | |
| 10 | 21 | import org.springframework.validation.BindingResult; |
| 11 | 22 | import org.springframework.web.bind.annotation.PostMapping; |
| 12 | 23 | import org.springframework.web.bind.annotation.RequestBody; |
| ... | ... | @@ -14,6 +25,8 @@ import org.springframework.web.bind.annotation.RequestMapping; |
| 14 | 25 | import org.springframework.web.bind.annotation.RestController; |
| 15 | 26 | |
| 16 | 27 | import javax.validation.Valid; |
| 28 | +import java.util.*; | |
| 29 | +import java.util.stream.Collectors; | |
| 17 | 30 | |
| 18 | 31 | /** |
| 19 | 32 | * @author liujun |
| ... | ... | @@ -25,6 +38,12 @@ import javax.validation.Valid; |
| 25 | 38 | @Api(tags = "【对接】钥匙提醒功能") |
| 26 | 39 | public class RemindDriverKeyLocalController extends BaseController { |
| 27 | 40 | |
| 41 | + @Autowired | |
| 42 | + private LinggangSchedulingService linggangSchedulingService; | |
| 43 | + @Autowired | |
| 44 | + private LinggangKeyWorkLocationService linggangKeyWorkLocationService; | |
| 45 | + @Autowired | |
| 46 | + private IEquipmentService equipmentService; | |
| 28 | 47 | |
| 29 | 48 | @ApiOperation("司机提醒信息") |
| 30 | 49 | @PostMapping(value = "/remind/driver/key/local/report") |
| ... | ... | @@ -33,7 +52,68 @@ public class RemindDriverKeyLocalController extends BaseController { |
| 33 | 52 | return ResponseResult.error(bindingResult.getFieldError().getDefaultMessage()); |
| 34 | 53 | } |
| 35 | 54 | |
| 55 | + LinggangScheduling scheduling = new LinggangScheduling(); | |
| 56 | + scheduling.setJobCode(request.getJobCode()); | |
| 36 | 57 | |
| 37 | - return null; | |
| 58 | + scheduling.setStartScheduleDate(request.getDate()); | |
| 59 | + scheduling.setEndScheduleDate(DateUtils.addDays(request.getDate(), 1)); | |
| 60 | + | |
| 61 | + OrderEntity orderEntity = new OrderEntity(); | |
| 62 | + orderEntity.setOrder("ascending"); | |
| 63 | + orderEntity.setProp("fcsjT"); | |
| 64 | + | |
| 65 | + List<LinggangScheduling> linggangSchedulings = linggangSchedulingService.list(scheduling, orderEntity); | |
| 66 | + int size = CollectionUtils.size(linggangSchedulings); | |
| 67 | + | |
| 68 | + List<LinggangKeyWorkLocation> linggangKeyWorkLocations = null; | |
| 69 | + List<Equipment> equipments = null; | |
| 70 | + | |
| 71 | + if (0 < size) { | |
| 72 | + Set<Long> schedulingIds = linggangSchedulings.stream().map(LinggangScheduling::getId).collect(Collectors.toSet()); | |
| 73 | + linggangKeyWorkLocations = linggangKeyWorkLocationService.listRecent(null, schedulingIds); | |
| 74 | + if (CollectionUtils.isNotEmpty(linggangKeyWorkLocations)) { | |
| 75 | + Set<String> deviceIds = linggangKeyWorkLocations.stream().map(LinggangKeyWorkLocation::getDevice).collect(Collectors.toSet()); | |
| 76 | + equipments = equipmentService.listNameAndIDBydeviceIds(deviceIds); | |
| 77 | + } | |
| 78 | + } | |
| 79 | + RemindDriverReportVo reportVo = new RemindDriverReportVo(); | |
| 80 | + reportVo.setCount(size); | |
| 81 | + | |
| 82 | + if (CollectionUtils.isNotEmpty(linggangKeyWorkLocations)) { | |
| 83 | + List<RemindKeyInfoLocalVo> remindKeyInfoLocalVoList = new ArrayList<>(); | |
| 84 | + for (int i = 0; i < size; i = i + 2) { | |
| 85 | + RemindKeyInfoLocalVo localVo = new RemindKeyInfoLocalVo(); | |
| 86 | + localVo.setNbbm(linggangSchedulings.get(i).getNbbm()); | |
| 87 | + int index = i; | |
| 88 | + | |
| 89 | + Optional<LinggangKeyWorkLocation> optional = linggangKeyWorkLocations.stream().filter(kl -> Objects.equals(kl.getSchedulingId(), linggangSchedulings.get(index).getId())).findFirst(); | |
| 90 | + if (optional.isPresent()) { | |
| 91 | + localVo.setKeyInfoStatus(optional.get().getType()); | |
| 92 | + localVo.setYardName(optional.get().getYardName()); | |
| 93 | + | |
| 94 | + if (CollectionUtils.isNotEmpty(equipments)) { | |
| 95 | + Optional<LinggangKeyWorkLocation> finalOptional = optional; | |
| 96 | + Optional<Equipment> equipmentOptional = equipments.stream().filter(e -> Objects.equals(e.getDeviceId(), finalOptional.get().getDevice())).findFirst(); | |
| 97 | + equipmentOptional.ifPresent(equipment -> localVo.setEquipmentName(equipment.getName())); | |
| 98 | + } | |
| 99 | + | |
| 100 | + if (i + 1 < size) { | |
| 101 | + optional = linggangKeyWorkLocations.stream().filter(kl -> Objects.equals(kl.getSchedulingId(), linggangSchedulings.get(index).getId())).findFirst(); | |
| 102 | + if (optional.isPresent()) { | |
| 103 | + localVo.setReturnYardName(optional.get().getYardName()); | |
| 104 | + if (CollectionUtils.isNotEmpty(equipments)) { | |
| 105 | + Optional<LinggangKeyWorkLocation> finalOptional = optional; | |
| 106 | + Optional<Equipment> equipmentOptional = equipments.stream().filter(e -> Objects.equals(e.getDeviceId(), finalOptional.get().getDevice())).findFirst(); | |
| 107 | + equipmentOptional.ifPresent(equipment -> localVo.setReturnEquipmentName(equipment.getName())); | |
| 108 | + } | |
| 109 | + } | |
| 110 | + } | |
| 111 | + } | |
| 112 | + remindKeyInfoLocalVoList.add(localVo); | |
| 113 | + } | |
| 114 | + reportVo.setRemindKeyInfoLocalVoList(remindKeyInfoLocalVoList); | |
| 115 | + } | |
| 116 | + | |
| 117 | + return ResponseResult.success(reportVo); | |
| 38 | 118 | } |
| 39 | 119 | } | ... | ... |
Bsth-admin/src/main/java/com/ruoyi/service/impl/scheduling/LinggangSchedulingServiceImpl.java
| ... | ... | @@ -61,6 +61,16 @@ public class LinggangSchedulingServiceImpl extends ServiceImpl<LinggangSchedulin |
| 61 | 61 | } |
| 62 | 62 | |
| 63 | 63 | @Override |
| 64 | + public List<LinggangScheduling> list(LinggangScheduling entity, OrderEntity orderEntity) { | |
| 65 | + LambdaQueryWrapper<LinggangScheduling> wrapper = new LambdaQueryWrapper<>(entity); | |
| 66 | + switchScheduleDate(wrapper, entity); | |
| 67 | + if (Objects.nonNull(orderEntity)) { | |
| 68 | + orderColumn(wrapper, orderEntity); | |
| 69 | + } | |
| 70 | + return list(wrapper); | |
| 71 | + } | |
| 72 | + | |
| 73 | + @Override | |
| 64 | 74 | public List<LinggangScheduling> list(LinggangScheduling entity, Collection<Long> schedulingIds) { |
| 65 | 75 | LambdaQueryWrapper<LinggangScheduling> wrapper = null; |
| 66 | 76 | if (Objects.isNull(entity)) { | ... | ... |
Bsth-admin/src/main/java/com/ruoyi/service/scheduling/LinggangSchedulingService.java
| ... | ... | @@ -23,6 +23,8 @@ public interface LinggangSchedulingService extends IService<LinggangScheduling> |
| 23 | 23 | */ |
| 24 | 24 | List<LinggangScheduling> list(LinggangScheduling entity); |
| 25 | 25 | |
| 26 | + List<LinggangScheduling> list(LinggangScheduling entity, OrderEntity orderEntity); | |
| 27 | + | |
| 26 | 28 | List<LinggangScheduling> list(LinggangScheduling entity, Collection<Long> schedulingIds); |
| 27 | 29 | |
| 28 | 30 | List<LinggangScheduling> listByCZ(LinggangScheduling entity); | ... | ... |