|
@@ -62,42 +62,40 @@ public class HelpActivityServiceImpl extends ServiceImpl<HelpActivityMapper, Hel
|
62
|
62
|
}
|
63
|
63
|
|
64
|
64
|
@Override
|
65
|
|
- public ResponseBean helpRecord(Integer helpActivityId, int status,Integer pageNum,Integer pageSize) {
|
|
65
|
+ public ResponseBean helpRecord(Integer helpActivityId, String status,Integer pageNum,Integer pageSize) {
|
66
|
66
|
ResponseBean responseBean = new ResponseBean<>();
|
67
|
|
- // status 0助力成功,1进行中,2助力失败
|
|
67
|
+ // status: helpSucceed助力成功,helpUnderway进行中,helpUnfinished助力失败
|
68
|
68
|
|
69
|
69
|
//查询当前助力成功所需的人数限制(persion_num)
|
70
|
70
|
HelpActivity helpActivity = taHelpActivityMapper.selectById(helpActivityId);
|
71
|
71
|
// 得到活动限制助力的总数
|
72
|
72
|
int persionNumCount = helpActivity.getPersionNum();
|
73
|
73
|
IPage<HelpInitiateRecord> pg = new Page<>(pageNum, pageSize);
|
74
|
|
- QueryWrapper<HelpInitiateRecord> helpInitiateRecordQuery = new QueryWrapper<>();
|
75
|
|
- helpInitiateRecordQuery.eq("help_activity_id", helpActivityId);
|
76
|
|
- IPage<HelpInitiateRecord> list = helpInitiateRecordMapper.selectPage(pg,helpInitiateRecordQuery);
|
|
74
|
+ IPage<HelpInitiateRecord> list = helpInitiateRecordMapper.selectPageList(pg,helpActivityId,status);
|
77
|
75
|
|
78
|
76
|
List<HelpInitiateRecord> helpInitiateRecordList= list.getRecords();
|
79
|
77
|
for (HelpInitiateRecord helpInitiateRecord : helpInitiateRecordList) {
|
80
|
|
-
|
|
78
|
+ helpInitiateRecord.setPersionNumCount(persionNumCount);
|
81
|
79
|
// 统计助力成功的总数(发起人得到助力数满了即可)
|
82
|
80
|
QueryWrapper<HelpRecord> helpRecorddQueryWrapper = new QueryWrapper<>();
|
83
|
|
- helpRecorddQueryWrapper.eq("help_record_initiate_id", helpInitiateRecord.getHelpActivityId());
|
|
81
|
+ helpRecorddQueryWrapper.eq("help_record_initiate_id", helpInitiateRecord.getHelpRecordInitiateId());
|
84
|
82
|
// 拿到每个发起人,得到助力的总数
|
85
|
83
|
int helpRecordCount = helpRecordMapper.selectCount(helpRecorddQueryWrapper);
|
86
|
84
|
// 助力成功
|
87
|
|
- if (0 == status) {
|
|
85
|
+ if ("helpSucceed".equals(status)) {
|
88
|
86
|
if (persionNumCount == helpRecordCount) {
|
89
|
87
|
helpInitiateRecord.setHelpCount(helpRecordCount);
|
90
|
88
|
}
|
91
|
89
|
}
|
92
|
90
|
// 助力进行中(活动进行中,未结束)
|
93
|
|
- if (1 == status && "1".equals(helpActivity.getStatus())) {
|
|
91
|
+ if ("helpUnderway".equals(status) && "1".equals(helpActivity.getStatus())) {
|
94
|
92
|
if (persionNumCount > helpRecordCount) {
|
95
|
93
|
helpInitiateRecord.setHelpCount(helpRecordCount);
|
96
|
94
|
}
|
97
|
95
|
}
|
98
|
96
|
// 活动助力失败
|
99
|
97
|
// 活动进行中(活动已结束)
|
100
|
|
- if (2 == status && "2".equals(helpActivity.getStatus())) {
|
|
98
|
+ if ("helpUnfinished".equals(status) && "2".equals(helpActivity.getStatus())) {
|
101
|
99
|
if (persionNumCount > helpRecordCount) {
|
102
|
100
|
helpInitiateRecord.setHelpCount(helpRecordCount);
|
103
|
101
|
}
|
|
@@ -120,4 +118,22 @@ public class HelpActivityServiceImpl extends ServiceImpl<HelpActivityMapper, Hel
|
120
|
118
|
responseBean.addSuccess(helpRecordList);
|
121
|
119
|
return responseBean;
|
122
|
120
|
}
|
|
121
|
+
|
|
122
|
+ @Override
|
|
123
|
+ public ResponseBean helpInitiateRecordVerify(Integer helpRecordInitiateId, Integer verifyCode) {
|
|
124
|
+ ResponseBean responseBean = new ResponseBean<>();
|
|
125
|
+ HelpInitiateRecord helpInitiateRecord = helpInitiateRecordMapper.selectById(helpRecordInitiateId);
|
|
126
|
+ // 判断是否已核销
|
|
127
|
+ if ("1".equals(helpInitiateRecord.getVerificationStatus())){
|
|
128
|
+ responseBean.addSuccess("已核销");
|
|
129
|
+ return responseBean;
|
|
130
|
+ }
|
|
131
|
+
|
|
132
|
+ if (helpInitiateRecord.getVerification().equals(verifyCode)){
|
|
133
|
+ responseBean.addSuccess("成功");
|
|
134
|
+ }else {
|
|
135
|
+ responseBean.addError("核销码错误");
|
|
136
|
+ }
|
|
137
|
+ return responseBean;
|
|
138
|
+ }
|
123
|
139
|
}
|