|
|
@@ -3,6 +3,7 @@ package com.cyksj.service.order.impl;
|
|
|
import cn.hutool.core.bean.BeanUtil;
|
|
|
import cn.hutool.core.date.DateTime;
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
+import cn.hutool.json.JSONUtil;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
import com.cyksj.common.constant.Constant;
|
|
|
import com.cyksj.common.exception.BusinessRuntimeException;
|
|
|
@@ -25,6 +26,7 @@ import org.springframework.stereotype.Service;
|
|
|
|
|
|
import java.util.List;
|
|
|
import java.util.Arrays;
|
|
|
+import java.util.Collections;
|
|
|
import java.util.stream.Collectors;
|
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
|
@@ -56,10 +58,11 @@ public class OrderCommentFrontServiceImpl implements OrderCommentFrontService {
|
|
|
throw BusinessRuntimeException.getInstance("最多上传9张图片");
|
|
|
}
|
|
|
if (files != null && files.length > 0) {
|
|
|
- String picture = Arrays.stream(files)
|
|
|
+ String picture = JSONUtil.toJsonStr(Arrays.stream(files)
|
|
|
.filter(file -> file != null && !file.isEmpty())
|
|
|
.map(thirdPartyFileUploadService::uploadImage)
|
|
|
- .collect(Collectors.joining(","));
|
|
|
+ .map(url -> Collections.singletonMap("url", url))
|
|
|
+ .collect(Collectors.toList()));
|
|
|
request.setPicture(picture);
|
|
|
}
|
|
|
Long orderId = request.getOrderId();
|
|
|
@@ -82,7 +85,7 @@ public class OrderCommentFrontServiceImpl implements OrderCommentFrontService {
|
|
|
if (request.getContent().length() > 1000) {
|
|
|
throw BusinessRuntimeException.getInstance("评论内容过多");
|
|
|
}
|
|
|
- // 最多9张图片的CDN地址以逗号拼接保存,不能沿用单图2000字符限制。
|
|
|
+ // 最多9张图片以 [{"url":"CDN地址"}] JSON数组保存。
|
|
|
if (StrUtil.isNotBlank(request.getPicture()) && request.getPicture().length() > 10000) {
|
|
|
throw BusinessRuntimeException.getInstance("图片过多");
|
|
|
}
|