|
|
@@ -61,6 +61,37 @@ public class PointsManageServiceImpl implements PointsManageService {
|
|
|
return addPoints(makerId, rule.getPointValue(), fullReason);
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
+ public boolean addPointsByRuleType(Integer makerId, Integer ruleType, String reason) {
|
|
|
+ // 根据规则类型查询积分规则
|
|
|
+ com.baomidou.mybatisplus.core.conditions.query.QueryWrapper<PointRule> wrapper =
|
|
|
+ new com.baomidou.mybatisplus.core.conditions.query.QueryWrapper<>();
|
|
|
+ wrapper.eq("rule_type", ruleType).eq("status", 1);
|
|
|
+ PointRule rule = pointRuleMapper.selectOne(wrapper);
|
|
|
+
|
|
|
+ if (rule == null) {
|
|
|
+ System.err.println("积分规则不存在,规则类型: " + ruleType);
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ if (rule.getPointValue() <= 0) {
|
|
|
+ System.err.println("积分值必须为正数,规则类型: " + ruleType);
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ // 构建积分变动原因
|
|
|
+ String fullReason = rule.getRuleName();
|
|
|
+ if (reason != null && !reason.isEmpty()) {
|
|
|
+ fullReason += "-" + reason;
|
|
|
+ }
|
|
|
+
|
|
|
+ System.out.println("添加积分 - 红娘ID: " + makerId + ", 规则类型: " + ruleType +
|
|
|
+ ", 规则名称: " + rule.getRuleName() + ", 积分值: " + rule.getPointValue());
|
|
|
+
|
|
|
+ // 调用添加积分方法
|
|
|
+ return addPoints(makerId, rule.getPointValue(), fullReason);
|
|
|
+ }
|
|
|
+
|
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public boolean addPoints(Integer makerId, Integer points, String reason) {
|