|
@@ -2,23 +2,28 @@ package com.ym.mec.web.controller;
|
|
|
|
|
|
import com.ym.mec.auth.api.client.SysUserFeignService;
|
|
|
import com.ym.mec.auth.api.entity.SysUser;
|
|
|
+import com.ym.mec.biz.dal.dao.EmployeeDao;
|
|
|
import com.ym.mec.biz.dal.dto.StudentApplyDetailDto;
|
|
|
import com.ym.mec.biz.dal.dto.StudentHasCourseDto;
|
|
|
import com.ym.mec.biz.dal.dto.TeacherSalaryDto;
|
|
|
import com.ym.mec.biz.dal.dto.musicalListDetailDto;
|
|
|
+import com.ym.mec.biz.dal.entity.Employee;
|
|
|
import com.ym.mec.biz.dal.entity.Goods;
|
|
|
+import com.ym.mec.biz.dal.entity.StudentPaymentOrder;
|
|
|
+import com.ym.mec.biz.dal.enums.GroupType;
|
|
|
import com.ym.mec.biz.dal.page.CourseScheduleTeacherSalaryQueryInfo;
|
|
|
+import com.ym.mec.biz.dal.page.StudentPaymentOrderQueryInfo;
|
|
|
import com.ym.mec.biz.dal.page.StudentRegistrationQueryInfo;
|
|
|
-import com.ym.mec.biz.service.CourseScheduleTeacherSalaryService;
|
|
|
-import com.ym.mec.biz.service.StudentManageService;
|
|
|
-import com.ym.mec.biz.service.StudentPaymentOrderDetailService;
|
|
|
-import com.ym.mec.biz.service.StudentRegistrationService;
|
|
|
+import com.ym.mec.biz.service.*;
|
|
|
import com.ym.mec.common.controller.BaseController;
|
|
|
+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.util.date.DateUtil;
|
|
|
import com.ym.mec.util.excel.POIUtil;
|
|
|
import io.swagger.annotations.Api;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
+import org.apache.commons.lang3.StringUtils;
|
|
|
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.security.access.prepost.PreAuthorize;
|
|
@@ -27,6 +32,8 @@ import org.springframework.web.bind.annotation.PostMapping;
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
+import java.math.BigDecimal;
|
|
|
+import java.util.Arrays;
|
|
|
import java.util.Date;
|
|
|
import java.util.List;
|
|
|
|
|
@@ -45,6 +52,10 @@ public class ExportController extends BaseController {
|
|
|
private CourseScheduleTeacherSalaryService courseScheduleTeacherSalaryService;
|
|
|
@Autowired
|
|
|
private SysUserFeignService sysUserFeignService;
|
|
|
+ @Autowired
|
|
|
+ private EmployeeDao employeeDao;
|
|
|
+ @Autowired
|
|
|
+ private StudentPaymentOrderService studentPaymentOrderService;
|
|
|
|
|
|
@ApiOperation(value = "导出学员是否有课")
|
|
|
@PostMapping("export/studentHasCourse")
|
|
@@ -141,4 +152,52 @@ public class ExportController extends BaseController {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ @ApiOperation(value = "订单列表导出")
|
|
|
+ @RequestMapping("order/orderList")
|
|
|
+ @PreAuthorize("@pcs.hasPermissions('order/orderList')")
|
|
|
+ public void orderList(StudentPaymentOrderQueryInfo queryInfo, HttpServletResponse response) {
|
|
|
+ SysUser sysUser = sysUserFeignService.queryUserInfo();
|
|
|
+ if (!sysUser.getIsSuperAdmin()) {
|
|
|
+ Employee employee = employeeDao.get(sysUser.getId());
|
|
|
+ if (StringUtils.isEmpty(queryInfo.getOrganId())) {
|
|
|
+ queryInfo.setOrganId(employee.getOrganIdList());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ PageInfo<StudentPaymentOrder> studentPaymentOrderPageInfo = studentPaymentOrderService.queryPage(queryInfo);
|
|
|
+
|
|
|
+ for (StudentPaymentOrder row : studentPaymentOrderPageInfo.getRows()) {
|
|
|
+ BigDecimal balancePaymentAmount = row.getBalancePaymentAmount() == null ? BigDecimal.ZERO : row.getBalancePaymentAmount();
|
|
|
+ if (queryInfo.getOrderType().equals(1)) {
|
|
|
+ BigDecimal comAmount = row.getComAmount() == null ? BigDecimal.ZERO : row.getComAmount();
|
|
|
+ row.setExpectAmount(comAmount.add(balancePaymentAmount));
|
|
|
+ row.setActualAmount(comAmount.add(balancePaymentAmount));
|
|
|
+ }else {
|
|
|
+ BigDecimal perAmount = row.getPerAmount() == null ? BigDecimal.ZERO : row.getPerAmount();
|
|
|
+ row.setExpectAmount(perAmount.add(balancePaymentAmount));
|
|
|
+ row.setActualAmount(perAmount.add(balancePaymentAmount));
|
|
|
+ }
|
|
|
+ if(row.getGroupType().equals(GroupType.SPORADIC)){
|
|
|
+ row.setSporadicAmount(row.getActualAmount());
|
|
|
+ row.setExpectAmount(BigDecimal.ZERO);
|
|
|
+ row.setActualAmount(BigDecimal.ZERO);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ try {
|
|
|
+ String[] header = {"序号", "学生姓名", "交易流水号", "订单编号", "收款渠道", "收款账户", "支付金额", "到账时间",
|
|
|
+ "关联乐团ID/VIP课ID","课程形态","押金","乐器","教辅费用","零星收款费用","零星收款类别","手续费","专业","分部","单位/学校","备注"};
|
|
|
+ String[] body = {"id", "user.username", "transNo", "orderNo", "paymentChannel", "merNos", "actualAmount", "payTime", "musicGroupId",
|
|
|
+ "groupType", "groupType","groupType","groupType","SporadicAmount","SporadicAmount","groupType","groupType","groupType","groupType","memo"};
|
|
|
+ HSSFWorkbook workbook = POIUtil.exportExcel(header, body, studentPaymentOrderPageInfo.getRows());
|
|
|
+ response.setContentType("application/octet-stream");
|
|
|
+ response.setHeader("Content-Disposition", "attachment;filename=lender-" + DateUtil.getDate(new Date()) + ".xls");
|
|
|
+ response.flushBuffer();
|
|
|
+ workbook.write(response.getOutputStream());
|
|
|
+ workbook.close();
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
}
|