|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import java.lang.reflect.Field; | 
|---|
|  |  |  | import java.math.BigDecimal; | 
|---|
|  |  |  | import java.util.Map; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * @author wzy | 
|---|
|  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | public int reduce(BigDecimal amount, Long memberId, String field) { | 
|---|
|  |  |  | public int reduce(BigDecimal amount, Long memberId, String field, Map<String, BigDecimal> map) { | 
|---|
|  |  |  | int i = 0; | 
|---|
|  |  |  | boolean flag = true; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | BigDecimal balance = (BigDecimal) declaredField.get(wallet); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if (amount.compareTo(balance) > 0) { | 
|---|
|  |  |  | return 2; | 
|---|
|  |  |  | if (map == null) { | 
|---|
|  |  |  | return 2; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | // 判断 赠送积分,如果剩下赠送积分不等于0且小于amount, 则扣除所有赠送积分 | 
|---|
|  |  |  | if ("score".equals(field)) { | 
|---|
|  |  |  | if (balance.compareTo(BigDecimal.ZERO) == 0) { | 
|---|
|  |  |  | return 2; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | amount = balance; | 
|---|
|  |  |  | map.put("amount", amount); | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | return 2; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | declaredField.set(update, balance.subtract(amount)); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | public int reduce(BigDecimal amount, Long memberId, String field) { | 
|---|
|  |  |  | return reduce(amount, memberId, field, null); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | @Transactional(rollbackFor = Exception.class) | 
|---|
|  |  |  | public void commissionChange(CommissionChangeDto commissionChange) { | 
|---|
|  |  |  | MallMember member = LoginUserUtil.getLoginUser(); | 
|---|