Browse Source

老师列表

chengpeng 5 years ago
parent
commit
5e2ddbc0cf

+ 10 - 1
mec-education/src/main/java/com/ym/mec/education/controller/TeacherController.java

@@ -56,7 +56,16 @@ public class TeacherController {
 
     @PostMapping(value = "/teacherDetail")
     public BaseResponse teacherDetail(@RequestBody TeacherReq req) {
-        BaseResponse baseResponse = new BaseResponse();
         return teacherService.teacherDetail(req);
     }
+
+    /**
+     *
+     * @return
+     */
+    @PostMapping(value = "/teacherVipClass")
+    public PageResponse teacherVipClass(@RequestBody TeacherReq req){
+
+        return null;
+    }
 }

+ 128 - 0
mec-education/src/main/java/com/ym/mec/education/entity/VipGroupDefaultClassesCycle.java

@@ -0,0 +1,128 @@
+package com.ym.mec.education.entity;
+
+import java.util.Date;
+import com.baomidou.mybatisplus.annotations.TableId;
+import com.baomidou.mybatisplus.annotations.TableField;
+import com.baomidou.mybatisplus.activerecord.Model;
+import com.baomidou.mybatisplus.annotations.TableName;
+import java.io.Serializable;
+
+/**
+ * <p>
+ * vip课默认课程周期
+ * </p>
+ *
+ * @author lemeng
+ * @since 2019-10-02
+ */
+@TableName("vip_group_default_classes_cycle")
+public class VipGroupDefaultClassesCycle extends Model<VipGroupDefaultClassesCycle> {
+
+    private static final long serialVersionUID = 1L;
+
+    @TableId("id_")
+    private Integer id;
+    /**
+     * 最小课次
+     */
+    @TableField("min_class_times_")
+    private Integer minClassTimes;
+    /**
+     * 最大课次
+     */
+    @TableField("max_class_times_")
+    private Integer maxClassTimes;
+    /**
+     * 最大排课范围(月份)
+     */
+    @TableField("month_")
+    private Integer month;
+    @TableField("create_time_")
+    private Date createTime;
+    @TableField("update_time_")
+    private Date updateTime;
+    @TableField("organ_id_")
+    private Integer organId;
+
+
+    public Integer getId() {
+        return id;
+    }
+
+    public VipGroupDefaultClassesCycle setId(Integer id) {
+        this.id = id;
+        return this;
+    }
+
+    public Integer getMinClassTimes() {
+        return minClassTimes;
+    }
+
+    public VipGroupDefaultClassesCycle setMinClassTimes(Integer minClassTimes) {
+        this.minClassTimes = minClassTimes;
+        return this;
+    }
+
+    public Integer getMaxClassTimes() {
+        return maxClassTimes;
+    }
+
+    public VipGroupDefaultClassesCycle setMaxClassTimes(Integer maxClassTimes) {
+        this.maxClassTimes = maxClassTimes;
+        return this;
+    }
+
+    public Integer getMonth() {
+        return month;
+    }
+
+    public VipGroupDefaultClassesCycle setMonth(Integer month) {
+        this.month = month;
+        return this;
+    }
+
+    public Date getCreateTime() {
+        return createTime;
+    }
+
+    public VipGroupDefaultClassesCycle setCreateTime(Date createTime) {
+        this.createTime = createTime;
+        return this;
+    }
+
+    public Date getUpdateTime() {
+        return updateTime;
+    }
+
+    public VipGroupDefaultClassesCycle setUpdateTime(Date updateTime) {
+        this.updateTime = updateTime;
+        return this;
+    }
+
+    public Integer getOrganId() {
+        return organId;
+    }
+
+    public VipGroupDefaultClassesCycle setOrganId(Integer organId) {
+        this.organId = organId;
+        return this;
+    }
+
+    @Override
+    protected Serializable pkVal() {
+        return this.id;
+    }
+
+    @Override
+    public String toString() {
+        return "VipGroupDefaultClassesCycle{" +
+        ", id=" + id +
+        ", minClassTimes=" + minClassTimes +
+        ", maxClassTimes=" + maxClassTimes +
+        ", month=" + month +
+        ", createTime=" + createTime +
+        ", updateTime=" + updateTime +
+        ", organId=" + organId +
+        "}";
+    }
+}

+ 1 - 1
mec-education/src/main/java/com/ym/mec/education/mapper/VipGroupCategoryMapper.java

@@ -1,7 +1,7 @@
 package com.ym.mec.education.mapper;
 
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.ym.mec.education.entity.VipGroupCategory;
-import com.baomidou.mybatisplus.mapper.BaseMapper;
 
 /**
  * <p>

+ 16 - 0
mec-education/src/main/java/com/ym/mec/education/mapper/VipGroupDefaultClassesCycleMapper.java

@@ -0,0 +1,16 @@
+package com.ym.mec.education.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.ym.mec.education.entity.VipGroupDefaultClassesCycle;
+
+/**
+ * <p>
+ * vip课默认课程周期 Mapper 接口
+ * </p>
+ *
+ * @author lemeng
+ * @since 2019-10-02
+ */
+public interface VipGroupDefaultClassesCycleMapper extends BaseMapper<VipGroupDefaultClassesCycle> {
+
+}

+ 2 - 0
mec-education/src/main/java/com/ym/mec/education/resp/TeacherDetailResp.java

@@ -31,7 +31,9 @@ public class TeacherDetailResp implements Serializable {
 
     private List<InnerDemoGroup> demoGroups;
 
+    private Integer countNum;
 
+    private Integer hourCount;
 
     @Data
     public static class InnerDemoGroup{

+ 28 - 0
mec-education/src/main/java/com/ym/mec/education/resp/VipGroupClassResp.java

@@ -0,0 +1,28 @@
+package com.ym.mec.education.resp;
+
+import lombok.Data;
+import lombok.ToString;
+
+import java.io.Serializable;
+import java.util.List;
+
+/**
+ * @author : chengp
+ * @version V1.0
+ * @Description: TODO
+ * @date Date : 2019年10月02日 15:22
+ */
+@Data
+@ToString
+public class VipGroupClassResp implements Serializable {
+
+    private String vipGroupName;
+
+    private String vipClassType;
+
+    private String classNum;
+
+    private String longTime;
+
+    private List<String> studentList;
+}

+ 2 - 0
mec-education/src/main/java/com/ym/mec/education/service/ITeacherService.java

@@ -19,4 +19,6 @@ public interface ITeacherService extends IService<Teacher> {
     PageResponse teacherList(TeacherReq req);
 
     BaseResponse teacherDetail(TeacherReq req);
+
+    PageResponse teacherVipClass(TeacherReq req);
 }

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

@@ -1,7 +1,7 @@
 package com.ym.mec.education.service;
 
+import com.baomidou.mybatisplus.extension.service.IService;
 import com.ym.mec.education.entity.VipGroupCategory;
-import com.baomidou.mybatisplus.service.IService;
 
 /**
  * <p>

+ 16 - 0
mec-education/src/main/java/com/ym/mec/education/service/IVipGroupDefaultClassesCycleService.java

@@ -0,0 +1,16 @@
+package com.ym.mec.education.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.ym.mec.education.entity.VipGroupDefaultClassesCycle;
+
+/**
+ * <p>
+ * vip课默认课程周期 服务类
+ * </p>
+ *
+ * @author lemeng
+ * @since 2019-10-02
+ */
+public interface IVipGroupDefaultClassesCycleService extends IService<VipGroupDefaultClassesCycle> {
+
+}

+ 62 - 0
mec-education/src/main/java/com/ym/mec/education/service/impl/TeacherServiceImpl.java

@@ -13,6 +13,7 @@ import com.ym.mec.education.mapper.TeacherMapper;
 import com.ym.mec.education.req.TeacherReq;
 import com.ym.mec.education.resp.TeacherDetailResp;
 import com.ym.mec.education.resp.TeacherResp;
+import com.ym.mec.education.resp.VipGroupClassResp;
 import com.ym.mec.education.service.*;
 import com.ym.mec.education.utils.DateUtil;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -21,6 +22,7 @@ import org.springframework.util.CollectionUtils;
 import org.springframework.util.StringUtils;
 
 import java.util.*;
+import java.util.concurrent.atomic.AtomicReference;
 import java.util.stream.Collectors;
 
 /**
@@ -51,6 +53,18 @@ public class TeacherServiceImpl extends ServiceImpl<TeacherMapper, Teacher> impl
     @Autowired
     private IDemoGroupCoursesPlanService demoGroupCoursesPlanService;
 
+    @Autowired
+    private ITeacherLeaveRecordService teacherLeaveRecordService;
+
+    @Autowired
+    private IVipGroupService vipGroupService;
+
+    @Autowired
+    private IVipGroupCategoryService vipGroupCategoryService;
+
+
+    @Autowired
+    private IVipGroupDefaultClassesCycleService vipGroupDefaultClassesCycleService;
     @Override
     public PageResponse teacherList(TeacherReq req) {
         PageResponse response = new PageResponse();
@@ -189,7 +203,55 @@ public class TeacherServiceImpl extends ServiceImpl<TeacherMapper, Teacher> impl
 
             }
 
+            QueryWrapper<TeacherLeaveRecord> teacherLeaveRecordQueryWrapper = new QueryWrapper<>();
+            teacherLeaveRecordQueryWrapper.eq("user_id_",req.getUserId());
+            List<TeacherLeaveRecord> teacherLeaveRecordList = teacherLeaveRecordService.list(teacherLeaveRecordQueryWrapper);
+            if(!CollectionUtils.isEmpty(teacherLeaveRecordList)){
+                AtomicReference<Integer> count = new AtomicReference<>(0);
+                teacherLeaveRecordList.forEach(e ->{
+
+                    Integer hour = DateUtil.subMin(e.getStartTime(),e.getEndTime());
+                    if (hour != null){
+                        count.set(count.get() + hour);
+                    }
+                });
+                teacherDetailResp.setCountNum(teacherLeaveRecordList.size());
+                teacherDetailResp.setHourCount(count.get());
+            }
         }
         return BaseResponse.success(teacherDetailResp);
     }
+
+    @Override
+    public PageResponse teacherVipClass(TeacherReq req) {
+
+        if(req == null && req.getUserId() == null){
+            return PageResponse.errorParam();
+        }
+
+        IPage page = new Page(req.getPageNo() == null ? 1 : req.getPageNo(),req.getPageSize() == null ? 10 : req.getPageSize());
+        QueryWrapper<VipGroup> vipGroupQueryWrapper = new QueryWrapper<>();
+        vipGroupQueryWrapper.eq("user_id_",req.getUserId());
+        IPage<VipGroup> vipGroupPage = vipGroupService.page(page,vipGroupQueryWrapper);
+
+        List<VipGroup> vipGroupList = vipGroupPage.getRecords();
+        List<VipGroupClassResp> vipGroupClassRespList = new ArrayList<>();
+        if(!CollectionUtils.isEmpty(vipGroupList)){
+
+            vipGroupList.forEach(e ->{
+                VipGroupClassResp vipGroupClassResp = new VipGroupClassResp();
+                vipGroupClassResp.setVipGroupName(e.getName());
+                VipGroupCategory vipGroupCategory =  vipGroupCategoryService.getById(e.getVipGroupCategoryId());
+                if(vipGroupCategory != null){
+                    vipGroupClassResp.setVipClassType(vipGroupCategory.getName());
+                }
+
+                vipGroupDefaultClassesCycleService.list()
+               // vipGroupClassResp.setClassNum();
+
+            });
+        }
+
+        return null;
+    }
 }

+ 1 - 1
mec-education/src/main/java/com/ym/mec/education/service/impl/VipGroupCategoryServiceImpl.java

@@ -1,9 +1,9 @@
 package com.ym.mec.education.service.impl;
 
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.ym.mec.education.entity.VipGroupCategory;
 import com.ym.mec.education.mapper.VipGroupCategoryMapper;
 import com.ym.mec.education.service.IVipGroupCategoryService;
-import com.baomidou.mybatisplus.service.impl.ServiceImpl;
 import org.springframework.stereotype.Service;
 
 /**

+ 20 - 0
mec-education/src/main/java/com/ym/mec/education/service/impl/VipGroupDefaultClassesCycleServiceImpl.java

@@ -0,0 +1,20 @@
+package com.ym.mec.education.service.impl;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.ym.mec.education.entity.VipGroupDefaultClassesCycle;
+import com.ym.mec.education.mapper.VipGroupDefaultClassesCycleMapper;
+import com.ym.mec.education.service.IVipGroupDefaultClassesCycleService;
+import org.springframework.stereotype.Service;
+
+/**
+ * <p>
+ * vip课默认课程周期 服务实现类
+ * </p>
+ *
+ * @author lemeng
+ * @since 2019-10-02
+ */
+@Service
+public class VipGroupDefaultClassesCycleServiceImpl extends ServiceImpl<VipGroupDefaultClassesCycleMapper, VipGroupDefaultClassesCycle> implements IVipGroupDefaultClassesCycleService {
+
+}

+ 14 - 0
mec-education/src/main/java/com/ym/mec/education/utils/DateUtil.java

@@ -95,4 +95,18 @@ public class DateUtil {
         }
         return null;
     }
+
+
+    public static Integer subMin(Date startTime,Date endTime){
+
+        if(startTime != null && endTime != null){
+            long from = startTime.getTime();
+            long to = endTime.getTime();
+            Integer hours = (int) ((to - from)/(1000 * 60 * 60));
+
+            return hours;
+        }
+
+        return null;
+    }
 }

+ 1 - 1
mec-education/src/main/java/test/MpGenerator.java

@@ -72,7 +72,7 @@ public class MpGenerator {
         // strategy.setCapitalMode(true);// 全局大写命名 ORACLE 注意
         //strategy.setTablePrefix(new String[]{"tb_", "tsys_"});// 此处可以修改为您的表前缀
         strategy.setNaming(NamingStrategy.underline_to_camel);// 表名生成策略
-         strategy.setInclude(new String[] { "demo_group_courses_plan" }); // 需要生成的表
+         strategy.setInclude(new String[] { "vip_group_default_classes_cycle" }); // 需要生成的表
          //strategy.setExclude(new String[]{"sys_user"}); // 排除生成的表
         // 自定义实体父类
         // strategy.setSuperEntityClass("com.baomidou.demo.TestEntity");

+ 21 - 0
mec-education/src/main/resources/mapper/VipGroupDefaultClassesCycleMapper.xml

@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.ym.mec.education.mapper.VipGroupDefaultClassesCycleMapper">
+
+    <!-- 通用查询映射结果 -->
+    <resultMap id="BaseResultMap" type="com.ym.mec.education.entity.VipGroupDefaultClassesCycle">
+        <id column="id_" property="id" />
+        <result column="min_class_times_" property="minClassTimes" />
+        <result column="max_class_times_" property="maxClassTimes" />
+        <result column="month_" property="month" />
+        <result column="create_time_" property="createTime" />
+        <result column="update_time_" property="updateTime" />
+        <result column="organ_id_" property="organId" />
+    </resultMap>
+
+    <!-- 通用查询结果列 -->
+    <sql id="Base_Column_List">
+        id_, min_class_times_, max_class_times_, month_, create_time_, update_time_, organ_id_
+    </sql>
+
+</mapper>