瀏覽代碼

修改活动4480

dingxin 6 年之前
父節點
當前提交
50514e497f

+ 2
- 0
CODE/smart-community/app-api/src/main/java/com/community/huiju/dao/TpActivityMapper.java 查看文件

@@ -38,4 +38,6 @@ public interface TpActivityMapper {
38 38
      * @return
39 39
      */
40 40
     List<TpActivity> selecttpActivity(@Param("id") Integer id, @Param("communityId") Integer communityId);
41
+
42
+    TpActivity selectActivity(@Param("activityId") Integer activityId);
41 43
 }

+ 1
- 0
CODE/smart-community/app-api/src/main/java/com/community/huiju/dao/TpActivitySignInMapper.java 查看文件

@@ -24,4 +24,5 @@ public interface TpActivitySignInMapper {
24 24
      *
25 25
      */
26 26
     TpActivitySignIn selectSing(@Param("activityId") Integer activityId,@Param("userID") Integer userID);
27
+
27 28
 }

+ 1
- 0
CODE/smart-community/app-api/src/main/java/com/community/huiju/dao/TpActivitySignupMapper.java 查看文件

@@ -1,6 +1,7 @@
1 1
 package com.community.huiju.dao;
2 2
 
3 3
 
4
+import com.community.huiju.model.TpActivitySignIn;
4 5
 import com.community.huiju.model.TpActivitySignup;
5 6
 import org.apache.ibatis.annotations.Mapper;
6 7
 import org.apache.ibatis.annotations.Param;

+ 11
- 1
CODE/smart-community/app-api/src/main/java/com/community/huiju/model/TpActivity.java 查看文件

@@ -42,7 +42,17 @@ public class TpActivity {
42 42
     private Date updateDate;
43 43
     
44 44
     private String userName;
45
-    
45
+
46
+    private String signInCode;
47
+
48
+    public String getSignInCode() {
49
+        return signInCode;
50
+    }
51
+
52
+    public void setSignInCode(String signInCode) {
53
+        this.signInCode = signInCode;
54
+    }
55
+
46 56
     /**
47 57
      * 报名状态
48 58
      */

+ 27
- 1
CODE/smart-community/app-api/src/main/java/com/community/huiju/service/impl/SocialServiceImpl.java 查看文件

@@ -645,6 +645,32 @@ public class SocialServiceImpl implements SocialServiceI {
645 645
     public ResponseBean tpActivitySignInAdd(String paramets, UserElement userElement) {
646 646
         ResponseBean responseBean = new ResponseBean();
647 647
         Integer activityId = JSONObject.parseObject(paramets).getInteger("activityId");
648
+        // 校验扫码签到
649
+        TpActivity tpActivity = tpActivityMapper.selectByPrimaryKey(activityId,userElement.getCommunityId());
650
+        /*当前用户扫的是否是本小区的码*/
651
+        TpActivity activity = tpActivityMapper.selectActivity(activityId);
652
+        if (null!=activity && (!userElement.getCommunityId().equals(activity.getCommunityId()))){
653
+            responseBean.addError("活动不属于当前登录小区,请在个人中心切换小区");
654
+            return responseBean;
655
+        }
656
+        /*查看当前用户是否报名*/
657
+         TpActivitySignup signIn= tpActivitySignupMapper.selectTpActivetitySignByUserId(activityId,userElement.getCommunityId(),userElement.getUserVerifyId());
658
+        if (signIn == null){
659
+            responseBean.addError("请先报名");
660
+            return responseBean;
661
+        }
662
+        /*活动不需要签到*/
663
+
664
+        if (null!=tpActivity && "2".equals(tpActivity.getSignInCode())){
665
+            responseBean.addError("活动已不能签到");
666
+            return responseBean;
667
+        }
668
+        /*活动作废*/
669
+        if (null!=tpActivity && "0".equals(tpActivity.getStatus())){
670
+            responseBean.addError("活动已被作废");
671
+            return responseBean;
672
+        }
673
+
648 674
         TpActivitySignIn tpActivitySignIn = new TpActivitySignIn();
649 675
         tpActivitySignIn.setActivityId(activityId);
650 676
         tpActivitySignIn.setCommunityId(userElement.getCommunityId());
@@ -787,7 +813,7 @@ public class SocialServiceImpl implements SocialServiceI {
787 813
         TpActivitySignup tpActivitySignup = new TpActivitySignup();
788 814
         tpActivitySignup.setActivityId(tpActivity.getId());
789 815
         tpActivitySignup.setCommunityId(communityId);
790
-        tpActivitySignup.setTaUserId(userElement.getId());
816
+        tpActivitySignup.setTaUserId(userElement.getUserVerifyId());
791 817
         tpActivitySignup.setSignUpTime(new Date());
792 818
         tpActivitySignup.setRemark(remark);
793 819
 

+ 19
- 4
CODE/smart-community/app-api/src/main/resources/mapper/TpActivityMapper.xml 查看文件

@@ -21,12 +21,14 @@
21 21
     <result column="create_date" property="createDate" jdbcType="TIMESTAMP" />
22 22
     <result column="update_user" property="updateUser" jdbcType="INTEGER" />
23 23
     <result column="update_date" property="updateDate" jdbcType="TIMESTAMP" />
24
+    <result column="sign_in_code" property="signInCode" jdbcType="VARCHAR" />
25
+
24 26
   </resultMap>
25 27
   <sql id="Base_Column_List" >
26 28
     id, community_id, activity_title, activity_carousel_img, activity_content, sort, 
27 29
     sign_up_count, sign_up_max, view_count, registration_start_time, registration_end_time, 
28 30
     activity_start_time, activity_end_time, status, create_user, create_date, update_user, 
29
-    update_date
31
+    update_date,sign_in_code
30 32
   </sql>
31 33
   <select id="selectByPrimaryKey" resultMap="BaseResultMap">
32 34
     select
@@ -45,14 +47,14 @@
45 47
       registration_start_time, registration_end_time, 
46 48
       activity_start_time, activity_end_time, 
47 49
       status, create_user, create_date, 
48
-      update_user, update_date)
50
+      update_user, update_date,sign_in_code,sign_in_code,sign_in_code)
49 51
     values (#{id,jdbcType=INTEGER}, #{communityId,jdbcType=INTEGER}, #{activityTitle,jdbcType=VARCHAR}, 
50 52
       #{activityCarouselImg,jdbcType=VARCHAR}, #{activityContent,jdbcType=LONGVARCHAR}, #{sort,jdbcType=INTEGER},
51 53
       #{signUpCount,jdbcType=INTEGER}, #{signUpMax,jdbcType=INTEGER}, #{viewCount,jdbcType=INTEGER}, 
52 54
       #{registrationStartTime,jdbcType=TIMESTAMP}, #{registrationEndTime,jdbcType=TIMESTAMP}, 
53 55
       #{activityStartTime,jdbcType=TIMESTAMP}, #{activityEndTime,jdbcType=TIMESTAMP}, 
54 56
       #{status,jdbcType=CHAR}, #{createUser,jdbcType=INTEGER}, #{createDate,jdbcType=TIMESTAMP}, 
55
-      #{updateUser,jdbcType=INTEGER}, #{updateDate,jdbcType=TIMESTAMP})
57
+      #{updateUser,jdbcType=INTEGER}, #{updateDate,jdbcType=TIMESTAMP},#{signInCode,jdbcType=TIMESTAMP})
56 58
   </insert>
57 59
   <insert id="insertSelective" parameterType="com.community.huiju.model.TpActivity" >
58 60
     insert into tp_activity
@@ -111,6 +113,9 @@
111 113
       <if test="updateDate != null" >
112 114
         update_date,
113 115
       </if>
116
+      <if test="signInCode != null" >
117
+        sign_in_code
118
+      </if>
114 119
     </trim>
115 120
     <trim prefix="values (" suffix=")" suffixOverrides="," >
116 121
       <if test="id != null" >
@@ -167,6 +172,9 @@
167 172
       <if test="updateDate != null" >
168 173
         #{updateDate,jdbcType=TIMESTAMP},
169 174
       </if>
175
+      <if test="signInCode != null" >
176
+        #{signInCode,jdbcType=VARCHAR},
177
+      </if>
170 178
     </trim>
171 179
   </insert>
172 180
   <update id="updateByPrimaryKeySelective" parameterType="com.community.huiju.model.TpActivity" >
@@ -223,6 +231,9 @@
223 231
       <if test="updateDate != null" >
224 232
         update_date = #{updateDate,jdbcType=TIMESTAMP},
225 233
       </if>
234
+      <if test="signInCode != null" >
235
+        sign_in_code = #{signInCode,jdbcType=VARCHAR}
236
+      </if>
226 237
     </set>
227 238
     where id = #{id,jdbcType=INTEGER}
228 239
   </update>
@@ -244,7 +255,8 @@
244 255
       create_user = #{createUser,jdbcType=INTEGER},
245 256
       create_date = #{createDate,jdbcType=TIMESTAMP},
246 257
       update_user = #{updateUser,jdbcType=INTEGER},
247
-      update_date = #{updateDate,jdbcType=TIMESTAMP}
258
+      update_date = #{updateDate,jdbcType=TIMESTAMP},
259
+      sign_in_code = #{signInCode,jdbcType=VARCHAR}
248 260
     where id = #{id,jdbcType=INTEGER}
249 261
   </update>
250 262
 
@@ -290,4 +302,7 @@
290 302
     AND tr.community_id =#{communityId}
291 303
     order by a.create_date desc
292 304
   </select>
305
+  <select id="selectActivity" resultMap="BaseResultMap">
306
+    select * from tp_activity where id = #{activityId}
307
+  </select>
293 308
 </mapper>

+ 10
- 0
CODE/smart-community/app-api/src/main/resources/mapper/TpActivitySignInMapper.xml 查看文件

@@ -149,4 +149,14 @@
149 149
     and ta_user_id = #{userID,jdbcType=INTEGER}
150 150
   </select>
151 151
 
152
+  <select id="toSignUp" resultMap="BaseResultMap">
153
+    select
154
+    <include refid="Base_Column_List" />
155
+    from
156
+    tp_activity_sign_in
157
+    where
158
+    activity_id = #{activityId,jdbcType=INTEGER}
159
+    and ta_user_id = #{userVerifyId,jdbcType=INTEGER}
160
+    and community_id = #{communityId,jdbcType=INTEGER}
161
+  </select>
152 162
 </mapper>