Commit 62d6ca01 by 涂亚平

临时上个版本 联调中

1 parent 930509dc
Showing with 1174 additions and 415 deletions
......@@ -208,10 +208,10 @@
<version>${jedis.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-mongodb</artifactId>
</dependency>
<!-- <dependency>-->
<!-- <groupId>org.springframework.boot</groupId>-->
<!-- <artifactId>spring-boot-starter-data-mongodb</artifactId>-->
<!-- </dependency>-->
</dependencies>
......
......@@ -14,11 +14,11 @@ public class WechatConfig {
private String appSecret;
private String msgUrl;
private String templateId;
private String agentId;
//private String msgUrl;
//
//private String templateId;
//
//private String agentId;
}
package com.subsidy.controller;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.subsidy.common.ResponseData;
import com.subsidy.common.ResponseVO;
import com.subsidy.common.configure.RestTemplateConfig;
import com.subsidy.common.configure.WechatConfig;
import com.subsidy.mapper.AccessTokenMapper;
import com.subsidy.model.AccessTokenDO;
import com.subsidy.util.ConstantUtils;
import com.subsidy.util.SecretUtils;
import com.subsidy.vo.wechat.AccessTokenVO;
import com.subsidy.vo.wechat.AuthenRequestVO;
import com.subsidy.vo.wechat.AuthenTokenVO;
import com.subsidy.vo.wechat.JsSdkVO;
import com.subsidy.vo.wechat.SignVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpMethod;
import org.springframework.http.ResponseEntity;
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.RestController;
import java.time.Duration;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
/**
* <p>
* 前端控制器
* </p>
*
* @author DengMin
* @since 2022-02-18
*/
@RestController
@Api(tags = "微信")
@RequestMapping("/wechat")
public class AccessTokenController {
@Autowired
private RestTemplateConfig restTemplateConfig;
@Autowired
private WechatConfig wechatConfig;
@Autowired
private AccessTokenMapper accessTokenMapper;
@PostMapping("/getJsapiTicket")
@ApiOperation("通过token请求获得jsapi_ticket {url}")
public ResponseVO getJsapiTicket(@RequestBody SignVO signVO) {
List<AccessTokenDO> accessTokens = accessTokenMapper.selectList(null);
String accessToken = "";
if (accessTokens.size()==0){
String url = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=" + wechatConfig.getAppId() + "&secret=" + wechatConfig.getAppSecret();
ResponseEntity<AccessTokenVO> response = restTemplateConfig.restTemplate()
.exchange(url, HttpMethod.GET, null, AccessTokenVO.class);
accessToken = response.getBody().getAccess_token();
AccessTokenDO accessToken1 = new AccessTokenDO();
accessToken1.setAccessToken(accessToken);
accessToken1.setUpdateDate(LocalDateTime.now());
accessTokenMapper.insert(accessToken1);
}else {
AccessTokenDO accessToken1 = accessTokens.get(0);
long diff = Duration.between(accessToken1.getUpdateDate(),LocalDateTime.now()).toMillis();
if (diff>=2*60*60*1000-5*1000){
String url = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=" + wechatConfig.getAppId() + "&secret=" + wechatConfig.getAppSecret();
ResponseEntity<AccessTokenVO> response = restTemplateConfig.restTemplate()
.exchange(url, HttpMethod.GET, null, AccessTokenVO.class);
accessToken = response.getBody().getAccess_token();
// AccessToken accessToken2= new AccessToken();
accessToken1.setAccessToken(accessToken);
accessToken1.setUpdateDate(LocalDateTime.now());
accessTokenMapper.updateById(accessToken1);
}else {
accessToken = accessToken1.getAccessToken();
}
}
signVO.setAccess_token(accessToken);
String url1 = "https://api.weixin.qq.com/cgi-bin/ticket/getticket?access_token=" + accessToken+ "&type=jsapi";
ResponseEntity<JsSdkVO> response1 = restTemplateConfig.restTemplate()
.exchange(url1, HttpMethod.GET, null, JsSdkVO.class);
String ticket = response1.getBody().getTicket();
signVO.setJsapi_ticket(ticket);
signVO.setNoncestr("1rtgtafNdHhxADMD");
signVO.setTimestamp(String.valueOf(System.currentTimeMillis()));
String signStr = "jsapi_ticket=" + signVO.getJsapi_ticket() + "&noncestr=" + signVO.getNoncestr() + "&timestamp=" + signVO.getTimestamp()
+ "&url=" + signVO.getUrl();
signVO.setSign(SecretUtils.getSHAString(signStr));
return ResponseData.generateCreatedResponse(0,signVO);
}
}
......@@ -36,28 +36,28 @@ public class ClassDictController {
private ClassDictService classDictService;
@PostMapping("getAllClasses")
@ApiOperation("获取某公司下的所有课程 companyId 所选企业id className 班级名称 openStatus 开放状态 startDate 开始时间 endDate 结束时间")
@ApiOperation("获取某公司下的所有班级 companyId 所选企业id className 班级名称 openStatus 开放状态 startDate 开始时间 endDate 结束时间")
@LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
public ResponseVO getAllClasses(@RequestBody ClassDictDO classDictDO){
return ResponseData.generateCreatedResponse(0,classDictService.getAllClasses(classDictDO));
}
@PostMapping("deleteClasses")
@ApiOperation(" 删除课程 id")
@ApiOperation(" 删除班级 id")
@LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
public ResponseVO deleteClasses(@RequestBody ClassDictDO classDictDO){
return ResponseData.generateCreatedResponse(0,classDictService.deleteClasses(classDictDO));
}
@PostMapping("addClass")
@ApiOperation("添加课程 userId:登录人id companyId courseId classType className startDate endDate isOrder 是否按照顺序播放 isFastPlay 是否快进 memberId [] 班级学员 classNoticeDOS[noticeType isAuto noticeTime]")
@ApiOperation("添加班级 userId:登录人id companyId courseId classType className startDate endDate testRule 是否视频看完再做测试 isOrder 是否按照顺序播放 isFastPlay 是否快进 memberIds [] 班级学员 classNoticeDOS[noticeType noticeTime]")
@LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
public ResponseVO addClass(@RequestBody AddClassDTO addClassDTO){
return ResponseData.generateCreatedResponse(0,classDictService.addClass(addClassDTO));
}
@PostMapping("updateClass")
@ApiOperation("修改课程 id ** companyId courseId className startDate endDate")
@ApiOperation("修改班级 id companyId courseId className startDate endDate")
@LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
public ResponseVO updateClass(@RequestBody ClassDictDO classDictDO){
return ResponseData.generateCreatedResponse(0,classDictService.updateClass(classDictDO));
......
......@@ -4,6 +4,7 @@ package com.subsidy.controller;
import com.subsidy.common.ResponseData;
import com.subsidy.common.ResponseVO;
import com.subsidy.common.interceptor.LoginRequired;
import com.subsidy.dto.course.AddCourseDTO;
import com.subsidy.dto.course.QueryCoursesDTO;
import com.subsidy.dto.course.UpdateCoursesDTO;
import com.subsidy.model.CourseDictDO;
......@@ -34,10 +35,10 @@ public class CourseDictController {
private CourseDictService courseDictService;
@PostMapping("addCourse")
@ApiOperation("添加课程 companyId courseName categoryId courseType courseSource")
@ApiOperation("添加课程 companyId courseName courseType coverPage openStatus fieldDictDOS[] categoryDOS[] jobDictDOS[] rankDictDOS[]")
@LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
public ResponseVO addCourse(@RequestBody CourseDictDO courseDictDO){
return ResponseData.generateCreatedResponse(0,courseDictService.addCourse(courseDictDO));
public ResponseVO addCourse(@RequestBody AddCourseDTO addCourseDTO){
return ResponseData.generateCreatedResponse(0,courseDictService.addCourse(addCourseDTO));
}
@PostMapping("deleteCourse")
......@@ -48,21 +49,21 @@ public class CourseDictController {
}
@PostMapping("queryCourses")
@ApiOperation("平台运营者--查询课程 pageSize pageNum courseName fieldId categoryId jobId rankId courseType")
@ApiOperation("平台运营者--查询课程 pageSize pageNum courseName fieldId categoryId jobId rankId courseType openStatus")
@LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
public ResponseVO queryCourses(@RequestBody QueryCoursesDTO queryCoursesDTO){
return ResponseData.generateCreatedResponse(0,courseDictService.queryCourses(queryCoursesDTO));
}
@PostMapping("updateCourses")
@ApiOperation("编辑课程 id courseName courseType coverPage fieldDictDOS categoryDOS jobDictDOS rankDictDOS ")
@ApiOperation("编辑课程 id courseName courseType coverPage openStatus fieldDictDOS[] categoryDOS[] jobDictDOS[] rankDictDOS[]")
@LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
public ResponseVO updateCourses(@RequestBody UpdateCoursesDTO updateCoursesDTO){
return ResponseData.generateCreatedResponse(0,courseDictService.updateCourses(updateCoursesDTO));
}
@PostMapping("queryCompanyCourse")
@ApiOperation("企业内容管理-- { companyId 所选企业id pageSize pageNum courseName categoryId jobId rankId }")
@ApiOperation("企业内容管理-- { companyId 所选企业id pageSize pageNum courseName categoryId jobId rankId openStatus}")
public ResponseVO queryCompanyCourse(@RequestBody QueryCoursesDTO queryCoursesDTO){
return ResponseData.generateCreatedResponse(0,courseDictService.queryCompanyCourse(queryCoursesDTO));
}
......
......@@ -62,7 +62,7 @@ public class DepartmentDictController {
}
@PostMapping("getDepartmentMembers")
@ApiOperation("获取部门成员 companyId 公司id id 部门id")
@ApiOperation("获取部门成员 companyId 公司id departmentId 部门id userName")
public ResponseVO getDepartmentMembers(@RequestBody GetDepartmentMembersDTO getDepartmentMembersDTO){
return ResponseData.generateCreatedResponse(0,departmentDictService.getDepartmentMembers(getDepartmentMembersDTO));
}
......
......@@ -50,7 +50,7 @@ public class JobDictController {
}
@PostMapping("updateJob")
@ApiOperation("更新岗位 jobName")
@ApiOperation("更新岗位 id jobName")
public ResponseVO updateJob(@RequestBody JobDictDO jobDictDO){
return ResponseData.generateCreatedResponse(0,jobDictService.updateJob(jobDictDO));
}
......
......@@ -54,14 +54,14 @@ public class MemberController {
}
@PostMapping("addMember")
@ApiOperation("新增成员 companyId departmentId userName accountName telephone gender image idCard")
@ApiOperation("新增成员 companyId userName accountName telephone gender image idCard departmentIds jobIds")
@LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
public ResponseVO addMember(@RequestBody AddMemberDTO addMemberDTO){
return ResponseData.generateCreatedResponse(0,memberService.addMember(addMemberDTO));
}
@PostMapping("updateMember")
@ApiOperation("编辑成员 {id companyId departmentId userName accountName telephone gender image idCard status}")
@ApiOperation("编辑成员 {id companyId userName accountName telephone gender image idCard status departmentIds jobIds}")
@LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
public ResponseVO updateMember(@RequestBody AddMemberDTO addMemberDTO){
return ResponseData.generateCreatedResponse(0,memberService.updateMember(addMemberDTO));
......@@ -98,7 +98,7 @@ public class MemberController {
}
@PostMapping("contentVod")
@ApiOperation("手机端:目录+视频 courseId 课程 memberId 学员id")
@ApiOperation("手机端:目录+视频 classId 班级id courseId 课程 memberId 学员id")
public ResponseVO contentVod(@RequestBody ContentMemberDTO contentVodDTO){
return ResponseData.generateCreatedResponse(0,memberService.contentVod(contentVodDTO));
}
......
......@@ -45,7 +45,7 @@ public class RankDictController {
}
@PostMapping("updateRank")
@ApiOperation("添加职级 id companyId rank")
@ApiOperation("添加职级 id rank")
public ResponseVO updateRank(@RequestBody RankDictDO rankDictDO){
return ResponseData.generateCreatedResponse(0,rankDictService.updateRank(rankDictDO));
}
......
......@@ -5,7 +5,7 @@ import com.subsidy.common.ResponseData;
import com.subsidy.common.ResponseVO;
import com.subsidy.common.interceptor.LoginRequired;
import com.subsidy.dto.member.GetMemberSignInfoDTO;
import com.subsidy.dto.sign.ClassSignInfoDTO;
import com.subsidy.dto.sign.DataViewDTO;
import com.subsidy.model.SignInRecordDO;
import com.subsidy.service.SignInRecordService;
import com.subsidy.util.ConstantUtils;
......@@ -45,11 +45,11 @@ public class SignInRecordController {
return ResponseData.generateCreatedResponse(0, signInRecordService.signIn(signInRecordDO));
}
@PostMapping("classStudyHistory")
@ApiOperation("校区学习记录 id 校区id className courseName pageSize pageNum")
//@LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
public ResponseVO classSignInfo(@RequestBody ClassSignInfoDTO classSignInfoDTO) {
return ResponseData.generateCreatedResponse(0, signInRecordService.classSignInfo(classSignInfoDTO));
@PostMapping("dataView")
@ApiOperation("数据概览 id 校区id className courseName pageSize pageNum")
@LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
public ResponseVO dataView(@RequestBody DataViewDTO classSignInfoDTO) {
return ResponseData.generateCreatedResponse(0, signInRecordService.dataView(classSignInfoDTO));
}
@PostMapping("signInStatus")
......
......@@ -5,6 +5,7 @@ import com.subsidy.common.ResponseData;
import com.subsidy.common.ResponseVO;
import com.subsidy.common.interceptor.LoginRequired;
import com.subsidy.dto.content.GetContendVodsDTO;
import com.subsidy.dto.vod.ChangeOrdersDTO;
import com.subsidy.model.VodDictDO;
import com.subsidy.service.VodDictService;
import com.subsidy.util.ConstantUtils;
......@@ -54,7 +55,7 @@ public class VodDictController {
@PostMapping("addVod")
@ApiOperation("新增视频 contentId vodName vodLength vodType vodSize vodUrl vodCode")
@LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
//@LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
public ResponseVO addVod(@RequestBody VodDictDO vodDictDO) {
return ResponseData.generateCreatedResponse(0, vodDictService.addVod(vodDictDO));
}
......@@ -66,5 +67,10 @@ public class VodDictController {
return ResponseData.generateCreatedResponse(0, vodDictService.updateVod(vodDictDO));
}
@PostMapping("changeOrders")
@ApiOperation("排序 vodIds [] 视频的id")
public ResponseVO changeOrders(@RequestBody ChangeOrdersDTO changeOrdersDTO ){
return ResponseData.generateCreatedResponse(0,vodDictService.changeOrders(changeOrdersDTO));
}
}
......@@ -6,7 +6,6 @@ import com.subsidy.common.ResponseData;
import com.subsidy.common.ResponseVO;
import com.subsidy.dto.vod.RemainSecondsDTO;
import com.subsidy.dto.vod.SignDatePlaysDTO;
import com.subsidy.dto.vod.FixDataTwoDTO;
import com.subsidy.model.VodPlayHistoryDO;
import com.subsidy.service.VodPlayHistoryService;
import io.swagger.annotations.Api;
......@@ -63,4 +62,11 @@ public class VodPlayHistoryController {
public void remainSeconds(@RequestBody RemainSecondsDTO remainSecondsDTO){
vodPlayHistoryService.remainSeconds(remainSecondsDTO);
}
@PostMapping("playLengthFix")
@ApiOperation("按照时长去跑脚本 {classId}")
public void playLengthFix(@RequestBody RemainSecondsDTO remainSecondsDTO){
vodPlayHistoryService.playLengthFix(remainSecondsDTO);
}
}
package com.subsidy.dto.course;
import com.subsidy.model.CategoryDO;
import com.subsidy.model.FieldDictDO;
import com.subsidy.model.JobDictDO;
import com.subsidy.model.RankDictDO;
import lombok.Data;
import java.util.List;
@Data
public class AddCourseDTO {
/**
* 企业id
*/
private Long companyId;
/**
* 课程名称
*/
private String courseName;
/**
* 课程类型
*/
private String courseType;
/**
* 课程来源
*/
private String courseSource;
/**
* 封面
*/
private String coverPage;
/**
* 开放状态
*/
private Integer openStatus;
/**
* 行业范围
*/
private List<Long> fieldDictDOS;
/**
* 课程类目
*/
private List<Long> categoryDOS;
/**
* 适用岗位
*/
private List<Long> jobDictDOS;
/**
* 适用职级
*/
private List<Long> rankDictDOS;
}
......@@ -23,4 +23,6 @@ public class QueryCoursesDTO {
private Long companyId;
private Integer openStatus;
}
package com.subsidy.dto.course;
import com.subsidy.model.CategoryDO;
import com.subsidy.model.FieldDictDO;
import com.subsidy.model.JobDictDO;
import com.subsidy.model.RankDictDO;
import lombok.Data;
import java.util.List;
......@@ -36,22 +32,22 @@ public class UpdateCoursesDTO {
/**
* 行业范围
*/
private List<FieldDictDO> fieldDictDOS;
private List<Long> fieldDictDOS;
/**
* 课程类目
*/
private List<CategoryDO> categoryDOS;
private List<Long> categoryDOS;
/**
* 适用岗位
*/
private List<JobDictDO> jobDictDOS;
private List<Long> jobDictDOS;
/**
* 适用职级
*/
private List<RankDictDO> rankDictDOS;
private List<Long> rankDictDOS;
}
package com.subsidy.dto.member;
import com.subsidy.model.DepartmentDictDO;
import com.subsidy.model.MemberDO;
import lombok.Data;
......@@ -11,4 +10,6 @@ public class AddMemberDTO extends MemberDO {
private List<Long> departmentIds;
private List<Long> jobIds;
}
......@@ -11,18 +11,20 @@ public class ImportMemberDTO {
@ExcelColumnUtil(value = "姓名", col = 1)
private String userName;
@ExcelColumnUtil(value = "性别", col = 2)
private String gender;
@ExcelColumnUtil(value = "账号", col = 3)
private String accountName;
@ExcelColumnUtil(value = "手机", col = 4)
@ExcelColumnUtil(value = "手机号", col = 2)
private String telephone;
@ExcelColumnUtil(value = "身份证号", col = 5)
@ExcelColumnUtil(value = "部门", col = 3)
private String departments;
@ExcelColumnUtil(value = "身份证号码", col = 4)
private String idCard;
@ExcelColumnUtil(value = "性别(男/女)", col = 5)
private String gender;
@ExcelColumnUtil(value = "英文名", col = 6)
private String accountNameEn;
}
......@@ -3,7 +3,7 @@ package com.subsidy.dto.sign;
import lombok.Data;
@Data
public class ClassSignInfoDTO {
public class DataViewDTO {
private String className;
......
......@@ -2,9 +2,11 @@ package com.subsidy.dto.vod;
import lombok.Data;
import java.util.List;
@Data
public class DataFixTwoDTO {
public class ChangeOrdersDTO {
private Integer classId;
private List<Long> vodIds;
}
......@@ -11,13 +11,9 @@ import com.subsidy.model.SignInRecordDO;
import com.subsidy.util.DateFormatUtil;
import com.subsidy.util.RedisUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Set;
......@@ -48,8 +44,6 @@ public class SchedulerJob {
@Autowired
private RedisUtil redisUtil;
@Autowired
private MongoTemplate mongoTemplate;
/**
删除十天前登录记录(管理端)
*/
......
package com.subsidy.mapper;
import com.subsidy.model.AccessTokenDO;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.springframework.stereotype.Repository;
/**
* <p>
* Mapper 接口
* </p>
*
* @author DengMin
* @since 2022-02-18
*/
@Repository
public interface AccessTokenMapper extends BaseMapper<AccessTokenDO> {
}
......@@ -24,7 +24,7 @@ public interface CompanyDictMapper extends BaseMapper<CompanyDictDO> {
* 企业管理--查找所有主账号
* @return
*/
IPage<OperatorsVO> operators(IPage page, String companyName,Long fieldId);
IPage<OperatorsVO> operators(IPage page, String companyName,Long fieldId,Integer role);
/**
* 查找所有的公司名称
......
......@@ -26,7 +26,7 @@ public interface CourseDictMapper extends BaseMapper<CourseDictDO> {
* courseName fieldId categoryId jobId courseRank courseType
* @return
*/
IPage<QueryCoursesVO > queryCourses(IPage page, String courseName, Long fieldId,Long categoryId,Long jobId,Long rankId, String courseType,Long companyId);
IPage<QueryCoursesVO > queryCourses(IPage page, String courseName, Long fieldId,Long categoryId,Long jobId,Long rankId, String courseType,Long companyId,Integer openStatus);
/**
* 通过课程id查询课程下的学生-----弃用
......
package com.subsidy.mapper;
import com.subsidy.model.CompanyDictDO;
import com.subsidy.model.JobDictDO;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.springframework.stereotype.Repository;
......@@ -23,4 +24,15 @@ public interface JobDictMapper extends BaseMapper<JobDictDO> {
*/
List<JobDictDO> queryCourseJobs(Long courseId);
/**
* 获取某个人的岗位
*/
List<JobDictDO> queryMemberJobs(Long memberId);
/**
* 查询岗位
* @param companyId
* @return
*/
List<JobDictDO> queryJobs(Long companyId);
}
......@@ -3,7 +3,7 @@ package com.subsidy.mapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.subsidy.model.SignInRecordDO;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.subsidy.vo.sign.ClassSignInfoVO;
import com.subsidy.vo.sign.DataViewVO;
import org.springframework.stereotype.Repository;
import java.util.List;
......@@ -12,10 +12,10 @@ import java.util.List;
public interface SignInRecordMapper extends BaseMapper<SignInRecordDO> {
/**
* 公司学习记录
* 数据概览
*/
IPage<ClassSignInfoVO> classSignInfo(IPage iPage, String className, String courseName, Integer id);
IPage<DataViewVO> classSignInfo(IPage iPage, String className, String courseName, Integer id);
List<SignInRecordDO> getSignInRecord();
......
......@@ -23,7 +23,7 @@ public interface VodDictMapper extends BaseMapper<VodDictDO> {
/**
* 查看某个目录下的视频
*/
IPage<GetContendVodsVO> getContendVods(IPage page,String vodName,Long contentId);
List<GetContendVodsVO> getContendVods(String vodName,Long contentId);
/**
* 查看某个课程下的视频
......@@ -34,4 +34,9 @@ public interface VodDictMapper extends BaseMapper<VodDictDO> {
* 获取某课程下,学习人数和平均学习时长
*/
ClassVodCompleteInfoVO classVodCompleteInfo(Long classId, Long vodId,List<Long> memberIds,String vodName);
/**
* 修改某个视频的顺序
*/
void updateVodOrderNo(Long id,Integer orderNo);
}
......@@ -5,7 +5,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.subsidy.model.VodPlayHistoryDO;
import com.subsidy.vo.administer.MemberStudyLogVO;
import com.subsidy.vo.member.ContentVodNewVO;
import com.subsidy.vo.sign.ClassSignInfoVO;
import com.subsidy.vo.sign.DataViewVO;
import com.subsidy.vo.vod.ClassMemberPlayLengthVO;
import com.subsidy.vo.vod.GetMemberStudyInfoVO;
import com.subsidy.vo.vod.StudyHistoryVO;
......@@ -52,10 +52,10 @@ public interface VodPlayHistoryMapper extends BaseMapper<VodPlayHistoryDO> {
*/
int completeVodOrNot(Long memberId, Long vodId);
/**
* 查看某个班级的学习记录
*/
ClassSignInfoVO classStudyHistory(Long classId);
///**
// * 查看某个班级的学习记录
// */
//DataViewVO classStudyHistory(Long classId);
/**
* 查看这个课程某个成员看的视频课程
......
package com.subsidy.model;
import com.subsidy.util.BaseModel;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* <p>
*
* </p>
*
* @author DengMin
* @since 2022-02-18
*/
@Data
@EqualsAndHashCode(callSuper = true)
@TableName("access_token")
public class AccessTokenDO extends BaseModel {
private static final long serialVersionUID = 1L;
@TableId(value = "id", type = IdType.AUTO)
private Integer id;
private String accessToken;
}
......@@ -73,5 +73,10 @@ public class ClassDictDO extends BaseModel {
*/
private String openStatus;
/**
* 测试规则
*/
private Integer testRule;
}
......@@ -37,11 +37,6 @@ public class ClassNoticeDO extends BaseModel {
private String noticeType;
/**
* 是否自动通知
*/
private Integer isAuto;
/**
* 通知时间
*/
private String noticeTime;
......
......@@ -39,19 +39,19 @@ public class CourseDictDO extends BaseModel {
private String courseName;
/**
* 类目id
*/
private Long categoryId;
/**
* 课程类型
*/
private String courseType;
/**
* 课程来源
* 课程封面
*/
private String courseSource;
private String coverPage;
/**
* 课程开放状态
*/
private Integer openStatus;
}
......@@ -27,7 +27,7 @@ public class CourseFieldMappingDO extends BaseModel {
private Long courseId;
private Long fieldMapping;
private Long fieldId;
}
......@@ -36,6 +36,11 @@ public class MemberDO extends BaseModel {
private String accountName;
/**
* 英文名
*/
private String accountNameEn;
/**
* 姓名
*/
private String userName;
......
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<MongoDO> 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<Collection> collections = mongoTemplate.findAll(Collection.class);
//System.out.println(collections);
//
//Query query = new Query(Criteria.where("name").regex("张"));//可累加条件
//List<Collection> 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<Collection> 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);
}
}
//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<MongoDO> 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<Collection> collections = mongoTemplate.findAll(Collection.class);
// //System.out.println(collections);
// //
// //Query query = new Query(Criteria.where("name").regex("张"));//可累加条件
// //List<Collection> 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<Collection> 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);
//
//
// }
//
//}
package com.subsidy.service;
import com.subsidy.model.AccessTokenDO;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* <p>
* 服务类
* </p>
*
* @author DengMin
* @since 2022-02-18
*/
public interface AccessTokenService extends IService<AccessTokenDO> {
}
package com.subsidy.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.subsidy.dto.course.AddCourseDTO;
import com.subsidy.dto.course.QueryCoursesDTO;
import com.subsidy.dto.course.UpdateCoursesDTO;
import com.subsidy.model.CourseDictDO;
......@@ -16,7 +17,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
*/
public interface CourseDictService extends IService<CourseDictDO> {
String addCourse(CourseDictDO courseDictDO);
String addCourse(AddCourseDTO addCourseDTO);
String deleteCourse(CourseDictDO courseDictDO);
......
......@@ -3,7 +3,7 @@ package com.subsidy.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
import com.subsidy.dto.member.GetMemberSignInfoDTO;
import com.subsidy.dto.sign.ClassSignInfoDTO;
import com.subsidy.dto.sign.DataViewDTO;
import com.subsidy.model.SignInRecordDO;
import com.subsidy.vo.member.GetMemberSignInfoVO;
import com.subsidy.vo.sign.SignInStatusVO;
......@@ -22,7 +22,7 @@ public interface SignInRecordService extends IService<SignInRecordDO> {
String signIn(SignInRecordDO signInRecordDO);
IPage classSignInfo(ClassSignInfoDTO classSignInfoDTO);
IPage dataView(DataViewDTO classSignInfoDTO);
SignInStatusVO signInStatus(SignInRecordDO signInRecordDO);
......
......@@ -3,10 +3,13 @@ package com.subsidy.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
import com.subsidy.dto.content.GetContendVodsDTO;
import com.subsidy.dto.vod.ChangeOrdersDTO;
import com.subsidy.model.VodDictDO;
import com.subsidy.vo.vod.GetContendVodsVO;
import com.subsidy.vo.vod.SignatureVO;
import java.util.List;
/**
* <p>
* 视频表 服务类
......@@ -19,11 +22,13 @@ public interface VodDictService extends IService<VodDictDO> {
SignatureVO signature()throws Exception;
IPage<GetContendVodsVO> getContendVods(GetContendVodsDTO getContendVodsDTO);
List<GetContendVodsVO> getContendVods(GetContendVodsDTO getContendVodsDTO);
String deleteVod(VodDictDO vodDictDO);
String addVod(VodDictDO vodDictDO);
String updateVod(VodDictDO vodDictDO);
String changeOrders(ChangeOrdersDTO changeOrdersDTO);
}
......@@ -25,4 +25,6 @@ public interface VodPlayHistoryService extends IService<VodPlayHistoryDO> {
void signDatePlays(SignDatePlaysDTO dataFixDTO);
void remainSeconds(RemainSecondsDTO remainSecondsDTO);
void playLengthFix(RemainSecondsDTO remainSecondsDTO);
}
package com.subsidy.service.impl;
import com.subsidy.model.AccessTokenDO;
import com.subsidy.mapper.AccessTokenMapper;
import com.subsidy.service.AccessTokenService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
/**
* <p>
* 服务实现类
* </p>
*
* @author DengMin
* @since 2022-02-18
*/
@Service
public class AccessTokenServiceImpl extends ServiceImpl<AccessTokenMapper, AccessTokenDO> implements AccessTokenService {
}
......@@ -326,7 +326,7 @@ public class AdministerServiceImpl extends ServiceImpl<AdministerMapper, Adminis
public IPage<OperatorsVO> operators(OperatorsDTO operatorsDTO) {
Page pager = new Page(operatorsDTO.getPageNum(), operatorsDTO.getPageSize());
IPage<OperatorsVO> operatorsVOIPage = companyDictMapper.operators(pager, operatorsDTO.getCompanyName(), operatorsDTO.getFieldId());
IPage<OperatorsVO> operatorsVOIPage = companyDictMapper.operators(pager, operatorsDTO.getCompanyName(), operatorsDTO.getFieldId(),0);
List<OperatorsVO> operatorsVOS = operatorsVOIPage.getRecords();
for (OperatorsVO operatorsVO : operatorsVOS) {
......@@ -436,7 +436,7 @@ public class AdministerServiceImpl extends ServiceImpl<AdministerMapper, Adminis
}
//签到人数 这个人签到了就算签过了
classSummaryVO.setSignCount(signCnt);
classSummaryVO.setSignCnt(signCnt);
//测试通过率
classSummaryVO.setPassCnt(testCnt);
......@@ -448,7 +448,7 @@ public class AdministerServiceImpl extends ServiceImpl<AdministerMapper, Adminis
Integer count = answeringQuestionMapper.selectCount(new QueryWrapper<AnsweringQuestionDO>()
.lambda()
.eq(AnsweringQuestionDO::getClassId, classDetailDTO.getId()));
classSummaryVO.setAnswerCount(count);
classSummaryVO.setAnswerCnt(count);
return classSummaryVO;
}
......@@ -1290,7 +1290,7 @@ public class AdministerServiceImpl extends ServiceImpl<AdministerMapper, Adminis
//不带声调
format.setToneType(HanyuPinyinToneType.WITHOUT_TONE);
ExcelUtil.readExcel(null, ImportMemberDTO.class, multipartFile).forEach(s -> {
ExcelUtil.readExcelWithoutTitle(null, ImportMemberDTO.class, multipartFile).forEach(s -> {
MemberDO memberDO = memberMapper.selectOne(new QueryWrapper<MemberDO>()
.lambda()
......@@ -1323,18 +1323,29 @@ public class AdministerServiceImpl extends ServiceImpl<AdministerMapper, Adminis
memberDO1.setIdCard(s.getIdCard());
memberDO1.setStatus("启用");
memberDO1.setPassword("123456");
memberDO1.setAccountNameEn(s.getAccountNameEn());
memberMapper.insert(memberDO1);
//找到该公司最大的部门
//找到对应的部门
String[] departments = s.getDepartments().split(",");
for (String dpt : departments){
//找到最后一个部门对应id
String[] deps = dpt.split("/");
DepartmentDictDO departmentDictDO = departmentDictMapper.selectOne(new QueryWrapper<DepartmentDictDO>()
.lambda()
.isNull(DepartmentDictDO::getParentId)
.eq(DepartmentDictDO::getCompanyId, companyId));
.eq(DepartmentDictDO::getCompanyId,companyId)
.eq(DepartmentDictDO::getDepartmentName,deps[deps.length-1]));
MemberDepartmentMappingDO memberDepartmentMappingDO = new MemberDepartmentMappingDO();
memberDepartmentMappingDO.setDepartmentId(departmentDictDO.getId());
memberDepartmentMappingDO.setMemberId(memberDO1.getId());
memberDepartmentMappingMapper.insert(memberDepartmentMappingDO);
}
}
});
} catch (Exception e) {
......
......@@ -2,9 +2,11 @@ package com.subsidy.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.subsidy.common.exception.HttpException;
import com.subsidy.dto.classDict.AddClassDTO;
import com.subsidy.dto.classDict.AddMemberToClassDTO;
import com.subsidy.dto.classDict.GetSpareMembersDTO;
import com.subsidy.jobs.CourseNotificationJob;
import com.subsidy.mapper.AnsweringQuestionMapper;
import com.subsidy.mapper.ClassDictMapper;
import com.subsidy.mapper.ClassMemberMappingMapper;
......@@ -22,6 +24,8 @@ import com.subsidy.model.MemberDO;
import com.subsidy.model.RoleAdministerMappingDO;
import com.subsidy.service.ClassDictService;
import com.subsidy.util.ConstantUtils;
import com.subsidy.util.DateFormatUtil;
import com.subsidy.util.QuartzUtil;
import com.subsidy.util.SMSUtils;
import com.subsidy.vo.classdict.GetAllClassesVO;
import com.subsidy.vo.classdict.GetClassBaseInfoVO;
......@@ -31,7 +35,10 @@ import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* <p>
......@@ -59,6 +66,9 @@ public class ClassDictServiceImpl extends ServiceImpl<ClassDictMapper, ClassDict
@Autowired
private AnsweringQuestionMapper answeringQuestionMapper;
@Autowired
private QuartzUtil quartzUtil;
public List<GetAllClassesVO> getAllClasses(ClassDictDO classDictDO) {
return this.baseMapper.getAllClasses(classDictDO);
}
......@@ -89,11 +99,24 @@ public class ClassDictServiceImpl extends ServiceImpl<ClassDictMapper, ClassDict
}
//添加通知
if (null != addClassDTO.getClassNoticeDOS()){
List<ClassNoticeDO> classNoticeDOS = addClassDTO.getClassNoticeDOS();
for (ClassNoticeDO classNoticeDO : classNoticeDOS) {
if(DateFormatUtil.parse(classNoticeDO.getNoticeTime(),"yyyy-MM-dd").before(new Date())) {
throw new HttpException(70001);
}
classNoticeDO.setClassId(classDictDO.getId());
classNoticeMapper.insert(classNoticeDO);
Map<String, Object> params = new HashMap<>();
//params.put("classId", classNoticeDO.getClassId());
params.put("id", classNoticeDO.getId());
String name = classDictDO.getClassName()+"-"+classNoticeDO.getNoticeType()+"-"+classNoticeDO.getNoticeTime();
quartzUtil.addSimpleJob(CourseNotificationJob.class, DateFormatUtil.parse(classNoticeDO.getNoticeTime(), "yyyy-MM-dd") , params, name, "CourseNotificationJob");
}
}
return ConstantUtils.ADD_SUCCESS;
}
......
......@@ -60,7 +60,7 @@ public class ClassNoticeServiceImpl extends ServiceImpl<ClassNoticeMapper, Class
ClassDictDO classDictDO = classDictService.getById(classNoticeDO.getClassId());
Map<String, Object> params = new HashMap<>();
params.put("classId", classNoticeDO.getClassId());
//params.put("classId", classNoticeDO.getClassId());
params.put("id", classNoticeDO.getId());
String name = classDictDO.getClassName()+"-"+classNoticeDO.getNoticeType()+"-"+classNoticeDO.getNoticeTime();
quartzUtil.addSimpleJob(CourseNotificationJob.class,DateFormatUtil.parse(classNoticeDO.getNoticeTime(), "yyyy-MM-dd") , params, name, "CourseNotificationJob");
......
......@@ -9,17 +9,21 @@ import com.subsidy.common.exception.HttpException;
import com.subsidy.dto.administer.OperatorsDTO;
import com.subsidy.dto.company.AddCompanyDTO;
import com.subsidy.mapper.AdministerMapper;
import com.subsidy.mapper.ClassTypeDictMapper;
import com.subsidy.mapper.CompanyDictMapper;
import com.subsidy.mapper.CompanyFieldMappingMapper;
import com.subsidy.mapper.DepartmentDictMapper;
import com.subsidy.mapper.FieldDictMapper;
import com.subsidy.mapper.JobDictMapper;
import com.subsidy.mapper.RoleAdministerMappingMapper;
import com.subsidy.model.AdministerDO;
import com.subsidy.model.ClassHourDictDO;
import com.subsidy.model.ClassTypeDictDO;
import com.subsidy.model.CompanyDictDO;
import com.subsidy.model.CompanyFieldMappingDO;
import com.subsidy.model.DepartmentDictDO;
import com.subsidy.model.FieldDictDO;
import com.subsidy.model.JobDictDO;
import com.subsidy.model.RoleAdministerMappingDO;
import com.subsidy.service.CompanyDictService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
......@@ -65,9 +69,14 @@ public class CompanyDictServiceImpl extends ServiceImpl<CompanyDictMapper, Compa
@Autowired
private CompanyFieldMappingMapper companyFieldMappingMapper;
@Autowired
private JobDictMapper jobDictMapper;
@Autowired
private ClassTypeDictMapper classTypeDictMapper;
public IPage<OperatorsVO> operators(OperatorsDTO operatorsDTO) {
Page pager = new Page(operatorsDTO.getPageNum(), operatorsDTO.getPageSize());
IPage page = this.baseMapper.operators(pager, operatorsDTO.getCompanyName(), operatorsDTO.getFieldId());
IPage page = this.baseMapper.operators(pager, operatorsDTO.getCompanyName(), operatorsDTO.getFieldId(),1);
List<OperatorsVO> operatorsVOS = page.getRecords();
for (OperatorsVO operatorsVO : operatorsVOS) {
//查看公司所在行业
......@@ -141,6 +150,20 @@ public class CompanyDictServiceImpl extends ServiceImpl<CompanyDictMapper, Compa
companyFieldMappingDO.setFieldId(lg);
companyFieldMappingMapper.insert(companyFieldMappingDO);
}
//初始化平台的岗位到企业的岗位
List<JobDictDO> jobDictDOS = jobDictMapper.selectList(new QueryWrapper<JobDictDO>()
.lambda()
.isNull(JobDictDO::getCompanyId));
for (JobDictDO jobDictDO : jobDictDOS){
jobDictDO.setCompanyId(companyDictDO.getId());
jobDictMapper.insert(jobDictDO);
}
//班级类型
ClassTypeDictDO classTypeDictDO = new ClassTypeDictDO();
classTypeDictDO.setClassType("企业内训");
classTypeDictMapper.insert(classTypeDictDO);
return ConstantUtils.ADD_SUCCESS;
}
......
......@@ -23,10 +23,7 @@ import java.util.List;
public class JobDictServiceImpl extends ServiceImpl<JobDictMapper, JobDictDO> implements JobDictService {
public List<JobDictDO> queryJobs(JobDictDO jobDictDO) {
return this.baseMapper.selectList(new QueryWrapper<JobDictDO>()
.lambda()
.eq(JobDictDO::getCompanyId, jobDictDO.getCompanyId())
.orderByAsc(JobDictDO::getOrderNo));
return this.baseMapper.queryJobs(jobDictDO.getId());
}
public String deleteJob(JobDictDO jobDictDO) {
......
......@@ -20,6 +20,8 @@ import com.subsidy.mapper.CourseContentMapper;
import com.subsidy.mapper.CourseFieldMappingMapper;
import com.subsidy.mapper.ExerciseDoneResultMapper;
import com.subsidy.mapper.FileDictMapper;
import com.subsidy.mapper.JobDictMapper;
import com.subsidy.mapper.JobMemberMappingMapper;
import com.subsidy.mapper.MemberDepartmentMappingMapper;
import com.subsidy.mapper.MemberMapper;
import com.subsidy.mapper.OprMemDictMapper;
......@@ -34,14 +36,14 @@ import com.subsidy.model.DepartmentDictDO;
import com.subsidy.model.ExerciseDoneResultDO;
import com.subsidy.model.FieldDictDO;
import com.subsidy.model.FileDictDO;
import com.subsidy.model.JobDictDO;
import com.subsidy.model.JobMemberMappingDO;
import com.subsidy.model.MemberDO;
import com.subsidy.model.MemberDepartmentMappingDO;
import com.subsidy.model.OprMemDictDO;
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;
......@@ -57,8 +59,6 @@ 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;
import org.springframework.transaction.annotation.Transactional;
......@@ -66,7 +66,6 @@ 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;
......@@ -111,9 +110,6 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, MemberDO> imple
private RedisUtil redisUtil;
@Autowired
private MongoTemplate mongoTemplate;
@Autowired
private CourseFieldMappingMapper courseFieldMappingMapper;
@Autowired
......@@ -122,14 +118,25 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, MemberDO> imple
@Autowired
private OprMemDictMapper oprMemDictMapper;
@Autowired
private JobDictMapper jobDictMapper;
@Autowired
private JobMemberMappingMapper jobMemberMappingMapper;
public IPage<GetAllVO> getAll(GetAllDTO getAllDTO) {
Page pager = new Page(getAllDTO.getPageNum(), getAllDTO.getPageSize());
IPage iPage = this.baseMapper.getMembers(pager, getAllDTO.getDepartmentId(), getAllDTO.getUserName(), getAllDTO.getStatus());
List<GetAllVO> getAllVOS = iPage.getRecords();
for (GetAllVO getAllVO : getAllVOS) {
//获取这个人所在的部门
List<DepartmentDictDO> departmentDictDOS = this.baseMapper.getDepartments(getAllVO.getId());
getAllVO.setDepartmentDictDOS(departmentDictDOS);
//获取这个人所在的岗位
List<JobDictDO> jobDictDOS = jobDictMapper.queryMemberJobs(getAllVO.getId());
getAllVO.setJobDictDOS(jobDictDOS);
}
return iPage;
}
......@@ -175,6 +182,7 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, MemberDO> imple
this.baseMapper.insert(memberDO);
redisUtil.set(RedisPrefixConstant.SUBSIDY_COMPANY_MEMBER_PREFIX + memberDO.getCompanyId() + ":" + memberDO.getAccountName(), memberDO);
if (null != addMemberDTO.getDepartmentIds()) {
//部门
List<Long> longs = addMemberDTO.getDepartmentIds();
......@@ -184,6 +192,23 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, MemberDO> imple
memberDepartmentMappingDO.setDepartmentId(lg);
memberDepartmentMappingMapper.insert(memberDepartmentMappingDO);
}
}
if (null != addMemberDTO.getJobIds()) {
jobMemberMappingMapper.delete(new QueryWrapper<JobMemberMappingDO>()
.lambda()
.eq(JobMemberMappingDO::getMemberId, addMemberDTO.getId()));
//岗位
List<Long> longs = addMemberDTO.getJobIds();
for (Long lg : longs) {
JobMemberMappingDO jobMemberMappingDO = new JobMemberMappingDO();
jobMemberMappingDO.setMemberId(memberDO.getId());
jobMemberMappingDO.setJobId(lg);
jobMemberMappingMapper.insert(jobMemberMappingDO);
}
}
return ConstantUtils.ADD_SUCCESS;
}
......@@ -230,6 +255,21 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, MemberDO> imple
}
}
if (null != addMemberDTO.getJobIds()) {
jobMemberMappingMapper.delete(new QueryWrapper<JobMemberMappingDO>()
.lambda()
.eq(JobMemberMappingDO::getMemberId, addMemberDTO.getId()));
//岗位
List<Long> longs = addMemberDTO.getJobIds();
for (Long lg : longs) {
JobMemberMappingDO jobMemberMappingDO = new JobMemberMappingDO();
jobMemberMappingDO.setMemberId(memberDO.getId());
jobMemberMappingDO.setJobId(lg);
jobMemberMappingMapper.insert(jobMemberMappingDO);
}
}
return ConstantUtils.SET_SUCCESS;
}
......@@ -337,7 +377,7 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, MemberDO> imple
//oprMemDictDO.setCompanyName(companyDictDO.getCompanyName());
//mongoTemplate.insert(oprMemDictDO);
oprMemDictMapper.insert(oprMemDictDO);
redisUtil.set(RedisPrefixConstant.SUBSIDY_COMPANY_MEMBER_PREFIX + passwordLoginDTO.getCompanyId() + ":" + passwordLoginDTO.getAccountName(),memberDO);
redisUtil.set(RedisPrefixConstant.SUBSIDY_COMPANY_MEMBER_PREFIX + passwordLoginDTO.getCompanyId() + ":" + passwordLoginDTO.getAccountName(), memberDO);
//redisUtil.set(RedisPrefixConstant.SUBSIDY_MEMBER_LOGIN_PREFIX + memberDO.getId() + ":" + System.currentTimeMillis(), 1);
return memberVO;
} else {
......@@ -424,8 +464,8 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, MemberDO> imple
}
public List<MyCoursesVO> myCourses(MyCoursesDTO myCoursesDTO) {
List<MyCoursesVO> myCoursesVOS = this.baseMapper.myCourses(myCoursesDTO.getMemberId(),myCoursesDTO.getStatus());
for (MyCoursesVO myCoursesVO : myCoursesVOS){
List<MyCoursesVO> myCoursesVOS = this.baseMapper.myCourses(myCoursesDTO.getMemberId(), myCoursesDTO.getStatus());
for (MyCoursesVO myCoursesVO : myCoursesVOS) {
List<FieldDictDO> fieldDictDOS = courseFieldMappingMapper.courseFields(myCoursesVO.getCourseId());
myCoursesVO.setFieldDictDOS(fieldDictDOS);
}
......@@ -436,6 +476,13 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, MemberDO> imple
ContentVodNewVO contentVodNewVO = new ContentVodNewVO();
//课程详细信息
ClassDictDO classDictDO = classDictMapper.selectById(contentVodDTO.getClassId());
contentVodNewVO.setIsFastPlay(classDictDO.getIsFastPlay());
contentVodNewVO.setIsOrder(classDictDO.getIsOrder());
contentVodNewVO.setTestRule(classDictDO.getTestRule());
List<ContentVodVO> contentVodVOS = new ArrayList<>();
List<CourseContentDO> courseContentDOS = courseContentMapper.selectList(new QueryWrapper<CourseContentDO>()
.lambda()
......@@ -448,9 +495,20 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, MemberDO> imple
List<MemberVodVO> memberVodVOS = courseContentMapper.contentVodProcess(courseContentDO.getId(), contentVodDTO.getMemberId());
Boolean flag = false;
for (MemberVodVO memberVodVO : memberVodVOS) {
if (memberVodVO.getPercent() == 100 && !flag) {
//这个视频看完了,已解锁
memberVodVO.setStatus(true);
} else {
//这个视频没看完,未解锁
memberVodVO.setStatus(false);
flag = true;
}
}
int playCount = 0;
for (MemberVodVO memberVodVO : memberVodVOS){
if (100 == memberVodVO.getPercent()){
for (MemberVodVO memberVodVO : memberVodVOS) {
if (100 == memberVodVO.getPercent()) {
playCount++;
}
}
......@@ -464,7 +522,7 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, MemberDO> imple
//最新的视频记录
List<ContentVodNewVO> contentVodNewVOS = vodPlayHistoryMapper.memberRecentPlay(contentVodDTO.getClassId(), contentVodDTO.getMemberId());
if (contentVodNewVOS.size()>0){
if (contentVodNewVOS.size() > 0) {
contentVodNewVO.setId(contentVodNewVOS.get(0).getId());
contentVodNewVO.setPlayRecord(contentVodNewVOS.get(0).getPlayRecord());
}
......@@ -513,7 +571,7 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, MemberDO> imple
//自己成绩
List<ExerciseDoneResultDO> exerciseDoneResultDOS = exerciseDoneResultMapper.getMaxScorePaper(queryPapersVO.getId(), contentMemberDTO.getMemberId());
if (exerciseDoneResultDOS.size()>0) {
if (exerciseDoneResultDOS.size() > 0) {
queryPapersVO.setRightCounts(exerciseDoneResultDOS.get(0).getRightCounts());
queryPapersVO.setTotalCount(exerciseDoneResultDOS.get(0).getTotalCounts());
queryPapersVO.setResult(exerciseDoneResultDOS.get(0).getResult());
......
......@@ -2,17 +2,15 @@ package com.subsidy.service.impl;
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.opr.GetHistoryDTO;
import com.subsidy.mapper.CompanyDictMapper;
import com.subsidy.mapper.MemberMapper;
import com.subsidy.model.OprMemDictDO;
import com.subsidy.mapper.OprMemDictMapper;
import com.subsidy.model.OprMemDictDO;
import com.subsidy.service.OprMemDictService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.subsidy.util.MongoUtil;
import com.subsidy.vo.opr.GetHistoryVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.stereotype.Service;
/**
......@@ -27,12 +25,6 @@ import org.springframework.stereotype.Service;
public class OprMemDictServiceImpl extends ServiceImpl<OprMemDictMapper, OprMemDictDO> implements OprMemDictService {
@Autowired
private MongoTemplate mongoTemplate;
@Autowired
private MongoUtil mongoUtil;
@Autowired
private MemberMapper memberMapper;
@Autowired
......
......@@ -6,16 +6,21 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.subsidy.common.RedisPrefixConstant;
import com.subsidy.dto.member.GetMemberSignInfoDTO;
import com.subsidy.dto.sign.ClassSignInfoDTO;
import com.subsidy.dto.sign.DataViewDTO;
import com.subsidy.mapper.AnsweringQuestionMapper;
import com.subsidy.mapper.ClassDictMapper;
import com.subsidy.mapper.ClassHourDictMapper;
import com.subsidy.mapper.ClassMemberMappingMapper;
import com.subsidy.mapper.ExerciseDoneResultMapper;
import com.subsidy.mapper.MemberMapper;
import com.subsidy.mapper.SignInRecordMapper;
import com.subsidy.mapper.VodPlayHistoryMapper;
import com.subsidy.model.AnsweringQuestionDO;
import com.subsidy.model.ClassDictDO;
import com.subsidy.model.ClassHourDictDO;
import com.subsidy.model.MemberDO;
import com.subsidy.model.ClassMemberMappingDO;
import com.subsidy.model.ExerciseDoneResultDO;
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;
......@@ -23,21 +28,18 @@ import com.subsidy.util.MathUtil;
import com.subsidy.util.MyBeanUtils;
import com.subsidy.util.RedisUtil;
import com.subsidy.vo.member.GetMemberSignInfoVO;
import com.subsidy.vo.sign.ClassSignInfoVO;
import com.subsidy.vo.sign.DataViewVO;
import com.subsidy.vo.sign.SignInStatusVO;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.text.SimpleDateFormat;
import java.time.LocalDateTime;
import java.time.ZoneOffset;
import java.util.Date;
import java.util.List;
import java.util.Set;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
/**
* <p>
......@@ -60,13 +62,16 @@ public class SignInRecordServiceImpl extends ServiceImpl<SignInRecordMapper, Sig
private RedisUtil redisUtil;
@Autowired
private MemberMapper memberMapper;
private SignInRecordMapper signInRecordMapper;
@Autowired
private ClassHourDictMapper classHourDictMapper;
private ClassDictMapper classDictMapper;
@Autowired
private SignInRecordMapper signInRecordMapper;
private ExerciseDoneResultMapper exerciseDoneResultMapper;
@Autowired
private AnsweringQuestionMapper answeringQuestionMapper;
public IPage<GetMemberSignInfoVO> getMemberSignInfo(GetMemberSignInfoDTO getMemberSignInfoDTO) {
Page pager = new Page(getMemberSignInfoDTO.getPageNum(), getMemberSignInfoDTO.getPageSize());
......@@ -109,23 +114,77 @@ public class SignInRecordServiceImpl extends ServiceImpl<SignInRecordMapper, Sig
return ConstantUtils.ADD_SUCCESS;
}
public IPage<ClassSignInfoVO> classSignInfo(ClassSignInfoDTO classSignInfoDTO) {
public IPage<DataViewVO> dataView(DataViewDTO classSignInfoDTO) {
Page pager = new Page(classSignInfoDTO.getPageNum(), classSignInfoDTO.getPageSize());
IPage<ClassSignInfoVO> classSignInfoVOIPage = this.baseMapper.classSignInfo(pager, classSignInfoDTO.getClassName(), classSignInfoDTO.getCourseName(), classSignInfoDTO.getCompanyId());
List<ClassSignInfoVO> classSignInfoVOS = classSignInfoVOIPage.getRecords();
IPage<DataViewVO> classSignInfoVOIPage = this.baseMapper.classSignInfo(pager, classSignInfoDTO.getClassName(), classSignInfoDTO.getCourseName(), classSignInfoDTO.getCompanyId());
List<DataViewVO> dataViewVOS = classSignInfoVOIPage.getRecords();
for (DataViewVO dataViewVO : dataViewVOS) {
//班级人数
List<ClassMemberMappingDO> classMemberMappingDOS = classMemberMappingMapper.selectList(new QueryWrapper<ClassMemberMappingDO>()
.lambda()
.eq(ClassMemberMappingDO::getClassId, dataViewVO.getClassId()));
dataViewVO.setMemberCount(classMemberMappingDOS.size());
//课程由多少个视频
List<VodDictDO> vodDictDOS = classDictMapper.getClassVods(dataViewVO.getClassId());
int signCnt = 0;
int testCnt = 0;
int vodCnt = 0;
for (ClassMemberMappingDO classMemberMappingDO : classMemberMappingDOS) {
//签到
Integer signCount = signInRecordMapper.selectCount(new QueryWrapper<SignInRecordDO>()
.lambda()
.eq(SignInRecordDO::getMemberId, classMemberMappingDO.getMemberId())
.eq(SignInRecordDO::getClassId, dataViewVO.getClassId()));
if (signCount > 0) {
signCnt++;
}
//测试
int testCount = exerciseDoneResultMapper.selectCount(new QueryWrapper<ExerciseDoneResultDO>()
.lambda()
.eq(ExerciseDoneResultDO::getMemberId, classMemberMappingDO.getMemberId())
.eq(ExerciseDoneResultDO::getClassId, dataViewVO.getClassId()));
if (testCount > 0) {
testCnt++;
}
//视频
int i = 0;
for (VodDictDO vodDictDO : vodDictDOS) {
int totalPlayLength = vodPlayHistoryMapper.memberVodTotalLength(classMemberMappingDO.getMemberId(), vodDictDO.getId());
if (totalPlayLength >= vodDictDO.getVodLength()) {
i++;
}
}
if (i == vodDictDOS.size()) {
vodCnt++;
}
}
//签到人数 这个人签到了就算签过了
dataViewVO.setSignCnt(signCnt);
//测试通过率
dataViewVO.setPassCnt(testCnt);
for (ClassSignInfoVO classSignInfoVO : classSignInfoVOS) {
ClassSignInfoVO classSignInfoVO1 = vodPlayHistoryMapper.classStudyHistory(classSignInfoVO.getClassId());
String[] nullParams = MyBeanUtils.getNullPropertyNames(classSignInfoVO1);
BeanUtils.copyProperties(classSignInfoVO1,classSignInfoVO,nullParams);
//视频看完人数
dataViewVO.setVodCnt(vodCnt);
//平均签到数 向下取整
long signCount = redisUtil.scan(RedisPrefixConstant.SUBSIDY_SIGN_INFO_PREFIX + "*:classId:" + classSignInfoVO.getClassId() + ":*").stream().count();
classSignInfoVO.setAvgSignCount(MathUtil.intDivCeil(signCount, classSignInfoVO1.getMemberCount()));
//答疑数
Integer count = answeringQuestionMapper.selectCount(new QueryWrapper<AnsweringQuestionDO>()
.lambda()
.eq(AnsweringQuestionDO::getClassId, dataViewVO.getClassId()));
dataViewVO.setAnswerCnt(count);
}
classSignInfoVOIPage.setRecords(classSignInfoVOS);
classSignInfoVOIPage.setRecords(dataViewVOS);
return classSignInfoVOIPage;
}
......
......@@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.subsidy.common.configure.VODConfig;
import com.subsidy.common.exception.HttpException;
import com.subsidy.dto.content.GetContendVodsDTO;
import com.subsidy.dto.vod.ChangeOrdersDTO;
import com.subsidy.mapper.VodDictMapper;
import com.subsidy.model.VodDictDO;
import com.subsidy.service.VodDictService;
......@@ -23,8 +24,10 @@ import com.tencentcloudapi.vod.v20180717.models.MediaProcessTaskInput;
import com.tencentcloudapi.vod.v20180717.models.ProcessMediaRequest;
import com.tencentcloudapi.vod.v20180717.models.TranscodeTaskInput;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Random;
/**
......@@ -41,6 +44,8 @@ public class VodDictServiceImpl extends ServiceImpl<VodDictMapper, VodDictDO> im
@Autowired
private VODConfig vodConfig;
@Value("${spring.profiles.active}")
private String env;
public SignatureVO signature() {
SignatureVO signatureVO = new SignatureVO();
......@@ -62,9 +67,9 @@ public class VodDictServiceImpl extends ServiceImpl<VodDictMapper, VodDictDO> im
return signatureVO;
}
public IPage<GetContendVodsVO> getContendVods(GetContendVodsDTO getContendVodsDTO) {
Page pager = new Page(getContendVodsDTO.getPageNum(), getContendVodsDTO.getPageSize());
return this.baseMapper.getContendVods(pager, getContendVodsDTO.getVodName(), getContendVodsDTO.getContentId());
public List<GetContendVodsVO> getContendVods(GetContendVodsDTO getContendVodsDTO) {
//Page pager = new Page(getContendVodsDTO.getPageNum(), getContendVodsDTO.getPageSize());
return this.baseMapper.getContendVods( getContendVodsDTO.getVodName(), getContendVodsDTO.getContentId());
}
public String deleteVod(VodDictDO vodDictDO) {
......@@ -96,6 +101,9 @@ public class VodDictServiceImpl extends ServiceImpl<VodDictMapper, VodDictDO> im
public String addVod(VodDictDO vodDictDO) {
this.baseMapper.insert(vodDictDO);
//测试环境就不转码了
if (env.equals("prod")){
//上传后直接转码
Credential cred = new Credential(vodConfig.getSecretId(), vodConfig.getSecretKey());
......@@ -122,7 +130,7 @@ public class VodDictServiceImpl extends ServiceImpl<VodDictMapper, VodDictDO> im
} catch (Exception ex) {
throw new HttpException(50001);
}
}
return ConstantUtils.ADD_SUCCESS;
}
......@@ -131,5 +139,14 @@ public class VodDictServiceImpl extends ServiceImpl<VodDictMapper, VodDictDO> im
return ConstantUtils.SET_SUCCESS;
}
public String changeOrders(ChangeOrdersDTO changeOrdersDTO){
int i = 1 ;
List<Long> longs = changeOrdersDTO.getVodIds();
for (Long lg : longs){
this.baseMapper.updateVodOrderNo(lg,i++);
}
return ConstantUtils.SET_SUCCESS;
}
}
......@@ -110,22 +110,22 @@ public class VodPlayHistoryServiceImpl extends ServiceImpl<VodPlayHistoryMapper,
rdm_total += n;
if ((m + n) < vodSize && k != signInrecord - 1) {
m += n;
if (n > 11 || n < 5) {
System.out.println("error" + "===================");
}
//if (n > 11 || n < 5) {
// System.out.println("error" + "===================");
//}
hashMap.put(localDateTimes.get(k), n);
integers.add(localDateTimes.get(k));
} else {
if (vodSize - rdm_total + n > 10 || vodSize - rdm_total + n < 5) {
System.out.println("error+==================");
}
//if (vodSize - rdm_total + n > 10 || vodSize - rdm_total + n < 5) {
// System.out.println("error+==================");
//}
hashMap.put(localDateTimes.get(k), vodSize - rdm_total + n);
integers.add(localDateTimes.get(k));
break;
}
}
// //是否是最后一天的
//是否是最后一天的
int key_index = 0;
// for (LocalDateTime localDateTime : hashMap.keySet()){
// if (hashMap.get(localDateTime)>10||hashMap.get(localDateTime)<5){
......@@ -133,7 +133,7 @@ public class VodPlayHistoryServiceImpl extends ServiceImpl<VodPlayHistoryMapper,
// }
// }
// 根据签到时间,对学生学习的课程做插入操作
// 根据签到时间,对学生学习的课程做插入操作
for (LocalDateTime localDateTime : hashMap.keySet()) {
//今天应该看几个视频
int total = hashMap.get(localDateTime);
......@@ -392,10 +392,20 @@ public class VodPlayHistoryServiceImpl extends ServiceImpl<VodPlayHistoryMapper,
}
}
public void playLengthFix(RemainSecondsDTO remainSecondsDTO){
// 查看敲到次数
//按照签到次数安排每天随机学习时长
//按照视频顺序依次学习完 每天学习时长不得超过8小时
}
public static void main(String[] args) {
while (true) {
System.out.println(new Random().nextInt(4));
System.out.println(getRandom());
}
// int m = 0;
//
......@@ -473,4 +483,5 @@ public class VodPlayHistoryServiceImpl extends ServiceImpl<VodPlayHistoryMapper,
return (int) (Math.random() * 11 / 2 + 5);
}
}
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<T> {
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<T> list) {
return new PageHelper(this.currentPage, total, this.pageSize, list);
}
public PageHelper pageHelper(List<T> list) {
return new PageHelper(this.currentPage, this.pageSize, list);
}
public PageHelper pageHelper(long currentPage, long total, long pageSize, List<T> list) {
return new PageHelper(currentPage, total, pageSize, list);
}
public PageHelper pageHelper(long currentPage, long pageSize, List<T> 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;
}
}
//package com.subsidy.util;
//
//import lombok.Data;
//import org.springframework.stereotype.Component;
//
//import java.util.List;
//import java.util.regex.Pattern;
//
//@Data
//@Component
//public class MongoUtil<T> {
// 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<T> list) {
// return new PageHelper(this.currentPage, total, this.pageSize, list);
// }
//
// public PageHelper pageHelper(List<T> list) {
// return new PageHelper(this.currentPage, this.pageSize, list);
// }
//
// public PageHelper pageHelper(long currentPage, long total, long pageSize, List<T> list) {
// return new PageHelper(currentPage, total, pageSize, list);
// }
//
// public PageHelper pageHelper(long currentPage, long pageSize, List<T> 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;
// }
//
//}
......@@ -190,6 +190,129 @@ public class ExcelUtil {
return dataList;
}
/**
* 导入excel文件
*
* @param path
* @param cls
* @param file
* @param <T>
* @return
*/
public static <T> List<T> readExcelWithoutTitle(String path, Class<T> cls, MultipartFile file) {
String fileName = file.getOriginalFilename();
if (!fileName.matches("^.+\\.(?i)(xls)$") && !fileName.matches("^.+\\.(?i)(xlsx)$")) {
log.info("上传文件格式不正确");
// throw new HTTPException(10022);
}
List<T> dataList = new ArrayList<>();
Workbook workbook = null;
try {
InputStream is = file.getInputStream();
if (fileName.endsWith(EXCEL2007)) {
// FileInputStream is = new FileInputStream(new File(path));
workbook = new XSSFWorkbook(is);
}
if (fileName.endsWith(EXCEL2003)) {
// FileInputStream is = new FileInputStream(new File(path));
workbook = new HSSFWorkbook(is);
}
if (workbook != null) {
Map<String, List<Field>> classMap = new HashMap<>();
List<Field> fields = Stream.of(cls.getDeclaredFields()).collect(Collectors.toList());
fields.forEach(field -> {
ExcelColumnUtil annotation = field.getAnnotation(ExcelColumnUtil.class);
if (annotation != null) {
String value = annotation.value();
if (StringUtils.isBlank(value)) {
return;
}
if (!classMap.containsKey(value)) {
classMap.put(value, new ArrayList<>());
}
field.setAccessible(true);
classMap.get(value).add(field);
}
});
//索引-->columns
Map<Integer, List<Field>> reflectionMap = new HashMap<>();
//默认读取第一个sheet
Sheet sheet = workbook.getSheetAt(0);
boolean firstRow = true;
for (int i = 1; i <= sheet.getLastRowNum(); i++) {
Row row = sheet.getRow(i);
//提取标题
if (firstRow) {
for (int j = 0; j <= row.getLastCellNum(); j++) {
Cell cell = row.getCell(j);
String cellValue = getCellValue(cell);
if (classMap.containsKey(cellValue)) {
reflectionMap.put(j, classMap.get(cellValue));
}
}
firstRow = false;
} else {
//忽略空白行
if (row == null) {
continue;
}
try {
T t = cls.newInstance();
//判断是否为空白行
boolean allBlank = true;
for (int j = 0; j <= row.getLastCellNum(); j++) {
if (reflectionMap.containsKey(j)) {
Cell cell = row.getCell(j);
String cellValue = getCellValue(cell);
if (StringUtils.isNotBlank(cellValue)) {
allBlank = false;
}
List<Field> fieldList = reflectionMap.get(j);
fieldList.forEach(x -> {
try {
handleField(t, cellValue, x);
} catch (Exception e) {
e.printStackTrace();
log.error(String.format("reflect field:%s value:%s exception!", x.getName(), cellValue), e);
}
});
}
}
if (!allBlank) {
dataList.add(t);
}
} catch (Exception e) {
e.printStackTrace();
log.error(String.format("parse row:%s exception!", i), e);
}
}
}
}
} catch (Exception e) {
e.printStackTrace();
log.error(String.format("parse excel exception!"), e);
} finally {
if (workbook != null) {
try {
workbook.close();
} catch (Exception e) {
e.printStackTrace();
log.error(String.format("parse excel exception!"), e);
}
}
}
return dataList;
}
public static <T> void writeExcel(List<Long> memberIds, HashMap<Long, HashMap<String, Integer>> hashMap, List<String> dates) {
ServletRequestAttributes servletRequestAttributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
HttpServletResponse response = servletRequestAttributes.getResponse();
......
......@@ -25,11 +25,11 @@ public class ClassSummaryVO {
/**
* 签到数
*/
private Integer signCount;
private Integer signCnt;
/**
* 答疑数
*/
private Integer answerCount;
private Integer answerCnt;
}
......@@ -11,6 +11,12 @@ public class ContentVodNewVO {
private Integer playRecord;
private Integer isFastPlay;
private Integer testRule;
private Integer isOrder;
private List<ContentVodVO> contentVodVOS;
}
......@@ -3,6 +3,7 @@ package com.subsidy.vo.member;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.subsidy.model.DepartmentDictDO;
import com.subsidy.model.JobDictDO;
import com.subsidy.model.MemberDO;
import lombok.Data;
......@@ -27,4 +28,6 @@ public class GetAllVO {
private List<DepartmentDictDO> departmentDictDOS;
private List<JobDictDO> jobDictDOS;
}
......@@ -11,6 +11,9 @@ public class MemberVodVO {
private Integer percent;
/**
* 解锁状态
*/
private Boolean status;
private String vodUrl;
......
......@@ -3,7 +3,7 @@ package com.subsidy.vo.sign;
import lombok.Data;
@Data
public class ClassSignInfoVO {
public class DataViewVO {
private Long classId;
......@@ -23,38 +23,24 @@ public class ClassSignInfoVO {
private Integer memberCount;
/**
* 课程进度
* 视频学习人数
*/
private Integer studyVodCounts;
/**
* 总课时
*/
private Integer totalVodCounts;
/**
* 平均时长
*/
private Integer avgVodPlayLength;
private Integer vodCnt;
/**
* 测试通过率
*/
private Integer passRate;
private Integer passCnt;
/**
* 平均签到数
*/
private Integer avgSignCount;
private Integer signCnt;
/**
* 答疑数
*/
private Integer answerCount;
private String classType;
private Integer answerCnt;
}
package com.subsidy.vo.wechat;
import lombok.Data;
@Data
public class AccessTokenVO {
private String access_token;
private String expires_in;
}
package com.subsidy.vo.wechat;
import lombok.Data;
@Data
public class AuthenRequestVO {
private String code;
private String phone;
private String openId;
}
package com.subsidy.vo.wechat;
import lombok.Data;
@Data
public class AuthenTokenVO {
private String access_token;
private String openid;
private String nickname;
private String sex;
private String province;
private String city;
private String country;
private String headimgurl;
private Object privilege;
private String unionid;
}
package com.subsidy.vo.wechat;
import lombok.Data;
@Data
public class JsSdkVO {
private String errcode;
private String errmsg;
private String ticket;
private String expires_in;
}
package com.subsidy.vo.wechat;
import lombok.Data;
@Data
public class SignVO {
private String access_token;
private String noncestr;
private String jsapi_ticket;
private String timestamp;
private String url;
private String sign;
private String code;
}
......@@ -68,3 +68,7 @@ spring.quartz.overwrite-existing-jobs=false
#spring.redis.port=6379
#spring.redis.password=r-uf6m4cpkjrgpzywjm3:Ykhl@208
wechat:
#pro
appId: wx5e1ecb9c9bd33451
appSecret: 4f5e1abb6fb4f68f5273820b6295ec6b
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.subsidy.mapper.AccessTokenMapper">
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="com.subsidy.model.AccessTokenDO">
<id column="id" property="id" />
<result column="create_date" property="createDate" />
<result column="update_date" property="updateDate" />
<result column="access_token" property="accessToken" />
</resultMap>
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
create_date,
update_date,
id, access_token
</sql>
</mapper>
......@@ -47,9 +47,9 @@
<if test="className != null and className !=''">
and t.class_name like concat('%',#{className} ,'%')
</if>
<if test="startDate != null and endDate != null">
<if test="startDate != null and endDate != null and startDate != '' and endDate != ''">
and t.end_date >= DATE_FORMAT( #{startDate}, '%Y-%m-%d' )
and t.start_date &lt; DATE_FORMAT( #{endDateDate}, '%Y-%m-%d' )
and t.start_date &lt; DATE_FORMAT( #{endDate}, '%Y-%m-%d' )
</if>
<if test="openStatus != null and openStatus != ''">
and t.open_status = #{openStatus}
......
......@@ -38,7 +38,9 @@
left join company_field_mapping t3 on t2.id = t3.company_id
WHERE
t.delete_date IS NULL
and role = 1
and t2.delete_date is null
and t3.delete_date is null
and role = #{role}
<if test="companyName != null and companyName != ''">
and t2.company_name like concat('%',#{companyName} ,'%')
</if>
......
......@@ -9,19 +9,18 @@
<result column="update_date" property="updateDate" />
<result column="delete_date" property="deleteDate" />
<result column="course_name" property="courseName" />
<result column="category_id" property="categoryId" />
<result column="course_type" property="courseType" />
<result column="course_source" property="courseSource" />
</resultMap>
<!-- 通用查询结果列 -->
<select id="queryCourses" resultType="com.subsidy.vo.course.QueryCoursesVO">
SELECT
distinct
t.id,
t.course_name,
t.course_rank,
t.course_type,
t.open_status
t.open_status,
t.cover_page
FROM
course_dict t
LEFT JOIN course_field_mapping t2 ON t.id = t2.course_id
......@@ -53,11 +52,14 @@
and t3.category_id = #{categoryId}
</if>
<if test="fieldId != null and fieldId != ''">
and t2.field_id = #{field}
and t2.field_id = #{fieldId}
</if>
<if test="rankId != null and rankId != ''">
and t5.rank_id = #{rankId}
</if>
<if test="openStatus != null and openStatus != ''">
and t.open_status = #{openStatus}
</if>
</select>
<sql id="Base_Column_List">
......@@ -107,7 +109,7 @@
<select id="queryCourseCnt" parameterType="long" resultType="integer">
SELECT
count( 1 )
count( t2.id )
FROM
course_content t1
LEFT JOIN vod_dict t2 ON t1.id = t2.content_id
......
......@@ -33,4 +33,26 @@
AND t.course_id = #{courseId}
</select>
<select id="queryMemberJobs" parameterType="long" resultType="com.subsidy.model.JobDictDO">
SELECT
t2.*
FROM
job_member_mapping t
LEFT JOIN job_dict t2 ON t.job_id = t2.id
where t.delete_date is null
and t2.delete_date is null
and t.member_id = #{memberId}
</select>
<select id="queryJobs" parameterType="long" resultType="com.subsidy.model.JobDictDO">
select * from job_dict t where t.delete_date is null
<if test="companyId != null and companyId != ''">
and t.company_id = #{companyId}
</if>
<if test="companyId == null ">
and t.company_id is null
</if>
order by t.order_no
</select>
</mapper>
......@@ -202,7 +202,7 @@
AND t.user_name LIKE concat('%',#{userName} ,'%')
</if>
<if test="companyId != null and companyId != ''">
and t2.company_id = #{companyId}
and t.company_id = #{companyId}
</if>
</select>
......
......@@ -21,15 +21,14 @@
id, student_id, class_id, sign_in_date
</sql>
<select id="classSignInfo" resultType="com.subsidy.vo.sign.ClassSignInfoVO">
<select id="classSignInfo" resultType="com.subsidy.vo.sign.DataViewVO">
SELECT
t.id AS classId,
t2.id AS courseId,
t.class_name,
t2.course_name,
t.start_date,
t.end_date,
t.class_type
t.end_date
FROM
class_dict t
LEFT JOIN company_dict t3 ON t3.id = t.company_id
......
......@@ -36,7 +36,9 @@
t.vod_url,
t.teacher_name,
t.cover_page,
t2.content
t2.content,
t.order_no,
t.vod_code
FROM
vod_dict t
LEFT JOIN course_content t2 ON t.content_id = t2.id
......@@ -47,6 +49,7 @@
<if test="vodName != null and vodName !=''">
and vod_name like concat('%',#{vodName} ,'%')
</if>
order by t.order_no
</select>
<select id="getCourseVods" parameterType="long" resultType="com.subsidy.model.VodDictDO">
......@@ -64,6 +67,7 @@
<if test="vodName != null and vodName !=''">
and t2.vod_name like concat('%',#{vodName} ,'%')
</if>
order by t.id,t2.order_no
</select>
<select id="classVodCompleteInfo" resultType="com.subsidy.vo.vod.ClassVodCompleteInfoVO">
......@@ -82,4 +86,8 @@
</select>
<update id="updateVodOrderNo">
update vod_dict t set t.order_no = #{orderNo} where t.id = #{id}
</update>
</mapper>
......@@ -132,107 +132,107 @@
AND t.vod_id = #{vodId}
</select>
<select id="classStudyHistory" parameterType="long" resultType="com.subsidy.vo.sign.ClassSignInfoVO">
<!-- <select id="classStudyHistory" parameterType="long" resultType="com.subsidy.vo.sign.DataViewVO">-->
SELECT
t10.mem_cnt AS memberCount,
ifnull( floor( t2.ttl / t10.mem_cnt ), 0 ) AS studyVodCounts,
ifnull( t3.total_vods, 0 ) AS totalVodCounts,
ifnull( avg_playlength, 0 ) AS avgVodPlayLength,
ifnull( floor( t4.pass_cnt * 100 / t10.mem_cnt ), 0 ) AS passRate,
ifnull( t5.ask_cnt, 0 ) AS answerCount
FROM
( SELECT t.class_id, count( 1 ) AS mem_cnt FROM class_member_mapping t WHERE t.delete_date IS NULL AND t.class_id = #{classId} ) t10
LEFT JOIN (
SELECT
t.class_id,
count(
DISTINCT ( t.member_id )) AS mem_cnt,
round( sum( t.play_length )/ count( DISTINCT ( t.member_id )), 0 ) AS avg_playlength
FROM
vod_play_history t
WHERE
t.delete_date IS NULL
AND t.class_id = #{classId}
) t ON t.class_id = t10.class_id
LEFT JOIN (
SELECT
t3.class_id,
sum( t3.cnt ) AS ttl
FROM
(
SELECT
t.class_id,
t.member_id,
t.vod_id,
IF
( sum( t.play_length )>= t2.vod_length, 1, 0 ) AS cnt
FROM
vod_play_history t
LEFT JOIN vod_dict t2 ON t.vod_id = t2.id
WHERE
t.class_id = #{classId}
AND t.delete_date IS NULL
GROUP BY
t.class_id,
t.member_id,
t.vod_id
) t3
) t2 ON t.class_id = t2.class_id
LEFT JOIN (
SELECT
t.id,
count( 1 ) AS total_vods
FROM
class_dict t
LEFT JOIN course_content t2 ON t.course_id = t2.course_id
LEFT JOIN vod_dict t3 ON t2.id = t3.content_id
WHERE
t.delete_date IS NULL
AND t2.delete_date IS NULL
AND t3.delete_date IS NULL
AND t.id = #{classId}
) t3 ON t.class_id = t3.id
LEFT JOIN (
SELECT
t2.class_id,
sum(
IF
( t2.cnt >= t4.paper_cnt, 1, 0 )) AS pass_cnt
FROM
(
SELECT
t2.class_id,
t2.member_id,
sum( t2.cnt ) AS cnt
FROM
(
SELECT
t.paper_id,
t.class_id,
t.member_id,
IF
( max( t.score )>= 60, 1, 0 ) AS cnt
FROM
exercise_done_result t
WHERE
t.class_id = #{classId}
AND t.delete_date IS NULL
GROUP BY
t.paper_id,
t.class_id,
t.member_id
) t2
GROUP BY
t2.class_id,
t2.member_id
) t2
LEFT JOIN class_dict t3 ON t2.class_id = t3.id
LEFT JOIN ( SELECT t.course_id, count( 1 ) AS paper_cnt FROM paper_dict t WHERE t.delete_date IS NULL GROUP BY t.course_id ) t4 ON t3.course_id = t4.course_id
) t4 ON t.class_id = t4.class_id
LEFT JOIN ( SELECT t.class_id, sum( 1 ) AS ask_cnt FROM answering_question t WHERE t.class_id = #{classId} AND t.delete_date IS NULL ) t5 ON t.class_id = t5.class_id
<!-- SELECT-->
<!-- t10.mem_cnt AS memberCount,-->
<!-- ifnull( floor( t2.ttl / t10.mem_cnt ), 0 ) AS studyVodCounts,-->
<!-- ifnull( t3.total_vods, 0 ) AS totalVodCounts,-->
<!-- ifnull( avg_playlength, 0 ) AS avgVodPlayLength,-->
<!-- ifnull( floor( t4.pass_cnt * 100 / t10.mem_cnt ), 0 ) AS passRate,-->
<!-- ifnull( t5.ask_cnt, 0 ) AS answerCount-->
<!--FROM-->
<!-- ( SELECT t.class_id, count( 1 ) AS mem_cnt FROM class_member_mapping t WHERE t.delete_date IS NULL AND t.class_id = #{classId} ) t10-->
<!-- LEFT JOIN (-->
<!-- SELECT-->
<!-- t.class_id,-->
<!-- count(-->
<!-- DISTINCT ( t.member_id )) AS mem_cnt,-->
<!-- round( sum( t.play_length )/ count( DISTINCT ( t.member_id )), 0 ) AS avg_playlength-->
<!-- FROM-->
<!-- vod_play_history t-->
<!-- WHERE-->
<!-- t.delete_date IS NULL-->
<!-- AND t.class_id = #{classId}-->
<!-- ) t ON t.class_id = t10.class_id-->
<!-- LEFT JOIN (-->
<!-- SELECT-->
<!-- t3.class_id,-->
<!-- sum( t3.cnt ) AS ttl-->
<!-- FROM-->
<!-- (-->
<!-- SELECT-->
<!-- t.class_id,-->
<!-- t.member_id,-->
<!-- t.vod_id,-->
<!-- IF-->
<!-- ( sum( t.play_length )>= t2.vod_length, 1, 0 ) AS cnt-->
<!-- FROM-->
<!-- vod_play_history t-->
<!-- LEFT JOIN vod_dict t2 ON t.vod_id = t2.id-->
<!-- WHERE-->
<!-- t.class_id = #{classId}-->
<!-- AND t.delete_date IS NULL-->
<!-- GROUP BY-->
<!-- t.class_id,-->
<!-- t.member_id,-->
<!-- t.vod_id-->
<!-- ) t3-->
<!-- ) t2 ON t.class_id = t2.class_id-->
<!-- LEFT JOIN (-->
<!-- SELECT-->
<!-- t.id,-->
<!-- count( 1 ) AS total_vods-->
<!-- FROM-->
<!-- class_dict t-->
<!-- LEFT JOIN course_content t2 ON t.course_id = t2.course_id-->
<!-- LEFT JOIN vod_dict t3 ON t2.id = t3.content_id-->
<!-- WHERE-->
<!-- t.delete_date IS NULL-->
<!-- AND t2.delete_date IS NULL-->
<!-- AND t3.delete_date IS NULL-->
<!-- AND t.id = #{classId}-->
<!-- ) t3 ON t.class_id = t3.id-->
<!-- LEFT JOIN (-->
<!-- SELECT-->
<!-- t2.class_id,-->
<!-- sum(-->
<!-- IF-->
<!-- ( t2.cnt >= t4.paper_cnt, 1, 0 )) AS pass_cnt-->
<!-- FROM-->
<!-- (-->
<!-- SELECT-->
<!-- t2.class_id,-->
<!-- t2.member_id,-->
<!-- sum( t2.cnt ) AS cnt-->
<!-- FROM-->
<!-- (-->
<!-- SELECT-->
<!-- t.paper_id,-->
<!-- t.class_id,-->
<!-- t.member_id,-->
<!-- IF-->
<!-- ( max( t.score )>= 60, 1, 0 ) AS cnt-->
<!-- FROM-->
<!-- exercise_done_result t-->
<!-- WHERE-->
<!-- t.class_id = #{classId}-->
<!-- AND t.delete_date IS NULL-->
<!-- GROUP BY-->
<!-- t.paper_id,-->
<!-- t.class_id,-->
<!-- t.member_id-->
<!-- ) t2-->
<!-- GROUP BY-->
<!-- t2.class_id,-->
<!-- t2.member_id-->
<!-- ) t2-->
<!-- LEFT JOIN class_dict t3 ON t2.class_id = t3.id-->
<!-- LEFT JOIN ( SELECT t.course_id, count( 1 ) AS paper_cnt FROM paper_dict t WHERE t.delete_date IS NULL GROUP BY t.course_id ) t4 ON t3.course_id = t4.course_id-->
<!-- ) t4 ON t.class_id = t4.class_id-->
<!-- LEFT JOIN ( SELECT t.class_id, sum( 1 ) AS ask_cnt FROM answering_question t WHERE t.class_id = #{classId} AND t.delete_date IS NULL ) t5 ON t.class_id = t5.class_id-->
</select>
<!-- </select>-->
<select id="memberRecentPlay" resultType="com.subsidy.vo.member.ContentVodNewVO">
SELECT
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!