提交代码

dev-discount
胡锐 2 years ago
parent 1e761f48d4
commit aaeb3473ff
  1. 2
      hai-order/src/main/resources/dev/config.properties
  2. 5
      hai-service/src/main/java/com/hai/order/model/CreateOrderChildModel.java
  3. 4
      hai-service/src/main/java/com/hai/order/service/OrderCreateHandleService.java
  4. 1
      hai-service/src/main/java/com/hai/order/service/OrderServiceExt.java
  5. 88
      hai-service/src/main/java/com/hai/order/service/impl/OrderCreateHandleServiceImpl.java
  6. 8
      hai-service/src/main/java/com/hai/order/service/impl/OrderServiceImpl.java

@ -6,8 +6,6 @@ wxPayMchId=1289663601
wxPayApiKey=Skufk5oi85wDFGl888i6wsRSTkdd5df5 wxPayApiKey=Skufk5oi85wDFGl888i6wsRSTkdd5df5
wxPayUnifiedOrderUrl=https://api.mch.weixin.qq.com/pay/unifiedorder wxPayUnifiedOrderUrl=https://api.mch.weixin.qq.com/pay/unifiedorder
wxPayNotifyUrl=https://hsgcs.dctpay.com/order/payNotify/wechatPay wxPayNotifyUrl=https://hsgcs.dctpay.com/order/payNotify/wechatPay
unionPayNotifyUrl=https://hsgcs.dctpay.com/order/payNotify/unionPay unionPayNotifyUrl=https://hsgcs.dctpay.com/order/payNotify/unionPay

@ -44,6 +44,11 @@ public class CreateOrderChildModel {
*/ */
private Long goodsId; private Long goodsId;
/**
* 产品规格
*/
private String goodsSpecName;
/** /**
* 产品价格 * 产品价格
*/ */

@ -47,14 +47,14 @@ public interface OrderCreateHandleService {
* @param createOrderChild * @param createOrderChild
* @return * @return
*/ */
ResponseData couponPackage(CreateOrderChildModel createOrderChild); HighChildOrder couponPackage(CreateOrderChildModel createOrderChild);
/** /**
* 汇联通充值校验 * 汇联通充值校验
* @param createOrderChild * @param createOrderChild
* @return * @return
*/ */
ResponseData hltUnionCardRecharge(CreateOrderChildModel createOrderChild); HighChildOrder hltUnionCardRecharge(CreateOrderChildModel createOrderChild);
/** /**
* @Author Sum1Dream * @Author Sum1Dream

@ -1,6 +1,5 @@
package com.hai.order.service; package com.hai.order.service;
import com.hai.order.model.OrderCouponModel; import com.hai.order.model.OrderCouponModel;
import com.hai.order.model.OrderIntegralRechargeModel; import com.hai.order.model.OrderIntegralRechargeModel;

@ -112,6 +112,12 @@ public class OrderCreateHandleServiceImpl implements OrderCreateHandleService {
@Resource @Resource
private ApiMemberProductService apiMemberProductService; private ApiMemberProductService apiMemberProductService;
@Resource
private HighDiscountPackageService discountPackageService;
@Resource
private HighDiscountPackageActualService discountPackageActualService;
@Override @Override
public List<HighChildOrder> couponHandle(HighDiscountUserRel discountUserRel, CreateOrderChildModel createOrderChild) throws Exception { public List<HighChildOrder> couponHandle(HighDiscountUserRel discountUserRel, CreateOrderChildModel createOrderChild) throws Exception {
if (createOrderChild.getSaleCount() != 1) { if (createOrderChild.getSaleCount() != 1) {
@ -496,13 +502,87 @@ public class OrderCreateHandleServiceImpl implements OrderCreateHandleService {
} }
@Override @Override
public ResponseData couponPackage(CreateOrderChildModel createOrderChild) { public HighChildOrder couponPackage(CreateOrderChildModel createOrderChild) {
return null; // 查询优惠券包
HighDiscountPackage discountPackage = discountPackageService.findDiscountPackageById(createOrderChild.getGoodsId().intValue());
if (discountPackage == null) {
log.error("HighOrderController --> addOrder() error!", "");
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到优惠券包");
}
if (discountPackage.getStatus() != 1) {
log.error("HighOrderController --> addOrder() error!", "");
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "优惠券包不可用");
}
if (discountPackageActualService.getStockByPackageId(discountPackage.getId()) == 0) {
log.error("HighOrderController --> addOrder() error!", "");
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "库存数量不足");
}
if (discountPackage.getPurchaseNum() < discountPackageActualService.userPurchaseByUserId(createOrderChild.getMemId().intValue(), discountPackage.getId())) {
log.error("HighOrderController --> addOrder() error!", "");
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "超过购买限制");
}
// 生成交易子订单
HighChildOrder childOrder = new HighChildOrder();
childOrder.setMemId(createOrderChild.getMemId());
childOrder.setMemName(createOrderChild.getMemName());
childOrder.setMemPhone(createOrderChild.getMemPhone());
childOrder.setChildOrderNo(OrderUtil.generateChildOrderNo());
childOrder.setGoodsType(OrderChildGoodsType.TYPE7.getNumber());
childOrder.setGoodsId(discountPackage.getId().longValue());
childOrder.setGoodsName(discountPackage.getTitle());
childOrder.setGoodsImg(discountPackage.getListImg());
childOrder.setGoodsSpecName("默认");
childOrder.setGoodsPrice(discountPackage.getPrice());
childOrder.setGoodsActualPrice(discountPackage.getPrice());
childOrder.setSaleCount(createOrderChild.getSaleCount());
childOrder.setGiveawayType(false);
childOrder.setChildOrderStatus(OrderChildStatus.STATUS1.getNumber());
childOrder.setTotalPrice(new BigDecimal(childOrder.getSaleCount().toString()).multiply(childOrder.getGoodsPrice()));
childOrder.setTotalActualPrice(new BigDecimal(childOrder.getSaleCount().toString()).multiply(childOrder.getGoodsActualPrice()));
childOrder.setTotalDeductionPrice(childOrder.getTotalPrice().subtract(childOrder.getTotalActualPrice()));
childOrder.setPraiseStatus(0);
childOrder.setCreateTime(new Date());
return childOrder;
} }
@Override @Override
public ResponseData hltUnionCardRecharge(CreateOrderChildModel createOrderChild) { public HighChildOrder hltUnionCardRecharge(CreateOrderChildModel createOrderChild) {
return null; if (createOrderChild.getGoodsPrice() == null) {
log.error("HighOrderController --> hltUnionCardRecharge() error!", "请设置充值金额");
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "请设置充值金额");
}
if (StringUtils.isBlank(createOrderChild.getGoodsSpecName()) ) {
log.error("HighOrderController --> hltUnionCardRecharge() error!", "请设置充值卡号");
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "请设置充值卡号");
}
// 查询用户信息
HighUser user = highUserService.findByUserId(createOrderChild.getMemId());
if (user == null) {
log.error("HighOrderController --> hltUnionCardRecharge() error!", "未找到用户");
throw ErrorHelp.genException(SysCode.System, ErrorCode.UN_MEMBER_ERROR, "");
}
// 生成交易子订单
HighChildOrder childOrder = new HighChildOrder();
childOrder.setMemId(createOrderChild.getMemId());
childOrder.setMemName(createOrderChild.getMemName());
childOrder.setMemPhone(createOrderChild.getMemPhone());
childOrder.setChildOrderNo(OrderUtil.generateChildOrderNo());
childOrder.setGoodsType(OrderChildGoodsType.TYPE8.getNumber());
childOrder.setGoodsId(user.getId());
childOrder.setGoodsName("贵州汇联通工会卡充值");
childOrder.setGoodsImg(CommonSysConst.getSysConfig().getHsgDomainName()+"/filesystem/wxApplets/hlt_logo.png");
childOrder.setGoodsSpecName(createOrderChild.getGoodsSpecName());
childOrder.setGoodsPrice(createOrderChild.getGoodsPrice());
childOrder.setGoodsActualPrice(createOrderChild.getGoodsPrice());
childOrder.setSaleCount(createOrderChild.getSaleCount());
childOrder.setGiveawayType(false);
childOrder.setChildOrderStatus(OrderChildStatus.STATUS1.getNumber());
childOrder.setTotalPrice(new BigDecimal(childOrder.getSaleCount().toString()).multiply(childOrder.getGoodsPrice()));
childOrder.setTotalActualPrice(new BigDecimal(childOrder.getSaleCount().toString()).multiply(childOrder.getGoodsActualPrice()));
childOrder.setTotalDeductionPrice(childOrder.getTotalPrice().subtract(childOrder.getTotalActualPrice()));
childOrder.setPraiseStatus(0);
childOrder.setCreateTime(new Date());
return childOrder;
} }
@Override @Override

@ -221,12 +221,16 @@ public class OrderServiceImpl implements OrderService {
// 优惠券包 // 优惠券包
} else if (child.getGoodsType().equals(OrderChildGoodsType.TYPE7.getNumber())) { } else if (child.getGoodsType().equals(OrderChildGoodsType.TYPE7.getNumber())) {
order.setProductType(OrderProductType.PRODUCT_TYPE9.getNumber()); order.setProductType(OrderProductType.PRODUCT_TYPE9.getNumber());
orderCreateHandleService.couponPackage(child); HighChildOrder childOrder = orderCreateHandleService.couponPackage(child);
childOrderList.add(childOrder);
order.setTitle(childOrder.getGoodsName());
// 贵州汇联通工会卡充值 // 贵州汇联通工会卡充值
} else if (child.getGoodsType().equals(OrderChildGoodsType.TYPE8.getNumber())) { } else if (child.getGoodsType().equals(OrderChildGoodsType.TYPE8.getNumber())) {
order.setProductType(OrderProductType.PRODUCT_TYPE8.getNumber()); order.setProductType(OrderProductType.PRODUCT_TYPE8.getNumber());
orderCreateHandleService.hltUnionCardRecharge(child); HighChildOrder childOrder = orderCreateHandleService.hltUnionCardRecharge(child);
childOrderList.add(childOrder);
order.setTitle(childOrder.getGoodsName());
// 星巴克 // 星巴克
} else if (child.getGoodsType().equals(OrderChildGoodsType.TYPE9.getNumber())) { } else if (child.getGoodsType().equals(OrderChildGoodsType.TYPE9.getNumber())) {

Loading…
Cancel
Save