|
@@ -5,15 +5,23 @@ import com.ym.mec.biz.service.MultiDataSourceHomeStatsService;
|
|
|
import com.ym.mec.biz.service.OrganizationService;
|
|
import com.ym.mec.biz.service.OrganizationService;
|
|
|
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.util.date.DateUtil;
|
|
|
|
|
+import com.ym.mec.util.excel.POIUtil;
|
|
|
import io.swagger.annotations.Api;
|
|
import io.swagger.annotations.Api;
|
|
|
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.PostMapping;
|
|
import org.springframework.web.bind.annotation.PostMapping;
|
|
|
import org.springframework.web.bind.annotation.RequestBody;
|
|
import org.springframework.web.bind.annotation.RequestBody;
|
|
|
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.OutputStream;
|
|
|
|
|
+import java.util.ArrayList;
|
|
|
|
|
+import java.util.Date;
|
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
|
|
|
|
|
@Api(tags = "首页多数据源统计")
|
|
@Api(tags = "首页多数据源统计")
|
|
@@ -21,6 +29,23 @@ import java.util.List;
|
|
|
@RestController
|
|
@RestController
|
|
|
public class MultiDataSourceHomeStatsController extends BaseController {
|
|
public class MultiDataSourceHomeStatsController extends BaseController {
|
|
|
|
|
|
|
|
|
|
+ private static final String GYM_SHEET_NAME = "管乐迷";
|
|
|
|
|
+ private static final String CLS_SHEET_NAME = "酷乐秀";
|
|
|
|
|
+ private static final String KT_SHEET_NAME = "音乐数字课堂";
|
|
|
|
|
+
|
|
|
|
|
+ private static final String[] GYM_HEADER = {"分部", "分账用户", "银行卡号", "学生编号", "学生姓名", "系统订单编号",
|
|
|
|
|
+ "支付对象ID(流水号)", "分账金额", "手续费", "到账金额", "分账日期"};
|
|
|
|
|
+ private static final String[] GYM_BODY = {"organName", "merNo", "cardNo", "userId", "username", "orderNo",
|
|
|
|
|
+ "transNo", "routeAmount", "serviceFee", "actualAmount", "routeDate"};
|
|
|
|
|
+
|
|
|
|
|
+ private static final String[] CLS_HEADER = {"订单号", "流水号", "付款金额", "支付渠道", "付款时间", "付款人姓名", "付款人编号"};
|
|
|
|
|
+ private static final String[] CLS_BODY = {"orderNo", "transNo", "actualPrice", "payChannel", "payTime", "username", "userId"};
|
|
|
|
|
+
|
|
|
|
|
+ private static final String[] KT_HEADER = {"订单编号", "流水号", "付款金额", "付款渠道", "付款客户端", "付款时间",
|
|
|
|
|
+ "付款人编号", "付款人姓名", "订单状态"};
|
|
|
|
|
+ private static final String[] KT_BODY = {"orderNo", "transNo", "paymentCashAmount", "paymentVender", "paymentChannel",
|
|
|
|
|
+ "payTime", "userId", "nickname", "statusName"};
|
|
|
|
|
+
|
|
|
@Autowired
|
|
@Autowired
|
|
|
private MultiDataSourceHomeStatsService multiDataSourceHomeStatsService;
|
|
private MultiDataSourceHomeStatsService multiDataSourceHomeStatsService;
|
|
|
@Autowired
|
|
@Autowired
|
|
@@ -33,4 +58,42 @@ public class MultiDataSourceHomeStatsController extends BaseController {
|
|
|
queryDto.setOrganIds(organizationService.getEmployeeOrgan(queryDto.getOrganIds()));
|
|
queryDto.setOrganIds(organizationService.getEmployeeOrgan(queryDto.getOrganIds()));
|
|
|
return succeed(multiDataSourceHomeStatsService.summerIncome(queryDto));
|
|
return succeed(multiDataSourceHomeStatsService.summerIncome(queryDto));
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ @ApiOperation(value = "三平台支付流水导出(管乐迷/酷乐秀/音乐数字课堂)")
|
|
|
|
|
+ @GetMapping("/exportPaymentFlow")
|
|
|
|
|
+ @PreAuthorize("@pcs.hasPermissions('multiDataSourceHomeStats/exportPaymentFlow')")
|
|
|
|
|
+ public void exportPaymentFlow(MultiDataSourceHomeStatsWrapper.QueryDto queryDto, HttpServletResponse response) throws Exception {
|
|
|
|
|
+ MultiDataSourceHomeStatsWrapper.PaymentFlowExport data = multiDataSourceHomeStatsService.paymentFlow(queryDto);
|
|
|
|
|
+
|
|
|
|
|
+ List<MultiDataSourceHomeStatsWrapper.GymPaymentFlowDto> gymList =
|
|
|
|
|
+ data.getGymList() == null ? new ArrayList<>() : data.getGymList();
|
|
|
|
|
+ List<MultiDataSourceHomeStatsWrapper.ClsPaymentFlowDto> clsList =
|
|
|
|
|
+ data.getClsList() == null ? new ArrayList<>() : data.getClsList();
|
|
|
|
|
+ List<MultiDataSourceHomeStatsWrapper.KtPaymentFlowDto> ktList =
|
|
|
|
|
+ data.getKtList() == null ? new ArrayList<>() : data.getKtList();
|
|
|
|
|
+
|
|
|
|
|
+ response.setContentType("application/octet-stream");
|
|
|
|
|
+ response.setHeader("Content-Disposition", "attachment;filename=paymentFlow-" + DateUtil.getDate(new Date()) + ".xls");
|
|
|
|
|
+ response.flushBuffer();
|
|
|
|
|
+
|
|
|
|
|
+ OutputStream outputStream = response.getOutputStream();
|
|
|
|
|
+ try {
|
|
|
|
|
+ // 依次写入三个sheet,multipleSheetExportExcel 只会创建无名sheet,需手动命名
|
|
|
|
|
+ HSSFWorkbook workbook = POIUtil.multipleSheetExportExcel(GYM_HEADER, GYM_BODY, gymList, null);
|
|
|
|
|
+ workbook.setSheetName(0, GYM_SHEET_NAME);
|
|
|
|
|
+
|
|
|
|
|
+ workbook = POIUtil.multipleSheetExportExcel(CLS_HEADER, CLS_BODY, clsList, workbook);
|
|
|
|
|
+ workbook.setSheetName(1, CLS_SHEET_NAME);
|
|
|
|
|
+
|
|
|
|
|
+ workbook = POIUtil.multipleSheetExportExcel(KT_HEADER, KT_BODY, ktList, workbook);
|
|
|
|
|
+ workbook.setSheetName(2, KT_SHEET_NAME);
|
|
|
|
|
+
|
|
|
|
|
+ workbook.write(outputStream);
|
|
|
|
|
+ outputStream.flush();
|
|
|
|
|
+ } finally {
|
|
|
|
|
+ if (outputStream != null) {
|
|
|
|
|
+ outputStream.close();
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|