'提交代码'

dev-discount
胡锐 3 years ago
parent 72731caed5
commit 7f380994a4
  1. 2
      hai-cweb/src/main/java/com/cweb/controller/HighTestController.java
  2. 2
      hai-cweb/src/main/java/com/cweb/controller/tPigController.java
  3. 1
      hai-service/src/main/java/com/hai/common/pay/entity/OrderType.java
  4. 74
      hai-service/src/main/java/com/hai/config/QianZhuConfig.java
  5. 21
      hai-service/src/main/java/com/hai/service/impl/HighQzOrderServiceImpl.java
  6. 52
      hai-service/src/main/java/com/hai/service/pay/impl/MobileOrderServiceImpl.java

@ -177,7 +177,7 @@ public class HighTestController {
@ApiOperation(value = "测试") @ApiOperation(value = "测试")
public ResponseData test2() { public ResponseData test2() {
try { try {
return ResponseMsgUtil.success(QianZhuConfig.getKfcOrderByOrderNo("20210712230130341045846")); return ResponseMsgUtil.success(QianZhuConfig.getMobileOrderByOrderNo("20210724151253346003684"));
} catch (Exception e) { } catch (Exception e) {
log.error("HighOrderController --> getOrderById() error!", e); log.error("HighOrderController --> getOrderById() error!", e);
return ResponseMsgUtil.exception(e); return ResponseMsgUtil.exception(e);

@ -87,7 +87,7 @@ public class tPigController {
String url = ""; String url = "";
if (token.getBoolean("success")) { if (token.getBoolean("success")) {
JSONObject data = token.getJSONObject("data"); JSONObject data = token.getJSONObject("data");
url = "https://m-test.qianzhu8.com/mobile/?platformId=" + CommonSysConst.getSysConfig().getQinzhuPlatformId() + "&token=" + data.getString("accessToken"); url = "https://m.qianzhu8.com/mobile/?platformId=" + CommonSysConst.getSysConfig().getQinzhuPlatformId() + "&token=" + data.getString("accessToken");
} }
return ResponseMsgUtil.success(url); return ResponseMsgUtil.success(url);
} catch (Exception e) { } catch (Exception e) {

@ -6,6 +6,7 @@ public enum OrderType {
RECHARGE_ORDER("RECHARGE_ORDER", "rechargeOrderService", "充值订单"), RECHARGE_ORDER("RECHARGE_ORDER", "rechargeOrderService", "充值订单"),
KFC_ORDER("KFC", "kfcOrderService", "KFC订单"), KFC_ORDER("KFC", "kfcOrderService", "KFC订单"),
CINEMA_ORDER("CINEMA", "cinemaOrderService", "电影票订单"), CINEMA_ORDER("CINEMA", "cinemaOrderService", "电影票订单"),
MOBILE_ORDER("MOBILE", "mobileOrderService", "话费充值订单"),
TEST("TEST", "testPayService", "支付测试"), TEST("TEST", "testPayService", "支付测试"),
; ;

@ -27,7 +27,7 @@ import java.util.*;
public class QianZhuConfig { public class QianZhuConfig {
/** /**
* 生成Token * 获取Token
* @param platformUniqueId 用户唯一id * @param platformUniqueId 用户唯一id
* @param nickname 昵称 * @param nickname 昵称
* @param mobile 电话号码 * @param mobile 电话号码
@ -44,25 +44,6 @@ public class QianZhuConfig {
return HttpsUtils.doGet(CommonSysConst.getSysConfig().getQinzhuUrl()+"/api/v2/platform/getToken", map); return HttpsUtils.doGet(CommonSysConst.getSysConfig().getQinzhuUrl()+"/api/v2/platform/getToken", map);
} }
public static JSONObject getMobileToken(String platformUniqueId,String nickname,String mobile) throws Exception {
Map<String,Object> contentMap = new LinkedHashMap<>();
contentMap.put("platformUniqueId", platformUniqueId);
contentMap.put("nickname", nickname);
contentMap.put("mobile", mobile);
Map<String,Object> map = new HashMap<>();
map.put("platformId", "10458");
map.put("action", "users.getTokenV2");
map.put("version", "1.0");
map.put("content", JSON.toJSONString(contentMap));
map.put("traceId", WxUtils.makeNonStr());
map.put("timestamp", new Date().getTime());
map.put("sign", MD5Util.encode(generateSignature(map,"nnl3gg4ss0pka11t").getBytes()).toLowerCase());
// return HttpsUtils.doPost(CommonSysConst.getSysConfig().getQinzhuMobileUrl()+"/gateway", JSON.toJSONString(map));
return HttpsUtils.doPost("https://live.qianzhu8.com/gateway", JSON.toJSONString(map));
}
/** /**
* KFC * KFC
* 根据订单号查询订单详情 * 根据订单号查询订单详情
@ -128,6 +109,59 @@ public class QianZhuConfig {
return HttpsUtils.doPost(CommonSysConst.getSysConfig().getQinzhuUrl()+"/openApi/v1/orders/payMovieOrder", JSONObject.toJSONString(map)); return HttpsUtils.doPost(CommonSysConst.getSysConfig().getQinzhuUrl()+"/openApi/v1/orders/payMovieOrder", JSONObject.toJSONString(map));
} }
/**
* 获取话费充值Token
* @param platformUniqueId 用户唯一id
* @param nickname 昵称
* @param mobile 电话号码
* @return Token
*/
public static JSONObject getMobileToken(String platformUniqueId,String nickname,String mobile) throws Exception {
Map<String,Object> contentMap = new LinkedHashMap<>();
contentMap.put("platformUniqueId", platformUniqueId);
contentMap.put("nickname", nickname);
contentMap.put("mobile", mobile);
Map<String,Object> map = new HashMap<>();
map.put("platformId", "10458");
map.put("action", "users.getTokenV2");
map.put("version", "1.0");
map.put("content", JSON.toJSONString(contentMap));
map.put("traceId", WxUtils.makeNonStr());
map.put("timestamp", new Date().getTime());
map.put("sign", MD5Util.encode(generateSignature(map,"nnl3gg4ss0pka11t").getBytes()).toLowerCase());
return HttpsUtils.doPost("https://live.qianzhu8.com/gateway", JSON.toJSONString(map));
}
public static JSONObject getMobileOrderByOrderNo(String orderNo) throws Exception {
Map<String,Object> contentMap = new LinkedHashMap<>();
contentMap.put("orderNo", orderNo);
Map<String,Object> map = new HashMap<>();
map.put("platformId", "10458");
map.put("action", "mobileOrders.pay");
map.put("version", "1.0");
map.put("content", JSON.toJSONString(contentMap));
map.put("traceId", WxUtils.makeNonStr());
map.put("timestamp", new Date().getTime());
map.put("sign", MD5Util.encode(generateSignature(map,"nnl3gg4ss0pka11t").getBytes()).toLowerCase());
return HttpsUtils.doPost("https://nf.qianzhu8.com/gateway", JSON.toJSONString(map));
}
public static JSONObject payMobileOrder(String orderNo) throws Exception {
Map<String,Object> contentMap = new LinkedHashMap<>();
contentMap.put("orderNo", orderNo);
Map<String,Object> map = new HashMap<>();
map.put("platformId", "10458");
map.put("action", "mobileOrders.pay");
map.put("version", "1.0");
map.put("content", JSON.toJSONString(contentMap));
map.put("traceId", WxUtils.makeNonStr());
map.put("timestamp", new Date().getTime());
map.put("sign", MD5Util.encode(generateSignature(map,"nnl3gg4ss0pka11t").getBytes()).toLowerCase());
return HttpsUtils.doPost("https://nf.qianzhu8.com/gateway", JSON.toJSONString(map));
}
/** /**
* 生成签名 * 生成签名
* @param data 数据 * @param data 数据

@ -39,6 +39,10 @@ public class HighQzOrderServiceImpl implements HighQzOrderService {
orderDetail = QianZhuConfig.getCinemaOrderByOrderNo(orderNo); orderDetail = QianZhuConfig.getCinemaOrderByOrderNo(orderNo);
} }
if (orderType.equals("MOBILE")) {
orderDetail = QianZhuConfig.getMobileOrderByOrderNo(orderNo);
}
if (orderDetail != null && orderDetail.getBoolean("success") == true) { if (orderDetail != null && orderDetail.getBoolean("success") == true) {
JSONObject data = orderDetail.getJSONObject("data"); JSONObject data = orderDetail.getJSONObject("data");
HighOrder order = highOrderService.getOrderByOrderNo(orderNo); HighOrder order = highOrderService.getOrderByOrderNo(orderNo);
@ -132,6 +136,23 @@ public class HighQzOrderServiceImpl implements HighQzOrderService {
highOrder.getHighChildOrderList().add(highChildOrder); highOrder.getHighChildOrderList().add(highChildOrder);
} }
if (orderType.equals("MOBILE")) {
highChildOrder = new HighChildOrder();
highChildOrder.setMemId(highOrder.getMemId());
highChildOrder.setGoodsType(6);
highChildOrder.setGoodsName("手机充值"+data.getString("rechargeDenomination")+"元");
highChildOrder.setGoodsSpecName(data.getString("rechargeMobile"));
highChildOrder.setGoodsPrice(new BigDecimal(data.getString("rechargeDenomination")));
highChildOrder.setGoodsActualPrice(new BigDecimal(data.getString("unitPrice")));
highChildOrder.setSaleCount(data.getInteger("quantity"));
highChildOrder.setTotalPrice(new BigDecimal(highChildOrder.getSaleCount().toString()).multiply(highChildOrder.getGoodsPrice()));
highChildOrder.setGiveawayType(false);
highChildOrder.setChildOrdeStatus(1);
highChildOrder.setPraiseStatus(0);
// 计算原始价格
highOrder.setTotalPrice(highChildOrder.getGoodsPrice().multiply(new BigDecimal(highChildOrder.getSaleCount().toString())));
}
} }
highOrderService.insertOrder(highOrder); highOrderService.insertOrder(highOrder);
return highOrder; return highOrder;

@ -0,0 +1,52 @@
package com.hai.service.pay.impl;
import com.hai.config.QianZhuConfig;
import com.hai.entity.HighChildOrder;
import com.hai.entity.HighOrder;
import com.hai.service.HighOrderService;
import com.hai.service.pay.PayService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.util.Date;
import java.util.Map;
/**
* @author hurui
* @version 1.0
* @ClassName MobileOrderServiceImpl
* @description: TODO
* @date 2021/7/24 15:51
*/
@Service("mobileOrderService")
public class MobileOrderServiceImpl implements PayService {
@Resource
private HighOrderService highOrderService;
@Override
public void paySuccess(Map<String, String> map, String payType) throws Exception {
if (payType.equals("Alipay")) {
return;
}
if (payType.equals("WechatPay")) {
HighOrder order = highOrderService.getOrderByOrderNo(map.get("out_trade_no"));
if (order != null && order.getOrderStatus() == 1) {
order.setPaySerialNo(map.get("transaction_id")); // 支付流水号
order.setPayRealPrice(new BigDecimal(map.get("total_fee")).divide(new BigDecimal("100"))); // 实付金额
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 childOrder : order.getHighChildOrderList()) {
childOrder.setChildOrdeStatus(2); // 子订单状态:1 待支付 2 已支付 3.已完成 4. 已退款 5.已取消
}
highOrderService.updateOrder(order);
// 支付给千猪
QianZhuConfig.payMobileOrder(order.getOrderNo());
}
}
}
}
Loading…
Cancel
Save