weiximei 6 лет назад
Родитель
Сommit
b3d5ac4830

+ 0
- 9
CODE/smart-community/app-api/src/main/java/com/community/huiju/controller/SocialController.java Просмотреть файл

@@ -444,14 +444,5 @@ public class SocialController extends BaseController {
444 444
         return response;
445 445
     }
446 446
 
447
-    @ApiOperation(value = "查询点赞次数", notes = "查询点赞次数")
448
-    @ApiImplicitParams({@ApiImplicitParam(paramType = "path", dataType = "integer", name = "id", value = "帖子id")})
449
-    @RequestMapping(value = "/transactionLikeList/{id}", method = RequestMethod.GET)
450
-    public ResponseBean transactionLikeList(@PathVariable("id") Integer id,HttpSession session) {
451
-        UserElement userElement = (UserElement) session.getAttribute(Constant.APP_USER_SESSION);
452
-        ResponseBean transactionLike = socialServiceI.transactionLikeList(id,userElement);
453
-        return transactionLike;
454
-    }
455
-
456 447
 
457 448
 }

+ 4
- 4
CODE/smart-community/app-api/src/main/java/com/community/huiju/dao/TpTransactionLikeMapper.java Просмотреть файл

@@ -1,8 +1,10 @@
1 1
 package com.community.huiju.dao;
2 2
 
3 3
 import com.community.huiju.model.TpTransactionLike;
4
+import org.apache.ibatis.annotations.Mapper;
4 5
 import org.apache.ibatis.annotations.Param;
5 6
 
7
+@Mapper
6 8
 public interface TpTransactionLikeMapper {
7 9
     int deleteByPrimaryKey(Integer id);
8 10
 
@@ -20,19 +22,17 @@ public interface TpTransactionLikeMapper {
20 22
      * 点赞
21 23
      * @param invitationId
22 24
      * @param communityId
23
-     * @param userId
24 25
      * @return
25 26
      */
26
-    Integer likeCount(@Param("invitationId") Integer invitationId, @Param("communityId") Integer communityId, @Param("userId") Integer userId);
27
+    Integer likeCount(@Param("invitationId") Integer invitationId, @Param("communityId") Integer communityId);
27 28
 
28 29
     /**
29 30
      * 踩
30 31
      * @param invitationId
31 32
      * @param communityId
32
-     * @param userId
33 33
      * @return
34 34
      */
35
-    Integer nolikeCount(@Param("invitationId") Integer invitationId, @Param("communityId") Integer communityId, @Param("userId") Integer userId);
35
+    Integer nolikeCount(@Param("invitationId") Integer invitationId, @Param("communityId") Integer communityId);
36 36
 
37 37
     /**
38 38
      * 查询当前人是否存在数据

+ 37
- 0
CODE/smart-community/app-api/src/main/java/com/community/huiju/model/TpTransaction.java Просмотреть файл

@@ -44,6 +44,20 @@ public class TpTransaction {
44 44
 
45 45
     private  String roleName;
46 46
 
47
+    /**
48
+     * 顶赞的次数
49
+     */
50
+    private Integer likeCount;
51
+    /**
52
+     * 踩的人数
53
+     */
54
+    private Integer noLikeCount;
55
+
56
+    /**
57
+     * 是否已点赞或者踩
58
+     */
59
+    private Boolean bel;
60
+
47 61
 
48 62
     public String getRoleName() {
49 63
         return roleName;
@@ -186,4 +200,27 @@ public class TpTransaction {
186 200
         this.createUserName = createUserName;
187 201
     }
188 202
 
203
+    public Integer getLikeCount() {
204
+        return likeCount;
205
+    }
206
+
207
+    public void setLikeCount(Integer likeCount) {
208
+        this.likeCount = likeCount;
209
+    }
210
+
211
+    public Integer getNoLikeCount() {
212
+        return noLikeCount;
213
+    }
214
+
215
+    public void setNoLikeCount(Integer noLikeCount) {
216
+        this.noLikeCount = noLikeCount;
217
+    }
218
+
219
+    public Boolean getBel() {
220
+        return bel;
221
+    }
222
+
223
+    public void setBel(Boolean bel) {
224
+        this.bel = bel;
225
+    }
189 226
 }

+ 1
- 7
CODE/smart-community/app-api/src/main/java/com/community/huiju/service/SocialServiceI.java Просмотреть файл

@@ -187,11 +187,5 @@ public interface SocialServiceI {
187 187
 	 */
188 188
     ResponseBean addTransactionReply(String paramets, UserElement userElement);
189 189
 
190
-	/**
191
-	 * 查询表帖子的点赞次数
192
-	 * @param id
193
-	 * @param userElement
194
-	 * @return
195
-	 */
196
-	ResponseBean transactionLikeList(Integer id, UserElement userElement);
190
+
197 191
 }

+ 19
- 21
CODE/smart-community/app-api/src/main/java/com/community/huiju/service/impl/SocialServiceImpl.java Просмотреть файл

@@ -604,27 +604,6 @@ public class SocialServiceImpl implements SocialServiceI {
604 604
         return response;
605 605
     }
606 606
 
607
-    @Override
608
-    public ResponseBean transactionLikeList(Integer invitationId, UserElement userElement) {
609
-        ResponseBean response= new ResponseBean();
610
-        TpTransactionLike tpTransactionLike= new TpTransactionLike();
611
-        //统计点赞人数的次数
612
-        Integer likeCount= tpTransactionLikeMapper.likeCount(invitationId,userElement.getCommunityId(),userElement.getId());
613
-        //不喜欢的人数
614
-        Integer noLikeCount= tpTransactionLikeMapper.nolikeCount(invitationId,userElement.getCommunityId(),userElement.getId());
615
-
616
-        tpTransactionLike.setLikeCount(likeCount);
617
-        tpTransactionLike.setNoLikeCount(noLikeCount);
618
-        // 查看点前用户是否点赞或踩
619
-        TpTransactionLike isUser= tpTransactionLikeMapper.getinvitationId(invitationId,userElement.getCommunityId(),userElement.getId());
620
-        if (null!=isUser){
621
-            tpTransactionLike.setBel(false);
622
-        }
623
-        response.addSuccess(tpTransactionLike);
624
-        return response;
625
-    }
626
-
627
-
628 607
     @Override
629 608
     public void accessTicket(Integer communityId, TpTicket tpTicket, String ticketId, Integer userId) {
630 609
         //修改工单内容和评分
@@ -760,6 +739,25 @@ public class SocialServiceImpl implements SocialServiceI {
760 739
         List<String> imgList = tdImagesList.stream().map(e->new String(e.getImageUrl())).collect(Collectors.toList());
761 740
         tpTransaction.setImgList(imgList);
762 741
 
742
+        /**
743
+         * 查询点赞和踩的次数
744
+         */
745
+
746
+
747
+        //统计点赞人数的次数
748
+        Integer likeCount= tpTransactionLikeMapper.likeCount(activityId, communityId);
749
+        //不喜欢的人数
750
+        Integer noLikeCount= tpTransactionLikeMapper.nolikeCount(activityId, communityId);
751
+        tpTransaction.setLikeCount(likeCount == null ? 0 : likeCount);
752
+        tpTransaction.setNoLikeCount(noLikeCount == null ? 0 : noLikeCount);
753
+
754
+        // 默认没有点赞或者踩
755
+        tpTransaction.setBel(false);
756
+        TpTransactionLike isUser= tpTransactionLikeMapper.getinvitationId(activityId,communityId, userId);
757
+        if (null!=isUser){
758
+            tpTransaction.setBel(true);
759
+        }
760
+
763 761
         return tpTransaction;
764 762
 
765 763
     }

+ 2
- 4
CODE/smart-community/app-api/src/main/resources/mapper/TpTransactionLikeMapper.xml Просмотреть файл

@@ -118,8 +118,7 @@
118 118
     SELECT COUNT(transaction_id) FROM
119 119
     tp_transaction_like
120 120
     WHERE like_status = 1
121
-    and   community_id = #{communityId,jdbcType=INTEGER},
122
-    and   ta_user_id = #{userId,jdbcType=INTEGER},
121
+    and   community_id = #{communityId,jdbcType=INTEGER}
123 122
     and   transaction_id = #{invitationId,jdbcType=INTEGER}
124 123
   </select>
125 124
 
@@ -127,8 +126,7 @@
127 126
     SELECT COUNT(transaction_id) FROM
128 127
     tp_transaction_like
129 128
     WHERE like_status = 2
130
-    and   community_id = #{communityId,jdbcType=INTEGER},
131
-    and   ta_user_id = #{userId,jdbcType=INTEGER},
129
+    and   community_id = #{communityId,jdbcType=INTEGER}
132 130
     and   transaction_id = #{invitationId,jdbcType=INTEGER}
133 131
   </select>
134 132