dingxin 6 years ago
parent
commit
231a3906cf

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

302
     @ApiOperation(value = "修改二手租赁帖子", notes = "修改二手租赁帖子")
302
     @ApiOperation(value = "修改二手租赁帖子", notes = "修改二手租赁帖子")
303
     @ApiImplicitParams({
303
     @ApiImplicitParams({
304
             @ApiImplicitParam(paramType = "body", dataType = "String", name = "paramets", value =
304
             @ApiImplicitParam(paramType = "body", dataType = "String", name = "paramets", value =
305
-                    "id:小区id,title:小区标题,content:小区内容"),
305
+                    "id:帖子id,imageUrl:图片url,transactionTitle:小区标题,transactionContent:小区内容"),
306
             @ApiImplicitParam(paramType = "header",dataType = "String",name = "X-Auth-Token",value = "Token")
306
             @ApiImplicitParam(paramType = "header",dataType = "String",name = "X-Auth-Token",value = "Token")
307
     })
307
     })
308
     @RequestMapping(value = "/updateTransaction/{Id}", method = RequestMethod.PUT)
308
     @RequestMapping(value = "/updateTransaction/{Id}", method = RequestMethod.PUT)
314
         return response;
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
     @ApiOperation(value = "评价工单内容以及评分", notes = "评价工单内容以及评分")
330
     @ApiOperation(value = "评价工单内容以及评分", notes = "评价工单内容以及评分")
318
     @ApiImplicitParams({@ApiImplicitParam(paramType = "path", dataType = "integer", name = "communityId", value = "小区Id"),
331
     @ApiImplicitParams({@ApiImplicitParam(paramType = "path", dataType = "integer", name = "communityId", value = "小区Id"),
319
             @ApiImplicitParam(name = "tpTicket", value = "报修", required = true, dataType = "TpTicket"),
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 View File

2
 
2
 
3
 import com.community.huiju.model.TdImages;
3
 import com.community.huiju.model.TdImages;
4
 import org.apache.ibatis.annotations.Mapper;
4
 import org.apache.ibatis.annotations.Mapper;
5
+import org.apache.ibatis.annotations.Param;
5
 
6
 
6
 import java.util.List;
7
 import java.util.List;
7
 import java.util.Map;
8
 import java.util.Map;
36
      * @return
37
      * @return
37
      */
38
      */
38
     int insertBatch(List<TdImages> list);
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 View File

135
 	 * @return
135
 	 * @return
136
 	 */
136
 	 */
137
 	ResponseBean cancelSignActivity(Integer activityId, Integer communityId, Integer userId);
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 View File

379
     }
379
     }
380
 
380
 
381
     @Override
381
     @Override
382
+    @Transactional(rollbackFor = Exception.class)
382
     public ResponseBean updateTransaction(String paramets,Integer userId) {
383
     public ResponseBean updateTransaction(String paramets,Integer userId) {
383
         ResponseBean response = new ResponseBean();
384
         ResponseBean response = new ResponseBean();
384
         JSONObject jsonObject = JSONObject.parseObject(paramets);
385
         JSONObject jsonObject = JSONObject.parseObject(paramets);
385
         String id = (String) jsonObject.get("id");
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
         tpTransactionMapper.updateTransaction(Integer.valueOf(id),transactionTitle,transactionContent,userId);
399
         tpTransactionMapper.updateTransaction(Integer.valueOf(id),transactionTitle,transactionContent,userId);
389
         response.addSuccess("修改成功");
400
         response.addSuccess("修改成功");
390
         return response;
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
     @Override
421
     @Override
394
     public void accessTicket(Integer communityId, TpTicket tpTicket, String ticketId, Integer userId) {
422
     public void accessTicket(Integer communityId, TpTicket tpTicket, String ticketId, Integer userId) {
395
         //修改工单内容和评分
423
         //修改工单内容和评分
436
         responseBean.addSuccess("取消报名成功");
464
         responseBean.addSuccess("取消报名成功");
437
         return responseBean;
465
         return responseBean;
438
     }
466
     }
439
-    
467
+
468
+
440
     public ResponseBean insertActivitySignUp(TpActivity tpActivity, Integer communityId, Integer userId,String remark){
469
     public ResponseBean insertActivitySignUp(TpActivity tpActivity, Integer communityId, Integer userId,String remark){
441
         ResponseBean responseBean = new ResponseBean();
470
         ResponseBean responseBean = new ResponseBean();
442
         //判断是否已经报名
471
         //判断是否已经报名

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

130
 
130
 
131
   </insert>
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
 </mapper>
138
 </mapper>