调整限购策略;预支付成功删除购物车
This commit is contained in:
parent
d7dae69e3f
commit
038235bbe9
@ -99,7 +99,9 @@ public class SysLoginInfoBuild extends AbstractLoginInfoBuild {
|
||||
staffLoginInfo.setBrandId(row.getString("brandId"));
|
||||
staffLoginInfo.setSourceType(SourceType.valueOf(row.getString("sourceType")));
|
||||
} else {
|
||||
staffLoginInfo.setName(Constants.SUPER_ADMIN)
|
||||
//超级管理员
|
||||
staffLoginInfo.setId("1")
|
||||
.setName(Constants.SUPER_ADMIN)
|
||||
.setSourceType(SourceType.COMMON);
|
||||
}
|
||||
return new LoginUser(staffLoginInfo, staffLoginInfo.getId(), getPermissionSet(sysUser.getUserName(), staffLoginInfo.getRoleId()));
|
||||
|
||||
@ -28,6 +28,7 @@
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<finalName>Cpop-Mall-Web</finalName>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
|
||||
@ -47,19 +47,22 @@ public class CpopWxPayTests {
|
||||
@Test
|
||||
public void refund() throws WxPayException {
|
||||
Brand brand = SpringUtils.getBean(BrandService.class).getById("75140168047210496");
|
||||
Order order = SpringUtils.getBean(OrderService.class).getById("78954327589658624");
|
||||
//Order order = SpringUtils.getBean(OrderService.class).getById("78954327589658624");
|
||||
WxPayRefundV3Request request = new WxPayRefundV3Request();
|
||||
WxPayRefundV3Request.Amount amount = new WxPayRefundV3Request.Amount();
|
||||
//退款金额(单位分)
|
||||
int refund = order.getTotalAmount().scaleByPowerOfTen(2).intValue();
|
||||
//int refund = order.getTotalAmount().scaleByPowerOfTen(2).intValue();
|
||||
int refund = 1;
|
||||
amount.setRefund(refund)
|
||||
.setTotal(refund)
|
||||
.setCurrency("CNY");
|
||||
request.setTransactionId(order.getOutOrderNo())
|
||||
.setSubMchid(wxPayService.getConfig().getSubMchId())
|
||||
request.setSubMchid(wxPayService.getConfig().getSubMchId())
|
||||
.setTransactionId("4200002027202310279036554434")
|
||||
.setOutTradeNo("75505378790948864")
|
||||
//.setTransactionId(order.getOutOrderNo())
|
||||
//.setOutTradeNo(order.getId())
|
||||
.setNotifyUrl(wxPayProperties.getNotifyRefund())
|
||||
.setOutRefundNo(IdUtils.fastSimpleUUID())
|
||||
.setOutTradeNo(order.getId())
|
||||
.setSubMchid(brand.getWxMchId())
|
||||
.setReason("接口测试退款")
|
||||
.setAmount(amount);
|
||||
|
||||
@ -57,6 +57,12 @@ public class AdvanceOrderBo implements Serializable {
|
||||
@ApiModelProperty(value = "支付用户名")
|
||||
private String payUserName;
|
||||
|
||||
/**
|
||||
* 购物车ids
|
||||
*/
|
||||
@ApiModelProperty(value = "购物车ids")
|
||||
private List<String> shoppingCartIds;
|
||||
|
||||
/**
|
||||
* 订单详情
|
||||
*/
|
||||
|
||||
@ -24,16 +24,16 @@ public class OrderPageBo implements Serializable {
|
||||
private String productName;
|
||||
|
||||
/**
|
||||
* 支付用户
|
||||
* 收货人
|
||||
*/
|
||||
@ApiModelProperty("支付用户")
|
||||
private String payUserName;
|
||||
@ApiModelProperty("收货人")
|
||||
private String receiveName;
|
||||
|
||||
/**
|
||||
* 接收人手机号
|
||||
* 收货人手机号
|
||||
*/
|
||||
@ApiModelProperty("接收人手机号")
|
||||
private String payUserPhone;
|
||||
@ApiModelProperty("收货人手机号")
|
||||
private String receivePhone;
|
||||
|
||||
/**
|
||||
* 订单状态(0:待付款;1:待发货;2:待确认;3:已完成;4:退款/售后中)
|
||||
|
||||
@ -54,4 +54,5 @@ public class ShoppingCartBo implements Serializable {
|
||||
@NotNull(message = "数量不能为空")
|
||||
@ApiModelProperty(value = "数量",required = true)
|
||||
private Integer number;
|
||||
|
||||
}
|
||||
|
||||
@ -36,6 +36,7 @@ public class OrderDetail extends BaseEntity implements Serializable {
|
||||
/**
|
||||
* 商品记录id
|
||||
*/
|
||||
@Id
|
||||
private String productRecordId;
|
||||
|
||||
/**
|
||||
|
||||
@ -32,6 +32,7 @@ import com.mybatisflex.core.query.QueryWrapper;
|
||||
import com.mybatisflex.spring.service.impl.ServiceImpl;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import static com.cpop.core.base.table.table.SysUserTableDef.SYS_USER;
|
||||
import static com.cpop.mall.business.entity.table.OrderRefundTableDef.ORDER_REFUND;
|
||||
@ -115,12 +116,17 @@ public class OrderRefundServiceImpl extends ServiceImpl<OrderRefundMapper, Order
|
||||
* @return: void
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void rejectRefund(OrderRejectRefundBo bo) {
|
||||
//获取订单
|
||||
OrderRefund refund = this.queryChain().where(ORDER_REFUND.ID.eq(bo.getId())).one();
|
||||
this.updateChain().set(ORDER_REFUND.REFUND_STATUS, 2)
|
||||
.set(ORDER_REFUND.REFUND_REASON, bo.getRejectReason())
|
||||
.where(ORDER_REFUND.ID.eq(bo.getId()))
|
||||
.update();
|
||||
|
||||
//更改订单为原状态
|
||||
SpringUtils.getBean(OrderService.class).updateChain().set(ORDER.ORDER_STATUS,ORDER.PREVIOUS_STATUS)
|
||||
.where(ORDER.ID.eq(refund.getOrderId())).update();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -54,6 +54,7 @@ import static com.cpop.mall.business.entity.table.OrderRefundTableDef.ORDER_REFU
|
||||
import static com.cpop.mall.business.entity.table.OrderTableDef.ORDER;
|
||||
import static com.cpop.mall.business.entity.table.ProductRecordTableDef.PRODUCT_RECORD;
|
||||
import static com.cpop.mall.business.entity.table.ProductTableDef.PRODUCT;
|
||||
import static com.cpop.mall.business.entity.table.ShoppingCartTableDef.SHOPPING_CART;
|
||||
import static com.cpop.system.business.entity.table.ProfitSharingTableDef.PROFIT_SHARING;
|
||||
import static com.cpop.system.business.entity.table.StoreTableDef.STORE;
|
||||
import static com.mybatisflex.core.query.QueryMethods.field;
|
||||
@ -113,8 +114,8 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
|
||||
.select(ORDER.ALL_COLUMNS)
|
||||
.from(ORDER)
|
||||
.leftJoin(SYS_USER).on(SYS_USER.ID.eq(ORDER.PAY_USER_ID))
|
||||
.and(ORDER.PAY_USER_NAME.like(bo.getPayUserName()))
|
||||
.and(SYS_USER.PHONE_NUMBER.like(bo.getPayUserPhone()))
|
||||
.and(ORDER.RECEIVE_NAME.like(bo.getReceiveName()))
|
||||
.and(ORDER.RECEIVE_PHONE.like(bo.getReceivePhone()))
|
||||
.and(ORDER.PRODUCT_NAMES.like(bo.getProductName()))
|
||||
.and(SYS_USER.USER_TYPE.eq("MINI_USER"))
|
||||
.orderBy(ORDER.CREATE_TIME.desc()),
|
||||
@ -162,7 +163,7 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
|
||||
//获取涉及到的商品
|
||||
ProductService productService = SpringUtils.getBean(ProductService.class);
|
||||
List<Product> productList = productService.queryChain()
|
||||
.select(PRODUCT.ID, PRODUCT.PRODUCT_NAME, PRODUCT.DESCRIPTION)
|
||||
.select(PRODUCT.ID, PRODUCT.PRODUCT_NAME, PRODUCT.DESCRIPTION, PRODUCT.BUY_RESTRICT, PRODUCT.LIMIT_NUM)
|
||||
.from(PRODUCT)
|
||||
.leftJoin(PRODUCT_RECORD).on(PRODUCT_RECORD.PRODUCT_ID.eq(PRODUCT.ID))
|
||||
.where(PRODUCT_RECORD.ID.in(recordIds))
|
||||
@ -202,6 +203,10 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
|
||||
item.setOrderId(order.getId());
|
||||
});
|
||||
SpringUtils.getBean(OrderDetailService.class).saveBatch(orderDetails);
|
||||
//移除购物车
|
||||
if (null != bo.getShoppingCartIds()&& !bo.getShoppingCartIds().isEmpty()){
|
||||
SpringUtils.getBean(ShoppingCartService.class).removeByIds(bo.getShoppingCartIds());
|
||||
}
|
||||
return order.getId();
|
||||
} catch (Exception e) {
|
||||
//回滚库存
|
||||
@ -503,7 +508,7 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
|
||||
@Override
|
||||
public void inputLogisticsOrder(LogisticsOrderBo bo) {
|
||||
this.updateChain().setRaw(ORDER.PREVIOUS_STATUS, ORDER.ORDER_STATUS)
|
||||
.set(ORDER.ORDER_STATUS, 2)
|
||||
.set(ORDER.ORDER_STATUS, 3)
|
||||
.set(ORDER.LOGISTICS_ORDER, bo.getLogisticsOrder())
|
||||
.where(ORDER.ID.eq(bo.getId())).update();
|
||||
}
|
||||
|
||||
@ -302,7 +302,8 @@ public class ProductServiceImpl extends ServiceImpl<ProductMapper, Product> impl
|
||||
.select("tct.template_id AS id,tct.brand_id,tct.name")
|
||||
.from("t_card_template").as("tct")
|
||||
.leftJoin("t_brand_info").as("tbi").on("tbi.id = tct.brand_id")
|
||||
.where("tbi.brand_id = ?", brandExtend.getBrandCloudId()));
|
||||
.where("tbi.brand_id = ?", brandExtend.getBrandCloudId())
|
||||
.or("tct.brand_id = ?", brandExtend.getBrandCloudId()));
|
||||
cardTemplateListVos = RowUtil.toEntityList(rowList, JamboxCardTemplateListVo.class);
|
||||
} finally {
|
||||
DataSourceKey.clear();
|
||||
|
||||
@ -59,7 +59,8 @@ public class ShoppingCartServiceImpl extends ServiceImpl<ShoppingCartMapper, Sho
|
||||
.leftJoin(PRODUCT_RECORD).on(PRODUCT_RECORD.ID.eq(SHOPPING_CART.PRODUCT_RECORD_ID))
|
||||
.leftJoin(PRODUCT).on(PRODUCT.ID.eq(PRODUCT_RECORD.PRODUCT_ID))
|
||||
.leftJoin(STORE).on(STORE.ID.eq(SHOPPING_CART.STORE_ID))
|
||||
.where(SHOPPING_CART.USER_ID.eq(loginUserInfo.getString("userId"))),
|
||||
.where(SHOPPING_CART.USER_ID.eq(loginUserInfo.getString("userId")))
|
||||
.orderBy(SHOPPING_CART.CREATE_TIME.desc()),
|
||||
MiniShoppingCartPageVo.class);
|
||||
}
|
||||
|
||||
|
||||
@ -56,7 +56,7 @@ public class UserRestrictStrategy implements BuyRestrictStrategy{
|
||||
num.addAndGet(value);
|
||||
}
|
||||
});
|
||||
if (product.getLimitNum() - count > num.get()) {
|
||||
if (product.getLimitNum() - count < num.get()) {
|
||||
//存在过购买记录
|
||||
throw new ServiceException("您购买的商品已超出限制,无法购买商品" + product.getProductName());
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user