Commit 1babf734 by 涂亚平

年前上线版本

1 parent 8515b4a4
Showing with 318 additions and 144 deletions
...@@ -23,7 +23,7 @@ public class RedisPrefixConstant { ...@@ -23,7 +23,7 @@ public class RedisPrefixConstant {
public static final String SUBSIDY_TELEPHONE_PREFIX = "subsidySmsCode:"; public static final String SUBSIDY_TELEPHONE_PREFIX = "subsidySmsCode:";
/** /**
* subsidySettings_companyId:ClassHourDictDO 公司操作设置 * subsidySettings:companyId:ClassHourDictDO 公司操作设置
*/ */
public static final String SUBSIDY_SETTINGS_PREFIX = "subsidySettings:"; public static final String SUBSIDY_SETTINGS_PREFIX = "subsidySettings:";
......
...@@ -139,7 +139,6 @@ public class AdministerController { ...@@ -139,7 +139,6 @@ public class AdministerController {
@PostMapping("getMemberPapers") @PostMapping("getMemberPapers")
@ApiOperation("获取某个成员某个卷子的做题历史 memberId paperId") @ApiOperation("获取某个成员某个卷子的做题历史 memberId paperId")
@LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
public ResponseVO getMemberPapers(@RequestBody ExerciseDoneResultDO exerciseDoneResultDO){ public ResponseVO getMemberPapers(@RequestBody ExerciseDoneResultDO exerciseDoneResultDO){
return ResponseData.generateCreatedResponse(0,administerService.getMemberPapers(exerciseDoneResultDO)); return ResponseData.generateCreatedResponse(0,administerService.getMemberPapers(exerciseDoneResultDO));
} }
......
...@@ -40,8 +40,8 @@ public class ClassHourDictController { ...@@ -40,8 +40,8 @@ public class ClassHourDictController {
} }
@PostMapping("updateSetting") @PostMapping("updateSetting")
@ApiOperation("修改当天设置时长 id 主键 classHour status interrupt interruptStatus repeatTime repeatStatus") @ApiOperation("修改当天设置时长 companyId 主键 classHour status interrupt interruptStatus repeatTime repeatStatus")
@LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE}) //@LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
public ResponseVO updateSetting(@RequestBody ClassHourDictDO classHourDictDO){ public ResponseVO updateSetting(@RequestBody ClassHourDictDO classHourDictDO){
return ResponseData.generateCreatedResponse(0,classHourDictService.updateSetting(classHourDictDO)); return ResponseData.generateCreatedResponse(0,classHourDictService.updateSetting(classHourDictDO));
} }
......
package com.subsidy.controller; package com.subsidy.controller;
import com.subsidy.common.ResponseData;
import com.subsidy.common.ResponseVO;
import com.subsidy.dto.field.QueryFieldsDTO;
import com.subsidy.model.FieldDictDO;
import com.subsidy.service.FieldDictService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
...@@ -16,7 +25,34 @@ import io.swagger.annotations.Api; ...@@ -16,7 +25,34 @@ import io.swagger.annotations.Api;
*/ */
@RestController @RestController
@Api(tags = "行业字典表") @Api(tags = "行业字典表")
@RequestMapping("/field-dict-do") @RequestMapping("/fieldDict")
public class FieldDictController { public class FieldDictController {
@Autowired
private FieldDictService fieldDictService;
@PostMapping("addField")
@ApiOperation("添加行业 fieldName 行业名称")
public ResponseVO addField(@RequestBody FieldDictDO fieldDictDO){
return ResponseData.generateCreatedResponse(0,fieldDictService.addField(fieldDictDO));
}
@PostMapping("updateField")
@ApiOperation("修改行业 id fieldName 行业名称")
public ResponseVO updateField(@RequestBody FieldDictDO fieldDictDO){
return ResponseData.generateCreatedResponse(0,fieldDictService.updateField(fieldDictDO));
}
@PostMapping("deleteField")
@ApiOperation("删除行业 id")
public ResponseVO deleteField(@RequestBody FieldDictDO fieldDictDO){
return ResponseData.generateCreatedResponse(0,fieldDictService.deleteField(fieldDictDO));
}
@PostMapping("queryFields")
@ApiOperation("查询行业 pageSize pageNum fieldName")
public ResponseVO queryFields(@RequestBody QueryFieldsDTO queryFieldsDTO){
return ResponseData.generateCreatedResponse(0,fieldDictService.queryFields(queryFieldsDTO));
}
} }
...@@ -47,7 +47,7 @@ public class SignInRecordController { ...@@ -47,7 +47,7 @@ public class SignInRecordController {
@PostMapping("classStudyHistory") @PostMapping("classStudyHistory")
@ApiOperation("校区学习记录 id 校区id className courseName pageSize pageNum") @ApiOperation("校区学习记录 id 校区id className courseName pageSize pageNum")
@LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE}) //@LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
public ResponseVO classSignInfo(@RequestBody ClassSignInfoDTO classSignInfoDTO) { public ResponseVO classSignInfo(@RequestBody ClassSignInfoDTO classSignInfoDTO) {
return ResponseData.generateCreatedResponse(0, signInRecordService.classSignInfo(classSignInfoDTO)); return ResponseData.generateCreatedResponse(0, signInRecordService.classSignInfo(classSignInfoDTO));
} }
......
package com.subsidy.dto.field;
import lombok.Data;
@Data
public class QueryFieldsDTO {
private Integer pageSize;
private Integer pageNum;
private String fieldName;
}
...@@ -46,7 +46,7 @@ public interface ExerciseDoneResultMapper extends BaseMapper<ExerciseDoneResultD ...@@ -46,7 +46,7 @@ public interface ExerciseDoneResultMapper extends BaseMapper<ExerciseDoneResultD
/** /**
* 查看某个人某个卷子完成的最好成绩 * 查看某个人某个卷子完成的最好成绩
*/ */
ExerciseDoneResultDO getMaxScorePaper(Long paperId,Long memberId); List<ExerciseDoneResultDO> getMaxScorePaper(Long paperId,Long memberId);
/** /**
* 测试成绩 最高成绩 测试测试 总评价 * 测试成绩 最高成绩 测试测试 总评价
......
package com.subsidy.mapper; package com.subsidy.mapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.subsidy.dto.field.QueryFieldsDTO;
import com.subsidy.model.FieldDictDO; import com.subsidy.model.FieldDictDO;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
...@@ -12,7 +14,9 @@ import org.springframework.stereotype.Repository; ...@@ -12,7 +14,9 @@ import org.springframework.stereotype.Repository;
* @author DengMin * @author DengMin
* @since 2022-01-20 * @since 2022-01-20
*/ */
@Repository @Repository
public interface FieldDictMapper extends BaseMapper<FieldDictDO> { public interface FieldDictMapper extends BaseMapper<FieldDictDO> {
IPage<FieldDictDO> queryFields(IPage ipage, String fieldName);
} }
package com.subsidy.service; package com.subsidy.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.subsidy.dto.field.QueryFieldsDTO;
import com.subsidy.model.FieldDictDO; import com.subsidy.model.FieldDictDO;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.tencentcloudapi.vpc.v20170312.models.Ip6Rule;
/** /**
* <p> * <p>
...@@ -13,4 +16,12 @@ import com.baomidou.mybatisplus.extension.service.IService; ...@@ -13,4 +16,12 @@ import com.baomidou.mybatisplus.extension.service.IService;
*/ */
public interface FieldDictService extends IService<FieldDictDO> { public interface FieldDictService extends IService<FieldDictDO> {
String addField(FieldDictDO fieldDictDO);
String updateField(FieldDictDO fieldDictDO);
String deleteField(FieldDictDO fieldDictDO);
IPage queryFields(QueryFieldsDTO queryFieldsDTO);
} }
...@@ -11,6 +11,7 @@ import com.subsidy.model.VodPlayHistoryDO; ...@@ -11,6 +11,7 @@ import com.subsidy.model.VodPlayHistoryDO;
import com.subsidy.service.ClassHourDictService; import com.subsidy.service.ClassHourDictService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.subsidy.util.ConstantUtils; import com.subsidy.util.ConstantUtils;
import com.subsidy.util.MyBeanUtils;
import com.subsidy.util.RedisUtil; import com.subsidy.util.RedisUtil;
import com.subsidy.vo.hour.PollingGetVO; import com.subsidy.vo.hour.PollingGetVO;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
...@@ -21,6 +22,7 @@ import org.springframework.stereotype.Service; ...@@ -21,6 +22,7 @@ import org.springframework.stereotype.Service;
import java.time.LocalDate; import java.time.LocalDate;
import java.util.List; import java.util.List;
import java.util.Set;
import java.util.concurrent.ExecutorService; import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors; import java.util.concurrent.Executors;
import java.util.concurrent.Future; import java.util.concurrent.Future;
...@@ -46,15 +48,16 @@ public class ClassHourDictServiceImpl extends ServiceImpl<ClassHourDictMapper, C ...@@ -46,15 +48,16 @@ public class ClassHourDictServiceImpl extends ServiceImpl<ClassHourDictMapper, C
private RedisUtil redisUtil; private RedisUtil redisUtil;
public ClassHourDictDO getSetting(ClassHourDictDO classHourDictDO) { public ClassHourDictDO getSetting(ClassHourDictDO classHourDictDO) {
return (ClassHourDictDO) redisUtil.get(RedisPrefixConstant.SUBSIDY_SETTINGS_PREFIX + classHourDictDO.getCompanyId()); return (ClassHourDictDO) redisUtil.get(RedisPrefixConstant.SUBSIDY_SETTINGS_PREFIX+classHourDictDO.getCompanyId());
} }
@Async
public String updateSetting(ClassHourDictDO classHourDictDO) { public String updateSetting(ClassHourDictDO classHourDictDO) {
ClassHourDictDO classHourDictDO1 = (ClassHourDictDO) redisUtil.get(RedisPrefixConstant.SUBSIDY_SETTINGS_PREFIX + classHourDictDO.getCompanyId()); ClassHourDictDO classHourDictDO1 = (ClassHourDictDO) redisUtil.get(RedisPrefixConstant.SUBSIDY_SETTINGS_PREFIX + classHourDictDO.getCompanyId());
BeanUtils.copyProperties(classHourDictDO, classHourDictDO1); classHourDictDO.setId(classHourDictDO1.getId());
redisUtil.set(RedisPrefixConstant.SUBSIDY_SETTINGS_PREFIX + classHourDictDO.getCompanyId(), classHourDictDO1); String[] nullParams = MyBeanUtils.getNullPropertyNames(classHourDictDO);
BeanUtils.copyProperties(classHourDictDO, classHourDictDO1,nullParams);
redisUtil.set(RedisPrefixConstant.SUBSIDY_SETTINGS_PREFIX+classHourDictDO.getCompanyId(), classHourDictDO1);
return ConstantUtils.SET_SUCCESS; return ConstantUtils.SET_SUCCESS;
} }
......
package com.subsidy.service.impl; 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.subsidy.common.exception.HttpException;
import com.subsidy.dto.field.QueryFieldsDTO;
import com.subsidy.model.FieldDictDO; import com.subsidy.model.FieldDictDO;
import com.subsidy.mapper.FieldDictMapper; import com.subsidy.mapper.FieldDictMapper;
import com.subsidy.model.FileDictDO;
import com.subsidy.service.FieldDictService; import com.subsidy.service.FieldDictService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.subsidy.util.ConstantUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
/** /**
...@@ -17,4 +24,42 @@ import org.springframework.stereotype.Service; ...@@ -17,4 +24,42 @@ import org.springframework.stereotype.Service;
@Service @Service
public class FieldDictServiceImpl extends ServiceImpl<FieldDictMapper, FieldDictDO> implements FieldDictService { public class FieldDictServiceImpl extends ServiceImpl<FieldDictMapper, FieldDictDO> implements FieldDictService {
public String addField(FieldDictDO fieldDictDO) {
Integer count = this.baseMapper.selectCount(new QueryWrapper<FieldDictDO>()
.lambda()
.eq(FieldDictDO::getFieldName, fieldDictDO.getFieldName()));
if (count > 0) {
throw new HttpException(11001);
}
this.baseMapper.insert(fieldDictDO);
return ConstantUtils.ADD_SUCCESS;
}
public String updateField(FieldDictDO fieldDictDO) {
Integer count = this.baseMapper.selectCount(new QueryWrapper<FieldDictDO>()
.lambda()
.eq(FieldDictDO::getFieldName, fieldDictDO.getFieldName())
.ne(FieldDictDO::getId, fieldDictDO.getId()));
if (count > 0) {
throw new HttpException(11001);
}
this.baseMapper.updateById(fieldDictDO);
return ConstantUtils.SET_SUCCESS;
}
public String deleteField(FieldDictDO fieldDictDO){
this.baseMapper.deleteById(fieldDictDO.getId());
return ConstantUtils.DELETE_SUCCESS;
}
public IPage queryFields(QueryFieldsDTO queryFieldsDTO){
Page pager = new Page(queryFieldsDTO.getPageNum(), queryFieldsDTO.getPageSize());
return this.baseMapper.queryFields(pager,queryFieldsDTO.getFieldName());
}
} }
...@@ -50,6 +50,7 @@ import com.subsidy.vo.member.GetAllVO; ...@@ -50,6 +50,7 @@ import com.subsidy.vo.member.GetAllVO;
import com.subsidy.vo.member.GetStudyInfoVO; import com.subsidy.vo.member.GetStudyInfoVO;
import com.subsidy.vo.member.MemberStudyPageVO; import com.subsidy.vo.member.MemberStudyPageVO;
import com.subsidy.vo.member.MemberVO; import com.subsidy.vo.member.MemberVO;
import com.subsidy.vo.member.MemberVodVO;
import com.subsidy.vo.member.MyCoursesVO; import com.subsidy.vo.member.MyCoursesVO;
import com.subsidy.vo.member.StudyPageVO; import com.subsidy.vo.member.StudyPageVO;
import com.subsidy.vo.paper.QueryPapersVO; import com.subsidy.vo.paper.QueryPapersVO;
...@@ -231,7 +232,7 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, MemberDO> imple ...@@ -231,7 +232,7 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, MemberDO> imple
public UserRoleVO login(VerifyCodeDTO verifyCodeDTO) { public UserRoleVO login(VerifyCodeDTO verifyCodeDTO) {
UserRoleVO userRoleVO = new UserRoleVO(); UserRoleVO userRoleVO = new UserRoleVO();
//TODO 先从redis里拿 ??? //先从redis里拿 还得从数据库先查公司。。还是直接查人快
MemberDO memberDO = this.baseMapper.selectOne(new QueryWrapper<MemberDO>() MemberDO memberDO = this.baseMapper.selectOne(new QueryWrapper<MemberDO>()
.lambda() .lambda()
.eq(MemberDO::getTelephone, verifyCodeDTO.getTelephone())); .eq(MemberDO::getTelephone, verifyCodeDTO.getTelephone()));
...@@ -316,6 +317,7 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, MemberDO> imple ...@@ -316,6 +317,7 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, MemberDO> 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(); MemberVO memberVO = new MemberVO();
BeanUtils.copyProperties(memberDO, memberVO); BeanUtils.copyProperties(memberDO, memberVO);
memberVO.setCompanyName(companyDictDO.getCompanyName());
OprMemDictDO oprMemDictDO = new OprMemDictDO(); OprMemDictDO oprMemDictDO = new OprMemDictDO();
oprMemDictDO.setUserId(memberDO.getId()); oprMemDictDO.setUserId(memberDO.getId());
oprMemDictDO.setOprType("登录"); oprMemDictDO.setOprType("登录");
...@@ -432,7 +434,19 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, MemberDO> imple ...@@ -432,7 +434,19 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, MemberDO> imple
for (CourseContentDO courseContentDO : courseContentDOS) { for (CourseContentDO courseContentDO : courseContentDOS) {
ContentVodVO contentVodVO = new ContentVodVO(); ContentVodVO contentVodVO = new ContentVodVO();
contentVodVO.setContent(courseContentDO.getContent()); contentVodVO.setContent(courseContentDO.getContent());
contentVodVO.setMemberVodVOS(courseContentMapper.contentVodProcess(courseContentDO.getId(), contentVodDTO.getMemberId()));
List<MemberVodVO> memberVodVOS = courseContentMapper.contentVodProcess(courseContentDO.getId(), contentVodDTO.getMemberId());
int playCount = 0;
for (MemberVodVO memberVodVO : memberVodVOS){
if (100 == memberVodVO.getPercent()){
playCount++;
}
}
contentVodVO.setPlayVods(playCount);
contentVodVO.setMemberVodVOS(memberVodVOS);
contentVodVO.setTotalVods(memberVodVOS.size());
contentVodVOS.add(contentVodVO); contentVodVOS.add(contentVodVO);
} }
contentVodNewVO.setContentVodVOS(contentVodVOS); contentVodNewVO.setContentVodVOS(contentVodVOS);
...@@ -479,32 +493,26 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, MemberDO> imple ...@@ -479,32 +493,26 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, MemberDO> imple
//查看该班级下的测试卷子(有效卷子) //查看该班级下的测试卷子(有效卷子)
ClassDictDO classDictDO = classDictMapper.selectById(contentMemberDTO.getClassId()); ClassDictDO classDictDO = classDictMapper.selectById(contentMemberDTO.getClassId());
List<QueryPapersVO> queryPapersVOS = paperDictMapper.queryPapers(contentMemberDTO.getCourseId(), null, 1); List<QueryPapersVO> queryPapersVOS = paperDictMapper.queryPapers(contentMemberDTO.getCourseId(), null, 1);
ExecutorService executorService = Executors.newCachedThreadPool();
for (QueryPapersVO queryPapersVO : queryPapersVOS) { for (QueryPapersVO queryPapersVO : queryPapersVOS) {
executorService.execute(() -> getCourseTestTask(queryPapersVO, contentMemberDTO.getMemberId(), classDictDO)); //多少人已完成
Integer cnt = paperDictMapper.completeCount(queryPapersVO.getId());
queryPapersVO.setCompleteCnt(cnt);
//自己成绩
List<ExerciseDoneResultDO> exerciseDoneResultDOS = exerciseDoneResultMapper.getMaxScorePaper(queryPapersVO.getId(), contentMemberDTO.getMemberId());
if (exerciseDoneResultDOS.size()>0) {
queryPapersVO.setRightCounts(exerciseDoneResultDOS.get(0).getRightCounts());
queryPapersVO.setTotalCount(exerciseDoneResultDOS.get(0).getTotalCounts());
queryPapersVO.setResult(exerciseDoneResultDOS.get(0).getResult());
} else {
queryPapersVO.setResult("待完成");
}
//截止时间
queryPapersVO.setEndDate(classDictDO.getEndDate());
} }
executorService.shutdown();
return queryPapersVOS; return queryPapersVOS;
} }
public void getCourseTestTask(QueryPapersVO queryPapersVO, Long memberId, ClassDictDO classDictDO) {
//多少人已完成
Integer cnt = paperDictMapper.completeCount(queryPapersVO.getId());
queryPapersVO.setCompleteCnt(cnt);
//自己成绩
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());
}
public List<ExerciseDoneResultDO> getPaperDoneDetail(ExerciseDoneResultDO exerciseDoneResultDO) { public List<ExerciseDoneResultDO> getPaperDoneDetail(ExerciseDoneResultDO exerciseDoneResultDO) {
return exerciseDoneResultMapper.selectList(new QueryWrapper<ExerciseDoneResultDO>() return exerciseDoneResultMapper.selectList(new QueryWrapper<ExerciseDoneResultDO>()
.lambda() .lambda()
......
...@@ -20,6 +20,7 @@ import com.subsidy.service.SignInRecordService; ...@@ -20,6 +20,7 @@ import com.subsidy.service.SignInRecordService;
import com.subsidy.util.ConstantUtils; import com.subsidy.util.ConstantUtils;
import com.subsidy.util.DateFormatUtil; import com.subsidy.util.DateFormatUtil;
import com.subsidy.util.MathUtil; import com.subsidy.util.MathUtil;
import com.subsidy.util.MyBeanUtils;
import com.subsidy.util.RedisUtil; import com.subsidy.util.RedisUtil;
import com.subsidy.vo.member.GetMemberSignInfoVO; import com.subsidy.vo.member.GetMemberSignInfoVO;
import com.subsidy.vo.sign.ClassSignInfoVO; import com.subsidy.vo.sign.ClassSignInfoVO;
...@@ -87,24 +88,19 @@ public class SignInRecordServiceImpl extends ServiceImpl<SignInRecordMapper, Sig ...@@ -87,24 +88,19 @@ public class SignInRecordServiceImpl extends ServiceImpl<SignInRecordMapper, Sig
IPage<ClassSignInfoVO> classSignInfoVOIPage = this.baseMapper.classSignInfo(pager, classSignInfoDTO.getClassName(), classSignInfoDTO.getCourseName(), classSignInfoDTO.getCompanyId()); IPage<ClassSignInfoVO> classSignInfoVOIPage = this.baseMapper.classSignInfo(pager, classSignInfoDTO.getClassName(), classSignInfoDTO.getCourseName(), classSignInfoDTO.getCompanyId());
List<ClassSignInfoVO> classSignInfoVOS = classSignInfoVOIPage.getRecords(); List<ClassSignInfoVO> classSignInfoVOS = classSignInfoVOIPage.getRecords();
final ExecutorService newCachedThreadPool = Executors.newCachedThreadPool();
for (ClassSignInfoVO classSignInfoVO : classSignInfoVOS) { for (ClassSignInfoVO classSignInfoVO : classSignInfoVOS) {
newCachedThreadPool.execute(()->classSignInfoTask(classSignInfoVO)); ClassSignInfoVO classSignInfoVO1 = vodPlayHistoryMapper.classStudyHistory(classSignInfoVO.getClassId());
String[] nullParams = MyBeanUtils.getNullPropertyNames(classSignInfoVO1);
BeanUtils.copyProperties(classSignInfoVO1,classSignInfoVO,nullParams);
//平均签到数 向下取整
long signCount = redisUtil.scan(RedisPrefixConstant.SUBSIDY_SIGN_INFO_PREFIX + "*:classId:" + classSignInfoVO.getClassId() + ":*").stream().count();
classSignInfoVO.setAvgSignCount(MathUtil.intDivCeil(signCount, classSignInfoVO1.getMemberCount()));
} }
newCachedThreadPool.shutdown();
classSignInfoVOIPage.setRecords(classSignInfoVOS); classSignInfoVOIPage.setRecords(classSignInfoVOS);
return classSignInfoVOIPage; return classSignInfoVOIPage;
} }
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();
classSignInfoVO.setAvgSignCount(MathUtil.intDivCeil(signCount, classSignInfoVO1.getMemberCount()));
}
public SignInStatusVO signInStatus(SignInRecordDO signInRecordDO) { public SignInStatusVO signInStatus(SignInRecordDO signInRecordDO) {
...@@ -117,7 +113,7 @@ public class SignInRecordServiceImpl extends ServiceImpl<SignInRecordMapper, Sig ...@@ -117,7 +113,7 @@ public class SignInRecordServiceImpl extends ServiceImpl<SignInRecordMapper, Sig
long size = redisUtil.scan(RedisPrefixConstant.SUBSIDY_SIGN_INFO_PREFIX + "memberId:" + signInRecordDO.getMemberId() + "*:" + DateFormatUtil.format(new Date(), "yyyyMMdd")+"*").stream().count(); long size = redisUtil.scan(RedisPrefixConstant.SUBSIDY_SIGN_INFO_PREFIX + "memberId:" + signInRecordDO.getMemberId() + "*:" + DateFormatUtil.format(new Date(), "yyyyMMdd")+"*").stream().count();
if (size != count) { if (size != count) {
signInStatusVO.setStatus(flag); signInStatusVO.setStatus(false);
} }
return signInStatusVO; return signInStatusVO;
...@@ -134,7 +130,7 @@ public class SignInRecordServiceImpl extends ServiceImpl<SignInRecordMapper, Sig ...@@ -134,7 +130,7 @@ public class SignInRecordServiceImpl extends ServiceImpl<SignInRecordMapper, Sig
//预写公司设置数据 //预写公司设置数据
List<ClassHourDictDO> classHourDictDOS = classHourDictMapper.selectList(null); List<ClassHourDictDO> classHourDictDOS = classHourDictMapper.selectList(null);
for (ClassHourDictDO classHourDictDO : classHourDictDOS) { for (ClassHourDictDO classHourDictDO : classHourDictDOS) {
redisUtil.set("subsidySettings:" + classHourDictDO.getCompanyId(), classHourDictDO); redisUtil.set("subsidySettings:"+ classHourDictDO.getCompanyId(), classHourDictDO);
} }
//预写学生账号数据 //预写学生账号数据
......
...@@ -16,7 +16,7 @@ public abstract class BaseModel { ...@@ -16,7 +16,7 @@ public abstract class BaseModel {
* 创建时间 * 创建时间
*/ */
@JsonIgnore @JsonIgnore
// @TableField(insertStrategy = FieldStrategy.NEVER, updateStrategy = FieldStrategy.NEVER, value = "create_date", fill = FieldFill.INSERT) @TableField(insertStrategy = FieldStrategy.NEVER, updateStrategy = FieldStrategy.NEVER, value = "create_date", fill = FieldFill.INSERT)
private LocalDateTime createDate; private LocalDateTime createDate;
/** /**
......
package com.subsidy.util;
import org.springframework.beans.BeanWrapper;
import org.springframework.beans.BeanWrapperImpl;
import java.beans.PropertyDescriptor;
import java.util.HashSet;
import java.util.Set;
public class MyBeanUtils {
public static String[] getNullPropertyNames (Object source) {
final BeanWrapper src = new BeanWrapperImpl(source);
PropertyDescriptor[] pds = src.getPropertyDescriptors();
Set<String> emptyNames = new HashSet<>();
for(PropertyDescriptor pd : pds) {
Object srcValue = src.getPropertyValue(pd.getName());
// 此处判断可根据需求修改
if (srcValue == null) {
emptyNames.add(pd.getName());
}
}
String[] result = new String[emptyNames.size()];
return emptyNames.toArray(result);
}
}
...@@ -562,9 +562,9 @@ public class RedisUtil { ...@@ -562,9 +562,9 @@ public class RedisUtil {
// * @param pattern // * @param pattern
// * @return // * @return
// */ // */
//public Set keys(String pattern){ public Set keys(String pattern){
// return redisTemplate.keys(pattern); return redisTemplate.keys(pattern);
//} }
/** /**
* 模糊查询 * 模糊查询
...@@ -574,7 +574,7 @@ public class RedisUtil { ...@@ -574,7 +574,7 @@ public class RedisUtil {
public Set scan(String pattern) { public Set scan(String pattern) {
return redisTemplate.execute((RedisCallback<Set<String>>) redisConnection -> { return redisTemplate.execute((RedisCallback<Set<String>>) redisConnection -> {
Set keys = new HashSet<>(); Set keys = new HashSet<>();
Cursor<byte[]> cursor = redisConnection.scan(new ScanOptions.ScanOptionsBuilder().match(pattern).count(1000).build()); Cursor<byte[]> cursor = redisConnection.scan(new ScanOptions.ScanOptionsBuilder().match(pattern).count(Integer.MAX_VALUE).build());
while (cursor.hasNext()) { while (cursor.hasNext()) {
keys.add(new String(cursor.next())); keys.add(new String(cursor.next()));
} }
......
...@@ -5,12 +5,18 @@ import lombok.Data; ...@@ -5,12 +5,18 @@ import lombok.Data;
@Data @Data
public class GetMemberPapersVO { public class GetMemberPapersVO {
private Long id;
private Long paperId; private Long paperId;
private String score; private String score;
private Integer cnt; private Integer cnt;
private Integer result; private Integer rightCounts;
private Integer totalCounts;
private String result;
} }
...@@ -9,6 +9,10 @@ public class ContentVodVO { ...@@ -9,6 +9,10 @@ public class ContentVodVO {
private String content; private String content;
private Integer totalVods;
private Integer playVods;
private List<MemberVodVO> memberVodVOS; private List<MemberVodVO> memberVodVOS;
} }
...@@ -16,4 +16,6 @@ public class MemberVO { ...@@ -16,4 +16,6 @@ public class MemberVO {
private String image; private String image;
private Integer firstLogin; private Integer firstLogin;
private String companyName;
} }
...@@ -12,6 +12,8 @@ public class MyCoursesVO { ...@@ -12,6 +12,8 @@ public class MyCoursesVO {
private Long classId; private Long classId;
private String className;
private String courseName; private String courseName;
private String endDate; private String endDate;
......
...@@ -42,3 +42,4 @@ meishu.code-message[90001]=该类目已存在 ...@@ -42,3 +42,4 @@ meishu.code-message[90001]=该类目已存在
meishu.code-message[10001]=导入失败 meishu.code-message[10001]=导入失败
meishu.code-message[11001]=该行业已存在
\ No newline at end of file
...@@ -45,70 +45,70 @@ ...@@ -45,70 +45,70 @@
<select id="contentVodProcess" resultType="com.subsidy.vo.member.MemberVodVO"> <select id="contentVodProcess" resultType="com.subsidy.vo.member.MemberVodVO">
SELECT SELECT
t3.id, t3.id,
t3.vod_url, t3.vod_url,
t3.vod_name, t3.vod_name,
t3.vod_type, t3.vod_type,
t3.vod_length, t3.vod_length,
t3.play_record, t3.play_record,
IF IF
( t3.vod_length - t3.sumPlay > 0, t3.vod_length - t3.sumPlay, 0 ) AS leftLength, ( t3.vod_length - t3.sumPlay > 0, t3.vod_length - t3.sumPlay, 0 ) AS leftLength,
round( t3.sumPlay * 100 / t3.vod_length, 0 ) AS percent if(round( t3.sumPlay * 100 / t3.vod_length, 0 ) &lt; 100,round( t3.sumPlay * 100 / t3.vod_length, 0 ),100) AS percent
FROM FROM
( (
SELECT SELECT
t.id, t.id,
t.vod_url, t.vod_url,
t.vod_name, t.vod_name,
t.vod_type, t.vod_type,
t.vod_length, t.vod_length,
t.order_no, t.order_no,
ifnull( t2.sumPlay, 0 ) AS sumPlay, ifnull( t2.sumPlay, 0 ) AS sumPlay,
t4.play_record t4.play_record
FROM FROM
vod_dict t vod_dict t
LEFT JOIN ( LEFT JOIN (
SELECT SELECT
t.vod_id, t.vod_id,
t.member_id, t.member_id,
sum( t.play_length ) AS sumPlay sum( t.play_length ) AS sumPlay
FROM FROM
vod_play_history t vod_play_history t
WHERE WHERE
t.member_id = #{memberId} t.member_id = #{memberId}
GROUP BY GROUP BY
t.vod_id, t.vod_id,
t.member_id t.member_id
) t2 ON t.id = t2.vod_id ) t2 ON t.id = t2.vod_id
LEFT JOIN ( LEFT JOIN (
SELECT SELECT
t.member_id, t.member_id,
t.vod_id, t.vod_id,
t2.play_record t2.play_record
FROM FROM
( (
SELECT SELECT
t.member_id, t.member_id,
t.vod_id, t.vod_id,
max( t.create_date ) AS create_date max( t.create_date ) AS create_date
FROM FROM
vod_play_history t vod_play_history t
WHERE WHERE
t.delete_date IS NULL t.delete_date IS NULL
AND t.member_id = #{memberId} AND t.member_id = #{memberId}
GROUP BY GROUP BY
t.member_id, t.member_id,
t.vod_id t.vod_id
) t ) t
LEFT JOIN vod_play_history t2 ON t.vod_id = t2.vod_id LEFT JOIN vod_play_history t2 ON t.vod_id = t2.vod_id
AND t.member_id = t2.member_id AND t.member_id = t2.member_id
AND t.create_date = t2.create_date AND t.create_date = t2.create_date
) t4 ON t2.vod_id = t4.vod_id ) t4 ON t2.vod_id = t4.vod_id
WHERE WHERE
t.content_id = #{contentId} t.content_id = #{contentId}
) t3 ) t3
ORDER BY ORDER BY
t3.order_no t3.order_no
</select> </select>
<select id="contentFiles" parameterType="long" resultType="com.subsidy.model.FileDictDO"> <select id="contentFiles" parameterType="long" resultType="com.subsidy.model.FileDictDO">
......
...@@ -95,16 +95,25 @@ ...@@ -95,16 +95,25 @@
<select id="getMaxScorePaper" resultType="com.subsidy.model.ExerciseDoneResultDO"> <select id="getMaxScorePaper" resultType="com.subsidy.model.ExerciseDoneResultDO">
SELECT SELECT
max( t.score ), t2.right_counts,
t.right_counts, t2.total_counts,
t.total_counts, t2.result,
t.result t2.score
FROM FROM
exercise_done_result t (
SELECT
max( t.score ) AS score
FROM
exercise_done_result t
WHERE
t.delete_date IS NULL
AND t.paper_id = #{paperId}
AND t.member_id = #{memberId}
) t1
LEFT JOIN exercise_done_result t2 ON t1.score = t2.score
WHERE WHERE
t.delete_date IS NULL t2.paper_id = #{paperId}
AND t.paper_id = #{paperId} AND t2.member_id = #{memberId}
AND t.member_id = #{memberId}
</select> </select>
<select id="testScoreInfo" resultType="com.subsidy.vo.done.TestScoreInfoVO"> <select id="testScoreInfo" resultType="com.subsidy.vo.done.TestScoreInfoVO">
......
...@@ -19,4 +19,15 @@ ...@@ -19,4 +19,15 @@
id, field_name id, field_name
</sql> </sql>
<select id="queryFields" resultType="com.subsidy.model.FieldDictDO">
SELECT
t.id,
t.field_name
FROM
field_dict t
WHERE
t.delete_date IS NULL
AND t.field_name LIKE concat('%',#{fieldName} ,'%')
</select>
</mapper> </mapper>
...@@ -64,6 +64,7 @@ ...@@ -64,6 +64,7 @@
SELECT SELECT
t3.id AS courseId, t3.id AS courseId,
t2.id AS classId, t2.id AS classId,
t2.class_name,
t3.course_name, t3.course_name,
t2.end_date, t2.end_date,
t4.cnt AS totalCnt, t4.cnt AS totalCnt,
......
...@@ -47,8 +47,7 @@ ...@@ -47,8 +47,7 @@
vod_play_history t vod_play_history t
WHERE WHERE
t.delete_date IS NULL t.delete_date IS NULL
AND t.member_id = #{member_id} AND t.member_id = #{memberId}
GROUP BY GROUP BY
t.vod_id, t.vod_id,
t.member_id t.member_id
...@@ -231,21 +230,14 @@ ...@@ -231,21 +230,14 @@
<select id="memberRecentPlay" resultType="com.subsidy.vo.member.ContentVodNewVO"> <select id="memberRecentPlay" resultType="com.subsidy.vo.member.ContentVodNewVO">
SELECT SELECT
t2.id, t2.play_record,
ifnull(t1.play_record,0) as play_record t2.vod_id
FROM FROM
( ( SELECT max( t.create_date ) AS create_date FROM vod_play_history t WHERE t.delete_date is null and t.member_id = #{memberId} AND t.class_id = #{classId} ) t
SELECT LEFT JOIN vod_play_history t2 ON t.create_date = t2.create_date
t.vod_id, WHERE
max( t.create_date ) AS create_date, t2.member_id = #{memberId}
t.play_record AND t2.class_id = #{classId}
FROM
vod_play_history t
WHERE
t.member_id = #{memberId}
AND t.class_id = #{classId}
) t1
LEFT JOIN vod_dict t2 ON t1.vod_id = t2.id
</select> </select>
...@@ -303,7 +295,7 @@ ...@@ -303,7 +295,7 @@
<select id="memberVodTotalLength" resultType="integer"> <select id="memberVodTotalLength" resultType="integer">
SELECT SELECT
sum( t.play_length ) ifnull(sum( t.play_length ),0)
FROM FROM
vod_play_history t vod_play_history t
WHERE WHERE
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!