Quellcode durchsuchen

合并本地分支

weiximei vor 6 Jahren
Ursprung
Commit
e5e140c782

+ 14
- 1
CODE/smart-community/app-api/src/main/java/com/community/huiju/controller/SocialController.java Datei anzeigen

@@ -302,7 +302,7 @@ 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,title:小区标题,content:小区内容"),
305
+                    "id:帖子id,imageUrl:图片url,transactionTitle:小区标题,transactionContent:小区内容"),
306 306
             @ApiImplicitParam(paramType = "header",dataType = "String",name = "X-Auth-Token",value = "Token")
307 307
     })
308 308
     @RequestMapping(value = "/updateTransaction/{Id}", method = RequestMethod.PUT)
@@ -314,6 +314,19 @@ public class SocialController extends BaseController {
314 314
         return response;
315 315
     }
316 316
 
317
+    @ApiOperation(value = "删除二手租赁帖子", notes = "删除二手租赁帖子")
318
+    @ApiImplicitParams({
319
+            @ApiImplicitParam(paramType = "body", dataType = "String", name = "paramets", value =
320
+                    "id:帖子id"),
321
+            @ApiImplicitParam(paramType = "header",dataType = "String",name = "X-Auth-Token",value = "Token")
322
+    })
323
+    @RequestMapping(value = "/deleteTransaction/{Id}", method = RequestMethod.PUT)
324
+    public ResponseBean deleteTransaction(HttpSession session, @RequestBody String paramets) {
325
+        ResponseBean response = socialServiceI.deleteransaction(paramets);
326
+        return response;
327
+    }
328
+
329
+
317 330
     @ApiOperation(value = "评价工单内容以及评分", notes = "评价工单内容以及评分")
318 331
     @ApiImplicitParams({@ApiImplicitParam(paramType = "path", dataType = "integer", name = "communityId", value = "小区Id"),
319 332
             @ApiImplicitParam(name = "tpTicket", value = "报修", required = true, dataType = "TpTicket"),

+ 8
- 0
CODE/smart-community/app-api/src/main/java/com/community/huiju/dao/TdImagesMapper.java Datei anzeigen

@@ -2,6 +2,7 @@ package com.community.huiju.dao;
2 2
 
3 3
 import com.community.huiju.model.TdImages;
4 4
 import org.apache.ibatis.annotations.Mapper;
5
+import org.apache.ibatis.annotations.Param;
5 6
 
6 7
 import java.util.List;
7 8
 import java.util.Map;
@@ -36,4 +37,11 @@ public interface TdImagesMapper {
36 37
      * @return
37 38
      */
38 39
     int insertBatch(List<TdImages> list);
40
+
41
+    /**
42
+     * 修改时删除当前图片
43
+     * @param uuid
44
+     * @param type
45
+     */
46
+    void deleteTdImages(@Param("uuid") Integer uuid, @Param("type") String type);
39 47
 }

+ 7
- 0
CODE/smart-community/app-api/src/main/java/com/community/huiju/service/SocialServiceI.java Datei anzeigen

@@ -135,4 +135,11 @@ public interface SocialServiceI {
135 135
 	 * @return
136 136
 	 */
137 137
 	ResponseBean cancelSignActivity(Integer activityId, Integer communityId, Integer userId);
138
+
139
+	/**
140
+	 * 删除二手租赁帖子
141
+ 	 * @param paramets
142
+	 * @return
143
+	 */
144
+	ResponseBean deleteransaction(String paramets);
138 145
 }

+ 32
- 3
CODE/smart-community/app-api/src/main/java/com/community/huiju/service/impl/SocialServiceImpl.java Datei anzeigen

@@ -382,17 +382,45 @@ public class SocialServiceImpl implements SocialServiceI {
382 382
     }
383 383
 
384 384
     @Override
385
+    @Transactional(rollbackFor = Exception.class)
385 386
     public ResponseBean updateTransaction(String paramets,Integer userId) {
386 387
         ResponseBean response = new ResponseBean();
387 388
         JSONObject jsonObject = JSONObject.parseObject(paramets);
388 389
         String id = (String) jsonObject.get("id");
389
-        String transactionTitle = (String) jsonObject.get("title");
390
-        String transactionContent = (String) jsonObject.get("content");
390
+        String transactionTitle = (String) jsonObject.get("transactionTitle");
391
+        String transactionContent = (String) jsonObject.get("transactionContent");
392
+        String imageUrl = (String) jsonObject.get("imageUrl");
393
+        TpTransaction tpTransaction = JSONObject.parseObject(paramets,TpTransaction.class);
394
+
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
+        }
391 402
         tpTransactionMapper.updateTransaction(Integer.valueOf(id),transactionTitle,transactionContent,userId);
392 403
         response.addSuccess("修改成功");
393 404
         return response;
394 405
     }
395 406
 
407
+    @Override
408
+    public ResponseBean deleteransaction(String paramets) {
409
+        ResponseBean responseBean= new ResponseBean();
410
+        JSONObject jsonObject = JSONObject.parseObject(paramets);
411
+        String id = (String) jsonObject.get("id");
412
+        TpTransaction tpTransaction=tpTransactionMapper.getById(Integer.valueOf(id));
413
+        if(null!= tpTransaction) {
414
+            tpTransaction.setStatus("0");
415
+            tpTransactionMapper.updateByPrimaryKeySelective(tpTransaction);
416
+            responseBean.addSuccess("删除成功");
417
+        }else {
418
+            responseBean.addSuccess("当前ID不存在");
419
+        }
420
+        return responseBean;
421
+        }
422
+
423
+
396 424
     @Override
397 425
     public void accessTicket(Integer communityId, TpTicket tpTicket, String ticketId, Integer userId) {
398 426
         //修改工单内容和评分
@@ -439,7 +467,8 @@ public class SocialServiceImpl implements SocialServiceI {
439 467
         responseBean.addSuccess("取消报名成功");
440 468
         return responseBean;
441 469
     }
442
-    
470
+
471
+
443 472
     public ResponseBean insertActivitySignUp(TpActivity tpActivity, Integer communityId, Integer userId,String remark){
444 473
         ResponseBean responseBean = new ResponseBean();
445 474
         //判断是否已经报名

+ 5
- 0
CODE/smart-community/app-api/src/main/resources/mapper/TdImagesMapper.xml Datei anzeigen

@@ -130,4 +130,9 @@
130 130
 
131 131
   </insert>
132 132
 
133
+  <delete id="deleteTdImages" parameterType="map" >
134
+    delete from td_images
135
+    where uuid = #{uuid,jdbcType=INTEGER} and type = #{type,jdbcType=CHAR}
136
+  </delete>
137
+
133 138
 </mapper>