|
@@ -22,6 +22,7 @@ import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
|
|
+import java.math.BigDecimal;
|
|
|
import java.text.ParseException;
|
|
|
import java.text.SimpleDateFormat;
|
|
|
import java.util.*;
|
|
@@ -1109,13 +1110,15 @@ public class RegisterServiceImpl implements RegisterService {
|
|
|
//1.user表扣豆子
|
|
|
VipPackage pac = vipMapper.findUserPackage(packageId);
|
|
|
Integer userBeans = vipMapper.findUserBeans(userId);
|
|
|
- Long l = Math.multiplyExact(Math.round(pac.getPrice()), pac.getProportion());
|
|
|
- Long beans = Long.valueOf(userBeans);
|
|
|
- Long result = Math.subtractExact(beans, l);
|
|
|
- String s = result.toString();
|
|
|
- vipMapper.updateUserBeans(userId, Integer.valueOf(s));
|
|
|
+ BigDecimal b1 = new BigDecimal(pac.getPrice());
|
|
|
+ BigDecimal b2 = new BigDecimal(pac.getProportion());
|
|
|
+ BigDecimal b3 = new BigDecimal(userBeans);
|
|
|
+ BigDecimal multiply = b1.multiply(b2);
|
|
|
+ //b3已有豆子-b1价格*b2比例
|
|
|
+ Integer integer = Integer.valueOf(String.valueOf(b3.subtract(multiply)));
|
|
|
+ vipMapper.updateUserBeans(userId, integer);
|
|
|
//采美豆消费表记录消费
|
|
|
- vipMapper.addUserBeansHistory(userId, Integer.valueOf((int) (pac.getPrice() * pac.getProportion())));
|
|
|
+ vipMapper.addUserBeansHistory(userId, Integer.valueOf(String.valueOf(multiply)));
|
|
|
Calendar cal = Calendar.getInstance();
|
|
|
if (repayFlag == 0) {
|
|
|
SuperVipPo superVip = new SuperVipPo();
|
|
@@ -1210,7 +1213,7 @@ public class RegisterServiceImpl implements RegisterService {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- log.info(userId + "消费采美豆" + l + "会员到期时间至" + cal.getTime());
|
|
|
+ log.info(userId + "消费采美豆" + multiply + "会员到期时间至" + cal.getTime());
|
|
|
}
|
|
|
|
|
|
/**
|