| | |
| | | @Override |
| | | public boolean receiveQuestionBank(JSONObject jsonObject) throws Exception { |
| | | InstitutionUser institutionUser = ThreeInContextHolder.getContext(); |
| | | ThQuestionBankReqDTO questionBankReqDTO = decryptData(jsonObject, new TypeReference<ThQuestionBankReqDTO>() {}); |
| | | ThQuestionBankReqDTO questionBankReqDTO = decryptData(jsonObject, new TypeReference<ThQuestionBankReqDTO>() {},"题库数据"); |
| | | if(questionBankReqDTO==null){ |
| | | throw new BusinessException(this.getClass(),ResultConstants.THREE_INSTITUTION_PARAMM_NULL,"题库数据不可为空"); |
| | | } |
| | |
| | | @Override |
| | | public AjaxResult receiveCourse(JSONObject jsonObject) { |
| | | InstitutionUser institutionUser = ThreeInContextHolder.getContext(); |
| | | |
| | | String data = jsonObject.getString("data"); |
| | | if(StringUtils.isEmpty(data)){ |
| | | throw new BusinessException(this.getClass(), ResultConstants.THREE_INSTITUTION_PARAMM_NULL); |
| | | } |
| | | //解密 |
| | | String decrypt = ""; |
| | | try { |
| | | decrypt = AESUtils.decrypt(data); |
| | | }catch (Exception e){ |
| | | throw new BusinessException(this.getClass(), ResultConstants.THREE_INSTITUTION_PARAMM_NULL); |
| | | } |
| | | List<ThCourseReqDTO> courseReqDTOList = new ArrayList<>(); |
| | | List<ThCourseReqDTO> courseReqDTOList = |
| | | decryptData(jsonObject, new TypeReference<List<ThCourseReqDTO>>() {},"课程"); |
| | | // List<ThCourseReqDTO> courseReqDTOList = new ArrayList<>(); |
| | | //反序列化 |
| | | try { |
| | | courseReqDTOList = JSONObject.parseObject(decrypt, new TypeReference<List<ThCourseReqDTO>>() {}); |
| | | |
| | | }catch (Exception e){ |
| | | logger.error("课程反序列化失败!"); |
| | | throw new BusinessException(this.getClass(), ResultConstants.SERIALIZE_ERROR); |
| | | |
| | | } |
| | | // try { |
| | | // courseReqDTOList = JSONObject.parseObject(decrypt, new TypeReference<List<ThCourseReqDTO>>() {}); |
| | | // |
| | | // }catch (Exception e){ |
| | | // logger.error("课程反序列化失败!"); |
| | | // throw new BusinessException(this.getClass(), ResultConstants.SERIALIZE_ERROR); |
| | | // |
| | | // } |
| | | |
| | | if(CollectionUtils.isEmpty(courseReqDTOList)){ |
| | | throw new BusinessException(this.getClass(), ResultConstants.THREE_INSTITUTION_PARAMM_ERROR,"数据推送不可以为空"); |
| | | } |
| | | //暂时不限制不能超过1000条 |
| | | //暂时限制不能超过1000条 |
| | | if (courseReqDTOList.size() > 1000){ |
| | | throw new BusinessException(this.getClass(), ResultConstants.THREE_INSTITUTION_PARAMM_ERROR,"数据推送数据量过大"); |
| | | } |
| | | List<String> reqAllCourseIds = new ArrayList<>(); |
| | | List<String> reqAllChapterIds = new ArrayList<>(); |
| | | List<ThErrorDataRespDTO> errorDataRespDTOS = new ArrayList<>(); |
| | |
| | | public AjaxResult receiveStudent(JSONObject jsonObject) { |
| | | InstitutionUser institutionUser = ThreeInContextHolder.getContext(); |
| | | |
| | | String data = jsonObject.getString("data"); |
| | | if(StringUtils.isEmpty(data)){ |
| | | throw new BusinessException(this.getClass(), ResultConstants.THREE_INSTITUTION_PARAMM_NULL); |
| | | } |
| | | //解密 |
| | | String decrypt = ""; |
| | | try { |
| | | decrypt = AESUtils.decrypt(data); |
| | | }catch (Exception e){ |
| | | throw new BusinessException(this.getClass(), ResultConstants.THREE_INSTITUTION_PARAMM_NULL); |
| | | } |
| | | List<ThStudentReqDTO> studentReqDTOs = |
| | | decryptData(jsonObject, new TypeReference<List<ThStudentReqDTO>>() {},"学员"); |
| | | |
| | | //反序列化 |
| | | List<ThStudentReqDTO> studentReqDTOs = new ArrayList<>(); |
| | | try { |
| | | studentReqDTOs = JSONObject.parseObject(decrypt, new TypeReference<List<ThStudentReqDTO>>() {}); |
| | | }catch (Exception e){ |
| | | logger.error("学员序列化失败!"); |
| | | throw new BusinessException(this.getClass(), ResultConstants.SERIALIZE_ERROR); |
| | | } |
| | | // List<ThStudentReqDTO> studentReqDTOs = new ArrayList<>(); |
| | | // try { |
| | | // studentReqDTOs = JSONObject.parseObject(decrypt, new TypeReference<List<ThStudentReqDTO>>() {}); |
| | | // }catch (Exception e){ |
| | | // logger.error("学员序列化失败!"); |
| | | // throw new BusinessException(this.getClass(), ResultConstants.SERIALIZE_ERROR); |
| | | // } |
| | | //参数校验 |
| | | if(CollectionUtils.isEmpty(studentReqDTOs)){ |
| | | throw new BusinessException(this.getClass(), ResultConstants.THREE_INSTITUTION_PARAMM_NULL,"学生信息不可为空"); |
| | | } |
| | | //限制数据量不超过1000条 |
| | | if (studentReqDTOs.size() > 1000){ |
| | | throw new BusinessException(this.getClass(), ResultConstants.THREE_INSTITUTION_PARAMM_ERROR,"数据推送数据量过大"); |
| | | } |
| | | |
| | | List<String> idcardList = new ArrayList<>(); |
| | |
| | | public AjaxResult receiveBatch(JSONObject jsonObject) { |
| | | InstitutionUser institutionUser = ThreeInContextHolder.getContext(); |
| | | |
| | | String data = jsonObject.getString("data"); |
| | | if(StringUtils.isEmpty(data)){ |
| | | throw new BusinessException(this.getClass(), ResultConstants.THREE_INSTITUTION_PARAMM_NULL); |
| | | } |
| | | //解密 |
| | | String decrypt = ""; |
| | | try { |
| | | decrypt = AESUtils.decrypt(data); |
| | | }catch (Exception e){ |
| | | throw new BusinessException(this.getClass(), ResultConstants.THREE_INSTITUTION_PARAMM_NULL); |
| | | } |
| | | List<ThBatchReqDTO> batchReqDTOList = decryptData(jsonObject, new TypeReference<List<ThBatchReqDTO>>() {},"班级"); |
| | | //反序列化 |
| | | List<ThBatchReqDTO> batchReqDTOList = new ArrayList<>(); |
| | | try { |
| | | batchReqDTOList = JSONObject.parseObject(decrypt, new TypeReference<List<ThBatchReqDTO>>() {}); |
| | | |
| | | }catch (Exception e){ |
| | | logger.error("班级序列化失败!"); |
| | | throw new BusinessException(this.getClass(), ResultConstants.SERIALIZE_ERROR); |
| | | |
| | | } |
| | | // List<ThBatchReqDTO> batchReqDTOList = new ArrayList<>(); |
| | | // try { |
| | | // batchReqDTOList = JSONObject.parseObject(decrypt, new TypeReference<List<ThBatchReqDTO>>() {}); |
| | | // |
| | | // }catch (Exception e){ |
| | | // logger.error("班级序列化失败!"); |
| | | // throw new BusinessException(this.getClass(), ResultConstants.SERIALIZE_ERROR); |
| | | // |
| | | // } |
| | | if(CollectionUtils.isEmpty(batchReqDTOList)){ |
| | | throw new BusinessException(this.getClass(), ResultConstants.THREE_INSTITUTION_PARAMM_NULL,"批次(班级)集合不可为空"); |
| | | } |
| | | //限制数据量不超过1000条 |
| | | if (batchReqDTOList.size() > 1000){ |
| | | throw new BusinessException(this.getClass(), ResultConstants.THREE_INSTITUTION_PARAMM_ERROR,"数据推送数据量过大"); |
| | | } |
| | | //过滤出本次请求所有班级课程章节 |
| | | List<String> reqAllBatchUuids = new ArrayList<>(); |
| | |
| | | public AjaxResult receiveStudyDetail(JSONObject jsonObject) { |
| | | InstitutionUser institutionUser = ThreeInContextHolder.getContext(); |
| | | |
| | | String data = jsonObject.getString("data"); |
| | | if(StringUtils.isEmpty(data)){ |
| | | throw new BusinessException(this.getClass(), ResultConstants.THREE_INSTITUTION_PARAMM_NULL); |
| | | } |
| | | //解密 |
| | | String decrypt = ""; |
| | | try { |
| | | decrypt = AESUtils.decrypt(data); |
| | | }catch (Exception e){ |
| | | throw new BusinessException(this.getClass(), ResultConstants.THREE_INSTITUTION_PARAMM_NULL); |
| | | } |
| | | List<ThStudyDetailReqDTO> thStudyDetailReqDTOS = decryptData(jsonObject, new TypeReference<List<ThStudyDetailReqDTO>>() {},"学习记录"); |
| | | //反序列化 |
| | | List<ThStudyDetailReqDTO> thStudyDetailReqDTOS = new ArrayList<>(); |
| | | try { |
| | | thStudyDetailReqDTOS = JSONObject.parseObject(decrypt, new TypeReference<List<ThStudyDetailReqDTO>>() {}); |
| | | }catch (Exception e){ |
| | | logger.error("学习记录序列化失败!"); |
| | | throw new BusinessException(this.getClass(), ResultConstants.SERIALIZE_ERROR); |
| | | } |
| | | // List<ThStudyDetailReqDTO> thStudyDetailReqDTOS = new ArrayList<>(); |
| | | // try { |
| | | // thStudyDetailReqDTOS = JSONObject.parseObject(decrypt, new TypeReference<List<ThStudyDetailReqDTO>>() {}); |
| | | // }catch (Exception e){ |
| | | // logger.error("学习记录序列化失败!"); |
| | | // throw new BusinessException(this.getClass(), ResultConstants.SERIALIZE_ERROR); |
| | | // } |
| | | //参数校验 |
| | | if(CollectionUtils.isEmpty(thStudyDetailReqDTOS)){ |
| | | throw new BusinessException(this.getClass(), ResultConstants.THREE_INSTITUTION_PARAMM_NULL,"学习记录清单不可为空"); |
| | | } |
| | | //限制数据量不超过1000条 |
| | | if (thStudyDetailReqDTOS.size() > 1000){ |
| | | throw new BusinessException(this.getClass(), ResultConstants.THREE_INSTITUTION_PARAMM_ERROR,"数据推送数据量过大"); |
| | | } |
| | | //获取班级学生以及章节 |
| | | List<String> chapterUuids = new ArrayList<>(); |
| | |
| | | public AjaxResult receiveExamRecord(JSONObject jsonObject) { |
| | | InstitutionUser institutionUser = ThreeInContextHolder.getContext(); |
| | | |
| | | String data = jsonObject.getString("data"); |
| | | if(StringUtils.isEmpty(data)){ |
| | | throw new BusinessException(this.getClass(), ResultConstants.THREE_INSTITUTION_PARAMM_NULL); |
| | | } |
| | | //解密 |
| | | String decrypt = ""; |
| | | try { |
| | | decrypt = AESUtils.decrypt(data); |
| | | }catch (Exception e){ |
| | | throw new BusinessException(this.getClass(), ResultConstants.THREE_INSTITUTION_PARAMM_NULL); |
| | | } |
| | | List<ThExamRecordReqDTO> examRecordReqDTOS = decryptData(jsonObject, new TypeReference<List<ThExamRecordReqDTO>>() {},"考试记录"); |
| | | //反序列化 |
| | | List<ThExamRecordReqDTO> examRecordReqDTOS = new ArrayList<>(); |
| | | try { |
| | | examRecordReqDTOS = JSONObject.parseObject(decrypt, new TypeReference<List<ThExamRecordReqDTO>>() {}); |
| | | }catch (Exception e){ |
| | | logger.error("考试记录序列化失败!"); |
| | | throw new BusinessException(this.getClass(), ResultConstants.SERIALIZE_ERROR); |
| | | } |
| | | // List<ThExamRecordReqDTO> examRecordReqDTOS = new ArrayList<>(); |
| | | // try { |
| | | // examRecordReqDTOS = JSONObject.parseObject(decrypt, new TypeReference<List<ThExamRecordReqDTO>>() {}); |
| | | // }catch (Exception e){ |
| | | // logger.error("考试记录序列化失败!"); |
| | | // throw new BusinessException(this.getClass(), ResultConstants.SERIALIZE_ERROR); |
| | | // } |
| | | if (CollectionUtils.isEmpty(examRecordReqDTOS)) { |
| | | throw new BusinessException(this.getClass(), ResultConstants.THREE_INSTITUTION_PARAMM_NULL,"考试记录不可为空"); |
| | | } |
| | | //限制数据量不超过1000条 |
| | | if (examRecordReqDTOS.size() > 1000){ |
| | | throw new BusinessException(this.getClass(), ResultConstants.THREE_INSTITUTION_PARAMM_ERROR,"数据推送数据量过大"); |
| | | } |
| | | List<String> idcards = new ArrayList<>(); |
| | | //List<String> batchUuids = new ArrayList<>(); |
| | |
| | | public AjaxResult receiveCourseDelete(JSONObject jsonObject) { |
| | | InstitutionUser institutionUser = ThreeInContextHolder.getContext(); |
| | | |
| | | String data = jsonObject.getString("data"); |
| | | if(StringUtils.isEmpty(data)){ |
| | | throw new BusinessException(this.getClass(), ResultConstants.THREE_INSTITUTION_PARAMM_NULL); |
| | | } |
| | | //解密 |
| | | String decrypt = ""; |
| | | try { |
| | | decrypt = AESUtils.decrypt(data); |
| | | }catch (Exception e){ |
| | | throw new BusinessException(this.getClass(), ResultConstants.THREE_INSTITUTION_PARAMM_NULL); |
| | | } |
| | | ThCourseDeleteReqDTO thCourseDeleteReqDTO = decryptData(jsonObject, new TypeReference<ThCourseDeleteReqDTO>() {},"课程删除"); |
| | | //反序列化 |
| | | |
| | | ThCourseDeleteReqDTO thCourseDeleteReqDTO = null; |
| | | try { |
| | | thCourseDeleteReqDTO = JSONObject.parseObject(decrypt, new TypeReference<ThCourseDeleteReqDTO>() {}); |
| | | |
| | | }catch (Exception e){ |
| | | logger.error("课程删除反序列化失败!"); |
| | | throw new BusinessException(this.getClass(), ResultConstants.SERIALIZE_ERROR); |
| | | |
| | | } |
| | | // ThCourseDeleteReqDTO thCourseDeleteReqDTO = null; |
| | | // try { |
| | | // thCourseDeleteReqDTO = JSONObject.parseObject(decrypt, new TypeReference<ThCourseDeleteReqDTO>() {}); |
| | | // |
| | | // }catch (Exception e){ |
| | | // logger.error("课程删除反序列化失败!"); |
| | | // throw new BusinessException(this.getClass(), ResultConstants.SERIALIZE_ERROR); |
| | | // |
| | | // } |
| | | if(thCourseDeleteReqDTO == null){ |
| | | throw new BusinessException(ResultConstants.THREE_INSTITUTION_PARAMM_NULL); |
| | | } |
| | |
| | | public AjaxResult receiveBatchOpen(JSONObject jsonObject) { |
| | | InstitutionUser institutionUser = ThreeInContextHolder.getContext(); |
| | | |
| | | String data = jsonObject.getString("data"); |
| | | if(StringUtils.isEmpty(data)){ |
| | | throw new BusinessException(this.getClass(), ResultConstants.THREE_INSTITUTION_PARAMM_NULL); |
| | | } |
| | | //解密 |
| | | String decrypt = ""; |
| | | try { |
| | | decrypt = AESUtils.decrypt(data); |
| | | }catch (Exception e){ |
| | | throw new BusinessException(this.getClass(), ResultConstants.THREE_INSTITUTION_PARAMM_NULL); |
| | | } |
| | | ThBatchOpenReqDTO thBatchOpenReqDTO = decryptData(jsonObject, new TypeReference<ThBatchOpenReqDTO>() {},"班级开始"); |
| | | //反序列化 |
| | | ThBatchOpenReqDTO thBatchOpenReqDTO = null; |
| | | try { |
| | | thBatchOpenReqDTO = JSONObject.parseObject(decrypt, new TypeReference<ThBatchOpenReqDTO>() {}); |
| | | }catch (Exception e){ |
| | | logger.error("班级开始反序列化失败!"); |
| | | throw new BusinessException(this.getClass(), ResultConstants.SERIALIZE_ERROR); |
| | | } |
| | | // ThBatchOpenReqDTO thBatchOpenReqDTO = null; |
| | | // try { |
| | | // thBatchOpenReqDTO = JSONObject.parseObject(decrypt, new TypeReference<ThBatchOpenReqDTO>() {}); |
| | | // }catch (Exception e){ |
| | | // logger.error("班级开始反序列化失败!"); |
| | | // throw new BusinessException(this.getClass(), ResultConstants.SERIALIZE_ERROR); |
| | | // } |
| | | if(thBatchOpenReqDTO == null){ |
| | | throw new BusinessException(this.getClass(),ResultConstants.THREE_INSTITUTION_PARAMM_NULL,"批次(班级)不可为空"); |
| | | } |
| | |
| | | @Override |
| | | public AjaxResult receiveBatchEnd(JSONObject jsonObject) { |
| | | InstitutionUser institutionUser = ThreeInContextHolder.getContext(); |
| | | ThBatchEndReqDTO thBatchEndReqDTO = decryptData(jsonObject, new TypeReference<ThBatchEndReqDTO>() {}); |
| | | ThBatchEndReqDTO thBatchEndReqDTO = decryptData(jsonObject, new TypeReference<ThBatchEndReqDTO>() {},"批次(班级)"); |
| | | if(thBatchEndReqDTO == null){ |
| | | throw new BusinessException(this.getClass(),ResultConstants.THREE_INSTITUTION_PARAMM_NULL,"批次(班级)不可为空"); |
| | | } |
| | |
| | | @Override |
| | | public AjaxResult receiveCerts(JSONObject jsonObject) throws Exception { |
| | | InstitutionUser institutionUser = ThreeInContextHolder.getContext(); |
| | | List<ThCertReqDTO> thCertReqDTOs = decryptData(jsonObject, new TypeReference<List<ThCertReqDTO>>() {}); |
| | | List<ThCertReqDTO> thCertReqDTOs = decryptData(jsonObject, new TypeReference<List<ThCertReqDTO>>() {},"学时证书"); |
| | | if(thCertReqDTOs.isEmpty() ||thCertReqDTOs.size()>50){ |
| | | throw new BusinessException(this.getClass(), ResultConstants.RECORD_OVER_MAX); |
| | | } |
| | |
| | | * @return |
| | | * @param <T> |
| | | */ |
| | | private <T> T decryptData(JSONObject jsonObject,TypeReference<T> typeReference){ |
| | | private <T> T decryptData(JSONObject jsonObject,TypeReference<T> typeReference,String type){ |
| | | String data = jsonObject.getString("data"); |
| | | if(StringUtils.isEmpty(data)){ |
| | | throw new BusinessException(this.getClass(), ResultConstants.THREE_INSTITUTION_PARAMM_NULL); |
| | |
| | | try { |
| | | return JSONObject.parseObject(decrypt,typeReference); |
| | | }catch (Exception e){ |
| | | logger.error("学时证书反序列化失败!"); |
| | | logger.error("{}反序列化失败!",type); |
| | | throw new BusinessException(this.getClass(), ResultConstants.SERIALIZE_ERROR); |
| | | } |
| | | } |