Commit 4183c71efb5173b20ecaaae228f46daf49dad8d1

Authored by guzijian
1 parent f50323cd

feat: 修改签到逻辑

Bsth-admin/src/main/java/com/ruoyi/driver/service/impl/DriverServiceImpl.java
@@ -11,6 +11,7 @@ import java.util.stream.Collectors; @@ -11,6 +11,7 @@ import java.util.stream.Collectors;
11 11
12 import cn.hutool.core.collection.CollectionUtil; 12 import cn.hutool.core.collection.CollectionUtil;
13 import cn.hutool.http.HttpUtil; 13 import cn.hutool.http.HttpUtil;
  14 +import com.github.pagehelper.util.StringUtil;
14 import com.ruoyi.common.cache.NowSchedulingCache; 15 import com.ruoyi.common.cache.NowSchedulingCache;
15 import com.ruoyi.common.cache.SchedulingCache; 16 import com.ruoyi.common.cache.SchedulingCache;
16 import com.ruoyi.common.config.RuoYiConfig; 17 import com.ruoyi.common.config.RuoYiConfig;
@@ -487,11 +488,11 @@ public class DriverServiceImpl implements IDriverService { @@ -487,11 +488,11 @@ public class DriverServiceImpl implements IDriverService {
487 public void updateDriverSignInfo(DriverSignInRequestVo vo) { 488 public void updateDriverSignInfo(DriverSignInRequestVo vo) {
488 log.info("开始进行人员数据更新"); 489 log.info("开始进行人员数据更新");
489 Driver driver = new Driver(); 490 Driver driver = new Driver();
490 - driver.setJobCode(vo.getJobCode()); 491 + driver.setJobCode(handlerJobCode(vo));
491 driver.setPersonnelName(vo.getName()); 492 driver.setPersonnelName(vo.getName());
492 driver.setPosts(vo.getPosts()); 493 driver.setPosts(vo.getPosts());
493 String base64 = vo.getImage(); 494 String base64 = vo.getImage();
494 - String fileName = vo.getJobCode() + ".png"; 495 + String fileName = handlerJobCode(vo) + ".png";
495 String filePath = getPathUrl(new File(RuoYiConfig.getUploadPath() + headImagePre + "/" + File.separator + fileName)); 496 String filePath = getPathUrl(new File(RuoYiConfig.getUploadPath() + headImagePre + "/" + File.separator + fileName));
496 try { 497 try {
497 fileName = FileUploadUtils.getPathFileName(RuoYiConfig.getUploadPath() + headImagePre, fileName); 498 fileName = FileUploadUtils.getPathFileName(RuoYiConfig.getUploadPath() + headImagePre, fileName);
@@ -510,6 +511,14 @@ public class DriverServiceImpl implements IDriverService { @@ -510,6 +511,14 @@ public class DriverServiceImpl implements IDriverService {
510 threadJobService.asyncStartUploadBase64Image(filePath, base64); 511 threadJobService.asyncStartUploadBase64Image(filePath, base64);
511 } 512 }
512 513
  514 + private static String handlerJobCode(DriverSignInRequestVo vo) {
  515 + if (StringUtil.isEmpty(vo.getJobCode())){
  516 + return vo.getJobCode();
  517 + }
  518 + String[] split = vo.getJobCode().split("-");
  519 + return split[split.length - 1];
  520 + }
  521 +
513 private String getPathUrl(File desc) { 522 private String getPathUrl(File desc) {
514 if (!desc.exists()) { 523 if (!desc.exists()) {
515 if (!desc.getParentFile().exists()) { 524 if (!desc.getParentFile().exists()) {