Browse Source

Merge branch 'master' of git.dayaedu.com:yonge/mec

chengpeng 5 years ago
parent
commit
32a8e37254

+ 13 - 0
cms/pom.xml

@@ -53,4 +53,17 @@
 			<artifactId>common-core</artifactId>
 		</dependency>
 	</dependencies>
+	
+	<build>
+		<plugins>
+			<plugin>
+				<groupId>org.springframework.boot</groupId>
+				<artifactId>spring-boot-maven-plugin</artifactId>
+			</plugin>
+			<plugin>
+				<groupId>com.spotify</groupId>
+				<artifactId>docker-maven-plugin</artifactId>
+			</plugin>
+		</plugins>
+	</build>
 </project>

+ 5 - 5
mec-education/src/main/java/com/ym/mec/education/controller/StudentRegistrationController.java → mec-education/src/main/java/com/ym/mec/education/controller/StudentController.java

@@ -2,7 +2,7 @@ package com.ym.mec.education.controller;
 
 import com.ym.mec.education.base.PageResponse;
 import com.ym.mec.education.req.ClassGroupReq;
-import com.ym.mec.education.service.IStudentRegistrationService;
+import com.ym.mec.education.service.IClassGroupStudentMapperService;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import lombok.extern.slf4j.Slf4j;
@@ -19,18 +19,18 @@ import org.springframework.web.bind.annotation.RestController;
  * @create: 2019-09-26 19:40
  */
 @RestController
-@RequestMapping("api/studentRegistration")
+@RequestMapping("api/student")
 @Api(tags = "学员名单")
 @Slf4j
-public class StudentRegistrationController {
+public class StudentController {
 
     @Autowired
-    private IStudentRegistrationService studentRegistrationService;
+    private IClassGroupStudentMapperService groupStudentMapperService;
 
     @PostMapping("/list")
     @ApiOperation("学员名单列表")
     public PageResponse list(@RequestBody ClassGroupReq classGroupReq) {
-        return studentRegistrationService.getPage(classGroupReq);
+        return groupStudentMapperService.getPage(classGroupReq);
     }
 
 }

+ 1 - 1
mec-education/src/main/java/com/ym/mec/education/resp/StudentRegistrationResp.java → mec-education/src/main/java/com/ym/mec/education/resp/StudentListResp.java

@@ -15,7 +15,7 @@ import lombok.experimental.Accessors;
 @Data
 @ApiModel(description = "学员名单出参")
 @Accessors(chain = true)
-public class StudentRegistrationResp extends BaseQuery {
+public class StudentListResp extends BaseQuery {
 
     @ApiModelProperty(value = "学员名称",required = true)
     private String studentName;

+ 3 - 0
mec-education/src/main/java/com/ym/mec/education/service/IClassGroupStudentMapperService.java

@@ -1,7 +1,9 @@
 package com.ym.mec.education.service;
 
 import com.baomidou.mybatisplus.extension.service.IService;
+import com.ym.mec.education.base.PageResponse;
 import com.ym.mec.education.entity.ClassGroupStudentMapper;
+import com.ym.mec.education.req.ClassGroupReq;
 
 /**
  * <p>
@@ -13,4 +15,5 @@ import com.ym.mec.education.entity.ClassGroupStudentMapper;
  */
 public interface IClassGroupStudentMapperService extends IService<ClassGroupStudentMapper> {
 
+    PageResponse getPage(ClassGroupReq classGroupReq);
 }

+ 0 - 1
mec-education/src/main/java/com/ym/mec/education/service/IStudentRegistrationService.java

@@ -15,5 +15,4 @@ import com.ym.mec.education.req.ClassGroupReq;
  */
 public interface IStudentRegistrationService extends IService<StudentRegistration> {
 
-     PageResponse getPage(ClassGroupReq classGroupReq);
 }

+ 47 - 0
mec-education/src/main/java/com/ym/mec/education/service/impl/ClassGroupStudentMapperServiceImpl.java

@@ -1,10 +1,25 @@
 package com.ym.mec.education.service.impl;
 
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.google.common.collect.Lists;
+import com.ym.mec.education.base.PageResponse;
 import com.ym.mec.education.entity.ClassGroupStudentMapper;
+import com.ym.mec.education.entity.StudentAttendance;
+import com.ym.mec.education.entity.StudentRegistration;
+import com.ym.mec.education.enums.StudentAttendanceStatusEnum;
 import com.ym.mec.education.mapper.ClassGroupStudentMapperMapper;
+import com.ym.mec.education.req.ClassGroupReq;
+import com.ym.mec.education.resp.StudentListResp;
 import com.ym.mec.education.service.IClassGroupStudentMapperService;
+import com.ym.mec.education.service.IStudentAttendanceService;
+import com.ym.mec.education.service.IStudentRegistrationService;
+import org.springframework.beans.BeanUtils;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
+import java.util.List;
 
 /**
  * <p>
@@ -17,4 +32,36 @@ import org.springframework.stereotype.Service;
 @Service
 public class ClassGroupStudentMapperServiceImpl extends ServiceImpl<ClassGroupStudentMapperMapper, ClassGroupStudentMapper> implements IClassGroupStudentMapperService {
 
+    @Autowired
+    private IStudentAttendanceService studentAttendanceService;
+    @Autowired
+    private IStudentRegistrationService studentRegistrationService;
+
+    @Override
+    public PageResponse getPage(ClassGroupReq classGroupReq) {
+        Page<ClassGroupStudentMapper> classGroupStudentMapperPage = new Page<>(classGroupReq.getPageNo(), classGroupReq.getPageSize());
+        QueryWrapper<ClassGroupStudentMapper> classGroupStudentMapperQueryWrapper = new QueryWrapper<>();
+        classGroupStudentMapperQueryWrapper.lambda().eq(true, ClassGroupStudentMapper::getClassGroupId, classGroupReq.getGroupId());
+        IPage<ClassGroupStudentMapper> page = page(classGroupStudentMapperPage, classGroupStudentMapperQueryWrapper);
+        Page<StudentListResp> studentListRespPage = new Page<>();
+        BeanUtils.copyProperties(page, studentListRespPage);
+        List<StudentListResp> list = Lists.newArrayList();
+        page.getRecords().forEach(item -> {
+            QueryWrapper<StudentAttendance> queryWrapper = new QueryWrapper<>();
+            //请假 旷课正常上课次数
+            queryWrapper.lambda().eq(true, StudentAttendance::getUserId, item.getUserId())
+                    .in(true, StudentAttendance::getStatus, StudentAttendanceStatusEnum.TRUANT.getCode(),
+                            StudentAttendanceStatusEnum.LEAVE.getCode());
+            int count = studentAttendanceService.count(queryWrapper);
+            QueryWrapper<StudentRegistration> studentRegistrationQueryWrapper = new QueryWrapper<>();
+            studentRegistrationQueryWrapper.lambda().eq(true, StudentRegistration::getClassGroupId, item.getClassGroupId())
+                    .eq(true, StudentRegistration::getUserId, item.getUserId());
+            StudentRegistration studentRegistration = studentRegistrationService.getOne(studentRegistrationQueryWrapper);
+            StudentListResp studentRegistrationResp = new StudentListResp()
+                    .setStudentName(studentRegistration.getName()).setStudentAttendance("连续缺到" + count + "次");
+            list.add(studentRegistrationResp);
+        });
+        studentListRespPage.setRecords(list);
+        return PageResponse.success(studentListRespPage);
+    }
 }

+ 0 - 41
mec-education/src/main/java/com/ym/mec/education/service/impl/StudentRegistrationServiceImpl.java

@@ -1,25 +1,11 @@
 package com.ym.mec.education.service.impl;
 
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
-import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import com.google.common.collect.Lists;
-import com.ym.mec.education.base.PageResponse;
-import com.ym.mec.education.entity.StudentAttendance;
 import com.ym.mec.education.entity.StudentRegistration;
-import com.ym.mec.education.enums.StudentAttendanceStatusEnum;
 import com.ym.mec.education.mapper.StudentRegistrationMapper;
-import com.ym.mec.education.req.ClassGroupReq;
-import com.ym.mec.education.resp.StudentRegistrationResp;
-import com.ym.mec.education.service.IStudentAttendanceService;
 import com.ym.mec.education.service.IStudentRegistrationService;
-import org.springframework.beans.BeanUtils;
-import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
-import java.util.List;
-
 /**
  * <p>
  * 学生报名表 服务实现类
@@ -30,31 +16,4 @@ import java.util.List;
  */
 @Service
 public class StudentRegistrationServiceImpl extends ServiceImpl<StudentRegistrationMapper, StudentRegistration> implements IStudentRegistrationService {
-
-    @Autowired
-    private IStudentAttendanceService studentAttendanceService;
-
-    @Override
-    public PageResponse getPage(ClassGroupReq classGroupReq) {
-        Page<StudentRegistration> studentRegistrationPage = new Page<>(classGroupReq.getPageNo(), classGroupReq.getPageSize());
-        QueryWrapper<StudentRegistration> studentRegistrationQueryWrapper = new QueryWrapper<>();
-        studentRegistrationQueryWrapper.lambda().eq(true, StudentRegistration::getClassGroupId, classGroupReq.getGroupId());
-        IPage<StudentRegistration> page = page(studentRegistrationPage, studentRegistrationQueryWrapper);
-        Page<StudentRegistrationResp> studentRegistrationRespPage = new Page<>();
-        BeanUtils.copyProperties(page, studentRegistrationRespPage);
-        List<StudentRegistrationResp> list = Lists.newArrayList();
-        page.getRecords().forEach(item -> {
-            QueryWrapper<StudentAttendance> queryWrapper = new QueryWrapper<>();
-            //请假 旷课正常上课次数
-            queryWrapper.lambda().eq(true, StudentAttendance::getUserId, item.getUserId())
-                    .in(true, StudentAttendance::getStatus, StudentAttendanceStatusEnum.TRUANT.getCode(),
-                            StudentAttendanceStatusEnum.LEAVE.getCode());
-            int count = studentAttendanceService.count(queryWrapper);
-            StudentRegistrationResp studentRegistrationResp = new StudentRegistrationResp()
-                    .setStudentName(item.getName()).setStudentAttendance("连续缺到" + count + "次");
-            list.add(studentRegistrationResp);
-        });
-        studentRegistrationRespPage.setRecords(list);
-        return PageResponse.success(studentRegistrationRespPage);
-    }
 }