|
@@ -1,14 +1,10 @@
|
|
package com.yh.saas.plugin.yiliangyiyun.controller;
|
|
package com.yh.saas.plugin.yiliangyiyun.controller;
|
|
|
|
|
|
|
|
|
|
-import cn.hutool.cache.CacheUtil;
|
|
|
|
-import cn.hutool.cache.impl.TimedCache;
|
|
|
|
-import cn.hutool.core.util.IdUtil;
|
|
|
|
-import cn.hutool.core.util.ObjectUtil;
|
|
|
|
-import cn.hutool.extra.qrcode.QrCodeUtil;
|
|
|
|
-import cn.hutool.extra.qrcode.QrConfig;
|
|
|
|
import com.alibaba.fastjson.JSON;
|
|
import com.alibaba.fastjson.JSON;
|
|
|
|
+import com.baomidou.mybatisplus.mapper.EntityWrapper;
|
|
import com.baomidou.mybatisplus.plugins.Page;
|
|
import com.baomidou.mybatisplus.plugins.Page;
|
|
|
|
+import com.openapi.sdk.service.DataExchangeService;
|
|
import com.winsea.svc.base.base.entity.CommonCompany;
|
|
import com.winsea.svc.base.base.entity.CommonCompany;
|
|
import com.winsea.svc.base.base.entity.CommonStaff;
|
|
import com.winsea.svc.base.base.entity.CommonStaff;
|
|
import com.winsea.svc.base.base.entity.CommonStaffRole;
|
|
import com.winsea.svc.base.base.entity.CommonStaffRole;
|
|
@@ -25,13 +21,11 @@ import com.winsea.svc.notice.entity.NoticeTaskInfo;
|
|
import com.yh.saas.common.support.util.IdGenerator;
|
|
import com.yh.saas.common.support.util.IdGenerator;
|
|
import com.yh.saas.common.support.util.StringUtils;
|
|
import com.yh.saas.common.support.util.StringUtils;
|
|
import com.yh.saas.plugin.yiliangyiyun.constant.ImageCensorConsts;
|
|
import com.yh.saas.plugin.yiliangyiyun.constant.ImageCensorConsts;
|
|
-import com.yh.saas.plugin.yiliangyiyun.entity.AjaxResult;
|
|
|
|
-import com.yh.saas.plugin.yiliangyiyun.entity.CommonUser;
|
|
|
|
-import com.yh.saas.plugin.yiliangyiyun.entity.SessionPojo;
|
|
|
|
-import com.yh.saas.plugin.yiliangyiyun.entity.UnimallMessage;
|
|
|
|
|
|
+import com.yh.saas.plugin.yiliangyiyun.entity.*;
|
|
import com.yh.saas.plugin.yiliangyiyun.entity.view.UserDefinedBean;
|
|
import com.yh.saas.plugin.yiliangyiyun.entity.view.UserDefinedBean;
|
|
import com.yh.saas.plugin.yiliangyiyun.exception.ServiceException;
|
|
import com.yh.saas.plugin.yiliangyiyun.exception.ServiceException;
|
|
import com.yh.saas.plugin.yiliangyiyun.service.ICommonUserService;
|
|
import com.yh.saas.plugin.yiliangyiyun.service.ICommonUserService;
|
|
|
|
+import com.yh.saas.plugin.yiliangyiyun.service.IHyTokenService;
|
|
import com.yh.saas.plugin.yiliangyiyun.util.*;
|
|
import com.yh.saas.plugin.yiliangyiyun.util.*;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
@@ -48,8 +42,6 @@ import com.google.gson.Gson;
|
|
import java.util.*;
|
|
import java.util.*;
|
|
|
|
|
|
import com.aliyuncs.sts.model.v20150401.*;
|
|
import com.aliyuncs.sts.model.v20150401.*;
|
|
-import org.springframework.web.server.ServerWebExchange;
|
|
|
|
-import reactor.core.publisher.Mono;
|
|
|
|
|
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
import javax.servlet.http.HttpServletRequest;
|
|
import java.net.URLEncoder;
|
|
import java.net.URLEncoder;
|
|
@@ -87,6 +79,8 @@ public class CommonUserController {
|
|
private ICommonCompanyService companyService;
|
|
private ICommonCompanyService companyService;
|
|
@Autowired
|
|
@Autowired
|
|
private WebSocket webSocket;
|
|
private WebSocket webSocket;
|
|
|
|
+ @Autowired
|
|
|
|
+ private IHyTokenService hyToken;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -397,5 +391,60 @@ public class CommonUserController {
|
|
messageDO.setPath("XXXXX");
|
|
messageDO.setPath("XXXXX");
|
|
webSocket.sendOneMessage(messageDO);
|
|
webSocket.sendOneMessage(messageDO);
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ public void login() {
|
|
|
|
+ try {
|
|
|
|
+ Map<String, String> map = new HashMap<String, String>(4);
|
|
|
|
+ map.put("user", "e8a253b1-12ee-46a4-aebe-58b55df34301");
|
|
|
|
+ map.put("pwd", "o1v78Rwje3U297j0owa7F2591174d5");
|
|
|
|
+ map.put("srt", "dfd28720-6c40-4029-8f3f-88e7e0ceec74");
|
|
|
|
+ map.put("cid", "26f33235-dff0-43d6-871b-9d1682996c12");
|
|
|
|
+ String url = "https://openapi-test.sinoiov.cn/save/apis/login";
|
|
|
|
+ // 设置 http 读写超时
|
|
|
|
+ DataExchangeService des = new DataExchangeService(5000, 8000);
|
|
|
|
+ System.out.println("请求地址:"+url);
|
|
|
|
+ // 通过 https 方式调用,此方法内部会使用私钥生成签名参数 sign,私钥不会发送
|
|
|
|
+ String res = des.postHttps(url, map);
|
|
|
|
+ HyToken token = new HyToken();
|
|
|
|
+ token.setId(IdGenerator.generateUUID());
|
|
|
|
+ token.setToken(res);
|
|
|
|
+ hyToken.insert(token);
|
|
|
|
+ System.out.println("返回:"+ res);
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
+ System.out.println("e:" + e.getMessage());
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ @PostMapping("/orderPath")
|
|
|
|
+ public void orderPath() throws Exception {
|
|
|
|
+ HyToken token = hyToken.selectOne(new EntityWrapper<HyToken>()
|
|
|
|
+ .eq("delete_flag",0));
|
|
|
|
+ if(token == null){
|
|
|
|
+ login();
|
|
|
|
+ token = hyToken.selectOne(new EntityWrapper<HyToken>()
|
|
|
|
+ .eq("delete_flag",0));
|
|
|
|
+ }
|
|
|
|
+ Map<String, String> map = new HashMap<String, String>(4);
|
|
|
|
+ map.put("token", token.getToken());
|
|
|
|
+ map.put("cid", "26f33235-dff0-43d6-871b-9d1682996c12");
|
|
|
|
+ map.put("srt", "dfd28720-6c40-4029-8f3f-88e7e0ceec74");
|
|
|
|
+ map.put("vclN", "陕 YH0009");
|
|
|
|
+ map.put("vco", "2");
|
|
|
|
+ map.put("qryBtm", "2021-09-05 15:56:46");
|
|
|
|
+ map.put("qryEtm", "2021-09-06 15:56:46");
|
|
|
|
+ map.put("startLonlat", " 116.31795,30.4252");
|
|
|
|
+ map.put("endLonlat", "110.9946817,25.9089816");
|
|
|
|
+ map.put("startAreaCode", "431102");
|
|
|
|
+ map.put("endAreaCode", "450324");
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ String url = "https://openapi-test.sinoiov.cn/save/apis/routerPath";
|
|
|
|
+ // 设置 http 读写超时
|
|
|
|
+ DataExchangeService des = new DataExchangeService(5000, 8000);
|
|
|
|
+ System.out.println("请求地址:"+url);
|
|
|
|
+ // 通过 https 方式调用,此方法内部会使用私钥生成签名参数 sign,私钥不会发送
|
|
|
|
+ String res = des.postHttps(url, map);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|