Browse Source

推送学期方法

wangliang 3 years ago
parent
commit
22fbf4131a

+ 2 - 2
distributed-print/src/main/java/com/qmth/distributed/print/api/OpenApiController.java

@@ -17,13 +17,13 @@ import org.springframework.web.bind.annotation.RestController;
 
 /**
  * <p>
- * 开放接口前端控制器
+ * 知学知考开放接口前端控制器
  * </p>
  *
  * @author wangliang
  * @since 2022-04-26
  */
-@Api(tags = "开放接口Controller")
+@Api(tags = "知学知考开放接口Controller")
 @RestController
 @RequestMapping(ApiConstant.DEFAULT_URI_PREFIX + "/${prefix.url.open}")
 @Validated

+ 26 - 13
distributed-print/src/main/java/com/qmth/distributed/print/api/TSAuthController.java

@@ -1,6 +1,5 @@
 package com.qmth.distributed.print.api;
 
-import com.alibaba.fastjson.JSONObject;
 import com.qmth.boot.api.annotation.Aac;
 import com.qmth.boot.api.annotation.BOOL;
 import com.qmth.boot.api.constant.ApiConstant;
@@ -8,9 +7,9 @@ import com.qmth.boot.core.solar.crypto.AppLicenseUtil;
 import com.qmth.boot.tools.signature.SignatureEntity;
 import com.qmth.boot.tools.signature.SignatureType;
 import com.qmth.distributed.print.business.service.AuthInfoService;
+import com.qmth.teachcloud.common.bean.params.BasicSemesterParams;
 import com.qmth.teachcloud.common.contant.SystemConstant;
 import com.qmth.teachcloud.common.entity.BasicSchool;
-import com.qmth.teachcloud.common.entity.SysUser;
 import com.qmth.teachcloud.common.service.CommonCacheService;
 import com.qmth.teachcloud.common.util.*;
 import io.swagger.annotations.*;
@@ -85,23 +84,37 @@ public class TSAuthController {
     @ApiResponses({@ApiResponse(code = 200, message = "测试推送信息给教研分析", response = Objects.class)})
     @RequestMapping(value = "/test/push", method = RequestMethod.POST)
     public void testPush() throws IOException {
-        SysUser sysUser = (SysUser) ServletUtil.getRequestUser();
+        /**
+         * 测试推送学期
+         */
+        String url = "/api/report/open/semester_edit";
         Long schoolId = SystemConstant.getHeadOrUserSchoolId();
         BasicSchool basicSchool = commonCacheService.schoolCache(schoolId);
-        JSONObject jsonObject = new JSONObject();
-        jsonObject.put("orgId", basicSchool.getId());
-        jsonObject.put("orgCode", basicSchool.getCode());
-        jsonObject.put("accessKey", basicSchool.getAccessKey());
-        jsonObject.put("accessSecret", basicSchool.getAccessSecret());
-        jsonObject.put("createId", sysUser.getId());
-        jsonObject.put("createUserName", sysUser.getRealName());
-        jsonObject.put("callbackUrl", "/api/admin/auth/test/callback");
+        BasicSemesterParams basicSemesterParams = new BasicSemesterParams("测试学期1", System.currentTimeMillis(), System.currentTimeMillis() + 1L);
         Long timestamp = System.currentTimeMillis();
-        String accessToken = SignatureEntity.build(SignatureType.SECRET, SystemConstant.METHOD, "/api/report/open/basic/examination/data", timestamp, basicSchool.getAccessKey(), basicSchool.getAccessSecret());
-        String result = HttpUtil.postJson("http://127.0.0.1:7004/api/report/open/basic/examination/data", jsonObject.toJSONString(), accessToken, timestamp);
+        String accessToken = SignatureEntity.build(SignatureType.SECRET, SystemConstant.METHOD, url, timestamp, basicSchool.getAccessKey(), basicSchool.getAccessSecret());
+        String result = HttpUtil.postJson("http://127.0.0.1:7004" + url, JacksonUtil.parseJson(basicSemesterParams), accessToken, timestamp);
         if (Objects.nonNull(result)) {
             log.info("result:{}", JacksonUtil.parseJson(result));
         }
+
+//        SysUser sysUser = (SysUser) ServletUtil.getRequestUser();
+//        Long schoolId = SystemConstant.getHeadOrUserSchoolId();
+//        BasicSchool basicSchool = commonCacheService.schoolCache(schoolId);
+//        JSONObject jsonObject = new JSONObject();
+//        jsonObject.put("orgId", basicSchool.getId());
+//        jsonObject.put("orgCode", basicSchool.getCode());
+//        jsonObject.put("accessKey", basicSchool.getAccessKey());
+//        jsonObject.put("accessSecret", basicSchool.getAccessSecret());
+//        jsonObject.put("createId", sysUser.getId());
+//        jsonObject.put("createUserName", sysUser.getRealName());
+//        jsonObject.put("callbackUrl", "/api/admin/auth/test/callback");
+//        Long timestamp = System.currentTimeMillis();
+//        String accessToken = SignatureEntity.build(SignatureType.SECRET, SystemConstant.METHOD, "/api/report/open/basic/examination/data", timestamp, basicSchool.getAccessKey(), basicSchool.getAccessSecret());
+//        String result = HttpUtil.post("http://127.0.0.1:7004/api/report/open/basic/examination/data", jsonObject.toJSONString(), accessToken, timestamp);
+//        if (Objects.nonNull(result)) {
+//            log.info("result:{}", JacksonUtil.parseJson(result));
+//    }
     }
 
     @ApiOperation(value = "测试教研分析回调接口")

+ 3 - 6
distributed-print/src/main/resources/application-dev.properties

@@ -12,9 +12,9 @@ spring.application.name=distributed-print
 #\u6570\u636E\u6E90\u914D\u7F6E
 db.host=localhost
 db.port=3306
-db.name=distributed-clear-v3.0.2
+db.name=distributed-v3.0.1-test
 db.username=root
-db.password=88888888
+db.password=123456789
 
 #redis\u6570\u636E\u6E90\u914D\u7F6E
 com.qmth.redis.host=${db.host}
@@ -159,10 +159,7 @@ sync.config.markerSaveUrl=/api/exam/marker/save
 
 #com.qmth.solar.access-key=274f823e5f59410f8b3bb6edcd8e2b6e
 #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.0.2/tc-dev-wl.lic
-com.qmth.solar.access-key=274f823e5f59410f8b3bb6edcd8e2b6e
-com.qmth.solar.access-secret=y7AO6W0TOdTF8HpWBwGHbp3wfIHsmUKr
-#com.qmth.solar.license=/Volumes/extend/\u542F\u660E/\u5206\u5E03\u5F0F\u5370\u5237/\u5206\u5E03\u5F0F\u5370\u5237v3.0.2/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
 
 sms.config.smsNormalCode=qmth
 sms.config.codeExpiredTime=2

+ 19 - 4
teachcloud-common/src/main/java/com/qmth/teachcloud/common/bean/params/BasicSemesterParams.java

@@ -16,6 +16,7 @@ import java.io.Serializable;
  * @Date: 2021-11-01
  */
 public class BasicSemesterParams implements Serializable {
+
     @JsonSerialize(using = ToStringSerializer.class)
     @ApiModelProperty(value = "学期id(编辑时必填)")
     @DBVerify(value = "学期id(编辑时必填)")
@@ -23,23 +24,37 @@ public class BasicSemesterParams implements Serializable {
 
     @ApiModelProperty(value = "学期名称")
     @NotNull(message = "请输入学期名称")
-    @Length(min = 1,message = "请输入学期名称")
-    @DBVerify(value = "学期名称",required = true,min = 1,max = 50)
+    @Length(min = 1, message = "请输入学期名称")
+    @DBVerify(value = "学期名称", required = true, min = 1, max = 50)
     private String semesterName;
 
     @ApiModelProperty(value = "学期开始时间")
     @NotNull(message = "请选择学期开始时间")
     @Range(min = 1L, message = "请选择学期开始时间")
-    @DBVerify(value = "学期开始时间",required = true,min = 1)
+    @DBVerify(value = "学期开始时间", required = true, min = 1)
     private Long startTime;
 
     @ApiModelProperty(value = "学期结束时间")
     @NotNull(message = "请选择学期结束时间")
     @Range(min = 1L, message = "请选择学期结束时间")
-    @DBVerify(value = "学期结束时间",required = true,min = 1)
+    @DBVerify(value = "学期结束时间", required = true, min = 1)
     private Long endTime;
 
     public BasicSemesterParams() {
+
+    }
+
+    public BasicSemesterParams(String semesterName, Long startTime, Long endTime) {
+        this.semesterName = semesterName;
+        this.startTime = startTime;
+        this.endTime = endTime;
+    }
+
+    public BasicSemesterParams(Long id, String semesterName, Long startTime, Long endTime) {
+        this.id = id;
+        this.semesterName = semesterName;
+        this.startTime = startTime;
+        this.endTime = endTime;
     }
 
     public Long getId() {

+ 34 - 0
teachcloud-common/src/main/java/com/qmth/teachcloud/common/contant/SystemConstant.java

@@ -2,6 +2,7 @@ package com.qmth.teachcloud.common.contant;
 
 import com.qmth.boot.core.uid.service.UidService;
 import com.qmth.teachcloud.common.annotation.DBVerify;
+import com.qmth.teachcloud.common.bean.params.BasicSemesterParams;
 import com.qmth.teachcloud.common.bean.result.DBVerifyResult;
 import com.qmth.teachcloud.common.config.DictionaryConfig;
 import com.qmth.teachcloud.common.entity.SysUser;
@@ -9,6 +10,8 @@ import com.qmth.teachcloud.common.enums.ExceptionResultEnum;
 import com.qmth.teachcloud.common.enums.TFCustomTypeEnum;
 import com.qmth.teachcloud.common.util.Base64Util;
 import com.qmth.teachcloud.common.util.ServletUtil;
+import org.apache.poi.ss.formula.functions.T;
+import org.springframework.cglib.beans.BeanMap;
 
 import java.io.*;
 import java.lang.reflect.Field;
@@ -146,6 +149,7 @@ public class SystemConstant {
     public static final String HEADER_PLATFORM = "platform";
     public static final String HEADER_DEVICE_ID = "deviceId";
     public static final String TOKEN = "token";
+    public static final String SIGN = "sign";
 
     /**
      * redis
@@ -562,4 +566,34 @@ public class SystemConstant {
             }
         }
     }
+
+    /**
+     * 将对象装换为map
+     *
+     * @param bean
+     * @return
+     */
+    public static Map<String, Object> beanToMap(Object bean) {
+        Map map = new HashMap<>();
+        if (bean != null) {
+            BeanMap beanMap = BeanMap.create(bean);
+            for (Object key : beanMap.keySet()) {
+                map.put(String.valueOf(key), beanMap.get(key));
+            }
+        }
+        return map;
+    }
+
+    /**
+     * 将map装换为javabean对象
+     *
+     * @param map
+     * @param bean
+     * @return
+     */
+    public static Object mapToBean(Map<String, Object> map, Object bean) {
+        BeanMap beanMap = BeanMap.create(bean);
+        beanMap.putAll(map);
+        return bean;
+    }
 }

+ 2 - 0
teachcloud-common/src/main/java/com/qmth/teachcloud/common/enums/ExceptionResultEnum.java

@@ -106,6 +106,8 @@ public enum ExceptionResultEnum {
 
     AUTH_INFO_ERROR(HttpStatus.UNAUTHORIZED, 4010009, "系统授权信息已过期,请联系系统管理员激活!"),
 
+    SIGN_INVALID(HttpStatus.UNAUTHORIZED, 4010010, "签名无效"),
+
     /**
      * 404
      */

+ 11 - 0
teachcloud-common/src/main/java/com/qmth/teachcloud/common/service/BasicSemesterService.java

@@ -36,6 +36,17 @@ public interface BasicSemesterService extends IService<BasicSemester> {
      */
     Long saveBasicSemester(BasicSemesterParams basicSemesterParams) throws IllegalAccessException;
 
+    /**
+     * 基础学期编辑
+     *
+     * @param basicSemesterParams
+     * @param schoolId
+     * @param orgId
+     * @return
+     * @throws IllegalAccessException
+     */
+    Long saveBasicSemesterCommon(BasicSemesterParams basicSemesterParams, Long schoolId, Long orgId) throws IllegalAccessException;
+
     /**
      * 学期删除
      *

+ 22 - 3
teachcloud-common/src/main/java/com/qmth/teachcloud/common/service/impl/BasicSemesterServiceImpl.java

@@ -18,6 +18,7 @@ import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.util.CollectionUtils;
 
+import javax.annotation.Resource;
 import java.util.List;
 import java.util.Objects;
 import java.util.stream.Collectors;
@@ -32,6 +33,10 @@ import java.util.stream.Collectors;
  */
 @Service
 public class BasicSemesterServiceImpl extends ServiceImpl<BasicSemesterMapper, BasicSemester> implements BasicSemesterService {
+
+    @Resource
+    BasicSemesterService basicSemesterService;
+
     @Override
     public IPage<BasicSemesterResult> basicSemesterPage(Long schoolId, int pageNumber, int pageSize) {
         return this.baseMapper.findBasicSemesterPage(new Page<>(pageNumber, pageSize), schoolId, null);
@@ -40,10 +45,24 @@ public class BasicSemesterServiceImpl extends ServiceImpl<BasicSemesterMapper, B
     @Transactional
     @Override
     public Long saveBasicSemester(BasicSemesterParams basicSemesterParams) throws IllegalAccessException {
-        SystemConstant.verifyDBFields(basicSemesterParams, basicSemesterParams.getClass());
         SysUser sysUser = (SysUser) ServletUtil.getRequestUser();
+        return basicSemesterService.saveBasicSemesterCommon(basicSemesterParams, sysUser.getSchoolId(), sysUser.getOrgId());
+    }
+
+    /**
+     * 保存公用
+     *
+     * @param basicSemesterParams
+     * @param schoolId
+     * @param orgId
+     * @return
+     * @throws IllegalAccessException
+     */
+    @Override
+    @Transactional
+    public Long saveBasicSemesterCommon(BasicSemesterParams basicSemesterParams, Long schoolId, Long orgId) throws IllegalAccessException {
+        SystemConstant.verifyDBFields(basicSemesterParams, basicSemesterParams.getClass());
         Long id = basicSemesterParams.getId();
-        Long schoolId = sysUser.getSchoolId();
         String semesterName = basicSemesterParams.getSemesterName();
         Long startTime = basicSemesterParams.getStartTime();
         Long endTime = basicSemesterParams.getEndTime();
@@ -78,7 +97,7 @@ public class BasicSemesterServiceImpl extends ServiceImpl<BasicSemesterMapper, B
             basicSemester.setCode(null);
             basicSemester.setStartTime(startTime);
             basicSemester.setEndTime(endTime);
-            basicSemester.setOrgId(sysUser.getOrgId());
+            basicSemester.setOrgId(orgId);
 
             QueryWrapper<BasicSemester> queryWrapper = new QueryWrapper<>();
             queryWrapper.lambda().eq(BasicSemester::getSchoolId, schoolId);

+ 78 - 0
teachcloud-common/src/main/java/com/qmth/teachcloud/common/util/AuthThirdUtil.java

@@ -0,0 +1,78 @@
+package com.qmth.teachcloud.common.util;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.qmth.boot.tools.signature.SignatureEntity;
+import com.qmth.boot.tools.signature.SignatureType;
+import com.qmth.teachcloud.common.contant.SpringContextHolder;
+import com.qmth.teachcloud.common.entity.BasicSchool;
+import com.qmth.teachcloud.common.enums.ExceptionResultEnum;
+import com.qmth.teachcloud.common.service.BasicSchoolService;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.servlet.http.HttpServletRequest;
+import java.util.Objects;
+
+/**
+ * @Description: 第三方鉴权util
+ * @Param:
+ * @return:
+ * @Author: wangliang
+ * @Date: 2022/5/27
+ */
+public class AuthThirdUtil {
+    private final static Logger log = LoggerFactory.getLogger(AuthThirdUtil.class);
+
+    /**
+     * 鉴权
+     *
+     * @return
+     */
+    public static BasicSchool hasPermission() {
+        BasicSchoolService basicSchoolService = SpringContextHolder.getBean(BasicSchoolService.class);
+        HttpServletRequest request = ServletUtil.getRequest();
+        String url = request.getServletPath();
+        //验证authorization
+        String authorization = ServletUtil.getRequestAuthorization();
+        if (Objects.isNull(authorization)) {
+            throw ExceptionResultEnum.AUTHORIZATION_INVALID.exception();
+        }
+        Long expireTime = ServletUtil.getRequestTime();
+        if (Objects.isNull(expireTime)) {
+            throw ExceptionResultEnum.TIME_INVALID.exception();
+        }
+        String method = request.getMethod();
+        final SignatureEntity info = SignatureEntity.parse(authorization, method, url, expireTime);
+        if (Objects.isNull(info)) {
+            log.warn("Authorization faile: signature decode error");
+            throw ExceptionResultEnum.AUTHORIZATION_ERROR.exception();
+        }
+        if (!url.equalsIgnoreCase(info.getUri())) {
+            log.warn("url faile: url error");
+            throw ExceptionResultEnum.AUTHORIZATION_ERROR.exception();
+        }
+        if (!method.equalsIgnoreCase(info.getMethod())) {
+            log.warn("method faile: method error");
+            throw ExceptionResultEnum.AUTHORIZATION_ERROR.exception();
+        }
+        if (info.getTimestamp() > expireTime) {
+            log.warn("Authorization faile: session has expired, expire time=" + expireTime);
+            throw ExceptionResultEnum.TIME_INVALID.exception();
+        }
+        if (SignatureType.SECRET != info.getType()) {
+            log.warn("Authorization faile: signature type is not Secret");
+            throw ExceptionResultEnum.AUTHORIZATION_ERROR.exception();
+        }
+        QueryWrapper<BasicSchool> basicSchoolQueryWrapper = new QueryWrapper<>();
+        basicSchoolQueryWrapper.lambda().eq(BasicSchool::getAccessKey, info.getInvoker());
+        BasicSchool basicSchool = basicSchoolService.getOne(basicSchoolQueryWrapper);
+        if (Objects.isNull(basicSchool)) {
+            throw ExceptionResultEnum.AUTHORIZATION_ERROR.exception("没有学校信息");
+        }
+        if (!info.validate(basicSchool.getAccessSecret())) {
+            log.warn("Authorization faile: secret invalid, secret is " + basicSchool.getAccessSecret());
+            throw ExceptionResultEnum.AUTHORIZATION_ERROR.exception();
+        }
+        return basicSchool;
+    }
+}

+ 2 - 2
teachcloud-common/src/main/java/com/qmth/teachcloud/common/util/HttpUtil.java

@@ -49,7 +49,7 @@ public class HttpUtil {
     public static String postJson(String url, String json, String secret, Long timestamp) throws IOException {
         // 构建post请求
         HttpPost post = new HttpPost(url);
-        post.setHeader("authorization-token", secret);
+        post.setHeader(SystemConstant.HEADER_AUTHORIZATION, secret);
         post.setHeader(SystemConstant.HEADER_TIME, String.valueOf(timestamp));
         post.setHeader(HTTP.CONTENT_TYPE, "application/json; charset=utf-8");
         post.setHeader("Accept", "application/json");
@@ -77,7 +77,7 @@ public class HttpUtil {
         HttpPost post = new HttpPost(url);
         post.setHeader(SystemConstant.HEADER_AUTHORIZATION, secret);
         post.setHeader(SystemConstant.HEADER_TIME, String.valueOf(timestamp));
-        post.setHeader("Content-Type", "application/x-www-form-urlencoded;charset=utf-8");
+        post.setHeader(HTTP.CONTENT_TYPE, "application/x-www-form-urlencoded;charset=utf-8");
         // 构建请求参数
         List<BasicNameValuePair> pairs = new ArrayList<BasicNameValuePair>();
         if (params != null) {

+ 15 - 0
teachcloud-common/src/main/java/com/qmth/teachcloud/common/util/ServletUtil.java

@@ -41,6 +41,21 @@ public class ServletUtil {
         httpResponse.getWriter().print(json);
     }
 
+    /**
+     * 获取请求的sign
+     *
+     * @return
+     */
+    public static String getRequestSign() {
+        try {
+            HttpServletRequest request = getRequest();
+            return Objects.isNull(request.getHeader(SystemConstant.SIGN)) ? request.getParameter(SystemConstant.SIGN) : request.getHeader(SystemConstant.SIGN);
+        } catch (Exception e) {
+            log.error(SystemConstant.LOG_ERROR, e);
+            throw ExceptionResultEnum.SIGN_INVALID.exception();
+        }
+    }
+
     /**
      * 获取请求的token
      *

+ 70 - 39
teachcloud-report/src/main/java/com/qmth/teachcloud/report/api/OpenApiController.java

@@ -1,13 +1,13 @@
 package com.qmth.teachcloud.report.api;
 
-import com.alibaba.fastjson.JSONObject;
 import com.qmth.boot.api.annotation.Aac;
 import com.qmth.boot.api.annotation.BOOL;
 import com.qmth.boot.api.constant.ApiConstant;
-import com.qmth.boot.tools.signature.SignatureEntity;
-import com.qmth.boot.tools.signature.SignatureType;
+import com.qmth.teachcloud.common.bean.params.BasicSemesterParams;
 import com.qmth.teachcloud.common.contant.SystemConstant;
-import com.qmth.teachcloud.common.util.HttpUtil;
+import com.qmth.teachcloud.common.entity.BasicSchool;
+import com.qmth.teachcloud.common.service.BasicSemesterService;
+import com.qmth.teachcloud.common.util.AuthThirdUtil;
 import com.qmth.teachcloud.common.util.JacksonUtil;
 import com.qmth.teachcloud.common.util.Result;
 import com.qmth.teachcloud.common.util.ResultUtil;
@@ -20,59 +20,90 @@ import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestMethod;
 import org.springframework.web.bind.annotation.RestController;
 
+import javax.annotation.Resource;
 import java.io.IOException;
 import java.net.URLDecoder;
-import java.util.Objects;
 
 /**
  * <p>
- * 开放接口前端控制器
+ * 教研分析开放接口前端控制器
  * </p>
  *
  * @author wangliang
  * @since 2022-04-26
  */
-@Api(tags = "开放接口Controller")
+@Api(tags = "教研分析开放接口Controller")
 @RestController
 @RequestMapping(ApiConstant.DEFAULT_URI_PREFIX + "/${prefix.url.open}")
 @Validated
-@Aac(auth = BOOL.FALSE)
 public class OpenApiController {
     private final static Logger log = LoggerFactory.getLogger(OpenApiController.class);
 
-    @ApiOperation(value = "接收基础考务数据")
-    @ApiResponses({@ApiResponse(code = 200, message = "推送基础考务数据", response = Object.class)})
-    @RequestMapping(value = "/basic/examination/data", method = RequestMethod.POST)
-    public Result basicExaminationData(@ApiParam(value = "接收基础考务数据信息", required = true) @RequestBody String result) throws IOException, InterruptedException {
-        log.info("basicExaminationData进来了,result:{}", result);
+    @Resource
+    BasicSemesterService basicSemesterService;
+
+    @ApiOperation(value = "学期创建/更新接口")
+    @ApiResponses({@ApiResponse(code = 200, message = "学期创建/更新接口", response = Object.class)})
+    @RequestMapping(value = "/semester_edit", method = RequestMethod.POST)
+    @Aac(auth = BOOL.FALSE)
+    public Result semesterEdit(@ApiParam(value = "接收学期数据信息", required = true) @RequestBody String result) throws IOException, InterruptedException, IllegalAccessException {
+        log.info("semesterEdit进来了,result:{}", JacksonUtil.parseJson(result));
         String decodeJson = URLDecoder.decode(result, SystemConstant.CHARSET_NAME);
         log.info("decodeJson:{}", decodeJson);
-        if (Objects.nonNull(decodeJson)) {
-            JSONObject jsonObject = JSONObject.parseObject(decodeJson);
-            String callbackUrl = jsonObject.getString("callbackUrl");
-            String accessKey = jsonObject.getString("accessKey");
-            String accessSecret = jsonObject.getString("accessSecret");
-            if (Objects.nonNull(callbackUrl)) {
-                Double progress = 0D;
-                for (int i = 0; i < 11; i++) {
-                    progress += 10D;
-                    JSONObject dataObjectJson = new JSONObject();
-                    dataObjectJson.put("progress", progress);
-                    if (progress == 100D) {
-                        dataObjectJson.put("status", "FINISHED");
-                    } else {
-                        dataObjectJson.put("status", "RUNNING");
-                    }
-                    Long timestamp = System.currentTimeMillis();
-                    String accessToken = SignatureEntity.build(SignatureType.SECRET, SystemConstant.METHOD, callbackUrl, timestamp, accessKey, accessSecret);
-                    String callbackResult = HttpUtil.postJson("http://127.0.0.1:7001" + callbackUrl, dataObjectJson.toJSONString(), accessToken, timestamp);
-                    if (Objects.nonNull(callbackResult)) {
-                        log.info("callbackResult:{}", JacksonUtil.parseJson(callbackResult));
-                    }
-                    Thread.sleep(5000);
-                }
-            }
-        }
+        BasicSemesterParams basicSemesterParams = JacksonUtil.readJson(decodeJson, BasicSemesterParams.class);
+        BasicSchool basicSchool = AuthThirdUtil.hasPermission();
+        return ResultUtil.ok(basicSemesterService.saveBasicSemesterCommon(basicSemesterParams, basicSchool.getId(), null));
+    }
+
+    @ApiOperation(value = "考试创建/更新接口")
+    @ApiResponses({@ApiResponse(code = 200, message = "考试创建/更新接口", response = Object.class)})
+    @RequestMapping(value = "/exam_edit", method = RequestMethod.POST)
+    public Result examEdit(@ApiParam(value = "接收考试数据信息", required = true) @RequestBody String result) throws IOException, InterruptedException {
+        log.info("examEdit进来了,result:{}", result);
         return ResultUtil.ok(true);
     }
+
+    @ApiOperation(value = "分析课程(试卷)创建/更新接口")
+    @ApiResponses({@ApiResponse(code = 200, message = "分析课程(试卷)创建/更新接口", response = Object.class)})
+    @RequestMapping(value = "/course_edit", method = RequestMethod.POST)
+    public Result courseEdit(@ApiParam(value = "接收分析课程(试卷)数据信息", required = true) @RequestBody String result) throws IOException, InterruptedException {
+        log.info("courseEdit进来了,result:{}", result);
+        return ResultUtil.ok(true);
+    }
+
+//    @ApiOperation(value = "接收基础考务数据")
+//    @ApiResponses({@ApiResponse(code = 200, message = "推送基础考务数据", response = Object.class)})
+//    @RequestMapping(value = "/basic/examination/data", method = RequestMethod.POST)
+//    public Result basicExaminationData(@ApiParam(value = "接收基础考务数据信息", required = true) @RequestBody String result) throws IOException, InterruptedException {
+//        log.info("basicExaminationData进来了,result:{}", result);
+//        String decodeJson = URLDecoder.decode(result, SystemConstant.CHARSET_NAME);
+//        log.info("decodeJson:{}", decodeJson);
+//        if (Objects.nonNull(decodeJson)) {
+//            JSONObject jsonObject = JSONObject.parseObject(decodeJson);
+//            String callbackUrl = jsonObject.getString("callbackUrl");
+//            String accessKey = jsonObject.getString("accessKey");
+//            String accessSecret = jsonObject.getString("accessSecret");
+//            if (Objects.nonNull(callbackUrl)) {
+//                Double progress = 0D;
+//                for (int i = 0; i < 11; i++) {
+//                    progress += 10D;
+//                    JSONObject dataObjectJson = new JSONObject();
+//                    dataObjectJson.put("progress", progress);
+//                    if (progress == 100D) {
+//                        dataObjectJson.put("status", "FINISHED");
+//                    } else {
+//                        dataObjectJson.put("status", "RUNNING");
+//                    }
+//                    Long timestamp = System.currentTimeMillis();
+//                    String accessToken = SignatureEntity.build(SignatureType.SECRET, SystemConstant.METHOD, callbackUrl, timestamp, accessKey, accessSecret);
+//                    String callbackResult = HttpUtil.postJson("http://127.0.0.1:7001" + callbackUrl, dataObjectJson.toJSONString(), accessToken, timestamp);
+//                    if (Objects.nonNull(callbackResult)) {
+//                        log.info("callbackResult:{}", JacksonUtil.parseJson(callbackResult));
+//                    }
+//                    Thread.sleep(5000);
+//                }
+//            }
+//        }
+//        return ResultUtil.ok(true);
+//    }
 }

+ 4 - 4
teachcloud-report/src/main/resources/application-dev.properties

@@ -13,10 +13,10 @@ spring.application.name=teachcloud-report
 #db.host=192.168.10.136
 db.host=localhost
 db.port=3306
-db.name=teachcloud_report_v3.0.2
+db.name=teachcloud-report-v3.1.0
 #db.name=teachcloud-report
 db.username=root
-db.password=88888888
+db.password=123456789
 
 #redis\u6570\u636E\u6E90\u914D\u7F6E
 com.qmth.redis.host=${db.host}
@@ -141,6 +141,6 @@ yun.mark.studentScoreApi=/api/exam/student/score
 
 print.open.callbackUrlApi=/api/admin/print/notify/analysis/progress
 
-com.qmth.solar.access-key=274f823e5f59410f8b3bb6edcd8e2b6e
-com.qmth.solar.access-secret=y7AO6W0TOdTF8HpWBwGHbp3wfIHsmUKr
+#com.qmth.solar.access-key=274f823e5f59410f8b3bb6edcd8e2b6e
+#com.qmth.solar.access-secret=y7AO6W0TOdTF8HpWBwGHbp3wfIHsmUKr
 #com.qmth.solar.license=/Users/king/Downloads/tc-dev-wl.lic