dev-discount
胡锐 3 years ago
commit 13a9cff968
  1. 23
      hai-cweb/src/main/java/com/cweb/controller/HighOrderController.java
  2. 25
      hai-service/src/main/java/com/hai/config/HuiLianTongUnionCardConfig.java
  3. 2
      hai-service/src/main/java/com/hai/entity/HighChildOrder.java
  4. 49
      hai-service/src/main/java/com/hai/service/pay/impl/GoodsOrderServiceImpl.java

@ -272,6 +272,29 @@ public class HighOrderController {
childOrder.setGoodsSpecName("默认"); childOrder.setGoodsSpecName("默认");
} }
// 汇联通充值
if (childOrder.getGoodsType() == 8) {
if (childOrder.getGoodsPrice() == null) {
log.error("HighOrderController --> addOrder() error!", "请设置充值金额");
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "请设置充值金额");
}
if (highOrder.getMemCardNo() == null) {
log.error("HighOrderController --> addOrder() error!", "请设置充值卡号");
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "请设置充值卡号");
}
// 查询用户信息
HighUser user = highUserService.findByUserId(childOrder.getGoodsId());
if (user == null) {
log.error("HighOrderController --> addOrder() error!", "未找到用户");
throw ErrorHelp.genException(SysCode.System, ErrorCode.UN_MEMBER_ERROR, "");
}
highOrder.setPayType(2); // 第三方平台
childOrder.setGoodsActualPrice(childOrder.getGoodsPrice());
childOrder.setGoodsName(user.getName());
childOrder.setGoodsImg(user.getHeaderImg());
childOrder.setGoodsSpecName("默认");
}
childOrder.setMemId(userInfoModel.getHighUser().getId()); childOrder.setMemId(userInfoModel.getHighUser().getId());
childOrder.setTotalPrice(childOrder.getGoodsPrice().multiply(new BigDecimal(childOrder.getSaleCount().toString()))); childOrder.setTotalPrice(childOrder.getGoodsPrice().multiply(new BigDecimal(childOrder.getSaleCount().toString())));
childOrder.setGiveawayType(false); // 是否是赠品 0:否 1:是 childOrder.setGiveawayType(false); // 是否是赠品 0:否 1:是

@ -121,6 +121,31 @@ public class HuiLianTongUnionCardConfig {
} }
} }
/**
* 充值
* @param orderNo 订单号
* @param cardNo 卡号
* @param tranAmount 支付金额
* @param businessType 业务类型 1.卖中石化加油券的固定填sinopec_oil_code 2.其他商品或服务的固定填hisen_consume
* @param tranVoucher 银行卡充值可填银行卡号支付宝微信充值可填相应的扣款单号接入方也可自定义填入交易流水跟踪号但长度不能超过50
* @param tranDesc 交易描述
* @return
* @throws Exception
*/
public static JSONObject deposit(String orderNo, String cardNo, BigDecimal tranAmount, String businessType, String tranVoucher , String tranDesc) throws Exception {
Map<String,Object> dataMap = new HashMap<>();
dataMap.put("orderNo", orderNo);
dataMap.put("cardType", "ghk");
dataMap.put("cardNo", cardNo);
dataMap.put("tranAmount", tranAmount);
dataMap.put("tranChannel", "HiSen");
dataMap.put("businessType", businessType);
dataMap.put("tranVoucher", tranVoucher);
dataMap.put("tranDesc", tranDesc);
System.out.println("工会卡支付请求参数" + JSON.toJSONString(dataMap));
return request("qtk/deposit", dataMap);
}
/** /**
* 支付 * 支付
* @param orderNo 订单号 * @param orderNo 订单号

@ -44,7 +44,7 @@ public class HighChildOrder implements Serializable {
private String storeAddress; private String storeAddress;
/** /**
* 商品类型 1:卡卷 2:金币充值 3:团油加油站 4: KFC 5电影票 * 商品类型 1:卡卷 2:金币充值 3:团油加油站 4: KFC 5电影票 8: 汇联通充值
*/ */
private Integer goodsType; private Integer goodsType;

@ -1,5 +1,6 @@
package com.hai.service.pay.impl; package com.hai.service.pay.impl;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.hai.common.exception.ErrorCode; import com.hai.common.exception.ErrorCode;
@ -10,6 +11,7 @@ import com.hai.common.pay.util.sdk.WXPayConstants;
import com.hai.common.utils.WxUtils; import com.hai.common.utils.WxUtils;
import com.hai.config.CommonSysConst; import com.hai.config.CommonSysConst;
import com.hai.config.HuiLianTongConfig; import com.hai.config.HuiLianTongConfig;
import com.hai.config.HuiLianTongUnionCardConfig;
import com.hai.config.TuanYouConfig; import com.hai.config.TuanYouConfig;
import com.hai.dao.HighCouponCodeOtherMapper; import com.hai.dao.HighCouponCodeOtherMapper;
import com.hai.dao.HighDiscountPackageRecordMapper; import com.hai.dao.HighDiscountPackageRecordMapper;
@ -259,6 +261,8 @@ public class GoodsOrderServiceImpl implements PayService {
if (highChildOrder.getGoodsType() == 2) { if (highChildOrder.getGoodsType() == 2) {
highChildOrder.setChildOrdeStatus(3); // 子订单状态:1 待支付 2 已支付 3.已完成 4. 已退款 5.已取消 highChildOrder.setChildOrdeStatus(3); // 子订单状态:1 待支付 2 已支付 3.已完成 4. 已退款 5.已取消
order.setFinishTime(new Date());
order.setOrderStatus(3); // 订单状态:1 待支付 2 已支付 3.已完成 4. 已退款 5.已取消
// 金币 1:100 // 金币 1:100
Integer goldNum = new BigDecimal(highChildOrder.getTotalPrice().toString()).multiply(new BigDecimal("100")).intValue(); Integer goldNum = new BigDecimal(highChildOrder.getTotalPrice().toString()).multiply(new BigDecimal("100")).intValue();
highUserService.goldHandle(highChildOrder.getGoodsId(), goldNum, 1, 1, highChildOrder.getId()); highUserService.goldHandle(highChildOrder.getGoodsId(), goldNum, 1, 1, highChildOrder.getId());
@ -327,6 +331,51 @@ public class GoodsOrderServiceImpl implements PayService {
discountPackageActualService.updateHighDiscountPackageActual(actual); discountPackageActualService.updateHighDiscountPackageActual(actual);
} }
} }
if (highChildOrder.getGoodsType() == 8) {
// 汇联通充值
String goodsDesc = "汇联通充值"+order.getPayPrice()+"元";
String tranDesc = "";
String businessType = "ghk_deposit";
// 汇联通卡充值
JSONObject deposit = HuiLianTongUnionCardConfig.deposit(order.getOrderNo(), order.getMemCardNo(), order.getPayPrice(), businessType, map.get("transaction_id"), tranDesc);
System.out.println("工会卡支付响应参数" + deposit.toJSONString());
JSONObject dataObject = HuiLianTongUnionCardConfig.resolveResponse(deposit.getString("data"));
Map<String,Object> dataMap = new HashMap<>();
dataMap.put("orderNo", order.getOrderNo());
dataMap.put("cardType", "ghk");
dataMap.put("cardNo", order.getMemCardNo());
dataMap.put("checkPassword", "N");
dataMap.put("tranAmount", order.getPayPrice());
dataMap.put("tranChannel", "HiSen");
dataMap.put("businessType", businessType);
dataMap.put("goodsDesc", goodsDesc);
dataMap.put("tranDesc", tranDesc);
HighGasOrderPush payPush = new HighGasOrderPush();
payPush.setType(OrderPushType.type5.getType());
payPush.setOrderNo(order.getOrderNo());
payPush.setCreateTime(new Date());
payPush.setCode(deposit.getString("respCode"));
payPush.setRequestContent(JSON.toJSONString(dataMap));
payPush.setReturnContent(deposit.toJSONString());
highGasOrderPushMapper.insert(payPush);
if (!Objects.equals(deposit.getString("respCode"), "0000")) {
throw ErrorHelp.genException(SysCode.System , ErrorCode.COMMON_ERROR , deposit.getString("respMessage"));
}
// 记录回调信息
if (!dataObject.getBoolean("success")) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, dataObject.getString("message"));
}
// 修改订单状态
highChildOrder.setChildOrdeStatus(3); // 子订单状态:1 待支付 2 已支付 3.已完成 4. 已退款 5.已取消
order.setFinishTime(new Date());
order.setOrderStatus(3); // 订单状态:1 待支付 2 已支付 3.已完成 4. 已退款 5.已取消
}
} }
highOrderService.updateOrder(order); highOrderService.updateOrder(order);

Loading…
Cancel
Save