Browse Source

学员小课数据统计

zouxuan 3 years ago
parent
commit
655770c375

+ 11 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/entity/StudentStatistics.java

@@ -68,6 +68,9 @@ public class StudentStatistics {
 
 
 	/** 预收款(未排课 价值总和) */
 	/** 预收款(未排课 价值总和) */
 	private java.math.BigDecimal noCourseFee;
 	private java.math.BigDecimal noCourseFee;
+
+	/** 预收款(总金额) */
+	private java.math.BigDecimal preCourseFee;
 	
 	
 	/** 首次付费订单时间 */
 	/** 首次付费订单时间 */
 	private String firstOrderTime;
 	private String firstOrderTime;
@@ -81,6 +84,14 @@ public class StudentStatistics {
 	/** 课程组类型(VIP乐理网管) */
 	/** 课程组类型(VIP乐理网管) */
 	private String groupType;
 	private String groupType;
 
 
+	public BigDecimal getPreCourseFee() {
+		return preCourseFee;
+	}
+
+	public void setPreCourseFee(BigDecimal preCourseFee) {
+		this.preCourseFee = preCourseFee;
+	}
+
 	public Integer getLatelyYearCourseConsumer() {
 	public Integer getLatelyYearCourseConsumer() {
 		return latelyYearCourseConsumer;
 		return latelyYearCourseConsumer;
 	}
 	}

+ 11 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/page/StudentStatisticsQueryInfo.java

@@ -48,6 +48,17 @@ public class StudentStatisticsQueryInfo extends QueryInfo {
     @ApiModelProperty(value = "第一次课截止时间(年月日)",required = false)
     @ApiModelProperty(value = "第一次课截止时间(年月日)",required = false)
     private String firstCourseEndTime;
     private String firstCourseEndTime;
 
 
+    @ApiModelProperty(value = "分部编号列表",required = false)
+    private String organId;
+
+    public String getOrganId() {
+        return organId;
+    }
+
+    public void setOrganId(String organId) {
+        this.organId = organId;
+    }
+
     public String getGroupType() {
     public String getGroupType() {
         return groupType;
         return groupType;
     }
     }

+ 2 - 1
mec-biz/src/main/resources/config/mybatis/StudentStatisticsMapper.xml

@@ -27,6 +27,7 @@
 		<result column="last_visit_time_" property="lastVisitTime" />
 		<result column="last_visit_time_" property="lastVisitTime" />
 		<result column="not_start_course_fee_" property="notStartCourseFee" />
 		<result column="not_start_course_fee_" property="notStartCourseFee" />
 		<result column="no_course_fee_" property="noCourseFee" />
 		<result column="no_course_fee_" property="noCourseFee" />
+		<result column="preCourseFee" property="preCourseFee" />
 		<result column="first_order_time_" property="firstOrderTime" />
 		<result column="first_order_time_" property="firstOrderTime" />
 		<result column="last_order_time_" property="lastOrderTime" />
 		<result column="last_order_time_" property="lastOrderTime" />
 		<result column="order_num_" property="orderNum" />
 		<result column="order_num_" property="orderNum" />
@@ -233,7 +234,7 @@
 		<include refid="queryStatisticsSql"/>
 		<include refid="queryStatisticsSql"/>
 	</select>
 	</select>
 	<select id="queryStatistics" resultMap="StudentStatisticsDto">
 	<select id="queryStatistics" resultMap="StudentStatisticsDto">
-		SELECT * FROM student_basic_info sbi
+		SELECT *,ss.not_start_course_fee_ + ss.no_course_fee_ preCourseFee FROM student_basic_info sbi
 		LEFT JOIN student_statistics ss ON ss.user_id_ = sbi.user_id_
 		LEFT JOIN student_statistics ss ON ss.user_id_ = sbi.user_id_
 		<include refid="queryStatisticsSql"/>
 		<include refid="queryStatisticsSql"/>
 		<include refid="global.limit"/>
 		<include refid="global.limit"/>

+ 57 - 0
mec-web/src/main/java/com/ym/mec/web/controller/StudentStatisticsController.java

@@ -1,17 +1,23 @@
 package com.ym.mec.web.controller;
 package com.ym.mec.web.controller;
 
 
+import com.ym.mec.biz.dal.dto.ReplacementInstrumentActivityStatDto;
 import com.ym.mec.biz.dal.dto.StudentStatisticsDto;
 import com.ym.mec.biz.dal.dto.StudentStatisticsDto;
 import com.ym.mec.biz.dal.dto.StudentStatisticsSumDto;
 import com.ym.mec.biz.dal.dto.StudentStatisticsSumDto;
 import com.ym.mec.biz.dal.dto.StudentStatisticsSumForDateDto;
 import com.ym.mec.biz.dal.dto.StudentStatisticsSumForDateDto;
 import com.ym.mec.biz.dal.page.StudentStatisticsQueryInfo;
 import com.ym.mec.biz.dal.page.StudentStatisticsQueryInfo;
+import com.ym.mec.biz.service.OrganizationService;
 import com.ym.mec.biz.service.StudentStatisticsService;
 import com.ym.mec.biz.service.StudentStatisticsService;
 import com.ym.mec.common.controller.BaseController;
 import com.ym.mec.common.controller.BaseController;
 import com.ym.mec.common.entity.HttpResponseResult;
 import com.ym.mec.common.entity.HttpResponseResult;
+import com.ym.mec.common.exception.BizException;
 import com.ym.mec.common.page.PageInfo;
 import com.ym.mec.common.page.PageInfo;
+import com.ym.mec.util.date.DateUtil;
+import com.ym.mec.util.excel.POIUtil;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiImplicitParam;
 import io.swagger.annotations.ApiImplicitParam;
 import io.swagger.annotations.ApiImplicitParams;
 import io.swagger.annotations.ApiImplicitParams;
 import io.swagger.annotations.ApiOperation;
 import io.swagger.annotations.ApiOperation;
+import org.apache.poi.hssf.usermodel.HSSFWorkbook;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.GetMapping;
@@ -19,6 +25,10 @@ import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 import org.springframework.web.bind.annotation.RestController;
 
 
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.util.Date;
 import java.util.List;
 import java.util.List;
 import java.util.Map;
 import java.util.Map;
 
 
@@ -29,6 +39,8 @@ public class StudentStatisticsController extends BaseController {
 
 
     @Autowired
     @Autowired
     private StudentStatisticsService studentStatisticsService;
     private StudentStatisticsService studentStatisticsService;
+    @Autowired
+    private OrganizationService organizationService;
 
 
     @ApiOperation(value = "分页查询收费类型列表")
     @ApiOperation(value = "分页查询收费类型列表")
     @PostMapping("/queryPage")
     @PostMapping("/queryPage")
@@ -72,4 +84,49 @@ public class StudentStatisticsController extends BaseController {
     public HttpResponseResult<List<Map<Integer, String>>> queryDirectorList(String groupType) {
     public HttpResponseResult<List<Map<Integer, String>>> queryDirectorList(String groupType) {
         return succeed(studentStatisticsService.queryDirectorList(groupType));
         return succeed(studentStatisticsService.queryDirectorList(groupType));
     }
     }
+
+    @ApiOperation(value = "导出小课学员管理")
+    @PostMapping("/exportStudentSmallClassStatisticsSum")
+    @PreAuthorize("@pcs.hasPermissions('studentStatistics/exportStudentSmallClassStatisticsSum')")
+    public void exportStudentSmallClassStatisticsSum(StudentStatisticsQueryInfo queryInfo, HttpServletResponse response) throws IOException {
+        queryInfo.setOrganId(organizationService.getEmployeeOrgan(queryInfo.getOrganId()));
+        queryInfo.setRows(65535);
+        PageInfo<StudentStatisticsDto> pageList = studentStatisticsService.queryStatisticsPage(queryInfo);
+
+        if (pageList.getTotal() <= 0) {
+            throw new BizException("没有可导出的记录");
+        }
+
+        OutputStream outputStream = response.getOutputStream();
+        HSSFWorkbook workbook = null;
+        try {
+            String[] header = {"分部", "学生姓名", "学员编号","联系电话", "声部", "学校", "年级", "学员状态", "未排课时", "总课时", "已完成课时",
+                    "剩余课时","预收金额","第一次课时间","最近上课时间","指导老师编号","指导老师","乐团主管编号","乐团主管","声部课老师编号","声部课老师","近30天课耗","回访次数",
+                    "回访状态","原因","回访日期"};
+            String[] body = {"studentBasicInfo.organName", "studentBasicInfo.userName", "studentBasicInfo.userId",
+                    "studentBasicInfo.phone","studentBasicInfo.subjectName", "studentBasicInfo.cooperationOrganName", "studentBasicInfo.grade",
+                    "overCourseNum > 0 && subCourseNum > 0 && latelyYearCourseConsumer < 1 ? '沉睡' : (noScheduleNum > 0 || subCourseNum > 0) && (latelyYearCourseConsumer > 0 || overCourseNum <= 0) ? '在读':''",
+                    "noScheduleNum","totalCourseNum", "overCourseNum", "subCourseNum","preCourseFee","firstCourseTime","lastCourseTime","teacherId","teacherName","musicDirectorId","musicDirectorName",
+            "studentBasicInfo.subjectTeacherId","studentBasicInfo.subjectTeacherName","latelyCourseConsumer","visitNum","lastVisitStatus","visitReason","lastVisitTime"};
+            workbook = POIUtil.exportExcel(header, body, pageList.getRows());
+            response.setContentType("application/octet-stream");
+            response.setHeader("Content-Disposition", "attachment;filename=replacement-" + DateUtil.getDate(new Date()) + ".xls");
+            response.flushBuffer();
+            outputStream = response.getOutputStream();
+            workbook.write(outputStream);
+            outputStream.flush();
+            workbook.close();
+        } catch (Exception e) {
+            e.printStackTrace();
+        } finally {
+            if (outputStream != null) {
+                try {
+                    workbook.close();
+                    outputStream.close();
+                } catch (IOException e) {
+                    e.printStackTrace();
+                }
+            }
+        }
+    }
 }
 }