教育训练处考试制证系统后端
heheng
2025-05-19 3a762add44449332d6d379e361698850f6066e16
exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/serviceImpl/ThStudyRecordManagerServiceImpl.java
@@ -19,6 +19,7 @@
import com.ruoyi.common.signature.AESUtils;
import com.ruoyi.system.domain.ThAccessAddress;
import com.ruoyi.system.service.ThAccessAddressService;
import lombok.extern.log4j.Log4j2;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils;
@@ -27,10 +28,12 @@
import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;
import java.time.Duration;
import java.util.*;
import java.util.stream.Collectors;
@Service("ThStudyRecordManagerService")
@Log4j2
public class ThStudyRecordManagerServiceImpl implements ThStudyRecordManagerService {
    private Logger logger = LoggerFactory.getLogger(ThStudyRecordManagerServiceImpl.class);
@@ -76,6 +79,10 @@
            List<String> idcards = thStudyDetailVOS.stream().map(ThStudyDetailVO::getIdcard).collect(Collectors.toList());
            List<ThStudent> studentList = studentService.getNameByIdcards(idcards);
            for(ThStudyDetailVO thStudyDetailVO : thStudyDetailVOS){
                //计算自然时间差
                Duration between = Duration.between(thStudyDetailVO.getStartTime(), thStudyDetailVO.getFinishTime());
                thStudyDetailVO.setDifference(between.getSeconds());
                thStudyDetailVO.setDifferenceDesc(ConvertTimeUtils.convertTimeToString(thStudyDetailVO.getDifference()));
                thStudyDetailVO.setDurationDesc(ConvertTimeUtils.convertTimeToString(thStudyDetailVO.getDuration()));
                thStudyDetailVO.setStartPositionDesc(ConvertTimeUtils.convertTimeToString(thStudyDetailVO.getStartPosition()));
                thStudyDetailVO.setFinishPositionDesc(ConvertTimeUtils.convertTimeToString(thStudyDetailVO.getFinishPosition()));
@@ -131,9 +138,11 @@
        Map<String,String> params = new HashMap<>();
        params.put("idcard",query.getIdcard());
        String json = HttpClientUtil.doGet(accessAddress.getUrl(), params);
        log.info("调用机构接口返回结果: "+json);
        ReturnVO<String> returnVo = JSONObject.parseObject(json, new TypeReference<ReturnVO<String>>() {});
        if(returnVo.getCode() == null || returnVo.getCode() != 200){
        log.info("获得第三方数据:"+returnVo);
        if(returnVo==null || returnVo.getCode() == null || returnVo.getCode() != 200){
            throw new ServiceException("获取三方数据数据异常");
        }
        ThPlatformStudentRespDTO thPlatformStudentRespDTO = null;
@@ -141,6 +150,7 @@
            String decrypt = "";
            try {
                decrypt = AESUtils.decrypt(returnVo.getData());
                log.info("解密后的数据为:"+decrypt);
            }catch (Exception e){
                throw new BusinessException(this.getClass(), ResultConstants.SYSTEM_ERROR,"解密异常");
            }