package com.stylefeng.guns.modular.system.controller.general;
|
|
import com.baomidou.mybatisplus.plugins.Page;
|
import com.stylefeng.guns.core.base.controller.BaseController;
|
import com.stylefeng.guns.core.common.constant.factory.PageFactory;
|
import com.stylefeng.guns.core.util.DateUtil;
|
import com.stylefeng.guns.core.util.ExcelExportUtil;
|
import com.stylefeng.guns.core.util.SinataUtil;
|
import com.stylefeng.guns.modular.system.service.ITOrderTaxiService;
|
import org.springframework.stereotype.Controller;
|
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.ResponseBody;
|
|
import javax.annotation.Resource;
|
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletResponse;
|
import java.util.ArrayList;
|
import java.util.Date;
|
import java.util.List;
|
import java.util.Map;
|
|
/**
|
* 财务报表
|
* @author zhibing.pu
|
* @Date 2025/4/22 10:55
|
*/
|
@Controller
|
@RequestMapping("/financialStatement")
|
public class FinancialStatementController extends BaseController {
|
|
private String PREFIX = "/system/financialStatement/";
|
|
@Resource
|
private ITOrderTaxiService orderTaxiService;
|
|
|
/**
|
* 跳转支付订单统计页
|
* @return
|
*/
|
@GetMapping("/paymentOrderStatistics")
|
public String paymentOrderStatistics(){
|
return PREFIX + "paymentOrderStatistics/paymentOrderStatistics.html";
|
}
|
|
|
/**
|
* 跳转线下订单统计页
|
* @return
|
*/
|
@GetMapping("/offlineOrderStatistics")
|
public String offlineOrderStatistics(){
|
return PREFIX + "offlineOrderStatistics/offlineOrderStatistics.html";
|
}
|
|
|
|
/**
|
* 获取支付订单统计列表
|
* @param paymentCode
|
* @param orderCode
|
* @param userPhone
|
* @param driverPhone
|
* @param createTime
|
* @param paymentTime
|
* @return
|
*/
|
@ResponseBody
|
@RequestMapping("/paymentOrderStatisticsList")
|
public Object paymentOrderStatisticsList(String paymentCode, String orderCode, String userPhone,
|
String driverPhone, String createTime, String paymentTime){
|
Page<Map<String, Object>> page = new PageFactory<Map<String, Object>>().defaultPage();
|
List<Map<String, Object>> list = orderTaxiService.paymentOrderStatisticsList(page, paymentCode, orderCode, userPhone, driverPhone, createTime, paymentTime);
|
return super.packForBT(page.setRecords(list));
|
}
|
|
|
/**
|
* 导出支付订单统计列表
|
* @param paymentCode
|
* @param orderCode
|
* @param userPhone
|
* @param driverPhone
|
* @param createTime
|
* @param paymentTime
|
*/
|
@ResponseBody
|
@RequestMapping("/paymentOrderStatisticsList_export")
|
public void paymentOrderStatisticsList_export(String paymentCode, String orderCode, String userPhone,
|
String driverPhone, String createTime, String paymentTime, HttpServletRequest request, HttpServletResponse response){
|
Page<Map<String, Object>> page = new Page(1, 9999);
|
List<Map<String, Object>> list = orderTaxiService.paymentOrderStatisticsList(page, paymentCode, orderCode, userPhone, driverPhone, createTime, paymentTime);
|
|
// 表格数据【封装】
|
List<List<String>> dataList = new ArrayList<>();
|
|
// 列【封装】
|
List<String> shellList = new ArrayList<String>();
|
shellList.add("支付流水号");
|
shellList.add("订单号");
|
shellList.add("支付用户手机号");
|
shellList.add("支付金额");
|
shellList.add("接单司机手机号");
|
shellList.add("司机所属机构");
|
shellList.add("扣除司机抽成");
|
shellList.add("下单时间");
|
shellList.add("支付时间");
|
dataList.add(shellList);
|
|
for (Map<String,Object> object : list){
|
// 详细数据列【封装】
|
shellList = new ArrayList<String>();
|
if(SinataUtil.isNotEmpty(object.get("paymentCode"))){
|
shellList.add(object.get("paymentCode").toString());
|
}else{
|
shellList.add("-");
|
}
|
if(SinataUtil.isNotEmpty(object.get("orderNum"))){
|
shellList.add(object.get("orderNum").toString());
|
}else{
|
shellList.add("-");
|
}
|
if(SinataUtil.isNotEmpty(object.get("userPhone"))){
|
shellList.add(object.get("userPhone").toString());
|
}else{
|
shellList.add("-");
|
}
|
if(SinataUtil.isNotEmpty(object.get("amount"))){
|
shellList.add(object.get("amount").toString());
|
}else{
|
shellList.add("-");
|
}
|
if(SinataUtil.isNotEmpty(object.get("driverPhone"))){
|
shellList.add(object.get("driverPhone").toString());
|
}else{
|
shellList.add("-");
|
}
|
if(SinataUtil.isNotEmpty(object.get("company"))){
|
shellList.add(object.get("company").toString());
|
}else{
|
shellList.add("-");
|
}
|
if(SinataUtil.isNotEmpty(object.get("income"))){
|
shellList.add(object.get("income").toString());
|
}else{
|
shellList.add("-");
|
}
|
if(SinataUtil.isNotEmpty(object.get("insertTime"))){
|
shellList.add(object.get("insertTime").toString());
|
}else{
|
shellList.add("-");
|
}
|
if(SinataUtil.isNotEmpty(object.get("paymentTime"))){
|
shellList.add(object.get("paymentTime").toString());
|
}else{
|
shellList.add("-");
|
}
|
dataList.add(shellList);
|
}
|
try {
|
// 调用工具类进行导出
|
ExcelExportUtil.easySheet("支付订单统计"+DateUtil.formatDate(new Date(), "YYYYMMddHHmmss"), "支付订单统计", dataList,request, response);
|
|
} catch (Exception e) {
|
e.printStackTrace();
|
}
|
}
|
|
|
/**
|
* 获取线下订单统计
|
* @param orderCode
|
* @param userPhone
|
* @param driverPhone
|
* @param createTime
|
* @param orderSource
|
* @return
|
*/
|
@ResponseBody
|
@RequestMapping("/offlineOrderStatisticsList")
|
public Object offlineOrderStatisticsList(String orderCode, String userPhone, String driverPhone,
|
String createTime, Integer orderSource){
|
Page<Map<String, Object>> page = new PageFactory<Map<String, Object>>().defaultPage();
|
List<Map<String, Object>> list = orderTaxiService.offlineOrderStatisticsList(page, orderCode, userPhone, driverPhone, createTime, orderSource);
|
return super.packForBT(page.setRecords(list));
|
}
|
|
|
/**
|
* 导出线下订单统计
|
* @param orderCode
|
* @param userPhone
|
* @param driverPhone
|
* @param createTime
|
* @param orderSource
|
*/
|
@ResponseBody
|
@RequestMapping("/offlineOrderStatisticsList_export")
|
public void offlineOrderStatisticsList_export(String orderCode, String userPhone, String driverPhone,
|
String createTime, Integer orderSource, HttpServletRequest request, HttpServletResponse response){
|
Page<Map<String, Object>> page = new Page(1, 9999);
|
List<Map<String, Object>> list = orderTaxiService.offlineOrderStatisticsList(page, orderCode, userPhone, driverPhone, createTime, orderSource);
|
|
// 表格数据【封装】
|
List<List<String>> dataList = new ArrayList<>();
|
|
// 列【封装】
|
List<String> shellList = new ArrayList<String>();
|
shellList.add("订单号");
|
shellList.add("用户手机号");
|
shellList.add("打车方式");
|
shellList.add("接单司机手机号");
|
shellList.add("司机所属机构");
|
shellList.add("扣除司机抽成");
|
shellList.add("下单时间");
|
dataList.add(shellList);
|
|
for (Map<String,Object> object : list){
|
shellList = new ArrayList<String>();
|
// 详细数据列【封装】
|
if(SinataUtil.isNotEmpty(object.get("orderNum"))){
|
shellList.add(object.get("orderNum").toString());
|
}else{
|
shellList.add("-");
|
}
|
if(SinataUtil.isNotEmpty(object.get("userPhone"))){
|
shellList.add(object.get("userPhone").toString());
|
}else{
|
shellList.add("-");
|
}
|
if(SinataUtil.isNotEmpty(object.get("orderSource"))){
|
shellList.add(object.get("orderSource").toString());
|
}else{
|
shellList.add("-");
|
}
|
if(SinataUtil.isNotEmpty(object.get("driverPhone"))){
|
shellList.add(object.get("driverPhone").toString());
|
}else{
|
shellList.add("-");
|
}
|
if(SinataUtil.isNotEmpty(object.get("company"))){
|
shellList.add(object.get("company").toString());
|
}else{
|
shellList.add("-");
|
}
|
if(SinataUtil.isNotEmpty(object.get("income"))){
|
shellList.add(object.get("income").toString());
|
}else{
|
shellList.add("-");
|
}
|
if(SinataUtil.isNotEmpty(object.get("insertTime"))){
|
shellList.add(object.get("insertTime").toString());
|
}else{
|
shellList.add("-");
|
}
|
dataList.add(shellList);
|
}
|
try {
|
// 调用工具类进行导出
|
ExcelExportUtil.easySheet("线下订单统计"+DateUtil.formatDate(new Date(), "YYYYMMddHHmmss"), "线下订单统计", dataList,request, response);
|
|
} catch (Exception e) {
|
e.printStackTrace();
|
}
|
}
|
|
}
|