Commit fa9ea695c9d05899b4266eb8045153c2a9adccfa
1 parent
f7196ca4
对接文件系统和蓝斯设备日志上传
Showing
31 changed files
with
239 additions
and
273 deletions
Bsth-admin/pom.xml
| @@ -22,11 +22,6 @@ | @@ -22,11 +22,6 @@ | ||
| 22 | <scope>test</scope> | 22 | <scope>test</scope> |
| 23 | </dependency> | 23 | </dependency> |
| 24 | 24 | ||
| 25 | - <dependency> | ||
| 26 | - <groupId>io.minio</groupId> | ||
| 27 | - <artifactId>minio</artifactId> | ||
| 28 | - <version>8.2.1</version> | ||
| 29 | - </dependency> | ||
| 30 | 25 | ||
| 31 | 26 | ||
| 32 | <dependency> | 27 | <dependency> |
Bsth-admin/src/main/java/com/ruoyi/controller/RefreshController.java
| @@ -275,7 +275,7 @@ public class RefreshController { | @@ -275,7 +275,7 @@ public class RefreshController { | ||
| 275 | 275 | ||
| 276 | @GetMapping(value = "/jar/class/path") | 276 | @GetMapping(value = "/jar/class/path") |
| 277 | public ResponseResult<String> getJarClassPath() { | 277 | public ResponseResult<String> getJarClassPath() { |
| 278 | - String path = StringUtils.join(System.getProperty("user.dir"), File.separator, "images"); | 278 | + String path = StringUtils.join(System.getProperty("user.dir"), "/images"); |
| 279 | 279 | ||
| 280 | ResponseResult<String> responseResult = ResponseResult.success(); | 280 | ResponseResult<String> responseResult = ResponseResult.success(); |
| 281 | responseResult.setData(path); | 281 | responseResult.setData(path); |
Bsth-admin/src/main/java/com/ruoyi/controller/dss/LansiAppLogController.java deleted
100644 → 0
| 1 | -package com.ruoyi.controller.dss; | ||
| 2 | - | ||
| 3 | -import com.ruoyi.common.core.controller.BaseController; | ||
| 4 | -import com.ruoyi.common.core.domain.ResponseResult; | ||
| 5 | -import com.ruoyi.domain.dss2.log.EquipmengLogDTO; | ||
| 6 | -import com.ruoyi.equipment.domain.Equipment; | ||
| 7 | -import com.ruoyi.equipment.service.IEquipmentService; | ||
| 8 | -import io.swagger.annotations.Api; | ||
| 9 | -import io.swagger.annotations.ApiOperation; | ||
| 10 | -import lombok.extern.slf4j.Slf4j; | ||
| 11 | -import org.apache.commons.collections4.CollectionUtils; | ||
| 12 | -import org.apache.commons.lang3.StringUtils; | ||
| 13 | -import org.slf4j.Logger; | ||
| 14 | -import org.slf4j.LoggerFactory; | ||
| 15 | -import org.springframework.web.bind.annotation.PostMapping; | ||
| 16 | -import org.springframework.web.bind.annotation.RequestBody; | ||
| 17 | -import org.springframework.web.bind.annotation.RequestMapping; | ||
| 18 | -import org.springframework.web.bind.annotation.RestController; | ||
| 19 | - | ||
| 20 | -import java.util.HashMap; | ||
| 21 | -import java.util.List; | ||
| 22 | -import java.util.Map; | ||
| 23 | -import java.util.Objects; | ||
| 24 | - | ||
| 25 | -@RestController | ||
| 26 | -@Slf4j | ||
| 27 | -@RequestMapping("/dss") | ||
| 28 | -@Api(tags = "【蓝斯二期】蓝斯设备日志") | ||
| 29 | -public class LansiAppLogController extends BaseController { | ||
| 30 | - | ||
| 31 | - private final static Map<String, Logger> LOGGER_MAP = new HashMap<>(); | ||
| 32 | - | ||
| 33 | - public LansiAppLogController(IEquipmentService equipmentService) { | ||
| 34 | - List<Equipment> equipmentList = equipmentService.list(); | ||
| 35 | - int size = CollectionUtils.size(equipmentList); | ||
| 36 | - for (int i = 0; i < size; i++) { | ||
| 37 | - String name = StringUtils.join("lansi:", equipmentList.get(i).getDeviceId()); | ||
| 38 | - LOGGER_MAP.put(equipmentList.get(i).getDeviceId(), LoggerFactory.getLogger(name)); | ||
| 39 | - } | ||
| 40 | - } | ||
| 41 | - | ||
| 42 | - @ApiOperation(value = "设备日志") | ||
| 43 | - @PostMapping("/equipment/log") | ||
| 44 | - public ResponseResult<Boolean> createLog(@RequestBody EquipmengLogDTO equipmengLogDTO) { | ||
| 45 | - | ||
| 46 | - Logger logger = LOGGER_MAP.get(equipmengLogDTO.getDevice()); | ||
| 47 | - if (Objects.isNull(logger)) { | ||
| 48 | - String name = StringUtils.join("lansi:", equipmengLogDTO.getDevice()); | ||
| 49 | - logger = LoggerFactory.getLogger(name); | ||
| 50 | - LOGGER_MAP.put(equipmengLogDTO.getDevice(), logger); | ||
| 51 | - | ||
| 52 | - } | ||
| 53 | - logger.info("[{}]", equipmengLogDTO); | ||
| 54 | - return ResponseResult.success(Boolean.TRUE); | ||
| 55 | - } | ||
| 56 | -} |
Bsth-admin/src/main/java/com/ruoyi/controller/dss2/DssLogController.java
0 → 100644
| 1 | +package com.ruoyi.controller.dss2; | ||
| 2 | + | ||
| 3 | +import com.ruoyi.common.TipEnum; | ||
| 4 | +import com.ruoyi.common.core.domain.AjaxResult; | ||
| 5 | +import com.ruoyi.common.core.domain.ResponseResult; | ||
| 6 | +import com.ruoyi.common.utils.file.MinioConfig; | ||
| 7 | +import com.ruoyi.framework.security.filter.JwtAuthenticationTokenFilter; | ||
| 8 | +import com.ruoyi.utils.DateUtil; | ||
| 9 | +import io.swagger.annotations.Api; | ||
| 10 | +import io.swagger.annotations.ApiOperation; | ||
| 11 | +import lombok.extern.slf4j.Slf4j; | ||
| 12 | +import org.apache.commons.lang3.StringUtils; | ||
| 13 | +import org.springframework.beans.factory.annotation.Autowired; | ||
| 14 | +import org.springframework.boot.autoconfigure.info.ProjectInfoProperties; | ||
| 15 | +import org.springframework.web.bind.annotation.PathVariable; | ||
| 16 | +import org.springframework.web.bind.annotation.PostMapping; | ||
| 17 | +import org.springframework.web.bind.annotation.RequestMapping; | ||
| 18 | +import org.springframework.web.bind.annotation.RestController; | ||
| 19 | +import org.springframework.web.multipart.MultipartFile; | ||
| 20 | + | ||
| 21 | +@Slf4j | ||
| 22 | +@RestController | ||
| 23 | +@RequestMapping("/dss/log") | ||
| 24 | +@Api(tags = "【蓝斯二期】日志信息") | ||
| 25 | +public class DssLogController { | ||
| 26 | + @Autowired | ||
| 27 | + private MinioConfig minioConfig; | ||
| 28 | + | ||
| 29 | + @PostMapping("/upload/{device}") | ||
| 30 | + @ApiOperation("客户端日志文件上传") | ||
| 31 | + public ResponseResult<Boolean> uploadImage(MultipartFile file, @PathVariable("device") String device) { | ||
| 32 | + String msg = JwtAuthenticationTokenFilter.validateDevice(device); | ||
| 33 | + if (StringUtils.isNotEmpty(msg)) { | ||
| 34 | + log.info(msg); | ||
| 35 | + return ResponseResult.error(TipEnum.TIP_401.getCode(), TipEnum.TIP_401.getMsg()); | ||
| 36 | + } | ||
| 37 | + | ||
| 38 | + try { | ||
| 39 | + String fileName = StringUtils.join("logs/", DateUtil.shortNowStr(), "/", device, "/", file.getOriginalFilename()); | ||
| 40 | + boolean flag = minioConfig.upload(file, fileName); | ||
| 41 | + return flag?ResponseResult.success(Boolean.TRUE):ResponseResult.error("上传日志文件失败"); | ||
| 42 | + } catch (Exception e) { | ||
| 43 | + log.error("客户端日志文件上传异常:[{}]", device, e); | ||
| 44 | + } | ||
| 45 | + | ||
| 46 | + | ||
| 47 | + return ResponseResult.error("上传日志文件失败"); | ||
| 48 | + } | ||
| 49 | + | ||
| 50 | +} |
Bsth-admin/src/main/java/com/ruoyi/driver/service/impl/DriverServiceImpl.java
| @@ -22,6 +22,7 @@ import com.ruoyi.common.utils.DateUtils; | @@ -22,6 +22,7 @@ import com.ruoyi.common.utils.DateUtils; | ||
| 22 | import com.ruoyi.common.utils.file.FileUploadUtils; | 22 | import com.ruoyi.common.utils.file.FileUploadUtils; |
| 23 | import com.ruoyi.common.utils.file.FileUtils; | 23 | import com.ruoyi.common.utils.file.FileUtils; |
| 24 | import com.ruoyi.common.utils.file.MimeTypeUtils; | 24 | import com.ruoyi.common.utils.file.MimeTypeUtils; |
| 25 | +import com.ruoyi.common.utils.file.MinioConfig; | ||
| 25 | import com.ruoyi.domain.DriverScheduling; | 26 | import com.ruoyi.domain.DriverScheduling; |
| 26 | import com.ruoyi.domain.EquipmentDriverExpand; | 27 | import com.ruoyi.domain.EquipmentDriverExpand; |
| 27 | import com.ruoyi.driver.domain.Driver; | 28 | import com.ruoyi.driver.domain.Driver; |
| @@ -136,6 +137,8 @@ public class DriverServiceImpl extends ServiceImpl<DriverMapper, Driver> impleme | @@ -136,6 +137,8 @@ public class DriverServiceImpl extends ServiceImpl<DriverMapper, Driver> impleme | ||
| 136 | 137 | ||
| 137 | @Autowired | 138 | @Autowired |
| 138 | private RuleAttendanceMainService attendanceMainService; | 139 | private RuleAttendanceMainService attendanceMainService; |
| 140 | + @Autowired | ||
| 141 | + private MinioConfig minioConfig; | ||
| 139 | 142 | ||
| 140 | /** | 143 | /** |
| 141 | * 查询驾驶员信息 | 144 | * 查询驾驶员信息 |
| @@ -408,13 +411,12 @@ public class DriverServiceImpl extends ServiceImpl<DriverMapper, Driver> impleme | @@ -408,13 +411,12 @@ public class DriverServiceImpl extends ServiceImpl<DriverMapper, Driver> impleme | ||
| 408 | } else { | 411 | } else { |
| 409 | fileName = StringUtils.join("head/", RandomUtils.nextInt(1, 90000), "/", fileName); | 412 | fileName = StringUtils.join("head/", RandomUtils.nextInt(1, 90000), "/", fileName); |
| 410 | } | 413 | } |
| 411 | - String urlFileName = fileName; | ||
| 412 | - String absPath = FileUploadUtils.getAbsoluteFile(baseUrl, fileName).getAbsolutePath(); | ||
| 413 | - fileName = FileUploadUtils.getPathFileName(baseUrl, fileName); | ||
| 414 | - file.transferTo(Paths.get(absPath)); | 414 | + |
| 415 | + minioConfig.upload(file, fileName); | ||
| 416 | + | ||
| 415 | 417 | ||
| 416 | SysDictData source = sysDictDataService.getResourceBaseUrl(); | 418 | SysDictData source = sysDictDataService.getResourceBaseUrl(); |
| 417 | - String url = sysDictDataService.combationValue(urlFileName, source); | 419 | + String url = sysDictDataService.combationValue(fileName, source); |
| 418 | 420 | ||
| 419 | AjaxResult ajax = AjaxResult.success(); | 421 | AjaxResult ajax = AjaxResult.success(); |
| 420 | ajax.put("url", url); | 422 | ajax.put("url", url); |
| @@ -650,7 +652,7 @@ public class DriverServiceImpl extends ServiceImpl<DriverMapper, Driver> impleme | @@ -650,7 +652,7 @@ public class DriverServiceImpl extends ServiceImpl<DriverMapper, Driver> impleme | ||
| 650 | driver.setPosts(vo.getPosts()); | 652 | driver.setPosts(vo.getPosts()); |
| 651 | String base64 = vo.getImage(); | 653 | String base64 = vo.getImage(); |
| 652 | String fileName = vo.getJobCode() + ".png"; | 654 | String fileName = vo.getJobCode() + ".png"; |
| 653 | - String filePath = new File(RuoYiConfig.getUploadPath() + headImagePre + "/" + fileName + File.separator).getAbsolutePath(); | 655 | + String filePath = new File(RuoYiConfig.getUploadPath() + headImagePre + "/" + fileName + "/").getAbsolutePath(); |
| 654 | try { | 656 | try { |
| 655 | fileName = FileUploadUtils.getPathFileName(RuoYiConfig.getUploadPath() + headImagePre, fileName); | 657 | fileName = FileUploadUtils.getPathFileName(RuoYiConfig.getUploadPath() + headImagePre, fileName); |
| 656 | } catch (IOException e) { | 658 | } catch (IOException e) { |
| @@ -817,7 +819,7 @@ public class DriverServiceImpl extends ServiceImpl<DriverMapper, Driver> impleme | @@ -817,7 +819,7 @@ public class DriverServiceImpl extends ServiceImpl<DriverMapper, Driver> impleme | ||
| 817 | private File getLocationFile(String jobCode) { | 819 | private File getLocationFile(String jobCode) { |
| 818 | String image = driverMapper.getDriverImageByJobCode(jobCode); | 820 | String image = driverMapper.getDriverImageByJobCode(jobCode); |
| 819 | 821 | ||
| 820 | - return new File(RuoYiConfig.getProfile() + File.separator + image.replace("/profile", "")); | 822 | + return new File(RuoYiConfig.getProfile() + "/" + image.replace("/profile", "")); |
| 821 | } | 823 | } |
| 822 | 824 | ||
| 823 | private String calimageContentFaceFeature(String imagePath) { | 825 | private String calimageContentFaceFeature(String imagePath) { |
Bsth-admin/src/main/java/com/ruoyi/in/service/impl/SignInServiceImpl.java
| @@ -819,7 +819,7 @@ public class SignInServiceImpl extends ServiceImpl<SignInMapper, SignIn> impleme | @@ -819,7 +819,7 @@ public class SignInServiceImpl extends ServiceImpl<SignInMapper, SignIn> impleme | ||
| 819 | * @throws IOException | 819 | * @throws IOException |
| 820 | */ | 820 | */ |
| 821 | public File getAbsoluteFile(String uploadDir, String fileName) throws IOException { | 821 | public File getAbsoluteFile(String uploadDir, String fileName) throws IOException { |
| 822 | - File desc = new File(uploadDir + File.separator + fileName); | 822 | + File desc = new File(uploadDir + "/" + fileName); |
| 823 | 823 | ||
| 824 | if (!desc.exists()) { | 824 | if (!desc.exists()) { |
| 825 | if (!desc.getParentFile().exists()) { | 825 | if (!desc.getParentFile().exists()) { |
Bsth-admin/src/main/java/com/ruoyi/in/service/impl/SignInServiceV1Impl.java
| @@ -42,6 +42,7 @@ import com.ruoyi.service.ThreadJobService; | @@ -42,6 +42,7 @@ import com.ruoyi.service.ThreadJobService; | ||
| 42 | import com.ruoyi.service.sign.in.exception.report.EquipmentExceptionReportService; | 42 | import com.ruoyi.service.sign.in.exception.report.EquipmentExceptionReportService; |
| 43 | import com.ruoyi.service.sign.in.resource.LinggangSignInResourceService; | 43 | import com.ruoyi.service.sign.in.resource.LinggangSignInResourceService; |
| 44 | import com.ruoyi.utils.ConstDateUtil; | 44 | import com.ruoyi.utils.ConstDateUtil; |
| 45 | +import com.ruoyi.utils.DateUtil; | ||
| 45 | import com.ruoyi.utils.UploadUtil; | 46 | import com.ruoyi.utils.UploadUtil; |
| 46 | import lombok.extern.slf4j.Slf4j; | 47 | import lombok.extern.slf4j.Slf4j; |
| 47 | import org.apache.commons.collections4.CollectionUtils; | 48 | import org.apache.commons.collections4.CollectionUtils; |
| @@ -277,14 +278,12 @@ public class SignInServiceV1Impl extends ServiceImpl<SignInMapperV1, SignInV1> i | @@ -277,14 +278,12 @@ public class SignInServiceV1Impl extends ServiceImpl<SignInMapperV1, SignInV1> i | ||
| 277 | } | 278 | } |
| 278 | if (org.apache.commons.lang3.StringUtils.isNotEmpty(videoContent) && Objects.equals(signIn.getResourceType(), 2)) { | 279 | if (org.apache.commons.lang3.StringUtils.isNotEmpty(videoContent) && Objects.equals(signIn.getResourceType(), 2)) { |
| 279 | StringBuilder builder = new StringBuilder(); | 280 | StringBuilder builder = new StringBuilder(); |
| 280 | - builder.append("sign"); | ||
| 281 | - builder.append(File.separator); | ||
| 282 | - builder.append("images"); | ||
| 283 | - builder.append(File.separator); | ||
| 284 | - builder.append("offline"); | ||
| 285 | - builder.append(File.separator); | 281 | + builder.append("sign/video/offline/"); |
| 282 | + builder.append(DateUtil.shortNowStr()); | ||
| 283 | + builder.append("/"); | ||
| 284 | + builder.append("/"); | ||
| 286 | builder.append(signIn.getId()); | 285 | builder.append(signIn.getId()); |
| 287 | - builder.append(File.separator); | 286 | + builder.append("/"); |
| 288 | builder.append(java.util.UUID.randomUUID().toString().replace("-", "")); | 287 | builder.append(java.util.UUID.randomUUID().toString().replace("-", "")); |
| 289 | builder.append(".mp4"); | 288 | builder.append(".mp4"); |
| 290 | 289 | ||
| @@ -301,18 +300,15 @@ public class SignInServiceV1Impl extends ServiceImpl<SignInMapperV1, SignInV1> i | @@ -301,18 +300,15 @@ public class SignInServiceV1Impl extends ServiceImpl<SignInMapperV1, SignInV1> i | ||
| 301 | signInResourceService.save(signInResource); | 300 | signInResourceService.save(signInResource); |
| 302 | } else if (org.apache.commons.lang3.StringUtils.isNotEmpty(videoContent)) { | 301 | } else if (org.apache.commons.lang3.StringUtils.isNotEmpty(videoContent)) { |
| 303 | StringBuilder builder = new StringBuilder(); | 302 | StringBuilder builder = new StringBuilder(); |
| 304 | - builder.append("sign"); | ||
| 305 | - builder.append(File.separator); | ||
| 306 | - builder.append("images"); | ||
| 307 | - builder.append(File.separator); | ||
| 308 | - builder.append("offline"); | ||
| 309 | - builder.append(File.separator); | 303 | + builder.append("sign/images/offline/"); |
| 304 | + builder.append(DateUtil.shortNowStr()); | ||
| 305 | + builder.append("/"); | ||
| 310 | builder.append(signIn.getId()); | 306 | builder.append(signIn.getId()); |
| 311 | - builder.append(File.separator); | 307 | + builder.append("/"); |
| 312 | builder.append(java.util.UUID.randomUUID().toString().replace("-", "")); | 308 | builder.append(java.util.UUID.randomUUID().toString().replace("-", "")); |
| 313 | builder.append(".jpg"); | 309 | builder.append(".jpg"); |
| 314 | 310 | ||
| 315 | - uploadUtil.uploadVideoOfBase64(videoContent, builder.toString()); | 311 | + uploadUtil.uploadImageOfBase64(videoContent, builder.toString(),"jpg"); |
| 316 | 312 | ||
| 317 | LinggangSignInResource signInResource = new LinggangSignInResource(); | 313 | LinggangSignInResource signInResource = new LinggangSignInResource(); |
| 318 | signInResource.setSignId(signIn.getId()); | 314 | signInResource.setSignId(signIn.getId()); |
| @@ -626,7 +622,7 @@ public class SignInServiceV1Impl extends ServiceImpl<SignInMapperV1, SignInV1> i | @@ -626,7 +622,7 @@ public class SignInServiceV1Impl extends ServiceImpl<SignInMapperV1, SignInV1> i | ||
| 626 | * @throws IOException | 622 | * @throws IOException |
| 627 | */ | 623 | */ |
| 628 | private File getAbsoluteFile(String uploadDir, String fileName) throws IOException { | 624 | private File getAbsoluteFile(String uploadDir, String fileName) throws IOException { |
| 629 | - File desc = new File(uploadDir + File.separator + fileName); | 625 | + File desc = new File(uploadDir + "/" + fileName); |
| 630 | 626 | ||
| 631 | if (!desc.exists()) { | 627 | if (!desc.exists()) { |
| 632 | if (!desc.getParentFile().exists()) { | 628 | if (!desc.getParentFile().exists()) { |
Bsth-admin/src/main/java/com/ruoyi/pojo/converter/common/ImageConverter.java
| @@ -37,7 +37,7 @@ public class ImageConverter implements Converter<String> { | @@ -37,7 +37,7 @@ public class ImageConverter implements Converter<String> { | ||
| 37 | GlobalConfiguration globalConfiguration) throws IOException { | 37 | GlobalConfiguration globalConfiguration) throws IOException { |
| 38 | String path = RuoYiConfig.getProfile() + value.replace("/profile", ""); | 38 | String path = RuoYiConfig.getProfile() + value.replace("/profile", ""); |
| 39 | System.out.println(path); | 39 | System.out.println(path); |
| 40 | - File file = new File(path + File.separator); | 40 | + File file = new File(path + "/"); |
| 41 | if (file.exists()) { | 41 | if (file.exists()) { |
| 42 | if (file.isDirectory() || !file.canRead()) { | 42 | if (file.isDirectory() || !file.canRead()) { |
| 43 | return new CellData("没有图片"); | 43 | return new CellData("没有图片"); |
Bsth-admin/src/main/java/com/ruoyi/service/ReportService.java
| @@ -13,22 +13,27 @@ import com.ruoyi.common.global.ResultCode; | @@ -13,22 +13,27 @@ import com.ruoyi.common.global.ResultCode; | ||
| 13 | import com.ruoyi.common.utils.SecurityUtils; | 13 | import com.ruoyi.common.utils.SecurityUtils; |
| 14 | import com.ruoyi.common.utils.poi.ExcelUtil; | 14 | import com.ruoyi.common.utils.poi.ExcelUtil; |
| 15 | import com.ruoyi.domain.DriverScheduling; | 15 | import com.ruoyi.domain.DriverScheduling; |
| 16 | +import com.ruoyi.domain.scheduling.LinggangScheduling; | ||
| 16 | import com.ruoyi.driver.domain.Driver; | 17 | import com.ruoyi.driver.domain.Driver; |
| 17 | import com.ruoyi.driver.mapper.DriverMapper; | 18 | import com.ruoyi.driver.mapper.DriverMapper; |
| 18 | import com.ruoyi.driver.mapper.DriverSchedulingMapper; | 19 | import com.ruoyi.driver.mapper.DriverSchedulingMapper; |
| 19 | import com.ruoyi.eexception.mapper.EquipmentExceptionMapper; | 20 | import com.ruoyi.eexception.mapper.EquipmentExceptionMapper; |
| 20 | import com.ruoyi.in.domain.SignIn; | 21 | import com.ruoyi.in.domain.SignIn; |
| 21 | import com.ruoyi.in.mapper.SignInMapper; | 22 | import com.ruoyi.in.mapper.SignInMapper; |
| 23 | +import com.ruoyi.in.service.ISignInService; | ||
| 22 | import com.ruoyi.pojo.request.ReportErrorRequestVo; | 24 | import com.ruoyi.pojo.request.ReportErrorRequestVo; |
| 23 | import com.ruoyi.pojo.request.ReportViewRequestVo; | 25 | import com.ruoyi.pojo.request.ReportViewRequestVo; |
| 24 | import com.ruoyi.pojo.response.*; | 26 | import com.ruoyi.pojo.response.*; |
| 25 | import com.ruoyi.pojo.vo.PersonSignDataResponseVo; | 27 | import com.ruoyi.pojo.vo.PersonSignDataResponseVo; |
| 28 | +import com.ruoyi.service.scheduling.LinggangSchedulingService; | ||
| 26 | import com.ruoyi.system.domain.SysNotice; | 29 | import com.ruoyi.system.domain.SysNotice; |
| 30 | +import com.ruoyi.system.service.ISysDictDataService; | ||
| 27 | import com.ruoyi.system.service.ISysNoticeService; | 31 | import com.ruoyi.system.service.ISysNoticeService; |
| 28 | import com.ruoyi.utils.ConstDateUtil; | 32 | import com.ruoyi.utils.ConstDateUtil; |
| 29 | import com.ruoyi.utils.DateUtil; | 33 | import com.ruoyi.utils.DateUtil; |
| 30 | import com.ruoyi.utils.ToolUtils; | 34 | import com.ruoyi.utils.ToolUtils; |
| 31 | import lombok.extern.slf4j.Slf4j; | 35 | import lombok.extern.slf4j.Slf4j; |
| 36 | +import org.apache.commons.collections4.CollectionUtils; | ||
| 32 | import org.apache.commons.lang3.time.DateUtils; | 37 | import org.apache.commons.lang3.time.DateUtils; |
| 33 | import org.springframework.beans.BeanUtils; | 38 | import org.springframework.beans.BeanUtils; |
| 34 | import org.springframework.beans.factory.annotation.Autowired; | 39 | import org.springframework.beans.factory.annotation.Autowired; |
| @@ -89,6 +94,10 @@ public class ReportService { | @@ -89,6 +94,10 @@ public class ReportService { | ||
| 89 | private RedisCache redisCache; | 94 | private RedisCache redisCache; |
| 90 | @Autowired | 95 | @Autowired |
| 91 | private NowSchedulingCache nowSchedulingCache; | 96 | private NowSchedulingCache nowSchedulingCache; |
| 97 | + @Autowired | ||
| 98 | + private ISignInService signInService; | ||
| 99 | + @Autowired | ||
| 100 | + private ISysDictDataService sysDictDataService; | ||
| 92 | 101 | ||
| 93 | /** | 102 | /** |
| 94 | * 查询报表信息 | 103 | * 查询报表信息 |
| @@ -100,6 +109,15 @@ public class ReportService { | @@ -100,6 +109,15 @@ public class ReportService { | ||
| 100 | 109 | ||
| 101 | public List<ReportErrorResponseVo> getErrorReportList(ReportErrorRequestVo request) { | 110 | public List<ReportErrorResponseVo> getErrorReportList(ReportErrorRequestVo request) { |
| 102 | List<EquipmentExceptionResponseVo> list = exceptionMapper.selectEquipmentExceptionListByVo(request); | 111 | List<EquipmentExceptionResponseVo> list = exceptionMapper.selectEquipmentExceptionListByVo(request); |
| 112 | + Set<Long> signIds = list.stream().map(EquipmentExceptionResponseVo::getSignId).collect(Collectors.toSet()); | ||
| 113 | + List<SignIn> signInList = null; | ||
| 114 | + | ||
| 115 | + if (CollectionUtils.isNotEmpty(signIds)) { | ||
| 116 | + signInList = signInService.listByIds(signIds); | ||
| 117 | + } | ||
| 118 | + int size = CollectionUtils.size(signInList); | ||
| 119 | + List<SignIn> signInList1 = signInList; | ||
| 120 | + | ||
| 103 | return list.stream().map(item -> { | 121 | return list.stream().map(item -> { |
| 104 | ReportErrorResponseVo vo = new ReportErrorResponseVo(); | 122 | ReportErrorResponseVo vo = new ReportErrorResponseVo(); |
| 105 | vo.setRemark(item.getRemark()); | 123 | vo.setRemark(item.getRemark()); |
| @@ -114,6 +132,12 @@ public class ReportService { | @@ -114,6 +132,12 @@ public class ReportService { | ||
| 114 | vo.setFleetName(item.getFleetName()); | 132 | vo.setFleetName(item.getFleetName()); |
| 115 | vo.setLineName(item.getLineName()); | 133 | vo.setLineName(item.getLineName()); |
| 116 | vo.setPlanTime(item.getPlanTime()); | 134 | vo.setPlanTime(item.getPlanTime()); |
| 135 | + | ||
| 136 | + if (size > 0) { | ||
| 137 | + Optional<SignIn> optional = signInList1.stream().filter(ls -> Objects.equals(ls.getId(), item.getSignId())).findFirst(); | ||
| 138 | + optional.ifPresent(signIn -> vo.setImage(sysDictDataService.combationValue(signIn.getImage()))); | ||
| 139 | + } | ||
| 140 | + | ||
| 117 | return vo; | 141 | return vo; |
| 118 | }).collect(Collectors.toList()); | 142 | }).collect(Collectors.toList()); |
| 119 | } | 143 | } |
| @@ -269,11 +293,11 @@ public class ReportService { | @@ -269,11 +293,11 @@ public class ReportService { | ||
| 269 | private List<ExportReportViewResponseVo> getDayReportTableResponseVo(String date) { | 293 | private List<ExportReportViewResponseVo> getDayReportTableResponseVo(String date) { |
| 270 | String endDateStr = null; | 294 | String endDateStr = null; |
| 271 | try { | 295 | try { |
| 272 | - endDateStr = DateUtil.YYYY_MM_DD_LINK.format(DateUtils.addDays(DateUtil.YYYY_MM_DD_LINK.parse(date),1)); | 296 | + endDateStr = DateUtil.YYYY_MM_DD_LINK.format(DateUtils.addDays(DateUtil.YYYY_MM_DD_LINK.parse(date), 1)); |
| 273 | } catch (ParseException e) { | 297 | } catch (ParseException e) { |
| 274 | throw new RuntimeException(e); | 298 | throw new RuntimeException(e); |
| 275 | } | 299 | } |
| 276 | - List<DriverScheduling> schedulingList = schedulingMapper.queryToDay(date,endDateStr, null, null, null); | 300 | + List<DriverScheduling> schedulingList = schedulingMapper.queryToDay(date, endDateStr, null, null, null); |
| 277 | Map<String, List<DriverScheduling>> resultMap = new HashMap<>(800); | 301 | Map<String, List<DriverScheduling>> resultMap = new HashMap<>(800); |
| 278 | List<ExportReportViewResponseVo> signVo = new ArrayList<>(800); | 302 | List<ExportReportViewResponseVo> signVo = new ArrayList<>(800); |
| 279 | handlerResultMap(date, resultMap, schedulingList); | 303 | handlerResultMap(date, resultMap, schedulingList); |
| @@ -368,11 +392,11 @@ public class ReportService { | @@ -368,11 +392,11 @@ public class ReportService { | ||
| 368 | List<ReportDetailResponseVo> responseVos = new ArrayList<>(); | 392 | List<ReportDetailResponseVo> responseVos = new ArrayList<>(); |
| 369 | String endDateStr = null; | 393 | String endDateStr = null; |
| 370 | try { | 394 | try { |
| 371 | - endDateStr = DateUtil.YYYY_MM_DD_LINK.format(DateUtils.addDays(DateUtil.YYYY_MM_DD_LINK.parse(vo.getDate()),1)); | 395 | + endDateStr = DateUtil.YYYY_MM_DD_LINK.format(DateUtils.addDays(DateUtil.YYYY_MM_DD_LINK.parse(vo.getDate()), 1)); |
| 372 | } catch (ParseException e) { | 396 | } catch (ParseException e) { |
| 373 | throw new RuntimeException(e); | 397 | throw new RuntimeException(e); |
| 374 | } | 398 | } |
| 375 | - List<DriverScheduling> toDay = schedulingMapper.queryToDay(vo.getDate(),endDateStr, vo.getName(), vo.getJobCode(), vo.getLineName()); | 399 | + List<DriverScheduling> toDay = schedulingMapper.queryToDay(vo.getDate(), endDateStr, vo.getName(), vo.getJobCode(), vo.getLineName()); |
| 376 | for (DriverScheduling scheduling : toDay) { | 400 | for (DriverScheduling scheduling : toDay) { |
| 377 | ToolUtils.updateReport(scheduling); | 401 | ToolUtils.updateReport(scheduling); |
| 378 | ReportDetailResponseVo reportDetailResponseVo = new ReportDetailResponseVo(); | 402 | ReportDetailResponseVo reportDetailResponseVo = new ReportDetailResponseVo(); |
Bsth-admin/src/main/java/com/ruoyi/service/ThreadJobService.java
| @@ -539,7 +539,7 @@ public class ThreadJobService { | @@ -539,7 +539,7 @@ public class ThreadJobService { | ||
| 539 | if (Objects.isNull(is)) { | 539 | if (Objects.isNull(is)) { |
| 540 | throw new IOException("图片数据不存在"); | 540 | throw new IOException("图片数据不存在"); |
| 541 | } | 541 | } |
| 542 | - File file = new File(filePath + File.separator); | 542 | + File file = new File(filePath + "/"); |
| 543 | log.info("文件路径:{}", file.getPath()); | 543 | log.info("文件路径:{}", file.getPath()); |
| 544 | if (!file.exists()) { | 544 | if (!file.exists()) { |
| 545 | if (!file.getParentFile().exists()) { | 545 | if (!file.getParentFile().exists()) { |
Bsth-admin/src/main/java/com/ruoyi/service/impl/driver/NewDriverServiceImpl.java
| @@ -20,6 +20,7 @@ import com.ruoyi.domain.OrderEntity; | @@ -20,6 +20,7 @@ import com.ruoyi.domain.OrderEntity; | ||
| 20 | import com.ruoyi.domain.driver.NewDriver; | 20 | import com.ruoyi.domain.driver.NewDriver; |
| 21 | import com.ruoyi.mapper.driver.NewDriverMapper; | 21 | import com.ruoyi.mapper.driver.NewDriverMapper; |
| 22 | import com.ruoyi.service.driver.NewDriverService; | 22 | import com.ruoyi.service.driver.NewDriverService; |
| 23 | +import com.ruoyi.utils.DateUtil; | ||
| 23 | import com.ruoyi.utils.UploadUtil; | 24 | import com.ruoyi.utils.UploadUtil; |
| 24 | import lombok.extern.slf4j.Slf4j; | 25 | import lombok.extern.slf4j.Slf4j; |
| 25 | import org.apache.commons.collections4.CollectionUtils; | 26 | import org.apache.commons.collections4.CollectionUtils; |
| @@ -341,7 +342,7 @@ public class NewDriverServiceImpl extends ServiceImpl<NewDriverMapper, NewDriver | @@ -341,7 +342,7 @@ public class NewDriverServiceImpl extends ServiceImpl<NewDriverMapper, NewDriver | ||
| 341 | String photo = Convert.toStr(obj.get("photo")); | 342 | String photo = Convert.toStr(obj.get("photo")); |
| 342 | if (StringUtils.isNotEmpty(photo)) { | 343 | if (StringUtils.isNotEmpty(photo)) { |
| 343 | StringBuilder builder = new StringBuilder(); | 344 | StringBuilder builder = new StringBuilder(); |
| 344 | - builder.append(obj.get("personID")); | 345 | + builder.append("head"); |
| 345 | builder.append("/image/"); | 346 | builder.append("/image/"); |
| 346 | builder.append(UUID.randomUUID().toString().replaceAll("-", "")); | 347 | builder.append(UUID.randomUUID().toString().replaceAll("-", "")); |
| 347 | builder.append(".png"); | 348 | builder.append(".png"); |
| @@ -409,20 +410,20 @@ public class NewDriverServiceImpl extends ServiceImpl<NewDriverMapper, NewDriver | @@ -409,20 +410,20 @@ public class NewDriverServiceImpl extends ServiceImpl<NewDriverMapper, NewDriver | ||
| 409 | return TipEnum.TIP_404; | 410 | return TipEnum.TIP_404; |
| 410 | } | 411 | } |
| 411 | LambdaUpdateWrapper<NewDriver> wrapper = new LambdaUpdateWrapper<NewDriver>(); | 412 | LambdaUpdateWrapper<NewDriver> wrapper = new LambdaUpdateWrapper<NewDriver>(); |
| 412 | - StringBuilder builder = new StringBuilder(bsthSystemConfig.getImageBasePath()); | ||
| 413 | - builder.append(File.separator); | 413 | + StringBuilder builder = new StringBuilder(); |
| 414 | + builder.append("head/face/"); | ||
| 415 | + builder.append(DateUtil.shortNowStr()); | ||
| 416 | + builder.append("/"); | ||
| 414 | builder.append(source.getId()); | 417 | builder.append(source.getId()); |
| 415 | - builder.append(File.separator); | ||
| 416 | - builder.append("image"); | 418 | + builder.append("/image/"); |
| 419 | + builder.append(UUID.randomUUID().toString().replaceAll("-", "")+".png"); | ||
| 417 | 420 | ||
| 418 | - ResponseResult<String> resultObj = FileUploadUtils.uploadBase64OfImage(builder.toString(), UUID.randomUUID().toString(). | ||
| 419 | - replaceAll("-", ""), "png", entity.getImage()); | 421 | + ResponseResult<String> resultObj = FileUploadUtils.uploadBase64OfImage(builder.toString(), "png", entity.getImage()); |
| 420 | if (!resultObj.isSuccess()) { | 422 | if (!resultObj.isSuccess()) { |
| 421 | return TipEnum.getObjByCode(resultObj.getCode()); | 423 | return TipEnum.getObjByCode(resultObj.getCode()); |
| 422 | } | 424 | } |
| 423 | 425 | ||
| 424 | - String result = StringUtils.substringAfter(resultObj.getData(), bsthSystemConfig.getImageBasePath() + File.separator); | ||
| 425 | - entity.setImage(result); | 426 | + entity.setImage(builder.toString()); |
| 426 | 427 | ||
| 427 | float imageVersion = 0.01f; | 428 | float imageVersion = 0.01f; |
| 428 | try { | 429 | try { |
Bsth-admin/src/main/java/com/ruoyi/service/impl/dss/FaceServiceImpl.java
| @@ -174,7 +174,7 @@ public class FaceServiceImpl implements FaceService { | @@ -174,7 +174,7 @@ public class FaceServiceImpl implements FaceService { | ||
| 174 | } | 174 | } |
| 175 | StringBuilder builder = new StringBuilder(); | 175 | StringBuilder builder = new StringBuilder(); |
| 176 | builder.append(bsthSystemConfig.getImageBasePath()); | 176 | builder.append(bsthSystemConfig.getImageBasePath()); |
| 177 | - builder.append(File.separator); | 177 | + builder.append("/"); |
| 178 | builder.append(dr.getImage()); | 178 | builder.append(dr.getImage()); |
| 179 | 179 | ||
| 180 | File targetFile = new File(builder.toString()); | 180 | File targetFile = new File(builder.toString()); |
Bsth-admin/src/main/java/com/ruoyi/service/impl/sign/in/resource/LinggangSignInResourceServiceImpl.java
| @@ -15,10 +15,12 @@ import com.ruoyi.in.service.ISignInService; | @@ -15,10 +15,12 @@ import com.ruoyi.in.service.ISignInService; | ||
| 15 | import com.ruoyi.in.service.SignInServiceV1; | 15 | import com.ruoyi.in.service.SignInServiceV1; |
| 16 | import com.ruoyi.mapper.sign.in.resource.LinggangSignInResourceMapper; | 16 | import com.ruoyi.mapper.sign.in.resource.LinggangSignInResourceMapper; |
| 17 | import com.ruoyi.service.sign.in.resource.LinggangSignInResourceService; | 17 | import com.ruoyi.service.sign.in.resource.LinggangSignInResourceService; |
| 18 | +import com.ruoyi.utils.DateUtil; | ||
| 18 | import com.ruoyi.utils.SpringApplicationUtil; | 19 | import com.ruoyi.utils.SpringApplicationUtil; |
| 19 | import com.ruoyi.utils.UploadUtil; | 20 | import com.ruoyi.utils.UploadUtil; |
| 20 | import lombok.extern.slf4j.Slf4j; | 21 | import lombok.extern.slf4j.Slf4j; |
| 21 | import org.apache.commons.collections4.CollectionUtils; | 22 | import org.apache.commons.collections4.CollectionUtils; |
| 23 | +import org.apache.commons.lang3.time.DateUtils; | ||
| 22 | import org.springframework.beans.factory.annotation.Autowired; | 24 | import org.springframework.beans.factory.annotation.Autowired; |
| 23 | import org.springframework.stereotype.Service; | 25 | import org.springframework.stereotype.Service; |
| 24 | import org.springframework.transaction.annotation.Transactional; | 26 | import org.springframework.transaction.annotation.Transactional; |
| @@ -140,6 +142,8 @@ public class LinggangSignInResourceServiceImpl extends ServiceImpl<LinggangSignI | @@ -140,6 +142,8 @@ public class LinggangSignInResourceServiceImpl extends ServiceImpl<LinggangSignI | ||
| 140 | builder.append("/"); | 142 | builder.append("/"); |
| 141 | builder.append(en.getDevice()); | 143 | builder.append(en.getDevice()); |
| 142 | builder.append("/"); | 144 | builder.append("/"); |
| 145 | + builder.append(DateUtil.shortNowStr()); | ||
| 146 | + builder.append("/"); | ||
| 143 | builder.append(en.getSignId()); | 147 | builder.append(en.getSignId()); |
| 144 | builder.append("/"); | 148 | builder.append("/"); |
| 145 | builder.append(UUID.randomUUID().toString().replace("-", "")); | 149 | builder.append(UUID.randomUUID().toString().replace("-", "")); |
| @@ -177,13 +181,15 @@ public class LinggangSignInResourceServiceImpl extends ServiceImpl<LinggangSignI | @@ -177,13 +181,15 @@ public class LinggangSignInResourceServiceImpl extends ServiceImpl<LinggangSignI | ||
| 177 | public boolean insertVoide(LinggangSignInResource entity) { | 181 | public boolean insertVoide(LinggangSignInResource entity) { |
| 178 | StringBuilder builder = new StringBuilder(); | 182 | StringBuilder builder = new StringBuilder(); |
| 179 | builder.append("sign"); | 183 | builder.append("sign"); |
| 180 | - builder.append(File.separator); | 184 | + builder.append("/"); |
| 181 | builder.append("video"); | 185 | builder.append("video"); |
| 182 | - builder.append(File.separator); | 186 | + builder.append("/"); |
| 183 | builder.append(entity.getDevice()); | 187 | builder.append(entity.getDevice()); |
| 184 | - builder.append(File.separator); | 188 | + builder.append("/"); |
| 189 | + builder.append(DateUtil.shortNowStr()); | ||
| 190 | + builder.append("/"); | ||
| 185 | builder.append(entity.getSignId()); | 191 | builder.append(entity.getSignId()); |
| 186 | - builder.append(File.separator); | 192 | + builder.append("/"); |
| 187 | builder.append(UUID.randomUUID().toString().replace("-", "")); | 193 | builder.append(UUID.randomUUID().toString().replace("-", "")); |
| 188 | builder.append(".mp4"); | 194 | builder.append(".mp4"); |
| 189 | 195 |
Bsth-admin/src/main/java/com/ruoyi/utils/DateUtil.java
| @@ -46,4 +46,12 @@ public class DateUtil { | @@ -46,4 +46,12 @@ public class DateUtil { | ||
| 46 | } | 46 | } |
| 47 | } | 47 | } |
| 48 | 48 | ||
| 49 | + public static String shortDateStr(Date date) { | ||
| 50 | + return YYYY_MM_DD_LINK.format(date); | ||
| 51 | + } | ||
| 52 | + | ||
| 53 | + public static String shortNowStr() { | ||
| 54 | + return shortDateStr(new Date()); | ||
| 55 | + } | ||
| 56 | + | ||
| 49 | } | 57 | } |
Bsth-admin/src/main/java/com/ruoyi/utils/UploadUtil.java
| @@ -4,18 +4,14 @@ import cn.hutool.core.codec.Base64; | @@ -4,18 +4,14 @@ import cn.hutool.core.codec.Base64; | ||
| 4 | import com.ruoyi.common.core.domain.ResponseResult; | 4 | import com.ruoyi.common.core.domain.ResponseResult; |
| 5 | import com.ruoyi.common.utils.StringUtils; | 5 | import com.ruoyi.common.utils.StringUtils; |
| 6 | import com.ruoyi.common.utils.file.FileUploadUtils; | 6 | import com.ruoyi.common.utils.file.FileUploadUtils; |
| 7 | +import com.ruoyi.common.utils.file.MinioConfig; | ||
| 7 | import com.ruoyi.config.BsthSystemConfig; | 8 | import com.ruoyi.config.BsthSystemConfig; |
| 8 | -import com.ruoyi.config.MinioConfig; | ||
| 9 | import lombok.extern.slf4j.Slf4j; | 9 | import lombok.extern.slf4j.Slf4j; |
| 10 | -import org.apache.commons.io.FileUtils; | ||
| 11 | import org.apache.commons.io.IOUtils; | 10 | import org.apache.commons.io.IOUtils; |
| 12 | import org.springframework.beans.factory.annotation.Autowired; | 11 | import org.springframework.beans.factory.annotation.Autowired; |
| 13 | import org.springframework.stereotype.Component; | 12 | import org.springframework.stereotype.Component; |
| 14 | 13 | ||
| 15 | -import javax.imageio.ImageIO; | ||
| 16 | -import java.awt.image.BufferedImage; | ||
| 17 | import java.io.ByteArrayInputStream; | 14 | import java.io.ByteArrayInputStream; |
| 18 | -import java.io.File; | ||
| 19 | import java.io.FileOutputStream; | 15 | import java.io.FileOutputStream; |
| 20 | import java.util.Objects; | 16 | import java.util.Objects; |
| 21 | 17 | ||
| @@ -48,13 +44,12 @@ public class UploadUtil { | @@ -48,13 +44,12 @@ public class UploadUtil { | ||
| 48 | } | 44 | } |
| 49 | 45 | ||
| 50 | ByteArrayInputStream inputStream = null; | 46 | ByteArrayInputStream inputStream = null; |
| 51 | - BufferedImage bufferedImage = null; | ||
| 52 | try { | 47 | try { |
| 53 | content = FileUploadUtils.choosePrictureContent(content); | 48 | content = FileUploadUtils.choosePrictureContent(content); |
| 54 | byte[] bytes = Base64.decode(content); | 49 | byte[] bytes = Base64.decode(content); |
| 55 | inputStream = new ByteArrayInputStream(bytes); | 50 | inputStream = new ByteArrayInputStream(bytes); |
| 56 | 51 | ||
| 57 | - minioConfig.upload(inputStream,path,"application/png"); | 52 | + minioConfig.upload(inputStream, path, "application/" + type); |
| 58 | 53 | ||
| 59 | return ResponseResult.success(Boolean.TRUE); | 54 | return ResponseResult.success(Boolean.TRUE); |
| 60 | } catch (Exception e) { | 55 | } catch (Exception e) { |
| @@ -82,22 +77,13 @@ public class UploadUtil { | @@ -82,22 +77,13 @@ public class UploadUtil { | ||
| 82 | } | 77 | } |
| 83 | 78 | ||
| 84 | FileOutputStream outputStream = null; | 79 | FileOutputStream outputStream = null; |
| 80 | + ByteArrayInputStream inputStream = null; | ||
| 85 | try { | 81 | try { |
| 86 | content = FileUploadUtils.choosePrictureContent(content); | 82 | content = FileUploadUtils.choosePrictureContent(content); |
| 87 | byte[] bytes = Base64.decode(content); | 83 | byte[] bytes = Base64.decode(content); |
| 84 | + inputStream = new ByteArrayInputStream(bytes); | ||
| 88 | 85 | ||
| 89 | - StringBuilder filePath = new StringBuilder(); | ||
| 90 | - filePath.append(bsthSystemConfig.getImageBasePath()); | ||
| 91 | - filePath.append(File.separator); | ||
| 92 | - filePath.append(path); | ||
| 93 | - | ||
| 94 | - File file = new File(filePath.toString()); | ||
| 95 | - if(!file.exists() || !file.isDirectory()){ | ||
| 96 | - FileUtils.forceMkdirParent(file); | ||
| 97 | - } | ||
| 98 | - outputStream = new FileOutputStream(file); | ||
| 99 | - outputStream.write(bytes, 0, bytes.length); | ||
| 100 | - outputStream.flush(); | 86 | + minioConfig.upload(inputStream, path, "application/mp4"); |
| 101 | 87 | ||
| 102 | return ResponseResult.success(Boolean.TRUE); | 88 | return ResponseResult.success(Boolean.TRUE); |
| 103 | } catch (Exception e) { | 89 | } catch (Exception e) { |
Bsth-admin/src/main/java/com/ruoyi/web/controller/common/CommonController.java
| @@ -26,13 +26,12 @@ import java.util.List; | @@ -26,13 +26,12 @@ import java.util.List; | ||
| 26 | 26 | ||
| 27 | /** | 27 | /** |
| 28 | * 通用请求处理 | 28 | * 通用请求处理 |
| 29 | - * | 29 | + * |
| 30 | * @author ruoyi | 30 | * @author ruoyi |
| 31 | */ | 31 | */ |
| 32 | @RestController | 32 | @RestController |
| 33 | @RequestMapping("/common") | 33 | @RequestMapping("/common") |
| 34 | -public class CommonController | ||
| 35 | -{ | 34 | +public class CommonController { |
| 36 | private static final Logger log = LoggerFactory.getLogger(CommonController.class); | 35 | private static final Logger log = LoggerFactory.getLogger(CommonController.class); |
| 37 | 36 | ||
| 38 | @Autowired | 37 | @Autowired |
| @@ -46,17 +45,14 @@ public class CommonController | @@ -46,17 +45,14 @@ public class CommonController | ||
| 46 | 45 | ||
| 47 | /** | 46 | /** |
| 48 | * 通用下载请求 | 47 | * 通用下载请求 |
| 49 | - * | 48 | + * |
| 50 | * @param fileName 文件名称 | 49 | * @param fileName 文件名称 |
| 51 | - * @param delete 是否删除 | 50 | + * @param delete 是否删除 |
| 52 | */ | 51 | */ |
| 53 | @GetMapping("/download") | 52 | @GetMapping("/download") |
| 54 | - public void fileDownload(String fileName, Boolean delete, HttpServletResponse response, HttpServletRequest request) | ||
| 55 | - { | ||
| 56 | - try | ||
| 57 | - { | ||
| 58 | - if (!FileUtils.checkAllowDownload(fileName)) | ||
| 59 | - { | 53 | + public void fileDownload(String fileName, Boolean delete, HttpServletResponse response, HttpServletRequest request) { |
| 54 | + try { | ||
| 55 | + if (!FileUtils.checkAllowDownload(fileName)) { | ||
| 60 | throw new Exception(StringUtils.format("文件名称({})非法,不允许下载。 ", fileName)); | 56 | throw new Exception(StringUtils.format("文件名称({})非法,不允许下载。 ", fileName)); |
| 61 | } | 57 | } |
| 62 | String realFileName = System.currentTimeMillis() + fileName.substring(fileName.indexOf("_") + 1); | 58 | String realFileName = System.currentTimeMillis() + fileName.substring(fileName.indexOf("_") + 1); |
| @@ -65,13 +61,10 @@ public class CommonController | @@ -65,13 +61,10 @@ public class CommonController | ||
| 65 | response.setContentType(MediaType.APPLICATION_OCTET_STREAM_VALUE); | 61 | response.setContentType(MediaType.APPLICATION_OCTET_STREAM_VALUE); |
| 66 | FileUtils.setAttachmentResponseHeader(response, realFileName); | 62 | FileUtils.setAttachmentResponseHeader(response, realFileName); |
| 67 | FileUtils.writeBytes(filePath, response.getOutputStream()); | 63 | FileUtils.writeBytes(filePath, response.getOutputStream()); |
| 68 | - if (delete) | ||
| 69 | - { | 64 | + if (delete) { |
| 70 | FileUtils.deleteFile(filePath); | 65 | FileUtils.deleteFile(filePath); |
| 71 | } | 66 | } |
| 72 | - } | ||
| 73 | - catch (Exception e) | ||
| 74 | - { | 67 | + } catch (Exception e) { |
| 75 | log.error("下载文件失败", e); | 68 | log.error("下载文件失败", e); |
| 76 | } | 69 | } |
| 77 | } | 70 | } |
| @@ -80,16 +73,13 @@ public class CommonController | @@ -80,16 +73,13 @@ public class CommonController | ||
| 80 | * 通用上传请求(单个) | 73 | * 通用上传请求(单个) |
| 81 | */ | 74 | */ |
| 82 | @PostMapping("/upload") | 75 | @PostMapping("/upload") |
| 83 | - public AjaxResult uploadFile(MultipartFile file) throws Exception | ||
| 84 | - { | ||
| 85 | - try | ||
| 86 | - { | 76 | + public AjaxResult uploadFile(MultipartFile file) throws Exception { |
| 77 | + try { | ||
| 87 | // 上传文件路径 | 78 | // 上传文件路径 |
| 88 | - String filePath = org.apache.commons.lang3.StringUtils.join(RuoYiConfig.getUploadPath(),"/image"); | 79 | + String filePath = org.apache.commons.lang3.StringUtils.join("usual/image"); |
| 89 | 80 | ||
| 90 | // 上传并返回新文件名称 | 81 | // 上传并返回新文件名称 |
| 91 | String fileName = FileUploadUtils.upload(filePath, file); | 82 | String fileName = FileUploadUtils.upload(filePath, file); |
| 92 | - fileName = org.apache.commons.lang3.StringUtils.substringAfter(fileName, "upload/image"); | ||
| 93 | String url = getSysDictDataService().combationValue(fileName); | 83 | String url = getSysDictDataService().combationValue(fileName); |
| 94 | AjaxResult ajax = AjaxResult.success(); | 84 | AjaxResult ajax = AjaxResult.success(); |
| 95 | 85 | ||
| @@ -99,15 +89,13 @@ public class CommonController | @@ -99,15 +89,13 @@ public class CommonController | ||
| 99 | ajax.put("newFileName", FileUtils.getName(fileName)); | 89 | ajax.put("newFileName", FileUtils.getName(fileName)); |
| 100 | ajax.put("originalFilename", file.getOriginalFilename()); | 90 | ajax.put("originalFilename", file.getOriginalFilename()); |
| 101 | return ajax; | 91 | return ajax; |
| 102 | - } | ||
| 103 | - catch (Exception e) | ||
| 104 | - { | 92 | + } catch (Exception e) { |
| 105 | return AjaxResult.error(e.getMessage()); | 93 | return AjaxResult.error(e.getMessage()); |
| 106 | } | 94 | } |
| 107 | } | 95 | } |
| 108 | 96 | ||
| 109 | - public ISysDictDataService getSysDictDataService(){ | ||
| 110 | - if(sysDictDataService == null){ | 97 | + public ISysDictDataService getSysDictDataService() { |
| 98 | + if (sysDictDataService == null) { | ||
| 111 | sysDictDataService = SpringUtils.getBean(ISysDictDataService.class); | 99 | sysDictDataService = SpringUtils.getBean(ISysDictDataService.class); |
| 112 | } | 100 | } |
| 113 | return sysDictDataService; | 101 | return sysDictDataService; |
| @@ -117,18 +105,15 @@ public class CommonController | @@ -117,18 +105,15 @@ public class CommonController | ||
| 117 | * 通用上传请求(多个) | 105 | * 通用上传请求(多个) |
| 118 | */ | 106 | */ |
| 119 | @PostMapping("/uploads") | 107 | @PostMapping("/uploads") |
| 120 | - public AjaxResult uploadFiles(List<MultipartFile> files) throws Exception | ||
| 121 | - { | ||
| 122 | - try | ||
| 123 | - { | 108 | + public AjaxResult uploadFiles(List<MultipartFile> files) throws Exception { |
| 109 | + try { | ||
| 124 | // 上传文件路径 | 110 | // 上传文件路径 |
| 125 | String filePath = RuoYiConfig.getUploadPath(); | 111 | String filePath = RuoYiConfig.getUploadPath(); |
| 126 | List<String> urls = new ArrayList<String>(); | 112 | List<String> urls = new ArrayList<String>(); |
| 127 | List<String> fileNames = new ArrayList<String>(); | 113 | List<String> fileNames = new ArrayList<String>(); |
| 128 | List<String> newFileNames = new ArrayList<String>(); | 114 | List<String> newFileNames = new ArrayList<String>(); |
| 129 | List<String> originalFilenames = new ArrayList<String>(); | 115 | List<String> originalFilenames = new ArrayList<String>(); |
| 130 | - for (MultipartFile file : files) | ||
| 131 | - { | 116 | + for (MultipartFile file : files) { |
| 132 | // 上传并返回新文件名称 | 117 | // 上传并返回新文件名称 |
| 133 | String fileName = FileUploadUtils.upload(filePath, file); | 118 | String fileName = FileUploadUtils.upload(filePath, file); |
| 134 | String url = serverConfig.getUrl() + fileName; | 119 | String url = serverConfig.getUrl() + fileName; |
| @@ -143,9 +128,7 @@ public class CommonController | @@ -143,9 +128,7 @@ public class CommonController | ||
| 143 | ajax.put("newFileNames", StringUtils.join(newFileNames, FILE_DELIMETER)); | 128 | ajax.put("newFileNames", StringUtils.join(newFileNames, FILE_DELIMETER)); |
| 144 | ajax.put("originalFilenames", StringUtils.join(originalFilenames, FILE_DELIMETER)); | 129 | ajax.put("originalFilenames", StringUtils.join(originalFilenames, FILE_DELIMETER)); |
| 145 | return ajax; | 130 | return ajax; |
| 146 | - } | ||
| 147 | - catch (Exception e) | ||
| 148 | - { | 131 | + } catch (Exception e) { |
| 149 | return AjaxResult.error(e.getMessage()); | 132 | return AjaxResult.error(e.getMessage()); |
| 150 | } | 133 | } |
| 151 | } | 134 | } |
| @@ -155,12 +138,9 @@ public class CommonController | @@ -155,12 +138,9 @@ public class CommonController | ||
| 155 | */ | 138 | */ |
| 156 | @GetMapping("/download/resource") | 139 | @GetMapping("/download/resource") |
| 157 | public void resourceDownload(String resource, HttpServletRequest request, HttpServletResponse response) | 140 | public void resourceDownload(String resource, HttpServletRequest request, HttpServletResponse response) |
| 158 | - throws Exception | ||
| 159 | - { | ||
| 160 | - try | ||
| 161 | - { | ||
| 162 | - if (!FileUtils.checkAllowDownload(resource)) | ||
| 163 | - { | 141 | + throws Exception { |
| 142 | + try { | ||
| 143 | + if (!FileUtils.checkAllowDownload(resource)) { | ||
| 164 | throw new Exception(StringUtils.format("资源文件({})非法,不允许下载。 ", resource)); | 144 | throw new Exception(StringUtils.format("资源文件({})非法,不允许下载。 ", resource)); |
| 165 | } | 145 | } |
| 166 | // 本地资源路径 | 146 | // 本地资源路径 |
| @@ -172,9 +152,7 @@ public class CommonController | @@ -172,9 +152,7 @@ public class CommonController | ||
| 172 | response.setContentType(MediaType.APPLICATION_OCTET_STREAM_VALUE); | 152 | response.setContentType(MediaType.APPLICATION_OCTET_STREAM_VALUE); |
| 173 | FileUtils.setAttachmentResponseHeader(response, downloadName); | 153 | FileUtils.setAttachmentResponseHeader(response, downloadName); |
| 174 | FileUtils.writeBytes(downloadPath, response.getOutputStream()); | 154 | FileUtils.writeBytes(downloadPath, response.getOutputStream()); |
| 175 | - } | ||
| 176 | - catch (Exception e) | ||
| 177 | - { | 155 | + } catch (Exception e) { |
| 178 | log.error("下载文件失败", e); | 156 | log.error("下载文件失败", e); |
| 179 | } | 157 | } |
| 180 | } | 158 | } |
Bsth-admin/src/main/java/com/ruoyi/web/controller/system/SysLoginController.java
| @@ -11,6 +11,7 @@ import com.ruoyi.common.utils.ServletUtils; | @@ -11,6 +11,7 @@ import com.ruoyi.common.utils.ServletUtils; | ||
| 11 | import com.ruoyi.framework.web.service.SysLoginService; | 11 | import com.ruoyi.framework.web.service.SysLoginService; |
| 12 | import com.ruoyi.framework.web.service.SysPermissionService; | 12 | import com.ruoyi.framework.web.service.SysPermissionService; |
| 13 | import com.ruoyi.framework.web.service.TokenService; | 13 | import com.ruoyi.framework.web.service.TokenService; |
| 14 | +import com.ruoyi.system.service.ISysDictDataService; | ||
| 14 | import com.ruoyi.system.service.ISysMenuService; | 15 | import com.ruoyi.system.service.ISysMenuService; |
| 15 | import io.swagger.annotations.Api; | 16 | import io.swagger.annotations.Api; |
| 16 | import io.swagger.annotations.ApiOperation; | 17 | import io.swagger.annotations.ApiOperation; |
| @@ -21,6 +22,7 @@ import org.springframework.web.bind.annotation.RequestBody; | @@ -21,6 +22,7 @@ import org.springframework.web.bind.annotation.RequestBody; | ||
| 21 | import org.springframework.web.bind.annotation.RestController; | 22 | import org.springframework.web.bind.annotation.RestController; |
| 22 | 23 | ||
| 23 | import java.util.List; | 24 | import java.util.List; |
| 25 | +import java.util.Objects; | ||
| 24 | import java.util.Set; | 26 | import java.util.Set; |
| 25 | 27 | ||
| 26 | /** | 28 | /** |
| @@ -41,6 +43,8 @@ public class SysLoginController { | @@ -41,6 +43,8 @@ public class SysLoginController { | ||
| 41 | private SysPermissionService permissionService; | 43 | private SysPermissionService permissionService; |
| 42 | @Autowired | 44 | @Autowired |
| 43 | private TokenService tokenService; | 45 | private TokenService tokenService; |
| 46 | + @Autowired | ||
| 47 | + private ISysDictDataService sysDictDataService; | ||
| 44 | 48 | ||
| 45 | /** | 49 | /** |
| 46 | * 登录方法 | 50 | * 登录方法 |
| @@ -103,6 +107,9 @@ public class SysLoginController { | @@ -103,6 +107,9 @@ public class SysLoginController { | ||
| 103 | public AjaxResult getInfo() { | 107 | public AjaxResult getInfo() { |
| 104 | LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest()); | 108 | LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest()); |
| 105 | SysUser user = loginUser.getUser(); | 109 | SysUser user = loginUser.getUser(); |
| 110 | + if(Objects.nonNull(user)){ | ||
| 111 | + user.setAvatar(sysDictDataService.combationValue(user.getAvatar())); | ||
| 112 | + } | ||
| 106 | // SysUser user = SecurityUtils.getLoginUser().getUser(); | 113 | // SysUser user = SecurityUtils.getLoginUser().getUser(); |
| 107 | // 角色集合 | 114 | // 角色集合 |
| 108 | Set<String> roles = permissionService.getRolePermission(user); | 115 | Set<String> roles = permissionService.getRolePermission(user); |
Bsth-admin/src/main/java/com/ruoyi/web/controller/system/SysProfileController.java
| 1 | package com.ruoyi.web.controller.system; | 1 | package com.ruoyi.web.controller.system; |
| 2 | 2 | ||
| 3 | +import com.ruoyi.system.service.ISysDictDataService; | ||
| 3 | import org.springframework.beans.factory.annotation.Autowired; | 4 | import org.springframework.beans.factory.annotation.Autowired; |
| 4 | import org.springframework.web.bind.annotation.GetMapping; | 5 | import org.springframework.web.bind.annotation.GetMapping; |
| 5 | import org.springframework.web.bind.annotation.PostMapping; | 6 | import org.springframework.web.bind.annotation.PostMapping; |
| @@ -23,6 +24,8 @@ import com.ruoyi.common.utils.file.MimeTypeUtils; | @@ -23,6 +24,8 @@ import com.ruoyi.common.utils.file.MimeTypeUtils; | ||
| 23 | import com.ruoyi.framework.web.service.TokenService; | 24 | import com.ruoyi.framework.web.service.TokenService; |
| 24 | import com.ruoyi.system.service.ISysUserService; | 25 | import com.ruoyi.system.service.ISysUserService; |
| 25 | 26 | ||
| 27 | +import java.util.Objects; | ||
| 28 | + | ||
| 26 | /** | 29 | /** |
| 27 | * 个人信息 业务处理 | 30 | * 个人信息 业务处理 |
| 28 | * | 31 | * |
| @@ -37,6 +40,8 @@ public class SysProfileController extends BaseController | @@ -37,6 +40,8 @@ public class SysProfileController extends BaseController | ||
| 37 | 40 | ||
| 38 | @Autowired | 41 | @Autowired |
| 39 | private TokenService tokenService; | 42 | private TokenService tokenService; |
| 43 | + @Autowired | ||
| 44 | + private ISysDictDataService sysDictDataService; | ||
| 40 | 45 | ||
| 41 | /** | 46 | /** |
| 42 | * 个人信息 | 47 | * 个人信息 |
| @@ -46,6 +51,9 @@ public class SysProfileController extends BaseController | @@ -46,6 +51,9 @@ public class SysProfileController extends BaseController | ||
| 46 | { | 51 | { |
| 47 | LoginUser loginUser = getLoginUser(); | 52 | LoginUser loginUser = getLoginUser(); |
| 48 | SysUser user = loginUser.getUser(); | 53 | SysUser user = loginUser.getUser(); |
| 54 | + if(Objects.nonNull(user)){ | ||
| 55 | + user.setAvatar(sysDictDataService.combationValue(user.getAvatar())); | ||
| 56 | + } | ||
| 49 | AjaxResult ajax = AjaxResult.success(user); | 57 | AjaxResult ajax = AjaxResult.success(user); |
| 50 | ajax.put("roleGroup", userService.selectUserRoleGroup(loginUser.getUsername())); | 58 | ajax.put("roleGroup", userService.selectUserRoleGroup(loginUser.getUsername())); |
| 51 | ajax.put("postGroup", userService.selectUserPostGroup(loginUser.getUsername())); | 59 | ajax.put("postGroup", userService.selectUserPostGroup(loginUser.getUsername())); |
| @@ -129,7 +137,8 @@ public class SysProfileController extends BaseController | @@ -129,7 +137,8 @@ public class SysProfileController extends BaseController | ||
| 129 | if (userService.updateUserAvatar(loginUser.getUsername(), avatar)) | 137 | if (userService.updateUserAvatar(loginUser.getUsername(), avatar)) |
| 130 | { | 138 | { |
| 131 | AjaxResult ajax = AjaxResult.success(); | 139 | AjaxResult ajax = AjaxResult.success(); |
| 132 | - ajax.put("imgUrl", avatar); | 140 | + |
| 141 | + ajax.put("imgUrl", sysDictDataService.combationValue(avatar)); | ||
| 133 | // 更新缓存用户头像 | 142 | // 更新缓存用户头像 |
| 134 | loginUser.getUser().setAvatar(avatar); | 143 | loginUser.getUser().setAvatar(avatar); |
| 135 | tokenService.setLoginUser(loginUser); | 144 | tokenService.setLoginUser(loginUser); |
Bsth-admin/src/main/resources/application-druid-dev.yml
| @@ -90,9 +90,9 @@ spring: | @@ -90,9 +90,9 @@ spring: | ||
| 90 | servlet: | 90 | servlet: |
| 91 | multipart: | 91 | multipart: |
| 92 | # 单个文件大小 | 92 | # 单个文件大小 |
| 93 | - max-file-size: 100MB | 93 | + max-file-size: 500MB |
| 94 | # 设置总上传的文件大小 | 94 | # 设置总上传的文件大小 |
| 95 | - max-request-size: 100MB | 95 | + max-request-size: 500MB |
| 96 | # 服务模块 | 96 | # 服务模块 |
| 97 | devtools: | 97 | devtools: |
| 98 | restart: | 98 | restart: |
Bsth-admin/src/main/resources/application-druid-devTest.yml
| @@ -89,9 +89,9 @@ spring: | @@ -89,9 +89,9 @@ spring: | ||
| 89 | servlet: | 89 | servlet: |
| 90 | multipart: | 90 | multipart: |
| 91 | # 单个文件大小 | 91 | # 单个文件大小 |
| 92 | - max-file-size: 100MB | 92 | + max-file-size: 500MB |
| 93 | # 设置总上传的文件大小 | 93 | # 设置总上传的文件大小 |
| 94 | - max-request-size: 100MB | 94 | + max-request-size: 500MB |
| 95 | # 服务模块 | 95 | # 服务模块 |
| 96 | devtools: | 96 | devtools: |
| 97 | restart: | 97 | restart: |
| @@ -137,7 +137,7 @@ ruoyi: | @@ -137,7 +137,7 @@ ruoyi: | ||
| 137 | # 实例演示开关 | 137 | # 实例演示开关 |
| 138 | demoEnabled: true | 138 | demoEnabled: true |
| 139 | # 文件路径 示例( Windows配置D:/ruoyi/uploadPath,Linux配置 /home/ruoyi/uploadPath) | 139 | # 文件路径 示例( Windows配置D:/ruoyi/uploadPath,Linux配置 /home/ruoyi/uploadPath) |
| 140 | - profile: /home/test/lingang/apache-tomcat-8.5.61/webapps/uploadPath | 140 | + profile: "usual" |
| 141 | # 获取ip地址开关 | 141 | # 获取ip地址开关 |
| 142 | addressEnabled: false | 142 | addressEnabled: false |
| 143 | # 验证码类型 math 数字计算 char 字符验证 | 143 | # 验证码类型 math 数字计算 char 字符验证 |
| @@ -202,6 +202,13 @@ netty: | @@ -202,6 +202,13 @@ netty: | ||
| 202 | speech: device/speech | 202 | speech: device/speech |
| 203 | port: 8989 | 203 | port: 8989 |
| 204 | 204 | ||
| 205 | +minio: | ||
| 206 | + host: http://192.168.168.167:9000 | ||
| 207 | + url: ${minio.host}/${minio.bucket}/ | ||
| 208 | + access-key: alcohol_0D2GVpdJ3 | ||
| 209 | + secret-key: ZF4M3dFk1SjmKDuCphTRfh2MZ5T84r25w6YVDSsA | ||
| 210 | + bucket: alchohol | ||
| 211 | + | ||
| 205 | 212 | ||
| 206 | bsth: | 213 | bsth: |
| 207 | face: | 214 | face: |
| @@ -218,3 +225,4 @@ bsth: | @@ -218,3 +225,4 @@ bsth: | ||
| 218 | process: | 225 | process: |
| 219 | sign: | 226 | sign: |
| 220 | url: http://127.0.0.1:9103/commonOpenDataApi/sendAppAndSmsNotice | 227 | url: http://127.0.0.1:9103/commonOpenDataApi/sendAppAndSmsNotice |
| 228 | + audit-jobs: | ||
| 221 | \ No newline at end of file | 229 | \ No newline at end of file |
Bsth-admin/src/main/resources/application-druid-lingangPrd.yml
| @@ -85,9 +85,9 @@ spring: | @@ -85,9 +85,9 @@ spring: | ||
| 85 | servlet: | 85 | servlet: |
| 86 | multipart: | 86 | multipart: |
| 87 | # 单个文件大小 | 87 | # 单个文件大小 |
| 88 | - max-file-size: 100MB | 88 | + max-file-size: 500MB |
| 89 | # 设置总上传的文件大小 | 89 | # 设置总上传的文件大小 |
| 90 | - max-request-size: 100MB | 90 | + max-request-size: 500MB |
| 91 | # 服务模块 | 91 | # 服务模块 |
| 92 | devtools: | 92 | devtools: |
| 93 | restart: | 93 | restart: |
Bsth-admin/src/main/resources/application-druid-lingangPrdAPI.yml
| @@ -85,9 +85,9 @@ spring: | @@ -85,9 +85,9 @@ spring: | ||
| 85 | servlet: | 85 | servlet: |
| 86 | multipart: | 86 | multipart: |
| 87 | # 单个文件大小 | 87 | # 单个文件大小 |
| 88 | - max-file-size: 100MB | 88 | + max-file-size: 500MB |
| 89 | # 设置总上传的文件大小 | 89 | # 设置总上传的文件大小 |
| 90 | - max-request-size: 100MB | 90 | + max-request-size: 500MB |
| 91 | # 服务模块 | 91 | # 服务模块 |
| 92 | devtools: | 92 | devtools: |
| 93 | restart: | 93 | restart: |
Bsth-admin/src/main/resources/application-druid-lingangTest.yml
| @@ -89,9 +89,9 @@ spring: | @@ -89,9 +89,9 @@ spring: | ||
| 89 | servlet: | 89 | servlet: |
| 90 | multipart: | 90 | multipart: |
| 91 | # 单个文件大小 | 91 | # 单个文件大小 |
| 92 | - max-file-size: 100MB | 92 | + max-file-size: 500MB |
| 93 | # 设置总上传的文件大小 | 93 | # 设置总上传的文件大小 |
| 94 | - max-request-size: 100MB | 94 | + max-request-size: 500MB |
| 95 | # 服务模块 | 95 | # 服务模块 |
| 96 | devtools: | 96 | devtools: |
| 97 | restart: | 97 | restart: |
Bsth-admin/src/main/resources/application-druid-prd.yml
| @@ -85,9 +85,9 @@ spring: | @@ -85,9 +85,9 @@ spring: | ||
| 85 | servlet: | 85 | servlet: |
| 86 | multipart: | 86 | multipart: |
| 87 | # 单个文件大小 | 87 | # 单个文件大小 |
| 88 | - max-file-size: 100MB | 88 | + max-file-size: 500MB |
| 89 | # 设置总上传的文件大小 | 89 | # 设置总上传的文件大小 |
| 90 | - max-request-size: 100MB | 90 | + max-request-size: 500MB |
| 91 | # 服务模块 | 91 | # 服务模块 |
| 92 | devtools: | 92 | devtools: |
| 93 | restart: | 93 | restart: |
Bsth-admin/src/main/resources/application.yml
| @@ -74,9 +74,9 @@ spring: | @@ -74,9 +74,9 @@ spring: | ||
| 74 | servlet: | 74 | servlet: |
| 75 | multipart: | 75 | multipart: |
| 76 | # 单个文件大小 | 76 | # 单个文件大小 |
| 77 | - max-file-size: 100MB | 77 | + max-file-size: 500MB |
| 78 | # 设置总上传的文件大小 | 78 | # 设置总上传的文件大小 |
| 79 | - max-request-size: 100MB | 79 | + max-request-size: 500MB |
| 80 | # 服务模块 | 80 | # 服务模块 |
| 81 | devtools: | 81 | devtools: |
| 82 | restart: | 82 | restart: |
Bsth-admin/src/main/resources/mapper/eexception/EquipmentExceptionMapper.xml
| @@ -105,11 +105,14 @@ | @@ -105,11 +105,14 @@ | ||
| 105 | equipment_exception.nbbm, | 105 | equipment_exception.nbbm, |
| 106 | equipment_exception.line_name, | 106 | equipment_exception.line_name, |
| 107 | equipment_exception.plan_time, | 107 | equipment_exception.plan_time, |
| 108 | - equipment_exception.sign_type | 108 | + equipment_exception.sign_type, |
| 109 | + equipment_exception.sign_id, | ||
| 110 | + venue_info.name siteName | ||
| 109 | from | 111 | from |
| 110 | equipment_exception | 112 | equipment_exception |
| 111 | join driver on driver.job_code = equipment_exception.job_code | 113 | join driver on driver.job_code = equipment_exception.job_code |
| 112 | join equipment on equipment.device_id = equipment_exception.device_id | 114 | join equipment on equipment.device_id = equipment_exception.device_id |
| 115 | + left join venue_info on equipment.yard_Id=venue_info.ID | ||
| 113 | <where> | 116 | <where> |
| 114 | equipment_exception.`status` != 1 | 117 | equipment_exception.`status` != 1 |
| 115 | <if test="fleetName != null and fleetName != ''">and equipment_exception.fleet_name like | 118 | <if test="fleetName != null and fleetName != ''">and equipment_exception.fleet_name like |
Bsth-common/pom.xml
| @@ -155,6 +155,13 @@ | @@ -155,6 +155,13 @@ | ||
| 155 | <scope>compile</scope> | 155 | <scope>compile</scope> |
| 156 | </dependency> | 156 | </dependency> |
| 157 | 157 | ||
| 158 | + <dependency> | ||
| 159 | + <groupId>io.minio</groupId> | ||
| 160 | + <artifactId>minio</artifactId> | ||
| 161 | + <version>8.2.1</version> | ||
| 162 | + </dependency> | ||
| 163 | + | ||
| 164 | + | ||
| 158 | </dependencies> | 165 | </dependencies> |
| 159 | 166 | ||
| 160 | </project> | 167 | </project> |
| 161 | \ No newline at end of file | 168 | \ No newline at end of file |
Bsth-common/src/main/java/com/ruoyi/common/config/RuoYiConfig.java
| @@ -75,7 +75,7 @@ public class RuoYiConfig | @@ -75,7 +75,7 @@ public class RuoYiConfig | ||
| 75 | 75 | ||
| 76 | public static String getProfile() | 76 | public static String getProfile() |
| 77 | { | 77 | { |
| 78 | - return profile; | 78 | + return "usual"; |
| 79 | } | 79 | } |
| 80 | 80 | ||
| 81 | public void setProfile(String profile) | 81 | public void setProfile(String profile) |
Bsth-common/src/main/java/com/ruoyi/common/utils/file/FileUploadUtils.java
| @@ -9,6 +9,7 @@ import com.ruoyi.common.exception.file.InvalidExtensionException; | @@ -9,6 +9,7 @@ import com.ruoyi.common.exception.file.InvalidExtensionException; | ||
| 9 | import com.ruoyi.common.utils.DateUtils; | 9 | import com.ruoyi.common.utils.DateUtils; |
| 10 | import com.ruoyi.common.utils.StringUtils; | 10 | import com.ruoyi.common.utils.StringUtils; |
| 11 | import com.ruoyi.common.utils.sign.Base64; | 11 | import com.ruoyi.common.utils.sign.Base64; |
| 12 | +import com.ruoyi.common.utils.spring.SpringUtils; | ||
| 12 | import com.ruoyi.common.utils.uuid.Seq; | 13 | import com.ruoyi.common.utils.uuid.Seq; |
| 13 | import org.apache.commons.io.FileUtils; | 14 | import org.apache.commons.io.FileUtils; |
| 14 | import org.apache.commons.io.FilenameUtils; | 15 | import org.apache.commons.io.FilenameUtils; |
| @@ -57,20 +58,7 @@ public class FileUploadUtils { | @@ -57,20 +58,7 @@ public class FileUploadUtils { | ||
| 57 | return defaultBaseDir; | 58 | return defaultBaseDir; |
| 58 | } | 59 | } |
| 59 | 60 | ||
| 60 | - /** | ||
| 61 | - * 以默认配置进行文件上传 | ||
| 62 | - * | ||
| 63 | - * @param file 上传的文件 | ||
| 64 | - * @return 文件名称 | ||
| 65 | - * @throws Exception | ||
| 66 | - */ | ||
| 67 | - public static final String upload(MultipartFile file) throws IOException { | ||
| 68 | - try { | ||
| 69 | - return upload(getDefaultBaseDir(), file, MimeTypeUtils.DEFAULT_ALLOWED_EXTENSION); | ||
| 70 | - } catch (Exception e) { | ||
| 71 | - throw new IOException(e.getMessage(), e); | ||
| 72 | - } | ||
| 73 | - } | 61 | + |
| 74 | 62 | ||
| 75 | /** | 63 | /** |
| 76 | * 根据文件路径上传 | 64 | * 根据文件路径上传 |
| @@ -112,9 +100,13 @@ public class FileUploadUtils { | @@ -112,9 +100,13 @@ public class FileUploadUtils { | ||
| 112 | 100 | ||
| 113 | String fileName = extractFilename(file); | 101 | String fileName = extractFilename(file); |
| 114 | 102 | ||
| 115 | - String absPath = getAbsoluteFile(baseDir, fileName).getAbsolutePath(); | ||
| 116 | - file.transferTo(Paths.get(absPath)); | ||
| 117 | - return getPathFileName(baseDir, fileName); | 103 | + StringBuilder builder = new StringBuilder(); |
| 104 | + builder.append(baseDir); | ||
| 105 | + builder.append("/"); | ||
| 106 | + builder.append(fileName); | ||
| 107 | + SpringUtils.getBean(MinioConfig.class).upload(file, builder.toString()); | ||
| 108 | + | ||
| 109 | + return builder.toString(); | ||
| 118 | } | 110 | } |
| 119 | 111 | ||
| 120 | /*** | 112 | /*** |
| @@ -122,16 +114,14 @@ public class FileUploadUtils { | @@ -122,16 +114,14 @@ public class FileUploadUtils { | ||
| 122 | * @author liujun | 114 | * @author liujun |
| 123 | * @date 2024/7/12 9:18 | 115 | * @date 2024/7/12 9:18 |
| 124 | * @param filePath 上传的路径 | 116 | * @param filePath 上传的路径 |
| 125 | - * @param fileName 上传文件名称 | ||
| 126 | * @param type 文件类型 | 117 | * @param type 文件类型 |
| 127 | * @param uploadContent 文件内容 | 118 | * @param uploadContent 文件内容 |
| 128 | * | 119 | * |
| 129 | * @return ResponseResult 文件上传成功返回文件路径;上传异常返回500;文件超大返回1;不是图片返回2 | 120 | * @return ResponseResult 文件上传成功返回文件路径;上传异常返回500;文件超大返回1;不是图片返回2 |
| 130 | */ | 121 | */ |
| 131 | - public static ResponseResult<String> uploadBase64OfImage(String filePath, String fileName, String type, String uploadContent) { | 122 | + public static ResponseResult<String> uploadBase64OfImage(String filePath, String type, String uploadContent) { |
| 132 | FileUploadUtils.uploadContent = uploadContent; | 123 | FileUploadUtils.uploadContent = uploadContent; |
| 133 | ByteArrayInputStream byteArrayInputStream = null; | 124 | ByteArrayInputStream byteArrayInputStream = null; |
| 134 | - BufferedImage bufferedImage = null; | ||
| 135 | try { | 125 | try { |
| 136 | if (org.apache.commons.lang3.StringUtils.isEmpty(uploadContent)) { | 126 | if (org.apache.commons.lang3.StringUtils.isEmpty(uploadContent)) { |
| 137 | return new ResponseResult<>(2, "请上传图片"); | 127 | return new ResponseResult<>(2, "请上传图片"); |
| @@ -145,28 +135,12 @@ public class FileUploadUtils { | @@ -145,28 +135,12 @@ public class FileUploadUtils { | ||
| 145 | 135 | ||
| 146 | } | 136 | } |
| 147 | byteArrayInputStream = new ByteArrayInputStream(content); | 137 | byteArrayInputStream = new ByteArrayInputStream(content); |
| 148 | - bufferedImage = ImageIO.read(byteArrayInputStream); | ||
| 149 | - if (Objects.isNull(bufferedImage)) { | ||
| 150 | - LOGGER.info("[{}]上传的不是图片", filePath); | ||
| 151 | - return new ResponseResult<>(2); | ||
| 152 | - } | ||
| 153 | - | ||
| 154 | 138 | ||
| 155 | - StringBuilder path = new StringBuilder(); | ||
| 156 | - path.append(filePath); | ||
| 157 | - path.append(File.separator); | ||
| 158 | - path.append(fileName); | ||
| 159 | - path.append("."); | ||
| 160 | - path.append(type); | 139 | + SpringUtils.getBean(MinioConfig.class).upload(byteArrayInputStream,filePath, "application/"+type); |
| 161 | 140 | ||
| 162 | - boolean flag = ImageIO.write(bufferedImage, type, new File(path.toString())); | ||
| 163 | - bufferedImage.flush(); | ||
| 164 | 141 | ||
| 165 | - if (Objects.equals(Boolean.FALSE, flag)) { | ||
| 166 | - return new ResponseResult<>(500); | ||
| 167 | - } | ||
| 168 | ResponseResult<String> responseResult = ResponseResult.success(); | 142 | ResponseResult<String> responseResult = ResponseResult.success(); |
| 169 | - responseResult.setData(path.toString()); | 143 | + responseResult.setData(filePath); |
| 170 | 144 | ||
| 171 | return responseResult; | 145 | return responseResult; |
| 172 | } catch (Exception e) { | 146 | } catch (Exception e) { |
| @@ -178,7 +152,7 @@ public class FileUploadUtils { | @@ -178,7 +152,7 @@ public class FileUploadUtils { | ||
| 178 | } | 152 | } |
| 179 | 153 | ||
| 180 | public static String choosePrictureContent(String uploadContent) { | 154 | public static String choosePrictureContent(String uploadContent) { |
| 181 | - if (org.apache.commons.lang3.StringUtils.indexOf(uploadContent, ";base64,")>0) { | 155 | + if (org.apache.commons.lang3.StringUtils.indexOf(uploadContent, ";base64,") > 0) { |
| 182 | uploadContent = org.apache.commons.lang3.StringUtils.substringAfter(uploadContent, ";base64,"); | 156 | uploadContent = org.apache.commons.lang3.StringUtils.substringAfter(uploadContent, ";base64,"); |
| 183 | } | 157 | } |
| 184 | return uploadContent; | 158 | return uploadContent; |
| @@ -193,7 +167,7 @@ public class FileUploadUtils { | @@ -193,7 +167,7 @@ public class FileUploadUtils { | ||
| 193 | } | 167 | } |
| 194 | 168 | ||
| 195 | public static final File getAbsoluteFile(String uploadDir, String fileName) throws IOException { | 169 | public static final File getAbsoluteFile(String uploadDir, String fileName) throws IOException { |
| 196 | - File desc = new File(uploadDir + File.separator + fileName); | 170 | + File desc = new File(uploadDir + "/" + fileName); |
| 197 | 171 | ||
| 198 | if (!desc.exists()) { | 172 | if (!desc.exists()) { |
| 199 | if (!desc.getParentFile().exists()) { | 173 | if (!desc.getParentFile().exists()) { |
Bsth-admin/src/main/java/com/ruoyi/config/MinioConfig.java renamed to Bsth-common/src/main/java/com/ruoyi/common/utils/file/MinioConfig.java
| 1 | -package com.ruoyi.config; | 1 | +package com.ruoyi.common.utils.file; |
| 2 | 2 | ||
| 3 | -import io.minio.*; | 3 | +import io.minio.MinioClient; |
| 4 | +import io.minio.ObjectWriteResponse; | ||
| 5 | +import io.minio.PutObjectArgs; | ||
| 4 | import io.minio.errors.*; | 6 | import io.minio.errors.*; |
| 5 | -import io.minio.http.Method; | ||
| 6 | import org.springframework.beans.factory.InitializingBean; | 7 | import org.springframework.beans.factory.InitializingBean; |
| 8 | +import org.springframework.beans.factory.annotation.Value; | ||
| 7 | import org.springframework.context.annotation.Bean; | 9 | import org.springframework.context.annotation.Bean; |
| 8 | import org.springframework.stereotype.Component; | 10 | import org.springframework.stereotype.Component; |
| 9 | -import org.springframework.beans.factory.annotation.Value; | ||
| 10 | import org.springframework.web.multipart.MultipartFile; | 11 | import org.springframework.web.multipart.MultipartFile; |
| 11 | -import org.springframework.web.util.UriUtils; | ||
| 12 | 12 | ||
| 13 | import java.io.IOException; | 13 | import java.io.IOException; |
| 14 | import java.io.InputStream; | 14 | import java.io.InputStream; |
| 15 | -import java.nio.charset.StandardCharsets; | ||
| 16 | import java.security.InvalidKeyException; | 15 | import java.security.InvalidKeyException; |
| 17 | import java.security.NoSuchAlgorithmException; | 16 | import java.security.NoSuchAlgorithmException; |
| 18 | 17 | ||
| 19 | -import javax.annotation.Resource; | ||
| 20 | - | ||
| 21 | @Component | 18 | @Component |
| 22 | public class MinioConfig implements InitializingBean { | 19 | public class MinioConfig implements InitializingBean { |
| 23 | @Value(value = "${minio.bucket}") | 20 | @Value(value = "${minio.bucket}") |
| @@ -55,18 +52,14 @@ public class MinioConfig implements InitializingBean { | @@ -55,18 +52,14 @@ public class MinioConfig implements InitializingBean { | ||
| 55 | * @param file 文件 | 52 | * @param file 文件 |
| 56 | * @return Boolean | 53 | * @return Boolean |
| 57 | */ | 54 | */ |
| 58 | - public Boolean upload(MultipartFile file) { | ||
| 59 | - // 修饰过的文件名 非源文件名 | ||
| 60 | - String fileName = "2021-07/21/"; | ||
| 61 | - fileName = fileName + file.getOriginalFilename(); | 55 | + public Boolean upload(MultipartFile file, String fileName) { |
| 62 | try { | 56 | try { |
| 63 | PutObjectArgs objectArgs = PutObjectArgs.builder().bucket(bucket).object(fileName) | 57 | PutObjectArgs objectArgs = PutObjectArgs.builder().bucket(bucket).object(fileName) |
| 64 | .stream(file.getInputStream(), file.getSize(), -1).contentType(file.getContentType()).build(); | 58 | .stream(file.getInputStream(), file.getSize(), -1).contentType(file.getContentType()).build(); |
| 65 | //文件名称相同会覆盖 | 59 | //文件名称相同会覆盖 |
| 66 | minioClient.putObject(objectArgs); | 60 | minioClient.putObject(objectArgs); |
| 67 | } catch (Exception e) { | 61 | } catch (Exception e) { |
| 68 | - e.printStackTrace(); | ||
| 69 | - return false; | 62 | + throw new RuntimeException(e); |
| 70 | } | 63 | } |
| 71 | return true; | 64 | return true; |
| 72 | } | 65 | } |
| @@ -79,42 +72,17 @@ public class MinioConfig implements InitializingBean { | @@ -79,42 +72,17 @@ public class MinioConfig implements InitializingBean { | ||
| 79 | * @return Boolean | 72 | * @return Boolean |
| 80 | */ | 73 | */ |
| 81 | public Boolean upload(InputStream inputStream, String fileName, String contentType) { | 74 | public Boolean upload(InputStream inputStream, String fileName, String contentType) { |
| 82 | - // 修饰过的文件名 非源文件名 | ||
| 83 | -// | ||
| 84 | -// try { | ||
| 85 | -// PutObjectArgs objectArgs = PutObjectArgs.builder().bucket(bucket).object(fileName) | ||
| 86 | -// .stream(inputStream, inputStream.available(), -1).contentType(contentType).build(); | ||
| 87 | -// //文件名称相同会覆盖 | ||
| 88 | -// minioClient.putObject(objectArgs); | ||
| 89 | -// } catch (Exception e) { | ||
| 90 | -// e.printStackTrace(); | ||
| 91 | -// return false; | ||
| 92 | -// } | ||
| 93 | try { | 75 | try { |
| 94 | - ObjectWriteResponse response= minioClient.putObject(PutObjectArgs.builder() | 76 | + minioClient.putObject(PutObjectArgs.builder() |
| 95 | .bucket(bucket) // 替换为你实际的存储桶名称 | 77 | .bucket(bucket) // 替换为你实际的存储桶名称 |
| 96 | .object(fileName) | 78 | .object(fileName) |
| 97 | .stream(inputStream, inputStream.available(), -1) | 79 | .stream(inputStream, inputStream.available(), -1) |
| 98 | .contentType(contentType) | 80 | .contentType(contentType) |
| 99 | .build()); | 81 | .build()); |
| 100 | return true; | 82 | return true; |
| 101 | - } catch (ErrorResponseException e) { | ||
| 102 | - throw new RuntimeException(e); | ||
| 103 | - } catch (InsufficientDataException e) { | ||
| 104 | - throw new RuntimeException(e); | ||
| 105 | - } catch (InternalException e) { | ||
| 106 | - throw new RuntimeException(e); | ||
| 107 | - } catch (InvalidKeyException e) { | ||
| 108 | - throw new RuntimeException(e); | ||
| 109 | - } catch (InvalidResponseException e) { | ||
| 110 | - throw new RuntimeException(e); | ||
| 111 | - } catch (IOException e) { | ||
| 112 | - throw new RuntimeException(e); | ||
| 113 | - } catch (NoSuchAlgorithmException e) { | ||
| 114 | - throw new RuntimeException(e); | ||
| 115 | - } catch (ServerException e) { | ||
| 116 | - throw new RuntimeException(e); | ||
| 117 | - } catch (XmlParserException e) { | 83 | + } catch (ErrorResponseException | InsufficientDataException | InternalException | InvalidKeyException | |
| 84 | + InvalidResponseException | IOException | NoSuchAlgorithmException | ServerException | | ||
| 85 | + XmlParserException e) { | ||
| 118 | throw new RuntimeException(e); | 86 | throw new RuntimeException(e); |
| 119 | } | 87 | } |
| 120 | } | 88 | } |
Bsth-generator/src/main/java/com/ruoyi/generator/service/GenTableServiceImpl.java
| @@ -514,8 +514,8 @@ public class GenTableServiceImpl implements IGenTableService | @@ -514,8 +514,8 @@ public class GenTableServiceImpl implements IGenTableService | ||
| 514 | String genPath = table.getGenPath(); | 514 | String genPath = table.getGenPath(); |
| 515 | if (StringUtils.equals(genPath, "/")) | 515 | if (StringUtils.equals(genPath, "/")) |
| 516 | { | 516 | { |
| 517 | - return System.getProperty("user.dir") + File.separator + "src" + File.separator + VelocityUtils.getFileName(template, table); | 517 | + return System.getProperty("user.dir") + "/" + "src" + "/" + VelocityUtils.getFileName(template, table); |
| 518 | } | 518 | } |
| 519 | - return genPath + File.separator + VelocityUtils.getFileName(template, table); | 519 | + return genPath + "/" + VelocityUtils.getFileName(template, table); |
| 520 | } | 520 | } |
| 521 | } | 521 | } |
| 522 | \ No newline at end of file | 522 | \ No newline at end of file |