修改虚拟币记录
This commit is contained in:
@@ -18,6 +18,7 @@ import lombok.RequiredArgsConstructor;
|
||||
import lombok.experimental.FieldDefaults;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import java.math.BigDecimal;
|
||||
@@ -58,6 +59,7 @@ public class AppController {
|
||||
* @return 验证结果
|
||||
*/
|
||||
@RequestMapping(value = "/veri", method = RequestMethod.POST)
|
||||
@Transactional
|
||||
public Result verifyIap(@RequestBody IapRequestDTO dto) {
|
||||
Lock lock = new ReentrantLock();
|
||||
lock.lock();
|
||||
@@ -119,36 +121,16 @@ public class AppController {
|
||||
String body = dto.getProductId();
|
||||
// 插入花生币 变动记录
|
||||
BookBuyConfigEntity bookBuyConfigEntity = this.bookBuyConfigService.getById(Integer.valueOf(body));
|
||||
MyUserEntity userEntity = userService.getById(Integer.valueOf(customerid));
|
||||
String realMoney = bookBuyConfigEntity.getMoney();
|
||||
Integer money = Integer.valueOf(realMoney);
|
||||
userService.rechargeHSPoint(Integer.valueOf(customerid), money);
|
||||
TransactionDetailsEntity transactionDetailsEntity = new TransactionDetailsEntity();
|
||||
transactionDetailsEntity.setUserId(Integer.valueOf(customerid));
|
||||
transactionDetailsEntity.setChangeAmount(new BigDecimal(money));
|
||||
transactionDetailsEntity.setOrderType("充值");
|
||||
transactionDetailsEntity.setRelationId(order.getId());
|
||||
transactionDetailsEntity.setRemark("苹果充值:"+order.getOrderid());
|
||||
MyUserEntity user = userService.getById(Integer.valueOf(customerid));
|
||||
BigDecimal peanutCoin = user.getPeanutCoin();
|
||||
transactionDetailsEntity.setUserBalance(peanutCoin);
|
||||
transactionDetailsEntity.setUserName(user.getNickname());
|
||||
transactionDetailsEntity.setTel(user.getTel());
|
||||
transactionDetailsService.save(transactionDetailsEntity);
|
||||
// 插入 花生币 充值记录
|
||||
PayPaymentOrderEntity payPaymentOrderEntity = new PayPaymentOrderEntity();
|
||||
payPaymentOrderEntity.setUserId(Integer.valueOf(customerid));
|
||||
payPaymentOrderEntity.setOrderId(order.getTransactionId());
|
||||
payPaymentOrderEntity.setRealAmount(new BigDecimal(bookBuyConfigEntity.getRealMoney()));
|
||||
payPaymentOrderEntity.setRechargeAmount(new BigDecimal(bookBuyConfigEntity.getMoney()));
|
||||
payPaymentOrderEntity.setRechargeChannel(bookBuyConfigEntity.getQudao());
|
||||
payPaymentOrderEntity.setRechargeStatus("success");
|
||||
payPaymentOrderEntity.setSuccessTime(new Date());
|
||||
payPaymentOrderEntity.setUserName(user.getNickname());
|
||||
payPaymentOrderEntity.setTel(user.getTel());
|
||||
payPaymentOrderService.save(payPaymentOrderEntity);
|
||||
userService.rechargeHSPoint(userEntity, Integer.valueOf(realMoney));
|
||||
//插入虚拟币消费记录
|
||||
transactionDetailsService.rechargeRecord(userEntity,realMoney,order.getId(),"苹果",order.getOrderid());
|
||||
//插入花生币充值记录
|
||||
payPaymentOrderService.insertDetail(userEntity,bookBuyConfigEntity,Integer.parseInt(order.getTransactionId()));
|
||||
buyOrderService.updateOrderStatus(Integer.valueOf(customerid), dto.getOrderId(), "2");
|
||||
order.setMoney(Integer.valueOf(bookBuyConfigEntity.getRealMoney()));
|
||||
order.setUsername(user.getName());
|
||||
order.setUsername(userEntity.getName());
|
||||
orderService.saveOrUpdate(order);
|
||||
orderService.update();
|
||||
return Result.ok0();
|
||||
|
||||
Reference in New Issue
Block a user