Browse Source

合并本地

weiximei 6 years ago
parent
commit
febfa24acb

+ 11
- 9
CODE/smart-community/app-api/src/main/java/com/community/huiju/controller/SocialController.java View File

@@ -302,27 +302,29 @@ public class SocialController extends BaseController {
302 302
     @ApiOperation(value = "修改二手租赁帖子", notes = "修改二手租赁帖子")
303 303
     @ApiImplicitParams({
304 304
             @ApiImplicitParam(paramType = "body", dataType = "String", name = "paramets", value =
305
-                    "id:帖子id,imageUrl:图片url,transactionTitle:小区标题,transactionContent:小区内容"),
305
+                    "imageUrl:图片url,transactionTitle:小区标题,transactionContent:小区内容"),
306
+            @ApiImplicitParam(paramType = "path", dataType = "String", name = "id", value = "id:帖子id"),
306 307
             @ApiImplicitParam(paramType = "header",dataType = "String",name = "X-Auth-Token",value = "Token")
307 308
     })
308
-    @RequestMapping(value = "/updateTransaction/{Id}", method = RequestMethod.PUT)
309
-    public ResponseBean ubdateTransaction(HttpSession session, @RequestBody String paramets) {
309
+    @RequestMapping(value = "/updateTransaction/{id}", method = RequestMethod.PUT)
310
+    public ResponseBean ubdateTransaction(HttpSession session,@PathVariable("id") String id, @RequestBody String paramets) {
310 311
         ResponseBean responseBean = new ResponseBean();
311 312
         UserElement userElement = (UserElement) session.getAttribute(Constant.APP_USER_SESSION);
312 313
         Integer userId = userElement.getId();
313
-        ResponseBean response = socialServiceI.updateTransaction(paramets, userId);
314
+        ResponseBean response = socialServiceI.updateTransaction(paramets,userId,Integer.valueOf(id));
314 315
         return response;
315 316
     }
316 317
 
317 318
     @ApiOperation(value = "删除二手租赁帖子", notes = "删除二手租赁帖子")
318 319
     @ApiImplicitParams({
319
-            @ApiImplicitParam(paramType = "body", dataType = "String", name = "paramets", value =
320
-                    "id:帖子id"),
320
+            @ApiImplicitParam(paramType = "path", dataType = "String", name = "id", value = "id:帖子id"),
321 321
             @ApiImplicitParam(paramType = "header",dataType = "String",name = "X-Auth-Token",value = "Token")
322 322
     })
323
-    @RequestMapping(value = "/deleteTransaction/{Id}", method = RequestMethod.PUT)
324
-    public ResponseBean deleteTransaction(HttpSession session, @RequestBody String paramets) {
325
-        ResponseBean response = socialServiceI.deleteransaction(paramets);
323
+    @RequestMapping(value = "/deleteTransaction/{id}", method = RequestMethod.DELETE)
324
+    public ResponseBean deleteTransaction(HttpSession session, @PathVariable("id") String id) {
325
+        UserElement userElement = (UserElement) session.getAttribute(Constant.APP_USER_SESSION);
326
+        Integer userId = userElement.getId();
327
+        ResponseBean response = socialServiceI.deleteransaction(Integer.valueOf(id),userId);
326 328
         return response;
327 329
     }
328 330
 

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

@@ -110,7 +110,7 @@ public interface SocialServiceI {
110 110
 	/**
111 111
 	 * 修改当前帖子
112 112
 	 */
113
-	ResponseBean updateTransaction(String paramets,Integer userId);
113
+	ResponseBean updateTransaction(String paramets,Integer userId,Integer id);
114 114
 
115 115
 	/**
116 116
 	 * 评价工单以及评分
@@ -138,8 +138,8 @@ public interface SocialServiceI {
138 138
 
139 139
 	/**
140 140
 	 * 删除二手租赁帖子
141
- 	 * @param paramets
141
+ 	 * @param id
142 142
 	 * @return
143 143
 	 */
144
-	ResponseBean deleteransaction(String paramets);
144
+	ResponseBean deleteransaction(Integer id,Integer userid);
145 145
 }

+ 17
- 15
CODE/smart-community/app-api/src/main/java/com/community/huiju/service/impl/SocialServiceImpl.java View File

@@ -383,34 +383,36 @@ public class SocialServiceImpl implements SocialServiceI {
383 383
 
384 384
     @Override
385 385
     @Transactional(rollbackFor = Exception.class)
386
-    public ResponseBean updateTransaction(String paramets,Integer userId) {
386
+    public ResponseBean updateTransaction(String paramets,Integer userId,Integer id) {
387 387
         ResponseBean response = new ResponseBean();
388 388
         JSONObject jsonObject = JSONObject.parseObject(paramets);
389
-        String id = (String) jsonObject.get("id");
390 389
         String transactionTitle = (String) jsonObject.get("transactionTitle");
391 390
         String transactionContent = (String) jsonObject.get("transactionContent");
392 391
         String imageUrl = (String) jsonObject.get("imageUrl");
393
-        TpTransaction tpTransaction = JSONObject.parseObject(paramets,TpTransaction.class);
392
+        TpTransaction tpTransaction = JSONObject.parseObject(paramets, TpTransaction.class);
393
+        TpTransaction taUser = tpTransactionMapper.getById(id);
394
+        if (null != taUser && userId.equals(taUser.getTaUserId())) {
395
+            tdImagesMapper.deleteTdImages(Integer.valueOf(id), Constant.TRANSACTION);
396
+            try {
397
+                insertTdImage(tpTransaction, imageUrl, userId, Constant.TRANSACTION);
398
+            } catch (IOException e) {
399
+                e.printStackTrace();
400
+                throw new RuntimeException("图片修改异常");
401
+            }
402
+            tpTransactionMapper.updateTransaction(Integer.valueOf(id), transactionTitle, transactionContent, userId);
403
+            response.addSuccess("修改成功");
404
+            return response;
394 405
 
395
-        tdImagesMapper.deleteTdImages( Integer.valueOf(id),Constant.TRANSACTION);
396
-        try {
397
-            insertTdImage(tpTransaction, imageUrl, userId,Constant.TRANSACTION);
398
-        } catch (IOException e) {
399
-            e.printStackTrace();
400
-            throw new RuntimeException("图片修改异常");
401 406
         }
402
-        tpTransactionMapper.updateTransaction(Integer.valueOf(id),transactionTitle,transactionContent,userId);
403
-        response.addSuccess("修改成功");
407
+        response.addError("操作失败");
404 408
         return response;
405 409
     }
406 410
 
407 411
     @Override
408
-    public ResponseBean deleteransaction(String paramets) {
412
+    public ResponseBean deleteransaction(Integer id,Integer userId) {
409 413
         ResponseBean responseBean= new ResponseBean();
410
-        JSONObject jsonObject = JSONObject.parseObject(paramets);
411
-        String id = (String) jsonObject.get("id");
412 414
         TpTransaction tpTransaction=tpTransactionMapper.getById(Integer.valueOf(id));
413
-        if(null!= tpTransaction) {
415
+        if(null!= tpTransaction && userId.equals(tpTransaction.getTaUserId())) {
414 416
             tpTransaction.setStatus("0");
415 417
             tpTransactionMapper.updateByPrimaryKeySelective(tpTransaction);
416 418
             responseBean.addSuccess("删除成功");

+ 5
- 5
文档/MYSQL/smartCommunity.pdb View File

@@ -1,5 +1,5 @@
1 1
 <?xml version="1.0" encoding="UTF-8"?>
2
-<?PowerDesigner AppLocale="UTF16" ID="{1EFA7B8F-E5BE-422B-A0AE-B907AA87924F}" Label="" LastModificationDate="1542770145" Name="smartCommunity" Objects="655" Symbols="78" Target="MySQL 5.0" Type="{CDE44E21-9669-11D1-9914-006097355D9B}" signature="PDM_DATA_MODEL_XML" version="16.5.0.3982"?>
2
+<?PowerDesigner AppLocale="UTF16" ID="{1EFA7B8F-E5BE-422B-A0AE-B907AA87924F}" Label="" LastModificationDate="1542791427" Name="smartCommunity" Objects="656" Symbols="78" Target="MySQL 5.0" Type="{CDE44E21-9669-11D1-9914-006097355D9B}" signature="PDM_DATA_MODEL_XML" version="16.5.0.3982"?>
3 3
 <!-- do not edit this file -->
4 4
 
5 5
 <Model xmlns:a="attribute" xmlns:c="collection" xmlns:o="object">
@@ -5945,9 +5945,9 @@ LABL 0 新宋体,8,N</a:FontList>
5945 5945
 </o:TableSymbol>
5946 5946
 <o:TableSymbol Id="o159">
5947 5947
 <a:CreationDate>1542706044</a:CreationDate>
5948
-<a:ModificationDate>1542706044</a:ModificationDate>
5948
+<a:ModificationDate>1542791427</a:ModificationDate>
5949 5949
 <a:IconMode>-1</a:IconMode>
5950
-<a:Rect>((-21601,-60687), (-4813,-54689))</a:Rect>
5950
+<a:Rect>((-22201,-62967), (-5413,-56969))</a:Rect>
5951 5951
 <a:LineColor>12615680</a:LineColor>
5952 5952
 <a:FillColor>16570034</a:FillColor>
5953 5953
 <a:ShadowColor>12632256</a:ShadowColor>
@@ -9335,9 +9335,9 @@ LABL 0 新宋体,8,N</a:FontList>
9335 9335
 <a:Code>type</a:Code>
9336 9336
 <a:CreationDate>1539162638</a:CreationDate>
9337 9337
 <a:Creator>szc</a:Creator>
9338
-<a:ModificationDate>1539591244</a:ModificationDate>
9338
+<a:ModificationDate>1542791171</a:ModificationDate>
9339 9339
 <a:Modifier>szc</a:Modifier>
9340
-<a:Comment>类型    0 代表 报修  1 代表 投诉  2代表 联系单   字典</a:Comment>
9340
+<a:Comment>类型    2 代表 报修  1 代表 投诉  3代表 联系单   字典</a:Comment>
9341 9341
 <a:DataType>char(1)</a:DataType>
9342 9342
 <a:Length>1</a:Length>
9343 9343
 </o:Column>

+ 5
- 5
文档/MYSQL/smartCommunity.pdm View File

@@ -1,5 +1,5 @@
1 1
 <?xml version="1.0" encoding="UTF-8"?>
2
-<?PowerDesigner AppLocale="UTF16" ID="{1EFA7B8F-E5BE-422B-A0AE-B907AA87924F}" Label="" LastModificationDate="1542770145" Name="smartCommunity" Objects="655" Symbols="78" Target="MySQL 5.0" Type="{CDE44E21-9669-11D1-9914-006097355D9B}" signature="PDM_DATA_MODEL_XML" version="16.5.0.3982"?>
2
+<?PowerDesigner AppLocale="UTF16" ID="{1EFA7B8F-E5BE-422B-A0AE-B907AA87924F}" Label="" LastModificationDate="1542791427" Name="smartCommunity" Objects="656" Symbols="78" Target="MySQL 5.0" Type="{CDE44E21-9669-11D1-9914-006097355D9B}" signature="PDM_DATA_MODEL_XML" version="16.5.0.3982"?>
3 3
 <!-- do not edit this file -->
4 4
 
5 5
 <Model xmlns:a="attribute" xmlns:c="collection" xmlns:o="object">
@@ -5945,9 +5945,9 @@ LABL 0 新宋体,8,N</a:FontList>
5945 5945
 </o:TableSymbol>
5946 5946
 <o:TableSymbol Id="o159">
5947 5947
 <a:CreationDate>1542706044</a:CreationDate>
5948
-<a:ModificationDate>1542706044</a:ModificationDate>
5948
+<a:ModificationDate>1542791427</a:ModificationDate>
5949 5949
 <a:IconMode>-1</a:IconMode>
5950
-<a:Rect>((-21601,-60687), (-4813,-54689))</a:Rect>
5950
+<a:Rect>((-22201,-62967), (-5413,-56969))</a:Rect>
5951 5951
 <a:LineColor>12615680</a:LineColor>
5952 5952
 <a:FillColor>16570034</a:FillColor>
5953 5953
 <a:ShadowColor>12632256</a:ShadowColor>
@@ -9335,9 +9335,9 @@ LABL 0 新宋体,8,N</a:FontList>
9335 9335
 <a:Code>type</a:Code>
9336 9336
 <a:CreationDate>1539162638</a:CreationDate>
9337 9337
 <a:Creator>szc</a:Creator>
9338
-<a:ModificationDate>1539591244</a:ModificationDate>
9338
+<a:ModificationDate>1542791171</a:ModificationDate>
9339 9339
 <a:Modifier>szc</a:Modifier>
9340
-<a:Comment>类型    0 代表 报修  1 代表 投诉  2代表 联系单   字典</a:Comment>
9340
+<a:Comment>类型    2 代表 报修  1 代表 投诉  3代表 联系单   字典</a:Comment>
9341 9341
 <a:DataType>char(1)</a:DataType>
9342 9342
 <a:Length>1</a:Length>
9343 9343
 </o:Column>