format the code and remove the unused import

This commit is contained in:
wuchunlei
2023-10-07 13:42:25 +08:00
parent fb7016d471
commit 6ca47a843f
11 changed files with 165 additions and 402 deletions

View File

@@ -190,8 +190,6 @@ public class WechatPayConfig implements Serializable {
* @return
*/
@Bean(name = "wxPayClient")
public CloseableHttpClient getWxPayClient(Verifier verifier) {
log.info("获取HttpClient");

View File

@@ -48,7 +48,7 @@ import java.util.concurrent.locks.ReentrantLock;
@Slf4j
@RestController
@CrossOrigin //跨域
@CrossOrigin
@RequestMapping("/pay")
@Configuration
public class WeChatPayController {
@@ -254,33 +254,24 @@ public class WeChatPayController {
BuyOrderEntity order = this.buyOrderService.getOne(new QueryWrapper<BuyOrderEntity>().eq("order_sn", orderNo));
PayWechatOrderEntity wechatEntity = new PayWechatOrderEntity();
if(!ObjectUtils.isEmpty(order)){
wechatEntity = this.payWechatOrderService.getOne(new QueryWrapper<PayWechatOrderEntity>().eq("order_sn", order.getOrderSn()));
}else{
log.error("无效订单!");
return R.error(500,"无效订单!");
}
// 1.根据订单id获取订单信息
if("order".equals(order.getOrderType())){
BuyOrderEntity orderEntity = buyOrderService.getBaseMapper().selectOne(new QueryWrapper<BuyOrderEntity>().eq("order_sn", wechatEntity.getOrderSn()));
BigDecimal realMoney = orderEntity.getRealMoney();
//更新 订单 记录
if (wechatEntity.getTotalAmount().compareTo(realMoney) == 0) {
buyOrderService.updateOrderStatus(Integer.valueOf(order.getUserId()),order.getOrderSn(),"0");
}
}
if("point".equals(order.getOrderType())){
// List<BookBuyConfigEntity> bookBuyConfigEntity = bookBuyConfigService.getBaseMapper().selectList(new QueryWrapper<BookBuyConfigEntity>().eq("price_type_id", ""));
// 插入花生币 变动记录
PayWechatOrderEntity buy_order_id = payWechatOrderService.getBaseMapper().selectOne(new QueryWrapper<PayWechatOrderEntity>().eq("order_sn", order.getOrderSn()));
Integer buyorder= buy_order_id.getBuyOrderId();
BookBuyConfigEntity bookBuyConfigEntity = bookBuyConfigService.getById(buyorder);
String realMoney =bookBuyConfigEntity.getRealMoney();
Integer money = Integer.valueOf(realMoney);
userService.rechargeHSPoint(Integer.valueOf(order.getUserId()),money);
@@ -288,7 +279,6 @@ public class WeChatPayController {
transactionDetailsEntity.setUserId(order.getUserId());
transactionDetailsEntity.setChangeAmount(new BigDecimal(money));
transactionDetailsEntity.setOrderType("充值");
// transactionDetailsEntity.setRelationId(wechatEntity.getId().intValue());
transactionDetailsEntity.setRelationId(buy_order_id.getId().intValue());
transactionDetailsEntity.setRemark("充值");