|
|
@@ -203,6 +203,19 @@ public class LiveCompletionPointsRecordServiceImpl implements ILiveCompletionPoi
|
|
|
if (user == null) {
|
|
|
throw new BaseException("用户不存在");
|
|
|
}
|
|
|
+ LiveCompletionPointsRecord updateRecord = new LiveCompletionPointsRecord();
|
|
|
+ updateRecord.setId(recordId);
|
|
|
+ updateRecord.setReceiveStatus(1);
|
|
|
+ updateRecord.setReceiveTime(new Date());
|
|
|
+ recordMapper.updateRecord(updateRecord);
|
|
|
+
|
|
|
+ // 7. 返回更新后的记录
|
|
|
+ record.setReceiveStatus(1);
|
|
|
+ record.setReceiveTime(new Date());
|
|
|
+
|
|
|
+ if (record.getPointsAwarded() == 0) {
|
|
|
+ return record;
|
|
|
+ }
|
|
|
|
|
|
Long currentIntegral = user.getIntegral() != null ? user.getIntegral().longValue() : 0L;
|
|
|
Long newIntegral = currentIntegral + record.getPointsAwarded();
|
|
|
@@ -228,16 +241,10 @@ public class LiveCompletionPointsRecordServiceImpl implements ILiveCompletionPoi
|
|
|
List<FsUser> addUserLists = new ArrayList<FsUser>();
|
|
|
addUserLists.add(user);
|
|
|
// 6. 更新完课记录状态
|
|
|
- LiveCompletionPointsRecord updateRecord = new LiveCompletionPointsRecord();
|
|
|
- updateRecord.setId(recordId);
|
|
|
- updateRecord.setReceiveStatus(1);
|
|
|
- updateRecord.setReceiveTime(new Date());
|
|
|
- recordMapper.updateRecord(updateRecord);
|
|
|
+
|
|
|
fsUserService.openPlatformGeneralUserIntegralHandle(addUserLists,recordId, Long.valueOf(record.getPointsAwarded()), FsUserIntegralLogTypeEnum.TYPE_28.getValue());
|
|
|
|
|
|
- // 7. 返回更新后的记录
|
|
|
- record.setReceiveStatus(1);
|
|
|
- record.setReceiveTime(new Date());
|
|
|
+
|
|
|
|
|
|
log.info("用户领取完课积分成功, userId={}, recordId={}, points={}", userId, recordId, record.getPointsAwarded());
|
|
|
|
|
|
@@ -349,7 +356,7 @@ public class LiveCompletionPointsRecordServiceImpl implements ILiveCompletionPoi
|
|
|
}
|
|
|
|
|
|
// 8. 计算积分
|
|
|
- int points = Math.toIntExact(config.getScoreAmount());
|
|
|
+ int points = config.getScoreAmount() == null ? 0 :Math.toIntExact(config.getScoreAmount());
|
|
|
|
|
|
// 9. 创建完课记录
|
|
|
record.setLiveId(liveId);
|