浏览代码

学员待回访列表

zouxuan 2 年之前
父节点
当前提交
6f0d659f72

+ 0 - 34
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/StudentPreVisitDao.java

@@ -1,34 +0,0 @@
-package com.ym.mec.biz.dal.dao;
-
-import com.ym.mec.biz.dal.dto.StudentPreVisitDto;
-import com.ym.mec.biz.dal.dto.StudentVisitDto;
-import com.ym.mec.biz.dal.entity.StudentPreVisit;
-import com.ym.mec.common.dal.BaseDAO;
-import org.apache.ibatis.annotations.Param;
-
-import java.util.List;
-import java.util.Map;
-
-public interface StudentPreVisitDao extends BaseDAO<Integer, StudentPreVisit> {
-	/**
-	 * 任务批量新增待回访记录
-	 * @param studentPreVisits
-	 * @return
-	 */
-	Integer batchInsert(@Param("studentPreVisits")List<StudentPreVisit> studentPreVisits);
-
-	/**
-	 *
-	 * @param studentId
-	 * @param visitCycle
-	 */
-	void updateVisit(@Param("studentId") Integer studentId, @Param("visitCycle") String visitCycle);
-
-	/**
-	 * 获取访问列表
-	 *
-	 * @param params
-	 * @return
-	 */
-	List<StudentPreVisitDto> getPageList(Map<String, Object> params);
-}

+ 12 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/StudentVisitDao.java

@@ -1,6 +1,7 @@
 package com.ym.mec.biz.dal.dao;
 
 import com.ym.mec.biz.dal.dto.BasicUserDto;
+import com.ym.mec.biz.dal.dto.StudentPreVisitDto;
 import com.ym.mec.biz.dal.dto.StudentVisitDto;
 import com.ym.mec.biz.dal.dto.TeacherVisitDto;
 import com.ym.mec.biz.dal.entity.StudentVisit;
@@ -80,4 +81,15 @@ public interface StudentVisitDao extends BaseDAO<Integer, StudentVisit> {
     List<Integer> queryRecordVisitStudentIds(@Param("teacherId") Integer teacherId,
                                              @Param("addDays1") Date addDays1,
                                              @Param("addDays3") Date addDays3);
+
+    /**
+    * @description: 获取当月待回访学员数量
+     * @param params
+    * @return int
+    * @author zx
+    * @date 2022/9/19 10:38
+    */
+    int countWaitVisit(Map<String, Object> params);
+
+    List<StudentPreVisitDto> queryWaitVisit(Map<String, Object> params);
 }

+ 41 - 81
mec-biz/src/main/java/com/ym/mec/biz/dal/dto/StudentPreVisitDto.java

@@ -1,124 +1,84 @@
 package com.ym.mec.biz.dal.dto;
 
-public class StudentPreVisitDto {
-    /**  */
-    private Integer id;
+import io.swagger.annotations.ApiModelProperty;
+
+import java.util.Date;
 
-    /** 分部 */
+public class StudentPreVisitDto {
+    @ApiModelProperty(value = "分部", required = false)
     private Integer organId;
 
-    /** 学生id */
+    @ApiModelProperty(value = "分部", required = false)
+    private String organName;
+
+    @ApiModelProperty(value = "学员编号", required = false)
     private Integer studentId;
 
-    /** 学生姓名 */
+    @ApiModelProperty(value = "学员姓名", required = false)
     private String studentName;
 
-    /** 老师id */
-    private Integer teacherId;
-
-    /** 老师姓名 */
-    private String teacherName;
-
-    /** 手机号 */
+    @ApiModelProperty(value = "手机", required = false)
     private String phone;
 
-    /** 组织名称 */
-    private String orgname;
-
-    /**  */
-    private Integer tenantId;
+    @ApiModelProperty(value = "月份", required = false)
+    private String month;
 
-    /** 访问状态 0待访问1已访问 */
-    private Integer isVisit;
+    @ApiModelProperty(value = "回访时间", required = false)
+    private Date createTime;
 
-    /** 访问周期 */
-    private String visitCycle;
-
-    public void setId(Integer id){
-        this.id = id;
-    }
-
-    public Integer getId(){
-        return this.id;
+    public Integer getOrganId() {
+        return organId;
     }
 
-    public void setOrganId(Integer organId){
+    public void setOrganId(Integer organId) {
         this.organId = organId;
     }
 
-    public Integer getOrganId(){
-        return this.organId;
-    }
-
-    public void setStudentId(Integer studentId){
-        this.studentId = studentId;
-    }
-
-    public Integer getStudentId(){
-        return this.studentId;
+    public String getOrganName() {
+        return organName;
     }
 
-    public void setStudentName(String studentName){
-        this.studentName = studentName;
+    public void setOrganName(String organName) {
+        this.organName = organName;
     }
 
-    public String getStudentName(){
-        return this.studentName;
+    public Integer getStudentId() {
+        return studentId;
     }
 
-    public void setTeacherId(Integer teacherId){
-        this.teacherId = teacherId;
+    public void setStudentId(Integer studentId) {
+        this.studentId = studentId;
     }
 
-    public Integer getTeacherId(){
-        return this.teacherId;
+    public String getStudentName() {
+        return studentName;
     }
 
-    public void setTeacherName(String teacherName){
-        this.teacherName = teacherName;
+    public void setStudentName(String studentName) {
+        this.studentName = studentName;
     }
 
-    public String getTeacherName(){
-        return this.teacherName;
+    public String getPhone() {
+        return phone;
     }
 
-    public void setPhone(String phone){
+    public void setPhone(String phone) {
         this.phone = phone;
     }
 
-    public String getPhone(){
-        return this.phone;
-    }
-
-    public void setOrgname(String orgname){
-        this.orgname = orgname;
-    }
-
-    public String getOrgname(){
-        return this.orgname;
-    }
-
-    public void setTenantId(Integer tenantId){
-        this.tenantId = tenantId;
-    }
-
-    public Integer getTenantId(){
-        return this.tenantId;
-    }
-
-    public void setIsVisit(Integer isVisit){
-        this.isVisit = isVisit;
+    public String getMonth() {
+        return month;
     }
 
-    public Integer getIsVisit(){
-        return this.isVisit;
+    public void setMonth(String month) {
+        this.month = month;
     }
 
-    public void setVisitCycle(String visitCycle){
-        this.visitCycle = visitCycle;
+    public Date getCreateTime() {
+        return createTime;
     }
 
-    public String getVisitCycle(){
-        return this.visitCycle;
+    public void setCreateTime(Date createTime) {
+        this.createTime = createTime;
     }
 }

+ 0 - 136
mec-biz/src/main/java/com/ym/mec/biz/dal/entity/StudentPreVisit.java

@@ -1,136 +0,0 @@
-package com.ym.mec.biz.dal.entity;
-
-import org.apache.commons.lang3.builder.ToStringBuilder;
-
-/**
- * 对应数据库表(student_pre_visit):
- */
-public class StudentPreVisit {
-
-	/**  */
-	private Integer id;
-	
-	/** 分部 */
-	private Integer organId;
-	
-	/** 学生id */
-	private Integer studentId;
-	
-	/** 学生姓名 */
-	private String studentName;
-	
-	/** 老师id */
-	private String teacherId;
-	
-	/** 老师姓名 */
-	private String teacherName;
-	
-	/** 手机号 */
-	private String phone;
-	
-	/** 组织名称 */
-	private String orgname;
-	
-	/**  */
-	private Integer tenantId;
-	
-	/** 访问状态 0待访问1已访问 */
-	private Integer isVisit;
-	
-	/** 访问周期 */
-	private String visitCycle;
-	
-	public void setId(Integer id){
-		this.id = id;
-	}
-	
-	public Integer getId(){
-		return this.id;
-	}
-			
-	public void setOrganId(Integer organId){
-		this.organId = organId;
-	}
-	
-	public Integer getOrganId(){
-		return this.organId;
-	}
-			
-	public void setStudentId(Integer studentId){
-		this.studentId = studentId;
-	}
-	
-	public Integer getStudentId(){
-		return this.studentId;
-	}
-			
-	public void setStudentName(String studentName){
-		this.studentName = studentName;
-	}
-	
-	public String getStudentName(){
-		return this.studentName;
-	}
-			
-	public void setTeacherId(String teacherId){
-		this.teacherId = teacherId;
-	}
-	
-	public String getTeacherId(){
-		return this.teacherId;
-	}
-			
-	public void setTeacherName(String teacherName){
-		this.teacherName = teacherName;
-	}
-	
-	public String getTeacherName(){
-		return this.teacherName;
-	}
-			
-	public void setPhone(String phone){
-		this.phone = phone;
-	}
-	
-	public String getPhone(){
-		return this.phone;
-	}
-			
-	public void setOrgname(String orgname){
-		this.orgname = orgname;
-	}
-	
-	public String getOrgname(){
-		return this.orgname;
-	}
-			
-	public void setTenantId(Integer tenantId){
-		this.tenantId = tenantId;
-	}
-	
-	public Integer getTenantId(){
-		return this.tenantId;
-	}
-			
-	public void setIsVisit(Integer isVisit){
-		this.isVisit = isVisit;
-	}
-	
-	public Integer getIsVisit(){
-		return this.isVisit;
-	}
-			
-	public void setVisitCycle(String visitCycle){
-		this.visitCycle = visitCycle;
-	}
-	
-	public String getVisitCycle(){
-		return this.visitCycle;
-	}
-			
-	@Override
-	public String toString() {
-		return ToStringBuilder.reflectionToString(this);
-	}
-
-}

+ 10 - 21
mec-biz/src/main/java/com/ym/mec/biz/dal/page/StudentPreVisitQueryInfo.java

@@ -4,23 +4,12 @@ import com.ym.mec.common.page.QueryInfo;
 import io.swagger.annotations.ApiModelProperty;
 
 public class StudentPreVisitQueryInfo extends QueryInfo {
-    @ApiModelProperty(value = "学生姓名或id搜索或者手机号", required = false)
-    private String student;
-
     @ApiModelProperty(value = "分部id", required = false)
     private String organId;
 
-    private Integer isVisit;
-
-    private String visitCycle;
+    private Boolean visitFlag;
 
-    public String getStudent() {
-        return student;
-    }
-
-    public void setStudent(String student) {
-        this.student = student;
-    }
+    private String month;
 
     public String getOrganId() {
         return organId;
@@ -30,19 +19,19 @@ public class StudentPreVisitQueryInfo extends QueryInfo {
         this.organId = organId;
     }
 
-    public Integer getIsVisit() {
-        return isVisit;
+    public Boolean getVisitFlag() {
+        return visitFlag;
     }
 
-    public void setIsVisit(Integer isVisit) {
-        this.isVisit = isVisit;
+    public void setVisitFlag(Boolean visitFlag) {
+        this.visitFlag = visitFlag;
     }
 
-    public String getVisitCycle() {
-        return visitCycle;
+    public String getMonth() {
+        return month;
     }
 
-    public void setVisitCycle(String visitCycle) {
-        this.visitCycle = visitCycle;
+    public void setMonth(String month) {
+        this.month = month;
     }
 }

+ 0 - 15
mec-biz/src/main/java/com/ym/mec/biz/service/StudentPreVisitService.java

@@ -1,15 +0,0 @@
-package com.ym.mec.biz.service;
-
-import com.ym.mec.biz.dal.dto.Student4operating;
-import com.ym.mec.biz.dal.dto.StudentPreVisitDto;
-import com.ym.mec.biz.dal.entity.StudentPreVisit;
-import com.ym.mec.biz.dal.page.StudentPreVisitQueryInfo;
-import com.ym.mec.common.page.PageInfo;
-import com.ym.mec.common.service.BaseService;
-
-import java.util.List;
-
-public interface StudentPreVisitService extends BaseService<Integer, StudentPreVisit> {
-    Integer batchInsert(List<Student4operating> student4operatings);
-    PageInfo<StudentPreVisitDto> getPageList(StudentPreVisitQueryInfo queryInfo);
-}

+ 4 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/StudentVisitService.java

@@ -1,10 +1,12 @@
 package com.ym.mec.biz.service;
 
 import com.ym.mec.biz.dal.dto.BasicUserDto;
+import com.ym.mec.biz.dal.dto.StudentPreVisitDto;
 import com.ym.mec.biz.dal.dto.StudentVisitDto;
 import com.ym.mec.biz.dal.entity.MusicGroup;
 import com.ym.mec.biz.dal.entity.StudentRegistration;
 import com.ym.mec.biz.dal.entity.StudentVisit;
+import com.ym.mec.biz.dal.page.StudentPreVisitQueryInfo;
 import com.ym.mec.biz.dal.page.StudentVisitQueryInfo;
 import com.ym.mec.common.page.PageInfo;
 import com.ym.mec.common.service.BaseService;
@@ -64,4 +66,6 @@ public interface StudentVisitService extends BaseService<Integer, StudentVisit>
      * @return
      */
     PageInfo<BasicUserDto> getStudents(StudentVisitQueryInfo queryInfo);
+
+    PageInfo<StudentPreVisitDto> queryWaitVisit(StudentPreVisitQueryInfo queryInfo);
 }

+ 0 - 79
mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentPreVisitServiceImpl.java

@@ -1,79 +0,0 @@
-package com.ym.mec.biz.service.impl;
-
-import com.ym.mec.biz.dal.dao.StudentPreVisitDao;
-import com.ym.mec.biz.dal.dto.Student4operating;
-import com.ym.mec.biz.dal.dto.StudentPreVisitDto;
-import com.ym.mec.biz.dal.dto.StudentVisitDto;
-import com.ym.mec.biz.dal.entity.StudentPreVisit;
-import com.ym.mec.biz.dal.page.StudentPreVisitQueryInfo;
-import com.ym.mec.biz.dal.page.StudentVisitQueryInfo;
-import com.ym.mec.biz.service.StudentPreVisitService;
-import com.ym.mec.common.dal.BaseDAO;
-import com.ym.mec.common.page.PageInfo;
-import com.ym.mec.common.service.impl.BaseServiceImpl;
-import com.ym.mec.util.collection.MapUtil;
-import com.ym.mec.util.date.DateUtil;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-
-import java.text.SimpleDateFormat;
-import java.util.*;
-
-@Service
-public class StudentPreVisitServiceImpl extends BaseServiceImpl<Integer, StudentPreVisit> implements StudentPreVisitService {
-	
-	@Autowired
-	private StudentPreVisitDao studentPreVisitDao;
-
-	@Override
-	public BaseDAO<Integer, StudentPreVisit> getDAO() {
-		return studentPreVisitDao;
-	}
-
-	@Override
-	public Integer batchInsert(List<Student4operating> student4operatings) {
-		List<StudentPreVisit> studentPreVisits = new ArrayList<>();
-		for (Student4operating student4operating : student4operatings) {
-			StudentPreVisit studentPreVisit = new StudentPreVisit();
-			studentPreVisit.setStudentId(student4operating.getStudentId());
-			studentPreVisit.setOrganId(Integer.parseInt(student4operating.getOrganId()));
-			studentPreVisit.setStudentName(student4operating.getStudentName());
-			studentPreVisit.setPhone(student4operating.getPhone());
-			studentPreVisit.setTeacherId(student4operating.getTeacherId());
-			studentPreVisit.setTeacherName(student4operating.getTeacherName());
-			studentPreVisit.setOrgname(student4operating.getOrganName());
-			SimpleDateFormat sf=new SimpleDateFormat("yyyy-MM");
-			GregorianCalendar gc=new GregorianCalendar();
-			gc.setTime(new Date());
-			gc.add(2,-1);
-			String format = sf.format(gc.getTime());
-			//这里月份进行了减一,因为生成的上月的数据
-			studentPreVisit.setVisitCycle(format);
-			studentPreVisit.setIsVisit(0);
-			studentPreVisits.add(studentPreVisit);
-		}
-
-	return studentPreVisitDao.batchInsert(studentPreVisits);
-	}
-
-
-	@Override
-	public PageInfo<StudentPreVisitDto> getPageList(StudentPreVisitQueryInfo queryInfo) {
-
-		PageInfo<StudentPreVisitDto> pageInfo = new PageInfo<>(queryInfo.getPage(), queryInfo.getRows());
-		Map<String, Object> params = new HashMap<String, Object>();
-		MapUtil.populateMap(params, queryInfo);
-
-		List<StudentPreVisitDto> dataList = new ArrayList<>();
-		int count = this.findCount(params);
-		if (count > 0) {
-			pageInfo.setTotal(count);
-			params.put("offset", pageInfo.getOffset());
-			dataList = studentPreVisitDao.getPageList(params);
-		}
-		pageInfo.setRows(dataList);
-		return pageInfo;
-	}
-
-
-}

+ 24 - 5
mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentVisitServiceImpl.java

@@ -3,16 +3,18 @@ package com.ym.mec.biz.service.impl;
 import com.ym.mec.auth.api.entity.SysUser;
 import com.ym.mec.biz.dal.dao.*;
 import com.ym.mec.biz.dal.dto.BasicUserDto;
-import com.ym.mec.biz.dal.dto.PageInfoDegree;
+import com.ym.mec.biz.dal.dto.StudentPreVisitDto;
 import com.ym.mec.biz.dal.dto.StudentVisitDto;
 import com.ym.mec.biz.dal.entity.*;
 import com.ym.mec.biz.dal.enums.YesOrNoEnum;
+import com.ym.mec.biz.dal.page.StudentPreVisitQueryInfo;
 import com.ym.mec.biz.dal.page.StudentVisitQueryInfo;
 import com.ym.mec.biz.service.StudentVisitService;
 import com.ym.mec.common.dal.BaseDAO;
 import com.ym.mec.common.exception.BizException;
 import com.ym.mec.common.page.PageInfo;
 import com.ym.mec.common.service.impl.BaseServiceImpl;
+import com.ym.mec.common.tenant.TenantContextHolder;
 import com.ym.mec.util.collection.MapUtil;
 import com.ym.mec.util.date.DateUtil;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -43,8 +45,6 @@ public class StudentVisitServiceImpl extends BaseServiceImpl<Integer, StudentVis
     private StudentAttendanceDao studentAttendanceDao;
     @Autowired
     private StudentOperatingVisitDao studentOperatingVisitDao;
-    @Autowired
-    private StudentPreVisitDao studentPreVisitDao;
 
 
     @Override
@@ -92,8 +92,6 @@ public class StudentVisitServiceImpl extends BaseServiceImpl<Integer, StudentVis
         studentVisitDao.insert(studentVisit);
         //更新学员回访统计数据
         studentOperatingVisitDao.updateVisit(studentVisit.getStudentId(),DateUtil.format(studentVisit.getVisitTime(),DateUtil.ISO_YEAR_MONTH_FORMAT));
-        //更新学员回访状态
-        studentPreVisitDao.updateVisit(studentVisit.getStudentId(),DateUtil.format(studentVisit.getVisitTime(),DateUtil.ISO_YEAR_MONTH_FORMAT));
         return studentVisit;
     }
 
@@ -166,4 +164,25 @@ public class StudentVisitServiceImpl extends BaseServiceImpl<Integer, StudentVis
         pageInfo.setRows(dataList);
         return pageInfo;
     }
+
+    @Override
+    public PageInfo<StudentPreVisitDto> queryWaitVisit(StudentPreVisitQueryInfo queryInfo) {
+        PageInfo<StudentPreVisitDto> pageInfo = new PageInfo<>(queryInfo.getPage(), queryInfo.getRows());
+        Map<String, Object> params = new HashMap<>();
+        MapUtil.populateMap(params, queryInfo);
+        List<StudentPreVisitDto> dataList = new ArrayList<>();
+        int count = studentVisitDao.countWaitVisit(params);
+        if (count > 0) {
+            pageInfo.setTotal(count);
+            params.put("offset", pageInfo.getOffset());
+            dataList = studentVisitDao.queryWaitVisit(params);
+            Set<Integer> collect = dataList.stream().map(e -> e.getOrganId()).collect(Collectors.toSet());
+            Map<Integer,String> organMap = getMap("organization", "id_", "name_", collect, TenantContextHolder.getTenantId(), Integer.class, String.class);
+            for (StudentPreVisitDto visitDto : dataList) {
+                visitDto.setOrganName(organMap.get(visitDto.getOrganId()));
+            }
+        }
+        pageInfo.setRows(dataList);
+        return pageInfo;
+    }
 }

+ 0 - 130
mec-biz/src/main/resources/config/mybatis/StudentPreVisitMapper.xml

@@ -1,130 +0,0 @@
-<?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.biz.dal.dao.StudentPreVisitDao">
-	
-	<resultMap type="com.ym.mec.biz.dal.entity.StudentPreVisit" id="StudentPreVisit">
-		<result column="id_" property="id" />
-		<result column="organ_id_" property="organId" />
-		<result column="student_id_" property="studentId" />
-		<result column="student_name" property="studentName" />
-		<result column="teacher_id_" property="teacherId" />
-		<result column="teacher_name" property="teacherName" />
-		<result column="phone" property="phone" />
-		<result column="orgName" property="orgname" />
-		<result column="tenant_id_" property="tenantId" />
-		<result column="is_visit" property="isVisit" />
-		<result column="visit_cycle" property="visitCycle" />
-	</resultMap>
-	
-	<!-- 根据主键查询一条记录 -->
-	<select id="get" resultMap="StudentPreVisit" >
-		SELECT * FROM student_pre_visit WHERE id_ = #{id} 
-	</select>
-	
-	<!-- 全查询 -->
-	<select id="findAll" resultMap="StudentPreVisit">
-		SELECT * FROM student_pre_visit ORDER BY id_
-	</select>
-	
-	<!-- 向数据库增加一条记录 -->
-	<insert id="insert" parameterType="com.ym.mec.biz.dal.entity.StudentPreVisit" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
-		<!--
-		<selectKey resultClass="int" keyProperty="id" > 
-		SELECT SEQ_WSDEFINITION_ID.nextval AS ID FROM DUAL 
-		</selectKey>
-		-->
-		INSERT INTO student_pre_visit (id_,organ_id_,student_id_,student_name,teacher_id_,teacher_name,phone,orgName,tenant_id_,is_visit,visit_cycle) VALUES(#{id},#{organId},#{studentId},#{studentName},#{teacherId},#{teacherName},#{phone},#{orgname},#{tenantId},#{isVisit},#{visitCycle})
-	</insert>
-	<insert id="batchInsert" parameterType="java.util.List">
-		INSERT INTO student_pre_visit (id_,organ_id_,student_id_,student_name,teacher_id_,teacher_name,phone,orgName,tenant_id_,is_visit,visit_cycle) VALUES
-		<foreach collection="studentPreVisits" item="item" index="index" separator=",">
-			(#{item.id},#{item.organId},#{item.studentId},#{item.studentName},#{item.teacherId},#{item.teacherName},#{item.phone},#{item.orgname},#{item.tenantId},#{item.isVisit},#{item.visitCycle})
-		</foreach>
-	</insert>
-	<update id="updateVisit">
-			UPDATE student_pre_visit set is_visit = 1 where visit_cycle =#{visitCycle} and student_id_ = #{studentId}
-	</update>
-
-	<select id="getPageList" resultMap="StudentPreVisit">
-		SELECT sv.* FROM
-        student_pre_visit sv
-		<include refid="queryPageSql"/>
-	</select>
-
-	<sql id="queryPageSql">
-		<where>
-
-			<if test="student !=null  and student != ''" >
-				AND sv.student_id_ = #{student} OR sv.student_name =#{student} or sv.phone = #{student}
-			</if>
-			<if test="organId != null and organId != ''">
-				AND FIND_IN_SET(sv.organ_id_,#{organId})
-			</if>
-			<if test="isVisit != null and isVisit != ''">
-				AND sv.is_visit = #{isVisit}
-			</if>
-			<if test="visitCycle != null and visitCycle != ''">
-				AND sv.visit_cycle = #{visitCycle}
-			</if>
-
-		</where>
-	</sql>
-	
-	<!-- 根据主键查询一条记录 -->
-	<update id="update" parameterType="com.ym.mec.biz.dal.entity.StudentPreVisit">
-		UPDATE student_pre_visit <set>
-<if test="studentName != null">
-student_name = #{studentName},
-</if>
-<if test="organId != null">
-organ_id_ = #{organId},
-</if>
-<if test="teacherName != null">
-teacher_name = #{teacherName},
-</if>
-<if test="isVisit != null">
-is_visit = #{isVisit},
-</if>
-<if test="orgname != null">
-orgName = #{orgname},
-</if>
-<if test="id != null">
-id_ = #{id},
-</if>
-<if test="phone != null">
-phone = #{phone},
-</if>
-<if test="teacherId != null">
-teacher_id_ = #{teacherId},
-</if>
-<if test="tenantId != null">
-tenant_id_ = #{tenantId},
-</if>
-<if test="studentId != null">
-student_id_ = #{studentId},
-</if>
-<if test="visitCycle != null">
-visit_cycle = #{visitCycle},
-</if>
-</set> WHERE id_ = #{id} 
-	</update>
-	
-	<!-- 根据主键删除一条记录 -->
-	<delete id="delete" >
-		DELETE FROM student_pre_visit WHERE id_ = #{id} 
-	</delete>
-	
-	<!-- 分页查询 -->
-	<select id="queryPage" resultMap="StudentPreVisit" parameterType="map">
-		SELECT * FROM student_pre_visit ORDER BY id_ <include refid="global.limit"/>
-	</select>
-	
-	<!-- 查询当前表的总记录数 -->
-	<select id="queryCount" resultType="int">
-		SELECT COUNT(*) FROM student_pre_visit
-	</select>
-</mapper>

+ 44 - 0
mec-biz/src/main/resources/config/mybatis/StudentVisitMapper.xml

@@ -228,4 +228,48 @@
         WHERE sv.type_ = '云教练' AND st.teacher_id_ = #{teacherId}
         AND sv.visit_time_ BETWEEN DATE_FORMAT(#{addDays1}, '%Y%m%d') AND DATE_FORMAT(#{addDays3}, '%Y%m%d')
     </select>
+    <select id="countWaitVisit" resultType="java.lang.Integer">
+        select COUNT(sov.user_id_) from student_operating_visit sov
+        LEFT JOIN sys_user su ON su.id_ = sov.user_id_
+        LEFT JOIN (select sv.student_id_,MAX(sv.create_time_) create_time_ from student_visit sv
+        where sv.student_id_ IS NOT NULL group by sv.student_id_,DATE_FORMAT(sv.create_time_,'%Y-%m')) sv ON sv.student_id_ = sov.user_id_ AND sov.month_ = DATE_FORMAT(sv.create_time_,'%Y-%m')
+        <include refid="queryWaitVisitSql"/>
+    </select>
+    <sql id="queryWaitVisitSql">
+        <where>
+            <if test="visitFlag != null and visitFlag == 1">
+                AND sv.create_time_ IS NOT NULL
+            </if>
+            <if test="visitFlag != null and visitFlag == 0">
+                AND sv.create_time_ IS NULL
+            </if>
+            <if test="month != null and month != ''">
+                AND sov.month_ = #{month}
+            </if>
+            <if test="organId != null and organId != ''">
+                AND FIND_IN_SET(sov.organ_id_,#{organId})
+            </if>
+            <if test="search != null and search != ''">
+                AND (su.username_ LIKE CONCAT('%',#{search},'%') OR su.phone_ LIKE CONCAT('%',#{search},'%') OR su.id_ = #{search})
+            </if>
+        </where>
+    </sql>
+    <resultMap type="com.ym.mec.biz.dal.dto.StudentPreVisitDto" id="StudentPreVisitDto">
+        <result column="organ_id_" property="organId" />
+        <result column="user_id_" property="studentId" />
+        <result column="username_" property="studentName" />
+        <result column="phone_" property="phone" />
+        <result column="organName" property="organName" />
+        <result column="month_" property="month" />
+        <result column="create_time_" property="createTime" />
+    </resultMap>
+    <select id="queryWaitVisit" resultMap="StudentPreVisitDto">
+        select sov.user_id_,su.username_,su.phone_,sov.month_,sv.create_time_,sov.organ_id_ from student_operating_visit sov
+        LEFT JOIN sys_user su ON su.id_ = sov.user_id_
+        LEFT JOIN (select sv.student_id_,MAX(sv.create_time_) create_time_ from student_visit sv
+        where sv.student_id_ IS NOT NULL group by sv.student_id_,DATE_FORMAT(sv.create_time_,'%Y-%m')) sv ON sv.student_id_ = sov.user_id_ AND sov.month_ = DATE_FORMAT(sv.create_time_,'%Y-%m')
+        <include refid="queryWaitVisitSql"/>
+        order by sov.month_ DESC,sv.create_time_
+        <include refid="global.limit"/>
+    </select>
 </mapper>

+ 0 - 15
mec-teacher/src/main/java/com/ym/mec/teacher/controller/VisitController.java

@@ -3,15 +3,11 @@ package com.ym.mec.teacher.controller;
 import com.ym.mec.auth.api.client.SysUserFeignService;
 import com.ym.mec.auth.api.entity.SysUser;
 import com.ym.mec.biz.dal.dto.BasicUserDto;
-import com.ym.mec.biz.dal.dto.StudentPreVisitDto;
 import com.ym.mec.biz.dal.dto.StudentVisitDto;
 import com.ym.mec.biz.dal.entity.MusicGroup;
 import com.ym.mec.biz.dal.entity.StudentRegistration;
 import com.ym.mec.biz.dal.entity.StudentVisit;
-import com.ym.mec.biz.dal.page.StudentPreVisitQueryInfo;
 import com.ym.mec.biz.dal.page.StudentVisitQueryInfo;
-import com.ym.mec.biz.service.OrganizationService;
-import com.ym.mec.biz.service.StudentPreVisitService;
 import com.ym.mec.biz.service.StudentVisitService;
 import com.ym.mec.common.controller.BaseController;
 import com.ym.mec.common.entity.HttpResponseResult;
@@ -33,10 +29,6 @@ public class VisitController extends BaseController {
     private StudentVisitService studentVisitService;
     @Autowired
     private SysUserFeignService sysUserFeignService;
-    @Autowired
-    private StudentPreVisitService studentPreVisitService;
-    @Autowired
-    private OrganizationService organizationService;
 
     @ApiOperation(value = "回访列表")
     @GetMapping("/queryPage")
@@ -55,13 +47,6 @@ public class VisitController extends BaseController {
         studentVisitService.addVisit(studentVisit);
         return succeed(studentVisit);
     }
-    @ApiOperation(value = "待回访列表")
-    @GetMapping("/queryVisitPage")
-    @PreAuthorize("@pcs.hasPermissions('visit/queryVisitPage')")
-    public HttpResponseResult<PageInfo<StudentPreVisitDto>> queryVisitPage(StudentPreVisitQueryInfo queryInfo) {
-        queryInfo.setOrganId(organizationService.getEmployeeOrgan(queryInfo.getOrganId()));
-        return succeed(studentPreVisitService.getPageList(queryInfo));
-    }
 
 
     @ApiOperation(value = "回访详情")

+ 0 - 32
mec-web/src/main/java/com/ym/mec/web/controller/TaskController.java

@@ -3,18 +3,12 @@ package com.ym.mec.web.controller;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.ym.mec.biz.dal.dao.MusicGroupSchoolTermCourseDetailDao;
-import com.ym.mec.biz.dal.dao.StudentDao;
-import com.ym.mec.biz.dal.dto.Student4operating;
 import com.ym.mec.biz.dal.entity.MusicGroupSchoolTermCourseDetail;
-import com.ym.mec.biz.dal.entity.OperatingReport;
-import com.ym.mec.biz.dal.entity.OperatingReportCloud;
 import com.ym.mec.biz.dal.entity.TenantInfo;
 import com.ym.mec.biz.dal.enums.IndexDataType;
-import com.ym.mec.biz.dal.page.StudentOperatingQueryInfo;
 import com.ym.mec.biz.event.source.CourseEventSource;
 import com.ym.mec.biz.service.*;
 import com.ym.mec.common.controller.BaseController;
-import com.ym.mec.common.page.PageInfo;
 import com.ym.mec.common.redis.service.RedisCache;
 import com.ym.mec.common.tenant.TenantContextHolder;
 import com.ym.mec.im.ImFeignService;
@@ -124,10 +118,6 @@ public class TaskController extends BaseController {
 	private ImSendGroupMessageService imSendGroupMessageService;
     @Autowired
     private TempLittleArtistTrainingCampService tempLittleArtistTrainingCampService;
-	@Autowired
-	private StudentPreVisitService studentPreVisitService;
-    @Autowired
-	private StudentManageService studentManageService;
     @Autowired
     private OperatingReportNewService operatingReportNewService;
 
@@ -618,26 +608,4 @@ public class TaskController extends BaseController {
     public void  pushStartTrain(){
         tempLittleArtistTrainingCampService.pushStartTrain();
     }
-
-	@ApiOperation("每月1日0点-根据service_tag_查询所有数据,并添加待回访表中")
-	@GetMapping(value = "/findAllWaitVisit")
-	public void findAllWaitVisit(){
-		List<TenantInfo> tenantInfos = tenantInfoService.list(new QueryWrapper<TenantInfo>().eq("state_",1));
-		List<Student4operating> student4operatingList = new ArrayList<>();
-		List<Integer> tenantIds = new ArrayList<>();
-		for (TenantInfo tenantInfo : tenantInfos) {
-			Integer id = tenantInfo.getId();
-			StudentOperatingQueryInfo queryInfo =new StudentOperatingQueryInfo();
-			queryInfo.setOperatingTag(1);
-			queryInfo.setTenantId(id);
-			PageInfo<Student4operating> operatingStudents = studentManageService.getOperatingStudents(queryInfo);
-			List<Student4operating> list = operatingStudents.getRows();
-			student4operatingList.addAll(list);
-		}
-
-		if(student4operatingList !=null && student4operatingList.size()>0) {
-			studentPreVisitService.batchInsert(student4operatingList);
-		}
-	}
-
 }

+ 4 - 8
mec-web/src/main/java/com/ym/mec/web/controller/VisitController.java

@@ -6,7 +6,6 @@ import com.ym.mec.biz.dal.entity.StudentVisit;
 import com.ym.mec.biz.dal.page.StudentPreVisitQueryInfo;
 import com.ym.mec.biz.dal.page.StudentVisitQueryInfo;
 import com.ym.mec.biz.service.OrganizationService;
-import com.ym.mec.biz.service.StudentPreVisitService;
 import com.ym.mec.biz.service.StudentVisitService;
 import com.ym.mec.biz.service.SysUserService;
 import com.ym.mec.common.controller.BaseController;
@@ -31,9 +30,6 @@ public class VisitController extends BaseController {
     @Autowired
     private OrganizationService organizationService;
 
-    @Autowired
-    private StudentPreVisitService studentPreVisitService;
-
     @ApiOperation(value = "回访列表")
     @GetMapping("/queryPage")
     @PreAuthorize("@pcs.hasPermissions('visit/queryPage')")
@@ -43,11 +39,11 @@ public class VisitController extends BaseController {
     }
 
     @ApiOperation(value = "待回访列表")
-    @GetMapping("/queryVisitPage")
-    @PreAuthorize("@pcs.hasPermissions('visit/queryVisitPage')")
-    public HttpResponseResult<PageInfo<StudentPreVisitDto>> queryVisitPage(StudentPreVisitQueryInfo queryInfo) {
+    @PostMapping("/queryWaitVisit")
+    @PreAuthorize("@pcs.hasPermissions('visit/queryWaitVisit')")
+    public HttpResponseResult<PageInfo<StudentPreVisitDto>> queryVisitPage(@RequestBody StudentPreVisitQueryInfo queryInfo) {
         queryInfo.setOrganId(organizationService.getEmployeeOrgan(queryInfo.getOrganId()));
-        return succeed(studentPreVisitService.getPageList(queryInfo));
+        return succeed(studentVisitService.queryWaitVisit(queryInfo));
     }
 
     @ApiOperation(value = "添加回访")