嗨森逛服务
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
hai-server/hai-service/src/main/java/com/hai/config/RechargeConfig.java

146 lines
5.5 KiB

package com.hai.config;
import com.alibaba.fastjson.JSONObject;
import com.hai.common.pay.util.sdk.WXPayConstants;
import com.hai.common.utils.HttpsUtils;
import com.hai.common.utils.MD5Util;
import com.hai.common.utils.WxUtils;
import com.hai.entity.OutRechargeChildOrder;
import com.hai.entity.OutRechargeOrder;
import com.hai.entity.OutRechargePrice;
import com.hai.service.OutRechargeChildOrderService;
import com.hai.service.OutRechargeOrderService;
import com.hai.service.OutRechargePriceService;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.RequestBody;
import javax.annotation.Resource;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @ClassName TelConfig
* @Author Sum1Dream
* @Version 1.0.0
* @Description // 充值接口
* @Date 2021/7/18 14:18
**/
@Component
public class RechargeConfig {
/**
* @Author Sum1Dream
* @name getProductsList.java
* @Description // 获取龙阅产品
* @Date 10:03 2022/5/24
* @Param []
* @return com.alibaba.fastjson.JSONObject
*/
public static JSONObject getProductsListByLy() throws Exception {
Map<String,Object> paramMap = new HashMap<>();
paramMap.put("userid" , CommonSysConst.getSysConfig().getLyMemberId());
paramMap.put("sign", WxUtils.generateSignatureLy(paramMap , CommonSysConst.getSysConfig().getLyApiKey() , WXPayConstants.SignType.MD5));
return HttpsUtils.doPost(CommonSysConst.getSysConfig().getLyPostUrl()+ "index/product", paramMap);
}
/**
* @Author Sum1Dream
* @name rechargeOrderByLy.java
* @Description // 龙阅订单充值
* @Date 09:57 2022/5/25
* @Param [com.alibaba.fastjson.JSONObject]
* @return com.alibaba.fastjson.JSONObject
*/
public static JSONObject rechargeOrderByLy(JSONObject object) throws Exception {
Map<String,Object> paramMap = new HashMap<>();
paramMap.put("out_trade_num" , object.getString("out_trade_num"));
paramMap.put("product_id" , object.getString("product_id"));
paramMap.put("mobile" , object.getString("mobile"));
paramMap.put("notify_url" , object.getString("notifyUrl"));
paramMap.put("userid" , CommonSysConst.getSysConfig().getLyMemberId());
paramMap.put("sign", WxUtils.generateSignatureLy(paramMap , CommonSysConst.getSysConfig().getLyApiKey() , WXPayConstants.SignType.MD5));
return HttpsUtils.doPost(CommonSysConst.getSysConfig().getLyPostUrl()+ "index/recharge", paramMap);
}
/**
* @Author Sum1Dream
* @name checkOrderByLy.java
* @Description // 龙阅查询订单结果
* @Date 14:05 2022/5/24
* @Param [com.alibaba.fastjson.JSONObject]
* @return com.alibaba.fastjson.JSONObject
*/
public static JSONObject checkOrderByLy(JSONObject object) throws Exception {
Map<String,Object> paramMap = new HashMap<>();
paramMap.put("userid" , CommonSysConst.getSysConfig().getLyMemberId());
paramMap.put("out_trade_nums" , object.getString("out_trade_nums"));
paramMap.put("sign", WxUtils.generateSignatureLy(paramMap , CommonSysConst.getSysConfig().getLyApiKey() , WXPayConstants.SignType.MD5));
return HttpsUtils.doPost(CommonSysConst.getSysConfig().getLyPostUrl()+ "index/check", paramMap);
}
/**
* @Author Sum1Dream
* @name rechargeOrderByJj.java
* @Description // 尖椒订单充值
* @Date 09:57 2022/5/25
* @Param [com.alibaba.fastjson.JSONObject]
* @return com.alibaba.fastjson.JSONObject
*/
public static JSONObject rechargeOrderByJj(JSONObject object) throws Exception {
String timestamp = String.valueOf(System.currentTimeMillis());
Map<String , Object> map = new HashMap<>();
map.put("mobile" , object.getString("mobile"));
map.put("amount" , object.getString("amount"));
map.put("out_order_id" , object.getString("out_order_id"));
map.put("app_key" , CommonSysConst.getSysConfig().getJjAppKey());
map.put("timestamp" , timestamp.substring(0,timestamp.length()-3));
map.put("is_fast" , object.getString("is_fast"));
map.put("notify_url" , object.getString("notifyUrl"));
String signStr = WxUtils.generateSignatureAppSecret(map, CommonSysConst.getSysConfig().getJjAppSecret() , WXPayConstants.SignType.MD5);
map.put("sign" , signStr);
return HttpsUtils.doPost(CommonSysConst.getSysConfig().getJjUrl() + "createOrder" , map);
}
/**
* @Author Sum1Dream
* @name checkOrderByJj.java
* @Description // 尖椒查询订单详情
* @Date 09:57 2022/5/25
* @Param [com.alibaba.fastjson.JSONObject]
* @return com.alibaba.fastjson.JSONObject
*/
public static JSONObject checkOrderByJj(JSONObject object) throws Exception {
String timestamp = String.valueOf(System.currentTimeMillis());
Map<String , Object> map = new HashMap<>();
map.put("out_order_id" , object.getString("out_order_id"));
map.put("app_key" , CommonSysConst.getSysConfig().getJjAppKey());
map.put("timestamp" , timestamp.substring(0,timestamp.length()-3));
map.put("notify_url" , CommonSysConst.getSysConfig().getLyNotifyUrl());
String signStr = WxUtils.generateSignatureAppSecret(map, CommonSysConst.getSysConfig().getJjAppSecret() , WXPayConstants.SignType.MD5);
map.put("sign" , signStr);
return HttpsUtils.doPost(CommonSysConst.getSysConfig().getJjUrl() + "queryOrder" , map);
}
}