Browse Source

超管设置修改

wangliang 2 năm trước cách đây
mục cha
commit
fad29e22a5

+ 9 - 48
distributed-print-business/src/main/java/com/qmth/distributed/print/business/bean/params/SysAdminSetParam.java

@@ -3,9 +3,12 @@ package com.qmth.distributed.print.business.bean.params;
 import com.fasterxml.jackson.annotation.JsonInclude;
 import com.fasterxml.jackson.databind.annotation.JsonSerialize;
 import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
+import com.qmth.teachcloud.common.bean.result.SysConfigResult;
 import com.qmth.teachcloud.common.entity.TSchoolPrivilege;
 import io.swagger.annotations.ApiModelProperty;
 
+import java.util.List;
+
 /**
  * @Description: 学校自定义菜单 param
  * @Param:
@@ -20,37 +23,19 @@ public class SysAdminSetParam extends TSchoolPrivilege {
     @ApiModelProperty(value = "权限id数组")
     private Long[] privilegeIds;
 
-    @ApiModelProperty(value = "pdf格式数组")
-    private String[] pdfSize;
-
-    @ApiModelProperty(value = "用户/密码模式是否开启短信验证")
-    Boolean accountSmsVerify;
-
-    @ApiModelProperty(value = "第三方统一身份认证地址")
-    String teachcloudExchangeHostUrl;
-
-    @ApiModelProperty(value = "同步配置地址")
-    String syncServicePaths;
+    @ApiModelProperty(value = "参数")
+    List<SysConfigResult> param;
 
     @JsonSerialize(using = ToStringSerializer.class)
     @ApiModelProperty(value = "角色id数组")
     private Long[] roleIds;
 
-    public SysAdminSetParam() {
-
+    public List<SysConfigResult> getParam() {
+        return param;
     }
 
-    public SysAdminSetParam(Boolean accountSmsVerify, String teachcloudExchangeHostUrl) {
-        this.accountSmsVerify = accountSmsVerify;
-        this.teachcloudExchangeHostUrl = teachcloudExchangeHostUrl;
-    }
-
-    public String getTeachcloudExchangeHostUrl() {
-        return teachcloudExchangeHostUrl;
-    }
-
-    public void setTeachcloudExchangeHostUrl(String teachcloudExchangeHostUrl) {
-        this.teachcloudExchangeHostUrl = teachcloudExchangeHostUrl;
+    public void setParam(List<SysConfigResult> param) {
+        this.param = param;
     }
 
     public Long[] getRoleIds() {
@@ -61,22 +46,6 @@ public class SysAdminSetParam extends TSchoolPrivilege {
         this.roleIds = roleIds;
     }
 
-    public String getSyncServicePaths() {
-        return syncServicePaths;
-    }
-
-    public void setSyncServicePaths(String syncServicePaths) {
-        this.syncServicePaths = syncServicePaths;
-    }
-
-    public Boolean getAccountSmsVerify() {
-        return accountSmsVerify;
-    }
-
-    public void setAccountSmsVerify(Boolean accountSmsVerify) {
-        this.accountSmsVerify = accountSmsVerify;
-    }
-
     public Long[] getPrivilegeIds() {
         return privilegeIds;
     }
@@ -84,12 +53,4 @@ public class SysAdminSetParam extends TSchoolPrivilege {
     public void setPrivilegeIds(Long[] privilegeIds) {
         this.privilegeIds = privilegeIds;
     }
-
-    public String[] getPdfSize() {
-        return pdfSize;
-    }
-
-    public void setPdfSize(String[] pdfSize) {
-        this.pdfSize = pdfSize;
-    }
 }

+ 0 - 11
distributed-print-business/src/main/java/com/qmth/distributed/print/business/bean/result/CustomPrivilegeResult.java

@@ -21,9 +21,6 @@ public class CustomPrivilegeResult implements Serializable {
     @ApiModelProperty(value = "自定义菜单")
     List<PrivilegeDto> customPrivilegeList;
 
-    @ApiModelProperty(value = "全局pdf格式")
-    List<String> sysPdfSize;
-
     @ApiModelProperty(value = "自定义角色")
     List<SysRole> customRoleList;
 
@@ -50,12 +47,4 @@ public class CustomPrivilegeResult implements Serializable {
     public void setCustomRoleList(List<SysRole> customRoleList) {
         this.customRoleList = customRoleList;
     }
-
-    public List<String> getSysPdfSize() {
-        return sysPdfSize;
-    }
-
-    public void setSysPdfSize(List<String> sysPdfSize) {
-        this.sysPdfSize = sysPdfSize;
-    }
 }

+ 10 - 53
distributed-print-business/src/main/java/com/qmth/distributed/print/business/bean/result/SysAdminSetResult.java

@@ -3,6 +3,7 @@ package com.qmth.distributed.print.business.bean.result;
 import com.fasterxml.jackson.annotation.JsonInclude;
 import com.fasterxml.jackson.databind.annotation.JsonSerialize;
 import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
+import com.qmth.teachcloud.common.bean.result.SysConfigResult;
 import io.swagger.annotations.ApiModelProperty;
 
 import java.io.Serializable;
@@ -25,17 +26,8 @@ public class SysAdminSetResult implements Serializable {
     @ApiModelProperty(value = "自定义菜单id")
     List<String> privilegeIdList;
 
-    @ApiModelProperty(value = "pdf格式")
-    List<String> pdfSize;
-
-    @ApiModelProperty(value = "用户/密码模式是否开启短信验证")
-    Boolean accountSmsVerify;
-
-    @ApiModelProperty(value = "第三方统一身份认证地址")
-    String teachcloudExchangeHostUrl;
-
-    @ApiModelProperty(value = "同步配置地址")
-    String syncServicePaths;
+    @ApiModelProperty(value = "返回结果")
+    List<SysConfigResult> result;
 
     @ApiModelProperty(value = "自定义角色id")
     List<String> roleIdList;
@@ -44,24 +36,13 @@ public class SysAdminSetResult implements Serializable {
 
     }
 
-    public SysAdminSetResult(List<String> pdfSize) {
-        this.pdfSize = pdfSize;
-    }
-
-    public SysAdminSetResult(Long schoolId, List<String> privilegeIdList) {
+    public SysAdminSetResult(Long schoolId) {
         this.schoolId = schoolId;
-        this.privilegeIdList = privilegeIdList;
     }
 
-    public SysAdminSetResult(Long schoolId, String syncServicePaths) {
+    public SysAdminSetResult(Long schoolId, List<SysConfigResult> result) {
         this.schoolId = schoolId;
-        this.syncServicePaths = syncServicePaths;
-    }
-
-    public SysAdminSetResult(Long schoolId, Boolean accountSmsVerify, String teachcloudExchangeHostUrl) {
-        this.schoolId = schoolId;
-        this.accountSmsVerify = accountSmsVerify;
-        this.teachcloudExchangeHostUrl = teachcloudExchangeHostUrl;
+        this.result = result;
     }
 
     public List<String> getRoleIdList() {
@@ -72,30 +53,6 @@ public class SysAdminSetResult implements Serializable {
         this.roleIdList = roleIdList;
     }
 
-    public String getTeachcloudExchangeHostUrl() {
-        return teachcloudExchangeHostUrl;
-    }
-
-    public void setTeachcloudExchangeHostUrl(String teachcloudExchangeHostUrl) {
-        this.teachcloudExchangeHostUrl = teachcloudExchangeHostUrl;
-    }
-
-    public String getSyncServicePaths() {
-        return syncServicePaths;
-    }
-
-    public void setSyncServicePaths(String syncServicePaths) {
-        this.syncServicePaths = syncServicePaths;
-    }
-
-    public Boolean getAccountSmsVerify() {
-        return accountSmsVerify;
-    }
-
-    public void setAccountSmsVerify(Boolean accountSmsVerify) {
-        this.accountSmsVerify = accountSmsVerify;
-    }
-
     public List<String> getPrivilegeIdList() {
         return privilegeIdList;
     }
@@ -112,11 +69,11 @@ public class SysAdminSetResult implements Serializable {
         this.schoolId = schoolId;
     }
 
-    public List<String> getPdfSize() {
-        return pdfSize;
+    public List<SysConfigResult> getResult() {
+        return result;
     }
 
-    public void setPdfSize(List<String> pdfSize) {
-        this.pdfSize = pdfSize;
+    public void setResult(List<SysConfigResult> result) {
+        this.result = result;
     }
 }

+ 1 - 1
distributed-print-business/src/main/java/com/qmth/distributed/print/business/util/PdfUtil.java

@@ -199,7 +199,7 @@ public class PdfUtil {
         CommonCacheService commonCacheService = SpringContextHolder.getBean(CommonCacheService.class);
         SysConfig sysConfig = commonCacheService.addSysConfigCache(schoolId, SystemConstant.PDF_SIZE_LIST);
         sysConfig = Objects.isNull(sysConfig) ? commonCacheService.addSysConfigCache(SystemConstant.SYS_PDF_SIZE_LIST) : sysConfig;
-        Optional.ofNullable(sysConfig).orElseThrow(() -> ExceptionResultEnum.ERROR.exception("未配置全局pdf格式清单"));
+        Optional.ofNullable(sysConfig).orElseThrow(() -> ExceptionResultEnum.ERROR.exception("未配置全局上传试卷规格"));
 
         String pdfSize = sysConfig.getConfigValue().replace("8K", "K8");
         List<String> pdfSizeList = Objects.nonNull(sysConfig) ? Arrays.asList(pdfSize.replaceAll("\\[", "").replaceAll("\\]", "").split(", ")) : null;

+ 65 - 74
distributed-print/src/main/java/com/qmth/distributed/print/api/SysAdminSetController.java

@@ -1,6 +1,5 @@
 package com.qmth.distributed.print.api;
 
-import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.qmth.boot.api.constant.ApiConstant;
 import com.qmth.distributed.print.business.backup.MySQLDatabaseBackup;
@@ -8,6 +7,7 @@ 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.SysAdminSetResult;
 import com.qmth.teachcloud.common.bean.dto.PrivilegeDto;
+import com.qmth.teachcloud.common.bean.result.SysConfigResult;
 import com.qmth.teachcloud.common.contant.SystemConstant;
 import com.qmth.teachcloud.common.entity.*;
 import com.qmth.teachcloud.common.enums.ExceptionResultEnum;
@@ -85,26 +85,26 @@ public class SysAdminSetController {
         SysConfig sysConfigQuestionHostUrl = commonCacheService.addSysConfigCache(schoolId, SystemConstant.QUESTION_HOST_URL);
         SysConfig sysConfigCloudmarkHostUrl = commonCacheService.addSysConfigCache(schoolId, SystemConstant.CLOUDMARK_HOST_URL);
         SysConfig sysConfigTeachcloudReportHostUrl = commonCacheService.addSysConfigCache(schoolId, SystemConstant.TEACHCLOUD_REPORT_HOST_URL);
-        JSONObject jsonObject = new JSONObject();
 
+        List<SysConfigResult> sysConfigResultList = new ArrayList<>();
         if (Objects.nonNull(sysConfigQuestionHostUrl)) {
-            jsonObject.put(SystemConstant.QUESTION_HOST_URL, sysConfigQuestionHostUrl.getConfigValue());
+            sysConfigResultList.add(new SysConfigResult(sysConfigQuestionHostUrl));
         } else {
-            jsonObject.put(SystemConstant.QUESTION_HOST_URL, "");
+            sysConfigResultList.add(new SysConfigResult(null, SystemConstant.QUESTION_HOST_URL, "题库地址", "", 1));
         }
 
         if (Objects.nonNull(sysConfigCloudmarkHostUrl)) {
-            jsonObject.put(SystemConstant.CLOUDMARK_HOST_URL, sysConfigCloudmarkHostUrl.getConfigValue());
+            sysConfigResultList.add(new SysConfigResult(sysConfigCloudmarkHostUrl));
         } else {
-            jsonObject.put(SystemConstant.CLOUDMARK_HOST_URL, "");
+            sysConfigResultList.add(new SysConfigResult(null, SystemConstant.CLOUDMARK_HOST_URL, "云阅卷地址", "", 2));
         }
 
         if (Objects.nonNull(sysConfigTeachcloudReportHostUrl)) {
-            jsonObject.put(SystemConstant.TEACHCLOUD_REPORT_HOST_URL, sysConfigTeachcloudReportHostUrl.getConfigValue());
+            sysConfigResultList.add(new SysConfigResult(sysConfigTeachcloudReportHostUrl));
         } else {
-            jsonObject.put(SystemConstant.TEACHCLOUD_REPORT_HOST_URL, "");
+            sysConfigResultList.add(new SysConfigResult(null, SystemConstant.TEACHCLOUD_REPORT_HOST_URL, "教研分析地址", "", 3));
         }
-        return ResultUtil.ok(new SysAdminSetResult(schoolId, jsonObject.toString()));
+        return ResultUtil.ok(new SysAdminSetResult(schoolId, sysConfigResultList));
     }
 
     @ApiOperation(value = "同步配置保存")
@@ -115,33 +115,18 @@ public class SysAdminSetController {
         if (bindingResult.hasErrors()) {
             return ResultUtil.error(bindingResult.getAllErrors().get(0).getDefaultMessage());
         }
-        Optional.ofNullable(sysAdminSetParam.getSyncServicePaths()).orElseThrow(() -> ExceptionResultEnum.PARAMS_ERROR.exception("同步配置地址不能为空"));
+        Optional.ofNullable(sysAdminSetParam.getParam()).orElseThrow(() -> ExceptionResultEnum.PARAMS_ERROR.exception("同步配置地址不能为空"));
 
-        SysConfig sysConfigQuestionHostUrl = commonCacheService.addSysConfigCache(sysAdminSetParam.getSchoolId(), SystemConstant.QUESTION_HOST_URL);
-        SysConfig sysConfigCloudmarkHostUrl = commonCacheService.addSysConfigCache(sysAdminSetParam.getSchoolId(), SystemConstant.CLOUDMARK_HOST_URL);
-        SysConfig sysConfigTeachcloudReportHostUrl = commonCacheService.addSysConfigCache(sysAdminSetParam.getSchoolId(), SystemConstant.TEACHCLOUD_REPORT_HOST_URL);
-        JSONObject jsonObject = JSONObject.parseObject(sysAdminSetParam.getSyncServicePaths());
-
-        if (Objects.isNull(sysConfigQuestionHostUrl)) {
-            sysConfigQuestionHostUrl = new SysConfig(sysAdminSetParam.getSchoolId(), SystemConstant.QUESTION_HOST_URL, "题库地址", jsonObject.getString(SystemConstant.QUESTION_HOST_URL));
-        } else {
-            sysConfigQuestionHostUrl.setConfigValue(jsonObject.getString(SystemConstant.QUESTION_HOST_URL));
-        }
-        if (Objects.isNull(sysConfigCloudmarkHostUrl)) {
-            sysConfigCloudmarkHostUrl = new SysConfig(sysAdminSetParam.getSchoolId(), SystemConstant.CLOUDMARK_HOST_URL, "云阅卷地址", jsonObject.getString(SystemConstant.CLOUDMARK_HOST_URL));
-        } else {
-            sysConfigCloudmarkHostUrl.setConfigValue(jsonObject.getString(SystemConstant.CLOUDMARK_HOST_URL));
-        }
-        if (Objects.isNull(sysConfigTeachcloudReportHostUrl)) {
-            sysConfigTeachcloudReportHostUrl = new SysConfig(sysAdminSetParam.getSchoolId(), SystemConstant.TEACHCLOUD_REPORT_HOST_URL, "教研分析地址", jsonObject.getString(SystemConstant.TEACHCLOUD_REPORT_HOST_URL));
-        } else {
-            sysConfigTeachcloudReportHostUrl.setConfigValue(jsonObject.getString(SystemConstant.TEACHCLOUD_REPORT_HOST_URL));
+        List<SysConfigResult> sysConfigResultList = sysAdminSetParam.getParam();
+        List<SysConfig> sysConfigList = new ArrayList<>();
+        for (SysConfigResult s : sysConfigResultList) {
+            sysConfigList.add(new SysConfig(sysAdminSetParam.getSchoolId(), s));
         }
-        sysConfigService.saveOrUpdateBatch(Arrays.asList(sysConfigQuestionHostUrl, sysConfigCloudmarkHostUrl, sysConfigTeachcloudReportHostUrl));
+        sysConfigService.saveOrUpdateBatch(sysConfigList);
 
-        commonCacheService.updateSysConfigCache(sysAdminSetParam.getSchoolId(), SystemConstant.QUESTION_HOST_URL);
-        commonCacheService.updateSysConfigCache(sysAdminSetParam.getSchoolId(), SystemConstant.CLOUDMARK_HOST_URL);
-        commonCacheService.updateSysConfigCache(sysAdminSetParam.getSchoolId(), SystemConstant.TEACHCLOUD_REPORT_HOST_URL);
+        for (SysConfigResult s : sysConfigResultList) {
+            commonCacheService.updateSysConfigCache(sysAdminSetParam.getSchoolId(), s.getCode());
+        }
         return ResultUtil.ok(true);
     }
 
@@ -150,10 +135,12 @@ public class SysAdminSetController {
     @RequestMapping(value = "/paper/sys/select", method = RequestMethod.POST)
     public Result sysadminPaperSysSelect() {
         SysConfig sysConfig = commonCacheService.addSysConfigCache(SystemConstant.SYS_PDF_SIZE_LIST);
-        Optional.ofNullable(sysConfig).orElseThrow(() -> ExceptionResultEnum.ERROR.exception("未配置全局pdf格式清单"));
-        CustomPrivilegeResult customPrivilegeResult = new CustomPrivilegeResult();
-        customPrivilegeResult.setSysPdfSize(Arrays.asList(sysConfig.getConfigValue().replaceAll("\\[", "").replaceAll("\\]", "").split(", ")));
-        return ResultUtil.ok(customPrivilegeResult);
+        Optional.ofNullable(sysConfig).orElseThrow(() -> ExceptionResultEnum.ERROR.exception("未配置全局上传试卷规格"));
+        SysAdminSetResult sysAdminSetResult = new SysAdminSetResult();
+        SysConfigResult sysConfigResult = new SysConfigResult(sysConfig);
+        sysConfigResult.setValue(Arrays.asList(sysConfigResult.getValue().toString().replaceAll("\\[", "").replaceAll("\\]", "").split(", ")));
+        sysAdminSetResult.setResult(Arrays.asList(sysConfigResult));
+        return ResultUtil.ok(sysAdminSetResult);
     }
 
     @ApiOperation(value = "试卷规格配置查询")
@@ -162,12 +149,16 @@ public class SysAdminSetController {
     public Result sysadminPaperSelect(@ApiParam(value = "学校id ", required = true) @RequestParam Long schoolId) {
         SysConfig sysConfigPdfSize = commonCacheService.addSysConfigCache(schoolId, SystemConstant.PDF_SIZE_LIST);
         List<String> pdfSize = null;
+        SysConfigResult sysConfigResult = null;
         if (Objects.nonNull(sysConfigPdfSize)) {
             pdfSize = Arrays.asList(sysConfigPdfSize.getConfigValue().replaceAll("\\[", "").replaceAll("\\]", "").split(", "));
+            sysConfigResult = new SysConfigResult(sysConfigPdfSize);
+            sysConfigResult.setValue(pdfSize);
+        } else {
+            sysConfigResult = new SysConfigResult(null, SystemConstant.PDF_SIZE_LIST, "允许上传试卷规格", new ArrayList<>(), 1);
         }
-        SysAdminSetResult sysAdminSetResult = new SysAdminSetResult();
-        sysAdminSetResult.setSchoolId(schoolId);
-        sysAdminSetResult.setPdfSize(CollectionUtils.isEmpty(pdfSize) ? new ArrayList<>() : pdfSize);
+        SysAdminSetResult sysAdminSetResult = new SysAdminSetResult(schoolId);
+        sysAdminSetResult.setResult(Arrays.asList(sysConfigResult));
         return ResultUtil.ok(sysAdminSetResult);
     }
 
@@ -179,21 +170,20 @@ public class SysAdminSetController {
         if (bindingResult.hasErrors()) {
             return ResultUtil.error(bindingResult.getAllErrors().get(0).getDefaultMessage());
         }
-        Optional.ofNullable(sysAdminSetParam.getPdfSize()).orElseThrow(() -> ExceptionResultEnum.PARAMS_ERROR.exception("试卷规格配置不能为空"));
+        Optional.ofNullable(sysAdminSetParam.getParam()).orElseThrow(() -> ExceptionResultEnum.PARAMS_ERROR.exception("试卷规格配置不能为空"));
 
-        SysConfig sysConfigPdfSize = commonCacheService.addSysConfigCache(sysAdminSetParam.getSchoolId(), SystemConstant.PDF_SIZE_LIST);
-        if (Objects.isNull(sysConfigPdfSize)) {
-            sysConfigPdfSize = new SysConfig(sysAdminSetParam.getSchoolId(), SystemConstant.PDF_SIZE_LIST, "pdf格式清单", Arrays.asList(sysAdminSetParam.getPdfSize()).toString());
-        } else {
-            if (Objects.nonNull(sysAdminSetParam.getPdfSize()) && sysAdminSetParam.getPdfSize().length > 0) {
-                sysConfigPdfSize.setConfigValue(Arrays.asList(sysAdminSetParam.getPdfSize()).toString());
-            } else {
-                sysConfigPdfSize.setConfigValue(null);
-            }
+        List<SysConfigResult> sysConfigResultList = sysAdminSetParam.getParam();
+        List<SysConfig> sysConfigList = new ArrayList<>();
+        for (SysConfigResult s : sysConfigResultList) {
+            SysConfig sysConfig = new SysConfig(sysAdminSetParam.getSchoolId(), s);
+            sysConfig.setConfigValue(Arrays.asList(s.getValue().toString().replaceAll("\\[", "").replaceAll("\\]", "").split(", ")).toString());
+            sysConfigList.add(sysConfig);
         }
-        sysConfigService.saveOrUpdate(sysConfigPdfSize);
+        sysConfigService.saveOrUpdateBatch(sysConfigList);
 
-        commonCacheService.updateSysConfigCache(sysAdminSetParam.getSchoolId(), SystemConstant.PDF_SIZE_LIST);
+        for (SysConfigResult s : sysConfigResultList) {
+            commonCacheService.updateSysConfigCache(sysAdminSetParam.getSchoolId(), s.getCode());
+        }
         return ResultUtil.ok(true);
     }
 
@@ -203,7 +193,18 @@ public class SysAdminSetController {
     public Result sysadminUserSelect(@ApiParam(value = "学校id ", required = true) @RequestParam Long schoolId) {
         SysConfig sysConfigAccount = commonCacheService.addSysConfigCache(schoolId, SystemConstant.ACCOUNT_SMS_VERIFY);
         SysConfig sysConfigTeachcloudExchangeHostUrl = commonCacheService.addSysConfigCache(schoolId, SystemConstant.TEACHCLOUD_EXCHANGE_HOST_URL);
-        return ResultUtil.ok(new SysAdminSetResult(schoolId, Objects.nonNull(sysConfigAccount) ? Boolean.valueOf(sysConfigAccount.getConfigValue()) : false, Objects.nonNull(sysConfigTeachcloudExchangeHostUrl) ? sysConfigTeachcloudExchangeHostUrl.getConfigValue() : ""));
+        List<SysConfigResult> sysConfigResultList = new ArrayList<>();
+        if (Objects.nonNull(sysConfigAccount)) {
+            sysConfigResultList.add(new SysConfigResult(sysConfigAccount));
+        } else {
+            sysConfigResultList.add(new SysConfigResult(null, SystemConstant.ACCOUNT_SMS_VERIFY, "用户/密码模式是否开启短信验证", false, 1));
+        }
+        if (Objects.nonNull(sysConfigTeachcloudExchangeHostUrl)) {
+            sysConfigResultList.add(new SysConfigResult(sysConfigTeachcloudExchangeHostUrl));
+        } else {
+            sysConfigResultList.add(new SysConfigResult(null, SystemConstant.TEACHCLOUD_EXCHANGE_HOST_URL, "第三方统一身份认证", "", 2));
+        }
+        return ResultUtil.ok(new SysAdminSetResult(schoolId, sysConfigResultList));
     }
 
     @ApiOperation(value = "用户验证保存")
@@ -214,29 +215,18 @@ public class SysAdminSetController {
         if (bindingResult.hasErrors()) {
             return ResultUtil.error(bindingResult.getAllErrors().get(0).getDefaultMessage());
         }
-        Optional.ofNullable(sysAdminSetParam.getAccountSmsVerify()).orElseThrow(() -> ExceptionResultEnum.PARAMS_ERROR.exception("用户/密码模式是否开启不能为空"));
-        Optional.ofNullable(sysAdminSetParam.getTeachcloudExchangeHostUrl()).orElseThrow(() -> ExceptionResultEnum.PARAMS_ERROR.exception("第三方统一身份认证不能为空"));
+        Optional.ofNullable(sysAdminSetParam.getParam()).orElseThrow(() -> ExceptionResultEnum.PARAMS_ERROR.exception("用户/密码模式是否开启不能为空"));
 
+        List<SysConfigResult> sysConfigResultList = sysAdminSetParam.getParam();
         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 sysConfigTeachcloudExchangeHostUrl = commonCacheService.addSysConfigCache(sysAdminSetParam.getSchoolId(), SystemConstant.TEACHCLOUD_EXCHANGE_HOST_URL);
-        if (Objects.isNull(sysConfigTeachcloudExchangeHostUrl)) {
-            sysConfigTeachcloudExchangeHostUrl = new SysConfig(sysAdminSetParam.getSchoolId(), SystemConstant.TEACHCLOUD_EXCHANGE_HOST_URL, "第三方统一身份认证", sysAdminSetParam.getTeachcloudExchangeHostUrl());
-        } else {
-            sysConfigTeachcloudExchangeHostUrl.setConfigValue(sysAdminSetParam.getTeachcloudExchangeHostUrl());
+        for (SysConfigResult s : sysConfigResultList) {
+            sysConfigList.add(new SysConfig(sysAdminSetParam.getSchoolId(), s));
         }
-        sysConfigList.add(sysConfigTeachcloudExchangeHostUrl);
         sysConfigService.saveOrUpdateBatch(sysConfigList);
 
-        commonCacheService.updateSysConfigCache(sysAdminSetParam.getSchoolId(), SystemConstant.ACCOUNT_SMS_VERIFY);
-        commonCacheService.updateSysConfigCache(sysAdminSetParam.getSchoolId(), SystemConstant.TEACHCLOUD_EXCHANGE_HOST_URL);
+        for (SysConfigResult s : sysConfigResultList) {
+            commonCacheService.updateSysConfigCache(sysAdminSetParam.getSchoolId(), s.getCode());
+        }
         return ResultUtil.ok(true);
     }
 
@@ -320,7 +310,9 @@ public class SysAdminSetController {
     public Result getSchoolPrivileges(@ApiParam(value = "学校id ", required = true) @RequestParam Long schoolId) {
         List<TSchoolPrivilege> tSchoolPrivilegeList = tSchoolPrivilegeService.findBySchoolId(schoolId);
         List<String> privilegeIdList = tSchoolPrivilegeList.stream().map(s -> String.valueOf(s.getPrivilegeId())).collect(Collectors.toList());
-        return ResultUtil.ok(new SysAdminSetResult(schoolId, CollectionUtils.isEmpty(privilegeIdList) ? new ArrayList<>() : privilegeIdList));
+        SysAdminSetResult sysAdminSetResult = new SysAdminSetResult(schoolId);
+        sysAdminSetResult.setPrivilegeIdList(CollectionUtils.isEmpty(privilegeIdList) ? new ArrayList<>() : privilegeIdList);
+        return ResultUtil.ok(sysAdminSetResult);
     }
 
     @ApiOperation(value = "查询自定义角色权限")
@@ -396,8 +388,7 @@ public class SysAdminSetController {
     public Result getSchoolRoles(@ApiParam(value = "学校id ", required = true) @RequestParam Long schoolId) {
         List<TSchoolRole> tSchoolRoleList = tSchoolRoleService.findBySchoolId(schoolId);
         List<String> roleIdList = tSchoolRoleList.stream().map(s -> String.valueOf(s.getRoleId())).collect(Collectors.toList());
-        SysAdminSetResult sysAdminSetResult = new SysAdminSetResult();
-        sysAdminSetResult.setSchoolId(schoolId);
+        SysAdminSetResult sysAdminSetResult = new SysAdminSetResult(schoolId);
         sysAdminSetResult.setRoleIdList(CollectionUtils.isEmpty(roleIdList) ? new ArrayList<>() : roleIdList);
         return ResultUtil.ok(sysAdminSetResult);
     }

+ 108 - 0
teachcloud-common/src/main/java/com/qmth/teachcloud/common/bean/result/SysConfigResult.java

@@ -0,0 +1,108 @@
+package com.qmth.teachcloud.common.bean.result;
+
+import com.fasterxml.jackson.databind.annotation.JsonSerialize;
+import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
+import com.qmth.teachcloud.common.entity.SysConfig;
+import io.swagger.annotations.ApiModelProperty;
+
+import java.io.Serializable;
+
+/**
+ * @Description: 系统参数result
+ * @Param:
+ * @return:
+ * @Author: wangliang
+ * @Date: 2022/11/30
+ */
+public class SysConfigResult implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    @JsonSerialize(using = ToStringSerializer.class)
+    @ApiModelProperty(value = "主键")
+    private Long id;
+
+    @ApiModelProperty(value = "参数编码")
+    private String code;
+
+    @ApiModelProperty(value = "参数名称")
+    private String name;
+
+    @ApiModelProperty(value = "参数值")
+    private Object value;
+
+    @ApiModelProperty(value = "启用/禁用,ture:启用,false:禁用,默认启用")
+    private Boolean enable = true;
+
+    @ApiModelProperty(value = "排序")
+    private Integer sort = 1;
+
+    public SysConfigResult() {
+
+    }
+
+    public SysConfigResult(Long id, String code, String name, Object value, Integer sort) {
+        this.id = id;
+        this.code = code;
+        this.name = name;
+        this.value = value;
+        this.sort = sort;
+    }
+
+    public SysConfigResult(SysConfig sysConfig) {
+        this.id = sysConfig.getId();
+        this.code = sysConfig.getConfigKey();
+        this.name = sysConfig.getConfigName();
+        this.value = sysConfig.getConfigValue();
+        this.enable = sysConfig.getEnable();
+        this.sort = sysConfig.getSort();
+    }
+
+    public Long getId() {
+        return id;
+    }
+
+    public void setId(Long id) {
+        this.id = id;
+    }
+
+    public String getCode() {
+        return code;
+    }
+
+    public void setCode(String code) {
+        this.code = code;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public Object getValue() {
+        return value;
+    }
+
+    public void setValue(Object value) {
+        this.value = value;
+    }
+
+    public Boolean getEnable() {
+        return enable;
+    }
+
+    public void setEnable(Boolean enable) {
+        this.enable = enable;
+    }
+
+    public Integer getSort() {
+        return sort;
+    }
+
+    public void setSort(Integer sort) {
+        this.sort = sort;
+    }
+}

+ 40 - 0
teachcloud-common/src/main/java/com/qmth/teachcloud/common/entity/SysConfig.java

@@ -6,10 +6,12 @@ import com.baomidou.mybatisplus.annotation.TableName;
 import com.fasterxml.jackson.databind.annotation.JsonSerialize;
 import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
 import com.qmth.teachcloud.common.base.BaseEntity;
+import com.qmth.teachcloud.common.bean.result.SysConfigResult;
 import com.qmth.teachcloud.common.contant.SystemConstant;
 import io.swagger.annotations.ApiModelProperty;
 
 import java.io.Serializable;
+import java.util.Objects;
 
 /**
  * <p>
@@ -53,10 +55,32 @@ public class SysConfig extends BaseEntity implements Serializable {
 
     private String remark;
 
+    @ApiModelProperty(value = "启用/禁用,ture:启用,false:禁用,默认启用")
+    private Boolean enable = true;
+
+    @ApiModelProperty(value = "排序")
+    private Integer sort = 1;
+
     public SysConfig() {
 
     }
 
+    public SysConfig(Long schoolId, SysConfigResult sysConfigResult) {
+        if (Objects.isNull(sysConfigResult.getId())) {
+            setId(SystemConstant.getDbUuid());
+        } else {
+            setId(sysConfigResult.getId());
+        }
+        this.schoolId = schoolId;
+        this.configKey = sysConfigResult.getCode();
+        this.configName = sysConfigResult.getName();
+        this.configValue = String.valueOf(sysConfigResult.getValue());
+        this.enable = sysConfigResult.getEnable();
+        this.sort = sysConfigResult.getSort();
+        setCreateId(1L);
+        setCreateTime(System.currentTimeMillis());
+    }
+
     public SysConfig(Long schoolId, String configKey, String configName, String configValue) {
         setId(SystemConstant.getDbUuid());
         this.schoolId = schoolId;
@@ -67,6 +91,22 @@ public class SysConfig extends BaseEntity implements Serializable {
         setCreateTime(System.currentTimeMillis());
     }
 
+    public Boolean getEnable() {
+        return enable;
+    }
+
+    public void setEnable(Boolean enable) {
+        this.enable = enable;
+    }
+
+    public Integer getSort() {
+        return sort;
+    }
+
+    public void setSort(Integer sort) {
+        this.sort = sort;
+    }
+
     public static long getSerialVersionUID() {
         return serialVersionUID;
     }