|
@@ -60,6 +60,35 @@ public class CloudMarkingTaskUtils {
|
|
@Resource
|
|
@Resource
|
|
private DictionaryConfig dictionaryConfig;
|
|
private DictionaryConfig dictionaryConfig;
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * 考试创建/更新接口
|
|
|
|
+ *
|
|
|
|
+ * @param code 唯一标识
|
|
|
|
+ * @param name 考试名称
|
|
|
|
+ * @param examTime 考试时间
|
|
|
|
+ * @return 考试ID
|
|
|
|
+ */
|
|
|
|
+ public Long syncSchool(Long schoolId, String code, String name, String examTime) {
|
|
|
|
+ SysConfig sysConfig = commonCacheService.addSysConfigCache(schoolId, SystemConstant.CLOUDMARK_HOST_URL);
|
|
|
|
+ Optional.ofNullable(sysConfig).orElseThrow(() -> ExceptionResultEnum.ERROR.exception("未配置云阅卷地址"));
|
|
|
|
+ String hostUrl = sysConfig.getConfigValue();
|
|
|
|
+ String examSaveUrl = SystemConstant.CLOUD_MARK_SCHOOL_SAVE_API;
|
|
|
|
+ validUrl(hostUrl, examSaveUrl);
|
|
|
|
+ String postUrl = hostUrl.concat(examSaveUrl);
|
|
|
|
+ //参数
|
|
|
|
+ Map<String, Object> map = new HashMap<>();
|
|
|
|
+ map.put("code", validParam(code, null, true, "唯一标识"));
|
|
|
|
+ map.put("name", validParam(name, null, true, "显示名称"));
|
|
|
|
+
|
|
|
|
+ String result = HttpKit.sendPost(postUrl, getHeaders(schoolId, examSaveUrl), map, null, null, null);
|
|
|
|
+ JSONObject jsonObject = JSONObject.parseObject(result);
|
|
|
|
+ if (jsonObject.containsKey("id")) {
|
|
|
|
+ return Long.valueOf(jsonObject.get("id").toString());
|
|
|
|
+ } else {
|
|
|
|
+ throw ExceptionResultEnum.ERROR.exception("学校(机构)同步失败");
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* 考试创建/更新接口
|
|
* 考试创建/更新接口
|
|
*
|
|
*
|