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.
334 lines
13 KiB
334 lines
13 KiB
package com.hai.openApi.config;
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
import com.hai.common.utils.HttpsUtils;
|
|
import com.hai.common.utils.RedisUtil;
|
|
import com.hai.config.CommonSysConst;
|
|
import org.slf4j.Logger;
|
|
import org.slf4j.LoggerFactory;
|
|
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;
|
|
|
|
private static Logger log = LoggerFactory.getLogger(BlxConfig.class);
|
|
|
|
/**
|
|
* @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");
|
|
log.info("============ 比邻星停车券业务-获取TOKEN-START =============");
|
|
JSONObject object = HttpsUtils.doGet(CommonSysConst.getSysConfig().getBlxPostUrl() + "/admin/api/generateJwt" , map);
|
|
log.info("请求参数: " + map);
|
|
log.info("响应参数: " + object);
|
|
log.info("============ 比邻星停车券业务-获取TOKEN-END ==============");
|
|
redisUtil.set("BlxToken" , object.getString("data") , 2000);
|
|
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() {
|
|
log.info("============ 比邻星停车券业务-获取比邻星停车券列表-START =============");
|
|
Map<String , Object > map = new HashMap<>();
|
|
map.put("rows" , "20");
|
|
map.put("currPage" , "1");
|
|
|
|
Map<String , Object> header = new HashMap<>();
|
|
header.put("token" , generateJw());
|
|
|
|
JSONObject object = HttpsUtils.doPost(CommonSysConst.getSysConfig().getBlxPostUrl() + "/admin/api/qureyCouponPage" , map , header);
|
|
log.info("头部参数: " + header);
|
|
log.info("请求参数: " + map);
|
|
log.info("响应参数: " + object);
|
|
log.info("============ 比邻星停车券业务-获取比邻星停车券列表-END ==============");
|
|
return object;
|
|
|
|
}
|
|
/**
|
|
* @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());
|
|
log.info("============ 比邻星停车券业务-发放停车券-START =============");
|
|
JSONObject data = HttpsUtils.doPost(CommonSysConst.getSysConfig().getBlxPostUrl() + "/admin/api/sendCupon" , map , header);
|
|
log.info("头部参数: " + header);
|
|
log.info("请求参数: " + map);
|
|
log.info("响应参数: " + data);
|
|
log.info("============ 比邻星停车券业务-发放停车券-END =============");
|
|
return data;
|
|
|
|
}
|
|
|
|
/**
|
|
* @Author Sum1Dream
|
|
* @Name queryCouponPage
|
|
* @Description // 获取比邻星停车券列表
|
|
* @Date 10:57 2023/7/11
|
|
* @Param []
|
|
* @Return com.alibaba.fastjson.JSONObject
|
|
*/
|
|
public JSONObject getUserCouponPage(JSONObject object) {
|
|
log.info("============ 比邻星停车券业务-获取用户未使用卡券列表-START =============");
|
|
Map<String , Object > map = new HashMap<>();
|
|
map.put("rows" , "2000");
|
|
map.put("currPage" , "1");
|
|
|
|
JSONObject jsonObject = new JSONObject();
|
|
|
|
jsonObject.put("userMobile" , object.getString("userMobile"));
|
|
jsonObject.put("couponStatus" , 1);
|
|
map.put("data" , jsonObject);
|
|
|
|
Map<String , Object> header = new HashMap<>();
|
|
header.put("token" , generateJw());
|
|
|
|
JSONObject data = HttpsUtils.doPost(CommonSysConst.getSysConfig().getBlxPostUrl() + "/admin/api/getUserCouponPage" , map , header);
|
|
log.info("头部参数: " + header);
|
|
log.info("请求参数: " + map);
|
|
log.info("响应参数: " + data);
|
|
log.info("============ 比邻星停车券业务-获取比邻星停车券列表-END ==============");
|
|
return data;
|
|
|
|
}
|
|
|
|
/**
|
|
* @Author Sum1Dream
|
|
* @Name getUserBindCarNo
|
|
* @Description // 获取用户绑定车辆信息
|
|
* @Date 10:11 2023/8/25
|
|
* @Param [object]
|
|
* @Return com.alibaba.fastjson.JSONObject
|
|
*/
|
|
public JSONObject getUserBindCarNo(JSONObject object) {
|
|
|
|
Map<String , Object > map = new HashMap<>();
|
|
map.put("userMobile" , object.getString("userMobile"));
|
|
map.put("organizeCode" , object.getString("organizeCode"));
|
|
|
|
Map<String , Object> header = new HashMap<>();
|
|
header.put("token" , generateJw());
|
|
log.info("============ 比邻星停车券业务-获取用户绑定车辆信息-START =============");
|
|
JSONObject data = HttpsUtils.doPost(CommonSysConst.getSysConfig().getBlxPostUrl() + "/peration/member/parking/api/getUserBindCarNo" , map , header);
|
|
log.info("头部参数: " + header);
|
|
log.info("请求参数: " + map);
|
|
log.info("响应参数: " + data);
|
|
log.info("============ 比邻星停车券业务-获取用户绑定车辆信息-END =============");
|
|
return data;
|
|
|
|
}
|
|
|
|
/**
|
|
* @Author Sum1Dream
|
|
* @Name addUserBindCarNo
|
|
* @Description // 用户绑定车辆
|
|
* @Date 10:11 2023/8/25
|
|
* @Param [object]
|
|
* @Return com.alibaba.fastjson.JSONObject
|
|
*/
|
|
public JSONObject addUserBindCarNo(JSONObject object) {
|
|
|
|
Map<String , Object > map = new HashMap<>();
|
|
map.put("userMobile" , object.getString("userMobile"));
|
|
map.put("organizeCode" , object.getString("organizeCode"));
|
|
map.put("plateNumber" , object.getString("plateNumber"));
|
|
// 车牌颜色- 0:未知,1:蓝色,2:黄色,3:黑色,4:白色,5:绿色
|
|
map.put("plateColor" , object.getString("plateColor"));
|
|
|
|
Map<String , Object> header = new HashMap<>();
|
|
header.put("token" , generateJw());
|
|
log.info("============ 比邻星停车券业务-用户绑定车辆-START =============");
|
|
JSONObject data = HttpsUtils.doPost(CommonSysConst.getSysConfig().getBlxPostUrl() + "/peration/member/parking/api/addUserBindCarNo" , map , header);
|
|
log.info("头部参数: " + header);
|
|
log.info("请求参数: " + map);
|
|
log.info("响应参数: " + data);
|
|
log.info("============ 比邻星停车券业务-用户绑定车辆-END =============");
|
|
return data;
|
|
|
|
}
|
|
|
|
/**
|
|
* @Author Sum1Dream
|
|
* @Name delUserBindCarNo
|
|
* @Description // 删除用户绑定车辆
|
|
* @Date 10:20 2023/8/25
|
|
* @Param [object]
|
|
* @Return com.alibaba.fastjson.JSONObject
|
|
*/
|
|
public JSONObject delUserBindCarNo(JSONObject object) {
|
|
|
|
Map<String , Object > map = new HashMap<>();
|
|
map.put("userMobile" , object.getString("userMobile"));
|
|
map.put("organizeCode" , object.getString("organizeCode"));
|
|
map.put("plateNumber" , object.getString("plateNumber"));
|
|
|
|
Map<String , Object> header = new HashMap<>();
|
|
header.put("token" , generateJw());
|
|
log.info("============ 比邻星停车券业务-删除用户绑定车辆-START =============");
|
|
JSONObject data = HttpsUtils.doPost(CommonSysConst.getSysConfig().getBlxPostUrl() + "/peration/member/parking/api/delUserBindCarNo" , map , header);
|
|
log.info("头部参数: " + header);
|
|
log.info("请求参数: " + map);
|
|
log.info("响应参数: " + data);
|
|
log.info("============ 比邻星停车券业务-删除用户绑定车辆-END =============");
|
|
return data;
|
|
|
|
}
|
|
|
|
/**
|
|
* @Author Sum1Dream
|
|
* @Name queryJsParking
|
|
* @Description // 获取附近停车场-捷顺
|
|
* @Date 10:26 2023/8/25
|
|
* @Param [object]
|
|
* @Return com.alibaba.fastjson.JSONObject
|
|
*/
|
|
public JSONObject queryJsParking(JSONObject object) {
|
|
|
|
Map<String , Object > map = new HashMap<>();
|
|
map.put("gps" , object.getString("gps"));
|
|
map.put("range" , object.getString("range"));
|
|
|
|
Map<String , Object> header = new HashMap<>();
|
|
header.put("token" , generateJw());
|
|
log.info("============ 比邻星停车券业务-获取附近停车场-捷顺-START =============");
|
|
JSONObject data = HttpsUtils.doPost(CommonSysConst.getSysConfig().getBlxPostUrl() + "/peration/member/parking/api/queryJsParking" , map , header);
|
|
log.info("头部参数: " + header);
|
|
log.info("请求参数: " + map);
|
|
log.info("响应参数: " + data);
|
|
log.info("============ 比邻星停车券业务-获取附近停车场-捷顺-END =============");
|
|
return data;
|
|
|
|
}
|
|
|
|
/**
|
|
* @Author Sum1Dream
|
|
* @Name queryJsOrderList
|
|
* @Description // 查询车牌订单列表信息
|
|
* @Date 11:42 2023/8/28
|
|
* @Param [object]
|
|
* @Return com.alibaba.fastjson.JSONObject
|
|
*/
|
|
public JSONObject queryJsOrderList(JSONObject object) {
|
|
|
|
Map<String , Object > map = new HashMap<>();
|
|
map.put("carNo" , object.getString("carNo"));
|
|
map.put("orderStatus" , object.getString("orderStatus"));
|
|
|
|
Map<String , Object> header = new HashMap<>();
|
|
header.put("token" , generateJw());
|
|
log.info("============ 比邻星停车券业务-查询车牌订单列表信息--捷顺-START =============");
|
|
JSONObject data = HttpsUtils.doPost(CommonSysConst.getSysConfig().getBlxPostUrl() + "/peration/member/parking/api/queryJsOrderList" , map , header);
|
|
log.info("头部参数: " + header);
|
|
log.info("请求参数: " + map);
|
|
log.info("响应参数: " + data);
|
|
System.out.println(header);
|
|
System.out.println(map);
|
|
log.info("============ 比邻星停车券业务-查询车牌订单列表信息--捷顺-END =============");
|
|
return data;
|
|
|
|
}
|
|
|
|
/**
|
|
* @Author Sum1Dream
|
|
* @Name creatOrder
|
|
* @Description // 停车添加订单
|
|
* @Date 10:12 2023/8/30
|
|
* @Param [object]
|
|
* @Return com.alibaba.fastjson.JSONObject
|
|
*/
|
|
public JSONObject creatOrder(JSONObject object) {
|
|
|
|
Map<String , Object > map = new HashMap<>();
|
|
map.put("organizeCode" , "dhy");
|
|
map.put("userMobile" , object.getString("userMobile"));
|
|
map.put("userCouponCode" , object.getString("userCouponCode"));
|
|
map.put("parkOrderId" , object.getString("parkOrderId"));
|
|
map.put("orderType" , object.getString("orderType"));
|
|
map.put("prePrice" , object.getString("prePrice"));
|
|
map.put("parkId" , object.getString("parkId"));
|
|
map.put("parkName" , object.getString("parkName"));
|
|
map.put("parkTime" , object.getString("parkTime"));
|
|
map.put("carSeatId" , object.getString("carSeatId"));
|
|
map.put("inTime" , object.getString("inTime"));
|
|
map.put("outTime" , object.getString("outTime"));
|
|
map.put("carNo" , object.getString("carNo"));
|
|
map.put("parkType" , 1);
|
|
|
|
Map<String , Object> header = new HashMap<>();
|
|
header.put("token" , generateJw());
|
|
log.info("============ 比邻星停车券业务-查询车牌订单列表信息--捷顺-START =============");
|
|
JSONObject data = HttpsUtils.doPost(CommonSysConst.getSysConfig().getBlxPostUrl() + "/peration/member/parking/api/creatOrder" , map , header);
|
|
log.info("头部参数: " + header);
|
|
log.info("请求参数: " + map);
|
|
log.info("响应参数: " + data);
|
|
log.info("============ 比邻星停车券业务-查询车牌订单列表信息--捷顺-END =============");
|
|
return data;
|
|
|
|
}
|
|
|
|
/**
|
|
* @Author Sum1Dream
|
|
* @Name parkOrderPay
|
|
* @Description // 订单支付
|
|
* @Date 14:49 2023/9/4
|
|
* @Param object
|
|
* @return com.alibaba.fastjson.JSONObject
|
|
*/
|
|
public JSONObject parkOrderPay(JSONObject object) {
|
|
|
|
Map<String , Object> header = new HashMap<>();
|
|
header.put("token" , generateJw());
|
|
header.put("orderCode" , object.getString("orderCode"));
|
|
log.info("============ 比邻星停车券业务-停车场订单支付--捷顺-START =============");
|
|
JSONObject data = HttpsUtils.doPost(CommonSysConst.getSysConfig().getBlxPostUrl() + "/peration/member/parking/api/parkOrderPay" , new HashMap<>() , header);
|
|
log.info("头部参数: " + header);
|
|
log.info("响应参数: " + data);
|
|
log.info("============ 比邻星停车券业务-停车场订单支付--捷顺-END =============");
|
|
return data;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|