diff --git a/pom.xml b/pom.xml index 7f3882c..911b12b 100644 --- a/pom.xml +++ b/pom.xml @@ -208,10 +208,10 @@ ${jedis.version} - - org.springframework.boot - spring-boot-starter-data-mongodb - + + + + diff --git a/src/main/java/com/subsidy/common/configure/WechatConfig.java b/src/main/java/com/subsidy/common/configure/WechatConfig.java index 46e2034..050e82b 100644 --- a/src/main/java/com/subsidy/common/configure/WechatConfig.java +++ b/src/main/java/com/subsidy/common/configure/WechatConfig.java @@ -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; } diff --git a/src/main/java/com/subsidy/controller/AccessTokenController.java b/src/main/java/com/subsidy/controller/AccessTokenController.java new file mode 100644 index 0000000..0058e29 --- /dev/null +++ b/src/main/java/com/subsidy/controller/AccessTokenController.java @@ -0,0 +1,106 @@ +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; + +/** + *

+ * 前端控制器 + *

+ * + * @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 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 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 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 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() + "×tamp=" + signVO.getTimestamp() + + "&url=" + signVO.getUrl(); + + signVO.setSign(SecretUtils.getSHAString(signStr)); + return ResponseData.generateCreatedResponse(0,signVO); + } +} diff --git a/src/main/java/com/subsidy/controller/ClassDictController.java b/src/main/java/com/subsidy/controller/ClassDictController.java index 0990c0a..2d99aa4 100644 --- a/src/main/java/com/subsidy/controller/ClassDictController.java +++ b/src/main/java/com/subsidy/controller/ClassDictController.java @@ -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)); diff --git a/src/main/java/com/subsidy/controller/CourseDictController.java b/src/main/java/com/subsidy/controller/CourseDictController.java index da148b4..fa6a20b 100644 --- a/src/main/java/com/subsidy/controller/CourseDictController.java +++ b/src/main/java/com/subsidy/controller/CourseDictController.java @@ -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)); } diff --git a/src/main/java/com/subsidy/controller/DepartmentDictController.java b/src/main/java/com/subsidy/controller/DepartmentDictController.java index 37683e0..5845bad 100644 --- a/src/main/java/com/subsidy/controller/DepartmentDictController.java +++ b/src/main/java/com/subsidy/controller/DepartmentDictController.java @@ -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)); } diff --git a/src/main/java/com/subsidy/controller/JobDictController.java b/src/main/java/com/subsidy/controller/JobDictController.java index 553c13e..267b53d 100644 --- a/src/main/java/com/subsidy/controller/JobDictController.java +++ b/src/main/java/com/subsidy/controller/JobDictController.java @@ -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)); } diff --git a/src/main/java/com/subsidy/controller/MemberController.java b/src/main/java/com/subsidy/controller/MemberController.java index e3249d6..b418212 100644 --- a/src/main/java/com/subsidy/controller/MemberController.java +++ b/src/main/java/com/subsidy/controller/MemberController.java @@ -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)); } diff --git a/src/main/java/com/subsidy/controller/RankDictController.java b/src/main/java/com/subsidy/controller/RankDictController.java index 4520b73..d0aa079 100644 --- a/src/main/java/com/subsidy/controller/RankDictController.java +++ b/src/main/java/com/subsidy/controller/RankDictController.java @@ -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)); } diff --git a/src/main/java/com/subsidy/controller/SignInRecordController.java b/src/main/java/com/subsidy/controller/SignInRecordController.java index 26e42c2..d904899 100644 --- a/src/main/java/com/subsidy/controller/SignInRecordController.java +++ b/src/main/java/com/subsidy/controller/SignInRecordController.java @@ -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") diff --git a/src/main/java/com/subsidy/controller/VodDictController.java b/src/main/java/com/subsidy/controller/VodDictController.java index 33d42e1..abd6949 100644 --- a/src/main/java/com/subsidy/controller/VodDictController.java +++ b/src/main/java/com/subsidy/controller/VodDictController.java @@ -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)); + } } diff --git a/src/main/java/com/subsidy/controller/VodPlayHistoryController.java b/src/main/java/com/subsidy/controller/VodPlayHistoryController.java index 95dfe80..4441072 100644 --- a/src/main/java/com/subsidy/controller/VodPlayHistoryController.java +++ b/src/main/java/com/subsidy/controller/VodPlayHistoryController.java @@ -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); + } + } diff --git a/src/main/java/com/subsidy/dto/course/AddCourseDTO.java b/src/main/java/com/subsidy/dto/course/AddCourseDTO.java new file mode 100644 index 0000000..83a9cc5 --- /dev/null +++ b/src/main/java/com/subsidy/dto/course/AddCourseDTO.java @@ -0,0 +1,64 @@ +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 fieldDictDOS; + + /** + * 课程类目 + */ + private List categoryDOS; + + /** + * 适用岗位 + */ + private List jobDictDOS; + + /** + * 适用职级 + */ + private List rankDictDOS; + +} diff --git a/src/main/java/com/subsidy/dto/course/QueryCoursesDTO.java b/src/main/java/com/subsidy/dto/course/QueryCoursesDTO.java index 689da22..1e6db0c 100644 --- a/src/main/java/com/subsidy/dto/course/QueryCoursesDTO.java +++ b/src/main/java/com/subsidy/dto/course/QueryCoursesDTO.java @@ -23,4 +23,6 @@ public class QueryCoursesDTO { private Long companyId; + private Integer openStatus; + } diff --git a/src/main/java/com/subsidy/dto/course/UpdateCoursesDTO.java b/src/main/java/com/subsidy/dto/course/UpdateCoursesDTO.java index d95adaf..672c497 100644 --- a/src/main/java/com/subsidy/dto/course/UpdateCoursesDTO.java +++ b/src/main/java/com/subsidy/dto/course/UpdateCoursesDTO.java @@ -1,9 +1,5 @@ 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 fieldDictDOS; + private List fieldDictDOS; /** * 课程类目 */ - private List categoryDOS; + private List categoryDOS; /** * 适用岗位 */ - private List jobDictDOS; + private List jobDictDOS; /** * 适用职级 */ - private List rankDictDOS; + private List rankDictDOS; } diff --git a/src/main/java/com/subsidy/dto/member/AddMemberDTO.java b/src/main/java/com/subsidy/dto/member/AddMemberDTO.java index 8511410..ad7d53f 100644 --- a/src/main/java/com/subsidy/dto/member/AddMemberDTO.java +++ b/src/main/java/com/subsidy/dto/member/AddMemberDTO.java @@ -1,6 +1,5 @@ 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 departmentIds; + private List jobIds; + } diff --git a/src/main/java/com/subsidy/dto/member/ImportMemberDTO.java b/src/main/java/com/subsidy/dto/member/ImportMemberDTO.java index 4ba1069..9f4f60b 100644 --- a/src/main/java/com/subsidy/dto/member/ImportMemberDTO.java +++ b/src/main/java/com/subsidy/dto/member/ImportMemberDTO.java @@ -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; } diff --git a/src/main/java/com/subsidy/dto/sign/ClassSignInfoDTO.java b/src/main/java/com/subsidy/dto/sign/DataViewDTO.java similarity index 90% rename from src/main/java/com/subsidy/dto/sign/ClassSignInfoDTO.java rename to src/main/java/com/subsidy/dto/sign/DataViewDTO.java index 57f6571..d12b31d 100644 --- a/src/main/java/com/subsidy/dto/sign/ClassSignInfoDTO.java +++ b/src/main/java/com/subsidy/dto/sign/DataViewDTO.java @@ -3,7 +3,7 @@ package com.subsidy.dto.sign; import lombok.Data; @Data -public class ClassSignInfoDTO { +public class DataViewDTO { private String className; diff --git a/src/main/java/com/subsidy/dto/vod/DataFixTwoDTO.java b/src/main/java/com/subsidy/dto/vod/ChangeOrdersDTO.java similarity index 61% rename from src/main/java/com/subsidy/dto/vod/DataFixTwoDTO.java rename to src/main/java/com/subsidy/dto/vod/ChangeOrdersDTO.java index 5732f9e..969eecd 100644 --- a/src/main/java/com/subsidy/dto/vod/DataFixTwoDTO.java +++ b/src/main/java/com/subsidy/dto/vod/ChangeOrdersDTO.java @@ -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 vodIds; } diff --git a/src/main/java/com/subsidy/jobs/SchedulerJob.java b/src/main/java/com/subsidy/jobs/SchedulerJob.java index 157379e..49b8900 100644 --- a/src/main/java/com/subsidy/jobs/SchedulerJob.java +++ b/src/main/java/com/subsidy/jobs/SchedulerJob.java @@ -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; /** 删除十天前登录记录(管理端) */ diff --git a/src/main/java/com/subsidy/mapper/AccessTokenMapper.java b/src/main/java/com/subsidy/mapper/AccessTokenMapper.java new file mode 100644 index 0000000..3453dc6 --- /dev/null +++ b/src/main/java/com/subsidy/mapper/AccessTokenMapper.java @@ -0,0 +1,18 @@ +package com.subsidy.mapper; + +import com.subsidy.model.AccessTokenDO; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.springframework.stereotype.Repository; + +/** + *

+ * Mapper 接口 + *

+ * + * @author DengMin + * @since 2022-02-18 + */ + @Repository +public interface AccessTokenMapper extends BaseMapper { + +} diff --git a/src/main/java/com/subsidy/mapper/CompanyDictMapper.java b/src/main/java/com/subsidy/mapper/CompanyDictMapper.java index 13913df..fe81fc9 100644 --- a/src/main/java/com/subsidy/mapper/CompanyDictMapper.java +++ b/src/main/java/com/subsidy/mapper/CompanyDictMapper.java @@ -24,7 +24,7 @@ public interface CompanyDictMapper extends BaseMapper { * 企业管理--查找所有主账号 * @return */ - IPage operators(IPage page, String companyName,Long fieldId); + IPage operators(IPage page, String companyName,Long fieldId,Integer role); /** * 查找所有的公司名称 diff --git a/src/main/java/com/subsidy/mapper/CourseDictMapper.java b/src/main/java/com/subsidy/mapper/CourseDictMapper.java index 05310e4..563613d 100644 --- a/src/main/java/com/subsidy/mapper/CourseDictMapper.java +++ b/src/main/java/com/subsidy/mapper/CourseDictMapper.java @@ -26,7 +26,7 @@ public interface CourseDictMapper extends BaseMapper { * courseName fieldId categoryId jobId courseRank courseType * @return */ - IPage queryCourses(IPage page, String courseName, Long fieldId,Long categoryId,Long jobId,Long rankId, String courseType,Long companyId); + IPage queryCourses(IPage page, String courseName, Long fieldId,Long categoryId,Long jobId,Long rankId, String courseType,Long companyId,Integer openStatus); /** * 通过课程id查询课程下的学生-----弃用 diff --git a/src/main/java/com/subsidy/mapper/JobDictMapper.java b/src/main/java/com/subsidy/mapper/JobDictMapper.java index 240d7a1..ca6a375 100644 --- a/src/main/java/com/subsidy/mapper/JobDictMapper.java +++ b/src/main/java/com/subsidy/mapper/JobDictMapper.java @@ -1,5 +1,6 @@ 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 { */ List queryCourseJobs(Long courseId); + /** + * 获取某个人的岗位 + */ + List queryMemberJobs(Long memberId); + + /** + * 查询岗位 + * @param companyId + * @return + */ + List queryJobs(Long companyId); } diff --git a/src/main/java/com/subsidy/mapper/SignInRecordMapper.java b/src/main/java/com/subsidy/mapper/SignInRecordMapper.java index 76960b1..a84d591 100644 --- a/src/main/java/com/subsidy/mapper/SignInRecordMapper.java +++ b/src/main/java/com/subsidy/mapper/SignInRecordMapper.java @@ -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 { /** - * 公司学习记录 + * 数据概览 */ - IPage classSignInfo(IPage iPage, String className, String courseName, Integer id); + IPage classSignInfo(IPage iPage, String className, String courseName, Integer id); List getSignInRecord(); diff --git a/src/main/java/com/subsidy/mapper/VodDictMapper.java b/src/main/java/com/subsidy/mapper/VodDictMapper.java index 72fcae5..5461f18 100644 --- a/src/main/java/com/subsidy/mapper/VodDictMapper.java +++ b/src/main/java/com/subsidy/mapper/VodDictMapper.java @@ -23,7 +23,7 @@ public interface VodDictMapper extends BaseMapper { /** * 查看某个目录下的视频 */ - IPage getContendVods(IPage page,String vodName,Long contentId); + List getContendVods(String vodName,Long contentId); /** * 查看某个课程下的视频 @@ -34,4 +34,9 @@ public interface VodDictMapper extends BaseMapper { * 获取某课程下,学习人数和平均学习时长 */ ClassVodCompleteInfoVO classVodCompleteInfo(Long classId, Long vodId,List memberIds,String vodName); + + /** + * 修改某个视频的顺序 + */ + void updateVodOrderNo(Long id,Integer orderNo); } diff --git a/src/main/java/com/subsidy/mapper/VodPlayHistoryMapper.java b/src/main/java/com/subsidy/mapper/VodPlayHistoryMapper.java index 2628870..506639e 100644 --- a/src/main/java/com/subsidy/mapper/VodPlayHistoryMapper.java +++ b/src/main/java/com/subsidy/mapper/VodPlayHistoryMapper.java @@ -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 { */ int completeVodOrNot(Long memberId, Long vodId); - /** - * 查看某个班级的学习记录 - */ - ClassSignInfoVO classStudyHistory(Long classId); + ///** + // * 查看某个班级的学习记录 + // */ + //DataViewVO classStudyHistory(Long classId); /** * 查看这个课程某个成员看的视频课程 diff --git a/src/main/java/com/subsidy/model/AccessTokenDO.java b/src/main/java/com/subsidy/model/AccessTokenDO.java new file mode 100644 index 0000000..2803660 --- /dev/null +++ b/src/main/java/com/subsidy/model/AccessTokenDO.java @@ -0,0 +1,31 @@ +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; + +/** + *

+ * + *

+ * + * @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; + + +} diff --git a/src/main/java/com/subsidy/model/ClassDictDO.java b/src/main/java/com/subsidy/model/ClassDictDO.java index 75f9fd3..1f82aa6 100644 --- a/src/main/java/com/subsidy/model/ClassDictDO.java +++ b/src/main/java/com/subsidy/model/ClassDictDO.java @@ -73,5 +73,10 @@ public class ClassDictDO extends BaseModel { */ private String openStatus; + /** + * 测试规则 + */ + private Integer testRule; + } diff --git a/src/main/java/com/subsidy/model/ClassNoticeDO.java b/src/main/java/com/subsidy/model/ClassNoticeDO.java index abd5943..8f48268 100644 --- a/src/main/java/com/subsidy/model/ClassNoticeDO.java +++ b/src/main/java/com/subsidy/model/ClassNoticeDO.java @@ -37,11 +37,6 @@ public class ClassNoticeDO extends BaseModel { private String noticeType; /** - * 是否自动通知 - */ - private Integer isAuto; - - /** * 通知时间 */ private String noticeTime; diff --git a/src/main/java/com/subsidy/model/CourseDictDO.java b/src/main/java/com/subsidy/model/CourseDictDO.java index 0cf012d..7bdecd5 100644 --- a/src/main/java/com/subsidy/model/CourseDictDO.java +++ b/src/main/java/com/subsidy/model/CourseDictDO.java @@ -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; } diff --git a/src/main/java/com/subsidy/model/CourseFieldMappingDO.java b/src/main/java/com/subsidy/model/CourseFieldMappingDO.java index c05f6b9..bed9f02 100644 --- a/src/main/java/com/subsidy/model/CourseFieldMappingDO.java +++ b/src/main/java/com/subsidy/model/CourseFieldMappingDO.java @@ -27,7 +27,7 @@ public class CourseFieldMappingDO extends BaseModel { private Long courseId; - private Long fieldMapping; + private Long fieldId; } diff --git a/src/main/java/com/subsidy/model/MemberDO.java b/src/main/java/com/subsidy/model/MemberDO.java index 68de3a7..9640093 100644 --- a/src/main/java/com/subsidy/model/MemberDO.java +++ b/src/main/java/com/subsidy/model/MemberDO.java @@ -36,6 +36,11 @@ public class MemberDO extends BaseModel { private String accountName; /** + * 英文名 + */ + private String accountNameEn; + + /** * 姓名 */ private String userName; diff --git a/src/main/java/com/subsidy/mongodb/MongoController.java b/src/main/java/com/subsidy/mongodb/MongoController.java index 74fb71e..ff92950 100644 --- a/src/main/java/com/subsidy/mongodb/MongoController.java +++ b/src/main/java/com/subsidy/mongodb/MongoController.java @@ -1,68 +1,68 @@ -package com.subsidy.mongodb; - -import com.subsidy.util.MongoUtil; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.data.mongodb.core.MongoTemplate; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; - -@RestController -@RequestMapping("/mango") -public class MongoController { - - - @Autowired - private MongoTemplate mongoTemplate; - - @Autowired - private MongoUtil mongoUtil; - - @PostMapping("getOne") - public void getAll(){ - ////Query query=new Query(); - ////MongoDO user = mongoTemplate.getDb(query , MongoDO.class); - ////List mongo= mongoTemplate.findAll(MongoDO.class); - ////System.out.println(mongo); - //System.out.println(mongoTemplate.getDb().getName()); - // - //Collection mongoDO = mongoTemplate.findById("61de944c5cdc5e3f896c95c7", Collection.class); - //System.out.println(mongoDO); - // - //List collections = mongoTemplate.findAll(Collection.class); - //System.out.println(collections); - // - //Query query = new Query(Criteria.where("name").regex("张"));//可累加条件 - //List entrY = mongoTemplate.find(query,Collection.class); - //System.out.println(entrY); - - //添加 - //Collection collection = new Collection(); - //collection.setName("bbbbbbbb"); - //collection.set_id("61de944c5cdc5e3f896c95c7"); - //mongoTemplate.save(collection,"collection"); - - //for (int i = 0 ; i < 100; i++){ - // Collection collection1 = new Collection(); - // collection1.setName("aaaa"+i); - // mongoTemplate.save(collection1); - //} - - //Query query =new Query(new Criteria()); - //query.with(Sort.by("name")); - ////mongoUtil.start(1,5,query); - //List collections = mongoTemplate.find(query,Collection.class); - //for (Collection collection : collections){ - // System.out.println(collection+"========="); - //} - - //OprAdmDictDO oprAdmDictDO = new OprAdmDictDO(); - //oprAdmDictDO.setUserId(1L); - //oprAdmDictDO.setResult(1); - //oprAdmDictDO.setOprType("登录成功"); - //mongoTemplate.save(oprAdmDictDO); - - - } - -} +//package com.subsidy.mongodb; +// +//import com.subsidy.util.MongoUtil; +//import org.springframework.beans.factory.annotation.Autowired; +//import org.springframework.data.mongodb.core.MongoTemplate; +//import org.springframework.web.bind.annotation.PostMapping; +//import org.springframework.web.bind.annotation.RequestMapping; +//import org.springframework.web.bind.annotation.RestController; +// +//@RestController +//@RequestMapping("/mango") +//public class MongoController { +// +// +// @Autowired +// private MongoTemplate mongoTemplate; +// +// @Autowired +// private MongoUtil mongoUtil; +// +// @PostMapping("getOne") +// public void getAll(){ +// ////Query query=new Query(); +// ////MongoDO user = mongoTemplate.getDb(query , MongoDO.class); +// ////List mongo= mongoTemplate.findAll(MongoDO.class); +// ////System.out.println(mongo); +// //System.out.println(mongoTemplate.getDb().getName()); +// // +// //Collection mongoDO = mongoTemplate.findById("61de944c5cdc5e3f896c95c7", Collection.class); +// //System.out.println(mongoDO); +// // +// //List collections = mongoTemplate.findAll(Collection.class); +// //System.out.println(collections); +// // +// //Query query = new Query(Criteria.where("name").regex("张"));//可累加条件 +// //List entrY = mongoTemplate.find(query,Collection.class); +// //System.out.println(entrY); +// +// //添加 +// //Collection collection = new Collection(); +// //collection.setName("bbbbbbbb"); +// //collection.set_id("61de944c5cdc5e3f896c95c7"); +// //mongoTemplate.save(collection,"collection"); +// +// //for (int i = 0 ; i < 100; i++){ +// // Collection collection1 = new Collection(); +// // collection1.setName("aaaa"+i); +// // mongoTemplate.save(collection1); +// //} +// +// //Query query =new Query(new Criteria()); +// //query.with(Sort.by("name")); +// ////mongoUtil.start(1,5,query); +// //List collections = mongoTemplate.find(query,Collection.class); +// //for (Collection collection : collections){ +// // System.out.println(collection+"========="); +// //} +// +// //OprAdmDictDO oprAdmDictDO = new OprAdmDictDO(); +// //oprAdmDictDO.setUserId(1L); +// //oprAdmDictDO.setResult(1); +// //oprAdmDictDO.setOprType("登录成功"); +// //mongoTemplate.save(oprAdmDictDO); +// +// +// } +// +//} diff --git a/src/main/java/com/subsidy/service/AccessTokenService.java b/src/main/java/com/subsidy/service/AccessTokenService.java new file mode 100644 index 0000000..bd4ab7b --- /dev/null +++ b/src/main/java/com/subsidy/service/AccessTokenService.java @@ -0,0 +1,16 @@ +package com.subsidy.service; + +import com.subsidy.model.AccessTokenDO; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + *

+ * 服务类 + *

+ * + * @author DengMin + * @since 2022-02-18 + */ +public interface AccessTokenService extends IService { + +} diff --git a/src/main/java/com/subsidy/service/CourseDictService.java b/src/main/java/com/subsidy/service/CourseDictService.java index 080c9c3..c02d72d 100644 --- a/src/main/java/com/subsidy/service/CourseDictService.java +++ b/src/main/java/com/subsidy/service/CourseDictService.java @@ -1,6 +1,7 @@ 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 { - String addCourse(CourseDictDO courseDictDO); + String addCourse(AddCourseDTO addCourseDTO); String deleteCourse(CourseDictDO courseDictDO); diff --git a/src/main/java/com/subsidy/service/SignInRecordService.java b/src/main/java/com/subsidy/service/SignInRecordService.java index f29f553..ab8071e 100644 --- a/src/main/java/com/subsidy/service/SignInRecordService.java +++ b/src/main/java/com/subsidy/service/SignInRecordService.java @@ -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 { String signIn(SignInRecordDO signInRecordDO); - IPage classSignInfo(ClassSignInfoDTO classSignInfoDTO); + IPage dataView(DataViewDTO classSignInfoDTO); SignInStatusVO signInStatus(SignInRecordDO signInRecordDO); diff --git a/src/main/java/com/subsidy/service/VodDictService.java b/src/main/java/com/subsidy/service/VodDictService.java index 80f753d..b923816 100644 --- a/src/main/java/com/subsidy/service/VodDictService.java +++ b/src/main/java/com/subsidy/service/VodDictService.java @@ -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; + /** *

* 视频表 服务类 @@ -19,11 +22,13 @@ public interface VodDictService extends IService { SignatureVO signature()throws Exception; - IPage getContendVods(GetContendVodsDTO getContendVodsDTO); + List getContendVods(GetContendVodsDTO getContendVodsDTO); String deleteVod(VodDictDO vodDictDO); String addVod(VodDictDO vodDictDO); String updateVod(VodDictDO vodDictDO); + + String changeOrders(ChangeOrdersDTO changeOrdersDTO); } diff --git a/src/main/java/com/subsidy/service/VodPlayHistoryService.java b/src/main/java/com/subsidy/service/VodPlayHistoryService.java index 5e1fa20..a907395 100644 --- a/src/main/java/com/subsidy/service/VodPlayHistoryService.java +++ b/src/main/java/com/subsidy/service/VodPlayHistoryService.java @@ -25,4 +25,6 @@ public interface VodPlayHistoryService extends IService { void signDatePlays(SignDatePlaysDTO dataFixDTO); void remainSeconds(RemainSecondsDTO remainSecondsDTO); + + void playLengthFix(RemainSecondsDTO remainSecondsDTO); } diff --git a/src/main/java/com/subsidy/service/impl/AccessTokenServiceImpl.java b/src/main/java/com/subsidy/service/impl/AccessTokenServiceImpl.java new file mode 100644 index 0000000..bdb62f9 --- /dev/null +++ b/src/main/java/com/subsidy/service/impl/AccessTokenServiceImpl.java @@ -0,0 +1,20 @@ +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; + +/** + *

+ * 服务实现类 + *

+ * + * @author DengMin + * @since 2022-02-18 + */ +@Service +public class AccessTokenServiceImpl extends ServiceImpl implements AccessTokenService { + +} diff --git a/src/main/java/com/subsidy/service/impl/AdministerServiceImpl.java b/src/main/java/com/subsidy/service/impl/AdministerServiceImpl.java index 7f68f78..f00f885 100644 --- a/src/main/java/com/subsidy/service/impl/AdministerServiceImpl.java +++ b/src/main/java/com/subsidy/service/impl/AdministerServiceImpl.java @@ -326,7 +326,7 @@ public class AdministerServiceImpl extends ServiceImpl operators(OperatorsDTO operatorsDTO) { Page pager = new Page(operatorsDTO.getPageNum(), operatorsDTO.getPageSize()); - IPage operatorsVOIPage = companyDictMapper.operators(pager, operatorsDTO.getCompanyName(), operatorsDTO.getFieldId()); + IPage operatorsVOIPage = companyDictMapper.operators(pager, operatorsDTO.getCompanyName(), operatorsDTO.getFieldId(),0); List operatorsVOS = operatorsVOIPage.getRecords(); for (OperatorsVO operatorsVO : operatorsVOS) { @@ -436,7 +436,7 @@ public class AdministerServiceImpl extends ServiceImpl() .lambda() .eq(AnsweringQuestionDO::getClassId, classDetailDTO.getId())); - classSummaryVO.setAnswerCount(count); + classSummaryVO.setAnswerCnt(count); return classSummaryVO; } @@ -1290,7 +1290,7 @@ public class AdministerServiceImpl extends ServiceImpl { + ExcelUtil.readExcelWithoutTitle(null, ImportMemberDTO.class, multipartFile).forEach(s -> { MemberDO memberDO = memberMapper.selectOne(new QueryWrapper() .lambda() @@ -1323,18 +1323,29 @@ public class AdministerServiceImpl extends ServiceImpl() - .lambda() - .isNull(DepartmentDictDO::getParentId) - .eq(DepartmentDictDO::getCompanyId, companyId)); + //找到对应的部门 + String[] departments = s.getDepartments().split(","); + + for (String dpt : departments){ + + //找到最后一个部门对应id + String[] deps = dpt.split("/"); + DepartmentDictDO departmentDictDO = departmentDictMapper.selectOne(new QueryWrapper() + .lambda() + .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); + + } + - MemberDepartmentMappingDO memberDepartmentMappingDO = new MemberDepartmentMappingDO(); - memberDepartmentMappingDO.setDepartmentId(departmentDictDO.getId()); - memberDepartmentMappingDO.setMemberId(memberDO1.getId()); - memberDepartmentMappingMapper.insert(memberDepartmentMappingDO); } }); } catch (Exception e) { diff --git a/src/main/java/com/subsidy/service/impl/ClassDictServiceImpl.java b/src/main/java/com/subsidy/service/impl/ClassDictServiceImpl.java index 399de93..85f7f7b 100644 --- a/src/main/java/com/subsidy/service/impl/ClassDictServiceImpl.java +++ b/src/main/java/com/subsidy/service/impl/ClassDictServiceImpl.java @@ -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; /** *

@@ -59,6 +66,9 @@ public class ClassDictServiceImpl extends ServiceImpl getAllClasses(ClassDictDO classDictDO) { return this.baseMapper.getAllClasses(classDictDO); } @@ -89,11 +99,24 @@ public class ClassDictServiceImpl extends ServiceImpl classNoticeDOS = addClassDTO.getClassNoticeDOS(); - for (ClassNoticeDO classNoticeDO : classNoticeDOS) { - classNoticeDO.setClassId(classDictDO.getId()); - classNoticeMapper.insert(classNoticeDO); + if (null != addClassDTO.getClassNoticeDOS()){ + List 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 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; } diff --git a/src/main/java/com/subsidy/service/impl/ClassNoticeServiceImpl.java b/src/main/java/com/subsidy/service/impl/ClassNoticeServiceImpl.java index c8631e4..98805da 100644 --- a/src/main/java/com/subsidy/service/impl/ClassNoticeServiceImpl.java +++ b/src/main/java/com/subsidy/service/impl/ClassNoticeServiceImpl.java @@ -60,7 +60,7 @@ public class ClassNoticeServiceImpl extends ServiceImpl 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"); diff --git a/src/main/java/com/subsidy/service/impl/CompanyDictServiceImpl.java b/src/main/java/com/subsidy/service/impl/CompanyDictServiceImpl.java index 631a5cc..ae1585c 100644 --- a/src/main/java/com/subsidy/service/impl/CompanyDictServiceImpl.java +++ b/src/main/java/com/subsidy/service/impl/CompanyDictServiceImpl.java @@ -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 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 operatorsVOS = page.getRecords(); for (OperatorsVO operatorsVO : operatorsVOS) { //查看公司所在行业 @@ -141,6 +150,20 @@ public class CompanyDictServiceImpl extends ServiceImpl jobDictDOS = jobDictMapper.selectList(new QueryWrapper() + .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; } diff --git a/src/main/java/com/subsidy/service/impl/CourseDictServiceImpl.java b/src/main/java/com/subsidy/service/impl/CourseDictServiceImpl.java index 8683dbf..059f7b1 100644 --- a/src/main/java/com/subsidy/service/impl/CourseDictServiceImpl.java +++ b/src/main/java/com/subsidy/service/impl/CourseDictServiceImpl.java @@ -5,6 +5,7 @@ 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.common.exception.HttpException; +import com.subsidy.dto.course.AddCourseDTO; import com.subsidy.dto.course.QueryCoursesDTO; import com.subsidy.dto.course.UpdateCoursesDTO; import com.subsidy.dto.field.QueryFieldsDTO; @@ -32,11 +33,14 @@ import com.subsidy.model.RankDictDO; import com.subsidy.model.RoleAdministerMappingDO; import com.subsidy.service.CourseDictService; import com.subsidy.util.ConstantUtils; +import com.subsidy.util.excel.ExcelUtil; import com.subsidy.vo.course.QueryCoursesVO; import org.springframework.beans.BeanUtils; +import org.springframework.beans.factory.BeanFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.scheduling.annotation.Async; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; import java.util.List; @@ -82,28 +86,73 @@ public class CourseDictServiceImpl extends ServiceImpl() .lambda() - .eq(CourseDictDO::getCourseName, courseDictDO.getCourseName()) + .eq(CourseDictDO::getCourseName, addCourseDTO.getCourseName()) .isNull(CourseDictDO::getCompanyId)); } else { count = this.baseMapper.selectCount(new QueryWrapper() .lambda() - .eq(CourseDictDO::getCourseName, courseDictDO.getCourseName()) - .eq(CourseDictDO::getCompanyId, courseDictDO.getCompanyId())); + .eq(CourseDictDO::getCourseName, addCourseDTO.getCourseName()) + .eq(CourseDictDO::getCompanyId, addCourseDTO.getCompanyId())); } if (count > 0) { throw new HttpException(20001); } + CourseDictDO courseDictDO = new CourseDictDO(); + BeanUtils.copyProperties(addCourseDTO, courseDictDO); this.baseMapper.insert(courseDictDO); + + if (null != addCourseDTO.getCategoryDOS()) { + List categoryDOS = addCourseDTO.getCategoryDOS(); + for (Long lg : categoryDOS) { + CourseCategoryMappingDO courseCategoryMappingDO = new CourseCategoryMappingDO(); + courseCategoryMappingDO.setCategoryId(lg); + courseCategoryMappingDO.setCourseId(courseDictDO.getId()); + courseCategoryMappingMapper.insert(courseCategoryMappingDO); + } + } + + if (null != addCourseDTO.getJobDictDOS()) { + List jobDictDOS = addCourseDTO.getJobDictDOS(); + for (Long lg : jobDictDOS) { + CourseJobMappingDO courseJobMappingDO = new CourseJobMappingDO(); + courseJobMappingDO.setJobId(lg); + courseJobMappingDO.setCourseId(courseDictDO.getId()); + courseJobMappingMapper.insert(courseJobMappingDO); + } + } + + + if (null != addCourseDTO.getFieldDictDOS()) { + List fieldDictDOS = addCourseDTO.getFieldDictDOS(); + for (Long lg : fieldDictDOS) { + CourseFieldMappingDO courseFieldMappingDO = new CourseFieldMappingDO(); + courseFieldMappingDO.setCourseId(courseDictDO.getId()); + courseFieldMappingDO.setFieldId(lg); + courseFieldMappingMapper.insert(courseFieldMappingDO); + } + } + + if (null != addCourseDTO.getRankDictDOS()) { + List rankDictDOS = addCourseDTO.getRankDictDOS(); + for (Long lg : rankDictDOS) { + CourseRankMappingDO courseRankMappingDO = new CourseRankMappingDO(); + courseRankMappingDO.setCourseId(courseDictDO.getId()); + courseRankMappingDO.setRankId(lg); + courseRankMappingMapper.insert(courseRankMappingDO); + } + } + return ConstantUtils.ADD_SUCCESS; } @@ -134,7 +183,7 @@ public class CourseDictServiceImpl extends ServiceImpl queryCourses(QueryCoursesDTO queryCoursesDTO) { Page pager = new Page(queryCoursesDTO.getPageNum(), queryCoursesDTO.getPageSize()); - IPage iPage = this.baseMapper.queryCourses(pager, queryCoursesDTO.getCourseName(), queryCoursesDTO.getFieldId(), queryCoursesDTO.getCategoryId(), queryCoursesDTO.getJobId(), queryCoursesDTO.getRankId(), queryCoursesDTO.getCourseType(), null); + IPage iPage = this.baseMapper.queryCourses(pager, queryCoursesDTO.getCourseName(), queryCoursesDTO.getFieldId(), queryCoursesDTO.getCategoryId(), queryCoursesDTO.getJobId(), queryCoursesDTO.getRankId(), queryCoursesDTO.getCourseType(), null, queryCoursesDTO.getOpenStatus()); List queryCoursesVOS = iPage.getRecords(); for (QueryCoursesVO queryCoursesVO : queryCoursesVOS) { @@ -151,6 +200,10 @@ public class CourseDictServiceImpl extends ServiceImpl rankDictDOS = rankDictMapper.queryCourseRanks(queryCoursesVO.getId()); queryCoursesVO.setRankDictDOS(rankDictDOS); + //行业范围 + List fieldDictDOS = fieldDictMapper.queryCourseFields(queryCoursesVO.getId()); + queryCoursesVO.setFieldDictDOS(fieldDictDOS); + //课时 Integer vodCnt = courseDictMapper.queryCourseCnt(queryCoursesVO.getId()); queryCoursesVO.setVodCounts(vodCnt); @@ -180,7 +233,8 @@ public class CourseDictServiceImpl extends ServiceImpl() .lambda() .eq(CourseDictDO::getCourseName, updateCoursesDTO.getCourseName()) - .isNull(CourseDictDO::getCompanyId)); + .isNull(CourseDictDO::getCompanyId) + .ne(CourseDictDO::getId, updateCoursesDTO.getId())); } if (count > 0) { @@ -191,61 +245,61 @@ public class CourseDictServiceImpl extends ServiceImpl 0) { + if (null != updateCoursesDTO.getFieldDictDOS()) { courseFieldMappingMapper.delete(new QueryWrapper() .lambda() .eq(CourseFieldMappingDO::getCourseId, updateCoursesDTO.getId())); - List fieldDictDOS = updateCoursesDTO.getFieldDictDOS(); - for (FieldDictDO fieldDictDO : fieldDictDOS) { + List fieldDictDOS = updateCoursesDTO.getFieldDictDOS(); + for (Long lg : fieldDictDOS) { CourseFieldMappingDO courseFieldMappingDO = new CourseFieldMappingDO(); courseFieldMappingDO.setCourseId(updateCoursesDTO.getId()); - courseFieldMappingDO.setFieldMapping(fieldDictDO.getId()); + courseFieldMappingDO.setFieldId(lg); courseFieldMappingMapper.insert(courseFieldMappingDO); } } //类目 - if (updateCoursesDTO.getCategoryDOS().size() > 0) { + if (null != updateCoursesDTO.getCategoryDOS()) { courseCategoryMappingMapper.delete(new QueryWrapper() .lambda() .eq(CourseCategoryMappingDO::getCourseId, updateCoursesDTO.getId())); - List categoryDOS = updateCoursesDTO.getCategoryDOS(); - for (CategoryDO categoryDO : categoryDOS) { + List categoryDOS = updateCoursesDTO.getCategoryDOS(); + for (Long lg : categoryDOS) { CourseCategoryMappingDO courseCategoryMappingDO = new CourseCategoryMappingDO(); courseCategoryMappingDO.setCourseId(updateCoursesDTO.getId()); - courseCategoryMappingDO.setCategoryId(categoryDO.getId()); + courseCategoryMappingDO.setCategoryId(lg); courseCategoryMappingMapper.insert(courseCategoryMappingDO); } } //岗位 - if (updateCoursesDTO.getJobDictDOS().size() > 0) { + if (null != updateCoursesDTO.getJobDictDOS()) { courseJobMappingMapper.delete(new QueryWrapper() .lambda() .eq(CourseJobMappingDO::getCourseId, updateCoursesDTO.getId())); - List jobDictDOS = updateCoursesDTO.getJobDictDOS(); - for (JobDictDO jobDictDO : jobDictDOS) { + List jobDictDOS = updateCoursesDTO.getJobDictDOS(); + for (Long lg : jobDictDOS) { CourseJobMappingDO courseJobMappingDO = new CourseJobMappingDO(); courseJobMappingDO.setCourseId(updateCoursesDTO.getId()); - courseJobMappingDO.setJobId(jobDictDO.getId()); + courseJobMappingDO.setJobId(lg); courseJobMappingMapper.insert(courseJobMappingDO); } } //职级 - if (updateCoursesDTO.getRankDictDOS().size() > 0) { - courseJobMappingMapper.delete(new QueryWrapper() + if (null != updateCoursesDTO.getRankDictDOS()) { + courseRankMappingMapper.delete(new QueryWrapper() .lambda() - .eq(CourseJobMappingDO::getCourseId, updateCoursesDTO.getId())); + .eq(CourseRankMappingDO::getCourseId, updateCoursesDTO.getId())); - List rankDictDOS = updateCoursesDTO.getRankDictDOS(); - for (RankDictDO rankDictDO : rankDictDOS) { + List rankDictDOS = updateCoursesDTO.getRankDictDOS(); + for (Long lg : rankDictDOS) { CourseRankMappingDO courseRankMappingDO = new CourseRankMappingDO(); courseRankMappingDO.setCourseId(updateCoursesDTO.getId()); - courseRankMappingDO.setRankId(rankDictDO.getId()); + courseRankMappingDO.setRankId(lg); courseRankMappingMapper.insert(courseRankMappingDO); } } @@ -254,7 +308,7 @@ public class CourseDictServiceImpl extends ServiceImpl iPage = this.baseMapper.queryCourses(pager, queryCoursesDTO.getCourseName(), null, queryCoursesDTO.getCategoryId(), queryCoursesDTO.getJobId(), queryCoursesDTO.getRankId(),null, queryCoursesDTO.getCompanyId()); + IPage iPage = this.baseMapper.queryCourses(pager, queryCoursesDTO.getCourseName(), null, queryCoursesDTO.getCategoryId(), queryCoursesDTO.getJobId(), queryCoursesDTO.getRankId(), null, queryCoursesDTO.getCompanyId(), queryCoursesDTO.getOpenStatus()); List queryCoursesVOS = iPage.getRecords(); for (QueryCoursesVO queryCoursesVO : queryCoursesVOS) { @@ -287,10 +341,10 @@ public class CourseDictServiceImpl extends ServiceImpl implements JobDictService { public List queryJobs(JobDictDO jobDictDO) { - return this.baseMapper.selectList(new QueryWrapper() - .lambda() - .eq(JobDictDO::getCompanyId, jobDictDO.getCompanyId()) - .orderByAsc(JobDictDO::getOrderNo)); + return this.baseMapper.queryJobs(jobDictDO.getId()); } public String deleteJob(JobDictDO jobDictDO) { diff --git a/src/main/java/com/subsidy/service/impl/MemberServiceImpl.java b/src/main/java/com/subsidy/service/impl/MemberServiceImpl.java index 3695192..7f54ac2 100644 --- a/src/main/java/com/subsidy/service/impl/MemberServiceImpl.java +++ b/src/main/java/com/subsidy/service/impl/MemberServiceImpl.java @@ -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 imple private RedisUtil redisUtil; @Autowired - private MongoTemplate mongoTemplate; - - @Autowired private CourseFieldMappingMapper courseFieldMappingMapper; @Autowired @@ -122,14 +118,25 @@ public class MemberServiceImpl extends ServiceImpl imple @Autowired private OprMemDictMapper oprMemDictMapper; + @Autowired + private JobDictMapper jobDictMapper; + + @Autowired + private JobMemberMappingMapper jobMemberMappingMapper; + public IPage getAll(GetAllDTO getAllDTO) { Page pager = new Page(getAllDTO.getPageNum(), getAllDTO.getPageSize()); IPage iPage = this.baseMapper.getMembers(pager, getAllDTO.getDepartmentId(), getAllDTO.getUserName(), getAllDTO.getStatus()); List getAllVOS = iPage.getRecords(); for (GetAllVO getAllVO : getAllVOS) { + //获取这个人所在的部门 List departmentDictDOS = this.baseMapper.getDepartments(getAllVO.getId()); getAllVO.setDepartmentDictDOS(departmentDictDOS); + + //获取这个人所在的岗位 + List jobDictDOS = jobDictMapper.queryMemberJobs(getAllVO.getId()); + getAllVO.setJobDictDOS(jobDictDOS); } return iPage; } @@ -175,14 +182,32 @@ public class MemberServiceImpl extends ServiceImpl imple this.baseMapper.insert(memberDO); redisUtil.set(RedisPrefixConstant.SUBSIDY_COMPANY_MEMBER_PREFIX + memberDO.getCompanyId() + ":" + memberDO.getAccountName(), memberDO); - //部门 - List longs = addMemberDTO.getDepartmentIds(); + if (null != addMemberDTO.getDepartmentIds()) { + //部门 + List longs = addMemberDTO.getDepartmentIds(); - for (Long lg : longs) { - MemberDepartmentMappingDO memberDepartmentMappingDO = new MemberDepartmentMappingDO(); - memberDepartmentMappingDO.setMemberId(memberDO.getId()); - memberDepartmentMappingDO.setDepartmentId(lg); - memberDepartmentMappingMapper.insert(memberDepartmentMappingDO); + for (Long lg : longs) { + MemberDepartmentMappingDO memberDepartmentMappingDO = new MemberDepartmentMappingDO(); + memberDepartmentMappingDO.setMemberId(memberDO.getId()); + memberDepartmentMappingDO.setDepartmentId(lg); + memberDepartmentMappingMapper.insert(memberDepartmentMappingDO); + } + } + + + if (null != addMemberDTO.getJobIds()) { + jobMemberMappingMapper.delete(new QueryWrapper() + .lambda() + .eq(JobMemberMappingDO::getMemberId, addMemberDTO.getId())); + + //岗位 + List 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 imple } } + if (null != addMemberDTO.getJobIds()) { + jobMemberMappingMapper.delete(new QueryWrapper() + .lambda() + .eq(JobMemberMappingDO::getMemberId, addMemberDTO.getId())); + + //岗位 + List 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 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 imple } public List myCourses(MyCoursesDTO myCoursesDTO) { - List myCoursesVOS = this.baseMapper.myCourses(myCoursesDTO.getMemberId(),myCoursesDTO.getStatus()); - for (MyCoursesVO myCoursesVO : myCoursesVOS){ + List myCoursesVOS = this.baseMapper.myCourses(myCoursesDTO.getMemberId(), myCoursesDTO.getStatus()); + for (MyCoursesVO myCoursesVO : myCoursesVOS) { List fieldDictDOS = courseFieldMappingMapper.courseFields(myCoursesVO.getCourseId()); myCoursesVO.setFieldDictDOS(fieldDictDOS); } @@ -436,6 +476,13 @@ public class MemberServiceImpl extends ServiceImpl imple ContentVodNewVO contentVodNewVO = new ContentVodNewVO(); + //课程详细信息 + ClassDictDO classDictDO = classDictMapper.selectById(contentVodDTO.getClassId()); + contentVodNewVO.setIsFastPlay(classDictDO.getIsFastPlay()); + contentVodNewVO.setIsOrder(classDictDO.getIsOrder()); + contentVodNewVO.setTestRule(classDictDO.getTestRule()); + + List contentVodVOS = new ArrayList<>(); List courseContentDOS = courseContentMapper.selectList(new QueryWrapper() .lambda() @@ -448,9 +495,20 @@ public class MemberServiceImpl extends ServiceImpl imple List 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 imple //最新的视频记录 List 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 imple //自己成绩 List 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()); diff --git a/src/main/java/com/subsidy/service/impl/OprMemDictServiceImpl.java b/src/main/java/com/subsidy/service/impl/OprMemDictServiceImpl.java index 6984a8d..2e9fd98 100644 --- a/src/main/java/com/subsidy/service/impl/OprMemDictServiceImpl.java +++ b/src/main/java/com/subsidy/service/impl/OprMemDictServiceImpl.java @@ -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 implements OprMemDictService { @Autowired - private MongoTemplate mongoTemplate; - - @Autowired - private MongoUtil mongoUtil; - - @Autowired private MemberMapper memberMapper; @Autowired diff --git a/src/main/java/com/subsidy/service/impl/SignInRecordServiceImpl.java b/src/main/java/com/subsidy/service/impl/SignInRecordServiceImpl.java index 271e7fd..b53d095 100644 --- a/src/main/java/com/subsidy/service/impl/SignInRecordServiceImpl.java +++ b/src/main/java/com/subsidy/service/impl/SignInRecordServiceImpl.java @@ -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; /** *

@@ -60,14 +62,17 @@ public class SignInRecordServiceImpl extends ServiceImpl getMemberSignInfo(GetMemberSignInfoDTO getMemberSignInfoDTO) { Page pager = new Page(getMemberSignInfoDTO.getPageNum(), getMemberSignInfoDTO.getPageSize()); @@ -109,23 +114,77 @@ public class SignInRecordServiceImpl extends ServiceImpl classSignInfo(ClassSignInfoDTO classSignInfoDTO) { + public IPage dataView(DataViewDTO classSignInfoDTO) { Page pager = new Page(classSignInfoDTO.getPageNum(), classSignInfoDTO.getPageSize()); - IPage classSignInfoVOIPage = this.baseMapper.classSignInfo(pager, classSignInfoDTO.getClassName(), classSignInfoDTO.getCourseName(), classSignInfoDTO.getCompanyId()); - List classSignInfoVOS = classSignInfoVOIPage.getRecords(); + IPage classSignInfoVOIPage = this.baseMapper.classSignInfo(pager, classSignInfoDTO.getClassName(), classSignInfoDTO.getCourseName(), classSignInfoDTO.getCompanyId()); + List dataViewVOS = classSignInfoVOIPage.getRecords(); + + for (DataViewVO dataViewVO : dataViewVOS) { - for (ClassSignInfoVO classSignInfoVO : classSignInfoVOS) { - ClassSignInfoVO classSignInfoVO1 = vodPlayHistoryMapper.classStudyHistory(classSignInfoVO.getClassId()); - String[] nullParams = MyBeanUtils.getNullPropertyNames(classSignInfoVO1); - BeanUtils.copyProperties(classSignInfoVO1,classSignInfoVO,nullParams); + //班级人数 + List classMemberMappingDOS = classMemberMappingMapper.selectList(new QueryWrapper() + .lambda() + .eq(ClassMemberMappingDO::getClassId, dataViewVO.getClassId())); + dataViewVO.setMemberCount(classMemberMappingDOS.size()); + + //课程由多少个视频 + List vodDictDOS = classDictMapper.getClassVods(dataViewVO.getClassId()); + + int signCnt = 0; + int testCnt = 0; + int vodCnt = 0; + + for (ClassMemberMappingDO classMemberMappingDO : classMemberMappingDOS) { + + //签到 + Integer signCount = signInRecordMapper.selectCount(new QueryWrapper() + .lambda() + .eq(SignInRecordDO::getMemberId, classMemberMappingDO.getMemberId()) + .eq(SignInRecordDO::getClassId, dataViewVO.getClassId())); + if (signCount > 0) { + signCnt++; + } + + //测试 + int testCount = exerciseDoneResultMapper.selectCount(new QueryWrapper() + .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); - //平均签到数 向下取整 - long signCount = redisUtil.scan(RedisPrefixConstant.SUBSIDY_SIGN_INFO_PREFIX + "*:classId:" + classSignInfoVO.getClassId() + ":*").stream().count(); - classSignInfoVO.setAvgSignCount(MathUtil.intDivCeil(signCount, classSignInfoVO1.getMemberCount())); + //测试通过率 + dataViewVO.setPassCnt(testCnt); + + //视频看完人数 + dataViewVO.setVodCnt(vodCnt); + + //答疑数 + Integer count = answeringQuestionMapper.selectCount(new QueryWrapper() + .lambda() + .eq(AnsweringQuestionDO::getClassId, dataViewVO.getClassId())); + dataViewVO.setAnswerCnt(count); } - classSignInfoVOIPage.setRecords(classSignInfoVOS); + classSignInfoVOIPage.setRecords(dataViewVOS); return classSignInfoVOIPage; } diff --git a/src/main/java/com/subsidy/service/impl/VodDictServiceImpl.java b/src/main/java/com/subsidy/service/impl/VodDictServiceImpl.java index eeb1a3c..80ff850 100644 --- a/src/main/java/com/subsidy/service/impl/VodDictServiceImpl.java +++ b/src/main/java/com/subsidy/service/impl/VodDictServiceImpl.java @@ -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 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 im return signatureVO; } - public IPage getContendVods(GetContendVodsDTO getContendVodsDTO) { - Page pager = new Page(getContendVodsDTO.getPageNum(), getContendVodsDTO.getPageSize()); - return this.baseMapper.getContendVods(pager, getContendVodsDTO.getVodName(), getContendVodsDTO.getContentId()); + public List 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,33 +101,36 @@ public class VodDictServiceImpl extends ServiceImpl im public String addVod(VodDictDO vodDictDO) { this.baseMapper.insert(vodDictDO); - //上传后直接转码 - Credential cred = new Credential(vodConfig.getSecretId(), vodConfig.getSecretKey()); - HttpProfile httpProfile = new HttpProfile(); - httpProfile.setEndpoint("vod.tencentcloudapi.com"); + //测试环境就不转码了 + if (env.equals("prod")){ + //上传后直接转码 + Credential cred = new Credential(vodConfig.getSecretId(), vodConfig.getSecretKey()); - ClientProfile clientProfile = new ClientProfile(); - clientProfile.setHttpProfile(httpProfile); + HttpProfile httpProfile = new HttpProfile(); + httpProfile.setEndpoint("vod.tencentcloudapi.com"); - VodClient client = new VodClient(cred, "", clientProfile); + ClientProfile clientProfile = new ClientProfile(); + clientProfile.setHttpProfile(httpProfile); - ProcessMediaRequest processMediaRequest = new ProcessMediaRequest(); - MediaProcessTaskInput mediaProcessTaskInput1 = new MediaProcessTaskInput(); - TranscodeTaskInput[] transcodeTaskInputs1 = new TranscodeTaskInput[1]; - TranscodeTaskInput transcodeTaskInput1 = new TranscodeTaskInput(); - transcodeTaskInput1.setDefinition(ConstantUtils.TEMPLATE_VOD); - transcodeTaskInputs1[0] = transcodeTaskInput1; - mediaProcessTaskInput1.setTranscodeTaskSet(transcodeTaskInputs1); - processMediaRequest.setMediaProcessTask(mediaProcessTaskInput1); - processMediaRequest.setFileId(vodDictDO.getVodCode()); + VodClient client = new VodClient(cred, "", clientProfile); - try { - client.ProcessMedia(processMediaRequest); - } catch (Exception ex) { - throw new HttpException(50001); + ProcessMediaRequest processMediaRequest = new ProcessMediaRequest(); + MediaProcessTaskInput mediaProcessTaskInput1 = new MediaProcessTaskInput(); + TranscodeTaskInput[] transcodeTaskInputs1 = new TranscodeTaskInput[1]; + TranscodeTaskInput transcodeTaskInput1 = new TranscodeTaskInput(); + transcodeTaskInput1.setDefinition(ConstantUtils.TEMPLATE_VOD); + transcodeTaskInputs1[0] = transcodeTaskInput1; + mediaProcessTaskInput1.setTranscodeTaskSet(transcodeTaskInputs1); + processMediaRequest.setMediaProcessTask(mediaProcessTaskInput1); + processMediaRequest.setFileId(vodDictDO.getVodCode()); + + try { + client.ProcessMedia(processMediaRequest); + } catch (Exception ex) { + throw new HttpException(50001); + } } - return ConstantUtils.ADD_SUCCESS; } @@ -131,5 +139,14 @@ public class VodDictServiceImpl extends ServiceImpl im return ConstantUtils.SET_SUCCESS; } + public String changeOrders(ChangeOrdersDTO changeOrdersDTO){ + + int i = 1 ; + List longs = changeOrdersDTO.getVodIds(); + for (Long lg : longs){ + this.baseMapper.updateVodOrderNo(lg,i++); + } + return ConstantUtils.SET_SUCCESS; + } } diff --git a/src/main/java/com/subsidy/service/impl/VodPlayHistoryServiceImpl.java b/src/main/java/com/subsidy/service/impl/VodPlayHistoryServiceImpl.java index c761eae..5b1de68 100644 --- a/src/main/java/com/subsidy/service/impl/VodPlayHistoryServiceImpl.java +++ b/src/main/java/com/subsidy/service/impl/VodPlayHistoryServiceImpl.java @@ -110,22 +110,22 @@ public class VodPlayHistoryServiceImpl extends ServiceImpl 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 { - public Integer pageSize; - private Integer currentPage; - - - public void start(Integer currentPage, Integer pageSize, Query query) { - pageSize = pageSize == 0 ? 10 : pageSize; - query.limit(pageSize); - query.skip((currentPage - 1) * pageSize); - this.pageSize = pageSize; - this.currentPage = currentPage; - } - - public PageHelper pageHelper(long total, List list) { - return new PageHelper(this.currentPage, total, this.pageSize, list); - } - - public PageHelper pageHelper(List list) { - return new PageHelper(this.currentPage, this.pageSize, list); - } - - public PageHelper pageHelper(long currentPage, long total, long pageSize, List list) { - return new PageHelper(currentPage, total, pageSize, list); - } - - public PageHelper pageHelper(long currentPage, long pageSize, List list) { - return new PageHelper(currentPage, pageSize, list); - } - - - /** - * 用于模糊查询忽略大小写 - * - * @param string - * @return - */ - public Pattern getPattern(String string) { - Pattern pattern = Pattern.compile("^.*" + string + ".*$", Pattern.CASE_INSENSITIVE); - return pattern; - } - -} +//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 { +// public Integer pageSize; +// private Integer currentPage; +// +// +// public void start(Integer currentPage, Integer pageSize, Query query) { +// pageSize = pageSize == 0 ? 10 : pageSize; +// query.limit(pageSize); +// query.skip((currentPage - 1) * pageSize); +// this.pageSize = pageSize; +// this.currentPage = currentPage; +// } +// +// public PageHelper pageHelper(long total, List list) { +// return new PageHelper(this.currentPage, total, this.pageSize, list); +// } +// +// public PageHelper pageHelper(List list) { +// return new PageHelper(this.currentPage, this.pageSize, list); +// } +// +// public PageHelper pageHelper(long currentPage, long total, long pageSize, List list) { +// return new PageHelper(currentPage, total, pageSize, list); +// } +// +// public PageHelper pageHelper(long currentPage, long pageSize, List list) { +// return new PageHelper(currentPage, pageSize, list); +// } +// +// +// /** +// * 用于模糊查询忽略大小写 +// * +// * @param string +// * @return +// */ +// public Pattern getPattern(String string) { +// Pattern pattern = Pattern.compile("^.*" + string + ".*$", Pattern.CASE_INSENSITIVE); +// return pattern; +// } +// +//} diff --git a/src/main/java/com/subsidy/util/excel/ExcelUtil.java b/src/main/java/com/subsidy/util/excel/ExcelUtil.java index 6a529b6..1e7c63d 100644 --- a/src/main/java/com/subsidy/util/excel/ExcelUtil.java +++ b/src/main/java/com/subsidy/util/excel/ExcelUtil.java @@ -190,6 +190,129 @@ public class ExcelUtil { return dataList; } + /** + * 导入excel文件 + * + * @param path + * @param cls + * @param file + * @param + * @return + */ + public static List readExcelWithoutTitle(String path, Class cls, MultipartFile file) { + String fileName = file.getOriginalFilename(); + if (!fileName.matches("^.+\\.(?i)(xls)$") && !fileName.matches("^.+\\.(?i)(xlsx)$")) { + log.info("上传文件格式不正确"); +// throw new HTTPException(10022); + } + + List 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> classMap = new HashMap<>(); + List 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> 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 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 void writeExcel(List memberIds, HashMap> hashMap, List dates) { ServletRequestAttributes servletRequestAttributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes(); HttpServletResponse response = servletRequestAttributes.getResponse(); diff --git a/src/main/java/com/subsidy/vo/administer/ClassSummaryVO.java b/src/main/java/com/subsidy/vo/administer/ClassSummaryVO.java index 104a321..28252ab 100644 --- a/src/main/java/com/subsidy/vo/administer/ClassSummaryVO.java +++ b/src/main/java/com/subsidy/vo/administer/ClassSummaryVO.java @@ -25,11 +25,11 @@ public class ClassSummaryVO { /** * 签到数 */ - private Integer signCount; + private Integer signCnt; /** * 答疑数 */ - private Integer answerCount; + private Integer answerCnt; } diff --git a/src/main/java/com/subsidy/vo/member/ContentVodNewVO.java b/src/main/java/com/subsidy/vo/member/ContentVodNewVO.java index e595f29..b9cb0a0 100644 --- a/src/main/java/com/subsidy/vo/member/ContentVodNewVO.java +++ b/src/main/java/com/subsidy/vo/member/ContentVodNewVO.java @@ -11,6 +11,12 @@ public class ContentVodNewVO { private Integer playRecord; + private Integer isFastPlay; + + private Integer testRule; + + private Integer isOrder; + private List contentVodVOS; } diff --git a/src/main/java/com/subsidy/vo/member/GetAllVO.java b/src/main/java/com/subsidy/vo/member/GetAllVO.java index 457e3c8..9d7eeb9 100644 --- a/src/main/java/com/subsidy/vo/member/GetAllVO.java +++ b/src/main/java/com/subsidy/vo/member/GetAllVO.java @@ -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 departmentDictDOS; + private List jobDictDOS; + } diff --git a/src/main/java/com/subsidy/vo/member/MemberVodVO.java b/src/main/java/com/subsidy/vo/member/MemberVodVO.java index 453b952..fb9b71e 100644 --- a/src/main/java/com/subsidy/vo/member/MemberVodVO.java +++ b/src/main/java/com/subsidy/vo/member/MemberVodVO.java @@ -11,6 +11,9 @@ public class MemberVodVO { private Integer percent; + /** + * 解锁状态 + */ private Boolean status; private String vodUrl; diff --git a/src/main/java/com/subsidy/vo/sign/ClassSignInfoVO.java b/src/main/java/com/subsidy/vo/sign/DataViewVO.java similarity index 70% rename from src/main/java/com/subsidy/vo/sign/ClassSignInfoVO.java rename to src/main/java/com/subsidy/vo/sign/DataViewVO.java index 91a0d04..f226f01 100644 --- a/src/main/java/com/subsidy/vo/sign/ClassSignInfoVO.java +++ b/src/main/java/com/subsidy/vo/sign/DataViewVO.java @@ -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; } diff --git a/src/main/java/com/subsidy/vo/wechat/AccessTokenVO.java b/src/main/java/com/subsidy/vo/wechat/AccessTokenVO.java new file mode 100644 index 0000000..f08fa68 --- /dev/null +++ b/src/main/java/com/subsidy/vo/wechat/AccessTokenVO.java @@ -0,0 +1,12 @@ +package com.subsidy.vo.wechat; + +import lombok.Data; + +@Data +public class AccessTokenVO { + + private String access_token; + + private String expires_in; + +} diff --git a/src/main/java/com/subsidy/vo/wechat/AuthenRequestVO.java b/src/main/java/com/subsidy/vo/wechat/AuthenRequestVO.java new file mode 100644 index 0000000..015cfe7 --- /dev/null +++ b/src/main/java/com/subsidy/vo/wechat/AuthenRequestVO.java @@ -0,0 +1,15 @@ +package com.subsidy.vo.wechat; + + +import lombok.Data; + +@Data +public class AuthenRequestVO { + + private String code; + + private String phone; + + private String openId; + +} diff --git a/src/main/java/com/subsidy/vo/wechat/AuthenTokenVO.java b/src/main/java/com/subsidy/vo/wechat/AuthenTokenVO.java new file mode 100644 index 0000000..978bcf0 --- /dev/null +++ b/src/main/java/com/subsidy/vo/wechat/AuthenTokenVO.java @@ -0,0 +1,30 @@ +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; + + +} diff --git a/src/main/java/com/subsidy/vo/wechat/JsSdkVO.java b/src/main/java/com/subsidy/vo/wechat/JsSdkVO.java new file mode 100644 index 0000000..ab25cf4 --- /dev/null +++ b/src/main/java/com/subsidy/vo/wechat/JsSdkVO.java @@ -0,0 +1,17 @@ +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; + + +} diff --git a/src/main/java/com/subsidy/vo/wechat/SignVO.java b/src/main/java/com/subsidy/vo/wechat/SignVO.java new file mode 100644 index 0000000..9f4e922 --- /dev/null +++ b/src/main/java/com/subsidy/vo/wechat/SignVO.java @@ -0,0 +1,22 @@ +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; +} diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index cf4411d..a62a220 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -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 diff --git a/src/main/resources/mapper/AccessTokenMapper.xml b/src/main/resources/mapper/AccessTokenMapper.xml new file mode 100644 index 0000000..28f635b --- /dev/null +++ b/src/main/resources/mapper/AccessTokenMapper.xml @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + + create_date, + update_date, + id, access_token + + + diff --git a/src/main/resources/mapper/ClassDictMapper.xml b/src/main/resources/mapper/ClassDictMapper.xml index 30c2560..88df559 100644 --- a/src/main/resources/mapper/ClassDictMapper.xml +++ b/src/main/resources/mapper/ClassDictMapper.xml @@ -47,9 +47,9 @@ and t.class_name like concat('%',#{className} ,'%') - + and t.end_date >= DATE_FORMAT( #{startDate}, '%Y-%m-%d' ) - and t.start_date < DATE_FORMAT( #{endDateDate}, '%Y-%m-%d' ) + and t.start_date < DATE_FORMAT( #{endDate}, '%Y-%m-%d' ) and t.open_status = #{openStatus} diff --git a/src/main/resources/mapper/CompanyDictMapper.xml b/src/main/resources/mapper/CompanyDictMapper.xml index 95b7e1f..0983030 100644 --- a/src/main/resources/mapper/CompanyDictMapper.xml +++ b/src/main/resources/mapper/CompanyDictMapper.xml @@ -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} and t2.company_name like concat('%',#{companyName} ,'%') diff --git a/src/main/resources/mapper/CourseDictMapper.xml b/src/main/resources/mapper/CourseDictMapper.xml index e1c2d9d..d3b60b3 100644 --- a/src/main/resources/mapper/CourseDictMapper.xml +++ b/src/main/resources/mapper/CourseDictMapper.xml @@ -9,19 +9,18 @@ - - @@ -107,7 +109,7 @@ + + + + diff --git a/src/main/resources/mapper/MemberMapper.xml b/src/main/resources/mapper/MemberMapper.xml index 754148c..80ddb67 100644 --- a/src/main/resources/mapper/MemberMapper.xml +++ b/src/main/resources/mapper/MemberMapper.xml @@ -202,7 +202,7 @@ AND t.user_name LIKE concat('%',#{userName} ,'%') - and t2.company_id = #{companyId} + and t.company_id = #{companyId} diff --git a/src/main/resources/mapper/SignInRecordMapper.xml b/src/main/resources/mapper/SignInRecordMapper.xml index 17f66be..48c992a 100644 --- a/src/main/resources/mapper/SignInRecordMapper.xml +++ b/src/main/resources/mapper/SignInRecordMapper.xml @@ -21,15 +21,14 @@ id, student_id, class_id, sign_in_date - 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 diff --git a/src/main/resources/mapper/VodDictMapper.xml b/src/main/resources/mapper/VodDictMapper.xml index be2ca52..e8d8503 100644 --- a/src/main/resources/mapper/VodDictMapper.xml +++ b/src/main/resources/mapper/VodDictMapper.xml @@ -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 @@ and vod_name like concat('%',#{vodName} ,'%') + order by t.order_no + + update vod_dict t set t.order_no = #{orderNo} where t.id = #{id} + + diff --git a/src/main/resources/mapper/VodPlayHistoryMapper.xml b/src/main/resources/mapper/VodPlayHistoryMapper.xml index d9b8b72..cc51ac9 100644 --- a/src/main/resources/mapper/VodPlayHistoryMapper.xml +++ b/src/main/resources/mapper/VodPlayHistoryMapper.xml @@ -132,107 +132,107 @@ AND t.vod_id = #{vodId} - +