|
@@ -1,7 +1,6 @@
|
|
|
package com.platform.manage;
|
|
package com.platform.manage;
|
|
|
|
|
|
|
|
import com.platform.api.request.LicensePlateValidateRequest;
|
|
import com.platform.api.request.LicensePlateValidateRequest;
|
|
|
-import com.google.common.collect.Maps;
|
|
|
|
|
import com.platform.api.request.WeighbridgePushRequest;
|
|
import com.platform.api.request.WeighbridgePushRequest;
|
|
|
import com.platform.entity.ValidateLicensePlate;
|
|
import com.platform.entity.ValidateLicensePlate;
|
|
|
import com.platform.entity.WeighbridgeRecord;
|
|
import com.platform.entity.WeighbridgeRecord;
|
|
@@ -9,13 +8,11 @@ import com.platform.enums.ErrorCodeEnum;
|
|
|
import com.platform.exception.IotException;
|
|
import com.platform.exception.IotException;
|
|
|
import com.platform.response.LicensePlateValidateResponse;
|
|
import com.platform.response.LicensePlateValidateResponse;
|
|
|
import com.platform.service.ValidateLicensePlateService;
|
|
import com.platform.service.ValidateLicensePlateService;
|
|
|
-import com.platform.result.HttpStatus;
|
|
|
|
|
import com.platform.service.WeighbridgeRecordService;
|
|
import com.platform.service.WeighbridgeRecordService;
|
|
|
import com.platform.utils.FileUtils;
|
|
import com.platform.utils.FileUtils;
|
|
|
import lombok.RequiredArgsConstructor;
|
|
import lombok.RequiredArgsConstructor;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
-import org.jspecify.annotations.NonNull;
|
|
|
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
|
|
@@ -23,7 +20,6 @@ import java.time.Instant;
|
|
|
import java.time.LocalDateTime;
|
|
import java.time.LocalDateTime;
|
|
|
import java.time.ZoneId;
|
|
import java.time.ZoneId;
|
|
|
import java.util.*;
|
|
import java.util.*;
|
|
|
-import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* 地磅记录业务编排类
|
|
* 地磅记录业务编排类
|
|
@@ -126,33 +122,21 @@ public class WeighbridgeRecordManage {
|
|
|
* @return 逗号分隔的文件名字符串
|
|
* @return 逗号分隔的文件名字符串
|
|
|
*/
|
|
*/
|
|
|
private String processImageFiles(MultipartFile[] images) {
|
|
private String processImageFiles(MultipartFile[] images) {
|
|
|
- List<Map<String, Object>> resultList = new ArrayList<>();
|
|
|
|
|
|
|
+ List<String> resultList = new ArrayList<>();
|
|
|
Arrays.stream(images).forEach(x->{
|
|
Arrays.stream(images).forEach(x->{
|
|
|
- Map<String, Object> map = Maps.newHashMap();
|
|
|
|
|
- //文件名称
|
|
|
|
|
- String originalFilename = x.getOriginalFilename();
|
|
|
|
|
- map.put("code", HttpStatus.SUCCESS_CODE);
|
|
|
|
|
- map.put("fileName", originalFilename);
|
|
|
|
|
- map.put("message", HttpStatus.SUCCESS_MESSAGE);
|
|
|
|
|
String oosUrl = null;
|
|
String oosUrl = null;
|
|
|
//上传文件是否成功
|
|
//上传文件是否成功
|
|
|
try {
|
|
try {
|
|
|
oosUrl = FileUtils.uploadFile(x);
|
|
oosUrl = FileUtils.uploadFile(x);
|
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
|
- map.put("code", HttpStatus.GLOBAL_EXCEPTION_CODE);
|
|
|
|
|
- map.put("fileName", originalFilename);
|
|
|
|
|
- map.put("message", e);
|
|
|
|
|
|
|
+ log.error("上传文件异常", e);
|
|
|
|
|
+ throw new IotException(ErrorCodeEnum.SYSTEM_ERROR, "上传文件异常");
|
|
|
}
|
|
}
|
|
|
- if (StringUtils.isBlank(oosUrl)) {
|
|
|
|
|
- map.put("code", HttpStatus.GLOBAL_EXCEPTION_CODE);
|
|
|
|
|
- map.put("fileName", originalFilename);
|
|
|
|
|
- map.put("message", HttpStatus.SUCCESS_MESSAGE);
|
|
|
|
|
- }
|
|
|
|
|
- //上传至oss文件地址
|
|
|
|
|
- map.put("oosUrl", oosUrl);
|
|
|
|
|
- resultList.add(map);
|
|
|
|
|
|
|
+ if (StringUtils.isNotBlank(oosUrl)) {
|
|
|
|
|
+ resultList.add(oosUrl);
|
|
|
|
|
+ };
|
|
|
});
|
|
});
|
|
|
- return resultList.stream().map(x -> x.get("fileName").toString()).collect(Collectors.joining(","));
|
|
|
|
|
|
|
+ return String.join(",", resultList);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|