Commit e195407a6492869037c1e41c8aef958bbcaefff6
1 parent
52e50152
fix: 新增验证功能
Showing
7 changed files
with
38 additions
and
13 deletions
ruoyi-admin/src/main/java/com/ruoyi/driver/controller/DriverController.java
| @@ -4,6 +4,7 @@ import java.util.List; | @@ -4,6 +4,7 @@ import java.util.List; | ||
| 4 | import javax.servlet.http.HttpServletResponse; | 4 | import javax.servlet.http.HttpServletResponse; |
| 5 | 5 | ||
| 6 | import com.ruoyi.pojo.request.FaceRegistrationFeedbackVo; | 6 | import com.ruoyi.pojo.request.FaceRegistrationFeedbackVo; |
| 7 | +import com.ruoyi.pojo.request.FaceUpdateReqVo; | ||
| 7 | import io.swagger.annotations.Api; | 8 | import io.swagger.annotations.Api; |
| 8 | import io.swagger.annotations.ApiOperation; | 9 | import io.swagger.annotations.ApiOperation; |
| 9 | import io.swagger.annotations.ApiParam; | 10 | import io.swagger.annotations.ApiParam; |
| @@ -122,6 +123,18 @@ public class DriverController extends BaseController { | @@ -122,6 +123,18 @@ public class DriverController extends BaseController { | ||
| 122 | return toAjax(driverService.updateDriver(driver) + 1); | 123 | return toAjax(driverService.updateDriver(driver) + 1); |
| 123 | } | 124 | } |
| 124 | 125 | ||
| 126 | + | ||
| 127 | + /** | ||
| 128 | + * 人脸数据更新接口 | ||
| 129 | + * @param vo 更新实际数据 | ||
| 130 | + */ | ||
| 131 | + @PostMapping("/update/face") | ||
| 132 | + public AjaxResult updateFaceByJob(List<FaceUpdateReqVo> vo){ | ||
| 133 | + // TODO 人脸数据更新接口 | ||
| 134 | + driverService.updateFaceByJob(vo); | ||
| 135 | + return AjaxResult.success(); | ||
| 136 | + } | ||
| 137 | + | ||
| 125 | /** | 138 | /** |
| 126 | * 删除驾驶员信息 | 139 | * 删除驾驶员信息 |
| 127 | */ | 140 | */ |
ruoyi-admin/src/main/java/com/ruoyi/driver/service/IDriverService.java
| @@ -6,6 +6,7 @@ import java.util.List; | @@ -6,6 +6,7 @@ import java.util.List; | ||
| 6 | import com.ruoyi.common.core.domain.AjaxResult; | 6 | import com.ruoyi.common.core.domain.AjaxResult; |
| 7 | import com.ruoyi.common.exception.file.InvalidExtensionException; | 7 | import com.ruoyi.common.exception.file.InvalidExtensionException; |
| 8 | import com.ruoyi.driver.domain.Driver; | 8 | import com.ruoyi.driver.domain.Driver; |
| 9 | +import com.ruoyi.pojo.request.FaceUpdateReqVo; | ||
| 9 | import com.ruoyi.pojo.response.ResponseScheduling; | 10 | import com.ruoyi.pojo.response.ResponseScheduling; |
| 10 | import org.springframework.web.multipart.MultipartFile; | 11 | import org.springframework.web.multipart.MultipartFile; |
| 11 | 12 | ||
| @@ -91,4 +92,6 @@ public interface IDriverService | @@ -91,4 +92,6 @@ public interface IDriverService | ||
| 91 | AjaxResult faceRegistrationFeedback(String deviceId, List<String> jobCode); | 92 | AjaxResult faceRegistrationFeedback(String deviceId, List<String> jobCode); |
| 92 | 93 | ||
| 93 | void updateDriverByComputed(); | 94 | void updateDriverByComputed(); |
| 95 | + | ||
| 96 | + void updateFaceByJob(List<FaceUpdateReqVo> vo); | ||
| 94 | } | 97 | } |
ruoyi-admin/src/main/java/com/ruoyi/driver/service/impl/DriverServiceImpl.java
| @@ -17,6 +17,7 @@ import com.ruoyi.equipment.mapper.EquipmentMapper; | @@ -17,6 +17,7 @@ import com.ruoyi.equipment.mapper.EquipmentMapper; | ||
| 17 | import com.ruoyi.framework.config.ServerConfig; | 17 | import com.ruoyi.framework.config.ServerConfig; |
| 18 | import com.ruoyi.job.DriverJob; | 18 | import com.ruoyi.job.DriverJob; |
| 19 | import com.ruoyi.pojo.domain.EquipmentDriverExpand; | 19 | import com.ruoyi.pojo.domain.EquipmentDriverExpand; |
| 20 | +import com.ruoyi.pojo.request.FaceUpdateReqVo; | ||
| 20 | import com.ruoyi.pojo.response.ResponseScheduling; | 21 | import com.ruoyi.pojo.response.ResponseScheduling; |
| 21 | import com.ruoyi.service.ThreadJobService; | 22 | import com.ruoyi.service.ThreadJobService; |
| 22 | import com.ruoyi.utils.ConstDateUtil; | 23 | import com.ruoyi.utils.ConstDateUtil; |
| @@ -262,6 +263,11 @@ public class DriverServiceImpl implements IDriverService { | @@ -262,6 +263,11 @@ public class DriverServiceImpl implements IDriverService { | ||
| 262 | driverMapper.updateDriverByComputed(count); | 263 | driverMapper.updateDriverByComputed(count); |
| 263 | } | 264 | } |
| 264 | 265 | ||
| 266 | + @Override | ||
| 267 | + public void updateFaceByJob(List<FaceUpdateReqVo> vo) { | ||
| 268 | +// if () | ||
| 269 | + } | ||
| 270 | + | ||
| 265 | private File getLocationFile(String jobCode) { | 271 | private File getLocationFile(String jobCode) { |
| 266 | String image = driverMapper.getDriverImageByJobCode(jobCode); | 272 | String image = driverMapper.getDriverImageByJobCode(jobCode); |
| 267 | 273 |
ruoyi-admin/src/main/java/com/ruoyi/in/controller/SignInController.java
| @@ -11,6 +11,7 @@ import io.swagger.annotations.ApiOperation; | @@ -11,6 +11,7 @@ import io.swagger.annotations.ApiOperation; | ||
| 11 | import io.swagger.annotations.ApiParam; | 11 | import io.swagger.annotations.ApiParam; |
| 12 | import org.springframework.security.access.prepost.PreAuthorize; | 12 | import org.springframework.security.access.prepost.PreAuthorize; |
| 13 | import org.springframework.beans.factory.annotation.Autowired; | 13 | import org.springframework.beans.factory.annotation.Autowired; |
| 14 | +import org.springframework.validation.annotation.Validated; | ||
| 14 | import org.springframework.web.bind.annotation.GetMapping; | 15 | import org.springframework.web.bind.annotation.GetMapping; |
| 15 | import org.springframework.web.bind.annotation.PostMapping; | 16 | import org.springframework.web.bind.annotation.PostMapping; |
| 16 | import org.springframework.web.bind.annotation.PutMapping; | 17 | import org.springframework.web.bind.annotation.PutMapping; |
| @@ -67,15 +68,6 @@ public class SignInController extends BaseController { | @@ -67,15 +68,6 @@ public class SignInController extends BaseController { | ||
| 67 | } | 68 | } |
| 68 | 69 | ||
| 69 | /** | 70 | /** |
| 70 | - * 人脸数据更新接口 | ||
| 71 | - */ | ||
| 72 | - @PostMapping("/update/face") | ||
| 73 | - public AjaxResult updateFaceByJob(FaceUpdateReqVo vo){ | ||
| 74 | - // TODO 人脸数据更新接口 | ||
| 75 | - return AjaxResult.success("签到成功"); | ||
| 76 | - } | ||
| 77 | - | ||
| 78 | - /** | ||
| 79 | * 获取签到详细信息 | 71 | * 获取签到详细信息 |
| 80 | */ | 72 | */ |
| 81 | // @PreAuthorize("@ss.hasPermi('in:in:query')") | 73 | // @PreAuthorize("@ss.hasPermi('in:in:query')") |
| @@ -106,7 +98,7 @@ public class SignInController extends BaseController { | @@ -106,7 +98,7 @@ public class SignInController extends BaseController { | ||
| 106 | */ | 98 | */ |
| 107 | @PostMapping("/newAdd") | 99 | @PostMapping("/newAdd") |
| 108 | @ApiOperation("新增签到(设备传入)") | 100 | @ApiOperation("新增签到(设备传入)") |
| 109 | - public AjaxResult addSignIn(@ApiParam @RequestBody SignIn signIn) throws FileUploadException, IOException { | 101 | + public AjaxResult addSignIn(@ApiParam @RequestBody @Validated SignIn signIn) throws FileUploadException, IOException { |
| 110 | return signInService.addSignIn(signIn); | 102 | return signInService.addSignIn(signIn); |
| 111 | } | 103 | } |
| 112 | 104 |
ruoyi-admin/src/main/java/com/ruoyi/in/domain/SignIn.java
| @@ -11,6 +11,9 @@ import org.apache.commons.lang3.builder.ToStringStyle; | @@ -11,6 +11,9 @@ import org.apache.commons.lang3.builder.ToStringStyle; | ||
| 11 | import com.ruoyi.common.annotation.Excel; | 11 | import com.ruoyi.common.annotation.Excel; |
| 12 | import com.ruoyi.common.core.domain.BaseEntity; | 12 | import com.ruoyi.common.core.domain.BaseEntity; |
| 13 | 13 | ||
| 14 | +import javax.validation.constraints.NotBlank; | ||
| 15 | +import javax.validation.constraints.NotNull; | ||
| 16 | + | ||
| 14 | /** | 17 | /** |
| 15 | * 签到对象 sign_in | 18 | * 签到对象 sign_in |
| 16 | * | 19 | * |
| @@ -33,10 +36,12 @@ public class SignIn extends BaseEntity { | @@ -33,10 +36,12 @@ public class SignIn extends BaseEntity { | ||
| 33 | */ | 36 | */ |
| 34 | @Excel(name = "工号") | 37 | @Excel(name = "工号") |
| 35 | @ApiModelProperty("工号") | 38 | @ApiModelProperty("工号") |
| 39 | + @NotBlank(message = "工号不能为空") | ||
| 36 | private String jobCode; | 40 | private String jobCode; |
| 37 | 41 | ||
| 38 | @Excel(name = "设备号") | 42 | @Excel(name = "设备号") |
| 39 | @ApiModelProperty("设备号") | 43 | @ApiModelProperty("设备号") |
| 44 | + @NotBlank(message = "设备号不能为空") | ||
| 40 | private String deviceId; | 45 | private String deviceId; |
| 41 | /** | 46 | /** |
| 42 | * 设备地址 | 47 | * 设备地址 |
| @@ -49,6 +54,7 @@ public class SignIn extends BaseEntity { | @@ -49,6 +54,7 @@ public class SignIn extends BaseEntity { | ||
| 49 | */ | 54 | */ |
| 50 | @Excel(name = "图片") | 55 | @Excel(name = "图片") |
| 51 | @ApiModelProperty("图片信息") | 56 | @ApiModelProperty("图片信息") |
| 57 | + @NotBlank(message = "图片信息不能为空") | ||
| 52 | private String image; | 58 | private String image; |
| 53 | /** | 59 | /** |
| 54 | * 签到结果 | 60 | * 签到结果 |
| @@ -61,12 +67,14 @@ public class SignIn extends BaseEntity { | @@ -61,12 +67,14 @@ public class SignIn extends BaseEntity { | ||
| 61 | */ | 67 | */ |
| 62 | @Excel(name = "签到类型") | 68 | @Excel(name = "签到类型") |
| 63 | @ApiModelProperty("签到类型 1 人脸 2 刷卡 3 其他 4 酒精 用可以多选 用,拼接 如 1,2,3,4") | 69 | @ApiModelProperty("签到类型 1 人脸 2 刷卡 3 其他 4 酒精 用可以多选 用,拼接 如 1,2,3,4") |
| 70 | + @NotBlank(message = "签到类型不能为空") | ||
| 64 | private String singnIn; | 71 | private String singnIn; |
| 65 | /** | 72 | /** |
| 66 | * 酒精测试 | 73 | * 酒精测试 |
| 67 | */ | 74 | */ |
| 68 | @Excel(name = "酒精测试") | 75 | @Excel(name = "酒精测试") |
| 69 | @ApiModelProperty("酒精测试 1 已测试 2 未测试") | 76 | @ApiModelProperty("酒精测试 1 已测试 2 未测试") |
| 77 | + @NotNull(message = "酒精测试标识不能为空") | ||
| 70 | private Integer alcoholFlag; | 78 | private Integer alcoholFlag; |
| 71 | 79 | ||
| 72 | /** | 80 | /** |
| @@ -74,6 +82,7 @@ public class SignIn extends BaseEntity { | @@ -74,6 +82,7 @@ public class SignIn extends BaseEntity { | ||
| 74 | */ | 82 | */ |
| 75 | @Excel(name = "签到签退") | 83 | @Excel(name = "签到签退") |
| 76 | @ApiModelProperty("签到签退 1 签到成功 2 签退成功") | 84 | @ApiModelProperty("签到签退 1 签到成功 2 签退成功") |
| 85 | + @NotNull(message = "签到类型不能为空") | ||
| 77 | private Integer type; | 86 | private Integer type; |
| 78 | 87 | ||
| 79 | /** | 88 | /** |
ruoyi-admin/src/main/java/com/ruoyi/in/service/impl/SignInServiceImpl.java
| @@ -218,8 +218,7 @@ public class SignInServiceImpl implements ISignInService { | @@ -218,8 +218,7 @@ public class SignInServiceImpl implements ISignInService { | ||
| 218 | count = redisCache.setIncrementMapValue(key, signIn.getJobCode(), 1); | 218 | count = redisCache.setIncrementMapValue(key, signIn.getJobCode(), 1); |
| 219 | } | 219 | } |
| 220 | if (SIGN_IN_ERROR_COUNT.compareTo(count) <= 0) { | 220 | if (SIGN_IN_ERROR_COUNT.compareTo(count) <= 0) { |
| 221 | - // TODO | ||
| 222 | - return AjaxResult.warn(SIGN_IN_ERROR + signIn.getRemark() + ",酒精测试不通过" + count + "次请更换车辆驾驶员", vo); | 221 | + return AjaxResult.warn(SIGN_IN_ERROR + signIn.getRemark() + "酒精测试不通过" + count + "次请更换车辆驾驶员", vo); |
| 223 | } | 222 | } |
| 224 | return null; | 223 | return null; |
| 225 | } | 224 | } |
ruoyi-admin/src/main/java/com/ruoyi/pojo/request/FaceUpdateReqVo.java
| @@ -2,6 +2,8 @@ package com.ruoyi.pojo.request; | @@ -2,6 +2,8 @@ package com.ruoyi.pojo.request; | ||
| 2 | 2 | ||
| 3 | import lombok.Data; | 3 | import lombok.Data; |
| 4 | 4 | ||
| 5 | +import javax.validation.constraints.NotBlank; | ||
| 6 | + | ||
| 5 | /** | 7 | /** |
| 6 | * 人脸更新数据 | 8 | * 人脸更新数据 |
| 7 | * @author 20412 | 9 | * @author 20412 |
| @@ -11,11 +13,12 @@ public class FaceUpdateReqVo { | @@ -11,11 +13,12 @@ public class FaceUpdateReqVo { | ||
| 11 | /** | 13 | /** |
| 12 | * 工号 | 14 | * 工号 |
| 13 | */ | 15 | */ |
| 16 | + @NotBlank | ||
| 14 | String jobCode; | 17 | String jobCode; |
| 15 | /** | 18 | /** |
| 16 | * 图片base64 | 19 | * 图片base64 |
| 17 | */ | 20 | */ |
| 18 | - String imageBase64; | 21 | + String imageUrl; |
| 19 | /** | 22 | /** |
| 20 | * 姓名 | 23 | * 姓名 |
| 21 | */ | 24 | */ |