Commit 1854df32856b0a473dfeaadf911da5a44a37998e
1 parent
88c7675e
酒测未通过审核
Showing
12 changed files
with
219 additions
and
38 deletions
Bsth-admin/src/main/java/com/ruoyi/controller/dss/DssFaceController.java
| ... | ... | @@ -94,7 +94,7 @@ public class DssFaceController extends BaseController { |
| 94 | 94 | } |
| 95 | 95 | |
| 96 | 96 | @ApiOperation(("人脸注册")) |
| 97 | - @PostMapping(value = "/Driver/FaceRegister") | |
| 97 | + @PostMapping(value = "/Face/FaceRegister") | |
| 98 | 98 | public ResponseResult<Object> faceRegister(@Valid @RequestBody FaceRegisterDTO dto, BindingResult bindingResult) { |
| 99 | 99 | if (bindingResult.hasErrors()) { |
| 100 | 100 | return ResponseResult.error(bindingResult.getFieldError().getDefaultMessage()); |
| ... | ... | @@ -236,7 +236,7 @@ public class DssFaceController extends BaseController { |
| 236 | 236 | vo.setStaffName(d.getPersonnelName()); |
| 237 | 237 | vo.setIcCardNo(d.getIcCardCode()); |
| 238 | 238 | vo.setFacePhotoPath(d.getImage()); |
| 239 | - vo.setFaceFeature(vo.getFaceFeature()); | |
| 239 | + vo.setFaceFeature(d.getFaceFeature()); | |
| 240 | 240 | vo.setStaffCode(d.getJobCode()); |
| 241 | 241 | // vo.setSynState(d.getS) |
| 242 | 242 | vo.setSynContent(d.getSyncontent()); | ... | ... |
Bsth-admin/src/main/java/com/ruoyi/controller/dss/KeyBoxController.java
| ... | ... | @@ -245,7 +245,9 @@ public class KeyBoxController extends BaseController { |
| 245 | 245 | if (Objects.isNull(responseResult)) { |
| 246 | 246 | return ResponseResult.error(); |
| 247 | 247 | } |
| 248 | - TakeKeyVo vo = convertTakeKeyVo(dto, responseResult); | |
| 248 | + Equipment equipment = equipmentService.getOneByDeviceId(dto.getDevice()); | |
| 249 | + | |
| 250 | + TakeKeyVo vo = convertTakeKeyVo(dto, responseResult,equipment); | |
| 249 | 251 | |
| 250 | 252 | return new ResponseResult<>(responseResult.getCode(), responseResult.getMsg(), vo); |
| 251 | 253 | } |
| ... | ... | @@ -264,10 +266,11 @@ public class KeyBoxController extends BaseController { |
| 264 | 266 | |
| 265 | 267 | List<LinggangKeyWorkLocation> locations = convert(dto, schedulings, driver); |
| 266 | 268 | ResponseResult<Boolean> responseResult = linggangKeyWorkLocationService.updateTakeKey(locations, LinggangKeyWorkLocation.LinggangKeyWorkLocationTypeEnum.REPAY); |
| 267 | - if (Objects.isNull(responseResult)) { | |
| 269 | + if (Objects.isNull(responseResult) || !responseResult.isSuccess()) { | |
| 268 | 270 | return ResponseResult.error(); |
| 269 | 271 | } |
| 270 | - TakeKeyVo vo = convertTakeKeyVo(dto, responseResult); | |
| 272 | + Equipment equipment = equipmentService.getOneByDeviceId(dto.getDevice()); | |
| 273 | + TakeKeyVo vo = convertTakeKeyVo(dto, responseResult,equipment); | |
| 271 | 274 | |
| 272 | 275 | return new ResponseResult<>(responseResult.getCode(), responseResult.getMsg(), vo); |
| 273 | 276 | } |
| ... | ... | @@ -382,8 +385,6 @@ public class KeyBoxController extends BaseController { |
| 382 | 385 | * 根据排班时间和钥匙ID查询钥匙 |
| 383 | 386 | * @author liujun |
| 384 | 387 | * @date 2024/7/16 17:05 |
| 385 | - * @param keyId | |
| 386 | - * @param scheduleDate | |
| 387 | 388 | * @param dto |
| 388 | 389 | * @return com.ruoyi.domain.key.location.LinggangKeyWorkLocation |
| 389 | 390 | */ |
| ... | ... | @@ -591,18 +592,26 @@ public class KeyBoxController extends BaseController { |
| 591 | 592 | } |
| 592 | 593 | } |
| 593 | 594 | |
| 594 | - location.setCreateBy(Convert.toLong(driver.getId())); | |
| 595 | + if(Objects.nonNull(driver)) { | |
| 596 | + location.setCreateBy(Convert.toLong(driver.getId())); | |
| 597 | + } | |
| 595 | 598 | location.setCreateTime(new Date()); |
| 596 | 599 | |
| 597 | 600 | return location; |
| 598 | 601 | }).filter(obj -> Objects.nonNull(obj.getKeyInfoId())).collect(Collectors.toList()); |
| 599 | 602 | } |
| 600 | 603 | |
| 601 | - private TakeKeyVo convertTakeKeyVo(TakeKeyDTO dto, ResponseResult<Boolean> result) { | |
| 604 | + private TakeKeyVo convertTakeKeyVo(TakeKeyDTO dto, ResponseResult<Boolean> result,Equipment equipment) { | |
| 602 | 605 | TakeKeyVo vo = new TakeKeyVo(); |
| 603 | 606 | vo.setDevice(dto.getDevice()); |
| 604 | 607 | vo.setTime(new Date()); |
| 605 | 608 | vo.setResult(result.isSuccess() ? 0 : 1); |
| 609 | + if(Objects.nonNull(equipment)){ | |
| 610 | + vo.setDeviceType(equipment.getPromise()); | |
| 611 | + vo.setDriverCode(equipment.getDeviceId()); | |
| 612 | + } | |
| 613 | + | |
| 614 | + | |
| 606 | 615 | return vo; |
| 607 | 616 | } |
| 608 | 617 | ... | ... |
Bsth-admin/src/main/java/com/ruoyi/controller/sign/in/exception/report/EquipmentExceptionReportController.java
| 1 | 1 | package com.ruoyi.controller.sign.in.exception.report; |
| 2 | 2 | |
| 3 | +import cn.hutool.core.convert.Convert; | |
| 3 | 4 | import com.baomidou.mybatisplus.core.metadata.IPage; |
| 4 | 5 | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| 5 | 6 | import com.ruoyi.common.core.controller.BaseController; |
| ... | ... | @@ -11,6 +12,7 @@ import com.ruoyi.domain.sign.in.exception.report.EquipmentExceptionReport; |
| 11 | 12 | import com.ruoyi.domain.sign.in.exception.report.dto.EquipmentExceptionReportAddDTO; |
| 12 | 13 | import com.ruoyi.domain.sign.in.exception.report.dto.EquipmentExceptionReportQueryDTO; |
| 13 | 14 | import com.ruoyi.domain.sign.in.exception.report.dto.EquipmentExceptionReportUpdateDTO; |
| 15 | +import com.ruoyi.domain.sign.in.exception.report.dto.EquipmentExceptionReportUpdateStatusDTO; | |
| 14 | 16 | import com.ruoyi.domain.sign.in.exception.report.vo.EquipmentExceptionReportVO; |
| 15 | 17 | import com.ruoyi.in.domain.SignIn; |
| 16 | 18 | import com.ruoyi.in.service.ISignInService; |
| ... | ... | @@ -151,17 +153,21 @@ public class EquipmentExceptionReportController extends BaseController { |
| 151 | 153 | } |
| 152 | 154 | |
| 153 | 155 | @ApiOperation("修改状态") |
| 154 | - @PostMapping(value = "/update/{status}/{id}") | |
| 155 | - public ResponseResult<Boolean> updateStatus(@PathVariable("status") Integer status, @PathVariable("id") Long id) { | |
| 156 | - EquipmentExceptionReport entity = equipmentExceptionReportService.getById(id); | |
| 157 | - if (Objects.isNull(entity)) { | |
| 158 | - return com.ruoyi.common.core.domain.ResponseResult.error("没有要修改的数据"); | |
| 156 | + @PostMapping(value = "/update/status") | |
| 157 | + public ResponseResult<Boolean> updateStatus(@RequestBody EquipmentExceptionReportUpdateStatusDTO dto) { | |
| 158 | + NewDriver driver = driverService.getOneByPhone(dto.getTelPhone()); | |
| 159 | + if(Objects.isNull(driver)){ | |
| 160 | + return ResponseResult.error("根据手机号没有找到相关的用户:[{}]",dto); | |
| 159 | 161 | } |
| 160 | -// entity.setUpdateBy(getUserId()); | |
| 161 | - entity.setUpdateTime(new Date()); | |
| 162 | - entity.setStatus(status); | |
| 163 | - entity.setReportTime(new Date()); | |
| 164 | - boolean flag = equipmentExceptionReportService.updateByPrimaryKey(entity); | |
| 162 | + EquipmentExceptionReport entity = new EquipmentExceptionReport(); | |
| 163 | + entity.setId(dto.getId()); | |
| 164 | + entity.setStatus(dto.getStatus()); | |
| 165 | + entity.setAlcoholIntake(dto.getAlcoholIntake()); | |
| 166 | + entity.setContent(dto.getContent()); | |
| 167 | + entity.setUpdateBy(Convert.toLong(driver.getId())); | |
| 168 | + | |
| 169 | + | |
| 170 | + boolean flag = equipmentExceptionReportService.updateStatusAndAddSign(entity); | |
| 165 | 171 | return flag ? com.ruoyi.common.core.domain.ResponseResult.success(Boolean.TRUE) : com.ruoyi.common.core.domain.ResponseResult.error("修改数据失败,请稍后再试"); |
| 166 | 172 | } |
| 167 | 173 | ... | ... |
Bsth-admin/src/main/java/com/ruoyi/domain/dss/key/box/dto/TakeKeyDTO.java
| ... | ... | @@ -46,9 +46,9 @@ public class TakeKeyDTO implements java.io.Serializable { |
| 46 | 46 | @ApiModelProperty(value = "领取类型;0:司机操作,16管理员操作,17紧急领取,18紧急按钮", required = true) |
| 47 | 47 | private Integer opeType; |
| 48 | 48 | |
| 49 | - @NotEmpty(message = "选择的钥匙位车牌 不能为空") | |
| 50 | - @ApiModelProperty(value = "选择的钥匙位车牌", required = true) | |
| 51 | - private String checkPlate; | |
| 49 | +// @NotEmpty(message = "选择的钥匙位车牌 不能为空") | |
| 50 | +// @ApiModelProperty(value = "选择的钥匙位车牌", required = true) | |
| 51 | +// private String plate; | |
| 52 | 52 | @ApiModelProperty(value = "领取钥匙信息集合") |
| 53 | 53 | private List<TakeKeyKeyItemDTO> keyItem; |
| 54 | 54 | ... | ... |
Bsth-admin/src/main/java/com/ruoyi/domain/sign/in/exception/report/EquipmentExceptionReport.java
| ... | ... | @@ -12,6 +12,7 @@ import lombok.NoArgsConstructor; |
| 12 | 12 | import lombok.experimental.Accessors; |
| 13 | 13 | import lombok.extern.slf4j.Slf4j; |
| 14 | 14 | |
| 15 | +import java.math.BigDecimal; | |
| 15 | 16 | import java.util.Collection; |
| 16 | 17 | import java.util.Date; |
| 17 | 18 | |
| ... | ... | @@ -137,6 +138,11 @@ public class EquipmentExceptionReport { |
| 137 | 138 | @TableField(exist = false) |
| 138 | 139 | private Collection<String> driverJobs; |
| 139 | 140 | |
| 141 | + @TableField(exist = false) | |
| 142 | + private BigDecimal alcoholIntake; | |
| 143 | + | |
| 144 | + @TableField(exist = false) | |
| 145 | + private String content; | |
| 140 | 146 | |
| 141 | 147 | @Override |
| 142 | 148 | public String toString() { | ... | ... |
Bsth-admin/src/main/java/com/ruoyi/domain/sign/in/exception/report/dto/EquipmentExceptionReportUpdateStatusDTO.java
0 → 100644
| 1 | +package com.ruoyi.domain.sign.in.exception.report.dto; | |
| 2 | + | |
| 3 | +import io.swagger.annotations.ApiModel; | |
| 4 | +import io.swagger.annotations.ApiModelProperty; | |
| 5 | +import lombok.Data; | |
| 6 | +import lombok.EqualsAndHashCode; | |
| 7 | +import lombok.experimental.Accessors; | |
| 8 | + | |
| 9 | +import java.math.BigDecimal; | |
| 10 | + | |
| 11 | +/** | |
| 12 | + * @author liujun | |
| 13 | + * @date 2024年08月09日 13:22 | |
| 14 | + */ | |
| 15 | +@Data | |
| 16 | +@ApiModel(value = "打卡异常上报表的修改DTO(status)") | |
| 17 | +@Accessors(chain = true) | |
| 18 | +@EqualsAndHashCode(callSuper = false) | |
| 19 | +public class EquipmentExceptionReportUpdateStatusDTO implements java.io.Serializable{ | |
| 20 | + | |
| 21 | + private static final long serialVersionUID = -7483578326873622615L; | |
| 22 | + | |
| 23 | + /***ID*/ | |
| 24 | + @ApiModelProperty(value = "ID", example = "1") | |
| 25 | + private Long id; | |
| 26 | + | |
| 27 | + /***处理状态 1 未处理 2 处理中 3 已处理*/ | |
| 28 | + @ApiModelProperty(value = "处理状态 1 未处理 2 处理中 3 已处理", example = "1") | |
| 29 | + private Integer status; | |
| 30 | + | |
| 31 | + /***处理状态 1 未处理 2 处理中 3 已处理*/ | |
| 32 | + @ApiModelProperty(value = "再次测试的酒精值", example = "1") | |
| 33 | + private BigDecimal alcoholIntake; | |
| 34 | + | |
| 35 | + @ApiModelProperty(value = "上传的图片信息") | |
| 36 | + private String content; | |
| 37 | + | |
| 38 | + private String telPhone; | |
| 39 | + | |
| 40 | + private String supperAuh; | |
| 41 | +} | ... | ... |
Bsth-admin/src/main/java/com/ruoyi/in/service/ISignInService.java
| ... | ... | @@ -4,6 +4,8 @@ import com.baomidou.mybatisplus.extension.service.IService; |
| 4 | 4 | import com.ruoyi.common.core.domain.AjaxResult; |
| 5 | 5 | import com.ruoyi.common.exception.file.FileUploadException; |
| 6 | 6 | import com.ruoyi.domain.driver.NewDriver; |
| 7 | +import com.ruoyi.domain.scheduling.LinggangScheduling; | |
| 8 | +import com.ruoyi.driver.domain.Driver; | |
| 7 | 9 | import com.ruoyi.in.domain.SignIn; |
| 8 | 10 | import com.ruoyi.pojo.response.SignInResponseVo; |
| 9 | 11 | |
| ... | ... | @@ -71,6 +73,8 @@ public interface ISignInService extends IService<SignIn> { |
| 71 | 73 | */ |
| 72 | 74 | AjaxResult addSignIn(SignIn signIn) throws FileUploadException, IOException; |
| 73 | 75 | |
| 76 | + AjaxResult addSign(SignIn signIn, Driver driver, LinggangScheduling scheduling) throws IOException; | |
| 77 | + | |
| 74 | 78 | String repairSignRecord(HttpServletRequest request); |
| 75 | 79 | |
| 76 | 80 | String repairAllSignRecord(HttpServletRequest request, String date); | ... | ... |
Bsth-admin/src/main/java/com/ruoyi/in/service/impl/SignInServiceImpl.java
| 1 | 1 | package com.ruoyi.in.service.impl; |
| 2 | 2 | |
| 3 | 3 | import cn.hutool.core.collection.CollectionUtil; |
| 4 | +import cn.hutool.core.convert.Convert; | |
| 4 | 5 | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| 5 | 6 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| 6 | 7 | import com.github.pagehelper.PageHelper; |
| ... | ... | @@ -19,6 +20,7 @@ import com.ruoyi.common.utils.uuid.Seq; |
| 19 | 20 | import com.ruoyi.common.utils.uuid.UUID; |
| 20 | 21 | import com.ruoyi.domain.DriverScheduling; |
| 21 | 22 | import com.ruoyi.domain.driver.NewDriver; |
| 23 | +import com.ruoyi.domain.scheduling.LinggangScheduling; | |
| 22 | 24 | import com.ruoyi.driver.domain.Driver; |
| 23 | 25 | import com.ruoyi.driver.mapper.DriverMapper; |
| 24 | 26 | import com.ruoyi.driver.mapper.DriverSchedulingMapper; |
| ... | ... | @@ -33,6 +35,7 @@ import com.ruoyi.pojo.GlobalIndex; |
| 33 | 35 | import com.ruoyi.pojo.response.SignInResponseVo; |
| 34 | 36 | import com.ruoyi.service.SchedulingService; |
| 35 | 37 | import com.ruoyi.service.ThreadJobService; |
| 38 | +import com.ruoyi.service.scheduling.LinggangSchedulingService; | |
| 36 | 39 | import com.ruoyi.utils.ConstDateUtil; |
| 37 | 40 | import org.apache.commons.collections4.CollectionUtils; |
| 38 | 41 | import org.apache.commons.io.FilenameUtils; |
| ... | ... | @@ -100,6 +103,9 @@ public class SignInServiceImpl extends ServiceImpl<SignInMapper, SignIn> impleme |
| 100 | 103 | @Resource |
| 101 | 104 | private ThreadJobService threadJobService; |
| 102 | 105 | |
| 106 | + @Autowired | |
| 107 | + private LinggangSchedulingService linggangSchedulingService; | |
| 108 | + | |
| 103 | 109 | /** |
| 104 | 110 | * 查询签到 |
| 105 | 111 | * |
| ... | ... | @@ -118,12 +124,12 @@ public class SignInServiceImpl extends ServiceImpl<SignInMapper, SignIn> impleme |
| 118 | 124 | wrapper.in(SignIn::getJobCode, jobCodes); |
| 119 | 125 | } |
| 120 | 126 | |
| 121 | - if(Objects.nonNull(signIn.getStartCreateTime()) && Objects.nonNull(signIn.getEndCreateTime())){ | |
| 122 | - wrapper.between(SignIn::getCreateTime,signIn.getStartCreateTime(),signIn.getEndCreateTime()); | |
| 123 | - }else if(Objects.nonNull(signIn.getStartCreateTime())){ | |
| 124 | - wrapper.ge(SignIn::getCreateTime,signIn.getStartCreateTime()); | |
| 125 | - }else if(Objects.nonNull(signIn.getEndCreateTime())){ | |
| 126 | - wrapper.le(SignIn::getCreateTime,signIn.getEndCreateTime()); | |
| 127 | + if (Objects.nonNull(signIn.getStartCreateTime()) && Objects.nonNull(signIn.getEndCreateTime())) { | |
| 128 | + wrapper.between(SignIn::getCreateTime, signIn.getStartCreateTime(), signIn.getEndCreateTime()); | |
| 129 | + } else if (Objects.nonNull(signIn.getStartCreateTime())) { | |
| 130 | + wrapper.ge(SignIn::getCreateTime, signIn.getStartCreateTime()); | |
| 131 | + } else if (Objects.nonNull(signIn.getEndCreateTime())) { | |
| 132 | + wrapper.le(SignIn::getCreateTime, signIn.getEndCreateTime()); | |
| 127 | 133 | } |
| 128 | 134 | return list(wrapper); |
| 129 | 135 | } |
| ... | ... | @@ -199,12 +205,12 @@ public class SignInServiceImpl extends ServiceImpl<SignInMapper, SignIn> impleme |
| 199 | 205 | GlobalIndex globalIndex = new GlobalIndex(); |
| 200 | 206 | long now = signIn.getCreateTime().getTime(); |
| 201 | 207 | List<DriverScheduling> dto = schedulingService.queryScheduling(signIn.getJobCode(), now); |
| 202 | - if(CollectionUtils.isEmpty(dto)){ | |
| 208 | + if (CollectionUtils.isEmpty(dto)) { | |
| 203 | 209 | return AjaxResult.error("今天没有签到数据,签到失败"); |
| 204 | 210 | } |
| 205 | 211 | handleSignBody(signIn, driver, globalIndex, now, dto); |
| 206 | 212 | |
| 207 | - log.info("签到的数据为:[{}];index为[{}]",dto,globalIndex); | |
| 213 | + log.info("签到的数据为:[{}];index为[{}]", dto, globalIndex); | |
| 208 | 214 | if (PERSONNEL_POSTS_DRIVER.equals(driver.getPosts()) && Objects.equals(dto.get(globalIndex.getIndex()).getBcType(), BC_TYPE_OUT)) { |
| 209 | 215 | AjaxResult result = getAjaxResultByDriverSignInfo(signIn, vo); |
| 210 | 216 | if (!Objects.isNull(result)) { |
| ... | ... | @@ -213,8 +219,8 @@ public class SignInServiceImpl extends ServiceImpl<SignInMapper, SignIn> impleme |
| 213 | 219 | return result; |
| 214 | 220 | } |
| 215 | 221 | } |
| 216 | - if(org.apache.commons.lang3.StringUtils.isNotEmpty(signIn.getImage())){ | |
| 217 | - uploadImage(signIn, vo); | |
| 222 | + if (org.apache.commons.lang3.StringUtils.isNotEmpty(signIn.getImage())) { | |
| 223 | + uploadImage(signIn, vo); | |
| 218 | 224 | } |
| 219 | 225 | signIn.setSchedulingId(dto.get(globalIndex.getIndex()).getId()); |
| 220 | 226 | signInMapper.insertSignIn(signIn); |
| ... | ... | @@ -226,7 +232,6 @@ public class SignInServiceImpl extends ServiceImpl<SignInMapper, SignIn> impleme |
| 226 | 232 | } |
| 227 | 233 | |
| 228 | 234 | |
| 229 | - | |
| 230 | 235 | // 异常保存到异常异常中 |
| 231 | 236 | threadJobService.asyncInsertExceptionRecord(signIn, driver, dto, globalIndex); |
| 232 | 237 | |
| ... | ... | @@ -234,6 +239,31 @@ public class SignInServiceImpl extends ServiceImpl<SignInMapper, SignIn> impleme |
| 234 | 239 | return handleAjaxResult(signIn, driver, vo); |
| 235 | 240 | } |
| 236 | 241 | |
| 242 | + /*** | |
| 243 | + * 保存审核的签到 | |
| 244 | + * @author liujun | |
| 245 | + * @date 2024/8/9 14:44 | |
| 246 | + * @param signIn | |
| 247 | + * @param driver | |
| 248 | + * @param scheduling | |
| 249 | + * @return com.ruoyi.common.core.domain.AjaxResult | |
| 250 | + */ | |
| 251 | + public AjaxResult addSign(SignIn signIn, Driver driver, LinggangScheduling scheduling) throws IOException { | |
| 252 | + Equipment equipment = equipmentMapper.selectEquipmentByDeviceId(signIn.getDeviceId()); | |
| 253 | + SignInResponseVo vo = getSignInResponseVo(driver, signIn, equipment); | |
| 254 | + if (org.apache.commons.lang3.StringUtils.isNotEmpty(signIn.getImage())) { | |
| 255 | + uploadImage(signIn, vo); | |
| 256 | + } | |
| 257 | + signIn.setSchedulingId(scheduling.getId()); | |
| 258 | + signInMapper.insertSignIn(signIn); | |
| 259 | + | |
| 260 | + scheduling.setSignInId(Convert.toInt(signIn.getId())); | |
| 261 | + // 更新考勤 | |
| 262 | + linggangSchedulingService.updateByPrimaryKey(scheduling); | |
| 263 | + | |
| 264 | + return AjaxResult.success(); | |
| 265 | + } | |
| 266 | + | |
| 237 | 267 | private void handleSignBody(SignIn signIn, Driver driver, GlobalIndex globalIndex, long now, List<DriverScheduling> dto) { |
| 238 | 268 | // 签到检查 |
| 239 | 269 | if (checkSignIn(now, dto, globalIndex, signIn, driver)) { | ... | ... |
Bsth-admin/src/main/java/com/ruoyi/service/impl/sign/in/exception/report/EquipmentExceptionReportServiceImpl.java
| 1 | 1 | package com.ruoyi.service.impl.sign.in.exception.report; |
| 2 | 2 | |
| 3 | +import cn.hutool.core.convert.Convert; | |
| 3 | 4 | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| 4 | 5 | import com.baomidou.mybatisplus.core.metadata.IPage; |
| 5 | 6 | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| 6 | 7 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| 7 | 8 | import com.github.pagehelper.PageHelper; |
| 9 | +import com.ruoyi.common.utils.spring.SpringUtils; | |
| 8 | 10 | import com.ruoyi.domain.OrderEntity; |
| 11 | +import com.ruoyi.domain.driver.NewDriver; | |
| 12 | +import com.ruoyi.domain.scheduling.LinggangScheduling; | |
| 9 | 13 | import com.ruoyi.domain.sign.in.exception.report.EquipmentExceptionReport; |
| 14 | +import com.ruoyi.driver.domain.Driver; | |
| 15 | +import com.ruoyi.in.domain.SignIn; | |
| 16 | +import com.ruoyi.in.service.ISignInService; | |
| 10 | 17 | import com.ruoyi.mapper.sign.in.exception.report.EquipmentExceptionReportMapper; |
| 18 | +import com.ruoyi.service.driver.NewDriverService; | |
| 19 | +import com.ruoyi.service.scheduling.LinggangSchedulingService; | |
| 11 | 20 | import com.ruoyi.service.sign.in.exception.report.EquipmentExceptionReportService; |
| 12 | 21 | import lombok.extern.slf4j.Slf4j; |
| 13 | 22 | import org.apache.commons.collections4.CollectionUtils; |
| 23 | +import org.springframework.beans.BeanUtils; | |
| 14 | 24 | import org.springframework.beans.factory.annotation.Autowired; |
| 15 | 25 | import org.springframework.stereotype.Service; |
| 26 | +import org.springframework.transaction.annotation.Transactional; | |
| 16 | 27 | |
| 28 | +import java.io.IOException; | |
| 17 | 29 | import java.util.Collections; |
| 30 | +import java.util.Date; | |
| 18 | 31 | import java.util.List; |
| 32 | +import java.util.Objects; | |
| 19 | 33 | |
| 20 | 34 | @Slf4j |
| 21 | 35 | @Service |
| ... | ... | @@ -24,6 +38,12 @@ public class EquipmentExceptionReportServiceImpl extends ServiceImpl<EquipmentEx |
| 24 | 38 | @Autowired |
| 25 | 39 | private EquipmentExceptionReportMapper equipmentExceptionReportMapper; |
| 26 | 40 | |
| 41 | + @Autowired | |
| 42 | + private LinggangSchedulingService schedulingService; | |
| 43 | + @Autowired | |
| 44 | + private NewDriverService driverService; | |
| 45 | + | |
| 46 | + | |
| 27 | 47 | /** |
| 28 | 48 | * 分页查询 |
| 29 | 49 | */ |
| ... | ... | @@ -31,8 +51,8 @@ public class EquipmentExceptionReportServiceImpl extends ServiceImpl<EquipmentEx |
| 31 | 51 | public IPage<EquipmentExceptionReport> pageList(Page<EquipmentExceptionReport> page, EquipmentExceptionReport entity, OrderEntity orderEntity) { |
| 32 | 52 | LambdaQueryWrapper<EquipmentExceptionReport> countWrapper = new LambdaQueryWrapper<>(entity); |
| 33 | 53 | countWrapper.select(EquipmentExceptionReport::getId); |
| 34 | - if(CollectionUtils.isNotEmpty(entity.getDriverJobs())){ | |
| 35 | - countWrapper.in(EquipmentExceptionReport::getJobCode,entity.getDriverJobs()); | |
| 54 | + if (CollectionUtils.isNotEmpty(entity.getDriverJobs())) { | |
| 55 | + countWrapper.in(EquipmentExceptionReport::getJobCode, entity.getDriverJobs()); | |
| 36 | 56 | } |
| 37 | 57 | int count = count(countWrapper); |
| 38 | 58 | |
| ... | ... | @@ -40,8 +60,8 @@ public class EquipmentExceptionReportServiceImpl extends ServiceImpl<EquipmentEx |
| 40 | 60 | if (count > 0) { |
| 41 | 61 | PageHelper.startPage((int) page.getCurrent(), (int) page.getSize(), false); |
| 42 | 62 | LambdaQueryWrapper<EquipmentExceptionReport> selectWrapper = new LambdaQueryWrapper<>(entity); |
| 43 | - if(CollectionUtils.isNotEmpty(entity.getDriverJobs())){ | |
| 44 | - selectWrapper.in(EquipmentExceptionReport::getJobCode,entity.getDriverJobs()); | |
| 63 | + if (CollectionUtils.isNotEmpty(entity.getDriverJobs())) { | |
| 64 | + selectWrapper.in(EquipmentExceptionReport::getJobCode, entity.getDriverJobs()); | |
| 45 | 65 | } |
| 46 | 66 | |
| 47 | 67 | orderColumn(selectWrapper, orderEntity); |
| ... | ... | @@ -117,6 +137,59 @@ public class EquipmentExceptionReportServiceImpl extends ServiceImpl<EquipmentEx |
| 117 | 137 | return updateById(entity); |
| 118 | 138 | } |
| 119 | 139 | |
| 140 | + @Override | |
| 141 | + @Transactional(rollbackFor = Exception.class) | |
| 142 | + public boolean updateStatusAndAddSign(EquipmentExceptionReport entity) { | |
| 143 | + EquipmentExceptionReport report = getById(entity.getId()); | |
| 144 | + if (Objects.isNull(report)) { | |
| 145 | + log.info("没有找到相应的异常签到数据:[{}]", entity); | |
| 146 | + return false; | |
| 147 | + } | |
| 148 | + ISignInService signInService = SpringUtils.getBean(ISignInService.class); | |
| 149 | + | |
| 150 | + SignIn signIn = signInService.getById(report.getSignId()); | |
| 151 | + if (Objects.isNull(signIn)) { | |
| 152 | + log.info("没有找到相应的签到数据:[{}];[{}]", entity, report); | |
| 153 | + return false; | |
| 154 | + } | |
| 155 | + | |
| 156 | + LinggangScheduling scheduling = schedulingService.getById(signIn.getSchedulingId()); | |
| 157 | + if(Objects.isNull(scheduling)){ | |
| 158 | + log.error("没有找到打卡信息[{}]",signIn); | |
| 159 | + return false; | |
| 160 | + } | |
| 161 | + | |
| 162 | + NewDriver driver = driverService.getOne(signIn.getJobCode()); | |
| 163 | + if(Objects.isNull(driver)){ | |
| 164 | + log.error("没有找到用户信息[{}]",signIn); | |
| 165 | + return false; | |
| 166 | + } | |
| 167 | + | |
| 168 | + Driver dr = new Driver(); | |
| 169 | + BeanUtils.copyProperties(driver, dr); | |
| 170 | + | |
| 171 | + signIn.setImage(entity.getContent()); | |
| 172 | + signIn.setCreateTime(new Date()); | |
| 173 | + signIn.setAlcoholIntake(entity.getAlcoholIntake()); | |
| 174 | + signIn.setCreateBy(Convert.toStr(entity.getUpdateBy())); | |
| 175 | + signIn.setId(null); | |
| 176 | + | |
| 177 | + try { | |
| 178 | + signInService.addSign(signIn, dr, scheduling); | |
| 179 | + | |
| 180 | + report.setStatus(entity.getStatus()); | |
| 181 | + report.setUpdateTime(new Date()); | |
| 182 | + report.setUpdateBy(entity.getUpdateBy()); | |
| 183 | + report.setImage(signIn.getImage()); | |
| 184 | + | |
| 185 | + updateByPrimaryKey(report); | |
| 186 | + return true; | |
| 187 | + } catch (IOException e) { | |
| 188 | + log.error("审核酒精测试失败", e); | |
| 189 | + } | |
| 190 | + return false; | |
| 191 | + } | |
| 192 | + | |
| 120 | 193 | /***根据主键删除数据*/ |
| 121 | 194 | @Override |
| 122 | 195 | public boolean deleteById(Long id) { | ... | ... |
Bsth-admin/src/main/java/com/ruoyi/service/sign/in/exception/report/EquipmentExceptionReportService.java
| ... | ... | @@ -48,5 +48,7 @@ public interface EquipmentExceptionReportService extends IService<EquipmentExcep |
| 48 | 48 | */ |
| 49 | 49 | boolean updateByPrimaryKey(EquipmentExceptionReport entity); |
| 50 | 50 | |
| 51 | + boolean updateStatusAndAddSign(EquipmentExceptionReport entity); | |
| 52 | + | |
| 51 | 53 | boolean deleteById(Long id); |
| 52 | 54 | } |
| 53 | 55 | \ No newline at end of file | ... | ... |
Bsth-admin/src/main/resources/application.yml
| ... | ... | @@ -37,7 +37,7 @@ server: |
| 37 | 37 | logging: |
| 38 | 38 | level: |
| 39 | 39 | com.ruoyi: debug |
| 40 | - org.springframework: warn | |
| 40 | + org.springframework: error | |
| 41 | 41 | org: |
| 42 | 42 | springframework: |
| 43 | 43 | web: |
| ... | ... | @@ -46,6 +46,10 @@ logging: |
| 46 | 46 | method: |
| 47 | 47 | annotation: |
| 48 | 48 | RequestResponseBodyMethodProcessor: TRACE |
| 49 | + DispatcherServlet: TRACE | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 49 | 53 | |
| 50 | 54 | # 用户配置 |
| 51 | 55 | user: | ... | ... |
Bsth-common/src/main/java/com/ruoyi/common/core/domain/ResponseResult.java
| ... | ... | @@ -2,6 +2,7 @@ package com.ruoyi.common.core.domain; |
| 2 | 2 | |
| 3 | 3 | import com.alibaba.fastjson2.JSON; |
| 4 | 4 | import com.ruoyi.common.constant.HttpStatus; |
| 5 | +import org.slf4j.MDC; | |
| 5 | 6 | |
| 6 | 7 | import java.util.Objects; |
| 7 | 8 | |
| ... | ... | @@ -14,6 +15,7 @@ public class ResponseResult<T> { |
| 14 | 15 | private String msg; |
| 15 | 16 | private T data; |
| 16 | 17 | |
| 18 | + | |
| 17 | 19 | public int getCode() { |
| 18 | 20 | return code; |
| 19 | 21 | } |
| ... | ... | @@ -38,6 +40,10 @@ public class ResponseResult<T> { |
| 38 | 40 | this.data = data; |
| 39 | 41 | } |
| 40 | 42 | |
| 43 | + public String getReqeustId() { | |
| 44 | + return MDC.get("requestId"); | |
| 45 | + } | |
| 46 | + | |
| 41 | 47 | public ResponseResult() { |
| 42 | 48 | } |
| 43 | 49 | ... | ... |