소스 검색

修复 bug 4609

魏熙美 6 년 전
부모
커밋
1412fd08f4

+ 12
- 0
CODE/smart-community/app-api/src/main/java/com/community/huiju/dao/TpActivityMapper.java 파일 보기

@@ -4,6 +4,8 @@ package com.community.huiju.dao;
4 4
 import com.community.huiju.model.TpActivity;
5 5
 import org.apache.ibatis.annotations.Mapper;
6 6
 import org.apache.ibatis.annotations.Param;
7
+import org.apache.ibatis.annotations.ResultMap;
8
+import org.apache.ibatis.annotations.Select;
7 9
 
8 10
 import java.util.List;
9 11
 
@@ -40,4 +42,14 @@ public interface TpActivityMapper {
40 42
     List<TpActivity> selecttpActivity(@Param("id") Integer id, @Param("communityId") Integer communityId);
41 43
 
42 44
     TpActivity selectActivity(@Param("activityId") Integer activityId);
45
+
46
+    /**
47
+     * 根据id 查询数据活动
48
+     * @param activityId
49
+     * @return
50
+     */
51
+    @ResultMap("BaseResultMap")
52
+    @Select("select * from tp_activity where id=#{activityId}")
53
+    TpActivity selectById(@Param("activityId") Integer activityId);
54
+
43 55
 }

+ 12
- 1
CODE/smart-community/app-api/src/main/java/com/community/huiju/service/impl/SocialServiceImpl.java 파일 보기

@@ -268,7 +268,18 @@ public class SocialServiceImpl implements SocialServiceI {
268 268
     @Override
269 269
     public ResponseBean findTaUserInfo(UserElement userElement, Integer activityId, Integer communityId, String remark) {
270 270
         ResponseBean responseBean = new ResponseBean();
271
-        TpActivity tpActivity = tpActivityMapper.selectByPrimaryKey(activityId, communityId);
271
+        TpActivity tpActivity = tpActivityMapper.selectById(activityId);
272
+
273
+        if (null == tpActivity) {
274
+            responseBean.addError("活动不存在");
275
+            return responseBean;
276
+        }
277
+
278
+        if (communityId.intValue() != tpActivity.getCommunityId().intValue()) {
279
+            responseBean.addError("活动不属于当前小区,请到个人中心切换房产后再报名");
280
+            return responseBean;
281
+        }
282
+
272 283
         //判断是否已经过了报名截至时间
273 284
         Date registrEndTime = tpActivity.getRegistrationEndTime();
274 285
         if (registrEndTime.compareTo(new Date()) < 0) {