|
@@ -19,9 +19,7 @@ import org.springframework.stereotype.Service;
|
19
|
19
|
|
20
|
20
|
import java.time.LocalDateTime;
|
21
|
21
|
import java.util.ArrayList;
|
22
|
|
-import java.util.HashMap;
|
23
|
22
|
import java.util.List;
|
24
|
|
-import java.util.Map;
|
25
|
23
|
|
26
|
24
|
/**
|
27
|
25
|
* <p>
|
|
@@ -44,11 +42,14 @@ public class TaPointsRecordsServiceImpl extends ServiceImpl<TaPointsRecordsMappe
|
44
|
42
|
|
45
|
43
|
/**
|
46
|
44
|
* 获取规则积分, 0 代表未启用
|
47
|
|
- * @param ruleId
|
|
45
|
+ * @param code
|
48
|
46
|
* @return
|
49
|
47
|
*/
|
50
|
|
- private Integer getRulePoints(Integer ruleId) {
|
51
|
|
- TdPointsRules rule = tdPointsRulesMapper.selectById(ruleId);
|
|
48
|
+ private Integer getRulePoints(String code,Integer orgId) {
|
|
49
|
+ QueryWrapper<TdPointsRules> tdPointsRulesQueryWrapper = new QueryWrapper<>();
|
|
50
|
+ tdPointsRulesQueryWrapper.eq("code",code);
|
|
51
|
+ tdPointsRulesQueryWrapper.eq("org_id",orgId);
|
|
52
|
+ TdPointsRules rule = tdPointsRulesMapper.selectOne(tdPointsRulesQueryWrapper);
|
52
|
53
|
if (null == rule) {
|
53
|
54
|
return 0;
|
54
|
55
|
}
|
|
@@ -70,15 +71,15 @@ public class TaPointsRecordsServiceImpl extends ServiceImpl<TaPointsRecordsMappe
|
70
|
71
|
|
71
|
72
|
@Override
|
72
|
73
|
public void sharePoints(TaShare taShare, Integer orgId) {
|
|
74
|
+ //
|
|
75
|
+ String changeType = CommConstant.POINTS_CHANGE_SHARE_POSTER;
|
|
76
|
+
|
73
|
77
|
// 是否开启积分规则
|
74
|
|
- Integer pointsAmount = getRulePoints(CommConstant.POINTS_RULE_SHARE_POSTER);
|
|
78
|
+ Integer pointsAmount = getRulePoints(changeType,orgId);
|
75
|
79
|
if (pointsAmount == 0) {
|
76
|
80
|
return;
|
77
|
81
|
}
|
78
|
82
|
|
79
|
|
- //
|
80
|
|
- String changeType = CommConstant.POINTS_CHANGE_SHARE_POSTER;
|
81
|
|
-
|
82
|
83
|
// 已经领取过的不会再次领取
|
83
|
84
|
String[] params = {
|
84
|
85
|
"shareId="+String.valueOf(taShare.getShareId()),
|
|
@@ -99,14 +100,13 @@ public class TaPointsRecordsServiceImpl extends ServiceImpl<TaPointsRecordsMappe
|
99
|
100
|
|
100
|
101
|
@Override
|
101
|
102
|
public void sharePosterAll(String recommenderId, Integer orgId) {
|
|
103
|
+ String changeType = CommConstant.POINTS_CHANGE_SHARE_POSTER;
|
102
|
104
|
// 是否开启积分规则
|
103
|
|
- Integer pointsAmount = getRulePoints(CommConstant.POINTS_RULE_SHARE_POSTER);
|
|
105
|
+ Integer pointsAmount = getRulePoints(changeType,orgId);
|
104
|
106
|
if (pointsAmount == 0) {
|
105
|
107
|
return;
|
106
|
108
|
}
|
107
|
109
|
|
108
|
|
- String changeType = CommConstant.POINTS_CHANGE_SHARE_POSTER;
|
109
|
|
-
|
110
|
110
|
String[] params = {
|
111
|
111
|
"openUser="+recommenderId
|
112
|
112
|
};
|
|
@@ -121,15 +121,15 @@ public class TaPointsRecordsServiceImpl extends ServiceImpl<TaPointsRecordsMappe
|
121
|
121
|
|
122
|
122
|
@Override
|
123
|
123
|
public void checkinPoints(TaPersonSign taPersonSign,Integer orgId) {
|
|
124
|
+ //
|
|
125
|
+ String changeType = CommConstant.POINTS_CHANGE_CHECKIN;
|
|
126
|
+
|
124
|
127
|
// 是否开启积分规则
|
125
|
|
- Integer pointsAmount = getRulePoints(CommConstant.POINTS_RULE_CHECKIN);
|
|
128
|
+ Integer pointsAmount = getRulePoints(changeType,orgId);
|
126
|
129
|
if (pointsAmount == 0) {
|
127
|
130
|
return;
|
128
|
131
|
}
|
129
|
132
|
|
130
|
|
- //
|
131
|
|
- String changeType = CommConstant.POINTS_CHANGE_CHECKIN;
|
132
|
|
-
|
133
|
133
|
// 已经领取过的不会再次领取
|
134
|
134
|
List<String> params = new ArrayList<String>() {{
|
135
|
135
|
add("date="+DateUtils.today());
|
|
@@ -160,12 +160,13 @@ public class TaPointsRecordsServiceImpl extends ServiceImpl<TaPointsRecordsMappe
|
160
|
160
|
|
161
|
161
|
@Override
|
162
|
162
|
public void checkinActivityPoints(TaActivityDynamicEnlist taActivityDynamicEnlist, Integer orgId){
|
|
163
|
+ String changeType =CommConstant.POINTS_CHANGE_ACTIVITY_CHECKIN;
|
163
|
164
|
// 是否开启积分规则
|
164
|
|
- Integer pointsAmount = getRulePoints(CommConstant.POINTS_RULE_ACTIVITY_CHECKIN);
|
|
165
|
+ Integer pointsAmount = getRulePoints(changeType,orgId);
|
165
|
166
|
if (pointsAmount == 0) {
|
166
|
167
|
return;
|
167
|
168
|
}
|
168
|
|
- String changeType =CommConstant.POINTS_CHANGE_ACTIVITY_CHECKIN;
|
|
169
|
+
|
169
|
170
|
// 已经领取过的不会再次领取
|
170
|
171
|
List<String> params = new ArrayList<String>() {{
|
171
|
172
|
add("user="+taActivityDynamicEnlist.getPersonId());
|
|
@@ -188,15 +189,14 @@ public class TaPointsRecordsServiceImpl extends ServiceImpl<TaPointsRecordsMappe
|
188
|
189
|
|
189
|
190
|
@Override
|
190
|
191
|
public void signUpPoints(TaPerson taPerson, Integer orgId) {
|
|
192
|
+ //
|
|
193
|
+ String changeType = CommConstant.POINTS_CHANGE_SIGNUP_AGENT;
|
191
|
194
|
// 是否开启积分规则
|
192
|
|
- Integer pointsAmount = getRulePoints(CommConstant.POINTS_RULE_SIGNUP_AGENT);
|
|
195
|
+ Integer pointsAmount = getRulePoints(changeType,orgId);
|
193
|
196
|
if (pointsAmount == 0) {
|
194
|
197
|
return;
|
195
|
198
|
}
|
196
|
199
|
|
197
|
|
- //
|
198
|
|
- String changeType = CommConstant.POINTS_CHANGE_SIGNUP_AGENT;
|
199
|
|
-
|
200
|
200
|
// 已经领取过的不会再次领取
|
201
|
201
|
List<String> params = new ArrayList<String>() {{
|
202
|
202
|
add("user="+taPerson.getPersonId());
|
|
@@ -215,15 +215,15 @@ public class TaPointsRecordsServiceImpl extends ServiceImpl<TaPointsRecordsMappe
|
215
|
215
|
|
216
|
216
|
@Override
|
217
|
217
|
public void recommendCustPoints(TaRecommendCustomer taRecommendCustomer, Integer orgId) {
|
|
218
|
+ //
|
|
219
|
+ String changeType = CommConstant.POINTS_CHANGE_RECOMMEND_CUSTOMER;
|
|
220
|
+
|
218
|
221
|
// 是否开启积分规则
|
219
|
|
- Integer pointsAmount = getRulePoints(CommConstant.POINTS_RULE_RECOMMENDER_CUSTOMER);
|
|
222
|
+ Integer pointsAmount = getRulePoints(changeType,orgId);
|
220
|
223
|
if (pointsAmount == 0) {
|
221
|
224
|
return;
|
222
|
225
|
}
|
223
|
226
|
|
224
|
|
- //
|
225
|
|
- String changeType = CommConstant.POINTS_CHANGE_RECOMMEND_CUSTOMER;
|
226
|
|
-
|
227
|
227
|
// 已经领取过的不会再次领取
|
228
|
228
|
List<String> params = new ArrayList<String>() {{
|
229
|
229
|
// 推荐人
|
|
@@ -343,15 +343,14 @@ public class TaPointsRecordsServiceImpl extends ServiceImpl<TaPointsRecordsMappe
|
343
|
343
|
|
344
|
344
|
@Override
|
345
|
345
|
public void documentVerify(TaDocumentVerify taDocumentVerify, Integer orgId) {
|
|
346
|
+ //
|
|
347
|
+ String changeType = CommConstant.POINTS_CHANGE_DOCUMENT_VERIFY;
|
346
|
348
|
// 是否开启积分规则
|
347
|
|
- Integer pointsAmount = getRulePoints(CommConstant.POINTS_RULE_DOCUMENT_VERIFY);
|
|
349
|
+ Integer pointsAmount = getRulePoints(changeType,orgId);
|
348
|
350
|
if (pointsAmount == 0) {
|
349
|
351
|
return;
|
350
|
352
|
}
|
351
|
353
|
|
352
|
|
- //
|
353
|
|
- String changeType = CommConstant.POINTS_CHANGE_DOCUMENT_VERIFY;
|
354
|
|
-
|
355
|
354
|
// 已经领取过的不会再次领取
|
356
|
355
|
String[] params = {
|
357
|
356
|
"shareId="+String.valueOf(taDocumentVerify.getDocumentVerifyId()),
|
|
@@ -372,14 +371,15 @@ public class TaPointsRecordsServiceImpl extends ServiceImpl<TaPointsRecordsMappe
|
372
|
371
|
|
373
|
372
|
@Override
|
374
|
373
|
public void activityVerificationSign(HelpInitiateRecord helpInitiateRecord, Integer orgId) {
|
|
374
|
+ //
|
|
375
|
+ String changeType = CommConstant.POINTS_CHANGE_ACTIVITY_VERIFICATION;
|
375
|
376
|
// 是否开启积分规则
|
376
|
|
- Integer pointsAmount = getRulePoints(CommConstant.POINTS_RULE_ACTIVITY_VERIFICATION);
|
|
377
|
+ Integer pointsAmount = getRulePoints(changeType,orgId);
|
377
|
378
|
if (pointsAmount == 0) {
|
378
|
379
|
return;
|
379
|
380
|
}
|
380
|
381
|
|
381
|
|
- //
|
382
|
|
- String changeType = CommConstant.POINTS_CHANGE_ACTIVITY_VERIFICATION;
|
|
382
|
+
|
383
|
383
|
|
384
|
384
|
// 已经领取过的不会再次领取
|
385
|
385
|
String[] params = {
|
|
@@ -398,4 +398,27 @@ public class TaPointsRecordsServiceImpl extends ServiceImpl<TaPointsRecordsMappe
|
398
|
398
|
taPersonMapper.setFieldIncrement(person.getPersonId(), "points", pointsAmount);
|
399
|
399
|
}
|
400
|
400
|
}
|
|
401
|
+
|
|
402
|
+ /**
|
|
403
|
+ * 消费拼团积分
|
|
404
|
+ * @param person
|
|
405
|
+ * @param integral
|
|
406
|
+ * @param buildingId
|
|
407
|
+ * @param groupActivityId
|
|
408
|
+ */
|
|
409
|
+ @Override
|
|
410
|
+ public void saveGroupRecord(TaPerson person, Integer integral, String buildingId, Integer groupActivityId) {
|
|
411
|
+ TaPointsRecords taPointsRecords = new TaPointsRecords();
|
|
412
|
+ taPointsRecords.setPersonId(person.getPersonId());
|
|
413
|
+ taPointsRecords.setPersonName(person.getNickname());
|
|
414
|
+ taPointsRecords.setPersonType(person.getPersonType());
|
|
415
|
+ taPointsRecords.setPointsAmount(-integral);
|
|
416
|
+ taPointsRecords.setChangeType(CommConstant.POINTS_CHANGE_GROUP);
|
|
417
|
+ taPointsRecords.setChangeParams("{\"group_activity_id\":"+groupActivityId+"}");
|
|
418
|
+ taPointsRecords.setCreateDate(LocalDateTime.now());
|
|
419
|
+ taPointsRecords.setOrgId(person.getOrgId());
|
|
420
|
+ taPointsRecords.setBuildingId(buildingId);
|
|
421
|
+ taPointsRecords.setStatus(CommConstant.STATUS_NORMAL);
|
|
422
|
+ taPointsRecordsMapper.insert(taPointsRecords);
|
|
423
|
+ }
|
401
|
424
|
}
|