getMaxScore(Long classId, Long memberId);
+ /**
+ * 查看某个人某个卷子完成的最好成绩
+ */
+ ExerciseDoneResultDO getMaxScorePaper(Long paperId,Long memberId);
+ /**
+ * 测试成绩 最高成绩 测试测试 总评价
+ */
+ TestScoreInfoVO testScoreInfo(Long paperId, Long memberId);
+ /**
+ * 汇总 查看课程通过情况
+ */
+ Integer getClassTestPassRate(Long classId);
}
diff --git a/src/main/java/com/subsidy/mapper/FileDictMapper.java b/src/main/java/com/subsidy/mapper/FileDictMapper.java
index 4ee1912..1f42b30 100644
--- a/src/main/java/com/subsidy/mapper/FileDictMapper.java
+++ b/src/main/java/com/subsidy/mapper/FileDictMapper.java
@@ -4,6 +4,8 @@ import com.subsidy.model.FileDictDO;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.springframework.stereotype.Repository;
+import java.util.List;
+
/**
*
* 课件表 Mapper 接口
@@ -15,4 +17,6 @@ import org.springframework.stereotype.Repository;
@Repository
public interface FileDictMapper extends BaseMapper {
+ List selectFiles(Long contentId,String fileName);
+
}
diff --git a/src/main/java/com/subsidy/mapper/OprAdmDictMapper.java b/src/main/java/com/subsidy/mapper/OprAdmDictMapper.java
index d52761c..741930d 100644
--- a/src/main/java/com/subsidy/mapper/OprAdmDictMapper.java
+++ b/src/main/java/com/subsidy/mapper/OprAdmDictMapper.java
@@ -1,7 +1,7 @@
package com.subsidy.mapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.subsidy.model.OprAdmDictDO;
+import com.subsidy.mongodb.OprAdmDictDO;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.subsidy.vo.opr.GetHistoryVO;
import org.springframework.stereotype.Repository;
diff --git a/src/main/java/com/subsidy/mapper/VodPlayHistoryMapper.java b/src/main/java/com/subsidy/mapper/VodPlayHistoryMapper.java
index 9a1d023..afeafc7 100644
--- a/src/main/java/com/subsidy/mapper/VodPlayHistoryMapper.java
+++ b/src/main/java/com/subsidy/mapper/VodPlayHistoryMapper.java
@@ -66,6 +66,14 @@ public interface VodPlayHistoryMapper extends BaseMapper {
*/
List memberStudyLog(Long classId, Long memberId);
+ /**
+ * 查看某个人的学习累计时长
+ */
+ Integer memberTotalLength(Long memberId);
+ /**
+ * 查看某个人某个视频的累计时长
+ */
+ Integer memberVodTotalLength(Long memberId,Long vodId);
}
diff --git a/src/main/java/com/subsidy/model/Collection.java b/src/main/java/com/subsidy/model/Collection.java
new file mode 100644
index 0000000..abcf13b
--- /dev/null
+++ b/src/main/java/com/subsidy/model/Collection.java
@@ -0,0 +1,13 @@
+package com.subsidy.model;
+
+import lombok.Data;
+
+@Data
+
+public class Collection {
+
+ private String _id;
+
+ private String name;
+
+}
diff --git a/src/main/java/com/subsidy/model/OprMemDictDO.java b/src/main/java/com/subsidy/model/OprMemDictDO.java
index 252bbc1..5622567 100644
--- a/src/main/java/com/subsidy/model/OprMemDictDO.java
+++ b/src/main/java/com/subsidy/model/OprMemDictDO.java
@@ -16,14 +16,9 @@ import lombok.EqualsAndHashCode;
* @since 2021-12-13
*/
@Data
-@EqualsAndHashCode(callSuper = true)
-@TableName("opr_mem_dict")
-public class OprMemDictDO extends BaseModel {
+public class OprMemDictDO {
- private static final long serialVersionUID = 1L;
-
- @TableId(value = "id", type = IdType.AUTO)
- private Long id;
+ private String _id;
/**
* 用户id
@@ -40,4 +35,13 @@ public class OprMemDictDO extends BaseModel {
*/
private Integer result;
+ /**
+ * 登录时间
+ */
+ private String loginDateFormat;
+
+ /**
+ * 创建时间
+ */
+ private String createDate;
}
diff --git a/src/main/java/com/subsidy/model/VodPlayHistoryDO.java b/src/main/java/com/subsidy/model/VodPlayHistoryDO.java
index 900a7bc..d5fc850 100644
--- a/src/main/java/com/subsidy/model/VodPlayHistoryDO.java
+++ b/src/main/java/com/subsidy/model/VodPlayHistoryDO.java
@@ -7,6 +7,8 @@ import com.baomidou.mybatisplus.annotation.TableId;
import lombok.Data;
import lombok.EqualsAndHashCode;
+import java.time.LocalDateTime;
+
/**
*
* 视频播放历史记录表
@@ -55,5 +57,7 @@ public class VodPlayHistoryDO extends BaseModel {
*/
private Integer playCount;
+ private LocalDateTime playDate;
+
}
diff --git a/src/main/java/com/subsidy/mongodb/MongoController.java b/src/main/java/com/subsidy/mongodb/MongoController.java
new file mode 100644
index 0000000..74fb71e
--- /dev/null
+++ b/src/main/java/com/subsidy/mongodb/MongoController.java
@@ -0,0 +1,68 @@
+package com.subsidy.mongodb;
+
+import com.subsidy.util.MongoUtil;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.data.mongodb.core.MongoTemplate;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+@RestController
+@RequestMapping("/mango")
+public class MongoController {
+
+
+ @Autowired
+ private MongoTemplate mongoTemplate;
+
+ @Autowired
+ private MongoUtil mongoUtil;
+
+ @PostMapping("getOne")
+ public void getAll(){
+ ////Query query=new Query();
+ ////MongoDO user = mongoTemplate.getDb(query , MongoDO.class);
+ ////List mongo= mongoTemplate.findAll(MongoDO.class);
+ ////System.out.println(mongo);
+ //System.out.println(mongoTemplate.getDb().getName());
+ //
+ //Collection mongoDO = mongoTemplate.findById("61de944c5cdc5e3f896c95c7", Collection.class);
+ //System.out.println(mongoDO);
+ //
+ //List collections = mongoTemplate.findAll(Collection.class);
+ //System.out.println(collections);
+ //
+ //Query query = new Query(Criteria.where("name").regex("张"));//可累加条件
+ //List entrY = mongoTemplate.find(query,Collection.class);
+ //System.out.println(entrY);
+
+ //添加
+ //Collection collection = new Collection();
+ //collection.setName("bbbbbbbb");
+ //collection.set_id("61de944c5cdc5e3f896c95c7");
+ //mongoTemplate.save(collection,"collection");
+
+ //for (int i = 0 ; i < 100; i++){
+ // Collection collection1 = new Collection();
+ // collection1.setName("aaaa"+i);
+ // mongoTemplate.save(collection1);
+ //}
+
+ //Query query =new Query(new Criteria());
+ //query.with(Sort.by("name"));
+ ////mongoUtil.start(1,5,query);
+ //List collections = mongoTemplate.find(query,Collection.class);
+ //for (Collection collection : collections){
+ // System.out.println(collection+"=========");
+ //}
+
+ //OprAdmDictDO oprAdmDictDO = new OprAdmDictDO();
+ //oprAdmDictDO.setUserId(1L);
+ //oprAdmDictDO.setResult(1);
+ //oprAdmDictDO.setOprType("登录成功");
+ //mongoTemplate.save(oprAdmDictDO);
+
+
+ }
+
+}
diff --git a/src/main/java/com/subsidy/model/OprAdmDictDO.java b/src/main/java/com/subsidy/mongodb/OprAdmDictDO.java
similarity index 67%
rename from src/main/java/com/subsidy/model/OprAdmDictDO.java
rename to src/main/java/com/subsidy/mongodb/OprAdmDictDO.java
index 8ece55c..443c8fc 100644
--- a/src/main/java/com/subsidy/model/OprAdmDictDO.java
+++ b/src/main/java/com/subsidy/mongodb/OprAdmDictDO.java
@@ -1,4 +1,4 @@
-package com.subsidy.model;
+package com.subsidy.mongodb;
import com.subsidy.util.BaseModel;
import com.baomidou.mybatisplus.annotation.TableName;
@@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import lombok.Data;
import lombok.EqualsAndHashCode;
+import org.omg.CosNaming.NamingContextExtPackage.StringNameHelper;
/**
*
@@ -16,14 +17,9 @@ import lombok.EqualsAndHashCode;
* @since 2021-12-13
*/
@Data
-@EqualsAndHashCode(callSuper = true)
-@TableName("opr_adm_dict")
-public class OprAdmDictDO extends BaseModel {
+public class OprAdmDictDO {
- private static final long serialVersionUID = 1L;
-
- @TableId(value = "id", type = IdType.AUTO)
- private Long id;
+ private String _id;
/**
* 用户id
@@ -31,6 +27,16 @@ public class OprAdmDictDO extends BaseModel {
private Long userId;
/**
+ * 公司id
+ */
+ private Long companyId;
+
+ /**
+ * 名字
+ */
+ private String userName;
+
+ /**
* 操作类型
*/
private String oprType;
@@ -40,4 +46,14 @@ public class OprAdmDictDO extends BaseModel {
*/
private Integer result;
+ /**
+ * 登录时间
+ */
+ private String loginDateFormat;
+
+ /**
+ * 创建时间
+ */
+ private String createDate;
+
}
diff --git a/src/main/java/com/subsidy/mongodb/PageVO.java b/src/main/java/com/subsidy/mongodb/PageVO.java
new file mode 100644
index 0000000..cca0447
--- /dev/null
+++ b/src/main/java/com/subsidy/mongodb/PageVO.java
@@ -0,0 +1,26 @@
+package com.subsidy.mongodb;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import lombok.Data;
+
+import java.util.List;
+
+@Data
+public class PageVO {
+
+
+ /**
+ * 分页记录列表
+ *
+ * @return 分页对象记录列表
+ */
+ private List records;
+
+ /**
+ * 设置当前满足条件总行数
+ */
+ private long total;
+
+
+
+}
diff --git a/src/main/java/com/subsidy/service/ExerciseDictService.java b/src/main/java/com/subsidy/service/ExerciseDictService.java
index a730c54..44a7f5f 100644
--- a/src/main/java/com/subsidy/service/ExerciseDictService.java
+++ b/src/main/java/com/subsidy/service/ExerciseDictService.java
@@ -21,16 +21,12 @@ import java.util.List;
*/
public interface ExerciseDictService extends IService {
- IPage getAllExercises(GetAllExercisesDTO getAllExercisesDTO);
-
String addExercise(ExerciseDictDO exerciseDictDO);
String deleteExercise(ExerciseDictDO exerciseDictDO);
String updateExercise(ExerciseDictDO exerciseDictDO);
- List getCourseExercises(CourseDictDO courseDictDO);
-
Long submit(SubmitDTO submitDTO);
IPage getPaperExercise(GetPaperExerciseDTO getPaperExerciseDTO);
diff --git a/src/main/java/com/subsidy/service/MemberService.java b/src/main/java/com/subsidy/service/MemberService.java
index 39db22a..e4e3928 100644
--- a/src/main/java/com/subsidy/service/MemberService.java
+++ b/src/main/java/com/subsidy/service/MemberService.java
@@ -60,8 +60,6 @@ public interface MemberService extends IService {
GetStudyInfoVO getStudyInfo(MemberDO memberDO);
- ExerciseDoneResultDO getDoneResult(ExerciseDoneResultDO exerciseDoneResultDO);
-
String checkTimes(ExerciseDoneResultDO exerciseDoneResultDO);
void importRedis();
diff --git a/src/main/java/com/subsidy/service/OprAdmDictService.java b/src/main/java/com/subsidy/service/OprAdmDictService.java
index 092b88c..ae63e22 100644
--- a/src/main/java/com/subsidy/service/OprAdmDictService.java
+++ b/src/main/java/com/subsidy/service/OprAdmDictService.java
@@ -2,8 +2,9 @@ package com.subsidy.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.subsidy.dto.opr.GetHistoryDTO;
-import com.subsidy.model.OprAdmDictDO;
+import com.subsidy.mongodb.OprAdmDictDO;
import com.baomidou.mybatisplus.extension.service.IService;
+import com.subsidy.mongodb.PageVO;
import com.subsidy.vo.opr.GetHistoryVO;
/**
@@ -16,6 +17,6 @@ import com.subsidy.vo.opr.GetHistoryVO;
*/
public interface OprAdmDictService extends IService {
- IPage getHistory(GetHistoryDTO getHistoryDTO);
+ PageVO getHistory(GetHistoryDTO getHistoryDTO);
}
diff --git a/src/main/java/com/subsidy/service/VodPlayHistoryService.java b/src/main/java/com/subsidy/service/VodPlayHistoryService.java
index a355a19..6b8c5ea 100644
--- a/src/main/java/com/subsidy/service/VodPlayHistoryService.java
+++ b/src/main/java/com/subsidy/service/VodPlayHistoryService.java
@@ -16,4 +16,6 @@ public interface VodPlayHistoryService extends IService {
String insertHistory(VodPlayHistoryDO vodPlayHistoryDO);
String insertHistoryNew(VodPlayHistoryDO vodPlayHistoryDO);
+
+ void dataFix();
}
diff --git a/src/main/java/com/subsidy/service/impl/AdministerServiceImpl.java b/src/main/java/com/subsidy/service/impl/AdministerServiceImpl.java
index cf47d81..cfbbac8 100644
--- a/src/main/java/com/subsidy/service/impl/AdministerServiceImpl.java
+++ b/src/main/java/com/subsidy/service/impl/AdministerServiceImpl.java
@@ -37,13 +37,14 @@ import com.subsidy.model.ExerciseDoneHistoryDO;
import com.subsidy.model.ExerciseDoneResultDO;
import com.subsidy.model.MemberDO;
import com.subsidy.model.MemberDepartmentMappingDO;
-import com.subsidy.model.OprAdmDictDO;
+import com.subsidy.model.OprMemDictDO;
+import com.subsidy.mongodb.OprAdmDictDO;
import com.subsidy.model.RoleAdministerMappingDO;
import com.subsidy.model.SignInRecordDO;
import com.subsidy.model.VodDictDO;
-import com.subsidy.model.VodPlayHistoryDO;
import com.subsidy.service.AdministerService;
import com.subsidy.util.ConstantUtils;
+import com.subsidy.util.DateFormatUtil;
import com.subsidy.util.ExcelFormatUtils;
import com.subsidy.util.JwtUtil;
import com.subsidy.util.Localstorage;
@@ -63,11 +64,13 @@ import com.subsidy.vo.administer.OperatorsVO;
import com.subsidy.vo.administer.PermissionsVO;
import com.subsidy.vo.classdict.ClassDetailVO;
import com.subsidy.vo.done.GetMaxScoreVO;
+import com.subsidy.vo.done.TestScoreInfoVO;
import com.subsidy.vo.member.ClassSignVO;
import com.subsidy.vo.sign.AnswerRecordVO;
import com.subsidy.vo.vod.ClassVodCompleteInfoVO;
import com.subsidy.vo.vod.DayInfoItemVO;
import com.subsidy.vo.vod.GetMemberStudyInfoVO;
+import net.bytebuddy.description.modifier.SynchronizationState;
import net.sourceforge.pinyin4j.PinyinHelper;
import net.sourceforge.pinyin4j.format.HanyuPinyinCaseType;
import net.sourceforge.pinyin4j.format.HanyuPinyinOutputFormat;
@@ -91,8 +94,11 @@ import org.apache.poi.xssf.streaming.SXSSFWorkbook;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.data.domain.Sort;
+import org.springframework.data.mongodb.core.MongoTemplate;
+import org.springframework.data.mongodb.core.query.Criteria;
+import org.springframework.data.mongodb.core.query.Query;
import org.springframework.scheduling.annotation.Async;
-import org.springframework.scheduling.annotation.AsyncResult;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.context.request.RequestContextHolder;
@@ -118,9 +124,6 @@ import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Set;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-import java.util.concurrent.Future;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream;
@@ -179,6 +182,9 @@ public class AdministerServiceImpl extends ServiceImpl oprAdmDictDOS = oprAdmDictMapper.getLoginInfo(administerDO1.getId());
+ Query query = new Query(Criteria.where("userId").is(1).and("createDate").gte(System.currentTimeMillis()-5*60*1000+""));//可累加条件
+ query.with(Sort.by("createDate").descending());
+ List oprAdmDictDOS = mongoTemplate.find(query, OprAdmDictDO.class);
+
+ //查mysql逻辑
+ //List oprAdmDictDOS = oprAdmDictMapper.getLoginInfo(administerDO1.getId());
boolean flag = false;
for (int i = 0; i < oprAdmDictDOS.size(); i++) {
@@ -217,7 +228,6 @@ public class AdministerServiceImpl extends ServiceImpl()
+ .lambda()
+ .eq(RoleAdministerMappingDO::getAdministerId, administerDO.getId()));
return ConstantUtils.DELETE_SUCCESS;
}
@@ -360,7 +383,6 @@ public class AdministerServiceImpl extends ServiceImpl //总共学习课时数 + 学习时长
- summaryTask1(classSummaryVO, classMemberMappingDOS, vodDictDOS));
- executorService.execute(() -> //测试通过率
- summaryTask2(classSummaryVO, classDictDO.getId()));
- executorService.execute(() -> //签到总次数
- summaryTask3(classSummaryVO, classDictDO.getId()));
- executorService.execute(() -> //答疑数
- summaryTask4(classSummaryVO, classDictDO.getId()));
- //执行后不再接收新任务,如果里面有任务,就执行完
- executorService.shutdown();
- try {
- while (true) {
- //等待所有任务都结束了继续执行
- if (executorService.isTerminated()) {
- break;
- }
- }
-
- } catch (Exception ex) {
- ex.printStackTrace();
- }
- return classSummaryVO;
- }
-
- public Future summaryTask1(ClassSummaryVO classSummaryVO, List classMemberMappingDOS, List vodDictDOS) {
-
-
int totalStudyVods = 0;
int totalStudyLength = 0;
//学生总共学习课时数
for (VodDictDO vodDictDO : vodDictDOS) {
for (ClassMemberMappingDO classMemberMappingDO : classMemberMappingDOS) {
- List vodPlayHistoryDOS = vodPlayHistoryMapper.selectList(new QueryWrapper()
- .lambda()
- .eq(VodPlayHistoryDO::getMemberId, classMemberMappingDO.getMemberId())
- .eq(VodPlayHistoryDO::getVodId, vodDictDO.getId())
- .orderByDesc(VodPlayHistoryDO::getPlayRecord));
-
- for (VodPlayHistoryDO vodPlayHistoryDO : vodPlayHistoryDOS) {
- totalStudyLength += vodPlayHistoryDO.getPlayLength();
- }
-
- if (vodPlayHistoryDOS.size() > 0) {
- if (vodPlayHistoryDOS.get(0).getPlayRecord() >= vodDictDO.getVodLength() * 0.8) {
- totalStudyVods++;
- }
+ int totalLength = vodPlayHistoryMapper.memberVodTotalLength(classMemberMappingDO.getMemberId(), vodDictDO.getId());
+ if (totalLength >= vodDictDO.getVodLength()) {
+ totalStudyVods++;
}
}
}
@@ -444,49 +425,27 @@ public class AdministerServiceImpl extends ServiceImpl(classSummaryVO);
- }
-
- public Future summaryTask2(ClassSummaryVO classSummaryVO, Long classId) {
//测试通过率
- List exerciseDoneResultDOS = exerciseDoneResultMapper.selectList(new QueryWrapper()
- .lambda()
- .eq(ExerciseDoneResultDO::getClassId, classId));
-
- int passNum = 0;
-
- for (ExerciseDoneResultDO exerciseDoneResultDO : exerciseDoneResultDOS) {
- if (exerciseDoneResultDO.getRightCounts() >= exerciseDoneResultDO.getTotalCounts() * 0.6) {
- passNum++;
- }
- }
-
+ Integer passNum = exerciseDoneResultMapper.getClassTestPassRate(classDictDO.getId());
classSummaryVO.setPassRate(MathUtil.intDivFloorPercent(passNum, classSummaryVO.getMemberCount()));
- return new AsyncResult<>(classSummaryVO);
- }
- public Future summaryTask3(ClassSummaryVO classSummaryVO, Long classId) {
//签到总次数
- long signCount = redisUtil.scan("subsidySignInfo*_classId_" + classId + "*").stream().count();
+ long signCount = redisUtil.scan("subsidySignInfo*:classId:" + classDictDO.getId() + "*").stream().count();
classSummaryVO.setAvgSignCount(MathUtil.intDivCeil(signCount, classSummaryVO.getMemberCount()));
- return new AsyncResult<>(classSummaryVO);
- }
-
- public Future summaryTask4(ClassSummaryVO classSummaryVO, Long classId) {
//答疑数
Integer count = answeringQuestionMapper.selectCount(new QueryWrapper()
.lambda()
- .eq(AnsweringQuestionDO::getClassId, classId));
+ .eq(AnsweringQuestionDO::getClassId, classDictDO.getId()));
classSummaryVO.setAnswerCount(count);
- return new AsyncResult<>(classSummaryVO);
+ return classSummaryVO;
}
+
public IPage classDetail(ClassDetailDTO classDetailDTO) {
Page pager = new Page(classDetailDTO.getPageNum(), classDetailDTO.getPageSize());
-
IPage classDetailVOIPage = this.baseMapper.classMembers(pager, classDetailDTO.getId(), classDetailDTO.getUserName());
List classDetailVOS = classDetailVOIPage.getRecords();
@@ -497,112 +456,59 @@ public class AdministerServiceImpl extends ServiceImpl ///该学生完成了多少个 学生成绩,学生进度
- classDetailTask1(classDetailVO, vodDictDOS, classDictDO.getId(), classDetailVO.getId()));
- cachedThreadPool.execute(() -> //答疑
- classDetailTask2(classDetailVO, classDetailDTO));
- cachedThreadPool.execute(() -> //签到
- classDetailTask3(classDetailVO, classDetailDTO));
-
- //执行后不再接收新任务,如果里面有任务,就执行完
- cachedThreadPool.shutdown();
- try {
- while (true) {
- //等待所有任务都结束了继续执行
- if (cachedThreadPool.isTerminated()) {
- break;
- }
- }
- } catch (Exception ex) {
- ex.printStackTrace();
- }
- }
- classDetailVOIPage.setRecords(classDetailVOS);
- return classDetailVOIPage;
- }
-
- public Future classDetailTask1(ClassDetailVO classDetailVO, List vodDictDOS, Long classId, Long memberId) {
-
- //该学生完成了多少个
- int i = 0;
- int playLength = 0;
- //该成员完成了几个视频
- for (VodDictDO vodDictDO : vodDictDOS) {
- List vodPlayHistoryDOS = vodPlayHistoryMapper.selectList(new QueryWrapper()
- .lambda()
- .eq(VodPlayHistoryDO::getMemberId, memberId)
- .eq(VodPlayHistoryDO::getVodId, vodDictDO.getId())
- .orderByDesc(VodPlayHistoryDO::getPlayRecord));
-
-
- if (vodPlayHistoryDOS.size() > 0) {
- if (vodPlayHistoryDOS.get(0).getPlayRecord() > vodDictDO.getVodLength() * 0.8) {
+ //该学生完成了多少个
+ int i = 0;
+ int playLength = 0;
+ //该成员完成了几个视频
+ for (VodDictDO vodDictDO : vodDictDOS) {
+ int totalPlayLength = vodPlayHistoryMapper.memberVodTotalLength(classDetailVO.getId(), vodDictDO.getId());
+ if (totalPlayLength >= vodDictDO.getVodLength()) {
i++;
}
+ playLength += totalPlayLength;
}
+ //培训时长
+ classDetailVO.setTrainingLength(playLength);
- for (VodPlayHistoryDO vodPlayHistoryDO : vodPlayHistoryDOS) {
- playLength += vodPlayHistoryDO.getPlayLength();
- }
-
- }
- classDetailVO.setStudyVodCounts(i);
-
- //学生测试完成情况 多套卷子各返回最高成绩
- List getMaxScoreVOS = exerciseDoneResultMapper.getMaxScore(classId, classDetailVO.getId());
- classDetailVO.setGetMaxScoreVOS(getMaxScoreVOS);
+ //学生测试完成情况 多套卷子各返回最高成绩
+ List getMaxScoreVOS = exerciseDoneResultMapper.getMaxScore(classDictDO.getId(), classDetailVO.getId());
+ classDetailVO.setGetMaxScoreVOS(getMaxScoreVOS);
- Boolean flag = true;
+ Boolean flag = true;
- if (getMaxScoreVOS.size() > 0) {
- for (GetMaxScoreVO getMaxScoreVO : getMaxScoreVOS) {
- if (getMaxScoreVO.getScore() < 60) {
- flag = false;
+ if (getMaxScoreVOS.size() > 0) {
+ for (GetMaxScoreVO getMaxScoreVO : getMaxScoreVOS) {
+ if (getMaxScoreVO.getScore() < 60) {
+ flag = false;
+ }
}
+ } else {
+ flag = false;
}
- } else {
- flag = false;
- }
- if (flag && i == vodDictDOS.size()) {
- classDetailVO.setResult("合格");
- } else {
- classDetailVO.setResult("不合格");
- }
-
- classDetailVO.setClassProcess(i + "/" + vodDictDOS.size());
-
- //培训时长
- classDetailVO.setTrainingLength(playLength);
- return new AsyncResult<>(classDetailVO);
- }
-
- public Future classDetailTask2(ClassDetailVO classDetailVO, ClassDetailDTO classDetailDTO) {
+ //总评价
+ classDetailVO.setResult(flag && i == vodDictDOS.size() ? "合格" : "不合格");
- //答疑
- Integer count = answeringQuestionMapper.selectCount(new QueryWrapper()
- .lambda()
- .eq(AnsweringQuestionDO::getAskId, classDetailVO.getId())
- .eq(AnsweringQuestionDO::getClassId, classDetailDTO.getId()));
- classDetailVO.setAskCounts(count);
+ //课程进度
+ classDetailVO.setClassProcess(i + "/" + vodDictDOS.size());
- return new AsyncResult<>(classDetailVO);
- }
+ //答疑
+ Integer count = answeringQuestionMapper.selectCount(new QueryWrapper()
+ .lambda()
+ .eq(AnsweringQuestionDO::getAskId, classDetailVO.getId())
+ .eq(AnsweringQuestionDO::getClassId, classDetailDTO.getId()));
+ classDetailVO.setAskCounts(count);
+ //签到次数
+ long set = redisUtil.scan(RedisPrefixConstant.SUBSIDY_SIGN_INFO_PREFIX + "memberId:" + classDetailVO.getId() + ":classId:" + classDetailDTO.getId() + "*").stream().count();
+ classDetailVO.setSignCounts(set);
- public Future classDetailTask3(ClassDetailVO classDetailVO, ClassDetailDTO classDetailDTO) {
- ////签到次数
- long set = redisUtil.scan(RedisPrefixConstant.SUBSIDY_SIGN_INFO_PREFIX + "memberId_" + classDetailVO.getId() + "_classId_" + classDetailDTO.getId() + "*").stream().count();
- classDetailVO.setSignCounts(set);
- return new AsyncResult<>(classDetailVO);
+ }
+ classDetailVOIPage.setRecords(classDetailVOS);
+ return classDetailVOIPage;
}
public List exportClassDetail(ClassDetailDTO classDetailDTO) throws Exception {
@@ -619,102 +525,69 @@ public class AdministerServiceImpl extends ServiceImpl ///该学生完成了多少个 学生成绩,学生进度
- exportClassDetailTask(classDetailVO, vodDictDOS, classDictDO.getId(), classDetailVO.getId()));
- newCachedThreadPool.execute(() -> //答疑
- classDetailTask2(classDetailVO, classDetailDTO));
- newCachedThreadPool.execute(() -> //签到
- classDetailTask3(classDetailVO, classDetailDTO));
-
- //执行后不再接收新任务,如果里面有任务,就执行完
- newCachedThreadPool.shutdown();
- try {
- while (true) {
- //等待所有任务都结束了继续执行
- if (newCachedThreadPool.isTerminated()) {
- break;
- }
- }
- } catch (Exception ex) {
- ex.printStackTrace();
+ //该学生完成了多少个
+ int i = 0;
+ int playLength = 0;
+ //该成员完成了几个视频
+ for (VodDictDO vodDictDO : vodDictDOS) {
+ int totalPlayLength = vodPlayHistoryMapper.memberVodTotalLength(classDetailVO.getId(), vodDictDO.getId());
+ if (totalPlayLength >= vodDictDO.getVodLength()) {
+ i++;
+ }
+ playLength += totalPlayLength;
}
- }
+ //课程进度
+ classDetailVO.setClassProcess(i + "/" + vodDictDOS.size());
- if (classDetailDTO.getFlag()) {
- CourseDictDO courseDictDO = courseDictMapper.selectById(classDictDO.getCourseId());
- String studyDate = classDictDO.getStartDate() + " 至 " + classDictDO.getEndDate();
- ExcelUtil.writeMemberExcel(companyDictDO.getCompanyName(), studyDate, courseDictDO.getCourseName(), "授课记录汇总表", classDetailVOS, ExcelFormatUtils.memberList);
- }
- return classDetailVOS;
- }
+ //学生测试完成情况 多套卷子各返回最高成绩
+ List getMaxScoreVOS = exerciseDoneResultMapper.getMaxScore(classDictDO.getId(), classDetailVO.getId());
+ classDetailVO.setGetMaxScoreVOS(getMaxScoreVOS);
- public Future exportClassDetailTask(ClassDetailVO classDetailVO, List vodDictDOS, Long classId, Long memberId) {
+ Boolean flag = true;
- //该学生完成了多少个
- int i = 0;
- int playLength = 0;
- //该成员完成了几个视频
- for (VodDictDO vodDictDO : vodDictDOS) {
- List vodPlayHistoryDOS = vodPlayHistoryMapper.selectList(new QueryWrapper()
- .lambda()
- .eq(VodPlayHistoryDO::getMemberId, memberId)
- .eq(VodPlayHistoryDO::getVodId, vodDictDO.getId())
- .orderByDesc(VodPlayHistoryDO::getPlayRecord));
+ StringBuilder stringBuilder = new StringBuilder();
- if (vodPlayHistoryDOS.size() > 0) {
- if (vodPlayHistoryDOS.get(0).getPlayRecord() > vodDictDO.getVodLength() * 0.8) {
- i++;
+ if (getMaxScoreVOS.size() > 0) {
+ for (GetMaxScoreVO getMaxScoreVO : getMaxScoreVOS) {
+ stringBuilder.append(getMaxScoreVO.getPaperName() + ":" + getMaxScoreVO.getScore());
+ if (getMaxScoreVO.getScore() < 60) {
+ flag = false;
+ }
+ stringBuilder.append(" ");
}
- }
-
- for (VodPlayHistoryDO vodPlayHistoryDO : vodPlayHistoryDOS) {
- playLength += vodPlayHistoryDO.getPlayLength();
+ } else {
+ flag = false;
}
- }
- //classDetailVO.setStudyVodCounts(i);
- classDetailVO.setClassProcess(i + "/" + vodDictDOS.size());
- //学生测试完成情况 多套卷子各返回最高成绩
- List getMaxScoreVOS = exerciseDoneResultMapper.getMaxScore(classId, classDetailVO.getId());
- classDetailVO.setGetMaxScoreVOS(getMaxScoreVOS);
+ //总评价
+ classDetailVO.setResult(flag && i == vodDictDOS.size() ? "合格" : "不合格");
- Boolean flag = true;
+ classDetailVO.setScore(stringBuilder.toString());
- StringBuilder stringBuilder = new StringBuilder();
+ //培训时长
+ classDetailVO.setTrainingLengthStr(MathUtil.secToTime(playLength));
- if (getMaxScoreVOS.size() > 0) {
- for (GetMaxScoreVO getMaxScoreVO : getMaxScoreVOS) {
- stringBuilder.append(getMaxScoreVO.getPaperName() + ":" + getMaxScoreVO.getScore());
- if (getMaxScoreVO.getScore() < 60) {
- flag = false;
- }
- stringBuilder.append(" ");
- }
+ //答疑
+ Integer count = answeringQuestionMapper.selectCount(new QueryWrapper()
+ .lambda()
+ .eq(AnsweringQuestionDO::getAskId, classDetailVO.getId())
+ .eq(AnsweringQuestionDO::getClassId, classDetailDTO.getId()));
+ classDetailVO.setAskCounts(count);
- } else {
- flag = false;
- }
+ //签到次数
+ long set = redisUtil.scan(RedisPrefixConstant.SUBSIDY_SIGN_INFO_PREFIX + "memberId:" + classDetailVO.getId() + ":classId:" + classDetailDTO.getId() + "*").stream().count();
+ classDetailVO.setSignCounts(set);
- if (flag && i == vodDictDOS.size()) {
- classDetailVO.setResult("合格");
- } else {
- classDetailVO.setResult("不合格");
}
- classDetailVO.setScore(stringBuilder.toString());
-
- //培训时长
- classDetailVO.setTrainingLength(playLength);
- classDetailVO.setTrainingLengthStr(MathUtil.secToTime(playLength));
- return new AsyncResult(classDetailVO);
+ if (classDetailDTO.getFlag()) {
+ CourseDictDO courseDictDO = courseDictMapper.selectById(classDictDO.getCourseId());
+ String studyDate = classDictDO.getStartDate() + " 至 " + classDictDO.getEndDate();
+ ExcelUtil.writeMemberExcel(companyDictDO.getCompanyName(), studyDate, courseDictDO.getCourseName(), "授课记录汇总表", classDetailVOS, ExcelFormatUtils.memberList);
+ }
+ return classDetailVOS;
}
public IPage signDetail(ClassDetailDTO classDetailDTO) {
@@ -729,83 +602,45 @@ public class AdministerServiceImpl extends ServiceImpl //全部视频数
- classSignVO.setAllVodCounts(vodDictDOS.size()));
- newCachedThreadPool.execute(() -> //完成率,完成情况
- signDetailsTask1(vodDictDOS, classSignVO));
- newCachedThreadPool.execute(() -> //签到,签到时间
- signDetailsTask2(classSignVO, classDetailDTO));
-
- //执行后不再接收新任务,如果里面有任务,就执行完
- newCachedThreadPool.shutdown();
- try {
- while (true) {
- //等待所有任务都结束了继续执行
- if (newCachedThreadPool.isTerminated()) {
- break;
- }
+ //该学生完成了多少个
+ int i = 0;
+ int playLength = 0;
+ //该成员完成了几个视频
+ for (VodDictDO vodDictDO : vodDictDOS) {
+ int totalPlayLength = vodPlayHistoryMapper.memberVodTotalLength(classSignVO.getId(), vodDictDO.getId());
+ if (totalPlayLength >= vodDictDO.getVodLength()) {
+ i++;
}
-
- } catch (Exception ex) {
- ex.printStackTrace();
+ playLength += totalPlayLength;
}
- }
- classSignVOIPage.setRecords(classSignVOS);
- return classSignVOIPage;
- }
+ //课程进度
+ classSignVO.setClassProcess(i + "/" + vodDictDOS.size());
- public Future signDetailsTask1(List vodDictDOS, ClassSignVO classSignVO) {
+ //完成率
+ String percent = MathUtil.getPercentAvgIndexWithPercent(new BigDecimal(i), new BigDecimal(vodDictDOS.size()));
+ classSignVO.setPercent(percent);
- //该学生完成了多少个
- int i = 0;
- int playLength = 0;
- //该成员完成了几个视频
- for (VodDictDO vodDictDO : vodDictDOS) {
- List vodPlayHistoryDOS = vodPlayHistoryMapper.selectList(new QueryWrapper()
- .lambda()
- .eq(VodPlayHistoryDO::getMemberId, classSignVO.getId())
- .eq(VodPlayHistoryDO::getVodId, vodDictDO.getId())
- .orderByDesc(VodPlayHistoryDO::getPlayRecord));
+ //培训时长
+ classSignVO.setTrainingLength(playLength);
+ classSignVO.setTrainingLengthStr(MathUtil.secToTime(playLength));
- if (vodPlayHistoryDOS.size() > 0) {
- if (vodPlayHistoryDOS.get(0).getPlayRecord() > vodDictDO.getVodLength() * 0.8) {
- i++;
- }
+ //签到
+ Set set = redisUtil.scan(RedisPrefixConstant.SUBSIDY_SIGN_INFO_PREFIX + "memberId:" + classSignVO.getId() + ":classId:" + classDetailDTO.getId() + "*");
+ classSignVO.setSignCounts(set.size());
+
+ StringBuilder stringBuilder = new StringBuilder();
+ //签到时间
+ for (SignInRecordDO signInRecordDO : set) {
+ stringBuilder.append(signInRecordDO.getSignInDate().toString().replace("T", " ")).append(";");
}
- for (VodPlayHistoryDO vodPlayHistoryDO : vodPlayHistoryDOS) {
- playLength += vodPlayHistoryDO.getPlayLength();
+ if (StringUtils.isNotBlank(stringBuilder.toString())) {
+ String signInDate = stringBuilder.toString().substring(0, stringBuilder.length() - 1);
+ classSignVO.setSignInDateList(signInDate);
}
- }
- classSignVO.setStudyVodCounts(i);
- classSignVO.setClassProcess(i + "/" + vodDictDOS.size());
-
- //完成率
- String percent = MathUtil.getPercentAvgIndexWithPercent(new BigDecimal(i), new BigDecimal(vodDictDOS.size()));
- classSignVO.setPercent(percent);
- //培训时长
- classSignVO.setTrainingLength(playLength);
- classSignVO.setTrainingLengthStr(MathUtil.secToTime(playLength));
- return new AsyncResult<>(classSignVO);
- }
-
- public Future signDetailsTask2(ClassSignVO classSignVO, ClassDetailDTO classDetailDTO) {
- //签到
- Set set = redisUtil.scan(RedisPrefixConstant.SUBSIDY_SIGN_INFO_PREFIX + "memberId_" + classSignVO.getId() + "_classId_" + classDetailDTO.getId() + "*");
- classSignVO.setSignCounts(set.size());
- StringBuilder stringBuilder = new StringBuilder();
- //签到时间
- for (SignInRecordDO signInRecordDO : set) {
- stringBuilder.append(signInRecordDO.getSignInDate().toString().replace("T", " ")).append(";");
}
- if (StringUtils.isNotBlank(stringBuilder.toString())) {
- String signInDate = stringBuilder.toString().substring(0, stringBuilder.length() - 1);
- classSignVO.setSignInDateList(signInDate);
- }
- return new AsyncResult<>(classSignVO);
+ classSignVOIPage.setRecords(classSignVOS);
+ return classSignVOIPage;
}
public List exportSignDetail(ClassDetailDTO classDetailDTO) throws Exception {
@@ -819,29 +654,40 @@ public class AdministerServiceImpl extends ServiceImpl //全部视频数
- classSignVO.setAllVodCounts(vodDictDOS.size()));
- newCachedThreadPool.execute(() -> //完成率,完成情况
- signDetailsTask1(vodDictDOS, classSignVO));
- newCachedThreadPool.execute(() -> //签到,签到时间
- signDetailsTask2(classSignVO, classDetailDTO));
-
- //执行后不再接收新任务,如果里面有任务,就执行完
- newCachedThreadPool.shutdown();
- try {
- while (true) {
- //等待所有任务都结束了继续执行
- if (newCachedThreadPool.isTerminated()) {
- break;
- }
+ //该学生完成了多少个
+ int i = 0;
+ int playLength = 0;
+ //该成员完成了几个视频
+ for (VodDictDO vodDictDO : vodDictDOS) {
+ int totalPlayLength = vodPlayHistoryMapper.memberVodTotalLength(classSignVO.getId(), vodDictDO.getId());
+ if (totalPlayLength >= vodDictDO.getVodLength()) {
+ i++;
}
+ playLength += totalPlayLength;
+ }
+ classSignVO.setClassProcess(i + "/" + vodDictDOS.size());
- } catch (Exception ex) {
- ex.printStackTrace();
+ //完成率
+ String percent = MathUtil.getPercentAvgIndexWithPercent(new BigDecimal(i), new BigDecimal(vodDictDOS.size()));
+ classSignVO.setPercent(percent);
+
+ //培训时长
+ classSignVO.setTrainingLengthStr(MathUtil.secToTime(playLength));
+
+ //签到
+ Set set = redisUtil.scan(RedisPrefixConstant.SUBSIDY_SIGN_INFO_PREFIX + "memberId:" + classSignVO.getId() + ":classId:" + classDetailDTO.getId() + "*");
+ classSignVO.setSignCounts(set.size());
+
+ StringBuilder stringBuilder = new StringBuilder();
+ //签到时间
+ for (SignInRecordDO signInRecordDO : set) {
+ stringBuilder.append(signInRecordDO.getSignInDate().toString().replace("T", " ")).append(";");
}
+ if (StringUtils.isNotBlank(stringBuilder.toString())) {
+ String signInDate = stringBuilder.toString().substring(0, stringBuilder.length() - 1);
+ classSignVO.setSignInDateList(signInDate);
+ }
+
}
if (classDetailDTO.getFlag()) {
@@ -862,47 +708,26 @@ public class AdministerServiceImpl extends ServiceImpl exerciseTestVOIPage = this.baseMapper.exerciseTest(pager, classDetailDTO.getId(), classDetailDTO.getUserName());
List classSignVOS = exerciseTestVOIPage.getRecords();
- ExecutorService newCachedThreadPool = Executors.newCachedThreadPool();
-
for (ExerciseTestVO exerciseTestVO : classSignVOS) {
- newCachedThreadPool.execute(() -> //签到,签到时间
- exerciseTestTask(exerciseTestVO, classDetailDTO.getId(), exerciseTestVO.getPaperId()));
- }
- //执行后不再接收新任务,如果里面有任务,就执行完
- newCachedThreadPool.shutdown();
- try {
- while (true) {
- //等待所有任务都结束了继续执行
- if (newCachedThreadPool.isTerminated()) {
- break;
- }
+ //学生测试完成情况
+ TestScoreInfoVO testScoreInfoVO = exerciseDoneResultMapper.testScoreInfo(classDetailDTO.getPaperId(), exerciseTestVO.getId());
+ exerciseTestVO.setPaperId(exerciseTestVO.getPaperId());
+ if (null != testScoreInfoVO) {
+ exerciseTestVO.setScore(testScoreInfoVO.getScore());
+ exerciseTestVO.setResult(testScoreInfoVO.getResult());
+ //测评次数
+ exerciseTestVO.setCount(testScoreInfoVO.getCnt());
+ } else {
+ exerciseTestVO.setScore(0);
+ exerciseTestVO.setResult("不合格");
+ exerciseTestVO.setCount(0);
}
-
- } catch (Exception ex) {
- ex.printStackTrace();
}
+
exerciseTestVOIPage.setRecords(classSignVOS);
return exerciseTestVOIPage;
}
- public void exerciseTestTask(ExerciseTestVO exerciseTestVO, Long classId, Long paperId) {
- //学生测试完成情况
- List exerciseDoneResultDOs = exerciseDoneResultMapper.queryExerciseDoneResult(exerciseTestVO.getId(), classId, paperId);
-
- exerciseTestVO.setPaperId(exerciseTestVO.getPaperId());
- if (exerciseDoneResultDOs.size() > 0) {
- exerciseTestVO.setScore(exerciseDoneResultDOs.get(0).getScore());
- exerciseTestVO.setResult(exerciseDoneResultDOs.get(0).getResult());
- //测评次数
- exerciseTestVO.setCount(exerciseDoneResultDOs.size());
- } else {
- exerciseTestVO.setScore(0);
- exerciseTestVO.setResult("不合格");
- exerciseTestVO.setCount(0);
- }
-
- }
-
public List exportExerciseTest(ClassDetailDTO classDetailDTO) throws Exception {
Page pager = new Page(0, -1L);
@@ -912,24 +737,20 @@ public class AdministerServiceImpl extends ServiceImpl //签到,签到时间
- exerciseTestTask(exerciseTestVO, classDetailDTO.getId(), exerciseTestVO.getPaperId()));
- }
- //执行后不再接收新任务,如果里面有任务,就执行完
- newCachedThreadPool.shutdown();
- try {
- while (true) {
- //等待所有任务都结束了继续执行
- if (newCachedThreadPool.isTerminated()) {
- break;
- }
+ //学生测试完成情况
+ TestScoreInfoVO testScoreInfoVO = exerciseDoneResultMapper.testScoreInfo(classDetailDTO.getPaperId(), exerciseTestVO.getId());
+ exerciseTestVO.setPaperId(exerciseTestVO.getPaperId());
+ if (null != testScoreInfoVO) {
+ exerciseTestVO.setScore(testScoreInfoVO.getScore());
+ exerciseTestVO.setResult(testScoreInfoVO.getResult());
+ //测评次数
+ exerciseTestVO.setCount(testScoreInfoVO.getCnt());
+ } else {
+ exerciseTestVO.setScore(0);
+ exerciseTestVO.setResult("不合格");
+ exerciseTestVO.setCount(0);
}
- } catch (Exception ex) {
- ex.printStackTrace();
}
if (classDetailDTO.getFlag()) {
@@ -976,6 +797,7 @@ public class AdministerServiceImpl extends ServiceImpl memberIds = classMemberMappingMapper.getClassMembers(classVodInfoDTO.getClassId());
+ //获取课程下的视频
List vodDictDOS = vodDictMapper.getCourseVods(classVodInfoDTO.getCourseId(), classVodInfoDTO.getVodName());
for (VodDictDO vodDictDO : vodDictDOS) {
//获取这个视频的学习人数和平均学习时长
@@ -1007,14 +829,17 @@ public class AdministerServiceImpl extends ServiceImpl dayInfoItemVOS = new ArrayList<>();
+ int total = 0;
for (GetMemberStudyInfoVO getMemberStudyInfoVO : getMemberStudyInfoVOS) {
if (classDailyInfoVO.getId().equals(getMemberStudyInfoVO.getMemberId())) {
DayInfoItemVO dayInfoItemVO = new DayInfoItemVO();
dayInfoItemVO.setStudyDate(getMemberStudyInfoVO.getStudyDate());
dayInfoItemVO.setTotalLength(getMemberStudyInfoVO.getPlayLength());
+ total += getMemberStudyInfoVO.getPlayLength();
dayInfoItemVOS.add(dayInfoItemVO);
}
}
+ classDailyInfoVO.setTotal(total);
classDailyInfoVO.setDayInfoItemVOS(dayInfoItemVOS);
}
return classDailyInfoVOIPage;
@@ -1027,6 +852,7 @@ public class AdministerServiceImpl extends ServiceImpl title = new ArrayList<>();
title.add("姓名");
title.addAll(findDaysStr(classDailyInfoDTO.getStartDate(), classDailyInfoDTO.getEndDate()));
+ title.add("合计总时长");
//获取班级成员
IPage classDailyInfoVOIPage = classMemberMappingMapper.getClassMembersWithName(pager, classDailyInfoDTO.getClassId(), classDailyInfoDTO.getUserName());
@@ -1095,16 +921,21 @@ public class AdministerServiceImpl extends ServiceImpl hashMap1 = hashMap.get(data);
Cell namecell = r.createCell(a.getAndIncrement());
namecell.setCellValue(memberMapper.selectById(data).getUserName());
- dates.forEach(field -> {
- if (!field.equals("姓名")) {
+ int total = 0 ;
+ for (String date : dates){
+ if (!date.equals("姓名")&&!"合计总时长".equals(date)) {
Cell cell1 = r.createCell(a.getAndIncrement());
if (null != hashMap1) {
- cell1.setCellValue(null == hashMap1.get(field) ? "00:00:00" : MathUtil.secToTime(hashMap1.get(field)));
+ total += null == hashMap1.get(date)?0:hashMap1.get(date);
+ cell1.setCellValue(null == hashMap1.get(date) ? "00:00:00" : MathUtil.secToTime(hashMap1.get(date)));
} else {
cell1.setCellValue("00:00:00");
}
}
- });
+ }
+
+ Cell totalCell = r.createCell(a.getAndIncrement());
+ totalCell.setCellValue(MathUtil.secToTime(total));
});
}
String fileName = String.valueOf(new Date().getTime());
@@ -1916,11 +1747,7 @@ public class AdministerServiceImpl extends ServiceImpl= 60) {
- newCell.setCellValue("合格");
- } else {
- newCell.setCellValue("不合格");
- }
+ newCell.setCellValue(exerciseTestVO.getScore() >= 60 ? "合格" : "不合格");
rowIndex++;
seq++;
diff --git a/src/main/java/com/subsidy/service/impl/AnsweringQuestionServiceImpl.java b/src/main/java/com/subsidy/service/impl/AnsweringQuestionServiceImpl.java
index f9e74e7..3eaba90 100644
--- a/src/main/java/com/subsidy/service/impl/AnsweringQuestionServiceImpl.java
+++ b/src/main/java/com/subsidy/service/impl/AnsweringQuestionServiceImpl.java
@@ -29,19 +29,16 @@ public class AnsweringQuestionServiceImpl extends ServiceImpl
}
}
-
- @Async
public String addCategory(CategoryDO categoryDO) {
- int count = 0;
+ int count;
if (null == categoryDO.getCompanyId()) {
count = this.baseMapper.selectCount(new QueryWrapper()
@@ -82,20 +80,20 @@ public class CategoryServiceImpl extends ServiceImpl
return ConstantUtils.ADD_SUCCESS;
}
- @Async
public String deleteCategory(CategoryDO categoryDO) {
this.baseMapper.deleteById(categoryDO.getId());
return ConstantUtils.DELETE_SUCCESS;
}
- @Async
public String updateCategory(CategoryDO categoryDO) {
int count = this.baseMapper.selectCount(new QueryWrapper()
.lambda()
- .eq(CategoryDO::getName, categoryDO.getName()));
+ .eq(CategoryDO::getName, categoryDO.getName())
+ .eq(CategoryDO::getCompanyId, categoryDO.getCompanyId())
+ .ne(CategoryDO::getId, categoryDO.getId()));
- if (count > 2) {
+ if (count > 0) {
throw new HttpException(90001);
}
diff --git a/src/main/java/com/subsidy/service/impl/ClassDictServiceImpl.java b/src/main/java/com/subsidy/service/impl/ClassDictServiceImpl.java
index 7d571c1..b1caad6 100644
--- a/src/main/java/com/subsidy/service/impl/ClassDictServiceImpl.java
+++ b/src/main/java/com/subsidy/service/impl/ClassDictServiceImpl.java
@@ -57,7 +57,6 @@ public class ClassDictServiceImpl extends ServiceImpl0){
- classDictDO.setClassType("平台支持");
- }else{
- classDictDO.setClassType("企业自建");
- }
+ classDictDO.setClassType(count>0?"平台支持":"企业自建");
this.baseMapper.insert(classDictDO);
return ConstantUtils.ADD_SUCCESS;
}
- @Async
public String updateClass(ClassDictDO classDictDO) {
this.baseMapper.updateById(classDictDO);
return ConstantUtils.SET_SUCCESS;
@@ -99,7 +92,6 @@ public class ClassDictServiceImpl extends ServiceImpl()
.lambda()
@@ -125,7 +117,6 @@ public class ClassDictServiceImpl extends ServiceImpl()
.lambda()
- .eq(RoleAdministerMappingDO::getAdministerId,operatorsDTO.getId())
- .eq(RoleAdministerMappingDO::getRoleId,1));
+ .eq(RoleAdministerMappingDO::getAdministerId, operatorsDTO.getId())
+ .eq(RoleAdministerMappingDO::getRoleId, 1));
- if (count > 0){
+ if (count > 0) {
+ //后台管理员
operatorsDTO.setId(null);
}
- return this.baseMapper.operators(pager, operatorsDTO.getCompanyName(), operatorsDTO.getId(),operatorsDTO.getUserName(),1);
+ return this.baseMapper.operators(pager, operatorsDTO.getCompanyName(), operatorsDTO.getId(), operatorsDTO.getUserName(), 1);
}
public String addOperator(AddCompanyDTO addCompanyDTO) {
@@ -75,16 +76,20 @@ public class CompanyDictServiceImpl extends ServiceImpl 0 ) {
+ throw new HttpException(20002);
+ }
+
Integer count1 = administerMapper.selectCount(new QueryWrapper()
- .lambda()
- .eq(AdministerDO::getAccountName, addCompanyDTO.getAccountName()));
+ .lambda()
+ .eq(AdministerDO::getAccountName, addCompanyDTO.getAccountName()));
- if (count > 0 || count1>0) {
+ if (count1 > 0) {
throw new HttpException(20002);
}
- CompanyDictDO companyDictDO =new CompanyDictDO();
- BeanUtils.copyProperties(addCompanyDTO,companyDictDO);
+ CompanyDictDO companyDictDO = new CompanyDictDO();
+ BeanUtils.copyProperties(addCompanyDTO, companyDictDO);
this.baseMapper.insert(companyDictDO);
AdministerDO administerDO = new AdministerDO();
@@ -108,7 +113,6 @@ public class CompanyDictServiceImpl extends ServiceImpl()
- .lambda()
- .eq(AdministerDO::getCompanyId,companyDictDO.getId()));
+ .lambda()
+ .eq(AdministerDO::getCompanyId, companyDictDO.getId()));
+ redisUtil.del(RedisPrefixConstant.SUBSIDY_SETTINGS_PREFIX+companyDictDO.getId());
return ConstantUtils.DELETE_SUCCESS;
}
- @Async
public String updateAdminister(AddCompanyDTO addCompanyDTO) {
CompanyDictDO companyDictDO = new CompanyDictDO();
- BeanUtils.copyProperties(addCompanyDTO,companyDictDO);
+ BeanUtils.copyProperties(addCompanyDTO, companyDictDO);
this.baseMapper.updateById(companyDictDO);
//查找企业管理员
AdministerDO administerDO = administerMapper.selectOne(new QueryWrapper()
- .lambda()
- .eq(AdministerDO::getCompanyId,addCompanyDTO.getId())
- .eq(AdministerDO::getRole,1));
- if (StringUtils.isNotBlank(addCompanyDTO.getAccountName())){
+ .lambda()
+ .eq(AdministerDO::getCompanyId, addCompanyDTO.getId())
+ .eq(AdministerDO::getRole, 1));
+ if (StringUtils.isNotBlank(addCompanyDTO.getAccountName())) {
administerDO.setAccountName(addCompanyDTO.getAccountName());
}
- if (StringUtils.isBlank(addCompanyDTO.getPassword())){
+ if (StringUtils.isBlank(addCompanyDTO.getPassword())) {
addCompanyDTO.setPassword(addCompanyDTO.getPassword());
}
administerMapper.updateById(administerDO);
return ConstantUtils.SET_SUCCESS;
}
- public List getAllCompany(CompanyDictDO companyDictDO){
+ public List getAllCompany(CompanyDictDO companyDictDO) {
return this.baseMapper.getAllCompany(companyDictDO);
}
diff --git a/src/main/java/com/subsidy/service/impl/CourseContentServiceImpl.java b/src/main/java/com/subsidy/service/impl/CourseContentServiceImpl.java
index 04e572e..2673a5d 100644
--- a/src/main/java/com/subsidy/service/impl/CourseContentServiceImpl.java
+++ b/src/main/java/com/subsidy/service/impl/CourseContentServiceImpl.java
@@ -31,39 +31,34 @@ public class CourseContentServiceImpl extends ServiceImpl courseContentDOS = this.baseMapper.selectList(new QueryWrapper()
- .lambda()
- .eq(CourseContentDO::getCourseId,courseContentDO.getCourseId())
- .orderByDesc(CourseContentDO::getOrderNo));
+ Integer orderNoTmp = this.baseMapper.selectMaxOrderNo(courseContentDO.getCourseId());
int orderNo = 1 ;
- if (courseContentDOS.size()>0){
- orderNo = courseContentDOS.get(0).getOrderNo()+1;
+ if (null!=orderNoTmp){
+ orderNo = orderNoTmp+1;
}
courseContentDO.setOrderNo(orderNo);
this.baseMapper.insert(courseContentDO);
return ConstantUtils.ADD_SUCCESS;
}
- @Async
public String updateContent(CourseContentDO courseContentDO){
- List courseContentDOS = this.baseMapper.selectList(new QueryWrapper()
+ int count = this.baseMapper.selectCount(new QueryWrapper()
.lambda()
.eq(CourseContentDO::getCourseId,courseContentDO.getCourseId())
- .eq(CourseContentDO::getContent,courseContentDO.getContent()));
+ .eq(CourseContentDO::getContent,courseContentDO.getContent())
+ .ne(CourseContentDO::getId,courseContentDO.getId()));
- if (courseContentDOS.size()>0){
+ if (count>0){
throw new HttpException(40001);
}
this.baseMapper.updateById(courseContentDO);
diff --git a/src/main/java/com/subsidy/service/impl/CourseDictServiceImpl.java b/src/main/java/com/subsidy/service/impl/CourseDictServiceImpl.java
index ac33235..f90c7fd 100644
--- a/src/main/java/com/subsidy/service/impl/CourseDictServiceImpl.java
+++ b/src/main/java/com/subsidy/service/impl/CourseDictServiceImpl.java
@@ -30,10 +30,9 @@ public class CourseDictServiceImpl extends ServiceImpl()
@@ -56,7 +55,6 @@ public class CourseDictServiceImpl extends ServiceImpl 0){
+ //后台管理员
queryCoursesDTO.setCompanyId(null);
}
@@ -80,7 +79,7 @@ public class CourseDictServiceImpl extends ServiceImpl()
diff --git a/src/main/java/com/subsidy/service/impl/ExerciseDictServiceImpl.java b/src/main/java/com/subsidy/service/impl/ExerciseDictServiceImpl.java
index 044cb5e..a04de54 100644
--- a/src/main/java/com/subsidy/service/impl/ExerciseDictServiceImpl.java
+++ b/src/main/java/com/subsidy/service/impl/ExerciseDictServiceImpl.java
@@ -1,32 +1,25 @@
package com.subsidy.service.impl;
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import com.subsidy.dto.exercise.GetAllExercisesDTO;
import com.subsidy.dto.exercise.GetPaperExerciseDTO;
import com.subsidy.dto.exercise.SubmitDTO;
import com.subsidy.mapper.ExerciseDictMapper;
import com.subsidy.mapper.ExerciseDoneHistoryMapper;
import com.subsidy.mapper.ExerciseDoneResultMapper;
-import com.subsidy.model.CourseDictDO;
import com.subsidy.model.ExerciseDictDO;
import com.subsidy.model.ExerciseDoneHistoryDO;
import com.subsidy.model.ExerciseDoneResultDO;
import com.subsidy.service.ExerciseDictService;
import com.subsidy.util.ConstantUtils;
import com.subsidy.util.MathUtil;
-import com.subsidy.vo.course.ExerciseVO;
import com.subsidy.vo.exercise.GetPaperExerciseVO;
import com.subsidy.vo.exercise.MemberExerciseVO;
-import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
-import java.util.ArrayList;
import java.util.List;
/**
@@ -46,67 +39,31 @@ public class ExerciseDictServiceImpl extends ServiceImpl getAllExercises(GetAllExercisesDTO getAllExercisesDTO) {
-
- Page pager = new Page(getAllExercisesDTO.getPageNum(), getAllExercisesDTO.getPageSize());
-
- return this.baseMapper.selectPage(pager, new QueryWrapper()
- .lambda()
- .eq(ExerciseDictDO::getCourseId, getAllExercisesDTO.getCourseId())
- .like(ExerciseDictDO::getDifficulty, getAllExercisesDTO.getDifficulty())
- .like(ExerciseDictDO::getExerciseType, getAllExercisesDTO.getExerciseType())
- .like(ExerciseDictDO::getTitle, getAllExercisesDTO.getTitle())
- .orderByAsc(ExerciseDictDO::getOrderNo));
- }
-
- @Async
public String addExercise(ExerciseDictDO exerciseDictDO){
- List exerciseDictDOS = this.baseMapper.selectList(new QueryWrapper()
- .lambda()
- .eq(ExerciseDictDO::getCourseId,exerciseDictDO.getCourseId())
- .orderByDesc(ExerciseDictDO::getOrderNo));
+ Integer orderNoTmp = this.baseMapper.getMaximumNo(exerciseDictDO.getPaperId());
int orderNo = 1;
- if (exerciseDictDOS.size() > 0) {
- orderNo = exerciseDictDOS.get(0).getOrderNo() + 1;
+ if (null!= orderNoTmp) {
+ orderNo = orderNoTmp + 1;
}
exerciseDictDO.setOrderNo(orderNo);
this.baseMapper.insert(exerciseDictDO);
return ConstantUtils.ADD_SUCCESS;
}
- @Async
public String deleteExercise(ExerciseDictDO exerciseDictDO) {
this.baseMapper.deleteById(exerciseDictDO.getId());
return ConstantUtils.DELETE_SUCCESS;
}
- @Async
public String updateExercise(ExerciseDictDO exerciseDictDO) {
this.baseMapper.updateById(exerciseDictDO);
return ConstantUtils.SET_SUCCESS;
}
- public List getCourseExercises(CourseDictDO courseDictDO) {
-
- List exerciseVOS = new ArrayList<>();
-
- List exerciseDictDOS = this.baseMapper.selectList(new QueryWrapper()
- .lambda()
- .eq(ExerciseDictDO::getCourseId, courseDictDO.getId()));
-
- for (ExerciseDictDO exerciseDictDO : exerciseDictDOS) {
- ExerciseVO exerciseVO = new ExerciseVO();
- BeanUtils.copyProperties(exerciseDictDO, exerciseVO);
- exerciseVOS.add(exerciseVO);
- }
- return exerciseVOS;
- }
-
@Transactional(rollbackFor = Exception.class)
- @Async
public Long submit(SubmitDTO submitDTO) {
ExerciseDoneResultDO exerciseDoneResultDO = new ExerciseDoneResultDO();
@@ -134,11 +91,7 @@ public class ExerciseDictServiceImpl extends ServiceImpl= 60) {
- exerciseDoneResultDO.setResult("合格");
- } else {
- exerciseDoneResultDO.setResult("不合格");
- }
+ exerciseDoneResultDO.setResult(score>=60?"合格":"不合格");
exerciseDoneResultMapper.insert(exerciseDoneResultDO);
diff --git a/src/main/java/com/subsidy/service/impl/ExerciseDoneResultServiceImpl.java b/src/main/java/com/subsidy/service/impl/ExerciseDoneResultServiceImpl.java
index b6cb20b..698d535 100644
--- a/src/main/java/com/subsidy/service/impl/ExerciseDoneResultServiceImpl.java
+++ b/src/main/java/com/subsidy/service/impl/ExerciseDoneResultServiceImpl.java
@@ -78,12 +78,6 @@ public class ExerciseDoneResultServiceImpl extends ServiceImpl implements FileDictService {
public List getContendFiles(FileDictDO fileDictDO) {
- return this.baseMapper.selectList(new QueryWrapper()
- .lambda()
- .eq(FileDictDO::getContentId,fileDictDO.getContentId())
- .like(FileDictDO::getFileName,fileDictDO.getFileName()));
+ return this.baseMapper.selectFiles(fileDictDO.getContentId(),fileDictDO.getFileName());
}
- @Async
public String deleteFile(FileDictDO fileDictDO) {
this.baseMapper.deleteById(fileDictDO.getId());
return ConstantUtils.DELETE_SUCCESS;
}
- @Async
public String addFile(FileDictDO fileDictDO) {
this.baseMapper.insert(fileDictDO);
return ConstantUtils.ADD_SUCCESS;
}
- @Async
public String updateFile(FileDictDO fileDictDO) {
this.baseMapper.updateById(fileDictDO);
return ConstantUtils.SET_SUCCESS;
diff --git a/src/main/java/com/subsidy/service/impl/MemberServiceImpl.java b/src/main/java/com/subsidy/service/impl/MemberServiceImpl.java
index 123bd09..3e13508 100644
--- a/src/main/java/com/subsidy/service/impl/MemberServiceImpl.java
+++ b/src/main/java/com/subsidy/service/impl/MemberServiceImpl.java
@@ -37,6 +37,7 @@ import com.subsidy.model.VodDictDO;
import com.subsidy.model.VodPlayHistoryDO;
import com.subsidy.service.MemberService;
import com.subsidy.util.ConstantUtils;
+import com.subsidy.util.DateFormatUtil;
import com.subsidy.util.RedisUtil;
import com.subsidy.vo.administer.UserRoleVO;
import com.subsidy.vo.member.ContentFilesVO;
@@ -50,6 +51,7 @@ import com.subsidy.vo.member.StudyPageVO;
import com.subsidy.vo.paper.QueryPapersVO;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.scheduling.annotation.Async;
import org.springframework.scheduling.annotation.AsyncResult;
import org.springframework.stereotype.Service;
@@ -58,6 +60,7 @@ import org.springframework.transaction.annotation.Transactional;
import java.time.Duration;
import java.time.LocalDateTime;
import java.util.ArrayList;
+import java.util.Date;
import java.util.List;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
@@ -104,6 +107,9 @@ public class MemberServiceImpl extends ServiceImpl imple
@Autowired
private RedisUtil redisUtil;
+ @Autowired
+ private MongoTemplate mongoTemplate;
+
public IPage getAll(GetAllDTO getAllDTO) {
Page pager = new Page(getAllDTO.getPageNum(), getAllDTO.getPageSize());
IPage iPage = this.baseMapper.getMembers(pager, getAllDTO.getDepartmentId(), getAllDTO.getUserName(), getAllDTO.getStatus());
@@ -155,7 +161,7 @@ public class MemberServiceImpl extends ServiceImpl imple
//公司赋值
memberDO.setCompanyId(addMemberDTO.getCompanyId());
this.baseMapper.insert(memberDO);
- redisUtil.set(RedisPrefixConstant.SUBSIDY_COMPANY_MEMBER_PREFIX + memberDO.getCompanyId() + memberDO.getAccountName(), memberDO);
+ redisUtil.set(RedisPrefixConstant.SUBSIDY_COMPANY_MEMBER_PREFIX + memberDO.getCompanyId() + ":" + memberDO.getAccountName(), memberDO);
//部门
List longs = addMemberDTO.getDepartmentIds();
@@ -194,7 +200,7 @@ public class MemberServiceImpl extends ServiceImpl imple
MemberDO memberDO = new MemberDO();
BeanUtils.copyProperties(addMemberDTO, memberDO);
this.baseMapper.updateById(memberDO);
- redisUtil.set(RedisPrefixConstant.SUBSIDY_COMPANY_MEMBER_PREFIX + memberDO.getCompanyId() + memberDO.getAccountName(), memberDO);
+ redisUtil.set(RedisPrefixConstant.SUBSIDY_COMPANY_MEMBER_PREFIX + memberDO.getCompanyId() + ":" + memberDO.getAccountName(), memberDO);
if (null != addMemberDTO.getDepartmentIds()) {
memberDepartmentMappingMapper.delete(new QueryWrapper()
@@ -224,14 +230,15 @@ public class MemberServiceImpl extends ServiceImpl imple
throw new HttpException(10010);
}
- CompanyDictDO companyDictDO = companyDictMapper.selectById(memberDO.getCompanyId());
-
if ("冻结".equals(memberDO.getStatus())) {
OprMemDictDO oprMemDictDO = new OprMemDictDO();
oprMemDictDO.setUserId(memberDO.getId());
oprMemDictDO.setOprType("登录");
oprMemDictDO.setResult(0);
- redisUtil.set(RedisPrefixConstant.SUBSIDY_MEMBER_LOGIN_PREFIX + memberDO.getId() + "_" + memberDO.getUserName() + "_" + companyDictDO.getCompanyName() + "_" + LocalDateTime.now(), oprMemDictDO);
+ oprMemDictDO.setCreateDate(System.currentTimeMillis()+"");
+ oprMemDictDO.setLoginDateFormat(DateFormatUtil.format(new Date(), "yyyyMMdd"));
+ mongoTemplate.insert(oprMemDictDO);
+ //redisUtil.set(RedisPrefixConstant.SUBSIDY_MEMBER_LOGIN_PREFIX + memberDO.getId() + ":" + memberDO.getUserName() + ":" + companyDictDO.getCompanyName() + ":" + LocalDateTime.now(), oprMemDictDO);
throw new HttpException(10013);
}
@@ -239,7 +246,7 @@ public class MemberServiceImpl extends ServiceImpl imple
if (0 == memberDO.getFirstLogin()) {
memberDO.setFirstLogin(1);
this.baseMapper.updateById(memberDO);
- redisUtil.set(RedisPrefixConstant.SUBSIDY_COMPANY_MEMBER_PREFIX + memberDO.getCompanyId() + "_" + memberDO.getAccountName(), memberDO);
+ redisUtil.set(RedisPrefixConstant.SUBSIDY_COMPANY_MEMBER_PREFIX + memberDO.getCompanyId() + ":" + memberDO.getAccountName(), memberDO);
}
BeanUtils.copyProperties(memberDO, userRoleVO);
@@ -250,17 +257,21 @@ public class MemberServiceImpl extends ServiceImpl imple
oprMemDictDO.setUserId(memberDO.getId());
oprMemDictDO.setOprType("登录");
oprMemDictDO.setResult(0);
- oprMemDictDO.setCreateDate(LocalDateTime.now());
- redisUtil.set(RedisPrefixConstant.SUBSIDY_MEMBER_LOGIN_PREFIX + memberDO.getId() + LocalDateTime.now(), oprMemDictDO);
+ oprMemDictDO.setCreateDate(System.currentTimeMillis()+"");
+ oprMemDictDO.setLoginDateFormat(DateFormatUtil.format(new Date(), "yyyyMMdd"));
+ mongoTemplate.insert(oprMemDictDO);
+ //redisUtil.set(RedisPrefixConstant.SUBSIDY_MEMBER_LOGIN_PREFIX + memberDO.getId() + ":" + LocalDateTime.now(), oprMemDictDO);
throw new HttpException(70010);
}
+ //审计日志
OprMemDictDO oprMemDictDO = new OprMemDictDO();
oprMemDictDO.setUserId(memberDO.getId());
oprMemDictDO.setOprType("登录");
oprMemDictDO.setResult(1);
- //审计日志
- redisUtil.set(RedisPrefixConstant.SUBSIDY_MEMBER_LOGIN_PREFIX + memberDO.getId() + LocalDateTime.now(), oprMemDictDO);
-
+ oprMemDictDO.setCreateDate(System.currentTimeMillis()+"");
+ oprMemDictDO.setLoginDateFormat(DateFormatUtil.format(new Date(), "yyyyMMdd"));
+ //redisUtil.set(RedisPrefixConstant.SUBSIDY_MEMBER_LOGIN_PREFIX + memberDO.getId() + ":" + LocalDateTime.now(), oprMemDictDO);
+ mongoTemplate.insert(oprMemDictDO);
return userRoleVO;
}
@@ -282,15 +293,17 @@ public class MemberServiceImpl extends ServiceImpl imple
}
}
- if (memberDO.getPassword().equals(passwordLoginDTO.getPassword()) && 1 == memberDO.getFirstLogin() && "冻结".equals(memberDO.getStatus())) {
+ if (memberDO.getPassword().equals(passwordLoginDTO.getPassword()) && 1 == memberDO.getFirstLogin() && !"冻结".equals(memberDO.getStatus())) {
MemberVO memberVO = new MemberVO();
BeanUtils.copyProperties(memberDO, memberVO);
OprMemDictDO oprMemDictDO = new OprMemDictDO();
oprMemDictDO.setUserId(memberDO.getId());
oprMemDictDO.setOprType("登录");
oprMemDictDO.setResult(1);
- oprMemDictDO.setCreateDate(LocalDateTime.now());
- redisUtil.set(RedisPrefixConstant.SUBSIDY_MEMBER_LOGIN_PREFIX + memberDO.getId() + "_" + System.currentTimeMillis(), 1);
+ oprMemDictDO.setCreateDate(System.currentTimeMillis()+"");
+ oprMemDictDO.setLoginDateFormat(DateFormatUtil.format(new Date(), "yyyyMMdd"));
+ mongoTemplate.insert(oprMemDictDO);
+ //redisUtil.set(RedisPrefixConstant.SUBSIDY_MEMBER_LOGIN_PREFIX + memberDO.getId() + ":" + System.currentTimeMillis(), 1);
return memberVO;
} else {
if (!memberDO.getPassword().equals(passwordLoginDTO.getPassword())) {
@@ -298,7 +311,10 @@ public class MemberServiceImpl extends ServiceImpl imple
oprMemDictDO.setUserId(memberDO.getId());
oprMemDictDO.setOprType("登录");
oprMemDictDO.setResult(0);
- redisUtil.set(RedisPrefixConstant.SUBSIDY_MEMBER_LOGIN_PREFIX + memberDO.getId() + LocalDateTime.now(), oprMemDictDO);
+ oprMemDictDO.setCreateDate(System.currentTimeMillis()+"");
+ oprMemDictDO.setLoginDateFormat(DateFormatUtil.format(new Date(), "yyyyMMdd"));
+ mongoTemplate.insert(oprMemDictDO);
+ //redisUtil.set(RedisPrefixConstant.SUBSIDY_MEMBER_LOGIN_PREFIX + memberDO.getId() + ":" + System.currentTimeMillis(), oprMemDictDO);
throw new HttpException(10016);
}
if (0 == memberDO.getFirstLogin()) {
@@ -306,8 +322,10 @@ public class MemberServiceImpl extends ServiceImpl imple
oprMemDictDO.setUserId(memberDO.getId());
oprMemDictDO.setOprType("登录");
oprMemDictDO.setResult(0);
- oprMemDictDO.setCreateDate(LocalDateTime.now());
- redisUtil.set(RedisPrefixConstant.SUBSIDY_MEMBER_LOGIN_PREFIX + memberDO.getId() + "_" + System.currentTimeMillis(), 0);
+ oprMemDictDO.setCreateDate(System.currentTimeMillis()+"");
+ oprMemDictDO.setLoginDateFormat(DateFormatUtil.format(new Date(), "yyyyMMdd"));
+ mongoTemplate.insert(oprMemDictDO);
+ //redisUtil.set(RedisPrefixConstant.SUBSIDY_MEMBER_LOGIN_PREFIX + memberDO.getId() + ":" + System.currentTimeMillis(), 0);
throw new HttpException(10015);
}
if ("冻结".equals(memberDO.getStatus())) {
@@ -332,7 +350,6 @@ public class MemberServiceImpl extends ServiceImpl imple
List studyPageVOS = this.baseMapper.studyPage(memberDO);
final ExecutorService newCachedThreadPool = Executors.newCachedThreadPool();
-
for (StudyPageVO studyPageVO : studyPageVOS) {
//查看课程下有几节课
List vodDictDOS = courseContentMapper.getCourseVods(studyPageVO.getId());
@@ -377,13 +394,13 @@ public class MemberServiceImpl extends ServiceImpl imple
for (CourseContentDO courseContentDO : courseContentDOS) {
ContentVodVO contentVodVO = new ContentVodVO();
contentVodVO.setContent(courseContentDO.getContent());
- contentVodVO.setMemberVodVOS(courseContentMapper.contentVodProcess(courseContentDO.getId(),contentVodDTO.getMemberId()));
+ contentVodVO.setMemberVodVOS(courseContentMapper.contentVodProcess(courseContentDO.getId(), contentVodDTO.getMemberId()));
contentVodVOS.add(contentVodVO);
}
contentVodNewVO.setContentVodVOS(contentVodVOS);
//最新的视频记录
- ContentVodNewVO contentVodNewVO1 = vodPlayHistoryMapper.memberRecentPlay(contentVodDTO.getClassId(),contentVodDTO.getMemberId());
+ ContentVodNewVO contentVodNewVO1 = vodPlayHistoryMapper.memberRecentPlay(contentVodDTO.getClassId(), contentVodDTO.getMemberId());
contentVodNewVO.setId(contentVodNewVO1.getId());
contentVodNewVO.setPlayRecord(contentVodNewVO.getPlayRecord());
return contentVodNewVO;
@@ -437,20 +454,15 @@ public class MemberServiceImpl extends ServiceImpl imple
Integer cnt = paperDictMapper.completeCount(queryPapersVO.getId());
queryPapersVO.setCompleteCnt(cnt);
//自己成绩
- List exerciseDoneResultDOS = exerciseDoneResultMapper.selectList(new QueryWrapper()
- .lambda()
- .eq(ExerciseDoneResultDO::getMemberId, memberId)
- .eq(ExerciseDoneResultDO::getPaperId, queryPapersVO.getId())
- .orderByDesc(ExerciseDoneResultDO::getScore));
-
- if (exerciseDoneResultDOS.size() > 0) {
- queryPapersVO.setRightCounts(exerciseDoneResultDOS.get(0).getRightCounts());
- queryPapersVO.setTotalCount(exerciseDoneResultDOS.get(0).getTotalCounts());
- queryPapersVO.setResult(exerciseDoneResultDOS.get(0).getResult());
+ ExerciseDoneResultDO exerciseDoneResultDO = exerciseDoneResultMapper.getMaxScorePaper(queryPapersVO.getId(),memberId);
+
+ if (null!=exerciseDoneResultDO) {
+ queryPapersVO.setRightCounts(exerciseDoneResultDO.getRightCounts());
+ queryPapersVO.setTotalCount(exerciseDoneResultDO.getTotalCounts());
+ queryPapersVO.setResult(exerciseDoneResultDO.getResult());
} else {
queryPapersVO.setResult("待完成");
}
-
//截止时间
queryPapersVO.setEndDate(classDictDO.getEndDate());
}
@@ -466,81 +478,36 @@ public class MemberServiceImpl extends ServiceImpl imple
GetStudyInfoVO getStudyInfoVO = new GetStudyInfoVO();
- MemberDO memberDO1 = this.baseMapper.selectById(memberDO.getId());
-
- final ExecutorService newCachedThreadPool = Executors.newCachedThreadPool();
-
- //多个任务
- newCachedThreadPool.execute(() ->
- getStudyInfoTask1(memberDO1.getId(), getStudyInfoVO));
- newCachedThreadPool.execute(() ->
- getStudyInfoTask2(memberDO1, getStudyInfoVO));
-
- //执行后不再接收新任务,如果里面有任务,就执行完
- newCachedThreadPool.shutdown();
- try {
- while (true) {
- //等待所有任务都结束了继续执行
- if (newCachedThreadPool.isTerminated()) {
- break;
- }
- }
-
- } catch (Exception ex) {
- ex.printStackTrace();
- }
- return getStudyInfoVO;
- }
-
- public Future getStudyInfoTask1(Long memberId, GetStudyInfoVO getStudyInfoVO) {
//已学课程
List classMemberMappingDOS = classMemberMappingMapper.selectList(new QueryWrapper()
.lambda()
- .eq(ClassMemberMappingDO::getMemberId, memberId));
+ .eq(ClassMemberMappingDO::getMemberId, memberDO.getId()));
/**
- * 遍历课程,里面的视频都看过80% 则表示已学完
+ * 遍历课程,累计学习时长超过视频时长 则表示已学完
*/
int i = 0; //已学课程
for (ClassMemberMappingDO classMemberMappingDO : classMemberMappingDOS) {
List vodDictDOS = classDictMapper.getClassVods(classMemberMappingDO.getClassId());
for (VodDictDO vodDictDO : vodDictDOS) {
- List vodPlayHistoryDOS = vodPlayHistoryMapper.selectList(new QueryWrapper()
- .lambda()
- .eq(VodPlayHistoryDO::getMemberId, memberId)
- .eq(VodPlayHistoryDO::getVodId, vodDictDO.getId())
- .orderByDesc(VodPlayHistoryDO::getPlayRecord));
- if (vodPlayHistoryDOS.size() > 0) {
- if (vodPlayHistoryDOS.get(0).getPlayRecord() < vodDictDO.getVodLength() * 0.8) {
- break;
- }
+ int playLength = vodPlayHistoryMapper.memberVodTotalLength(memberDO.getId(), vodDictDO.getId());
+ if (playLength < vodDictDO.getVodLength()) {
+ break;
}
}
i++;
}
getStudyInfoVO.setStudyCourse(i);
- return new AsyncResult<>(getStudyInfoVO);
- }
- public Future getStudyInfoTask2(MemberDO memberDO, GetStudyInfoVO getStudyInfoVO) {
//累计学习时长
- int studyLength = 0;
- List vodPlayHistoryDOS = vodPlayHistoryMapper.selectList(new QueryWrapper()
- .lambda()
- .eq(VodPlayHistoryDO::getMemberId, memberDO.getId()));
-
- for (VodPlayHistoryDO vodPlayHistoryDO : vodPlayHistoryDOS) {
- studyLength += vodPlayHistoryDO.getPlayLength();
- }
+ int studyLength = vodPlayHistoryMapper.memberTotalLength(memberDO.getId());
getStudyInfoVO.setStudyLength(studyLength);
//第几天
- long diff = Duration.between(memberDO.getCreateDate(), LocalDateTime.now()).toDays();
+ MemberDO memberDO1 = this.baseMapper.selectById(memberDO.getId());
+ long diff = Duration.between(memberDO1.getCreateDate(), LocalDateTime.now()).toDays();
getStudyInfoVO.setDiff(diff);
- return new AsyncResult(getStudyInfoVO);
- }
- public ExerciseDoneResultDO getDoneResult(ExerciseDoneResultDO exerciseDoneResultDO) {
- return exerciseDoneResultMapper.selectById(exerciseDoneResultDO.getId());
+ return getStudyInfoVO;
}
public String checkTimes(ExerciseDoneResultDO exerciseDoneResultDO) {
diff --git a/src/main/java/com/subsidy/service/impl/OprAdmDictServiceImpl.java b/src/main/java/com/subsidy/service/impl/OprAdmDictServiceImpl.java
index ce9fb6a..7fa6f88 100644
--- a/src/main/java/com/subsidy/service/impl/OprAdmDictServiceImpl.java
+++ b/src/main/java/com/subsidy/service/impl/OprAdmDictServiceImpl.java
@@ -3,13 +3,27 @@ package com.subsidy.service.impl;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.subsidy.dto.opr.GetHistoryDTO;
-import com.subsidy.model.OprAdmDictDO;
+import com.subsidy.mapper.AdministerMapper;
+import com.subsidy.mapper.CompanyDictMapper;
+import com.subsidy.model.AdministerDO;
+import com.subsidy.model.CompanyDictDO;
+import com.subsidy.mongodb.OprAdmDictDO;
import com.subsidy.mapper.OprAdmDictMapper;
+import com.subsidy.mongodb.PageVO;
import com.subsidy.service.OprAdmDictService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.subsidy.util.MongoUtil;
import com.subsidy.vo.opr.GetHistoryVO;
+import org.springframework.beans.BeanUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.data.mongodb.core.MongoTemplate;
+import org.springframework.data.mongodb.core.query.Criteria;
+import org.springframework.data.mongodb.core.query.Query;
import org.springframework.stereotype.Service;
+import java.util.ArrayList;
+import java.util.List;
+
/**
*
* 审计表 服务实现类
@@ -21,10 +35,44 @@ import org.springframework.stereotype.Service;
@Service
public class OprAdmDictServiceImpl extends ServiceImpl implements OprAdmDictService {
+ @Autowired
+ private MongoTemplate mongoTemplate;
+
+ @Autowired
+ private MongoUtil mongoUtil;
+
+ @Autowired
+ private AdministerMapper administerMapper;
+
+ @Autowired
+ private CompanyDictMapper companyDictMapper;
+
+ public PageVO getHistory(GetHistoryDTO getHistoryDTO){
+
+ PageVO pageVO = new PageVO();
+
+ List getHistoryVOS = new ArrayList<>();
+
+ //可累加条件
+ Query query = new Query(Criteria.where("userName").regex(getHistoryDTO.getUserName())
+ .and("loginDateFormat").gte(getHistoryDTO.getStartDate())
+ .and("loginDateFormat").lte(getHistoryDTO.getEndDate()));
+ Long count = mongoTemplate.count(query,OprAdmDictDO.class);
+ mongoUtil.start(getHistoryDTO.getPageNum(),getHistoryDTO.getPageSize(),query);
+ List oprAdmDictDOS = mongoTemplate.find(query,OprAdmDictDO.class);
+ for (OprAdmDictDO oprAdmDictDO : oprAdmDictDOS){
+ AdministerDO administerDO = administerMapper.selectById(oprAdmDictDO.getUserId());
+ CompanyDictDO companyDictDO = companyDictMapper.selectById(administerDO.getCompanyId());
+ GetHistoryVO getHistoryVO = new GetHistoryVO();
+ BeanUtils.copyProperties(oprAdmDictDO,getHistoryVO);
+ getHistoryVO.setCompanyName(companyDictDO.getCompanyName());
+ getHistoryVO.setUserName(administerDO.getUserName());
+ getHistoryVOS.add(getHistoryVO);
+ }
+ pageVO.setRecords(getHistoryVOS);
+ pageVO.setTotal(count);
- public IPage getHistory(GetHistoryDTO getHistoryDTO){
- Page pager = new Page(getHistoryDTO.getPageNum(), getHistoryDTO.getPageSize());
- return this.baseMapper.getHistory(pager,getHistoryDTO.getUserName(),getHistoryDTO.getStartDate(),getHistoryDTO.getEndDate());
+ return pageVO;
}
}
diff --git a/src/main/java/com/subsidy/service/impl/SignInRecordServiceImpl.java b/src/main/java/com/subsidy/service/impl/SignInRecordServiceImpl.java
index 6005cdc..10b4ffd 100644
--- a/src/main/java/com/subsidy/service/impl/SignInRecordServiceImpl.java
+++ b/src/main/java/com/subsidy/service/impl/SignInRecordServiceImpl.java
@@ -9,31 +9,29 @@ import com.subsidy.dto.member.GetMemberSignInfoDTO;
import com.subsidy.dto.sign.ClassSignInfoDTO;
import com.subsidy.mapper.ClassHourDictMapper;
import com.subsidy.mapper.ClassMemberMappingMapper;
+import com.subsidy.mapper.MemberMapper;
import com.subsidy.mapper.SignInRecordMapper;
import com.subsidy.mapper.VodPlayHistoryMapper;
import com.subsidy.model.ClassDictDO;
import com.subsidy.model.ClassHourDictDO;
+import com.subsidy.model.MemberDO;
import com.subsidy.model.SignInRecordDO;
-import com.subsidy.model.VodDictDO;
import com.subsidy.service.SignInRecordService;
import com.subsidy.util.ConstantUtils;
import com.subsidy.util.DateFormatUtil;
import com.subsidy.util.MathUtil;
import com.subsidy.util.RedisUtil;
import com.subsidy.vo.member.GetMemberSignInfoVO;
-import com.subsidy.vo.member.StudyPageVO;
import com.subsidy.vo.sign.ClassSignInfoVO;
import com.subsidy.vo.sign.SignInStatusVO;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.scheduling.annotation.AsyncResult;
import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.List;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
-import java.util.concurrent.Future;
/**
*
@@ -56,8 +54,11 @@ public class SignInRecordServiceImpl extends ServiceImpl getMemberSignInfo(GetMemberSignInfoDTO getMemberSignInfoDTO) {
Page pager = new Page(getMemberSignInfoDTO.getPageNum(), getMemberSignInfoDTO.getPageSize());
@@ -73,7 +74,7 @@ public class SignInRecordServiceImpl extends ServiceImpl classDictDOS = classMemberMappingMapper.getMemberClass(signInRecordDO.getMemberId());
for (ClassDictDO classDictDO : classDictDOS) {
- redisUtil.set(RedisPrefixConstant.SUBSIDY_SIGN_INFO_PREFIX + "memberId_" + signInRecordDO.getMemberId() + "_classId_" + classDictDO.getId() + "_" + DateFormatUtil.format(new Date(), "yyyyMMdd") + "_" + System.currentTimeMillis(), null);
+ redisUtil.set(RedisPrefixConstant.SUBSIDY_SIGN_INFO_PREFIX + "memberId:" + signInRecordDO.getMemberId() + ":classId:" + classDictDO.getId() + ":" + DateFormatUtil.format(new Date(), "yyyyMMdd") + ":" + System.currentTimeMillis(), null);
}
return ConstantUtils.ADD_SUCCESS;
@@ -88,24 +89,21 @@ public class SignInRecordServiceImpl extends ServiceImplclassSignInfoTask(classSignInfoVO));
+ newCachedThreadPool.execute(()->classSignInfoTask(classSignInfoVO));
}
newCachedThreadPool.shutdown();
classSignInfoVOIPage.setRecords(classSignInfoVOS);
return classSignInfoVOIPage;
}
- public Future classSignInfoTask(ClassSignInfoVO classSignInfoVO){
+ public void classSignInfoTask(ClassSignInfoVO classSignInfoVO){
ClassSignInfoVO classSignInfoVO1 = vodPlayHistoryMapper.classStudyHistory(classSignInfoVO.getClassId());
BeanUtils.copyProperties(classSignInfoVO1,classSignInfoVO);
//平均签到数 向下取整
- long signCount = redisUtil.scan(RedisPrefixConstant.SUBSIDY_SIGN_INFO_PREFIX + "*_classId_" + classSignInfoVO.getClassId() + "_*").stream().count();
+ long signCount = redisUtil.scan(RedisPrefixConstant.SUBSIDY_SIGN_INFO_PREFIX + "*:classId:" + classSignInfoVO.getClassId() + ":*").stream().count();
classSignInfoVO.setAvgSignCount(MathUtil.intDivCeil(signCount, classSignInfoVO1.getMemberCount()));
- return new AsyncResult<>(classSignInfoVO);
}
public SignInStatusVO signInStatus(SignInRecordDO signInRecordDO) {
@@ -113,10 +111,10 @@ public class SignInRecordServiceImpl extends ServiceImpl classHourDictDOS = classHourDictMapper.selectList(null);
for (ClassHourDictDO classHourDictDO : classHourDictDOS) {
- redisUtil.set("subsidySettings_" + classHourDictDO.getCompanyId(), classHourDictDO);
+ redisUtil.set("subsidySettings:" + classHourDictDO.getCompanyId(), classHourDictDO);
}
//预写学生账号数据
//List memberDOS = memberMapper.selectList(null);
//for (MemberDO memberDO : memberDOS){
- // redisUtil.set(RedisPrefixConstant.SUBSIDY_COMPANY_MEMBER_PREFIX+memberDO.getCompanyId()+"_"+memberDO.getAccountName(),memberDO);
+ // redisUtil.set(RedisPrefixConstant.SUBSIDY_COMPANY_MEMBER_PREFIX+memberDO.getCompanyId()+":"+memberDO.getAccountName(),memberDO);
//}
}
diff --git a/src/main/java/com/subsidy/service/impl/VodPlayHistoryServiceImpl.java b/src/main/java/com/subsidy/service/impl/VodPlayHistoryServiceImpl.java
index 7f70e7d..ef85deb 100644
--- a/src/main/java/com/subsidy/service/impl/VodPlayHistoryServiceImpl.java
+++ b/src/main/java/com/subsidy/service/impl/VodPlayHistoryServiceImpl.java
@@ -1,13 +1,29 @@
package com.subsidy.service.impl;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.subsidy.mapper.ClassDictMapper;
+import com.subsidy.mapper.ClassMemberMappingMapper;
+import com.subsidy.mapper.CourseContentMapper;
+import com.subsidy.mapper.SignInRecordMapper;
+import com.subsidy.model.ClassDictDO;
+import com.subsidy.model.ClassMemberMappingDO;
+import com.subsidy.model.SignInRecordDO;
+import com.subsidy.model.VodDictDO;
import com.subsidy.model.VodPlayHistoryDO;
import com.subsidy.mapper.VodPlayHistoryMapper;
import com.subsidy.service.VodPlayHistoryService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.subsidy.util.ConstantUtils;
+import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
+import java.time.LocalDate;
+import java.time.LocalDateTime;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Random;
+
/**
*
* 视频播放历史记录表 服务实现类
@@ -19,18 +35,104 @@ import org.springframework.stereotype.Service;
@Service
public class VodPlayHistoryServiceImpl extends ServiceImpl implements VodPlayHistoryService {
- @Async
+ @Autowired
+ private ClassMemberMappingMapper classMemberMappingMapper;
+
+ @Autowired
+ private ClassDictMapper classDictMapper;
+
+ @Autowired
+ private CourseContentMapper courseContentMapper;
+
+ @Autowired
+ private SignInRecordMapper signInRecordMapper;
+
+ @Autowired
+ private VodPlayHistoryMapper vodPlayHistoryMapper;
+
public String insertHistory(VodPlayHistoryDO vodPlayHistoryDO) {
vodPlayHistoryDO.setPlayCount(1);
this.baseMapper.insert(vodPlayHistoryDO);
return ConstantUtils.ADD_SUCCESS;
}
- @Async
- public String insertHistoryNew(VodPlayHistoryDO vodPlayHistoryDO){
+ public String insertHistoryNew(VodPlayHistoryDO vodPlayHistoryDO) {
vodPlayHistoryDO.setPlayCount(1);
this.baseMapper.insert(vodPlayHistoryDO);
return ConstantUtils.ADD_SUCCESS;
}
+ public void dataFix() {
+
+ //班级ids
+ List classIds = Arrays.asList(new String[]{"28"});
+
+ for (String str : classIds) {
+
+ ClassDictDO classDictDO = classDictMapper.selectById(str);
+
+ //找到班级里的学生
+ List classMemberMappingDOS = classMemberMappingMapper.selectList(new QueryWrapper()
+ .lambda()
+ .eq(ClassMemberMappingDO::getClassId, Long.valueOf(str)));
+
+ //查找课程里的所有视频
+ List vodDictDOS = courseContentMapper.getCourseVods(classDictDO.getCourseId());
+
+ //遍历班级学生
+ for (ClassMemberMappingDO classMemberMappingDO : classMemberMappingDOS) {
+
+ //查询这个人 这节课 排序
+ List signInRecordDOS = signInRecordMapper.selectList(new QueryWrapper()
+ .lambda()
+ .eq(SignInRecordDO::getMemberId, classMemberMappingDO.getMemberId())
+ .eq(SignInRecordDO::getClassId, str)
+ .orderByAsc(SignInRecordDO::getSignInDate));
+
+ //根据签到时间,对学生学习的课程做插入操作
+ for (SignInRecordDO signInRecordDO : signInRecordDOS) {
+ LocalDateTime signInDate = signInRecordDO.getSignInDate();
+ if (signInDate.getHour() <= 15 && signInDate.getHour() >= 6) {
+ Random random = new Random();
+ int totalDailyLength = random.nextInt(4);
+ //查找这个人应该学的课程
+ for (VodDictDO vodDictDO : vodDictDOS) {
+ //从历史记录里找中这个人有没有学过
+ if (totalDailyLength<=7*60*60){
+ Integer count = vodPlayHistoryMapper.selectCount(new QueryWrapper()
+ .lambda()
+ .eq(VodPlayHistoryDO::getMemberId, classMemberMappingDO.getMemberId())
+ .eq(VodPlayHistoryDO::getClassId, str)
+ .eq(VodPlayHistoryDO::getVodId, vodDictDO.getId()));
+ if (count == 0 && signInDate.plusSeconds(totalDailyLength).getHour() < 23) {
+ totalDailyLength+=vodDictDO.getVodLength();
+ VodPlayHistoryDO vodPlayHistoryDO = new VodPlayHistoryDO();
+ vodPlayHistoryDO.setPlayCount(1);
+ vodPlayHistoryDO.setClassId(Long.valueOf(str));
+ vodPlayHistoryDO.setMemberId(classMemberMappingDO.getMemberId());
+ vodPlayHistoryDO.setPlayRecord(vodDictDO.getVodLength());
+ vodPlayHistoryDO.setPlayLength(vodDictDO.getVodLength());
+ vodPlayHistoryDO.setVodId(vodDictDO.getId());
+ vodPlayHistoryDO.setPlayDate(signInDate.plusSeconds(totalDailyLength));
+ //vodPlayHistoryDO.setCreateDate(signInDate.plusSeconds(totalDailyLength));
+ vodPlayHistoryMapper.insert(vodPlayHistoryDO);
+ Random random1 = new Random();
+ totalDailyLength+=random1.nextInt(5);
+ }
+ }
+
+ }
+ }
+ }
+ }
+ }
+ }
+
+ public static void main(String[] args) {
+
+ Random random = new Random();
+ System.out.println();
+
+ }
+
}
diff --git a/src/main/java/com/subsidy/util/ConstantUtils.java b/src/main/java/com/subsidy/util/ConstantUtils.java
index 977b5e2..5f05c6f 100644
--- a/src/main/java/com/subsidy/util/ConstantUtils.java
+++ b/src/main/java/com/subsidy/util/ConstantUtils.java
@@ -52,8 +52,6 @@ public class ConstantUtils {
public static final String COMPRESS_SUCCESS = "压缩成功";
- public static final String SCHOOL = "上海市市西中学";
-
public static final String CHECK_STATUS = "审核通过";
/**
diff --git a/src/main/java/com/subsidy/util/ExcelFormatUtils.java b/src/main/java/com/subsidy/util/ExcelFormatUtils.java
index 280e5e9..aac6018 100644
--- a/src/main/java/com/subsidy/util/ExcelFormatUtils.java
+++ b/src/main/java/com/subsidy/util/ExcelFormatUtils.java
@@ -14,6 +14,6 @@ public class ExcelFormatUtils {
public static final List answersList = Arrays.asList("序号", "提问", "答疑", "提问时间", "提问成员", "答疑时间");
- public static final List studyLogList = Arrays.asList("开始时间","结束时间","操作对象","类型","平台","学习时长","有效时长");
+ public static final List studyLogList = Arrays.asList("开始时间","结束时间","操作对象","类型","平台","学习时长","累计有效时长");
}
diff --git a/src/main/java/com/subsidy/util/MathUtil.java b/src/main/java/com/subsidy/util/MathUtil.java
index 5d81796..70a9d8e 100644
--- a/src/main/java/com/subsidy/util/MathUtil.java
+++ b/src/main/java/com/subsidy/util/MathUtil.java
@@ -137,17 +137,17 @@ public class MathUtil {
// }
public static String secToTime(int time) {
- String timeStr = null;
- int hour = 0;
- int minute = 0;
- int second = 0;
+ String timeStr ;
+ int hour;
+ int minute;
+ int second;
if (time <= 0) {
- return "00:00";
+ return "00:00:00";
} else {
minute = time / 60;
if (minute < 60) {
second = time % 60;
- timeStr = unitFormat(minute) + ":" + unitFormat(second);
+ timeStr = "00:"+unitFormat(minute) + ":" + unitFormat(second);
} else {
hour = minute / 60;
minute = minute % 60;
diff --git a/src/main/java/com/subsidy/util/MongoUtil.java b/src/main/java/com/subsidy/util/MongoUtil.java
new file mode 100644
index 0000000..aba131e
--- /dev/null
+++ b/src/main/java/com/subsidy/util/MongoUtil.java
@@ -0,0 +1,53 @@
+package com.subsidy.util;
+
+import lombok.Data;
+import org.springframework.data.mongodb.core.query.Query;
+import org.springframework.stereotype.Component;
+
+import java.util.List;
+import java.util.regex.Pattern;
+
+@Data
+@Component
+public class MongoUtil {
+ public Integer pageSize;
+ private Integer currentPage;
+
+
+ public void start(Integer currentPage, Integer pageSize, Query query) {
+ pageSize = pageSize == 0 ? 10 : pageSize;
+ query.limit(pageSize);
+ query.skip((currentPage - 1) * pageSize);
+ this.pageSize = pageSize;
+ this.currentPage = currentPage;
+ }
+
+ public PageHelper pageHelper(long total, List list) {
+ return new PageHelper(this.currentPage, total, this.pageSize, list);
+ }
+
+ public PageHelper pageHelper(List list) {
+ return new PageHelper(this.currentPage, this.pageSize, list);
+ }
+
+ public PageHelper pageHelper(long currentPage, long total, long pageSize, List list) {
+ return new PageHelper(currentPage, total, pageSize, list);
+ }
+
+ public PageHelper pageHelper(long currentPage, long pageSize, List list) {
+ return new PageHelper(currentPage, pageSize, list);
+ }
+
+
+ /**
+ * 用于模糊查询忽略大小写
+ *
+ * @param string
+ * @return
+ */
+ public Pattern getPattern(String string) {
+ Pattern pattern = Pattern.compile("^.*" + string + ".*$", Pattern.CASE_INSENSITIVE);
+ return pattern;
+ }
+
+}
diff --git a/src/main/java/com/subsidy/util/PageHelper.java b/src/main/java/com/subsidy/util/PageHelper.java
new file mode 100644
index 0000000..bf37716
--- /dev/null
+++ b/src/main/java/com/subsidy/util/PageHelper.java
@@ -0,0 +1,30 @@
+package com.subsidy.util;
+
+import lombok.Data;
+import org.apache.poi.ss.formula.functions.T;
+
+import java.util.List;
+
+@Data
+public class PageHelper {
+
+ private long currentPage;
+ private long total;
+ private long pageSize;
+ private List list;
+
+ public PageHelper(long pageNum, long total, long pageSize, List list) {
+ this.currentPage = pageNum;
+ this.total = total;
+ this.pageSize = pageSize;
+ this.list = list;
+ }
+
+ public PageHelper(long pageNum, long pageSize, List list) {
+ this.currentPage = pageNum;
+ this.pageSize = pageSize;
+ this.list = list;
+ }
+
+
+}
diff --git a/src/main/java/com/subsidy/util/RedisUtil.java b/src/main/java/com/subsidy/util/RedisUtil.java
index b74d000..03e08ff 100644
--- a/src/main/java/com/subsidy/util/RedisUtil.java
+++ b/src/main/java/com/subsidy/util/RedisUtil.java
@@ -557,14 +557,14 @@ public class RedisUtil {
}
}
- /**
- * 模糊查询获取key值
- * @param pattern
- * @return
- */
- public Set keys(String pattern){
- return redisTemplate.keys(pattern);
- }
+ ///**
+ // * 模糊查询获取key值
+ // * @param pattern
+ // * @return
+ // */
+ //public Set keys(String pattern){
+ // return redisTemplate.keys(pattern);
+ //}
/**
* 模糊查询
diff --git a/src/main/java/com/subsidy/vo/administer/ClassDailyInfoVO.java b/src/main/java/com/subsidy/vo/administer/ClassDailyInfoVO.java
index 6859989..44d1cb4 100644
--- a/src/main/java/com/subsidy/vo/administer/ClassDailyInfoVO.java
+++ b/src/main/java/com/subsidy/vo/administer/ClassDailyInfoVO.java
@@ -13,4 +13,6 @@ public class ClassDailyInfoVO {
private String userName;
private List dayInfoItemVOS;
+
+ private Integer total;
}
diff --git a/src/main/java/com/subsidy/vo/administer/GetMemberPapersVO.java b/src/main/java/com/subsidy/vo/administer/GetMemberPapersVO.java
index 836bac9..d75e3c4 100644
--- a/src/main/java/com/subsidy/vo/administer/GetMemberPapersVO.java
+++ b/src/main/java/com/subsidy/vo/administer/GetMemberPapersVO.java
@@ -5,17 +5,12 @@ import lombok.Data;
@Data
public class GetMemberPapersVO {
- private Long id;
+ private Long paperId;
- private String paperName;
+ private String score;
- private Integer rightCounts;
+ private Integer cnt;
- private Integer totalCounts;
+ private Integer result;
- private String result;
-
- private String createDate;
-
- private Integer score;
}
diff --git a/src/main/java/com/subsidy/vo/answer/GetCourseQuestionVO.java b/src/main/java/com/subsidy/vo/answer/GetCourseQuestionVO.java
index c9db152..782aff7 100644
--- a/src/main/java/com/subsidy/vo/answer/GetCourseQuestionVO.java
+++ b/src/main/java/com/subsidy/vo/answer/GetCourseQuestionVO.java
@@ -44,6 +44,5 @@ public class GetCourseQuestionVO {
private String updateDate;
- private String deleteDate;
}
diff --git a/src/main/java/com/subsidy/vo/classdict/ClassDetailVO.java b/src/main/java/com/subsidy/vo/classdict/ClassDetailVO.java
index 63480bf..a8521cf 100644
--- a/src/main/java/com/subsidy/vo/classdict/ClassDetailVO.java
+++ b/src/main/java/com/subsidy/vo/classdict/ClassDetailVO.java
@@ -33,12 +33,12 @@ public class ClassDetailVO{
/**
* 已看视频
*/
- private Integer studyVodCounts;
+ //private Integer studyVodCounts;
/**
* 全部视频
*/
- private Integer allVodCounts;
+ //private Integer allVodCounts;
@ExcelColumn(col = 6,value = "课程进度")
private String classProcess;
diff --git a/src/main/java/com/subsidy/vo/done/GetMaxScoreVO.java b/src/main/java/com/subsidy/vo/done/GetMaxScoreVO.java
index 36178a3..acd8d34 100644
--- a/src/main/java/com/subsidy/vo/done/GetMaxScoreVO.java
+++ b/src/main/java/com/subsidy/vo/done/GetMaxScoreVO.java
@@ -11,4 +11,5 @@ public class GetMaxScoreVO {
private Long score;
+ private Integer result;
}
diff --git a/src/main/java/com/subsidy/vo/done/TestScoreInfoVO.java b/src/main/java/com/subsidy/vo/done/TestScoreInfoVO.java
new file mode 100644
index 0000000..855d040
--- /dev/null
+++ b/src/main/java/com/subsidy/vo/done/TestScoreInfoVO.java
@@ -0,0 +1,16 @@
+package com.subsidy.vo.done;
+
+import lombok.Data;
+
+@Data
+public class TestScoreInfoVO {
+
+ private Long paperId;
+
+ private Integer score;
+
+ private Integer cnt;
+
+ private String result;
+
+}
diff --git a/src/main/java/com/subsidy/vo/member/ClassSignVO.java b/src/main/java/com/subsidy/vo/member/ClassSignVO.java
index 9390669..3aa3ef7 100644
--- a/src/main/java/com/subsidy/vo/member/ClassSignVO.java
+++ b/src/main/java/com/subsidy/vo/member/ClassSignVO.java
@@ -34,15 +34,6 @@ public class ClassSignVO {
@ExcelColumn(col = 4,value = "培训时长")
private String trainingLengthStr;
- /**
- * 已看视频
- */
- private Integer studyVodCounts;
-
- /**
- * 全部视频
- */
- private Integer allVodCounts;
@ExcelColumn(col = 5,value = "课程进度")
private String classProcess;
diff --git a/src/main/java/com/subsidy/vo/member/StudyPageVO.java b/src/main/java/com/subsidy/vo/member/StudyPageVO.java
index dc234c6..6c06e4b 100644
--- a/src/main/java/com/subsidy/vo/member/StudyPageVO.java
+++ b/src/main/java/com/subsidy/vo/member/StudyPageVO.java
@@ -5,7 +5,7 @@ import lombok.Data;
@Data
public class StudyPageVO {
- private Integer id;
+ private Long id;
private Integer classId;
diff --git a/src/main/resources/application-dev.properties b/src/main/resources/application-dev.properties
index a02ed62..0f8bf7b 100644
--- a/src/main/resources/application-dev.properties
+++ b/src/main/resources/application-dev.properties
@@ -2,7 +2,7 @@
# 数据源配置
spring.datasource.url=jdbc:mysql://47.97.19.66:3306/subsidy_test?autoReconnect=true&useUnicode=true&characterEncoding=utf8&serverTimezone=GMT%2B8
-#spring.datasource.url=jdbc:mysql://rm-uf606h696n5qod70cfo.mysql.rds.aliyuncs.com:3306/subsidy_test?autoReconnect=true&useUnicode=true&characterEncoding=utf8&serverTimezone=GMT%2B8
+#spring.datasource.url=jdbc:mysql://rm-uf6rab73w0qg843opxo.mysql.rds.aliyuncs.com:3306/subsidy_test?autoReconnect=true&useUnicode=true&characterEncoding=utf8&serverTimezone=GMT%2B8
spring.datasource.type=com.alibaba.druid.pool.DruidDataSource
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
#spring.datasource.username=ykadmin_new
@@ -27,9 +27,19 @@ spring.datasource.druid.useGlobalDataSourceStat=true
# 控制台日志打印
mybatis-plus.configuration.log-impl=org.apache.ibatis.logging.stdout.StdOutImpl
-#spring.redis.host=r-uf6thsc3bzt5b6f7fdpd.redis.rds.aliyuncs.com
-#spring.redis.password=r-uf6thsc3bzt5b6f7fd:Ykhl@208
+#spring.redis.host=r-uf6meywj6ysuehg148pd.redis.rds.aliyuncs.com
+#spring.redis.password=r-uf6meywj6ysuehg148:Ykhl@208
#spring.redis.port=6379
#spring.redis.lettuce.pool.max-idle=16
#spring.redis.lettuce.pool.max-active=32
-#spring.redis.lettuce.pool.min-idle=8
\ No newline at end of file
+#spring.redis.lettuce.pool.min-idle=8
+
+spring.application.name=spring-boot-mongodb
+# mongodb
+#spring.data.mongodb.uri=mongodb://47.97.19.66:27017/subsidy
+spring.data.mongodb.username=root
+spring.data.mongodb.password=123456
+#spring.data.mongodb.authentication-database=subsidy
+spring.data.mongodb.database=subsidy
+spring.data.mongodb.host=47.97.19.66
+spring.data.mongodb.port=27017
diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties
index e4f49f3..33a6e52 100644
--- a/src/main/resources/application.properties
+++ b/src/main/resources/application.properties
@@ -1,7 +1,7 @@
# 环境配置
spring.profiles.active=dev
# 端口号
-spring.server.port=23454
+spring.server.port=23457
#嵌入tomcat配置
#和CPU数
spring.server.acceptorThreadCount=600
@@ -64,24 +64,6 @@ spring.quartz.overwrite-existing-jobs=false
#spring.quartz.jdbc.initialize-schema=always
#spring.datasource.initialization-mode=embedded
-#spring.task.execution.pool.allow-core-thread-timeout=true
-#spring.task.execution.pool.core-size=8
-#spring.task.execution.pool.keep-alive=60
-#spring.task.execution.pool.max-size=200
-#spring.task.execution.pool.queue-capacity=200
-#spring.task.execution.thread-name-prefix=subsidy-
-
-#spring.task.scheduling.pool.size=2
-#spring.task.scheduling.thread-name-prefix=subsidy-
-
-#spring.redis.cluster.nodes=47.97.19.66:6377,47.97.19.66:6378,47.97.19.66:6379
-##spring.redis.port=6379
-#spring.redis.password=Ykhl@208
-## spring.redis.cluster.max-redirects=3
-#spring.redis.lettuce.pool.max-idle=16
-#spring.redis.lettuce.pool.max-active=32
-#spring.redis.lettuce.pool.min-idle=8
-
#spring.redis.host=r-uf6m4cpkjrgpzywjm3pd.redis.rds.aliyuncs.com
#spring.redis.port=6379
#spring.redis.password=r-uf6m4cpkjrgpzywjm3:Ykhl@208
diff --git a/src/main/resources/mapper/AnsweringQuestionMapper.xml b/src/main/resources/mapper/AnsweringQuestionMapper.xml
index efd56ac..595c4d7 100644
--- a/src/main/resources/mapper/AnsweringQuestionMapper.xml
+++ b/src/main/resources/mapper/AnsweringQuestionMapper.xml
@@ -4,15 +4,15 @@
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
@@ -25,23 +25,30 @@
diff --git a/src/main/resources/mapper/ClassDictMapper.xml b/src/main/resources/mapper/ClassDictMapper.xml
index 7d84003..b621c71 100644
--- a/src/main/resources/mapper/ClassDictMapper.xml
+++ b/src/main/resources/mapper/ClassDictMapper.xml
@@ -65,7 +65,17 @@