|
@@ -56,6 +56,12 @@ public class TaPersonServiceImpl extends ServiceImpl<TaPersonMapper, TaPerson> i
|
56
|
56
|
|
57
|
57
|
@Autowired
|
58
|
58
|
TaChatMapper taChatMapper;
|
|
59
|
+
|
|
60
|
+ @Autowired
|
|
61
|
+ private TdPointsRulesMapper tdPointsRulesMapper;
|
|
62
|
+
|
|
63
|
+ @Autowired
|
|
64
|
+ private TaPointsRecordsMapper taPointsRecordsMapper;
|
59
|
65
|
|
60
|
66
|
@Override
|
61
|
67
|
public TaPerson mergePersonWxInfo(WxMaUserInfo userInfo) {
|
|
@@ -125,6 +131,34 @@ public class TaPersonServiceImpl extends ServiceImpl<TaPersonMapper, TaPerson> i
|
125
|
131
|
if (null == tel || "".equals(tel)){
|
126
|
132
|
person.setTel(phone);
|
127
|
133
|
}
|
|
134
|
+
|
|
135
|
+ //查看是否领取过授权积分
|
|
136
|
+ QueryWrapper<TaPointsRecords> taPointsRecordsQueryWrapper = new QueryWrapper<>();
|
|
137
|
+ taPointsRecordsQueryWrapper.eq("change_type",CommConstant.POINTS_AUTHORIZE);
|
|
138
|
+ taPointsRecordsQueryWrapper.like("change_params","%\""+person.getPersonId()+"\"%");
|
|
139
|
+ List<TaPointsRecords> taPointsRecordsList = taPointsRecordsMapper.selectList(taPointsRecordsQueryWrapper);
|
|
140
|
+ if (taPointsRecordsList.size() < 0){
|
|
141
|
+ //发放积分
|
|
142
|
+ TdPointsRules tdPointsRules = tdPointsRulesMapper.selectById(2);
|
|
143
|
+ //插入积分消费流水表
|
|
144
|
+ TaPointsRecords taPointsRecords = new TaPointsRecords();
|
|
145
|
+ taPointsRecords.setPersonId(person.getPersonId());
|
|
146
|
+ taPointsRecords.setPersonName(com.huiju.estateagents.common.StringUtils.ifNull(person.getName(),person.getNickname()));
|
|
147
|
+ taPointsRecords.setPersonType(person.getPersonType());
|
|
148
|
+ taPointsRecords.setPointsAmount(tdPointsRules.getPointsAmount());
|
|
149
|
+ taPointsRecords.setChangeType(CommConstant.POINTS_AUTHORIZE);
|
|
150
|
+ JSONObject jsonObject = new JSONObject();
|
|
151
|
+ jsonObject.put("person_id",person.getPersonId());
|
|
152
|
+ taPointsRecords.setChangeParams(jsonObject.toJSONString());
|
|
153
|
+ taPointsRecords.setCreateDate(LocalDateTime.now());
|
|
154
|
+ taPointsRecords.setStatus(CommConstant.STATUS_NORMAL);
|
|
155
|
+ taPointsRecordsMapper.insert(taPointsRecords);
|
|
156
|
+ //添加积分
|
|
157
|
+ UpdateWrapper<TaPerson> taPersonwrapper = new UpdateWrapper<>();
|
|
158
|
+ wrapper.eq("person_id", person.getPersonId());
|
|
159
|
+ wrapper.setSql("points = IFNULL(points, 0) + " + String.valueOf(tdPointsRules.getPointsAmount()));
|
|
160
|
+ taPersonMapper.update(new TaPerson(), taPersonwrapper);
|
|
161
|
+ }
|
128
|
162
|
|
129
|
163
|
return person;
|
130
|
164
|
}
|
|
@@ -313,11 +347,28 @@ public class TaPersonServiceImpl extends ServiceImpl<TaPersonMapper, TaPerson> i
|
313
|
347
|
// 增加积分
|
314
|
348
|
// 1-7 天积分 1-7, 超过7天按 7 个积分算
|
315
|
349
|
int points = durationDays >= 7 ? 7 : durationDays;
|
|
350
|
+ //签到获取积分
|
|
351
|
+ //TdPointsRules tdPointsRules = tdPointsRulesMapper.selectById(1);
|
|
352
|
+ //int points = tdPointsRules.getPointsAmount();
|
316
|
353
|
UpdateWrapper<TaPerson> wrapper = new UpdateWrapper<>();
|
317
|
354
|
wrapper.eq("person_id", taPerson.getPersonId());
|
318
|
355
|
wrapper.setSql("points = IFNULL(points, 0) + " + String.valueOf(points));
|
319
|
356
|
// wrapper.set("points", "points + " + String.valueOf(points));
|
320
|
357
|
taPersonMapper.update(new TaPerson(), wrapper);
|
|
358
|
+
|
|
359
|
+ //插入积分消费流水表
|
|
360
|
+ TaPointsRecords taPointsRecords = new TaPointsRecords();
|
|
361
|
+ taPointsRecords.setPersonId(taPerson.getPersonId());
|
|
362
|
+ taPointsRecords.setPersonName(StringUtils.ifNull(taPerson.getName(),taPerson.getNickname()));
|
|
363
|
+ taPointsRecords.setPersonType(taPerson.getPersonType());
|
|
364
|
+ taPointsRecords.setPointsAmount(points);
|
|
365
|
+ taPointsRecords.setChangeType(CommConstant.POINTS_CHECKIN);
|
|
366
|
+ JSONObject jsonObject = new JSONObject();
|
|
367
|
+ jsonObject.put("person_id",taPerson.getPersonId());
|
|
368
|
+ taPointsRecords.setChangeParams(jsonObject.toJSONString());
|
|
369
|
+ taPointsRecords.setCreateDate(LocalDateTime.now());
|
|
370
|
+ taPointsRecords.setStatus(CommConstant.STATUS_NORMAL);
|
|
371
|
+ taPointsRecordsMapper.insert(taPointsRecords);
|
321
|
372
|
|
322
|
373
|
Map<String, Object> result = new HashMap<>();
|
323
|
374
|
|