|
|
|
@ -67,36 +67,37 @@ public class TourRunServiceImpl |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public PageUtils list(DevicePR pr) { |
|
|
|
|
String token = token(); |
|
|
|
|
|
|
|
|
|
Map<String, String> paramMap = paramMap(Method.LIST.getCode()); |
|
|
|
|
|
|
|
|
|
// 私有参数
|
|
|
|
|
paramMap.put("access_token", token); |
|
|
|
|
paramMap.put("target", properties.getTourRunAccount()); |
|
|
|
|
// 计算签名
|
|
|
|
|
String sign = ""; |
|
|
|
|
try { |
|
|
|
|
sign = SignUtils.signTopRequest(paramMap, properties.getAppSecret(), Constant.MD5); |
|
|
|
|
paramMap.put("sign", sign); |
|
|
|
|
} catch (IOException e) { |
|
|
|
|
e.printStackTrace(); |
|
|
|
|
} |
|
|
|
|
//调用com/zilber/boot/module/vehicle/util/http/HttpUtils方法
|
|
|
|
|
JSONObject jsonObject = sendPost(properties.getOpenapiUrl(), headerMap(), paramMap); |
|
|
|
|
//初始化列表
|
|
|
|
|
// List<JSONObject> resultList = null;
|
|
|
|
|
// if ( jsonObject != null) {
|
|
|
|
|
// if ( !jsonObject.get("code").toString().equals("0"))
|
|
|
|
|
// {
|
|
|
|
|
// throw new ServiceException(jsonObject.get("message").toString());
|
|
|
|
|
// }
|
|
|
|
|
// resultList = jsonObject.getList("result", JSONObject.class);
|
|
|
|
|
// }
|
|
|
|
|
// else {
|
|
|
|
|
// throw new ServiceException("列表获取失败");
|
|
|
|
|
// String token = token();
|
|
|
|
|
//
|
|
|
|
|
// Map<String, String> paramMap = paramMap(Method.LIST.getCode());
|
|
|
|
|
//
|
|
|
|
|
// // 私有参数
|
|
|
|
|
// paramMap.put("access_token", token);
|
|
|
|
|
// paramMap.put("target", properties.getTourRunAccount());
|
|
|
|
|
// // 计算签名
|
|
|
|
|
// String sign = "";
|
|
|
|
|
// try {
|
|
|
|
|
// sign = SignUtils.signTopRequest(paramMap, properties.getAppSecret(), Constant.MD5);
|
|
|
|
|
// paramMap.put("sign", sign);
|
|
|
|
|
// } catch (IOException e) {
|
|
|
|
|
// e.printStackTrace();
|
|
|
|
|
// }
|
|
|
|
|
List<JSONObject> resultList = handleResult(jsonObject, JSONObject.class, "获取列表失败"); |
|
|
|
|
// //调用com/zilber/boot/module/vehicle/util/http/HttpUtils方法
|
|
|
|
|
// JSONObject jsonObject = sendPost(properties.getOpenapiUrl(), headerMap(), paramMap);
|
|
|
|
|
// //初始化列表
|
|
|
|
|
//// List<JSONObject> resultList = null;
|
|
|
|
|
//// if ( jsonObject != null) {
|
|
|
|
|
//// if ( !jsonObject.get("code").toString().equals("0"))
|
|
|
|
|
//// {
|
|
|
|
|
//// throw new ServiceException(jsonObject.get("message").toString());
|
|
|
|
|
//// }
|
|
|
|
|
//// resultList = jsonObject.getList("result", JSONObject.class);
|
|
|
|
|
//// }
|
|
|
|
|
//// else {
|
|
|
|
|
//// throw new ServiceException("列表获取失败");
|
|
|
|
|
//// }
|
|
|
|
|
// List<JSONObject> resultList = handleResult(jsonObject, JSONObject.class, "获取列表失败");
|
|
|
|
|
List<JSONObject> resultList = resultList(); |
|
|
|
|
if (CollectionUtils.isNotEmpty(resultList)) |
|
|
|
|
{ |
|
|
|
|
List<JSONObject> handledList = resultList.stream() |
|
|
|
@ -116,6 +117,31 @@ public class TourRunServiceImpl |
|
|
|
|
return new PageUtils(new ArrayList<>(), 0, pr.getPageSize(), pr.getPageNo()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public Map<String, Integer> stat() { |
|
|
|
|
Map<String, Integer> resultMap = new HashMap<>(Constant.SCOPES.size()); |
|
|
|
|
List<JSONObject> resultList = resultList(); |
|
|
|
|
if (CollectionUtils.isNotEmpty(resultList)) { |
|
|
|
|
Map<String, List<JSONObject>> scopeMap |
|
|
|
|
= resultList.stream() |
|
|
|
|
.collect(Collectors.groupingBy(jo -> jo.get("mcTypeUseScope").toString())); |
|
|
|
|
for ( String scope: Constant.SCOPES) { |
|
|
|
|
List<JSONObject> jsonObjects = scopeMap.get(scope); |
|
|
|
|
if ( CollectionUtils.isNotEmpty(jsonObjects)) { |
|
|
|
|
resultMap.put(scope, jsonObjects.size()); |
|
|
|
|
} |
|
|
|
|
else { |
|
|
|
|
resultMap.put(scope, 0); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
return resultMap; |
|
|
|
|
} |
|
|
|
|
for ( String scope: Constant.SCOPES) { |
|
|
|
|
resultMap.put(scope, 0); |
|
|
|
|
} |
|
|
|
|
return resultMap; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//https://openh5.aichezaixian.com/?token=XXX&imei=AAA&appKey=BBB&activeTab=CCC
|
|
|
|
|
@Override |
|
|
|
|
public String h5(String tabType, String imei) { |
|
|
|
@ -175,6 +201,39 @@ public class TourRunServiceImpl |
|
|
|
|
return formatter.format(new Date()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private List<JSONObject> resultList() { |
|
|
|
|
String token = token(); |
|
|
|
|
|
|
|
|
|
Map<String, String> paramMap = paramMap(Method.LIST.getCode()); |
|
|
|
|
|
|
|
|
|
// 私有参数
|
|
|
|
|
paramMap.put("access_token", token); |
|
|
|
|
paramMap.put("target", properties.getTourRunAccount()); |
|
|
|
|
// 计算签名
|
|
|
|
|
String sign = ""; |
|
|
|
|
try { |
|
|
|
|
sign = SignUtils.signTopRequest(paramMap, properties.getAppSecret(), Constant.MD5); |
|
|
|
|
paramMap.put("sign", sign); |
|
|
|
|
} catch (IOException e) { |
|
|
|
|
e.printStackTrace(); |
|
|
|
|
} |
|
|
|
|
//调用com/zilber/boot/module/vehicle/util/http/HttpUtils方法
|
|
|
|
|
JSONObject jsonObject = sendPost(properties.getOpenapiUrl(), headerMap(), paramMap); |
|
|
|
|
//初始化列表
|
|
|
|
|
// List<JSONObject> resultList = null;
|
|
|
|
|
// if ( jsonObject != null) {
|
|
|
|
|
// if ( !jsonObject.get("code").toString().equals("0"))
|
|
|
|
|
// {
|
|
|
|
|
// throw new ServiceException(jsonObject.get("message").toString());
|
|
|
|
|
// }
|
|
|
|
|
// resultList = jsonObject.getList("result", JSONObject.class);
|
|
|
|
|
// }
|
|
|
|
|
// else {
|
|
|
|
|
// throw new ServiceException("列表获取失败");
|
|
|
|
|
// }
|
|
|
|
|
return handleResult(jsonObject, JSONObject.class, "获取列表失败"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 构造并初始化部分参数的请求头map |
|
|
|
|
* @return map |
|
|
|
|