Explorar o código

激活BUG修复

wangliang %!s(int64=2) %!d(string=hai) anos
pai
achega
b65a2f5cc8

+ 10 - 3
teachcloud-common-api/src/main/java/com/qmth/teachcloud/common/api/api/TSAuthController.java

@@ -54,9 +54,16 @@ public class TSAuthController {
     @ApiOperation(value = "同步机构接口")
     @RequestMapping(value = "/sync/org", method = RequestMethod.POST)
     @ApiResponses({@ApiResponse(code = 200, message = "菜单信息", response = Result.class)})
-    public Result syncOrg() {
-        solarService.update(solarProperties.getAccessKey(), solarProperties.getAccessSecret());
-        authInfoService.appInfoInit();
+    public Result syncOrg() throws Exception {
+        if (Objects.isNull(solarProperties.getAccessKey()) && Objects.isNull(solarProperties.getAccessSecret())) {
+            throw ExceptionResultEnum.ERROR.exception("key和secret为空");
+        }
+        AppInfo appInfo = solarService.update(solarProperties.getAccessKey(), solarProperties.getAccessSecret());
+        if (Objects.isNull(appInfo)) {
+            throw ExceptionResultEnum.ERROR.exception("同步机构失败");
+        } else {
+            authInfoService.appInfoInit(appInfo, solarProperties.getAccessKey(), solarProperties.getAccessSecret());
+        }
         return ResultUtil.ok(true);
     }