Commit 33a17c250540beb8b6a65c8664109dc83ef0126e
1 parent
b1aa1c06
fix: 人脸注册更新
Showing
9 changed files
with
104 additions
and
96 deletions
ruoyi-admin/src/main/java/com/ruoyi/common/global/Result.java
| @@ -67,6 +67,14 @@ public class Result<T extends Object> { | @@ -67,6 +67,14 @@ public class Result<T extends Object> { | ||
| 67 | r.setMsg("失败"); | 67 | r.setMsg("失败"); |
| 68 | return r; | 68 | return r; |
| 69 | } | 69 | } |
| 70 | + /** 失败静态方法 */ | ||
| 71 | + public static Result ERROR(ResultCode code,String msg) { | ||
| 72 | + Result r = new Result(); | ||
| 73 | + r.setSuccess(false); | ||
| 74 | + r.setCode(code.getCode()); | ||
| 75 | + r.setMsg("失败"); | ||
| 76 | + return r; | ||
| 77 | + } | ||
| 70 | 78 | ||
| 71 | /** 失败静态方法 */ | 79 | /** 失败静态方法 */ |
| 72 | public static Result ERROR(String message) { | 80 | public static Result ERROR(String message) { |
ruoyi-admin/src/main/java/com/ruoyi/driver/controller/DriverController.java
| @@ -5,6 +5,7 @@ import javax.servlet.http.HttpServletRequest; | @@ -5,6 +5,7 @@ import javax.servlet.http.HttpServletRequest; | ||
| 5 | import javax.servlet.http.HttpServletResponse; | 5 | import javax.servlet.http.HttpServletResponse; |
| 6 | 6 | ||
| 7 | import com.ruoyi.common.global.Result; | 7 | import com.ruoyi.common.global.Result; |
| 8 | +import com.ruoyi.common.global.ResultCode; | ||
| 8 | import com.ruoyi.pojo.request.DriverSignInRequestVo; | 9 | import com.ruoyi.pojo.request.DriverSignInRequestVo; |
| 9 | import com.ruoyi.pojo.request.FaceRegistrationFeedbackVo; | 10 | import com.ruoyi.pojo.request.FaceRegistrationFeedbackVo; |
| 10 | import com.ruoyi.pojo.request.FaceUpdateReqVo; | 11 | import com.ruoyi.pojo.request.FaceUpdateReqVo; |
| @@ -128,7 +129,6 @@ public class DriverController extends BaseController { | @@ -128,7 +129,6 @@ public class DriverController extends BaseController { | ||
| 128 | } | 129 | } |
| 129 | 130 | ||
| 130 | 131 | ||
| 131 | - | ||
| 132 | /** | 132 | /** |
| 133 | * 修改驾驶员信息 | 133 | * 修改驾驶员信息 |
| 134 | */ | 134 | */ |
| @@ -142,16 +142,20 @@ public class DriverController extends BaseController { | @@ -142,16 +142,20 @@ public class DriverController extends BaseController { | ||
| 142 | 142 | ||
| 143 | 143 | ||
| 144 | /** | 144 | /** |
| 145 | - * 人脸数据更新接口 | 145 | + * 人脸数据更新接口 |
| 146 | + * | ||
| 146 | * @param request 请求头 | 147 | * @param request 请求头 |
| 147 | - * @param vo 更新实际数据 | 148 | + * @param vo 更新实际数据 |
| 148 | */ | 149 | */ |
| 149 | - @ApiOperation("人脸数据更新接口") | ||
| 150 | @PostMapping("/update/face") | 150 | @PostMapping("/update/face") |
| 151 | - public AjaxResult updateFaceByJob(HttpServletRequest request, @ApiParam @Validated @RequestBody FaceUpdateReqVo vo){ | ||
| 152 | - // TODO 人脸数据更新接口 | ||
| 153 | - driverService.updateFaceByJob(request,vo); | ||
| 154 | - return AjaxResult.success(); | 151 | + @ApiOperation("人脸数据更新接口") |
| 152 | + public Result<?> updateFaceByJob(HttpServletRequest request, @ApiParam @Validated @RequestBody FaceUpdateReqVo vo) { | ||
| 153 | + try { | ||
| 154 | + driverService.updateFaceByJob(request, vo); | ||
| 155 | + } catch (Exception e) { | ||
| 156 | + return Result.ERROR(ResultCode.CODE_401, e.getMessage()); | ||
| 157 | + } | ||
| 158 | + return Result.OK(); | ||
| 155 | } | 159 | } |
| 156 | 160 | ||
| 157 | /** | 161 | /** |
| @@ -190,7 +194,6 @@ public class DriverController extends BaseController { | @@ -190,7 +194,6 @@ public class DriverController extends BaseController { | ||
| 190 | } | 194 | } |
| 191 | 195 | ||
| 192 | 196 | ||
| 193 | - | ||
| 194 | /** | 197 | /** |
| 195 | * 头像下载 根据 工号 | 198 | * 头像下载 根据 工号 |
| 196 | */ | 199 | */ |
| @@ -206,7 +209,7 @@ public class DriverController extends BaseController { | @@ -206,7 +209,7 @@ public class DriverController extends BaseController { | ||
| 206 | @ApiOperation("注册反馈") | 209 | @ApiOperation("注册反馈") |
| 207 | @PostMapping("/faceSignIn") | 210 | @PostMapping("/faceSignIn") |
| 208 | public AjaxResult faceRegistrationFeedback(@RequestBody FaceRegistrationFeedbackVo vo) { | 211 | public AjaxResult faceRegistrationFeedback(@RequestBody FaceRegistrationFeedbackVo vo) { |
| 209 | - return driverService.faceRegistrationFeedback(vo.getDeviceId(),vo.getJobCodes()); | 212 | + return driverService.faceRegistrationFeedback(vo.getDeviceId(), vo.getJobCodes()); |
| 210 | } | 213 | } |
| 211 | 214 | ||
| 212 | } | 215 | } |
ruoyi-admin/src/main/java/com/ruoyi/driver/domain/Driver.java
| @@ -145,4 +145,8 @@ public class Driver extends BaseEntity { | @@ -145,4 +145,8 @@ public class Driver extends BaseEntity { | ||
| 145 | @ApiModelProperty("注册设备列表") | 145 | @ApiModelProperty("注册设备列表") |
| 146 | private String signInEquipment; | 146 | private String signInEquipment; |
| 147 | 147 | ||
| 148 | + @ApiModelProperty("车队名称") | ||
| 149 | + @Excel( name ="车队名称") | ||
| 150 | + private String fleetName; | ||
| 151 | + | ||
| 148 | } | 152 | } |
ruoyi-admin/src/main/java/com/ruoyi/driver/mapper/DriverMapper.java
| @@ -69,15 +69,7 @@ public interface DriverMapper | @@ -69,15 +69,7 @@ public interface DriverMapper | ||
| 69 | */ | 69 | */ |
| 70 | void saveDrivers(@Param("drivers") List<Driver> driverList); | 70 | void saveDrivers(@Param("drivers") List<Driver> driverList); |
| 71 | 71 | ||
| 72 | - void saveDriverScheduling(@Param("responseSchedulings") List<ResponseScheduling> responseSchedulings); | ||
| 73 | 72 | ||
| 74 | - /** | ||
| 75 | - * 获取驾驶员排班信息 | ||
| 76 | - * @param date | ||
| 77 | - * @param jobCode | ||
| 78 | - * @return | ||
| 79 | - */ | ||
| 80 | - List<ResponseScheduling> getDriverSchedulingList(@Param("date") String date,@Param("jobCode") String jobCode); | ||
| 81 | 73 | ||
| 82 | /** | 74 | /** |
| 83 | * | 75 | * |
| @@ -103,8 +95,11 @@ public interface DriverMapper | @@ -103,8 +95,11 @@ public interface DriverMapper | ||
| 103 | 95 | ||
| 104 | void updateDriverByComputed(@Param("count")Integer count); | 96 | void updateDriverByComputed(@Param("count")Integer count); |
| 105 | 97 | ||
| 106 | - void updateDriversByJobCodes(@Param("list") List<Driver> list); | 98 | + void updateSignStatusDriversByJobCodes(@Param("list") List<Driver> list); |
| 107 | 99 | ||
| 108 | void deleteDeviceIdAssociatedJobCode(@Param("jobCodes") List<String> jobCodes); | 100 | void deleteDeviceIdAssociatedJobCode(@Param("jobCodes") List<String> jobCodes); |
| 109 | 101 | ||
| 102 | + List<String> queryJobCodesIsExists(@Param("jobCodes") List<String> jobCodes); | ||
| 103 | + | ||
| 104 | + void updateDriverInfoByJobCodes(@Param("drivers") List<Driver> drivers); | ||
| 110 | } | 105 | } |
ruoyi-admin/src/main/java/com/ruoyi/driver/service/IDriverService.java
| @@ -9,6 +9,7 @@ import com.ruoyi.driver.domain.Driver; | @@ -9,6 +9,7 @@ import com.ruoyi.driver.domain.Driver; | ||
| 9 | import com.ruoyi.pojo.request.DriverSignInRequestVo; | 9 | import com.ruoyi.pojo.request.DriverSignInRequestVo; |
| 10 | import com.ruoyi.pojo.request.FaceUpdateReqVo; | 10 | import com.ruoyi.pojo.request.FaceUpdateReqVo; |
| 11 | import com.ruoyi.pojo.response.ResponseScheduling; | 11 | import com.ruoyi.pojo.response.ResponseScheduling; |
| 12 | +import org.apache.ibatis.annotations.Param; | ||
| 12 | import org.springframework.web.multipart.MultipartFile; | 13 | import org.springframework.web.multipart.MultipartFile; |
| 13 | 14 | ||
| 14 | import javax.servlet.http.HttpServletRequest; | 15 | import javax.servlet.http.HttpServletRequest; |
| @@ -78,8 +79,6 @@ public interface IDriverService | @@ -78,8 +79,6 @@ public interface IDriverService | ||
| 78 | 79 | ||
| 79 | AjaxResult getDriverSchedulingInfo(String schedulingDate,String jobCode); | 80 | AjaxResult getDriverSchedulingInfo(String schedulingDate,String jobCode); |
| 80 | 81 | ||
| 81 | - void saveDriverScheduling(List<ResponseScheduling> driverSchedulingMap); | ||
| 82 | - | ||
| 83 | AjaxResult getDriverSchedulingAll(); | 82 | AjaxResult getDriverSchedulingAll(); |
| 84 | 83 | ||
| 85 | AjaxResult checkJobCode(Driver jobCode); | 84 | AjaxResult checkJobCode(Driver jobCode); |
| @@ -98,4 +97,6 @@ public interface IDriverService | @@ -98,4 +97,6 @@ public interface IDriverService | ||
| 98 | void updateFaceByJob(HttpServletRequest request, FaceUpdateReqVo vo); | 97 | void updateFaceByJob(HttpServletRequest request, FaceUpdateReqVo vo); |
| 99 | 98 | ||
| 100 | void saveDriverSignInfo(DriverSignInRequestVo vo); | 99 | void saveDriverSignInfo(DriverSignInRequestVo vo); |
| 100 | + | ||
| 101 | + void updateDrivers(List<Driver> drivers); | ||
| 101 | } | 102 | } |
ruoyi-admin/src/main/java/com/ruoyi/driver/service/impl/DriverServiceImpl.java
| @@ -17,7 +17,6 @@ import com.ruoyi.common.utils.file.FileUtils; | @@ -17,7 +17,6 @@ import com.ruoyi.common.utils.file.FileUtils; | ||
| 17 | import com.ruoyi.common.utils.file.MimeTypeUtils; | 17 | import com.ruoyi.common.utils.file.MimeTypeUtils; |
| 18 | import com.ruoyi.equipment.mapper.EquipmentMapper; | 18 | import com.ruoyi.equipment.mapper.EquipmentMapper; |
| 19 | import com.ruoyi.framework.config.ServerConfig; | 19 | import com.ruoyi.framework.config.ServerConfig; |
| 20 | -import com.ruoyi.in.domain.SignIn; | ||
| 21 | import com.ruoyi.job.DriverJob; | 20 | import com.ruoyi.job.DriverJob; |
| 22 | import com.ruoyi.pojo.domain.EquipmentDriverExpand; | 21 | import com.ruoyi.pojo.domain.EquipmentDriverExpand; |
| 23 | import com.ruoyi.pojo.request.DriverSignInRequestVo; | 22 | import com.ruoyi.pojo.request.DriverSignInRequestVo; |
| @@ -44,7 +43,6 @@ import javax.servlet.http.HttpServletResponse; | @@ -44,7 +43,6 @@ import javax.servlet.http.HttpServletResponse; | ||
| 44 | 43 | ||
| 45 | import static com.ruoyi.common.ApiProperties.PERSONNEL_API_KEY; | 44 | import static com.ruoyi.common.ApiProperties.PERSONNEL_API_KEY; |
| 46 | import static com.ruoyi.common.redispre.GlobalRedisPreName.DRIVER_SCHEDULING_PRE; | 45 | import static com.ruoyi.common.redispre.GlobalRedisPreName.DRIVER_SCHEDULING_PRE; |
| 47 | -import static com.ruoyi.in.service.impl.SignInServiceImpl.checkImageBase64Format; | ||
| 48 | 46 | ||
| 49 | /** | 47 | /** |
| 50 | * 驾驶员信息Service业务层处理 | 48 | * 驾驶员信息Service业务层处理 |
| @@ -81,6 +79,7 @@ public class DriverServiceImpl implements IDriverService { | @@ -81,6 +79,7 @@ public class DriverServiceImpl implements IDriverService { | ||
| 81 | 79 | ||
| 82 | @Value("${api.headImage}") | 80 | @Value("${api.headImage}") |
| 83 | private String headImagePre; | 81 | private String headImagePre; |
| 82 | + | ||
| 84 | /** | 83 | /** |
| 85 | * 查询驾驶员信息 | 84 | * 查询驾驶员信息 |
| 86 | * | 85 | * |
| @@ -163,7 +162,7 @@ public class DriverServiceImpl implements IDriverService { | @@ -163,7 +162,7 @@ public class DriverServiceImpl implements IDriverService { | ||
| 163 | public AjaxResult getDriverSchedulingInfo(String schedulingDate, String jobCode) { | 162 | public AjaxResult getDriverSchedulingInfo(String schedulingDate, String jobCode) { |
| 164 | String key = DRIVER_SCHEDULING_PRE + schedulingDate; | 163 | String key = DRIVER_SCHEDULING_PRE + schedulingDate; |
| 165 | List<ResponseScheduling> cacheMapValue = redisCache.getCacheMapValue(key, jobCode); | 164 | List<ResponseScheduling> cacheMapValue = redisCache.getCacheMapValue(key, jobCode); |
| 166 | - log.info("获取到排班数据:{}",cacheMapValue); | 165 | + log.info("获取到排班数据:{}", cacheMapValue); |
| 167 | // 优先从缓存中读取 | 166 | // 优先从缓存中读取 |
| 168 | if (cacheMapValue != null && cacheMapValue.size() > 0) { | 167 | if (cacheMapValue != null && cacheMapValue.size() > 0) { |
| 169 | 168 | ||
| @@ -181,19 +180,13 @@ public class DriverServiceImpl implements IDriverService { | @@ -181,19 +180,13 @@ public class DriverServiceImpl implements IDriverService { | ||
| 181 | Map<String, List<ResponseScheduling>> scheduling = driverJob.saveSchedulingToRedis(getSchedulingInfoUrl, schedulingDate); | 180 | Map<String, List<ResponseScheduling>> scheduling = driverJob.saveSchedulingToRedis(getSchedulingInfoUrl, schedulingDate); |
| 182 | // 数据库中读取所有接收到的排班信息 | 181 | // 数据库中读取所有接收到的排班信息 |
| 183 | // List<ResponseScheduling> responseSchedulings = driverMapper.getDriverSchedulingList(schedulingDate, jobCode); | 182 | // List<ResponseScheduling> responseSchedulings = driverMapper.getDriverSchedulingList(schedulingDate, jobCode); |
| 184 | - if (jobCode.equals("700001") || jobCode.equals("700002")){ | 183 | + if (jobCode.equals("700001") || jobCode.equals("700002")) { |
| 185 | return AjaxResult.success(scheduling.get("724228")); | 184 | return AjaxResult.success(scheduling.get("724228")); |
| 186 | } | 185 | } |
| 187 | return AjaxResult.success(scheduling.get(jobCode)); | 186 | return AjaxResult.success(scheduling.get(jobCode)); |
| 188 | } | 187 | } |
| 189 | 188 | ||
| 190 | - @Override | ||
| 191 | - public void saveDriverScheduling(List<ResponseScheduling> schedulings) { | ||
| 192 | - List<List<ResponseScheduling>> lists = ListUtils.splitList(schedulings, 1000); | ||
| 193 | - for (List<ResponseScheduling> responseSchedulings : lists) { | ||
| 194 | - driverMapper.saveDriverScheduling(responseSchedulings); | ||
| 195 | - } | ||
| 196 | - } | 189 | + |
| 197 | 190 | ||
| 198 | @Override | 191 | @Override |
| 199 | public AjaxResult getDriverSchedulingAll() { | 192 | public AjaxResult getDriverSchedulingAll() { |
| @@ -283,16 +276,20 @@ public class DriverServiceImpl implements IDriverService { | @@ -283,16 +276,20 @@ public class DriverServiceImpl implements IDriverService { | ||
| 283 | public void updateFaceByJob(HttpServletRequest request, FaceUpdateReqVo vo) { | 276 | public void updateFaceByJob(HttpServletRequest request, FaceUpdateReqVo vo) { |
| 284 | // 获取校验 | 277 | // 获取校验 |
| 285 | String header = request.getHeader("X-TOKEN-AUTHORIZATION"); | 278 | String header = request.getHeader("X-TOKEN-AUTHORIZATION"); |
| 286 | - if (!PERSONNEL_API_KEY.equals(header)){ | 279 | + if (!PERSONNEL_API_KEY.equals(header)) { |
| 287 | throw new RuntimeException("X-TOKEN-AUTHORIZATION value error"); | 280 | throw new RuntimeException("X-TOKEN-AUTHORIZATION value error"); |
| 288 | } | 281 | } |
| 289 | Date date = new Date(); | 282 | Date date = new Date(); |
| 283 | + // 查询当前人员信息库是否存在对应员工数据 | ||
| 284 | + List<String> jobCodes = vo.getFaceDataList().stream().map(FaceUpdateReqVo.FaceData::getJobCode).collect(Collectors.toList()); | ||
| 285 | + List<String> existsJobCodes = driverMapper.queryJobCodesIsExists(jobCodes); | ||
| 286 | + | ||
| 290 | List<Driver> drivers = vo.getFaceDataList().stream().map(item -> { | 287 | List<Driver> drivers = vo.getFaceDataList().stream().map(item -> { |
| 291 | Driver driver = new Driver(); | 288 | Driver driver = new Driver(); |
| 292 | driver.setPosts(item.getPosts()); | 289 | driver.setPosts(item.getPosts()); |
| 293 | driver.setJobCode(item.getJobCode()); | 290 | driver.setJobCode(item.getJobCode()); |
| 294 | try { | 291 | try { |
| 295 | - driver.setImage(getNewImageUrl(item.getJobCode(),item.getImageUrl())); | 292 | + driver.setImage(getNewImageUrl(item.getJobCode(), item.getImageUrl())); |
| 296 | } catch (IOException e) { | 293 | } catch (IOException e) { |
| 297 | log.info(e.getMessage()); | 294 | log.info(e.getMessage()); |
| 298 | throw new RuntimeException(e); | 295 | throw new RuntimeException(e); |
| @@ -305,11 +302,11 @@ public class DriverServiceImpl implements IDriverService { | @@ -305,11 +302,11 @@ public class DriverServiceImpl implements IDriverService { | ||
| 305 | log.info("开始人脸数据更新"); | 302 | log.info("开始人脸数据更新"); |
| 306 | // 数据更新 更新人脸注册标识 更新基本数据 | 303 | // 数据更新 更新人脸注册标识 更新基本数据 |
| 307 | for (List<Driver> list : lists) { | 304 | for (List<Driver> list : lists) { |
| 308 | - driverMapper.updateDriversByJobCodes(list); | 305 | + driverMapper.updateSignStatusDriversByJobCodes(list); |
| 309 | } | 306 | } |
| 310 | log.info("人脸数据更新完成"); | 307 | log.info("人脸数据更新完成"); |
| 311 | - // 删除注册表中对应工号的数据 | ||
| 312 | - List<String> jobCodes = drivers.stream().map(Driver::getJobCode).collect(Collectors.toList()); | 308 | + // TODO 删除注册表中对应工号的数据 |
| 309 | +// List<String> jobCodes = drivers.stream().map(Driver::getJobCode).collect(Collectors.toList()); | ||
| 313 | log.info("开始删除注册表中对应工号的数据"); | 310 | log.info("开始删除注册表中对应工号的数据"); |
| 314 | driverMapper.deleteDeviceIdAssociatedJobCode(jobCodes); | 311 | driverMapper.deleteDeviceIdAssociatedJobCode(jobCodes); |
| 315 | log.info("删除注册表中对应工号的数据结束"); | 312 | log.info("删除注册表中对应工号的数据结束"); |
| @@ -332,12 +329,17 @@ public class DriverServiceImpl implements IDriverService { | @@ -332,12 +329,17 @@ public class DriverServiceImpl implements IDriverService { | ||
| 332 | driver.setImage(fileName); | 329 | driver.setImage(fileName); |
| 333 | driver.setUpdateTime(new Date()); | 330 | driver.setUpdateTime(new Date()); |
| 334 | int result = driverMapper.insertDriver(driver); | 331 | int result = driverMapper.insertDriver(driver); |
| 335 | - if (result == 0) driverMapper.updateDriversByJobCodes(new ArrayList<>(Arrays.asList(driver))); | 332 | + if (result == 0) driverMapper.updateSignStatusDriversByJobCodes(new ArrayList<>(Arrays.asList(driver))); |
| 336 | log.info("开始上传签到图片"); | 333 | log.info("开始上传签到图片"); |
| 337 | // 异步上传文件 | 334 | // 异步上传文件 |
| 338 | threadJobService.asyncStartUploadBase64Image(filePath, base64); | 335 | threadJobService.asyncStartUploadBase64Image(filePath, base64); |
| 339 | } | 336 | } |
| 340 | 337 | ||
| 338 | + @Override | ||
| 339 | + public void updateDrivers(List<Driver> drivers) { | ||
| 340 | + driverMapper.updateDriverInfoByJobCodes(drivers); | ||
| 341 | + } | ||
| 342 | + | ||
| 341 | /** | 343 | /** |
| 342 | * 获取新的imageUrl | 344 | * 获取新的imageUrl |
| 343 | * | 345 | * |
| @@ -345,7 +347,7 @@ public class DriverServiceImpl implements IDriverService { | @@ -345,7 +347,7 @@ public class DriverServiceImpl implements IDriverService { | ||
| 345 | * @param url | 347 | * @param url |
| 346 | * @return | 348 | * @return |
| 347 | */ | 349 | */ |
| 348 | - private String getNewImageUrl(String jobCode,String url) throws IOException { | 350 | + private String getNewImageUrl(String jobCode, String url) throws IOException { |
| 349 | // 生成文件路径 | 351 | // 生成文件路径 |
| 350 | String fileName = jobCode + ".png"; | 352 | String fileName = jobCode + ".png"; |
| 351 | String filePath = RuoYiConfig.getUploadPath() + headImagePre + "/" + fileName; | 353 | String filePath = RuoYiConfig.getUploadPath() + headImagePre + "/" + fileName; |
ruoyi-admin/src/main/java/com/ruoyi/job/DriverJob.java
| @@ -229,11 +229,14 @@ public class DriverJob implements InitializingBean { | @@ -229,11 +229,14 @@ public class DriverJob implements InitializingBean { | ||
| 229 | if (++i <= countPage) { | 229 | if (++i <= countPage) { |
| 230 | vo = getPersonInfo(accessToken, 100, i); | 230 | vo = getPersonInfo(accessToken, 100, i); |
| 231 | drivers = getDrivers(date, vo); | 231 | drivers = getDrivers(date, vo); |
| 232 | +// updateDrivers(drivers); | ||
| 232 | saveDrivers(drivers, accessToken); | 233 | saveDrivers(drivers, accessToken); |
| 233 | } | 234 | } |
| 234 | } | 235 | } |
| 236 | + } | ||
| 235 | 237 | ||
| 236 | -// return drivers; | 238 | + private static void updateDrivers(List<Driver> drivers) { |
| 239 | + DRIVER_SERVICE.updateDrivers(drivers); | ||
| 237 | } | 240 | } |
| 238 | 241 | ||
| 239 | private static List<Driver> getDrivers(Date date, PersonnelResultResponseVo vo) { | 242 | private static List<Driver> getDrivers(Date date, PersonnelResultResponseVo vo) { |
| @@ -247,6 +250,8 @@ public class DriverJob implements InitializingBean { | @@ -247,6 +250,8 @@ public class DriverJob implements InitializingBean { | ||
| 247 | // 解析JSON字符串 | 250 | // 解析JSON字符串 |
| 248 | List<ImageField_lk9mk228> lists = JSONArray.parseArray(formData.getImageField_lk9mk228(), ImageField_lk9mk228.class); | 251 | List<ImageField_lk9mk228> lists = JSONArray.parseArray(formData.getImageField_lk9mk228(), ImageField_lk9mk228.class); |
| 249 | driver.setImage(lists.get(0).getPreviewUrl()); | 252 | driver.setImage(lists.get(0).getPreviewUrl()); |
| 253 | + driver.setLineName(formData.getTextField_lkmgdvnu()); | ||
| 254 | + driver.setFleetName(formData.getTextField_lkmgdvnv()); | ||
| 250 | return driver; | 255 | return driver; |
| 251 | }).collect(Collectors.toList()); | 256 | }).collect(Collectors.toList()); |
| 252 | return drivers; | 257 | return drivers; |
ruoyi-admin/src/main/java/com/ruoyi/pojo/response/personnel/FormData.java
| @@ -12,6 +12,31 @@ public class FormData { | @@ -12,6 +12,31 @@ public class FormData { | ||
| 12 | private String imageField_lk9mk228; | 12 | private String imageField_lk9mk228; |
| 13 | private String textField_lk9mk222; | 13 | private String textField_lk9mk222; |
| 14 | private String textField_lk9mk224; | 14 | private String textField_lk9mk224; |
| 15 | + /** | ||
| 16 | + * 车队 | ||
| 17 | + */ | ||
| 18 | + private String textField_lkmgdvnv; | ||
| 19 | + /** | ||
| 20 | + * 线路 | ||
| 21 | + */ | ||
| 22 | + private String textField_lkmgdvnu; | ||
| 23 | + | ||
| 24 | + public String getTextField_lkmgdvnv() { | ||
| 25 | + return textField_lkmgdvnv; | ||
| 26 | + } | ||
| 27 | + | ||
| 28 | + public void setTextField_lkmgdvnv(String textField_lkmgdvnv) { | ||
| 29 | + this.textField_lkmgdvnv = textField_lkmgdvnv; | ||
| 30 | + } | ||
| 31 | + | ||
| 32 | + public String getTextField_lkmgdvnu() { | ||
| 33 | + return textField_lkmgdvnu; | ||
| 34 | + } | ||
| 35 | + | ||
| 36 | + public void setTextField_lkmgdvnu(String textField_lkmgdvnu) { | ||
| 37 | + this.textField_lkmgdvnu = textField_lkmgdvnu; | ||
| 38 | + } | ||
| 39 | + | ||
| 15 | public void setTextField_lk9mk226(String textField_lk9mk226) { | 40 | public void setTextField_lk9mk226(String textField_lk9mk226) { |
| 16 | this.textField_lk9mk226 = textField_lk9mk226; | 41 | this.textField_lk9mk226 = textField_lk9mk226; |
| 17 | } | 42 | } |
ruoyi-admin/src/main/resources/mapper/driver/DriverMapper.xml
| @@ -23,6 +23,7 @@ | @@ -23,6 +23,7 @@ | ||
| 23 | <result property="lineName" column="line_name"/> | 23 | <result property="lineName" column="line_name"/> |
| 24 | <result property="lineCode" column="line_code"/> | 24 | <result property="lineCode" column="line_code"/> |
| 25 | <result property="updateTime" column="update_time"/> | 25 | <result property="updateTime" column="update_time"/> |
| 26 | + <result property="fleetName" column="fleet_name"/> | ||
| 26 | </resultMap> | 27 | </resultMap> |
| 27 | 28 | ||
| 28 | <sql id="selectDriverVo"> | 29 | <sql id="selectDriverVo"> |
| @@ -46,12 +47,13 @@ | @@ -46,12 +47,13 @@ | ||
| 46 | face_sign_in, | 47 | face_sign_in, |
| 47 | image, | 48 | image, |
| 48 | update_time, | 49 | update_time, |
| 49 | - sign_in_equipment | 50 | + sign_in_equipment, |
| 51 | + fleet_name | ||
| 50 | from driver | 52 | from driver |
| 51 | </sql> | 53 | </sql> |
| 52 | <sql id="insertDriverVo"> | 54 | <sql id="insertDriverVo"> |
| 53 | job_code | 55 | job_code |
| 54 | - , 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 | 56 | + , 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 |
| 55 | </sql> | 57 | </sql> |
| 56 | 58 | ||
| 57 | <select id="selectDriverList" parameterType="Driver" resultMap="DriverResult"> | 59 | <select id="selectDriverList" parameterType="Driver" resultMap="DriverResult"> |
| @@ -77,6 +79,7 @@ | @@ -77,6 +79,7 @@ | ||
| 77 | <if test="lineName != null and lineName != ''">and line_name like concat('%', #{lineName}, '%')</if> | 79 | <if test="lineName != null and lineName != ''">and line_name like concat('%', #{lineName}, '%')</if> |
| 78 | <if test="lineCode != null and lineCode != ''">and line_code = #{lineCode}</if> | 80 | <if test="lineCode != null and lineCode != ''">and line_code = #{lineCode}</if> |
| 79 | <if test="faceSignIn != null and faceSignIn != ''">and face_sign_in = #{faceSignIn}</if> | 81 | <if test="faceSignIn != null and faceSignIn != ''">and face_sign_in = #{faceSignIn}</if> |
| 82 | + <if test="fleetName != null and fleet_name != ''">and fleet_name = #{fleetName}</if> | ||
| 80 | </where> | 83 | </where> |
| 81 | </select> | 84 | </select> |
| 82 | 85 | ||
| @@ -84,16 +87,6 @@ | @@ -84,16 +87,6 @@ | ||
| 84 | <include refid="selectDriverVo"/> | 87 | <include refid="selectDriverVo"/> |
| 85 | where id = #{id} | 88 | where id = #{id} |
| 86 | </select> | 89 | </select> |
| 87 | - <select id="getDriverSchedulingList" resultType="com.ruoyi.pojo.response.ResponseScheduling"> | ||
| 88 | - select id, scheduleDate, lineName, lineCode, lpName, | ||
| 89 | - nbbm, job_code as jobCode,jsy, spy, upDown, qdzCode, | ||
| 90 | - qdzName, zdzCode, zdzName, fcsjT, dfsjT, | ||
| 91 | - zdsjT, fcsjActualTime, zdsjActualTime, | ||
| 92 | - jhlc, jhlcOrig, bcsj, bcType, status, adjustExps, | ||
| 93 | - sflj, remarks | ||
| 94 | - from driver_scheduling | ||
| 95 | - where scheduleDate = #{date} and job_code = #{jobCode} | ||
| 96 | - </select> | ||
| 97 | <select id="getNameByJobCode" resultMap="DriverResult"> | 90 | <select id="getNameByJobCode" resultMap="DriverResult"> |
| 98 | select personnel_name,job_code | 91 | select personnel_name,job_code |
| 99 | from driver | 92 | from driver |
| @@ -145,6 +138,13 @@ | @@ -145,6 +138,13 @@ | ||
| 145 | <include refid="selectDriverVo"></include> | 138 | <include refid="selectDriverVo"></include> |
| 146 | where job_code = #{jobCode} | 139 | where job_code = #{jobCode} |
| 147 | </select> | 140 | </select> |
| 141 | + <select id="queryJobCodesIsExists" resultType="java.lang.String"> | ||
| 142 | + select job_code | ||
| 143 | + where job_code in | ||
| 144 | + <foreach collection="jobCodes" item="item" open="(" separator="," close=")"> | ||
| 145 | + #{item} | ||
| 146 | + </foreach> | ||
| 147 | + </select> | ||
| 148 | 148 | ||
| 149 | <insert id="insertDriver" parameterType="Driver" useGeneratedKeys="true" keyProperty="id"> | 149 | <insert id="insertDriver" parameterType="Driver" useGeneratedKeys="true" keyProperty="id"> |
| 150 | insert into driver | 150 | insert into driver |
| @@ -245,56 +245,20 @@ | @@ -245,56 +245,20 @@ | ||
| 245 | HAVING COUNT(*) = #{count} | 245 | HAVING COUNT(*) = #{count} |
| 246 | ); | 246 | ); |
| 247 | </update> | 247 | </update> |
| 248 | - <update id="updateDriversByJobCodes"> | 248 | + <update id="updateSignStatusDriversByJobCodes"> |
| 249 | <foreach collection="list" item="item" separator=";"> | 249 | <foreach collection="list" item="item" separator=";"> |
| 250 | update driver set face_sign_in = 1, | 250 | update driver set face_sign_in = 1, |
| 251 | personnel_name = #{item.personnelName,jdbcType=VARCHAR},posts = #{item.posts,jdbcType=VARCHAR},image = #{item.image,jdbcType=VARCHAR},update_time = #{item.updateTime} | 251 | personnel_name = #{item.personnelName,jdbcType=VARCHAR},posts = #{item.posts,jdbcType=VARCHAR},image = #{item.image,jdbcType=VARCHAR},update_time = #{item.updateTime} |
| 252 | where job_code = #{item.jobCode,jdbcType=VARCHAR} | 252 | where job_code = #{item.jobCode,jdbcType=VARCHAR} |
| 253 | </foreach> | 253 | </foreach> |
| 254 | </update> | 254 | </update> |
| 255 | - <insert id="saveDriverScheduling"> | ||
| 256 | - INSERT INTO driver_scheduling ( | ||
| 257 | - id, scheduleDate, lineName, lineCode, lpName, | ||
| 258 | - nbbm, job_code,jsy, spy, upDown, qdzCode, | ||
| 259 | - qdzName, zdzCode, zdzName, fcsjT, dfsjT, | ||
| 260 | - zdsjT, fcsjActualTime, zdsjActualTime, | ||
| 261 | - jhlc, jhlcOrig, bcsj, bcType, status, adjustExps, | ||
| 262 | - sflj, remarks) | ||
| 263 | - values | ||
| 264 | - <foreach collection="responseSchedulings" item="item" index="index" separator=","> | ||
| 265 | - ( | ||
| 266 | - #{item.id}, | ||
| 267 | - #{item.scheduleDate}, | ||
| 268 | - #{item.lineName,jdbcType=VARCHAR}, | ||
| 269 | - #{item.lineCode,jdbcType=VARCHAR}, | ||
| 270 | - #{item.lpName,jdbcType=VARCHAR}, | ||
| 271 | - #{item.nbbm,jdbcType=VARCHAR}, | ||
| 272 | - #{item.jobCode,jdbcType=VARCHAR}, | ||
| 273 | - #{item.jsy,jdbcType=VARCHAR}, | ||
| 274 | - #{item.spy,jdbcType=VARCHAR}, | ||
| 275 | - #{item.upDown,jdbcType=VARCHAR}, | ||
| 276 | - #{item.qdzCode,jdbcType=VARCHAR}, | ||
| 277 | - #{item.qdzName,jdbcType=VARCHAR}, | ||
| 278 | - #{item.zdzCode,jdbcType=VARCHAR}, | ||
| 279 | - #{item.zdzName,jdbcType=VARCHAR}, | ||
| 280 | - #{item.fcsjT}, | ||
| 281 | - #{item.dfsjT}, | ||
| 282 | - #{item.zdsjT}, | ||
| 283 | - #{item.fcsjActualTime}, | ||
| 284 | - #{item.zdsjActualTime}, | ||
| 285 | - #{item.jhlc,jdbcType=VARCHAR}, | ||
| 286 | - #{item.jhlcOrig,jdbcType=VARCHAR}, | ||
| 287 | - #{item.bcsj,jdbcType=VARCHAR}, | ||
| 288 | - #{item.bcType,jdbcType=VARCHAR}, | ||
| 289 | - #{item.status,jdbcType=VARCHAR}, | ||
| 290 | - #{item.adjustExps,jdbcType=VARCHAR}, | ||
| 291 | - #{item.sflj,jdbcType=VARCHAR}, | ||
| 292 | - #{item.remarks,jdbcType=VARCHAR} | ||
| 293 | - ) | 255 | + <update id="updateDriverInfoByJobCodes"> |
| 256 | + <foreach collection="drivers" item="item" separator=";"> | ||
| 257 | + update driver set | ||
| 258 | + line_name=#{item.lineName,jdbcType=VARCHAR},fleet_name=#{item.fleetName,jdbcType=VARCHAR},personnel_name = #{item.personnelName,jdbcType=VARCHAR},posts = #{item.posts,jdbcType=VARCHAR} | ||
| 259 | + where job_code = #{item.jobCode,jdbcType=VARCHAR} | ||
| 294 | </foreach> | 260 | </foreach> |
| 295 | - on duplicate key update | ||
| 296 | - job_code = values(job_code) | ||
| 297 | - </insert> | 261 | + </update> |
| 298 | 262 | ||
| 299 | <delete id="deleteDriverById" parameterType="Long"> | 263 | <delete id="deleteDriverById" parameterType="Long"> |
| 300 | delete | 264 | delete |
| @@ -344,7 +308,8 @@ | @@ -344,7 +308,8 @@ | ||
| 344 | #{item.faceSignIn}, | 308 | #{item.faceSignIn}, |
| 345 | #{item.image}, | 309 | #{item.image}, |
| 346 | #{item.updateTime}, | 310 | #{item.updateTime}, |
| 347 | - #{item.signInEquipment} | 311 | + #{item.signInEquipment}, |
| 312 | + #{item.fleetName} | ||
| 348 | ) | 313 | ) |
| 349 | </foreach> | 314 | </foreach> |
| 350 | on duplicate key update | 315 | on duplicate key update |