|
@@ -5,16 +5,14 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
|
5
|
5
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
6
|
6
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
7
|
7
|
import com.huiju.estateagents.base.ResponseBean;
|
|
8
|
+import com.huiju.estateagents.common.CommConstant;
|
8
|
9
|
import com.huiju.estateagents.common.StringUtils;
|
9
|
10
|
import com.huiju.estateagents.entity.*;
|
10
|
11
|
import com.huiju.estateagents.event.EventBus;
|
11
|
12
|
import com.huiju.estateagents.excel.HelpInitiateRecordSucceed;
|
12
|
13
|
import com.huiju.estateagents.excel.HelpProceedAndFinish;
|
13
|
14
|
import com.huiju.estateagents.excel.HelpRecordExport;
|
14
|
|
-import com.huiju.estateagents.mapper.HelpActivityMapper;
|
15
|
|
-import com.huiju.estateagents.mapper.HelpInitiateRecordMapper;
|
16
|
|
-import com.huiju.estateagents.mapper.HelpRecordMapper;
|
17
|
|
-import com.huiju.estateagents.mapper.TaShareActivityMapper;
|
|
15
|
+import com.huiju.estateagents.mapper.*;
|
18
|
16
|
import com.huiju.estateagents.service.IHelpActivityService;
|
19
|
17
|
import org.apache.commons.collections.CollectionUtils;
|
20
|
18
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
@@ -43,6 +41,12 @@ public class HelpActivityServiceImpl extends ServiceImpl<HelpActivityMapper, Hel
|
43
|
41
|
@Autowired
|
44
|
42
|
HelpInitiateRecordMapper helpInitiateRecordMapper;
|
45
|
43
|
|
|
44
|
+ @Autowired
|
|
45
|
+ private TaActivityDynamicEnlistMapper taActivityDynamicEnlistMapper;
|
|
46
|
+
|
|
47
|
+ @Autowired
|
|
48
|
+ private TaShareRecordMapper taShareRecordMapper;
|
|
49
|
+
|
46
|
50
|
@Autowired
|
47
|
51
|
HelpRecordMapper helpRecordMapper;
|
48
|
52
|
|
|
@@ -53,10 +57,10 @@ public class HelpActivityServiceImpl extends ServiceImpl<HelpActivityMapper, Hel
|
53
|
57
|
TaShareActivityMapper taShareActivityMapper;
|
54
|
58
|
|
55
|
59
|
@Override
|
56
|
|
- public ResponseBean helpActivityList(Integer pageNum, Integer pageSize, Integer cityId, String buildingId, String title, String startDate, String endDate, Integer activityStatus, Integer orgId,List<TaPersonBuilding> personBuildingList) {
|
|
60
|
+ public ResponseBean helpActivityList(Integer pageNum, Integer pageSize, Integer cityId, String buildingId, String title, String startDate, String endDate, Integer activityStatus, Integer orgId, List<TaPersonBuilding> personBuildingList) {
|
57
|
61
|
ResponseBean responseBean = new ResponseBean<>();
|
58
|
62
|
IPage<HelpActivity> pg = new Page<>(pageNum, pageSize);
|
59
|
|
- IPage<HelpActivity> result = taHelpActivityMapper.helpActivityListPage(pg, cityId, buildingId, title, startDate, endDate, activityStatus, orgId,personBuildingList);
|
|
63
|
+ IPage<HelpActivity> result = taHelpActivityMapper.helpActivityListPage(pg, cityId, buildingId, title, startDate, endDate, activityStatus, orgId, personBuildingList);
|
60
|
64
|
responseBean.addSuccess(result);
|
61
|
65
|
return responseBean;
|
62
|
66
|
}
|
|
@@ -65,7 +69,7 @@ public class HelpActivityServiceImpl extends ServiceImpl<HelpActivityMapper, Hel
|
65
|
69
|
public int helpActivityAdd(HelpActivity helpActivity, Integer orgId) {
|
66
|
70
|
helpActivity.setOrgId(orgId)
|
67
|
71
|
.setCreateDate(LocalDateTime.now());
|
68
|
|
- taHelpActivityMapper.insert(helpActivity);
|
|
72
|
+ taHelpActivityMapper.insert(helpActivity);
|
69
|
73
|
return helpActivity.getHelpActivityId();
|
70
|
74
|
}
|
71
|
75
|
|
|
@@ -75,7 +79,7 @@ public class HelpActivityServiceImpl extends ServiceImpl<HelpActivityMapper, Hel
|
75
|
79
|
}
|
76
|
80
|
|
77
|
81
|
@Override
|
78
|
|
- public ResponseBean helpRecord(Integer helpActivityId, String status,Integer pageNum,Integer pageSize,String tel) {
|
|
82
|
+ public ResponseBean helpRecord(Integer helpActivityId, String status, Integer pageNum, Integer pageSize, String tel) {
|
79
|
83
|
ResponseBean responseBean = new ResponseBean<>();
|
80
|
84
|
// status: helpSucceed助力成功,helpUnderway进行中,helpUnfinished助力失败
|
81
|
85
|
|
|
@@ -84,9 +88,9 @@ public class HelpActivityServiceImpl extends ServiceImpl<HelpActivityMapper, Hel
|
84
|
88
|
// 得到活动限制助力的总数
|
85
|
89
|
int persionNumCount = helpActivity.getPersonNum();
|
86
|
90
|
IPage<HelpInitiateRecord> pg = new Page<>(pageNum, pageSize);
|
87
|
|
- IPage<HelpInitiateRecord> list = helpInitiateRecordMapper.selectPageList(pg,helpActivityId,status,tel);
|
|
91
|
+ IPage<HelpInitiateRecord> list = helpInitiateRecordMapper.selectPageList(pg, helpActivityId, status, tel);
|
88
|
92
|
|
89
|
|
- List<HelpInitiateRecord> helpInitiateRecordList= list.getRecords();
|
|
93
|
+ List<HelpInitiateRecord> helpInitiateRecordList = list.getRecords();
|
90
|
94
|
for (HelpInitiateRecord helpInitiateRecord : helpInitiateRecordList) {
|
91
|
95
|
helpInitiateRecord.setPersionNumCount(persionNumCount);
|
92
|
96
|
// 统计助力成功的总数(发起人得到助力数满了即可)
|
|
@@ -127,7 +131,7 @@ public class HelpActivityServiceImpl extends ServiceImpl<HelpActivityMapper, Hel
|
127
|
131
|
public ResponseBean taHelpRecordDetails(Integer helpRecordInitiateId, Integer pageNum, Integer pageSize) {
|
128
|
132
|
ResponseBean responseBean = new ResponseBean<>();
|
129
|
133
|
IPage<HelpInitiateRecord> pg = new Page<>(pageNum, pageSize);
|
130
|
|
- IPage<HelpRecord> helpRecordList= helpRecordMapper.taHelpRecordDetails(pg,helpRecordInitiateId);
|
|
134
|
+ IPage<HelpRecord> helpRecordList = helpRecordMapper.taHelpRecordDetails(pg, helpRecordInitiateId);
|
131
|
135
|
responseBean.addSuccess(helpRecordList);
|
132
|
136
|
return responseBean;
|
133
|
137
|
}
|
|
@@ -136,26 +140,26 @@ public class HelpActivityServiceImpl extends ServiceImpl<HelpActivityMapper, Hel
|
136
|
140
|
public ResponseBean helpInitiateRecordVerify(Integer helpRecordInitiateId, String verifyCode) {
|
137
|
141
|
ResponseBean responseBean = new ResponseBean<>();
|
138
|
142
|
HelpInitiateRecord helpInitiateRecord = helpInitiateRecordMapper.selectById(helpRecordInitiateId);
|
139
|
|
- if (null ==verifyCode || "".equals(verifyCode)){
|
|
143
|
+ if (null == verifyCode || "".equals(verifyCode)) {
|
140
|
144
|
responseBean.addError("请输入核销码");
|
141
|
145
|
return responseBean;
|
142
|
146
|
}
|
143
|
147
|
|
144
|
148
|
// 判断是否已核销
|
145
|
|
- if ("1".equals(helpInitiateRecord.getVerificationStatus())){
|
|
149
|
+ if ("1".equals(helpInitiateRecord.getVerificationStatus())) {
|
146
|
150
|
responseBean.addSuccess("已核销");
|
147
|
151
|
return responseBean;
|
148
|
152
|
}
|
149
|
153
|
|
150
|
|
- if (verifyCode.equals(String.valueOf(helpInitiateRecord.getVerification()))){
|
|
154
|
+ if (verifyCode.equals(String.valueOf(helpInitiateRecord.getVerification()))) {
|
151
|
155
|
helpInitiateRecord.setVerificationStatus(1);
|
152
|
156
|
helpInitiateRecordMapper.updateById(helpInitiateRecord);
|
153
|
157
|
|
154
|
158
|
// 活动核销加积分
|
155
|
|
- applicationContext.publishEvent(new EventBus(helpInitiateRecord, EventBus.EventType.ActivityVerificationSign,helpInitiateRecord.getOrgId()));
|
|
159
|
+ applicationContext.publishEvent(new EventBus(helpInitiateRecord, EventBus.EventType.ActivityVerificationSign, helpInitiateRecord.getOrgId()));
|
156
|
160
|
|
157
|
161
|
responseBean.addSuccess("成功");
|
158
|
|
- }else {
|
|
162
|
+ } else {
|
159
|
163
|
responseBean.addError("核销码错误,请重新输入");
|
160
|
164
|
}
|
161
|
165
|
return responseBean;
|
|
@@ -163,34 +167,34 @@ public class HelpActivityServiceImpl extends ServiceImpl<HelpActivityMapper, Hel
|
163
|
167
|
|
164
|
168
|
@Override
|
165
|
169
|
public Integer getHelpInitiateRecordSucceed(String tel, Integer helpActivityId) {
|
166
|
|
- QueryWrapper<HelpInitiateRecord> helpInitiateRecordQuery= new QueryWrapper<>();
|
167
|
|
- helpInitiateRecordQuery.eq("help_activity_id",helpActivityId);
|
168
|
|
- helpInitiateRecordQuery.eq(!StringUtils.isEmpty(tel), "phone",tel);
|
|
170
|
+ QueryWrapper<HelpInitiateRecord> helpInitiateRecordQuery = new QueryWrapper<>();
|
|
171
|
+ helpInitiateRecordQuery.eq("help_activity_id", helpActivityId);
|
|
172
|
+ helpInitiateRecordQuery.eq(!StringUtils.isEmpty(tel), "phone", tel);
|
169
|
173
|
return helpInitiateRecordMapper.selectCount(helpInitiateRecordQuery);
|
170
|
174
|
}
|
171
|
175
|
|
172
|
176
|
@Override
|
173
|
177
|
public List<HelpInitiateRecordSucceed> getHelpInitiateRecordSucceedExportList(int i, Integer pageSize, String tel, Integer helpActivityId) {
|
174
|
|
- List<HelpInitiateRecordSucceed> lsit= helpInitiateRecordMapper.getHelpInitiateRecordSucceedExportList(i,pageSize,tel,helpActivityId);
|
|
178
|
+ List<HelpInitiateRecordSucceed> lsit = helpInitiateRecordMapper.getHelpInitiateRecordSucceedExportList(i, pageSize, tel, helpActivityId);
|
175
|
179
|
return lsit;
|
176
|
180
|
}
|
177
|
181
|
|
178
|
182
|
@Override
|
179
|
|
- public List<HelpProceedAndFinish> getHelpProceedAndFinishExportList(int i, Integer pageSize, String tel, Integer helpActivityId,String condition) {
|
180
|
|
- List<HelpProceedAndFinish> lsit= helpInitiateRecordMapper.getHelpProceedAndFinishExportList(i,pageSize,tel,helpActivityId,condition);
|
|
183
|
+ public List<HelpProceedAndFinish> getHelpProceedAndFinishExportList(int i, Integer pageSize, String tel, Integer helpActivityId, String condition) {
|
|
184
|
+ List<HelpProceedAndFinish> lsit = helpInitiateRecordMapper.getHelpProceedAndFinishExportList(i, pageSize, tel, helpActivityId, condition);
|
181
|
185
|
return lsit;
|
182
|
186
|
}
|
183
|
187
|
|
184
|
188
|
@Override
|
185
|
189
|
public Integer getHelpRecord(Integer helpRecordInitiateId) {
|
186
|
|
- QueryWrapper<HelpRecord> helpInitiateRecordQuery= new QueryWrapper<>();
|
187
|
|
- helpInitiateRecordQuery.eq("help_record_initiate_id",helpRecordInitiateId);
|
|
190
|
+ QueryWrapper<HelpRecord> helpInitiateRecordQuery = new QueryWrapper<>();
|
|
191
|
+ helpInitiateRecordQuery.eq("help_record_initiate_id", helpRecordInitiateId);
|
188
|
192
|
return helpRecordMapper.selectCount(helpInitiateRecordQuery);
|
189
|
193
|
}
|
190
|
194
|
|
191
|
195
|
@Override
|
192
|
196
|
public List<HelpRecordExport> getHelpRecordExportList(int i, Integer pageSize, Integer helpRecordInitiateId) {
|
193
|
|
- List<HelpRecordExport> lsit= helpRecordMapper.getHelpRecordExportList(i,pageSize,helpRecordInitiateId);
|
|
197
|
+ List<HelpRecordExport> lsit = helpRecordMapper.getHelpRecordExportList(i, pageSize, helpRecordInitiateId);
|
194
|
198
|
return lsit;
|
195
|
199
|
}
|
196
|
200
|
|
|
@@ -210,19 +214,56 @@ public class HelpActivityServiceImpl extends ServiceImpl<HelpActivityMapper, Hel
|
210
|
214
|
}
|
211
|
215
|
|
212
|
216
|
@Override
|
213
|
|
- public ResponseBean wxhelpActivityAndGroup(Integer orgId,String buildingId,String cityID) {
|
|
217
|
+ public ResponseBean wxhelpActivityAndGroup(Integer orgId, String buildingId, String cityID, TaPerson person) {
|
214
|
218
|
ResponseBean responseBean = new ResponseBean<>();
|
|
219
|
+ //查询是否报名了普通活动
|
|
220
|
+ QueryWrapper<TaActivityDynamicEnlist> queryWrapper = new QueryWrapper<>();
|
|
221
|
+ queryWrapper.eq("org_id", orgId);
|
|
222
|
+ queryWrapper.eq("person_id", person.getPersonId());
|
|
223
|
+ List<TaActivityDynamicEnlist> taActivityDynamicEnlists = taActivityDynamicEnlistMapper.selectList(queryWrapper);
|
|
224
|
+ //查询是否报名了拼团活动
|
|
225
|
+ QueryWrapper<TaShareRecord> taShareRecordQueryWrapper = new QueryWrapper<>();
|
|
226
|
+ taShareRecordQueryWrapper.eq("org_id", orgId);
|
|
227
|
+ taShareRecordQueryWrapper.eq("person_id", person.getPersonId());
|
|
228
|
+ List<TaShareRecord> taShareRecords = taShareRecordMapper.selectList(taShareRecordQueryWrapper);
|
|
229
|
+ //判断是否发起了助力活动
|
|
230
|
+ QueryWrapper<HelpInitiateRecord> helpInitiateRecordListQueryWrapper = new QueryWrapper<>();
|
|
231
|
+ helpInitiateRecordListQueryWrapper.eq("org_id", orgId);
|
|
232
|
+ helpInitiateRecordListQueryWrapper.eq("person_id", person.getPersonId());
|
|
233
|
+ List<HelpInitiateRecord> helpInitiateRecords = helpInitiateRecordMapper.selectList(helpInitiateRecordListQueryWrapper);
|
|
234
|
+
|
215
|
235
|
// buildingId 楼盘ID为空时首页只查置顶的活动,楼盘ID不为空查所有拼团和助力
|
216
|
|
- List<HelpActivity> HelpActivity = taHelpActivityMapper.selectWxhelpActivityAndGroup(orgId,buildingId,cityID);
|
217
|
|
- responseBean.addSuccess(HelpActivity);
|
|
236
|
+ List<HelpActivity> helpActivities = taHelpActivityMapper.selectWxhelpActivityAndGroup(orgId, buildingId, cityID);
|
|
237
|
+ for (HelpActivity helpActivity : helpActivities) {
|
|
238
|
+ if ("activity".equals(helpActivity.getType())) {
|
|
239
|
+ taActivityDynamicEnlists.forEach(dynamic -> {
|
|
240
|
+ if (helpActivity.getActivityId().equals(dynamic.getDynamicId())) {
|
|
241
|
+ helpActivity.setActivityStatus(CommConstant.ACTIVITY_STATUS_PARTNER);
|
|
242
|
+ }
|
|
243
|
+ });
|
|
244
|
+ } else if ("group".equals(helpActivity.getType())) {
|
|
245
|
+ taShareRecords.forEach(share -> {
|
|
246
|
+ if (helpActivity.getActivityId().equals(share.getGroupActivityId().toString())) {
|
|
247
|
+ helpActivity.setActivityStatus(CommConstant.ACTIVITY_STATUS_PARTNER);
|
|
248
|
+ }
|
|
249
|
+ });
|
|
250
|
+ } else if ("help".equals(helpActivity.getType())) {
|
|
251
|
+ helpInitiateRecords.forEach(help -> {
|
|
252
|
+ if (helpActivity.getActivityId().equals(help.getHelpActivityId().toString())) {
|
|
253
|
+ helpActivity.setActivityStatus(CommConstant.ACTIVITY_STATUS_PARTNER);
|
|
254
|
+ }
|
|
255
|
+ });
|
|
256
|
+ }
|
|
257
|
+ }
|
|
258
|
+ responseBean.addSuccess(helpActivities);
|
218
|
259
|
return responseBean;
|
219
|
260
|
}
|
220
|
261
|
|
221
|
262
|
@Override
|
222
|
|
- public ResponseBean helpActivityEffectiveList(Integer pageNum, Integer pageSize, Integer cityId, Integer orgId, String buildingId,Integer status,String name,List<TaPersonBuilding> personBuildingList) {
|
|
263
|
+ public ResponseBean helpActivityEffectiveList(Integer pageNum, Integer pageSize, Integer cityId, Integer orgId, String buildingId, Integer status, String name, List<TaPersonBuilding> personBuildingList) {
|
223
|
264
|
ResponseBean responseBean = new ResponseBean<>();
|
224
|
265
|
IPage<HelpActivity> pg = new Page<>(pageNum, pageSize);
|
225
|
|
- IPage<HelpActivity> result = taHelpActivityMapper.helpActivityListEffectivePage(pg, cityId, orgId, buildingId,status,name,personBuildingList);
|
|
266
|
+ IPage<HelpActivity> result = taHelpActivityMapper.helpActivityListEffectivePage(pg, cityId, orgId, buildingId, status, name, personBuildingList);
|
226
|
267
|
responseBean.addSuccess(result);
|
227
|
268
|
return responseBean;
|
228
|
269
|
}
|