Commit 6fcf15c1d61a9e7df9708619b6979faf643c45d0
1 parent
f246d844
对接统一登录平台和优化
Showing
9 changed files
with
186 additions
and
13 deletions
Bsth-admin/pom.xml
| ... | ... | @@ -22,6 +22,12 @@ |
| 22 | 22 | <scope>test</scope> |
| 23 | 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 | 33 | <groupId>junit</groupId> |
| ... | ... | @@ -136,7 +142,6 @@ |
| 136 | 142 | </dependency> |
| 137 | 143 | |
| 138 | 144 | |
| 139 | - | |
| 140 | 145 | <dependency> |
| 141 | 146 | <groupId>org.apache.httpcomponents</groupId> |
| 142 | 147 | <artifactId>commons-httpclient</artifactId> | ... | ... |
Bsth-admin/src/main/java/com/ruoyi/config/MinioConfig.java
0 → 100644
| 1 | +package com.ruoyi.config; | |
| 2 | + | |
| 3 | +import io.minio.errors.*; | |
| 4 | +import org.springframework.beans.factory.InitializingBean; | |
| 5 | +import org.springframework.context.annotation.Bean; | |
| 6 | +import org.springframework.stereotype.Component; | |
| 7 | +import org.springframework.beans.factory.annotation.Value; | |
| 8 | +import io.minio.MinioClient; | |
| 9 | +import org.springframework.web.multipart.MultipartFile; | |
| 10 | +import org.springframework.web.util.UriUtils; | |
| 11 | + | |
| 12 | +import java.io.IOException; | |
| 13 | +import java.io.InputStream; | |
| 14 | +import java.nio.charset.StandardCharsets; | |
| 15 | +import java.security.InvalidKeyException; | |
| 16 | +import java.security.NoSuchAlgorithmException; | |
| 17 | + | |
| 18 | +import io.minio.PutObjectArgs; | |
| 19 | + | |
| 20 | +import javax.annotation.Resource; | |
| 21 | + | |
| 22 | +@Component | |
| 23 | +public class MinioConfig implements InitializingBean { | |
| 24 | + @Value(value = "${minio.bucket}") | |
| 25 | + private String bucket; | |
| 26 | + | |
| 27 | + @Value(value = "${minio.host}") | |
| 28 | + private String host; | |
| 29 | + | |
| 30 | + @Value(value = "${minio.url}") | |
| 31 | + private String url; | |
| 32 | + | |
| 33 | + @Value(value = "${minio.access-key}") | |
| 34 | + private String accessKey; | |
| 35 | + | |
| 36 | + @Value(value = "${minio.secret-key}") | |
| 37 | + private String secretKey; | |
| 38 | + | |
| 39 | + private MinioClient minioClient; | |
| 40 | + | |
| 41 | + /** | |
| 42 | + * 初始化 MinIO 客户端 | |
| 43 | + */ | |
| 44 | + @Bean | |
| 45 | + public MinioClient minioClient() { | |
| 46 | + minioClient = MinioClient.builder() | |
| 47 | + .endpoint(host) | |
| 48 | + .credentials(accessKey, secretKey) | |
| 49 | + .build(); | |
| 50 | + return minioClient; | |
| 51 | + } | |
| 52 | + | |
| 53 | + /** | |
| 54 | + * 文件上传 | |
| 55 | + * | |
| 56 | + * @param file 文件 | |
| 57 | + * @return Boolean | |
| 58 | + */ | |
| 59 | + public Boolean upload(MultipartFile file) { | |
| 60 | + // 修饰过的文件名 非源文件名 | |
| 61 | + String fileName = "2021-07/21/"; | |
| 62 | + fileName = fileName + file.getOriginalFilename(); | |
| 63 | + try { | |
| 64 | + PutObjectArgs objectArgs = PutObjectArgs.builder().bucket(bucket).object(fileName) | |
| 65 | + .stream(file.getInputStream(), file.getSize(), -1).contentType(file.getContentType()).build(); | |
| 66 | + //文件名称相同会覆盖 | |
| 67 | + minioClient.putObject(objectArgs); | |
| 68 | + } catch (Exception e) { | |
| 69 | + e.printStackTrace(); | |
| 70 | + return false; | |
| 71 | + } | |
| 72 | + return true; | |
| 73 | + } | |
| 74 | + | |
| 75 | + | |
| 76 | + /** | |
| 77 | + * 文件上传 | |
| 78 | + * | |
| 79 | + * @param inputStream 文件 | |
| 80 | + * @return Boolean | |
| 81 | + */ | |
| 82 | + public Boolean upload(InputStream inputStream, String fileName, String contentType) { | |
| 83 | + // 修饰过的文件名 非源文件名 | |
| 84 | + | |
| 85 | + try { | |
| 86 | + PutObjectArgs objectArgs = PutObjectArgs.builder().bucket(bucket).object(fileName) | |
| 87 | + .stream(inputStream, inputStream.available(), -1).contentType(contentType).build(); | |
| 88 | + //文件名称相同会覆盖 | |
| 89 | + minioClient.putObject(objectArgs); | |
| 90 | + } catch (Exception e) { | |
| 91 | + e.printStackTrace(); | |
| 92 | + return false; | |
| 93 | + } | |
| 94 | + return true; | |
| 95 | + } | |
| 96 | + | |
| 97 | + | |
| 98 | + @Override | |
| 99 | + public void afterPropertiesSet() throws Exception { | |
| 100 | + | |
| 101 | + } | |
| 102 | +} | ... | ... |
Bsth-admin/src/main/java/com/ruoyi/domain/driver/NewDriver.java
| ... | ... | @@ -168,10 +168,17 @@ public class NewDriver { |
| 168 | 168 | @ApiModelProperty("审计岗,0不是审计岗,1是酒驾审计岗") |
| 169 | 169 | private Integer audit; |
| 170 | 170 | |
| 171 | + private String auditZname; | |
| 172 | + | |
| 171 | 173 | @TableField(exist = false) |
| 172 | 174 | private float imageScore; |
| 173 | 175 | @TableField(exist = false) |
| 174 | 176 | private Collection<String> lineNames; |
| 177 | + @TableField(exist = false) | |
| 178 | + private Collection<String> jobCodes; | |
| 179 | + | |
| 180 | + @TableField(exist = false) | |
| 181 | + private Collection<String> zNames; | |
| 175 | 182 | |
| 176 | 183 | public Integer getInteger() { |
| 177 | 184 | return integer1; | ... | ... |
Bsth-admin/src/main/java/com/ruoyi/service/ThreadJobService.java
| ... | ... | @@ -142,6 +142,8 @@ public class ThreadJobService { |
| 142 | 142 | |
| 143 | 143 | @Value("${bsth.process.sign.url}") |
| 144 | 144 | private String processSignExceptionURL; |
| 145 | + @Value("${bsth.audit-jobs}") | |
| 146 | + private String auditJobs; | |
| 145 | 147 | |
| 146 | 148 | |
| 147 | 149 | /** |
| ... | ... | @@ -335,16 +337,34 @@ public class ThreadJobService { |
| 335 | 337 | linggangScheduling.setSchedulingType(1); |
| 336 | 338 | List<LinggangScheduling> linggangSchedulings = linggangSchedulingService.list(linggangScheduling); |
| 337 | 339 | |
| 338 | - Set<String> lineNames = null; | |
| 340 | + Set<String> qdznames = new HashSet<>(); | |
| 341 | + | |
| 339 | 342 | List<NewDriver> newDrivers = null; |
| 340 | 343 | if (CollectionUtils.isNotEmpty(linggangSchedulings)) { |
| 341 | - lineNames = linggangSchedulings.stream().map(LinggangScheduling::getLineName).filter(org.apache.commons.lang3.StringUtils::isNotEmpty).collect(Collectors.toSet()); | |
| 344 | + qdznames = linggangSchedulings.stream().map(LinggangScheduling::getQdzname).filter(org.apache.commons.lang3.StringUtils::isNotEmpty).collect(Collectors.toSet()); | |
| 345 | + qdznames.add("鸿音路临时停车点"); | |
| 346 | + | |
| 347 | + newDrivers = newDriverService.listByQdzName(qdznames); | |
| 342 | 348 | } |
| 343 | - if (CollectionUtils.isNotEmpty(lineNames)) { | |
| 344 | - NewDriver newDriver = new NewDriver(); | |
| 345 | - newDriver.setAudit(1); | |
| 346 | - newDriver.setLineNames(lineNames); | |
| 347 | - newDrivers = newDriverService.list(newDriver); | |
| 349 | + | |
| 350 | + if (StringUtils.isNotEmpty(auditJobs)) { | |
| 351 | + String[] jobCodes1 = auditJobs.split(";"); | |
| 352 | + Set<String> jobCodes = new HashSet<>(); | |
| 353 | + for (String code : jobCodes1) { | |
| 354 | + if (org.apache.commons.lang3.StringUtils.isNotEmpty(code)) { | |
| 355 | + jobCodes.add(code); | |
| 356 | + } | |
| 357 | + } | |
| 358 | + if (CollectionUtils.isNotEmpty(jobCodes)) { | |
| 359 | + NewDriver newDriver = new NewDriver(); | |
| 360 | + newDriver.setJobCodes(jobCodes); | |
| 361 | + List<NewDriver> newDrivers1 = newDriverService.list(qdznames); | |
| 362 | + if (Objects.isNull(newDrivers) && CollectionUtils.isNotEmpty(newDrivers1)) { | |
| 363 | + newDrivers = newDrivers1; | |
| 364 | + } else if (CollectionUtils.isNotEmpty(newDrivers) && CollectionUtils.isNotEmpty(newDrivers1)) { | |
| 365 | + newDrivers.addAll(newDrivers1); | |
| 366 | + } | |
| 367 | + } | |
| 348 | 368 | } |
| 349 | 369 | |
| 350 | 370 | if (CollectionUtils.isNotEmpty(newDrivers)) { | ... | ... |
Bsth-admin/src/main/java/com/ruoyi/service/driver/NewDriverService.java
| ... | ... | @@ -43,6 +43,9 @@ public interface NewDriverService extends IService<NewDriver> { |
| 43 | 43 | */ |
| 44 | 44 | List<NewDriver> listOfSelect(NewDriver entity); |
| 45 | 45 | |
| 46 | + List<NewDriver> listByQdzName(String qdzName); | |
| 47 | + List<NewDriver> listByQdzName(Collection<String> qdzNames); | |
| 48 | + | |
| 46 | 49 | Collection<String> listOfJobs(NewDriver entity); |
| 47 | 50 | |
| 48 | 51 | /** | ... | ... |
Bsth-admin/src/main/java/com/ruoyi/service/impl/driver/NewDriverServiceImpl.java
| ... | ... | @@ -75,6 +75,7 @@ public class NewDriverServiceImpl extends ServiceImpl<NewDriverMapper, NewDriver |
| 75 | 75 | public List<NewDriver> list(NewDriver entity) { |
| 76 | 76 | LambdaQueryWrapper<NewDriver> wrapper = new LambdaQueryWrapper<>(entity); |
| 77 | 77 | chooseLineNames(entity, wrapper); |
| 78 | + chooseJobCodes(entity, wrapper); | |
| 78 | 79 | return list(wrapper); |
| 79 | 80 | } |
| 80 | 81 | |
| ... | ... | @@ -149,6 +150,23 @@ public class NewDriverServiceImpl extends ServiceImpl<NewDriverMapper, NewDriver |
| 149 | 150 | } |
| 150 | 151 | |
| 151 | 152 | @Override |
| 153 | + public List<NewDriver> listByQdzName(String qdzName) { | |
| 154 | + LambdaQueryWrapper<NewDriver> wrapper = new LambdaQueryWrapper<>(); | |
| 155 | + wrapper.like(NewDriver::getAuditZname, qdzName + ";"); | |
| 156 | + | |
| 157 | + return list(wrapper); | |
| 158 | + } | |
| 159 | + | |
| 160 | + @Override | |
| 161 | + public List<NewDriver> listByQdzName(Collection<String> qdzNames) { | |
| 162 | + LambdaQueryWrapper<NewDriver> wrapper = new LambdaQueryWrapper<>(); | |
| 163 | + for (String qdzName : qdzNames) { | |
| 164 | + wrapper.or().like(NewDriver::getAuditZname, qdzName + ";"); | |
| 165 | + } | |
| 166 | + return list(wrapper); | |
| 167 | + } | |
| 168 | + | |
| 169 | + @Override | |
| 152 | 170 | public Collection<String> listOfJobs(NewDriver entity) { |
| 153 | 171 | LambdaQueryWrapper<NewDriver> wrapper = new LambdaQueryWrapper<>(entity); |
| 154 | 172 | wrapper.select(NewDriver::getJobCode, NewDriver::getTelphone); |
| ... | ... | @@ -578,5 +596,11 @@ public class NewDriverServiceImpl extends ServiceImpl<NewDriverMapper, NewDriver |
| 578 | 596 | } |
| 579 | 597 | } |
| 580 | 598 | |
| 599 | + private void chooseJobCodes(NewDriver driver, LambdaQueryWrapper<NewDriver> wrapper) { | |
| 600 | + if (Objects.nonNull(driver) && CollectionUtils.isNotEmpty(driver.getJobCodes())) { | |
| 601 | + wrapper.in(NewDriver::getJobCode, driver.getJobCodes()); | |
| 602 | + } | |
| 603 | + } | |
| 604 | + | |
| 581 | 605 | |
| 582 | 606 | } |
| 583 | 607 | \ No newline at end of file | ... | ... |
Bsth-admin/src/main/resources/application-druid-dev.yml
| ... | ... | @@ -212,6 +212,12 @@ management: |
| 212 | 212 | endpoint: |
| 213 | 213 | shutdown: |
| 214 | 214 | enabled: true |
| 215 | +minio: | |
| 216 | + host: http://192.168.168.167:9000 | |
| 217 | + url: ${minio.host}/${minio.bucket}/ | |
| 218 | + access-key: alcohol_0D2GVpdJ3 | |
| 219 | + secret-key: ZF4M3dFk1SjmKDuCphTRfh2MZ5T84r25w6YVDSsA | |
| 220 | + bucket: alchohol | |
| 215 | 221 | bsth: |
| 216 | 222 | face: |
| 217 | 223 | app: |
| ... | ... | @@ -225,4 +231,6 @@ bsth: |
| 225 | 231 | process: |
| 226 | 232 | sign: |
| 227 | 233 | url: http://127.0.0.1:9103/commonOpenDataApi/sendAppAndSmsNotice |
| 234 | + audit-jobs: | |
| 235 | + | |
| 228 | 236 | ... | ... |
Bsth-admin/src/main/resources/application-druid-lingangPrd.yml
| ... | ... | @@ -219,6 +219,12 @@ netty: |
| 219 | 219 | image: device/image |
| 220 | 220 | speech: device/speech |
| 221 | 221 | port: 8989 |
| 222 | +minio: | |
| 223 | + host: http://10.10.200.172:9009 | |
| 224 | + url: ${minio.host}/${minio.bucket}/ | |
| 225 | + access-key: alcohol_0D2GVpdJ3 | |
| 226 | + secret-key: ZF4M3dFk1SjmKDuCphTRfh2MZ5T84r25w6YVDSsA | |
| 227 | + bucket: alchohol | |
| 222 | 228 | bsth: |
| 223 | 229 | face: |
| 224 | 230 | app: |
| ... | ... | @@ -233,5 +239,6 @@ bsth: |
| 233 | 239 | url: http://222.76.217.238:8880/fcgi-bin/entry.fcgi/system |
| 234 | 240 | process: |
| 235 | 241 | sign: |
| 236 | - url: http://127.0.0.1:9103/commonOpenDataApi/sendAppAndSmsNotice | |
| 242 | + url: http://10.10.200.171:9103/commonOpenDataApi/sendAppAndSmsNotice | |
| 243 | + audit-jobs: | |
| 237 | 244 | ... | ... |
Bsth-common/src/main/java/com/ruoyi/common/utils/file/FileUploadUtils.java
| ... | ... | @@ -138,10 +138,7 @@ public class FileUploadUtils { |
| 138 | 138 | } |
| 139 | 139 | |
| 140 | 140 | uploadContent = choosePrictureContent(uploadContent); |
| 141 | - File file = new File(filePath); | |
| 142 | - if (!file.isDirectory()) { | |
| 143 | - FileUtils.forceMkdir(file); | |
| 144 | - } | |
| 141 | + | |
| 145 | 142 | |
| 146 | 143 | byte[] content = Base64.decode(uploadContent); |
| 147 | 144 | if (ArrayUtils.getLength(content) > DEFAULT_MAX_SIZE) { | ... | ... |