Merge branch 'new-dev' into 2.0-dev

# Conflicts:
#	hai-service/src/main/java/com/hai/openApi/service/impl/ApiOrderCreateHandleServiceImpl.java
#	hai-service/src/main/java/com/hai/openApi/service/impl/ApiOrderServiceImpl.java
master
袁野 10 months ago
parent 3faaca057a
commit 37f768ac18
  1. 1
      hai-bweb/src/main/java/com/bweb/config/AuthConfig.java
  2. 2
      hai-bweb/src/main/java/com/bweb/controller/ApiProductController.java
  3. 2
      hai-bweb/src/main/java/com/bweb/controller/HighTestController.java
  4. 2
      hai-order/src/main/java/com/web/controller/OrderPayController.java
  5. 5
      hai-service/src/main/java/com/hai/common/utils/WxUtils.java
  6. 30
      hai-service/src/main/java/com/hai/config/RechargeConfig.java
  7. 6
      hai-service/src/main/java/com/hai/config/WxOrderConfig.java
  8. 2
      hai-service/src/main/java/com/hai/entity/OutRechargeChildOrder.java
  9. 2
      hai-service/src/main/java/com/hai/order/service/impl/OrderCreateHandleServiceImpl.java
  10. 40
      hai-service/src/main/java/com/hai/service/impl/OutRechargeOrderServiceImpl.java

@ -98,6 +98,7 @@ public class AuthConfig implements WebMvcConfigurer {
.excludePathPatterns("/highGoldRec/*") .excludePathPatterns("/highGoldRec/*")
.excludePathPatterns("/openApi/*") .excludePathPatterns("/openApi/*")
.excludePathPatterns("/test/*") .excludePathPatterns("/test/*")
.excludePathPatterns("/apiProduct/*")
; ;
} }

@ -359,7 +359,7 @@ public class ApiProductController {
JSONObject goodsOption = jsonArray.getJSONObject(j); JSONObject goodsOption = jsonArray.getJSONObject(j);
JSONArray childArray = goodsOption.getJSONArray("child"); JSONArray childArray = goodsOption.getJSONArray("child");
for (int t = 0; t < childArray.size(); t++) { for (int t = 0; t < childArray.size(); t++) {
JSONObject child = childArray.getJSONObject(j); JSONObject child = childArray.getJSONObject(t);
JSONObject data = new JSONObject(); JSONObject data = new JSONObject();
data.put("title" , jsonObject.getString("sort_title") + goodsOption.getString("name")); data.put("title" , jsonObject.getString("sort_title") + goodsOption.getString("name"));
data.put("goodsId" , child.getString("goods_id")); data.put("goodsId" , child.getString("goods_id"));

File diff suppressed because one or more lines are too long

@ -349,7 +349,7 @@ public class OrderPayController {
weChatPayReqInfo.setSub_mch_id(WxOrderConfig.MCH_ID_1665668540); weChatPayReqInfo.setSub_mch_id(WxOrderConfig.MCH_ID_1665668540);
} else if (order.getProductType().equals(OrderProductType.PRODUCT_TYPE9.getNumber())) { } else if (order.getProductType().equals(OrderProductType.PRODUCT_TYPE9.getNumber())) {
weChatPayReqInfo.setSub_mch_id(WxOrderConfig.MCH_ID_1614670195); weChatPayReqInfo.setSub_mch_id(WxOrderConfig.MCH_ID_1667177808);
} else if (order.getProductType().equals(OrderProductType.PRODUCT_TYPE12.getNumber())) { } else if (order.getProductType().equals(OrderProductType.PRODUCT_TYPE12.getNumber())) {
weChatPayReqInfo.setSub_mch_id(WxOrderConfig.MCH_ID_1614670195); weChatPayReqInfo.setSub_mch_id(WxOrderConfig.MCH_ID_1614670195);

@ -3,6 +3,7 @@ package com.hai.common.utils;
import com.google.common.collect.Maps; import com.google.common.collect.Maps;
import com.hai.common.pay.util.sdk.WXPayConstants; import com.hai.common.pay.util.sdk.WXPayConstants;
import com.hai.common.pay.util.sdk.WXPayXmlUtil; import com.hai.common.pay.util.sdk.WXPayXmlUtil;
import com.hai.config.CommonSysConst;
import com.thoughtworks.xstream.XStream; import com.thoughtworks.xstream.XStream;
import com.thoughtworks.xstream.io.naming.NoNameCoder; import com.thoughtworks.xstream.io.naming.NoNameCoder;
import com.thoughtworks.xstream.io.xml.XppDriver; import com.thoughtworks.xstream.io.xml.XppDriver;
@ -535,6 +536,7 @@ public class WxUtils {
} }
public static String generateSignApi(final Map<String, Object> data, String key, WXPayConstants.SignType signType , Boolean isUpperCase) throws Exception { public static String generateSignApi(final Map<String, Object> data, String key, WXPayConstants.SignType signType , Boolean isUpperCase) throws Exception {
Set<String> keySet = data.keySet(); Set<String> keySet = data.keySet();
String[] keyArray = keySet.toArray(new String[keySet.size()]); String[] keyArray = keySet.toArray(new String[keySet.size()]);
Arrays.sort(keyArray); Arrays.sort(keyArray);
@ -543,9 +545,6 @@ public class WxUtils {
if (k.equals(WXPayConstants.FIELD_SIGN) || k.equals("app_secret")) { if (k.equals(WXPayConstants.FIELD_SIGN) || k.equals("app_secret")) {
continue; continue;
} }
if (k.equals("notify_url")) {
k = URLEncoder.encode(k, "UTF-8");
}
if (data.get(k) != null) // 参数值为空,则不参与签名 if (data.get(k) != null) // 参数值为空,则不参与签名
{ {
sb.append(k).append("=").append(data.get(k)).append("&"); sb.append(k).append("=").append(data.get(k)).append("&");

@ -16,6 +16,7 @@ import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.net.URLEncoder;
import java.util.*; import java.util.*;
/** /**
@ -264,20 +265,33 @@ public class RechargeConfig {
* @Param object * @Param object
* @return com.alibaba.fastjson.JSONObject * @return com.alibaba.fastjson.JSONObject
*/ */
public static JSONObject rechargeOrderByJn(JSONObject object) throws Exception{ public static JSONObject rechargeOrderByJn(JSONObject object){
try {
log.info("发起简牛下单表"); log.info("发起简牛下单表");
Map<String,Object> paramMap = new HashMap<>(); Map<String,Object> paramMap = new HashMap<>();
paramMap.put("appid" , CommonSysConst.getSysConfig().getJnApiKey()); paramMap.put("appid" , CommonSysConst.getSysConfig().getJnApiKey());
paramMap.put("account" , object.getBigDecimal("price")); paramMap.put("account" , object.getString("phone"));
paramMap.put("goods_id" , object.getBigDecimal("goodsId")); paramMap.put("option_id" , object.getString("option_id"));
paramMap.put("order_no" , object.getBigDecimal("orderNo")); paramMap.put("order_no" , object.getString("orderNo"));
paramMap.put("option_id" , object.getBigDecimal("optionId")); paramMap.put("goods_id" , "136");
paramMap.put("notify_url" , CommonSysConst.getSysConfig().getJnNotifyUrl()); paramMap.put("notify_url" , URLEncoder.encode(CommonSysConst.getSysConfig().getJnNotifyUrl(), "UTF-8"));
paramMap.put("sign", WxUtils.generateSignApi(paramMap , CommonSysConst.getSysConfig().getJnAppSecret() , WXPayConstants.SignType.MD5 , false));
Map<String,Object> paramMaps = new HashMap<>();
paramMaps.put("appid" , CommonSysConst.getSysConfig().getJnApiKey());
paramMaps.put("account" , object.getString("phone"));
paramMaps.put("option_id" , object.getString("option_id"));
paramMaps.put("order_no" , object.getString("orderNo"));
paramMaps.put("goods_id" , "136");
paramMaps.put("notify_url" , CommonSysConst.getSysConfig().getJnNotifyUrl());
paramMaps.put("sign", WxUtils.generateSignApi(paramMap , CommonSysConst.getSysConfig().getJnAppSecret() , WXPayConstants.SignType.MD5 , false));
log.info("发起简牛下单-请求参数: " + JSON.toJSONString(paramMap)); log.info("发起简牛下单-请求参数: " + JSON.toJSONString(paramMap));
JSONObject jsonObject = HttpsUtils.doPost(CommonSysConst.getSysConfig().getJnPostUrl()+ "/modules/api/open/order-create", paramMap , new HashMap<>()); JSONObject jsonObject = HttpsUtils.doPost(CommonSysConst.getSysConfig().getJnPostUrl()+ "/modules/api/open/order-create", paramMaps , new HashMap<>());
log.info("发起简牛下单-响应参数: " + jsonObject.toJSONString()); log.info("发起简牛下单-响应参数: " + jsonObject.toJSONString());
return jsonObject; return jsonObject;
}catch (Exception e) {
return null;
}
} }
/** /**

@ -50,6 +50,12 @@ public class WxOrderConfig {
*/ */
public static final String MCH_ID_1609882817 = "1609882817"; public static final String MCH_ID_1609882817 = "1609882817";
/**
* 微信支付商户号
* 青岛简牛网络科技有限公司
*/
public static final String MCH_ID_1667177808 = "1667177808";
/** /**
* 微信支付商户号 * 微信支付商户号
* 惠兑礼品 (重庆) 有限公司 * 惠兑礼品 (重庆) 有限公司

@ -29,7 +29,7 @@ public class OutRechargeChildOrder implements Serializable {
private String orderNo; private String orderNo;
/** /**
* 1:尖椒 2龙阅 3畅停 * 1:尖椒 2龙阅 4畅停 5简牛
*/ */
private Integer rechargePlatform; private Integer rechargePlatform;

@ -1284,7 +1284,7 @@ public class OrderCreateHandleServiceImpl implements OrderCreateHandleService {
childOrder.setGoodsId(apiCoupon.getId()); childOrder.setGoodsId(apiCoupon.getId());
childOrder.setGoodsName(apiCoupon.getName()); childOrder.setGoodsName(apiCoupon.getName());
childOrder.setGoodsSpecName(apiCoupon.getCode()); childOrder.setGoodsSpecName(apiCoupon.getCode());
childOrder.setGoodsPrice(new BigDecimal(apiCoupon.getPrice()/100)); childOrder.setGoodsPrice(new BigDecimal(apiCoupon.getPrice()));
childOrder.setGoodsActualPrice(createOrderChildModel.getPrice()); childOrder.setGoodsActualPrice(createOrderChildModel.getPrice());
childOrder.setSaleCount(createOrderChildModel.getSaleCount()); childOrder.setSaleCount(createOrderChildModel.getSaleCount());
childOrder.setGiveawayType(false); childOrder.setGiveawayType(false);

@ -636,6 +636,25 @@ public class OutRechargeOrderServiceImpl implements OutRechargeOrderService {
childOrder.setExt2("畅停请求参数" + object.toJSONString()); childOrder.setExt2("畅停请求参数" + object.toJSONString());
childOrder.setExt3("畅停充值" + returnObject.toJSONString()); childOrder.setExt3("畅停充值" + returnObject.toJSONString());
} }
// 简牛充值
if (object.getInteger("rechargePlatform") == 5) {
if (object.getString("code") == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, "");
}
object.put("orderNo", childOrder.getOrderNo());
object.put("option_id", object.getString("code"));
object.put("phone", object.getString("rechargeMobile"));
JSONObject returnObject = RechargeConfig.rechargeOrderByJn(object);
childOrder.setRechargePlatform(5);
childOrder.setExt1("简牛充值" + returnObject.toJSONString());
childOrder.setExt2("简牛请求参数" + object.toJSONString());
childOrder.setExt3("简牛充值" + returnObject.toJSONString());
}
childOrder.setUpdateTime(new Date()); childOrder.setUpdateTime(new Date());
outRechargeChildOrderService.updateOrder(childOrder); outRechargeChildOrderService.updateOrder(childOrder);
} }
@ -767,6 +786,27 @@ public class OutRechargeOrderServiceImpl implements OutRechargeOrderService {
} }
} }
// 简牛
if (childOrder.getRechargePlatform() == 5) {
object.put("orderNo" , childOrder.getOrderNo());
JSONObject jsonObject = RechargeConfig.checkOrderByJn(object);
childOrder.setExt3("畅停查询"+ jsonObject);
if (jsonObject.getJSONObject("data") != null) {
JSONObject objectData= jsonObject.getJSONObject("data");
// // 10充值中 20充值完成 -10 充值失败
// -1取消,0充值中 ,1充值成功,2充值失败,3部分成功
if (objectData.getInteger("status") == 10) {
status = 0;
} else if (objectData.getInteger("status") == 20) {
status = 1;
} else if (objectData.getInteger("status") == -10) {
status = 2;
}
}
}
if (status == 1) { if (status == 1) {
childOrder.setStatus(101); childOrder.setStatus(101);
} }

Loading…
Cancel
Save