Procházet zdrojové kódy

增加学生运营指标查询

周箭河 před 5 roky
rodič
revize
785e0829af

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

@@ -15,6 +15,12 @@ private Integer vipTimes;
 private Integer freePracticeTimes;
 private Integer buyPracticeTimes;
 
+private String operatingTagStr;
+private String vipTimesStr;
+private String freePracticeTimesStr;
+private String buyPracticeTimesStr;
+
+
 	public String getOrganName() {
 		return organName;
 	}
@@ -99,4 +105,36 @@ private Integer buyPracticeTimes;
 	public String toString() {
 		return ToStringBuilder.reflectionToString(this);
 	}
+
+	public String getOperatingTagStr() {
+		return operatingTagStr;
+	}
+
+	public void setOperatingTagStr(String operatingTagStr) {
+		this.operatingTagStr = operatingTagStr;
+	}
+
+	public String getVipTimesStr() {
+		return vipTimesStr;
+	}
+
+	public void setVipTimesStr(String vipTimesStr) {
+		this.vipTimesStr = vipTimesStr;
+	}
+
+	public String getFreePracticeTimesStr() {
+		return freePracticeTimesStr;
+	}
+
+	public void setFreePracticeTimesStr(String freePracticeTimesStr) {
+		this.freePracticeTimesStr = freePracticeTimesStr;
+	}
+
+	public String getBuyPracticeTimesStr() {
+		return buyPracticeTimesStr;
+	}
+
+	public void setBuyPracticeTimesStr(String buyPracticeTimesStr) {
+		this.buyPracticeTimesStr = buyPracticeTimesStr;
+	}
 }

+ 9 - 6
mec-biz/src/main/resources/config/mybatis/StudentMapper.xml

@@ -211,6 +211,9 @@
 
 	<sql id="student4OperatingQueryCondition">
 		<where>
+			<if test="search != null and search != ''">
+				AND (su.phone_ LIKE CONCAT('%',#{search},'%') OR su.username_ LIKE CONCAT('%',#{search},'%') OR su.id_ LIKE CONCAT('%',#{search},'%'))
+			</if>
 			<if test="organId != null and organId != ''">
 				AND FIND_IN_SET(su.organ_id_,#{organId})
 			</if>
@@ -220,22 +223,22 @@
 			<if test="operatingTag !=null">
 				AND s.operating_tag_ = #{operatingTag}
 			</if>
-			<if test='hasVip != null and hasVip.toString()=="1".toString()'>
+			<if test='hasVip != null and hasVip=="1"'>
 				AND a.vip_times_ >=1
 			</if>
-			<if test='hasVip != null and hasVip.toString()=="0".toString()'>
+			<if test='hasVip != null and hasVip=="0"'>
 				AND (a.vip_times_ =0 OR a.vip_times_ IS NULL)
 			</if>
-			<if test='HasFreePractice != null and HasFreePractice.toString()=="1".toString()'>
+			<if test='HasFreePractice != null and HasFreePractice=="1"'>
 				AND p.free_practice_times_ >=1
 			</if>
-			<if test='HasFreePractice != null and HasFreePractice.toString()=="0".toString()'>
+			<if test='HasFreePractice != null and HasFreePractice=="0"'>
 				AND (p.free_practice_times_ =0 OR p.free_practice_times_ IS NULL)
 			</if>
-			<if test='HasBuyPractice != null and HasBuyPractice.toString()=="1".toString()'>
+			<if test='HasBuyPractice != null and HasBuyPractice=="1"'>
 				AND a.buy_practice_times_ >=1
 			</if>
-			<if test='HasBuyPractice != null and HasBuyPractice.toString()=="0".toString()'>
+			<if test='HasBuyPractice != null and HasBuyPractice=="0"'>
 				AND (a.buy_practice_times_ =0 OR a.buy_practice_times_ IS NULL)
 			</if>
 		</where>

+ 92 - 17
mec-web/src/main/java/com/ym/mec/web/controller/ExportController.java

@@ -104,9 +104,9 @@ public class ExportController extends BaseController {
         List<StudentBuyPracticeDto> rows = practiceGroupService.studentBuys(queryInfo).getRows();
         OutputStream outputStream = response.getOutputStream();
         try {
-            HSSFWorkbook workbook = POIUtil.exportExcel(new String[]{"学员编号", "学员名称", "所属分部","课程老师","课程组老师", "购买网管课",
+            HSSFWorkbook workbook = POIUtil.exportExcel(new String[]{"学员编号", "学员名称", "所属分部", "课程老师", "课程组老师", "购买网管课",
                     "免费课结束日期", "首次购买日期", "时间差"}, new String[]{
-                    "studentId", "studentName", "organName","teacherName","courseGroupTeacherName" ,"buyPractice.msg",
+                    "studentId", "studentName", "organName", "teacherName", "courseGroupTeacherName", "buyPractice.msg",
                     "lastClassDate", "firstBuyTime", "intervalDay"}, rows);
             response.setContentType("application/octet-stream");
             response.setHeader("Content-Disposition", "attachment;filename=lender-" + DateUtil.getDate(new Date()) + ".xls");
@@ -946,7 +946,7 @@ public class ExportController extends BaseController {
 
         try {
             String[] header = {"分部", "学生编号", "学生姓名", "网管课老师id", "网管课老师", "有效期截止时间", "课程截止时间", "总课时", "剩余课时", "是否购买"};
-            String[] body = {"organName", "studentId", "studentName", "teacherIds", "teacherName", "expireDate", "classEndDate", "totalClassTimes", "noStartClassTimes","buyPractice.msg"};
+            String[] body = {"organName", "studentId", "studentName", "teacherIds", "teacherName", "expireDate", "classEndDate", "totalClassTimes", "noStartClassTimes", "buyPractice.msg"};
             HSSFWorkbook workbook = POIUtil.exportExcel(header, body, practiceGroupExports);
             response.setContentType("application/octet-stream");
             response.setHeader("Content-Disposition", "attachment;filename=lender-" + DateUtil.getDate(new Date()) + ".xls");
@@ -1181,24 +1181,24 @@ public class ExportController extends BaseController {
             return;
         }
         for (TeacherCourseSalaryDetail4WebDto row : rows) {
-            if(Objects.isNull(row.getSignInTime())){
+            if (Objects.isNull(row.getSignInTime())) {
                 row.setSignInStatusStr("未签到");
-            }else{
+            } else {
                 String signInTimeStr = DateUtil.dateToString(row.getSignInTime(), "yyyy-MM-dd HH:mm");
-                if(YesOrNoEnum.YES.equals(row.getSignInStatus())){
-                    row.setSignInStatusStr(signInTimeStr+"(正常签到)");
-                }else{
-                    row.setSignInStatusStr(signInTimeStr+"(异常签到)");
+                if (YesOrNoEnum.YES.equals(row.getSignInStatus())) {
+                    row.setSignInStatusStr(signInTimeStr + "(正常签到)");
+                } else {
+                    row.setSignInStatusStr(signInTimeStr + "(异常签到)");
                 }
             }
-            if(Objects.isNull(row.getSignOutTime())){
+            if (Objects.isNull(row.getSignOutTime())) {
                 row.setSignOutStatusStr("未签退");
-            }else{
+            } else {
                 String signOutTimeStr = DateUtil.dateToString(row.getSignOutTime(), "yyyy-MM-dd HH:mm");
-                if(YesOrNoEnum.YES.equals(row.getSignOutStatus())){
-                    row.setSignOutStatusStr(signOutTimeStr+"(正常签退)");
-                }else{
-                    row.setSignOutStatusStr(signOutTimeStr+"(异常签退)");
+                if (YesOrNoEnum.YES.equals(row.getSignOutStatus())) {
+                    row.setSignOutStatusStr(signOutTimeStr + "(正常签退)");
+                } else {
+                    row.setSignOutStatusStr(signOutTimeStr + "(异常签退)");
                 }
             }
         }
@@ -1206,9 +1206,84 @@ public class ExportController extends BaseController {
         try {
             HSSFWorkbook workbook = POIUtil.exportExcel(
                     new String[]{"分部", "课程组类型", "课程编号", "时间", "课程名称", "老师编号", "老师姓名", "签到时间", "签退时间", "应发课酬",
-                                 "课酬扣款", "结算课酬", "状态", "备注"},
+                            "课酬扣款", "结算课酬", "状态", "备注"},
                     new String[]{"organName", "groupType.desc", "courseScheduleId", "startClassTime", "courseName", "teacherId", "teacherName",
-                                "signInStatusStr", "signOutStatusStr", "actualSalary", "reduceSalary", "finalSalary", "confirmStatus.desc", "memo"}, rows);
+                            "signInStatusStr", "signOutStatusStr", "actualSalary", "reduceSalary", "finalSalary", "confirmStatus.desc", "memo"}, rows);
+            response.setContentType("application/octet-stream");
+            response.setHeader("Content-Disposition", "attachment;filename=lender-" + DateUtil.getDate(new Date()) + ".xls");
+            ouputStream = response.getOutputStream();
+            workbook.write(ouputStream);
+            ouputStream.flush();
+        } catch (Exception e) {
+            e.printStackTrace();
+        } finally {
+            if (ouputStream != null) {
+                try {
+                    ouputStream.close();
+                } catch (IOException e) {
+                    e.printStackTrace();
+                }
+            }
+        }
+    }
+
+
+    @ApiOperation(value = "课外训练-教学导出")
+    @GetMapping("export/operatingStudents")
+    @PreAuthorize("@pcs.hasPermissions('export/operatingStudents')")
+    public void operatingStudents(StudentOperatingQueryInfo queryInfo, HttpServletResponse response) {
+        queryInfo.setRows(999999);
+        SysUser sysUser = sysUserFeignService.queryUserInfo();
+        if (sysUser == null) {
+            throw new BizException("用户信息获取失败");
+        }
+        if (!sysUser.getIsSuperAdmin()) {
+            Employee employee = employeeDao.get(sysUser.getId());
+            if (StringUtils.isEmpty(queryInfo.getOrganId())) {
+                queryInfo.setOrganId(employee.getOrganIdList());
+            } else if (StringUtils.isEmpty(employee.getOrganIdList())) {
+                throw new BizException("用户所在分部异常");
+            } else {
+                List<String> list = Arrays.asList(employee.getOrganIdList().split(","));
+                if (!list.containsAll(Arrays.asList(queryInfo.getOrganId().split(",")))) {
+                    throw new BizException("非法请求");
+                }
+            }
+        }
+        PageInfo<Student4operating> PageOperatingStudents = studentManageService.getOperatingStudents(queryInfo);
+
+        if (PageOperatingStudents.getTotal() <= 0) {
+            throw new BizException("导出记录不存在");
+        }
+        List<Student4operating> rows = PageOperatingStudents.getRows();
+        for (Student4operating row : rows) {
+            if(row.getOperatingTag() != null && row.getOperatingTag()==1){
+                row.setOperatingTagStr("是");
+            }else {
+                row.setOperatingTagStr("否");
+            }
+            if(row.getVipTimes() != null && row.getVipTimes() >0){
+                row.setVipTimesStr("有");
+            }else {
+                row.setVipTimesStr("无");
+            }
+            if(row.getFreePracticeTimes() != null && row.getFreePracticeTimes() >0){
+                row.setFreePracticeTimesStr("有");
+            }else {
+                row.setFreePracticeTimesStr("无");
+            }
+            if(row.getBuyPracticeTimes() != null && row.getBuyPracticeTimes() >0){
+                row.setBuyPracticeTimesStr("有");
+            }else {
+                row.setBuyPracticeTimesStr("无");
+            }
+        }
+        OutputStream ouputStream = null;
+        try {
+
+            HSSFWorkbook workbook = POIUtil.exportExcel(
+                    new String[]{"分部", "学生", "学生编号", "指导老师","指导老师id", "运营指标", "VIP课", "免费网管课", "付费网管课"},
+                    new String[]{"organName", "studentName", "studentId", "teacherName","teacherId", "operatingTagStr", "vipTimesStr", "freePracticeTimesStr", "buyPracticeTimesStr"}, rows);
             response.setContentType("application/octet-stream");
             response.setHeader("Content-Disposition", "attachment;filename=lender-" + DateUtil.getDate(new Date()) + ".xls");
             ouputStream = response.getOutputStream();