|
@@ -92,6 +92,8 @@ public class ExportController extends BaseController {
|
|
|
|
|
|
@Autowired
|
|
|
private CooperationOrganService cooperationOrganService;
|
|
|
+ @Autowired
|
|
|
+ private StudentPaymentRouteOrderDao studentPaymentRouteOrderDao;
|
|
|
|
|
|
@ApiOperation(value = "导出教师考勤列表")
|
|
|
@PostMapping("export/queryTeacherAttendances")
|
|
@@ -1798,4 +1800,172 @@ public class ExportController extends BaseController {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+ @ApiOperation(value = "财务管理导出")
|
|
|
+ @RequestMapping("export/routeOrderList")
|
|
|
+ @PreAuthorize("@pcs.hasPermissions('export/routeOrderList')")
|
|
|
+ public void routeOrderList(StudentPaymentOrderQueryInfo queryInfo, HttpServletResponse response) throws IOException {
|
|
|
+ SysUser sysUser = sysUserFeignService.queryUserInfo();
|
|
|
+ if (!sysUser.getIsSuperAdmin()) {
|
|
|
+ Employee employee = employeeDao.get(sysUser.getId());
|
|
|
+ if (StringUtils.isEmpty(queryInfo.getRoutingOrganId()) && queryInfo.getOrderType().equals("3")) {
|
|
|
+ queryInfo.setRoutingOrganId(employee.getOrganIdList());
|
|
|
+ } else if (StringUtils.isEmpty(queryInfo.getOrganId())) {
|
|
|
+ queryInfo.setOrganId(employee.getOrganIdList());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ queryInfo.setPage(1);
|
|
|
+ queryInfo.setRows(49999);
|
|
|
+ queryInfo.setIsExport(true);
|
|
|
+ queryInfo.setOrderType("3");
|
|
|
+ Map<String, Object> params = new HashMap<String, Object>();
|
|
|
+ MapUtil.populateMap(params, queryInfo);
|
|
|
+ List<StudentPaymentOrderExportDto> studentPaymentOrderExportDtos = studentPaymentRouteOrderDao.ExportQueryPage(params);
|
|
|
+ if (studentPaymentOrderExportDtos.size() > 50000) {
|
|
|
+ throw new BizException("数据集太大,不能导出.最大数据集不能超过50000");
|
|
|
+ }
|
|
|
+ OutputStream outputStream = response.getOutputStream();
|
|
|
+ long i = 1;
|
|
|
+ for (StudentPaymentOrderExportDto row : studentPaymentOrderExportDtos) {
|
|
|
+ if (queryInfo.getOrderType().equals("1")) {
|
|
|
+ BigDecimal comAmount = row.getComAmount() == null ? BigDecimal.ZERO : row.getComAmount();
|
|
|
+ row.setActualAmount(comAmount);
|
|
|
+ } else if (queryInfo.getOrderType().equals("2")) {
|
|
|
+ BigDecimal perAmount = row.getPerAmount() == null ? BigDecimal.ZERO : row.getPerAmount();
|
|
|
+ row.setActualAmount(perAmount);
|
|
|
+ }
|
|
|
+ if (row.getActualAmount() == null) {
|
|
|
+ row.setActualAmount(BigDecimal.ZERO);
|
|
|
+ }
|
|
|
+ if (row.getBalancePaymentAmount() == null) {
|
|
|
+ row.setBalancePaymentAmount(BigDecimal.ZERO);
|
|
|
+ }
|
|
|
+ BigDecimal transferFee = (row.getActualAmount().multiply(new BigDecimal("0.28")).divide(new BigDecimal(100))).setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
|
+ row.setTransferFee(transferFee);
|
|
|
+ BigDecimal musicalFee = BigDecimal.ZERO;
|
|
|
+ BigDecimal teachingFee = BigDecimal.ZERO;
|
|
|
+ BigDecimal courseFee = BigDecimal.ZERO;
|
|
|
+ BigDecimal leaseFee = BigDecimal.ZERO;
|
|
|
+ String goodsName = "";
|
|
|
+ if (row.getOrderDetailList() != null) {
|
|
|
+ for (StudentPaymentOrderDetail orderDetail : row.getOrderDetailList()) {
|
|
|
+ if (orderDetail.getType().equals(OrderDetailTypeEnum.MUSICAL)) {
|
|
|
+ if (orderDetail.getKitGroupPurchaseType() != null && orderDetail.getKitGroupPurchaseType().equals(KitGroupPurchaseTypeEnum.LEASE)) {
|
|
|
+ leaseFee = orderDetail.getPrice();
|
|
|
+ } else {
|
|
|
+ musicalFee = orderDetail.getPrice();
|
|
|
+ }
|
|
|
+ } else if (orderDetail.getType().equals(OrderDetailTypeEnum.COURSE)) {
|
|
|
+ courseFee = courseFee.add(orderDetail.getPrice());
|
|
|
+ } else if (orderDetail.getType().equals(OrderDetailTypeEnum.ACCESSORIES) || orderDetail.getType().equals(OrderDetailTypeEnum.TEACHING) || orderDetail.getType().equals(OrderDetailTypeEnum.OTHER)) {
|
|
|
+ teachingFee = teachingFee.add(orderDetail.getPrice());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (row.getGoodsList() != null) {
|
|
|
+ goodsName = row.getGoodsList().stream().map(Goods::getName).collect(Collectors.joining("|"));
|
|
|
+ }
|
|
|
+ row.setCourseFee(courseFee);
|
|
|
+ row.setMusicalFee(musicalFee);
|
|
|
+ row.setTeachingFee(teachingFee);
|
|
|
+ row.setLeaseFee(leaseFee);
|
|
|
+ row.setMemo(goodsName);
|
|
|
+ //专业
|
|
|
+ if (row.getGroupType().equals(GroupType.MUSIC)) {
|
|
|
+ StudentRegistration studentRegistration = studentRegistrationDao.findStudentByMusicGroupIdAndUserId(row.getMusicGroupId(), row.getUserId());
|
|
|
+ if (studentRegistration != null) {
|
|
|
+ row.setSubjectName(studentRegistration.getSubjectName());
|
|
|
+ row.setSchoolName(studentRegistration.getSchoolName());
|
|
|
+ row.setCooperationOrganName(studentRegistration.getRemark());
|
|
|
+ }
|
|
|
+ } else if (row.getGroupType().equals(GroupType.VIP)) {
|
|
|
+ row.setCourseFee(row.getActualAmount());
|
|
|
+ VipGroup vipGroupInfo = vipGroupDao.findVipGroupInfo(Integer.parseInt(row.getMusicGroupId()), row.getClassGroupId());
|
|
|
+ if (vipGroupInfo != null) {
|
|
|
+ row.setSchoolName(vipGroupInfo.getSchoolName());
|
|
|
+ row.setSubjectName(vipGroupInfo.getSubjectName());
|
|
|
+ }
|
|
|
+
|
|
|
+ } else if (row.getGroupType().equals(GroupType.SPORADIC)) {
|
|
|
+ row.setSporadicAmount(row.getActualAmount());
|
|
|
+ row.setMusicalFee(BigDecimal.ZERO);
|
|
|
+ row.setTeachingFee(BigDecimal.ZERO);
|
|
|
+ if (row.getChargeType() != null) {
|
|
|
+
|
|
|
+ if (row.getChargeType().equals(1)) {
|
|
|
+ row.setSporadicType("考级");
|
|
|
+ } else if (row.getChargeType().equals(2)) {
|
|
|
+ row.setSporadicType("声部更改");
|
|
|
+ } else if (row.getChargeType().equals(3)) {
|
|
|
+ row.setSporadicType("乐器更换");
|
|
|
+ } else if (row.getChargeType().equals(4)) {
|
|
|
+ row.setSporadicType("配件销售");
|
|
|
+ } else if (row.getChargeType().equals(5)) {
|
|
|
+ row.setSporadicType("维修费");
|
|
|
+ } else if (row.getChargeType().equals(6)) {
|
|
|
+ row.setSporadicType("福袋活动");
|
|
|
+ } else if (row.getChargeType().equals(7)) {
|
|
|
+ row.setSporadicType("上门费");
|
|
|
+ } else if (row.getChargeType().equals(9)) {
|
|
|
+ row.setSporadicType("账户充值");
|
|
|
+ } else if (row.getChargeType().equals(10)) {
|
|
|
+ row.setSporadicType("乐保服务");
|
|
|
+ } else if (row.getChargeType().equals(11)) {
|
|
|
+ row.setSporadicType("其他");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ School userSchool = musicGroupDao.findUserSchool(row.getUserId());
|
|
|
+ if (userSchool != null) {
|
|
|
+ row.setSchoolName(userSchool.getName());
|
|
|
+ }
|
|
|
+ } else if (row.getGroupType().equals(GroupType.PRACTICE)) {
|
|
|
+ row.setCourseFee(row.getActualAmount());
|
|
|
+ School userSchool = musicGroupDao.findUserSchool(row.getUserId());
|
|
|
+ if (userSchool != null) {
|
|
|
+ row.setSchoolName(userSchool.getName());
|
|
|
+ }
|
|
|
+ PracticeCourseDto practiceGroup = practiceGroupDao.findByGroupId(Integer.parseInt(row.getMusicGroupId()));
|
|
|
+ if (practiceGroup != null) {
|
|
|
+ row.setSubjectName(practiceGroup.getSubjectName());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ String paymentChannel = "";
|
|
|
+ if (row.getPaymentChannel() == null) {
|
|
|
+ } else if (row.getPaymentChannel().equals("YQPAY")) {
|
|
|
+ paymentChannel = "双乾";
|
|
|
+ } else if (row.getPaymentChannel().equals("ADAPAY")) {
|
|
|
+ paymentChannel = "汇付";
|
|
|
+ } else if (row.getPaymentChannel().equals("BALANCE")) {
|
|
|
+ paymentChannel = "余额";
|
|
|
+ }
|
|
|
+ row.setPaymentChannel(paymentChannel);
|
|
|
+ row.setId(i);
|
|
|
+ i++;
|
|
|
+ }
|
|
|
+
|
|
|
+ try {
|
|
|
+ String[] header = {"序号", "学生姓名", "交易流水号", "订单编号", "收款渠道", "收款账户", "应付金额", "现金支付", "余额支付","分润账户","分润金额","分润余额","到账时间",
|
|
|
+ "关联乐团ID/VIP课ID", "课程形态", "课程费用", "减免费用", "押金", "乐器", "教辅费用", "零星收款费用", "零星收款类别", "手续费", "专业", "分部", "单位/学校", "合作机构", "备注"};
|
|
|
+ String[] body = {"id", "user.username", "transNo", "orderNo", "paymentChannel", "merNos", "expectAmount", "actualAmount", "balancePaymentAmount","routeMerNo","routeAmount","routeBalance", "payTime", "musicGroupId",
|
|
|
+ "groupType.desc", "courseFee", "remitFee", "leaseFee", "musicalFee", "teachingFee", "sporadicAmount", "sporadicType", "transferFee", "subjectName", "organName", "schoolName", "cooperationOrganName", "memo"};
|
|
|
+ HSSFWorkbook workbook = POIUtil.exportExcel(header, body, studentPaymentOrderExportDtos);
|
|
|
+ response.setContentType("application/octet-stream");
|
|
|
+ response.setHeader("Content-Disposition", "attachment;filename=lender-" + 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();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|