From d81d24aefee622bce4e1108ee8f880d9c4eddb58 Mon Sep 17 00:00:00 2001 From: = <=> Date: Sun, 29 Aug 2021 18:26:03 +0800 Subject: [PATCH] =?UTF-8?q?'=E6=8F=90=E4=BA=A4=E4=BB=A3=E7=A0=81'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/HighUserCardController.java | 87 ++++++++ .../cweb/controller/pay/OrderController.java | 90 +++++++- .../config/HuiLianTongUnionCardConfig.java | 43 +++- .../com/hai/service/HighOrderService.java | 8 + .../service/impl/HighOrderServiceImpl.java | 205 +++++++++++++++++- 5 files changed, 420 insertions(+), 13 deletions(-) diff --git a/hai-cweb/src/main/java/com/cweb/controller/HighUserCardController.java b/hai-cweb/src/main/java/com/cweb/controller/HighUserCardController.java index b9a60b6e..68cad0ac 100644 --- a/hai-cweb/src/main/java/com/cweb/controller/HighUserCardController.java +++ b/hai-cweb/src/main/java/com/cweb/controller/HighUserCardController.java @@ -25,6 +25,8 @@ import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; import javax.servlet.http.HttpServletRequest; +import java.util.HashMap; +import java.util.Map; import java.util.Objects; @Controller @@ -59,6 +61,33 @@ public class HighUserCardController { } } + @RequestMapping(value = "/delUserCard", method = RequestMethod.POST) + @ResponseBody + @ApiOperation(value = "删除用户卡号") + public ResponseData delUserCard(@RequestBody JSONObject body, HttpServletRequest request) { + try { + if (body == null || StringUtils.isBlank(body.getString("cardNo"))) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); + } + // 用户 + SessionObject sessionObject = userCenter.getSessionObject(request); + HighUserModel userInfoModel = (HighUserModel) sessionObject.getObject(); + + HighUserCard card = highUserCardService.getDetailByUserCardNo(userInfoModel.getHighUser().getId(), body.getString("cardNo")); + if (card == null) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到数据"); + } + card.setStatus(0); + highUserCardService.editCard(card); + + return ResponseMsgUtil.success("操作成功"); + + } catch (Exception e) { + log.error("HighUserCardController --> delCard() error!", e); + return ResponseMsgUtil.exception(e); + } + } + @RequestMapping(value = "/bindHuiLianTongCard", method = RequestMethod.POST) @ResponseBody @ApiOperation(value = "绑定汇联通工会卡") @@ -134,5 +163,63 @@ public class HighUserCardController { } } + @RequestMapping(value = "/getHuiLianTongCardInfo", method = RequestMethod.GET) + @ResponseBody + @ApiOperation(value = "查询汇联通工会卡详情") + public ResponseData getHuiLianTongCardInfo(@RequestParam(name = "cardNo", required = true) String cardNo,HttpServletRequest request) { + try { + // 用户 + SessionObject sessionObject = userCenter.getSessionObject(request); + HighUserModel userInfoModel = (HighUserModel) sessionObject.getObject(); + + HighUserCard card = highUserCardService.getDetailByUserCardNo(userInfoModel.getHighUser().getId(), cardNo); + if (card == null) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到数据"); + } + + JSONObject cardInfo = HuiLianTongUnionCardConfig.queryCardInfo(cardNo); + if (StringUtils.isBlank(cardInfo.getString("data"))) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.REQUEST_ERROR, ""); + } + return ResponseMsgUtil.success(HuiLianTongUnionCardConfig.resolveResponse(cardInfo.getString("data"))); + + } catch (Exception e) { + log.error("HighUserCardController --> getHuiLianTongCardInfo() error!", e); + return ResponseMsgUtil.exception(e); + } + } + + @RequestMapping(value = "/getHuiLianTongCardConsume", method = RequestMethod.GET) + @ResponseBody + @ApiOperation(value = "查询汇联通工会卡消费记录") + public ResponseData getHuiLianTongCardConsume(@RequestParam(name = "businessType", required = true) String businessType, + @RequestParam(name = "cardNo", required = true) String cardNo, + @RequestParam(name = "sdate", required = true) Long sdate, + @RequestParam(name = "edate", required = true) Long edate, + @RequestParam(name = "pageNum", required = true) Integer pageNum, + @RequestParam(name = "pageSize", required = true) Integer pageSize, + HttpServletRequest request) { + try { + // 用户 + SessionObject sessionObject = userCenter.getSessionObject(request); + HighUserModel userInfoModel = (HighUserModel) sessionObject.getObject(); + + HighUserCard card = highUserCardService.getDetailByUserCardNo(userInfoModel.getHighUser().getId(), cardNo); + if (card == null) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到数据"); + } + + JSONObject consumptionRecord = HuiLianTongUnionCardConfig.queryConsumptionRecordByBusiness(businessType, cardNo, sdate, edate, pageNum, pageSize); + if (StringUtils.isBlank(consumptionRecord.getString("data"))) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.REQUEST_ERROR, ""); + } + + return ResponseMsgUtil.success(HuiLianTongUnionCardConfig.resolveResponse(consumptionRecord.getString("data"))); + + } catch (Exception e) { + log.error("HighUserCardController --> getHuiLianTongCardConsume() error!", e); + return ResponseMsgUtil.exception(e); + } + } } diff --git a/hai-cweb/src/main/java/com/cweb/controller/pay/OrderController.java b/hai-cweb/src/main/java/com/cweb/controller/pay/OrderController.java index 86f12d6c..0c0d85e8 100644 --- a/hai-cweb/src/main/java/com/cweb/controller/pay/OrderController.java +++ b/hai-cweb/src/main/java/com/cweb/controller/pay/OrderController.java @@ -20,18 +20,12 @@ import com.hai.common.utils.MathUtils; import com.hai.common.utils.ResponseMsgUtil; import com.hai.config.QianZhuConfig; import com.hai.config.TuanYouConfig; -import com.hai.entity.HighChildOrder; -import com.hai.entity.HighCoupon; -import com.hai.entity.HighOrder; -import com.hai.entity.HighUserPayPassword; +import com.hai.entity.*; import com.hai.model.HighCouponModel; import com.hai.model.HighUserModel; import com.hai.model.ResponseData; import com.hai.model.UserInfoModel; -import com.hai.service.HighCouponService; -import com.hai.service.HighOrderService; -import com.hai.service.HighQzOrderService; -import com.hai.service.HighUserPayPasswordService; +import com.hai.service.*; import com.wechat.pay.contrib.apache.httpclient.WechatPayHttpClientBuilder; import com.wechat.pay.contrib.apache.httpclient.auth.AutoUpdateCertificatesVerifier; import com.wechat.pay.contrib.apache.httpclient.auth.PrivateKeySigner; @@ -99,6 +93,9 @@ public class OrderController { @Resource private HighUserPayPasswordService highUserPayPasswordService; + @Resource + private HighUserCardService highUserCardService; + /** * * @Title: orderToPay @@ -277,6 +274,83 @@ public class OrderController { } } + @RequestMapping(value="/hltUnionCardPay",method = RequestMethod.POST) + @ResponseBody + @ApiOperation(value = "汇联通工会卡支付") + public ResponseData hltUnionCardPay(@RequestBody String reqBodyStr,HttpServletRequest request) { + try { + // 用户 + SessionObject sessionObject = userCenter.getSessionObject(request); + HighUserModel userInfoModel = (HighUserModel) sessionObject.getObject(); + + if (StringUtils.isBlank(reqBodyStr)) { + log.error("orderToPay error!", "参数错误"); + throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); + } + JSONObject jsonObject = JSONObject.parseObject(reqBodyStr); + String cardNo = jsonObject.getString("cardNo"); + Long orderId = jsonObject.getLong("orderId"); + String password = jsonObject.getString("password"); + + if (StringUtils.isBlank(cardNo) || orderId == null) { + log.error("orderToPay error!", "参数错误"); + throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); + } + // 查询用户支付密码 + HighUserPayPassword userPayPassword = highUserPayPasswordService.getDetailByUser(userInfoModel.getHighUser().getId()); + if (userPayPassword == null) { + log.error("orderToPay error!", "未设置支付密码"); + throw ErrorHelp.genException(SysCode.System, ErrorCode.NOT_SET_USER_PAY_PWD, ""); + } + if (StringUtils.isBlank(password)) { + log.error("orderToPay error!", "未输入支付密码"); + throw ErrorHelp.genException(SysCode.System, ErrorCode.NOT_ENTER_USER_PAY_PWD, ""); + } + // 校验支付密码是否一直 + if (!AESEncodeUtil.aesEncrypt(password).equals(userPayPassword.getPassword())) { + log.error("orderToPay error!", ""); + throw ErrorHelp.genException(SysCode.System, ErrorCode.USER_PAY_PWD_ERROR, ""); + } + + // 查询用户与卡号的关系 + HighUserCard userCard = highUserCardService.getDetailByUserCardNo(userInfoModel.getHighUser().getId(), cardNo); + if (userCard == null) { + log.error("OrderController --> orderToPay() ERROR", "未绑定卡号"); + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未绑定卡号"); + } + + HighOrder order = highOrderService.getOrderById(orderId); + if(order == null) { + log.error("OrderController --> orderToPay() ERROR", "未找到订单信息"); + throw ErrorHelp.genException(SysCode.System, ErrorCode.NOT_FOUND_ORDER, ""); + } + //校验订单状态 订单状态:1 待支付 2 已支付 3.已完成 4. 已退款 5.已取消 + if(order.getOrderStatus() != 1) { + log.error("OrderController --> orderToPay() ERROR", "订单不处于待支付状态"); + throw ErrorHelp.genException(SysCode.System, ErrorCode.ORDER_NO_STAY_PAY, ""); + } + +/* // 商品类型 1:卡卷 2:金币充值 + for (HighChildOrder childOrder : order.getHighChildOrderList()) { + if (childOrder.getGoodsType() == 2) { + HighCoupon coupon = highCouponService.getCouponById(childOrder.getGoodsId()); + // 支付类型:1.微信支付 2.金币支付 + if (coupon.getPayType() != 2) { + log.error("OrderController --> orderToPay() ERROR", "只支持积分支付"); + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, coupon.getCouponName() + ",只支持积分支付"); + } + } + }*/ + + highOrderService.hltUnionCardPay(userCard.getId(), order.getId()); + + return ResponseMsgUtil.success("支付成功"); + } catch (Exception e) { + log.error("orderToPay error!", e); + return ResponseMsgUtil.exception(e); + } + } + @RequestMapping(value="/qzOrderToPay",method = RequestMethod.POST) @ResponseBody diff --git a/hai-service/src/main/java/com/hai/config/HuiLianTongUnionCardConfig.java b/hai-service/src/main/java/com/hai/config/HuiLianTongUnionCardConfig.java index 68ee8f51..1a49dfc4 100644 --- a/hai-service/src/main/java/com/hai/config/HuiLianTongUnionCardConfig.java +++ b/hai-service/src/main/java/com/hai/config/HuiLianTongUnionCardConfig.java @@ -14,6 +14,7 @@ import org.apache.commons.collections4.MapUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import java.math.BigDecimal; import java.nio.charset.Charset; import java.util.*; @@ -70,7 +71,7 @@ public class HuiLianTongUnionCardConfig { * @return * @throws Exception */ - public static JSONObject queryConsumptionRecordByBusiness(String businessType,String cardNo,Integer page,Integer pageSize,Long sdate,Long edate) throws Exception { + public static JSONObject queryConsumptionRecordByBusiness(String businessType,String cardNo,Long sdate,Long edate,Integer page,Integer pageSize) throws Exception { Map dataMap = new HashMap<>(); dataMap.put("businessType", businessType); dataMap.put("cardNo", cardNo); @@ -85,6 +86,46 @@ public class HuiLianTongUnionCardConfig { return request("qtk/queryConsumptionRecordByBusiness", dataMap); } + /** + * 支付 + * @param orderNo 订单号 + * @param cardNo 卡号 + * @param tranAmount 支付金额 + * @param businessType 业务类型 1.卖中石化加油券的,固定填sinopec_oil_code 2.其他商品或服务的,固定填hisen_consume + * @param goodsDesc 商品描述 + * @param tranDesc 交易描述 + * @return + * @throws Exception + */ + public static JSONObject consumption(String orderNo, String cardNo, BigDecimal tranAmount, String businessType, String goodsDesc, String tranDesc) throws Exception { + Map dataMap = new HashMap<>(); + dataMap.put("orderNo", orderNo); + dataMap.put("cardType", "ghk"); + dataMap.put("cardNo", cardNo); + dataMap.put("checkPassword", "N"); + dataMap.put("tranAmount", tranAmount); + dataMap.put("tranChannel", "HiSen"); + dataMap.put("businessType", businessType); + dataMap.put("instCode", "11098222"); + dataMap.put("goodsDesc", goodsDesc); + dataMap.put("tranDesc", tranDesc); + return request("qtk/consumption", dataMap); + } + + /** + * 退款 + * @param refundOrderNo 退款订单号 + * @param origOrderNo 支付订单号 + * @return + * @throws Exception + */ + public static JSONObject refund(String refundOrderNo, String origOrderNo) throws Exception { + Map dataMap = new HashMap<>(); + dataMap.put("orderNo", refundOrderNo); + dataMap.put("origOrderNo", origOrderNo); + dataMap.put("checkPassword", "N"); + return request("qtk/refund", dataMap); + } /** * 会员卡业务请求 diff --git a/hai-service/src/main/java/com/hai/service/HighOrderService.java b/hai-service/src/main/java/com/hai/service/HighOrderService.java index 23a404ef..4c59b4ba 100644 --- a/hai-service/src/main/java/com/hai/service/HighOrderService.java +++ b/hai-service/src/main/java/com/hai/service/HighOrderService.java @@ -35,6 +35,14 @@ public interface HighOrderService { **/ void goldPayOrder(Long userId, Long orderId) throws Exception; + /** + * 汇联通工会卡支付 + * @param userCardId + * @param orderId + * @throws Exception + */ + void hltUnionCardPay(Long userCardId, Long orderId) throws Exception; + /** * @Author 胡锐 * @Description 修改订单 diff --git a/hai-service/src/main/java/com/hai/service/impl/HighOrderServiceImpl.java b/hai-service/src/main/java/com/hai/service/impl/HighOrderServiceImpl.java index 01737395..d46a1bfc 100644 --- a/hai-service/src/main/java/com/hai/service/impl/HighOrderServiceImpl.java +++ b/hai-service/src/main/java/com/hai/service/impl/HighOrderServiceImpl.java @@ -8,13 +8,13 @@ import com.hai.common.exception.ErrorHelp; import com.hai.common.exception.SysCode; import com.hai.common.utils.DateUtil; import com.hai.common.utils.IDGenerator; +import com.hai.config.CommonSysConst; import com.hai.config.HuiLianTongConfig; +import com.hai.config.HuiLianTongUnionCardConfig; +import com.hai.config.TuanYouConfig; import com.hai.dao.*; import com.hai.entity.*; -import com.hai.model.HighCouponHandselModel; -import com.hai.model.HighCouponModel; -import com.hai.model.HighOrderData; -import com.hai.model.HighOrderModel; +import com.hai.model.*; import com.hai.service.*; import org.apache.commons.collections4.MapUtils; import org.apache.commons.lang3.StringUtils; @@ -43,6 +43,9 @@ public class HighOrderServiceImpl implements HighOrderService { @Resource private HighOrderMapperExt highOrderMapperExt; + @Resource + private HighUserCardService highUserCardService; + @Resource private HighChildOrderMapper highChildOrderMapper; @@ -76,6 +79,9 @@ public class HighOrderServiceImpl implements HighOrderService { @Resource private HighDiscountAgentCodeService highDiscountAgentCodeService; + @Resource + private HighMerchantStoreService highMerchantStoreService; + @Override @Transactional(propagation= Propagation.REQUIRES_NEW) public void insertOrder(HighOrder highOrder) throws Exception { @@ -272,6 +278,197 @@ public class HighOrderServiceImpl implements HighOrderService { updateOrder(highOrder); } + @Override + public void hltUnionCardPay(Long userCardId, Long orderId) throws Exception { + + HighUserCard userCard = highUserCardService.getDetailById(userCardId); + if(userCard == null) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到用户绑定的卡号信息"); + } + + // 查询订单信息 + HighOrder order = getOrderById(orderId); + if (order == null) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.NOT_FOUND_ORDER, ""); + } + String goodsDesc = ""; + String tranDesc = ""; + String businessType = "hisen_consume"; + + if (order.getHighChildOrderList().get(0).getGoodsType() == 1) { + businessType = "sinopec_oil_code"; + goodsDesc = "购买加油券"; + tranDesc = order.getHighChildOrderList().get(0).getGoodsName(); + + } else if (order.getHighChildOrderList().get(0).getGoodsType() == 2) { + goodsDesc = "积分充值"+order.getPayPrice()+"元"; + tranDesc = "嗨森逛积分充值"+order.getPayPrice()+"元"; + + } else { + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "暂时无法支付,请使用其他支付方式"); + } + + // 工会卡支付 + JSONObject consumption = HuiLianTongUnionCardConfig.consumption(order.getOrderNo(), userCard.getCardNo(), order.getPayPrice(), businessType, goodsDesc, tranDesc); + if(!consumption.getString("respCode").equals("0000")) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, consumption.getString("respMessage")); + } + JSONObject consumptionResult = HuiLianTongUnionCardConfig.resolveResponse(consumption.getString("data")); + if (consumptionResult.getBoolean("success") != true) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "交易失败,请使用其他支付方式"); + } + + // 查询用户 + HighUser highUser = highUserService.findByUserId(order.getMemId()); + + order.setMemCardId(userCard.getId()); + order.setMemCardNo(userCard.getCardNo()); + order.setMemCardType(userCard.getType()); + order.setPaySerialNo(consumption.getString("orderId")); // 支付流水号 + order.setPayRealPrice(order.getPayPrice()); // 实付金额 + order.setPayTime(new Date()); // 支付时间 + order.setPayModel(2); // 支付模式:1 金币,2 第三方平台,3 混合 + order.setPayType(2); // 支付方式: 1:支付宝 2:微信 3:金币 + order.setOrderStatus(2); // 订单状态:1 待支付 2 已支付 3.已完成 4. 已退款 5.已取消 + + for (HighChildOrder highChildOrder : order.getHighChildOrderList()) { + // 商品类型 商品类型 1:卡卷 2:金币充值 + if (highChildOrder.getGoodsType() == 1) { + highChildOrder.setChildOrdeStatus(2); // 子订单状态:1 待支付 2 已支付 3.已完成 4. 已退款 5.已取消 + HighCouponCode code = highCouponCodeService.getCouponCodeByOrderId(highChildOrder.getId()); + code.setStatus(2); // 状态:1.待销售 2.未使用 3.已使用 99.预支付 + code.setReceiveTime(new Date()); + highCouponCodeService.updateCouponCode(code); + + HighCoupon coupon = highCouponService.getCouponById(highChildOrder.getGoodsId()); + // 贵州中石化 + if (coupon.getCouponSource() == 4) { + // 获取token + JSONObject tokenObject = HuiLianTongConfig.getToken(); + if (!tokenObject.getString("result").equals("success")) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "获取token失败"); + } + + Map push = new HashMap<>(); + push.put("token", "data"); + push.put("couTypeCode", coupon.getCouponKey()); + push.put("distCouCount", highChildOrder.getSaleCount()); + push.put("userPhone", highUser.getPhone()); + push.put("thirdUserId", highUser.getUnionId()); + + // 推送给高速 + JSONObject returnParam = HuiLianTongConfig.couJointDist(tokenObject.getString("data"), coupon.getCouponKey(), highChildOrder.getSaleCount(), highUser.getPhone(), highUser.getUnionId()); + if (returnParam != null && returnParam.getString("result").equals("success")) { + JSONArray dataArray = returnParam.getJSONArray("data"); + 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.setStatus(20); + couponCodeOther.setCreateTime(new Date()); + couponCodeOther.setActiveTime(dataObject.getDate("activeTime")); + couponCodeOther.setValidStartDate(dataObject.getDate("validStartDate")); + couponCodeOther.setValidEndDate(dataObject.getDate("validEndDate")); + 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.setCreateTime(new Date()); + highGasOrderPush.setCode(returnParam.getString("result")); + highGasOrderPush.setRequestContent(JSONObject.toJSONString(push)); + highGasOrderPush.setReturnContent(returnParam.toJSONString()); + highGasOrderPushMapper.insert(highGasOrderPush); + + } else { + // 卡卷关联用户 + 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); + } + } + + 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); + HighMerchantStoreModel store = highMerchantStoreService.getMerchantStoreById(highChildOrder.getGoodsId()); + // 推送团油订单 + Map 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.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")); + } + } + updateOrder(order); + } + } + @Override @Transactional(propagation= Propagation.REQUIRES_NEW) public void updateOrder(HighOrder highOrder) {