diff --git a/mall-admin/src/main/java/com/buy507/mall/service/impl/PmsProductServiceImpl.java b/mall-admin/src/main/java/com/buy507/mall/service/impl/PmsProductServiceImpl.java index b222a08..7029af8 100644 --- a/mall-admin/src/main/java/com/buy507/mall/service/impl/PmsProductServiceImpl.java +++ b/mall-admin/src/main/java/com/buy507/mall/service/impl/PmsProductServiceImpl.java @@ -85,7 +85,11 @@ public class PmsProductServiceImpl implements PmsProductService { log.info("c"+String.valueOf(product.getProductCategoryId())); log.info("d"+String.valueOf(product.getProductAttributeCategoryId())); product.setOriginalPrice(productParam.getPrice()); + productMapper.insertAll(product); + productParam.getSkuStockList().forEach(item->{ + item.setPrice(product.getPrice()); + }); //根据促销类型设置价格:、阶梯价格、满减价格 Long productId = product.getId(); //会员价格 diff --git a/mall-dao/src/main/resources/com/buy507/mall/mapper/UmsMemberAccountTransactionMapper.xml b/mall-dao/src/main/resources/com/buy507/mall/mapper/UmsMemberAccountTransactionMapper.xml index d9e8701..8195410 100644 --- a/mall-dao/src/main/resources/com/buy507/mall/mapper/UmsMemberAccountTransactionMapper.xml +++ b/mall-dao/src/main/resources/com/buy507/mall/mapper/UmsMemberAccountTransactionMapper.xml @@ -109,10 +109,10 @@ SELECT LAST_INSERT_ID() insert into ums_member_account_transaction (member_id, order_id, revenue_amount, - transaction_state, remarks, commission_ratio, transfer_payment_time, revenue_points) + transaction_state, remarks, commission_ratio, transfer_payment_time, revenue_points, flow_type) values (#{memberId,jdbcType=BIGINT}, #{orderId,jdbcType=BIGINT}, #{revenueAmount,jdbcType=DECIMAL}, #{transactionState,jdbcType=INTEGER}, #{remarks,jdbcType=VARCHAR}, #{commissionRatio,jdbcType=INTEGER}, - #{transferPaymentTime,jdbcType=TIMESTAMP}, #{revenuePoints,jdbcType=INTEGER}) + #{transferPaymentTime,jdbcType=TIMESTAMP}, #{revenuePoints,jdbcType=INTEGER}, #{flowType,jdbcType=INTEGER}) diff --git a/mall-portal/pom.xml b/mall-portal/pom.xml index aa0845a..e4be818 100644 --- a/mall-portal/pom.xml +++ b/mall-portal/pom.xml @@ -80,7 +80,7 @@ - org.apache.commons + commons-io commons-io 1.3.2 diff --git a/mall-portal/src/main/java/com/buy507/mall/portal/domain/OrderResult.java b/mall-portal/src/main/java/com/buy507/mall/portal/domain/OrderResult.java index 94e1745..88c51fd 100644 --- a/mall-portal/src/main/java/com/buy507/mall/portal/domain/OrderResult.java +++ b/mall-portal/src/main/java/com/buy507/mall/portal/domain/OrderResult.java @@ -119,6 +119,17 @@ public class OrderResult { @ApiModelProperty(value = "积分兑换专区") private Integer intergrationExchange; + @ApiModelProperty(value = "订单类型") + private Integer orderType; + + public Integer getOrderType() { + return orderType; + } + + public void setOrderType(Integer orderType) { + this.orderType = orderType; + } + public Integer getIntergrationExchange() { return intergrationExchange; } diff --git a/mall-portal/src/main/java/com/buy507/mall/portal/service/impl/OmsPortalOrderServiceImpl.java b/mall-portal/src/main/java/com/buy507/mall/portal/service/impl/OmsPortalOrderServiceImpl.java index a9a4a47..2eee7d4 100644 --- a/mall-portal/src/main/java/com/buy507/mall/portal/service/impl/OmsPortalOrderServiceImpl.java +++ b/mall-portal/src/main/java/com/buy507/mall/portal/service/impl/OmsPortalOrderServiceImpl.java @@ -377,7 +377,8 @@ public class OmsPortalOrderServiceImpl implements OmsPortalOrderService { orderResult.setNote(order.getNote()); orderResult.setDeliveryCompany(order.getDeliveryCompany()); orderResult.setDeliverySn(order.getDeliverySn()); - orderResult.setPaymentTime(order.getPaymentTime()); + orderResult.setOrderType(order.getOrderType()); + orderResult.setPaymentTime(new Date()); // 获取商品信息,判断是否是积分专区商品 PmsProduct product = productMapper.getProductByOrderSn(order.getOrderSn()); @@ -1402,6 +1403,17 @@ public class OmsPortalOrderServiceImpl implements OmsPortalOrderService { updateStock(orderId); }); + //插入流水表积分 + UmsMemberAccountTransaction accountTransaction = new UmsMemberAccountTransaction(); + accountTransaction.setMemberId(member.getId()); + accountTransaction.setOrderId(orderId); + accountTransaction.setFlowType(2); + accountTransaction.setTransferPaymentTime(order.getPaymentTime()); + accountTransaction.setRevenuePoints(-totalPointsAmount.intValue()); + PmsProduct pmsProduct = orderMapper.selectAll(order.getOrderSn()); + accountTransaction.setRemarks( "商品名称" + pmsProduct.getName()); + umsMemberAccountTransactionMapper.insert(accountTransaction); + // 返还积分金额到前端 return CommonResult.success(totalPointsAmount, "支付成功"); @@ -1442,16 +1454,6 @@ public class OmsPortalOrderServiceImpl implements OmsPortalOrderService { // return CommonResult.validateFailed("无效订单"); // } // -// //插入流水表 -// UmsMemberAccountTransaction accountTransaction = new UmsMemberAccountTransaction(); -// accountTransaction.setMemberId(member.getId()); -// accountTransaction.setOrderId(orderId); -// accountTransaction.setTransferPaymentTime(order.getPaymentTime()); -// accountTransaction.setRevenuePoints(totalPointsAmount.intValue()); -// PmsProduct pmsProduct = orderMapper.selectAll(order.getOrderSn()); -// accountTransaction.setRemarks( "商品名称" + pmsProduct.getName()); -// umsMemberAccountTransactionMapper.insert(accountTransaction); -// // Date date = new Date(); // // //支付方式:0->未支付;1->支付宝;2->微信;3->线下支付;4->余额支付 @@ -1568,6 +1570,7 @@ public class OmsPortalOrderServiceImpl implements OmsPortalOrderService { UmsMemberAccountTransaction accountTransaction = new UmsMemberAccountTransaction(); accountTransaction.setMemberId(member.getId()); accountTransaction.setOrderId(orderId); + accountTransaction.setFlowType(1); accountTransaction.setTransferPaymentTime(orderResult.getPaymentTime()); accountTransaction.setRevenueAmount(payAmount.negate()); PmsProduct pmsProduct = orderMapper.selectAll(orderResult.getOrderSn()); @@ -1592,19 +1595,28 @@ public class OmsPortalOrderServiceImpl implements OmsPortalOrderService { //增加基金积分 int fundPoints = (int)(rewardPoints * 0.05); umsDevelopmentFundMapper.updatePoints(fundPoints); - -// //积分分润逻辑 -// memberPointsSplitProfitService.pointsSplit(order); + //插入流水表积分 + UmsMemberAccountTransaction transaction = new UmsMemberAccountTransaction(); + transaction.setMemberId(member.getId()); + transaction.setOrderId(orderId); + transaction.setFlowType(2); + transaction.setTransferPaymentTime(orderResult.getPaymentTime()); + transaction.setRevenuePoints(rewardPoints); + transaction.setRemarks( "购买商品返还积分:" + pmsProduct.getName()); + umsMemberAccountTransactionMapper.insert(transaction); } } // 更新订单状态为已支付 OmsOrder order = orderMapper.selectByPrimaryKey(orderId); + // 设置为余额支付 order.setPayType(5); // 设置订单状态为已支付 order.setStatus(2); order.setPaymentTime(new Date()); orderMapper.updateByPrimaryKey(order); + //积分分润逻辑 + memberPointsSplitProfitService.pointsSplit(order); // 处理库存、分销等后续操作 executorService.execute(() -> { @@ -2052,6 +2064,16 @@ public class OmsPortalOrderServiceImpl implements OmsPortalOrderService { int fundPoints = (int)(rewardPoints * 0.05); umsDevelopmentFundMapper.updatePoints(fundPoints); + //插入流水表积分 + UmsMemberAccountTransaction accountTransaction = new UmsMemberAccountTransaction(); + accountTransaction.setMemberId(member.getId()); + accountTransaction.setOrderId(order.getId()); + accountTransaction.setFlowType(2); + accountTransaction.setTransferPaymentTime(order.getPaymentTime()); + accountTransaction.setRevenuePoints(rewardPoints); + accountTransaction.setRemarks( "购买商品返还积分:" + pmsProduct.getName()); + umsMemberAccountTransactionMapper.insert(accountTransaction); + //积分分润逻辑 memberPointsSplitProfitService.pointsSplit(order); } diff --git a/mall-portal/src/main/resources/application-prod.yml b/mall-portal/src/main/resources/application-prod.yml index 9fbc383..94c5996 100644 --- a/mall-portal/src/main/resources/application-prod.yml +++ b/mall-portal/src/main/resources/application-prod.yml @@ -106,8 +106,8 @@ becomeVipAmount: 899 # 同等级分润比例 sameLevelProfit: 10 #店长升级金额 -storeManagerAmount: 1000 +storeManagerAmount: 10000 #代理升级金额 -agentAmount: 1000 +agentAmount: 50000 #市代理升级金额 -cityAgentAmount: 1000 \ No newline at end of file +cityAgentAmount: 100000 \ No newline at end of file