|
@@ -69,7 +69,7 @@ public class TaPointsRecordsServiceImpl extends ServiceImpl<TaPointsRecordsMappe
|
69
|
69
|
}
|
70
|
70
|
|
71
|
71
|
@Override
|
72
|
|
- public void sharePoints(TaShare taShare) {
|
|
72
|
+ public void sharePoints(TaShare taShare, Integer orgId) {
|
73
|
73
|
// 是否开启积分规则
|
74
|
74
|
Integer pointsAmount = getRulePoints(CommConstant.POINTS_RULE_SHARE_POSTER);
|
75
|
75
|
if (pointsAmount == 0) {
|
|
@@ -92,13 +92,13 @@ public class TaPointsRecordsServiceImpl extends ServiceImpl<TaPointsRecordsMappe
|
92
|
92
|
|
93
|
93
|
// 发放积分
|
94
|
94
|
TaPerson person = taPersonMapper.selectById(taShare.getPersonId());
|
95
|
|
- if (savePoints(person, changeType, changeParams, pointsAmount)) {
|
|
95
|
+ if (savePoints(person, changeType, changeParams, pointsAmount, orgId)) {
|
96
|
96
|
taPersonMapper.setFieldIncrement(person.getPersonId(), "points", pointsAmount);
|
97
|
97
|
}
|
98
|
98
|
}
|
99
|
99
|
|
100
|
100
|
@Override
|
101
|
|
- public void sharePosterAll(String recommenderId) {
|
|
101
|
+ public void sharePosterAll(String recommenderId, Integer orgId) {
|
102
|
102
|
// 是否开启积分规则
|
103
|
103
|
Integer pointsAmount = getRulePoints(CommConstant.POINTS_RULE_SHARE_POSTER);
|
104
|
104
|
if (pointsAmount == 0) {
|
|
@@ -114,13 +114,13 @@ public class TaPointsRecordsServiceImpl extends ServiceImpl<TaPointsRecordsMappe
|
114
|
114
|
|
115
|
115
|
// 发放积分
|
116
|
116
|
TaPerson person = taPersonMapper.selectById(recommenderId);
|
117
|
|
- if (savePoints(person, changeType, changeParams, pointsAmount)) {
|
|
117
|
+ if (savePoints(person, changeType, changeParams, pointsAmount, orgId)) {
|
118
|
118
|
taPersonMapper.setFieldIncrement(person.getPersonId(), "points", pointsAmount);
|
119
|
119
|
}
|
120
|
120
|
}
|
121
|
121
|
|
122
|
122
|
@Override
|
123
|
|
- public void checkinPoints(TaPersonSign taPersonSign) {
|
|
123
|
+ public void checkinPoints(TaPersonSign taPersonSign,Integer orgId) {
|
124
|
124
|
// 是否开启积分规则
|
125
|
125
|
Integer pointsAmount = getRulePoints(CommConstant.POINTS_RULE_CHECKIN);
|
126
|
126
|
if (pointsAmount == 0) {
|
|
@@ -153,13 +153,13 @@ public class TaPointsRecordsServiceImpl extends ServiceImpl<TaPointsRecordsMappe
|
153
|
153
|
|
154
|
154
|
// 发放积分
|
155
|
155
|
TaPerson person = taPersonMapper.selectById(taPersonSign.getPersonId());
|
156
|
|
- if (savePoints(person, changeType, changeParams, pointsAmount)) {
|
|
156
|
+ if (savePoints(person, changeType, changeParams, pointsAmount, orgId)) {
|
157
|
157
|
taPersonMapper.setFieldIncrement(person.getPersonId(), "points", pointsAmount);
|
158
|
158
|
}
|
159
|
159
|
}
|
160
|
160
|
|
161
|
161
|
@Override
|
162
|
|
- public void signUpPoints(TaPerson taPerson) {
|
|
162
|
+ public void signUpPoints(TaPerson taPerson, Integer orgId) {
|
163
|
163
|
// 是否开启积分规则
|
164
|
164
|
Integer pointsAmount = getRulePoints(CommConstant.POINTS_RULE_SIGNUP_AGENT);
|
165
|
165
|
if (pointsAmount == 0) {
|
|
@@ -180,13 +180,13 @@ public class TaPointsRecordsServiceImpl extends ServiceImpl<TaPointsRecordsMappe
|
180
|
180
|
}
|
181
|
181
|
|
182
|
182
|
// 发放积分
|
183
|
|
- if (savePoints(taPerson, changeType, changeParams, pointsAmount)) {
|
|
183
|
+ if (savePoints(taPerson, changeType, changeParams, pointsAmount, orgId)) {
|
184
|
184
|
taPersonMapper.setFieldIncrement(taPerson.getPersonId(), "points", pointsAmount);
|
185
|
185
|
}
|
186
|
186
|
}
|
187
|
187
|
|
188
|
188
|
@Override
|
189
|
|
- public void recommendCustPoints(TaRecommendCustomer taRecommendCustomer) {
|
|
189
|
+ public void recommendCustPoints(TaRecommendCustomer taRecommendCustomer, Integer orgId) {
|
190
|
190
|
// 是否开启积分规则
|
191
|
191
|
Integer pointsAmount = getRulePoints(CommConstant.POINTS_RULE_RECOMMENDER_CUSTOMER);
|
192
|
192
|
if (pointsAmount == 0) {
|
|
@@ -211,7 +211,7 @@ public class TaPointsRecordsServiceImpl extends ServiceImpl<TaPointsRecordsMappe
|
211
|
211
|
|
212
|
212
|
// 发放积分
|
213
|
213
|
TaPerson taPerson = taPersonMapper.getById(taRecommendCustomer.getRecommendPerson());
|
214
|
|
- if (savePoints(taPerson, changeType, changeParams, pointsAmount)) {
|
|
214
|
+ if (savePoints(taPerson, changeType, changeParams, pointsAmount, orgId)) {
|
215
|
215
|
taPersonMapper.setFieldIncrement(taPerson.getPersonId(), "points", pointsAmount);
|
216
|
216
|
}
|
217
|
217
|
}
|
|
@@ -223,7 +223,7 @@ public class TaPointsRecordsServiceImpl extends ServiceImpl<TaPointsRecordsMappe
|
223
|
223
|
}
|
224
|
224
|
|
225
|
225
|
@Override
|
226
|
|
- public void consumeGoodsPoints(TaGoods taGoods) {
|
|
226
|
+ public void consumeGoodsPoints(TaGoods taGoods, Integer orgId) {
|
227
|
227
|
Integer minusPoints = taGoods.getPointPrice();
|
228
|
228
|
if (null == minusPoints || minusPoints <= 0) {
|
229
|
229
|
return;
|
|
@@ -249,12 +249,12 @@ public class TaPointsRecordsServiceImpl extends ServiceImpl<TaPointsRecordsMappe
|
249
|
249
|
|
250
|
250
|
// 发放积分
|
251
|
251
|
Integer pointsAmount = 0 - minusPoints;
|
252
|
|
- if (savePoints(taPerson, CommConstant.POINTS_CHANGE_GOODS, changeParams, pointsAmount)) {
|
|
252
|
+ if (savePoints(taPerson, CommConstant.POINTS_CHANGE_GOODS, changeParams, pointsAmount, orgId)) {
|
253
|
253
|
taPersonMapper.setFieldIncrement(taPerson.getPersonId(), "points", pointsAmount);
|
254
|
254
|
}
|
255
|
255
|
}
|
256
|
256
|
|
257
|
|
- private boolean savePoints(TaPerson person, String changeType, String changeParams, Integer pointsAmount) {
|
|
257
|
+ private boolean savePoints(TaPerson person, String changeType, String changeParams, Integer pointsAmount, Integer orgId) {
|
258
|
258
|
TaPointsRecords taPointsRecords = new TaPointsRecords();
|
259
|
259
|
taPointsRecords.setPersonId(person.getPersonId());
|
260
|
260
|
taPointsRecords.setPersonName(StringUtils.ifNull(person.getName(),person.getNickname()));
|
|
@@ -264,6 +264,7 @@ public class TaPointsRecordsServiceImpl extends ServiceImpl<TaPointsRecordsMappe
|
264
|
264
|
taPointsRecords.setChangeParams(changeParams);
|
265
|
265
|
taPointsRecords.setStatus(CommConstant.STATUS_NORMAL);
|
266
|
266
|
taPointsRecords.setCreateDate(LocalDateTime.now());
|
|
267
|
+ taPointsRecords.setOrgId(orgId);
|
267
|
268
|
|
268
|
269
|
return taPointsRecordsMapper.insert(taPointsRecords) > 0;
|
269
|
270
|
}
|
|
@@ -282,7 +283,7 @@ public class TaPointsRecordsServiceImpl extends ServiceImpl<TaPointsRecordsMappe
|
282
|
283
|
// }
|
283
|
284
|
// }
|
284
|
285
|
|
285
|
|
- private void sendPoints(TaPerson person,Integer rulesId,String shareType) {
|
|
286
|
+ private void sendPoints(TaPerson person,Integer rulesId,String shareType, Integer orgId) {
|
286
|
287
|
//发放积分
|
287
|
288
|
QueryWrapper<TdPointsRules> queryWrapper = new QueryWrapper<>();
|
288
|
289
|
queryWrapper.eq("rule_id",rulesId);
|
|
@@ -301,6 +302,7 @@ public class TaPointsRecordsServiceImpl extends ServiceImpl<TaPointsRecordsMappe
|
301
|
302
|
taPointsRecords.setChangeParams(jsonObject.toJSONString());
|
302
|
303
|
taPointsRecords.setCreateDate(LocalDateTime.now());
|
303
|
304
|
taPointsRecords.setStatus(CommConstant.STATUS_NORMAL);
|
|
305
|
+ taPointsRecords.setOrgId(orgId);
|
304
|
306
|
taPointsRecordsMapper.insert(taPointsRecords);
|
305
|
307
|
//添加积分
|
306
|
308
|
UpdateWrapper<TaPerson> taPersonwrapper = new UpdateWrapper<>();
|