|
|
@ -1,10 +1,12 @@
|
|
|
|
package com.luoo.user.controller;
|
|
|
|
package com.luoo.user.controller;
|
|
|
|
|
|
|
|
|
|
|
|
import java.io.IOException;
|
|
|
|
import java.io.IOException;
|
|
|
|
|
|
|
|
import java.nio.charset.Charset;
|
|
|
|
import java.util.*;
|
|
|
|
import java.util.*;
|
|
|
|
import java.util.function.Function;
|
|
|
|
import java.util.function.Function;
|
|
|
|
import java.util.stream.Collectors;
|
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
|
import com.github.houbb.sensitive.word.bs.SensitiveWordBs;
|
|
|
|
import com.github.houbb.sensitive.word.bs.SensitiveWordBs;
|
|
|
|
import com.luoo.user.dao.UserMessageDao;
|
|
|
|
import com.luoo.user.dao.UserMessageDao;
|
|
|
@ -25,7 +27,9 @@ import org.springframework.data.mongodb.core.aggregation.Aggregation;
|
|
|
|
import org.springframework.data.mongodb.core.aggregation.AggregationResults;
|
|
|
|
import org.springframework.data.mongodb.core.aggregation.AggregationResults;
|
|
|
|
import org.springframework.data.mongodb.core.query.Criteria;
|
|
|
|
import org.springframework.data.mongodb.core.query.Criteria;
|
|
|
|
import org.springframework.data.redis.core.RedisTemplate;
|
|
|
|
import org.springframework.data.redis.core.RedisTemplate;
|
|
|
|
import org.springframework.http.ResponseEntity;
|
|
|
|
import org.springframework.http.*;
|
|
|
|
|
|
|
|
import org.springframework.http.converter.HttpMessageConverter;
|
|
|
|
|
|
|
|
import org.springframework.http.converter.StringHttpMessageConverter;
|
|
|
|
import org.springframework.util.CollectionUtils;
|
|
|
|
import org.springframework.util.CollectionUtils;
|
|
|
|
import org.springframework.web.bind.annotation.CrossOrigin;
|
|
|
|
import org.springframework.web.bind.annotation.CrossOrigin;
|
|
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
|
@ -298,11 +302,32 @@ public class MyController extends BaseController {
|
|
|
|
for (String image:imagesArray) {
|
|
|
|
for (String image:imagesArray) {
|
|
|
|
robotImage = robotImage + Constants.RESOURCE_PREFIX +"user/feedback/" + image+"\r\n";
|
|
|
|
robotImage = robotImage + Constants.RESOURCE_PREFIX +"user/feedback/" + image+"\r\n";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
Map<String,String> robot = new HashMap<>();
|
|
|
|
Map<String,Object> robot = new HashMap<>();
|
|
|
|
|
|
|
|
Map<String,String> contentMap = new HashMap<>();
|
|
|
|
|
|
|
|
contentMap.put("text","反馈内容:"+content+"\r\n反馈人:"+userLoginDto.getNickName()+"\r\n附件:" + robotImage);
|
|
|
|
robot.put("msg_type","text");
|
|
|
|
robot.put("msg_type","text");
|
|
|
|
robot.put("content","反馈内容:"+content+"\r\n反馈人:"+userLoginDto.getNickName()+"\r\n附件:" + robotImage);
|
|
|
|
robot.put("content",contentMap);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
HttpHeaders httpHeaders = new HttpHeaders();
|
|
|
|
|
|
|
|
httpHeaders.setContentType(MediaType.APPLICATION_JSON);
|
|
|
|
|
|
|
|
JSONObject jsonObject = new JSONObject();
|
|
|
|
|
|
|
|
jsonObject.put("msg_type","text");
|
|
|
|
|
|
|
|
jsonObject.put("content",contentMap);
|
|
|
|
|
|
|
|
HttpEntity<String> requestEntity = new HttpEntity<>(jsonObject.toString(),httpHeaders);
|
|
|
|
|
|
|
|
// restTemplate.exchange(url, HttpMethod.POST,requestEntity,Map.class);
|
|
|
|
|
|
|
|
// JSON json = JSONObject.toJSON(robot);
|
|
|
|
|
|
|
|
// String json =JSONObject.toJSONString(robot);
|
|
|
|
|
|
|
|
// 中文乱码,主要是 StringHttpMessageConverter的默认编码为ISO导致的
|
|
|
|
|
|
|
|
List<HttpMessageConverter<?>> list = restTemplate.getMessageConverters();
|
|
|
|
|
|
|
|
for (HttpMessageConverter converter : list) {
|
|
|
|
|
|
|
|
if (converter instanceof StringHttpMessageConverter) {
|
|
|
|
|
|
|
|
((StringHttpMessageConverter) converter).setDefaultCharset(Charset.forName("UTF-8"));
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
ResponseEntity<Map> response = restTemplate.postForEntity(url,requestEntity,Map.class);
|
|
|
|
|
|
|
|
|
|
|
|
restTemplate.postForEntity(url,JSONObject.toJSON(robot),Map.class);
|
|
|
|
System.out.println(response.toString());
|
|
|
|
return Result.success();
|
|
|
|
return Result.success();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -318,7 +343,8 @@ public class MyController extends BaseController {
|
|
|
|
String imageName = feedback.getUserId() + "_" + feedback.getFeedbackId() + "_" + idWorker.nextId()
|
|
|
|
String imageName = feedback.getUserId() + "_" + feedback.getFeedbackId() + "_" + idWorker.nextId()
|
|
|
|
+ StringTools.getFileSuffix(file.getOriginalFilename());
|
|
|
|
+ StringTools.getFileSuffix(file.getOriginalFilename());
|
|
|
|
String filePath = Constants.USER_FEEDBACK_IMAGE_DIRECTORY + imageName;
|
|
|
|
String filePath = Constants.USER_FEEDBACK_IMAGE_DIRECTORY + imageName;
|
|
|
|
s3Service.uploadImage("indie", filePath, file.getBytes());
|
|
|
|
// s3Service.uploadImage("indie", filePath, file.getBytes());
|
|
|
|
|
|
|
|
s3Service.upload("indie",filePath,file);
|
|
|
|
return imageName;
|
|
|
|
return imageName;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|