he2802 пре 3 година
родитељ
комит
e8f3611795

+ 9 - 0
zhongzheng-admin/src/main/java/com/zhongzheng/controller/schedule/ScheduleController.java

@@ -315,4 +315,13 @@ public class ScheduleController extends BaseController {
         iScheduleService.wisdomSyncExamVideo(bo);
         return AjaxResult.success();
     }
+
+
+
+    @ApiOperation("手动刷新token")
+    @GetMapping("/refreshToken")
+    public AjaxResult refreshToken(UserQueryBo bo){
+        iScheduleService.refreshToken(bo);
+        return AjaxResult.success();
+    }
 }

+ 7 - 1
zhongzheng-api/src/main/java/com/zhongzheng/controller/cmmon/CommonController.java

@@ -24,6 +24,7 @@ import com.zhongzheng.modules.exam.vo.ExamActivityVo;
 import com.zhongzheng.modules.goods.vo.GoodsUserVo;
 import com.zhongzheng.modules.goods.vo.GoodsVo;
 import com.zhongzheng.modules.order.domain.Printer;
+import com.zhongzheng.modules.system.service.ISysConfigService;
 import com.zhongzheng.modules.wx.bo.WxServerBody;
 import com.zhongzheng.modules.wx.domain.*;
 import io.swagger.annotations.Api;
@@ -78,6 +79,9 @@ public class CommonController extends BaseController {
         return AjaxResult.success(iCourseTopicService.getGoodsList(bo));
     }
 
+    private final ISysConfigService configService;
+
+
     /**
      * 查询课程列表
      */
@@ -144,7 +148,9 @@ public class CommonController extends BaseController {
         Map<String,Object> map = new HashMap<>();
         map.put("hide",false);
         if(Validator.isNotEmpty(bo.getVersion())){
-            if(bo.getVersion().equals("7.0.1")){
+            String hideVersion = configService.selectConfigByKey("version.hide");
+            System.out.println(hideVersion);
+            if(bo.getVersion().equals(hideVersion)){
                 map.put("hide",true);
             }
         }

+ 2 - 2
zhongzheng-system/src/main/java/com/zhongzheng/modules/activity/service/impl/ActivityRecommendServiceImpl.java

@@ -88,7 +88,7 @@ public class ActivityRecommendServiceImpl extends ServiceImpl<ActivityRecommendM
         validEntityBeforeSave(add);
         add.setCreateTime(DateUtils.getNowTime());
         add.setUpdateTime(DateUtils.getNowTime());
-        if (CollectionUtils.isNotEmpty(bo.getSubjectIds())){
+        if (CollectionUtils.isNotEmpty(bo.getSubjectIds())&&bo.getSubjectIds().size()>0){
             add.setSubjectIds(StringUtils.join(bo.getSubjectIds(),","));
         }
         Boolean rs =  this.save(add);
@@ -126,7 +126,7 @@ public class ActivityRecommendServiceImpl extends ServiceImpl<ActivityRecommendM
         ActivityRecommend update = BeanUtil.toBean(bo, ActivityRecommend.class);
         validEntityBeforeSave(update);
         update.setUpdateTime(DateUtils.getNowTime());
-        if (CollectionUtils.isNotEmpty(bo.getSubjectIds())){
+        if (CollectionUtils.isNotEmpty(bo.getSubjectIds())&&bo.getSubjectIds().size()>0){
             update.setSubjectIds(StringUtils.join(bo.getSubjectIds(),","));
         }
         if(bo.getGoodsList()!=null){

+ 2 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/schedule/service/IScheduleService.java

@@ -74,6 +74,8 @@ public interface IScheduleService extends IService<PolyvVideo> {
 
     void wisdomExamSite(UserQueryBo bo);
 
+    void refreshToken(UserQueryBo bo);
+
     Map<String,Object> wisdomSyncApplyUserInfo(ExamApplyQueryBo bo);
 
     void wisdomSyncExamStatus(ExamApplyQueryBo bo);

+ 13 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/schedule/service/impl/ScheduleServiceImpl.java

@@ -307,9 +307,13 @@ public class ScheduleServiceImpl extends ServiceImpl<PolyvVideoMapper, PolyvVide
     @Value("${aliyun.sms.longNotStudyTeacherRemind}")
     private String longNotStudyTeacherRemind;
 
+    @Autowired
+    private RedisCache redisCache;
+
     @Value("${aliyun.sms.signCommitmentRemind}")
     private String signCommitmentRemind;
 
+
     @Override
     public String updateGoodsSend(UserQueryBo bo) {
         InformRemindVo informRemindVo = informRemindService.queryById(1L);
@@ -2218,6 +2222,15 @@ public class ScheduleServiceImpl extends ServiceImpl<PolyvVideoMapper, PolyvVide
     }
 
 
+    @Override
+    public void refreshToken(UserQueryBo bo) {
+        String key = "WX_SMALL_ACCESS_TOKEN";
+        redisCache.deleteObject(key);
+        String key2 = "WX_GZH_ACCESS_TOKEN";
+        redisCache.deleteObject(key2);
+
+    }
+
 
     private Long formatTime(Long startTime, String addTime) throws ParseException{
         Long times = startTime*1000;//时间戳

+ 26 - 10
zhongzheng-system/src/main/java/com/zhongzheng/modules/user/service/impl/UserStudyRecordServiceImpl.java

@@ -322,7 +322,13 @@ public class UserStudyRecordServiceImpl extends ServiceImpl<UserStudyRecordMappe
         validEntityBeforeSave(add);
         add.setCreateTime(DateUtils.getNowTime());
         add.setUpdateTime(DateUtils.getNowTime());
+        if(Validator.isEmpty(add.getVideoCurrentTime())){
+            add.setVideoCurrentTime(0L);
+        }
         if(Validator.isNotEmpty(add.getStudyDuration())){
+           /* if(add.getStudyDuration().longValue()>60L){
+                add.setStudyDuration(60L); //前端60秒提交一次,超过60按60算
+            }*/
             add.setStartTime(DateUtils.getNowTime().longValue() - add.getStudyDuration().longValue());
         }else{
             add.setStartTime(DateUtils.getNowTime().longValue());
@@ -338,33 +344,43 @@ public class UserStudyRecordServiceImpl extends ServiceImpl<UserStudyRecordMappe
         CourseSection section = iCourseSectionService.getById(bo.getSectionId());
         add.setSectionType(section.getSectionType());
         add.setIdentification(bo.getIdentification());
-        this.save(add);
+   //     this.save(add);
         if (ObjectUtils.isNull(bo.getOrderGoodsId())){
             //没有购买商品,通过分享观看
+            this.save(add);
             return 0;
         }
-/*        if(courseSectionVo.getSectionType()==1||courseSectionVo.getSectionType()==2||courseSectionVo.getSectionType()==3){
+        if(courseSectionVo.getSectionType()==1||courseSectionVo.getSectionType()==2||courseSectionVo.getSectionType()==3){
             UserStudyRecordQueryBo queryBo = BeanUtil.toBean(bo, UserStudyRecordQueryBo.class);
-*//*            queryBo.setUserId(bo.getUserId());
+            queryBo.setUserId(bo.getUserId());
             queryBo.setGradeId(bo.getGradeId());
             queryBo.setGoodsId(bo.getGoodsId());
             queryBo.setCourseId(bo.getCourseId());
             queryBo.setModuleId(bo.getModuleId());
             queryBo.setChapterId(bo.getChapterId());
             queryBo.setSectionId(bo.getSectionId());
-            queryBo.setOrderGoodsId(bo.getOrderGoodsId());*//*
+            queryBo.setOrderGoodsId(bo.getOrderGoodsId());
             UserStudyRecordVo lastVo = queryLast(queryBo);
-            if(Validator.isEmpty(lastVo)||Validator.isEmpty(lastVo.getVideoCurrentTime())||lastVo.getVideoCurrentTime().longValue()>add.getVideoCurrentTime().longValue()){
-                //如果没有历史数据或者之前播放时长比现在晚,则新增观看记录
+            if(Validator.isEmpty(lastVo)||Validator.isNotEmpty(bo.getPhoto())||Validator.isEmpty(lastVo.getVideoCurrentTime())||lastVo.getVideoCurrentTime().longValue()>add.getVideoCurrentTime().longValue()){
+                //如果没有历史数据或者之前播放时长比现在晚,或者携带照片则新增观看记录
                 this.save(add);
             }else{
-                //修改最后一条记录,减少观看数据
                 lastVo.setVideoCurrentTime(add.getVideoCurrentTime());
                 lastVo.setEndTime(add.getEndTime());
                 if(Validator.isNotEmpty(add.getStatus())&&add.getStatus()==1){
                     lastVo.setStatus(1);
                 }
-                if(add.getOrderGoodsId().equals(lastVo.getOrderGoodsId())&&(add.getSectionId().equals(lastVo.getSectionId()))&&(add.getGoodsId().equals(lastVo.getGoodsId()))){
+                if(lastVo.getVideoCurrentTime().longValue()<=add.getVideoCurrentTime().longValue()){
+                    lastVo.setStudyDuration(lastVo.getStudyDuration().longValue()+(add.getVideoCurrentTime().longValue()-lastVo.getVideoCurrentTime().longValue()));
+                }else{
+                    lastVo.setStudyDuration(lastVo.getStudyDuration().longValue()+add.getStudyDuration().longValue());
+                }
+
+                UserStudyRecord update = BeanUtil.toBean(lastVo, UserStudyRecord.class);
+                update.setUpdateTime(DateUtils.getNowTime());
+                this.updateById(update);
+                add.setRecordId(update.getRecordId());
+                /*if(add.getOrderGoodsId().equals(lastVo.getOrderGoodsId())&&(add.getSectionId().equals(lastVo.getSectionId()))&&(add.getGoodsId().equals(lastVo.getGoodsId()))){
                     lastVo.setStudyDuration(add.getStudyDuration()+lastVo.getStudyDuration());
                     UserStudyRecord update = BeanUtil.toBean(lastVo, UserStudyRecord.class);
                     update.setUpdateTime(DateUtils.getNowTime());
@@ -372,11 +388,11 @@ public class UserStudyRecordServiceImpl extends ServiceImpl<UserStudyRecordMappe
                     add.setRecordId(update.getRecordId());
                 }else{
                     this.save(add);
-                }
+                }*/
             }
         }else{
             this.save(add);
-        }*/
+        }
 
         //新增学时记录,照片
         userPeriodSave(add, bo);

+ 4 - 2
zhongzheng-system/src/main/resources/mapper/modules/bank/ExamMapper.xml

@@ -84,7 +84,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         cpt.project_name,
         cb.business_name,
         cs.subject_name,
-        (SELECT count(*)  from exam_question where exam_id = e.exam_id ) question_num
+        eq.question_num
         FROM
             exam e
                 LEFT JOIN exam_paper ep ON e.exam_paper_id = ep.paper_id
@@ -93,7 +93,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
                 LEFT JOIN course_education_type cet ON qb.education_type_id = cet.id
                 LEFT JOIN course_project_type cpt ON qb.project_id = cpt.id
                 LEFT JOIN course_business cb ON qb.business_id = cb.id
-                LEFT JOIN course_subject cs ON cs.id = qb.subject_id where 1=1
+                LEFT JOIN course_subject cs ON cs.id = qb.subject_id
+                LEFT JOIN (SELECT count(*) question_num,exam_id  from exam_question GROUP BY exam_id)eq on eq.exam_id = e.exam_id
+        where 1=1
         <if test="status != null and status.size()!=0 ">
             AND e.status in
             <foreach collection="status" item="item" index="index" open="(" close=")" separator=",">