Browse Source

1.0.4 赋分

xiaofei 2 years ago
parent
commit
80fdcbc12a
51 changed files with 1804 additions and 1406 deletions
  1. 7 0
      src/main/java/com/qmth/eds/api/BasicSchoolController.java
  2. 1 1
      src/main/java/com/qmth/eds/api/EasyExcelController.java
  3. 85 0
      src/main/java/com/qmth/eds/api/ExamAssignController.java
  4. 52 0
      src/main/java/com/qmth/eds/api/SysSettingController.java
  5. 74 0
      src/main/java/com/qmth/eds/bean/dto/AssignListDto.java
  6. 47 0
      src/main/java/com/qmth/eds/bean/dto/syssetting/SettingObject.java
  7. 75 0
      src/main/java/com/qmth/eds/bean/dto/syssetting/SimpleObject.java
  8. 37 0
      src/main/java/com/qmth/eds/common/contant/SysSettingConstant.java
  9. 1 0
      src/main/java/com/qmth/eds/common/contant/SystemConstant.java
  10. 119 0
      src/main/java/com/qmth/eds/common/entity/ExamAssign.java
  11. 94 0
      src/main/java/com/qmth/eds/common/entity/SysSetting.java
  12. 2 1
      src/main/java/com/qmth/eds/common/enums/RoleTypeEnum.java
  13. 166 0
      src/main/java/com/qmth/eds/common/tools/CdutUtils.java
  14. 19 20
      src/main/java/com/qmth/eds/common/tools/CloudMarkingUtils.java
  15. 13 11
      src/main/java/com/qmth/eds/common/tools/WhuUtils.java
  16. 7 46
      src/main/java/com/qmth/eds/common/util/FileStoreUtil.java
  17. 6 7
      src/main/java/com/qmth/eds/core/auth/EdsAuthenticationService.java
  18. 5 49
      src/main/java/com/qmth/eds/core/config/DictionaryConfig.java
  19. 0 69
      src/main/java/com/qmth/eds/core/domain/CloudMarkingDomain.java
  20. 1 1
      src/main/java/com/qmth/eds/core/domain/FssDomain.java
  21. 0 26
      src/main/java/com/qmth/eds/core/domain/FssLocalFileDomain.java
  22. 0 34
      src/main/java/com/qmth/eds/core/domain/FssPrivateDomain.java
  23. 0 23
      src/main/java/com/qmth/eds/core/domain/PrefixUrlDomain.java
  24. 0 125
      src/main/java/com/qmth/eds/core/domain/SysDomain.java
  25. 0 49
      src/main/java/com/qmth/eds/core/domain/WhuDomain.java
  26. 18 0
      src/main/java/com/qmth/eds/mapper/ExamAssignMapper.java
  27. 13 0
      src/main/java/com/qmth/eds/mapper/SysSettingMapper.java
  28. 5 3
      src/main/java/com/qmth/eds/service/AsyncTaskService.java
  29. 3 0
      src/main/java/com/qmth/eds/service/BasicSchoolService.java
  30. 29 0
      src/main/java/com/qmth/eds/service/CdutDataSyncService.java
  31. 14 0
      src/main/java/com/qmth/eds/service/CommonCacheService.java
  32. 10 150
      src/main/java/com/qmth/eds/service/CommonService.java
  33. 26 0
      src/main/java/com/qmth/eds/service/ExamAssignService.java
  34. 2 0
      src/main/java/com/qmth/eds/service/ExamSyncTotalService.java
  35. 23 0
      src/main/java/com/qmth/eds/service/SysSettingService.java
  36. 2 2
      src/main/java/com/qmth/eds/service/WhuDataSyncService.java
  37. 1 27
      src/main/java/com/qmth/eds/service/impl/AuthInfoServiceImpl.java
  38. 26 0
      src/main/java/com/qmth/eds/service/impl/BasicSchoolServiceImpl.java
  39. 504 0
      src/main/java/com/qmth/eds/service/impl/CdutDataSyncServiceImpl.java
  40. 5 3
      src/main/java/com/qmth/eds/service/impl/CloudMarkingExamServiceImpl.java
  41. 32 5
      src/main/java/com/qmth/eds/service/impl/CommonCacheServiceImpl.java
  42. 20 676
      src/main/java/com/qmth/eds/service/impl/CommonServiceImpl.java
  43. 64 0
      src/main/java/com/qmth/eds/service/impl/ExamAssignServiceImpl.java
  44. 9 0
      src/main/java/com/qmth/eds/service/impl/ExamSyncTotalServiceImpl.java
  45. 88 0
      src/main/java/com/qmth/eds/service/impl/SysSettingServiceImpl.java
  46. 0 1
      src/main/java/com/qmth/eds/service/impl/TeachcloudCommonServiceImpl.java
  47. 11 11
      src/main/java/com/qmth/eds/service/impl/WhuDataSyncServiceImpl.java
  48. 13 62
      src/main/resources/application.properties
  49. 46 0
      src/main/resources/db/log/log-1.0.4.sql
  50. 25 0
      src/main/resources/mapper/ExamAssignMapper.xml
  51. 4 4
      src/test/java/com/qmth/eds/WhuTest.java

+ 7 - 0
src/main/java/com/qmth/eds/api/BasicSchoolController.java

@@ -7,6 +7,7 @@ import com.qmth.eds.service.BasicSchoolService;
 import io.swagger.annotations.ApiOperation;
 import io.swagger.annotations.ApiOperation;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.RestController;
 import org.springframework.web.bind.annotation.RestController;
 
 
 import javax.annotation.Resource;
 import javax.annotation.Resource;
@@ -32,4 +33,10 @@ public class BasicSchoolController {
         return ResultUtil.ok(basicSchoolService.list());
         return ResultUtil.ok(basicSchoolService.list());
     }
     }
 
 
+    @ApiOperation(value = "查询(根据用户查询学校列表)")
+    @PostMapping("/list_by_user")
+    public Result listByUser(@RequestParam String loginName) {
+        return ResultUtil.ok(basicSchoolService.listByUser(loginName));
+    }
+
 }
 }

+ 1 - 1
src/main/java/com/qmth/eds/api/EasyExcelController.java

@@ -40,7 +40,7 @@ import java.util.Objects;
  */
  */
 @Api(tags = "easyExcelController")
 @Api(tags = "easyExcelController")
 @RestController
 @RestController
-@RequestMapping("/${prefix.url.common}")
+@RequestMapping("/common")
 @Aac(auth = BOOL.FALSE)
 @Aac(auth = BOOL.FALSE)
 public class EasyExcelController {
 public class EasyExcelController {
     private final static Logger log = LoggerFactory.getLogger(EasyExcelController.class);
     private final static Logger log = LoggerFactory.getLogger(EasyExcelController.class);

+ 85 - 0
src/main/java/com/qmth/eds/api/ExamAssignController.java

@@ -0,0 +1,85 @@
+package com.qmth.eds.api;
+
+
+import com.qmth.boot.api.constant.ApiConstant;
+import com.qmth.eds.bean.dto.syssetting.SettingObject;
+import com.qmth.eds.bean.result.EditResult;
+import com.qmth.eds.common.contant.SystemConstant;
+import com.qmth.eds.common.util.Result;
+import com.qmth.eds.common.util.ResultUtil;
+import com.qmth.eds.service.ExamAssignService;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiResponse;
+import io.swagger.annotations.ApiResponses;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.*;
+
+import javax.annotation.Resource;
+import javax.validation.constraints.Max;
+import javax.validation.constraints.Min;
+import java.util.List;
+
+/**
+ * <p>
+ * 赋分管理 前端控制器
+ * </p>
+ */
+@Api(tags = "赋分管理controller")
+@RestController
+@RequestMapping(ApiConstant.DEFAULT_URI_PREFIX + "/assign")
+@Validated
+public class ExamAssignController {
+
+    @Resource
+    private ExamAssignService examAssignService;
+
+    @ApiOperation(value = "分页查询")
+    @PostMapping("/page")
+    @ApiResponses({@ApiResponse(code = 200, message = "查询成功", response = Result.class)})
+    public Result pageData(@RequestParam(value = "semesterId", required = false) Long semesterId,
+                           @RequestParam(value = "examTypeId", required = false) Long examTypeId,
+                           @RequestParam(value = "courseCode", required = false) String courseCode,
+                           @RequestParam @Min(SystemConstant.PAGE_NUMBER_MIN) Integer pageNumber,
+                           @RequestParam @Min(SystemConstant.PAGE_SIZE_MIN) @Max(SystemConstant.PAGE_SIZE_MAX) Integer pageSize) {
+        return ResultUtil.ok(examAssignService.pageData(semesterId, examTypeId, courseCode, pageNumber, pageSize));
+    }
+
+
+    @ApiOperation(value = "计算")
+    @PostMapping("/calc")
+    @ApiResponses({@ApiResponse(code = 200, message = "保存/更新成功", response = EditResult.class)})
+    public Result save(@RequestParam(value = "semesterId", required = false) Long semesterId,
+                       @RequestParam(value = "examTypeId", required = false) Long examTypeId,
+                       @RequestParam(value = "courseCode", required = false) String courseCode,
+                       @RequestParam(value = "courseName", required = false) String courseName,
+                       @RequestParam(value = "formula", required = false) String formula,
+                       @RequestParam(value = "fullScore", required = false) Double fullScore,
+                       @RequestParam(value = "passScore", required = false) Double passScore,
+                       @RequestParam(value = "coefficient", required = false) String coefficient) {
+        return ResultUtil.ok(examAssignService.calcData(semesterId, examTypeId, courseCode, courseName, formula, fullScore, passScore, coefficient));
+    }
+
+    @ApiOperation(value = "计算结果查询")
+    @PostMapping("/result")
+    @ApiResponses({@ApiResponse(code = 200, message = "保存/更新成功", response = EditResult.class)})
+    public Result result(@RequestParam(value = "semesterId", required = false) Long semesterId,
+                         @RequestParam(value = "examTypeId", required = false) Long examTypeId,
+                         @RequestParam(value = "courseCode", required = false) String courseCode,
+                         @RequestParam(value = "courseName", required = false) String courseName,
+                         @RequestParam(value = "formula", required = false) String formula,
+                         @RequestParam(value = "fullScore", required = false) Double fullScore,
+                         @RequestParam @Min(SystemConstant.PAGE_NUMBER_MIN) Integer pageNumber,
+                         @RequestParam @Min(SystemConstant.PAGE_SIZE_MIN) @Max(SystemConstant.PAGE_SIZE_MAX) Integer pageSize) {
+        return ResultUtil.ok(examAssignService.result(semesterId, examTypeId, courseCode, courseName, formula, fullScore, pageNumber, pageSize));
+    }
+
+    @ApiOperation(value = "计算结果对比")
+    @PostMapping("/contrast")
+    @ApiResponses({@ApiResponse(code = 200, message = "保存/更新成功", response = EditResult.class)})
+    public Result contrast(@RequestParam(value = "semesterId", required = false) Long semesterId,
+                           @RequestParam(value = "examTypeId", required = false) Long examTypeId,
+                           @RequestParam(value = "courseCode", required = false) String courseCode) {
+        return ResultUtil.ok(examAssignService.contrast(semesterId, examTypeId, courseCode));
+    }
+}

+ 52 - 0
src/main/java/com/qmth/eds/api/SysSettingController.java

@@ -0,0 +1,52 @@
+package com.qmth.eds.api;
+
+
+import com.qmth.boot.api.constant.ApiConstant;
+import com.qmth.eds.bean.dto.syssetting.SettingObject;
+import com.qmth.eds.bean.result.EditResult;
+import com.qmth.eds.common.util.Result;
+import com.qmth.eds.common.util.ResultUtil;
+import com.qmth.eds.service.SysSettingService;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiResponse;
+import io.swagger.annotations.ApiResponses;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import javax.annotation.Resource;
+import java.util.List;
+
+/**
+ * <p>
+ * 系统设置 前端控制器
+ * </p>
+ */
+@Api(tags = "系统设置controller")
+@RestController
+@RequestMapping(ApiConstant.DEFAULT_URI_PREFIX + "/sys_setting")
+@Validated
+public class SysSettingController {
+
+    @Resource
+    private SysSettingService sysSettingService;
+
+    @ApiOperation(value = "查询")
+    @PostMapping("/get")
+    @ApiResponses({@ApiResponse(code = 200, message = "查询成功", response = Result.class)})
+    public Result getData() {
+        return ResultUtil.ok(sysSettingService.getData());
+    }
+
+
+    @ApiOperation(value = "新增/修改")
+    @PostMapping("/save")
+    @ApiResponses({@ApiResponse(code = 200, message = "保存/更新成功", response = EditResult.class)})
+    public Result save(@RequestBody List<SettingObject> simpleObjectList) {
+        return ResultUtil.ok(sysSettingService.saveData(simpleObjectList));
+    }
+
+}

+ 74 - 0
src/main/java/com/qmth/eds/bean/dto/AssignListDto.java

@@ -0,0 +1,74 @@
+package com.qmth.eds.bean.dto;
+
+public class AssignListDto {
+
+    private Long schoolId;
+
+    private Long semesterId;
+
+    private Long examTypeId;
+
+    private String courseCode;
+
+    private String courseName;
+
+    private String kkxy;
+
+    private String actualCount;
+
+    public Long getSchoolId() {
+        return schoolId;
+    }
+
+    public void setSchoolId(Long schoolId) {
+        this.schoolId = schoolId;
+    }
+
+    public Long getSemesterId() {
+        return semesterId;
+    }
+
+    public void setSemesterId(Long semesterId) {
+        this.semesterId = semesterId;
+    }
+
+    public Long getExamTypeId() {
+        return examTypeId;
+    }
+
+    public void setExamTypeId(Long examTypeId) {
+        this.examTypeId = examTypeId;
+    }
+
+    public String getCourseCode() {
+        return courseCode;
+    }
+
+    public void setCourseCode(String courseCode) {
+        this.courseCode = courseCode;
+    }
+
+    public String getCourseName() {
+        return courseName;
+    }
+
+    public void setCourseName(String courseName) {
+        this.courseName = courseName;
+    }
+
+    public String getKkxy() {
+        return kkxy;
+    }
+
+    public void setKkxy(String kkxy) {
+        this.kkxy = kkxy;
+    }
+
+    public String getActualCount() {
+        return actualCount;
+    }
+
+    public void setActualCount(String actualCount) {
+        this.actualCount = actualCount;
+    }
+}

+ 47 - 0
src/main/java/com/qmth/eds/bean/dto/syssetting/SettingObject.java

@@ -0,0 +1,47 @@
+package com.qmth.eds.bean.dto.syssetting;
+
+import java.util.List;
+
+public class SettingObject {
+
+    private String name;
+
+    private int sort;
+
+    private List<SimpleObject> data;
+
+    public SettingObject() {
+    }
+
+    public SettingObject(String name, int sort, List<SimpleObject> data) {
+        this.name = name;
+        this.sort = sort;
+        this.data = data;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public int getSort() {
+        return sort;
+    }
+
+    public void setSort(int sort) {
+        this.sort = sort;
+    }
+
+    public List<SimpleObject> getData() {
+        return data;
+    }
+
+    public void setData(List<SimpleObject> data) {
+        this.data = data;
+    }
+
+
+}

+ 75 - 0
src/main/java/com/qmth/eds/bean/dto/syssetting/SimpleObject.java

@@ -0,0 +1,75 @@
+package com.qmth.eds.bean.dto.syssetting;
+
+public class SimpleObject {
+    private String code;
+
+    private String value;
+
+    private String name;
+
+    private String type;
+
+    private int sort;
+
+    private boolean enable;
+
+    public SimpleObject() {
+    }
+
+    public SimpleObject(String code, String name, String value, String type, int sort, boolean enable) {
+        this.code = code;
+        this.name = name;
+        this.value = value;
+        this.type = type;
+        this.sort = sort;
+        this.enable = enable;
+    }
+
+    public String getCode() {
+        return code;
+    }
+
+    public void setCode(String code) {
+        this.code = code;
+    }
+
+    public String getValue() {
+        return value;
+    }
+
+    public void setValue(String value) {
+        this.value = value;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public String getType() {
+        return type;
+    }
+
+    public void setType(String type) {
+        this.type = type;
+    }
+
+    public int getSort() {
+        return sort;
+    }
+
+    public void setSort(int sort) {
+        this.sort = sort;
+    }
+
+    public boolean isEnable() {
+        return enable;
+    }
+
+    public void setEnable(boolean enable) {
+        this.enable = enable;
+    }
+}

+ 37 - 0
src/main/java/com/qmth/eds/common/contant/SysSettingConstant.java

@@ -0,0 +1,37 @@
+package com.qmth.eds.common.contant;
+
+/**
+ * API常量
+ */
+public class SysSettingConstant {
+    /**
+     * 武汉大学参数
+     */
+    public static final String WHU_APP_KEY = "whuAppKey";
+    public static final String WHU_APP_SECRET = "whuAppSecret";
+    public static final String WHU_TOKEN_URL = "whuTokenUrl";
+    public static final String WHU_KW_URL = "whuKwUrl";
+
+    /**
+     * 成都理工大学参数
+     */
+    public static final String CDUT_APP_KEY = "cdutAppKey";
+    public static final String CDUT_APP_SECRET = "cdutAppSecret";
+    public static final String CDUT_TOKEN_URL = "cdutTokenUrl";
+    public static final String CDUT_KW_URL = "cdutKwUrl";
+
+    /**
+     * 云阅卷参数
+     */
+    public static final String CLOUD_MARKING_ACCESS_KEY = "cloudMarkingAccessKey";
+    public static final String CLOUD_MARKING_ACCESS_SECRET = "cloudMarkingAccessSecret";
+    public static final String CLOUD_MARKING_ROOT_URL = "cloudMarkingRootUrl";
+
+    // 云阅卷考试查询api
+    public static final String CLOUD_MARKING_EXAM_URL = "/api/exams";
+    // 云阅卷考生数量查询api
+    public static final String CLOUD_MARKING_STUDENT_COUNT_URL = "/api/exam/student/count";
+    // 云阅卷考生成绩查询api
+    public static final String CLOUD_MARKING_STUDENT_SCORE_URL = "/api/exam/student/score";
+
+}

+ 1 - 0
src/main/java/com/qmth/eds/common/contant/SystemConstant.java

@@ -96,6 +96,7 @@ public class SystemConstant {
     public static final String ROLE_PRIVILEGE_CACHE = "role:privilege:cache";
     public static final String ROLE_PRIVILEGE_CACHE = "role:privilege:cache";
     public static final String USER_ROLE_PRIVILEGE_CACHE = "user:role:privilege:cache";
     public static final String USER_ROLE_PRIVILEGE_CACHE = "user:role:privilege:cache";
     public static final String ROLE_CACHE = "role:cache";
     public static final String ROLE_CACHE = "role:cache";
+    public static final String SYS_SETTING_CACHE = "sys:setting:cache";
 
 
     /**
     /**
      * 鉴权
      * 鉴权

+ 119 - 0
src/main/java/com/qmth/eds/common/entity/ExamAssign.java

@@ -0,0 +1,119 @@
+package com.qmth.eds.common.entity;
+
+import com.fasterxml.jackson.databind.annotation.JsonSerialize;
+import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
+import com.qmth.eds.core.base.BaseEntity;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+
+import java.io.Serializable;
+
+/**
+ * 赋分系数表
+ */
+@ApiModel(value = "ExamAssign对象", description = "赋分系数表")
+public class ExamAssign extends BaseEntity implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    @ApiModelProperty(value = "学校id")
+    @JsonSerialize(using = ToStringSerializer.class)
+    private Long schoolId;
+
+    @ApiModelProperty(value = "学期id")
+    @JsonSerialize(using = ToStringSerializer.class)
+    private Long semesterId;
+
+    @ApiModelProperty(value = "考试类型id")
+    @JsonSerialize(using = ToStringSerializer.class)
+    private Long examTypeId;
+
+    @ApiModelProperty(value = "课程代码")
+    private String courseCode;
+
+    @ApiModelProperty(value = "课程名称")
+    private String courseName;
+
+    @ApiModelProperty(value = "公式类型")
+    private String formula;
+    @ApiModelProperty(value = "满分")
+    private Double fullScore;
+    @ApiModelProperty(value = "及格分")
+    private Double passScore;
+
+    @ApiModelProperty(value = "系数json")
+    private String coefficient;
+
+
+    public Long getSchoolId() {
+        return schoolId;
+    }
+
+    public void setSchoolId(Long schoolId) {
+        this.schoolId = schoolId;
+    }
+
+    public Long getSemesterId() {
+        return semesterId;
+    }
+
+    public void setSemesterId(Long semesterId) {
+        this.semesterId = semesterId;
+    }
+
+    public Long getExamTypeId() {
+        return examTypeId;
+    }
+
+    public void setExamTypeId(Long examTypeId) {
+        this.examTypeId = examTypeId;
+    }
+
+    public String getCourseCode() {
+        return courseCode;
+    }
+
+    public void setCourseCode(String courseCode) {
+        this.courseCode = courseCode;
+    }
+
+    public String getCourseName() {
+        return courseName;
+    }
+
+    public void setCourseName(String courseName) {
+        this.courseName = courseName;
+    }
+
+    public String getFormula() {
+        return formula;
+    }
+
+    public void setFormula(String formula) {
+        this.formula = formula;
+    }
+
+    public Double getFullScore() {
+        return fullScore;
+    }
+
+    public void setFullScore(Double fullScore) {
+        this.fullScore = fullScore;
+    }
+
+    public Double getPassScore() {
+        return passScore;
+    }
+
+    public void setPassScore(Double passScore) {
+        this.passScore = passScore;
+    }
+
+    public String getCoefficient() {
+        return coefficient;
+    }
+
+    public void setCoefficient(String coefficient) {
+        this.coefficient = coefficient;
+    }
+}

+ 94 - 0
src/main/java/com/qmth/eds/common/entity/SysSetting.java

@@ -0,0 +1,94 @@
+package com.qmth.eds.common.entity;
+
+import com.alibaba.fastjson.JSON;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.fasterxml.jackson.databind.annotation.JsonSerialize;
+import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
+import com.qmth.eds.bean.dto.syssetting.SettingObject;
+import com.qmth.eds.bean.dto.syssetting.SimpleObject;
+import com.qmth.eds.common.contant.SysSettingConstant;
+import com.qmth.eds.core.base.BaseEntity;
+import io.swagger.annotations.ApiModelProperty;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * <p>
+ * 系统设置表
+ * </p>
+ */
+@TableName("sys_setting")
+public class SysSetting extends BaseEntity implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    @ApiModelProperty(value = "学校id")
+    @JsonSerialize(using = ToStringSerializer.class)
+    @TableField("school_id")
+    private Long schoolId;
+
+
+    /**
+     * 参数配置详情
+     */
+    @TableField("parameter_object")
+    private String parameterObject;
+
+    public Long getSchoolId() {
+        return schoolId;
+    }
+
+    public void setSchoolId(Long schoolId) {
+        this.schoolId = schoolId;
+    }
+
+    public String getParameterObject() {
+        return parameterObject;
+    }
+
+    public void setParameterObject(String parameterObject) {
+        this.parameterObject = parameterObject;
+    }
+
+    /**
+     * 初始化数据
+     */
+    public static SysSetting init(BasicSchool basicSchool) {
+        List<SettingObject> settingObjects = new ArrayList<>();
+
+        List<SimpleObject> basicSimpleObjects = new ArrayList<>();
+        basicSimpleObjects.add(new SimpleObject(SysSettingConstant.CLOUD_MARKING_ACCESS_KEY, "文件访问地址", "", "text", 1, true));
+        settingObjects.add(new SettingObject("访问参数设置", 1, basicSimpleObjects));
+
+        String schoolCode = basicSchool.getCode();
+        if ("whu".equals(schoolCode)) {
+            List<SimpleObject> simpleObjects1 = new ArrayList<>();
+            simpleObjects1.add(new SimpleObject(SysSettingConstant.WHU_APP_KEY, "App Key", "", "text", 1, true));
+            simpleObjects1.add(new SimpleObject(SysSettingConstant.WHU_APP_SECRET, "App Secret", "", "text", 2, true));
+            simpleObjects1.add(new SimpleObject(SysSettingConstant.WHU_TOKEN_URL, "Token接口", "", "text", 3, true));
+            simpleObjects1.add(new SimpleObject(SysSettingConstant.WHU_KW_URL, "考务数据接口", "", "text", 4, true));
+            settingObjects.add(new SettingObject("对接参数设置", 2, simpleObjects1));
+        } else if ("cdut".equals(schoolCode)) {
+            List<SimpleObject> simpleObjects1 = new ArrayList<>();
+            simpleObjects1.add(new SimpleObject(SysSettingConstant.CDUT_APP_KEY, "App Key", "", "text", 1, true));
+            simpleObjects1.add(new SimpleObject(SysSettingConstant.CDUT_APP_SECRET, "App Secret", "", "text", 2, true));
+            simpleObjects1.add(new SimpleObject(SysSettingConstant.CDUT_TOKEN_URL, "Token接口", "", "text", 3, true));
+            simpleObjects1.add(new SimpleObject(SysSettingConstant.CDUT_KW_URL, "考务数据接口", "", "text", 4, true));
+            settingObjects.add(new SettingObject("对接参数设置", 2, simpleObjects1));
+        }
+
+        List<SimpleObject> cloudMarkingSimpleObjects = new ArrayList<>();
+        cloudMarkingSimpleObjects.add(new SimpleObject(SysSettingConstant.CLOUD_MARKING_ACCESS_KEY, "Access Key", basicSchool.getAccessKey(), "text", 1, true));
+        cloudMarkingSimpleObjects.add(new SimpleObject(SysSettingConstant.CLOUD_MARKING_ACCESS_SECRET, "Access Secret", basicSchool.getAccessSecret(), "text", 2, true));
+        cloudMarkingSimpleObjects.add(new SimpleObject(SysSettingConstant.CLOUD_MARKING_ROOT_URL, "云阅卷地址", "", "text", 3, true));
+        settingObjects.add(new SettingObject("云阅卷参数设置", 3, cloudMarkingSimpleObjects));
+
+        SysSetting sysSetting = new SysSetting();
+        sysSetting.setSchoolId(basicSchool.getId());
+        sysSetting.setParameterObject(JSON.toJSONString(settingObjects));
+        return sysSetting;
+    }
+}

+ 2 - 1
src/main/java/com/qmth/eds/common/enums/RoleTypeEnum.java

@@ -11,7 +11,8 @@ import java.util.List;
 public enum RoleTypeEnum {
 public enum RoleTypeEnum {
 
 
     ADMIN("管理员"),
     ADMIN("管理员"),
-    IMPLEMENT("实施人员");
+    IMPLEMENT("实施人员"),
+    ASSIGN("赋分老师");
 
 
     RoleTypeEnum(String desc) {
     RoleTypeEnum(String desc) {
         this.desc = desc;
         this.desc = desc;

+ 166 - 0
src/main/java/com/qmth/eds/common/tools/CdutUtils.java

@@ -0,0 +1,166 @@
+package com.qmth.eds.common.tools;
+
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONObject;
+import com.qmth.eds.common.contant.SysSettingConstant;
+import com.qmth.eds.common.entity.ExamSyncStudentTemp;
+import com.qmth.eds.common.enums.ExceptionResultEnum;
+import com.qmth.eds.common.util.HttpKit;
+import com.qmth.eds.common.util.RedisUtil;
+import com.qmth.eds.service.CommonService;
+import com.qmth.eds.service.impl.WhuDataSyncServiceImpl;
+import org.apache.commons.lang3.StringUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.stereotype.Component;
+
+import javax.annotation.Resource;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicInteger;
+
+/**
+ * 武汉大学工具类
+ */
+@Component
+public class CdutUtils {
+    private static final Logger log = LoggerFactory.getLogger(WhuDataSyncServiceImpl.class);
+
+    private final static int CODE_SUCCESS = 10000;
+
+    @Resource
+    RedisUtil redisUtil;
+
+    @Resource
+    CommonService commonService;
+
+    /**
+     * 获取token
+     */
+    public String getAccessToken(Long schoolId) {
+        String key = "accessToken" + schoolId;
+        Object o = redisUtil.get(key);
+        if (o != null) {
+            return String.valueOf(o);
+        }
+
+        String appKey = commonService.getSysSettingValue(schoolId, SysSettingConstant.CDUT_APP_KEY);
+        String appSecret = commonService.getSysSettingValue(schoolId, SysSettingConstant.CDUT_APP_SECRET);
+        String tokenUrl = commonService.getSysSettingValue(schoolId, SysSettingConstant.CDUT_TOKEN_URL);
+        validUrl(appKey, appSecret, tokenUrl);
+        try {
+            //参数
+            Map<String, String> paramMap = new HashMap<>();
+            paramMap.put("appKey", appKey);
+            paramMap.put("appSecret", appSecret);
+
+            String result = HttpKit.sendPost(tokenUrl, paramMap, null);
+            JSONObject jsonResult = JSON.parseObject(result);
+            log.info("参数:{}", JSONObject.toJSONString(paramMap));
+            log.info("结果:{}", result);
+            if (jsonResult.containsKey("code") && CODE_SUCCESS == jsonResult.getIntValue("code")) {
+                String resultString = jsonResult.getString("result");
+                JSONObject jsonToken = JSON.parseObject(resultString);
+                if (jsonToken.containsKey("access_token")) {
+                    String accessToken = jsonToken.getString("access_token");
+                    int expiresIn = jsonToken.getIntValue("expires_in");
+                    // 缓存
+                    redisUtil.set(key, accessToken, expiresIn, TimeUnit.SECONDS);
+                    return accessToken;
+                }
+            }
+            return null;
+        } catch (Exception e) {
+            throw ExceptionResultEnum.ERROR.exception(e.getMessage());
+        }
+    }
+
+    /**
+     * 获取考务数据
+     */
+    public List<ExamSyncStudentTemp> getKwData(Long schoolId, String token) {
+        String kwUrl = commonService.getSysSettingValue(schoolId, SysSettingConstant.CDUT_KW_URL);
+        validUrl(kwUrl);
+        try {
+            // 循环查
+            AtomicInteger offset = new AtomicInteger(1);
+            int perPage = 1000;
+            int totalCount = 0;
+            List<ExamSyncStudentTemp> subExamSyncStudentTemps = null;
+            List<ExamSyncStudentTemp> examSyncStudentTemps = new ArrayList<>();
+            do {
+                Map<String, String> paramMap = new HashMap<>();
+                paramMap.put("access_token", token);
+                paramMap.put("page", String.valueOf(offset.getAndIncrement()));
+                paramMap.put("per_page", String.valueOf(perPage));
+
+                String data = HttpKit.sendGet(kwUrl, paramMap, null);
+                JSONObject dataResult = JSON.parseObject(data);
+                if (dataResult.containsKey("code") && CODE_SUCCESS == dataResult.getIntValue("code")) {
+                    String resultString = dataResult.getString("result");
+                    JSONObject jsonResult = JSON.parseObject(resultString);
+                    if (totalCount == 0) {
+                        totalCount = jsonResult.getIntValue("total");
+                    }
+                    if (jsonResult.containsKey("data")) {
+                        String dataString = jsonResult.getString("data");
+                        subExamSyncStudentTemps = JSON.parseArray(dataString, ExamSyncStudentTemp.class);
+                        if (!subExamSyncStudentTemps.isEmpty()) {
+                            examSyncStudentTemps.addAll(subExamSyncStudentTemps);
+                        }
+                    }
+                }
+            } while (!subExamSyncStudentTemps.isEmpty());
+
+            if (totalCount != examSyncStudentTemps.size()) {
+                throw ExceptionResultEnum.ERROR.exception(String.format("不一致,接口返回总数%d,数据解析总数%d", totalCount, examSyncStudentTemps.size()));
+            }
+
+            return examSyncStudentTemps;
+        } catch (Exception e) {
+            throw ExceptionResultEnum.ERROR.exception(e.getMessage());
+        }
+    }
+
+    /**
+     * 校验url是否配置
+     *
+     * @param urls URL数组
+     */
+    private void validUrl(String... urls) {
+        if (StringUtils.isAnyBlank(urls)) {
+            throw ExceptionResultEnum.ERROR.exception("接口参数未配置");
+        }
+    }
+
+    private List<ExamSyncStudentTemp> listTemps() {
+        List<ExamSyncStudentTemp> examSyncStudentTemps = new ArrayList<>();
+        for (int i = 0; i < 4; i++) {
+            ExamSyncStudentTemp examSyncStudentTemp = new ExamSyncStudentTemp();
+            examSyncStudentTemp.setXnm("100" + i);
+            examSyncStudentTemp.setXqm("200" + i);
+            examSyncStudentTemp.setJxbId("300" + i);
+            examSyncStudentTemp.setJxbmc("教学班" + i);
+            examSyncStudentTemp.setKch("400" + i);
+            examSyncStudentTemp.setKcmc("课程" + i);
+            examSyncStudentTemp.setJgh("500" + i);
+            examSyncStudentTemp.setXm("姓名" + i);
+            examSyncStudentTemp.setKkbm("开课学院" + i);
+            examSyncStudentTemp.setXf("35");
+            examSyncStudentTemp.setXh("100000100" + i);
+            examSyncStudentTemp.setXsxm("学生" + i);
+            examSyncStudentTemp.setJgmc("机构" + i);
+            examSyncStudentTemp.setZymc("专业" + i);
+            examSyncStudentTemp.setCxbj("0");
+            examSyncStudentTemp.setNjdmId("年级" + i);
+            examSyncStudentTemp.setZwh("1" + i);
+            examSyncStudentTemp.setCdmc("考场" + i);
+            examSyncStudentTemp.setKsbz("无");
+            examSyncStudentTemps.add(examSyncStudentTemp);
+        }
+        return examSyncStudentTemps;
+    }
+}

+ 19 - 20
src/main/java/com/qmth/eds/common/tools/CloudMarkingUtil.java → src/main/java/com/qmth/eds/common/tools/CloudMarkingUtils.java

@@ -3,12 +3,14 @@ package com.qmth.eds.common.tools;
 import com.alibaba.fastjson.JSONObject;
 import com.alibaba.fastjson.JSONObject;
 import com.qmth.boot.tools.signature.SignatureEntity;
 import com.qmth.boot.tools.signature.SignatureEntity;
 import com.qmth.boot.tools.signature.SignatureType;
 import com.qmth.boot.tools.signature.SignatureType;
+import com.qmth.eds.common.contant.SysSettingConstant;
 import com.qmth.eds.common.contant.SystemConstant;
 import com.qmth.eds.common.contant.SystemConstant;
 import com.qmth.eds.common.entity.SysCollege;
 import com.qmth.eds.common.entity.SysCollege;
 import com.qmth.eds.common.enums.ExceptionResultEnum;
 import com.qmth.eds.common.enums.ExceptionResultEnum;
 import com.qmth.eds.common.util.HttpKit;
 import com.qmth.eds.common.util.HttpKit;
 import com.qmth.eds.core.config.DictionaryConfig;
 import com.qmth.eds.core.config.DictionaryConfig;
 import com.qmth.eds.service.CommonCacheService;
 import com.qmth.eds.service.CommonCacheService;
+import com.qmth.eds.service.CommonService;
 import com.qmth.eds.service.SysCollegeService;
 import com.qmth.eds.service.SysCollegeService;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.stereotype.Service;
 import org.springframework.stereotype.Service;
@@ -23,7 +25,7 @@ import java.util.Objects;
  * 云阅卷接口工具类
  * 云阅卷接口工具类
  */
  */
 @Service
 @Service
-public class CloudMarkingUtil {
+public class CloudMarkingUtils {
 
 
     private static final String SUCCESS = "success";
     private static final String SUCCESS = "success";
 
 
@@ -37,10 +39,7 @@ public class CloudMarkingUtil {
 
 
 
 
     @Resource
     @Resource
-    DictionaryConfig dictionaryConfig;
-
-    @Resource
-    CommonCacheService commonCacheService;
+    CommonService commonService;
 
 
     @Resource
     @Resource
     SysCollegeService sysCollegeService;
     SysCollegeService sysCollegeService;
@@ -51,19 +50,19 @@ public class CloudMarkingUtil {
      * @param pageNo   分页参数
      * @param pageNo   分页参数
      * @param pageSize 分页参数
      * @param pageSize 分页参数
      */
      */
-    public List<JSONObject> getExam(Long collegeId, int pageNo, int pageSize) {
+    public List<JSONObject> getExam(Long schoolId, Long collegeId, int pageNo, int pageSize) {
         Map<String, String> paramMap = new HashMap<>();
         Map<String, String> paramMap = new HashMap<>();
         paramMap.put("pageNumber", String.valueOf(pageNo));
         paramMap.put("pageNumber", String.valueOf(pageNo));
         paramMap.put("pageSize", String.valueOf(pageSize));
         paramMap.put("pageSize", String.valueOf(pageSize));
 
 
-        String yyjRootUrl = dictionaryConfig.cloudMarkingDomain().getRootUrl();
-        String examUrl = dictionaryConfig.cloudMarkingDomain().getExamUrl();
+        String yyjRootUrl = commonService.getSysSettingValue(schoolId, SysSettingConstant.CLOUD_MARKING_ROOT_URL);
+        String examUrl = SysSettingConstant.CLOUD_MARKING_EXAM_URL;
 
 
         if (StringUtils.isAnyBlank(yyjRootUrl, examUrl)) {
         if (StringUtils.isAnyBlank(yyjRootUrl, examUrl)) {
             throw ExceptionResultEnum.ERROR.exception("考试查询接口url未设置");
             throw ExceptionResultEnum.ERROR.exception("考试查询接口url未设置");
         }
         }
 
 
-        Map<String, String> header = createHeader(examUrl, collegeId);
+        Map<String, String> header = createHeader(schoolId, examUrl, collegeId);
         //请求
         //请求
         String examObject = HttpKit.sendPost(yyjRootUrl + examUrl, paramMap, header);
         String examObject = HttpKit.sendPost(yyjRootUrl + examUrl, paramMap, header);
         return JSONObject.parseArray(JSONObject.toJSON(examObject).toString(), JSONObject.class);
         return JSONObject.parseArray(JSONObject.toJSON(examObject).toString(), JSONObject.class);
@@ -75,18 +74,18 @@ public class CloudMarkingUtil {
      * @param mapSource 参数
      * @param mapSource 参数
      * @param collegeId
      * @param collegeId
      */
      */
-    public int getStudentCount(Map<String, String> mapSource, Long collegeId) {
+    public int getStudentCount(Long schoolId, Map<String, String> mapSource, Long collegeId) {
         Map<String, String> map = paramMap(mapSource);
         Map<String, String> map = paramMap(mapSource);
 
 
-        String yyjRootUrl = dictionaryConfig.cloudMarkingDomain().getRootUrl();
-        String studentCountUrl = dictionaryConfig.cloudMarkingDomain().getStudentCountUrl();
+        String yyjRootUrl = commonService.getSysSettingValue(schoolId, SysSettingConstant.CLOUD_MARKING_ROOT_URL);
+        String studentCountUrl = SysSettingConstant.CLOUD_MARKING_STUDENT_COUNT_URL;
 
 
         if (StringUtils.isAnyBlank(yyjRootUrl, studentCountUrl)) {
         if (StringUtils.isAnyBlank(yyjRootUrl, studentCountUrl)) {
             throw ExceptionResultEnum.ERROR.exception("考试成绩考生数量查询接口url未设置");
             throw ExceptionResultEnum.ERROR.exception("考试成绩考生数量查询接口url未设置");
         }
         }
 
 
         //header
         //header
-        Map<String, String> headerMap = createHeader(studentCountUrl, collegeId);
+        Map<String, String> headerMap = createHeader(schoolId, studentCountUrl, collegeId);
         //请求
         //请求
         String res = HttpKit.sendPost(yyjRootUrl + studentCountUrl, map, headerMap);
         String res = HttpKit.sendPost(yyjRootUrl + studentCountUrl, map, headerMap);
         if (StringUtils.isNotBlank(res)) {
         if (StringUtils.isNotBlank(res)) {
@@ -104,20 +103,20 @@ public class CloudMarkingUtil {
      * @param pageNo    分页参数
      * @param pageNo    分页参数
      * @param pageSize  分页参数
      * @param pageSize  分页参数
      */
      */
-    public List<JSONObject> getStudentScore(Map<String, String> map, Long collegeId, int pageNo, int pageSize) {
+    public List<JSONObject> getStudentScore(Long schoolId, Map<String, String> map, Long collegeId, int pageNo, int pageSize) {
         Map<String, String> paramMap = paramMap(map);
         Map<String, String> paramMap = paramMap(map);
 
 
         paramMap.put("pageNumber", String.valueOf(pageNo));
         paramMap.put("pageNumber", String.valueOf(pageNo));
         paramMap.put("pageSize", String.valueOf(pageSize));
         paramMap.put("pageSize", String.valueOf(pageSize));
 
 
-        String yyjRootUrl = dictionaryConfig.cloudMarkingDomain().getRootUrl();
-        String studentScoreUrl = dictionaryConfig.cloudMarkingDomain().getStudentScoreUrl();
+        String yyjRootUrl = commonService.getSysSettingValue(schoolId, SysSettingConstant.CLOUD_MARKING_ROOT_URL);
+        String studentScoreUrl = SysSettingConstant.CLOUD_MARKING_STUDENT_SCORE_URL;
 
 
         if (StringUtils.isAnyBlank(yyjRootUrl, studentScoreUrl)) {
         if (StringUtils.isAnyBlank(yyjRootUrl, studentScoreUrl)) {
             throw ExceptionResultEnum.ERROR.exception("考试成绩查询接口url未设置");
             throw ExceptionResultEnum.ERROR.exception("考试成绩查询接口url未设置");
         }
         }
 
 
-        Map<String, String> header = createHeader(studentScoreUrl, collegeId);
+        Map<String, String> header = createHeader(schoolId, studentScoreUrl, collegeId);
         //请求
         //请求
         String studentObject = HttpKit.sendPost(yyjRootUrl + studentScoreUrl, paramMap, header);
         String studentObject = HttpKit.sendPost(yyjRootUrl + studentScoreUrl, paramMap, header);
         return JSONObject.parseArray(JSONObject.toJSON(studentObject).toString(), JSONObject.class);
         return JSONObject.parseArray(JSONObject.toJSON(studentObject).toString(), JSONObject.class);
@@ -128,7 +127,7 @@ public class CloudMarkingUtil {
      *
      *
      * @param url url
      * @param url url
      */
      */
-    private Map<String, String> createHeader(String url, Long collegeId) {
+    private Map<String, String> createHeader(Long schoolId, String url, Long collegeId) {
         SysCollege sysCollege = sysCollegeService.getById(collegeId);
         SysCollege sysCollege = sysCollegeService.getById(collegeId);
         String accessKey = null;
         String accessKey = null;
         String accessSecret = null;
         String accessSecret = null;
@@ -136,8 +135,8 @@ public class CloudMarkingUtil {
             accessKey = sysCollege.getAccessKey();
             accessKey = sysCollege.getAccessKey();
             accessSecret = sysCollege.getAccessSecret();
             accessSecret = sysCollege.getAccessSecret();
         } else {
         } else {
-            accessKey = dictionaryConfig.cloudMarkingDomain().getAccessKey();
-            accessSecret = dictionaryConfig.cloudMarkingDomain().getAccessSecret();
+            accessKey = commonService.getSysSettingValue(schoolId, SysSettingConstant.CLOUD_MARKING_ACCESS_KEY);
+            accessSecret = commonService.getSysSettingValue(schoolId, SysSettingConstant.CLOUD_MARKING_ACCESS_SECRET);
         }
         }
         long time = System.currentTimeMillis();
         long time = System.currentTimeMillis();
         Map<String, String> headerMap = new HashMap<>();
         Map<String, String> headerMap = new HashMap<>();

+ 13 - 11
src/main/java/com/qmth/eds/common/tools/WuhanUniversityUtils.java → src/main/java/com/qmth/eds/common/tools/WhuUtils.java

@@ -2,11 +2,13 @@ package com.qmth.eds.common.tools;
 
 
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONObject;
 import com.alibaba.fastjson.JSONObject;
+import com.qmth.eds.common.contant.SysSettingConstant;
 import com.qmth.eds.common.util.HttpKit;
 import com.qmth.eds.common.util.HttpKit;
-import com.qmth.eds.core.config.DictionaryConfig;
 import com.qmth.eds.common.entity.ExamSyncStudentTemp;
 import com.qmth.eds.common.entity.ExamSyncStudentTemp;
 import com.qmth.eds.common.enums.ExceptionResultEnum;
 import com.qmth.eds.common.enums.ExceptionResultEnum;
-import com.qmth.eds.service.impl.DataSyncServiceImpl;
+import com.qmth.eds.service.CommonCacheService;
+import com.qmth.eds.service.CommonService;
+import com.qmth.eds.service.impl.WhuDataSyncServiceImpl;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.commons.lang3.StringUtils;
 import org.slf4j.Logger;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.slf4j.LoggerFactory;
@@ -23,20 +25,20 @@ import java.util.concurrent.atomic.AtomicInteger;
  * 武汉大学工具类
  * 武汉大学工具类
  */
  */
 @Component
 @Component
-public class WuhanUniversityUtils {
+public class WhuUtils {
 
 
-    private static final Logger log = LoggerFactory.getLogger(DataSyncServiceImpl.class);
+    private static final Logger log = LoggerFactory.getLogger(WhuDataSyncServiceImpl.class);
 
 
     @Resource
     @Resource
-    private DictionaryConfig dictionaryConfig;
+    CommonService commonService;
 
 
     /**
     /**
      * 获取token
      * 获取token
      */
      */
-    public String getAccessToken() {
-        String appKey = dictionaryConfig.whuDomain().getAppKey();
-        String appSecret = dictionaryConfig.whuDomain().getAppSecret();
-        String tokenUrl = dictionaryConfig.whuDomain().getTokenUrl();
+    public String getAccessToken(Long schoolId) {
+        String appKey = commonService.getSysSettingValue(schoolId, SysSettingConstant.WHU_APP_KEY);
+        String appSecret = commonService.getSysSettingValue(schoolId, SysSettingConstant.WHU_APP_SECRET);
+        String tokenUrl = commonService.getSysSettingValue(schoolId, SysSettingConstant.WHU_TOKEN_URL);
         validUrl(appKey, appSecret, tokenUrl);
         validUrl(appKey, appSecret, tokenUrl);
         try {
         try {
             //参数
             //参数
@@ -64,8 +66,8 @@ public class WuhanUniversityUtils {
     /**
     /**
      * 获取考务数据
      * 获取考务数据
      */
      */
-    public List<ExamSyncStudentTemp> getKwData(String token) {
-        String kwUrl = dictionaryConfig.whuDomain().getKwUrl();
+    public List<ExamSyncStudentTemp> getKwData(Long schoolId, String token) {
+        String kwUrl = commonService.getSysSettingValue(schoolId, SysSettingConstant.WHU_KW_URL);
         validUrl(kwUrl);
         validUrl(kwUrl);
         try {
         try {
             //参数
             //参数

+ 7 - 46
src/main/java/com/qmth/eds/common/util/FileStoreUtil.java

@@ -1,6 +1,5 @@
 package com.qmth.eds.common.util;
 package com.qmth.eds.common.util;
 
 
-import com.qmth.boot.core.fss.service.FileService;
 import com.qmth.boot.core.fss.store.FileStore;
 import com.qmth.boot.core.fss.store.FileStore;
 import com.qmth.eds.common.enums.ExceptionResultEnum;
 import com.qmth.eds.common.enums.ExceptionResultEnum;
 import com.qmth.eds.common.enums.UploadFileEnum;
 import com.qmth.eds.common.enums.UploadFileEnum;
@@ -27,7 +26,7 @@ public class FileStoreUtil {
     private final static Logger log = LoggerFactory.getLogger(FileStoreUtil.class);
     private final static Logger log = LoggerFactory.getLogger(FileStoreUtil.class);
 
 
     @Resource
     @Resource
-    private FileService fileService;
+    private FileStore fileStore;
 
 
     @Resource
     @Resource
     private DictionaryConfig dictionaryConfig;
     private DictionaryConfig dictionaryConfig;
@@ -41,7 +40,7 @@ public class FileStoreUtil {
      */
      */
     public void ossUpload(String dirName, InputStream inputStream, String md5, String type) throws Exception {
     public void ossUpload(String dirName, InputStream inputStream, String md5, String type) throws Exception {
         log.info("ossUpload is come in");
         log.info("ossUpload is come in");
-        fileService.getFileStore(type).write(dirName, inputStream, md5);
+        fileStore.write(dirName, inputStream, md5);
         log.info("dirName:{}", dirName);
         log.info("dirName:{}", dirName);
     }
     }
 
 
@@ -54,7 +53,7 @@ public class FileStoreUtil {
      */
      */
     public void ossUpload(String dirName, File file, String md5, String type) throws Exception {
     public void ossUpload(String dirName, File file, String md5, String type) throws Exception {
         log.info("ossUpload is come in");
         log.info("ossUpload is come in");
-        fileService.getFileStore(type).write(dirName, new FileInputStream(file), md5);
+        fileStore.write(dirName, new FileInputStream(file), md5);
         log.info("dirName:{}", dirName);
         log.info("dirName:{}", dirName);
     }
     }
 
 
@@ -67,7 +66,7 @@ public class FileStoreUtil {
      */
      */
     public void ossUpload(String dirName, String content, String type) throws Exception {
     public void ossUpload(String dirName, String content, String type) throws Exception {
         log.info("ossUpload is come in");
         log.info("ossUpload is come in");
-        fileService.getFileStore(type).write(dirName, new ByteArrayInputStream(content.getBytes()), DigestUtils.md5Hex(new ByteArrayInputStream(content.getBytes())));
+        fileStore.write(dirName, new ByteArrayInputStream(content.getBytes()), DigestUtils.md5Hex(new ByteArrayInputStream(content.getBytes())));
         log.info("dirName:{}", dirName);
         log.info("dirName:{}", dirName);
     }
     }
 
 
@@ -81,7 +80,7 @@ public class FileStoreUtil {
      */
      */
     public File ossDownload(String dirName, String localPath, String type) throws Exception {
     public File ossDownload(String dirName, String localPath, String type) throws Exception {
         log.info("ossDownload is come in");
         log.info("ossDownload is come in");
-        return this.saveLocal(fileService.getFileStore(type).read(dirName), localPath);
+        return this.saveLocal(fileStore.read(dirName), localPath);
     }
     }
 
 
 
 
@@ -94,7 +93,7 @@ public class FileStoreUtil {
      */
      */
     public byte[] ossDownload(String objectName, String type) throws Exception {
     public byte[] ossDownload(String objectName, String type) throws Exception {
         log.info("oss Download is come in");
         log.info("oss Download is come in");
-        return IOUtils.toByteArray(fileService.getFileStore(type).read(objectName));
+        return IOUtils.toByteArray(fileStore.read(objectName));
     }
     }
 
 
     /**
     /**
@@ -106,45 +105,7 @@ public class FileStoreUtil {
      */
      */
     public InputStream ossDownloadIs(String objectName, String type) throws Exception {
     public InputStream ossDownloadIs(String objectName, String type) throws Exception {
         log.info("oss Download is come in");
         log.info("oss Download is come in");
-        return fileService.getFileStore(type).read(objectName);
-    }
-
-
-    /**
-     * 获取文件访问url
-     *
-     * @param objectPath 文件路径
-     * @param type       文件上传的类型
-     * @return
-     */
-    public String getPrivateUrl(String objectPath, String type) {
-        String server = null;
-        if ("public".equals(type)) {
-            server = dictionaryConfig.fssPublicDomain().getServer();
-            return server + "/" + objectPath;
-        } else if ("private".equals(type)) {
-            Boolean oss = dictionaryConfig.sysDomain().isOss();
-            if (Objects.nonNull(oss) && oss) {
-                FileStore fileStore = fileService.getFileStore(type);
-                return fileStore.getPresignedUrl(objectPath, Duration.ofMinutes(5L));
-            } else {
-                return dictionaryConfig.fssPrivateDomain().getServer() + "/" + objectPath;
-            }
-        } else {
-            throw ExceptionResultEnum.ERROR.exception("文件存储store类型不存在");
-        }
-    }
-
-    /**
-     * 根据数据库文件路径判断文件上传类型
-     *
-     * @param path 路径
-     * @return 类型
-     */
-    public UploadFileEnum getUploadEnumByPath(String path) {
-        path = path.replaceAll("\\\\", "/");
-        String target = path.substring(0, path.indexOf('/'));
-        return UploadFileEnum.valueOf(target.toUpperCase());
+        return fileStore.read(objectName);
     }
     }
 
 
     /**
     /**

+ 6 - 7
src/main/java/com/qmth/eds/core/auth/EdsAuthenticationService.java

@@ -11,10 +11,9 @@ import com.qmth.eds.common.entity.TBSession;
 import com.qmth.eds.common.enums.ExceptionResultEnum;
 import com.qmth.eds.common.enums.ExceptionResultEnum;
 import com.qmth.eds.common.enums.PrivilegePropertyEnum;
 import com.qmth.eds.common.enums.PrivilegePropertyEnum;
 import com.qmth.eds.common.enums.RoleTypeEnum;
 import com.qmth.eds.common.enums.RoleTypeEnum;
-import com.qmth.eds.service.CommonCacheService;
 import com.qmth.eds.common.util.RedisUtil;
 import com.qmth.eds.common.util.RedisUtil;
 import com.qmth.eds.common.util.ServletUtil;
 import com.qmth.eds.common.util.ServletUtil;
-import com.qmth.eds.core.config.DictionaryConfig;
+import com.qmth.eds.service.CommonCacheService;
 import org.slf4j.Logger;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.slf4j.LoggerFactory;
 import org.springframework.stereotype.Component;
 import org.springframework.stereotype.Component;
@@ -22,6 +21,7 @@ import org.springframework.stereotype.Component;
 import javax.annotation.Resource;
 import javax.annotation.Resource;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 import javax.servlet.http.HttpServletResponse;
+import java.time.Duration;
 import java.util.Objects;
 import java.util.Objects;
 import java.util.Set;
 import java.util.Set;
 
 
@@ -29,15 +29,14 @@ import java.util.Set;
 public class EdsAuthenticationService implements AuthorizationService {
 public class EdsAuthenticationService implements AuthorizationService {
     private final static Logger log = LoggerFactory.getLogger(EdsAuthenticationService.class);
     private final static Logger log = LoggerFactory.getLogger(EdsAuthenticationService.class);
 
 
+    private Duration duration = Duration.ofHours(2);
+
     @Resource
     @Resource
     CommonCacheService commonCacheService;
     CommonCacheService commonCacheService;
 
 
     @Resource
     @Resource
     RedisUtil redisUtil;
     RedisUtil redisUtil;
 
 
-    @Resource
-    DictionaryConfig dictionaryConfig;
-
     @Override
     @Override
     public AccessEntity findByIdentity(String identity, SignatureType signatureType, String path) {
     public AccessEntity findByIdentity(String identity, SignatureType signatureType, String path) {
         return new EdsSession(identity, SignatureType.TOKEN);
         return new EdsSession(identity, SignatureType.TOKEN);
@@ -75,8 +74,8 @@ public class EdsAuthenticationService implements AuthorizationService {
             if (auth) {
             if (auth) {
                 Long expireTime = redisUtil.getUserSessionExpire(accessEntity.getIdentity());
                 Long expireTime = redisUtil.getUserSessionExpire(accessEntity.getIdentity());
                 if (Objects.nonNull(expireTime) && expireTime.longValue() > -1L) {
                 if (Objects.nonNull(expireTime) && expireTime.longValue() > -1L) {
-                    if (Objects.nonNull(tbSession.getLastAccessTime()) && (System.currentTimeMillis() - tbSession.getLastAccessTime()) / 1000 > dictionaryConfig.sysDomain().getSessionActive().getSeconds()) {
-                        log.warn("Authorization faile: session active, session active is {}", dictionaryConfig.sysDomain().getSessionActive().getSeconds());
+                    if (Objects.nonNull(tbSession.getLastAccessTime()) && (System.currentTimeMillis() - tbSession.getLastAccessTime()) / 1000 > duration.getSeconds()) {
+                        log.warn("Authorization faile: session active, session active is {}", duration.getSeconds());
                         throw ExceptionResultEnum.NOT_LOGIN.exception();
                         throw ExceptionResultEnum.NOT_LOGIN.exception();
                     }
                     }
                     tbSession.setLastInfo();
                     tbSession.setLastInfo();

+ 5 - 49
src/main/java/com/qmth/eds/core/config/DictionaryConfig.java

@@ -1,6 +1,7 @@
 package com.qmth.eds.core.config;
 package com.qmth.eds.core.config;
 
 
-import com.qmth.eds.core.domain.*;
+import com.qmth.eds.core.domain.FssDomain;
+import com.qmth.eds.core.domain.SmsDomain;
 import org.springframework.boot.context.properties.ConfigurationProperties;
 import org.springframework.boot.context.properties.ConfigurationProperties;
 import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.Configuration;
 import org.springframework.context.annotation.Configuration;
@@ -15,28 +16,6 @@ import org.springframework.context.annotation.Configuration;
 @Configuration
 @Configuration
 public class DictionaryConfig {
 public class DictionaryConfig {
 
 
-    /**
-     * 模块前缀
-     *
-     * @return
-     */
-    @Bean
-    @ConfigurationProperties(prefix = "prefix.url")
-    public PrefixUrlDomain prefixUrlDomain() {
-        return new PrefixUrlDomain();
-    }
-
-    /**
-     * 系统配置
-     *
-     * @return
-     */
-    @Bean
-    @ConfigurationProperties(prefix = "sys.config")
-    public SysDomain sysDomain() {
-        return new SysDomain();
-    }
-
     /**
     /**
      * 短信配置
      * 短信配置
      *
      *
@@ -49,32 +28,9 @@ public class DictionaryConfig {
     }
     }
 
 
     @Bean
     @Bean
-    @ConfigurationProperties(prefix = "com.qmth.fss.public", ignoreUnknownFields = false)
-    public FssPublicDomain fssPublicDomain() {
-        return new FssPublicDomain();
-    }
-
-    @Bean
-    @ConfigurationProperties(prefix = "com.qmth.fss.private", ignoreUnknownFields = false)
-    public FssPrivateDomain fssPrivateDomain() {
-        return new FssPrivateDomain();
-    }
-
-    @Bean
-    @ConfigurationProperties(prefix = "whu.config", ignoreUnknownFields = false)
-    public WhuDomain whuDomain() {
-        return new WhuDomain();
-    }
-
-    @Bean
-    @ConfigurationProperties(prefix = "com.qmth.fss.localfile", ignoreUnknownFields = false)
-    public FssLocalFileDomain fssLocalFileDomain() {
-        return new FssLocalFileDomain();
+    @ConfigurationProperties(prefix = "com.qmth.fss", ignoreUnknownFields = false)
+    public FssDomain fssDomain() {
+        return new FssDomain();
     }
     }
 
 
-    @Bean
-    @ConfigurationProperties(prefix = "cloud.marking.config", ignoreUnknownFields = false)
-    public CloudMarkingDomain cloudMarkingDomain() {
-        return new CloudMarkingDomain();
-    }
 }
 }

+ 0 - 69
src/main/java/com/qmth/eds/core/domain/CloudMarkingDomain.java

@@ -1,69 +0,0 @@
-package com.qmth.eds.core.domain;
-
-import java.io.Serializable;
-
-/**
- * 云阅卷配置
- */
-public class CloudMarkingDomain implements Serializable {
-
-    private String accessKey;
-
-    private String accessSecret;
-
-    private String rootUrl;
-
-    private String examUrl;
-
-    private String studentCountUrl;
-
-    private String studentScoreUrl;
-
-    public String getAccessKey() {
-        return accessKey;
-    }
-
-    public void setAccessKey(String accessKey) {
-        this.accessKey = accessKey;
-    }
-
-    public String getAccessSecret() {
-        return accessSecret;
-    }
-
-    public void setAccessSecret(String accessSecret) {
-        this.accessSecret = accessSecret;
-    }
-
-    public String getRootUrl() {
-        return rootUrl;
-    }
-
-    public void setRootUrl(String rootUrl) {
-        this.rootUrl = rootUrl;
-    }
-
-    public String getExamUrl() {
-        return examUrl;
-    }
-
-    public void setExamUrl(String examUrl) {
-        this.examUrl = examUrl;
-    }
-
-    public String getStudentCountUrl() {
-        return studentCountUrl;
-    }
-
-    public void setStudentCountUrl(String studentCountUrl) {
-        this.studentCountUrl = studentCountUrl;
-    }
-
-    public String getStudentScoreUrl() {
-        return studentScoreUrl;
-    }
-
-    public void setStudentScoreUrl(String studentScoreUrl) {
-        this.studentScoreUrl = studentScoreUrl;
-    }
-}

+ 1 - 1
src/main/java/com/qmth/eds/core/domain/FssPublicDomain.java → src/main/java/com/qmth/eds/core/domain/FssDomain.java

@@ -5,7 +5,7 @@ package com.qmth.eds.core.domain;
  * @Author: CaoZixuan
  * @Author: CaoZixuan
  * @Date: 2021-08-18
  * @Date: 2021-08-18
  */
  */
-public class FssPublicDomain {
+public class FssDomain {
     private static final long serialVersionUID = 7510626406622200443L;
     private static final long serialVersionUID = 7510626406622200443L;
 
 
     private String config;
     private String config;

+ 0 - 26
src/main/java/com/qmth/eds/core/domain/FssLocalFileDomain.java

@@ -1,26 +0,0 @@
-package com.qmth.eds.core.domain;
-
-/**
- *
- */
-public class FssLocalFileDomain {
-    private String config;
-
-    private String server;
-
-    public String getConfig() {
-        return config;
-    }
-
-    public void setConfig(String config) {
-        this.config = config;
-    }
-
-    public String getServer() {
-        return server;
-    }
-
-    public void setServer(String server) {
-        this.server = server;
-    }
-}

+ 0 - 34
src/main/java/com/qmth/eds/core/domain/FssPrivateDomain.java

@@ -1,34 +0,0 @@
-package com.qmth.eds.core.domain;
-
-/**
- * @Description: 文件存储中心配置-私有
- * @Author: CaoZixuan
- * @Date: 2021-08-18
- */
-public class FssPrivateDomain {
-    private static final long serialVersionUID = 7510626406622200443L;
-
-    private String config;
-
-    private String server;
-
-    public static long getSerialVersionUID() {
-        return serialVersionUID;
-    }
-
-    public String getConfig() {
-        return config;
-    }
-
-    public void setConfig(String config) {
-        this.config = config;
-    }
-
-    public String getServer() {
-        return server;
-    }
-
-    public void setServer(String server) {
-        this.server = server;
-    }
-}

+ 0 - 23
src/main/java/com/qmth/eds/core/domain/PrefixUrlDomain.java

@@ -1,23 +0,0 @@
-package com.qmth.eds.core.domain;
-
-import java.io.Serializable;
-
-/**
- * @Description: 模块前缀
- * @Param:
- * @return:
- * @Author: wangliang
- * @Date: 2020/4/10
- */
-public class PrefixUrlDomain implements Serializable {
-
-    String common;
-
-    public String getCommon() {
-        return common;
-    }
-
-    public void setCommon(String common) {
-        this.common = common;
-    }
-}

+ 0 - 125
src/main/java/com/qmth/eds/core/domain/SysDomain.java

@@ -1,125 +0,0 @@
-package com.qmth.eds.core.domain;
-
-import java.io.Serializable;
-import java.time.Duration;
-import java.util.List;
-
-/**
- * @Description: 系统配置
- * @Param:
- * @return:
- * @Author: wangliang
- * @Date: 2020/4/10
- */
-public class SysDomain implements Serializable {
-
-    boolean oss;
-
-    List attachmentType;
-
-    Integer attachmentLength;
-
-    Double attachmentSize;
-
-    String serverUpload;
-
-    String fileHost;
-
-    String serverHost;
-
-    Integer autoCreatePdfResetMaxCount;
-
-    Integer threadPoolCoreSize;
-
-    boolean customThreadPoolCoreSize;
-
-    Duration sessionActive;
-
-    public Duration getSessionActive() {
-        return sessionActive;
-    }
-
-    public void setSessionActive(Duration sessionActive) {
-        this.sessionActive = sessionActive;
-    }
-
-    public boolean isCustomThreadPoolCoreSize() {
-        return customThreadPoolCoreSize;
-    }
-
-    public void setCustomThreadPoolCoreSize(boolean customThreadPoolCoreSize) {
-        this.customThreadPoolCoreSize = customThreadPoolCoreSize;
-    }
-
-    public Integer getAutoCreatePdfResetMaxCount() {
-        return autoCreatePdfResetMaxCount;
-    }
-
-    public void setAutoCreatePdfResetMaxCount(Integer autoCreatePdfResetMaxCount) {
-        this.autoCreatePdfResetMaxCount = autoCreatePdfResetMaxCount;
-    }
-
-    public Integer getThreadPoolCoreSize() {
-        return threadPoolCoreSize;
-    }
-
-    public void setThreadPoolCoreSize(Integer threadPoolCoreSize) {
-        this.threadPoolCoreSize = threadPoolCoreSize;
-    }
-
-    public String getFileHost() {
-        return fileHost;
-    }
-
-    public void setFileHost(String fileHost) {
-        this.fileHost = fileHost;
-    }
-
-    public String getServerHost() {
-        return serverHost;
-    }
-
-    public void setServerHost(String serverHost) {
-        this.serverHost = serverHost;
-    }
-
-    public Integer getAttachmentLength() {
-        return attachmentLength;
-    }
-
-    public void setAttachmentLength(Integer attachmentLength) {
-        this.attachmentLength = attachmentLength;
-    }
-
-    public Double getAttachmentSize() {
-        return attachmentSize;
-    }
-
-    public void setAttachmentSize(Double attachmentSize) {
-        this.attachmentSize = attachmentSize;
-    }
-
-    public boolean isOss() {
-        return oss;
-    }
-
-    public void setOss(boolean oss) {
-        this.oss = oss;
-    }
-
-    public List getAttachmentType() {
-        return attachmentType;
-    }
-
-    public void setAttachmentType(List attachmentType) {
-        this.attachmentType = attachmentType;
-    }
-
-    public String getServerUpload() {
-        return serverUpload;
-    }
-
-    public void setServerUpload(String serverUpload) {
-        this.serverUpload = serverUpload;
-    }
-}

+ 0 - 49
src/main/java/com/qmth/eds/core/domain/WhuDomain.java

@@ -1,49 +0,0 @@
-package com.qmth.eds.core.domain;
-
-import java.io.Serializable;
-
-/**
- * 武汉大学配置
- */
-public class WhuDomain implements Serializable {
-
-    private String appKey;
-
-    private String appSecret;
-
-    private String tokenUrl;
-
-    private String kwUrl;
-
-    public String getAppKey() {
-        return appKey;
-    }
-
-    public void setAppKey(String appKey) {
-        this.appKey = appKey;
-    }
-
-    public String getAppSecret() {
-        return appSecret;
-    }
-
-    public void setAppSecret(String appSecret) {
-        this.appSecret = appSecret;
-    }
-
-    public String getTokenUrl() {
-        return tokenUrl;
-    }
-
-    public void setTokenUrl(String tokenUrl) {
-        this.tokenUrl = tokenUrl;
-    }
-
-    public String getKwUrl() {
-        return kwUrl;
-    }
-
-    public void setKwUrl(String kwUrl) {
-        this.kwUrl = kwUrl;
-    }
-}

+ 18 - 0
src/main/java/com/qmth/eds/mapper/ExamAssignMapper.java

@@ -0,0 +1,18 @@
+package com.qmth.eds.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.qmth.eds.bean.dto.AssignListDto;
+import com.qmth.eds.common.entity.ExamAssign;
+import org.apache.ibatis.annotations.Param;
+
+/**
+ * <p>
+ * 赋分管理 Mapper 接口
+ * </p>
+ */
+public interface ExamAssignMapper extends BaseMapper<ExamAssign> {
+
+    IPage<AssignListDto> pageData(@Param("page") Page<AssignListDto> page, @Param("schoolId") Long schoolId, @Param("semesterId") Long semesterId, @Param("examTypeId") Long examTypeId, @Param("courseCode") String courseCode);
+}

+ 13 - 0
src/main/java/com/qmth/eds/mapper/SysSettingMapper.java

@@ -0,0 +1,13 @@
+package com.qmth.eds.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.qmth.eds.common.entity.SysSetting;
+
+/**
+ * <p>
+ * 系统设置 Mapper 接口
+ * </p>
+ */
+public interface SysSettingMapper extends BaseMapper<SysSetting> {
+
+}

+ 5 - 3
src/main/java/com/qmth/eds/service/AsyncTaskService.java

@@ -3,6 +3,7 @@ package com.qmth.eds.service;
 import com.qmth.eds.common.entity.ExamScheduleTask;
 import com.qmth.eds.common.entity.ExamScheduleTask;
 import com.qmth.eds.common.entity.TBSyncTask;
 import com.qmth.eds.common.entity.TBSyncTask;
 import com.qmth.eds.common.enums.TaskTypeEnum;
 import com.qmth.eds.common.enums.TaskTypeEnum;
+import com.qmth.eds.common.util.ServletUtil;
 import org.springframework.stereotype.Service;
 import org.springframework.stereotype.Service;
 
 
 import javax.annotation.Resource;
 import javax.annotation.Resource;
@@ -14,7 +15,7 @@ import javax.annotation.Resource;
 public class AsyncTaskService {
 public class AsyncTaskService {
 
 
     @Resource
     @Resource
-    private DataSyncService dataSyncService;
+    private WhuDataSyncService whuDataSyncService;
 
 
     @Resource
     @Resource
     private TBSyncTaskService tbSyncTaskService;
     private TBSyncTaskService tbSyncTaskService;
@@ -25,13 +26,14 @@ public class AsyncTaskService {
     public void syncExamData(ExamScheduleTask examScheduleTask, boolean isAuto) {
     public void syncExamData(ExamScheduleTask examScheduleTask, boolean isAuto) {
         // 记录日志
         // 记录日志
         TBSyncTask tbSyncTask = tbSyncTaskService.saveTask(examScheduleTask, TaskTypeEnum.WHU_TEACH_DATA, isAuto);
         TBSyncTask tbSyncTask = tbSyncTaskService.saveTask(examScheduleTask, TaskTypeEnum.WHU_TEACH_DATA, isAuto);
-        dataSyncService.syncWuhanUniversityExamData(examScheduleTask, tbSyncTask, isAuto);
+        whuDataSyncService.syncWuhanUniversityExamData(examScheduleTask, tbSyncTask, isAuto);
     }
     }
 
 
     public void syncStudentScore(Long semesterId, Long examTypeId, Long collegeId, Integer examId) {
     public void syncStudentScore(Long semesterId, Long examTypeId, Long collegeId, Integer examId) {
+        Long schoolId = Long.valueOf(ServletUtil.getRequestHeaderSchoolId().toString());
         // 记录日志
         // 记录日志
         String remark = "云阅卷考试:" + examId;
         String remark = "云阅卷考试:" + examId;
         TBSyncTask tbSyncTask = tbSyncTaskService.saveTask(collegeId, semesterId, examTypeId, TaskTypeEnum.CLOUD_MARKING_STUDENT_SCORE, remark);
         TBSyncTask tbSyncTask = tbSyncTaskService.saveTask(collegeId, semesterId, examTypeId, TaskTypeEnum.CLOUD_MARKING_STUDENT_SCORE, remark);
-        dataSyncService.syncCloudMarkingStudentScoreData(tbSyncTask, examId);
+        whuDataSyncService.syncCloudMarkingStudentScoreData(schoolId, tbSyncTask, examId);
     }
     }
 }
 }

+ 3 - 0
src/main/java/com/qmth/eds/service/BasicSchoolService.java

@@ -3,6 +3,8 @@ package com.qmth.eds.service;
 import com.qmth.eds.common.entity.BasicSchool;
 import com.qmth.eds.common.entity.BasicSchool;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.baomidou.mybatisplus.extension.service.IService;
 
 
+import java.util.List;
+
 /**
 /**
  * <p>
  * <p>
  * 学校表 服务类
  * 学校表 服务类
@@ -13,4 +15,5 @@ import com.baomidou.mybatisplus.extension.service.IService;
  */
  */
 public interface BasicSchoolService extends IService<BasicSchool> {
 public interface BasicSchoolService extends IService<BasicSchool> {
 
 
+    List<BasicSchool> listByUser(String loginName);
 }
 }

+ 29 - 0
src/main/java/com/qmth/eds/service/CdutDataSyncService.java

@@ -0,0 +1,29 @@
+package com.qmth.eds.service;
+
+import com.qmth.eds.common.entity.ExamScheduleTask;
+import com.qmth.eds.common.entity.TBSyncTask;
+import org.springframework.scheduling.annotation.Async;
+
+/**
+ * 同步数据到云阅卷 服务类
+ */
+public interface CdutDataSyncService {
+
+    /**
+     * 武汉大学考务数据同步
+     *
+     * @param examScheduleTask examScheduleTask
+     * @param tbSyncTask       tbSyncTask
+     * @param isAuto           是否定时任务
+     */
+    void syncExamData(ExamScheduleTask examScheduleTask, TBSyncTask tbSyncTask, boolean isAuto);
+
+    /**
+     * 同步云阅卷考生成绩
+     *
+     * @param tbSyncTask tbSyncTask
+     * @param examId     云阅卷考试ID
+     */
+    @Async
+    void syncCloudMarkingStudentScoreData(Long schoolId, TBSyncTask tbSyncTask, Integer examId);
+}

+ 14 - 0
src/main/java/com/qmth/eds/service/CommonCacheService.java

@@ -2,11 +2,13 @@ package com.qmth.eds.service;
 
 
 import com.qmth.eds.bean.auth.AuthBean;
 import com.qmth.eds.bean.auth.AuthBean;
 import com.qmth.eds.bean.dto.AuthOrgInfoDto;
 import com.qmth.eds.bean.dto.AuthOrgInfoDto;
+import com.qmth.eds.bean.dto.syssetting.SimpleObject;
 import com.qmth.eds.bean.result.MenuResult;
 import com.qmth.eds.bean.result.MenuResult;
 import com.qmth.eds.common.entity.*;
 import com.qmth.eds.common.entity.*;
 import com.qmth.eds.common.enums.PrivilegePropertyEnum;
 import com.qmth.eds.common.enums.PrivilegePropertyEnum;
 
 
 import java.util.List;
 import java.util.List;
+import java.util.Map;
 import java.util.Set;
 import java.util.Set;
 
 
 /**
 /**
@@ -240,4 +242,16 @@ public interface CommonCacheService {
      */
      */
     public void removeOrgCache();
     public void removeOrgCache();
 
 
+    /**
+     * 删除系统参数数据
+     *
+     * @param schoolId
+     * @return
+     */
+    String removeSysSetting(Long schoolId);
+
+    /**
+     * 获取学校缓存
+     */
+    Map<String, SimpleObject> getSysSetting(Long schoolId);
 }
 }

+ 10 - 150
src/main/java/com/qmth/eds/service/CommonService.java

@@ -1,22 +1,12 @@
 package com.qmth.eds.service;
 package com.qmth.eds.service;
 
 
-import com.qmth.eds.bean.dto.PrivilegeCacheDto;
-import com.qmth.eds.bean.result.RolePrivilegeResult;
-import com.qmth.eds.common.enums.AppSourceEnum;
 import com.qmth.eds.bean.auth.AuthBean;
 import com.qmth.eds.bean.auth.AuthBean;
-import com.qmth.eds.bean.result.LoginResult;
 import com.qmth.eds.bean.result.MenuResult;
 import com.qmth.eds.bean.result.MenuResult;
-import com.qmth.eds.common.entity.BasicAttachment;
 import com.qmth.eds.common.entity.SysRolePrivilege;
 import com.qmth.eds.common.entity.SysRolePrivilege;
-import com.qmth.eds.common.entity.SysUser;
 import com.qmth.eds.common.entity.SysUserRole;
 import com.qmth.eds.common.entity.SysUserRole;
 import com.qmth.eds.common.enums.PrivilegePropertyEnum;
 import com.qmth.eds.common.enums.PrivilegePropertyEnum;
 
 
-import javax.servlet.http.HttpServletResponse;
-import java.io.File;
-import java.security.NoSuchAlgorithmException;
 import java.util.List;
 import java.util.List;
-import java.util.Map;
 import java.util.Set;
 import java.util.Set;
 
 
 /**
 /**
@@ -34,32 +24,7 @@ public interface CommonService {
      * @param userId
      * @param userId
      * @return
      * @return
      */
      */
-    public MenuResult getUserMenu(Long userId);
-
-    /**
-     * 新增用户权限
-     *
-     * @param sysUser
-     * @param roleId
-     */
-    public void addUserRolePrivilege(SysUser sysUser, Long roleId);
-
-    /**
-     * 新增用户权限
-     *
-     * @param sysUser
-     * @param roleIds
-     */
-    public void addUserRolePrivilege(SysUser sysUser, Long[] roleIds);
-
-    /**
-     * 获取要新增的用户权限集合
-     *
-     * @param sysUser
-     * @param roleIds
-     * @return
-     */
-    List<SysUserRole> disposeUserPrivilege(SysUser sysUser, Long[] roleIds);
+     MenuResult getUserMenu(Long userId);
 
 
     /**
     /**
      * 获取用户角色
      * 获取用户角色
@@ -67,7 +32,7 @@ public interface CommonService {
      * @param userId
      * @param userId
      * @return
      * @return
      */
      */
-    public List<SysUserRole> getUserRolePrivilege(Long userId);
+     List<SysUserRole> getUserRolePrivilege(Long userId);
 
 
     /**
     /**
      * 获取角色权限
      * 获取角色权限
@@ -75,7 +40,7 @@ public interface CommonService {
      * @param roleId
      * @param roleId
      * @return
      * @return
      */
      */
-    public List<SysRolePrivilege> getRolePrivilege(Long roleId);
+     List<SysRolePrivilege> getRolePrivilege(Long roleId);
 
 
     /**
     /**
      * 获取用户权限
      * 获取用户权限
@@ -83,7 +48,7 @@ public interface CommonService {
      * @param userId
      * @param userId
      * @return
      * @return
      */
      */
-    public AuthBean getUserAuth(Long userId);
+     AuthBean getUserAuth(Long userId);
 
 
     /**
     /**
      * 获取鉴权url
      * 获取鉴权url
@@ -91,7 +56,7 @@ public interface CommonService {
      * @param privilegePropertyEnum
      * @param privilegePropertyEnum
      * @return
      * @return
      */
      */
-    public Set<String> getPrivilegeUrl(PrivilegePropertyEnum privilegePropertyEnum);
+     Set<String> getPrivilegeUrl(PrivilegePropertyEnum privilegePropertyEnum);
 
 
     /**
     /**
      * 获取鉴权url
      * 获取鉴权url
@@ -100,118 +65,13 @@ public interface CommonService {
      * @param schoolId
      * @param schoolId
      * @return
      * @return
      */
      */
-    public Set<String> getPrivilegeUrl(PrivilegePropertyEnum privilegePropertyEnum, Long schoolId);
-
-    /**
-     * 给学校赋予权限的公共方法(权限是否启用跟学校联动)
-     *
-     * @param schoolIdSet 所有学校主键set
-     */
-    public void addSchoolPrivilege(Set<Long> schoolIdSet);
-
-    /**
-     * 删除用户信息
-     *
-     * @param userId
-     * @param all
-     */
-    public void removeUserInfo(Long userId, boolean all) throws NoSuchAlgorithmException;
-
-//    /**
-//     * 批量删除用户信息
-//     *
-//     * @param userIds
-//     * @param all
-//     */
-//    public void removeUserInfoBatch(List<Long> userIds, boolean all);
-
-    /**
-     * 修改角色状态
-     *
-     * @param roleIds
-     * @param enable
-     */
-    public void updateRoleEnable(Long[] roleIds, Boolean enable);
-
-    /**
-     * 查询用户或角色权限信息
-     *
-     * @param privilegeCacheDtoList
-     * @return
-     */
-    public RolePrivilegeResult getUserOrRolePrivilege(List<PrivilegeCacheDto> privilegeCacheDtoList);
-
-    /**
-     * 文件预览
-     *
-     * @param path
-     * @return
-     */
-    public String filePreview(String path);
-
-    /**
-     * 文件预览
-     *
-     * @param path
-     * @return
-     */
-    public String filePreviewByPathAndType(String path, String type, Boolean isExpire);
-
-    /**
-     * 文件预览
-     *
-     * @param attachmentId
-     * @return
-     */
-    public Map<String, String> filePreviewByAttachmentId(Long attachmentId, Boolean isExpire);
-
-    /**
-     * 题卡html文件上传,读取文件内容
-     *
-     * @param path
-     * @return
-     */
-    public String readFileContent(String path);
+     Set<String> getPrivilegeUrl(PrivilegePropertyEnum privilegePropertyEnum, Long schoolId);
 
 
     /**
     /**
-     * 下载文件到本地
-     *
-     * @param rootPath   保存目录
-     * @param attachment 附件表对象
-     * @return
-     */
-    public File copyFile(String rootPath, String fileName, BasicAttachment attachment) throws Exception;
-
-    /**
-     * 下载文件到本地并压缩返回
-     *
-     * @param filePath 文件根目录
-     * @param files    需要下载的文件集合
-     */
-    public void downloadFileAndZip(HttpServletResponse response, String filePath, List<File> files);
-
-    /**
-     * 下载文件到本地并压缩返回
-     *
-     * @param filePath 文件根目录
-     * @param time     zip文件名(时间戳)
-     */
-    public void downloadFileAndZip(HttpServletResponse response, String filePath, long time);
-
-//    /**
-//     * 根据orgId查询所有子机构ID集合
-//     *
-//     * @return
-//     */
-//    public Set<Long> listSubOrgIds(Long orgId);
-
-    /**
-     * 登录公用
-     *
-     * @param password
-     * @param sysUser
-     * @param appSource
+     * 查询系统参数值
+     * @param schoolId 学校ID
+     * @param code key
      * @return
      * @return
      */
      */
-    public LoginResult login(String password, SysUser sysUser, AppSourceEnum appSource) throws NoSuchAlgorithmException;
+    String getSysSettingValue(Long schoolId, String code);
 }
 }

+ 26 - 0
src/main/java/com/qmth/eds/service/ExamAssignService.java

@@ -0,0 +1,26 @@
+package com.qmth.eds.service;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.qmth.eds.bean.dto.AssignListDto;
+import com.qmth.eds.common.entity.CloudMarkingScore;
+import com.qmth.eds.common.entity.ExamAssign;
+
+import java.util.Map;
+
+/**
+ * <p>
+ * 赋分管理 服务类
+ * </p>
+ */
+public interface ExamAssignService extends IService<ExamAssign> {
+
+
+    IPage<AssignListDto> pageData(Long semesterId, Long examTypeId, String courseCode, Integer pageNumber, Integer pageSize);
+
+    boolean calcData(Long semesterId, Long examTypeId, String courseCode, String courseName, String formula, Double fullScore, Double passScore, String coefficient);
+
+    IPage<CloudMarkingScore> result(Long semesterId, Long examTypeId, String courseCode, String courseName, String formula, Double fullScore, Integer pageNumber, Integer pageSize);
+
+    Map contrast(Long semesterId, Long examTypeId, String courseCode);
+}

+ 2 - 0
src/main/java/com/qmth/eds/service/ExamSyncTotalService.java

@@ -20,4 +20,6 @@ public interface ExamSyncTotalService extends IService<ExamSyncTotal> {
     void updateDownloadStatusBySchoolIdAndSemesterIdAndExamTypeId(Long schoolId, Long semesterId, Long examTypeId);
     void updateDownloadStatusBySchoolIdAndSemesterIdAndExamTypeId(Long schoolId, Long semesterId, Long examTypeId);
 
 
     List<ExamSyncTotalDownloadDto> listDownloadRecordInfos(Long schoolId, Long semesterId, Long examTypeId);
     List<ExamSyncTotalDownloadDto> listDownloadRecordInfos(Long schoolId, Long semesterId, Long examTypeId);
+
+    ExamSyncTotal getBySemesterIdAndExamTypeIdAndDownloadStatus(Long semesterId, Long examTypeId, boolean status);
 }
 }

+ 23 - 0
src/main/java/com/qmth/eds/service/SysSettingService.java

@@ -0,0 +1,23 @@
+package com.qmth.eds.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.qmth.eds.bean.dto.syssetting.SettingObject;
+import com.qmth.eds.bean.dto.syssetting.SimpleObject;
+import com.qmth.eds.common.entity.SysSetting;
+
+import java.util.List;
+
+/**
+ * <p>
+ * 系统设置 服务类
+ * </p>
+ */
+public interface SysSettingService extends IService<SysSetting> {
+
+    List<SettingObject> getData();
+
+    boolean saveData(List<SettingObject> settingObjects);
+
+    SysSetting getBySchoolId(Long schoolId);
+
+}

+ 2 - 2
src/main/java/com/qmth/eds/service/DataSyncService.java → src/main/java/com/qmth/eds/service/WhuDataSyncService.java

@@ -7,7 +7,7 @@ import org.springframework.scheduling.annotation.Async;
 /**
 /**
  * 同步数据到云阅卷 服务类
  * 同步数据到云阅卷 服务类
  */
  */
-public interface DataSyncService {
+public interface WhuDataSyncService {
 
 
     /**
     /**
      * 武汉大学考务数据同步
      * 武汉大学考务数据同步
@@ -25,5 +25,5 @@ public interface DataSyncService {
      * @param examId     云阅卷考试ID
      * @param examId     云阅卷考试ID
      */
      */
     @Async
     @Async
-    void syncCloudMarkingStudentScoreData(TBSyncTask tbSyncTask, Integer examId);
+    void syncCloudMarkingStudentScoreData(Long schoolId, TBSyncTask tbSyncTask, Integer examId);
 }
 }

+ 1 - 27
src/main/java/com/qmth/eds/service/impl/AuthInfoServiceImpl.java

@@ -182,7 +182,6 @@ public class AuthInfoServiceImpl implements AuthInfoService {
             basicSchoolSet = new HashSet<>();
             basicSchoolSet = new HashSet<>();
             sysOrgSet = new HashSet<>();
             sysOrgSet = new HashSet<>();
         }
         }
-        boolean oss = dictionaryConfig.sysDomain().isOss();
         for (OrgInfo o : orgInfoList) {
         for (OrgInfo o : orgInfoList) {
             orgIdsSet.add(o.getId());
             orgIdsSet.add(o.getId());
             if (authEnum == AuthEnum.OFF_LINE) {
             if (authEnum == AuthEnum.OFF_LINE) {
@@ -203,33 +202,8 @@ public class AuthInfoServiceImpl implements AuthInfoService {
             BasicSchool basicSchool = basicSchoolService.getOne(basicSchoolQueryWrapper);
             BasicSchool basicSchool = basicSchoolService.getOne(basicSchoolQueryWrapper);
             if (Objects.isNull(basicSchool)) {//不存在则创建学校
             if (Objects.isNull(basicSchool)) {//不存在则创建学校
                 basicSchool = new BasicSchool(o.getId(), o.getCode(), o.getName(), o.getAccessKey(), o.getAccessSecret());
                 basicSchool = new BasicSchool(o.getId(), o.getCode(), o.getName(), o.getAccessKey(), o.getAccessSecret());
-                if (Objects.nonNull(o.getLogo()) && (!o.getLogo().startsWith("https:") || !o.getLogo().startsWith("http"))) {
-                    String filePath = dictionaryConfig.fssLocalFileDomain().getConfig() + File.separator + SystemConstant.getUuid() + ".jpg";
-                    File logoFile = new File(filePath);
-                    if (!logoFile.getParentFile().exists()) {
-                        // 不存在则创建父目录及子文件
-                        logoFile.getParentFile().mkdirs();
-                        logoFile.createNewFile();
-                    }
-                    SystemConstant.base64ToImage(o.getLogo(), filePath);
+                basicSchool.setLogo(o.getLogo());
 
 
-                    if (oss) {
-                        LocalDateTime nowTime = LocalDateTime.now();
-                        StringJoiner stringJoiner = new StringJoiner("");
-                        stringJoiner.add(UploadFileEnum.FILE.name().toLowerCase()).add(File.separator)
-                                .add(String.valueOf(nowTime.getYear())).add(File.separator)
-                                .add(String.format("%02d", nowTime.getMonthValue())).add(File.separator)
-                                .add(String.format("%02d", nowTime.getDayOfMonth())).add(File.separator)
-                                .add(SystemConstant.getUuid()).add(".jpg");
-                        fileStoreUtil.ossUpload(stringJoiner.toString(), logoFile, DigestUtils.md5Hex(new FileInputStream(logoFile)), UploadFileEnum.FILE.getFssType());
-                        logoFile.delete();
-                        basicSchool.setLogo(fileStoreUtil.getPrivateUrl(stringJoiner.toString(), UploadFileEnum.FILE.getFssType()));
-                    } else {
-                        basicSchool.setLogo(filePath);
-                    }
-                } else {
-                    basicSchool.setLogo(o.getLogo());
-                }
                 basicSchoolSet.add(basicSchool);
                 basicSchoolSet.add(basicSchool);
             }
             }
 
 

+ 26 - 0
src/main/java/com/qmth/eds/service/impl/BasicSchoolServiceImpl.java

@@ -1,10 +1,18 @@
 package com.qmth.eds.service.impl;
 package com.qmth.eds.service.impl;
 
 
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.qmth.eds.common.entity.BasicSchool;
 import com.qmth.eds.common.entity.BasicSchool;
+import com.qmth.eds.common.entity.SysUser;
 import com.qmth.eds.mapper.BasicSchoolMapper;
 import com.qmth.eds.mapper.BasicSchoolMapper;
 import com.qmth.eds.service.BasicSchoolService;
 import com.qmth.eds.service.BasicSchoolService;
+import com.qmth.eds.service.SysUserService;
 import org.springframework.stereotype.Service;
 import org.springframework.stereotype.Service;
+import org.springframework.util.CollectionUtils;
+
+import javax.annotation.Resource;
+import java.util.List;
+import java.util.stream.Collectors;
 
 
 /**
 /**
  * <p>
  * <p>
@@ -17,4 +25,22 @@ import org.springframework.stereotype.Service;
 @Service
 @Service
 public class BasicSchoolServiceImpl extends ServiceImpl<BasicSchoolMapper, BasicSchool> implements BasicSchoolService {
 public class BasicSchoolServiceImpl extends ServiceImpl<BasicSchoolMapper, BasicSchool> implements BasicSchoolService {
 
 
+    @Resource
+    SysUserService sysUserService;
+
+    @Override
+    public List<BasicSchool> listByUser(String loginName) {
+        QueryWrapper<SysUser> sysUserQueryWrapper = new QueryWrapper<>();
+        sysUserQueryWrapper.lambda().eq(SysUser::getLoginName, loginName)
+                .isNotNull(SysUser::getSchoolId);
+        List<SysUser> sysUsers = sysUserService.list(sysUserQueryWrapper);
+        if (!CollectionUtils.isEmpty(sysUsers)) {
+            List<Long> schoolIds = sysUsers.stream().map(SysUser::getSchoolId).collect(Collectors.toList());
+            QueryWrapper<BasicSchool> basicSchoolQueryWrapper = new QueryWrapper<>();
+            basicSchoolQueryWrapper.lambda().in(BasicSchool::getId, schoolIds)
+                    .orderByAsc(BasicSchool::getId);
+            return this.list(basicSchoolQueryWrapper);
+        }
+        return null;
+    }
 }
 }

+ 504 - 0
src/main/java/com/qmth/eds/service/impl/CdutDataSyncServiceImpl.java

@@ -0,0 +1,504 @@
+package com.qmth.eds.service.impl;
+
+import cn.hutool.core.bean.BeanUtil;
+import com.alibaba.excel.EasyExcel;
+import com.alibaba.excel.ExcelWriter;
+import com.alibaba.excel.write.metadata.WriteSheet;
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
+import com.qmth.boot.api.exception.ApiException;
+import com.qmth.eds.common.contant.SystemConstant;
+import com.qmth.eds.common.entity.*;
+import com.qmth.eds.common.enums.ExceptionResultEnum;
+import com.qmth.eds.common.enums.TaskResultEnum;
+import com.qmth.eds.common.enums.TaskStatusEnum;
+import com.qmth.eds.common.tools.CdutUtils;
+import com.qmth.eds.common.tools.CloudMarkingUtils;
+import com.qmth.eds.common.tools.WhuUtils;
+import com.qmth.eds.common.util.FileUtil;
+import com.qmth.eds.common.util.ServletUtil;
+import com.qmth.eds.service.*;
+import org.apache.commons.codec.digest.DigestUtils;
+import org.apache.commons.lang3.StringUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.scheduling.annotation.Async;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import javax.annotation.Resource;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.time.Instant;
+import java.time.LocalDate;
+import java.time.ZoneId;
+import java.util.*;
+import java.util.stream.Collectors;
+
+/**
+ * 同步服务类
+ */
+@Service
+public class CdutDataSyncServiceImpl implements CdutDataSyncService {
+
+    private static final Logger log = LoggerFactory.getLogger(CdutDataSyncServiceImpl.class);
+
+    @Resource
+    private TBSyncTaskService tbSyncTaskService;
+
+    @Resource
+    private CdutUtils cdutUtils;
+
+    @Resource
+    private CloudMarkingUtils cloudMarkingUtils;
+
+    @Resource
+    private CloudMarkingScoreService cloudMarkingScoreService;
+
+    @Resource
+    private CloudMarkingScoreForeignService cloudMarkingScoreForeignService;
+
+    @Resource
+    private ExamSyncStudentService examSyncStudentService;
+
+    @Resource
+    private ExamSyncStudentTempService examSyncStudentTempService;
+
+    @Resource
+    private ExamSyncTotalService examSyncTotalService;
+
+    @Resource
+    private BasicMessageService basicMessageService;
+
+    @Async
+    @Override
+    public void syncExamData(ExamScheduleTask examScheduleTask, TBSyncTask tbSyncTask, boolean isAuto) {
+        // 同步初始参数
+        TaskResultEnum result = null;
+        String errorMessage = "";
+        Long schoolId = examScheduleTask.getSchoolId();
+        String schoolName = examScheduleTask.getSchoolName();
+        Long semesterId = examScheduleTask.getSemesterId();
+        String semesterName = examScheduleTask.getSemesterName();
+        Long examTypeId = examScheduleTask.getExamTypeId();
+        String examTypeName = examScheduleTask.getExamTypeName();
+        File txtFile = null;
+        FileInputStream fis = null;
+        // 汇总表ID
+        Long examSyncTotalId = SystemConstant.getDbUuid();
+        try {
+            // 同步中
+            tbSyncTaskService.updateStatusAndResultById(tbSyncTask.getId(), TaskStatusEnum.RUNNING, null, null);
+            // 获取token
+            String token = cdutUtils.getAccessToken(schoolId);
+            if (StringUtils.isBlank(token)) {
+                throw ExceptionResultEnum.ERROR.exception("获取AccessToken失败");
+            }
+            // 调用接口
+            List<ExamSyncStudentTemp> examSyncStudentTemps = cdutUtils.getKwData(schoolId, token);
+
+            examSyncStudentTemps.forEach(m -> {
+                m.setId(SystemConstant.getDbUuid());
+                m.setSchoolId(schoolId);
+                m.setExamSyncTotalId(examSyncTotalId);
+            });
+            // 保存临时考务数据
+            examSyncStudentTempService.saveBatch(examSyncStudentTemps);
+
+            // 生成数据文件,用来比较内容是否有变动
+            txtFile = createTxt(schoolId, examSyncStudentTemps);
+            String txtFileMd5 = null;
+
+            if (txtFile != null) {
+                fis = new FileInputStream(txtFile);
+                txtFileMd5 = DigestUtils.md5Hex(fis);
+            }
+            // 校验数据是否变动,若变动,需要新增
+            if (canAddTotal(schoolId, semesterId, examTypeId, examSyncStudentTemps.size(), txtFileMd5)) {
+                // 保存到正式表
+                List<ExamSyncStudent> examSyncStudents = examSyncStudentTemps.stream().map(m -> {
+                    ExamSyncStudent examSyncStudent = new ExamSyncStudent();
+                    BeanUtil.copyProperties(m, examSyncStudent);
+                    examSyncStudent.setId(SystemConstant.getDbUuid());
+                    return examSyncStudent;
+                }).collect(Collectors.toList());
+                examSyncStudentService.saveBatch(examSyncStudents);
+
+                // 将以前数据设置为不可下载
+                examSyncTotalService.updateDownloadStatusBySchoolIdAndSemesterIdAndExamTypeId(schoolId, semesterId, examTypeId);
+
+                // 生成汇总数据
+                long syncDate;
+                if (isAuto) {
+                    ZoneId zone = ZoneId.systemDefault();
+                    Instant instant = LocalDate.now().atStartOfDay().atZone(zone).toInstant();
+                    Date date = Date.from(instant);
+                    syncDate = date.getTime();
+                } else {
+                    syncDate = System.currentTimeMillis();
+                }
+                int colleges = Integer.parseInt(String.valueOf(examSyncStudentTemps.stream().map(ExamSyncStudentTemp::getJgmc).filter(StringUtils::isNotBlank).distinct().count()));
+                int subjects = Integer.parseInt(String.valueOf(examSyncStudentTemps.stream().map(ExamSyncStudentTemp::getKch).filter(StringUtils::isNotBlank).distinct().count()));
+                int students = examSyncStudentTemps.size();
+                ExamSyncTotal examSyncTotal = new ExamSyncTotal(syncDate, schoolId, schoolName, semesterId, semesterName, examTypeId, examTypeName, colleges, subjects, students, txtFileMd5);
+                examSyncTotal.setId(examSyncTotalId);
+                examSyncTotalService.save(examSyncTotal);
+                // 生成excel文件
+                File excelFile = createExcel(schoolId, examSyncStudents);
+
+                // 更新文件路径
+                examSyncTotal.setFileName(excelFile.getName());
+                examSyncTotal.setFilePath(excelFile.getPath());
+                examSyncTotalService.updateById(examSyncTotal);
+
+                // 下载过学校+学期+考试类型  文件的实施人员发送短信
+                basicMessageService.sendTeachDataChangeNotice(schoolId, semesterId, examTypeId);
+            }
+            result = TaskResultEnum.SUCCESS;
+        } catch (ApiException | IOException e) {
+            result = TaskResultEnum.ERROR;
+            errorMessage = errorMessage + e.getMessage();
+        } finally {
+            // 删除临时表数据
+            examSyncStudentTempService.deleteByExamSyncTotalId(examSyncTotalId);
+            // 更新任务状态
+            tbSyncTaskService.updateStatusAndResultById(tbSyncTask.getId(), TaskStatusEnum.FINISH, result, errorMessage);
+
+            // 关闭fis流
+            if (fis != null) {
+                try {
+                    fis.close();
+                } catch (IOException e) {
+                    e.printStackTrace();
+                }
+            }
+
+            // 删除txt文件
+            if (txtFile != null) {
+                txtFile.delete();
+            }
+        }
+    }
+
+    @Override
+    public void syncCloudMarkingStudentScoreData(Long schoolId, TBSyncTask tbSyncTask, Integer examId) {
+        // 同步初始参数
+        TaskResultEnum result = null;
+        String errorMessage = "";
+        Long collegeId = tbSyncTask.getSchoolId();
+        Long semesterId = tbSyncTask.getSemesterId();
+        Long examTypeId = tbSyncTask.getExamTypeId();
+        File txtFile = null;
+        FileInputStream fis = null;
+        // 汇总表ID
+        try {
+            // 同步中
+            tbSyncTaskService.updateStatusAndResultById(tbSyncTask.getId(), TaskStatusEnum.RUNNING, null, null);
+
+            Map<String, String> mapSource = new HashMap<>();
+            mapSource.put("examId", String.valueOf(examId));
+            int totalCount = cloudMarkingUtils.getStudentCount(schoolId, mapSource, collegeId);
+            List<CloudMarkingScore> cloudMarkingScoreList = new ArrayList<>();
+            if (totalCount > 0) {
+                int pageSize = SystemConstant.PAGE_SIZE;
+                int mod = totalCount % pageSize;
+                int pageNos = mod == 0 ? totalCount / pageSize : totalCount / pageSize + 1;
+                for (int i = 1; i <= pageNos; i++) {
+                    List<JSONObject> students = cloudMarkingUtils.getStudentScore(schoolId, mapSource, collegeId, i, pageSize);
+                    List<CloudMarkingScore> cloudMarkingScores = students.stream().map(m -> {
+                        CloudMarkingScore cloudMarkingScore = new CloudMarkingScore();
+                        cloudMarkingScore.setId(SystemConstant.getDbUuid());
+                        cloudMarkingScore.setSchoolId(collegeId);
+                        cloudMarkingScore.setSemesterId(semesterId);
+                        cloudMarkingScore.setExamTypeId(examTypeId);
+                        cloudMarkingScore.setExamId(examId);
+                        cloudMarkingScore.setExamCode(m.getString("examCode"));
+                        cloudMarkingScore.setExamNumber(m.getString("examNumber"));
+                        cloudMarkingScore.setStudentCode(m.getString("studentCode"));
+                        cloudMarkingScore.setName(m.getString("name"));
+                        cloudMarkingScore.setSubjectCode(m.getString("subjectCode"));
+                        cloudMarkingScore.setSubjectName(m.getString("subjectName"));
+                        cloudMarkingScore.setPaperType(m.getString("paperType"));
+                        cloudMarkingScore.setCollege(m.getString("college"));
+                        cloudMarkingScore.setClassName(m.getString("className"));
+                        cloudMarkingScore.setTeacher(m.getString("teacher"));
+                        cloudMarkingScore.setStatus(m.getInteger("status"));
+//                        cloudMarkingScore.setSheetUrls(m.getString("sheetUrls"));
+                        cloudMarkingScore.setTotalScore(m.getString("totalScore"));
+                        cloudMarkingScore.setObjectiveScore(m.getString("objectiveScore"));
+                        cloudMarkingScore.setSubjectiveScore(m.getString("subjectiveScore"));
+//                        cloudMarkingScore.setObjectiveScoreDetail(m.getString("objectiveScoreDetail"));
+//                        cloudMarkingScore.setSubjectiveScoreDetail(m.getString("subjectiveScoreDetail"));
+//                        cloudMarkingScore.setMarkTags(m.getString("markTags"));
+                        return cloudMarkingScore;
+                    }).collect(Collectors.toList());
+                    cloudMarkingScoreList.addAll(cloudMarkingScores);
+                }
+            }
+
+            //2.调用教务系统接口回传成绩
+            if (!cloudMarkingScoreList.isEmpty()) {
+                saveScoreData(collegeId, semesterId, examTypeId, examId, cloudMarkingScoreList);
+            }
+
+            result = TaskResultEnum.SUCCESS;
+        } catch (ApiException e) {
+            result = TaskResultEnum.ERROR;
+            errorMessage = errorMessage + e.getMessage();
+        } finally {
+            // 删除临时表数据
+            // 更新任务状态
+            tbSyncTaskService.updateStatusAndResultById(tbSyncTask.getId(), TaskStatusEnum.FINISH, result, errorMessage);
+
+            // 关闭fis流
+            if (fis != null) {
+                try {
+                    fis.close();
+                } catch (IOException e) {
+                    e.printStackTrace();
+                }
+            }
+
+            // 删除txt文件
+            if (txtFile != null) {
+                txtFile.delete();
+            }
+        }
+    }
+
+    @Transactional
+    public void saveScoreData(Long collegeId, Long semesterId, Long examTypeId, Integer examId, List<CloudMarkingScore> cloudMarkingScoreList) {
+        Long schoolId = Long.valueOf(ServletUtil.getRequestHeaderSchoolId().toString());
+        // 删除旧数据
+        cloudMarkingScoreService.deleteByKeys(collegeId, semesterId, examTypeId, examId);
+
+        List<CloudMarkingScore> data = new ArrayList<>();
+        //1000条提交一次
+        for (CloudMarkingScore markingScore : cloudMarkingScoreList) {
+            if (data.size() == 1000) {
+                cloudMarkingScoreService.saveBatch(data);
+                data.clear();
+            }
+            data.add(markingScore);
+        }
+        //将剩下的数据也导入
+        if (!data.isEmpty()) {
+            cloudMarkingScoreService.saveBatch(data);
+        }
+
+        // 查询对外数据
+        QueryWrapper<ExamSyncTotal> totalQueryWrapper = new QueryWrapper<>();
+        totalQueryWrapper.lambda().eq(ExamSyncTotal::getSchoolId, schoolId)
+                .eq(ExamSyncTotal::getSemesterId, semesterId)
+                .eq(ExamSyncTotal::getExamTypeId, examTypeId)
+                .eq(ExamSyncTotal::getDownloadStatus, true)
+                .orderByDesc(ExamSyncTotal::getSyncDate);
+        List<ExamSyncTotal> examSyncTotalList = examSyncTotalService.list(totalQueryWrapper);
+        List<CloudMarkingScoreForeign> cloudMarkingScoreForeigns = new ArrayList<>();
+        if (!examSyncTotalList.isEmpty()) {
+            ExamSyncTotal examSyncTotal = examSyncTotalList.get(0);
+            List<ExamSyncStudent> examSyncStudents = examSyncStudentService.listByExamSyncTotalId(examSyncTotal);
+            for (CloudMarkingScore cloudMarkingScore : cloudMarkingScoreList) {
+                Optional<ExamSyncStudent> optional = examSyncStudents.stream()
+                        .filter(s -> s.getJxbmc().equals(cloudMarkingScore.getClassName())
+                                && ((StringUtils.isBlank(s.getCloudMarkingCourseCode()) && s.getKch().equals(cloudMarkingScore.getSubjectCode())) || (StringUtils.isNotBlank(s.getCloudMarkingCourseCode()) && s.getCloudMarkingCourseCode().equals(cloudMarkingScore.getSubjectCode())))
+                                && s.getXh().equals(cloudMarkingScore.getStudentCode())).findFirst();
+                if (!optional.isPresent()) {
+                    cloudMarkingScoreForeigns.add(new CloudMarkingScoreForeign(collegeId, semesterId, examTypeId, examId, null, null, null, cloudMarkingScore.getSubjectCode(), cloudMarkingScore.getSubjectName(), cloudMarkingScore.getStudentCode(), cloudMarkingScore.getTotalScore()));
+                } else {
+                    ExamSyncStudent examSyncStudent = optional.get();
+                    cloudMarkingScoreForeigns.add(new CloudMarkingScoreForeign(collegeId, semesterId, examTypeId, examId, examSyncStudent.getXnm(), examSyncStudent.getXqm(), examSyncStudent.getJxbId(), examSyncStudent.getKch(), examSyncStudent.getKcmc(), examSyncStudent.getXh(), cloudMarkingScore.getTotalScore()));
+                }
+            }
+        } else {
+            for (CloudMarkingScore cloudMarkingScore : cloudMarkingScoreList) {
+                cloudMarkingScoreForeigns.add(new CloudMarkingScoreForeign(collegeId, semesterId, examTypeId, examId, null, null, null, cloudMarkingScore.getSubjectCode(), cloudMarkingScore.getSubjectName(), cloudMarkingScore.getStudentCode(), cloudMarkingScore.getTotalScore()));
+            }
+        }
+
+        // 删除全量数据
+        UpdateWrapper<CloudMarkingScoreForeign> updateWrapper = new UpdateWrapper<>();
+        updateWrapper.lambda().eq(CloudMarkingScoreForeign::getSchoolId, collegeId)
+                .eq(CloudMarkingScoreForeign::getSemesterId, semesterId)
+                .eq(CloudMarkingScoreForeign::getExamTypeId, examTypeId)
+                .eq(CloudMarkingScoreForeign::getExamId, examId);
+        cloudMarkingScoreForeignService.remove(updateWrapper);
+
+        List<CloudMarkingScoreForeign> foreignData = new ArrayList<>();
+        //1000条提交一次
+        for (CloudMarkingScoreForeign scoreForeign : cloudMarkingScoreForeigns) {
+            if (foreignData.size() == 1000) {
+                cloudMarkingScoreForeignService.saveBatch(foreignData);
+                data.clear();
+            }
+            foreignData.add(scoreForeign);
+        }
+        //将剩下的数据也导入
+        if (!foreignData.isEmpty()) {
+            cloudMarkingScoreForeignService.saveBatch(foreignData);
+        }
+    }
+
+    /**
+     * 检查数据是否有变动,需要新增一条新同步记录
+     *
+     * @param schoolId   学校ID
+     * @param semesterId 学期ID
+     * @param examTypeId 考试类型ID
+     * @param count      考生数量
+     * @param txtFileMd5 txt文件md5
+     * @return true:可以新增  false:不能新增
+     */
+    private boolean canAddTotal(Long schoolId, Long semesterId, Long examTypeId, int count, String txtFileMd5) {
+        // txtFileMd5为空,无法校验,返回true
+        if (txtFileMd5 == null) {
+            return true;
+        }
+
+        // 查询上一次同步数据,先比较数量
+        QueryWrapper<ExamSyncTotal> queryWrapper = new QueryWrapper<>();
+        queryWrapper.lambda().eq(ExamSyncTotal::getSchoolId, schoolId)
+                .eq(ExamSyncTotal::getSemesterId, semesterId)
+                .eq(ExamSyncTotal::getExamTypeId, examTypeId)
+                .orderByDesc(ExamSyncTotal::getSyncDate)
+                .orderByDesc(ExamSyncTotal::getCreateTime);
+        List<ExamSyncTotal> examSyncTotals = examSyncTotalService.list(queryWrapper);
+        // 没有同步记录,返回true
+        if (examSyncTotals.isEmpty()) {
+            return true;
+        }
+        ExamSyncTotal examSyncTotal = examSyncTotals.get(0);
+        // 上一次同步数据量与本次不一样,返回true
+        if (count != examSyncTotal.getStudents()) {
+            return true;
+        }
+        // 数据内容有变动,返回 true
+        return !txtFileMd5.equals(examSyncTotal.getDataMd5());
+    }
+
+    /**
+     * 生成txt,比较md5
+     *
+     * @param examSyncStudentTemps list
+     */
+    private File createTxt(Long schoolId, List<ExamSyncStudentTemp> examSyncStudentTemps) {
+        // 按学号排序
+        examSyncStudentTemps.sort(Comparator.comparing(ExamSyncStudentTemp::getXh));
+
+        List<String> list = examSyncStudentTemps.stream().map(m -> {
+            StringJoiner stringJoiner = new StringJoiner("|");
+            stringJoiner.add(m.getXnm())
+                    .add(m.getXqm())
+                    .add(m.getJxbId())
+                    .add(m.getJxbmc())
+                    .add(m.getKch())
+                    .add(m.getKcmc())
+                    .add(m.getJgh())
+                    .add(m.getXm())
+                    .add(m.getKkbm())
+                    .add(m.getXf())
+                    .add(m.getXh())
+                    .add(m.getXsxm())
+                    .add(m.getJgmc())
+                    .add(m.getZymc())
+                    .add(m.getCxbj())
+                    .add(m.getNjdmId())
+                    .add(m.getZwh())
+                    .add(m.getCdmc())
+                    .add(m.getKsbz());
+            return stringJoiner.toString();
+        }).collect(Collectors.toList());
+
+        File file = null;
+        try {
+            String fileName = "file-folder" + File.separator + schoolId + File.separator + System.currentTimeMillis() + ".txt";
+            file = FileUtil.writeTxt(fileName, list);
+        } catch (IOException e) {
+            log.error("数据txt文件生成失败");
+        }
+        return file;
+    }
+
+    /**
+     * 生成excel文件
+     *
+     * @param examSyncStudents 考务数据
+     */
+    private File createExcel(Long schoolId, List<ExamSyncStudent> examSyncStudents) throws IOException {
+        List<List<String>> head = new ArrayList<>();
+        List<String> headTitle0 = new ArrayList<>();
+        headTitle0.add("学年");
+        List<String> headTitle1 = new ArrayList<>();
+        headTitle1.add("学期");
+        List<String> headTitle2 = new ArrayList<>();
+        headTitle2.add("教学班ID");
+        List<String> headTitle3 = new ArrayList<>();
+        headTitle3.add("教学班名称");
+        List<String> headTitle4 = new ArrayList<>();
+        headTitle4.add("课程号");
+        List<String> headTitle5 = new ArrayList<>();
+        headTitle5.add("课程名称");
+        List<String> headTitle6 = new ArrayList<>();
+        headTitle6.add("工号");
+        List<String> headTitle7 = new ArrayList<>();
+        headTitle7.add("姓名");
+        List<String> headTitle8 = new ArrayList<>();
+        headTitle8.add("开课部门");
+        List<String> headTitle9 = new ArrayList<>();
+        headTitle9.add("学分");
+        List<String> headTitle10 = new ArrayList<>();
+        headTitle10.add("学号");
+        List<String> headTitle11 = new ArrayList<>();
+        headTitle11.add("学生姓名");
+        List<String> headTitle12 = new ArrayList<>();
+        headTitle12.add("学院");
+        List<String> headTitle13 = new ArrayList<>();
+        headTitle13.add("专业");
+        List<String> headTitle14 = new ArrayList<>();
+        headTitle14.add("重修标记");
+        List<String> headTitle15 = new ArrayList<>();
+        headTitle15.add("年级");
+        List<String> headTitle16 = new ArrayList<>();
+        headTitle16.add("座位号");
+        List<String> headTitle17 = new ArrayList<>();
+        headTitle17.add("场地名称");
+        List<String> headTitle18 = new ArrayList<>();
+        headTitle18.add("考试备注");
+
+
+        head.add(headTitle0);
+        head.add(headTitle1);
+        head.add(headTitle2);
+        head.add(headTitle3);
+        head.add(headTitle4);
+        head.add(headTitle5);
+        head.add(headTitle6);
+        head.add(headTitle7);
+        head.add(headTitle8);
+        head.add(headTitle9);
+        head.add(headTitle10);
+        head.add(headTitle11);
+        head.add(headTitle12);
+        head.add(headTitle13);
+        head.add(headTitle14);
+        head.add(headTitle15);
+        head.add(headTitle16);
+        head.add(headTitle17);
+        head.add(headTitle18);
+
+        String fileName = "file-folder" + File.separator + schoolId + File.separator + System.currentTimeMillis() + ".xlsx";
+        File file = new File(fileName);
+        if (!file.exists()) {
+            file.createNewFile();
+        }
+        ExcelWriter excelWriter = EasyExcel.write(file).build();
+        //动态表头
+        WriteSheet writeSheet1 = EasyExcel.writerSheet(0, "考务数据").head(head).build();
+        excelWriter.write(examSyncStudents, writeSheet1);
+        excelWriter.finish();
+
+        return file;
+    }
+}

+ 5 - 3
src/main/java/com/qmth/eds/service/impl/CloudMarkingExamServiceImpl.java

@@ -7,7 +7,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.qmth.eds.common.contant.SystemConstant;
 import com.qmth.eds.common.contant.SystemConstant;
 import com.qmth.eds.common.entity.CloudMarkingExam;
 import com.qmth.eds.common.entity.CloudMarkingExam;
 import com.qmth.eds.common.enums.ExceptionResultEnum;
 import com.qmth.eds.common.enums.ExceptionResultEnum;
-import com.qmth.eds.common.tools.CloudMarkingUtil;
+import com.qmth.eds.common.tools.CloudMarkingUtils;
 import com.qmth.eds.common.util.ServletUtil;
 import com.qmth.eds.common.util.ServletUtil;
 import com.qmth.eds.mapper.CloudMarkingExamMapper;
 import com.qmth.eds.mapper.CloudMarkingExamMapper;
 import com.qmth.eds.service.CloudMarkingExamService;
 import com.qmth.eds.service.CloudMarkingExamService;
@@ -22,7 +22,7 @@ import java.util.stream.Collectors;
 public class CloudMarkingExamServiceImpl extends ServiceImpl<CloudMarkingExamMapper, CloudMarkingExam> implements CloudMarkingExamService {
 public class CloudMarkingExamServiceImpl extends ServiceImpl<CloudMarkingExamMapper, CloudMarkingExam> implements CloudMarkingExamService {
 
 
     @Resource
     @Resource
-    CloudMarkingUtil cloudMarkingUtil;
+    CloudMarkingUtils cloudMarkingUtils;
 
 
     @Override
     @Override
     public List<CloudMarkingExam> listExam(Long collegeId) {
     public List<CloudMarkingExam> listExam(Long collegeId) {
@@ -35,6 +35,8 @@ public class CloudMarkingExamServiceImpl extends ServiceImpl<CloudMarkingExamMap
     @Transactional
     @Transactional
     @Override
     @Override
     public List<CloudMarkingExam> syncExam(Long collegeId) {
     public List<CloudMarkingExam> syncExam(Long collegeId) {
+        Long schoolId = Long.valueOf(ServletUtil.getRequestHeaderSchoolId().toString());
+
         if(collegeId == null){
         if(collegeId == null){
             throw ExceptionResultEnum.ERROR.exception("请选择学院");
             throw ExceptionResultEnum.ERROR.exception("请选择学院");
         }
         }
@@ -42,7 +44,7 @@ public class CloudMarkingExamServiceImpl extends ServiceImpl<CloudMarkingExamMap
         updateWrapper.lambda().eq(CloudMarkingExam::getSchoolId, collegeId);
         updateWrapper.lambda().eq(CloudMarkingExam::getSchoolId, collegeId);
         this.remove(updateWrapper);
         this.remove(updateWrapper);
 
 
-        List<JSONObject> objectList = cloudMarkingUtil.getExam(collegeId, SystemConstant.PAGE_NUMBER_MIN, SystemConstant.PAGE_SIZE);
+        List<JSONObject> objectList = cloudMarkingUtils.getExam(schoolId, collegeId, SystemConstant.PAGE_NUMBER_MIN, SystemConstant.PAGE_SIZE);
         if (objectList.isEmpty()) {
         if (objectList.isEmpty()) {
             throw ExceptionResultEnum.ERROR.exception("未查询到考试");
             throw ExceptionResultEnum.ERROR.exception("未查询到考试");
         }
         }

+ 32 - 5
src/main/java/com/qmth/eds/service/impl/CommonCacheServiceImpl.java

@@ -1,16 +1,19 @@
 package com.qmth.eds.service.impl;
 package com.qmth.eds.service.impl;
 
 
+import com.alibaba.fastjson.JSON;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.qmth.boot.core.solar.model.AppInfo;
 import com.qmth.boot.core.solar.model.AppInfo;
 import com.qmth.boot.core.solar.model.OrgInfo;
 import com.qmth.boot.core.solar.model.OrgInfo;
 import com.qmth.boot.core.solar.service.SolarService;
 import com.qmth.boot.core.solar.service.SolarService;
 import com.qmth.eds.bean.auth.AuthBean;
 import com.qmth.eds.bean.auth.AuthBean;
 import com.qmth.eds.bean.dto.AuthOrgInfoDto;
 import com.qmth.eds.bean.dto.AuthOrgInfoDto;
+import com.qmth.eds.bean.dto.syssetting.SettingObject;
+import com.qmth.eds.bean.dto.syssetting.SimpleObject;
 import com.qmth.eds.bean.result.MenuResult;
 import com.qmth.eds.bean.result.MenuResult;
-import com.qmth.eds.common.entity.*;
 import com.qmth.eds.common.contant.SystemConstant;
 import com.qmth.eds.common.contant.SystemConstant;
-import com.qmth.eds.service.*;
+import com.qmth.eds.common.entity.*;
 import com.qmth.eds.common.enums.PrivilegePropertyEnum;
 import com.qmth.eds.common.enums.PrivilegePropertyEnum;
+import com.qmth.eds.service.*;
 import org.slf4j.Logger;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.slf4j.LoggerFactory;
 import org.springframework.cache.annotation.CacheEvict;
 import org.springframework.cache.annotation.CacheEvict;
@@ -19,9 +22,7 @@ import org.springframework.cache.annotation.Cacheable;
 import org.springframework.stereotype.Service;
 import org.springframework.stereotype.Service;
 
 
 import javax.annotation.Resource;
 import javax.annotation.Resource;
-import java.util.List;
-import java.util.Objects;
-import java.util.Set;
+import java.util.*;
 import java.util.stream.Collectors;
 import java.util.stream.Collectors;
 
 
 /**
 /**
@@ -50,6 +51,9 @@ public class CommonCacheServiceImpl implements CommonCacheService {
     @Resource
     @Resource
     SysRoleService sysRoleService;
     SysRoleService sysRoleService;
 
 
+    @Resource
+    SysSettingService sysSettingService;
+
     @Resource
     @Resource
     SolarService solarService;
     SolarService solarService;
 
 
@@ -399,4 +403,27 @@ public class CommonCacheServiceImpl implements CommonCacheService {
     @CacheEvict(value = SystemConstant.ORG_CACHE, allEntries = true)
     @CacheEvict(value = SystemConstant.ORG_CACHE, allEntries = true)
     public void removeOrgCache() {
     public void removeOrgCache() {
     }
     }
+
+    @Override
+    @CacheEvict(value = SystemConstant.SYS_SETTING_CACHE, key = "#p0")
+    public String removeSysSetting(Long schoolId) {
+        return null;
+    }
+
+    @Override
+    @Cacheable(value = SystemConstant.SYS_SETTING_CACHE, key = "#p0")
+    public Map<String, SimpleObject> getSysSetting(Long schoolId) {
+        Map<String, SimpleObject> map = new HashMap<>();
+        SysSetting sysSetting = sysSettingService.getBySchoolId(schoolId);
+        if (sysSetting != null) {
+            String parameterObject = sysSetting.getParameterObject();
+            List<SettingObject> settingObjects = JSON.parseArray(parameterObject, SettingObject.class);
+            for (SettingObject settingObject : settingObjects) {
+                for (SimpleObject simpleObject : settingObject.getData()) {
+                    map.put(simpleObject.getCode(), simpleObject);
+                }
+            }
+        }
+        return map;
+    }
 }
 }

+ 20 - 676
src/main/java/com/qmth/eds/service/impl/CommonServiceImpl.java

@@ -1,47 +1,33 @@
 package com.qmth.eds.service.impl;
 package com.qmth.eds.service.impl;
 
 
-import cn.hutool.core.io.FileUtil;
-import cn.hutool.core.util.ZipUtil;
-import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
-import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
 import com.google.common.reflect.TypeToken;
 import com.google.common.reflect.TypeToken;
 import com.google.gson.Gson;
 import com.google.gson.Gson;
-import com.qmth.boot.core.enums.Platform;
 import com.qmth.eds.bean.auth.AuthBean;
 import com.qmth.eds.bean.auth.AuthBean;
-import com.qmth.eds.bean.auth.ExpireTimeBean;
 import com.qmth.eds.bean.dto.MenuDto;
 import com.qmth.eds.bean.dto.MenuDto;
 import com.qmth.eds.bean.dto.MenuPrivilegeDto;
 import com.qmth.eds.bean.dto.MenuPrivilegeDto;
-import com.qmth.eds.bean.dto.OrgDto;
-import com.qmth.eds.bean.dto.PrivilegeCacheDto;
-import com.qmth.eds.bean.result.*;
+import com.qmth.eds.bean.dto.syssetting.SimpleObject;
+import com.qmth.eds.bean.result.MenuResult;
 import com.qmth.eds.common.contant.SpringContextHolder;
 import com.qmth.eds.common.contant.SpringContextHolder;
 import com.qmth.eds.common.contant.SystemConstant;
 import com.qmth.eds.common.contant.SystemConstant;
 import com.qmth.eds.common.entity.*;
 import com.qmth.eds.common.entity.*;
-import com.qmth.eds.common.enums.*;
-import com.qmth.eds.common.util.*;
-import com.qmth.eds.core.config.DictionaryConfig;
+import com.qmth.eds.common.enums.ExceptionResultEnum;
+import com.qmth.eds.common.enums.PrivilegeEnum;
+import com.qmth.eds.common.enums.PrivilegePropertyEnum;
+import com.qmth.eds.common.enums.RoleTypeEnum;
+import com.qmth.eds.common.util.JacksonUtil;
 import com.qmth.eds.service.*;
 import com.qmth.eds.service.*;
-import org.apache.commons.lang3.StringUtils;
 import org.slf4j.Logger;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.slf4j.LoggerFactory;
 import org.springframework.stereotype.Service;
 import org.springframework.stereotype.Service;
-import org.springframework.transaction.annotation.Transactional;
 import org.springframework.util.LinkedMultiValueMap;
 import org.springframework.util.LinkedMultiValueMap;
 
 
 import javax.annotation.Resource;
 import javax.annotation.Resource;
-import javax.servlet.http.HttpServletResponse;
-import java.io.*;
-import java.security.NoSuchAlgorithmException;
 import java.util.*;
 import java.util.*;
 import java.util.stream.Collectors;
 import java.util.stream.Collectors;
 
 
 /**
 /**
- * @Description: 公共服务service impl
- * @Param:
- * @return:
- * @Author: wangliang
- * @Date: 2021/3/26
+ * 公共服务service impl
  */
  */
 @Service
 @Service
 public class CommonServiceImpl implements CommonService {
 public class CommonServiceImpl implements CommonService {
@@ -50,9 +36,6 @@ public class CommonServiceImpl implements CommonService {
     @Resource
     @Resource
     CommonCacheService commonCacheService;
     CommonCacheService commonCacheService;
 
 
-    @Resource
-    CommonService commonService;
-
     @Resource
     @Resource
     SysUserRoleService sysUserRoleService;
     SysUserRoleService sysUserRoleService;
 
 
@@ -65,32 +48,10 @@ public class CommonServiceImpl implements CommonService {
     @Resource
     @Resource
     SysRoleService sysRoleService;
     SysRoleService sysRoleService;
 
 
-    @Resource
-    TBSessionService tbSessionService;
-
-    @Resource
-    RedisUtil redisUtil;
-
-    @Resource
-    DictionaryConfig dictionaryConfig;
-
-    @Resource
-    BasicAttachmentService basicAttachmentService;
-
-    @Resource
-    FileStoreUtil fileStoreUtil;
-
-    @Resource
-    private BasicSchoolService basicSchoolService;
-
-    @Resource
-    SysUserService sysUserService;
-
     /**
     /**
      * 获取用户菜单
      * 获取用户菜单
      *
      *
-     * @param userId
-     * @return
+     * @param userId 用户ID
      */
      */
     @Override
     @Override
     public MenuResult getUserMenu(Long userId) {
     public MenuResult getUserMenu(Long userId) {
@@ -156,52 +117,10 @@ public class CommonServiceImpl implements CommonService {
         return new MenuResult(sysUser.getId(), menuPrivilegeDtoList);
         return new MenuResult(sysUser.getId(), menuPrivilegeDtoList);
     }
     }
 
 
-    /**
-     * 新增用户权限
-     *
-     * @param sysUser
-     * @param roleId
-     */
-    @Override
-    public void addUserRolePrivilege(SysUser sysUser, Long roleId) {
-        List<SysRolePrivilege> sysRolePrivilegeList = commonCacheService.rolePrivilegeCache(roleId);
-        List<SysUserRole> sysUserRoleList = new ArrayList<>();
-        sysRolePrivilegeList.forEach(s -> {
-            sysUserRoleList.add(new SysUserRole(sysUser.getId(), s.getRoleId(), s.getPrivilegeId()));
-        });
-        sysUserRoleService.saveBatch(sysUserRoleList);
-    }
-
-    /**
-     * 新增用户权限
-     *
-     * @param sysUser
-     * @param roleIds
-     */
-    @Override
-    public void addUserRolePrivilege(SysUser sysUser, Long[] roleIds) {
-        List<SysUserRole> sysUserRoleList = new ArrayList<>();
-        for (int i = 0; i < roleIds.length; i++) {
-            sysUserRoleList.add(new SysUserRole(sysUser.getId(), roleIds[i]));
-        }
-        sysUserRoleService.saveBatch(sysUserRoleList);
-    }
-
-    @Override
-    public List<SysUserRole> disposeUserPrivilege(SysUser sysUser, Long[] roleIds) {
-        List<SysUserRole> sysUserRoleList = new ArrayList<>();
-        for (int i = 0; i < roleIds.length; i++) {
-            sysUserRoleList.add(new SysUserRole(sysUser.getId(), roleIds[i]));
-        }
-        return sysUserRoleList;
-    }
-
-
     /**
     /**
      * 获取用户角色权限
      * 获取用户角色权限
      *
      *
-     * @param userId
-     * @return
+     * @param userId 用户ID
      */
      */
     @Override
     @Override
     public List<SysUserRole> getUserRolePrivilege(Long userId) {
     public List<SysUserRole> getUserRolePrivilege(Long userId) {
@@ -214,8 +133,7 @@ public class CommonServiceImpl implements CommonService {
     /**
     /**
      * 获取角色权限
      * 获取角色权限
      *
      *
-     * @param roleId
-     * @return
+     * @param roleId 角色ID
      */
      */
     @Override
     @Override
     public List<SysRolePrivilege> getRolePrivilege(Long roleId) {
     public List<SysRolePrivilege> getRolePrivilege(Long roleId) {
@@ -227,8 +145,7 @@ public class CommonServiceImpl implements CommonService {
     /**
     /**
      * 获取用户权限
      * 获取用户权限
      *
      *
-     * @param userId
-     * @return
+     * @param userId 用户ID
      */
      */
     @Override
     @Override
     public AuthBean getUserAuth(Long userId) {
     public AuthBean getUserAuth(Long userId) {
@@ -255,9 +172,7 @@ public class CommonServiceImpl implements CommonService {
                 int count = Objects.nonNull(sysRoleList) && sysRoleList.size() > 0 ? (int) sysRoleList.stream().filter(s -> Objects.equals(s.getName(), RoleTypeEnum.ADMIN.getDesc())).count() : 0;
                 int count = Objects.nonNull(sysRoleList) && sysRoleList.size() > 0 ? (int) sysRoleList.stream().filter(s -> Objects.equals(s.getName(), RoleTypeEnum.ADMIN.getDesc())).count() : 0;
                 QueryWrapper<SysPrivilege> sysPrivilegeQueryWrapper = new QueryWrapper<>();
                 QueryWrapper<SysPrivilege> sysPrivilegeQueryWrapper = new QueryWrapper<>();
                 if (count > 0) {//超级系统管理员
                 if (count > 0) {//超级系统管理员
-//                    Long schoolId = Long.parseLong(ServletUtil.getRequestSchoolByNotVaild().toString());
                     sysPrivilegeQueryWrapper.lambda()
                     sysPrivilegeQueryWrapper.lambda()
-//                            .eq(SysPrivilege::getSchoolId, schoolId)
                             .eq(SysPrivilege::getType, PrivilegeEnum.URL)
                             .eq(SysPrivilege::getType, PrivilegeEnum.URL)
                             .eq(SysPrivilege::getProperty, PrivilegePropertyEnum.AUTH);
                             .eq(SysPrivilege::getProperty, PrivilegePropertyEnum.AUTH);
                     List<SysPrivilege> sysPrivilegeList = sysPrivilegeService.list(sysPrivilegeQueryWrapper);
                     List<SysPrivilege> sysPrivilegeList = sysPrivilegeService.list(sysPrivilegeQueryWrapper);
@@ -268,11 +183,6 @@ public class CommonServiceImpl implements CommonService {
                     sysPrivilegeQueryWrapper.lambda().in(SysPrivilege::getId, privilegeIds)
                     sysPrivilegeQueryWrapper.lambda().in(SysPrivilege::getId, privilegeIds)
                             .eq(SysPrivilege::getType, PrivilegeEnum.URL)
                             .eq(SysPrivilege::getType, PrivilegeEnum.URL)
                             .eq(SysPrivilege::getProperty, PrivilegePropertyEnum.AUTH);
                             .eq(SysPrivilege::getProperty, PrivilegePropertyEnum.AUTH);
-//                    if (Objects.isNull(tbSchool)) {
-//                        sysPrivilegeQueryWrapper.lambda().isNull(SysPrivilege::getSchoolId);
-//                    } else {
-//                        sysPrivilegeQueryWrapper.lambda().eq(SysPrivilege::getSchoolId, user.getSchoolId());
-//                    }
                     List<SysPrivilege> sysPrivilegeList = sysPrivilegeService.list(sysPrivilegeQueryWrapper);
                     List<SysPrivilege> sysPrivilegeList = sysPrivilegeService.list(sysPrivilegeQueryWrapper);
                     authBean = new AuthBean(sysRoleList, sysPrivilegeList.stream().map(s -> s.getUrl()).collect(Collectors.toSet()), tbSchool, org);
                     authBean = new AuthBean(sysRoleList, sysPrivilegeList.stream().map(s -> s.getUrl()).collect(Collectors.toSet()), tbSchool, org);
                 }
                 }
@@ -286,9 +196,6 @@ public class CommonServiceImpl implements CommonService {
 
 
     /**
     /**
      * 获取鉴权url
      * 获取鉴权url
-     *
-     * @param privilegePropertyEnum
-     * @return
      */
      */
     @Override
     @Override
     public Set<String> getPrivilegeUrl(PrivilegePropertyEnum privilegePropertyEnum) {
     public Set<String> getPrivilegeUrl(PrivilegePropertyEnum privilegePropertyEnum) {
@@ -302,10 +209,6 @@ public class CommonServiceImpl implements CommonService {
 
 
     /**
     /**
      * 获取鉴权url
      * 获取鉴权url
-     *
-     * @param privilegePropertyEnum
-     * @param schoolId
-     * @return
      */
      */
     @Override
     @Override
     public Set<String> getPrivilegeUrl(PrivilegePropertyEnum privilegePropertyEnum, Long schoolId) {
     public Set<String> getPrivilegeUrl(PrivilegePropertyEnum privilegePropertyEnum, Long schoolId) {
@@ -314,580 +217,21 @@ public class CommonServiceImpl implements CommonService {
                 .eq(SysPrivilege::getProperty, privilegePropertyEnum)
                 .eq(SysPrivilege::getProperty, privilegePropertyEnum)
                 .eq(SysPrivilege::getEnable, true)
                 .eq(SysPrivilege::getEnable, true)
                 .eq(SysPrivilege::getDefaultAuth, true);
                 .eq(SysPrivilege::getDefaultAuth, true);
-//                .eq(SysPrivilege::getSchoolId, schoolId);
         List<SysPrivilege> sysPrivilegeList = sysPrivilegeService.list(sysPrivilegeQueryWrapper);
         List<SysPrivilege> sysPrivilegeList = sysPrivilegeService.list(sysPrivilegeQueryWrapper);
         return Objects.nonNull(sysPrivilegeList) && sysPrivilegeList.size() > 0 ? sysPrivilegeList.stream().map(s -> s.getUrl()).collect(Collectors.toSet()) : null;
         return Objects.nonNull(sysPrivilegeList) && sysPrivilegeList.size() > 0 ? sysPrivilegeList.stream().map(s -> s.getUrl()).collect(Collectors.toSet()) : null;
     }
     }
 
 
-    @Transactional
     @Override
     @Override
-    public void addSchoolPrivilege(Set<Long> schoolIdSet) {
-//        Set<Long> pidSet = sysPrivilegeService.list().stream().map(SysPrivilege::getSchoolId).collect(Collectors.toSet());
-//        // 权限表里没有该学校主键的
-//        Set<Long> targetSchoolIdSet = schoolIdSet.stream().filter(e -> !pidSet.contains(e)).collect(Collectors.toSet());
-        QueryWrapper<SysPrivilege> queryWrapper = new QueryWrapper<>();
-//        queryWrapper.lambda().eq(SysPrivilege::getSchoolId, SystemConstant.DEFAULT_PRIVILEGE_SCHOOL);
-        queryWrapper.lambda().eq(SysPrivilege::getDefaultAuth, true)
-                .eq(SysPrivilege::getEnable, true);
-        List<SysPrivilege> sysPrivileges = sysPrivilegeService.list(queryWrapper);
-        if (sysPrivileges.size() == 0) {
-            throw ExceptionResultEnum.ERROR.exception("默认学校权限不存在");
+    public String getSysSettingValue(Long schoolId, String code) {
+        Map<String, SimpleObject> simpleObjectMap = commonCacheService.getSysSetting(schoolId);
+        if (simpleObjectMap == null) {
+            throw ExceptionResultEnum.ERROR.exception("系统参数未设置");
         }
         }
-//        for (Long newSchoolId : targetSchoolIdSet) {
-//            // 一个学校一个学校的权限加 如果放在外面的话必须在map的key中关联进学校主键
-//            Map<Long, Long> map = new HashMap<>();
-//            List<SysPrivilege> newList = new ArrayList<>();
-//            BasicSchool basicSchool = basicSchoolService.getById(newSchoolId);
-//            if (Objects.isNull(basicSchool)) {
-//                throw ExceptionResultEnum.ERROR.exception("未找到学校信息");
-//            }
-//            for (SysPrivilege sysPrivilege : sysPrivileges) {
-//                SysPrivilege cell = new SysPrivilege();
-//                BeanUtils.copyProperties(sysPrivilege, cell);
-//                Long id = SystemConstant.getDbUuid();
-//                map.put(cell.getId(), id);
-//                cell.setId(id);
-//                cell.setSchoolId(newSchoolId);
-//                cell.setEnable(basicSchool.getEnable());
-//                newList.add(cell);
-//            }
-//            for (SysPrivilege sysPrivilege : newList) {
-//                if (Objects.nonNull(sysPrivilege.getParentId())) {
-//                    sysPrivilege.setParentId(map.get(sysPrivilege.getParentId()));
-//                }
-//                String relateId = sysPrivilege.getRelated();
-//                if (StringUtils.isNotBlank(relateId)) {
-//                    String[] relateIds = relateId.split(",");
-//                    List<String> newRelateIds = new ArrayList<>();
-//                    for (String id : relateIds) {
-//                        Long lid = Long.valueOf(id.trim());
-//                        newRelateIds.add(String.valueOf(map.get(lid)));
-//                    }
-//                    String newRelateId = String.join(",", newRelateIds);
-//                    sysPrivilege.setRelated(newRelateId);
-//                }
-//            }
-//            sysPrivilegeService.saveBatch(newList);
-//        }
-    }
-
-    /**
-     * 删除用户信息
-     *
-     * @param userId
-     * @param all
-     */
-    @Override
-    public void removeUserInfo(Long userId, boolean all) throws NoSuchAlgorithmException {
-        AuthBean authBean = commonCacheService.userAuthCache(userId);
-        if (Objects.isNull(authBean)) {
-            throw ExceptionResultEnum.NOT_LOGIN.exception();
-        }
-        if (all) {
-            for (Platform p : Platform.values()) {
-                Set<String> roleNames = authBean.getRoleList().stream().map(s -> s.getName()).collect(Collectors.toSet());
-                String sessionId = SessionUtil.digest(userId, Math.abs(roleNames.toString().hashCode()), p.name());
-                tbSessionService.removeById(sessionId);
-                redisUtil.deleteUserSession(sessionId);
-            }
-        } else {
-            TBSession tbSession = (TBSession) ServletUtil.getRequestSession();
-            tbSessionService.removeById(tbSession.getId());
-            redisUtil.deleteUserSession(tbSession.getId());
-        }
-        commonCacheService.removeUserCache(userId);
-        commonCacheService.removeUserAuthCache(userId);
-        commonCacheService.removeUserMenuCache(userId);
-        commonCacheService.removeUserRolePrivilegeCache(userId);
-    }
-
-//    /**
-//     * 批量删除用户信息
-//     *
-//     * @param userIds
-//     * @param all
-//     */
-//    @Override
-//    public void removeUserInfoBatch(List<Long> userIds, boolean all) {
-//        new Thread(() -> {
-//            if (all) {
-//                Set<String> sessionIdSet = new HashSet<>(Platform.values().length * userIds.size());
-//                int min = 0;
-//                int max = SystemConstant.IN_SIZE_MAX, size = userIds.size();
-//                if (max >= size) {
-//                    max = size;
-//                }
-//                while (max <= size) {
-//                    List<UserRoleNameResult> userRoleNameResultList = sysUserService.selectRoleNames(userIds.subList(min, max));
-//                    for (UserRoleNameResult userRoleNameResult : userRoleNameResultList) {
-//                        for (Platform p : Platform.values()) {
-//                            String sessionId = null;
-//                            try {
-//                                sessionId = SessionUtil.digest(userRoleNameResult.getUserId(), Math.abs(Arrays.asList(userRoleNameResult.getRoleNames().split(",")).toString().hashCode()), p.name());
-//                            } catch (NoSuchAlgorithmException e) {
-//                                e.printStackTrace();
-//                            }
-//                            sessionIdSet.add(sessionId);
-//                        }
-//                    }
-//                    if (max == size) {
-//                        break;
-//                    }
-//                    min = max;
-//                    max += SystemConstant.IN_SIZE_MAX;
-//                    if (max >= size) {
-//                        max = size;
-//                    }
-//                }
-//                tbSessionService.removeByIds(sessionIdSet);
-//                for (String s : sessionIdSet) {
-//                    redisUtil.deleteUserSession(s);
-//                }
-//            } else {
-//                TBSession tbSession = (TBSession) ServletUtil.getRequestSession();
-//                tbSessionService.removeById(tbSession.getId());
-//                redisUtil.deleteUserSession(tbSession.getId());
-//            }
-//            for (Long l : userIds) {
-//                commonCacheService.removeUserCache(l);
-//                commonCacheService.removeUserAuthCache(l);
-//                commonCacheService.removeUserMenuCache(l);
-//                commonCacheService.removeUserRolePrivilegeCache(l);
-//            }
-//        }).start();
-//    }
-
-    /**
-     * 修改角色状态
-     *
-     * @param roleIds
-     * @param enable
-     */
-    @Override
-    public void updateRoleEnable(Long[] roleIds, Boolean enable) {
-        SysUser requestUser = (SysUser) ServletUtil.getRequestUser();
-        List<SysRole> dbRoleList = sysRoleService.listByIds(Arrays.asList(roleIds));
-        if (Objects.isNull(dbRoleList) || dbRoleList.size() == 0) {
-            throw ExceptionResultEnum.ROLE_NO_DATA.exception();
-        }
-
-        //修改角色
-        UpdateWrapper<SysRole> sysRoleUpdateWrapper = new UpdateWrapper<>();
-        sysRoleUpdateWrapper.lambda().in(SysRole::getId, roleIds)
-                .set(SysRole::getEnable, enable)
-                .set(SysRole::getUpdateId, requestUser.getId())
-                .set(SysRole::getUpdateTime, System.currentTimeMillis());
-        sysRoleService.update(sysRoleUpdateWrapper);
-
-        //修改角色权限
-        UpdateWrapper<SysRolePrivilege> sysRolePrivilegeUpdateWrapper = new UpdateWrapper<>();
-        sysRolePrivilegeUpdateWrapper.lambda().in(SysRolePrivilege::getRoleId, roleIds)
-                .set(SysRolePrivilege::getEnable, enable);
-        sysRolePrivilegeService.update(sysRolePrivilegeUpdateWrapper);
-
-        //修改用户角色权限
-        UpdateWrapper<SysUserRole> sysUserRoleUpdateWrapper = new UpdateWrapper<>();
-        sysUserRoleUpdateWrapper.lambda().in(SysUserRole::getRoleId, roleIds)
-                .set(SysUserRole::getEnable, enable);
-        sysUserRoleService.update(sysUserRoleUpdateWrapper);
-
-        List<Long> updateRoleIds = new ArrayList<>();
-        for (SysRole dbRole : dbRoleList) {
-            //如果数据库的状态和修改的状态不同
-            if (Objects.nonNull(dbRole.getEnable()) && dbRole.getEnable().booleanValue() != enable.booleanValue()) {
-                //更新角色权限
-                commonCacheService.updateRolePrivilegeCache(dbRole.getId());
-                updateRoleIds.add(dbRole.getId());
-            }
-        }
-        //更新用户权限状态
-        QueryWrapper<SysUserRole> sysUserRoleQueryWrapper = new QueryWrapper<>();
-        sysUserRoleQueryWrapper.lambda().eq(SysUserRole::getRoleId, updateRoleIds);
-        List<SysUserRole> sysUserRoleList = sysUserRoleService.list(sysUserRoleQueryWrapper);
-        Set<Long> userIds = sysUserRoleList.stream().map(s -> s.getUserId()).collect(Collectors.toSet());
-        for (Long l : userIds) {
-            commonCacheService.updateUserRolePrivilegeCache(l);
-            commonCacheService.updateUserAuthCache(l);
+        SimpleObject simpleObject = simpleObjectMap.get(code);
+        if (simpleObject == null) {
+            throw ExceptionResultEnum.ERROR.exception("系统参数[" + code + "]未设置");
         }
         }
+        return simpleObject.getValue();
     }
     }
 
 
-    /**
-     * 查询用户或者角色权限信息
-     *
-     * @param privilegeCacheDtoList
-     * @return
-     */
-    @Override
-    public RolePrivilegeResult getUserOrRolePrivilege(List<PrivilegeCacheDto> privilegeCacheDtoList) {
-        LinkedMultiValueMap<Long, PrivilegeResult> buttonsLinkedMultiValueMap = new LinkedMultiValueMap<>(), linksLinkedMultiValueMap = new LinkedMultiValueMap<>();
-        List<PrivilegeCacheDto> buttonsFilterList = new ArrayList<>(), linksFilterList = new ArrayList<>();
-
-        for (PrivilegeCacheDto privilegeCacheDto : privilegeCacheDtoList) {
-            if (privilegeCacheDto.getPrivilegeType() == PrivilegeEnum.BUTTON) {
-                buttonsFilterList.add(privilegeCacheDto);
-                buttonsLinkedMultiValueMap.add(privilegeCacheDto.getParentId(), new PrivilegeResult(privilegeCacheDto));
-            } else if (privilegeCacheDto.getPrivilegeType() == PrivilegeEnum.LINK) {
-                linksFilterList.add(privilegeCacheDto);
-                linksLinkedMultiValueMap.add(privilegeCacheDto.getParentId(), new PrivilegeResult(privilegeCacheDto));
-            }
-        }
-
-        privilegeCacheDtoList.removeAll(buttonsFilterList);
-        privilegeCacheDtoList.removeAll(linksFilterList);
-
-        RolePrivilegeResult rolePrivilegeResult = new RolePrivilegeResult();
-        List<PrivilegeResult> privilegeResultList = new ArrayList<>();
-        for (PrivilegeCacheDto privilegeCacheDto : privilegeCacheDtoList) {
-            rolePrivilegeResult.setInfo(privilegeCacheDto);
-            PrivilegeResult privilegeResult = new PrivilegeResult(privilegeCacheDto);
-            privilegeResult.setButtons(buttonsLinkedMultiValueMap.get(privilegeResult.getId()));
-            privilegeResult.setLinks(linksLinkedMultiValueMap.get(privilegeResult.getId()));
-            privilegeResultList.add(privilegeResult);
-        }
-        rolePrivilegeResult.setPrivileges(privilegeResultList);
-        return rolePrivilegeResult;
-    }
-
-    /**
-     * 文件预览
-     *
-     * @param path
-     * @return
-     */
-    @Override
-    public String filePreview(String path) {
-        String url = null;
-        JSONObject jsonObject = JSONObject.parseObject(path);
-        String attachmentType = (String) jsonObject.get(SystemConstant.TYPE);
-        String filePath = (String) jsonObject.get(SystemConstant.PATH);
-        UploadFileEnum uploadFileEnum = UploadFileEnum.valueOf((String) jsonObject.get(SystemConstant.UPLOAD_TYPE));
-        if (Objects.equals(attachmentType, SystemConstant.LOCAL)) {
-            url = SystemConstant.HTTP + dictionaryConfig.sysDomain().getFileHost() + File.separator + filePath;
-        } else {
-//            if (uploadFileEnum == UploadFileEnum.PAPER) {
-//                url = ossUtil.getPrivateUrl(filePath);
-            url = fileStoreUtil.getPrivateUrl(filePath, uploadFileEnum.getFssType());
-//            } else {
-//                url = dictionaryConfig.aliYunOssDomain().getUrl() + File.separator + filePath;
-//                url = fileStoreUtil.getPrivateUrl(filePath, uploadFileEnum.getFssType());
-//            }
-        }
-        return url;
-    }
-
-    /**
-     * 文件预览
-     *
-     * @param path     附件路径
-     * @param type     保存类型:本地、OSS
-     * @param isExpire url是否带过期时间
-     * @return
-     */
-    @Override
-    public String filePreviewByPathAndType(String path, String type, Boolean isExpire) {
-        if (StringUtils.isBlank(path)) {
-            return null;
-        }
-
-        String pathUrl;
-        if (Objects.equals(type, SystemConstant.LOCAL)) {
-            pathUrl = SystemConstant.HTTP + dictionaryConfig.sysDomain().getFileHost() + File.separator + path;
-        } else {
-            if (isExpire) {
-//                pathUrl = ossUtil.getPrivateUrl(path);
-                pathUrl = fileStoreUtil.getPrivateUrl(path, fileStoreUtil.getUploadEnumByPath(path).getFssType());
-            } else {
-//                pathUrl = dictionaryConfig.aliYunOssDomain().getUrl() + File.separator + path;
-                pathUrl = fileStoreUtil.getPrivateUrl(path, fileStoreUtil.getUploadEnumByPath(path).getFssType());
-            }
-
-        }
-        return pathUrl;
-    }
-
-    /**
-     * 文件预览
-     *
-     * @param attachmentId 附件路径
-     * @param isExpire     url是否带过期时间
-     * @return
-     */
-    @Override
-    public Map<String, String> filePreviewByAttachmentId(Long attachmentId, Boolean isExpire) {
-        BasicAttachment attachment = basicAttachmentService.getById(attachmentId);
-        if (attachment == null) {
-            return null;
-        }
-
-        Map<String, String> map = new HashMap<>();
-
-        String pathUrl;
-        JSONObject jsonObject = JSONObject.parseObject(attachment.getPath());
-        String attachmentType = (String) jsonObject.get(SystemConstant.TYPE);
-        String filePath = (String) jsonObject.get(SystemConstant.PATH);
-        UploadFileEnum uploadFileEnum = jsonObject.get(SystemConstant.UPLOAD_TYPE).toString().contains(UploadFileEnum.HTML.name()) ? UploadFileEnum.HTML : UploadFileEnum.valueOf((String) jsonObject.get(SystemConstant.UPLOAD_TYPE));
-
-        if (Objects.equals(attachmentType, SystemConstant.LOCAL)) {
-            pathUrl = SystemConstant.HTTP + dictionaryConfig.sysDomain().getFileHost() + File.separator + filePath;
-        } else {
-            pathUrl = fileStoreUtil.getPrivateUrl(filePath, uploadFileEnum.getFssType());
-        }
-        map.put("url", pathUrl);
-        if (attachment.getType().equals(".html")) {
-            String htmlMd5 = (String) jsonObject.get("htmlMd5");
-            map.put("md5", htmlMd5);
-        } else {
-            map.put("md5", attachment.getMd5());
-        }
-        return map;
-    }
-
-    @Override
-    public String readFileContent(String path) {
-        // 解析path
-        JSONObject object = JSONObject.parseObject(path);
-        String filePath = object.getString(SystemConstant.PATH);
-        String type = object.getString(SystemConstant.TYPE);
-        UploadFileEnum uploadType = Enum.valueOf(UploadFileEnum.class, (String) object.get(SystemConstant.UPLOAD_TYPE));
-
-        if (filePath.endsWith(SystemConstant.HTML_PREFIX) || filePath.endsWith(SystemConstant.FTL_PREFIX)) {
-            StringBuffer sb = new StringBuffer();
-            try {
-                InputStream fis;
-                if (type.equals(SystemConstant.OSS)) {
-                    fis = fileStoreUtil.ossDownloadIs(filePath, uploadType.getFssType());
-                } else {
-                    String url = SystemConstant.HTTP + dictionaryConfig.sysDomain().getFileHost() + File.separator + filePath;
-                    File file = new File(url);
-                    if (!file.exists()) {
-                        throw ExceptionResultEnum.ERROR.exception("附件文件不存在");
-                    }
-                    fis = new FileInputStream(file);
-                }
-                BufferedReader br = new BufferedReader(new InputStreamReader(fis));
-                String s;
-                while ((s = br.readLine()) != null) {
-                    sb.append(s).append("\n");
-                }
-            } catch (IOException e) {
-                throw ExceptionResultEnum.ERROR.exception("文件读取异常");
-            } catch (Exception e) {
-                log.error(SystemConstant.LOG_ERROR, e);
-            }
-            return sb.toString();
-        }
-        return null;
-    }
-
-    @Override
-    public File copyFile(String rootPath, String fileName, BasicAttachment attachment) throws Exception {
-        JSONObject object = JSONObject.parseObject(attachment.getPath());
-        String filePath = object.getString(SystemConstant.PATH);
-        String type = object.getString(SystemConstant.TYPE);
-        UploadFileEnum uploadType = Enum.valueOf(UploadFileEnum.class, (String) object.get(SystemConstant.UPLOAD_TYPE));
-
-        if (type.equals(SystemConstant.OSS)) {
-            File localPath = new File(rootPath, fileName);
-            try {
-//                File file = ossUtil.ossDownload(filePath, localPath.getPath());
-                File file = fileStoreUtil.ossDownload(filePath, localPath.getPath(), uploadType.getFssType());
-                return file;
-            } catch (IOException e) {
-                throw ExceptionResultEnum.ERROR.exception("从OSS上下载文件失败");
-            }
-        } else {
-            File file = new File(filePath);
-            if (!file.exists()) {
-                throw ExceptionResultEnum.ERROR.exception("本地文件不存在");
-            }
-            return file;
-        }
-    }
-
-    @Override
-    public void downloadFileAndZip(HttpServletResponse response, String rootPath, List<File> files) {
-        String schoolId = ServletUtil.getRequestHeaderSchoolId().toString();
-        long time = System.nanoTime();
-        File rootFile = new File(rootPath);
-        // 创建保存目录
-        if (!rootFile.exists()) {
-            rootFile.mkdirs();
-        }
-        File zipFile = null;
-        try {
-            String zipPath = SystemConstant.TEMP_FILES_DIR + File.separator + schoolId;
-            File zipPathFile = new File(zipPath);
-            if (!zipPathFile.exists()) {
-                zipPathFile.mkdirs();
-            }
-            zipFile = FileUtil.file(zipPath, time + ".zip");
-
-            // 压缩文件
-            if (!zipFile.exists()) {
-                zipFile.createNewFile();
-            }
-            File[] srcFiles = files.toArray(new File[files.size()]);
-//            ZipUtil.zip(rootFile.getAbsolutePath(), zipFile.getAbsolutePath(), false);
-
-            ZipUtil.zip(zipFile, true, srcFiles);
-            outputFile(response, zipFile, String.valueOf(time));
-        } catch (Exception e) {
-            throw ExceptionResultEnum.ERROR.exception("下载失败");
-        } finally {
-            // 删除zip文件
-            FileUtil.del(zipFile);
-            // 删除压缩内容
-            FileUtil.del(rootPath);
-        }
-    }
-
-    @Override
-    public void downloadFileAndZip(HttpServletResponse response, String rootPath, long time) {
-        File rootFile = new File(rootPath);
-        // 创建保存目录
-        if (!rootFile.exists()) {
-            rootFile.mkdirs();
-        }
-        File zipFile = null;
-        try {
-            zipFile = FileUtil.file(SystemConstant.TEMP_FILES_DIR, time + ".zip");
-            // 压缩文件
-            if (!zipFile.exists()) {
-                zipFile.createNewFile();
-            }
-            ZipUtil.zip(rootPath, zipFile.getAbsolutePath(), true);
-            outputFile(response, zipFile, String.valueOf(time));
-        } catch (Exception e) {
-            throw ExceptionResultEnum.ERROR.exception("下载失败");
-        } finally {
-            // 删除zip文件
-            FileUtil.del(zipFile);
-            // 删除压缩内容
-            FileUtil.del(rootPath);
-        }
-    }
-
-//    @Override
-//    public Set<Long> listSubOrgIds(Long id) {
-//        SysUser sysUser = (SysUser) ServletUtil.getRequestUser();
-//        Long orgId;
-//        if (id == null) {
-//            orgId = sysUser.getOrgId();
-//        } else {
-//            orgId = id;
-//        }
-//        if (orgId == null) {
-//            return null;
-//        }
-//        List<OrgDto> orgDtos = sysOrgService.listOrgTree(null);
-//        Set<Long> stringSet = new HashSet<>();
-//        stringSet.add(orgId);
-//        stringSet = getOrgIds(stringSet, orgDtos, orgId);
-//        return stringSet;
-//    }
-
-    /**
-     * 登录公用
-     *
-     * @param password
-     * @param sysUser
-     * @param appSource
-     * @return
-     * @throws NoSuchAlgorithmException
-     */
-    @Override
-    public LoginResult login(String password, SysUser sysUser, AppSourceEnum appSource) throws NoSuchAlgorithmException {
-        //停用
-        if (!sysUser.getEnable()) {
-            throw ExceptionResultEnum.USER_ENABLE.exception();
-        }
-
-        Platform platform = ServletUtil.getRequestPlatform();
-        String deviceId = ServletUtil.getRequestDeviceId();
-        AuthBean authBean = commonService.getUserAuth(sysUser.getId());
-        //添加用户鉴权缓存
-        if (Objects.isNull(authBean)) {
-            throw ExceptionResultEnum.ROLE_ENABLE_AUTHORIZATION.exception();
-        }
-        //生成token
-        String token = SystemConstant.getUuid();
-        commonCacheService.userCache(sysUser.getId());
-        //添加用户会话缓存
-        Set<String> roleNames = new HashSet<>(), roleTypes = new HashSet<>();
-        for (SysRole s : authBean.getRoleList()) {
-            roleNames.add(s.getName());
-            if (Objects.nonNull(s.getType())) {
-                roleTypes.add(s.getType().name());
-            }
-        }
-        String sessionId = SessionUtil.digest(sysUser.getId(), Math.abs(roleNames.toString().hashCode()), platform.name());
-        //TODO 测试用
-//        String test = SignatureEntityTest.build(SignatureType.TOKEN, sessionId, token);
-        ExpireTimeBean expireTime = AuthUtil.getExpireTime(platform);
-        TBSession tbSession = new TBSession(sysUser.getSchoolId(), sessionId, String.valueOf(sysUser.getId()), roleNames.toString(),
-                platform.name(), platform.name(), deviceId, ServletUtil.getRequest().getLocalAddr(), token,
-                expireTime.getDate().getTime(), appSource);
-        tbSessionService.saveOrUpdate(tbSession);
-        redisUtil.setUserSession(sessionId, tbSession, expireTime.getExpireSeconds());
-
-//        LoginResult loginResult = new LoginResult(sysUser, sessionId, test, Objects.nonNull(roleTypes) && roleTypes.size() > 0 ? roleTypes : roleNames, appSource);
-        LoginResult loginResult = new LoginResult(sysUser, sessionId, token, Objects.nonNull(roleTypes) && roleTypes.size() > 0 ? roleTypes : roleNames, appSource);
-        loginResult.setSchoolInfo(Objects.nonNull(authBean.getSchool()) ? loginResult.new SchoolNativeBean(authBean.getSchool()) : null);
-        loginResult.setOrgInfo(Objects.nonNull(authBean.getOrg()) ? loginResult.new OrgNativeBean(authBean.getOrg()) : null);
-        loginResult.setTime(System.currentTimeMillis());
-        String mobileNumber = sysUser.getMobileNumber();
-        int pwdCount = sysUser.getPwdCount();
-        if (roleTypes.contains(RoleTypeEnum.ADMIN.name())) {
-            mobileNumber = sysUser.getLoginName() + "(特殊权限)";
-            pwdCount = 1;
-        }
-        loginResult.setUserLoginCheckResult(new UserLoginCheckResult(sysUser.getId(), mobileNumber, pwdCount));
-        return loginResult;
-    }
-
-    private Set<Long> getOrgIds(Set<Long> stringSet, List<OrgDto> orgDtos, Long parentId) {
-        for (OrgDto orgDto : orgDtos) {
-            Long tempParentId = orgDto.getParentId();
-            if (parentId.equals(tempParentId) && stringSet.contains(parentId)) {
-                stringSet.add(Long.valueOf(orgDto.getId()));
-            }
-            if (orgDto.getChildren().isEmpty()) {
-                continue;
-            }
-            getOrgIds(stringSet, orgDto.getChildren(), Long.valueOf(orgDto.getId()));
-        }
-        return stringSet;
-    }
-
-    public static void outputFile(HttpServletResponse response, File file, String fileName) {
-        try {
-
-            if (!file.exists()) {
-                response.sendError(404, "File not found!");
-            }
-
-            BufferedInputStream br = new BufferedInputStream(new FileInputStream(file));
-            byte[] buf = new byte[1024];
-            int len = 0;
-
-            String fName = new String(fileName.getBytes(), "ISO-8859-1");
-
-            response.reset();
-            response.setContentType("application/x-msdownload");
-            response.setHeader("Content-Disposition", "attachment; filename=" + fName);
-
-            OutputStream outStream = response.getOutputStream();
-
-            while ((len = br.read(buf)) > 0) {
-                outStream.write(buf, 0, len);
-            }
-
-            br.close();
-            outStream.close();
-        } catch (FileNotFoundException e) {
-            log.error(SystemConstant.LOG_ERROR, e);
-        } catch (IOException e) {
-            log.error(SystemConstant.LOG_ERROR, e);
-        }
-    }
 }
 }

+ 64 - 0
src/main/java/com/qmth/eds/service/impl/ExamAssignServiceImpl.java

@@ -0,0 +1,64 @@
+package com.qmth.eds.service.impl;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.qmth.eds.bean.dto.AssignListDto;
+import com.qmth.eds.common.entity.*;
+import com.qmth.eds.common.util.ServletUtil;
+import com.qmth.eds.mapper.ExamAssignMapper;
+import com.qmth.eds.service.ExamAssignService;
+import com.qmth.eds.service.ExamSyncStudentService;
+import com.qmth.eds.service.ExamSyncTotalService;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+import java.util.Map;
+
+/**
+ * <p>
+ * 赋分管理 服务实现类
+ * </p>
+ */
+@Service
+public class ExamAssignServiceImpl extends ServiceImpl<ExamAssignMapper, ExamAssign> implements ExamAssignService {
+
+    @Resource
+    ExamSyncTotalService examSyncTotalService;
+
+    @Resource
+    ExamSyncStudentService examSyncStudentService;
+
+    @Override
+    public IPage<AssignListDto> pageData(Long semesterId, Long examTypeId, String courseCode, Integer pageNumber, Integer pageSize) {
+        SysUser sysUser = (SysUser) ServletUtil.getRequestUser();
+        Page<AssignListDto> page = new Page<>(pageNumber, pageSize);
+        IPage<AssignListDto> assignListDtoIPage = this.baseMapper.pageData(page, sysUser.getOrgId(), semesterId, examTypeId, courseCode);
+
+        ExamSyncTotal examSyncTotal = examSyncTotalService.getBySemesterIdAndExamTypeIdAndDownloadStatus(semesterId, examTypeId, true);
+
+        for (AssignListDto record : assignListDtoIPage.getRecords()) {
+
+        }
+
+        return assignListDtoIPage;
+    }
+
+    @Override
+    public boolean calcData(Long semesterId, Long examTypeId, String courseCode, String courseName, String formula, Double fullScore, Double passScore, String coefficient) {
+        // 保存赋分参数
+
+        // 计算赋分
+        return true;
+    }
+
+    @Override
+    public IPage<CloudMarkingScore> result(Long semesterId, Long examTypeId, String courseCode, String courseName, String formula, Double fullScore, Integer pageNumber, Integer pageSize) {
+        return null;
+    }
+
+    @Override
+    public Map contrast(Long semesterId, Long examTypeId, String courseCode) {
+        return null;
+    }
+}

+ 9 - 0
src/main/java/com/qmth/eds/service/impl/ExamSyncTotalServiceImpl.java

@@ -90,4 +90,13 @@ public class ExamSyncTotalServiceImpl extends ServiceImpl<ExamSyncTotalMapper, E
     public List<ExamSyncTotalDownloadDto> listDownloadRecordInfos(Long schoolId, Long semesterId, Long examTypeId) {
     public List<ExamSyncTotalDownloadDto> listDownloadRecordInfos(Long schoolId, Long semesterId, Long examTypeId) {
         return this.baseMapper.listDownloadRecordInfos(schoolId, semesterId, examTypeId);
         return this.baseMapper.listDownloadRecordInfos(schoolId, semesterId, examTypeId);
     }
     }
+
+    @Override
+    public ExamSyncTotal getBySemesterIdAndExamTypeIdAndDownloadStatus(Long semesterId, Long examTypeId, boolean status) {
+        QueryWrapper<ExamSyncTotal> queryWrapper = new QueryWrapper<>();
+        queryWrapper.lambda().eq(ExamSyncTotal::getSemesterId, semesterId)
+                .eq(ExamSyncTotal::getExamTypeId, examTypeId)
+                .eq(ExamSyncTotal::getDownloadStatus, status);
+        return this.getOne(queryWrapper);
+    }
 }
 }

+ 88 - 0
src/main/java/com/qmth/eds/service/impl/SysSettingServiceImpl.java

@@ -0,0 +1,88 @@
+package com.qmth.eds.service.impl;
+
+import com.alibaba.fastjson.JSON;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.qmth.eds.bean.dto.syssetting.SettingObject;
+import com.qmth.eds.common.contant.SystemConstant;
+import com.qmth.eds.common.entity.BasicSchool;
+import com.qmth.eds.common.entity.SysSetting;
+import com.qmth.eds.common.enums.ExceptionResultEnum;
+import com.qmth.eds.common.util.ServletUtil;
+import com.qmth.eds.mapper.SysSettingMapper;
+import com.qmth.eds.service.CommonCacheService;
+import com.qmth.eds.service.SysSettingService;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+import java.util.List;
+
+/**
+ * <p>
+ * 系统设置 服务实现类
+ * </p>
+ */
+@Service
+public class SysSettingServiceImpl extends ServiceImpl<SysSettingMapper, SysSetting> implements SysSettingService {
+
+    @Resource
+    CommonCacheService commonCacheService;
+
+    @Override
+    public List<SettingObject> getData() {
+        Long schoolId = Long.valueOf(ServletUtil.getRequestHeaderSchoolId().toString());
+        QueryWrapper<SysSetting> queryWrapper = new QueryWrapper<>();
+        queryWrapper.lambda().eq(SysSetting::getSchoolId, schoolId);
+        List<SysSetting> sysSettingList = this.list(queryWrapper);
+
+        SysSetting sysSetting = new SysSetting();
+        // 第一次设置,初始化数据
+        if (sysSettingList.isEmpty()) {
+            BasicSchool basicSchool = commonCacheService.schoolCache(schoolId);
+            sysSetting = SysSetting.init(basicSchool);
+            this.save(sysSetting);
+        } else if (sysSettingList.size() > 1) {
+            throw ExceptionResultEnum.ERROR.exception("系统设置有误,查出多条数据");
+        }
+
+        if (!sysSettingList.isEmpty()) {
+            sysSetting = sysSettingList.get(0);
+        }
+
+        return JSON.parseArray(sysSetting.getParameterObject(), SettingObject.class);
+    }
+
+    @Override
+    public boolean saveData(List<SettingObject> settingObjects) {
+        Long schoolId = Long.valueOf(ServletUtil.getRequestHeaderSchoolId().toString());
+        Long userId = Long.valueOf(ServletUtil.getRequestUserId().toString());
+
+        QueryWrapper<SysSetting> queryWrapper = new QueryWrapper<>();
+        queryWrapper.lambda().eq(SysSetting::getSchoolId, schoolId);
+        SysSetting sysSetting = this.getOne(queryWrapper);
+
+        String parameterObject = JSON.toJSONString(settingObjects);
+        // 新增
+        if (sysSetting == null) {
+            sysSetting = new SysSetting();
+            sysSetting.setId(SystemConstant.getDbUuid());
+            sysSetting.setParameterObject(parameterObject);
+            sysSetting.setSchoolId(schoolId);
+            sysSetting.setCreateId(userId);
+            sysSetting.setCreateTime(System.currentTimeMillis());
+        } else {
+            sysSetting.setParameterObject(parameterObject);
+            sysSetting.setUpdateId(userId);
+            sysSetting.setUpdateTime(System.currentTimeMillis());
+            commonCacheService.removeSysSetting(schoolId);
+        }
+        return this.saveOrUpdate(sysSetting);
+    }
+
+    @Override
+    public SysSetting getBySchoolId(Long schoolId) {
+        QueryWrapper<SysSetting> queryWrapper = new QueryWrapper<>();
+        queryWrapper.lambda().eq(SysSetting::getSchoolId, schoolId);
+        return this.getOne(queryWrapper);
+    }
+}

+ 0 - 1
src/main/java/com/qmth/eds/service/impl/TeachcloudCommonServiceImpl.java

@@ -70,7 +70,6 @@ public class TeachcloudCommonServiceImpl implements TeachcloudCommonService {
             roleNames = sysRoles.stream().map(m -> m.getType().name()).collect(Collectors.toSet());
             roleNames = sysRoles.stream().map(m -> m.getType().name()).collect(Collectors.toSet());
         }
         }
         String sessionId = SessionUtil.digest(sysUser.getId(), Math.abs(roleNames.toString().hashCode()), platform.name());
         String sessionId = SessionUtil.digest(sysUser.getId(), Math.abs(roleNames.toString().hashCode()), platform.name());
-        // TODO 测试用
 //      String test = SignatureEntityTest.build(SignatureType.TOKEN, sessionId, token);
 //      String test = SignatureEntityTest.build(SignatureType.TOKEN, sessionId, token);
         ExpireTimeBean expireTime = AuthUtil.getExpireTime(platform);
         ExpireTimeBean expireTime = AuthUtil.getExpireTime(platform);
         TBSession tbSession = new TBSession(sysUser.getSchoolId(), sessionId, String.valueOf(sysUser.getId()), roleNames.toString(),
         TBSession tbSession = new TBSession(sysUser.getSchoolId(), sessionId, String.valueOf(sysUser.getId()), roleNames.toString(),

+ 11 - 11
src/main/java/com/qmth/eds/service/impl/DataSyncServiceImpl.java → src/main/java/com/qmth/eds/service/impl/WhuDataSyncServiceImpl.java

@@ -13,8 +13,8 @@ import com.qmth.eds.common.entity.*;
 import com.qmth.eds.common.enums.ExceptionResultEnum;
 import com.qmth.eds.common.enums.ExceptionResultEnum;
 import com.qmth.eds.common.enums.TaskResultEnum;
 import com.qmth.eds.common.enums.TaskResultEnum;
 import com.qmth.eds.common.enums.TaskStatusEnum;
 import com.qmth.eds.common.enums.TaskStatusEnum;
-import com.qmth.eds.common.tools.CloudMarkingUtil;
-import com.qmth.eds.common.tools.WuhanUniversityUtils;
+import com.qmth.eds.common.tools.CloudMarkingUtils;
+import com.qmth.eds.common.tools.WhuUtils;
 import com.qmth.eds.common.util.FileUtil;
 import com.qmth.eds.common.util.FileUtil;
 import com.qmth.eds.common.util.ServletUtil;
 import com.qmth.eds.common.util.ServletUtil;
 import com.qmth.eds.service.*;
 import com.qmth.eds.service.*;
@@ -40,18 +40,18 @@ import java.util.stream.Collectors;
  * 同步服务类
  * 同步服务类
  */
  */
 @Service
 @Service
-public class DataSyncServiceImpl implements DataSyncService {
+public class WhuDataSyncServiceImpl implements WhuDataSyncService {
 
 
-    private static final Logger log = LoggerFactory.getLogger(DataSyncServiceImpl.class);
+    private static final Logger log = LoggerFactory.getLogger(WhuDataSyncServiceImpl.class);
 
 
     @Resource
     @Resource
     private TBSyncTaskService tbSyncTaskService;
     private TBSyncTaskService tbSyncTaskService;
 
 
     @Resource
     @Resource
-    private WuhanUniversityUtils wuhanUniversityUtils;
+    private WhuUtils whuUtils;
 
 
     @Resource
     @Resource
-    private CloudMarkingUtil cloudMarkingUtil;
+    private CloudMarkingUtils cloudMarkingUtils;
 
 
     @Resource
     @Resource
     private CloudMarkingScoreService cloudMarkingScoreService;
     private CloudMarkingScoreService cloudMarkingScoreService;
@@ -91,12 +91,12 @@ public class DataSyncServiceImpl implements DataSyncService {
             // 同步中
             // 同步中
             tbSyncTaskService.updateStatusAndResultById(tbSyncTask.getId(), TaskStatusEnum.RUNNING, null, null);
             tbSyncTaskService.updateStatusAndResultById(tbSyncTask.getId(), TaskStatusEnum.RUNNING, null, null);
             // 获取token
             // 获取token
-            String token = wuhanUniversityUtils.getAccessToken();
+            String token = whuUtils.getAccessToken(schoolId);
             if (StringUtils.isBlank(token)) {
             if (StringUtils.isBlank(token)) {
                 throw ExceptionResultEnum.ERROR.exception("获取AccessToken失败");
                 throw ExceptionResultEnum.ERROR.exception("获取AccessToken失败");
             }
             }
             // 调用接口
             // 调用接口
-            List<ExamSyncStudentTemp> examSyncStudentTemps = wuhanUniversityUtils.getKwData(token);
+            List<ExamSyncStudentTemp> examSyncStudentTemps = whuUtils.getKwData(schoolId, token);
 
 
             examSyncStudentTemps.forEach(m -> {
             examSyncStudentTemps.forEach(m -> {
                 m.setId(SystemConstant.getDbUuid());
                 m.setId(SystemConstant.getDbUuid());
@@ -182,7 +182,7 @@ public class DataSyncServiceImpl implements DataSyncService {
     }
     }
 
 
     @Override
     @Override
-    public void syncCloudMarkingStudentScoreData(TBSyncTask tbSyncTask, Integer examId) {
+    public void syncCloudMarkingStudentScoreData(Long schoolId, TBSyncTask tbSyncTask, Integer examId) {
         // 同步初始参数
         // 同步初始参数
         TaskResultEnum result = null;
         TaskResultEnum result = null;
         String errorMessage = "";
         String errorMessage = "";
@@ -198,14 +198,14 @@ public class DataSyncServiceImpl implements DataSyncService {
 
 
             Map<String, String> mapSource = new HashMap<>();
             Map<String, String> mapSource = new HashMap<>();
             mapSource.put("examId", String.valueOf(examId));
             mapSource.put("examId", String.valueOf(examId));
-            int totalCount = cloudMarkingUtil.getStudentCount(mapSource, collegeId);
+            int totalCount = cloudMarkingUtils.getStudentCount(schoolId, mapSource, collegeId);
             List<CloudMarkingScore> cloudMarkingScoreList = new ArrayList<>();
             List<CloudMarkingScore> cloudMarkingScoreList = new ArrayList<>();
             if (totalCount > 0) {
             if (totalCount > 0) {
                 int pageSize = SystemConstant.PAGE_SIZE;
                 int pageSize = SystemConstant.PAGE_SIZE;
                 int mod = totalCount % pageSize;
                 int mod = totalCount % pageSize;
                 int pageNos = mod == 0 ? totalCount / pageSize : totalCount / pageSize + 1;
                 int pageNos = mod == 0 ? totalCount / pageSize : totalCount / pageSize + 1;
                 for (int i = 1; i <= pageNos; i++) {
                 for (int i = 1; i <= pageNos; i++) {
-                    List<JSONObject> students = cloudMarkingUtil.getStudentScore(mapSource, collegeId, i, pageSize);
+                    List<JSONObject> students = cloudMarkingUtils.getStudentScore(schoolId, mapSource, collegeId, i, pageSize);
                     List<CloudMarkingScore> cloudMarkingScores = students.stream().map(m -> {
                     List<CloudMarkingScore> cloudMarkingScores = students.stream().map(m -> {
                         CloudMarkingScore cloudMarkingScore = new CloudMarkingScore();
                         CloudMarkingScore cloudMarkingScore = new CloudMarkingScore();
                         cloudMarkingScore.setId(SystemConstant.getDbUuid());
                         cloudMarkingScore.setId(SystemConstant.getDbUuid());

+ 13 - 62
src/main/resources/application.properties

@@ -1,56 +1,37 @@
 server.port=7772
 server.port=7772
-#tomcat\u6700\u5927\u7EBF\u7A0B\u6570\uFF0C\u9ED8\u8BA4\u4E3A200
+
 server.tomcat.threads.max=2500
 server.tomcat.threads.max=2500
-#tomcat\u6700\u5927\u8FDE\u63A5\u6570
 server.tomcat.max-connections=2500
 server.tomcat.max-connections=2500
-#tomcat\u7684URI\u7F16\u7801
 server.tomcat.uri-encoding=UTF-8
 server.tomcat.uri-encoding=UTF-8
-#\u9879\u76EE\u540D\u79F0
 spring.application.name=eds
 spring.application.name=eds
-#\u6570\u636E\u6E90\u914D\u7F6E
+
 db.host=localhost
 db.host=localhost
 db.port=3306
 db.port=3306
-db.name=a
+db.name=eds-1.0.2
 db.username=root
 db.username=root
-db.password=root
-#redis\u6570\u636E\u6E90\u914D\u7F6E
+db.password=12345678
+
 com.qmth.redis.host=${db.host}
 com.qmth.redis.host=${db.host}
 com.qmth.redis.db=3
 com.qmth.redis.db=3
 com.qmth.redis.port=6379
 com.qmth.redis.port=6379
 #com.qmth.redis.password=123456
 #com.qmth.redis.password=123456
-#mysql\u914D\u7F6E
+
 com.qmth.datasource.url=jdbc:mysql://${db.host}:${db.port}/${db.name}?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=UTF-8&nullCatalogMeansCurrent=true
 com.qmth.datasource.url=jdbc:mysql://${db.host}:${db.port}/${db.name}?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=UTF-8&nullCatalogMeansCurrent=true
 com.qmth.datasource.username=${db.username}
 com.qmth.datasource.username=${db.username}
 com.qmth.datasource.password=${db.password}
 com.qmth.datasource.password=${db.password}
 com.qmth.mybatis.log-level=debug
 com.qmth.mybatis.log-level=debug
 
 
-com.qmth.fss.public.config=oss://key:secret@teachcloud-print-dev-public.oss-api.qmth.com.cn
-com.qmth.fss.public.server=https://oss-file.qmth.com.cn/teachcloud-print-dev-public
-com.qmth.fss.private.config=oss://key:secret@teachcloud-print-dev-private.oss-api.qmth.com.cn
-com.qmth.fss.private.server=https://oss-file.qmth.com.cn/teachcloud-print-dev-private
-com.qmth.fss.localfile.config=/Users/king/Downloads/file-temp
-com.qmth.fss.localfile.server=http://192.168.10.140:8001
+com.qmth.fss.config=/Users/xiaofei/qmth/temporary/eds/file-temp
+com.qmth.fss.server=http://192.168.10.140:8001
 
 
 com.qmth.solar.access-key=274f823e5f59410f8b3bb6edcd8e2b6e
 com.qmth.solar.access-key=274f823e5f59410f8b3bb6edcd8e2b6e
 com.qmth.solar.access-secret=y7AO6W0TOdTF8HpWBwGHbp3wfIHsmUKr
 com.qmth.solar.access-secret=y7AO6W0TOdTF8HpWBwGHbp3wfIHsmUKr
 #com.qmth.solar.license=/Volumes/extend/\u542F\u660E/\u5206\u5E03\u5F0F\u5370\u5237/\u5206\u5E03\u5F0F\u5370\u5237&\u6559\u7814\u5206\u6790v3.1.0/tc-dev-wl.lic
 #com.qmth.solar.license=/Volumes/extend/\u542F\u660E/\u5206\u5E03\u5F0F\u5370\u5237/\u5206\u5E03\u5F0F\u5370\u5237&\u6559\u7814\u5206\u6790v3.1.0/tc-dev-wl.lic
 
 
-#\u7CFB\u7EDF\u914D\u7F6E
-sys.config.oss=true
-sys.config.attachmentType=.xlsx,.xls,.doc,.docx,.pdf,.jpg,.jpeg,.png,.html,.zip,.mp3,.wav,.dll,.exe,.ftl,.bpmn,.xml
-sys.config.attachmentLength=100
-sys.config.attachmentSize=200
-sys.config.serverUpload=
-sys.config.fileHost=192.168.10.36:7001
-sys.config.serverHost=192.168.10.36:7001
 sys.config.threadPoolCoreSize=1
 sys.config.threadPoolCoreSize=1
 sys.config.customThreadPoolCoreSize=true
 sys.config.customThreadPoolCoreSize=true
-sys.config.sessionActive=4h
-spring.resources.static-locations=file:${sys.config.serverUpload},classpath:/META-INF/resources/,classpath:/resources/
+spring.resources.static-locations=classpath:/META-INF/resources/,classpath:/resources/
 
 
-org.center.url=https://solar.qmth.com.cn
-org.center.orgQueryApi=/api/open/org/query
-#com.qmth.api.uri-prefix=/aaa
 #\u7EDF\u8BA1\u9875\u9762\u914D\u7F6E
 #\u7EDF\u8BA1\u9875\u9762\u914D\u7F6E
 com.qmth.api.metrics-endpoint=/metrics-count
 com.qmth.api.metrics-endpoint=/metrics-count
 com.qmth.api.global-auth=true
 com.qmth.api.global-auth=true
@@ -61,64 +42,34 @@ com.qmth.auth.time-max-ahead=1m
 com.qmth.auth.time-max-delay=5m
 com.qmth.auth.time-max-delay=5m
 #\u7F13\u5B58\u65F6\u95F4
 #\u7F13\u5B58\u65F6\u95F4
 com.qmth.cache.expire-after-write=8h
 com.qmth.cache.expire-after-write=8h
-#api\u524D\u7F00
-prefix.url.common=admin/common
+
 #\u65E5\u671F\u683C\u5F0F\u5316
 #\u65E5\u671F\u683C\u5F0F\u5316
 spring.jackson.date-format=yyyy-MM-dd HH:mm:ss
 spring.jackson.date-format=yyyy-MM-dd HH:mm:ss
 spring.jackson.time-zone=GMT+8
 spring.jackson.time-zone=GMT+8
 #\u65E5\u5FD7\u914D\u7F6E
 #\u65E5\u5FD7\u914D\u7F6E
 com.qmth.logging.root-level=info
 com.qmth.logging.root-level=info
-com.qmth.logging.file-path=/Users/king/Downloads/eds.log
+com.qmth.logging.file-path=/Users/xiaofei/qmth/temporary/eds/log/eds.log
 #============================================================================
 #============================================================================
 # \u914D\u7F6EJobStore
 # \u914D\u7F6EJobStore
 #============================================================================
 #============================================================================
 spring.quartz.job-store-type=jdbc
 spring.quartz.job-store-type=jdbc
 spring.quartz.jdbc.initialize-schema=never
 spring.quartz.jdbc.initialize-schema=never
-# JobDataMaps\u662F\u5426\u90FD\u4E3AString\u7C7B\u578B\uFF0C\u9ED8\u8BA4false
 spring.quartz.properties.org.quartz.jobStore.useProperties=false
 spring.quartz.properties.org.quartz.jobStore.useProperties=false
-# \u8868\u7684\u524D\u7F00\uFF0C\u9ED8\u8BA4QRTZ_
 spring.quartz.properties.org.quartz.jobStore.tablePrefix=QRTZ_
 spring.quartz.properties.org.quartz.jobStore.tablePrefix=QRTZ_
-# \u662F\u5426\u52A0\u5165\u96C6\u7FA4
 spring.quartz.properties.org.quartz.jobStore.isClustered=true
 spring.quartz.properties.org.quartz.jobStore.isClustered=true
-# \u8C03\u5EA6\u5B9E\u4F8B\u5931\u6548\u7684\u68C0\u67E5\u65F6\u95F4\u95F4\u9694 ms
 spring.quartz.properties.org.quartz.jobStore.clusterCheckinInterval=5000
 spring.quartz.properties.org.quartz.jobStore.clusterCheckinInterval=5000
-# \u5F53\u8BBE\u7F6E\u4E3A\u201Ctrue\u201D\u65F6\uFF0C\u6B64\u5C5E\u6027\u544A\u8BC9Quartz \u5728\u975E\u6258\u7BA1JDBC\u8FDE\u63A5\u4E0A\u8C03\u7528setTransactionIsolation\uFF08Connection.TRANSACTION_READ_COMMITTED\uFF09\u3002
 spring.quartz.properties.org.quartz.jobStore.txIsolationLevelReadCommitted=true
 spring.quartz.properties.org.quartz.jobStore.txIsolationLevelReadCommitted=true
-# \u6570\u636E\u4FDD\u5B58\u65B9\u5F0F\u4E3A\u6570\u636E\u5E93\u6301\u4E45\u5316
 spring.quartz.properties.org.quartz.jobStore.class=org.quartz.impl.jdbcjobstore.JobStoreTX
 spring.quartz.properties.org.quartz.jobStore.class=org.quartz.impl.jdbcjobstore.JobStoreTX
-# \u6570\u636E\u5E93\u4EE3\u7406\u7C7B\uFF0C\u4E00\u822Corg.quartz.impl.jdbcjobstore.StdJDBCDelegate\u53EF\u4EE5\u6EE1\u8DB3\u5927\u90E8\u5206\u6570\u636E\u5E93
 spring.quartz.properties.org.quartz.jobStore.driverDelegateClass=org.quartz.impl.jdbcjobstore.StdJDBCDelegate
 spring.quartz.properties.org.quartz.jobStore.driverDelegateClass=org.quartz.impl.jdbcjobstore.StdJDBCDelegate
-#============================================================================
-# Scheduler \u8C03\u5EA6\u5668\u5C5E\u6027\u914D\u7F6E
-#============================================================================
-# \u8C03\u5EA6\u6807\u8BC6\u540D \u96C6\u7FA4\u4E2D\u6BCF\u4E00\u4E2A\u5B9E\u4F8B\u90FD\u5FC5\u987B\u4F7F\u7528\u76F8\u540C\u7684\u540D\u79F0
 spring.quartz.properties.org.quartz.scheduler.instanceName=ClusterQuartz
 spring.quartz.properties.org.quartz.scheduler.instanceName=ClusterQuartz
-# ID\u8BBE\u7F6E\u4E3A\u81EA\u52A8\u83B7\u53D6 \u6BCF\u4E00\u4E2A\u5FC5\u987B\u4E0D\u540C
 spring.quartz.properties.org.quartz.scheduler.instanceId=AUTO
 spring.quartz.properties.org.quartz.scheduler.instanceId=AUTO
-#============================================================================
-# \u914D\u7F6EThreadPool
-#============================================================================
-# \u7EBF\u7A0B\u6C60\u7684\u5B9E\u73B0\u7C7B\uFF08\u4E00\u822C\u4F7F\u7528SimpleThreadPool\u5373\u53EF\u6EE1\u8DB3\u51E0\u4E4E\u6240\u6709\u7528\u6237\u7684\u9700\u6C42\uFF09
-spring.quartz.properties.org.quartz.threadPool.class=org.quartz.simpl.SimpleThreadPool
-# \u6307\u5B9A\u7EBF\u7A0B\u6570\uFF0C\u4E00\u822C\u8BBE\u7F6E\u4E3A1-100\u76F4\u63A5\u7684\u6574\u6570\uFF0C\u6839\u636E\u7CFB\u7EDF\u8D44\u6E90\u914D\u7F6E
 spring.quartz.properties.org.quartz.threadPool.threadCount=10
 spring.quartz.properties.org.quartz.threadPool.threadCount=10
-# \u8BBE\u7F6E\u7EBF\u7A0B\u7684\u4F18\u5148\u7EA7(\u53EF\u4EE5\u662FThread.MIN_PRIORITY\uFF08\u53731\uFF09\u548CThread.MAX_PRIORITY\uFF08\u8FD9\u662F10\uFF09\u4E4B\u95F4\u7684\u4EFB\u4F55int \u3002\u9ED8\u8BA4\u503C\u4E3AThread.NORM_PRIORITY\uFF085\uFF09\u3002)
 spring.quartz.properties.org.quartz.threadPool.threadPriority=5
 spring.quartz.properties.org.quartz.threadPool.threadPriority=5
+
 sms.config.normalCode=kwsj
 sms.config.normalCode=kwsj
 sms.config.expiredTime=2
 sms.config.expiredTime=2
 sms.config.sendInterval=60
 sms.config.sendInterval=60
 sms.config.aliyunSMSKey=LTAI4Fi8jVRYT49QBXU9x5QX
 sms.config.aliyunSMSKey=LTAI4Fi8jVRYT49QBXU9x5QX
 sms.config.aliyunSMSSecret=97aBLBfkQR5mzCiQa82yWLAH57eUd8
 sms.config.aliyunSMSSecret=97aBLBfkQR5mzCiQa82yWLAH57eUd8
 sms.config.aliyunSMSSignName=\u542F\u660E\u6CF0\u548C
 sms.config.aliyunSMSSignName=\u542F\u660E\u6CF0\u548C
-sms.config.teachDataChangeNoticeCode=SMS_242831889
-whu.config.appKey=DD1198B44CD624B6E0530107010AF5DF
-whu.config.appSecret=MIIBVAIBADANBgkqhkiG9w0BAQEFAASCAT4wggE6AgEAAkEAojkSbVqi/6v7hNdHZIPU4EKLyyxO7akNAIXilJ0+c0sYHV4Z6vctSrds4LIPp3fXUuMA9F7d1vp6s7HOQfuIfwIDAQABAkBiCowQew635oEEL/d90A7/2jgSepzZFao9/qyJlN8BXg8M6zwBFiEB51GbW0642bWTftFT0Arrq6ipYkXTyH7BAiEA8oMCG7HqUYXX4bt6h9Bz8LIwI4oFx3x90RpK+b0iPmMCIQCrPuAZB90EJtr4fOE3+lQBORoKVOF/cwFQX14mBXRKNQIhAKLeVVYgQMwLZZcWgA4icxsdsLLNiWAWPbFnRR9AZHUdAiA5tGJHjQLJF17KRSqPdmdAUkGYIaorDFHxB3HuVgAt0QIgIMcILJ3lJx6URAEG9e055KXh8J+nXItScHZ4bXMWls4=
-whu.config.tokenUrl=http://120.76.177.81/zfdsb/oauth2/accessToken
-whu.config.kwUrl=http://120.76.177.81/zfdsb/api/kw/ksmd
-
-cloud.marking.config.accessKey=d81badf113d1450c9f554809e1282ae1
-cloud.marking.config.accessSecret=dmILQXiRESNasxUylMNGl05R0JsaVb9t
-cloud.marking.config.rootUrl=http://192.168.10.225:8080
-cloud.marking.config.examUrl=/api/exams
-cloud.marking.config.studentCountUrl=/api/exam/student/count
-cloud.marking.config.studentScoreUrl=/api/exam/student/score
+sms.config.teachDataChangeNoticeCode=SMS_242831889

+ 46 - 0
src/main/resources/db/log/log-1.0.4.sql

@@ -0,0 +1,46 @@
+CREATE TABLE `sys_setting` (
+                               `id` bigint NOT NULL,
+                               `school_id` bigint NOT NULL COMMENT '学校Id',
+                               `parameter_object` MEDIUMTEXT NOT NULL COMMENT '参数对象(json)',
+                               `create_id` bigint DEFAULT NULL COMMENT '创建人',
+                               `create_time` bigint DEFAULT NULL COMMENT '创建时间',
+                               `update_id` bigint DEFAULT NULL COMMENT '更新人',
+                               `update_time` bigint DEFAULT NULL COMMENT '更新时间',
+                               PRIMARY KEY (`id`) USING BTREE
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='系统设置';
+
+INSERT INTO `sys_role` (`id`, `school_id`, `name`, `enable`, `type`) VALUES ('3', '1', '赋分老师', '1', 'ASSIGN');
+
+INSERT INTO `sys_privilege` (`id`, `name`, `url`, `type`, `sequence`, `enable`, `default_auth`, `front_display`) VALUES ('45', '赋分管理', 'AssignManage', 'MENU', '4', '0', '1', '1');
+INSERT INTO `sys_privilege` (`id`, `name`, `url`, `type`, `parent_id`, `sequence`, `enable`, `default_auth`, `front_display`) VALUES ('46', '赋分试算', 'AssignCalc', 'MENU', '45', '1', '1', '0', '1');
+INSERT INTO `sys_privilege` (`id`, `name`, `url`, `type`, `parent_id`, `sequence`, `property`, `enable`, `default_auth`, `front_display`) VALUES ('47', '赋分列表查询', '/api/assign/page', 'URL', '45', '1', 'AUTH', '1', '1', '1');
+INSERT INTO `sys_privilege` (`id`, `name`, `url`, `type`, `parent_id`, `sequence`, `property`, `enable`, `default_auth`, `front_display`) VALUES ('48', '赋分列表详情', '/api/assign/detail', 'URL', '45', '2', 'AUTH', '1', '1', '1');
+INSERT INTO `sys_privilege` (`id`, `name`, `url`, `type`, `parent_id`, `sequence`, `property`, `enable`, `default_auth`, `front_display`) VALUES ('49', '赋分计算', '/api/assign/calc', 'URL', '45', '3', 'AUTH', '1', '1', '1');
+INSERT INTO `sys_privilege` (`id`, `name`, `url`, `type`, `parent_id`, `sequence`, `property`, `enable`, `default_auth`, `front_display`) VALUES ('50', '赋分计算结果查询', '/api/assign/result', 'URL', '45', '4', 'AUTH', '1', '1', '1');
+INSERT INTO `sys_privilege` (`id`, `name`, `url`, `type`, `parent_id`, `sequence`, `property`, `enable`, `default_auth`, `front_display`) VALUES ('51', '赋分计算结果对比', '/api/assign/contrast', 'URL', '45', '5', 'AUTH', '1', '1', '1');
+
+
+INSERT INTO `sys_role_privilege` (`id`, `role_id`, `privilege_id`, `enable`) VALUES ('45', '3', '45', '1');
+INSERT INTO `sys_role_privilege` (`id`, `role_id`, `privilege_id`, `enable`) VALUES ('46', '3', '46', '1');
+INSERT INTO `sys_role_privilege` (`id`, `role_id`, `privilege_id`, `enable`) VALUES ('47', '3', '47', '1');
+INSERT INTO `sys_role_privilege` (`id`, `role_id`, `privilege_id`, `enable`) VALUES ('48', '3', '48', '1');
+INSERT INTO `sys_role_privilege` (`id`, `role_id`, `privilege_id`, `enable`) VALUES ('49', '3', '49', '1');
+INSERT INTO `sys_role_privilege` (`id`, `role_id`, `privilege_id`, `enable`) VALUES ('50', '3', '50', '1');
+INSERT INTO `sys_role_privilege` (`id`, `role_id`, `privilege_id`, `enable`) VALUES ('51', '3', '51', '1');
+
+CREATE TABLE `exam_assign` (
+     `id` BIGINT(20) NOT NULL,
+     `school_id` BIGINT(20) NULL,
+     `semester_id` BIGINT(20) NULL,
+     `exam_type_id` BIGINT(20) NULL,
+     `course_code` VARCHAR(45) NULL,
+     `course_name` VARCHAR(100) NULL,
+     `formula` VARCHAR(45) NULL COMMENT '公式类型(类型1或者类型2)',
+     `full_score` DOUBLE NULL COMMENT '满分',
+     `pass_score` DOUBLE NULL COMMENT '及格分',
+     `coefficient` MEDIUMTEXT NULL COMMENT '系统对象(json格式)',
+     `create_id` BIGINT(20) NULL,
+     `create_time` BIGINT(20) NULL,
+     `update_id` BIGINT(20) NULL,
+     `update_time` BIGINT(20) NULL,
+     PRIMARY KEY (`id`));

+ 25 - 0
src/main/resources/mapper/ExamAssignMapper.xml

@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
+<mapper namespace="com.qmth.eds.mapper.ExamAssignMapper">
+    <select id="pageData" resultType="com.qmth.eds.bean.dto.AssignListDto">
+        select
+            distinct
+            school_id schoolId,
+            semester_id semesterId,
+            exam_type_id examTypeId,
+            subject_code courseCode
+            from cloud_marking_score
+        <where>
+            school_id = #{schoolId}
+            <if test="semesterId != null">
+                and semester_id = #{semesterId}
+            </if>
+            <if test="examTypeId != null">
+                and exam_type_id = #{examTypeId}
+            </if>
+            <if test="courseCode != null and courseCode != ''">
+                and course_code = #{courseCode}
+            </if>
+        </where>
+    </select>
+</mapper>

+ 4 - 4
src/test/java/com/qmth/eds/WhuTest.java

@@ -2,7 +2,7 @@ package com.qmth.eds;
 
 
 import com.qmth.eds.common.entity.ExamSyncStudentTemp;
 import com.qmth.eds.common.entity.ExamSyncStudentTemp;
 import com.qmth.eds.job.service.JobService;
 import com.qmth.eds.job.service.JobService;
-import com.qmth.eds.common.tools.WuhanUniversityUtils;
+import com.qmth.eds.common.tools.WhuUtils;
 import org.junit.Test;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.junit.runner.RunWith;
 import org.springframework.boot.test.context.SpringBootTest;
 import org.springframework.boot.test.context.SpringBootTest;
@@ -19,16 +19,16 @@ import java.util.List;
 public class WhuTest {
 public class WhuTest {
 
 
     @Resource
     @Resource
-    WuhanUniversityUtils wuhanUniversityUtils;
+    WhuUtils whuUtils;
 
 
     @Resource
     @Resource
     JobService jobService;
     JobService jobService;
 
 
     @Test
     @Test
     public void test() {
     public void test() {
-        String token = wuhanUniversityUtils.getAccessToken();
+        String token = whuUtils.getAccessToken(1l);
 
 
-        List<ExamSyncStudentTemp> kwData = wuhanUniversityUtils.getKwData(token);
+        List<ExamSyncStudentTemp> kwData = whuUtils.getKwData(1l, token);
         System.out.println(kwData);
         System.out.println(kwData);
 
 
     }
     }