|
@@ -24,7 +24,7 @@ import org.springframework.web.multipart.MultipartFile;
|
|
import javax.annotation.Resource;
|
|
import javax.annotation.Resource;
|
|
import javax.servlet.http.HttpServletResponse;
|
|
import javax.servlet.http.HttpServletResponse;
|
|
import java.io.ByteArrayInputStream;
|
|
import java.io.ByteArrayInputStream;
|
|
-import java.io.IOException;
|
|
|
|
|
|
+import java.util.Objects;
|
|
|
|
|
|
/**
|
|
/**
|
|
* <p>
|
|
* <p>
|
|
@@ -76,11 +76,7 @@ public class TSAuthController {
|
|
@ApiResponses({@ApiResponse(code = 200, message = "授权配置信息", response = Boolean.class)})
|
|
@ApiResponses({@ApiResponse(code = 200, message = "授权配置信息", response = Boolean.class)})
|
|
@RequestMapping(value = "/offline/activation", method = RequestMethod.POST)
|
|
@RequestMapping(value = "/offline/activation", method = RequestMethod.POST)
|
|
public Result offlineActivation(@ApiParam(value = "上传文件", required = true) @RequestParam(required = true) MultipartFile file) throws Exception {
|
|
public Result offlineActivation(@ApiParam(value = "上传文件", required = true) @RequestParam(required = true) MultipartFile file) throws Exception {
|
|
- try {
|
|
|
|
- authInfoService.updateLicense(file.getBytes());
|
|
|
|
- } catch (IOException e) {
|
|
|
|
- e.printStackTrace();
|
|
|
|
- }
|
|
|
|
|
|
+ authInfoService.updateLicense(file.getBytes());
|
|
return ResultUtil.ok(true);
|
|
return ResultUtil.ok(true);
|
|
}
|
|
}
|
|
|
|
|
|
@@ -90,6 +86,9 @@ public class TSAuthController {
|
|
public Result onlineActivation(@ApiParam(value = "accessKey", required = true) @RequestParam(required = true) String accessKey,
|
|
public Result onlineActivation(@ApiParam(value = "accessKey", required = true) @RequestParam(required = true) String accessKey,
|
|
@ApiParam(value = "accessSecret", required = true) @RequestParam(required = true) String accessSecret) throws Exception {
|
|
@ApiParam(value = "accessSecret", required = true) @RequestParam(required = true) String accessSecret) throws Exception {
|
|
AppInfo appInfo = solarService.update(accessKey, accessSecret);
|
|
AppInfo appInfo = solarService.update(accessKey, accessSecret);
|
|
|
|
+ if (Objects.isNull(appInfo)) {
|
|
|
|
+ throw new RuntimeException("激活失败,请检查key和secret输入是否正确");
|
|
|
|
+ }
|
|
authInfoService.appInfoInit(appInfo, accessKey, accessSecret);
|
|
authInfoService.appInfoInit(appInfo, accessKey, accessSecret);
|
|
return ResultUtil.ok(true);
|
|
return ResultUtil.ok(true);
|
|
}
|
|
}
|