|
|
@@ -1,16 +1,30 @@
|
|
|
package com.uas.eis;
|
|
|
|
|
|
+import com.netease.qiye.qiyeopenplatform.common.dto.login.AppLoginResp;
|
|
|
+import com.netease.qiye.qiyeopenplatform.sdk.QiyeOpenPlatSDK;
|
|
|
+import com.netease.qiye.qiyeopenplatform.sdk.QiyeOpenPlatSDKConfig;
|
|
|
+import com.netease.qiye.qiyeopenplatform.sdk.dto.R;
|
|
|
+import com.uas.eis.core.config.NetEasyConfig;
|
|
|
+import com.uas.eis.sdk.NetEasySDK;
|
|
|
import com.uas.eis.serviceImpl.NetEasyService;
|
|
|
import org.junit.Test;
|
|
|
import org.junit.runner.RunWith;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.boot.test.context.SpringBootTest;
|
|
|
import org.springframework.test.context.junit4.SpringRunner;
|
|
|
+
|
|
|
+import javax.annotation.Resource;
|
|
|
+
|
|
|
@RunWith(SpringRunner.class)
|
|
|
@SpringBootTest(classes = {UasEisApplication.class})
|
|
|
public class NetEasyTest {
|
|
|
@Autowired
|
|
|
private NetEasyService netEasyService;
|
|
|
+ @Autowired
|
|
|
+ private NetEasySDK netEasySDK;
|
|
|
+
|
|
|
+ @Resource
|
|
|
+ private NetEasyConfig netEasyConfig;
|
|
|
@Test
|
|
|
public void initOrg() throws Exception {
|
|
|
netEasyService.initNetEasyOrg();
|
|
|
@@ -29,6 +43,34 @@ public class NetEasyTest {
|
|
|
}
|
|
|
@Test
|
|
|
public void ssoLogin() throws Exception {
|
|
|
- netEasyService.ssoLogin("zhuad");
|
|
|
+ System.out.println(netEasyService.ssoLogin("yangxin"));
|
|
|
+ }
|
|
|
+ @Test
|
|
|
+ public void getMsg() throws Exception {
|
|
|
+ netEasyService.getUnreadMsg("zhuad");
|
|
|
+ }
|
|
|
+
|
|
|
+ @Test
|
|
|
+ public void refreshToken() throws Exception {
|
|
|
+
|
|
|
+// QiyeOpenPlatSDKConfig qiyeOpenPlatSDKConfig = QiyeOpenPlatSDKConfig.builder()
|
|
|
+// //应用ID
|
|
|
+// .appId(netEasyConfig.getAppId())
|
|
|
+// //企业OpenID
|
|
|
+// .orgOpenId(netEasyConfig.getCropId())
|
|
|
+// //服务地址信息
|
|
|
+// .urlPrefix(netEasyConfig.getServerUrl())
|
|
|
+// .build();
|
|
|
+//
|
|
|
+// //创建SDK实例
|
|
|
+// QiyeOpenPlatSDK sdkInstance = new QiyeOpenPlatSDK("dev", qiyeOpenPlatSDKConfig);
|
|
|
+// AppLoginResp appLoginResp = new AppLoginResp();
|
|
|
+// appLoginResp.setAccessToken("50a3e14102f945f49bd8abecb029c147");
|
|
|
+// appLoginResp.setRefreshToken("2ee0a626585a4247934aa1055972e35a");
|
|
|
+// sdkInstance.getQiyeOpenPlatSDKConfig().setupToken(appLoginResp);
|
|
|
+// System.out.println(sdkInstance.refreshToken().getDataBean(AppLoginResp.class).getRefreshTokenExpiredTime().getTime());
|
|
|
+ QiyeOpenPlatSDK instanceSDK = netEasySDK.getSDKInstance();
|
|
|
+ System.out.println(instanceSDK.getQiyeOpenPlatSDKConfig().getAccessTokenExpiredEnd().getTime());
|
|
|
+ System.out.println(System.currentTimeMillis());
|
|
|
}
|
|
|
}
|