feat(work): 新增订单修改功能并增加抵扣金和集材社订单ID字段
- 在 ITpOrderService 接口中新增 updateInfoByBo 方法用于修改订单信息 - 在 TpOrder、TpOrderBo、TpOrderVo 类中添加 coupon(抵扣金)和 jcOrderId(集材社订单ID)字段 - 更新 TpOrderServiceImpl 中的订单修改逻辑,考虑抵扣金因素
This commit is contained in:
@@ -235,6 +235,16 @@ public class TpOrder {
|
||||
*/
|
||||
private String byThree;
|
||||
|
||||
/**
|
||||
* 抵扣金
|
||||
*/
|
||||
private BigDecimal coupon;
|
||||
|
||||
/**
|
||||
* 集材社订单ID
|
||||
*/
|
||||
private Long jcOrderId;
|
||||
|
||||
/**
|
||||
* 接待客服名称
|
||||
*/
|
||||
|
||||
@@ -316,4 +316,14 @@ public class TpOrderBo extends BaseEntity {
|
||||
*/
|
||||
private String byThree;
|
||||
|
||||
/**
|
||||
* 抵扣金
|
||||
*/
|
||||
private BigDecimal coupon;
|
||||
|
||||
/**
|
||||
* 集材社订单ID
|
||||
*/
|
||||
private Long jcOrderId;
|
||||
|
||||
}
|
||||
|
||||
@@ -322,4 +322,14 @@ public class TpOrderVo implements Serializable {
|
||||
*/
|
||||
private String byThree;
|
||||
|
||||
/**
|
||||
* 抵扣金
|
||||
*/
|
||||
private BigDecimal coupon;
|
||||
|
||||
/**
|
||||
* 集材社订单ID
|
||||
*/
|
||||
private Long jcOrderId;
|
||||
|
||||
}
|
||||
|
||||
@@ -199,4 +199,11 @@ public interface ITpOrderService extends MPJBaseService<TpOrder> {
|
||||
* @return
|
||||
*/
|
||||
List<TpOrderVo> queryList(TpOrderBo bo);
|
||||
|
||||
/**
|
||||
* 修改订单信息
|
||||
* @param bo
|
||||
* @return
|
||||
*/
|
||||
Boolean updateInfoByBo(TpOrderBo bo);
|
||||
}
|
||||
|
||||
@@ -576,17 +576,17 @@ public class TpOrderServiceImpl extends MPJBaseServiceImpl<TpOrderMapper,TpOrder
|
||||
if(StringUtils.isNotEmpty(bo.getOrderId()) && !Objects.equals(bo.getOrderId(), order.getOrderId())){
|
||||
throw new ServiceException("订单编号不可以修改");
|
||||
}
|
||||
BigDecimal endPrice = bo.getPrice().subtract(order.getPayPrice());
|
||||
BigDecimal endPrice = bo.getPrice().subtract(order.getPayPrice().add(order.getCoupon()));
|
||||
if(endPrice.compareTo(BigDecimal.ZERO) < 0){
|
||||
throw new ServiceException("订单金额不可以小于已支付金额");
|
||||
}
|
||||
if(order.getPayState() == 2){
|
||||
if (bo.getPrice().compareTo(order.getPayPrice()) == 0) {
|
||||
if (bo.getPrice().compareTo(order.getPayPrice().add(order.getCoupon())) == 0) {
|
||||
bo.setPayState(3);
|
||||
}
|
||||
}
|
||||
if(order.getPayState() == 3){
|
||||
if(bo.getPrice().compareTo(order.getPayPrice()) > 0){
|
||||
if(bo.getPrice().compareTo(order.getPayPrice().add(order.getCoupon())) > 0){
|
||||
bo.setPayState(2);
|
||||
}
|
||||
}
|
||||
@@ -600,6 +600,18 @@ public class TpOrderServiceImpl extends MPJBaseServiceImpl<TpOrderMapper,TpOrder
|
||||
return baseMapper.updateById(update) > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改订单信息
|
||||
*
|
||||
* @param bo
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Boolean updateInfoByBo(TpOrderBo bo) {
|
||||
TpOrder update = MapstructUtils.convert(bo, TpOrder.class);
|
||||
return baseMapper.updateById(update) > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验并批量删除订单管理信息
|
||||
*
|
||||
@@ -779,7 +791,7 @@ public class TpOrderServiceImpl extends MPJBaseServiceImpl<TpOrderMapper,TpOrder
|
||||
order.setJsPayPrice(getJsPay(jsPayPrice));
|
||||
order.setState(2);
|
||||
order.setPayPrice(newPayPrice);
|
||||
BigDecimal endPrice = order.getPrice().subtract(newPayPrice);
|
||||
BigDecimal endPrice = order.getPrice().subtract(newPayPrice.add(order.getCoupon()));
|
||||
order.setEndPrice(endPrice);
|
||||
if(endPrice.compareTo(BigDecimal.ZERO) > 0){
|
||||
order.setPayState(2);
|
||||
|
||||
Reference in New Issue
Block a user