“djh”
2024-11-27 3c8e94af36e9f83485414f14a0e136e19c7a5137
exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/serviceImpl/TripartiteInterfaceServiceImpl.java
@@ -69,36 +69,48 @@
    private ThCertService certService;
    @Override
    public boolean receiveQuestionBank(JSONObject jsonObject) throws Exception {
    public AjaxResult receiveQuestionBank(JSONObject jsonObject) throws Exception {
        InstitutionUser institutionUser = ThreeInContextHolder.getContext();
        ThQuestionBankReqDTO questionBankReqDTO =   decryptData(jsonObject, new TypeReference<ThQuestionBankReqDTO>() {},"题库数据");
        if(questionBankReqDTO==null){
        List<ThQuestionBankReqDTO> questionBankReqDTO =  decryptData(jsonObject, new TypeReference<List<ThQuestionBankReqDTO>>() {},"题库数据");
        if(CollectionUtils.isEmpty(questionBankReqDTO)){
            throw new BusinessException(this.getClass(),ResultConstants.THREE_INSTITUTION_PARAMM_NULL,"题库数据不可为空");
        }
        String valdateMessage=ValidatorUtils.validateFast(questionBankReqDTO);
        if(!StringUtils.isEmpty(valdateMessage)){
            throw new BusinessException(this.getClass(), ResultConstants.THREE_INSTITUTION_PARAMM_NULL,valdateMessage);
        List<ThErrorDataRespDTO> errorDataRespDTOS = new ArrayList<>();
        List<ThQuestionBankReqDTO> thQuestionBankReqDTOS = new ArrayList<>();
        for (ThQuestionBankReqDTO thQuestionBankReqDTO : questionBankReqDTO) {
            String valdateMessage=ValidatorUtils.validateFast(thQuestionBankReqDTO);
            if(!StringUtils.isEmpty(valdateMessage)){
//                throw new BusinessException(this.getClass(), ResultConstants.THREE_INSTITUTION_PARAMM_NULL,valdateMessage);
                errorDataRespDTOS.add(new ThErrorDataRespDTO(thQuestionBankReqDTO.getUuid(),valdateMessage));
                continue;
            }
            thQuestionBankReqDTOS.add(thQuestionBankReqDTO);
        }
        //根据uuid查询数据
        ThQuestionBank qb = questionBankService.getQuestionInfoByUuid(questionBankReqDTO.getUuid());
        boolean i = true;
        if(qb == null){
            //新增
            qb = new ThQuestionBank();
            BeanUtils.copyProperties(questionBankReqDTO, qb);
            qb.setUuid(questionBankReqDTO.getUuid());
            qb.setInstitutionId(institutionUser.getId());
            qb.setInstitutionName(institutionUser.getInstitutionalName());
            qb.setCreateBy(institutionUser.getInstitutionalName());
            qb.setUpdateBy(institutionUser.getInstitutionalName());
            i = questionBankService.save(qb);
        }else {
            //修改
            BeanUtils.copyProperties(questionBankReqDTO, qb);
            qb.setUpdateBy(institutionUser.getInstitutionalName());
            i = questionBankService.updateById(qb);
        List<ThQuestionBank> savethQuestionBanks = new ArrayList<>();
        List<ThQuestionBank> updatethQuestionBanks = new ArrayList<>();
        for (ThQuestionBankReqDTO thQuestionBankReqDTO : thQuestionBankReqDTOS) {
            //根据uuid查询数据
            ThQuestionBank qb = questionBankService.getQuestionInfoByUuid(thQuestionBankReqDTO.getUuid());
            if(qb == null){
                //新增
                qb = new ThQuestionBank();
                BeanUtils.copyProperties(thQuestionBankReqDTO, qb);
                qb.setUuid(thQuestionBankReqDTO.getUuid());
                qb.setInstitutionId(institutionUser.getId());
                qb.setInstitutionName(institutionUser.getInstitutionalName());
                qb.setCreateBy(institutionUser.getInstitutionalName());
                qb.setUpdateBy(institutionUser.getInstitutionalName());
                savethQuestionBanks.add(qb);
            }else {
                //修改
                BeanUtils.copyProperties(thQuestionBankReqDTO, qb);
                qb.setUpdateBy(institutionUser.getInstitutionalName());
                updatethQuestionBanks.add(qb);
            }
        }
        return i;
        questionBankService.saveBatch(savethQuestionBanks);
        questionBankService.updateBatchById(updatethQuestionBanks);
        return AjaxResult.success(errorDataRespDTOS);
    }
    @Transactional
@@ -544,7 +556,7 @@
        List<ThStudentBatch> updateThStudentBatchList = new ArrayList<>();
        for (ThStudentReqDTO studentReqDTO : saveStudentReqDTOList) {
            //学生表中过滤
            List<ThStudent> collect = students.stream().filter(s -> s.getIdcard().equals(studentReqDTO.getIdcard())).collect(Collectors.toList());
            List<ThStudent> collect = students.stream().filter(s -> s.getIdcard().equals(studentReqDTO.getIdcard()) && s.getInstitutionId().equals(institutionUser.getId()) ).collect(Collectors.toList());
            if(collect.size() > 0){
                ThStudent student = collect.get(0);
                //修改
@@ -1351,20 +1363,20 @@
                errorDataRespDTOS.add(new ThErrorDataRespDTO(studentDetailReqDTO.getUuid(),"结束位置不可为空"));
                continue;
            }
            if(StringUtils.isEmpty(studentDetailReqDTO.getLessonReportUrl())){
                errorDataRespDTOS.add(new ThErrorDataRespDTO(studentDetailReqDTO.getUuid(),"学时报告不可为空"));
                continue;
            }
//            if(StringUtils.isEmpty(studentDetailReqDTO.getLessonReportUrl())){
//                errorDataRespDTOS.add(new ThErrorDataRespDTO(studentDetailReqDTO.getUuid(),"学时报告不可为空"));
//                continue;
//            }
            //认证记录集合
//            if(CollectionUtils.isEmpty(studentDetailReqDTO.getAuthList())){
//                errorDataRespDTOS.add(new ThErrorDataRespDTO(studentDetailReqDTO.getUuid(),"认证记录集合不可为空"));
//                continue;
//            }
            //学习轨迹集合
            if(CollectionUtils.isEmpty(studentDetailReqDTO.getTrackList())){
                errorDataRespDTOS.add(new ThErrorDataRespDTO(studentDetailReqDTO.getUuid(),"学习轨迹集合不可为空"));
                continue;
            }
//            if(CollectionUtils.isEmpty(studentDetailReqDTO.getTrackList())){
//                errorDataRespDTOS.add(new ThErrorDataRespDTO(studentDetailReqDTO.getUuid(),"学习轨迹集合不可为空"));
//                continue;
//            }
            /*boolean authFlag = false;
            for(ThStudytAuthReqDTO item : studentDetailReqDTO.getAuthList()){
@@ -1397,32 +1409,32 @@
            if(authFlag){
                continue;
            }*/
            boolean trackFlag = false;
            for(ThStudyTrackReqDTO item : studentDetailReqDTO.getTrackList()){
                if(StringUtils.isEmpty(item.getUuid()) || !UUID.checkIsUuid(item.getUuid())){
                    trackFlag = true;
                    errorDataRespDTOS.add(new ThErrorDataRespDTO(studentDetailReqDTO.getUuid(),"学习轨迹uuid("+item.getUuid()+")不符合规范"));
                    break;
                }
                if(item.getStartTime() == null){
                    trackFlag = true;
                    errorDataRespDTOS.add(new ThErrorDataRespDTO(studentDetailReqDTO.getUuid(),"学习轨迹uuid("+item.getUuid()+"),轨迹开始时间不可为空"));
                    break;
                }
                if(item.getEndTime() == null){
                    trackFlag = true;
                    errorDataRespDTOS.add(new ThErrorDataRespDTO(studentDetailReqDTO.getUuid(),"学习轨迹uuid("+item.getUuid()+"),轨迹结束时间不可为空"));
                    break;
                }
                if(item.getTimeInterval() == null) {
                    trackFlag = true;
                    errorDataRespDTOS.add(new ThErrorDataRespDTO(studentDetailReqDTO.getUuid(),"学习轨迹uuid("+item.getUuid()+"),时间间隔(秒)不可为空"));
                    break;
                }
            }
            if(trackFlag){
                continue;
            }
//            boolean trackFlag = false;
//            for(ThStudyTrackReqDTO item : studentDetailReqDTO.getTrackList()){
//                if(StringUtils.isEmpty(item.getUuid()) || !UUID.checkIsUuid(item.getUuid())){
//                    trackFlag = true;
//                    errorDataRespDTOS.add(new ThErrorDataRespDTO(studentDetailReqDTO.getUuid(),"学习轨迹uuid("+item.getUuid()+")不符合规范"));
//                    break;
//                }
//                if(item.getStartTime() == null){
//                    trackFlag = true;
//                    errorDataRespDTOS.add(new ThErrorDataRespDTO(studentDetailReqDTO.getUuid(),"学习轨迹uuid("+item.getUuid()+"),轨迹开始时间不可为空"));
//                    break;
//                }
//                if(item.getEndTime() == null){
//                    trackFlag = true;
//                    errorDataRespDTOS.add(new ThErrorDataRespDTO(studentDetailReqDTO.getUuid(),"学习轨迹uuid("+item.getUuid()+"),轨迹结束时间不可为空"));
//                    break;
//                }
//                if(item.getTimeInterval() == null) {
//                    trackFlag = true;
//                    errorDataRespDTOS.add(new ThErrorDataRespDTO(studentDetailReqDTO.getUuid(),"学习轨迹uuid("+item.getUuid()+"),时间间隔(秒)不可为空"));
//                    break;
//                }
//            }
//            if(trackFlag){
//                continue;
//            }
            saveStudyDetailReqDTOS.add(studentDetailReqDTO);
            //判断需要修改的批次学生