diff --git a/pom.xml b/pom.xml index ff3381d..6e083c4 100644 --- a/pom.xml +++ b/pom.xml @@ -5,13 +5,13 @@ org.springframework.boot spring-boot-starter-parent - 2.4.5 + 2.1.7.RELEASE - com.meishu - teachaicms + com.subsidy + subsidy 0.0.1 - teachaicms + subsidy Demo project for Spring Boot @@ -186,7 +186,7 @@ - teachcms + subsidy org.springframework.boot diff --git a/src/main/java/com/subsidy/MeishuApplication.java b/src/main/java/com/subsidy/MeishuApplication.java index 768f41b..d863709 100644 --- a/src/main/java/com/subsidy/MeishuApplication.java +++ b/src/main/java/com/subsidy/MeishuApplication.java @@ -12,7 +12,7 @@ import org.springframework.web.bind.annotation.RestController; @RestController @SpringBootApplication -@MapperScan(basePackages = {"com.meishu.mapper"}) +@MapperScan(basePackages = {"com.subsidy.mapper"}) @EnableScheduling @EnableAsync public class MeishuApplication { diff --git a/src/main/java/com/subsidy/common/Code.java b/src/main/java/com/subsidy/common/Code.java deleted file mode 100644 index 91afe9e..0000000 --- a/src/main/java/com/subsidy/common/Code.java +++ /dev/null @@ -1,45 +0,0 @@ -package com.subsidy.common; - -public enum Code { - - USERNAMENOTFOUND(10001, "用户不存在"), - BADCREDENTIALS(10002,"账户或者密码错误"), - ACCOUNTEXPIRED(10003,"账户过期"), - LOCKEDEXCEPTION(10004, "账户已锁定"), - DISABLEDEXCEPTION(10005,"账户已禁用"), - ACCESSDENIED(10006,"无权限访问"), - AUTHENTICATION(10007,"身份验证异常"), - NOHANDLERFOUND(10008,"找不到相应的视图处理器"), - PARAM_INVALID(10009, "参数不合法"), - TOKEN_EXCEPTION(10010, "Token不合法"), - TOKEN_EXPIRED(10011, "Token已过期"), - OSS_ERROR(10012, "OSS文件上传异常"), - Network_ERROR(90000, "网络请求失败"), - SERVER_INTERNAL_ERROR(99999, "服务器内部错误"), - ; - - private Integer code; - - private String message; - - Code(Integer code, String message) { - this.code = code; - this.message = message; - } - - public Integer getCode() { - return code; - } - - public void setCode(Integer code) { - this.code = code; - } - - public String getMessage() { - return message; - } - - public void setMessage(String message) { - this.message = message; - } -} diff --git a/src/main/java/com/subsidy/common/configure/SwaggerConfig.java b/src/main/java/com/subsidy/common/configure/SwaggerConfig.java index 68dc808..01b41bd 100644 --- a/src/main/java/com/subsidy/common/configure/SwaggerConfig.java +++ b/src/main/java/com/subsidy/common/configure/SwaggerConfig.java @@ -17,10 +17,10 @@ public class SwaggerConfig { return new Docket(DocumentationType.SWAGGER_2) .pathMapping("/") .select() - .apis(RequestHandlerSelectors.basePackage("com.meishu")) + .apis(RequestHandlerSelectors.basePackage("com.subsidy")) .paths(PathSelectors.any()) .build().apiInfo(new ApiInfoBuilder() - .title("市西cms") + .title("学习壮业") .description("接口文档规范") .version("1.0") // .contact(new Contact("啊啊啊啊","www.youkehulian.com","tcp@meishu.com")) diff --git a/src/main/java/com/subsidy/common/configure/WebLogAspect.java b/src/main/java/com/subsidy/common/configure/WebLogAspect.java index 1732de8..0f193cd 100644 --- a/src/main/java/com/subsidy/common/configure/WebLogAspect.java +++ b/src/main/java/com/subsidy/common/configure/WebLogAspect.java @@ -4,6 +4,7 @@ import org.aspectj.lang.JoinPoint; import org.aspectj.lang.annotation.*; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import org.springframework.core.annotation.Order; import org.springframework.stereotype.Component; import org.springframework.web.context.request.RequestAttributes; import org.springframework.web.context.request.RequestContextHolder; @@ -14,6 +15,7 @@ import java.util.Arrays; @Aspect @Component +@Order(1) public class WebLogAspect { private final Logger logger = LoggerFactory.getLogger(WebLogAspect.class); diff --git a/src/main/java/com/subsidy/common/interceptor/AuthenticationInterceptor.java b/src/main/java/com/subsidy/common/interceptor/AuthenticationInterceptor.java index a3b12c9..94f2eeb 100644 --- a/src/main/java/com/subsidy/common/interceptor/AuthenticationInterceptor.java +++ b/src/main/java/com/subsidy/common/interceptor/AuthenticationInterceptor.java @@ -3,7 +3,11 @@ package com.subsidy.common.interceptor; import com.auth0.jwt.interfaces.Claim; import com.baomidou.mybatisplus.core.toolkit.StringUtils; import com.subsidy.common.exception.HttpException; +import com.subsidy.mapper.AdministerMapper; +import com.subsidy.model.AdministerDO; import com.subsidy.util.JwtUtil; +import com.subsidy.util.Localstorage; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import org.springframework.web.method.HandlerMethod; import org.springframework.web.servlet.HandlerInterceptor; @@ -24,7 +28,8 @@ import java.util.Map; @Component public class AuthenticationInterceptor implements HandlerInterceptor { - + @Autowired + private AdministerMapper administerMapper; @Override public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) { @@ -54,23 +59,23 @@ public class AuthenticationInterceptor implements HandlerInterceptor { String type = claimMap.get("type").asString(); if (role.length > 0) { if ("administer".equals(type)) { - //AdministerDO administerDO = administerMapper.selectById(claimMap.get("id").asLong()); - //if (administerDO != null) { - // Localstorage.setUser(administerDO); - // return true; - //} + AdministerDO administerDO = administerMapper.selectById(claimMap.get("id").asLong()); + if (administerDO != null) { + Localstorage.setUser(administerDO); + return true; + } } else { throw new HttpException(1010); } } else { - //AdministerDO administerDO = administerMapper.selectById(claimMap.get("id").asLong()); - //if (administerDO != null) { - // Localstorage.setUser(administerDO); - // return true; - //} + AdministerDO administerDO = administerMapper.selectById(claimMap.get("id").asLong()); + if (administerDO != null) { + Localstorage.setUser(administerDO); + return true; + } } } -// return true; + //return true; } throw new HttpException(1010); } diff --git a/src/main/java/com/subsidy/controller/AdministerController.java b/src/main/java/com/subsidy/controller/AdministerController.java index 3ac0588..e25f118 100644 --- a/src/main/java/com/subsidy/controller/AdministerController.java +++ b/src/main/java/com/subsidy/controller/AdministerController.java @@ -4,19 +4,27 @@ package com.subsidy.controller; import com.subsidy.common.ResponseData; import com.subsidy.common.ResponseVO; import com.subsidy.common.interceptor.LoginRequired; +import com.subsidy.dto.administer.ClassDetailDTO; import com.subsidy.dto.administer.OperatorsDTO; import com.subsidy.model.AdministerDO; +import com.subsidy.model.ClassDictDO; import com.subsidy.service.AdministerService; import com.subsidy.util.ConstantUtils; +import com.subsidy.util.excel.ExcelUtil; +import com.subsidy.vo.administer.ExerciseTestVO; +import com.subsidy.vo.classdict.ClassDetailVO; +import com.subsidy.vo.member.ClassSignVO; +import com.subsidy.vo.sign.AnswerRecordVO; +import com.subsidy.vo.sign.ClassSignInfoVO; import io.swagger.annotations.ApiOperation; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.*; -import org.springframework.web.bind.annotation.RestController; import io.swagger.annotations.Api; +import javax.servlet.http.HttpServletResponse; +import java.util.List; + /** *

* 管理平台用户 前端控制器 @@ -34,7 +42,7 @@ public class AdministerController { private AdministerService administerService; @PostMapping("/login") - @ApiOperation("登录接口 telephone password") + @ApiOperation("登录接口 accountName password") public ResponseVO login(@RequestBody AdministerDO administerDO){ return ResponseData.generateCreatedResponse(0,administerService.login(administerDO)); } @@ -47,34 +55,105 @@ public class AdministerController { } @PostMapping("/administers") - @ApiOperation("运营者/企业查询 {pageNum pageSize accountType 0:运营者管理 1:企业管理}") + @ApiOperation("查询所有运营者 { userName pageNum pageSize }") @LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE}) public ResponseVO operators(@RequestBody OperatorsDTO operatorsDTO){ return ResponseData.generateCreatedResponse(0,administerService.operators(operatorsDTO)); } @PostMapping("addAdminister") - @ApiOperation("添加运营者/企业 {telephone:账号 userName:成员名称/企业名称 shortName 简称 banner:标语 field:领域 accountType:账号类型}") - @LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE}) - public ResponseVO addOperator(@RequestBody AdministerDO administerDO){ - return ResponseData.generateCreatedResponse(0,administerService.addOperator(administerDO)); + @ApiOperation("添加运营者 id userName 名称 accountName 账号 ") + public ResponseVO addAdminister(@RequestBody AdministerDO administerDO){ + return ResponseData.generateCreatedResponse(0,administerService.addAdminister(administerDO)); } @PostMapping("deleteAdminister") - @ApiOperation("删除运营者/企业 id") - @LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE}) - public ResponseVO deleteAdminister(AdministerDO administerDO){ + @ApiOperation("添加运营者 id ") + public ResponseVO deleteAdminister(@RequestBody AdministerDO administerDO){ return ResponseData.generateCreatedResponse(0,administerService.deleteAdminister(administerDO)); } @PostMapping("updateAdminister") - @ApiOperation("修改运营者,企业 id userName:成员名称/企业名称 shortName 简称 banner:标语 field:领域") - @LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE}) - public ResponseVO updateAdminister(AdministerDO administerDO){ + @ApiOperation("编辑运营者 id userName 名称 accountName 账号 password") + public ResponseVO updateAdminister(@RequestBody AdministerDO administerDO){ return ResponseData.generateCreatedResponse(0,administerService.updateAdminister(administerDO)); } + @PostMapping("classSummary") + @ApiOperation("课程汇总 id 班级id ") + @LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE}) + public ResponseVO classSummary(@RequestBody ClassDetailDTO classDetailDTO){ + return ResponseData.generateCreatedResponse(0,administerService.classSummary(classDetailDTO)); + } + + @PostMapping("classDetail") + @ApiOperation("班级管理--班级成员 id 班级id userName") + @LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE}) + public ResponseVO classDetail(@RequestBody ClassDetailDTO classDetailDTO){ + return ResponseData.generateCreatedResponse(0,administerService.classDetail(classDetailDTO)); + } + + @PostMapping("exportClassDetail") + @ApiOperation("班级管理--班级成员--导出 id 班级id userName") + @LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE}) + public void exportClassDetail(@RequestBody ClassDetailDTO classDetailDTO){ + List classDetailVOS = administerService.exportClassDetail(classDetailDTO); + ExcelUtil.writeExcel(classDetailVOS,ClassDetailVO.class); + } + + @PostMapping("signDetail") + @ApiOperation("班级管理--注册签到 id 班级id userName") + @LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE}) + public ResponseVO signDetail(@RequestBody ClassDetailDTO classDetailDTO){ + return ResponseData.generateCreatedResponse(0,administerService.signDetail(classDetailDTO)); + } + + @PostMapping("exportSignDetail") + @ApiOperation("班级管理--注册签到 id 班级id userName") + @LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE}) + public void exportSignDetail(@RequestBody ClassDetailDTO classDetailDTO){ + List classSignVOS = administerService.exportSignDetail(classDetailDTO); + ExcelUtil.writeExcel(classSignVOS, ClassSignVO.class); + } + + @PostMapping("exerciseTest") + @ApiOperation("班级管理--测评成绩 id 班级id userName") + @LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE}) + public ResponseVO exerciseTest(@RequestBody ClassDetailDTO classDetailDTO){ + return ResponseData.generateCreatedResponse(0,administerService.exerciseTest(classDetailDTO)); + } + + @PostMapping("exportExerciseTest") + @ApiOperation("班级管理--测评成绩 id 班级id userName") + @LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE}) + public void exportExerciseTest(@RequestBody ClassDetailDTO classDetailDTO){ + List exerciseTestVOS =administerService.exportExerciseTest(classDetailDTO); + ExcelUtil.writeExcel(exerciseTestVOS,ExerciseTestVO.class); + } + + @PostMapping("answerRecord") + @ApiOperation("班级管理--答疑 id 班级id userName") + @LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE}) + public ResponseVO answerRecord(@RequestBody ClassDetailDTO classDetailDTO){ + return ResponseData.generateCreatedResponse(0,administerService.answerRecord(classDetailDTO)); + } + + @PostMapping("exportAnswerRecord") + @ApiOperation("班级管理--答疑 id 班级id userName") + @LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE}) + public void exportAnswerRecord(@RequestBody ClassDetailDTO classDetailDTO){ + List answerRecordVOS = administerService.exportAnswerRecord(classDetailDTO); + ExcelUtil.writeExcel(answerRecordVOS,AnswerRecordVO.class); + } + + @PostMapping("exportZip") + @ApiOperation("下载压缩包 id 班级id") + @CrossOrigin + //@LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE}) + public void exportZip(@RequestBody ClassDetailDTO classDetailDTO)throws Exception{ + administerService.export(classDetailDTO); + } } diff --git a/src/main/java/com/subsidy/controller/AnsweringQuestionController.java b/src/main/java/com/subsidy/controller/AnsweringQuestionController.java new file mode 100644 index 0000000..79f70ef --- /dev/null +++ b/src/main/java/com/subsidy/controller/AnsweringQuestionController.java @@ -0,0 +1,57 @@ +package com.subsidy.controller; + + +import com.subsidy.common.ResponseData; +import com.subsidy.common.ResponseVO; +import com.subsidy.dto.GetCourseQuestionDTO; +import com.subsidy.model.AnsweringQuestionDO; +import com.subsidy.service.AnsweringQuestionService; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import io.swagger.annotations.Api; + +/** + *

+ * 问题答疑表 前端控制器 + *

+ * + * @author DengMin + * @since 2021-10-14 + */ +@RestController +@Api(tags = "问题答疑表") +@RequestMapping("/answeringQuestion") +public class AnsweringQuestionController { + + @Autowired + private AnsweringQuestionService answeringQuestionService; + + @PostMapping("getCourseQuestion") + @ApiOperation("获取某个课程的答疑 {classId pageSize pageNum memberId}") + public ResponseVO getCourseQuestion(@RequestBody GetCourseQuestionDTO getCourseQuestionDTO){ + return ResponseData.generateCreatedResponse(0,answeringQuestionService.getCourseQuestion(getCourseQuestionDTO)); + } + + @PostMapping("addQuestion") + @ApiOperation("新增答疑 {classId askId title}") + public ResponseVO addQuestion(@RequestBody AnsweringQuestionDO answeringQuestionDO){ + return ResponseData.generateCreatedResponse(0,answeringQuestionService.addQuestion(answeringQuestionDO)); + } + + @PostMapping("deleteQuestion") + @ApiOperation("删除答疑 {id}") + public ResponseVO deleteQuestion(@RequestBody AnsweringQuestionDO answeringQuestionDO){ + return ResponseData.generateCreatedResponse(0,answeringQuestionService.deleteQuestion(answeringQuestionDO)); + } + + @PostMapping("updateQuestion") + @ApiOperation("编辑答疑 {id answerId answer}") + public ResponseVO updateQuestion(@RequestBody AnsweringQuestionDO answeringQuestionDO){ + return ResponseData.generateCreatedResponse(0, answeringQuestionService.updateQuestion(answeringQuestionDO)); + } + + + +} diff --git a/src/main/java/com/subsidy/controller/CategoryController.java b/src/main/java/com/subsidy/controller/CategoryController.java index 374dca7..494576a 100644 --- a/src/main/java/com/subsidy/controller/CategoryController.java +++ b/src/main/java/com/subsidy/controller/CategoryController.java @@ -34,20 +34,20 @@ public class CategoryController { private CategoryService categoryService; @PostMapping("getCategories") - @ApiOperation("查询类目 name 类目名称 pageSize pageNum") + @ApiOperation("查询类目 ** name 类目名称 companyId pageSize pageNum") @LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE}) public ResponseVO getCategories(@RequestBody GetCategoriesDTO getCategoriesDTO){ return ResponseData.generateCreatedResponse(0,categoryService.getCategories(getCategoriesDTO)); } @PostMapping("getAll") - @ApiOperation("查询所有类目") - public ResponseVO getAll(){ - return ResponseData.generateCreatedResponse(0,categoryService.getAll()); + @ApiOperation("查询所有类目 **companyId") + public ResponseVO getAll(@RequestBody GetCategoriesDTO getCategoriesDTO){ + return ResponseData.generateCreatedResponse(0,categoryService.getAll(getCategoriesDTO)); } @PostMapping("addCategory") - @ApiOperation("新增类目 name") + @ApiOperation("新增类目 **name companyId") @LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE}) public ResponseVO addCategory(@RequestBody CategoryDO categoryDO){ return ResponseData.generateCreatedResponse(0,categoryService.addCategory(categoryDO)); @@ -61,7 +61,7 @@ public class CategoryController { } @PostMapping("updateCategory") - @ApiOperation("修改类目 id name") + @ApiOperation("修改类目 ** id name companyId") @LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE}) public ResponseVO updateCategory(@RequestBody CategoryDO categoryDO){ return ResponseData.generateCreatedResponse(0,categoryService.updateCategory(categoryDO)); diff --git a/src/main/java/com/subsidy/controller/ClassDictController.java b/src/main/java/com/subsidy/controller/ClassDictController.java index fd0b3ec..48ed80d 100644 --- a/src/main/java/com/subsidy/controller/ClassDictController.java +++ b/src/main/java/com/subsidy/controller/ClassDictController.java @@ -4,7 +4,11 @@ package com.subsidy.controller; import com.subsidy.common.ResponseData; import com.subsidy.common.ResponseVO; import com.subsidy.common.interceptor.LoginRequired; +import com.subsidy.dto.classDict.AddMemberToClassDTO; +import com.subsidy.dto.classDict.GetAllClassesDTO; +import com.subsidy.dto.classDict.GetSpareMembersDTO; import com.subsidy.model.ClassDictDO; +import com.subsidy.model.ClassMemberMappingDO; import com.subsidy.service.ClassDictService; import com.subsidy.util.ConstantUtils; import io.swagger.annotations.ApiOperation; @@ -33,7 +37,7 @@ public class ClassDictController { private ClassDictService classDictService; @PostMapping("getAllClasses") - @ApiOperation("获取某企业下的所有课程 companyId") + @ApiOperation("获取某老师下的所有课程 ** companyId 所选企业id className 班级名称") @LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE}) public ResponseVO getAllClasses(@RequestBody ClassDictDO classDictDO){ return ResponseData.generateCreatedResponse(0,classDictService.getAllClasses(classDictDO)); @@ -47,17 +51,46 @@ public class ClassDictController { } @PostMapping("addClass") - @ApiOperation("添加课程 companyId courseId className startDate endDate") + @ApiOperation("添加课程 ** companyId courseId className startDate endDate") @LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE}) public ResponseVO addClass(@RequestBody ClassDictDO classDictDO){ return ResponseData.generateCreatedResponse(0,classDictService.addClass(classDictDO)); } @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)); } + @PostMapping("classDetail") + @ApiOperation("获取一个班级详情 id") + @LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE}) + public ResponseVO classDetail(@RequestBody ClassDictDO classDictDO){ + return ResponseData.generateCreatedResponse(0,classDictService.classDetail(classDictDO)); + } + + @PostMapping("removeMember") + @ApiOperation("移除班级 classId 班级id memberId人员id") + @LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE}) + public ResponseVO removeMember(@RequestBody ClassMemberMappingDO classMemberMappingDO){ + return ResponseData.generateCreatedResponse(0,classDictService.removeMember(classMemberMappingDO)); + } + + @PostMapping("getSpareMembers") + @ApiOperation("获取不在某班级的某企业里所有成员 ** companyId 企业id classId 班级id") + @LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE}) + public ResponseVO getSpareMembers(@RequestBody GetSpareMembersDTO getSpareMembersDTO){ + return ResponseData.generateCreatedResponse(0,classDictService.getSpareMembers(getSpareMembersDTO)); + } + + @PostMapping("addMemberToClass") + @ApiOperation("将某个成员加入到某个班级里 classId memberIds []") + @LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE}) + public ResponseVO addMemberToClass(@RequestBody AddMemberToClassDTO addMemberToClassDTO){ + return ResponseData.generateCreatedResponse(0,classDictService.addMemberToClass(addMemberToClassDTO)); + } + + } diff --git a/src/main/java/com/subsidy/controller/CompanyDictController.java b/src/main/java/com/subsidy/controller/CompanyDictController.java new file mode 100644 index 0000000..61badba --- /dev/null +++ b/src/main/java/com/subsidy/controller/CompanyDictController.java @@ -0,0 +1,66 @@ +package com.subsidy.controller; + + +import com.subsidy.common.ResponseData; +import com.subsidy.common.ResponseVO; +import com.subsidy.common.interceptor.LoginRequired; +import com.subsidy.dto.administer.OperatorsDTO; +import com.subsidy.dto.company.AddCompanyDTO; +import com.subsidy.model.AdministerDO; +import com.subsidy.model.CompanyDictDO; +import com.subsidy.service.CompanyDictService; +import com.subsidy.util.ConstantUtils; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; + +import org.springframework.web.bind.annotation.RestController; +import io.swagger.annotations.Api; + +/** + *

+ * 企业字典表 前端控制器 + *

+ * + * @author DengMin + * @since 2021-10-25 + */ +@RestController +@Api(tags = "企业字典表") +@RequestMapping("/companyDict") +public class CompanyDictController { + + @Autowired + private CompanyDictService companyDictService; + + @PostMapping("/administers") + @ApiOperation("查询所有企业 { companyName pageNum pageSize }") + @LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE}) + public ResponseVO operators(@RequestBody OperatorsDTO operatorsDTO){ + return ResponseData.generateCreatedResponse(0,companyDictService.operators(operatorsDTO)); + } + + @PostMapping("addCompany") + @ApiOperation("添加企业 {accountName:账号 companyName:企业名称 shortName 简称 banner:标语 field:领域 role 1:超级管理员 2:普通成员}") + @LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE}) + public ResponseVO addOperator(@RequestBody AddCompanyDTO addCompanyDTO){ + return ResponseData.generateCreatedResponse(0,companyDictService.addOperator(addCompanyDTO)); + } + + @PostMapping("deleteCompany") + @ApiOperation("删除企业 id") + @LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE}) + public ResponseVO deleteAdminister(@RequestBody CompanyDictDO companyDictDO){ + return ResponseData.generateCreatedResponse(0,companyDictService.deleteAdminister(companyDictDO)); + } + + @PostMapping("updateCompany") + @ApiOperation("修改企业 id accountName:账号 companyName:企业名称 shortName 简称 banner:标语 field:领域 role 1:超级管理员 2:普通成员") + @LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE}) + public ResponseVO updateAdminister(@RequestBody AddCompanyDTO addCompanyDTO){ + return ResponseData.generateCreatedResponse(0,companyDictService.updateAdminister(addCompanyDTO)); + } + +} diff --git a/src/main/java/com/subsidy/controller/CourseContentController.java b/src/main/java/com/subsidy/controller/CourseContentController.java index 9d75906..6fc1c10 100644 --- a/src/main/java/com/subsidy/controller/CourseContentController.java +++ b/src/main/java/com/subsidy/controller/CourseContentController.java @@ -40,4 +40,26 @@ public class CourseContentController { return ResponseData.generateCreatedResponse(0,courseContentService.getContents(courseContentDO)); } + @PostMapping("deleteContent") + @ApiOperation("删除一个目录 {id} ") + @LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE}) + public ResponseVO deleteContent(@RequestBody CourseContentDO courseContentDO){ + return ResponseData.generateCreatedResponse(0,courseContentService.deleteContent(courseContentDO)); + } + + @PostMapping("addContent") + @ApiOperation("添加一个目录 {courseId content}") + @LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE}) + public ResponseVO addContent(@RequestBody CourseContentDO courseContentDO){ + return ResponseData.generateCreatedResponse(0,courseContentService.addContent(courseContentDO)); + } + + @PostMapping("updateContent") + @ApiOperation("更新一个目录 {id courseId content}") + @LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE}) + public ResponseVO updateContent(@RequestBody CourseContentDO courseContentDO){ + return ResponseData.generateCreatedResponse(0,courseContentService.updateContent(courseContentDO)); + } + + } diff --git a/src/main/java/com/subsidy/controller/CourseDictController.java b/src/main/java/com/subsidy/controller/CourseDictController.java index cbd229a..93b2728 100644 --- a/src/main/java/com/subsidy/controller/CourseDictController.java +++ b/src/main/java/com/subsidy/controller/CourseDictController.java @@ -10,11 +10,8 @@ import com.subsidy.service.CourseDictService; import com.subsidy.util.ConstantUtils; import io.swagger.annotations.ApiOperation; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.*; -import org.springframework.web.bind.annotation.RestController; import io.swagger.annotations.Api; /** @@ -34,7 +31,7 @@ public class CourseDictController { private CourseDictService courseDictService; @PostMapping("addCourse") - @ApiOperation("添加课程 courseName categoryId courseType courseSource") + @ApiOperation("添加课程 **companyId courseName categoryId courseType courseSource") @LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE}) public ResponseVO addCourse(@RequestBody CourseDictDO courseDictDO){ return ResponseData.generateCreatedResponse(0,courseDictService.addCourse(courseDictDO)); @@ -48,21 +45,24 @@ public class CourseDictController { } @PostMapping("queryCourses") - @ApiOperation("查询课程 courseName categoryId courseType courseSource") + @ApiOperation("平台运营者--查询课程 pageSize pageNum companyId courseName categoryId courseType courseSource") @LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE}) public ResponseVO queryCourses(@RequestBody QueryCoursesDTO queryCoursesDTO){ return ResponseData.generateCreatedResponse(0,courseDictService.queryCourses(queryCoursesDTO)); } - @PostMapping("updateCourses") - @ApiOperation("编辑课程 id courseName categoryId courseType courseSource") + @ApiOperation("编辑课程 id ** companyId courseName categoryId courseType courseSource") @LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE}) public ResponseVO updateCourses(@RequestBody CourseDictDO courseDictDO){ return ResponseData.generateCreatedResponse(0,courseDictService.updateCourses(courseDictDO)); } - + @PostMapping("queryCompanyCourse") + @ApiOperation("企业内容管理-- { ** companyId 所选企业id}") + 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 bbd4199..2d4ade9 100644 --- a/src/main/java/com/subsidy/controller/DepartmentDictController.java +++ b/src/main/java/com/subsidy/controller/DepartmentDictController.java @@ -33,14 +33,14 @@ public class DepartmentDictController { private DepartmentDictService departmentDictService; @PostMapping("getDepartments") - @ApiOperation("获取所有部门 companyId 企业id") + @ApiOperation("获取所有部门 ** companyId 企业id") @LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE}) public ResponseVO getDepartments(@RequestBody DepartmentDictDO departmentDictDO){ return ResponseData.generateCreatedResponse(0,departmentDictService.getDepartments(departmentDictDO)); } @PostMapping("addDepartment") - @ApiOperation("添加部门 companyId departmentName leaderName") + @ApiOperation("添加部门 ** companyId departmentName leaderName") @LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE}) public ResponseVO addDepartment(@RequestBody DepartmentDictDO departmentDictDO){ return ResponseData.generateCreatedResponse(0,departmentDictService.addDepartment(departmentDictDO)); @@ -54,7 +54,7 @@ public class DepartmentDictController { } @PostMapping("updateDepartment") - @ApiOperation("编辑部门 id companyId departmentName leaderName") + @ApiOperation("编辑部门 id ** companyId departmentName leaderName") @LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE}) public ResponseVO updateDepartment(@RequestBody DepartmentDictDO departmentDictDO){ return ResponseData.generateCreatedResponse(0,departmentDictService.updateDepartment(departmentDictDO)); diff --git a/src/main/java/com/subsidy/controller/ExerciseDictController.java b/src/main/java/com/subsidy/controller/ExerciseDictController.java index 91341e7..192755e 100644 --- a/src/main/java/com/subsidy/controller/ExerciseDictController.java +++ b/src/main/java/com/subsidy/controller/ExerciseDictController.java @@ -5,16 +5,15 @@ import com.subsidy.common.ResponseData; import com.subsidy.common.ResponseVO; import com.subsidy.common.interceptor.LoginRequired; import com.subsidy.dto.exercise.GetAllExercisesDTO; +import com.subsidy.dto.exercise.SubmitDTO; +import com.subsidy.model.CourseDictDO; import com.subsidy.model.ExerciseDictDO; import com.subsidy.service.ExerciseDictService; import com.subsidy.util.ConstantUtils; import io.swagger.annotations.ApiOperation; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.*; -import org.springframework.web.bind.annotation.RestController; import io.swagger.annotations.Api; /** @@ -34,7 +33,7 @@ public class ExerciseDictController { private ExerciseDictService exerciseDictService; @PostMapping("getAllExercises") - @ApiOperation("查询所有题目 {courseId 课程id exerciseType 题目类型 difficulty 难度 title题目 pageSize pageNum}") + @ApiOperation("查询所有题目 {courseId 课程id exerciseType 题目类型 difficulty 难度 title 题目 pageSize pageNum}") @LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE}) public ResponseVO getAllExercises(@RequestBody GetAllExercisesDTO getAllExercisesDTO){ return ResponseData.generateCreatedResponse(0,exerciseDictService.getAllExercises(getAllExercisesDTO)); @@ -60,4 +59,18 @@ public class ExerciseDictController { public ResponseVO updateExercise(@RequestBody ExerciseDictDO exerciseDictDO){ return ResponseData.generateCreatedResponse(0,exerciseDictService.updateExercise(exerciseDictDO)); } + + @PostMapping("getCourseExercises") + @ApiOperation("获取课程的习题 id 课程id") + public ResponseVO getCourseExercises(@RequestBody CourseDictDO courseDictDO){ + return ResponseData.generateCreatedResponse(0,exerciseDictService.getCourseExercises(courseDictDO)); + } + + @PostMapping("submit") + @ApiOperation("提交答案 {memberId 成员id classId课程 courseId 课程id memberExerciseVOS [ id selectAnswer ]} ") + public ResponseVO submit(@RequestBody SubmitDTO submitDTO){ + return ResponseData.generateCreatedResponse(0,exerciseDictService.submit(submitDTO)); + } + + } diff --git a/src/main/java/com/subsidy/controller/ExerciseDoneResultController.java b/src/main/java/com/subsidy/controller/ExerciseDoneResultController.java new file mode 100644 index 0000000..8c7191f --- /dev/null +++ b/src/main/java/com/subsidy/controller/ExerciseDoneResultController.java @@ -0,0 +1,22 @@ +package com.subsidy.controller; + + +import org.springframework.web.bind.annotation.RequestMapping; + +import org.springframework.web.bind.annotation.RestController; +import io.swagger.annotations.Api; + +/** + *

+ * 学生课程习题完成情况 前端控制器 + *

+ * + * @author DengMin + * @since 2021-10-15 + */ +@RestController +@Api(tags = "学生课程习题完成情况") +@RequestMapping("/exerciseDoneResult") +public class ExerciseDoneResultController { + +} diff --git a/src/main/java/com/subsidy/controller/FileDictController.java b/src/main/java/com/subsidy/controller/FileDictController.java index aafca9f..61f84ba 100644 --- a/src/main/java/com/subsidy/controller/FileDictController.java +++ b/src/main/java/com/subsidy/controller/FileDictController.java @@ -34,7 +34,7 @@ public class FileDictController { private FileDictService fileDictService; @PostMapping("getContendFiles") - @ApiOperation("获取目录下的视频 {contentId vodName}") + @ApiOperation("获取目录下的视频 {contentId fileName}") @LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE}) public ResponseVO getContendFiles(@RequestBody FileDictDO fileDictDO){ return ResponseData.generateCreatedResponse(0,fileDictService.getContendFiles(fileDictDO)); @@ -48,14 +48,14 @@ public class FileDictController { } @PostMapping("addFile") - @ApiOperation("新增视频 contentId vodName vodLength vodType vodSize vodUrl vodCode") + @ApiOperation("新增视频 contentId fileName fileSize fileType fileUrl") @LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE}) public ResponseVO addFile(@RequestBody FileDictDO fileDictDO){ return ResponseData.generateCreatedResponse(0,fileDictService.addFile(fileDictDO)); } @PostMapping("updateFile") - @ApiOperation("新增视频 id contentId vodName vodLength vodType vodSize vodUrl vodCode") + @ApiOperation("新增视频 id contentId fileName fileSize fileType fileUrl") @LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE}) public ResponseVO updateFile(@RequestBody FileDictDO fileDictDO){ return ResponseData.generateCreatedResponse(0,fileDictService.updateFile(fileDictDO)); diff --git a/src/main/java/com/subsidy/controller/MemberController.java b/src/main/java/com/subsidy/controller/MemberController.java index 8d47d47..71f8e93 100644 --- a/src/main/java/com/subsidy/controller/MemberController.java +++ b/src/main/java/com/subsidy/controller/MemberController.java @@ -4,10 +4,14 @@ package com.subsidy.controller; import com.subsidy.common.ResponseData; import com.subsidy.common.ResponseVO; import com.subsidy.common.interceptor.LoginRequired; +import com.subsidy.dto.administer.VerifyCodeDTO; +import com.subsidy.dto.member.ContentMemberDTO; import com.subsidy.dto.member.GetAllDTO; +import com.subsidy.dto.member.StudyHistoryDTO; import com.subsidy.model.MemberDO; import com.subsidy.service.MemberService; import com.subsidy.util.ConstantUtils; +import com.subsidy.vo.member.ContentVodVO; import io.swagger.annotations.ApiOperation; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.PostMapping; @@ -34,7 +38,7 @@ public class MemberController { private MemberService memberService; @PostMapping("getAll") - @ApiOperation("查询某部门成员 pageNum pageSize userName status") + @ApiOperation("查询某部门成员 pageNum pageSize departmentId userName status") @LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE}) public ResponseVO getAll(@RequestBody GetAllDTO getAllDTO){ return ResponseData.generateCreatedResponse(0,memberService.getAll(getAllDTO)); @@ -55,11 +59,65 @@ public class MemberController { } @PostMapping("updateMember") - @ApiOperation("编辑成员 {id departmentId userName accountName telephone gender image idCard}") + @ApiOperation("编辑成员 {id departmentId userName accountName telephone gender image idCard status}") @LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE}) public ResponseVO updateMember(@RequestBody MemberDO memberDO){ return ResponseData.generateCreatedResponse(0,memberService.updateMember(memberDO)); } + @PostMapping(value = "/login") + @ApiOperation("手机端:登录:telephone/手机号, verifyCode/验证码") + public ResponseVO login(@RequestBody VerifyCodeDTO verifyCodeDTO) { + return ResponseData.generateCreatedResponse(0, memberService.login(verifyCodeDTO)); + } + + @PostMapping("passwordLogin") + @ApiOperation("手机端:密码登录 {accountName password}") + public ResponseVO passwordLogin(@RequestBody MemberDO memberDO){ + return ResponseData.generateCreatedResponse(0,memberService.passwordLogin(memberDO)); + } + + @PostMapping("updatePassword") + @ApiOperation("修改密码 {id password}") + public ResponseVO updatePassword(@RequestBody MemberDO memberDO){ + return ResponseData.generateCreatedResponse(0,memberService.updatePassword(memberDO)); + } + + @PostMapping("studyPage") + @ApiOperation("手机端:学习主页 id 学员id") + public ResponseVO studyPage(@RequestBody MemberDO memberDO){ + return ResponseData.generateCreatedResponse(0,memberService.studyPage(memberDO)); + } + + @PostMapping("contentVod") + @ApiOperation("手机端:目录+视频 courseId 课程 memberId 学员id") + public ResponseVO contentVod(@RequestBody ContentMemberDTO contentVodDTO){ + return ResponseData.generateCreatedResponse(0,memberService.contentVod(contentVodDTO)); + } + + @PostMapping("contentFiles") + @ApiOperation("手机端:目录+课件 courseId 课程 memberId 学员id") + public ResponseVO contentFiles(@RequestBody ContentMemberDTO contentMemberDTO){ + return ResponseData.generateCreatedResponse(0,memberService.contentFiles(contentMemberDTO)); + } + + @PostMapping("studyHistory") + @ApiOperation("学习记录 id 成员id pageSize pageNum") + public ResponseVO studyHistory(@RequestBody StudyHistoryDTO studyHistoryDTO){ + return ResponseData.generateCreatedResponse(0,memberService.studyHistory(studyHistoryDTO)); + } + + @PostMapping("getCourseTest") + @ApiOperation("获取课程下的测试情况 {memberId courseId}") + public ResponseVO getCourseTest(@RequestBody ContentMemberDTO contentMemberDTO){ + return ResponseData.generateCreatedResponse(0,memberService.getCourseTest(contentMemberDTO)); + } + + @PostMapping("getStudyInfo") + @ApiOperation("获取学生完成课程情况 id 学员id") + public ResponseVO getStudyInfo(@RequestBody MemberDO memberDO){ + return ResponseData.generateCreatedResponse(0,memberService.getStudyInfo(memberDO)); + } + } diff --git a/src/main/java/com/subsidy/controller/SignInRecordController.java b/src/main/java/com/subsidy/controller/SignInRecordController.java new file mode 100644 index 0000000..e9bdad9 --- /dev/null +++ b/src/main/java/com/subsidy/controller/SignInRecordController.java @@ -0,0 +1,59 @@ +package com.subsidy.controller; + + +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.SignInDTO; +import com.subsidy.model.MemberDO; +import com.subsidy.model.SignInRecordDO; +import com.subsidy.service.SignInRecordService; +import com.subsidy.util.ConstantUtils; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; + +import org.springframework.web.bind.annotation.RestController; +import io.swagger.annotations.Api; + +/** + *

+ * 学生签到表 前端控制器 + *

+ * + * @author DengMin + * @since 2021-10-18 + */ +@RestController +@Api(tags = "学生签到表") +@RequestMapping("/signIn") +public class SignInRecordController { + + @Autowired + private SignInRecordService signInRecordService; + + @PostMapping("getMemberSignInfo") + @ApiOperation("获取某个成员的签到记录 id 成员id pageSize pageNum") + public ResponseVO getMemberSignInfo(@RequestBody GetMemberSignInfoDTO getMemberSignInfoDTO){ + return ResponseData.generateCreatedResponse(0,signInRecordService.getMemberSignInfo(getMemberSignInfoDTO)); + } + + @PostMapping("signIn") + @ApiOperation("签到 classId :班级id memberId") + public ResponseVO signIn(@RequestBody SignInRecordDO signInRecordDO){ + 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)); + } + + +} diff --git a/src/main/java/com/subsidy/controller/SmsVerifyCodeController.java b/src/main/java/com/subsidy/controller/SmsVerifyCodeController.java new file mode 100644 index 0000000..e8f1d91 --- /dev/null +++ b/src/main/java/com/subsidy/controller/SmsVerifyCodeController.java @@ -0,0 +1,41 @@ +package com.subsidy.controller; + + +import com.subsidy.common.ResponseData; +import com.subsidy.common.ResponseVO; +import com.subsidy.dto.sms.SendVerifyCodeDTO; +import com.subsidy.service.SmsVerifyCodeService; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; + +import org.springframework.web.bind.annotation.RestController; +import io.swagger.annotations.Api; + +/** + *

+ * 短信验证码记录表 前端控制器 + *

+ * + * @author DengMin + * @since 2021-10-14 + */ +@RestController +@Api(tags = "短信验证码记录表") +@RequestMapping("/smsVerify") +public class SmsVerifyCodeController { + + @Autowired + private SmsVerifyCodeService smsVerifyCodeService; + + @PostMapping(value = "/send") + @ApiOperation("发送短信验证码 {telephone} ") + public ResponseVO sendVerifyCode(@RequestBody SendVerifyCodeDTO sendVerifyCodeDTO ) { + smsVerifyCodeService.sendVerifyCode(sendVerifyCodeDTO); + return ResponseData.generateCreatedResponse(0); + } + +} + diff --git a/src/main/java/com/subsidy/controller/VodDictController.java b/src/main/java/com/subsidy/controller/VodDictController.java index 7041430..f797c41 100644 --- a/src/main/java/com/subsidy/controller/VodDictController.java +++ b/src/main/java/com/subsidy/controller/VodDictController.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.content.GetContendVodsDTO; import com.subsidy.model.VodDictDO; import com.subsidy.service.VodDictService; import com.subsidy.util.ConstantUtils; @@ -41,8 +42,8 @@ public class VodDictController { @PostMapping("getContendVods") @ApiOperation("获取目录下的视频 {contentId vodName}") @LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE}) - public ResponseVO getContendVods(@RequestBody VodDictDO vodDictDO){ - return ResponseData.generateCreatedResponse(0,vodDictService.getContendVods(vodDictDO)); + public ResponseVO getContendVods(@RequestBody GetContendVodsDTO getContendVodsDTO){ + return ResponseData.generateCreatedResponse(0,vodDictService.getContendVods(getContendVodsDTO)); } @PostMapping("deleteVod") diff --git a/src/main/java/com/subsidy/controller/VodPlayHistoryController.java b/src/main/java/com/subsidy/controller/VodPlayHistoryController.java new file mode 100644 index 0000000..9d9b44d --- /dev/null +++ b/src/main/java/com/subsidy/controller/VodPlayHistoryController.java @@ -0,0 +1,40 @@ +package com.subsidy.controller; + + +import com.subsidy.common.ResponseData; +import com.subsidy.common.ResponseVO; +import com.subsidy.model.VodPlayHistoryDO; +import com.subsidy.service.VodPlayHistoryService; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; + +import org.springframework.web.bind.annotation.RestController; +import io.swagger.annotations.Api; + +/** + *

+ * 视频播放历史记录表 前端控制器 + *

+ * + * @author DengMin + * @since 2021-10-14 + */ +@RestController +@Api(tags = "视频播放历史记录表") +@RequestMapping("/vodPlayHistory") +public class VodPlayHistoryController { + + @Autowired + private VodPlayHistoryService vodPlayHistoryService; + + @PostMapping("insertHistory") + @ApiOperation("记录学生看视频位置 classId班级id vodId 视频id memberId 成员id playLength 播放时长 playRecord 位点") + public ResponseVO insertHistory(@RequestBody VodPlayHistoryDO vodPlayHistoryDO){ + return ResponseData.generateCreatedResponse(0,vodPlayHistoryService.insertHistory(vodPlayHistoryDO)); + } + + +} diff --git a/src/main/java/com/subsidy/dto/GetCourseQuestionDTO.java b/src/main/java/com/subsidy/dto/GetCourseQuestionDTO.java new file mode 100644 index 0000000..e544f88 --- /dev/null +++ b/src/main/java/com/subsidy/dto/GetCourseQuestionDTO.java @@ -0,0 +1,16 @@ +package com.subsidy.dto; + +import lombok.Data; + +@Data +public class GetCourseQuestionDTO { + + private Integer pageSize; + + private Integer pageNum; + + private Long classId; + + private Long memberId; + +} diff --git a/src/main/java/com/subsidy/dto/administer/ClassDetailDTO.java b/src/main/java/com/subsidy/dto/administer/ClassDetailDTO.java new file mode 100644 index 0000000..79c89db --- /dev/null +++ b/src/main/java/com/subsidy/dto/administer/ClassDetailDTO.java @@ -0,0 +1,16 @@ +package com.subsidy.dto.administer; + +import lombok.Data; + +@Data +public class ClassDetailDTO { + + private Long id; + + private Integer pageSize; + + private Integer pageNum; + + private String userName; + +} diff --git a/src/main/java/com/subsidy/dto/administer/OperatorsDTO.java b/src/main/java/com/subsidy/dto/administer/OperatorsDTO.java index 89f3b0d..597bc22 100644 --- a/src/main/java/com/subsidy/dto/administer/OperatorsDTO.java +++ b/src/main/java/com/subsidy/dto/administer/OperatorsDTO.java @@ -9,6 +9,10 @@ public class OperatorsDTO { private Integer pageNum; - private String accountType; + private Integer role; + + private String companyName; + + private String userName; } diff --git a/src/main/java/com/subsidy/dto/administer/VerifyCodeDTO.java b/src/main/java/com/subsidy/dto/administer/VerifyCodeDTO.java new file mode 100644 index 0000000..2d3dd68 --- /dev/null +++ b/src/main/java/com/subsidy/dto/administer/VerifyCodeDTO.java @@ -0,0 +1,11 @@ +package com.subsidy.dto.administer; + +import lombok.Data; + +@Data +public class VerifyCodeDTO { + + private String telephone; + + private String verifyCode; +} diff --git a/src/main/java/com/subsidy/dto/category/GetCategoriesDTO.java b/src/main/java/com/subsidy/dto/category/GetCategoriesDTO.java index 91640ab..f7fee2e 100644 --- a/src/main/java/com/subsidy/dto/category/GetCategoriesDTO.java +++ b/src/main/java/com/subsidy/dto/category/GetCategoriesDTO.java @@ -11,4 +11,6 @@ public class GetCategoriesDTO { private String name; + private Long companyId; + } diff --git a/src/main/java/com/subsidy/dto/classDict/AddMemberToClassDTO.java b/src/main/java/com/subsidy/dto/classDict/AddMemberToClassDTO.java new file mode 100644 index 0000000..6794de0 --- /dev/null +++ b/src/main/java/com/subsidy/dto/classDict/AddMemberToClassDTO.java @@ -0,0 +1,14 @@ +package com.subsidy.dto.classDict; + +import lombok.Data; + +import java.util.List; + +@Data +public class AddMemberToClassDTO { + + private List memberIds; + + private Long classId; + +} diff --git a/src/main/java/com/subsidy/dto/classDict/GetAllClassesDTO.java b/src/main/java/com/subsidy/dto/classDict/GetAllClassesDTO.java new file mode 100644 index 0000000..a060723 --- /dev/null +++ b/src/main/java/com/subsidy/dto/classDict/GetAllClassesDTO.java @@ -0,0 +1,18 @@ +package com.subsidy.dto.classDict; + +import lombok.Data; + +import java.util.List; + +@Data +public class GetAllClassesDTO { + + private Long administerId; + + private String className; + + private Long companyId; + + private List teacherIds; + +} diff --git a/src/main/java/com/subsidy/dto/classDict/GetSpareMembersDTO.java b/src/main/java/com/subsidy/dto/classDict/GetSpareMembersDTO.java new file mode 100644 index 0000000..2e81412 --- /dev/null +++ b/src/main/java/com/subsidy/dto/classDict/GetSpareMembersDTO.java @@ -0,0 +1,13 @@ +package com.subsidy.dto.classDict; + + +import lombok.Data; + +@Data +public class GetSpareMembersDTO { + + private Long companyId; + + private Long classId; + +} diff --git a/src/main/java/com/subsidy/dto/company/AddCompanyDTO.java b/src/main/java/com/subsidy/dto/company/AddCompanyDTO.java new file mode 100644 index 0000000..ef03529 --- /dev/null +++ b/src/main/java/com/subsidy/dto/company/AddCompanyDTO.java @@ -0,0 +1,17 @@ +package com.subsidy.dto.company; + +import com.subsidy.model.CompanyDictDO; +import lombok.Data; + +@Data +public class AddCompanyDTO extends CompanyDictDO { + + private String accountName; + + //private String accountType; + + private String password; + + private Integer role; + +} diff --git a/src/main/java/com/subsidy/dto/content/GetContendVodsDTO.java b/src/main/java/com/subsidy/dto/content/GetContendVodsDTO.java new file mode 100644 index 0000000..b9ca9a9 --- /dev/null +++ b/src/main/java/com/subsidy/dto/content/GetContendVodsDTO.java @@ -0,0 +1,16 @@ +package com.subsidy.dto.content; + +import lombok.Data; + +@Data +public class GetContendVodsDTO { + + private Integer pageSize; + + private Integer pageNum; + + private Long contentId; + + private String vodName; + +} diff --git a/src/main/java/com/subsidy/dto/course/QueryCoursesDTO.java b/src/main/java/com/subsidy/dto/course/QueryCoursesDTO.java index 80e315d..74a7907 100644 --- a/src/main/java/com/subsidy/dto/course/QueryCoursesDTO.java +++ b/src/main/java/com/subsidy/dto/course/QueryCoursesDTO.java @@ -2,6 +2,8 @@ package com.subsidy.dto.course; import lombok.Data; +import java.util.List; + @Data public class QueryCoursesDTO { @@ -17,4 +19,10 @@ public class QueryCoursesDTO { private String courseSource; + //private Long administerId; + + private Long companyId; + + private List teacherIds; + } diff --git a/src/main/java/com/subsidy/dto/exercise/GetAllExercisesDTO.java b/src/main/java/com/subsidy/dto/exercise/GetAllExercisesDTO.java index cd38971..7ad85bb 100644 --- a/src/main/java/com/subsidy/dto/exercise/GetAllExercisesDTO.java +++ b/src/main/java/com/subsidy/dto/exercise/GetAllExercisesDTO.java @@ -10,4 +10,6 @@ public class GetAllExercisesDTO extends ExerciseDictDO { private Integer pageNum; + + } diff --git a/src/main/java/com/subsidy/dto/exercise/SubmitDTO.java b/src/main/java/com/subsidy/dto/exercise/SubmitDTO.java new file mode 100644 index 0000000..2550af2 --- /dev/null +++ b/src/main/java/com/subsidy/dto/exercise/SubmitDTO.java @@ -0,0 +1,18 @@ +package com.subsidy.dto.exercise; + +import com.subsidy.vo.exercise.MemberExerciseVO; +import lombok.Data; + +import java.util.List; + +@Data +public class SubmitDTO { + + private List memberExerciseVOS; + + private Long memberId; + + private Long courseId; + + private Long classId; +} diff --git a/src/main/java/com/subsidy/dto/member/ContentMemberDTO.java b/src/main/java/com/subsidy/dto/member/ContentMemberDTO.java new file mode 100644 index 0000000..f616e51 --- /dev/null +++ b/src/main/java/com/subsidy/dto/member/ContentMemberDTO.java @@ -0,0 +1,12 @@ +package com.subsidy.dto.member; + +import lombok.Data; + +@Data +public class ContentMemberDTO { + + private Integer memberId; + + private Integer courseId; + +} diff --git a/src/main/java/com/subsidy/dto/member/GetMemberSignInfoDTO.java b/src/main/java/com/subsidy/dto/member/GetMemberSignInfoDTO.java new file mode 100644 index 0000000..571466a --- /dev/null +++ b/src/main/java/com/subsidy/dto/member/GetMemberSignInfoDTO.java @@ -0,0 +1,14 @@ +package com.subsidy.dto.member; + +import lombok.Data; + +@Data +public class GetMemberSignInfoDTO { + + private Integer pageSize; + + private Integer pageNum; + + private Long id; + +} diff --git a/src/main/java/com/subsidy/dto/member/StudyHistoryDTO.java b/src/main/java/com/subsidy/dto/member/StudyHistoryDTO.java new file mode 100644 index 0000000..09053b8 --- /dev/null +++ b/src/main/java/com/subsidy/dto/member/StudyHistoryDTO.java @@ -0,0 +1,14 @@ +package com.subsidy.dto.member; + +import lombok.Data; + +@Data +public class StudyHistoryDTO { + + private Integer pageSize; + + private Integer pageNum; + + private Long memberId; + +} diff --git a/src/main/java/com/subsidy/dto/sign/ClassSignInfoDTO.java b/src/main/java/com/subsidy/dto/sign/ClassSignInfoDTO.java new file mode 100644 index 0000000..bced7dc --- /dev/null +++ b/src/main/java/com/subsidy/dto/sign/ClassSignInfoDTO.java @@ -0,0 +1,19 @@ +package com.subsidy.dto.sign; + +import lombok.Data; + +@Data +public class ClassSignInfoDTO { + + + private String className; + + private String courseName; + + private Integer pageSize; + + private Integer pageNum; + + private Integer id; + +} diff --git a/src/main/java/com/subsidy/dto/sign/SignInDTO.java b/src/main/java/com/subsidy/dto/sign/SignInDTO.java new file mode 100644 index 0000000..6691299 --- /dev/null +++ b/src/main/java/com/subsidy/dto/sign/SignInDTO.java @@ -0,0 +1,12 @@ +package com.subsidy.dto.sign; + +import lombok.Data; + +@Data +public class SignInDTO { + + private Long memberId; + + private Long courseId; + +} diff --git a/src/main/java/com/subsidy/dto/sms/SendVerifyCodeDTO.java b/src/main/java/com/subsidy/dto/sms/SendVerifyCodeDTO.java new file mode 100644 index 0000000..6eaf8dd --- /dev/null +++ b/src/main/java/com/subsidy/dto/sms/SendVerifyCodeDTO.java @@ -0,0 +1,9 @@ +package com.subsidy.dto.sms; + +import lombok.Data; + +@Data +public class SendVerifyCodeDTO { + + private String telephone; +} diff --git a/src/main/java/com/subsidy/mapper/AdministerMapper.java b/src/main/java/com/subsidy/mapper/AdministerMapper.java index 97c91cb..313c9c5 100644 --- a/src/main/java/com/subsidy/mapper/AdministerMapper.java +++ b/src/main/java/com/subsidy/mapper/AdministerMapper.java @@ -4,8 +4,12 @@ import com.baomidou.mybatisplus.core.metadata.IPage; import com.subsidy.dto.administer.OperatorsDTO; import com.subsidy.model.AdministerDO; import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.subsidy.vo.administer.ExerciseTestVO; import com.subsidy.vo.administer.OperatorsVO; import com.subsidy.vo.administer.PermissionsVO; +import com.subsidy.vo.classdict.ClassDetailVO; +import com.subsidy.vo.member.ClassSignVO; +import com.subsidy.vo.sign.AnswerRecordVO; import org.springframework.stereotype.Repository; import java.util.List; @@ -23,6 +27,25 @@ public interface AdministerMapper extends BaseMapper { List getPermissions(Long id); - IPage operators(IPage page,String accountType); + /** + * 获取班级成员详情---班级成员 + */ + IPage classMembers(IPage iPage,Long classId,String userName); + + /** + * 获取班级成员---注册签到 + */ + IPage classSign(IPage iPage,Long classId,String userName); + + /** + * 获取班级成员---测试成绩 + */ + IPage exerciseTest(IPage iPage, Long classId, String userName); + + /** + * 获取班级成员---答疑记录 + */ + IPage answerRecord(IPage iPage, Long classId, String userName); + } diff --git a/src/main/java/com/subsidy/mapper/AnsweringQuestionMapper.java b/src/main/java/com/subsidy/mapper/AnsweringQuestionMapper.java new file mode 100644 index 0000000..7fa17a8 --- /dev/null +++ b/src/main/java/com/subsidy/mapper/AnsweringQuestionMapper.java @@ -0,0 +1,27 @@ +package com.subsidy.mapper; + +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.subsidy.model.AnsweringQuestionDO; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.subsidy.vo.answer.GetCourseQuestionVO; +import com.subsidy.vo.vod.GetContendVodsVO; +import org.springframework.stereotype.Repository; + +import java.util.List; + +/** + *

+ * 问题答疑表 Mapper 接口 + *

+ * + * @author DengMin + * @since 2021-10-14 + */ +@Repository +public interface AnsweringQuestionMapper extends BaseMapper { + + /** + * 获取某个课程的答疑 + */ + IPage getCourseQuestion(IPage page, Long classId,Long memberId); +} diff --git a/src/main/java/com/subsidy/mapper/ClassDictMapper.java b/src/main/java/com/subsidy/mapper/ClassDictMapper.java index 3f23005..bf30e6f 100644 --- a/src/main/java/com/subsidy/mapper/ClassDictMapper.java +++ b/src/main/java/com/subsidy/mapper/ClassDictMapper.java @@ -1,7 +1,11 @@ package com.subsidy.mapper; +import com.subsidy.dto.classDict.GetAllClassesDTO; +import com.subsidy.dto.classDict.GetSpareMembersDTO; import com.subsidy.model.ClassDictDO; import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.subsidy.model.MemberDO; +import com.subsidy.model.VodDictDO; import com.subsidy.vo.classdict.GetAllClassesVO; import org.springframework.stereotype.Repository; @@ -15,9 +19,24 @@ import java.util.List; * @author DengMin * @since 2021-10-12 */ - @Repository +@Repository public interface ClassDictMapper extends BaseMapper { - List getAllClasses(ClassDictDO classDictDO); + /** + * 获取某企业的全部班级 + */ + List getAllClasses(ClassDictDO classDictDO); + + /** + * 获取某班级下的全部视频 + */ + List getClassVods(Long classId); + + /** + * 查看某企业里,不在某班级的成员 + * @return + */ + List getSpareMembers(GetSpareMembersDTO getSpareMembersDTO); + } diff --git a/src/main/java/com/subsidy/mapper/ClassMemberMappingMapper.java b/src/main/java/com/subsidy/mapper/ClassMemberMappingMapper.java index fa258cb..7a2665d 100644 --- a/src/main/java/com/subsidy/mapper/ClassMemberMappingMapper.java +++ b/src/main/java/com/subsidy/mapper/ClassMemberMappingMapper.java @@ -1,9 +1,13 @@ package com.subsidy.mapper; +import com.subsidy.dto.classDict.GetSpareMembersDTO; import com.subsidy.model.ClassMemberMappingDO; import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.subsidy.model.MemberDO; import org.springframework.stereotype.Repository; +import java.util.List; + /** *

* 班级成员映射表 Mapper 接口 @@ -12,7 +16,8 @@ import org.springframework.stereotype.Repository; * @author DengMin * @since 2021-10-12 */ - @Repository +@Repository public interface ClassMemberMappingMapper extends BaseMapper { + } diff --git a/src/main/java/com/subsidy/mapper/CompanyDictMapper.java b/src/main/java/com/subsidy/mapper/CompanyDictMapper.java new file mode 100644 index 0000000..7e86199 --- /dev/null +++ b/src/main/java/com/subsidy/mapper/CompanyDictMapper.java @@ -0,0 +1,33 @@ +package com.subsidy.mapper; + +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.subsidy.model.AdministerDO; +import com.subsidy.model.CompanyDictDO; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.subsidy.vo.administer.OperatorsVO; +import org.springframework.stereotype.Repository; + +/** + *

+ * 企业字典表 Mapper 接口 + *

+ * + * @author DengMin + * @since 2021-10-25 + */ +@Repository +public interface CompanyDictMapper extends BaseMapper { + + /** + * 查找运营者 + * + * @return + */ + IPage operators(IPage page, String companyName, String userName,Integer role); + + /** + * 通过企业id查找企业的管理员 + */ + AdministerDO getAdministerByCompanyId(Long companyId); + +} diff --git a/src/main/java/com/subsidy/mapper/CourseContentMapper.java b/src/main/java/com/subsidy/mapper/CourseContentMapper.java index 66db80e..c16dd53 100644 --- a/src/main/java/com/subsidy/mapper/CourseContentMapper.java +++ b/src/main/java/com/subsidy/mapper/CourseContentMapper.java @@ -2,8 +2,12 @@ package com.subsidy.mapper; import com.subsidy.model.CourseContentDO; import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.subsidy.model.CourseDictDO; +import com.subsidy.model.VodDictDO; import org.springframework.stereotype.Repository; +import java.util.List; + /** *

* 课程目录表 Mapper 接口 @@ -12,7 +16,12 @@ import org.springframework.stereotype.Repository; * @author DengMin * @since 2021-10-11 */ - @Repository +@Repository public interface CourseContentMapper extends BaseMapper { + /** + * 查看课程下有多少个视频 + */ + List getCourseVods(Integer courseId); + } diff --git a/src/main/java/com/subsidy/mapper/CourseDictMapper.java b/src/main/java/com/subsidy/mapper/CourseDictMapper.java index e83ae3f..0aa8478 100644 --- a/src/main/java/com/subsidy/mapper/CourseDictMapper.java +++ b/src/main/java/com/subsidy/mapper/CourseDictMapper.java @@ -1,8 +1,13 @@ package com.subsidy.mapper; import com.baomidou.mybatisplus.core.metadata.IPage; +import com.subsidy.model.ClassMemberMappingDO; import com.subsidy.model.CourseDictDO; import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.subsidy.model.MemberDO; +import com.subsidy.vo.course.QueryCoursesVO; +import com.subsidy.vo.member.StudyPageVO; +import org.apache.ibatis.annotations.Param; import org.springframework.stereotype.Repository; import java.util.List; @@ -18,6 +23,26 @@ import java.util.List; @Repository public interface CourseDictMapper extends BaseMapper { - IPage queryCourses(IPage page,String courseName,Long categoryId,String courseType,String courseSource); + /** + * 查询全部课程 + * @return + */ + IPage queryCourses(IPage page, String courseName, Long categoryId, String courseType, String courseSource,Long companyId); + + /** + * 通过课程id查询课程下的学生-----弃用 + */ + List queryCourseMember(StudyPageVO studyPageVO); + + /** + * 查询全部公共课程 + * @return + */ + IPage queryPublicCourses(IPage page, String courseName, Long categoryId, String courseType, String courseSource); + + /** + * 查询企业内部课程 + */ + IPage queryCompanyCourse(IPage page, String courseName, Long categoryId, String courseType, String courseSource,Long companyId); } diff --git a/src/main/java/com/subsidy/mapper/ExerciseDoneResultMapper.java b/src/main/java/com/subsidy/mapper/ExerciseDoneResultMapper.java new file mode 100644 index 0000000..788d86d --- /dev/null +++ b/src/main/java/com/subsidy/mapper/ExerciseDoneResultMapper.java @@ -0,0 +1,18 @@ +package com.subsidy.mapper; + +import com.subsidy.model.ExerciseDoneResultDO; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.springframework.stereotype.Repository; + +/** + *

+ * 学生课程习题完成情况 Mapper 接口 + *

+ * + * @author DengMin + * @since 2021-10-15 + */ + @Repository +public interface ExerciseDoneResultMapper extends BaseMapper { + +} diff --git a/src/main/java/com/subsidy/mapper/MemberMapper.java b/src/main/java/com/subsidy/mapper/MemberMapper.java index eedc04c..efaed52 100644 --- a/src/main/java/com/subsidy/mapper/MemberMapper.java +++ b/src/main/java/com/subsidy/mapper/MemberMapper.java @@ -2,8 +2,11 @@ package com.subsidy.mapper; import com.subsidy.model.MemberDO; import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.subsidy.vo.member.StudyPageVO; import org.springframework.stereotype.Repository; +import java.util.List; + /** *

* 学生表 Mapper 接口 @@ -12,7 +15,12 @@ import org.springframework.stereotype.Repository; * @author DengMin * @since 2021-10-11 */ - @Repository +@Repository public interface MemberMapper extends BaseMapper { + /** + * 查看学生的课程 + */ + List studyPage(MemberDO memberDO); + } diff --git a/src/main/java/com/subsidy/mapper/SignInRecordMapper.java b/src/main/java/com/subsidy/mapper/SignInRecordMapper.java new file mode 100644 index 0000000..89a32c0 --- /dev/null +++ b/src/main/java/com/subsidy/mapper/SignInRecordMapper.java @@ -0,0 +1,24 @@ +package com.subsidy.mapper; + +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.subsidy.dto.sign.ClassSignInfoDTO; +import com.subsidy.model.SignInRecordDO; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.subsidy.vo.sign.ClassSignInfoVO; +import org.springframework.stereotype.Repository; + +/** + *

+ * 学生签到表 Mapper 接口 + *

+ * + * @author DengMin + * @since 2021-10-18 + */ + @Repository +public interface SignInRecordMapper extends BaseMapper { + + IPage classSignInfo(IPage iPage,String className,String courseName,Integer id); + + +} diff --git a/src/main/java/com/subsidy/mapper/SmsVerifyCodeMapper.java b/src/main/java/com/subsidy/mapper/SmsVerifyCodeMapper.java new file mode 100644 index 0000000..77d2613 --- /dev/null +++ b/src/main/java/com/subsidy/mapper/SmsVerifyCodeMapper.java @@ -0,0 +1,18 @@ +package com.subsidy.mapper; + +import com.subsidy.model.SmsVerifyCodeDO; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.springframework.stereotype.Repository; + +/** + *

+ * 短信验证码记录表 Mapper 接口 + *

+ * + * @author DengMin + * @since 2021-10-14 + */ + @Repository +public interface SmsVerifyCodeMapper extends BaseMapper { + +} diff --git a/src/main/java/com/subsidy/mapper/VodDictMapper.java b/src/main/java/com/subsidy/mapper/VodDictMapper.java index fdd5e00..71dd0e3 100644 --- a/src/main/java/com/subsidy/mapper/VodDictMapper.java +++ b/src/main/java/com/subsidy/mapper/VodDictMapper.java @@ -1,5 +1,6 @@ package com.subsidy.mapper; +import com.baomidou.mybatisplus.core.metadata.IPage; import com.subsidy.model.VodDictDO; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.subsidy.vo.vod.GetContendVodsVO; @@ -18,5 +19,12 @@ import java.util.List; @Repository public interface VodDictMapper extends BaseMapper { - List getContendVods(VodDictDO vodDictDO); + /** + * 查看某个目录下的视频 + * @param page + * @param vodName + * @param contentId + * @return + */ + IPage getContendVods(IPage page,String vodName,Long contentId); } diff --git a/src/main/java/com/subsidy/mapper/VodPlayHistoryMapper.java b/src/main/java/com/subsidy/mapper/VodPlayHistoryMapper.java new file mode 100644 index 0000000..acae106 --- /dev/null +++ b/src/main/java/com/subsidy/mapper/VodPlayHistoryMapper.java @@ -0,0 +1,26 @@ +package com.subsidy.mapper; + +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.subsidy.model.VodPlayHistoryDO; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.subsidy.vo.vod.StudyHistoryVO; +import org.springframework.stereotype.Repository; + +/** + *

+ * 视频播放历史记录表 Mapper 接口 + *

+ * + * @author DengMin + * @since 2021-10-14 + */ +@Repository +public interface VodPlayHistoryMapper extends BaseMapper { + + /** + * 查看某成员的学习历史 + */ + IPage studyHistory(IPage iPage,Long memberId); + + +} diff --git a/src/main/java/com/subsidy/model/AdministerDO.java b/src/main/java/com/subsidy/model/AdministerDO.java index 6cf32d7..d76b33c 100644 --- a/src/main/java/com/subsidy/model/AdministerDO.java +++ b/src/main/java/com/subsidy/model/AdministerDO.java @@ -29,6 +29,16 @@ public class AdministerDO extends BaseModel { private Long id; /** + * 公司名称 + */ + private Long companyId; + + /** + * 账号 + */ + private String accountName; + + /** * 手机号/企业账号 */ private String telephone; @@ -39,39 +49,29 @@ public class AdministerDO extends BaseModel { private String password; /** - * 成员名称/企业名称 + * 成员名称 */ private String userName; /** - * 简称 - */ - private String shortName; - - /** * 头像 */ private String img; /** - * 标语 - */ - private String banner; - - /** * 1:启用 0:禁用 */ private String status; - /** - * 领域 - */ - private String field; + ///** + // * 0:运营者账号 1:企业账号 + // */ + //private String accountType; /** - * 账户类型 + * role 0:平台运营者 1:超级管理员 2:普通成员 */ - private String accountType; + private Integer role; } diff --git a/src/main/java/com/subsidy/model/AnsweringQuestionDO.java b/src/main/java/com/subsidy/model/AnsweringQuestionDO.java new file mode 100644 index 0000000..f844713 --- /dev/null +++ b/src/main/java/com/subsidy/model/AnsweringQuestionDO.java @@ -0,0 +1,54 @@ +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 2021-10-14 + */ +@Data +@EqualsAndHashCode(callSuper = true) +@TableName("answering_question") +public class AnsweringQuestionDO extends BaseModel { + + private static final long serialVersionUID = 1L; + + @TableId(value = "id", type = IdType.AUTO) + private Long id; + + /** + * 班级id + */ + private Long classId; + + /** + * 提问id + */ + private Long askId; + + /** + * 回答人id + */ + private Long answerId; + + /** + * 问题 + */ + private String title; + + /** + * 答案 + */ + private String answer; + + +} diff --git a/src/main/java/com/subsidy/model/CategoryDO.java b/src/main/java/com/subsidy/model/CategoryDO.java index c8bec80..c82ebcb 100644 --- a/src/main/java/com/subsidy/model/CategoryDO.java +++ b/src/main/java/com/subsidy/model/CategoryDO.java @@ -26,6 +26,11 @@ public class CategoryDO extends BaseModel { private Long id; /** + * 企业id + */ + private Long companyId; + + /** * 类目名称 */ private String name; diff --git a/src/main/java/com/subsidy/model/ClassDictDO.java b/src/main/java/com/subsidy/model/ClassDictDO.java index 573e509..a89a813 100644 --- a/src/main/java/com/subsidy/model/ClassDictDO.java +++ b/src/main/java/com/subsidy/model/ClassDictDO.java @@ -4,7 +4,9 @@ import com.subsidy.util.BaseModel; import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.TableId; + import java.time.LocalDateTime; + import lombok.Data; import lombok.EqualsAndHashCode; @@ -27,7 +29,7 @@ public class ClassDictDO extends BaseModel { private Long id; /** - * 企业id + * 老师id */ private Long companyId; @@ -41,9 +43,9 @@ public class ClassDictDO extends BaseModel { */ private Long courseId; - private LocalDateTime startDate; + private String startDate; - private LocalDateTime endDate; + private String endDate; } diff --git a/src/main/java/com/subsidy/model/ClassMemberMappingDO.java b/src/main/java/com/subsidy/model/ClassMemberMappingDO.java index db0dec8..614000d 100644 --- a/src/main/java/com/subsidy/model/ClassMemberMappingDO.java +++ b/src/main/java/com/subsidy/model/ClassMemberMappingDO.java @@ -1,5 +1,7 @@ package com.subsidy.model; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; import com.subsidy.util.BaseModel; import com.baomidou.mybatisplus.annotation.TableName; import lombok.Data; @@ -20,6 +22,7 @@ public class ClassMemberMappingDO extends BaseModel { private static final long serialVersionUID = 1L; + @TableId(value = "id", type = IdType.AUTO) private Long id; /** diff --git a/src/main/java/com/subsidy/model/CompanyDictDO.java b/src/main/java/com/subsidy/model/CompanyDictDO.java new file mode 100644 index 0000000..3e1700a --- /dev/null +++ b/src/main/java/com/subsidy/model/CompanyDictDO.java @@ -0,0 +1,55 @@ +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 2021-10-25 + */ +@Data +@EqualsAndHashCode(callSuper = true) +@TableName("company_dict") +public class CompanyDictDO extends BaseModel { + + private static final long serialVersionUID = 1L; + + @TableId(value = "id", type = IdType.AUTO) + private Long id; + + /** + * 企业logo + */ + private String logo; + + /** + * 公司名称 + */ + private String companyName; + + /** + * 简称 + */ + private String shortName; + + /** + * 标语 + */ + private String banner; + + /** + * 领域 + */ + private String field; + + + +} diff --git a/src/main/java/com/subsidy/model/CourseContentDO.java b/src/main/java/com/subsidy/model/CourseContentDO.java index e07f57b..f1e64a7 100644 --- a/src/main/java/com/subsidy/model/CourseContentDO.java +++ b/src/main/java/com/subsidy/model/CourseContentDO.java @@ -1,5 +1,7 @@ package com.subsidy.model; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; import com.subsidy.util.BaseModel; import com.baomidou.mybatisplus.annotation.TableName; import lombok.Data; @@ -20,6 +22,7 @@ public class CourseContentDO extends BaseModel { private static final long serialVersionUID = 1L; + @TableId(value = "id", type = IdType.AUTO) private Long id; private Long courseId; diff --git a/src/main/java/com/subsidy/model/CourseDictDO.java b/src/main/java/com/subsidy/model/CourseDictDO.java index de5fe9f..e1626af 100644 --- a/src/main/java/com/subsidy/model/CourseDictDO.java +++ b/src/main/java/com/subsidy/model/CourseDictDO.java @@ -7,6 +7,9 @@ import com.baomidou.mybatisplus.annotation.TableId; import lombok.Data; import lombok.EqualsAndHashCode; +import java.time.LocalDateTime; +import java.util.Date; + /** *

* @@ -26,6 +29,11 @@ public class CourseDictDO extends BaseModel { private Long id; /** + * + */ + private Long companyId; + + /** * 课程名称 */ private String courseName; @@ -45,5 +53,9 @@ public class CourseDictDO extends BaseModel { */ private String courseSource; + /** + * 习题截止时间 + */ + private LocalDateTime deadline; } diff --git a/src/main/java/com/subsidy/model/DepartmentDictDO.java b/src/main/java/com/subsidy/model/DepartmentDictDO.java index 2f34ede..469e635 100644 --- a/src/main/java/com/subsidy/model/DepartmentDictDO.java +++ b/src/main/java/com/subsidy/model/DepartmentDictDO.java @@ -17,7 +17,7 @@ import lombok.EqualsAndHashCode; */ @Data @EqualsAndHashCode(callSuper = true) -@TableName("departmentDict") +@TableName("department_dict") public class DepartmentDictDO extends BaseModel { private static final long serialVersionUID = 1L; diff --git a/src/main/java/com/subsidy/model/ExerciseDoneResultDO.java b/src/main/java/com/subsidy/model/ExerciseDoneResultDO.java new file mode 100644 index 0000000..3398bf1 --- /dev/null +++ b/src/main/java/com/subsidy/model/ExerciseDoneResultDO.java @@ -0,0 +1,54 @@ +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 2021-10-15 + */ +@Data +@EqualsAndHashCode(callSuper = true) +@TableName("exercise_done_result") +public class ExerciseDoneResultDO extends BaseModel { + + private static final long serialVersionUID = 1L; + + @TableId(value = "id", type = IdType.AUTO) + private Long id; + + /** + * 成员id + */ + private Long memberId; + + /** + * 班级id + */ + private Long classId; + + /** + * 课程id + */ + private Long courseId; + + /** + * 正确个数 + */ + private Integer rightCounts; + + /** + * 总共个数 + */ + private Integer totalCounts; + + +} diff --git a/src/main/java/com/subsidy/model/FileDictDO.java b/src/main/java/com/subsidy/model/FileDictDO.java index 1b75394..7143b28 100644 --- a/src/main/java/com/subsidy/model/FileDictDO.java +++ b/src/main/java/com/subsidy/model/FileDictDO.java @@ -40,6 +40,10 @@ public class FileDictDO extends BaseModel { */ private String fileSize; + private String fileType; + + private String fileUrl; + /** * 排序 */ diff --git a/src/main/java/com/subsidy/model/SignInRecordDO.java b/src/main/java/com/subsidy/model/SignInRecordDO.java new file mode 100644 index 0000000..ed14d50 --- /dev/null +++ b/src/main/java/com/subsidy/model/SignInRecordDO.java @@ -0,0 +1,45 @@ +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 java.time.LocalDateTime; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + *

+ * 学生签到表 + *

+ * + * @author DengMin + * @since 2021-10-18 + */ +@Data +@EqualsAndHashCode(callSuper = true) +@TableName("sign_in_record") +public class SignInRecordDO extends BaseModel { + + private static final long serialVersionUID = 1L; + + @TableId(value = "id", type = IdType.AUTO) + private Long id; + + /** + * 学生id + */ + private Integer studentId; + + /** + * 班级id + */ + private Integer classId; + + /** + * 签到时间 + */ + private LocalDateTime signInDate; + + +} diff --git a/src/main/java/com/subsidy/model/SmsVerifyCodeDO.java b/src/main/java/com/subsidy/model/SmsVerifyCodeDO.java new file mode 100644 index 0000000..67ad9e3 --- /dev/null +++ b/src/main/java/com/subsidy/model/SmsVerifyCodeDO.java @@ -0,0 +1,39 @@ +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 2021-10-14 + */ +@Data +@EqualsAndHashCode(callSuper = true) +@TableName("sms_verify_code") +public class SmsVerifyCodeDO extends BaseModel { + + private static final long serialVersionUID = 1L; + + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + /** + * 手机号 + */ + private String telephone; + + /** + * 验证码 + */ + private String verifyCode; + + +} diff --git a/src/main/java/com/subsidy/model/VodDictDO.java b/src/main/java/com/subsidy/model/VodDictDO.java index d684161..3661321 100644 --- a/src/main/java/com/subsidy/model/VodDictDO.java +++ b/src/main/java/com/subsidy/model/VodDictDO.java @@ -60,5 +60,14 @@ public class VodDictDO extends BaseModel { */ private String vodCode; + /** + * 讲师名称 + */ + private String teacherName; + + /** + * 封面 + */ + private String coverPage; } diff --git a/src/main/java/com/subsidy/model/VodPlayHistoryDO.java b/src/main/java/com/subsidy/model/VodPlayHistoryDO.java new file mode 100644 index 0000000..1635b64 --- /dev/null +++ b/src/main/java/com/subsidy/model/VodPlayHistoryDO.java @@ -0,0 +1,54 @@ +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 2021-10-14 + */ +@Data +@EqualsAndHashCode(callSuper = true) +@TableName("vod_play_history") +public class VodPlayHistoryDO extends BaseModel { + + private static final long serialVersionUID = 1L; + + @TableId(value = "id", type = IdType.AUTO) + private Long id; + + /** + * 班级id + */ + private Long classId; + + /** + * 视频id + */ + private Long vodId; + + /** + * 学生id + */ + private Long memberId; + + /** + * 观看时长 + */ + private Integer playLength; + + /** + * 播放视频位置 + */ + private Integer playRecord; + + +} diff --git a/src/main/java/com/subsidy/service/AdministerService.java b/src/main/java/com/subsidy/service/AdministerService.java index 938d30f..8908a89 100644 --- a/src/main/java/com/subsidy/service/AdministerService.java +++ b/src/main/java/com/subsidy/service/AdministerService.java @@ -1,13 +1,17 @@ package com.subsidy.service; import com.baomidou.mybatisplus.core.metadata.IPage; +import com.subsidy.dto.administer.ClassDetailDTO; import com.subsidy.dto.administer.OperatorsDTO; import com.subsidy.model.AdministerDO; import com.baomidou.mybatisplus.extension.service.IService; -import com.subsidy.vo.administer.AdministerPermissionVO; -import com.subsidy.vo.administer.LoginVO; -import com.subsidy.vo.administer.OperatorsVO; +import com.subsidy.model.ClassDictDO; +import com.subsidy.vo.administer.*; +import com.subsidy.vo.classdict.ClassDetailVO; +import com.subsidy.vo.member.ClassSignVO; +import com.subsidy.vo.sign.AnswerRecordVO; +import javax.servlet.http.HttpServletResponse; import java.util.List; /** @@ -26,10 +30,30 @@ public interface AdministerService extends IService { IPage operators(OperatorsDTO operatorsDTO); - String addOperator(AdministerDO administerDO); + String addAdminister(AdministerDO administerDO); String deleteAdminister(AdministerDO administerDO); String updateAdminister(AdministerDO administerDO); + ClassSummaryVO classSummary(ClassDetailDTO classDetailDTO); + + IPage classDetail(ClassDetailDTO classDetailDTO); + + List exportClassDetail(ClassDetailDTO classDetailDTO); + + IPage signDetail(ClassDetailDTO classDetailDTO); + + List exportSignDetail(ClassDetailDTO classDetailDTO); + + IPage exerciseTest(ClassDetailDTO classDetailDTO); + + List exportExerciseTest(ClassDetailDTO classDetailDTO); + + IPage answerRecord(ClassDetailDTO classDetailDTO); + + List exportAnswerRecord(ClassDetailDTO classDetailDTO); + + void export(ClassDetailDTO classDetailDTO)throws Exception; + } diff --git a/src/main/java/com/subsidy/service/AnsweringQuestionService.java b/src/main/java/com/subsidy/service/AnsweringQuestionService.java new file mode 100644 index 0000000..7af3159 --- /dev/null +++ b/src/main/java/com/subsidy/service/AnsweringQuestionService.java @@ -0,0 +1,25 @@ +package com.subsidy.service; + +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.subsidy.dto.GetCourseQuestionDTO; +import com.subsidy.model.AnsweringQuestionDO; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + *

+ * 问题答疑表 服务类 + *

+ * + * @author DengMin + * @since 2021-10-14 + */ +public interface AnsweringQuestionService extends IService { + + IPage getCourseQuestion(GetCourseQuestionDTO getCourseQuestionDTO); + + String addQuestion(AnsweringQuestionDO answeringQuestionDO); + + String deleteQuestion(AnsweringQuestionDO answeringQuestionDO); + + String updateQuestion(AnsweringQuestionDO answeringQuestionDO); +} diff --git a/src/main/java/com/subsidy/service/CategoryService.java b/src/main/java/com/subsidy/service/CategoryService.java index 034a526..8647c82 100644 --- a/src/main/java/com/subsidy/service/CategoryService.java +++ b/src/main/java/com/subsidy/service/CategoryService.java @@ -19,7 +19,7 @@ public interface CategoryService extends IService { IPage getCategories(GetCategoriesDTO getCategoriesDTO); - List getAll(); + List getAll(GetCategoriesDTO getCategoriesDTO); String addCategory(CategoryDO categoryDO); diff --git a/src/main/java/com/subsidy/service/ClassDictService.java b/src/main/java/com/subsidy/service/ClassDictService.java index b701ab6..7719ead 100644 --- a/src/main/java/com/subsidy/service/ClassDictService.java +++ b/src/main/java/com/subsidy/service/ClassDictService.java @@ -1,7 +1,12 @@ package com.subsidy.service; +import com.subsidy.dto.classDict.AddMemberToClassDTO; +import com.subsidy.dto.classDict.GetAllClassesDTO; +import com.subsidy.dto.classDict.GetSpareMembersDTO; import com.subsidy.model.ClassDictDO; import com.baomidou.mybatisplus.extension.service.IService; +import com.subsidy.model.ClassMemberMappingDO; +import com.subsidy.model.MemberDO; import com.subsidy.vo.classdict.GetAllClassesVO; import java.util.List; @@ -24,4 +29,12 @@ public interface ClassDictService extends IService { String updateClass(ClassDictDO classDictDO); + ClassDictDO classDetail(ClassDictDO classDictDO); + + String removeMember(ClassMemberMappingDO classMemberMappingDO); + + List getSpareMembers(GetSpareMembersDTO getSpareMembersDTO); + + String addMemberToClass(AddMemberToClassDTO addMemberToClassDTO); + } diff --git a/src/main/java/com/subsidy/service/CompanyDictService.java b/src/main/java/com/subsidy/service/CompanyDictService.java new file mode 100644 index 0000000..7d4fa7f --- /dev/null +++ b/src/main/java/com/subsidy/service/CompanyDictService.java @@ -0,0 +1,29 @@ +package com.subsidy.service; + +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.subsidy.dto.administer.OperatorsDTO; +import com.subsidy.dto.company.AddCompanyDTO; +import com.subsidy.model.AdministerDO; +import com.subsidy.model.CompanyDictDO; +import com.baomidou.mybatisplus.extension.service.IService; +import com.subsidy.vo.administer.OperatorsVO; + +/** + *

+ * 企业字典表 服务类 + *

+ * + * @author DengMin + * @since 2021-10-25 + */ +public interface CompanyDictService extends IService { + + IPage operators(OperatorsDTO operatorsDTO); + + String addOperator(AddCompanyDTO addCompanyDTO); + + String deleteAdminister(CompanyDictDO companyDictDO); + + String updateAdminister(AddCompanyDTO addCompanyDTO); + +} diff --git a/src/main/java/com/subsidy/service/CourseContentService.java b/src/main/java/com/subsidy/service/CourseContentService.java index 2ccc299..128b5c8 100644 --- a/src/main/java/com/subsidy/service/CourseContentService.java +++ b/src/main/java/com/subsidy/service/CourseContentService.java @@ -21,5 +21,9 @@ public interface CourseContentService extends IService { List getContents(CourseContentDO courseContentDO); + String deleteContent(CourseContentDO courseContentDO); + String addContent(CourseContentDO courseContentDO); + + String updateContent(CourseContentDO courseContentDO); } diff --git a/src/main/java/com/subsidy/service/CourseDictService.java b/src/main/java/com/subsidy/service/CourseDictService.java index ddb7f61..59f9db7 100644 --- a/src/main/java/com/subsidy/service/CourseDictService.java +++ b/src/main/java/com/subsidy/service/CourseDictService.java @@ -22,4 +22,6 @@ public interface CourseDictService extends IService { IPage queryCourses(QueryCoursesDTO queryCoursesDTO); String updateCourses(CourseDictDO courseDictDO); + + IPage queryCompanyCourse(QueryCoursesDTO queryCoursesDTO); } diff --git a/src/main/java/com/subsidy/service/ExerciseDictService.java b/src/main/java/com/subsidy/service/ExerciseDictService.java index f0346d5..8f9782d 100644 --- a/src/main/java/com/subsidy/service/ExerciseDictService.java +++ b/src/main/java/com/subsidy/service/ExerciseDictService.java @@ -2,8 +2,11 @@ package com.subsidy.service; import com.baomidou.mybatisplus.core.metadata.IPage; import com.subsidy.dto.exercise.GetAllExercisesDTO; +import com.subsidy.dto.exercise.SubmitDTO; +import com.subsidy.model.CourseDictDO; import com.subsidy.model.ExerciseDictDO; import com.baomidou.mybatisplus.extension.service.IService; +import com.subsidy.vo.course.ExerciseVO; import java.util.List; @@ -24,4 +27,9 @@ public interface ExerciseDictService extends IService { String deleteExercise(ExerciseDictDO exerciseDictDO); String updateExercise(ExerciseDictDO exerciseDictDO); + + List getCourseExercises(CourseDictDO courseDictDO); + + String submit(SubmitDTO submitDTO); + } diff --git a/src/main/java/com/subsidy/service/ExerciseDoneResultService.java b/src/main/java/com/subsidy/service/ExerciseDoneResultService.java new file mode 100644 index 0000000..5628acb --- /dev/null +++ b/src/main/java/com/subsidy/service/ExerciseDoneResultService.java @@ -0,0 +1,16 @@ +package com.subsidy.service; + +import com.subsidy.model.ExerciseDoneResultDO; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + *

+ * 学生课程习题完成情况 服务类 + *

+ * + * @author DengMin + * @since 2021-10-15 + */ +public interface ExerciseDoneResultService extends IService { + +} diff --git a/src/main/java/com/subsidy/service/MemberService.java b/src/main/java/com/subsidy/service/MemberService.java index d6982f5..0edc0e3 100644 --- a/src/main/java/com/subsidy/service/MemberService.java +++ b/src/main/java/com/subsidy/service/MemberService.java @@ -1,9 +1,16 @@ package com.subsidy.service; import com.baomidou.mybatisplus.core.metadata.IPage; +import com.subsidy.dto.administer.VerifyCodeDTO; +import com.subsidy.dto.member.ContentMemberDTO; import com.subsidy.dto.member.GetAllDTO; +import com.subsidy.dto.member.StudyHistoryDTO; import com.subsidy.model.MemberDO; import com.baomidou.mybatisplus.extension.service.IService; +import com.subsidy.vo.administer.UserRoleVO; +import com.subsidy.vo.member.*; + +import java.util.List; /** *

@@ -23,4 +30,23 @@ public interface MemberService extends IService { String updateMember(MemberDO memberDO); + UserRoleVO login(VerifyCodeDTO verifyCodeDTO); + + UserRoleVO passwordLogin(MemberDO memberDO); + + String updatePassword(MemberDO memberDO); + + MemberStudyPageVO studyPage(MemberDO memberDO); + + List contentVod(ContentMemberDTO contentVodDTO); + + List contentFiles(ContentMemberDTO contentMemberDTO); + + IPage studyHistory(StudyHistoryDTO studyHistoryDTO); + + GetCourseTestVO getCourseTest(ContentMemberDTO contentMemberDTO); + + GetStudyInfoVO getStudyInfo(MemberDO memberDO); + + } diff --git a/src/main/java/com/subsidy/service/SignInRecordService.java b/src/main/java/com/subsidy/service/SignInRecordService.java new file mode 100644 index 0000000..dd6746b --- /dev/null +++ b/src/main/java/com/subsidy/service/SignInRecordService.java @@ -0,0 +1,28 @@ +package com.subsidy.service; + +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.subsidy.dto.member.GetMemberSignInfoDTO; +import com.subsidy.dto.sign.ClassSignInfoDTO; +import com.subsidy.dto.sign.SignInDTO; +import com.subsidy.model.MemberDO; +import com.subsidy.model.SignInRecordDO; +import com.baomidou.mybatisplus.extension.service.IService; +import com.subsidy.vo.member.GetMemberSignInfoVO; +import com.tencentcloudapi.common.Sign; + +/** + *

+ * 学生签到表 服务类 + *

+ * + * @author DengMin + * @since 2021-10-18 + */ +public interface SignInRecordService extends IService { + + IPage getMemberSignInfo(GetMemberSignInfoDTO getMemberSignInfoDTO); + + String signIn(SignInRecordDO signInRecordDO); + + IPage classSignInfo(ClassSignInfoDTO classSignInfoDTO); +} diff --git a/src/main/java/com/subsidy/service/SmsVerifyCodeService.java b/src/main/java/com/subsidy/service/SmsVerifyCodeService.java new file mode 100644 index 0000000..706fa89 --- /dev/null +++ b/src/main/java/com/subsidy/service/SmsVerifyCodeService.java @@ -0,0 +1,19 @@ +package com.subsidy.service; + +import com.subsidy.dto.sms.SendVerifyCodeDTO; +import com.subsidy.model.SmsVerifyCodeDO; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + *

+ * 短信验证码记录表 服务类 + *

+ * + * @author DengMin + * @since 2021-10-14 + */ +public interface SmsVerifyCodeService extends IService { + + void sendVerifyCode(SendVerifyCodeDTO sendVerifyCodeDTO); + +} diff --git a/src/main/java/com/subsidy/service/VodDictService.java b/src/main/java/com/subsidy/service/VodDictService.java index ac16676..1d5183a 100644 --- a/src/main/java/com/subsidy/service/VodDictService.java +++ b/src/main/java/com/subsidy/service/VodDictService.java @@ -1,5 +1,7 @@ package com.subsidy.service; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.subsidy.dto.content.GetContendVodsDTO; import com.subsidy.model.VodDictDO; import com.baomidou.mybatisplus.extension.service.IService; import com.subsidy.vo.vod.GetContendVodsVO; @@ -19,7 +21,7 @@ public interface VodDictService extends IService { SignatureVO signature()throws Exception; - List getContendVods(VodDictDO vodDictDO); + IPage getContendVods(GetContendVodsDTO getContendVodsDTO); String deleteVod(VodDictDO vodDictDO); diff --git a/src/main/java/com/subsidy/service/VodPlayHistoryService.java b/src/main/java/com/subsidy/service/VodPlayHistoryService.java new file mode 100644 index 0000000..3b850e3 --- /dev/null +++ b/src/main/java/com/subsidy/service/VodPlayHistoryService.java @@ -0,0 +1,18 @@ +package com.subsidy.service; + +import com.subsidy.model.VodPlayHistoryDO; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + *

+ * 视频播放历史记录表 服务类 + *

+ * + * @author DengMin + * @since 2021-10-14 + */ +public interface VodPlayHistoryService extends IService { + + String insertHistory(VodPlayHistoryDO vodPlayHistoryDO); + +} diff --git a/src/main/java/com/subsidy/service/impl/AdministerServiceImpl.java b/src/main/java/com/subsidy/service/impl/AdministerServiceImpl.java index 4f6ee3a..30ccae7 100644 --- a/src/main/java/com/subsidy/service/impl/AdministerServiceImpl.java +++ b/src/main/java/com/subsidy/service/impl/AdministerServiceImpl.java @@ -4,26 +4,45 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.subsidy.common.exception.HttpException; +import com.subsidy.dto.administer.ClassDetailDTO; import com.subsidy.dto.administer.OperatorsDTO; -import com.subsidy.model.AdministerDO; -import com.subsidy.mapper.AdministerMapper; -import com.subsidy.model.RoleAdministerMappingDO; +import com.subsidy.mapper.*; +import com.subsidy.model.*; import com.subsidy.service.AdministerService; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.subsidy.util.ConstantUtils; -import com.subsidy.util.JwtUtil; -import com.subsidy.util.Localstorage; -import com.subsidy.vo.administer.AdministerPermissionVO; -import com.subsidy.vo.administer.LoginVO; -import com.subsidy.vo.administer.OperatorsVO; -import com.subsidy.vo.administer.PermissionsVO; +import com.subsidy.util.*; +import com.subsidy.vo.administer.*; +import com.subsidy.vo.classdict.ClassDetailVO; +import com.subsidy.vo.member.ClassSignVO; +import com.subsidy.vo.sign.AnswerRecordVO; +import org.apache.poi.hssf.usermodel.HSSFCellStyle; +import org.apache.poi.hssf.usermodel.HSSFFont; +import org.apache.poi.hssf.util.CellRangeAddress; +import org.apache.poi.ss.usermodel.CellStyle; +import org.apache.poi.ss.usermodel.Font; +import org.apache.poi.xssf.streaming.SXSSFCell; +import org.apache.poi.xssf.streaming.SXSSFRow; +import org.apache.poi.xssf.streaming.SXSSFSheet; +import org.apache.poi.xssf.streaming.SXSSFWorkbook; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.http.MediaType; import org.springframework.stereotype.Service; +import org.springframework.web.context.request.RequestContextHolder; +import org.springframework.web.context.request.ServletRequestAttributes; -import java.time.LocalDateTime; +import javax.servlet.ServletOutputStream; +import javax.servlet.http.HttpServletResponse; +import java.io.*; +import java.math.BigDecimal; +import java.text.SimpleDateFormat; import java.util.ArrayList; +import java.util.Arrays; import java.util.List; +import java.util.zip.ZipEntry; +import java.util.zip.ZipOutputStream; + +import static org.springframework.http.MediaType.*; /** *

@@ -36,6 +55,29 @@ import java.util.List; @Service public class AdministerServiceImpl extends ServiceImpl implements AdministerService { + @Autowired + private ClassDictMapper classDictMapper; + + @Autowired + private VodPlayHistoryMapper vodPlayHistoryMapper; + + @Autowired + private ExerciseDoneResultMapper exerciseDoneResultMapper; + + @Autowired + private AnsweringQuestionMapper answeringQuestionMapper; + + @Autowired + private ClassMemberMappingMapper classMemberMappingMapper; + + @Autowired + private CourseDictMapper courseDictMapper; + + @Autowired + private SignInRecordMapper signInRecordMapper; + + @Autowired + private CompanyDictMapper companyDictMapper; public LoginVO login(AdministerDO administerDO) { @@ -43,14 +85,14 @@ public class AdministerServiceImpl extends ServiceImpl() .lambda() - .eq(AdministerDO::getTelephone, administerDO.getTelephone())); + .eq(AdministerDO::getAccountName, administerDO.getAccountName())); if (null != administerDO1) { if (administerDO.getPassword().equals(administerDO1.getPassword())) { - String token = JwtUtil.generateToken(administerDO.getId(), ConstantUtils.ADMINISTER_TERMINATE); + String token = JwtUtil.generateToken(administerDO1.getId(), ConstantUtils.ADMINISTER_TERMINATE); loginVO.setToken(token); return loginVO; - }else { + } else { throw new HttpException(10004); } } else { @@ -89,38 +131,989 @@ public class AdministerServiceImpl extends ServiceImpl operators(OperatorsDTO operatorsDTO){ + public IPage operators(OperatorsDTO operatorsDTO) { Page pager = new Page(operatorsDTO.getPageNum(), operatorsDTO.getPageSize()); - return this.baseMapper.operators(pager,operatorsDTO.getAccountType()); + return companyDictMapper.operators(pager, operatorsDTO.getCompanyName(), operatorsDTO.getUserName(), 0); } - public String addOperator(AdministerDO administerDO){ + public String addAdminister(AdministerDO administerDO) { - Integer count = this.baseMapper.selectCount(new QueryWrapper() - .lambda() - .eq(AdministerDO::getAccountType,administerDO.getAccountType()) - .eq(AdministerDO::getTelephone,administerDO.getTelephone())); + int count = this.baseMapper.selectCount(new QueryWrapper() + .lambda() + .eq(AdministerDO::getAccountName, administerDO.getAccountName())); - if (count>0){ - throw new HttpException(10014); + if (count > 0) { + throw new HttpException(20002); } + administerDO.setRole(0); administerDO.setPassword("admin123"); administerDO.setStatus("1"); this.baseMapper.insert(administerDO); - return ConstantUtils.ADD_SUCCESS; } - public String deleteAdminister(AdministerDO administerDO){ + public String deleteAdminister(AdministerDO administerDO) { this.baseMapper.deleteById(administerDO.getId()); return ConstantUtils.DELETE_SUCCESS; } - public String updateAdminister(AdministerDO administerDO){ + public String updateAdminister(AdministerDO administerDO) { + + int count = this.baseMapper.selectCount(new QueryWrapper() + .lambda() + .eq(AdministerDO::getAccountName, administerDO.getAccountName()) + .ne(AdministerDO::getId, administerDO.getId())); + + if (count > 0) { + throw new HttpException(20002); + } this.baseMapper.updateById(administerDO); return ConstantUtils.SET_SUCCESS; } + public ClassSummaryVO classSummary(ClassDetailDTO classDetailDTO) { + + ClassSummaryVO classSummaryVO = new ClassSummaryVO(); + + ClassDictDO classDictDO = classDictMapper.selectById(classDetailDTO.getId()); + classSummaryVO.setClassId(classDetailDTO.getId()); + classSummaryVO.setClassName(classDictDO.getClassName()); + classSummaryVO.setStartDate(classDictDO.getStartDate()); + classSummaryVO.setEndDate(classDictDO.getEndDate()); + + CourseDictDO courseDictDO = courseDictMapper.selectById(classDictDO.getCourseId()); + classSummaryVO.setCourseName(courseDictDO.getCourseName()); + + //班级人数 + List classMemberMappingDOS = classMemberMappingMapper.selectList(new QueryWrapper() + .lambda() + .eq(ClassMemberMappingDO::getClassId, classDetailDTO.getId())); + classSummaryVO.setMemberCount(classMemberMappingDOS.size()); + + //课程总数 + List vodDictDOS = classDictMapper.getClassVods(classDetailDTO.getId()); + classSummaryVO.setTotalVodCounts(vodDictDOS.size()); + + + int totalStudyVods = 0; + int totalStudyLength = 0; + //学生总共学习课时数 + for (VodDictDO vodDictDO : vodDictDOS) { + for (ClassMemberMappingDO classMemberMappingDO : classMemberMappingDOS) { + List vodPlayHistoryDOS = vodPlayHistoryMapper.selectList(new QueryWrapper() + .lambda() + .eq(VodPlayHistoryDO::getMemberId, classMemberMappingDO.getId()) + .eq(VodPlayHistoryDO::getVodId, vodDictDO.getId()) + .orderByDesc(VodPlayHistoryDO::getPlayRecord)); + for (VodPlayHistoryDO vodPlayHistoryDO : vodPlayHistoryDOS) { + totalStudyLength += vodPlayHistoryDO.getPlayLength(); + } + if (vodPlayHistoryDOS.size() > 0) { + if (vodPlayHistoryDOS.get(0).getPlayRecord() > vodDictDO.getVodLength() * 0.8) { + totalStudyVods++; + } + } + } + } + classSummaryVO.setStudyVodCounts(MathUtil.intDivFloorPercent(totalStudyVods, vodDictDOS.size())); + + //平均完成时长 学生观看课程视频的全部时长/总人数 + int avg = MathUtil.intDivCeil(totalStudyLength, classMemberMappingDOS.size()); + classSummaryVO.setAvgVodPlayLength(avg); + + //测试通过率 + List exerciseDoneResultDOS = exerciseDoneResultMapper.selectList(new QueryWrapper() + .lambda() + .eq(ExerciseDoneResultDO::getClassId, classDetailDTO.getId())); + + int passNum = 0; + + for (ExerciseDoneResultDO exerciseDoneResultDO : exerciseDoneResultDOS) { + if (exerciseDoneResultDO.getRightCounts() > exerciseDoneResultDO.getTotalCounts() * 0.6) { + passNum++; + } + } + classSummaryVO.setPassRate(100 * MathUtil.intDivFloorPercent(passNum, classMemberMappingDOS.size())); + + + //平均签到数 向上取整 + //签到总次数 + Integer signCount = signInRecordMapper.selectCount(new QueryWrapper() + .lambda() + .eq(SignInRecordDO::getClassId, classDetailDTO.getId())); + classSummaryVO.setAvgSignCount(MathUtil.intDivCeil(signCount, classMemberMappingDOS.size())); + + //答疑数 + Integer count = answeringQuestionMapper.selectCount(new QueryWrapper() + .lambda() + .eq(AnsweringQuestionDO::getClassId, classDetailDTO.getId())); + classSummaryVO.setAnswerCount(count); + + return classSummaryVO; + } + + public IPage classDetail(ClassDetailDTO classDetailDTO) { + + Page pager = new Page(classDetailDTO.getPageNum(), classDetailDTO.getPageSize()); + + + IPage classDetailVOIPage = this.baseMapper.classMembers(pager, classDetailDTO.getId(), classDetailDTO.getUserName()); + List classDetailVOS = classDetailVOIPage.getRecords(); + + //课程由多少个视频 + List vodDictDOS = classDictMapper.getClassVods(classDetailDTO.getId()); + + //课程详情 + ClassDictDO classDictDO = classDictMapper.selectById(classDetailDTO.getId()); + + for (ClassDetailVO classDetailVO : classDetailVOS) { + //全部视频数 + classDetailVO.setAllVodCounts(vodDictDOS.size()); + + //该学生完成了多少个 + int i = 0; + + //该成员完成了几个视频 + for (VodDictDO vodDictDO : vodDictDOS) { + List vodPlayHistoryDOS = vodPlayHistoryMapper.selectList(new QueryWrapper() + .lambda() + .eq(VodPlayHistoryDO::getMemberId, classDetailVO.getId()) + .eq(VodPlayHistoryDO::getVodId, vodDictDO.getId()) + .orderByDesc(VodPlayHistoryDO::getPlayRecord)); + + if (vodPlayHistoryDOS.size() > 0) { + if (vodPlayHistoryDOS.get(0).getPlayRecord() > vodDictDO.getVodLength() * 0.8) { + i++; + } + } + } + classDetailVO.setStudyVodCounts(i); + + //学生测试完成情况 + ExerciseDoneResultDO exerciseDoneResultDO = exerciseDoneResultMapper.selectOne(new QueryWrapper() + .lambda() + .eq(ExerciseDoneResultDO::getCourseId, classDictDO.getCourseId()) + .eq(ExerciseDoneResultDO::getMemberId, classDetailVO.getId())); + + if (null != exerciseDoneResultDO) { + classDetailVO.setRightCounts(exerciseDoneResultDO.getRightCounts()); + classDetailVO.setTotalExeCounts(exerciseDoneResultDO.getTotalCounts()); + classDetailVO.setScore(MathUtil.intDivCeil(exerciseDoneResultDO.getRightCounts(), exerciseDoneResultDO.getTotalCounts())); + } + + //答疑 + Integer count = answeringQuestionMapper.selectCount(new QueryWrapper() + .lambda() + .eq(AnsweringQuestionDO::getAskId, classDetailVO.getId()) + .eq(AnsweringQuestionDO::getClassId, classDetailDTO.getId())); + classDetailVO.setAskCounts(count); + + //签到次数 + Integer signCount = signInRecordMapper.selectCount(new QueryWrapper() + .lambda() + .eq(SignInRecordDO::getStudentId, classDetailVO.getId()) + .eq(SignInRecordDO::getClassId, classDetailDTO.getId())); + classDetailVO.setSignCounts(signCount); + + //培训时长 + classDetailVO.setTrainingLength(i); + } + classDetailVOIPage.setRecords(classDetailVOS); + return classDetailVOIPage; + } + + public List exportClassDetail(ClassDetailDTO classDetailDTO) { + Page pager = new Page(1, 10000000); + + + IPage classDetailVOIPage = this.baseMapper.classMembers(pager, classDetailDTO.getId(), classDetailDTO.getUserName()); + List classDetailVOS = classDetailVOIPage.getRecords(); + + //课程由多少个视频 + List vodDictDOS = classDictMapper.getClassVods(classDetailDTO.getId()); + + //课程详情 + ClassDictDO classDictDO = classDictMapper.selectById(classDetailDTO.getId()); + + for (ClassDetailVO classDetailVO : classDetailVOS) { + //全部视频数 + //classDetailVO.setAllVodCounts(vodDictDOS.size()); + + //该学生完成了多少个 + int i = 0; + + //该成员完成了几个视频 + for (VodDictDO vodDictDO : vodDictDOS) { + List vodPlayHistoryDOS = vodPlayHistoryMapper.selectList(new QueryWrapper() + .lambda() + .eq(VodPlayHistoryDO::getMemberId, classDetailVO.getId()) + .eq(VodPlayHistoryDO::getVodId, vodDictDO.getId()) + .orderByDesc(VodPlayHistoryDO::getPlayRecord)); + + if (vodPlayHistoryDOS.size() > 0) { + if (vodPlayHistoryDOS.get(0).getPlayRecord() > vodDictDO.getVodLength() * 0.8) { + i++; + } + } + } + //classDetailVO.setStudyVodCounts(i); + classDetailVO.setClassProcess(i + "/" + vodDictDOS.size()); + //学生测试完成情况 + ExerciseDoneResultDO exerciseDoneResultDO = exerciseDoneResultMapper.selectOne(new QueryWrapper() + .lambda() + .eq(ExerciseDoneResultDO::getCourseId, classDictDO.getCourseId()) + .eq(ExerciseDoneResultDO::getMemberId, classDetailVO.getId())); + + if (null != exerciseDoneResultDO) { + classDetailVO.setScore(MathUtil.intDivCeil(exerciseDoneResultDO.getRightCounts(), exerciseDoneResultDO.getTotalCounts())); + } else { + classDetailVO.setScore(0); + } + + //答疑 + Integer count = answeringQuestionMapper.selectCount(new QueryWrapper() + .lambda() + .eq(AnsweringQuestionDO::getAskId, classDetailVO.getId()) + .eq(AnsweringQuestionDO::getClassId, classDetailDTO.getId())); + classDetailVO.setAskCounts(count); + + //签到次数 + Integer signCount = signInRecordMapper.selectCount(new QueryWrapper() + .lambda() + .eq(SignInRecordDO::getStudentId, classDetailVO.getId()) + .eq(SignInRecordDO::getClassId, classDetailDTO.getId())); + classDetailVO.setSignCounts(signCount); + + //培训时长 + classDetailVO.setTrainingLength(i); + } + return classDetailVOS; + } + + + public IPage signDetail(ClassDetailDTO classDetailDTO) { + + Page pager = new Page(classDetailDTO.getPageNum(), classDetailDTO.getPageSize()); + + IPage classSignVOIPage = this.baseMapper.classSign(pager, classDetailDTO.getId(), classDetailDTO.getUserName()); + List classSignVOS = classSignVOIPage.getRecords(); + + //课程由多少个视频 + List vodDictDOS = classDictMapper.getClassVods(classDetailDTO.getId()); + + for (ClassSignVO classSignVO : classSignVOS) { + + //全部视频数 + classSignVO.setAllVodCounts(vodDictDOS.size()); + + //该学生完成了多少个 + int i = 0; + + //该成员完成了几个视频 + for (VodDictDO vodDictDO : vodDictDOS) { + List vodPlayHistoryDOS = vodPlayHistoryMapper.selectList(new QueryWrapper() + .lambda() + .eq(VodPlayHistoryDO::getMemberId, classSignVO.getId()) + .eq(VodPlayHistoryDO::getVodId, vodDictDO.getId()) + .orderByDesc(VodPlayHistoryDO::getPlayRecord)); + + if (vodPlayHistoryDOS.size() > 0) { + if (vodPlayHistoryDOS.get(0).getPlayRecord() > vodDictDO.getVodLength() * 0.8) { + i++; + } + } + } + classSignVO.setStudyVodCounts(i); + + //完成率 + String percent = MathUtil.getPercentAvgIndexWithPercent(new BigDecimal(i), new BigDecimal(vodDictDOS.size())); + classSignVO.setPercent(percent); + + //签到次数 + Integer count = signInRecordMapper.selectCount(new QueryWrapper() + .lambda() + .eq(SignInRecordDO::getStudentId, classSignVO.getId()) + .eq(SignInRecordDO::getClassId, classDetailDTO.getId())); + classSignVO.setSignCounts(count); + + //培训时长 + classSignVO.setTrainingLength(i); + } + classSignVOIPage.setRecords(classSignVOS); + return classSignVOIPage; + } + + public List exportSignDetail(ClassDetailDTO classDetailDTO) { + Page pager = new Page(1, 1000000); + + IPage classSignVOIPage = this.baseMapper.classSign(pager, classDetailDTO.getId(), classDetailDTO.getUserName()); + List classSignVOS = classSignVOIPage.getRecords(); + + //课程由多少个视频 + List vodDictDOS = classDictMapper.getClassVods(classDetailDTO.getId()); + + for (ClassSignVO classSignVO : classSignVOS) { + + //全部视频数 + //classSignVO.setAllVodCounts(vodDictDOS.size()); + + //该学生完成了多少个 + int i = 0; + + //该成员完成了几个视频 + for (VodDictDO vodDictDO : vodDictDOS) { + List vodPlayHistoryDOS = vodPlayHistoryMapper.selectList(new QueryWrapper() + .lambda() + .eq(VodPlayHistoryDO::getMemberId, classSignVO.getId()) + .eq(VodPlayHistoryDO::getVodId, vodDictDO.getId()) + .orderByDesc(VodPlayHistoryDO::getPlayRecord)); + + if (vodPlayHistoryDOS.size() > 0) { + if (vodPlayHistoryDOS.get(0).getPlayRecord() > vodDictDO.getVodLength() * 0.8) { + i++; + } + } + } + //classSignVO.setStudyVodCounts(i); + classSignVO.setClassProcess(i + "/" + vodDictDOS.size()); + + //完成率 + String percent = MathUtil.getPercentAvgIndexWithPercent(new BigDecimal(i), new BigDecimal(vodDictDOS.size())); + classSignVO.setPercent(percent); + + //签到次数 + Integer count = signInRecordMapper.selectCount(new QueryWrapper() + .lambda() + .eq(SignInRecordDO::getStudentId, classSignVO.getId()) + .eq(SignInRecordDO::getClassId, classDetailDTO.getId())); + classSignVO.setSignCounts(count); + + //培训时长 + classSignVO.setTrainingLength(i); + } + return classSignVOS; + } + + + public IPage exerciseTest(ClassDetailDTO classDetailDTO) { + + Page pager = new Page(classDetailDTO.getPageNum(), classDetailDTO.getPageSize()); + + IPage exerciseTestVOIPage = this.baseMapper.exerciseTest(pager, classDetailDTO.getId(), classDetailDTO.getUserName()); + List classSignVOS = exerciseTestVOIPage.getRecords(); + + //课程详情 + ClassDictDO classDictDO = classDictMapper.selectById(classDetailDTO.getId()); + + for (ExerciseTestVO exerciseTestVO : classSignVOS) { + + //学生测试完成情况 + ExerciseDoneResultDO exerciseDoneResultDO = exerciseDoneResultMapper.selectOne(new QueryWrapper() + .lambda() + .eq(ExerciseDoneResultDO::getCourseId, classDictDO.getCourseId()) + .eq(ExerciseDoneResultDO::getMemberId, exerciseTestVO.getId())); + + if (null != exerciseDoneResultDO) { + int rights = exerciseDoneResultDO.getRightCounts(); + int total = exerciseDoneResultDO.getTotalCounts(); + int score = MathUtil.intDivCeil(rights, total); + exerciseTestVO.setScore(score); + if (score >= 60) { + exerciseTestVO.setResult("通过"); + } else { + exerciseTestVO.setResult("未通过"); + } + } else { + exerciseTestVO.setScore(0); + exerciseTestVO.setResult("未通过"); + } + } + exerciseTestVOIPage.setRecords(classSignVOS); + return exerciseTestVOIPage; + } + + public List exportExerciseTest(ClassDetailDTO classDetailDTO) { + Page pager = new Page(0, 1000000); + + IPage exerciseTestVOIPage = this.baseMapper.exerciseTest(pager, classDetailDTO.getId(), classDetailDTO.getUserName()); + List exerciseTestVOS = exerciseTestVOIPage.getRecords(); + + //课程详情 + ClassDictDO classDictDO = classDictMapper.selectById(classDetailDTO.getId()); + + for (ExerciseTestVO exerciseTestVO : exerciseTestVOS) { + + //学生测试完成情况 + ExerciseDoneResultDO exerciseDoneResultDO = exerciseDoneResultMapper.selectOne(new QueryWrapper() + .lambda() + .eq(ExerciseDoneResultDO::getCourseId, classDictDO.getCourseId()) + .eq(ExerciseDoneResultDO::getMemberId, exerciseTestVO.getId())); + + if (null != exerciseDoneResultDO) { + int rights = exerciseDoneResultDO.getRightCounts(); + int total = exerciseDoneResultDO.getTotalCounts(); + int score = MathUtil.intDivCeil(rights, total); + exerciseTestVO.setScore(score); + if (score >= 60) { + exerciseTestVO.setResult("通过"); + } else { + exerciseTestVO.setResult("未通过"); + } + } else { + exerciseTestVO.setScore(0); + exerciseTestVO.setResult("未通过"); + } + } + + return exerciseTestVOS; + } + + public IPage answerRecord(ClassDetailDTO classDetailDTO) { + Page pager = new Page(classDetailDTO.getPageNum(), classDetailDTO.getPageSize()); + return this.baseMapper.answerRecord(pager, classDetailDTO.getId(), classDetailDTO.getUserName()); + } + + public List exportAnswerRecord(ClassDetailDTO classDetailDTO) { + Page pager = new Page(1, 1000000); + IPage iPage = this.baseMapper.answerRecord(pager, classDetailDTO.getId(), classDetailDTO.getUserName()); + return iPage.getRecords(); + } + + public void export(ClassDetailDTO classDetailDTO) throws Exception { + + ServletRequestAttributes servletRequestAttributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes(); + HttpServletResponse response = servletRequestAttributes.getResponse(); + ServletOutputStream sos = response.getOutputStream(); + ZipOutputStream zipOutputStream = new ZipOutputStream(sos); + String zipname = "summary.zip"; + response.reset(); + response.setContentType(ALL_VALUE); + response.setHeader("Content-Disposition", "attachment;filename=" + new String((zipname).getBytes(), "iso-8859-1")); + + /** + * 班级成员 + */ + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + List memberList = Arrays.asList(new String[]{"成员名称", "账号", "联系方式", "签到次数", "课程进度", "培训时长", "评级测试", "答疑"}); + List classDetailVOS = exportClassDetail(classDetailDTO); + membersListExcel("班级成员", memberList, classDetailVOS, null, 0, baos); + compressFileToZipStream(zipOutputStream, baos, "member.xlsx"); + + /** + * 注册签到 + */ + ByteArrayOutputStream baos1 = new ByteArrayOutputStream(); + List signList = Arrays.asList(new String[]{"成员名称", "签到次数", "培训时长", "课程进度", "完成率"}); + List classSignVOS = exportSignDetail(classDetailDTO); + signListExcel("注册签到", signList, classSignVOS, null, 0, baos1); + compressFileToZipStream(zipOutputStream, baos1, "sign.xlsx"); + + /** + * 测试成绩 + */ + ByteArrayOutputStream baos2 = new ByteArrayOutputStream(); + List scoreList = Arrays.asList(new String[]{"成员名称", "测试结果", "最高分"}); + List exerciseTestVOS = exportExerciseTest(classDetailDTO); + testListExcel("测试成绩", scoreList, exerciseTestVOS, null, 0, baos2); + compressFileToZipStream(zipOutputStream, baos2, "test.xlsx"); + + /** + * 答疑记录 + */ + ByteArrayOutputStream baos3 = new ByteArrayOutputStream(); + List answerList = Arrays.asList(new String[]{"提问", "答疑", "提问时间", "提问成员", "答疑时间"}); + List answerRecordVOS = exportAnswerRecord(classDetailDTO); + askListExcel("答疑记录", answerList, answerRecordVOS, null, 0, baos3); + compressFileToZipStream(zipOutputStream, baos3, "answer.xlsx"); + + zipOutputStream.flush(); + zipOutputStream.closeEntry(); + + baos.close(); + baos1.close(); + baos2.close(); + baos3.close(); + + zipOutputStream.flush(); + zipOutputStream.close(); + + sos.close(); + + } + + public static void membersListExcel(String title, List headList, List classDetailVOS, String datePattern, int colWidth, OutputStream out) { + if (datePattern == null) { + datePattern = "yyyy年MM月dd日"; + } + // 声明一个工作薄 + SXSSFWorkbook workbook = new SXSSFWorkbook(1000);//缓存 + workbook.setCompressTempFiles(true); + //表头样式 + CellStyle titleStyle = workbook.createCellStyle(); + titleStyle.setAlignment(HSSFCellStyle.ALIGN_CENTER); + Font titleFont = workbook.createFont(); + titleFont.setFontHeightInPoints((short) 20); + titleFont.setBoldweight((short) 700); + titleStyle.setFont(titleFont); + // 列头样式 + CellStyle headerStyle = workbook.createCellStyle(); + headerStyle.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND); + headerStyle.setBorderBottom(HSSFCellStyle.BORDER_THIN); + headerStyle.setBorderLeft(HSSFCellStyle.BORDER_THIN); + headerStyle.setBorderRight(HSSFCellStyle.BORDER_THIN); + headerStyle.setBorderTop(HSSFCellStyle.BORDER_THIN); + headerStyle.setAlignment(HSSFCellStyle.ALIGN_CENTER); + Font headerFont = workbook.createFont(); + headerFont.setFontHeightInPoints((short) 12); + headerFont.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD); + headerStyle.setFont(headerFont); + // 单元格样式 + CellStyle cellStyle = workbook.createCellStyle(); + cellStyle.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND); + cellStyle.setBorderBottom(HSSFCellStyle.BORDER_THIN); + cellStyle.setBorderLeft(HSSFCellStyle.BORDER_THIN); + cellStyle.setBorderRight(HSSFCellStyle.BORDER_THIN); + cellStyle.setBorderTop(HSSFCellStyle.BORDER_THIN); + cellStyle.setAlignment(HSSFCellStyle.ALIGN_CENTER); + cellStyle.setVerticalAlignment(HSSFCellStyle.VERTICAL_CENTER); + Font cellFont = workbook.createFont(); + cellFont.setBoldweight(HSSFFont.BOLDWEIGHT_NORMAL); + cellStyle.setFont(cellFont); + // 生成一个(带标题)表格 + SXSSFSheet sheet = workbook.createSheet(); + //设置列宽 + int minBytes = colWidth < 17 ? 17 : colWidth;//至少字节数 + int[] arrColWidth = new int[headList.size()]; + // 产生表格标题行,以及设置列宽 + String[] headers = new String[headList.size()]; + int ii = 0; + for (int i = 0; i < headList.size(); i++) { + + headers[ii] = headList.get(i); + + int bytes = headList.get(i).getBytes().length; + arrColWidth[ii] = bytes < minBytes ? minBytes : bytes; + sheet.setColumnWidth(ii, arrColWidth[ii] * 256); + ii++; + } + // 遍历集合数据,产生数据行 + int rowIndex = 0; + for (ClassDetailVO classDetailVO : classDetailVOS) { + if (rowIndex == 65535 || rowIndex == 0) { + if (rowIndex != 0) { + sheet = workbook.createSheet();//如果数据超过了,则在第二页显示 + } + SXSSFRow titleRow = sheet.createRow(0);//表头 rowIndex=0 + titleRow.createCell(0).setCellValue(title); + titleRow.getCell(0).setCellStyle(titleStyle); + sheet.addMergedRegion(new CellRangeAddress(0, 0, 0, headList.size() - 1)); + + SXSSFRow headerRow = sheet.createRow(1); //列头 rowIndex =1 + for (int i = 0; i < headers.length; i++) { + headerRow.createCell(i).setCellValue(headers[i]); + headerRow.getCell(i).setCellStyle(headerStyle); + + } + rowIndex = 2;//数据内容从 rowIndex=2开始 + } + + SXSSFRow dataRow = sheet.createRow(rowIndex); + + SXSSFCell newCell = dataRow.createCell(0); + newCell.setCellStyle(cellStyle); + newCell.setCellValue(classDetailVO.getUserName()); + + newCell = dataRow.createCell(1); + newCell.setCellValue(classDetailVO.getAccountName()); + + newCell = dataRow.createCell(2); + newCell.setCellValue(classDetailVO.getTelephone()); + + newCell = dataRow.createCell(3); + newCell.setCellValue(classDetailVO.getSignCounts()); + + newCell = dataRow.createCell(4); + newCell.setCellValue(classDetailVO.getClassProcess()); + + newCell = dataRow.createCell(5); + newCell.setCellValue(classDetailVO.getTrainingLength()); + + newCell = dataRow.createCell(6); + newCell.setCellValue(classDetailVO.getScore()); + + newCell = dataRow.createCell(7); + newCell.setCellValue(classDetailVO.getAskCounts()); + + rowIndex++; + } + // 自动调整宽度 + /*for (int i = 0; i < headers.length; i++) { + sheet.autoSizeColumn(i); + }*/ + try { + workbook.write(out); + workbook.close(); + workbook.dispose(); + } catch (IOException e) { + e.printStackTrace(); + } + } + + public static void signListExcel(String title, List headList, List classSignVOS, String datePattern, int colWidth, OutputStream out) { + if (datePattern == null) { + datePattern = "yyyy年MM月dd日"; + } + // 声明一个工作薄 + SXSSFWorkbook workbook = new SXSSFWorkbook(1000);//缓存 + workbook.setCompressTempFiles(true); + //表头样式 + CellStyle titleStyle = workbook.createCellStyle(); + titleStyle.setAlignment(HSSFCellStyle.ALIGN_CENTER); + Font titleFont = workbook.createFont(); + titleFont.setFontHeightInPoints((short) 20); + titleFont.setBoldweight((short) 700); + titleStyle.setFont(titleFont); + // 列头样式 + CellStyle headerStyle = workbook.createCellStyle(); + headerStyle.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND); + headerStyle.setBorderBottom(HSSFCellStyle.BORDER_THIN); + headerStyle.setBorderLeft(HSSFCellStyle.BORDER_THIN); + headerStyle.setBorderRight(HSSFCellStyle.BORDER_THIN); + headerStyle.setBorderTop(HSSFCellStyle.BORDER_THIN); + headerStyle.setAlignment(HSSFCellStyle.ALIGN_CENTER); + Font headerFont = workbook.createFont(); + headerFont.setFontHeightInPoints((short) 12); + headerFont.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD); + headerStyle.setFont(headerFont); + // 单元格样式 + CellStyle cellStyle = workbook.createCellStyle(); + cellStyle.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND); + cellStyle.setBorderBottom(HSSFCellStyle.BORDER_THIN); + cellStyle.setBorderLeft(HSSFCellStyle.BORDER_THIN); + cellStyle.setBorderRight(HSSFCellStyle.BORDER_THIN); + cellStyle.setBorderTop(HSSFCellStyle.BORDER_THIN); + cellStyle.setAlignment(HSSFCellStyle.ALIGN_CENTER); + cellStyle.setVerticalAlignment(HSSFCellStyle.VERTICAL_CENTER); + Font cellFont = workbook.createFont(); + cellFont.setBoldweight(HSSFFont.BOLDWEIGHT_NORMAL); + cellStyle.setFont(cellFont); + // 生成一个(带标题)表格 + SXSSFSheet sheet = workbook.createSheet(); + //设置列宽 + int minBytes = colWidth < 17 ? 17 : colWidth;//至少字节数 + int[] arrColWidth = new int[headList.size()]; + // 产生表格标题行,以及设置列宽 + String[] headers = new String[headList.size()]; + int ii = 0; + for (int i = 0; i < headList.size(); i++) { + + headers[ii] = headList.get(i); + + int bytes = headList.get(i).getBytes().length; + arrColWidth[ii] = bytes < minBytes ? minBytes : bytes; + sheet.setColumnWidth(ii, arrColWidth[ii] * 256); + ii++; + } + // 遍历集合数据,产生数据行 + int rowIndex = 0; + for (ClassSignVO classSignVO : classSignVOS) { + if (rowIndex == 65535 || rowIndex == 0) { + if (rowIndex != 0) { + sheet = workbook.createSheet();//如果数据超过了,则在第二页显示 + } + SXSSFRow titleRow = sheet.createRow(0);//表头 rowIndex=0 + titleRow.createCell(0).setCellValue(title); + titleRow.getCell(0).setCellStyle(titleStyle); + sheet.addMergedRegion(new CellRangeAddress(0, 0, 0, headList.size() - 1)); + + SXSSFRow headerRow = sheet.createRow(1); //列头 rowIndex =1 + for (int i = 0; i < headers.length; i++) { + headerRow.createCell(i).setCellValue(headers[i]); + headerRow.getCell(i).setCellStyle(headerStyle); + + } + rowIndex = 2;//数据内容从 rowIndex=2开始 + } + + SXSSFRow dataRow = sheet.createRow(rowIndex); + + SXSSFCell newCell = dataRow.createCell(0); + newCell.setCellStyle(cellStyle); + newCell.setCellValue(classSignVO.getUserName()); + + newCell = dataRow.createCell(1); + newCell.setCellValue(classSignVO.getSignCounts()); + + newCell = dataRow.createCell(2); + newCell.setCellValue(classSignVO.getTrainingLength()); + + newCell = dataRow.createCell(3); + newCell.setCellValue(classSignVO.getClassProcess()); + + newCell = dataRow.createCell(4); + newCell.setCellValue(classSignVO.getPercent()); + + rowIndex++; + } + // 自动调整宽度 + /*for (int i = 0; i < headers.length; i++) { + sheet.autoSizeColumn(i); + }*/ + try { + workbook.write(out); + workbook.close(); + workbook.dispose(); + } catch (IOException e) { + e.printStackTrace(); + } + } + + public static void testListExcel(String title, List headList, List exerciseTestVOS, String datePattern, int colWidth, OutputStream out) { + if (datePattern == null) { + datePattern = "yyyy年MM月dd日"; + } + // 声明一个工作薄 + SXSSFWorkbook workbook = new SXSSFWorkbook(1000);//缓存 + workbook.setCompressTempFiles(true); + //表头样式 + CellStyle titleStyle = workbook.createCellStyle(); + titleStyle.setAlignment(HSSFCellStyle.ALIGN_CENTER); + Font titleFont = workbook.createFont(); + titleFont.setFontHeightInPoints((short) 20); + titleFont.setBoldweight((short) 700); + titleStyle.setFont(titleFont); + // 列头样式 + CellStyle headerStyle = workbook.createCellStyle(); + headerStyle.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND); + headerStyle.setBorderBottom(HSSFCellStyle.BORDER_THIN); + headerStyle.setBorderLeft(HSSFCellStyle.BORDER_THIN); + headerStyle.setBorderRight(HSSFCellStyle.BORDER_THIN); + headerStyle.setBorderTop(HSSFCellStyle.BORDER_THIN); + headerStyle.setAlignment(HSSFCellStyle.ALIGN_CENTER); + Font headerFont = workbook.createFont(); + headerFont.setFontHeightInPoints((short) 12); + headerFont.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD); + headerStyle.setFont(headerFont); + // 单元格样式 + CellStyle cellStyle = workbook.createCellStyle(); + cellStyle.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND); + cellStyle.setBorderBottom(HSSFCellStyle.BORDER_THIN); + cellStyle.setBorderLeft(HSSFCellStyle.BORDER_THIN); + cellStyle.setBorderRight(HSSFCellStyle.BORDER_THIN); + cellStyle.setBorderTop(HSSFCellStyle.BORDER_THIN); + cellStyle.setAlignment(HSSFCellStyle.ALIGN_CENTER); + cellStyle.setVerticalAlignment(HSSFCellStyle.VERTICAL_CENTER); + Font cellFont = workbook.createFont(); + cellFont.setBoldweight(HSSFFont.BOLDWEIGHT_NORMAL); + cellStyle.setFont(cellFont); + // 生成一个(带标题)表格 + SXSSFSheet sheet = workbook.createSheet(); + //设置列宽 + int minBytes = colWidth < 17 ? 17 : colWidth;//至少字节数 + int[] arrColWidth = new int[headList.size()]; + // 产生表格标题行,以及设置列宽 + String[] headers = new String[headList.size()]; + int ii = 0; + for (int i = 0; i < headList.size(); i++) { + + headers[ii] = headList.get(i); + + int bytes = headList.get(i).getBytes().length; + arrColWidth[ii] = bytes < minBytes ? minBytes : bytes; + sheet.setColumnWidth(ii, arrColWidth[ii] * 256); + ii++; + } + // 遍历集合数据,产生数据行 + int rowIndex = 0; + for (ExerciseTestVO exerciseTestVO : exerciseTestVOS) { + if (rowIndex == 65535 || rowIndex == 0) { + if (rowIndex != 0) { + sheet = workbook.createSheet();//如果数据超过了,则在第二页显示 + } + SXSSFRow titleRow = sheet.createRow(0);//表头 rowIndex=0 + titleRow.createCell(0).setCellValue(title); + titleRow.getCell(0).setCellStyle(titleStyle); + sheet.addMergedRegion(new CellRangeAddress(0, 0, 0, headList.size() - 1)); + + SXSSFRow headerRow = sheet.createRow(1); //列头 rowIndex =1 + for (int i = 0; i < headers.length; i++) { + headerRow.createCell(i).setCellValue(headers[i]); + headerRow.getCell(i).setCellStyle(headerStyle); + + } + rowIndex = 2;//数据内容从 rowIndex=2开始 + } + + SXSSFRow dataRow = sheet.createRow(rowIndex); + + SXSSFCell newCell = dataRow.createCell(0); + newCell.setCellStyle(cellStyle); + newCell.setCellValue(exerciseTestVO.getUserName()); + + newCell = dataRow.createCell(1); + newCell.setCellValue(exerciseTestVO.getResult()); + + newCell = dataRow.createCell(2); + newCell.setCellValue(exerciseTestVO.getScore()); + + rowIndex++; + } + // 自动调整宽度 + /*for (int i = 0; i < headers.length; i++) { + sheet.autoSizeColumn(i); + }*/ + try { + workbook.write(out); + workbook.close(); + workbook.dispose(); + } catch (IOException e) { + e.printStackTrace(); + } + } + + public static void askListExcel(String title, List headList, List answerRecordVOS, String datePattern, int colWidth, OutputStream out) { + if (datePattern == null) { + datePattern = "yyyy年MM月dd日"; + } + // 声明一个工作薄 + SXSSFWorkbook workbook = new SXSSFWorkbook(1000);//缓存 + workbook.setCompressTempFiles(true); + //表头样式 + CellStyle titleStyle = workbook.createCellStyle(); + titleStyle.setAlignment(HSSFCellStyle.ALIGN_CENTER); + Font titleFont = workbook.createFont(); + titleFont.setFontHeightInPoints((short) 20); + titleFont.setBoldweight((short) 700); + titleStyle.setFont(titleFont); + // 列头样式 + CellStyle headerStyle = workbook.createCellStyle(); + headerStyle.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND); + headerStyle.setBorderBottom(HSSFCellStyle.BORDER_THIN); + headerStyle.setBorderLeft(HSSFCellStyle.BORDER_THIN); + headerStyle.setBorderRight(HSSFCellStyle.BORDER_THIN); + headerStyle.setBorderTop(HSSFCellStyle.BORDER_THIN); + headerStyle.setAlignment(HSSFCellStyle.ALIGN_CENTER); + Font headerFont = workbook.createFont(); + headerFont.setFontHeightInPoints((short) 12); + headerFont.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD); + headerStyle.setFont(headerFont); + // 单元格样式 + CellStyle cellStyle = workbook.createCellStyle(); + cellStyle.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND); + cellStyle.setBorderBottom(HSSFCellStyle.BORDER_THIN); + cellStyle.setBorderLeft(HSSFCellStyle.BORDER_THIN); + cellStyle.setBorderRight(HSSFCellStyle.BORDER_THIN); + cellStyle.setBorderTop(HSSFCellStyle.BORDER_THIN); + cellStyle.setAlignment(HSSFCellStyle.ALIGN_CENTER); + cellStyle.setVerticalAlignment(HSSFCellStyle.VERTICAL_CENTER); + Font cellFont = workbook.createFont(); + cellFont.setBoldweight(HSSFFont.BOLDWEIGHT_NORMAL); + cellStyle.setFont(cellFont); + // 生成一个(带标题)表格 + SXSSFSheet sheet = workbook.createSheet(); + //设置列宽 + int minBytes = colWidth < 17 ? 17 : colWidth;//至少字节数 + int[] arrColWidth = new int[headList.size()]; + // 产生表格标题行,以及设置列宽 + String[] headers = new String[headList.size()]; + int ii = 0; + for (int i = 0; i < headList.size(); i++) { + + headers[ii] = headList.get(i); + + int bytes = headList.get(i).getBytes().length; + arrColWidth[ii] = bytes < minBytes ? minBytes : bytes; + sheet.setColumnWidth(ii, arrColWidth[ii] * 256); + ii++; + } + // 遍历集合数据,产生数据行 + int rowIndex = 0; + for (AnswerRecordVO answerRecordVO : answerRecordVOS) { + if (rowIndex == 65535 || rowIndex == 0) { + if (rowIndex != 0) { + sheet = workbook.createSheet();//如果数据超过了,则在第二页显示 + } + SXSSFRow titleRow = sheet.createRow(0);//表头 rowIndex=0 + titleRow.createCell(0).setCellValue(title); + titleRow.getCell(0).setCellStyle(titleStyle); + sheet.addMergedRegion(new CellRangeAddress(0, 0, 0, headList.size() - 1)); + + SXSSFRow headerRow = sheet.createRow(1); //列头 rowIndex =1 + for (int i = 0; i < headers.length; i++) { + headerRow.createCell(i).setCellValue(headers[i]); + headerRow.getCell(i).setCellStyle(headerStyle); + + } + rowIndex = 2;//数据内容从 rowIndex=2开始 + } + + SXSSFRow dataRow = sheet.createRow(rowIndex); + + SXSSFCell newCell = dataRow.createCell(0); + newCell.setCellStyle(cellStyle); + newCell.setCellValue(answerRecordVO.getTitle()); + + newCell = dataRow.createCell(1); + newCell.setCellValue(answerRecordVO.getAnswer()); + + newCell = dataRow.createCell(2); + newCell.setCellValue(answerRecordVO.getCreateDate()); + + newCell = dataRow.createCell(3); + newCell.setCellValue(answerRecordVO.getUserName()); + + newCell = dataRow.createCell(4); + newCell.setCellValue(answerRecordVO.getUpdateDate()); + + rowIndex++; + } + // 自动调整宽度 + /*for (int i = 0; i < headers.length; i++) { + sheet.autoSizeColumn(i); + }*/ + try { + workbook.write(out); + workbook.close(); + workbook.dispose(); + } catch (IOException e) { + e.printStackTrace(); + } + } + + + /** + * 压缩单个excel文件的输出流 到zip输出流,注意zipOutputStream未关闭,需要交由调用者关闭之 + * + * @param zipOutputStream zip文件的输出流 + * @param excelOutputStream excel文件的输出流 + * @param excelFilename 文件名可以带目录,例如 TestDir/test1.xlsx + */ + public static void compressFileToZipStream(ZipOutputStream zipOutputStream, + ByteArrayOutputStream excelOutputStream, String excelFilename) { + byte[] buf = new byte[1024]; + try { + // Compress the files + byte[] content = excelOutputStream.toByteArray(); + ByteArrayInputStream is = new ByteArrayInputStream(content); + BufferedInputStream bis = new BufferedInputStream(is); + // Add ZIP entry to output stream. + zipOutputStream.putNextEntry(new ZipEntry(excelFilename)); + // Transfer bytes from the file to the ZIP file + int len; + while ((len = bis.read(buf)) > 0) { + zipOutputStream.write(buf, 0, len); + } + // Complete the entry + //excelOutputStream.close();//关闭excel输出流 + //zipOutputStream.closeEntry(); + bis.close(); + is.close(); + // Complete the ZIP file + } catch (IOException e) { + e.printStackTrace(); + } + } + } diff --git a/src/main/java/com/subsidy/service/impl/AnsweringQuestionServiceImpl.java b/src/main/java/com/subsidy/service/impl/AnsweringQuestionServiceImpl.java new file mode 100644 index 0000000..fe91fc8 --- /dev/null +++ b/src/main/java/com/subsidy/service/impl/AnsweringQuestionServiceImpl.java @@ -0,0 +1,46 @@ +package com.subsidy.service.impl; + +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.subsidy.dto.GetCourseQuestionDTO; +import com.subsidy.model.AnsweringQuestionDO; +import com.subsidy.mapper.AnsweringQuestionMapper; +import com.subsidy.service.AnsweringQuestionService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.subsidy.util.ConstantUtils; +import org.springframework.stereotype.Service; + +/** + *

+ * 问题答疑表 服务实现类 + *

+ * + * @author DengMin + * @since 2021-10-14 + */ +@Service +public class AnsweringQuestionServiceImpl extends ServiceImpl implements AnsweringQuestionService { + + + public IPage getCourseQuestion(GetCourseQuestionDTO getCourseQuestionDTO) { + Page pager = new Page(getCourseQuestionDTO.getPageNum(), getCourseQuestionDTO.getPageSize()); + return this.baseMapper.getCourseQuestion(pager, getCourseQuestionDTO.getClassId(), getCourseQuestionDTO.getMemberId()); + } + + public String addQuestion(AnsweringQuestionDO answeringQuestionDO) { + this.baseMapper.insert(answeringQuestionDO); + return ConstantUtils.ADD_SUCCESS; + } + + public String deleteQuestion(AnsweringQuestionDO answeringQuestionDO) { + this.baseMapper.deleteById(answeringQuestionDO.getId()); + return ConstantUtils.DELETE_SUCCESS; + } + + public String updateQuestion(AnsweringQuestionDO answeringQuestionDO) { + this.baseMapper.updateById(answeringQuestionDO); + return ConstantUtils.SET_SUCCESS; + } + + +} diff --git a/src/main/java/com/subsidy/service/impl/CategoryServiceImpl.java b/src/main/java/com/subsidy/service/impl/CategoryServiceImpl.java index 97604dd..dbb014b 100644 --- a/src/main/java/com/subsidy/service/impl/CategoryServiceImpl.java +++ b/src/main/java/com/subsidy/service/impl/CategoryServiceImpl.java @@ -25,25 +25,54 @@ import java.util.List; @Service public class CategoryServiceImpl extends ServiceImpl implements CategoryService { - public IPage getCategories(GetCategoriesDTO getCategoriesDTO){ + public IPage getCategories(GetCategoriesDTO getCategoriesDTO) { Page pager = new Page(getCategoriesDTO.getPageNum(), getCategoriesDTO.getPageSize()); - return this.baseMapper.selectPage(pager,new QueryWrapper() - .lambda() - .like(CategoryDO::getName,getCategoriesDTO.getName())); + + if (null == getCategoriesDTO.getCompanyId()) { + return this.baseMapper.selectPage(pager, new QueryWrapper() + .lambda() + .like(CategoryDO::getName, getCategoriesDTO.getName()) + .isNull(CategoryDO::getCompanyId)); + } else { + return this.baseMapper.selectPage(pager, new QueryWrapper() + .lambda() + .like(CategoryDO::getName, getCategoriesDTO.getName()) + .eq(CategoryDO::getCompanyId, getCategoriesDTO.getCompanyId())); + } + } - public List getAll(){ - return this.baseMapper.selectList(null); + public List getAll(GetCategoriesDTO getCategoriesDTO) { + + if (null == getCategoriesDTO.getCompanyId()) { + return this.baseMapper.selectList(new QueryWrapper() + .lambda() + .isNull(CategoryDO::getCompanyId)); + } else { + return this.baseMapper.selectList(new QueryWrapper() + .lambda() + .eq(CategoryDO::getCompanyId, getCategoriesDTO.getCompanyId())); + } } - public String addCategory(CategoryDO categoryDO){ + public String addCategory(CategoryDO categoryDO) { + + int count = 0; - Integer count = this.baseMapper.selectCount(new QueryWrapper() - .lambda() - .eq(CategoryDO::getName,categoryDO.getName())); + if (null == categoryDO.getCompanyId()) { + count = this.baseMapper.selectCount(new QueryWrapper() + .lambda() + .like(CategoryDO::getName, categoryDO.getName()) + .isNull(CategoryDO::getCompanyId)); + } else { + count = this.baseMapper.selectCount(new QueryWrapper() + .lambda() + .like(CategoryDO::getName, categoryDO.getName()) + .eq(CategoryDO::getCompanyId, categoryDO.getCompanyId())); + } - if (count > 0 ){ + if (count > 0) { throw new HttpException(90001); } this.baseMapper.insert(categoryDO); @@ -51,18 +80,18 @@ public class CategoryServiceImpl extends ServiceImpl return ConstantUtils.ADD_SUCCESS; } - public String deleteCategory(CategoryDO categoryDO){ + public String deleteCategory(CategoryDO categoryDO) { this.baseMapper.deleteById(categoryDO.getId()); return ConstantUtils.DELETE_SUCCESS; } - public String updateCategory(CategoryDO categoryDO){ + public String updateCategory(CategoryDO categoryDO) { int count = this.baseMapper.selectCount(new QueryWrapper() - .lambda() - .eq(CategoryDO::getName,categoryDO.getName())); + .lambda() + .eq(CategoryDO::getName, categoryDO.getName())); - if (count>2){ + if (count > 2) { throw new HttpException(90001); } diff --git a/src/main/java/com/subsidy/service/impl/ClassDictServiceImpl.java b/src/main/java/com/subsidy/service/impl/ClassDictServiceImpl.java index c07ef76..aab829f 100644 --- a/src/main/java/com/subsidy/service/impl/ClassDictServiceImpl.java +++ b/src/main/java/com/subsidy/service/impl/ClassDictServiceImpl.java @@ -1,10 +1,14 @@ package com.subsidy.service.impl; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.subsidy.dto.classDict.AddMemberToClassDTO; +import com.subsidy.dto.classDict.GetAllClassesDTO; +import com.subsidy.dto.classDict.GetSpareMembersDTO; +import com.subsidy.mapper.AdministerMapper; import com.subsidy.mapper.ClassMemberMappingMapper; -import com.subsidy.model.ClassDictDO; +import com.subsidy.mapper.RoleAdministerMappingMapper; +import com.subsidy.model.*; import com.subsidy.mapper.ClassDictMapper; -import com.subsidy.model.ClassMemberMappingDO; import com.subsidy.service.ClassDictService; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.subsidy.util.ConstantUtils; @@ -13,6 +17,8 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import javax.management.relation.Role; +import java.util.ArrayList; import java.util.List; /** @@ -29,28 +35,58 @@ public class ClassDictServiceImpl extends ServiceImpl getAllClasses(ClassDictDO classDictDO){ + + public List getAllClasses(ClassDictDO classDictDO) { return this.baseMapper.getAllClasses(classDictDO); } @Transactional - public String deleteClasses(ClassDictDO classDictDO){ + public String deleteClasses(ClassDictDO classDictDO) { this.baseMapper.deleteById(classDictDO.getId()); classMemberMappingMapper.delete(new QueryWrapper() - .lambda() - .eq(ClassMemberMappingDO::getClassId,classDictDO.getId())); + .lambda() + .eq(ClassMemberMappingDO::getClassId, classDictDO.getId())); return ConstantUtils.DELETE_SUCCESS; } - public String addClass(ClassDictDO classDictDO){ + public String addClass(ClassDictDO classDictDO) { this.baseMapper.insert(classDictDO); return ConstantUtils.ADD_SUCCESS; } - public String updateClass(ClassDictDO classDictDO){ + public String updateClass(ClassDictDO classDictDO) { this.baseMapper.updateById(classDictDO); return ConstantUtils.SET_SUCCESS; } + public ClassDictDO classDetail(ClassDictDO classDictDO) { + return this.baseMapper.selectById(classDictDO.getId()); + } + + public String removeMember(ClassMemberMappingDO classMemberMappingDO) { + classMemberMappingMapper.delete(new QueryWrapper() + .lambda() + .eq(ClassMemberMappingDO::getClassId, classMemberMappingDO.getClassId()) + .eq(ClassMemberMappingDO::getMemberId, classMemberMappingDO.getMemberId())); + return ConstantUtils.DELETE_SUCCESS; + } + + public List getSpareMembers(GetSpareMembersDTO getSpareMembersDTO){ + return this.baseMapper.getSpareMembers(getSpareMembersDTO); + } + + public String addMemberToClass(AddMemberToClassDTO addMemberToClassDTO){ + + List memberIds = addMemberToClassDTO.getMemberIds(); + + for (Long lg : memberIds){ + ClassMemberMappingDO classMemberMappingDO = new ClassMemberMappingDO(); + classMemberMappingDO.setClassId(addMemberToClassDTO.getClassId()); + classMemberMappingDO.setMemberId(lg); + classMemberMappingMapper.insert(classMemberMappingDO); + } + return ConstantUtils.ADD_SUCCESS; + } + } diff --git a/src/main/java/com/subsidy/service/impl/CompanyDictServiceImpl.java b/src/main/java/com/subsidy/service/impl/CompanyDictServiceImpl.java new file mode 100644 index 0000000..6ceb03d --- /dev/null +++ b/src/main/java/com/subsidy/service/impl/CompanyDictServiceImpl.java @@ -0,0 +1,102 @@ +package com.subsidy.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.core.toolkit.StringUtils; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +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.model.AdministerDO; +import com.subsidy.model.CompanyDictDO; +import com.subsidy.mapper.CompanyDictMapper; +import com.subsidy.service.CompanyDictService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.subsidy.util.ConstantUtils; +import com.subsidy.vo.administer.OperatorsVO; +import org.springframework.beans.BeanUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +/** + *

+ * 企业字典表 服务实现类 + *

+ * + * @author DengMin + * @since 2021-10-25 + */ +@Service +public class CompanyDictServiceImpl extends ServiceImpl implements CompanyDictService { + + + @Autowired + private AdministerMapper administerMapper; + + public IPage operators(OperatorsDTO operatorsDTO) { + Page pager = new Page(operatorsDTO.getPageNum(), operatorsDTO.getPageSize()); + return this.baseMapper.operators(pager, operatorsDTO.getCompanyName(), operatorsDTO.getUserName(),1); + } + + public String addOperator(AddCompanyDTO addCompanyDTO) { + + Integer count = this.baseMapper.selectCount(new QueryWrapper() + .lambda() + .eq(CompanyDictDO::getCompanyName, addCompanyDTO.getAccountName())); + + Integer count1 = administerMapper.selectCount(new QueryWrapper() + .lambda() + .eq(AdministerDO::getAccountName, addCompanyDTO.getAccountName())); + + if (count > 0 || count1>0) { + throw new HttpException(20002); + } + + CompanyDictDO companyDictDO =new CompanyDictDO(); + BeanUtils.copyProperties(addCompanyDTO,companyDictDO); + this.baseMapper.insert(companyDictDO); + + AdministerDO administerDO = new AdministerDO(); + administerDO.setAccountName(addCompanyDTO.getAccountName()); + administerDO.setCompanyId(companyDictDO.getId()); + administerDO.setPassword("admin123"); + administerDO.setStatus("1"); + administerDO.setRole(1); + administerMapper.insert(administerDO); + + return ConstantUtils.ADD_SUCCESS; + } + + public String deleteAdminister(CompanyDictDO companyDictDO) { + this.baseMapper.deleteById(companyDictDO.getId()); + + administerMapper.delete(new QueryWrapper() + .lambda() + .eq(AdministerDO::getCompanyId,companyDictDO.getId())); + + return ConstantUtils.DELETE_SUCCESS; + } + + public String updateAdminister(AddCompanyDTO addCompanyDTO) { + + CompanyDictDO companyDictDO = new CompanyDictDO(); + BeanUtils.copyProperties(addCompanyDTO,companyDictDO); + this.baseMapper.updateById(companyDictDO); + + //查找企业管理员 + AdministerDO administerDO = administerMapper.selectOne(new QueryWrapper() + .lambda() + .eq(AdministerDO::getCompanyId,addCompanyDTO.getId()) + .eq(AdministerDO::getRole,1)); + if (StringUtils.isNotBlank(addCompanyDTO.getAccountName())){ + administerDO.setAccountName(addCompanyDTO.getAccountName()); + } + if (StringUtils.isBlank(addCompanyDTO.getPassword())){ + addCompanyDTO.setPassword(addCompanyDTO.getPassword()); + } + administerMapper.updateById(administerDO); + return ConstantUtils.SET_SUCCESS; + } + +} diff --git a/src/main/java/com/subsidy/service/impl/CourseContentServiceImpl.java b/src/main/java/com/subsidy/service/impl/CourseContentServiceImpl.java index 8008bc9..4ce8553 100644 --- a/src/main/java/com/subsidy/service/impl/CourseContentServiceImpl.java +++ b/src/main/java/com/subsidy/service/impl/CourseContentServiceImpl.java @@ -1,6 +1,7 @@ package com.subsidy.service.impl; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.subsidy.common.exception.HttpException; import com.subsidy.controller.CourseContentController; import com.subsidy.mapper.VodDictMapper; import com.subsidy.model.CourseContentDO; @@ -27,9 +28,6 @@ import java.util.List; @Service public class CourseContentServiceImpl extends ServiceImpl implements CourseContentService { - @Autowired - private VodDictMapper vodDictMapper; - public List getContents(CourseContentDO courseContentDO) { return this.baseMapper.selectList(new QueryWrapper() .lambda() @@ -38,5 +36,40 @@ public class CourseContentServiceImpl extends ServiceImpl courseContentDOS = this.baseMapper.selectList(new QueryWrapper() + .lambda() + .eq(CourseContentDO::getCourseId,courseContentDO.getCourseId()) + .orderByDesc(CourseContentDO::getOrderNo)); + + int orderNo = 1 ; + + if (courseContentDOS.size()>0){ + orderNo = courseContentDOS.get(0).getOrderNo()+1; + } + courseContentDO.setOrderNo(orderNo); + this.baseMapper.insert(courseContentDO); + return ConstantUtils.ADD_SUCCESS; + } + + public String updateContent(CourseContentDO courseContentDO){ + + List courseContentDOS = this.baseMapper.selectList(new QueryWrapper() + .lambda() + .eq(CourseContentDO::getCourseId,courseContentDO.getCourseId()) + .eq(CourseContentDO::getContent,courseContentDO.getContent())); + + if (courseContentDOS.size()>0){ + throw new HttpException(40001); + } + this.baseMapper.updateById(courseContentDO); + return ConstantUtils.SET_SUCCESS; + } } diff --git a/src/main/java/com/subsidy/service/impl/CourseDictServiceImpl.java b/src/main/java/com/subsidy/service/impl/CourseDictServiceImpl.java index 073d3f7..58cfff2 100644 --- a/src/main/java/com/subsidy/service/impl/CourseDictServiceImpl.java +++ b/src/main/java/com/subsidy/service/impl/CourseDictServiceImpl.java @@ -5,16 +5,27 @@ import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.subsidy.common.exception.HttpException; import com.subsidy.dto.course.QueryCoursesDTO; +import com.subsidy.mapper.AdministerMapper; +import com.subsidy.mapper.CompanyDictMapper; +import com.subsidy.mapper.RoleAdministerMappingMapper; +import com.subsidy.model.AdministerDO; +import com.subsidy.model.CompanyDictDO; import com.subsidy.model.CourseDictDO; import com.subsidy.mapper.CourseDictMapper; +import com.subsidy.model.RoleAdministerMappingDO; +import com.subsidy.service.CompanyDictService; import com.subsidy.service.CourseDictService; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.subsidy.util.ConstantUtils; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import java.util.ArrayList; +import java.util.List; + /** *

- * 服务实现类 + * 服务实现类 *

* * @author DengMin @@ -23,13 +34,33 @@ import org.springframework.stereotype.Service; @Service public class CourseDictServiceImpl extends ServiceImpl implements CourseDictService { - public String addCourse(CourseDictDO courseDictDO){ + @Autowired + private RoleAdministerMappingMapper roleAdministerMappingMapper; + + @Autowired + private AdministerMapper administerMapper; + + @Autowired + private CompanyDictMapper companyDictMapper; + + public String addCourse(CourseDictDO courseDictDO) { + + int count = 0; - int count = this.baseMapper.selectCount(new QueryWrapper() - .lambda() - .eq(CourseDictDO::getCourseName,courseDictDO.getCourseName())); + if (null != courseDictDO.getCompanyId()) { + count = this.baseMapper.selectCount(new QueryWrapper() + .lambda() + .eq(CourseDictDO::getCourseName, courseDictDO.getCourseName()) + .isNull(CourseDictDO::getCompanyId)); - if (count >0){ + } else { + count = this.baseMapper.selectCount(new QueryWrapper() + .lambda() + .eq(CourseDictDO::getCourseName, courseDictDO.getCourseName()) + .eq(CourseDictDO::getCompanyId, courseDictDO.getCompanyId())); + } + + if (count > 0) { throw new HttpException(20001); } @@ -37,27 +68,72 @@ public class CourseDictServiceImpl extends ServiceImpl() - .lambda() - .eq(CourseDictDO::getCourseName,courseDictDO.getCourseName())); + public String updateCourses(CourseDictDO courseDictDO) { + int count = 0; - if (count >1){ - throw new HttpException(20001); + if (null != courseDictDO.getCompanyId()) { + count = this.baseMapper.selectCount(new QueryWrapper() + .lambda() + .eq(CourseDictDO::getCourseName, courseDictDO.getCourseName()) + .ne(CourseDictDO::getId, courseDictDO.getCompanyId())); + + } else { + count = this.baseMapper.selectCount(new QueryWrapper() + .lambda() + .eq(CourseDictDO::getCourseName, courseDictDO.getCourseName()) + .isNull(CourseDictDO::getCompanyId)); } + if (count > 0) { + throw new HttpException(20001); + } this.baseMapper.updateById(courseDictDO); return ConstantUtils.DELETE_SUCCESS; } + public IPage queryCompanyCourse(QueryCoursesDTO queryCoursesDTO) { + Page pager = new Page(queryCoursesDTO.getPageNum(), queryCoursesDTO.getPageSize()); + + ////判断角色 + //List roleAdministerMappingDOS = roleAdministerMappingMapper.selectList(new QueryWrapper() + //.lambda() + //.eq(RoleAdministerMappingDO::getAdministerId,roleAdministerMappingMapper)); + // + //Boolean flag = false; + //for (RoleAdministerMappingDO roleAdministerMappingDO : roleAdministerMappingDOS){ + // + // if (roleAdministerMappingDO.getRoleId() ==3){ + // flag= false; + // }else if(roleAdministerMappingDO.getRoleId()==2) { + // flag = true; + // } + //} + + //List longs = new ArrayList<>(); + //if (flag){ + // //运营者账号 该企业下的所有课程 管理员 + // //获取该企业下所有老师的课程 + // AdministerDO administerDO = administerMapper.selectById(queryCoursesDTO.getAdministerId()); + // + // List administerDOS = administerMapper.selectList(new QueryWrapper() + // .lambda() + // .eq(AdministerDO::getCompanyId,administerDO.getCompanyId())); + // for (AdministerDO administerDO1 : administerDOS){ + // longs.add(administerDO1.getId()); + // } + return this.baseMapper.queryCompanyCourse(pager, queryCoursesDTO.getCourseName(), queryCoursesDTO.getCategoryId(), queryCoursesDTO.getCourseType(), queryCoursesDTO.getCourseSource(), queryCoursesDTO.getCompanyId()); + //} + + } + } diff --git a/src/main/java/com/subsidy/service/impl/ExerciseDictServiceImpl.java b/src/main/java/com/subsidy/service/impl/ExerciseDictServiceImpl.java index 6473d47..ffd3268 100644 --- a/src/main/java/com/subsidy/service/impl/ExerciseDictServiceImpl.java +++ b/src/main/java/com/subsidy/service/impl/ExerciseDictServiceImpl.java @@ -4,14 +4,22 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.subsidy.dto.exercise.GetAllExercisesDTO; +import com.subsidy.dto.exercise.SubmitDTO; +import com.subsidy.mapper.ExerciseDoneResultMapper; +import com.subsidy.model.CourseDictDO; import com.subsidy.model.ExerciseDictDO; import com.subsidy.mapper.ExerciseDictMapper; +import com.subsidy.model.ExerciseDoneResultDO; import com.subsidy.service.ExerciseDictService; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.subsidy.util.ConstantUtils; -import org.apache.tomcat.util.bcel.Const; +import com.subsidy.vo.course.ExerciseVO; +import com.subsidy.vo.exercise.MemberExerciseVO; +import org.springframework.beans.BeanUtils; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import java.util.ArrayList; import java.util.List; /** @@ -25,6 +33,9 @@ import java.util.List; @Service public class ExerciseDictServiceImpl extends ServiceImpl implements ExerciseDictService { + @Autowired + private ExerciseDoneResultMapper exerciseDoneResultMapper; + public IPage getAllExercises(GetAllExercisesDTO getAllExercisesDTO) { Page pager = new Page(getAllExercisesDTO.getPageNum(), getAllExercisesDTO.getPageSize()); @@ -34,7 +45,7 @@ public class ExerciseDictServiceImpl extends ServiceImpl getCourseExercises(CourseDictDO courseDictDO){ + + List exerciseVOS = new ArrayList<>(); + + List exerciseDictDOS = this.baseMapper.selectList(new QueryWrapper() + .lambda() + .eq(ExerciseDictDO::getCourseId,courseDictDO.getId())); + + for (ExerciseDictDO exerciseDictDO : exerciseDictDOS){ + ExerciseVO exerciseVO = new ExerciseVO(); + BeanUtils.copyProperties(exerciseDictDO,exerciseVO); + exerciseVOS.add(exerciseVO); + } + return exerciseVOS; + } + + public String submit(SubmitDTO submitDTO){ + + ExerciseDoneResultDO exerciseDoneResultDO = new ExerciseDoneResultDO(); + + List memberExerciseVOS = submitDTO.getMemberExerciseVOS(); + + int rightCounts = 0 ; + + for (MemberExerciseVO exerciseVO : memberExerciseVOS){ + ExerciseDictDO exerciseDictDO = this.baseMapper.selectById(exerciseVO.getId()); + if (exerciseDictDO.getRightAnswer().equals(exerciseVO.getSelectAnswer())){ + rightCounts++; + } + } + + exerciseDoneResultDO.setClassId(submitDTO.getClassId()); + exerciseDoneResultDO.setRightCounts(rightCounts); + exerciseDoneResultDO.setTotalCounts(memberExerciseVOS.size()); + exerciseDoneResultDO.setCourseId(submitDTO.getCourseId()); + exerciseDoneResultDO.setMemberId(submitDTO.getMemberId()); + + exerciseDoneResultMapper.delete(new QueryWrapper() + .lambda() + .eq(ExerciseDoneResultDO::getMemberId,submitDTO.getMemberId()) + .eq(ExerciseDoneResultDO::getCourseId,submitDTO.getCourseId())); + + exerciseDoneResultMapper.insert(exerciseDoneResultDO); + + return ConstantUtils.COMMIT_SUCCESS; + } + } diff --git a/src/main/java/com/subsidy/service/impl/ExerciseDoneResultServiceImpl.java b/src/main/java/com/subsidy/service/impl/ExerciseDoneResultServiceImpl.java new file mode 100644 index 0000000..3575d56 --- /dev/null +++ b/src/main/java/com/subsidy/service/impl/ExerciseDoneResultServiceImpl.java @@ -0,0 +1,20 @@ +package com.subsidy.service.impl; + +import com.subsidy.model.ExerciseDoneResultDO; +import com.subsidy.mapper.ExerciseDoneResultMapper; +import com.subsidy.service.ExerciseDoneResultService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +/** + *

+ * 学生课程习题完成情况 服务实现类 + *

+ * + * @author DengMin + * @since 2021-10-15 + */ +@Service +public class ExerciseDoneResultServiceImpl extends ServiceImpl implements ExerciseDoneResultService { + +} diff --git a/src/main/java/com/subsidy/service/impl/MemberServiceImpl.java b/src/main/java/com/subsidy/service/impl/MemberServiceImpl.java index 2ec38f9..ef51d11 100644 --- a/src/main/java/com/subsidy/service/impl/MemberServiceImpl.java +++ b/src/main/java/com/subsidy/service/impl/MemberServiceImpl.java @@ -4,13 +4,28 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.subsidy.common.exception.HttpException; +import com.subsidy.dto.administer.VerifyCodeDTO; +import com.subsidy.dto.member.ContentMemberDTO; import com.subsidy.dto.member.GetAllDTO; -import com.subsidy.model.MemberDO; -import com.subsidy.mapper.MemberMapper; +import com.subsidy.dto.member.StudyHistoryDTO; +import com.subsidy.mapper.*; +import com.subsidy.model.*; import com.subsidy.service.MemberService; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.subsidy.util.ConstantUtils; +import com.subsidy.util.MathUtil; +import com.subsidy.vo.administer.UserRoleVO; +import com.subsidy.vo.member.*; +import com.subsidy.vo.vod.StudyHistoryVO; +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.time.Duration; +import java.time.LocalDateTime; +import java.util.ArrayList; +import java.util.List; /** *

@@ -23,10 +38,50 @@ import org.springframework.stereotype.Service; @Service public class MemberServiceImpl extends ServiceImpl implements MemberService { + @Autowired + private SmsVerifyCodeMapper smsVerifyCodeMapper; + + @Autowired + private CourseContentMapper courseContentMapper; + + @Autowired + private VodPlayHistoryMapper vodPlayHistoryMapper; + + @Autowired + private CourseDictMapper courseDictMapper; + + @Autowired + private VodDictMapper vodDictMapper; + + @Autowired + private FileDictMapper fileDictMapper; + + @Autowired + private ExerciseDoneResultMapper exerciseDoneResultMapper; + + @Autowired + private ExerciseDictMapper exerciseDictMapper; + + @Autowired + private DepartmentDictMapper departmentDictMapper; + + @Autowired + private AdministerMapper administerMapper; + + @Autowired + private ClassMemberMappingMapper classMemberMappingMapper; + + @Autowired + private ClassDictMapper classDictMapper; + + @Autowired + private CompanyDictMapper companyDictMapper; + public IPage getAll(GetAllDTO getAllDTO) { Page pager = new Page(getAllDTO.getPageNum(), getAllDTO.getPageSize()); return this.baseMapper.selectPage(pager, new QueryWrapper() .lambda() + .eq(MemberDO::getDepartmentId,getAllDTO.getDepartmentId()) .like(MemberDO::getUserName, getAllDTO.getUserName()) .like(MemberDO::getStatus, getAllDTO.getStatus())); } @@ -49,7 +104,7 @@ public class MemberServiceImpl extends ServiceImpl imple Integer count1 = this.baseMapper.selectCount(new QueryWrapper() .lambda() - .eq(MemberDO::getIdCard, memberDO.getIdCard()) + .eq(MemberDO::getAccountName, memberDO.getAccountName()) .eq(MemberDO::getDepartmentId, memberDO.getDepartmentId())); if (count1 > 0) { @@ -76,7 +131,7 @@ public class MemberServiceImpl extends ServiceImpl imple Integer count1 = this.baseMapper.selectCount(new QueryWrapper() .lambda() - .eq(MemberDO::getIdCard, memberDO.getIdCard()) + .eq(MemberDO::getAccountName, memberDO.getAccountName()) .eq(MemberDO::getDepartmentId, memberDO.getDepartmentId()) .ne(MemberDO::getId, memberDO.getId())); @@ -87,4 +142,297 @@ public class MemberServiceImpl extends ServiceImpl imple return ConstantUtils.SET_SUCCESS; } + @Override + @Transactional(rollbackFor = Exception.class) + public UserRoleVO login(VerifyCodeDTO verifyCodeDTO) { + UserRoleVO userRoleVO = new UserRoleVO(); + MemberDO userRoleDO = this.baseMapper.selectOne(new QueryWrapper() + .lambda() + .eq(MemberDO::getTelephone, verifyCodeDTO.getTelephone())); + if (userRoleDO == null) { + throw new HttpException(10010); + } + BeanUtils.copyProperties(userRoleDO, userRoleVO); + + SmsVerifyCodeDO smsCodeDO = smsVerifyCodeMapper.selectOne(new QueryWrapper() + .lambda() + .eq(SmsVerifyCodeDO::getTelephone, verifyCodeDTO.getTelephone()) + .eq(SmsVerifyCodeDO::getVerifyCode, verifyCodeDTO.getVerifyCode())); + if (smsCodeDO == null) { + throw new HttpException(70010); + } + return userRoleVO; + } + + public UserRoleVO passwordLogin(MemberDO memberDO) { + UserRoleVO userRoleVO = new UserRoleVO(); + MemberDO memberDO1 = this.baseMapper.selectOne(new QueryWrapper() + .lambda() + .eq(MemberDO::getPassword, memberDO.getPassword()) + .eq(MemberDO::getAccountName, memberDO.getAccountName())); + if (memberDO1 == null) { + throw new HttpException(10004); + } + BeanUtils.copyProperties(memberDO1, userRoleVO); + return userRoleVO; + } + + public String updatePassword(MemberDO memberDO){ + this.baseMapper.updateById(memberDO); + return ConstantUtils.SET_SUCCESS; + } + + public MemberStudyPageVO studyPage(MemberDO memberDO) { + + MemberStudyPageVO memberStudyPageVO = new MemberStudyPageVO(); + + List studyPageVOS = this.baseMapper.studyPage(memberDO); + + for (StudyPageVO studyPageVO : studyPageVOS) { + + //查看课程下有几节课 + List vodDictDOS = courseContentMapper.getCourseVods(studyPageVO.getId()); + studyPageVO.setTotalVods(vodDictDOS.size()); + + int i = 0; + + //该成员完成了几个视频 + for (VodDictDO vodDictDO : vodDictDOS) { + List vodPlayHistoryDOS = vodPlayHistoryMapper.selectList(new QueryWrapper() + .lambda() + .eq(VodPlayHistoryDO::getMemberId, memberDO.getId()) + .eq(VodPlayHistoryDO::getVodId, vodDictDO.getId()) + .orderByDesc(VodPlayHistoryDO::getPlayRecord)); + + if (vodPlayHistoryDOS.size() > 0) { + if (vodPlayHistoryDOS.get(0).getPlayRecord() > vodDictDO.getVodLength() * 0.8) { + i++; + } + } + } + studyPageVO.setDoneVods(i); + + //该班级课程下有多少人 + List classMemberMappingDOS = classMemberMappingMapper.selectList(new QueryWrapper() + .lambda() + .eq(ClassMemberMappingDO::getClassId,studyPageVO.getClassId())); + studyPageVO.setTotalMember(classMemberMappingDOS.size()); + + //多少人完成 + int completedCnt = 0; + for (ClassMemberMappingDO cmmd : classMemberMappingDOS) { + + Boolean flag = true; + + for (VodDictDO vodDictDO : vodDictDOS) { + List vodPlayHistoryDOS = vodPlayHistoryMapper.selectList(new QueryWrapper() + .lambda() + .eq(VodPlayHistoryDO::getVodId, vodDictDO.getId()) + .eq(VodPlayHistoryDO::getMemberId, cmmd.getMemberId()) + .orderByDesc(VodPlayHistoryDO::getPlayRecord)); + if (vodPlayHistoryDOS.size() > 0) { + if (vodPlayHistoryDOS.get(0).getPlayRecord() < vodDictDO.getVodLength()) { + flag = false; + break; + } + } + } + if (flag) { + completedCnt++; + } + } + studyPageVO.setDoneMember(completedCnt); + } + + memberStudyPageVO.setStudyPageVOS(studyPageVOS); + + MemberDO memberDO1 = this.baseMapper.selectById(memberDO.getId()); + DepartmentDictDO departmentDictDO = departmentDictMapper.selectById(memberDO1.getDepartmentId()); + CompanyDictDO companyDictDO = companyDictMapper.selectById(departmentDictDO.getCompanyId()); + if (null!=companyDictDO){ + BeanUtils.copyProperties(companyDictDO,memberStudyPageVO); + } + + return memberStudyPageVO; + } + + public List contentVod(ContentMemberDTO contentVodDTO) { + + List contentVodVOS = new ArrayList<>(); + List courseContentDOS = courseContentMapper.selectList(new QueryWrapper() + .lambda() + .eq(CourseContentDO::getCourseId, contentVodDTO.getCourseId()) + .orderByAsc(CourseContentDO::getOrderNo)); + + for (CourseContentDO courseContentDO : courseContentDOS) { + ContentVodVO contentVodVO = new ContentVodVO(); + contentVodVO.setContent(courseContentDO.getContent()); + + List memberVodVOS = new ArrayList<>(); + + //目录下的视频 + List vodDictDOS = vodDictMapper.selectList(new QueryWrapper() + .lambda() + .eq(VodDictDO::getContentId,courseContentDO.getId())); + for (VodDictDO vodDictDO : vodDictDOS){ + MemberVodVO memberVodVO = new MemberVodVO(); + List vodPlayHistoryDOS = vodPlayHistoryMapper.selectList(new QueryWrapper() + .lambda() + .eq(VodPlayHistoryDO::getMemberId,contentVodDTO.getMemberId()) + .eq(VodPlayHistoryDO::getVodId,vodDictDO.getId()) + .orderByDesc(VodPlayHistoryDO::getPlayRecord)); + + memberVodVO.setStatus(false); + if (vodPlayHistoryDOS.size()>0){ + memberVodVO.setPercent(MathUtil.intDivCeil(100*vodPlayHistoryDOS.get(0).getPlayRecord(),vodDictDO.getVodLength())); + if (memberVodVO.getPercent()>=80){ + memberVodVO.setStatus(true); + } + }else { + memberVodVO.setPercent(0); + } + List vodPlayHistoryDOS1 = vodPlayHistoryMapper.selectList(new QueryWrapper() + .lambda() + .eq(VodPlayHistoryDO::getMemberId,contentVodDTO.getMemberId()) + .eq(VodPlayHistoryDO::getVodId,vodDictDO.getId()) + .orderByDesc(VodPlayHistoryDO::getCreateDate)); + if (vodPlayHistoryDOS1.size()>0){ + memberVodVO.setPlayRecord(vodPlayHistoryDOS1.get(0).getPlayRecord()); + } + memberVodVO.setId(vodDictDO.getId()); + memberVodVO.setVodUrl(vodDictDO.getVodUrl()); + memberVodVO.setTeacherName(vodDictDO.getTeacherName()); + memberVodVO.setVodLength(vodDictDO.getVodLength()); + memberVodVO.setVodName(vodDictDO.getVodName()); + memberVodVOS.add(memberVodVO); + } + contentVodVO.setMemberVodVOS(memberVodVOS); + contentVodVOS.add(contentVodVO); + } + + return contentVodVOS; + } + + public List contentFiles(ContentMemberDTO contentMemberDTO){ + + List contentFilesVOS = new ArrayList<>(); + + List courseContentDOS = courseContentMapper.selectList(new QueryWrapper() + .lambda() + .eq(CourseContentDO::getCourseId, contentMemberDTO.getCourseId()) + .orderByAsc(CourseContentDO::getOrderNo)); + + for (CourseContentDO courseContentDO : courseContentDOS) { + + ContentFilesVO contentFilesVO = new ContentFilesVO(); + contentFilesVO.setContent(courseContentDO.getContent()); + + List fileDictDOS = fileDictMapper.selectList(new QueryWrapper() + .lambda() + .eq(FileDictDO::getContentId,courseContentDO.getId())); + contentFilesVO.setFileDictDOS(fileDictDOS); + + contentFilesVOS.add(contentFilesVO); + } + + return contentFilesVOS; + } + + public IPage studyHistory(StudyHistoryDTO studyHistoryDTO){ + Page pager = new Page(studyHistoryDTO.getPageNum(), studyHistoryDTO.getPageSize()); + + IPage iPage = vodPlayHistoryMapper.studyHistory(pager,studyHistoryDTO.getMemberId()); + + List studyHistoryVOS = iPage.getRecords(); + + for (StudyHistoryVO studyHistoryVO : studyHistoryVOS){ + if (studyHistoryVO.getPercent()>=80){ + studyHistoryVO.setStatus(true); + }else { + studyHistoryVO.setStatus(false); + } + } + iPage.setRecords(studyHistoryVOS); + + return iPage; + } + + public GetCourseTestVO getCourseTest(ContentMemberDTO contentMemberDTO){ + + GetCourseTestVO getCourseTestVO = new GetCourseTestVO(); + + CourseDictDO courseDictDO = courseDictMapper.selectById(contentMemberDTO.getCourseId()); + getCourseTestVO.setCourseId(courseDictDO.getId()); + getCourseTestVO.setCourseName(courseDictDO.getCourseName()); + getCourseTestVO.setDeadline(courseDictDO.getDeadline().toString().replace("T"," ")); + + ExerciseDoneResultDO exerciseDoneResultDO = exerciseDoneResultMapper.selectOne(new QueryWrapper() + .lambda() + .eq(ExerciseDoneResultDO::getCourseId,contentMemberDTO.getCourseId()) + .eq(ExerciseDoneResultDO::getMemberId,contentMemberDTO.getMemberId())); + + if (null != exerciseDoneResultDO){ + getCourseTestVO.setRightCount(String.valueOf(exerciseDoneResultDO.getRightCounts())); + getCourseTestVO.setTotalCount(String.valueOf(exerciseDoneResultDO.getTotalCounts())); + }else { + getCourseTestVO.setRightCount("-"); + //该课程下有多少习题 + Integer count = exerciseDictMapper.selectCount(new QueryWrapper() + .lambda() + .eq(ExerciseDictDO::getCourseId,contentMemberDTO.getCourseId())); + getCourseTestVO.setTotalCount(String.valueOf(count)); + } + return getCourseTestVO; + } + + public GetStudyInfoVO getStudyInfo(MemberDO memberDO){ + + GetStudyInfoVO getStudyInfoVO = new GetStudyInfoVO(); + + MemberDO memberDO1 = this.baseMapper.selectById(memberDO.getId()); + + //第几天 + long diff = Duration.between(LocalDateTime.now(),memberDO1.getCreateDate()).toDays(); + getStudyInfoVO.setDiff(diff); + + //已学课程 + List classMemberMappingDOS = classMemberMappingMapper.selectList(new QueryWrapper() + .lambda() + .eq(ClassMemberMappingDO::getMemberId,memberDO.getId())); + /** + * 遍历课程,里面的视频都看过80% 则表示已学完 + */ + int i = 0 ; //已学课程 + for (ClassMemberMappingDO classMemberMappingDO : classMemberMappingDOS){ + List vodDictDOS = classDictMapper.getClassVods(classMemberMappingDO.getClassId()); + for (VodDictDO vodDictDO : vodDictDOS){ + List vodPlayHistoryDOS = vodPlayHistoryMapper.selectList(new QueryWrapper() + .lambda() + .eq(VodPlayHistoryDO::getMemberId,memberDO.getId()) + .eq(VodPlayHistoryDO::getVodId,vodDictDO.getId()) + .orderByDesc(VodPlayHistoryDO::getPlayRecord)); + if (vodPlayHistoryDOS.size()>0){ + if (vodPlayHistoryDOS.get(0).getPlayRecord() vodPlayHistoryDOS = vodPlayHistoryMapper.selectList(new QueryWrapper() + .lambda() + .eq(VodPlayHistoryDO::getMemberId,memberDO.getId())); + + for (VodPlayHistoryDO vodPlayHistoryDO : vodPlayHistoryDOS){ + studyLength+=vodPlayHistoryDO.getPlayLength(); + } + getStudyInfoVO.setStudyLength(studyLength); + + return getStudyInfoVO; + } + } diff --git a/src/main/java/com/subsidy/service/impl/SignInRecordServiceImpl.java b/src/main/java/com/subsidy/service/impl/SignInRecordServiceImpl.java new file mode 100644 index 0000000..5527712 --- /dev/null +++ b/src/main/java/com/subsidy/service/impl/SignInRecordServiceImpl.java @@ -0,0 +1,160 @@ +package com.subsidy.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.subsidy.dto.member.GetMemberSignInfoDTO; +import com.subsidy.dto.sign.ClassSignInfoDTO; +import com.subsidy.dto.sign.SignInDTO; +import com.subsidy.mapper.*; +import com.subsidy.model.*; +import com.subsidy.service.SignInRecordService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.subsidy.util.ConstantUtils; +import com.subsidy.util.MathUtil; +import com.subsidy.vo.member.GetMemberSignInfoVO; +import com.subsidy.vo.sign.ClassSignInfoVO; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + *

+ * 学生签到表 服务实现类 + *

+ * + * @author DengMin + * @since 2021-10-18 + */ +@Service +public class SignInRecordServiceImpl extends ServiceImpl implements SignInRecordService { + + @Autowired + private ClassMemberMappingMapper classMemberMappingMapper; + + @Autowired + private ClassDictMapper classDictMapper; + + @Autowired + private VodPlayHistoryMapper vodPlayHistoryMapper; + + @Autowired + private ExerciseDoneResultMapper exerciseDoneResultMapper; + + @Autowired + private AnsweringQuestionMapper answeringQuestionMapper; + + public IPage getMemberSignInfo(GetMemberSignInfoDTO getMemberSignInfoDTO) { + Page pager = new Page(getMemberSignInfoDTO.getPageNum(), getMemberSignInfoDTO.getPageSize()); + + return this.baseMapper.selectPage(pager, new QueryWrapper() + .lambda() + .eq(SignInRecordDO::getStudentId, getMemberSignInfoDTO.getId()) + .orderByDesc(SignInRecordDO::getCreateDate)); + } + + public String signIn(SignInRecordDO signInRecordDO) { + + /** + * 查看学生打卡记录 + */ + List signInRecordDOS = this.baseMapper.selectList(new QueryWrapper() + .lambda() + .eq(SignInRecordDO::getStudentId, signInRecordDO.getStudentId())); + + /** + * 查看学生所有在读班级 + */ + + if (signInRecordDOS.size() == 0) { + this.baseMapper.insert(signInRecordDO); + return ConstantUtils.ADD_SUCCESS; + } else { + //不用签到 + return ""; + } + } + + public IPage classSignInfo(ClassSignInfoDTO classSignInfoDTO) { + + Page pager = new Page(classSignInfoDTO.getPageNum(), classSignInfoDTO.getPageSize()); + + IPage classSignInfoVOIPage = this.baseMapper.classSignInfo(pager, classSignInfoDTO.getClassName(), classSignInfoDTO.getCourseName(),classSignInfoDTO.getId()); + List classSignInfoVOS = classSignInfoVOIPage.getRecords(); + + for (ClassSignInfoVO classSignInfoVO : classSignInfoVOS){ + + //班级人数 + List classMemberMappingDOS = classMemberMappingMapper.selectList(new QueryWrapper() + .lambda() + .eq(ClassMemberMappingDO::getClassId,classSignInfoVO.getClassId())); + + classSignInfoVO.setMemberCount(classMemberMappingDOS.size()); + + + //课程总数 + List vodDictDOS = classDictMapper.getClassVods(classSignInfoVO.getClassId()); + classSignInfoVO.setTotalVodCounts(vodDictDOS.size()); + + + int totalStudyVods = 0; + int totalStudyLength = 0 ; + //学生总共学习课时数 + for (VodDictDO vodDictDO : vodDictDOS) { + for (ClassMemberMappingDO classMemberMappingDO : classMemberMappingDOS) { + List vodPlayHistoryDOS = vodPlayHistoryMapper.selectList(new QueryWrapper() + .lambda() + .eq(VodPlayHistoryDO::getMemberId, classMemberMappingDO.getId()) + .eq(VodPlayHistoryDO::getVodId, vodDictDO.getId()) + .orderByDesc(VodPlayHistoryDO::getPlayRecord)); + for (VodPlayHistoryDO vodPlayHistoryDO : vodPlayHistoryDOS){ + totalStudyLength+=vodPlayHistoryDO.getPlayLength(); + } + if (vodPlayHistoryDOS.size() > 0) { + if (vodPlayHistoryDOS.get(0).getPlayRecord() > vodDictDO.getVodLength() * 0.8) { + totalStudyVods++; + } + } + } + } + classSignInfoVO.setStudyVodCounts(MathUtil.intDivFloorPercent(totalStudyVods, vodDictDOS.size())); + + //平均完成时长 学生观看课程视频的全部时长/总人数 + int avg = MathUtil.intDivCeil(totalStudyLength,classMemberMappingDOS.size()); + classSignInfoVO.setAvgVodPlayLength(avg); + + //测试通过率 + List exerciseDoneResultDOS = exerciseDoneResultMapper.selectList(new QueryWrapper() + .lambda() + .eq(ExerciseDoneResultDO::getClassId, classSignInfoVO.getClassId())); + + int passNum = 0; + + for (ExerciseDoneResultDO exerciseDoneResultDO : exerciseDoneResultDOS) { + if (exerciseDoneResultDO.getRightCounts() > exerciseDoneResultDO.getTotalCounts()*0.6){ + passNum++; + } + } + classSignInfoVO.setPassRate(100* MathUtil.intDivFloorPercent(passNum,classMemberMappingDOS.size())); + + + //平均签到数 向上取整 + //签到总次数 + Integer signCount = this.baseMapper.selectCount(new QueryWrapper() + .lambda() + .eq(SignInRecordDO::getClassId,classSignInfoVO.getClassId())); + classSignInfoVO.setAvgSignCount(MathUtil.intDivCeil(signCount,classMemberMappingDOS.size())); + + //答疑数 + Integer count = answeringQuestionMapper.selectCount(new QueryWrapper() + .lambda() + .eq(AnsweringQuestionDO::getClassId, classSignInfoVO.getClassId())); + classSignInfoVO.setAnswerCount(count); + } + + classSignInfoVOIPage.setRecords(classSignInfoVOS); + return classSignInfoVOIPage; + } + +} diff --git a/src/main/java/com/subsidy/service/impl/SmsVerifyCodeServiceImpl.java b/src/main/java/com/subsidy/service/impl/SmsVerifyCodeServiceImpl.java new file mode 100644 index 0000000..c135d69 --- /dev/null +++ b/src/main/java/com/subsidy/service/impl/SmsVerifyCodeServiceImpl.java @@ -0,0 +1,55 @@ +package com.subsidy.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.subsidy.common.exception.HttpException; +import com.subsidy.dto.sms.SendVerifyCodeDTO; +import com.subsidy.mapper.MemberMapper; +import com.subsidy.model.MemberDO; +import com.subsidy.model.SmsVerifyCodeDO; +import com.subsidy.mapper.SmsVerifyCodeMapper; +import com.subsidy.service.MemberService; +import com.subsidy.service.SmsVerifyCodeService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.subsidy.util.RandomUtil; +import com.subsidy.util.SMSUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.lang.reflect.Member; + +/** + *

+ * 短信验证码记录表 服务实现类 + *

+ * + * @author DengMin + * @since 2021-10-14 + */ +@Service +public class SmsVerifyCodeServiceImpl extends ServiceImpl implements SmsVerifyCodeService { + + @Autowired + private SMSUtils smsUtils; + + @Autowired + private MemberMapper memberMapper; + + public void sendVerifyCode(SendVerifyCodeDTO sendVerifyCodeDTO){ + MemberDO memberDO =memberMapper.selectOne(new QueryWrapper() + .lambda() + .eq(MemberDO::getTelephone, sendVerifyCodeDTO.getTelephone())); + if(memberDO == null) { + throw new HttpException(70012); + } + + String code = RandomUtil.getRandomCode(6); + smsUtils.send(sendVerifyCodeDTO.getTelephone(), code); + + SmsVerifyCodeDO smsCodeDO = new SmsVerifyCodeDO(); + smsCodeDO.setVerifyCode(code); + smsCodeDO.setTelephone(sendVerifyCodeDTO.getTelephone()); + this.baseMapper.insert(smsCodeDO); + + } + +} diff --git a/src/main/java/com/subsidy/service/impl/VodDictServiceImpl.java b/src/main/java/com/subsidy/service/impl/VodDictServiceImpl.java index df13404..d3bc1a3 100644 --- a/src/main/java/com/subsidy/service/impl/VodDictServiceImpl.java +++ b/src/main/java/com/subsidy/service/impl/VodDictServiceImpl.java @@ -1,6 +1,9 @@ package com.subsidy.service.impl; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.subsidy.common.configure.VODConfig; +import com.subsidy.dto.content.GetContendVodsDTO; import com.subsidy.model.VodDictDO; import com.subsidy.mapper.VodDictMapper; import com.subsidy.service.VodDictService; @@ -52,8 +55,9 @@ public class VodDictServiceImpl extends ServiceImpl im return signatureVO; } - public List getContendVods(VodDictDO vodDictDO) { - return this.baseMapper.getContendVods(vodDictDO); + public IPage getContendVods(GetContendVodsDTO getContendVodsDTO) { + Page pager = new Page(getContendVodsDTO.getPageNum(), getContendVodsDTO.getPageSize()); + return this.baseMapper.getContendVods(pager,getContendVodsDTO.getVodName(),getContendVodsDTO.getContentId()); } public String deleteVod(VodDictDO vodDictDO) { diff --git a/src/main/java/com/subsidy/service/impl/VodPlayHistoryServiceImpl.java b/src/main/java/com/subsidy/service/impl/VodPlayHistoryServiceImpl.java new file mode 100644 index 0000000..b29fe46 --- /dev/null +++ b/src/main/java/com/subsidy/service/impl/VodPlayHistoryServiceImpl.java @@ -0,0 +1,26 @@ +package com.subsidy.service.impl; + +import com.subsidy.model.VodPlayHistoryDO; +import com.subsidy.mapper.VodPlayHistoryMapper; +import com.subsidy.service.VodPlayHistoryService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.subsidy.util.ConstantUtils; +import org.springframework.stereotype.Service; + +/** + *

+ * 视频播放历史记录表 服务实现类 + *

+ * + * @author DengMin + * @since 2021-10-14 + */ +@Service +public class VodPlayHistoryServiceImpl extends ServiceImpl implements VodPlayHistoryService { + + public String insertHistory(VodPlayHistoryDO vodPlayHistoryDO) { + this.baseMapper.insert(vodPlayHistoryDO); + return ConstantUtils.ADD_SUCCESS; + } + +} diff --git a/src/main/java/com/subsidy/util/MathUtil.java b/src/main/java/com/subsidy/util/MathUtil.java index 854ca16..30f4816 100644 --- a/src/main/java/com/subsidy/util/MathUtil.java +++ b/src/main/java/com/subsidy/util/MathUtil.java @@ -89,13 +89,21 @@ public class MathUtil { return counts.multiply(new BigDecimal(100)).divide(total, RoundingMode.CEILING).stripTrailingZeros().toPlainString() + "%"; } } - //百分比 不带%输出 public static String getPercentAvgIndexWithPercent(BigDecimal counts, BigDecimal total) { if (BigDecimal.ZERO.equals(total) || BigDecimal.ZERO.equals(counts)) { return "0"; } else { - return counts.multiply(new BigDecimal(100)).divide(total, RoundingMode.CEILING).stripTrailingZeros().toPlainString(); + return counts.multiply(new BigDecimal(100)).divide(total,2,BigDecimal.ROUND_HALF_UP).stripTrailingZeros().toPlainString(); + } + } + + //百分比 不带%输出 + public static String getPercentAvgIndexCeil(BigDecimal counts, BigDecimal total) { + if (BigDecimal.ZERO.equals(total) || BigDecimal.ZERO.equals(counts)) { + return "0"; + } else { + return counts.multiply(new BigDecimal(100)).divide(total,2,BigDecimal.ROUND_CEILING).stripTrailingZeros().toPlainString(); } } diff --git a/src/main/java/com/subsidy/util/SMSUtils.java b/src/main/java/com/subsidy/util/SMSUtils.java index 8d625d6..7772f13 100644 --- a/src/main/java/com/subsidy/util/SMSUtils.java +++ b/src/main/java/com/subsidy/util/SMSUtils.java @@ -21,6 +21,8 @@ import org.springframework.stereotype.Component; @Component public class SMSUtils { + + @Autowired private AliyunSmsProperties aliyunSmsProperties; diff --git a/src/main/java/com/subsidy/util/Student.java b/src/main/java/com/subsidy/util/Student.java new file mode 100644 index 0000000..77f6c1c --- /dev/null +++ b/src/main/java/com/subsidy/util/Student.java @@ -0,0 +1,17 @@ +package com.subsidy.util; + +import lombok.Data; + +import java.util.Date; + +@Data +public class Student { + + private String name; + private int age; + private Date birthday; + private float height; + private double weight; + private boolean sex; + +} diff --git a/src/main/java/com/subsidy/util/ZipTestUtils.java b/src/main/java/com/subsidy/util/ZipTestUtils.java new file mode 100644 index 0000000..925652e --- /dev/null +++ b/src/main/java/com/subsidy/util/ZipTestUtils.java @@ -0,0 +1,299 @@ +package com.subsidy.util; + +import org.apache.poi.hssf.usermodel.HSSFCellStyle; +import org.apache.poi.hssf.usermodel.HSSFFont; +import org.apache.poi.hssf.util.CellRangeAddress; +import org.apache.poi.ss.usermodel.CellStyle; +import org.apache.poi.ss.usermodel.Font; +import org.apache.poi.xssf.streaming.SXSSFCell; +import org.apache.poi.xssf.streaming.SXSSFRow; +import org.apache.poi.xssf.streaming.SXSSFSheet; +import org.apache.poi.xssf.streaming.SXSSFWorkbook; + +import javax.servlet.ServletOutputStream; +import javax.servlet.http.HttpServletResponse; +import java.io.*; +import java.text.SimpleDateFormat; +import java.util.*; +import java.util.zip.ZipEntry; +import java.util.zip.ZipOutputStream; + +public class ZipTestUtils { + + /* + 原链接:https://blog.csdn.net/houxuehan/article/details/89189820 + */ + + public static String NO_DEFINE = "no_define";//未定义的字段 + public static String DEFAULT_DATE_PATTERN = "yyyy年MM月dd日";//默认日期格式 + public static int DEFAULT_COLOUMN_WIDTH = 17; + + /** + * 导出Excel 2007 OOXML (.xlsx)格式 + * + * @param title 标题行 + * @param headList 属性-列头 + * @param students 数据集 + * @param datePattern 日期格式,传null值则默认 年月日 + * @param colWidth 列宽 默认 至少17个字节 + * @param out 输出流 + */ + public static void exportExcelX(String title, List headList, List students, String datePattern, int colWidth, OutputStream out) { + if (datePattern == null) { + datePattern = DEFAULT_DATE_PATTERN; + } + // 声明一个工作薄 + SXSSFWorkbook workbook = new SXSSFWorkbook(1000);//缓存 + workbook.setCompressTempFiles(true); + //表头样式 + CellStyle titleStyle = workbook.createCellStyle(); + titleStyle.setAlignment(HSSFCellStyle.ALIGN_CENTER); + Font titleFont = workbook.createFont(); + titleFont.setFontHeightInPoints((short) 20); + titleFont.setBoldweight((short) 700); + titleStyle.setFont(titleFont); + // 列头样式 + CellStyle headerStyle = workbook.createCellStyle(); + headerStyle.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND); + headerStyle.setBorderBottom(HSSFCellStyle.BORDER_THIN); + headerStyle.setBorderLeft(HSSFCellStyle.BORDER_THIN); + headerStyle.setBorderRight(HSSFCellStyle.BORDER_THIN); + headerStyle.setBorderTop(HSSFCellStyle.BORDER_THIN); + headerStyle.setAlignment(HSSFCellStyle.ALIGN_CENTER); + Font headerFont = workbook.createFont(); + headerFont.setFontHeightInPoints((short) 12); + headerFont.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD); + headerStyle.setFont(headerFont); + // 单元格样式 + CellStyle cellStyle = workbook.createCellStyle(); + cellStyle.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND); + cellStyle.setBorderBottom(HSSFCellStyle.BORDER_THIN); + cellStyle.setBorderLeft(HSSFCellStyle.BORDER_THIN); + cellStyle.setBorderRight(HSSFCellStyle.BORDER_THIN); + cellStyle.setBorderTop(HSSFCellStyle.BORDER_THIN); + cellStyle.setAlignment(HSSFCellStyle.ALIGN_CENTER); + cellStyle.setVerticalAlignment(HSSFCellStyle.VERTICAL_CENTER); + Font cellFont = workbook.createFont(); + cellFont.setBoldweight(HSSFFont.BOLDWEIGHT_NORMAL); + cellStyle.setFont(cellFont); + // 生成一个(带标题)表格 + SXSSFSheet sheet = workbook.createSheet(); + //设置列宽 + int minBytes = colWidth < DEFAULT_COLOUMN_WIDTH ? DEFAULT_COLOUMN_WIDTH : colWidth;//至少字节数 + int[] arrColWidth = new int[headList.size()]; + // 产生表格标题行,以及设置列宽 + String[] properties = new String[headList.size()]; + String[] headers = new String[headList.size()]; + int ii = 0; + for (int i = 0 ;i < headList.size(); i++) { + + //properties[ii] = fieldName; + headers[ii] = headList.get(i); + + int bytes = headList.get(i).getBytes().length; + arrColWidth[ii] = bytes < minBytes ? minBytes : bytes; + sheet.setColumnWidth(ii, arrColWidth[ii] * 256); + ii++; + } + // 遍历集合数据,产生数据行 + int rowIndex = 0; + for (Student student : students) { + if (rowIndex == 65535 || rowIndex == 0) { + if (rowIndex != 0) { + sheet = workbook.createSheet();//如果数据超过了,则在第二页显示 + } + SXSSFRow titleRow = sheet.createRow(0);//表头 rowIndex=0 + titleRow.createCell(0).setCellValue(title); + titleRow.getCell(0).setCellStyle(titleStyle); + sheet.addMergedRegion(new CellRangeAddress(0, 0, 0, headList.size() - 1)); + + SXSSFRow headerRow = sheet.createRow(1); //列头 rowIndex =1 + for (int i = 0; i < headers.length; i++) { + headerRow.createCell(i).setCellValue(headers[i]); + headerRow.getCell(i).setCellStyle(headerStyle); + + } + rowIndex = 2;//数据内容从 rowIndex=2开始 + } + + SXSSFRow dataRow = sheet.createRow(rowIndex); + + SXSSFCell newCell = dataRow.createCell(0); + newCell.setCellStyle(cellStyle); + newCell.setCellValue(student.getName()); + + newCell = dataRow.createCell(1); + //newCell.setCellStyle(cellStyle); + newCell.setCellValue(student.getAge()); + + newCell = dataRow.createCell(2); + newCell.setCellValue(new SimpleDateFormat(datePattern).format(student.getBirthday())); + + newCell = dataRow.createCell(3); + newCell.setCellValue(student.getHeight()); + + newCell = dataRow.createCell(4); + newCell.setCellValue(student.getWeight()); + + newCell = dataRow.createCell(5); + newCell.setCellValue(student.isSex()); + + // + //for (int i = 0; i < properties.length; i++) { + // + // Object o = jo.get(properties[i]); + // String cellValue = ""; + // if (o == null) { + // cellValue = ""; + // } else if (o instanceof Date) { + // cellValue = new SimpleDateFormat(datePattern).format(o); + // } + // /*else if(o instanceof Float || o instanceof Double) { + // double d = (double) o; + // if(d%1==0) cellValue=o.toString(); + // else cellValue= new BigDecimal(o.toString()).setScale(2,BigDecimal.ROUND_HALF_UP).toString(); + // }*/ + // else { + // cellValue = o.toString(); + // } + // newCell.setCellValue(cellValue); + // newCell.setCellStyle(cellStyle); + //} + rowIndex++; + } + // 自动调整宽度 + /*for (int i = 0; i < headers.length; i++) { + sheet.autoSizeColumn(i); + }*/ + try { + workbook.write(out); + workbook.close(); + workbook.dispose(); + } catch (IOException e) { + e.printStackTrace(); + } + } + + /** + * 压缩单个excel文件的输出流 到zip输出流,注意zipOutputStream未关闭,需要交由调用者关闭之 + * + * @param zipOutputStream zip文件的输出流 + * @param excelOutputStream excel文件的输出流 + * @param excelFilename 文件名可以带目录,例如 TestDir/test1.xlsx + */ + public static void compressFileToZipStream(ZipOutputStream zipOutputStream, + ByteArrayOutputStream excelOutputStream, String excelFilename) { + byte[] buf = new byte[1024]; + try { + // Compress the files + byte[] content = excelOutputStream.toByteArray(); + ByteArrayInputStream is = new ByteArrayInputStream(content); + BufferedInputStream bis = new BufferedInputStream(is); + // Add ZIP entry to output stream. + zipOutputStream.putNextEntry(new ZipEntry(excelFilename)); + // Transfer bytes from the file to the ZIP file + int len; + while ((len = bis.read(buf)) > 0) { + zipOutputStream.write(buf, 0, len); + } + // Complete the entry + //excelOutputStream.close();//关闭excel输出流 + zipOutputStream.closeEntry(); + bis.close(); + is.close(); + // Complete the ZIP file + } catch (IOException e) { + e.printStackTrace(); + } + } + + public static void main(String[] args) throws IOException { + int count = 100; + List list = new ArrayList<>(); + for (int i = 0; i < count; i++) { + Student s = new Student(); + s.setName("POI" + i); + s.setAge(i); + s.setBirthday(new Date()); + s.setHeight(i); + s.setWeight(i); + s.setSex(i / 2 == 0 ? false : true); + list.add(s); + } + //Map headMap = new LinkedHashMap(); + //headMap.put("name", "姓名"); + //headMap.put("age", "年龄"); + //headMap.put("birthday", "生日"); + //headMap.put("height", "身高"); + //headMap.put("weight", "体重"); + //headMap.put("sex", "性别"); + + List memberList = Arrays.asList(new String[]{"成员名称","账号","联系方式","签到次数","课程进度","培训时长","评级测试","答疑"}); + + + //导出zip + OutputStream outXlsx = new FileOutputStream("E://test.zip"); + ZipOutputStream zipOutputStream = new ZipOutputStream(outXlsx); + + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + exportExcelX("testExcel", memberList, list, null, 0, baos); + compressFileToZipStream(zipOutputStream, baos, "/test/aaa.xlsx"); + baos.close(); + + zipOutputStream.flush(); + zipOutputStream.close(); + outXlsx.close(); + + System.out.println("导出zip完成"); + } + + + public void exportZip(HttpServletResponse response, List students) throws Exception { + + ServletOutputStream sos = response.getOutputStream(); + ZipOutputStream zipOutputStream = new ZipOutputStream(sos); + String zipname = "test.zip"; + response.reset(); + response.setContentType("application/x-download"); + response.setHeader("Content-Disposition", "attachment;filename=" + new String((zipname).getBytes(), "iso-8859-1")); + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + + /** + * 班级成员 + */ + List memberList = Arrays.asList(new String[]{"成员名称","账号","联系方式","签到次数","课程进度","培训时长","评级测试","答疑"}); + + /** + * 注册签到 + */ + List signList = Arrays.asList(new String[]{"成员名称","培训时长","课程进度","完成率"}); + + /** + * 测试成绩 + */ + List scoreList = Arrays.asList(new String[]{"成员名称","测试结果","最高分"}); + + /** + * 答疑记录 + */ + List answerList = Arrays.asList(new String[]{"提问","答疑","提问时间","提问成员","答疑时间"}); + + //Map headMap = new LinkedHashMap(); + //headMap.put("name", "成员名称"); + //headMap.put("age", "年龄"); + //headMap.put("birthday", "生日"); + //headMap.put("height", "身高"); + //headMap.put("weight", "体重"); + //headMap.put("sex", "性别"); + + exportExcelX("title", memberList, students, null, 0, baos); + compressFileToZipStream(zipOutputStream, baos, "/test/aaa.xlsx"); + baos.close(); + + zipOutputStream.flush(); + zipOutputStream.close(); + sos.close(); + System.out.println("导出zip完成"); + } + +} diff --git a/src/main/java/com/subsidy/util/ZipUtils.java b/src/main/java/com/subsidy/util/ZipUtils.java new file mode 100644 index 0000000..8cc27e3 --- /dev/null +++ b/src/main/java/com/subsidy/util/ZipUtils.java @@ -0,0 +1,259 @@ +package com.subsidy.util; + +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; +import org.apache.poi.hssf.usermodel.HSSFCellStyle; +import org.apache.poi.hssf.usermodel.HSSFFont; +import org.apache.poi.hssf.util.CellRangeAddress; +import org.apache.poi.ss.usermodel.CellStyle; +import org.apache.poi.ss.usermodel.Font; +import org.apache.poi.xssf.streaming.SXSSFCell; +import org.apache.poi.xssf.streaming.SXSSFRow; +import org.apache.poi.xssf.streaming.SXSSFSheet; +import org.apache.poi.xssf.streaming.SXSSFWorkbook; + +import javax.servlet.ServletOutputStream; +import javax.servlet.http.HttpServletResponse; +import java.io.*; +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.Iterator; +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.zip.ZipEntry; +import java.util.zip.ZipOutputStream; + +public class ZipUtils { + + /* + 原链接:https://blog.csdn.net/houxuehan/article/details/89189820 + */ + + public static String NO_DEFINE = "no_define";//未定义的字段 + public static String DEFAULT_DATE_PATTERN = "yyyy年MM月dd日";//默认日期格式 + public static int DEFAULT_COLOUMN_WIDTH = 17; + + /** + * 导出Excel 2007 OOXML (.xlsx)格式 + * + * @param title 标题行 + * @param headMap 属性-列头 + * @param jsonArray 数据集 + * @param datePattern 日期格式,传null值则默认 年月日 + * @param colWidth 列宽 默认 至少17个字节 + * @param out 输出流 + */ + public static void exportExcelX(String title, Map headMap, JSONArray jsonArray, String datePattern, int colWidth, OutputStream out) { + if (datePattern == null) { + datePattern = DEFAULT_DATE_PATTERN; + } + // 声明一个工作薄 + SXSSFWorkbook workbook = new SXSSFWorkbook(1000);//缓存 + workbook.setCompressTempFiles(true); + //表头样式 + CellStyle titleStyle = workbook.createCellStyle(); + titleStyle.setAlignment(HSSFCellStyle.ALIGN_CENTER); + Font titleFont = workbook.createFont(); + titleFont.setFontHeightInPoints((short) 20); + titleFont.setBoldweight((short) 700); + titleStyle.setFont(titleFont); + // 列头样式 + CellStyle headerStyle = workbook.createCellStyle(); + headerStyle.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND); + headerStyle.setBorderBottom(HSSFCellStyle.BORDER_THIN); + headerStyle.setBorderLeft(HSSFCellStyle.BORDER_THIN); + headerStyle.setBorderRight(HSSFCellStyle.BORDER_THIN); + headerStyle.setBorderTop(HSSFCellStyle.BORDER_THIN); + headerStyle.setAlignment(HSSFCellStyle.ALIGN_CENTER); + Font headerFont = workbook.createFont(); + headerFont.setFontHeightInPoints((short) 12); + headerFont.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD); + headerStyle.setFont(headerFont); + // 单元格样式 + CellStyle cellStyle = workbook.createCellStyle(); + cellStyle.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND); + cellStyle.setBorderBottom(HSSFCellStyle.BORDER_THIN); + cellStyle.setBorderLeft(HSSFCellStyle.BORDER_THIN); + cellStyle.setBorderRight(HSSFCellStyle.BORDER_THIN); + cellStyle.setBorderTop(HSSFCellStyle.BORDER_THIN); + cellStyle.setAlignment(HSSFCellStyle.ALIGN_CENTER); + cellStyle.setVerticalAlignment(HSSFCellStyle.VERTICAL_CENTER); + Font cellFont = workbook.createFont(); + cellFont.setBoldweight(HSSFFont.BOLDWEIGHT_NORMAL); + cellStyle.setFont(cellFont); + // 生成一个(带标题)表格 + SXSSFSheet sheet = workbook.createSheet(); + //设置列宽 + int minBytes = colWidth < DEFAULT_COLOUMN_WIDTH ? DEFAULT_COLOUMN_WIDTH : colWidth;//至少字节数 + int[] arrColWidth = new int[headMap.size()]; + // 产生表格标题行,以及设置列宽 + String[] properties = new String[headMap.size()]; + String[] headers = new String[headMap.size()]; + int ii = 0; + for (Iterator iter = headMap.keySet().iterator(); iter + .hasNext(); ) { + String fieldName = iter.next(); + + properties[ii] = fieldName; + headers[ii] = headMap.get(fieldName); + + int bytes = fieldName.getBytes().length; + arrColWidth[ii] = bytes < minBytes ? minBytes : bytes; + sheet.setColumnWidth(ii, arrColWidth[ii] * 256); + ii++; + } + // 遍历集合数据,产生数据行 + int rowIndex = 0; + for (Object obj : jsonArray) { + if (rowIndex == 65535 || rowIndex == 0) { + if (rowIndex != 0) { + sheet = workbook.createSheet();//如果数据超过了,则在第二页显示 + } + SXSSFRow titleRow = sheet.createRow(0);//表头 rowIndex=0 + titleRow.createCell(0).setCellValue(title); + titleRow.getCell(0).setCellStyle(titleStyle); + sheet.addMergedRegion(new CellRangeAddress(0, 0, 0, headMap.size() - 1)); + + SXSSFRow headerRow = sheet.createRow(1); //列头 rowIndex =1 + for (int i = 0; i < headers.length; i++) { + headerRow.createCell(i).setCellValue(headers[i]); + headerRow.getCell(i).setCellStyle(headerStyle); + + } + rowIndex = 2;//数据内容从 rowIndex=2开始 + } + JSONObject jo = (JSONObject) JSONObject.toJSON(obj); + SXSSFRow dataRow = sheet.createRow(rowIndex); + for (int i = 0; i < properties.length; i++) { + SXSSFCell newCell = dataRow.createCell(i); + + Object o = jo.get(properties[i]); + String cellValue = ""; + if (o == null) { + cellValue = ""; + } else if (o instanceof Date) { + cellValue = new SimpleDateFormat(datePattern).format(o); + } + /*else if(o instanceof Float || o instanceof Double) { + double d = (double) o; + if(d%1==0) cellValue=o.toString(); + else cellValue= new BigDecimal(o.toString()).setScale(2,BigDecimal.ROUND_HALF_UP).toString(); + }*/ + else { + cellValue = o.toString(); + } + newCell.setCellValue(cellValue); + newCell.setCellStyle(cellStyle); + } + rowIndex++; + } + // 自动调整宽度 + /*for (int i = 0; i < headers.length; i++) { + sheet.autoSizeColumn(i); + }*/ + try { + workbook.write(out); + workbook.close(); + workbook.dispose(); + } catch (IOException e) { + e.printStackTrace(); + } + } + + /** + * 压缩单个excel文件的输出流 到zip输出流,注意zipOutputStream未关闭,需要交由调用者关闭之 + * + * @param zipOutputStream zip文件的输出流 + * @param excelOutputStream excel文件的输出流 + * @param excelFilename 文件名可以带目录,例如 TestDir/test1.xlsx + */ + public static void compressFileToZipStream(ZipOutputStream zipOutputStream, + ByteArrayOutputStream excelOutputStream, String excelFilename) { + byte[] buf = new byte[1024]; + try { + // Compress the files + byte[] content = excelOutputStream.toByteArray(); + ByteArrayInputStream is = new ByteArrayInputStream(content); + BufferedInputStream bis = new BufferedInputStream(is); + // Add ZIP entry to output stream. + zipOutputStream.putNextEntry(new ZipEntry(excelFilename)); + // Transfer bytes from the file to the ZIP file + int len; + while ((len = bis.read(buf)) > 0) { + zipOutputStream.write(buf, 0, len); + } + // Complete the entry + //excelOutputStream.close();//关闭excel输出流 + zipOutputStream.closeEntry(); + bis.close(); + is.close(); + // Complete the ZIP file + } catch (IOException e) { + e.printStackTrace(); + } + } + + public static void main(String[] args) throws IOException { + int count = 100; + JSONArray ja = new JSONArray(); + for (int i = 0; i < count; i++) { + Student s = new Student(); + s.setName("POI" + i); + s.setAge(i); + s.setBirthday(new Date()); + s.setHeight(i); + s.setWeight(i); + s.setSex(i / 2 == 0 ? false : true); + ja.add(s); + } + Map headMap = new LinkedHashMap(); + headMap.put("name", "姓名"); + headMap.put("age", "年龄"); + headMap.put("birthday", "生日"); + headMap.put("height", "身高"); + headMap.put("weight", "体重"); + headMap.put("sex", "性别"); + //导出zip + OutputStream outXlsx = new FileOutputStream("E://test.zip"); + ZipOutputStream zipOutputStream = new ZipOutputStream(outXlsx); + + for (int i = 1; i < 6; i++) { + String dir = i % 2 == 0 ? "dirA" : "dirB"; + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + exportExcelX("testExcel", headMap, ja, null, 0, baos); + compressFileToZipStream(zipOutputStream, baos, dir + "/test" + i + ".xlsx"); + baos.close(); + } + zipOutputStream.flush(); + zipOutputStream.close(); + outXlsx.close(); + + System.out.println("导出zip完成"); + } + + + public void exportZip(HttpServletResponse response) throws Exception { + + ServletOutputStream sos = response.getOutputStream(); + ZipOutputStream zipOutputStream = new ZipOutputStream(sos); + String zipname = "test.zip"; + response.reset(); + response.setContentType("application/x-download"); + response.setHeader("Content-Disposition", "attachment;filename=" + new + + String((zipname). + + getBytes(), "iso-8859-1")); + for (int i = 1; i < 6; i++) { + String dir = i % 2 == 0 ? "dirA" : "dirB"; + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + //exportExcelX(title, headMap, ja, null, 0, baos); + compressFileToZipStream(zipOutputStream, baos, dir + "/test" + i + ".xlsx"); + baos.close(); + } + zipOutputStream.flush(); + zipOutputStream.close(); + sos.close(); + System.out.println("导出zip完成"); + } +} diff --git a/src/main/java/com/subsidy/vo/administer/ClassSummaryVO.java b/src/main/java/com/subsidy/vo/administer/ClassSummaryVO.java new file mode 100644 index 0000000..a85c1e3 --- /dev/null +++ b/src/main/java/com/subsidy/vo/administer/ClassSummaryVO.java @@ -0,0 +1,54 @@ +package com.subsidy.vo.administer; + +import lombok.Data; + +@Data +public class ClassSummaryVO { + + private Long classId; + + private String className; + + private String courseName; + + private String startDate; + + private String endDate; + + /** + * 学员总数 + */ + private Integer memberCount; + + /** + * 课程进度 + */ + private Integer studyVodCounts; + + /** + * 总课时 + */ + private Integer totalVodCounts; + + + /** + * 平均时长 + */ + private Integer avgVodPlayLength; + + /** + * 测试通过率 + */ + private Integer passRate; + + /** + * 平均签到数 + */ + private Integer avgSignCount; + + /** + * 答疑数 + */ + private Integer answerCount; + +} diff --git a/src/main/java/com/subsidy/vo/administer/ExerciseTestVO.java b/src/main/java/com/subsidy/vo/administer/ExerciseTestVO.java new file mode 100644 index 0000000..acca0e6 --- /dev/null +++ b/src/main/java/com/subsidy/vo/administer/ExerciseTestVO.java @@ -0,0 +1,23 @@ +package com.subsidy.vo.administer; + +import com.subsidy.util.excel.ExcelColumn; +import lombok.Data; + +@Data +public class ExerciseTestVO { + + private Long id; + + @ExcelColumn(col = 1,value = "成员名称") + private String userName; + + /** + * 分数 向上取整 + */ + @ExcelColumn(col = 2,value = "测试结果") + private Integer score; + + @ExcelColumn(col = 3,value = "最高分") + private String result; + +} diff --git a/src/main/java/com/subsidy/vo/administer/OperatorsVO.java b/src/main/java/com/subsidy/vo/administer/OperatorsVO.java index f9770fc..33d4086 100644 --- a/src/main/java/com/subsidy/vo/administer/OperatorsVO.java +++ b/src/main/java/com/subsidy/vo/administer/OperatorsVO.java @@ -11,4 +11,17 @@ public class OperatorsVO { private String telephone; + private String field; + + private String banner; + + private String shortName; + + private String img; + + private String companyName; + + private String accountName; + + private Integer companyId; } diff --git a/src/main/java/com/subsidy/vo/administer/UserRoleVO.java b/src/main/java/com/subsidy/vo/administer/UserRoleVO.java new file mode 100644 index 0000000..c9fb0fa --- /dev/null +++ b/src/main/java/com/subsidy/vo/administer/UserRoleVO.java @@ -0,0 +1,17 @@ +package com.subsidy.vo.administer; + +import lombok.Data; + +@Data +public class UserRoleVO { + + private Long id; + + private String telephone; + + private String userName; + + private String img; + + +} diff --git a/src/main/java/com/subsidy/vo/answer/GetCourseQuestionVO.java b/src/main/java/com/subsidy/vo/answer/GetCourseQuestionVO.java new file mode 100644 index 0000000..c9db152 --- /dev/null +++ b/src/main/java/com/subsidy/vo/answer/GetCourseQuestionVO.java @@ -0,0 +1,49 @@ +package com.subsidy.vo.answer; + +import lombok.Data; + +@Data +public class GetCourseQuestionVO { + + + + private String memberName; + + private String administerName; + + private String companyName; + + private Long id; + + /** + * 科目id + */ + private Long courseId; + + /** + * 提问id + */ + private Long askId; + + /** + * 回答人id + */ + private Long answerId; + + /** + * 问题 + */ + private String title; + + /** + * 答案 + */ + private String answer; + + private String createDate; + + private String updateDate; + + private String deleteDate; + +} diff --git a/src/main/java/com/subsidy/vo/classdict/ClassDetailVO.java b/src/main/java/com/subsidy/vo/classdict/ClassDetailVO.java new file mode 100644 index 0000000..4d001ae --- /dev/null +++ b/src/main/java/com/subsidy/vo/classdict/ClassDetailVO.java @@ -0,0 +1,70 @@ +package com.subsidy.vo.classdict; + +import com.subsidy.util.excel.ExcelColumn; +import lombok.Data; + +@Data +public class ClassDetailVO { + + + private Long id; + + @ExcelColumn(col = 1,value = "成员名称") + private String userName; + + @ExcelColumn(col = 2,value = "账号") + private String accountName; + + @ExcelColumn(col = 3,value = "联系方式") + private String telephone; + + /** + * 签到次数 + */ + @ExcelColumn(col = 4,value = "签到次数") + private Integer signCounts; + + /** + * 已看视频 + */ + private Integer studyVodCounts; + + /** + * 全部视频 + */ + private Integer allVodCounts; + + @ExcelColumn(col = 5,value = "课程进度") + private String classProcess; + + @ExcelColumn(col = 6,value = "培训时长") + private Integer trainingLength; + + /** + * 作对个数 + */ + private Integer rightCounts; + + /** + * 总题数 + */ + private Integer totalExeCounts; + + /** + * 评价测试 + */ + @ExcelColumn(col = 7,value = "评价测试") + private Integer score; + + /** + * 答疑个数 + */ + @ExcelColumn(col = 8,value = "答题数") + private Integer askCounts; + + + + + + +} diff --git a/src/main/java/com/subsidy/vo/classdict/GetAllClassesVO.java b/src/main/java/com/subsidy/vo/classdict/GetAllClassesVO.java index 33536a4..dcd7fab 100644 --- a/src/main/java/com/subsidy/vo/classdict/GetAllClassesVO.java +++ b/src/main/java/com/subsidy/vo/classdict/GetAllClassesVO.java @@ -7,6 +7,8 @@ public class GetAllClassesVO { private Integer id; + private Integer courseId; + private String className; private String courseName; diff --git a/src/main/java/com/subsidy/vo/course/ExerciseVO.java b/src/main/java/com/subsidy/vo/course/ExerciseVO.java new file mode 100644 index 0000000..8e34e7a --- /dev/null +++ b/src/main/java/com/subsidy/vo/course/ExerciseVO.java @@ -0,0 +1,31 @@ +package com.subsidy.vo.course; + +import lombok.Data; + +@Data +public class ExerciseVO { + + + private Long id; + + /** + * 题目类型:单选/多选/是非 + */ + private String exerciseType; + + /** + * 难度:容易/适中/困难 + */ + private String difficulty; + + /** + * 题目 + */ + private String title; + + /** + * 选项 + */ + private String items; + +} diff --git a/src/main/java/com/subsidy/vo/course/QueryCoursesVO.java b/src/main/java/com/subsidy/vo/course/QueryCoursesVO.java new file mode 100644 index 0000000..ba7ead4 --- /dev/null +++ b/src/main/java/com/subsidy/vo/course/QueryCoursesVO.java @@ -0,0 +1,11 @@ +package com.subsidy.vo.course; + +import com.subsidy.model.CourseDictDO; +import lombok.Data; + +@Data +public class QueryCoursesVO extends CourseDictDO { + + private String name; + +} diff --git a/src/main/java/com/subsidy/vo/exercise/MemberExerciseVO.java b/src/main/java/com/subsidy/vo/exercise/MemberExerciseVO.java new file mode 100644 index 0000000..9417ae1 --- /dev/null +++ b/src/main/java/com/subsidy/vo/exercise/MemberExerciseVO.java @@ -0,0 +1,12 @@ +package com.subsidy.vo.exercise; + +import lombok.Data; + +@Data +public class MemberExerciseVO { + + private Long id; + + private String selectAnswer; + +} diff --git a/src/main/java/com/subsidy/vo/member/ClassSignVO.java b/src/main/java/com/subsidy/vo/member/ClassSignVO.java new file mode 100644 index 0000000..b42a13c --- /dev/null +++ b/src/main/java/com/subsidy/vo/member/ClassSignVO.java @@ -0,0 +1,49 @@ +package com.subsidy.vo.member; + +import com.subsidy.util.excel.ExcelColumn; +import lombok.Data; + +@Data +public class ClassSignVO { + + private Long id; + + @ExcelColumn(col = 1,value = "成员名称") + private String userName; + + /** + * 签到次数 + */ + @ExcelColumn(col = 2,value = "签到次数") + private Integer signCounts; + + /** + * 培训时长 + */ + @ExcelColumn(col = 3,value = "培训时长") + private Integer trainingLength; + + /** + * 已看视频 + */ + private Integer studyVodCounts; + + /** + * 全部视频 + */ + private Integer allVodCounts; + + @ExcelColumn(col = 4,value = "课程进度") + private String classProcess; + + /** + * 完成率 + */ + @ExcelColumn(col = 5,value = "完成率") + private String percent; + + + + + +} diff --git a/src/main/java/com/subsidy/vo/member/ContentFilesVO.java b/src/main/java/com/subsidy/vo/member/ContentFilesVO.java new file mode 100644 index 0000000..dc313c0 --- /dev/null +++ b/src/main/java/com/subsidy/vo/member/ContentFilesVO.java @@ -0,0 +1,15 @@ +package com.subsidy.vo.member; + +import com.subsidy.model.FileDictDO; +import lombok.Data; + +import java.util.List; + +@Data +public class ContentFilesVO { + + private String content; + + private List fileDictDOS; + +} diff --git a/src/main/java/com/subsidy/vo/member/ContentVodVO.java b/src/main/java/com/subsidy/vo/member/ContentVodVO.java new file mode 100644 index 0000000..09d7c8e --- /dev/null +++ b/src/main/java/com/subsidy/vo/member/ContentVodVO.java @@ -0,0 +1,14 @@ +package com.subsidy.vo.member; + +import lombok.Data; + +import java.util.List; + +@Data +public class ContentVodVO { + + private String content; + + private List memberVodVOS; + +} diff --git a/src/main/java/com/subsidy/vo/member/GetCourseTestVO.java b/src/main/java/com/subsidy/vo/member/GetCourseTestVO.java new file mode 100644 index 0000000..b324245 --- /dev/null +++ b/src/main/java/com/subsidy/vo/member/GetCourseTestVO.java @@ -0,0 +1,18 @@ +package com.subsidy.vo.member; + +import lombok.Data; + +@Data +public class GetCourseTestVO { + + private Long courseId; + + private String courseName; + + private String rightCount; + + private String totalCount; + + private String deadline; + +} diff --git a/src/main/java/com/subsidy/vo/member/GetMemberSignInfoVO.java b/src/main/java/com/subsidy/vo/member/GetMemberSignInfoVO.java new file mode 100644 index 0000000..42b51a0 --- /dev/null +++ b/src/main/java/com/subsidy/vo/member/GetMemberSignInfoVO.java @@ -0,0 +1,7 @@ +package com.subsidy.vo.member; + +import lombok.Data; + +@Data +public class GetMemberSignInfoVO { +} diff --git a/src/main/java/com/subsidy/vo/member/GetStudyInfoVO.java b/src/main/java/com/subsidy/vo/member/GetStudyInfoVO.java new file mode 100644 index 0000000..47e5353 --- /dev/null +++ b/src/main/java/com/subsidy/vo/member/GetStudyInfoVO.java @@ -0,0 +1,14 @@ +package com.subsidy.vo.member; + +import lombok.Data; + +@Data +public class GetStudyInfoVO { + + private Long diff; + + private Integer studyCourse; + + private Integer studyLength; + +} diff --git a/src/main/java/com/subsidy/vo/member/MemberStudyPageVO.java b/src/main/java/com/subsidy/vo/member/MemberStudyPageVO.java new file mode 100644 index 0000000..48a87ab --- /dev/null +++ b/src/main/java/com/subsidy/vo/member/MemberStudyPageVO.java @@ -0,0 +1,20 @@ +package com.subsidy.vo.member; + +import lombok.Data; + +import java.util.List; + +@Data +public class MemberStudyPageVO { + + private List studyPageVOS; + + private String companyName; + + private String shortName; + + private String banner; + + private String img; + +} diff --git a/src/main/java/com/subsidy/vo/member/MemberVodVO.java b/src/main/java/com/subsidy/vo/member/MemberVodVO.java new file mode 100644 index 0000000..0abb10b --- /dev/null +++ b/src/main/java/com/subsidy/vo/member/MemberVodVO.java @@ -0,0 +1,24 @@ +package com.subsidy.vo.member; + +import lombok.Data; + +@Data +public class MemberVodVO { + + private String vodName; + + private Integer vodLength; + + private String teacherName; + + private Integer percent; + + private Boolean status; + + private String vodUrl; + + private Long id; + + private Integer playRecord; + +} diff --git a/src/main/java/com/subsidy/vo/member/StudyPageVO.java b/src/main/java/com/subsidy/vo/member/StudyPageVO.java new file mode 100644 index 0000000..699f4e9 --- /dev/null +++ b/src/main/java/com/subsidy/vo/member/StudyPageVO.java @@ -0,0 +1,24 @@ +package com.subsidy.vo.member; + +import lombok.Data; + +@Data +public class StudyPageVO { + + private Integer id; + + private Integer classId; + + private String courseName; + + private String endDate; + + private Integer totalVods; + + private Integer doneVods; + + private Integer totalMember; + + private Integer doneMember; + +} diff --git a/src/main/java/com/subsidy/vo/sign/AnswerRecordVO.java b/src/main/java/com/subsidy/vo/sign/AnswerRecordVO.java new file mode 100644 index 0000000..b43f3cf --- /dev/null +++ b/src/main/java/com/subsidy/vo/sign/AnswerRecordVO.java @@ -0,0 +1,26 @@ +package com.subsidy.vo.sign; + +import com.subsidy.util.excel.ExcelColumn; +import lombok.Data; + +@Data +public class AnswerRecordVO { + + private Long id; + + @ExcelColumn(col = 1,value = "提问") + private String title; + + @ExcelColumn(col = 2,value = "答疑") + private String answer; + + @ExcelColumn(col = 3,value = "提问时间") + private String createDate; + + @ExcelColumn(col = 4,value = "提问成员") + private String userName; + + @ExcelColumn(col = 5,value = "答疑时间") + private String updateDate; + +} diff --git a/src/main/java/com/subsidy/vo/sign/ClassSignInfoVO.java b/src/main/java/com/subsidy/vo/sign/ClassSignInfoVO.java new file mode 100644 index 0000000..1480ef4 --- /dev/null +++ b/src/main/java/com/subsidy/vo/sign/ClassSignInfoVO.java @@ -0,0 +1,57 @@ +package com.subsidy.vo.sign; + +import lombok.Data; + +@Data +public class ClassSignInfoVO { + + private Long classId; + + private Long courseId; + + private String className; + + private String courseName; + + private String startDate; + + private String endDate; + + /** + * 班级人数 + */ + private Integer memberCount; + + /** + * 课程进度 + */ + private Integer studyVodCounts; + + /** + * 总课时 + */ + private Integer totalVodCounts; + + + /** + * 平均时长 + */ + private Integer avgVodPlayLength; + + /** + * 测试通过率 + */ + private Integer passRate; + + /** + * 平均签到数 + */ + private Integer avgSignCount; + + /** + * 答疑数 + */ + private Integer answerCount; + + +} diff --git a/src/main/java/com/subsidy/vo/vod/StudyHistoryVO.java b/src/main/java/com/subsidy/vo/vod/StudyHistoryVO.java new file mode 100644 index 0000000..9a0220b --- /dev/null +++ b/src/main/java/com/subsidy/vo/vod/StudyHistoryVO.java @@ -0,0 +1,17 @@ +package com.subsidy.vo.vod; + +import lombok.Data; + +@Data +public class StudyHistoryVO { + + private String vodName; + + private String teacherName; + + private Integer percent; + + private String vodLength; + + private Boolean status; +} diff --git a/src/main/resources/application-dev.properties b/src/main/resources/application-dev.properties index 2f0d750..119200b 100644 --- a/src/main/resources/application-dev.properties +++ b/src/main/resources/application-dev.properties @@ -4,7 +4,7 @@ server.port=23454 # 数据源配置 -spring.datasource.url=jdbc:mysql://116.62.57.92:3306/shixiAI?autoReconnect=true&useUnicode=true&characterEncoding=utf8&serverTimezone=GMT%2B8 +spring.datasource.url=jdbc:mysql://116.62.57.92:3306/subsidy?autoReconnect=true&useUnicode=true&characterEncoding=utf8&serverTimezone=GMT%2B8 spring.datasource.type=com.alibaba.druid.pool.DruidDataSource spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver spring.datasource.username=devloper diff --git a/src/main/resources/code.properties b/src/main/resources/code.properties index 6ad881a..1ff9904 100644 --- a/src/main/resources/code.properties +++ b/src/main/resources/code.properties @@ -15,6 +15,8 @@ meishu.code-message[20002]=该成员已存在 meishu.code-message[30001]=该部门已存在 +meishu.code-message[40001]=该目录已存在 + meishu.code-message[70010]=验证码错误 meishu.code-message[70011]=验证码发送频繁 meishu.code-message[70012]=手机号未注册 diff --git a/src/main/resources/mapper/AdministerMapper.xml b/src/main/resources/mapper/AdministerMapper.xml index c4bdce7..cc47025 100644 --- a/src/main/resources/mapper/AdministerMapper.xml +++ b/src/main/resources/mapper/AdministerMapper.xml @@ -13,9 +13,7 @@ - - @@ -45,19 +43,74 @@ - + SELECT + t2.id, + t2.user_name, + t2.account_name, + t2.telephone + FROM + class_member_mapping t + LEFT JOIN member t2 ON t.member_id = t2.id + where t.delete_date IS NULL + AND t2.delete_date IS NULL + AND t.class_id = #{classId} + + and t2.user_name like concat('%',#{userName} ,'%') + + + + + + + + diff --git a/src/main/resources/mapper/AnsweringQuestionMapper.xml b/src/main/resources/mapper/AnsweringQuestionMapper.xml new file mode 100644 index 0000000..7e11dfa --- /dev/null +++ b/src/main/resources/mapper/AnsweringQuestionMapper.xml @@ -0,0 +1,47 @@ + + + + + + + + + + + + + + + + + + + + create_date, + update_date, + delete_date, + id, course_id, ask_id, answer_id, title, answer + + + + + diff --git a/src/main/resources/mapper/ClassDictMapper.xml b/src/main/resources/mapper/ClassDictMapper.xml index 0084dcd..f39923d 100644 --- a/src/main/resources/mapper/ClassDictMapper.xml +++ b/src/main/resources/mapper/ClassDictMapper.xml @@ -4,14 +4,14 @@ - - - - - - - - + + + + + + + + @@ -24,21 +24,61 @@ + + + + diff --git a/src/main/resources/mapper/CompanyDictMapper.xml b/src/main/resources/mapper/CompanyDictMapper.xml new file mode 100644 index 0000000..4c9b6b0 --- /dev/null +++ b/src/main/resources/mapper/CompanyDictMapper.xml @@ -0,0 +1,61 @@ + + + + + + + + + + + + + + + + create_date, + update_date, + delete_date, + id, company_name + + + + + + + diff --git a/src/main/resources/mapper/CourseContentMapper.xml b/src/main/resources/mapper/CourseContentMapper.xml index dca213d..2b17ffb 100644 --- a/src/main/resources/mapper/CourseContentMapper.xml +++ b/src/main/resources/mapper/CourseContentMapper.xml @@ -21,4 +21,17 @@ id, course_id, content, order_no + + diff --git a/src/main/resources/mapper/CourseDictMapper.xml b/src/main/resources/mapper/CourseDictMapper.xml index e7c0df9..b3fe11d 100644 --- a/src/main/resources/mapper/CourseDictMapper.xml +++ b/src/main/resources/mapper/CourseDictMapper.xml @@ -15,6 +15,36 @@ + + create_date, update_date, @@ -22,17 +52,67 @@ id, course_name, category_id, course_type, course_source - SELECT - * + t3.* FROM course_dict t + LEFT JOIN class_dict t2 ON t.id = t2.course_id + LEFT JOIN class_member_mapping t3 ON t2.id = t3.member_id WHERE t.delete_date IS NULL + AND t2.delete_date IS NULL + AND t3.delete_date IS NULL + AND t.id = {classId} + + + + diff --git a/src/main/resources/mapper/ExerciseDoneResultMapper.xml b/src/main/resources/mapper/ExerciseDoneResultMapper.xml new file mode 100644 index 0000000..4b35529 --- /dev/null +++ b/src/main/resources/mapper/ExerciseDoneResultMapper.xml @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + + create_date, + update_date, + delete_date, + id, member_id, course_id, right_counts, total_counts + + + diff --git a/src/main/resources/mapper/MemberMapper.xml b/src/main/resources/mapper/MemberMapper.xml index e0d3576..d70f719 100644 --- a/src/main/resources/mapper/MemberMapper.xml +++ b/src/main/resources/mapper/MemberMapper.xml @@ -24,4 +24,20 @@ id, user_name, telephone, password, gender, image, id_card + + diff --git a/src/main/resources/mapper/SignInRecordMapper.xml b/src/main/resources/mapper/SignInRecordMapper.xml new file mode 100644 index 0000000..0b6cb74 --- /dev/null +++ b/src/main/resources/mapper/SignInRecordMapper.xml @@ -0,0 +1,47 @@ + + + + + + + + + + + + + + + + + + create_date, + update_date, + delete_date, + id, student_id, class_id, sign_in_date + + + + + diff --git a/src/main/resources/mapper/SmsVerifyCodeMapper.xml b/src/main/resources/mapper/SmsVerifyCodeMapper.xml new file mode 100644 index 0000000..1333675 --- /dev/null +++ b/src/main/resources/mapper/SmsVerifyCodeMapper.xml @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + + create_date, + update_date, + delete_date, + id, telephone, verify_code + + + diff --git a/src/main/resources/mapper/VodDictMapper.xml b/src/main/resources/mapper/VodDictMapper.xml index af8d323..a7efd42 100644 --- a/src/main/resources/mapper/VodDictMapper.xml +++ b/src/main/resources/mapper/VodDictMapper.xml @@ -25,7 +25,7 @@ id, content_id, vod_name, vod_length, vod_type, vod_size, vod_url, vod_code - SELECT t.*, t2.content @@ -36,7 +36,9 @@ t.delete_date IS NULL AND t2.delete_date IS NULL AND t.content_id = #{contentId} - and vod_name like concat('%',#{vodName} ,'%') + + and vod_name like concat('%',#{vodName} ,'%') + diff --git a/src/main/resources/mapper/VodPlayHistoryMapper.xml b/src/main/resources/mapper/VodPlayHistoryMapper.xml new file mode 100644 index 0000000..4d18d92 --- /dev/null +++ b/src/main/resources/mapper/VodPlayHistoryMapper.xml @@ -0,0 +1,53 @@ + + + + + + + + + + + + + + + + + + + + create_date, + update_date, + delete_date, + id, class_id, vod_id, member_id, play_length, play_record + + + + +