|
@@ -3,22 +3,30 @@ package com.qmth.distributed.print.api;
|
|
import com.qmth.boot.api.constant.ApiConstant;
|
|
import com.qmth.boot.api.constant.ApiConstant;
|
|
import com.qmth.boot.core.solar.crypto.AppLicenseUtil;
|
|
import com.qmth.boot.core.solar.crypto.AppLicenseUtil;
|
|
import com.qmth.distributed.print.business.bean.dto.TSAuthDto;
|
|
import com.qmth.distributed.print.business.bean.dto.TSAuthDto;
|
|
|
|
+import com.qmth.distributed.print.business.service.AuthInfoService;
|
|
|
|
+import com.qmth.teachcloud.common.bean.dto.AuthOrgInfoDto;
|
|
import com.qmth.teachcloud.common.contant.SystemConstant;
|
|
import com.qmth.teachcloud.common.contant.SystemConstant;
|
|
|
|
+import com.qmth.teachcloud.common.entity.BasicSchool;
|
|
|
|
+import com.qmth.teachcloud.common.service.CommonCacheService;
|
|
|
|
+import com.qmth.teachcloud.common.util.Result;
|
|
|
|
+import com.qmth.teachcloud.common.util.ResultUtil;
|
|
import com.qmth.teachcloud.common.util.ServletUtil;
|
|
import com.qmth.teachcloud.common.util.ServletUtil;
|
|
-import io.swagger.annotations.Api;
|
|
|
|
-import io.swagger.annotations.ApiOperation;
|
|
|
|
-import io.swagger.annotations.ApiResponse;
|
|
|
|
-import io.swagger.annotations.ApiResponses;
|
|
|
|
|
|
+import io.swagger.annotations.*;
|
|
import org.apache.commons.io.IOUtils;
|
|
import org.apache.commons.io.IOUtils;
|
|
import org.slf4j.Logger;
|
|
import org.slf4j.Logger;
|
|
import org.slf4j.LoggerFactory;
|
|
import org.slf4j.LoggerFactory;
|
|
import org.springframework.validation.annotation.Validated;
|
|
import org.springframework.validation.annotation.Validated;
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
import org.springframework.web.bind.annotation.RequestMethod;
|
|
import org.springframework.web.bind.annotation.RequestMethod;
|
|
|
|
+import org.springframework.web.bind.annotation.RequestParam;
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
+import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
|
|
|
+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>
|
|
@@ -35,6 +43,12 @@ import java.io.ByteArrayInputStream;
|
|
public class TSAuthController {
|
|
public class TSAuthController {
|
|
private final static Logger log = LoggerFactory.getLogger(TSAuthController.class);
|
|
private final static Logger log = LoggerFactory.getLogger(TSAuthController.class);
|
|
|
|
|
|
|
|
+ @Resource
|
|
|
|
+ AuthInfoService authInfoService;
|
|
|
|
+
|
|
|
|
+ @Resource
|
|
|
|
+ CommonCacheService commonCacheService;
|
|
|
|
+
|
|
@ApiOperation(value = "导出硬件信息")
|
|
@ApiOperation(value = "导出硬件信息")
|
|
@ApiResponses({@ApiResponse(code = 200, message = "导出硬件信息", response = TSAuthDto.class)})
|
|
@ApiResponses({@ApiResponse(code = 200, message = "导出硬件信息", response = TSAuthDto.class)})
|
|
@RequestMapping(value = "/export/device/info", method = RequestMethod.POST)
|
|
@RequestMapping(value = "/export/device/info", method = RequestMethod.POST)
|
|
@@ -47,4 +61,32 @@ public class TSAuthController {
|
|
log.error(SystemConstant.LOG_ERROR, e);
|
|
log.error(SystemConstant.LOG_ERROR, e);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ @ApiOperation(value = "离线激活")
|
|
|
|
+ @ApiResponses({@ApiResponse(code = 200, message = "授权配置信息", response = TSAuthDto.class)})
|
|
|
|
+ @RequestMapping(value = "/offline/activation", method = RequestMethod.POST)
|
|
|
|
+ public Result offlineActivation(@ApiParam(value = "上传文件", required = true) @RequestParam(required = true) MultipartFile file) {
|
|
|
|
+ try {
|
|
|
|
+ authInfoService.updateLicense(file.getBytes());
|
|
|
|
+ } catch (IOException e) {
|
|
|
|
+ e.printStackTrace();
|
|
|
|
+ }
|
|
|
|
+ return ResultUtil.ok(true);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @ApiOperation(value = "查询激活信息")
|
|
|
|
+ @ApiResponses({@ApiResponse(code = 200, message = "授权配置信息", response = TSAuthDto.class)})
|
|
|
|
+ @RequestMapping(value = "/select", method = RequestMethod.POST)
|
|
|
|
+ public Result select() {
|
|
|
|
+ Long schoolId = SystemConstant.getHeadOrUserSchoolId();
|
|
|
|
+ Long expireTime = null;
|
|
|
|
+ if (Objects.nonNull(schoolId)) {
|
|
|
|
+ BasicSchool basicSchool = commonCacheService.schoolCache(schoolId);
|
|
|
|
+ AuthOrgInfoDto authOrgInfoDto = commonCacheService.authInfoCache(basicSchool.getCode());
|
|
|
|
+ if (Objects.nonNull(authOrgInfoDto) && Objects.nonNull(authOrgInfoDto.getControl())) {
|
|
|
|
+ expireTime = authOrgInfoDto.getControl().getExpireTime();
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ return ResultUtil.ok(expireTime);
|
|
|
|
+ }
|
|
}
|
|
}
|