|
|
|
@ -7,6 +7,7 @@ import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
|
|
import com.github.houbb.sensitive.word.bs.SensitiveWordBs;
|
|
|
|
|
import com.luoo.user.dao.UserMessageDao;
|
|
|
|
|
import com.luoo.user.dto.FeedbackImage;
|
|
|
|
|
import com.luoo.user.dto.TotalCommentVo;
|
|
|
|
|
import com.luoo.user.dto.request.LoginReq;
|
|
|
|
|
import com.luoo.user.dto.request.LogoffReq;
|
|
|
|
@ -60,7 +61,6 @@ import io.swagger.annotations.ApiImplicitParam;
|
|
|
|
|
import io.swagger.annotations.ApiImplicitParams;
|
|
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
|
|
import io.swagger.annotations.ApiParam;
|
|
|
|
|
import lombok.SneakyThrows;
|
|
|
|
|
import util.DateUtil;
|
|
|
|
|
import util.IdWorker;
|
|
|
|
|
import util.ScaleFilter;
|
|
|
|
@ -283,25 +283,27 @@ public class MyController extends BaseController {
|
|
|
|
|
feedback.setUserId(userLoginDto.getUserId());
|
|
|
|
|
feedback.setNickName(EmojiConverterUtil.encode(userLoginDto.getNickName()));
|
|
|
|
|
feedback.setContent(EmojiConverterUtil.encode(content));
|
|
|
|
|
feedback.setImages(uploadImages(feedback, files));
|
|
|
|
|
feedbackService.send(feedback);
|
|
|
|
|
feedbackService.send(feedback, getInputStream(files));
|
|
|
|
|
return Result.success();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private String uploadImages(Feedback feedback, List<MultipartFile> files) {
|
|
|
|
|
if (null == files || files.isEmpty()) {
|
|
|
|
|
return null;
|
|
|
|
|
private List<FeedbackImage> getInputStream(List<MultipartFile> files) {
|
|
|
|
|
if(null==files) {
|
|
|
|
|
return Collections.emptyList();
|
|
|
|
|
}
|
|
|
|
|
return files.parallelStream().map(f -> uploadImages(feedback, f)).collect(Collectors.joining(","));
|
|
|
|
|
return files.stream().map(this::getFeedbackImage).collect(Collectors.toList());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@SneakyThrows
|
|
|
|
|
private String uploadImages(Feedback feedback, MultipartFile file) {
|
|
|
|
|
String imageName = feedback.getUserId() + "_" + feedback.getFeedbackId() + "_" + idWorker.nextId()
|
|
|
|
|
+ StringTools.getFileSuffix(file.getOriginalFilename());
|
|
|
|
|
String filePath = Constants.USER_FEEDBACK_IMAGE_DIRECTORY + imageName;
|
|
|
|
|
s3Service.upload("indie", filePath, file);
|
|
|
|
|
return imageName;
|
|
|
|
|
private FeedbackImage getFeedbackImage(MultipartFile multipartFile) {
|
|
|
|
|
FeedbackImage feedbackImage=new FeedbackImage();
|
|
|
|
|
try {
|
|
|
|
|
feedbackImage.setInputStream(multipartFile.getInputStream());
|
|
|
|
|
}catch(Exception e) {
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
}
|
|
|
|
|
feedbackImage.setContentType(multipartFile.getContentType());
|
|
|
|
|
feedbackImage.setOriginalFilename(multipartFile.getOriginalFilename());
|
|
|
|
|
feedbackImage.setSize(multipartFile.getSize());
|
|
|
|
|
return feedbackImage;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private Result<PageResult<UserRespDTO>> getCollectedUserInfo(String userId, Integer pageNum, Integer pageSize,
|
|
|
|
|