嗨森逛服务
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/openApi/config/BlxConfig.java

83 lines
2.3 KiB

package com.hai.openApi.config;
import com.alibaba.fastjson.JSONObject;
import com.hai.common.utils.HttpsUtils;
import com.hai.common.utils.RedisUtil;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import java.util.HashMap;
import java.util.Map;
@Component
public class BlxConfig {
@Resource
private RedisUtil redisUtil;
/**
* @Author Sum1Dream
* @Name generateJw
* @Description // 获取token
* @Date 10:42 2023/7/11
* @Param []
* @Return java.lang.String
*/
public String generateJw() {
Object token = redisUtil.get("BlxToken");
if (token == null) {
Map<String , Object > map = new HashMap<>();
map.put("organizeCode" , "dhy");
JSONObject object = HttpsUtils.doGet("https://vertical-formats-gateway.blx.bodata.cn:18443/admin/api/generateJwt" , map);
return object.getString("data");
}
return token.toString();
}
/**
* @Author Sum1Dream
* @Name queryCouponPage
* @Description // 获取比邻星停车券列表
* @Date 10:57 2023/7/11
* @Param []
* @Return com.alibaba.fastjson.JSONObject
*/
public JSONObject queryCouponPage() {
Map<String , Object > map = new HashMap<>();
map.put("rows" , "20");
map.put("currPage" , "1");
Map<String , Object> header = new HashMap<>();
header.put("token" , generateJw());
return HttpsUtils.doPost("https://vertical-formats-gateway.blx.bodata.cn:18443/admin/api/qureyCouponPage" , map , header);
}
/**
* @Author Sum1Dream
* @Name sendCoupon
* @Description // 发放券
* @Date 11:01 2023/7/11
* @Param [object]
* @Return com.alibaba.fastjson.JSONObject
*/
public JSONObject sendCoupon(JSONObject object) {
Map<String , Object > map = new HashMap<>();
map.put("couponCode" , object.getString("couponCode"));
map.put("receiverPhone" , object.getString("receiverPhone"));
map.put("receiverCount" , object.getInteger("receiverCount"));
Map<String , Object> header = new HashMap<>();
header.put("token" , generateJw());
return HttpsUtils.doPost("https://vertical-formats-gateway.blx.bodata.cn:18443/admin/api/qureyCouponPage" , map , header);
}
}