|
|
|
@ -165,6 +165,9 @@ public class HighOrderServiceImpl implements HighOrderService { |
|
|
|
|
@Resource |
|
|
|
|
private ShellGroupService shellGroupService; |
|
|
|
|
|
|
|
|
|
@Resource |
|
|
|
|
private JinZhuJiaYouService jinZhuJiaYouService; |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
@Transactional( |
|
|
|
|
isolation = Isolation.SERIALIZABLE, |
|
|
|
@ -258,6 +261,34 @@ public class HighOrderServiceImpl implements HighOrderService { |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (childOrder.getGoodsType() == 3) { |
|
|
|
|
// 加油站详情
|
|
|
|
|
HighMerchantStore store = highMerchantStoreService.getDetailById(childOrder.getGoodsId()); |
|
|
|
|
if (store == null) { |
|
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.NOT_FOUND_ORDER, ""); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (store.getSourceType().equals(MerchantStoreSourceType.type4.getNumber())) { |
|
|
|
|
// 查询金猪油品数据
|
|
|
|
|
JinZhuJiaYouOilNo jzOilNo = JinZhuJiaYouOilNo.getDataByOilNo(Integer.valueOf(childOrder.getGasOilNo())); |
|
|
|
|
if (jzOilNo == null) { |
|
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "暂时无法提交订单,未知的油品"); |
|
|
|
|
} |
|
|
|
|
// 创建金猪订单
|
|
|
|
|
JSONObject jzOrderObject = jinZhuJiaYouService.createOrder(highOrder.getOrderNo(), |
|
|
|
|
highOrder.getTotalPrice(), |
|
|
|
|
store.getStoreKey(), |
|
|
|
|
jzOilNo.getOilNoCode(), |
|
|
|
|
childOrder.getGasGunNo(), |
|
|
|
|
highOrder.getMemPhone() |
|
|
|
|
); |
|
|
|
|
childOrder.setGasOrderNo(jzOrderObject.getJSONObject("data").getString("systemOrderNo")); |
|
|
|
|
childOrder.setGasPriceChannelPay(jzOrderObject.getJSONObject("data").getBigDecimal("paymentAmount")); |
|
|
|
|
highChildOrderMapper.updateByPrimaryKey(childOrder); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (childOrder.getGoodsType() == 7) { |
|
|
|
|
// 查询库存
|
|
|
|
|
List<HighDiscountPackageActual> list = discountPackageActualService.getListByPackageId(childOrder.getGoodsId().intValue(), 1); |
|
|
|
@ -270,10 +301,56 @@ public class HighOrderServiceImpl implements HighOrderService { |
|
|
|
|
discountPackageActualService.updateHighDiscountPackageActual(list.get(0)); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public static void main(String[] args) { |
|
|
|
|
System.out.println(HuiLianTongUnionCardConfig.resolveResponse("Gbkl57c3fEBg+E3HfPuQ52xYXxRnbPnT1CFoWj0AaUCBA2W/qzLuaUXplapIu/Avzt0AmzA/oCA=\\n")); |
|
|
|
|
// 积分抵扣,卡券除外
|
|
|
|
|
if (!highOrder.getHighChildOrderList().get(0).getGoodsType().equals(1) && highOrder.getPayGold() != null) { |
|
|
|
|
// 积分转换成金额
|
|
|
|
|
BigDecimal goldPrice = new BigDecimal(highOrder.getPayGold().toString()).divide(new BigDecimal(100)); |
|
|
|
|
|
|
|
|
|
// 积分金额大于应付金额
|
|
|
|
|
if (goldPrice.compareTo(highOrder.getPayablePrice()) == 1) { |
|
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "支付的积分金额大于支付金额"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 积分金额小于应付金额
|
|
|
|
|
if (goldPrice.compareTo(highOrder.getPayablePrice()) == -1) { |
|
|
|
|
// 应付金额 减去 积分抵扣金额 = 支付金额
|
|
|
|
|
highOrder.setPayPrice(highOrder.getPayablePrice().subtract(goldPrice)); |
|
|
|
|
updateOrderDetail(highOrder); |
|
|
|
|
|
|
|
|
|
// 扣除用户积分
|
|
|
|
|
highUserService.goldHandle(highOrder.getMemId(), highOrder.getPayGold(), 2, 2, highOrder.getId()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 积分金额等于应付金额
|
|
|
|
|
if (goldPrice.compareTo(highOrder.getPayablePrice()) == 0) { |
|
|
|
|
if (StringUtils.isBlank(highOrder.getPayPwd())) { |
|
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.NOT_ENTER_USER_PAY_PWD, ""); |
|
|
|
|
} |
|
|
|
|
// 查询用户密码
|
|
|
|
|
HighUserPayPassword userPayPwd = highUserPayPasswordService.getDetailByUser(highOrder.getMemId()); |
|
|
|
|
if (userPayPwd == null) { |
|
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.NOT_SET_USER_PAY_PWD, ""); |
|
|
|
|
} |
|
|
|
|
// 校验支付密码是否正确
|
|
|
|
|
if (userPayPwd.getPassword().equals(AESEncodeUtil.aesEncrypt(highOrder.getPayPwd()))) { |
|
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.USER_PAY_PWD_ERROR, ""); |
|
|
|
|
} |
|
|
|
|
// 扣除用户积分
|
|
|
|
|
highUserService.goldHandle(highOrder.getMemId(), highOrder.getPayGold(), 2, 2, highOrder.getId()); |
|
|
|
|
|
|
|
|
|
highOrder.setOrderStatus(OrderStatusEnum.type3.getType()); |
|
|
|
|
highOrder.setPayTime(new Date()); |
|
|
|
|
for (HighChildOrder childOrder : highOrder.getHighChildOrderList()) { |
|
|
|
|
childOrder.setChildOrdeStatus(3); |
|
|
|
|
} |
|
|
|
|
updateOrder(highOrder); |
|
|
|
|
|
|
|
|
|
// 订单完成业务处理
|
|
|
|
|
orderBusinessTransaction(highOrder); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@ -483,14 +560,25 @@ public class HighOrderServiceImpl implements HighOrderService { |
|
|
|
|
} |
|
|
|
|
} else if (store.getSourceType().equals(MerchantStoreSourceType.type3.getNumber())) { |
|
|
|
|
|
|
|
|
|
// 推送壳牌
|
|
|
|
|
JSONObject syncPayment = shellGroupService.gasSyncPayment(highOrder.getOrderNo(), |
|
|
|
|
// 推送加好油
|
|
|
|
|
shellGroupService.gasSyncPayment(highOrder.getOrderNo(), |
|
|
|
|
store.getStoreKey(), |
|
|
|
|
highOrder.getPayTime(), |
|
|
|
|
highChildOrder.getGasPriceGun(), |
|
|
|
|
highChildOrder.getTotalPrice(), |
|
|
|
|
highChildOrder.getGasOilNo(), |
|
|
|
|
highChildOrder.getGasGunNo(), |
|
|
|
|
highOrder.getTotalPrice()); |
|
|
|
|
highOrder.getPayablePrice(), |
|
|
|
|
highOrder.getDeductionPrice() |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
} else if (store.getSourceType().equals(MerchantStoreSourceType.type4.getNumber())) { |
|
|
|
|
// 推送金猪加油
|
|
|
|
|
JSONObject jzOrderObject = jinZhuJiaYouService.payOrder(highOrder.getOrderNo(), highChildOrder.getGasPriceChannelPay()); |
|
|
|
|
if (jzOrderObject == null |
|
|
|
|
|| !jzOrderObject.getString("type").equals("OK") |
|
|
|
|
|| !jzOrderObject.getInteger("status").equals(200)) { |
|
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, jzOrderObject.getString("title")); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -759,14 +847,16 @@ public class HighOrderServiceImpl implements HighOrderService { |
|
|
|
|
} |
|
|
|
|
} else if (store.getSourceType().equals(MerchantStoreSourceType.type3.getNumber())) { |
|
|
|
|
|
|
|
|
|
// 推送壳牌
|
|
|
|
|
JSONObject syncPayment = shellGroupService.gasSyncPayment(order.getOrderNo(), |
|
|
|
|
// 推送加好油
|
|
|
|
|
shellGroupService.gasSyncPayment(order.getOrderNo(), |
|
|
|
|
store.getStoreKey(), |
|
|
|
|
order.getPayTime(), |
|
|
|
|
highChildOrder.getGasPriceGun(), |
|
|
|
|
highChildOrder.getTotalPrice(), |
|
|
|
|
highChildOrder.getGasOilNo(), |
|
|
|
|
highChildOrder.getGasGunNo(), |
|
|
|
|
order.getTotalPrice()); |
|
|
|
|
order.getPayablePrice(), |
|
|
|
|
order.getDeductionPrice() |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -1073,14 +1163,16 @@ public class HighOrderServiceImpl implements HighOrderService { |
|
|
|
|
} |
|
|
|
|
} else if (store.getSourceType().equals(MerchantStoreSourceType.type3.getNumber())) { |
|
|
|
|
|
|
|
|
|
// 推送壳牌
|
|
|
|
|
JSONObject syncPayment = shellGroupService.gasSyncPayment(order.getOrderNo(), |
|
|
|
|
// 推送加好油
|
|
|
|
|
shellGroupService.gasSyncPayment(order.getOrderNo(), |
|
|
|
|
store.getStoreKey(), |
|
|
|
|
order.getPayTime(), |
|
|
|
|
highChildOrder.getGasPriceGun(), |
|
|
|
|
highChildOrder.getTotalPrice(), |
|
|
|
|
highChildOrder.getGasOilNo(), |
|
|
|
|
highChildOrder.getGasGunNo(), |
|
|
|
|
order.getTotalPrice()); |
|
|
|
|
order.getPayablePrice(), |
|
|
|
|
order.getDeductionPrice() |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -1144,6 +1236,241 @@ public class HighOrderServiceImpl implements HighOrderService { |
|
|
|
|
highOrderMapper.updateByPrimaryKey(highOrder); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public void orderBusinessTransaction(HighOrder order) throws Exception { |
|
|
|
|
for (HighChildOrder highChildOrder : order.getHighChildOrderList()) { |
|
|
|
|
// 商品类型 商品类型 1:卡卷 2:金币充值
|
|
|
|
|
if (highChildOrder.getGoodsType() == 1) { |
|
|
|
|
highChildOrder.setChildOrdeStatus(2); // 子订单状态:1 待支付 2 已支付 3.已完成 4. 已退款 5.已取消
|
|
|
|
|
|
|
|
|
|
HighCoupon coupon = highCouponService.getCouponById(highChildOrder.getGoodsId()); |
|
|
|
|
|
|
|
|
|
// 是否预约
|
|
|
|
|
if (coupon.getReserveStatus() == true) { |
|
|
|
|
HighOrderPre orderPre = new HighOrderPre(); |
|
|
|
|
orderPre.setCompanyId(coupon.getCompanyId()); |
|
|
|
|
orderPre.setMerchantId(coupon.getMerchantId()); |
|
|
|
|
orderPre.setMerchantStoreId(highChildOrder.getStoreId()); |
|
|
|
|
orderPre.setPreOrderNo(System.currentTimeMillis() + ""); |
|
|
|
|
orderPre.setOrderId(order.getId()); |
|
|
|
|
orderPre.setOrderNo(order.getOrderNo()); |
|
|
|
|
orderPre.setChildOrderId(highChildOrder.getId()); |
|
|
|
|
orderPre.setPayRealPrice(order.getPayRealPrice()); |
|
|
|
|
orderPre.setGoodsType(1); |
|
|
|
|
orderPre.setGoodsName(coupon.getCouponName()); |
|
|
|
|
orderPre.setGoodsId(coupon.getId()); |
|
|
|
|
orderPre.setPreUserId(order.getMemId()); |
|
|
|
|
orderPre.setPreUserName(order.getMemName()); |
|
|
|
|
orderPre.setPreUserPhone(order.getMemPhone()); |
|
|
|
|
orderPre.setPreUserRemark(order.getRemarks()); |
|
|
|
|
orderPre.setStatus(1); |
|
|
|
|
highOrderPreService.insertOrderPre(orderPre); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 贵州中石化
|
|
|
|
|
if (coupon.getCouponSource() == 4) { |
|
|
|
|
Map<String, Object> push = new HashMap<>(); |
|
|
|
|
push.put("couTypeCode", coupon.getCouponKey()); |
|
|
|
|
push.put("distCouCount", highChildOrder.getSaleCount()); |
|
|
|
|
push.put("userPhone", order.getMemPhone()); |
|
|
|
|
push.put("thirdUserId", order.getMerchId()); |
|
|
|
|
|
|
|
|
|
// 推送给高速
|
|
|
|
|
JSONObject returnParam = HuiLianTongConfig.costRechargeOrder(highChildOrder.getExt2()); |
|
|
|
|
if (returnParam != null && returnParam.getString("respCode").equals("0000")) { |
|
|
|
|
// 解密
|
|
|
|
|
JSONObject jsonObject = HuiLianTongUnionCardConfig.resolveResponse(returnParam.getString("data")); |
|
|
|
|
JSONArray dataArray = JSONObject.parseObject(jsonObject.getString("data"), JSONArray.class); |
|
|
|
|
for (Object data : dataArray) { |
|
|
|
|
JSONObject dataObject = (JSONObject) data; |
|
|
|
|
HighCouponCodeOther couponCodeOther = new HighCouponCodeOther(); |
|
|
|
|
couponCodeOther.setType(1); |
|
|
|
|
couponCodeOther.setOrderId(order.getId()); |
|
|
|
|
couponCodeOther.setChildOrderId(highChildOrder.getId()); |
|
|
|
|
couponCodeOther.setCouTypeCode(dataObject.getString("couTypeCode")); |
|
|
|
|
couponCodeOther.setCouNo(dataObject.getString("couNo")); |
|
|
|
|
couponCodeOther.setActiveTime(dataObject.getDate("activeTime")); |
|
|
|
|
couponCodeOther.setValidStartDate(dataObject.getDate("validStartDate")); |
|
|
|
|
couponCodeOther.setValidEndDate(dataObject.getDate("validEndDate")); |
|
|
|
|
couponCodeOther.setStatus(20); |
|
|
|
|
couponCodeOther.setCreateTime(new Date()); |
|
|
|
|
highCouponCodeOtherMapper.insert(couponCodeOther); |
|
|
|
|
|
|
|
|
|
// 卡卷关联用户
|
|
|
|
|
HighUserCoupon highUserCoupon = new HighUserCoupon(); |
|
|
|
|
highUserCoupon.setMerchantId(coupon.getMerchantId()); |
|
|
|
|
highUserCoupon.setCouponId(coupon.getId()); |
|
|
|
|
highUserCoupon.setUserId(order.getMemId()); |
|
|
|
|
highUserCoupon.setCreateTime(new Date()); |
|
|
|
|
highUserCoupon.setQrCodeImg(dataObject.getString("couNo")); |
|
|
|
|
highUserCoupon.setUseEndTime(dataObject.getDate("validEndDate")); |
|
|
|
|
highUserCoupon.setStatus(1); // 状态 0:已过期 1:未使用 2:已使用
|
|
|
|
|
highUserCouponMapper.insert(highUserCoupon); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 推送记录
|
|
|
|
|
HighGasOrderPush highGasOrderPush = new HighGasOrderPush(); |
|
|
|
|
highGasOrderPush.setType(OrderPushType.type6.getType()); |
|
|
|
|
highGasOrderPush.setOrderNo(order.getOrderNo()); |
|
|
|
|
highGasOrderPush.setCreateTime(new Date()); |
|
|
|
|
highGasOrderPush.setCode(returnParam.getString("result")); |
|
|
|
|
highGasOrderPush.setRequestContent(JSONObject.toJSONString(push)); |
|
|
|
|
highGasOrderPush.setReturnContent(returnParam.toJSONString()); |
|
|
|
|
highGasOrderPushMapper.insert(highGasOrderPush); |
|
|
|
|
|
|
|
|
|
} else { |
|
|
|
|
HighCouponCode code = highCouponCodeService.getCouponCodeByOrderId(highChildOrder.getId()); |
|
|
|
|
code.setStatus(2); // 状态:1.待销售 2.未使用 3.已使用 99.预支付
|
|
|
|
|
code.setReceiveTime(new Date()); |
|
|
|
|
highCouponCodeService.updateCouponCode(code); |
|
|
|
|
|
|
|
|
|
// 卡卷关联用户
|
|
|
|
|
HighUserCoupon highUserCoupon = new HighUserCoupon(); |
|
|
|
|
highUserCoupon.setMerchantId(code.getMerchantId()); |
|
|
|
|
highUserCoupon.setCouponId(code.getCouponId()); |
|
|
|
|
highUserCoupon.setUserId(order.getMemId()); |
|
|
|
|
highUserCoupon.setCouponCodeId(code.getId()); |
|
|
|
|
highUserCoupon.setCreateTime(new Date()); |
|
|
|
|
highUserCoupon.setQrCodeImg(code.getExt1()); |
|
|
|
|
|
|
|
|
|
// 计算使用有效期
|
|
|
|
|
Calendar userEndTime = Calendar.getInstance(); |
|
|
|
|
userEndTime.setTime(new Date()); |
|
|
|
|
userEndTime.set(Calendar.HOUR_OF_DAY, 23); |
|
|
|
|
userEndTime.set(Calendar.MINUTE, 59); |
|
|
|
|
userEndTime.set(Calendar.SECOND, 59); |
|
|
|
|
userEndTime.add(Calendar.DATE, coupon.getRecycleDay()); |
|
|
|
|
if (userEndTime.getTime().compareTo(code.getUseEndTime()) == 1) { |
|
|
|
|
highUserCoupon.setUseEndTime(code.getUseEndTime()); |
|
|
|
|
} else { |
|
|
|
|
highUserCoupon.setUseEndTime(userEndTime.getTime()); |
|
|
|
|
} |
|
|
|
|
highUserCoupon.setStatus(1); // 状态 0:已过期 1:未使用 2:已使用
|
|
|
|
|
highUserCouponMapper.insert(highUserCoupon); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 查询卡券是否有活动
|
|
|
|
|
Map<String, Object> activity = highActivityInfoService.getNewActivityByCouponId(coupon.getId()); |
|
|
|
|
if (activity != null && MapUtils.getLong(activity, "id") != null) { |
|
|
|
|
highActivityUserLotteryNumService.addLotteryNum(MapUtils.getLong(activity, "id"), order.getMemId(), 1); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (highChildOrder.getGoodsType() == 2) { |
|
|
|
|
highChildOrder.setChildOrdeStatus(3); // 子订单状态:1 待支付 2 已支付 3.已完成 4. 已退款 5.已取消
|
|
|
|
|
// 金币 1:100
|
|
|
|
|
Integer goldNum = new BigDecimal(highChildOrder.getTotalPrice().toString()).multiply(new BigDecimal("100")).intValue(); |
|
|
|
|
highUserService.goldHandle(highChildOrder.getGoodsId(), goldNum, 1, 1, highChildOrder.getId()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (highChildOrder.getGoodsType() == 3) { |
|
|
|
|
highChildOrder.setChildOrdeStatus(3); |
|
|
|
|
order.setOrderStatus(3); |
|
|
|
|
HighMerchantStoreModel store = highMerchantStoreService.getMerchantStoreById(highChildOrder.getGoodsId()); |
|
|
|
|
|
|
|
|
|
// 来源类型 1:平台自建 2:团油
|
|
|
|
|
if (store.getSourceType().equals(1)) { |
|
|
|
|
|
|
|
|
|
// 预存类型 0:非预存 1:预存门店
|
|
|
|
|
if (store.getPrestoreType() != null && store.getPrestoreType().equals(1)) { |
|
|
|
|
Map<String, Object> pushParam = new HashMap<>(); |
|
|
|
|
pushParam.put("businessType", MerStoreAmountTypeEnum.type2.getType()); |
|
|
|
|
pushParam.put("storeId", highChildOrder.getGoodsId()); |
|
|
|
|
pushParam.put("price", order.getTotalPrice()); |
|
|
|
|
pushParam.put("sourceType", MerStoreAmountSourceTypeEnum.type2.getType()); |
|
|
|
|
pushParam.put("sourceId", order.getId()); |
|
|
|
|
pushParam.put("sourceContent", "订单号:" + order.getOrderNo() + ",加油金额:¥" + order.getTotalPrice()); |
|
|
|
|
pushParam.put("opUserId", order.getMemId()); |
|
|
|
|
pushParam.put("opUserName", order.getMemName()); |
|
|
|
|
// 扣预存款
|
|
|
|
|
this.redisTemplate.boundListOps(MsgTopic.MerStoreAccount.getName()).leftPush(pushParam); |
|
|
|
|
} |
|
|
|
|
} else if (store.getSourceType().equals(2)) { |
|
|
|
|
// 推送团油订单
|
|
|
|
|
Map<String, Object> paramMap = new HashMap<>(); |
|
|
|
|
paramMap.put("gasId", store.getStoreKey()); |
|
|
|
|
paramMap.put("oilNo", highChildOrder.getGasOilNo()); |
|
|
|
|
paramMap.put("gunNo", highChildOrder.getGasGunNo()); |
|
|
|
|
BigDecimal priceGun = highChildOrder.getGasPriceGun(); |
|
|
|
|
BigDecimal priceVip = highChildOrder.getGasPriceVip(); |
|
|
|
|
paramMap.put("priceGun", priceGun); // 枪单价
|
|
|
|
|
paramMap.put("priceVip", priceVip); // 优惠价
|
|
|
|
|
paramMap.put("driverPhone", order.getMemPhone()); |
|
|
|
|
paramMap.put("thirdSerialNo", order.getOrderNo()); |
|
|
|
|
paramMap.put("refuelingAmount", highChildOrder.getTotalPrice()); |
|
|
|
|
|
|
|
|
|
// 油品类型 1:汽油:2:柴油;3:天然气
|
|
|
|
|
if (highChildOrder.getGasOilType() == 1) { |
|
|
|
|
paramMap.put("accountNo", CommonSysConst.getSysConfig().getTuanYouGasolineAccount()); |
|
|
|
|
} else if (highChildOrder.getGasOilType() == 2) { |
|
|
|
|
paramMap.put("accountNo", CommonSysConst.getSysConfig().getTuanYouDieselAccount()); |
|
|
|
|
} |
|
|
|
|
JSONObject orderPushObject = TuanYouConfig.refuelingOrderPush(paramMap); |
|
|
|
|
// 推送团油订单记录
|
|
|
|
|
HighGasOrderPush highGasOrderPush = new HighGasOrderPush(); |
|
|
|
|
highGasOrderPush.setType(OrderPushType.type1.getType()); |
|
|
|
|
highGasOrderPush.setOrderNo(order.getOrderNo()); |
|
|
|
|
highGasOrderPush.setCreateTime(new Date()); |
|
|
|
|
highGasOrderPush.setCode(orderPushObject.getString("code")); |
|
|
|
|
highGasOrderPush.setRequestContent(JSONObject.toJSONString(paramMap)); |
|
|
|
|
highGasOrderPush.setReturnContent(orderPushObject.toJSONString()); |
|
|
|
|
highGasOrderPushMapper.insert(highGasOrderPush); |
|
|
|
|
|
|
|
|
|
if (orderPushObject != null && orderPushObject.getString("code").equals("200")) { |
|
|
|
|
highChildOrder.setGasOrderNo(orderPushObject.getJSONObject("result").getString("orderNo")); |
|
|
|
|
} |
|
|
|
|
} else if (store.getSourceType().equals(MerchantStoreSourceType.type3.getNumber())) { |
|
|
|
|
|
|
|
|
|
// 推送加好油
|
|
|
|
|
shellGroupService.gasSyncPayment(order.getOrderNo(), |
|
|
|
|
store.getStoreKey(), |
|
|
|
|
order.getPayTime(), |
|
|
|
|
highChildOrder.getTotalPrice(), |
|
|
|
|
highChildOrder.getGasOilNo(), |
|
|
|
|
highChildOrder.getGasGunNo(), |
|
|
|
|
order.getPayablePrice(), |
|
|
|
|
order.getDeductionPrice() |
|
|
|
|
); |
|
|
|
|
} else if (store.getSourceType().equals(MerchantStoreSourceType.type4.getNumber())) { |
|
|
|
|
// 推送金猪加油
|
|
|
|
|
JSONObject jzOrderObject = jinZhuJiaYouService.payOrder(order.getOrderNo(), highChildOrder.getGasPriceChannelPay()); |
|
|
|
|
if (jzOrderObject == null |
|
|
|
|
|| !jzOrderObject.getString("type").equals("OK") |
|
|
|
|
|| !jzOrderObject.getInteger("status").equals(200)) { |
|
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, jzOrderObject.getString("title")); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (highChildOrder.getGoodsType() == 7) { |
|
|
|
|
HighDiscountPackageActual actual = discountPackageActualService.getDetailByChildOrderId(highChildOrder.getId()); |
|
|
|
|
if (actual != null) { |
|
|
|
|
List<HighDiscountPackageDiscountActual> discountList = discountPackageDiscountActualService.getHighDiscountPackageDiscountActualList(actual.getId()); |
|
|
|
|
for (HighDiscountPackageDiscountActual discount : discountList) { |
|
|
|
|
highDiscountUserRelService.receiveDiscount(order.getMemId(), discount.getAgentDiscountCodeId()); |
|
|
|
|
} |
|
|
|
|
HighDiscountPackage discountPackage = discountPackageService.findDiscountPackageById(actual.getDiscountPackageId()); |
|
|
|
|
HighDiscountPackageRecord record = new HighDiscountPackageRecord(); |
|
|
|
|
record.setDiscountPackageId(discountPackage.getId()); |
|
|
|
|
record.setDiscountPackageTitle(discountPackage.getTitle()); |
|
|
|
|
record.setUsingAttribution(discountPackage.getUsingAttribution()); |
|
|
|
|
record.setCompanyId(discountPackage.getCompanyId()); |
|
|
|
|
record.setOrderId(order.getId().intValue()); |
|
|
|
|
record.setChildOrderId(highChildOrder.getId().intValue()); |
|
|
|
|
record.setRecordNo(System.currentTimeMillis() + ""); |
|
|
|
|
record.setSalesType(1); |
|
|
|
|
record.setPrice(order.getPayPrice()); |
|
|
|
|
record.setUserId(order.getMemId().intValue()); |
|
|
|
|
discountPackageRecordService.insertRecord(record); |
|
|
|
|
actual.setAllocationTime(new Date()); |
|
|
|
|
actual.setStatus(3); // 状态: 1: 待分配 2:预分配(售卖)3:已分配
|
|
|
|
|
discountPackageActualService.updateHighDiscountPackageActual(actual); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public Integer getUndoneChildOrder(Long orderId) { |
|
|
|
|
HighOrder order = getOrderById(orderId); |
|
|
|
|