|
@@ -3,20 +3,16 @@ package com.qmth.distributed.print.api;
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
import com.qmth.boot.api.constant.ApiConstant;
|
|
import com.qmth.boot.api.constant.ApiConstant;
|
|
-import com.qmth.distributed.print.business.bean.params.TSchoolPrivilegeParam;
|
|
|
|
|
|
+import com.qmth.distributed.print.business.bean.params.SysAdminSetParam;
|
|
import com.qmth.distributed.print.business.bean.result.CustomPrivilegeResult;
|
|
import com.qmth.distributed.print.business.bean.result.CustomPrivilegeResult;
|
|
-import com.qmth.distributed.print.business.bean.result.TSchoolPrivilegeResult;
|
|
|
|
|
|
+import com.qmth.distributed.print.business.bean.result.SysAdminSetResult;
|
|
import com.qmth.teachcloud.common.bean.dto.PrivilegeDto;
|
|
import com.qmth.teachcloud.common.bean.dto.PrivilegeDto;
|
|
import com.qmth.teachcloud.common.contant.SystemConstant;
|
|
import com.qmth.teachcloud.common.contant.SystemConstant;
|
|
import com.qmth.teachcloud.common.entity.*;
|
|
import com.qmth.teachcloud.common.entity.*;
|
|
-import com.qmth.teachcloud.common.enums.ExceptionResultEnum;
|
|
|
|
import com.qmth.teachcloud.common.service.*;
|
|
import com.qmth.teachcloud.common.service.*;
|
|
import com.qmth.teachcloud.common.util.Result;
|
|
import com.qmth.teachcloud.common.util.Result;
|
|
import com.qmth.teachcloud.common.util.ResultUtil;
|
|
import com.qmth.teachcloud.common.util.ResultUtil;
|
|
-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.springframework.transaction.annotation.Transactional;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
import org.springframework.util.CollectionUtils;
|
|
import org.springframework.util.CollectionUtils;
|
|
import org.springframework.validation.BindingResult;
|
|
import org.springframework.validation.BindingResult;
|
|
@@ -29,17 +25,17 @@ import java.util.*;
|
|
import java.util.stream.Collectors;
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
/**
|
|
- * @Description: 菜单权限修改
|
|
|
|
|
|
+ * @Description: 超管设置
|
|
* @Param:
|
|
* @Param:
|
|
* @return:
|
|
* @return:
|
|
* @Author: wangliang
|
|
* @Author: wangliang
|
|
* @Date: 2021/10/29
|
|
* @Date: 2021/10/29
|
|
*/
|
|
*/
|
|
-@Api(tags = "菜单权限修改Controller")
|
|
|
|
|
|
+@Api(tags = "超管设置Controller")
|
|
@RestController
|
|
@RestController
|
|
-@RequestMapping(ApiConstant.DEFAULT_URI_PREFIX + "/${prefix.url.menu}")
|
|
|
|
|
|
+@RequestMapping(ApiConstant.DEFAULT_URI_PREFIX + "/${prefix.url.set}")
|
|
//@Aac(auth = BOOL.FALSE, strict = BOOL.FALSE)
|
|
//@Aac(auth = BOOL.FALSE, strict = BOOL.FALSE)
|
|
-public class MenuCustomController {
|
|
|
|
|
|
+public class SysAdminSetController {
|
|
|
|
|
|
@Resource
|
|
@Resource
|
|
SysPrivilegeService sysPrivilegeService;
|
|
SysPrivilegeService sysPrivilegeService;
|
|
@@ -65,22 +61,62 @@ public class MenuCustomController {
|
|
@Resource
|
|
@Resource
|
|
SysConfigService sysConfigService;
|
|
SysConfigService sysConfigService;
|
|
|
|
|
|
|
|
+ @ApiOperation(value = "用户验证查询")
|
|
|
|
+ @ApiResponses({@ApiResponse(code = 200, message = "用户验证信息", response = SysAdminSetResult.class)})
|
|
|
|
+ @RequestMapping(value = "/user/select", method = RequestMethod.POST)
|
|
|
|
+ public Result sysadminUserSelect(@ApiParam(value = "学校id ", required = true) @RequestParam Long schoolId) {
|
|
|
|
+ SysConfig sysConfigAccount = commonCacheService.addSysConfigCache(schoolId, SystemConstant.ACCOUNT_SMS_VERIFY);
|
|
|
|
+ SysConfig sysConfigTeachcloudExchangeSerivePath = commonCacheService.addSysConfigCache(schoolId, SystemConstant.TEACHCLOUD_EXCHANGE_SERVICE_PATH);
|
|
|
|
+ return ResultUtil.ok(new SysAdminSetResult(schoolId, Objects.nonNull(sysConfigAccount) ? Boolean.valueOf(sysConfigAccount.getConfigValue()) : false, Objects.nonNull(sysConfigTeachcloudExchangeSerivePath) ? sysConfigTeachcloudExchangeSerivePath.getConfigValue() : ""));
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @ApiOperation(value = "用户验证保存")
|
|
|
|
+ @ApiResponses({@ApiResponse(code = 200, message = "用户验证信息", response = ResultUtil.class)})
|
|
|
|
+ @RequestMapping(value = "/user/save", method = RequestMethod.POST)
|
|
|
|
+ @Transactional
|
|
|
|
+ public Result sysadminUserSave(@Valid @RequestBody SysAdminSetParam sysAdminSetParam, BindingResult bindingResult) {
|
|
|
|
+ if (bindingResult.hasErrors()) {
|
|
|
|
+ return ResultUtil.error(bindingResult.getAllErrors().get(0).getDefaultMessage());
|
|
|
|
+ }
|
|
|
|
+ List<SysConfig> sysConfigList = new ArrayList<>();
|
|
|
|
+ SysConfig sysConfigAccount = commonCacheService.addSysConfigCache(sysAdminSetParam.getSchoolId(), SystemConstant.ACCOUNT_SMS_VERIFY);
|
|
|
|
+ if (Objects.isNull(sysConfigAccount)) {
|
|
|
|
+ sysConfigAccount = new SysConfig(sysAdminSetParam.getSchoolId(), SystemConstant.ACCOUNT_SMS_VERIFY, "用户/密码模式是否开启短信验证", String.valueOf(sysAdminSetParam.getAccountSmsVerify()));
|
|
|
|
+ } else {
|
|
|
|
+ sysConfigAccount.setConfigValue(String.valueOf(sysAdminSetParam.getAccountSmsVerify()));
|
|
|
|
+ }
|
|
|
|
+ sysConfigList.add(sysConfigAccount);
|
|
|
|
+
|
|
|
|
+ SysConfig sysConfigTeachcloudExchangeSerivePath = commonCacheService.addSysConfigCache(sysAdminSetParam.getSchoolId(), SystemConstant.TEACHCLOUD_EXCHANGE_SERVICE_PATH);
|
|
|
|
+ if (Objects.isNull(sysConfigTeachcloudExchangeSerivePath)) {
|
|
|
|
+ sysConfigTeachcloudExchangeSerivePath = new SysConfig(sysAdminSetParam.getSchoolId(), SystemConstant.TEACHCLOUD_EXCHANGE_SERVICE_PATH, "第三方统一身份认证", sysAdminSetParam.getTeachcloudExchangeSerivePath());
|
|
|
|
+ } else {
|
|
|
|
+ sysConfigTeachcloudExchangeSerivePath.setConfigValue(sysAdminSetParam.getTeachcloudExchangeSerivePath());
|
|
|
|
+ }
|
|
|
|
+ sysConfigList.add(sysConfigTeachcloudExchangeSerivePath);
|
|
|
|
+ sysConfigService.saveOrUpdateBatch(sysConfigList);
|
|
|
|
+
|
|
|
|
+ commonCacheService.removeSysConfigCache(sysAdminSetParam.getSchoolId(), SystemConstant.ACCOUNT_SMS_VERIFY);
|
|
|
|
+ commonCacheService.removeSysConfigCache(sysAdminSetParam.getSchoolId(), SystemConstant.TEACHCLOUD_EXCHANGE_SERVICE_PATH);
|
|
|
|
+ return ResultUtil.ok(true);
|
|
|
|
+ }
|
|
|
|
+
|
|
@ApiOperation(value = "查询自定义菜单权限")
|
|
@ApiOperation(value = "查询自定义菜单权限")
|
|
@ApiResponses({@ApiResponse(code = 200, message = "菜单权限信息", response = SysPrivilege.class)})
|
|
@ApiResponses({@ApiResponse(code = 200, message = "菜单权限信息", response = SysPrivilege.class)})
|
|
- @RequestMapping(value = "/custom/list", method = RequestMethod.POST)
|
|
|
|
|
|
+ @RequestMapping(value = "/menu/custom/list", method = RequestMethod.POST)
|
|
public Result customList() {
|
|
public Result customList() {
|
|
List<PrivilegeDto> customPrivilegeList = sysPrivilegeService.addCustomList();
|
|
List<PrivilegeDto> customPrivilegeList = sysPrivilegeService.addCustomList();
|
|
- SysConfig sysConfig = commonCacheService.addSysConfigCache(SystemConstant.SYS_PDF_SIZE_LIST);
|
|
|
|
- Optional.ofNullable(sysConfig).orElseThrow(() -> ExceptionResultEnum.ERROR.exception("未配置全局pdf格式清单"));
|
|
|
|
- SysConfig sysConfigAccount = commonCacheService.addSysConfigCache(SystemConstant.ACCOUNT_SMS_VERIFY);
|
|
|
|
- return ResultUtil.ok(new CustomPrivilegeResult(customPrivilegeList, Arrays.asList(sysConfig.getConfigValue().replaceAll("\\[", "").replaceAll("\\]", "").split(", ")), Objects.nonNull(sysConfigAccount) ? Boolean.valueOf(sysConfigAccount.getConfigValue()) : false));
|
|
|
|
|
|
+// SysConfig sysConfig = commonCacheService.addSysConfigCache(SystemConstant.SYS_PDF_SIZE_LIST);
|
|
|
|
+// Optional.ofNullable(sysConfig).orElseThrow(() -> ExceptionResultEnum.ERROR.exception("未配置全局pdf格式清单"));
|
|
|
|
+// return ResultUtil.ok(new CustomPrivilegeResult(customPrivilegeList, Arrays.asList(sysConfig.getConfigValue().replaceAll("\\[", "").replaceAll("\\]", "").split(", "))));
|
|
|
|
+ return ResultUtil.ok(new CustomPrivilegeResult(customPrivilegeList));
|
|
}
|
|
}
|
|
|
|
|
|
@ApiOperation(value = "学校新增/修改自定义菜单权限")
|
|
@ApiOperation(value = "学校新增/修改自定义菜单权限")
|
|
- @ApiResponses({@ApiResponse(code = 200, message = "常规信息", response = ResultUtil.class)})
|
|
|
|
- @RequestMapping(value = "/custom/save", method = RequestMethod.POST)
|
|
|
|
|
|
+ @ApiResponses({@ApiResponse(code = 200, message = "菜单权限信息", response = ResultUtil.class)})
|
|
|
|
+ @RequestMapping(value = "/menu/custom/save", method = RequestMethod.POST)
|
|
@Transactional
|
|
@Transactional
|
|
- public Result getRolePrivileges(@Valid @RequestBody TSchoolPrivilegeParam tSchoolPrivilegeParam, BindingResult bindingResult) throws NoSuchAlgorithmException {
|
|
|
|
|
|
+ public Result getRolePrivileges(@Valid @RequestBody SysAdminSetParam tSchoolPrivilegeParam, BindingResult bindingResult) throws NoSuchAlgorithmException {
|
|
if (bindingResult.hasErrors()) {
|
|
if (bindingResult.hasErrors()) {
|
|
return ResultUtil.error(bindingResult.getAllErrors().get(0).getDefaultMessage());
|
|
return ResultUtil.error(bindingResult.getAllErrors().get(0).getDefaultMessage());
|
|
}
|
|
}
|
|
@@ -143,42 +179,42 @@ public class MenuCustomController {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
-
|
|
|
|
- List<SysConfig> sysConfigList = new ArrayList<>();
|
|
|
|
- SysConfig sysConfig = commonCacheService.addSysConfigCache(tSchoolPrivilegeParam.getSchoolId(), SystemConstant.PDF_SIZE_LIST);
|
|
|
|
- if (Objects.isNull(sysConfig)) {
|
|
|
|
- sysConfig = new SysConfig(tSchoolPrivilegeParam.getSchoolId(), SystemConstant.PDF_SIZE_LIST, "pdf格式清单", Arrays.asList(tSchoolPrivilegeParam.getPdfSize()).toString());
|
|
|
|
- } else {
|
|
|
|
- if (Objects.nonNull(tSchoolPrivilegeParam.getPdfSize()) && tSchoolPrivilegeParam.getPdfSize().length > 0) {
|
|
|
|
- sysConfig.setConfigValue(Arrays.asList(tSchoolPrivilegeParam.getPdfSize()).toString());
|
|
|
|
- } else {
|
|
|
|
- sysConfig.setConfigValue(null);
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- sysConfigList.add(sysConfig);
|
|
|
|
-
|
|
|
|
- SysConfig sysConfigAccount = commonCacheService.addSysConfigCache(tSchoolPrivilegeParam.getSchoolId(), SystemConstant.ACCOUNT_SMS_VERIFY);
|
|
|
|
- if (Objects.isNull(sysConfigAccount)) {
|
|
|
|
- sysConfigAccount = new SysConfig(tSchoolPrivilegeParam.getSchoolId(), SystemConstant.ACCOUNT_SMS_VERIFY, "用户/密码模式是否开启短信验证", String.valueOf(tSchoolPrivilegeParam.isAccountSmsVerify()));
|
|
|
|
- } else {
|
|
|
|
- sysConfigAccount.setConfigValue(String.valueOf(tSchoolPrivilegeParam.isAccountSmsVerify()));
|
|
|
|
- }
|
|
|
|
- sysConfigList.add(sysConfigAccount);
|
|
|
|
-
|
|
|
|
- sysConfigService.saveOrUpdateBatch(sysConfigList);
|
|
|
|
- commonCacheService.removeSysConfigCache(tSchoolPrivilegeParam.getSchoolId(), SystemConstant.PDF_SIZE_LIST);
|
|
|
|
- commonCacheService.removeSysConfigCache(tSchoolPrivilegeParam.getSchoolId(), SystemConstant.ACCOUNT_SMS_VERIFY);
|
|
|
|
|
|
+// List<SysConfig> sysConfigList = new ArrayList<>();
|
|
|
|
+// SysConfig sysConfig = commonCacheService.addSysConfigCache(tSchoolPrivilegeParam.getSchoolId(), SystemConstant.PDF_SIZE_LIST);
|
|
|
|
+// if (Objects.isNull(sysConfig)) {
|
|
|
|
+// sysConfig = new SysConfig(tSchoolPrivilegeParam.getSchoolId(), SystemConstant.PDF_SIZE_LIST, "pdf格式清单", Arrays.asList(tSchoolPrivilegeParam.getPdfSize()).toString());
|
|
|
|
+// } else {
|
|
|
|
+// if (Objects.nonNull(tSchoolPrivilegeParam.getPdfSize()) && tSchoolPrivilegeParam.getPdfSize().length > 0) {
|
|
|
|
+// sysConfig.setConfigValue(Arrays.asList(tSchoolPrivilegeParam.getPdfSize()).toString());
|
|
|
|
+// } else {
|
|
|
|
+// sysConfig.setConfigValue(null);
|
|
|
|
+// }
|
|
|
|
+// }
|
|
|
|
+// sysConfigList.add(sysConfig);
|
|
|
|
+//
|
|
|
|
+// SysConfig sysConfigAccount = commonCacheService.addSysConfigCache(tSchoolPrivilegeParam.getSchoolId(), SystemConstant.ACCOUNT_SMS_VERIFY);
|
|
|
|
+// if (Objects.isNull(sysConfigAccount)) {
|
|
|
|
+// sysConfigAccount = new SysConfig(tSchoolPrivilegeParam.getSchoolId(), SystemConstant.ACCOUNT_SMS_VERIFY, "用户/密码模式是否开启短信验证", String.valueOf(tSchoolPrivilegeParam.isAccountSmsVerify()));
|
|
|
|
+// } else {
|
|
|
|
+// sysConfigAccount.setConfigValue(String.valueOf(tSchoolPrivilegeParam.isAccountSmsVerify()));
|
|
|
|
+// }
|
|
|
|
+// sysConfigList.add(sysConfigAccount);
|
|
|
|
+//
|
|
|
|
+// sysConfigService.saveOrUpdateBatch(sysConfigList);
|
|
|
|
+// commonCacheService.removeSysConfigCache(tSchoolPrivilegeParam.getSchoolId(), SystemConstant.PDF_SIZE_LIST);
|
|
|
|
+// commonCacheService.removeSysConfigCache(tSchoolPrivilegeParam.getSchoolId(), SystemConstant.ACCOUNT_SMS_VERIFY);
|
|
return ResultUtil.ok(true);
|
|
return ResultUtil.ok(true);
|
|
}
|
|
}
|
|
|
|
|
|
@ApiOperation(value = "学校已绑定自定义菜单权限列表")
|
|
@ApiOperation(value = "学校已绑定自定义菜单权限列表")
|
|
- @ApiResponses({@ApiResponse(code = 200, message = "常规信息", response = ResultUtil.class)})
|
|
|
|
- @RequestMapping(value = "/custom/get_school_custom_privileges", method = RequestMethod.POST)
|
|
|
|
- public Result getRolePrivileges(@RequestParam(value = "schoolId", required = true) Long schoolId) {
|
|
|
|
|
|
+ @ApiResponses({@ApiResponse(code = 200, message = "菜单权限信息", response = SysAdminSetResult.class)})
|
|
|
|
+ @RequestMapping(value = "/menu/custom/get_school_custom_privileges", method = RequestMethod.POST)
|
|
|
|
+ public Result getRolePrivileges(@ApiParam(value = "学校id ", required = true) @RequestParam Long schoolId) {
|
|
List<TSchoolPrivilege> tSchoolPrivilegeList = tSchoolPrivilegeService.findBySchoolId(schoolId);
|
|
List<TSchoolPrivilege> tSchoolPrivilegeList = tSchoolPrivilegeService.findBySchoolId(schoolId);
|
|
List<String> privilegeIdList = tSchoolPrivilegeList.stream().map(s -> String.valueOf(s.getPrivilegeId())).collect(Collectors.toList());
|
|
List<String> privilegeIdList = tSchoolPrivilegeList.stream().map(s -> String.valueOf(s.getPrivilegeId())).collect(Collectors.toList());
|
|
- SysConfig sysConfig = commonCacheService.addSysConfigCache(schoolId, SystemConstant.PDF_SIZE_LIST);
|
|
|
|
- SysConfig sysConfigAccount = commonCacheService.addSysConfigCache(schoolId, SystemConstant.ACCOUNT_SMS_VERIFY);
|
|
|
|
- return ResultUtil.ok(new TSchoolPrivilegeResult(schoolId, privilegeIdList, Objects.nonNull(sysConfig) ? Arrays.asList(sysConfig.getConfigValue().replaceAll("\\[", "").replaceAll("\\]", "").split(", ")) : null, Objects.nonNull(sysConfigAccount) ? Boolean.valueOf(sysConfigAccount.getConfigValue()) : false));
|
|
|
|
|
|
+// SysConfig sysConfig = commonCacheService.addSysConfigCache(schoolId, SystemConstant.PDF_SIZE_LIST);
|
|
|
|
+// SysConfig sysConfigAccount = commonCacheService.addSysConfigCache(schoolId, SystemConstant.ACCOUNT_SMS_VERIFY);
|
|
|
|
+// return ResultUtil.ok(new TSchoolPrivilegeResult(schoolId, privilegeIdList, Objects.nonNull(sysConfig) ? Arrays.asList(sysConfig.getConfigValue().replaceAll("\\[", "").replaceAll("\\]", "").split(", ")) : null, Objects.nonNull(sysConfigAccount) ? Boolean.valueOf(sysConfigAccount.getConfigValue()) : false));
|
|
|
|
+ return ResultUtil.ok(new SysAdminSetResult(schoolId, CollectionUtils.isEmpty(privilegeIdList) ? new ArrayList<>() : privilegeIdList));
|
|
}
|
|
}
|
|
}
|
|
}
|