Commit 52fd9259831ab6ce5b296cc72bf8545d61e88522

Authored by guzijian
1 parent efbd1836

feat: 修改上传头像配置,修改日志文件

Bsth-admin/src/main/java/com/ruoyi/common/cache/NowSchedulingCache.java
... ... @@ -28,7 +28,7 @@ public class NowSchedulingCache {
28 28 public NowSchedulingCache(DriverSchedulingMapper driverSchedulingMapper,IErrorJobcodeService errorJobcodeService) {
29 29 this.schedulingMapper = driverSchedulingMapper;
30 30 this.errorJobcodeService = errorJobcodeService;
31   - log.info("项目启动加载中获取排班表-----");
  31 + log.info("金高项目启动加载中获取排班表-----");
32 32 // cacheNowDaySchedulingInit();
33 33 }
34 34  
... ...
Bsth-admin/src/main/java/com/ruoyi/common/cache/SchedulingCache.java
... ... @@ -41,7 +41,7 @@ public class SchedulingCache {
41 41  
42 42  
43 43 public SchedulingCache() {
44   - log.info("项目启动加载中获取实时班次-----");
  44 + log.info("金高项目启动加载中获取实时班次-----");
45 45 schedulingInit();
46 46 }
47 47  
... ...
Bsth-admin/src/main/java/com/ruoyi/driver/service/impl/DriverServiceImpl.java
... ... @@ -11,7 +11,6 @@ import java.util.stream.Collectors;
11 11  
12 12 import cn.hutool.core.collection.CollectionUtil;
13 13 import cn.hutool.http.HttpUtil;
14   -import com.github.pagehelper.util.StringUtil;
15 14 import com.ruoyi.common.cache.NowSchedulingCache;
16 15 import com.ruoyi.common.cache.SchedulingCache;
17 16 import com.ruoyi.common.config.RuoYiConfig;
... ... @@ -61,7 +60,6 @@ import javax.servlet.http.HttpServletResponse;
61 60 import static com.ruoyi.common.ApiProperties.PERSONNEL_API_KEY;
62 61 import static com.ruoyi.common.ConstDriverProperties.*;
63 62 import static com.ruoyi.common.ConstSignInConstSignInProperties.*;
64   -import static com.ruoyi.common.ErrorTypeProperties.WORK_DAY_ERROR;
65 63 import static com.ruoyi.common.redispre.GlobalRedisPreName.DRIVER_SCHEDULING_PRE;
66 64  
67 65 /**
... ... @@ -166,7 +164,7 @@ public class DriverServiceImpl implements IDriverService {
166 164 // 如果当前有效范围内签到记录无效如酒精测试异常则重复当前操作
167 165 if ((Math.abs(nowBetween) <= 60)) {
168 166 return timeMap.get(index);
169   - } else if (nowBetween > 60L){
  167 + } else if (nowBetween > 60L) {
170 168 index = index < timeMap.size() - 1 ? index + 1 : index;
171 169 }
172 170 }
... ... @@ -494,12 +492,13 @@ public class DriverServiceImpl implements IDriverService {
494 492 driver.setPosts(vo.getPosts());
495 493 String base64 = vo.getImage();
496 494 String fileName = vo.getJobCode() + ".png";
497   - String filePath = new File(RuoYiConfig.getUploadPath() + headImagePre + "/" + fileName + File.separator).getAbsolutePath();
  495 + String filePath = getPathUrl(new File(RuoYiConfig.getUploadPath() + headImagePre + "/" + File.separator + fileName));
498 496 try {
499 497 fileName = FileUploadUtils.getPathFileName(RuoYiConfig.getUploadPath() + headImagePre, fileName);
500 498 } catch (IOException e) {
501 499 throw new RuntimeException(e);
502 500 }
  501 +
503 502 driver.setImage(fileName);
504 503 driver.setUpdateTime(new Date());
505 504 driverMapper.insertDriver(driver);
... ... @@ -511,6 +510,15 @@ public class DriverServiceImpl implements IDriverService {
511 510 threadJobService.asyncStartUploadBase64Image(filePath, base64);
512 511 }
513 512  
  513 + private String getPathUrl(File desc) {
  514 + if (!desc.exists()) {
  515 + if (!desc.getParentFile().exists()) {
  516 + desc.getParentFile().mkdirs();
  517 + }
  518 + }
  519 + return desc.getAbsolutePath();
  520 + }
  521 +
514 522 @Override
515 523 public void updateDrivers(List<Driver> drivers) {
516 524 driverMapper.updateDriverInfoByJobCodes(drivers);
... ...