|
|
@@ -1,9 +1,11 @@
|
|
|
package com.zhongzheng.modules.grade.service.impl;
|
|
|
|
|
|
import cn.hutool.core.bean.BeanUtil;
|
|
|
+import cn.hutool.core.convert.Convert;
|
|
|
import cn.hutool.core.lang.Validator;
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
|
|
|
@@ -12,26 +14,42 @@ import com.zhongzheng.common.core.redis.RedisCache;
|
|
|
import com.zhongzheng.common.exception.CustomException;
|
|
|
import com.zhongzheng.common.utils.DateUtils;
|
|
|
import com.zhongzheng.common.utils.SecurityUtils;
|
|
|
+import com.zhongzheng.common.utils.ToolsUtils;
|
|
|
+import com.zhongzheng.common.utils.http.HttpUtils;
|
|
|
import com.zhongzheng.modules.base.service.ICertificateTpService;
|
|
|
+import com.zhongzheng.modules.course.bo.CourseMenuQueryBo;
|
|
|
import com.zhongzheng.modules.course.domain.CourseBusiness;
|
|
|
import com.zhongzheng.modules.course.service.ICourseBusinessService;
|
|
|
+import com.zhongzheng.modules.course.service.ICourseChapterSectionService;
|
|
|
+import com.zhongzheng.modules.course.service.ICourseMenuService;
|
|
|
+import com.zhongzheng.modules.course.service.ICourseModuleChapterService;
|
|
|
+import com.zhongzheng.modules.course.vo.CourseMenuVo;
|
|
|
+import com.zhongzheng.modules.course.vo.CourseModuleChapterVo;
|
|
|
+import com.zhongzheng.modules.course.vo.CourseVo;
|
|
|
+import com.zhongzheng.modules.goods.bo.GoodsCourseQueryBo;
|
|
|
import com.zhongzheng.modules.goods.domain.Goods;
|
|
|
+import com.zhongzheng.modules.goods.service.IGoodsCourseService;
|
|
|
import com.zhongzheng.modules.goods.service.IGoodsService;
|
|
|
import com.zhongzheng.modules.goods.vo.GoodsVo;
|
|
|
import com.zhongzheng.modules.grade.bo.ClassGradeUserQueryBo;
|
|
|
+import com.zhongzheng.modules.grade.domain.ClassGrade;
|
|
|
import com.zhongzheng.modules.grade.domain.ClassGradeUser;
|
|
|
import com.zhongzheng.modules.grade.domain.UserPeriodStatus;
|
|
|
import com.zhongzheng.modules.grade.mapper.ClassGradeUserMapper;
|
|
|
+import com.zhongzheng.modules.grade.service.IClassGradeService;
|
|
|
import com.zhongzheng.modules.grade.service.IClassGradeUserService;
|
|
|
import com.zhongzheng.modules.grade.service.IUserPeriodStatusService;
|
|
|
-import com.zhongzheng.modules.grade.vo.ClassPeriodStudentVo;
|
|
|
-import com.zhongzheng.modules.grade.vo.UserPeriodStatusVo;
|
|
|
+import com.zhongzheng.modules.grade.vo.*;
|
|
|
import com.zhongzheng.modules.inform.bo.InformUserAddBo;
|
|
|
import com.zhongzheng.modules.inform.service.IInformRemindService;
|
|
|
import com.zhongzheng.modules.inform.service.IInformUserService;
|
|
|
import com.zhongzheng.modules.inform.vo.InformRemindVo;
|
|
|
+import com.zhongzheng.modules.order.domain.OrderGoods;
|
|
|
+import com.zhongzheng.modules.order.service.IOrderGoodsService;
|
|
|
import com.zhongzheng.modules.user.domain.User;
|
|
|
+import com.zhongzheng.modules.user.domain.UserStudyRecordPhoto;
|
|
|
import com.zhongzheng.modules.user.service.IUserService;
|
|
|
+import com.zhongzheng.modules.user.service.IUserStudyRecordPhotoService;
|
|
|
import com.zhongzheng.modules.user.vo.UserVo;
|
|
|
import com.zhongzheng.modules.wx.service.IWxLoginService;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
@@ -46,10 +64,10 @@ import com.zhongzheng.modules.grade.bo.UserPeriodQueryBo;
|
|
|
import com.zhongzheng.modules.grade.bo.UserPeriodEditBo;
|
|
|
import com.zhongzheng.modules.grade.domain.UserPeriod;
|
|
|
import com.zhongzheng.modules.grade.mapper.UserPeriodMapper;
|
|
|
-import com.zhongzheng.modules.grade.vo.UserPeriodVo;
|
|
|
import com.zhongzheng.modules.grade.service.IUserPeriodService;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
+import java.io.IOException;
|
|
|
import java.util.*;
|
|
|
import java.util.concurrent.TimeUnit;
|
|
|
import java.util.stream.Collectors;
|
|
|
@@ -111,6 +129,29 @@ public class UserPeriodServiceImpl extends ServiceImpl<UserPeriodMapper, UserPer
|
|
|
@Autowired
|
|
|
private ICourseBusinessService iCourseBusinessService;
|
|
|
|
|
|
+ @Value("${aliyun.oss.endpoint}")
|
|
|
+ private String ossHost;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private IOrderGoodsService iOrderGoodsService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private IClassGradeService iClassGradeService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private IGoodsCourseService iGoodsCourseService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private ICourseMenuService iCourseMenuService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private ICourseModuleChapterService iCourseModuleChapterService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private IUserStudyRecordPhotoService userStudyRecordPhotoService;
|
|
|
+
|
|
|
+ @Value("${oldStudySys.syncPath}")
|
|
|
+ private String SYNC_PATH;
|
|
|
|
|
|
@Override
|
|
|
public UserPeriodVo queryById(Long id) {
|
|
|
@@ -392,9 +433,131 @@ public class UserPeriodServiceImpl extends ServiceImpl<UserPeriodMapper, UserPer
|
|
|
bo.setStatus(1);
|
|
|
sendPeriodSMS(bo);
|
|
|
sendPeriodSevenSMS(bo);
|
|
|
+ syncStudyLogToOld(bo);
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public SyncUserCourseStudyRec syncStudyLogToOld(UserPeriodEditBo bo) {
|
|
|
+ UserVo userVo = iUserService.queryById(bo.getUserId());
|
|
|
+ ClassGradeUser gradeUser = iClassGradeUserService.getOne(new LambdaQueryWrapper<ClassGradeUser>().eq(ClassGradeUser::getUserId,bo.getUserId()).eq(ClassGradeUser::getGradeId,bo.getGradeId()).last("limit 1"));
|
|
|
+ OrderGoods orderGoods = iOrderGoodsService.getOne(new LambdaQueryWrapper<OrderGoods>().eq(OrderGoods::getOrderGoodsId,gradeUser.getOrderGoodsId()).last("limit 1"));
|
|
|
+ ClassGrade classGrade = iClassGradeService.getOne(new LambdaQueryWrapper<ClassGrade>().eq(ClassGrade::getGradeId,gradeUser.getGradeId()).last("limit 1"));
|
|
|
+ SyncUserCourseStudyRec studyRec = new SyncUserCourseStudyRec();
|
|
|
+ studyRec.setName(userVo.getRealname());
|
|
|
+ studyRec.setIdNum(userVo.getIdCard());
|
|
|
+ studyRec.setMobile(userVo.getTelphone());
|
|
|
+ studyRec.setGender(userVo.getSex()==1?"男":"女");
|
|
|
+ studyRec.setRecentPhotoSrc(Validator.isNotEmpty(userVo.getOneInchPhotos())?ossHost+"/"+userVo.getOneInchPhotos():"");
|
|
|
+ studyRec.setIdcardPhotoSrc(Validator.isNotEmpty(userVo.getIdCardImg1())?ossHost+"/"+userVo.getIdCardImg1():"");
|
|
|
+ studyRec.setIdcardPhotoSrc2(Validator.isNotEmpty(userVo.getIdCardImg2())?ossHost+"/"+userVo.getIdCardImg2():"");
|
|
|
+ studyRec.setCourseId(bo.getGoodsId());
|
|
|
+ studyRec.setCourseBuyTime(DateUtils.timestampToDateFormat(orderGoods.getCreateTime(),DateUtils.YYYY_MM_DD_HH_MM_SS));
|
|
|
+ studyRec.setClassNo(classGrade.getOfficialName());
|
|
|
+ GoodsVo goodsVo = iGoodsService.queryById(bo.getGoodsId());
|
|
|
+ List<SyncUserChapterList> ChapterList = new ArrayList<>();
|
|
|
+ GoodsCourseQueryBo goodsCourseQueryBo = new GoodsCourseQueryBo();
|
|
|
+ goodsCourseQueryBo.setGoodsId(goodsVo.getGoodsId());
|
|
|
+ List<CourseVo> courseVoList = iGoodsCourseService.selectList(goodsCourseQueryBo);
|
|
|
+ for(CourseVo courseVo : courseVoList){
|
|
|
+ CourseMenuQueryBo menuQueryBo = new CourseMenuQueryBo();
|
|
|
+ menuQueryBo.setCourseId(courseVo.getCourseId());
|
|
|
+ List<CourseMenuVo> courseMenuVoList = iCourseMenuService.selectList(menuQueryBo);
|
|
|
+ courseMenuVoList.forEach(courseMenuVo -> {
|
|
|
+ if(courseMenuVo.getType()==1){
|
|
|
+ //获取章信息
|
|
|
+ List<CourseModuleChapterVo> courseModuleChapterVoList = iCourseModuleChapterService.getListById(courseMenuVo.getMenuId());
|
|
|
+ courseModuleChapterVoList.forEach(courseModuleChapterVo -> {
|
|
|
+ SyncUserChapterList syncUserChapterItem = new SyncUserChapterList();
|
|
|
+ syncUserChapterItem.setChapterId(courseModuleChapterVo.getChapterId());
|
|
|
+ syncUserChapterItem.setChapterName(courseModuleChapterVo.getName());
|
|
|
+
|
|
|
+ UserPeriodQueryBo userPeriodQueryBo = new UserPeriodQueryBo();
|
|
|
+ userPeriodQueryBo.setCourseId(courseVo.getCourseId());
|
|
|
+ userPeriodQueryBo.setGoodsId(bo.getGoodsId());
|
|
|
+ userPeriodQueryBo.setUserId(bo.getUserId());
|
|
|
+ userPeriodQueryBo.setChapterId(courseModuleChapterVo.getChapterId());
|
|
|
+ userPeriodQueryBo.setModuleId(courseMenuVo.getMenuId());
|
|
|
+ userPeriodQueryBo.setGradeId(bo.getGradeId());
|
|
|
+ userPeriodQueryBo.setType(2);
|
|
|
+ List<UserPeriodStatusVo> userPeriodStatusVos = userPeriodStatusService.selectPeriodStatus(userPeriodQueryBo);
|
|
|
+ if (!CollectionUtils.isEmpty(userPeriodStatusVos)&&userPeriodStatusVos.size()>0) {
|
|
|
+ int numIndex = userPeriodStatusVos.size() - 1;
|
|
|
+ UserPeriodStatusVo userPeriodStatusVo = userPeriodStatusVos.get(numIndex);
|
|
|
+ LambdaQueryWrapper<UserStudyRecordPhoto> lqw = Wrappers.lambdaQuery();
|
|
|
+ lqw.eq(UserStudyRecordPhoto::getPeriodId, userPeriodStatusVo.getId());
|
|
|
+ List<UserStudyRecordPhoto> examPhoto = userStudyRecordPhotoService.list(lqw);
|
|
|
+ if(Validator.isNotEmpty(examPhoto)&&examPhoto.size()>0){
|
|
|
+ UserStudyRecordPhoto photo = examPhoto.get(0);
|
|
|
+ syncUserChapterItem.setImageSrc(ossHost+"/"+photo.getPhoto());
|
|
|
+ syncUserChapterItem.setImageTime(DateUtils.timestampToDateFormat(photo.getCreateTime(),DateUtils.YYYY_MM_DD_HH_MM_SS));
|
|
|
+ syncUserChapterItem.setMatchData(Validator.isNotEmpty(photo.getSimilarity())?photo.getSimilarity().toString():null);
|
|
|
+ syncUserChapterItem.setExamTime(DateUtils.timestampToDateFormat(userPeriodStatusVo.getRecordStartTime(),DateUtils.YYYY_MM_DD_HH_MM_SS));
|
|
|
+ syncUserChapterItem.setExamScore(userPeriodStatusVo.getPerformance().toString());
|
|
|
+ syncUserChapterItem.setStudyIP(userPeriodStatusVo.getIp());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ List<ClassPeriodSectionVo> classPeriodSectionVos = classGradeUserMapper.listPeriodSection(courseModuleChapterVo.getChapterId(), bo.getGoodsId(), courseVo.getCourseId(), bo.getUserId());
|
|
|
+ Collections.sort(classPeriodSectionVos);
|
|
|
+ List<SyncUserStudyRec> RecList = new ArrayList<>();
|
|
|
+ for (ClassPeriodSectionVo classPeriodSectionVo : classPeriodSectionVos) {
|
|
|
+ SyncUserStudyRec syncUserStudyRec = new SyncUserStudyRec();
|
|
|
+ syncUserStudyRec.setVideoId(classPeriodSectionVo.getId());
|
|
|
+ syncUserStudyRec.setVideoKey(classPeriodSectionVo.getRecordingUrl());
|
|
|
+
|
|
|
+ UserPeriodQueryBo userPeriodQueryBo2 = new UserPeriodQueryBo();
|
|
|
+ userPeriodQueryBo2.setSectionId(classPeriodSectionVo.getId());
|
|
|
+ userPeriodQueryBo2.setCourseId(courseVo.getCourseId());
|
|
|
+ userPeriodQueryBo2.setGoodsId(bo.getGoodsId());
|
|
|
+ userPeriodQueryBo2.setUserId(bo.getUserId());
|
|
|
+ userPeriodQueryBo2.setChapterId(courseModuleChapterVo.getChapterId());
|
|
|
+ userPeriodQueryBo2.setModuleId(0L);
|
|
|
+ userPeriodQueryBo2.setGradeId(bo.getGradeId());
|
|
|
+ List<UserPeriodStatusVo> userPeriodStatusVos2 = userPeriodStatusService.selectPeriodStatus(userPeriodQueryBo2);
|
|
|
+ if (!CollectionUtils.isEmpty(userPeriodStatusVos2)) {
|
|
|
+ int numIndex2 = userPeriodStatusVos2.size() - 1;
|
|
|
+ UserPeriodStatusVo userPeriodStatusVo = userPeriodStatusVos2.get(numIndex2);
|
|
|
+ LambdaQueryWrapper<UserStudyRecordPhoto> lqw = Wrappers.lambdaQuery();
|
|
|
+ lqw.eq(UserStudyRecordPhoto::getPeriodId, userPeriodStatusVo.getId());
|
|
|
+ List<UserStudyRecordPhoto> videoPhoto2 = userStudyRecordPhotoService.list(lqw);
|
|
|
+ syncUserStudyRec.setCreateTime(DateUtils.timestampToDateFormat(userPeriodStatusVo.getRecordStartTime(),DateUtils.YYYY_MM_DD_HH_MM_SS));
|
|
|
+ syncUserStudyRec.setEndTime(DateUtils.timestampToDateFormat(userPeriodStatusVo.getRecordEndTime(),DateUtils.YYYY_MM_DD_HH_MM_SS));
|
|
|
+ syncUserChapterItem.setStudyIP(userPeriodStatusVo.getIp());
|
|
|
+ List<SyncUserImageRc> ImgList = new ArrayList<>();
|
|
|
+ for (UserStudyRecordPhoto videoPhoto : videoPhoto2) {
|
|
|
+ SyncUserImageRc imageRc = new SyncUserImageRc();
|
|
|
+ imageRc.setImgSrc(ossHost+"/"+videoPhoto.getPhoto());
|
|
|
+ imageRc.setCreateTime(DateUtils.timestampToDateFormat(videoPhoto.getCreateTime(),DateUtils.YYYY_MM_DD_HH_MM_SS));
|
|
|
+ imageRc.setMatchData(Validator.isNotEmpty(videoPhoto.getSimilarity())?videoPhoto.getSimilarity().toString():null);
|
|
|
+ ImgList.add(imageRc);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ RecList.add(syncUserStudyRec);
|
|
|
+ }
|
|
|
+ syncUserChapterItem.setRecList(RecList);
|
|
|
+ ChapterList.add(syncUserChapterItem);
|
|
|
+ });
|
|
|
+
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ studyRec.setChapterList(ChapterList);
|
|
|
+ //学习记录推送到旧系统
|
|
|
+ Map<String, String> params = new HashMap<>();
|
|
|
+ Long nowTime = DateUtils.getNowTime();
|
|
|
+ String sign = ToolsUtils.EncoderByMd5(nowTime.toString()+"pubilc2022");
|
|
|
+ params.put("stamp", nowTime.toString());
|
|
|
+ params.put("sign", sign);
|
|
|
+ params.put("jsonstr", JSONObject.toJSONString(studyRec));
|
|
|
+ String respone = "";
|
|
|
+ try {
|
|
|
+ respone = HttpUtils.postFormBody(SYNC_PATH, params);
|
|
|
+ } catch (IOException e) {
|
|
|
+ throw new CustomException("请求错误");
|
|
|
+ }
|
|
|
+ return studyRec;
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 打回操作
|
|
|
*
|
|
|
@@ -450,6 +613,8 @@ public class UserPeriodServiceImpl extends ServiceImpl<UserPeriodMapper, UserPer
|
|
|
return baseMapper.todayStudySectionNum(bo);
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+
|
|
|
//学时通过处理事件
|
|
|
private void periodPass(ClassGradeUserQueryBo classGradeUserQueryBo) {
|
|
|
//生成证书
|