dingxin il y a 6 ans
Parent
révision
a5f6ac8406

+ 52
- 3
CODE/smart-community/app-api/src/main/java/com/community/huiju/controller/SocialController.java Voir le fichier

@@ -56,8 +56,12 @@ public class SocialController extends BaseController {
56 56
     @ApiOperation(value = "活动报名接口", notes = "活动报名接口")
57 57
     @ApiImplicitParams({@ApiImplicitParam(paramType = "path", dataType = "integer", name = "communityId", value = "小区Id"),
58 58
             @ApiImplicitParam(paramType = "query", dataType = "integer", name = "activityId", value = "活动Id"),
59
+            @ApiImplicitParam(paramType = "query", dataType = "String", name = "remark", value = "活动备注"),
59 60
             @ApiImplicitParam(paramType = "header",dataType = "String",name = "X-Auth-Token",value = "Token")})
60
-    public ResponseBean SignActivity(@PathVariable(value = "communityId") Integer communityId, @RequestParam("activityId") Integer activityId, HttpSession session) {
61
+    public ResponseBean SignActivity(@PathVariable(value = "communityId") Integer communityId,
62
+                                     @RequestParam(value = "remark", required = false) String remark,
63
+                                     @RequestParam("activityId") Integer activityId,
64
+                                     HttpSession session) {
61 65
         UserElement userElement = (UserElement) session.getAttribute(Constant.APP_USER_SESSION);
62 66
         Integer userId = userElement.getId();
63 67
 
@@ -68,9 +72,54 @@ public class SocialController extends BaseController {
68 72
             return responseBean;
69 73
         }
70 74
 
71
-        responseBean = socialServiceI.findTaUserInfo(activityId, communityId, userId);
75
+        responseBean = socialServiceI.findTaUserInfo(activityId, communityId, userId,remark);
72 76
         return responseBean;
73 77
     }
78
+    
79
+    @RequestMapping(value = "/sign/cancel/{communityId}", method = RequestMethod.POST)
80
+    @ApiOperation(value = "取消活动报名接口", notes = "取消活动报名接口")
81
+    @ApiImplicitParams({@ApiImplicitParam(paramType = "path", dataType = "integer", name = "communityId", value = "小区Id"),
82
+            @ApiImplicitParam(paramType = "query", dataType = "integer", name = "activityId", value = "活动Id"),
83
+            @ApiImplicitParam(paramType = "header",dataType = "String",name = "X-Auth-Token",value = "Token")})
84
+    public ResponseBean cancelSignActivity(@PathVariable(value = "communityId") Integer communityId, @RequestParam("activityId") Integer activityId, HttpSession session) {
85
+        UserElement userElement = (UserElement) session.getAttribute(Constant.APP_USER_SESSION);
86
+        Integer userId = userElement.getId();
87
+        
88
+        ResponseBean responseBean = new ResponseBean();
89
+        
90
+        if (!check(communityId)) {
91
+            responseBean.addError("小区不存在");
92
+            return responseBean;
93
+        }
94
+        //取消报名
95
+        responseBean = socialServiceI.cancelSignActivity(activityId, communityId, userId);
96
+        return responseBean;
97
+    }
98
+
99
+
100
+    @RequestMapping(value = "/sign/{communityId}", method = RequestMethod.PUT)
101
+    @ApiOperation(value = "修改活动报名接口", notes = "修改活动报名接口")
102
+    @ApiImplicitParams({@ApiImplicitParam(paramType = "path", dataType = "integer", name = "communityId", value = "小区Id"),
103
+            @ApiImplicitParam(paramType = "query", dataType = "integer", name = "activityId", value = "活动Id"),
104
+            @ApiImplicitParam(paramType = "query", dataType = "String", name = "remark", value = "活动备注"),
105
+            @ApiImplicitParam(paramType = "header",dataType = "String",name = "X-Auth-Token",value = "Token")})
106
+    public ResponseBean updateSignActivity(@PathVariable(value = "communityId") Integer communityId,
107
+                                     @RequestParam(value = "remark", required = false) String remark,
108
+                                     @RequestParam("activityId") Integer activityId,
109
+                                     HttpSession session) {
110
+        UserElement userElement = (UserElement) session.getAttribute(Constant.APP_USER_SESSION);
111
+        Integer userId = userElement.getId();
112
+
113
+        ResponseBean responseBean = new ResponseBean();
114
+        if (!check(communityId)) {
115
+            responseBean.addError("小区不存在");
116
+            return responseBean;
117
+        }
118
+
119
+        responseBean = socialServiceI.updateActivtiySignUp(activityId, communityId, userId,remark);
120
+        return responseBean;
121
+    }
122
+
74 123
 
75 124
     @ApiOperation(value = "按小区获取分页公告列表", notes = "按小区获取分页公告列表,公告标题模糊查询")
76 125
     @ApiImplicitParams({@ApiImplicitParam(paramType = "path", dataType = "String", name = "communityId", value = "小区Id"),
@@ -240,7 +289,7 @@ public class SocialController extends BaseController {
240 289
     })
241 290
     @RequestMapping(value = "/selectAllTransaction", method = RequestMethod.GET)
242 291
     public ResponseBean selectAllTransaction(HttpSession session,
243
-                                             @RequestParam("type") Integer type,
292
+                                             @RequestParam(value = "type",required = false) Integer type,
244 293
                                              @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
245 294
                                              @RequestParam(value = "pageSize", defaultValue = "5") Integer pageSize) {
246 295
         ResponseBean responseBean = new ResponseBean();

+ 17
- 0
CODE/smart-community/app-api/src/main/java/com/community/huiju/dao/TpActivitySignupMapper.java Voir le fichier

@@ -22,4 +22,21 @@ public interface TpActivitySignupMapper {
22 22
     Integer sumActivitySignUpNum(@Param("id")Integer id, @Param("communityId")Integer communityId);
23 23
 
24 24
     Integer findTpActivetitySignByUserId(@Param("activityId") Integer activityId, @Param("communityId")Integer communityId, @Param("userId")Integer userId);
25
+
26
+    /**
27
+     * 获取报名总人数
28
+     * @param tpActivitySignup
29
+     * @return
30
+     */
31
+    Integer selectSignNum(TpActivitySignup tpActivitySignup);
32
+    
33
+    /**
34
+     * 删除报名
35
+     * @param tpActivitySignup
36
+     * @return
37
+     */
38
+    Integer deleteSignUp(TpActivitySignup tpActivitySignup);
39
+    
40
+    TpActivitySignup selectTpActivetitySignByUserId(@Param("activityId") Integer activityId, @Param("communityId")Integer communityId, @Param("userId")Integer userId);
41
+
25 42
 }

+ 19
- 0
CODE/smart-community/app-api/src/main/java/com/community/huiju/dao/TpUserMapper.java Voir le fichier

@@ -0,0 +1,19 @@
1
+package com.community.huiju.dao;
2
+
3
+import com.community.huiju.model.TpUser;
4
+import org.apache.ibatis.annotations.Mapper;
5
+
6
+@Mapper
7
+public interface TpUserMapper {
8
+    int deleteByPrimaryKey(Integer id);
9
+
10
+    int insert(TpUser record);
11
+
12
+    int insertSelective(TpUser record);
13
+
14
+    TpUser selectByPrimaryKey(Integer id);
15
+
16
+    int updateByPrimaryKeySelective(TpUser record);
17
+
18
+    int updateByPrimaryKey(TpUser record);
19
+}

+ 24
- 0
CODE/smart-community/app-api/src/main/java/com/community/huiju/model/TpActivity.java Voir le fichier

@@ -1,6 +1,7 @@
1 1
 package com.community.huiju.model;
2 2
 
3 3
 import java.util.Date;
4
+import java.util.List;
4 5
 
5 6
 public class TpActivity {
6 7
     private Integer id;
@@ -40,6 +41,13 @@ public class TpActivity {
40 41
     private Date updateDate;
41 42
     
42 43
     private String userName;
44
+    
45
+    /**
46
+     * 报名状态
47
+     */
48
+    private String signStatus;
49
+
50
+    private List<String> imgList;
43 51
 
44 52
     public Integer getId() {
45 53
         return id;
@@ -192,4 +200,20 @@ public class TpActivity {
192 200
     public void setUserName(String userName) {
193 201
         this.userName = userName;
194 202
     }
203
+    
204
+    public String getSignStatus() {
205
+        return signStatus;
206
+    }
207
+    
208
+    public void setSignStatus(String signStatus) {
209
+        this.signStatus = signStatus;
210
+    }
211
+    
212
+    public List<String> getImgList() {
213
+        return imgList;
214
+    }
215
+
216
+    public void setImgList(List<String> imgList) {
217
+        this.imgList = imgList;
218
+    }
195 219
 }

+ 11
- 0
CODE/smart-community/app-api/src/main/java/com/community/huiju/model/TpAnnouncement.java Voir le fichier

@@ -1,6 +1,7 @@
1 1
 package com.community.huiju.model;
2 2
 
3 3
 import java.util.Date;
4
+import java.util.List;
4 5
 
5 6
 public class TpAnnouncement {
6 7
     private Integer id;
@@ -31,6 +32,8 @@ public class TpAnnouncement {
31 32
 
32 33
     private Date updateDate;
33 34
 
35
+    private List<String> imgList;
36
+
34 37
     public Integer getId() {
35 38
         return id;
36 39
     }
@@ -142,4 +145,12 @@ public class TpAnnouncement {
142 145
     public void setUserName(String userName) {
143 146
         this.userName = userName;
144 147
     }
148
+
149
+    public List<String> getImgList() {
150
+        return imgList;
151
+    }
152
+
153
+    public void setImgList(List<String> imgList) {
154
+        this.imgList = imgList;
155
+    }
145 156
 }

+ 11
- 0
CODE/smart-community/app-api/src/main/java/com/community/huiju/model/TpTransaction.java Voir le fichier

@@ -1,6 +1,7 @@
1 1
 package com.community.huiju.model;
2 2
 
3 3
 import java.util.Date;
4
+import java.util.List;
4 5
 
5 6
 public class TpTransaction {
6 7
     private Integer id;
@@ -27,6 +28,8 @@ public class TpTransaction {
27 28
 
28 29
     private Date updateDate;
29 30
 
31
+    private List<String> imgList;
32
+
30 33
     private  Integer roleId;
31 34
 
32 35
     private  String roleName;
@@ -139,4 +142,12 @@ public class TpTransaction {
139 142
     public void setUpdateDate(Date updateDate) {
140 143
         this.updateDate = updateDate;
141 144
     }
145
+
146
+    public List<String> getImgList() {
147
+        return imgList;
148
+    }
149
+
150
+    public void setImgList(List<String> imgList) {
151
+        this.imgList = imgList;
152
+    }
142 153
 }

+ 135
- 0
CODE/smart-community/app-api/src/main/java/com/community/huiju/model/TpUser.java Voir le fichier

@@ -0,0 +1,135 @@
1
+package com.community.huiju.model;
2
+
3
+import java.util.Date;
4
+
5
+public class TpUser {
6
+    private Integer id;
7
+
8
+    private Integer communityId;
9
+
10
+    private String userName;
11
+
12
+    private String loginName;
13
+
14
+    private String loginPassword;
15
+
16
+    private String status;
17
+
18
+    private String remark;
19
+
20
+    private String email;
21
+
22
+    private String headPortrait;
23
+
24
+    private Integer createUser;
25
+
26
+    private Date createDate;
27
+
28
+    private Integer updateUser;
29
+
30
+    private Date updateDate;
31
+
32
+    public Integer getId() {
33
+        return id;
34
+    }
35
+
36
+    public void setId(Integer id) {
37
+        this.id = id;
38
+    }
39
+
40
+    public Integer getCommunityId() {
41
+        return communityId;
42
+    }
43
+
44
+    public void setCommunityId(Integer communityId) {
45
+        this.communityId = communityId;
46
+    }
47
+
48
+    public String getUserName() {
49
+        return userName;
50
+    }
51
+
52
+    public void setUserName(String userName) {
53
+        this.userName = userName == null ? null : userName.trim();
54
+    }
55
+
56
+    public String getLoginName() {
57
+        return loginName;
58
+    }
59
+
60
+    public void setLoginName(String loginName) {
61
+        this.loginName = loginName == null ? null : loginName.trim();
62
+    }
63
+
64
+    public String getLoginPassword() {
65
+        return loginPassword;
66
+    }
67
+
68
+    public void setLoginPassword(String loginPassword) {
69
+        this.loginPassword = loginPassword == null ? null : loginPassword.trim();
70
+    }
71
+
72
+    public String getStatus() {
73
+        return status;
74
+    }
75
+
76
+    public void setStatus(String status) {
77
+        this.status = status == null ? null : status.trim();
78
+    }
79
+
80
+    public String getRemark() {
81
+        return remark;
82
+    }
83
+
84
+    public void setRemark(String remark) {
85
+        this.remark = remark == null ? null : remark.trim();
86
+    }
87
+
88
+    public String getEmail() {
89
+        return email;
90
+    }
91
+
92
+    public void setEmail(String email) {
93
+        this.email = email == null ? null : email.trim();
94
+    }
95
+
96
+    public String getHeadPortrait() {
97
+        return headPortrait;
98
+    }
99
+
100
+    public void setHeadPortrait(String headPortrait) {
101
+        this.headPortrait = headPortrait == null ? null : headPortrait.trim();
102
+    }
103
+
104
+    public Integer getCreateUser() {
105
+        return createUser;
106
+    }
107
+
108
+    public void setCreateUser(Integer createUser) {
109
+        this.createUser = createUser;
110
+    }
111
+
112
+    public Date getCreateDate() {
113
+        return createDate;
114
+    }
115
+
116
+    public void setCreateDate(Date createDate) {
117
+        this.createDate = createDate;
118
+    }
119
+
120
+    public Integer getUpdateUser() {
121
+        return updateUser;
122
+    }
123
+
124
+    public void setUpdateUser(Integer updateUser) {
125
+        this.updateUser = updateUser;
126
+    }
127
+
128
+    public Date getUpdateDate() {
129
+        return updateDate;
130
+    }
131
+
132
+    public void setUpdateDate(Date updateDate) {
133
+        this.updateDate = updateDate;
134
+    }
135
+}

+ 36
- 1
CODE/smart-community/app-api/src/main/java/com/community/huiju/service/SocialServiceI.java Voir le fichier

@@ -12,6 +12,14 @@ import java.util.List;
12 12
  * @date 2018/10/23
13 13
  */
14 14
 public interface SocialServiceI {
15
+
16
+	/**
17
+	 * 查看公告详情
18
+	 * @param id
19
+	 * @param communityId
20
+	 * @param userId
21
+	 * @return
22
+	 */
15 23
     TpAnnouncement findAnnouncementDetail(Integer id, Integer communityId, Integer userId);
16 24
 
17 25
 
@@ -50,7 +58,25 @@ public interface SocialServiceI {
50 58
 	 */
51 59
 	TpActivity findActivityDetail(Integer activityId, Integer communityId, Integer userId);
52 60
 
53
-	ResponseBean findTaUserInfo(Integer id, Integer communityId, Integer userId);
61
+	/**
62
+	 * 活动报名
63
+	 * @param activityId
64
+	 * @param communityId
65
+	 * @param userId
66
+	 * @param remark
67
+	 * @return
68
+	 */
69
+	ResponseBean findTaUserInfo(Integer activityId, Integer communityId, Integer userId, String remark);
70
+
71
+	/**
72
+	 * 修改活动报名
73
+	 * @param activityId
74
+	 * @param communityId
75
+	 * @param userId
76
+	 * @param remark
77
+	 * @return
78
+	 */
79
+	ResponseBean updateActivtiySignUp(Integer activityId, Integer communityId, Integer userId, String remark);
54 80
 
55 81
 	/**
56 82
 	 * 获取二手租赁详情
@@ -100,4 +126,13 @@ public interface SocialServiceI {
100 126
 	 * @return
101 127
 	 */
102 128
 	List<TpActivity> getActivity(Integer communityId);
129
+	
130
+	/**
131
+	 * 取消报名接口
132
+	 * @param activityId
133
+	 * @param communityId
134
+	 * @param userId
135
+	 * @return
136
+	 */
137
+	ResponseBean cancelSignActivity(Integer activityId, Integer communityId, Integer userId);
103 138
 }

+ 107
- 12
CODE/smart-community/app-api/src/main/java/com/community/huiju/service/impl/SocialServiceImpl.java Voir le fichier

@@ -10,15 +10,14 @@ import com.community.huiju.service.SocialServiceI;
10 10
 import com.github.pagehelper.Page;
11 11
 import com.github.pagehelper.PageHelper;
12 12
 import com.google.common.collect.Maps;
13
+import com.sun.org.apache.bcel.internal.generic.NEW;
13 14
 import org.springframework.beans.factory.annotation.Autowired;
14 15
 import org.springframework.stereotype.Service;
15 16
 import org.springframework.transaction.annotation.Transactional;
16 17
 
17 18
 import java.io.IOException;
18
-import java.util.Date;
19
-import java.util.HashMap;
20
-import java.util.List;
21
-import java.util.Map;
19
+import java.util.*;
20
+import java.util.stream.Collectors;
22 21
 
23 22
 /**
24 23
  * @author weichaochao
@@ -65,7 +64,8 @@ public class SocialServiceImpl implements SocialServiceI {
65 64
     private TdImagesMapper tdImagesMapper;
66 65
 
67 66
     @Autowired
68
-    private ImageServiceI imageServiceI;
67
+    private TpUserMapper tpUserMapper;
68
+
69 69
 
70 70
     @Override
71 71
     @Transactional
@@ -76,6 +76,15 @@ public class SocialServiceImpl implements SocialServiceI {
76 76
             tpAnnouncementMapper.updateByPrimaryKeySelective(id, allViewNum);
77 77
         }
78 78
         TpAnnouncement tpAnnouncement = tpAnnouncementMapper.selectByPrimaryKey(id, communityId);
79
+        tpAnnouncement.setUserName(tpUserMapper.selectByPrimaryKey(tpAnnouncement.getCreateUser()).getUserName());
80
+
81
+        Map<String,Object> map = Maps.newHashMap();
82
+        map.put("uuid",tpAnnouncement.getId());
83
+        map.put("type",Constant.ANNOUNCEMENT);
84
+        // 查询图片
85
+        List<TdImages> tdImagesList = tdImagesMapper.getByUUIDAndByType(map);
86
+        List<String> imgList = tdImagesList.stream().map(e->new String(e.getImageUrl())).collect(Collectors.toList());
87
+        tpAnnouncement.setImgList(imgList);
79 88
         return tpAnnouncement;
80 89
     }
81 90
 
@@ -151,7 +160,22 @@ public class SocialServiceImpl implements SocialServiceI {
151 160
             activity.setViewCount(allViewNum);
152 161
             tpActivityMapper.updateByPrimaryKeySelective(activity);
153 162
         }
154
-        return tpActivityMapper.selectByPrimaryKey(activityId,communityId);
163
+
164
+        TpActivity tpActivity = tpActivityMapper.selectByPrimaryKey(activityId,communityId);
165
+        //返回报名状态
166
+        Integer signNum = tpActivitySignupMapper.findTpActivetitySignByUserId(tpActivity.getId(), communityId, userId);
167
+        String signStatus = signNum != 0 ? Constant.STATUS_SIGNED : Constant.STATUS_UNSIGN;
168
+        tpActivity.setSignStatus(signStatus);
169
+        
170
+        Map<String,Object> map = Maps.newHashMap();
171
+        map.put("uuid",tpActivity.getId());
172
+        map.put("type",Constant.ACTIVITY);
173
+        // 查询图片
174
+        List<TdImages> tdImagesList = tdImagesMapper.getByUUIDAndByType(map);
175
+        List<String> imgList = tdImagesList.stream().map(e->new String(e.getImageUrl())).collect(Collectors.toList());
176
+        tpActivity.setImgList(imgList);
177
+
178
+        return tpActivity;
155 179
     }
156 180
     
157 181
     /**
@@ -182,7 +206,7 @@ public class SocialServiceImpl implements SocialServiceI {
182 206
     }
183 207
 
184 208
     @Override
185
-    public ResponseBean findTaUserInfo(Integer activityId, Integer communityId, Integer userId) {
209
+    public ResponseBean findTaUserInfo(Integer activityId, Integer communityId, Integer userId,String remark) {
186 210
         ResponseBean responseBean = new ResponseBean();
187 211
         TpActivity tpActivity = tpActivityMapper.selectByPrimaryKey(activityId, communityId);
188 212
         //判断是否已经过了报名截至时间
@@ -227,7 +251,7 @@ public class SocialServiceImpl implements SocialServiceI {
227 251
                 || Constant.TENANT.equals(sysRole.getRoleName())
228 252
                 || Constant.OWNER.equals(sysRole.getRoleName()))){
229 253
 
230
-            return insertActivitySignUp(tpActivity, communityId, userId);
254
+            return insertActivitySignUp(tpActivity, communityId, userId, remark);
231 255
         }
232 256
         responseBean.addError("9995", "无法确认您的身份,请联系物业");
233 257
         return responseBean;
@@ -390,11 +414,32 @@ public class SocialServiceImpl implements SocialServiceI {
390 414
         List<TpActivity> listActivity=tpActivityMapper.getActivity(communityId,Num);
391 415
         return listActivity;
392 416
     }
393
-
394
-    public ResponseBean insertActivitySignUp(TpActivity tpActivity, Integer communityId, Integer userId){
417
+    
418
+    /**
419
+     * 取消报名接口
420
+     *
421
+     * @param activityId
422
+     * @param communityId
423
+     * @param userId
424
+     * @return
425
+     */
426
+    @Override
427
+    public ResponseBean cancelSignActivity(Integer activityId, Integer communityId, Integer userId) {
428
+        ResponseBean responseBean = new ResponseBean();
429
+        TpActivitySignup tpActivitySignup = new TpActivitySignup();
430
+        tpActivitySignup.setActivityId(activityId);
431
+        tpActivitySignup.setCommunityId(communityId);
432
+        tpActivitySignup.setTaUserId(userId);
433
+        tpActivitySignupMapper.deleteSignUp(tpActivitySignup);
434
+        //更新报名人数
435
+        updateActivitySignUpNum(communityId,activityId);
436
+        responseBean.addSuccess("取消报名成功");
437
+        return responseBean;
438
+    }
439
+    
440
+    public ResponseBean insertActivitySignUp(TpActivity tpActivity, Integer communityId, Integer userId,String remark){
395 441
         ResponseBean responseBean = new ResponseBean();
396 442
         //判断是否已经报名
397
-        //todo
398 443
         Integer signNum = tpActivitySignupMapper.findTpActivetitySignByUserId(tpActivity.getId(), communityId, userId);
399 444
         if (signNum != 0){
400 445
             responseBean.addError("9996", "您已报名,请勿重复报名");
@@ -406,10 +451,31 @@ public class SocialServiceImpl implements SocialServiceI {
406 451
         tpActivitySignup.setCommunityId(communityId);
407 452
         tpActivitySignup.setTaUserId(userId);
408 453
         tpActivitySignup.setSignUpTime(new Date());
454
+        tpActivitySignup.setRemark(remark);
409 455
         tpActivitySignupMapper.insertSelective(tpActivitySignup);
456
+        //更新报名人数
457
+        updateActivitySignUpNum(communityId,tpActivity.getId());
410 458
         responseBean.addSuccess("报名成功");
411 459
         return responseBean;
412 460
     }
461
+    
462
+    /**
463
+     * 更新报名人数
464
+     * @param communityId
465
+     * @param activityId
466
+     * @return
467
+     */
468
+    private Integer updateActivitySignUpNum(Integer communityId,Integer activityId) {
469
+        TpActivitySignup tpActivitySignup = new TpActivitySignup();
470
+        tpActivitySignup.setActivityId(activityId);
471
+        tpActivitySignup.setCommunityId(communityId);
472
+        Integer signNum = tpActivitySignupMapper.selectSignNum(tpActivitySignup);
473
+        TpActivity updateActivity = new TpActivity();
474
+        updateActivity.setId(activityId);
475
+        updateActivity.setSignUpCount(signNum);
476
+        tpActivityMapper.updateByPrimaryKeySelective(updateActivity);
477
+        return signNum;
478
+    }
413 479
 
414 480
     @Transactional
415 481
     @Override
@@ -421,7 +487,36 @@ public class SocialServiceImpl implements SocialServiceI {
421 487
             transaction.setViewCount(num);
422 488
             tpTransactionMapper.updateByPrimaryKeySelective(transaction);
423 489
         }
424
-        return tpTransactionMapper.selectByPrimaryKey(activityId,communityId);
425 490
 
491
+        TpTransaction tpTransaction = tpTransactionMapper.selectByPrimaryKey(activityId,communityId);
492
+
493
+        Map<String,Object> map = Maps.newHashMap();
494
+        map.put("uuid",tpTransaction.getId());
495
+        map.put("type",Constant.TRANSACTION);
496
+        // 查询图片
497
+        List<TdImages> tdImagesList = tdImagesMapper.getByUUIDAndByType(map);
498
+        List<String> imgList = tdImagesList.stream().map(e->new String(e.getImageUrl())).collect(Collectors.toList());
499
+        tpTransaction.setImgList(imgList);
500
+
501
+        return tpTransaction;
502
+
503
+    }
504
+
505
+    @Transactional(rollbackFor = Exception.class)
506
+    @Override
507
+    public ResponseBean updateActivtiySignUp(Integer activityId, Integer communityId, Integer userId, String remark) {
508
+        ResponseBean responseBean = new ResponseBean();
509
+        TpActivitySignup tpActivitySignup = tpActivitySignupMapper.selectTpActivetitySignByUserId(activityId, communityId, userId);
510
+        if (null == tpActivitySignup){
511
+            responseBean.addError("9996", "您未报名!");
512
+            return responseBean;
513
+        }
514
+
515
+        tpActivitySignup.setCommunityId(communityId);
516
+        tpActivitySignup.setTaUserId(userId);
517
+        tpActivitySignup.setRemark(remark);
518
+        tpActivitySignupMapper.updateByPrimaryKey(tpActivitySignup);
519
+        responseBean.addSuccess("操作成功!");
520
+        return responseBean;
426 521
     }
427 522
 }

+ 20
- 0
CODE/smart-community/app-api/src/main/resources/mapper/TpActivitySignupMapper.xml Voir le fichier

@@ -117,4 +117,24 @@
117 117
     from tp_activity_sign_up
118 118
     where activity_id = #{activityId} and community_id = #{communityId} and ta_user_id = #{userId}
119 119
   </select>
120
+
121
+
122
+  <select id="selectSignNum" resultType="java.lang.Integer">
123
+    select
124
+    count(*)
125
+    from tp_activity_sign_up
126
+    where activity_id = #{activityId} and community_id = #{communityId}
127
+  </select>
128
+
129
+  <delete id="deleteSignUp" parameterType="com.community.huiju.model.TpActivitySignup" >
130
+    delete from tp_activity_sign_up
131
+    where activity_id = #{activityId} and community_id = #{communityId} and ta_user_id = #{taUserId}
132
+  </delete>
133
+
134
+  <select id="selectTpActivetitySignByUserId" resultMap="BaseResultMap">
135
+    select
136
+    <include refid="Base_Column_List"/>
137
+    from tp_activity_sign_up
138
+    where activity_id = #{activityId} and community_id = #{communityId} and ta_user_id = #{userId}
139
+  </select>
120 140
 </mapper>

+ 6
- 1
CODE/smart-community/app-api/src/main/resources/mapper/TpTransactionMapper.xml Voir le fichier

@@ -210,7 +210,12 @@ LEFT JOIN ta_sys_role sr ON sr.id = tsur.role_id
210 210
     select
211 211
     <include refid="Base_Column_List" />
212 212
     from tp_transaction
213
-    where community_id = #{communityId,jdbcType=INTEGER} and ta_user_id = #{userId,jdbcType=INTEGER} and type = #{type,jdbcType=INTEGER}
213
+    where community_id = #{communityId,jdbcType=INTEGER}
214
+    and ta_user_id = #{userId,jdbcType=INTEGER}
215
+    <if test="type != null and type != ''">
216
+      and type = #{type,jdbcType=INTEGER}
217
+    </if>
218
+
214 219
   </select>
215 220
 
216 221
   <update id="updateTransaction" parameterType="com.community.huiju.model.TpTransaction" >

+ 188
- 0
CODE/smart-community/app-api/src/main/resources/mapper/TpUserMapper.xml Voir le fichier

@@ -0,0 +1,188 @@
1
+<?xml version="1.0" encoding="UTF-8" ?>
2
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
3
+<mapper namespace="com.community.huiju.dao.TpUserMapper" >
4
+  <resultMap id="BaseResultMap" type="com.community.huiju.model.TpUser" >
5
+    <id column="id" property="id" jdbcType="INTEGER" />
6
+    <result column="community_id" property="communityId" jdbcType="INTEGER" />
7
+    <result column="user_name" property="userName" jdbcType="VARCHAR" />
8
+    <result column="login_name" property="loginName" jdbcType="VARCHAR" />
9
+    <result column="login_password" property="loginPassword" jdbcType="VARCHAR" />
10
+    <result column="status" property="status" jdbcType="CHAR" />
11
+    <result column="remark" property="remark" jdbcType="VARCHAR" />
12
+    <result column="email" property="email" jdbcType="VARCHAR" />
13
+    <result column="head_portrait" property="headPortrait" jdbcType="VARCHAR" />
14
+    <result column="create_user" property="createUser" jdbcType="INTEGER" />
15
+    <result column="create_date" property="createDate" jdbcType="TIMESTAMP" />
16
+    <result column="update_user" property="updateUser" jdbcType="INTEGER" />
17
+    <result column="update_date" property="updateDate" jdbcType="TIMESTAMP" />
18
+  </resultMap>
19
+  <sql id="Base_Column_List" >
20
+    id, community_id, user_name, login_name, login_password, status, remark, email, head_portrait, 
21
+    create_user, create_date, update_user, update_date
22
+  </sql>
23
+  <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
24
+    select 
25
+    <include refid="Base_Column_List" />
26
+    from tp_user
27
+    where id = #{id,jdbcType=INTEGER}
28
+  </select>
29
+  <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" >
30
+    delete from tp_user
31
+    where id = #{id,jdbcType=INTEGER}
32
+  </delete>
33
+  <insert id="insert" parameterType="com.community.huiju.model.TpUser" >
34
+    insert into tp_user (id, community_id, user_name, 
35
+      login_name, login_password, status, 
36
+      remark, email, head_portrait, 
37
+      create_user, create_date, update_user, 
38
+      update_date)
39
+    values (#{id,jdbcType=INTEGER}, #{communityId,jdbcType=INTEGER}, #{userName,jdbcType=VARCHAR}, 
40
+      #{loginName,jdbcType=VARCHAR}, #{loginPassword,jdbcType=VARCHAR}, #{status,jdbcType=CHAR}, 
41
+      #{remark,jdbcType=VARCHAR}, #{email,jdbcType=VARCHAR}, #{headPortrait,jdbcType=VARCHAR}, 
42
+      #{createUser,jdbcType=INTEGER}, #{createDate,jdbcType=TIMESTAMP}, #{updateUser,jdbcType=INTEGER}, 
43
+      #{updateDate,jdbcType=TIMESTAMP})
44
+  </insert>
45
+  <insert id="insertSelective" parameterType="com.community.huiju.model.TpUser" >
46
+    insert into tp_user
47
+    <trim prefix="(" suffix=")" suffixOverrides="," >
48
+      <if test="id != null" >
49
+        id,
50
+      </if>
51
+      <if test="communityId != null" >
52
+        community_id,
53
+      </if>
54
+      <if test="userName != null" >
55
+        user_name,
56
+      </if>
57
+      <if test="loginName != null" >
58
+        login_name,
59
+      </if>
60
+      <if test="loginPassword != null" >
61
+        login_password,
62
+      </if>
63
+      <if test="status != null" >
64
+        status,
65
+      </if>
66
+      <if test="remark != null" >
67
+        remark,
68
+      </if>
69
+      <if test="email != null" >
70
+        email,
71
+      </if>
72
+      <if test="headPortrait != null" >
73
+        head_portrait,
74
+      </if>
75
+      <if test="createUser != null" >
76
+        create_user,
77
+      </if>
78
+      <if test="createDate != null" >
79
+        create_date,
80
+      </if>
81
+      <if test="updateUser != null" >
82
+        update_user,
83
+      </if>
84
+      <if test="updateDate != null" >
85
+        update_date,
86
+      </if>
87
+    </trim>
88
+    <trim prefix="values (" suffix=")" suffixOverrides="," >
89
+      <if test="id != null" >
90
+        #{id,jdbcType=INTEGER},
91
+      </if>
92
+      <if test="communityId != null" >
93
+        #{communityId,jdbcType=INTEGER},
94
+      </if>
95
+      <if test="userName != null" >
96
+        #{userName,jdbcType=VARCHAR},
97
+      </if>
98
+      <if test="loginName != null" >
99
+        #{loginName,jdbcType=VARCHAR},
100
+      </if>
101
+      <if test="loginPassword != null" >
102
+        #{loginPassword,jdbcType=VARCHAR},
103
+      </if>
104
+      <if test="status != null" >
105
+        #{status,jdbcType=CHAR},
106
+      </if>
107
+      <if test="remark != null" >
108
+        #{remark,jdbcType=VARCHAR},
109
+      </if>
110
+      <if test="email != null" >
111
+        #{email,jdbcType=VARCHAR},
112
+      </if>
113
+      <if test="headPortrait != null" >
114
+        #{headPortrait,jdbcType=VARCHAR},
115
+      </if>
116
+      <if test="createUser != null" >
117
+        #{createUser,jdbcType=INTEGER},
118
+      </if>
119
+      <if test="createDate != null" >
120
+        #{createDate,jdbcType=TIMESTAMP},
121
+      </if>
122
+      <if test="updateUser != null" >
123
+        #{updateUser,jdbcType=INTEGER},
124
+      </if>
125
+      <if test="updateDate != null" >
126
+        #{updateDate,jdbcType=TIMESTAMP},
127
+      </if>
128
+    </trim>
129
+  </insert>
130
+  <update id="updateByPrimaryKeySelective" parameterType="com.community.huiju.model.TpUser" >
131
+    update tp_user
132
+    <set >
133
+      <if test="communityId != null" >
134
+        community_id = #{communityId,jdbcType=INTEGER},
135
+      </if>
136
+      <if test="userName != null" >
137
+        user_name = #{userName,jdbcType=VARCHAR},
138
+      </if>
139
+      <if test="loginName != null" >
140
+        login_name = #{loginName,jdbcType=VARCHAR},
141
+      </if>
142
+      <if test="loginPassword != null" >
143
+        login_password = #{loginPassword,jdbcType=VARCHAR},
144
+      </if>
145
+      <if test="status != null" >
146
+        status = #{status,jdbcType=CHAR},
147
+      </if>
148
+      <if test="remark != null" >
149
+        remark = #{remark,jdbcType=VARCHAR},
150
+      </if>
151
+      <if test="email != null" >
152
+        email = #{email,jdbcType=VARCHAR},
153
+      </if>
154
+      <if test="headPortrait != null" >
155
+        head_portrait = #{headPortrait,jdbcType=VARCHAR},
156
+      </if>
157
+      <if test="createUser != null" >
158
+        create_user = #{createUser,jdbcType=INTEGER},
159
+      </if>
160
+      <if test="createDate != null" >
161
+        create_date = #{createDate,jdbcType=TIMESTAMP},
162
+      </if>
163
+      <if test="updateUser != null" >
164
+        update_user = #{updateUser,jdbcType=INTEGER},
165
+      </if>
166
+      <if test="updateDate != null" >
167
+        update_date = #{updateDate,jdbcType=TIMESTAMP},
168
+      </if>
169
+    </set>
170
+    where id = #{id,jdbcType=INTEGER}
171
+  </update>
172
+  <update id="updateByPrimaryKey" parameterType="com.community.huiju.model.TpUser" >
173
+    update tp_user
174
+    set community_id = #{communityId,jdbcType=INTEGER},
175
+      user_name = #{userName,jdbcType=VARCHAR},
176
+      login_name = #{loginName,jdbcType=VARCHAR},
177
+      login_password = #{loginPassword,jdbcType=VARCHAR},
178
+      status = #{status,jdbcType=CHAR},
179
+      remark = #{remark,jdbcType=VARCHAR},
180
+      email = #{email,jdbcType=VARCHAR},
181
+      head_portrait = #{headPortrait,jdbcType=VARCHAR},
182
+      create_user = #{createUser,jdbcType=INTEGER},
183
+      create_date = #{createDate,jdbcType=TIMESTAMP},
184
+      update_user = #{updateUser,jdbcType=INTEGER},
185
+      update_date = #{updateDate,jdbcType=TIMESTAMP}
186
+    where id = #{id,jdbcType=INTEGER}
187
+  </update>
188
+</mapper>

+ 10
- 0
CODE/smart-community/community-common/src/main/java/com/community/commom/constant/Constant.java Voir le fichier

@@ -107,4 +107,14 @@ public class Constant {
107 107
 
108 108
     /** 添加用户所对应的部门 住户 **/
109 109
     public static final String DEPT_RESIDENTS = "测试";
110
+    
111
+    /**
112
+     * 报名状态 已报名
113
+     */
114
+    public static final String STATUS_SIGNED = "signed";
115
+    
116
+    /**
117
+     * 报名状态 未报名
118
+     */
119
+    public static final String STATUS_UNSIGN = "unsigned";
110 120
 }