dingxin 6 lat temu
rodzic
commit
231a3906cf

+ 14
- 1
CODE/smart-community/app-api/src/main/java/com/community/huiju/controller/SocialController.java Wyświetl plik

@@ -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 Wyświetl plik

@@ -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 Wyświetl plik

@@ -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 Wyświetl plik

@@ -379,17 +379,45 @@ public class SocialServiceImpl implements SocialServiceI {
379 379
     }
380 380
 
381 381
     @Override
382
+    @Transactional(rollbackFor = Exception.class)
382 383
     public ResponseBean updateTransaction(String paramets,Integer userId) {
383 384
         ResponseBean response = new ResponseBean();
384 385
         JSONObject jsonObject = JSONObject.parseObject(paramets);
385 386
         String id = (String) jsonObject.get("id");
386
-        String transactionTitle = (String) jsonObject.get("title");
387
-        String transactionContent = (String) jsonObject.get("content");
387
+        String transactionTitle = (String) jsonObject.get("transactionTitle");
388
+        String transactionContent = (String) jsonObject.get("transactionContent");
389
+        String imageUrl = (String) jsonObject.get("imageUrl");
390
+        TpTransaction tpTransaction = JSONObject.parseObject(paramets,TpTransaction.class);
391
+
392
+        tdImagesMapper.deleteTdImages( Integer.valueOf(id),Constant.TRANSACTION);
393
+        try {
394
+            insertTdImage(tpTransaction, imageUrl, userId,Constant.TRANSACTION);
395
+        } catch (IOException e) {
396
+            e.printStackTrace();
397
+            throw new RuntimeException("图片修改异常");
398
+        }
388 399
         tpTransactionMapper.updateTransaction(Integer.valueOf(id),transactionTitle,transactionContent,userId);
389 400
         response.addSuccess("修改成功");
390 401
         return response;
391 402
     }
392 403
 
404
+    @Override
405
+    public ResponseBean deleteransaction(String paramets) {
406
+        ResponseBean responseBean= new ResponseBean();
407
+        JSONObject jsonObject = JSONObject.parseObject(paramets);
408
+        String id = (String) jsonObject.get("id");
409
+        TpTransaction tpTransaction=tpTransactionMapper.getById(Integer.valueOf(id));
410
+        if(null!= tpTransaction) {
411
+            tpTransaction.setStatus("0");
412
+            tpTransactionMapper.updateByPrimaryKeySelective(tpTransaction);
413
+            responseBean.addSuccess("删除成功");
414
+        }else {
415
+            responseBean.addSuccess("当前ID不存在");
416
+        }
417
+        return responseBean;
418
+        }
419
+
420
+
393 421
     @Override
394 422
     public void accessTicket(Integer communityId, TpTicket tpTicket, String ticketId, Integer userId) {
395 423
         //修改工单内容和评分
@@ -436,7 +464,8 @@ public class SocialServiceImpl implements SocialServiceI {
436 464
         responseBean.addSuccess("取消报名成功");
437 465
         return responseBean;
438 466
     }
439
-    
467
+
468
+
440 469
     public ResponseBean insertActivitySignUp(TpActivity tpActivity, Integer communityId, Integer userId,String remark){
441 470
         ResponseBean responseBean = new ResponseBean();
442 471
         //判断是否已经报名

+ 5
- 0
CODE/smart-community/app-api/src/main/resources/mapper/TdImagesMapper.xml Wyświetl plik

@@ -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>