提交修改

This commit is contained in:
quyixiao 2025-11-17 08:49:59 +08:00
parent 069d64eb7c
commit f9cfef17ea
5 changed files with 65 additions and 24 deletions

View File

@ -10,7 +10,7 @@ import java.util.Date;import java.util.Date;
/**
*购物车
* @author quyixiao
* @since 2025-11-09
* @since 2025-11-17
*/
@Data
@ -29,7 +29,7 @@ private static final long serialVersionUID = 1L;
public final static String buyer_phone = CLASS_NAME + "buyer_phone"; // 买家手机号
public final static String buyer_name = CLASS_NAME + "buyer_name"; // 买家名
public final static String buyer_weixin = CLASS_NAME + "buyer_weixin"; // 买家微信
public final static String all_price = CLASS_NAME + "all_price"; // 总价
public final static String pay_amount = CLASS_NAME + "pay_amount"; // 支付金额
public final static String refund_amount = CLASS_NAME + "refund_amount"; // 退款金额
public final static String refund_count = CLASS_NAME + "refund_count"; // 退货数量
public final static String buyer_id = CLASS_NAME + "buyer_id"; // 买家id
@ -48,6 +48,7 @@ private static final long serialVersionUID = 1L;
public final static String trade_info = CLASS_NAME + "trade_info"; // 交易信息
public final static String transaction_id = CLASS_NAME + "transaction_id"; // 事务id
public final static String buyer_address_id = CLASS_NAME + "buyer_address_id"; // 买家地址id
public final static String promotion_price = CLASS_NAME + "promotion_price"; // 促销价
//
@TableId(value = "id", type = IdType.AUTO)
private Long id;
@ -65,8 +66,8 @@ private static final long serialVersionUID = 1L;
private String buyerName;
//买家微信
private String buyerWeixin;
//总价
private BigDecimal allPrice;
//支付金额
private BigDecimal payAmount;
//退款金额
private BigDecimal refundAmount;
//退货数量
@ -103,6 +104,8 @@ private static final long serialVersionUID = 1L;
private String transactionId;
//买家地址id
private Long buyerAddressId;
//促销价
private BigDecimal promotionPrice;
/**
*
* @return
@ -224,18 +227,18 @@ private static final long serialVersionUID = 1L;
}
/**
* 总价
* 支付金额
* @return
*/
public BigDecimal getAllPrice() {
return allPrice;
public BigDecimal getPayAmount() {
return payAmount;
}
/**
* 总价
* @param allPrice
* 支付金额
* @param payAmount
*/
public void setAllPrice(BigDecimal allPrice) {
this.allPrice = allPrice;
public void setPayAmount(BigDecimal payAmount) {
this.payAmount = payAmount;
}
/**
@ -508,6 +511,21 @@ private static final long serialVersionUID = 1L;
this.buyerAddressId = buyerAddressId;
}
/**
* 促销价
* @return
*/
public BigDecimal getPromotionPrice() {
return promotionPrice;
}
/**
* 促销价
* @param promotionPrice
*/
public void setPromotionPrice(BigDecimal promotionPrice) {
this.promotionPrice = promotionPrice;
}
@Override
public String toString() {
return "VvTradeOrderEntity{" +
@ -519,7 +537,7 @@ private static final long serialVersionUID = 1L;
",buyerPhone=" + buyerPhone +
",buyerName=" + buyerName +
",buyerWeixin=" + buyerWeixin +
",allPrice=" + allPrice +
",payAmount=" + payAmount +
",refundAmount=" + refundAmount +
",refundCount=" + refundCount +
",buyerId=" + buyerId +
@ -538,6 +556,7 @@ private static final long serialVersionUID = 1L;
",tradeInfo=" + tradeInfo +
",transactionId=" + transactionId +
",buyerAddressId=" + buyerAddressId +
",promotionPrice=" + promotionPrice +
"}";
}
}

View File

@ -10,7 +10,7 @@ import java.util.Date;import java.util.Date;
/**
*购物车
* @author quyixiao
* @since 2025-11-16
* @since 2025-11-17
*/
@Data
@ -93,6 +93,7 @@ private static final long serialVersionUID = 1L;
public final static String reject_sign_receipt_reason = CLASS_NAME + "reject_sign_receipt_reason"; // 拒绝签收原因
public final static String reject_sign_receipt_features = CLASS_NAME + "reject_sign_receipt_features"; // 拒绝签收的信息
public final static String close_reason = CLASS_NAME + "close_reason"; // 关闭原因
public final static String pay_amount = CLASS_NAME + "pay_amount"; // 实付金额
//
@TableId(value = "id", type = IdType.AUTO)
private Long id;
@ -238,6 +239,8 @@ private static final long serialVersionUID = 1L;
private String rejectSignReceiptFeatures;
//关闭原因
private String closeReason;
//实付金额
private BigDecimal payAmount;
/**
*
* @return
@ -1318,6 +1321,21 @@ private static final long serialVersionUID = 1L;
this.closeReason = closeReason;
}
/**
* 实付金额
* @return
*/
public BigDecimal getPayAmount() {
return payAmount;
}
/**
* 实付金额
* @param payAmount
*/
public void setPayAmount(BigDecimal payAmount) {
this.payAmount = payAmount;
}
@Override
public String toString() {
return "VvTradeOrderLineEntity{" +
@ -1393,6 +1411,7 @@ private static final long serialVersionUID = 1L;
",rejectSignReceiptReason=" + rejectSignReceiptReason +
",rejectSignReceiptFeatures=" + rejectSignReceiptFeatures +
",closeReason=" + closeReason +
",payAmount=" + payAmount +
"}";
}
}

View File

@ -49,9 +49,9 @@ public class MysqlMain_update {
List<TablesBean> list = new ArrayList<TablesBean>();
list.add(new TablesBean("vv_trade_order_line_status_log"));
list.add(new TablesBean("vv_trade_order_line"));
//list.add(new TablesBean("vv_trade_order"));
list.add(new TablesBean("vv_trade_order"));
Map<String, String> map = MysqlUtil2ShowCreateTable.getComments();

View File

@ -235,7 +235,7 @@ public class JsapiPrepay {
request.amount = new AmountReq();
Long refundAmount = BigDecimalUtil.multiply(vvReverseOrderEntity.getRefundAmount(), new BigDecimal(100)).longValue();
Long tradeOrderAmount = BigDecimalUtil.multiply(vvTradeOrderEntity.getAllPrice(), new BigDecimal(100)).longValue();
Long tradeOrderAmount = BigDecimalUtil.multiply(vvTradeOrderEntity.getPromotionPrice(), new BigDecimal(100)).longValue();
request.amount.refund =refundAmount; // 退款金额 退款金额币种的最小单位只能为整数不能超过原订单支付金额

View File

@ -166,8 +166,6 @@ public class AppOrderController {
@RequestMapping("/add")
public R add(@RequestBody VvTradeOrderDTO vvOrderRequest) {
List<VvTradeOrderLineEntity> vvTradeOrderLineEntityList = new ArrayList<>();
BigDecimal allPrice = BigDecimal.ZERO;
int allNum = 0;
List<Long> skuIds = new ArrayList<>();
for (VvTradeOrderLineDTO vvTradeOrderLineDTO : vvOrderRequest.getVvTradeOrderLineDTOList()) {
@ -212,6 +210,7 @@ public class AppOrderController {
}
Map<Long, Integer> productNumMap = new HashMap<>();
VvBuyerAddressEntity vvBuyerAddress = vvBuyerAddressDao.selectVvBuyerAddressById(vvOrderRequest.getBuyerAddressId());
for (VvTradeOrderLineDTO vvTradeOrderLineDTO : vvOrderRequest.getVvTradeOrderLineDTOList()) {
VvSkuEntity vvSkuEntity = skuEntityMap.get(vvTradeOrderLineDTO.getSkuId());
@ -226,8 +225,6 @@ public class AppOrderController {
allNum = allNum + vvTradeOrderLineDTO.getNum();
allPrice = BigDecimalUtil.add(BigDecimalUtil.multiply(vvSkuEntity.getPromotionPrice(), new BigDecimal(vvTradeOrderLineDTO.getNum())), allPrice);
List<VvSkuPropertyValueEntity> vvSkuPropertyValueEntities = vvSkuPropertyValueMap.get(vvTradeOrderLineDTO.getSkuId());
VvProductEntity vvProduct = vvProductMap.get(vvSkuEntity.getProductId());
@ -265,6 +262,7 @@ public class AppOrderController {
vvTradeOrderLineEntity.setBuyerId(vvOrderRequest.getBuyerId());
vvTradeOrderLineEntity.setBuyerAddressId(vvOrderRequest.getBuyerAddressId());
vvTradeOrderLineEntity.setBatchNum(vvTradeOrderLineDTO.getNum());
vvTradeOrderLineEntity.setPayAmount(vvSkuEntity.getPromotionPrice());
vvTradeOrderLineEntityList.add(vvTradeOrderLineEntity);
}
}
@ -274,7 +272,7 @@ public class AppOrderController {
//创建时间
vvTradeOrderEntity.setCreateTime(new Date());
vvTradeOrderEntity.setModifyTime(new Date());
vvTradeOrderEntity.setNum(allNum);
vvTradeOrderEntity.setNum(vvTradeOrderLineEntityList.size());
vvTradeOrderEntity.setBuyerPhone(vvBuyerEntity.getBuyerPhone());
vvTradeOrderEntity.setBuyerName(vvBuyerEntity.getBuyerName());
vvTradeOrderEntity.setBuyerWeixin(vvBuyerEntity.getBuyerWeixin());
@ -285,11 +283,17 @@ public class AppOrderController {
vvTradeOrderEntity.setCity(vvBuyerAddress.getCity());
vvTradeOrderEntity.setDistrict(vvBuyerAddress.getDistrict());
vvTradeOrderEntity.setBuyerDetailAddress(vvBuyerAddress.getDetail());
vvTradeOrderEntity.setAllPrice(allPrice);
BigDecimal tradeOrderPromotionPrice = SanUtils.sum(vvTradeOrderLineEntityList, VvTradeOrderLineEntity::getPromotionPrice);
vvTradeOrderEntity.setPromotionPrice(tradeOrderPromotionPrice);
vvTradeOrderEntity.setBuyerId(vvOrderRequest.getBuyerId());
vvTradeOrderEntity.setCreateTimestamp(System.currentTimeMillis());
vvTradeOrderEntity.setModifyTimestamp(System.currentTimeMillis());
vvTradeOrderEntity.setBuyerAddressId(vvOrderRequest.getBuyerAddressId());
BigDecimal tradePayAmount = SanUtils.sum(vvTradeOrderLineEntityList, VvTradeOrderLineEntity::getPayAmount);
vvTradeOrderEntity.setPayAmount(tradePayAmount);
vvTradeOrderDao.insertVvTradeOrder(vvTradeOrderEntity);
for (VvTradeOrderLineEntity tradeOrderLineEntity : vvTradeOrderLineEntityList) {
@ -303,9 +307,8 @@ public class AppOrderController {
for (Map.Entry<Long, Integer> map : productNumMap.entrySet()) {
vvProductDao.updateShowSaleCountAndSaleCount(map.getValue(), map.getValue(), map.getKey());
}
DirectAPIv3JsapiPrepayResponse jsapiPrepayResponse = jsapiPrepay.prePay(vvTradeOrderEntity.getId(),
BigDecimalUtil.multiply(vvTradeOrderEntity.getAllPrice(), new BigDecimal(100)).longValue(),
BigDecimalUtil.multiply(vvTradeOrderEntity.getPayAmount(), new BigDecimal(100)).longValue(),
vvBuyerEntity.getOpenid()
);