|
|
@ -41,7 +41,7 @@ public class ConsumeServiceImpl implements ConsumeService { |
|
|
|
//新增消费记录 |
|
|
|
public int insert(Detail detail) throws Exception { |
|
|
|
int result =consumeMapper.insert(detail); |
|
|
|
System.out.println(detail); |
|
|
|
System.out.println(detail+"----------------------------------------"); |
|
|
|
if (result != 1) { |
|
|
|
throw new Exception("Failed to insert another entity"); |
|
|
|
} |
|
|
@ -87,30 +87,9 @@ public class ConsumeServiceImpl implements ConsumeService { |
|
|
|
detail.setOrderCode(uuid); |
|
|
|
//添加表单数据 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//消费完成后需要将用户的三币从user表中去掉 |
|
|
|
//消费记录添加完成 |
|
|
|
if(result==1){ |
|
|
|
userService.updateFreecoin(detail); |
|
|
|
// BigDecimal paidGold1 =detail.getRechargeCoin(); |
|
|
|
// BigDecimal freeGold1 =detail.getFreeCoin(); |
|
|
|
// BigDecimal taskGold1 =detail.getTaskCoin(); |
|
|
|
BigDecimal newbuyjb = user.getBuyJb().subtract(paidGold1); |
|
|
|
user.setBuyJb(newbuyjb); |
|
|
|
|
|
|
|
BigDecimal newtask = user.getCoreJb().subtract(taskGold1); |
|
|
|
user.setCoreJb(newtask); |
|
|
|
|
|
|
|
|
|
|
|
System.out.println(user.getFree6()+"-------1---"); |
|
|
|
System.out.println(user.getFree12()+"-------2---"); |
|
|
|
System.out.println(user.getFree6()+"----------"); |
|
|
|
System.out.println(user.getFree6()+"-------1---"); |
|
|
|
|
|
|
|
// 更新用户对象以反映新的余额 |
|
|
|
result = userMapper.update(user); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return result; |
|
|
|