|
@@ -6,12 +6,15 @@ import com.ym.mec.biz.dal.entity.*;
|
|
|
import com.ym.mec.biz.dal.enums.*;
|
|
|
import com.ym.mec.biz.dal.page.*;
|
|
|
import com.ym.mec.biz.service.*;
|
|
|
+import com.ym.mec.common.constant.CommonConstants;
|
|
|
import com.ym.mec.common.entity.HttpResponseResult;
|
|
|
import com.ym.mec.common.service.IdGeneratorService;
|
|
|
import io.swagger.annotations.Api;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
import java.io.IOException;
|
|
|
import java.io.OutputStream;
|
|
|
+import java.math.BigDecimal;
|
|
|
+import java.text.NumberFormat;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.Arrays;
|
|
|
import java.util.Date;
|
|
@@ -130,9 +133,86 @@ public class ExportController extends BaseController {
|
|
|
private MusicGroupQuitService musicGroupQuitService;
|
|
|
@Autowired
|
|
|
private IndexBaseMonthDataService indexService;
|
|
|
-
|
|
|
@Autowired
|
|
|
private TeacherCourseStatisticsService teacherCourseStatisticsService;
|
|
|
+ @Autowired
|
|
|
+ private SysUserCashAccountDetailDao sysUserCashAccountDetailDao;
|
|
|
+ @Autowired
|
|
|
+ private SysUserCoursesAccountDetailDao sysUserCoursesAccountDetailDao;
|
|
|
+
|
|
|
+ @ApiOperation(value = "学生个人账户余额导出")
|
|
|
+ @PostMapping("export/userCashAccountDetail")
|
|
|
+ @PreAuthorize("@pcs.hasPermissions('export/userCashAccountDetail')")
|
|
|
+ public void userCashAccountDetail(HttpServletResponse response, Integer userId) throws IOException {
|
|
|
+ List<SysUserCashAccountDetail> cashAccountDetails = sysUserCashAccountDetailDao.exportDetail(userId);
|
|
|
+ if(cashAccountDetails.size() < 1){
|
|
|
+ throw new BizException("没有可导出数据");
|
|
|
+ }
|
|
|
+ if(cashAccountDetails.size() > 49999){
|
|
|
+ throw new BizException("数据超长,请联系管理员");
|
|
|
+ }
|
|
|
+ OutputStream outputStream = response.getOutputStream();
|
|
|
+ try {
|
|
|
+ HSSFWorkbook workbook = POIUtil.exportExcel(new String[]{"学员编号", "姓名", "电话", "声部",
|
|
|
+ "交易类型", "交易金额", "交易时间", "备注"}, new String[]{
|
|
|
+ "userId", "username", "phone", "subjectName",
|
|
|
+ "type.msg", "amount", "createTime", "comment"}, cashAccountDetails);
|
|
|
+ response.setContentType("application/octet-stream");
|
|
|
+ response.setHeader("Content-Disposition", "attac:wq" +
|
|
|
+ "hment;filename=classGroup-" + DateUtil.getDate(new Date()) + ".xls");
|
|
|
+ response.flushBuffer();
|
|
|
+ outputStream = response.getOutputStream();
|
|
|
+ workbook.write(outputStream);
|
|
|
+ outputStream.flush();
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ } finally {
|
|
|
+ if (outputStream != null) {
|
|
|
+ try {
|
|
|
+ outputStream.close();
|
|
|
+ } catch (IOException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation(value = "学生个人课程余额导出")
|
|
|
+ @PostMapping("export/userCoursesAccount")
|
|
|
+ @PreAuthorize("@pcs.hasPermissions('export/userCoursesAccount')")
|
|
|
+ public void userCoursesAccount(HttpServletResponse response, Integer userId) throws IOException {
|
|
|
+ List<SysUserCoursesAccountDetail> coursesAccountDetails = sysUserCoursesAccountDetailDao.exportDetail(userId);
|
|
|
+ if(coursesAccountDetails.size() < 1){
|
|
|
+ throw new BizException("没有可导出数据");
|
|
|
+ }
|
|
|
+ if(coursesAccountDetails.size() > 49999){
|
|
|
+ throw new BizException("数据超长,请联系管理员");
|
|
|
+ }
|
|
|
+ OutputStream outputStream = response.getOutputStream();
|
|
|
+ try {
|
|
|
+ HSSFWorkbook workbook = POIUtil.exportExcel(new String[]{"学员编号", "姓名", "电话", "声部",
|
|
|
+ "交易类型", "交易金额", "交易时间", "备注"}, new String[]{
|
|
|
+ "userId", "username", "phone", "subjectName",
|
|
|
+ "type.msg", "amount", "createTime", "comment"}, coursesAccountDetails);
|
|
|
+ response.setContentType("application/octet-stream");
|
|
|
+ response.setHeader("Content-Disposition", "attac:wq" +
|
|
|
+ "hment;filename=classGroup-" + DateUtil.getDate(new Date()) + ".xls");
|
|
|
+ response.flushBuffer();
|
|
|
+ outputStream = response.getOutputStream();
|
|
|
+ workbook.write(outputStream);
|
|
|
+ outputStream.flush();
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ } finally {
|
|
|
+ if (outputStream != null) {
|
|
|
+ try {
|
|
|
+ outputStream.close();
|
|
|
+ } catch (IOException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
@ApiOperation(value = "班级列表导出")
|
|
|
@PostMapping("export/classGroup")
|
|
@@ -2525,13 +2605,26 @@ public class ExportController extends BaseController {
|
|
|
}
|
|
|
OutputStream outputStream = response.getOutputStream();
|
|
|
|
|
|
+ BigDecimal oneHundred = new BigDecimal(100);
|
|
|
+ BigDecimal zero = new BigDecimal("0.00");
|
|
|
+
|
|
|
for (TeacherServeDto row : result.getRows()) {
|
|
|
row.setDateRange(com.ym.mec.util.date.DateUtil.dateToString(row.getMonday(), "yyyy-MM-dd") + '~' + com.ym.mec.util.date.DateUtil.dateToString(row.getSunday(), "yyyy-MM-dd"));
|
|
|
+ if(row.getActualExercisesNum()<=0){
|
|
|
+ row.setSubmitRate(zero.toString()+"%");
|
|
|
+ }else{
|
|
|
+ BigDecimal submitRate = new BigDecimal(row.getExercisesReplyNum()).divide(new BigDecimal(row.getActualExercisesNum()), CommonConstants.DECIMAL_FINAL_PLACE, BigDecimal.ROUND_HALF_UP).multiply(oneHundred);
|
|
|
+ row.setSubmitRate(submitRate+"%");
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
try {
|
|
|
- String[] header = {"分部", "老师编号", "老师姓名", "服务周期", "课后作业(节)", "课外作业(人)", "是否异常", "提醒时间", "操作人"};
|
|
|
- String[] body = {"organName", "teacherId", "teacherName", "dateRange", "homeworkNum", "exerciseNum", "unDone==0?'否':'是'", "remindDate", "operatorName"};
|
|
|
+ String[] header = {"分部", "老师编号", "老师姓名", "服务周期", "课后作业(节)", "课外作业(人)",
|
|
|
+ "作业布置", "作业点评", "作业提交率",
|
|
|
+ "提醒时间", "操作人"};
|
|
|
+ String[] body = {"organName", "teacherId", "teacherName", "dateRange", "homeworkNum", "exerciseNum",
|
|
|
+ "expectExercisesNum>actualExercisesNum?'异常':'正常'", "exercisesReplyNum>exercisesMessageNum?'异常':'正常'", "submitRate",
|
|
|
+ "remindDate", "operatorName"};
|
|
|
HSSFWorkbook workbook = POIUtil.exportExcel(header, body, result.getRows());
|
|
|
response.setContentType("application/octet-stream");
|
|
|
response.setHeader("Content-Disposition", "attachment;filename=teacherDefaultSalary-" + DateUtil.getDate(new Date()) + ".xls");
|