|
@@ -125,6 +125,20 @@ public class PointsService implements PointsServiceInterface {
|
|
|
return newSystemPoints;
|
|
return newSystemPoints;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 心愿兑换扣除积分(家长审批通过后调用)
|
|
|
|
|
+ * @param childId 孩子ID
|
|
|
|
|
+ * @param amount 扣除数量
|
|
|
|
|
+ * @return true=扣除成功, false=余额不足
|
|
|
|
|
+ */
|
|
|
|
|
+ @Transactional
|
|
|
|
|
+ public boolean deductForWish(Long childId, Integer amount) {
|
|
|
|
|
+ if (amount == null || amount <= 0) {
|
|
|
|
|
+ return false;
|
|
|
|
|
+ }
|
|
|
|
|
+ return deductSystemPoints(childId, amount, "心愿兑换扣除") >= 0;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
/** @return 扣除后余额,余额不足返回-1 */
|
|
/** @return 扣除后余额,余额不足返回-1 */
|
|
|
@Transactional
|
|
@Transactional
|
|
|
public int deductSystemPoints(Long childId, int amount, String reason) {
|
|
public int deductSystemPoints(Long childId, int amount, String reason) {
|