Forráskód Böngészése

业务表student加了phone字段,student_visit加了prob_status,新加student_pre_visit表

王昭 2 éve
szülő
commit
bc7622b51d

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

@@ -0,0 +1,11 @@
+package com.ym.mec.biz.dal.dao;
+
+import com.ym.mec.biz.dal.entity.StudentPreVisit;
+import com.ym.mec.common.dal.BaseDAO;
+
+import java.util.List;
+
+public interface StudentPreVisitDao extends BaseDAO<Integer, StudentPreVisit> {
+
+	Integer batchInsert(List<StudentPreVisit> studentPreVisits);
+}

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

@@ -31,6 +31,11 @@ public interface StudentVisitDao extends BaseDAO<Integer, StudentVisit> {
     List<StudentVisitDto> getPageList(Map<String, Object> params);
 
     /**
+     * 修改状态
+     */
+    Integer updateProbStatus(@Param("id") Integer id ,@Param("probStatus")Integer probStatus);
+
+    /**
      * 获取学生列表
      *
      * @param params

+ 9 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dto/Student4operating.java

@@ -23,6 +23,7 @@ public class Student4operating {
     private String musicNetWorkTimesStr;
     private String groupNames;
     private Integer studentNum;
+    private String phone;
 
     public String getGroupNames() {
         return groupNames;
@@ -172,4 +173,12 @@ public class Student4operating {
     public void setMusicNetWorkTimesStr(String musicNetWorkTimesStr) {
         this.musicNetWorkTimesStr = musicNetWorkTimesStr;
     }
+
+    public String getPhone() {
+        return phone;
+    }
+
+    public void setPhone(String phone) {
+        this.phone = phone;
+    }
 }

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

@@ -0,0 +1,136 @@
+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 Integer 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(Integer teacherId){
+		this.teacherId = teacherId;
+	}
+	
+	public Integer 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);
+	}
+
+}

+ 23 - 3
mec-biz/src/main/java/com/ym/mec/biz/dal/entity/StudentVisit.java

@@ -1,19 +1,18 @@
 package com.ym.mec.biz.dal.entity;
 
+import com.ym.mec.biz.dal.enums.TeachModeEnum;
 import com.ym.mec.common.entity.BaseEntity;
 import com.ym.mec.common.enums.BaseEnum;
-
 import io.swagger.annotations.ApiModelProperty;
 
 import javax.validation.constraints.NotBlank;
 import javax.validation.constraints.PastOrPresent;
 import javax.validation.constraints.Positive;
-
 import java.util.Date;
 
 public class StudentVisit extends BaseEntity {
 
-    public enum VisiterTypeEnum implements BaseEnum<String, com.ym.mec.biz.dal.enums.TeachModeEnum> {
+    public enum VisiterTypeEnum implements BaseEnum<String, TeachModeEnum> {
         TEACHER("TEACHER", "指导老师"), EDU_TEACHER("EDU_TEACHER", "教务老师");
 
         private String code;
@@ -190,6 +189,11 @@ public class StudentVisit extends BaseEntity {
 
     private Long objectId;
 
+    private int probStatus;
+
+    private String visitCyCle;
+
+
     @ApiModelProperty(value = "回访图片", required = true)
     private String attachments;
 
@@ -320,4 +324,20 @@ public class StudentVisit extends BaseEntity {
     public void setObjectId(Long objectId) {
         this.objectId = objectId;
     }
+
+    public int getProbStatus() {
+        return probStatus;
+    }
+
+    public void setProbStatus(int probStatus) {
+        this.probStatus = probStatus;
+    }
+
+    public String getVisitCyCle() {
+        return visitCyCle;
+    }
+
+    public void setVisitCyCle(String visitCyCle) {
+        this.visitCyCle = visitCyCle;
+    }
 }

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

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

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

@@ -28,6 +28,11 @@ public interface StudentVisitService extends BaseService<Integer, StudentVisit>
     StudentVisitDto getInfo(Integer id);
 
     /**
+     * 根据id修改状态
+     */
+    String updateProbStatus(Integer id, Integer probStatus);
+
+    /**
      * 获取访问列表
      *
      * @param queryInfo

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

@@ -0,0 +1,46 @@
+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.entity.StudentPreVisit;
+import com.ym.mec.biz.service.StudentPreVisitService;
+import com.ym.mec.common.dal.BaseDAO;
+import com.ym.mec.common.service.impl.BaseServiceImpl;
+import com.ym.mec.util.date.DateUtil;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+
+@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) {
+		StudentPreVisit studentPreVisit = new StudentPreVisit();
+		List<StudentPreVisit> studentPreVisits = new ArrayList<>();
+		for (Student4operating student4operating : student4operatings) {
+			studentPreVisit.setStudentId(student4operating.getStudentId());
+			studentPreVisit.setOrganId(Integer.parseInt(student4operating.getOrganId()));
+			studentPreVisit.setStudentName(student4operating.getStudentName());
+			studentPreVisit.setPhone(student4operating.getPhone());
+			studentPreVisit.setTeacherId(Integer.parseInt(student4operating.getTeacherId()));
+			studentPreVisit.setTeacherName(student4operating.getTeacherName());
+			studentPreVisit.setOrgname(student4operating.getOrganName());
+			studentPreVisit.setVisitCycle(DateUtil.format(new Date(),"yyyy-MM").toString());
+			studentPreVisit.setIsVisit(0);
+			studentPreVisits.add(studentPreVisit);
+		}
+	return studentPreVisitDao.batchInsert(studentPreVisits);
+	}
+}

+ 7 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentVisitServiceImpl.java

@@ -99,6 +99,13 @@ public class StudentVisitServiceImpl extends BaseServiceImpl<Integer, StudentVis
     }
 
     @Override
+    public String updateProbStatus(Integer id, Integer probStatus) {
+        Integer status = studentVisitDao.updateProbStatus(id, probStatus);
+        return status >0 ?"成功":"失败";
+
+    }
+
+    @Override
     public PageInfo<StudentVisitDto> getPageList(StudentVisitQueryInfo queryInfo) {
         if (queryInfo.getEndTime() != null) {
             queryInfo.setEndTime(DateUtil.getLastTimeWithDay(queryInfo.getEndTime()));

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

@@ -0,0 +1,102 @@
+<?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.ArrayList">
+		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="list" 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="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>

+ 9 - 2
mec-biz/src/main/resources/config/mybatis/StudentVisitMapper.xml

@@ -45,13 +45,13 @@
         <!--@mbg.generated-->
         insert into student_visit (music_group_id_, organ_id_, student_id_, teacher_id_, visiter_type_, feedback_type_,feedback_type_desc_,
         type_, purpose_, overview_,
-        feedback_, visit_time_, create_time_,object_id_,tenant_id_,attachments_)
+        feedback_, visit_time_, create_time_,object_id_,tenant_id_,attachments_,prob_status)
         values (#{musicGroupId,jdbcType=VARCHAR}, #{organId,jdbcType=INTEGER}, #{studentId,jdbcType=INTEGER},
         #{teacherId,jdbcType=INTEGER},#{visiterType,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
                 #{feedbackType,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
                 #{feedbackTypeDesc,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
         #{type,jdbcType=VARCHAR}, #{purpose,jdbcType=VARCHAR}, #{overview,jdbcType=VARCHAR},
-        #{feedback,jdbcType=VARCHAR}, #{visitTime}, #{createTime},#{objectId},#{tenantId},#{attachments})
+        #{feedback,jdbcType=VARCHAR}, #{visitTime}, #{createTime},#{objectId},#{tenantId},#{attachments},#{probStatus})
     </insert>
     <update id="update" parameterType="com.ym.mec.biz.dal.entity.StudentVisit">
         <!--@mbg.generated-->
@@ -90,6 +90,10 @@
         </set>
         WHERE id_ = #{id,jdbcType=INTEGER} AND tenant_id_ = #{tenantId}
     </update>
+    <update id="updateProbStatus">
+        update student_visit set prob_status = #{probStatus}
+        where id_ = #{id}
+    </update>
 
     <select id="queryPage" resultMap="StudentVisit">
         SELECT * FROM student_visit sv
@@ -151,6 +155,9 @@
             <if test="endTime != null">
                 AND sv.visit_time_ &lt;= #{endTime}
             </if>
+            <if test="visitCyCle != null and visitCyCle != ''">
+                AND CONVERT (VARCHAR,sv.visit_time,120) LIKE CONCAT('%',#{visitCyCle},'%')
+            </if>
         </where>
     </sql>
     <select id="queryCount" resultType="int">

+ 3 - 0
mec-client-api/src/main/java/com/ym/mec/task/TaskRemoteService.java

@@ -277,4 +277,7 @@ public interface TaskRemoteService {
      */
     @GetMapping("task/pushStartTrain")
     void pushStartTrain();
+
+    @GetMapping("task/findAllWaitVisit")
+    void findAllWaitVisit();
 }

+ 5 - 0
mec-client-api/src/main/java/com/ym/mec/task/fallback/TaskRemoteServiceFallback.java

@@ -319,4 +319,9 @@ public class TaskRemoteServiceFallback implements TaskRemoteService {
     public void pushStartTrain(){
         logger.error("开始训练通知推送失败");
     }
+
+    @Override
+    public void findAllWaitVisit() {
+        logger.error("查询所有学员并生成未回访记录失败");
+    }
 }

+ 17 - 0
mec-task/src/main/java/com/ym/mec/task/jobs/findAllWaitVisitTask.java

@@ -0,0 +1,17 @@
+package com.ym.mec.task.jobs;
+
+import com.ym.mec.task.TaskRemoteService;
+import com.ym.mec.task.core.BaseTask;
+import com.ym.mec.task.core.TaskException;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+@Service
+public class findAllWaitVisitTask extends BaseTask {
+    @Autowired
+    private TaskRemoteService taskRemoteService;
+    @Override
+    public void execute() throws TaskException {
+        taskRemoteService.findAllWaitVisit();
+    }
+}

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

@@ -15,6 +15,7 @@ import com.ym.mec.common.page.PageInfo;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
@@ -61,6 +62,12 @@ public class VisitController extends BaseController {
         }
         return succeed(studentVisitService.getInfo(id));
     }
+    @ApiOperation(value = "修改问题状态")
+    @PostMapping(value = "/updateProbStatus")
+    @PreAuthorize("@pcs.hasPermissions('visit/updateProbStatus')")
+    public HttpResponseResult<String> updateProbStatus(Integer id,Integer probStatus) {
+        return succeed(studentVisitService.updateProbStatus(id,probStatus));
+    }
 
     @ApiOperation(value = "获取乐团列表")
     @GetMapping(value = "/getMusicGroup")

+ 15 - 1
mec-web/src/main/java/com/ym/mec/web/controller/TaskController.java

@@ -3,6 +3,8 @@ 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.TenantInfo;
 import com.ym.mec.biz.dal.enums.IndexDataType;
@@ -120,7 +122,10 @@ public class TaskController extends BaseController {
 	private ImSendGroupMessageService imSendGroupMessageService;
     @Autowired
     private TempLittleArtistTrainingCampService tempLittleArtistTrainingCampService;
-
+	@Autowired
+	private StudentPreVisitService studentPreVisitService;
+    @Autowired
+	private StudentDao studentDao;
     @GetMapping(value = "/syncImHistoryMessageTask")
 	// 同步即时通讯聊天记录
 	public void syncImHistoryMessageTask(String date) throws Exception {
@@ -602,4 +607,13 @@ public class TaskController extends BaseController {
         tempLittleArtistTrainingCampService.pushStartTrain();
     }
 
+	@ApiOperation("每月1日0点-根据service_tag_查询所有数据,并添加待回访表中")
+	@GetMapping(value = "/findAllWaitVisit")
+	public void findAllWaitVisit(){
+		Integer tenantId = TenantContextHolder.getTenantId();
+		//查出所有在服务的学员
+		List<Student4operating> operatingStudents = studentDao.getOperatingStudents(new HashMap<>());
+		studentPreVisitService.batchInsert(operatingStudents);
+	}
+
 }

+ 6 - 0
mec-web/src/main/java/com/ym/mec/web/controller/VisitController.java

@@ -44,6 +44,12 @@ public class VisitController extends BaseController {
         studentVisit.setVisiterType(StudentVisit.VisiterTypeEnum.EDU_TEACHER);
         return succeed(studentVisitService.addVisit(studentVisit));
     }
+    @ApiOperation(value = "修改问题状态")
+    @PostMapping(value = "/updateProbStatus")
+    @PreAuthorize("@pcs.hasPermissions('visit/updateProbStatus')")
+    public HttpResponseResult<String> updateProbStatus(Integer id,Integer probStatus) {
+        return succeed(studentVisitService.updateProbStatus(id,probStatus));
+    }
 
 
     @ApiOperation(value = "回访详情")