zhibing.pu
2024-09-10 eb5aadd8ea2ce7151459a708d49eb0aedd3c8316
Merge branch 'master' of http://120.76.84.145:10101/gitblit/r/java/mx_charging_pile
14个文件已修改
3个文件已添加
597 ■■■■■ 已修改文件
ruoyi-api/ruoyi-api-chargingPile/src/main/java/com/ruoyi/chargingPile/api/query/ParkingRecordQuery.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/model/ChargingListQuery.java 36 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/vo/AccountListVO.java 29 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/vo/AccountVO.java 85 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/vo/ChargingBillListVO.java 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/vo/ChargingOrderTimeVO.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/controller/TParkingRecordController.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/mapper/SiteMapper.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/mapper/TParkingRecordMapper.java 21 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/service/TParkingRecordService.java 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/service/impl/TParkingRecordServiceImpl.java 39 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-chargingPile/src/main/resources/mapper/chargingPile/TParkingRecordMapper.xml 55 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/ChargingBillController.java 9 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/FinancialSettlementController.java 55 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/export/TChargingOrderExport.java 159 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TChargingOrderServiceImpl.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-order/src/main/resources/mapper/order/TChargingOrderMapper.xml 75 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-chargingPile/src/main/java/com/ruoyi/chargingPile/api/query/ParkingRecordQuery.java
@@ -5,6 +5,8 @@
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
@Data
@ApiModel(value = "停车缴费订单Query")
public class ParkingRecordQuery extends TimeRangePageQuery {
@@ -18,4 +20,7 @@
    @ApiModelProperty(value = "车牌号")
    private String licensePlate;
    @ApiModelProperty(value = "停车场id集合 前端忽略")
    private List<Integer> lotIds;
}
ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/model/ChargingListQuery.java
@@ -9,14 +9,38 @@
import java.util.List;
@Data
@ApiModel(value = "充电账单列表查询参数")
@ApiModel("充电时段统计DTO")
public class ChargingListQuery extends BasePage {
    @ApiModelProperty("订单分类 1全站 2各个站点")
    private String type;
    @ApiModelProperty("账单周期2020-01-01 00:00:00 - 2020-01-01 23:59:59")
    private String startTime;
    @ApiModelProperty("1已出账 2未出账")
    @ApiModelProperty("订单编号")
    private String code;
    @ApiModelProperty("电站id")
    private Integer siteId;
    @ApiModelProperty("状态(0=未知,1=等待中,2=启动中,3=充电中,4=停止中,5=已结束)")
    private Integer status;
    @ApiModelProperty("订单分类(1全站 2各个站点)")
    private Integer type;
    @ApiModelProperty("状态(1未出账 2已出账)")
    private Integer state;
    @ApiModelProperty("uid 前端忽略")
    private String uid;
    @ApiModelProperty("手机号")
    private String phone;
    @ApiModelProperty("车牌号")
    private String licensePlate;
    @ApiModelProperty("订单类型(1=充电订单(小程序),2=充电订单(刷卡))")
    private Integer orderType;
    @ApiModelProperty("开始时间 2020-01-01 12:00:00 - 2020-01-01 23:00:00")
    private String startTime;
    @ApiModelProperty("结束时间 2020-01-01 12:00:00 - 2020-01-01 23:00:00")
    private String endTime;
    @ApiModelProperty("用户ids 前端忽略")
    private List<Long> userIds;
    @ApiModelProperty("车辆ids 前端忽略")
    private List<Long> carIds;
}
ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/vo/AccountListVO.java
New file
@@ -0,0 +1,29 @@
package com.ruoyi.order.api.vo;
import com.ruoyi.common.core.web.page.PageInfo;
import com.ruoyi.order.api.model.TChargingBill;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.math.BigDecimal;
import java.util.List;
@Data
@ApiModel(value = "ChargingBillListVO对象",description = "充电算帐单列表VO")
public class AccountListVO{
    @ApiModelProperty(value = "账单数量")
    private String billCount;
    @ApiModelProperty(value = "总入账金额")
    private BigDecimal totalAmount;
    @ApiModelProperty(value = "总支付结算金额")
    private BigDecimal paymentAmount;
    @ApiModelProperty(value = "总退款结算金额")
    private BigDecimal orderAmount;
    @ApiModelProperty(value = "平台手续费")
    private BigDecimal commissionAmount;
    @ApiModelProperty(value = "列表数据")
    private PageInfo<ChargingBillListVO> list;
}
ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/vo/AccountVO.java
New file
@@ -0,0 +1,85 @@
package com.ruoyi.order.api.vo;
import com.ruoyi.common.core.web.page.PageInfo;
import com.ruoyi.order.api.model.TChargingOrder;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.math.BigDecimal;
import java.util.List;
@Data
@ApiModel(value = "ChargingBillVO对象",description = "充电算帐单")
public class AccountVO {
    @ApiModelProperty(value = "账单编号")
    private String code;
    @ApiModelProperty(value = "账户类型")
    private String accountType;
    @ApiModelProperty(value = "账单类型")
    private String orderType;
    @ApiModelProperty(value = "账单分类")
    private String type;
//    @ApiModelProperty(value = "账单周期")
//    private String accountType;
//    @ApiModelProperty(value = "站点名称")
//    private String accountType;
//    @ApiModelProperty(value = "账户类型")
//    private String accountType;
//    @ApiModelProperty(value = "账户类型")
//    private String accountType;
//    @ApiModelProperty(value = "账户类型")
//    private String accountType;
//    @ApiModelProperty(value = "账户类型")
//    private String accountType;
//    @ApiModelProperty(value = "账户类型")
//    private String accountType;
//    @ApiModelProperty(value = "账户类型")
//    private String accountType;
//    @ApiModelProperty(value = "账户类型")
//    private String accountType;
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//    @ApiModelProperty(value = "订单总金额")
//    private BigDecimal orderAmount;
//    @ApiModelProperty(value = "累计电费")
//    private BigDecimal electrovalence;
//    @ApiModelProperty(value = "累计服务费")
//    private BigDecimal serviceCharge;
//    @ApiModelProperty(value = "订单数量")
//    private Integer orderCount;
//    @ApiModelProperty(value = "平台手续费")
//    private BigDecimal commissionAmount;
//    @ApiModelProperty(value = "三方平台分佣")
//    private BigDecimal sharingAmount;
//    @ApiModelProperty(value = "优惠抵扣")
//    private BigDecimal discount;
//    @ApiModelProperty(value = "账单分类 1全站 2各个站点 前端忽略")
//    private String category;
//    @ApiModelProperty(value = "账单类型 月结 前端忽略")
//    private String type;
//    @ApiModelProperty(value = "站点名称 前端忽略")
//    private String siteName;
//    @ApiModelProperty(value = "账单周期 前端忽略")
//    private String billWeek;
//    @ApiModelProperty(value = "账单生成日期 前端忽略")
//    private String createTime;
//    @ApiModelProperty(value = "账单编号 前端忽略")
//    private String code;
//    @ApiModelProperty(value = "充电时长 前端忽略")
//    private String chargingTime;
}
ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/vo/ChargingBillListVO.java
@@ -20,8 +20,12 @@
    private Integer orderCount;
    @ApiModelProperty(value = "站点名称")
    private String siteName;
    @ApiModelProperty(value = "实收金额")
    @ApiModelProperty(value = "实收金额(支付结算金额)")
    private BigDecimal paymentAmount;
    @ApiModelProperty(value = "退款结算金额")
    private BigDecimal refundAmount;
    @ApiModelProperty(value = "平台分佣")
    private BigDecimal sharingAmount;
    @ApiModelProperty(value = "总金额")
    private BigDecimal orderAmount;
    @ApiModelProperty(value = "累计电费")
@@ -30,8 +34,7 @@
    private BigDecimal serviceCharge;
    @ApiModelProperty(value = "平台手续费")
    private BigDecimal commissionAmount;
    @ApiModelProperty(value = "平台分佣")
    private BigDecimal sharingAmount;
    @ApiModelProperty(value = "充电电流 度")
    private BigDecimal chargingCapacity;
}
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-chargingPile/src/main/java/com/ruoyi/chargingPile/controller/TParkingRecordController.java
@@ -55,9 +55,8 @@
    @ApiOperation(tags = {"后台-订单管理-停车记录"},value = "停车缴费订单列表")
    @PostMapping(value = "/pageList")
    public R<PageInfo<TParkingRecordPageInfoVO>> pageList(@RequestBody ParkingRecordQuery query) {
        return R.ok();
    public R<TParkingRecordPageInfoVO> pageList(@RequestBody ParkingRecordQuery query) {
        return R.ok(parkingRecordService.pageList(query));
    }
    @ApiOperation(tags = {"后台-订单管理-停车记录"},value = "详情")
ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/mapper/SiteMapper.java
@@ -8,6 +8,7 @@
import com.ruoyi.chargingPile.api.vo.SiteDetailVO;
import com.ruoyi.chargingPile.api.vo.SiteVO;
import com.ruoyi.common.core.web.page.PageInfo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@@ -17,6 +18,7 @@
 * @author zhibing.pu
 * @Date 2024/8/7 19:49
 */
@Mapper
public interface SiteMapper extends BaseMapper<Site> {
    
    
ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/mapper/TParkingRecordMapper.java
@@ -2,10 +2,15 @@
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ruoyi.chargingPile.api.model.TParkingRecord;
import com.ruoyi.chargingPile.api.query.ParkingRecordQuery;
import com.ruoyi.chargingPile.api.vo.TParkingRecordPageInfoVO;
import com.ruoyi.chargingPile.api.vo.TParkingRecordVO;
import com.ruoyi.common.core.web.page.PageInfo;
import org.apache.ibatis.annotations.Param;
import java.math.BigDecimal;
import java.time.LocalDate;
import java.util.List;
/**
 * <p>
@@ -18,4 +23,20 @@
public interface TParkingRecordMapper extends BaseMapper<TParkingRecord> {
    BigDecimal getSum(@Param("sixBefore") LocalDate sixBefore);
    /**
     * 停车缴费订单列表
     * @param query
     * @param pageInfo
     * @return
     */
    List<TParkingRecordVO> pageList(@Param("query") ParkingRecordQuery query, @Param("pageInfo")PageInfo<TParkingRecordVO> pageInfo);
    /**
     * 统计
     * @param query
     * @return
     */
    TParkingRecordPageInfoVO getParkingRecordCount(@Param("query")ParkingRecordQuery query);
}
ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/service/TParkingRecordService.java
@@ -2,6 +2,9 @@
import com.baomidou.mybatisplus.extension.service.IService;
import com.ruoyi.chargingPile.api.model.TParkingRecord;
import com.ruoyi.chargingPile.api.query.ParkingRecordQuery;
import com.ruoyi.chargingPile.api.vo.TParkingRecordPageInfoVO;
import com.ruoyi.common.core.web.page.PageInfo;
import java.math.BigDecimal;
import java.time.LocalDate;
@@ -17,4 +20,11 @@
public interface TParkingRecordService extends IService<TParkingRecord> {
    BigDecimal getSum(LocalDate sixBefore);
    /**
     * 停车缴费订单列表
     * @param query
     * @return
     */
    TParkingRecordPageInfoVO pageList(ParkingRecordQuery query);
}
ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/service/impl/TParkingRecordServiceImpl.java
@@ -1,13 +1,28 @@
package com.ruoyi.chargingPile.service.impl;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.chargingPile.api.model.Site;
import com.ruoyi.chargingPile.api.model.TParkingLot;
import com.ruoyi.chargingPile.api.model.TParkingRecord;
import com.ruoyi.chargingPile.api.query.ParkingRecordQuery;
import com.ruoyi.chargingPile.api.vo.TParkingLotVO;
import com.ruoyi.chargingPile.api.vo.TParkingRecordPageInfoVO;
import com.ruoyi.chargingPile.api.vo.TParkingRecordVO;
import com.ruoyi.chargingPile.domain.SiteMenu;
import com.ruoyi.chargingPile.mapper.SiteMapper;
import com.ruoyi.chargingPile.mapper.TParkingLotMapper;
import com.ruoyi.chargingPile.mapper.TParkingRecordMapper;
import com.ruoyi.chargingPile.service.TParkingRecordService;
import com.ruoyi.common.core.web.page.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.math.BigDecimal;
import java.time.LocalDate;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;
/**
 * <p>
@@ -20,8 +35,32 @@
@Service
public class TParkingRecordServiceImpl extends ServiceImpl<TParkingRecordMapper, TParkingRecord> implements TParkingRecordService {
    @Autowired
    private SiteMapper siteMapper;
    @Autowired
    private TParkingLotMapper parkingLotMapper;
    @Override
    public BigDecimal getSum(LocalDate sixBefore) {
        return this.baseMapper.getSum(sixBefore);
    }
    @Override
    public TParkingRecordPageInfoVO pageList(ParkingRecordQuery query) {
        // 查询站点的停车场id
        if(Objects.nonNull(query.getSiteId())){
            Site site = siteMapper.selectById(query.getSiteId());
            List<TParkingLot> tParkingLots = parkingLotMapper.selectList(Wrappers.lambdaQuery(TParkingLot.class)
                    .eq(TParkingLot::getSiteId, site.getId()));
            List<Integer> lotIds = tParkingLots.stream().map(TParkingLot::getId).collect(Collectors.toList());
            query.setLotIds(lotIds);
        }
        PageInfo<TParkingRecordVO> pageInfo = new PageInfo<>(query.getPageCurr(),query.getPageSize());
        List<TParkingRecordVO> list = this.baseMapper.pageList(query,pageInfo);
        pageInfo.setRecords(list);
        // 查询总数
        TParkingRecordPageInfoVO infoVO = this.baseMapper.getParkingRecordCount(query);
        infoVO.setParkingRecordVOS(pageInfo);
        return infoVO;
    }
}
ruoyi-service/ruoyi-chargingPile/src/main/resources/mapper/chargingPile/TParkingRecordMapper.xml
@@ -17,6 +17,7 @@
        <result column="status" property="status" />
        <result column="out_parking_type" property="outParkingType" />
        <result column="create_time" property="createTime" />
        <result column="code" property="code" />
    </resultMap>
    <!-- 通用查询结果列 -->
@@ -26,5 +27,59 @@
    <select id="getSum" resultType="java.math.BigDecimal">
        select sum(timeout_amount) from t_parking_record where   in_parking_time >= #{sixBefore}
    </select>
    <select id="pageList" resultType="com.ruoyi.chargingPile.api.vo.TParkingRecordVO">
        select
        tpr.id, tpr.app_user_id, tpr.license_plate, tpr.vehicle_color, tpr.charging_order_id, tpr.parking_lot_id, tpr.in_parking_time, tpr.out_parking_time,
        tpr.parking_duration, tpr.order_amount, tpr.status, tpr.out_parking_type, tpr.create_time,(tpr.order_amount - tpr.timeout_amount) as parkingFee,
        (tpr.parking_duration - tpr.free_duration) as feeDuration,ts.name as siteName
        from t_parking_record tpr
        left join t_parking_lot tpl on tpr.parking_lot_id = tpl.id
        left join t_site ts on tpl.site_id = ts.id
        <where>
            <if test="query.startTime != null and query.startTime != '' and query.endTime != null and query.endTime != ''">
                AND tpr.create_time BETWEEN #{query.startTime} AND #{query.endTime}
            </if>
            <if test="query.code != null and query.code != ''">
                AND tpr.code LIKE concat('%',#{query.code},'%')
            </if>
            <if test="query.licensePlate != null and query.licensePlate != ''">
                AND tpr.licensePlate LIKE concat('%',#{query.licensePlate},'%')
            </if>
            <if test="query.lotIds != null and query.lotIds.size()>0">
                AND tpr.parking_lot_id IN
                <foreach collection="query.lotIds" item="item" open="(" separator="," close=")">
                    #{item}
                </foreach>
            </if>
            AND tpr.status = 3
        </where>
        ORDER BY tpr.create_time DESC
    </select>
    <select id="getParkingRecordCount" resultType="com.ruoyi.chargingPile.api.vo.TParkingRecordPageInfoVO">
        SELECT count(id) as orderCount,
               sum(timeout_amount) as timeoutAmountSum,
               sum(parking_duration - free_duration) as feeDurationSum,
               sum(parking_duration) as parkingDurationSum
        from t_parking_record
        <where>
            <if test="query.startTime != null and query.startTime != '' and query.endTime != null and query.endTime != ''">
                AND create_time BETWEEN #{query.startTime} AND #{query.endTime}
            </if>
            <if test="query.code != null and query.code != ''">
                AND code LIKE concat('%',#{query.code},'%')
            </if>
            <if test="query.licensePlate != null and query.licensePlate != ''">
                AND licensePlate LIKE concat('%',#{query.licensePlate},'%')
            </if>
            <if test="query.lotIds != null and query.lotIds.size()>0">
                AND parking_lot_id IN
                <foreach collection="query.lotIds" item="item" open="(" separator="," close=")">
                    #{item}
                </foreach>
            </if>
            AND status = 3
        </where>
        ORDER BY create_time DESC
    </select>
</mapper>
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/ChargingBillController.java
@@ -18,6 +18,7 @@
import com.ruoyi.order.api.model.TChargingBill;
import com.ruoyi.order.api.model.TChargingOrder;
import com.ruoyi.order.api.query.TOrderInvoiceQuery;
import com.ruoyi.order.api.vo.AccountListVO;
import com.ruoyi.order.api.vo.ChargingBillListVO;
import com.ruoyi.order.api.vo.ChargingBillVO;
import com.ruoyi.order.api.model.ChargingListQuery;
@@ -66,7 +67,13 @@
    @Resource
    private TChargingOrderService chargingOrderService;
    @PostMapping(value = "/accountBillList")
    @ApiOperation(value = "列表查询", tags = {"管理后台-账户结算账单"})
    public R<AccountListVO> accountBillList(@RequestBody ChargingListQuery dto) {
        AccountListVO accountListVO = new AccountListVO();
        ChargingBillVO res = chargingBillService.chargingBillList(dto);
        return R.ok(accountListVO);
    }
    @PostMapping(value = "/chargingBillList")
    @ApiOperation(value = "充电算帐单列表查询", tags = {"管理后台-充电算账单"})
    public AjaxResult<ChargingBillVO> chargingBillList(@RequestBody ChargingListQuery dto) {
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,29 +10,45 @@
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.ChargingListQuery;
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;
import com.ruoyi.order.service.*;
import com.ruoyi.payment.api.feignClient.AliPaymentClient;
import com.ruoyi.payment.api.feignClient.WxPaymentClient;
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>