|
@@ -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);
|
|
|
}
|
|
|
|