|
|
@@ -48,32 +48,6 @@ public class ReceivePonitsService { |
|
|
|
return result; |
|
|
|
} |
|
|
|
|
|
|
|
WestreamKnowUser westreamKnowUser = westreamKnowUserMapper.selectOne(new LambdaQueryWrapper<WestreamKnowUser>() |
|
|
|
.eq(WestreamKnowUser::getTenantId, request.getTenantId()) |
|
|
|
.eq(WestreamKnowUser::getOpenid, request.getOpenid()) |
|
|
|
.eq(WestreamKnowUser::getKnowId, request.getKnowId()) |
|
|
|
.eq(WestreamKnowUser::getMark, MarkEnum.VALID.getCode())); |
|
|
|
if (ObjectUtil.isNotEmpty(westreamKnowUser)) { |
|
|
|
return JsonResult.error("您已获得过积分了,仅能获取一次积分。"); |
|
|
|
} else { |
|
|
|
westreamKnowUser = new WestreamKnowUser(); |
|
|
|
westreamKnowUser.setTenantId(request.getTenantId()); |
|
|
|
westreamKnowUser.setOpenid(request.getOpenid()); |
|
|
|
westreamKnowUser.setKnowId(request.getKnowId()); |
|
|
|
westreamKnowUser.setCreateUser(0); |
|
|
|
westreamKnowUser.setCreateTime(DateUtils.now()); |
|
|
|
westreamKnowUserMapper.insert(westreamKnowUser); |
|
|
|
} |
|
|
|
|
|
|
|
WestreamUser westreamUser = westreamUserMapper.selectOne(new LambdaQueryWrapper<WestreamUser>() |
|
|
|
.eq(WestreamUser::getTenantId, request.getTenantId()) |
|
|
|
.eq(WestreamUser::getOpenid, request.getOpenid()) |
|
|
|
.eq(WestreamUser::getMark, MarkEnum.VALID.getCode())); |
|
|
|
if (ObjectUtil.isEmpty(westreamUser)) { |
|
|
|
log.info("领取积分,该用户不存在,tenantId:{}, openid:{}", request.getTenantId(), request.getOpenid()); |
|
|
|
return JsonResult.success("该用户不存在"); |
|
|
|
} |
|
|
|
|
|
|
|
ThDict dict = dictMapper.selectOne(new LambdaQueryWrapper<ThDict>() |
|
|
|
.eq(ThDict::getTenantId, request.getTenantId()) |
|
|
|
.eq(ThDict::getCode, DictEnum.POINTS_RULE.getCode()) |
|
|
@@ -93,6 +67,56 @@ public class ReceivePonitsService { |
|
|
|
return JsonResult.success("积分规则未设置"); |
|
|
|
} |
|
|
|
|
|
|
|
ThDictData dailyLimitWestreamSubmitDictData = dictDataMapper.selectOne(new LambdaQueryWrapper<ThDictData>() |
|
|
|
.eq(ThDictData::getTenantId, request.getTenantId()) |
|
|
|
.eq(ThDictData::getDictId, dict.getId()) |
|
|
|
.eq(ThDictData::getName, DictDataEnum.DAILY_LIMIT_WESTREAM_SUBMIT.getCode()) |
|
|
|
.eq(ThDictData::getMark, MarkEnum.VALID.getCode())); |
|
|
|
if (ObjectUtil.isEmpty(dailyLimitWestreamSubmitDictData)) { |
|
|
|
log.info("领取积分,每日上报最大限额字典项不存在,tenantId:{}, dictDataName:{}", request.getTenantId(), DictDataEnum.DAILY_LIMIT_WESTREAM_SUBMIT.getCode()); |
|
|
|
return JsonResult.success("积分规则未设置"); |
|
|
|
} |
|
|
|
|
|
|
|
Integer dailyLimitWestreamSubmit = 0; |
|
|
|
if (ObjectUtil.isNotEmpty(dailyLimitWestreamSubmitDictData)) { |
|
|
|
dailyLimitWestreamSubmit = Integer.parseInt(dailyLimitWestreamSubmitDictData.getValue()); |
|
|
|
} |
|
|
|
|
|
|
|
String pointsTime = DateUtils.getDate(); |
|
|
|
Integer totalPointsByToDay = userPointsDetailMapper.selectTotalPointsByToDay(request.getOpenid(), pointsTime); |
|
|
|
if (ObjectUtil.isNotEmpty(totalPointsByToDay)) { |
|
|
|
if (totalPointsByToDay >= dailyLimitWestreamSubmit) { |
|
|
|
log.info("领取积分,已超过每日积分上限,totalPointsByToDay:{}, dailyLimitWestreamSubmit:{}", totalPointsByToDay, dailyLimitWestreamSubmit); |
|
|
|
return JsonResult.success("已超过每日积分上限"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
WestreamUser westreamUser = westreamUserMapper.selectOne(new LambdaQueryWrapper<WestreamUser>() |
|
|
|
.eq(WestreamUser::getTenantId, request.getTenantId()) |
|
|
|
.eq(WestreamUser::getOpenid, request.getOpenid()) |
|
|
|
.eq(WestreamUser::getMark, MarkEnum.VALID.getCode())); |
|
|
|
if (ObjectUtil.isEmpty(westreamUser)) { |
|
|
|
log.info("领取积分,该用户不存在,tenantId:{}, openid:{}", request.getTenantId(), request.getOpenid()); |
|
|
|
return JsonResult.success("该用户不存在"); |
|
|
|
} |
|
|
|
|
|
|
|
WestreamKnowUser westreamKnowUser = westreamKnowUserMapper.selectOne(new LambdaQueryWrapper<WestreamKnowUser>() |
|
|
|
.eq(WestreamKnowUser::getTenantId, request.getTenantId()) |
|
|
|
.eq(WestreamKnowUser::getOpenid, request.getOpenid()) |
|
|
|
.eq(WestreamKnowUser::getKnowId, request.getKnowId()) |
|
|
|
.eq(WestreamKnowUser::getMark, MarkEnum.VALID.getCode())); |
|
|
|
if (ObjectUtil.isNotEmpty(westreamKnowUser)) { |
|
|
|
return JsonResult.error("您已获得过积分了,仅能获取一次积分。"); |
|
|
|
} else { |
|
|
|
westreamKnowUser = new WestreamKnowUser(); |
|
|
|
westreamKnowUser.setTenantId(request.getTenantId()); |
|
|
|
westreamKnowUser.setOpenid(request.getOpenid()); |
|
|
|
westreamKnowUser.setKnowId(request.getKnowId()); |
|
|
|
westreamKnowUser.setCreateUser(0); |
|
|
|
westreamKnowUser.setCreateTime(DateUtils.now()); |
|
|
|
westreamKnowUserMapper.insert(westreamKnowUser); |
|
|
|
} |
|
|
|
|
|
|
|
UserPointsDetail userPointsDetail = new UserPointsDetail(); |
|
|
|
userPointsDetail.setTenantId(request.getTenantId()); |
|
|
|
userPointsDetail.setOpenid(request.getOpenid()); |