ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/vo/ChargingOrderTimeVO.java
@@ -31,4 +31,6 @@ private String electronicProportion; @ApiModelProperty(value = "列表数据") private PageInfo<ChargingOrderListVO> list; @ApiModelProperty(value = "导出列表数据") private List<ChargingOrderListVO> exportList; } ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/FinancialSettlementController.java
@@ -1,6 +1,8 @@ package com.ruoyi.order.controller; import cn.afterturn.easypoi.excel.ExcelExportUtil; import cn.afterturn.easypoi.excel.entity.ExportParams; import com.ruoyi.account.api.feignClient.AppUserCarClient; import com.ruoyi.account.api.feignClient.AppUserClient; import com.ruoyi.chargingPile.api.feignClient.ChargingGunClient; @@ -8,15 +10,24 @@ import com.ruoyi.chargingPile.api.feignClient.ParkingLotClient; import com.ruoyi.chargingPile.api.feignClient.SiteClient; import com.ruoyi.common.core.domain.R; import com.ruoyi.common.core.utils.DateUtils; import com.ruoyi.common.core.utils.WebUtils; import com.ruoyi.common.core.web.domain.AjaxResult; import com.ruoyi.common.core.web.page.PageInfo; import com.ruoyi.common.log.annotation.Log; import com.ruoyi.common.log.enums.BusinessType; import com.ruoyi.common.redis.service.RedisService; import com.ruoyi.common.security.service.TokenService; import com.ruoyi.order.api.dto.SettlementConfirmAdd; import com.ruoyi.order.api.model.TChargingOrder; import com.ruoyi.order.api.model.TSettlementConfirm; import com.ruoyi.order.api.query.SettlementListQuery; import com.ruoyi.order.api.query.TOrderInvoiceQuery; import com.ruoyi.order.api.vo.ChargingOrderListVO; import com.ruoyi.order.api.vo.SettlementTotalVO; import com.ruoyi.order.api.vo.TOrderInvoiceVO; import com.ruoyi.order.export.OrderInvoiceExport; import com.ruoyi.order.export.TChargingOrderExport; import com.ruoyi.order.vo.ChargingOrderListInfoVO; import com.ruoyi.order.api.vo.ChargingOrderTimeVO; import com.ruoyi.order.api.model.ChargingListQuery; @@ -26,11 +37,18 @@ import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiParam; import org.apache.poi.ss.usermodel.Workbook; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; import javax.servlet.ServletOutputStream; import javax.servlet.http.HttpServletResponse; import java.io.IOException; import java.net.URLEncoder; import java.time.format.DateTimeFormatter; import java.util.ArrayList; import java.util.List; /** @@ -62,7 +80,42 @@ ChargingOrderListInfoVO res = chargingOrderService.chargingInfo(uid); return AjaxResult.success(res); } @ApiOperation(value = "充电时段统计-导出", tags = {"管理后台-财务结算"}) @PostMapping("/export") public void export(@RequestBody ChargingListQuery dto) { ChargingOrderTimeVO res = chargingOrderService.chargingList(dto); List<TChargingOrderExport> tChargingOrderExports = new ArrayList<>(); List<ChargingOrderListVO> exportList = res.getExportList(); for (ChargingOrderListVO chargingOrderListVO : exportList) { TChargingOrderExport tChargingOrderExport = new TChargingOrderExport(); BeanUtils.copyProperties(chargingOrderListVO,tChargingOrderExport); tChargingOrderExports.add(tChargingOrderExport); } Workbook workbook = ExcelExportUtil.exportExcel(new ExportParams(), TChargingOrderExport.class, tChargingOrderExports); HttpServletResponse response = WebUtils.response(); response.setContentType("application/vnd.ms-excel"); response.setCharacterEncoding("utf-8"); ServletOutputStream outputStream = null; try { String fileName = URLEncoder.encode("充电时段统计导出.xls", "utf-8"); response.setHeader("Content-Disposition", "attachment;filename=" + fileName); response.setContentType("application/vnd.ms-excel;charset=UTF-8"); response.setHeader("Pragma", "no-cache"); response.setHeader("Cache-Control", "no-cache"); outputStream = response.getOutputStream(); workbook.write(outputStream); } catch (IOException e) { e.printStackTrace(); } finally { try { outputStream.close(); } catch (IOException e) { e.printStackTrace(); } } } @GetMapping(value = "/settlementTotal") @ApiOperation(value = "结算汇总-列表查询", tags = {"管理后台-财务结算"}) @ApiParam(name = "time", value = "汇报时间2024-01-01 00:00:00") ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/export/TChargingOrderExport.java
New file @@ -0,0 +1,159 @@ package com.ruoyi.order.export; import cn.afterturn.easypoi.excel.annotation.Excel; import io.swagger.annotations.ApiModel; import lombok.Data; import java.io.Serializable; import java.math.BigDecimal; @Data @ApiModel(value = "充电时段统计-导出") public class TChargingOrderExport implements Serializable { @Excel(name = "序号",width = 30) private Integer id; @Excel(name = "订单编号",width = 30) private String code; @Excel(name = "电站编号",width = 30) private String siteCode; @Excel(name = "电站名称",width = 30) private String siteName; @Excel(name = "终端名称",width = 30) private String terminalName; @Excel(name = "所属城市",width = 30) private String city; @Excel(name = "市区名称",width = 30) private String cityName; @Excel(name = "所属合作商",width = 30) private String partner; @Excel(name = "电站类型",width = 30,replace = {"其他_0","公共_1","个人_2","公交_3","环卫_4","物流_5","出租车_6"}) private Integer siteType; @Excel(name = "售电模式",width = 30,replace = {"正常使用_1","维修中_2","关闭下线_3"}) private String saleType; @Excel(name = "运营类型",width = 30,replace = {"直营_1","非直营_2"}) private String businessCategory; @Excel(name = "计费模板",width = 30) private String name; @Excel(name = "收款方式",width = 30,replace = {"线上_1","线下_2"}) private String orderClassification; @Excel(name = "充电启动方式",width = 30) private String startType; @Excel(name = "一级来源",width = 30) private String one; @Excel(name = "二级来源",width = 30) private String two; @Excel(name = "订单创建时间",width = 30) private String createTime; @Excel(name = "充电开始时间",width = 30) private String startTime; @Excel(name = "充电结束时间",width = 30) private String endTime; @Excel(name = "订单状态",width = 30,replace = {"待支付_1","已支付_2"}) private String rechargePaymentStatus; @Excel(name = "订单类型",width = 30) private String type; @Excel(name = "充电形式",width = 30) private String chargingType; @Excel(name = "判定结束原因",width = 30,replace = {"异常终止_0","主动终止_1","满电终止_2","费用不足终止_3"}) private String endmode; @Excel(name = "充电结束账号",width = 30) private String chargingEndAccount; @Excel(name = "是否是免费订单",width = 30) private String isFree; @Excel(name = "充电电费(元)",width = 30) private String electrovalence; @Excel(name = "充电服务费(元)",width = 30) private String serviceCharge; @Excel(name = "充电费用(元)",width = 30) private String total; @Excel(name = "充电电量(度)",width = 30) private String chargingCapacity; @Excel(name = "平均电费单价(元)",width = 30) private String electrovalencePrice; @Excel(name = "平均服务费实际单价(元)",width = 30) private String serviceChargePrice; @Excel(name = "平均服务费挂牌单价(元)",width = 30) private String serviceChargePriceLook; @Excel(name = "充电时长(分钟)",width = 30) private String cumulativeChargingTime; @Excel(name = "充电前面soc",width = 30) private String startSoc; @Excel(name = "充电后soc",width = 30) private String endtSoc; @Excel(name = "是否限制soc",width = 30) private String isSoc; @Excel(name = "限制soc方式",width = 30) private String isSocType; @Excel(name = "限制soc值",width = 30) private String isSocNum; @Excel(name = "客户类型",width = 30) private String userType; @Excel(name = "会员类型",width = 30) private String vipType; @Excel(name = "是否PLUS订单",width = 30) private String isPlus; @Excel(name = "客户编号",width = 30) private String userCode; @Excel(name = "真实姓名",width = 30) private String realName; @Excel(name = "设备号",width = 30) private String deviceCode; @Excel(name = "手机号",width = 30) private String phone; @Excel(name = "昵称",width = 30) private String nickName; @Excel(name = "企业编号",width = 30) private String companyCode; @Excel(name = "企业名称",width = 30) private String companyName; @Excel(name = "扣费账户类型",width = 30) private String accountType; @Excel(name = "使用人",width = 30) private String useUser; @Excel(name = "卡号",width = 30) private String bankCard; @Excel(name = "代充使用人",width = 30) private String replaceUser; @Excel(name = "车架号",width = 30) private String carSiteName; @Excel(name = "车架号来源",width = 30) private String carSiteSource; @Excel(name = "车牌号",width = 30) private String carNumber; @Excel(name = "发动机号",width = 30) private String carEngineNumber; @Excel(name = "车辆自编号",width = 30) private String carNumberCode; @Excel(name = "第三方商户订单",width = 30) private String orderCode; @Excel(name = "判定车牌号",width = 30) private String carNumberSource; @Excel(name = "是否单枪",width = 30) private String isSingle; @Excel(name = "选择车型",width = 30) private String carType; @Excel(name = "车辆品牌",width = 30) private String carBrand; @Excel(name = "判定车系",width = 30) private String carSeries; @Excel(name = "判定车系来源",width = 30) private String carSeriesSource; @Excel(name = "收款时间",width = 30) private String payTime; @Excel(name = "电费结算方编码",width = 30) private String electrovalenceSiteCode; @Excel(name = "电费结算方名称",width = 30) private String electrovalenceSiteName; @Excel(name = "管理公司",width = 30) private String companyNameAdmin; @Excel(name = "计费方式",width = 30) private String moneyType; @Excel(name = "设备接入方式",width = 30) private String deviceType; @Excel(name = "核算公司",width = 30) private String settlementCompanyName; @Excel(name = "预支付类型",width = 30) private String prePaymentType; @Excel(name = "是否安全防护订单",width = 30) private String isSecurity; } ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TChargingOrderServiceImpl.java
@@ -1245,6 +1245,7 @@ } // 不分页 List<ChargingOrderListVO> list1 = this.baseMapper.chargingList1(dto,startTime1,startTime2,endTime1,endTime2); chargingOrderTimeVO.setExportList(list1); chargingOrderTimeVO.setOrderCount(list1.size()); // 计算充电总度数 BigDecimal electronic = new BigDecimal("0"); ruoyi-service/ruoyi-order/src/main/resources/mapper/order/TChargingOrderMapper.xml
@@ -443,5 +443,78 @@ </select> <select id="chargingList" resultType="com.ruoyi.order.api.vo.ChargingOrderListVO"> select t1.* from t_charging_order t1 where 1=1 <if test="null != req.code and req.code!=''"> and t1.code LIKE CONCAT('%',#{req.code},'%') </if> <if test="null != req.carIds and req.carIds.size()>0" > and t1.app_user_car_id in <foreach collection="req.carIds" item="item" index="index" separator="," open="(" close=")"> #{item} </foreach> </if> <if test="null != req.userIds and req.userIds.size()>0" > and t1.app_user_id in <foreach collection="req.userIds" item="item" index="index" separator="," open="(" close=")"> #{item} </foreach> </if> <if test="req.orderType != null "> and t1.order_type = #{req.orderType} </if> <if test="req.status != null "> and t1.status = #{status} </if> <if test="req.status != null "> and t1.status = #{req.status} </if> <if test="req.siteId != null "> and t1.site_id = #{req.siteId} </if> <if test="startTime1 != null and startTime1!=''"> and (t1.start_time between #{startTime1} and #{startTime2}) </if> <if test="endTime1 != null and endTime1!=''"> and (t1.end_time between #{endTime1} and #{endTime2}) </if> </select> <select id="chargingList1" resultType="com.ruoyi.order.api.vo.ChargingOrderListVO"> select t1.* from t_charging_order t1 where 1=1 <if test="null != req.code and req.code!=''"> and t1.code LIKE CONCAT('%',#{req.code},'%') </if> <if test="null != req.carIds and req.carIds.size()>0" > and t1.app_user_car_id in <foreach collection="req.carIds" item="item" index="index" separator="," open="(" close=")"> #{item} </foreach> </if> <if test="null != req.userIds and req.userIds.size()>0" > and t1.app_user_id in <foreach collection="req.userIds" item="item" index="index" separator="," open="(" close=")"> #{item} </foreach> </if> <if test="req.orderType != null "> and t1.order_type = #{req.orderType} </if> <if test="req.status != null "> and t1.status = #{status} </if> <if test="req.status != null "> and t1.status = #{req.status} </if> <if test="req.siteId != null "> and t1.site_id = #{req.siteId} </if> <if test="startTime1 != null and startTime1!=''"> and (t1.start_time between #{startTime1} and #{startTime2}) </if> <if test="endTime1 != null and endTime1!=''"> and (t1.end_time between #{endTime1} and #{endTime2}) </if> </select> </mapper>