|
@@ -15,12 +15,15 @@ import com.qmth.themis.business.enums.UploadFileEnum;
|
|
|
import com.qmth.themis.business.service.TBClientVersionService;
|
|
|
import com.qmth.themis.business.service.TBOrgService;
|
|
|
import com.qmth.themis.business.service.ThemisCacheService;
|
|
|
+import com.qmth.themis.common.enums.ExceptionResultEnum;
|
|
|
import com.qmth.themis.common.exception.BusinessException;
|
|
|
import com.qmth.themis.common.util.GsonUtil;
|
|
|
import com.qmth.themis.common.util.Result;
|
|
|
import com.qmth.themis.common.util.ResultUtil;
|
|
|
import com.qmth.themis.exam.config.DictionaryConfig;
|
|
|
import io.swagger.annotations.*;
|
|
|
+import org.springframework.validation.BindingResult;
|
|
|
+import org.springframework.validation.annotation.Validated;
|
|
|
import org.springframework.web.bind.annotation.RequestBody;
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
import org.springframework.web.bind.annotation.RequestMethod;
|
|
@@ -36,6 +39,7 @@ import java.util.Optional;
|
|
|
@Api(tags = "系统信息Controller")
|
|
|
@RestController
|
|
|
@RequestMapping(SystemConstant.PREFIX_URL_OE + "/sys")
|
|
|
+@Validated
|
|
|
public class SysController {
|
|
|
|
|
|
@Resource
|
|
@@ -92,11 +96,29 @@ public class SysController {
|
|
|
|
|
|
@ApiOperation(value = "获取所有学校接口")
|
|
|
@RequestMapping(value = "/school/list", method = RequestMethod.POST)
|
|
|
- @ApiResponses({@ApiResponse(code = 200, message = "系统通知信息", response = TBOrg.class)})
|
|
|
+ @ApiResponses({@ApiResponse(code = 200, message = "学校信息", response = TBOrgBean.class)})
|
|
|
public Result schoolList() {
|
|
|
List<TBOrg> tbOrgList = tbOrgService.list();
|
|
|
List<TBOrgBean> tbOrgBeanList = GsonUtil.fromJson(GsonUtil.toJson(tbOrgList), new TypeToken<List<TBOrgBean>>() {
|
|
|
}.getType());
|
|
|
return ResultUtil.ok(tbOrgBeanList);
|
|
|
}
|
|
|
+
|
|
|
+ @ApiOperation(value = "上传安装包回调接口")
|
|
|
+ @RequestMapping(value = "/upload/package/callback", method = RequestMethod.POST)
|
|
|
+ @ApiResponses({@ApiResponse(code = 200, message = "常规信息", response = Result.class)})
|
|
|
+ public Result uploadPackageCallback(@Validated @ApiParam(value = "学校信息", required = true) @RequestBody TBOrgBean tbOrgBean, BindingResult bindingResult) {
|
|
|
+ if (bindingResult.hasErrors()) {
|
|
|
+ return ResultUtil.error(bindingResult.getAllErrors().get(0).getDefaultMessage());
|
|
|
+ }
|
|
|
+ TBOrg tbOrg = themisCacheService.addOrgCache(tbOrgBean.getId());
|
|
|
+ Optional.ofNullable(tbOrg).orElseThrow(() -> new BusinessException(ExceptionResultEnum.ORG_NO));
|
|
|
+
|
|
|
+ tbOrg.setPackagePath(tbOrgBean.getPackagePath());
|
|
|
+ tbOrgService.updateById(tbOrg);
|
|
|
+
|
|
|
+ themisCacheService.updateOrgCache(tbOrgBean.getId());
|
|
|
+ themisCacheService.updateOrgCodeCache(tbOrgBean.getCode());
|
|
|
+ return ResultUtil.ok(true);
|
|
|
+ }
|
|
|
}
|