Commit 52fd9259831ab6ce5b296cc72bf8545d61e88522
1 parent
efbd1836
feat: 修改上传头像配置,修改日志文件
Showing
3 changed files
with
14 additions
and
6 deletions
Bsth-admin/src/main/java/com/ruoyi/common/cache/NowSchedulingCache.java
| @@ -28,7 +28,7 @@ public class NowSchedulingCache { | @@ -28,7 +28,7 @@ public class NowSchedulingCache { | ||
| 28 | public NowSchedulingCache(DriverSchedulingMapper driverSchedulingMapper,IErrorJobcodeService errorJobcodeService) { | 28 | public NowSchedulingCache(DriverSchedulingMapper driverSchedulingMapper,IErrorJobcodeService errorJobcodeService) { |
| 29 | this.schedulingMapper = driverSchedulingMapper; | 29 | this.schedulingMapper = driverSchedulingMapper; |
| 30 | this.errorJobcodeService = errorJobcodeService; | 30 | this.errorJobcodeService = errorJobcodeService; |
| 31 | - log.info("项目启动加载中获取排班表-----"); | 31 | + log.info("金高项目启动加载中获取排班表-----"); |
| 32 | // cacheNowDaySchedulingInit(); | 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,7 +41,7 @@ public class SchedulingCache { | ||
| 41 | 41 | ||
| 42 | 42 | ||
| 43 | public SchedulingCache() { | 43 | public SchedulingCache() { |
| 44 | - log.info("项目启动加载中获取实时班次-----"); | 44 | + log.info("金高项目启动加载中获取实时班次-----"); |
| 45 | schedulingInit(); | 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,7 +11,6 @@ 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; | ||
| 15 | import com.ruoyi.common.cache.NowSchedulingCache; | 14 | import com.ruoyi.common.cache.NowSchedulingCache; |
| 16 | import com.ruoyi.common.cache.SchedulingCache; | 15 | import com.ruoyi.common.cache.SchedulingCache; |
| 17 | import com.ruoyi.common.config.RuoYiConfig; | 16 | import com.ruoyi.common.config.RuoYiConfig; |
| @@ -61,7 +60,6 @@ import javax.servlet.http.HttpServletResponse; | @@ -61,7 +60,6 @@ import javax.servlet.http.HttpServletResponse; | ||
| 61 | import static com.ruoyi.common.ApiProperties.PERSONNEL_API_KEY; | 60 | import static com.ruoyi.common.ApiProperties.PERSONNEL_API_KEY; |
| 62 | import static com.ruoyi.common.ConstDriverProperties.*; | 61 | import static com.ruoyi.common.ConstDriverProperties.*; |
| 63 | import static com.ruoyi.common.ConstSignInConstSignInProperties.*; | 62 | import static com.ruoyi.common.ConstSignInConstSignInProperties.*; |
| 64 | -import static com.ruoyi.common.ErrorTypeProperties.WORK_DAY_ERROR; | ||
| 65 | import static com.ruoyi.common.redispre.GlobalRedisPreName.DRIVER_SCHEDULING_PRE; | 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,7 +164,7 @@ public class DriverServiceImpl implements IDriverService { | ||
| 166 | // 如果当前有效范围内签到记录无效如酒精测试异常则重复当前操作 | 164 | // 如果当前有效范围内签到记录无效如酒精测试异常则重复当前操作 |
| 167 | if ((Math.abs(nowBetween) <= 60)) { | 165 | if ((Math.abs(nowBetween) <= 60)) { |
| 168 | return timeMap.get(index); | 166 | return timeMap.get(index); |
| 169 | - } else if (nowBetween > 60L){ | 167 | + } else if (nowBetween > 60L) { |
| 170 | index = index < timeMap.size() - 1 ? index + 1 : index; | 168 | index = index < timeMap.size() - 1 ? index + 1 : index; |
| 171 | } | 169 | } |
| 172 | } | 170 | } |
| @@ -494,12 +492,13 @@ public class DriverServiceImpl implements IDriverService { | @@ -494,12 +492,13 @@ public class DriverServiceImpl implements IDriverService { | ||
| 494 | driver.setPosts(vo.getPosts()); | 492 | driver.setPosts(vo.getPosts()); |
| 495 | String base64 = vo.getImage(); | 493 | String base64 = vo.getImage(); |
| 496 | String fileName = vo.getJobCode() + ".png"; | 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 | try { | 496 | try { |
| 499 | fileName = FileUploadUtils.getPathFileName(RuoYiConfig.getUploadPath() + headImagePre, fileName); | 497 | fileName = FileUploadUtils.getPathFileName(RuoYiConfig.getUploadPath() + headImagePre, fileName); |
| 500 | } catch (IOException e) { | 498 | } catch (IOException e) { |
| 501 | throw new RuntimeException(e); | 499 | throw new RuntimeException(e); |
| 502 | } | 500 | } |
| 501 | + | ||
| 503 | driver.setImage(fileName); | 502 | driver.setImage(fileName); |
| 504 | driver.setUpdateTime(new Date()); | 503 | driver.setUpdateTime(new Date()); |
| 505 | driverMapper.insertDriver(driver); | 504 | driverMapper.insertDriver(driver); |
| @@ -511,6 +510,15 @@ public class DriverServiceImpl implements IDriverService { | @@ -511,6 +510,15 @@ public class DriverServiceImpl implements IDriverService { | ||
| 511 | threadJobService.asyncStartUploadBase64Image(filePath, base64); | 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 | @Override | 522 | @Override |
| 515 | public void updateDrivers(List<Driver> drivers) { | 523 | public void updateDrivers(List<Driver> drivers) { |
| 516 | driverMapper.updateDriverInfoByJobCodes(drivers); | 524 | driverMapper.updateDriverInfoByJobCodes(drivers); |