|
@@ -139,25 +139,30 @@ public class TaPersonServiceImpl extends ServiceImpl<TaPersonMapper, TaPerson> i
|
139
|
139
|
List<TaPointsRecords> taPointsRecordsList = taPointsRecordsMapper.selectList(taPointsRecordsQueryWrapper);
|
140
|
140
|
if (taPointsRecordsList.size() < 0){
|
141
|
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);
|
|
142
|
+ QueryWrapper<TdPointsRules> queryWrapper = new QueryWrapper<>();
|
|
143
|
+ queryWrapper.eq("rule_id",2);
|
|
144
|
+ queryWrapper.eq("status",CommConstant.STATUS_NORMAL);
|
|
145
|
+ TdPointsRules tdPointsRules = tdPointsRulesMapper.selectOne(queryWrapper);
|
|
146
|
+ if (null != tdPointsRules) {
|
|
147
|
+ //插入积分消费流水表
|
|
148
|
+ TaPointsRecords taPointsRecords = new TaPointsRecords();
|
|
149
|
+ taPointsRecords.setPersonId(person.getPersonId());
|
|
150
|
+ taPointsRecords.setPersonName(com.huiju.estateagents.common.StringUtils.ifNull(person.getName(),person.getNickname()));
|
|
151
|
+ taPointsRecords.setPersonType(person.getPersonType());
|
|
152
|
+ taPointsRecords.setPointsAmount(tdPointsRules.getPointsAmount());
|
|
153
|
+ taPointsRecords.setChangeType(CommConstant.POINTS_AUTHORIZE);
|
|
154
|
+ JSONObject jsonObject = new JSONObject();
|
|
155
|
+ jsonObject.put("person_id",person.getPersonId());
|
|
156
|
+ taPointsRecords.setChangeParams(jsonObject.toJSONString());
|
|
157
|
+ taPointsRecords.setCreateDate(LocalDateTime.now());
|
|
158
|
+ taPointsRecords.setStatus(CommConstant.STATUS_NORMAL);
|
|
159
|
+ taPointsRecordsMapper.insert(taPointsRecords);
|
|
160
|
+ //添加积分
|
|
161
|
+ UpdateWrapper<TaPerson> taPersonwrapper = new UpdateWrapper<>();
|
|
162
|
+ wrapper.eq("person_id", person.getPersonId());
|
|
163
|
+ wrapper.setSql("points = IFNULL(points, 0) + " + String.valueOf(tdPointsRules.getPointsAmount()));
|
|
164
|
+ taPersonMapper.update(new TaPerson(), taPersonwrapper);
|
|
165
|
+ }
|
161
|
166
|
}
|
162
|
167
|
|
163
|
168
|
return person;
|