分润导出
This commit is contained in:
		| @ -2,11 +2,16 @@ package com.ruoyi.orders.controller; | ||||
|  | ||||
| import java.util.List; | ||||
| import java.util.Map; | ||||
| import java.util.stream.Collectors; | ||||
|  | ||||
| import com.ruoyi.common.constant.UserConstants; | ||||
| import com.ruoyi.common.utils.DateUtils; | ||||
| import com.ruoyi.common.utils.DictUtils; | ||||
| import com.ruoyi.operation.domain.Company; | ||||
| import com.ruoyi.operation.service.ICompanyService; | ||||
| import com.ruoyi.orders.dto.OrderDistribExportDto; | ||||
| import org.apache.shiro.authz.annotation.RequiresPermissions; | ||||
| import org.springframework.beans.BeanUtils; | ||||
| import org.springframework.beans.factory.annotation.Autowired; | ||||
| import org.springframework.stereotype.Controller; | ||||
| import org.springframework.ui.ModelMap; | ||||
| @ -89,9 +94,37 @@ public class ZcOrderDistribController extends BaseController | ||||
|         if(UserConstants.USER_TYPE_02 .equals(getSysUser().getUserType())){ | ||||
|             zcOrderDistrib.setCompanyId(getSysUser().getGroupId()); | ||||
|         } | ||||
|  | ||||
|         List<ZcOrderDistrib> list = zcOrderDistribService.selectZcOrderDistribList(zcOrderDistrib); | ||||
|         ExcelUtil<ZcOrderDistrib> util = new ExcelUtil<ZcOrderDistrib>(ZcOrderDistrib.class); | ||||
|         return util.exportExcel(list, "订单分成统计数据"); | ||||
|  | ||||
|         // 转换为导出DTO | ||||
|         List<OrderDistribExportDto> exportList = list.stream() | ||||
|                 .map(this::convertToExportDto) | ||||
|                 .collect(Collectors.toList()); | ||||
|  | ||||
|         ExcelUtil<OrderDistribExportDto> util = new ExcelUtil<>(OrderDistribExportDto.class); | ||||
|         return util.exportExcel(exportList, "订单分成统计数据"); | ||||
|     } | ||||
|  | ||||
|     private OrderDistribExportDto convertToExportDto(ZcOrderDistrib entity) { | ||||
|         OrderDistribExportDto dto = new OrderDistribExportDto(); | ||||
|         // 执行字段映射 | ||||
|         dto.setOrderNo(entity.getOrderNo()); | ||||
|         dto.setOperatorName(entity.getZcOrderMain().getOperatorName()); | ||||
|         dto.setStoreName(entity.getZcOrderMain().getStoreName()); | ||||
|         dto.setLicensePlate(entity.getZcOrderMain().getLicensePlate()); | ||||
|         dto.setCustomerName(entity.getZcOrderMain().getCustomerName()); | ||||
|         dto.setCustomerPhone(entity.getZcOrderMain().getCustomerPhone()); | ||||
|         dto.setRentalType(DictUtils.getDictLabel("key_order_rental_type", entity.getZcOrderMain().getRentalType())); | ||||
|         dto.setRentalPrice(entity.getZcOrderMain().getRentalPrice()); | ||||
|         dto.setDepositPrice(entity.getZcOrderMain().getDepositPrice()); | ||||
|         dto.setRentalDuration(entity.getZcOrderMain().getRentalDuration()); | ||||
|         dto.setOrderAmount(entity.getZcOrderMain().getOrderAmount()); | ||||
|         dto.setFirstOrderTime(DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS, entity.getZcOrderMain().getFirstOrderTime())); | ||||
|         dto.setOrderStatus(DictUtils.getDictLabel("key_order_status", entity.getZcOrderMain().getOrderStatus())); | ||||
|         dto.setDistribRate(entity.getDistribRate()); | ||||
|         dto.setDistribAmount(entity.getDistribAmount()); | ||||
|         return dto; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|  | ||||
| @ -0,0 +1,73 @@ | ||||
| package com.ruoyi.orders.dto; | ||||
|  | ||||
| import com.fasterxml.jackson.annotation.JsonFormat; | ||||
| import com.ruoyi.common.annotation.Excel; | ||||
| import lombok.Data; | ||||
|  | ||||
| import java.math.BigDecimal; | ||||
| import java.util.Date; | ||||
|  | ||||
| @Data | ||||
| public class OrderDistribExportDto { | ||||
|  | ||||
|     /** 订单编号 */ | ||||
|     @Excel(name = "订单编号") | ||||
|     private String orderNo; | ||||
|  | ||||
|     /** 所属运营商 */ | ||||
|     @Excel(name = "所属运营商") | ||||
|     private String operatorName; | ||||
|  | ||||
|     /** 所属门店 */ | ||||
|     @Excel(name = "所属门店") | ||||
|     private String storeName; | ||||
|  | ||||
|     /** 车牌号 */ | ||||
|     @Excel(name = "车牌号") | ||||
|     private String licensePlate; | ||||
|  | ||||
|     /** 客户姓名 */ | ||||
|     @Excel(name = "客户姓名") | ||||
|     private String customerName; | ||||
|  | ||||
|     /** 联系电话 */ | ||||
|     @Excel(name = "联系电话") | ||||
|     private String customerPhone; | ||||
|  | ||||
|     /** 租赁类型 */ | ||||
|     @Excel(name = "租赁类型") | ||||
|     private String rentalType; | ||||
|  | ||||
|     /** 租赁价格 */ | ||||
|     @Excel(name = "租赁价格(元)") | ||||
|     private BigDecimal rentalPrice; | ||||
|  | ||||
|     /** 支付押金 */ | ||||
|     @Excel(name = "支付押金(元)") | ||||
|     private BigDecimal depositPrice; | ||||
|  | ||||
|     /** 租赁时长 */ | ||||
|     @Excel(name = "租赁时长") | ||||
|     private Long rentalDuration; | ||||
|  | ||||
|     /** 租金总额 */ | ||||
|     @Excel(name = "租金总额") | ||||
|     private BigDecimal orderAmount; | ||||
|  | ||||
|     /** 首次下单时间 */ | ||||
|     @Excel(name = "首次下单时间", width = 30) | ||||
|     private String firstOrderTime; | ||||
|  | ||||
|     /** 订单状态 */ | ||||
|     @Excel(name = "订单状态") | ||||
|     private String orderStatus; | ||||
|  | ||||
|     /** 分配比例 */ | ||||
|     @Excel(name = "分配比例") | ||||
|     private BigDecimal distribRate; | ||||
|  | ||||
|     /** 分配金额 */ | ||||
|     @Excel(name = "分配金额") | ||||
|     private BigDecimal distribAmount; | ||||
|  | ||||
| } | ||||
| @ -95,9 +95,6 @@ | ||||
|  | ||||
|             <div class="btn-group-sm" id="toolbar" role="group"> | ||||
|  | ||||
| <!--                <a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="orders:distrib:export">--> | ||||
| <!--                    <i class="fa fa-download"></i> 导出--> | ||||
| <!--                </a>--> | ||||
|                 <div class="distrib-statistics"> | ||||
|                     <div class="statistics-header"> | ||||
|                         <i class="fa fa-circle-o-notch text-blue"></i> | ||||
| @ -137,6 +134,13 @@ | ||||
|         $(function() { | ||||
|             // 初始化时间范围为近一周 | ||||
|             initDateRange(); | ||||
|             setTimeout(function () { | ||||
|                 var exportBtn = '<a class="btn btn-warning btn-sm" onclick="$.table.exportExcel()" shiro:hasPermission="orders:distrib:export">' + | ||||
|                     '<i class="fa fa-download"></i> 导出</a>'; | ||||
|                 // 在搜索按钮前插入新按钮 | ||||
|                 $('button[name*="search"]').before(exportBtn); | ||||
|             }, 500) | ||||
|  | ||||
|  | ||||
|             var options = { | ||||
|                 url: prefix + "/list", | ||||
|  | ||||
		Reference in New Issue
	
	Block a user
	 19173159168
					19173159168