魏超 6 anni fa
parent
commit
0172cebb9f

+ 0
- 2
CODE/smart-community/app-api/src/main/java/com/community/huiju/controller/ImageController.java Vedi File

@@ -23,8 +23,6 @@ import org.springframework.web.multipart.MultipartFile;
23 23
 @Api(value = "图片操作API", description = "图片操作API")
24 24
 public class ImageController {
25 25
 
26
-
27
-
28 26
     @Autowired
29 27
     private ImageServiceI imageService;
30 28
 

+ 4
- 6
CODE/smart-community/app-api/src/main/java/com/community/huiju/controller/SocialController.java Vedi File

@@ -158,17 +158,15 @@ public class SocialController {
158 158
 
159 159
     @ApiOperation(value = "添加二手租赁帖子", notes = "添加二手租赁帖子")
160 160
     @ApiImplicitParams({
161
-            @ApiImplicitParam(paramType = "body", dataType = "String", name = "paramets", value =
162
-                    "title:小区标题,content:小区内容, type:0二手,1求购,2租赁"),
161
+            @ApiImplicitParam(paramType = "body", dataType = "String", name = "paramets", value ="title:小区标题, imageUrl:图片URL地址, content:小区内容, type:0二手,1求购,2租赁"),
163 162
             @ApiImplicitParam(paramType = "header",dataType = "String",name = "X-Auth-Token",value = "Token")
164 163
     })
165
-    @PostMapping(value = "/addTransaction", consumes = "multipart/*", headers = "content-type=multipart/form-data")
166
-    @ResponseBody
167
-    public ResponseBean addTransaction(@RequestBody String paramets, @ApiParam(value = "file" ,required = true) MultipartFile uploadFile, HttpSession session) throws IOException {
164
+    @RequestMapping(value = "/addTransaction", method = RequestMethod.POST)
165
+    public ResponseBean addTransaction(@RequestBody String paramets, HttpSession session) throws IOException {
168 166
         ResponseBean responseBean = new ResponseBean();
169 167
         UserElement userElement = (UserElement) session.getAttribute(Constant.APP_USER_SESSION);
170 168
         Integer userId = userElement.getId();
171
-        ResponseBean response = socialServiceI.addAllTransaction(userId, paramets, uploadFile);
169
+        ResponseBean response = socialServiceI.addAllTransaction(userId, paramets);
172 170
         return response;
173 171
     }
174 172
 

+ 1
- 1
CODE/smart-community/app-api/src/main/java/com/community/huiju/service/SocialServiceI.java Vedi File

@@ -71,7 +71,7 @@ public interface SocialServiceI {
71 71
 	/**
72 72
 	 * 添加二手租赁帖子
73 73
 	 */
74
-    ResponseBean addAllTransaction(Integer userId, String paramets, MultipartFile uploadFile) throws IOException;
74
+    ResponseBean addAllTransaction(Integer userId, String paramets) throws IOException;
75 75
 
76 76
 	/**
77 77
 	 * 获取当前用户发布所有的帖子

+ 4
- 4
CODE/smart-community/app-api/src/main/java/com/community/huiju/service/impl/SocialServiceImpl.java Vedi File

@@ -228,7 +228,7 @@ public class SocialServiceImpl implements SocialServiceI {
228 228
 
229 229
     @Transactional
230 230
     @Override
231
-    public ResponseBean addAllTransaction(Integer userId, String paramets, MultipartFile uploadFile) throws IOException {
231
+    public ResponseBean addAllTransaction(Integer userId, String paramets) throws IOException {
232 232
 
233 233
         ResponseBean response = new ResponseBean();
234 234
 
@@ -236,6 +236,7 @@ public class SocialServiceImpl implements SocialServiceI {
236 236
         String transactionTitle = (String) jsonObject.get("title");
237 237
         String transactionContent = (String) jsonObject.get("content");
238 238
         String  type= (String) jsonObject.get("type");
239
+        String imageUrl = (String) jsonObject.get("imageUrl");
239 240
 
240 241
         TaUser user=taUserMapper.selectByPrimaryKey(userId);
241 242
         TpTransaction tpTransaction = new TpTransaction();
@@ -270,7 +271,7 @@ public class SocialServiceImpl implements SocialServiceI {
270 271
 
271 272
         if (Constant.EFFECTIVE.equals(taUser.getStatus()) && (Constant.RELATION.equals(sysRole.getRoleName()) || Constant.TENANT.equals(sysRole.getRoleName()) || Constant.OWNER.equals(sysRole.getRoleName()))){
272 273
             tpTransactionMapper.insertSelective(tpTransaction);
273
-            insertTdImage(tpTransaction, uploadFile, type, userId);
274
+            insertTdImage(tpTransaction, imageUrl, type, userId);
274 275
 
275 276
             TpTransaction tpTransaction1=tpTransactionMapper.getById(tpTransaction.getId());
276 277
             response.addSuccess(tpTransaction1);
@@ -280,10 +281,9 @@ public class SocialServiceImpl implements SocialServiceI {
280 281
         return response;
281 282
     }
282 283
 
283
-    private void insertTdImage(TpTransaction tpTransaction, MultipartFile uploadFile, String type, Integer userId) throws IOException {
284
+    private void insertTdImage(TpTransaction tpTransaction, String imageUrl, String type, Integer userId) throws IOException {
284 285
         TdImages tdImages = new TdImages();
285 286
         Integer uuId = tpTransaction.getId();
286
-        String imageUrl = imageServiceI.getImageUrl(uploadFile);
287 287
         tdImages.setImageUrl(imageUrl);
288 288
         tdImages.setType(type);
289 289
         tdImages.setUuid(uuId);

BIN
CODE/smart-community/community-common/target/classes/com/community/commom/ailiyun/AESDecode.class Vedi File