|
|
@ -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 |
|
|
|