mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-04-20 11:05:18 +08:00
查询时间段内订单总金额和总用电量V2
This commit is contained in:
@@ -1,12 +1,9 @@
|
||||
package com.jsowell.pile.domain;
|
||||
|
||||
import lombok.*;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
|
||||
/**
|
||||
* 结算订单报表
|
||||
@@ -65,11 +62,13 @@ public class SettleOrderReport {
|
||||
|
||||
/**
|
||||
* 收入金额
|
||||
* 订单主表中orderAmount的累计金额
|
||||
*/
|
||||
private BigDecimal totalAmount;
|
||||
|
||||
/**
|
||||
* 虚拟金额
|
||||
* 也就是不对账的部分消费
|
||||
*/
|
||||
private BigDecimal virtualAmount;
|
||||
|
||||
@@ -80,11 +79,13 @@ public class SettleOrderReport {
|
||||
|
||||
/**
|
||||
* 交易金额
|
||||
* 结算金额拆分为 交易金额 + 交易手续费
|
||||
*/
|
||||
private BigDecimal tradeAmount;
|
||||
|
||||
/**
|
||||
* 交易手续费
|
||||
* 结算金额拆分为 交易金额 + 交易手续费
|
||||
*/
|
||||
private BigDecimal tradeFee;
|
||||
|
||||
|
||||
@@ -135,8 +135,6 @@ public interface PileBasicInfoMapper {
|
||||
* @param dto 站点Id
|
||||
* @return 首页基本信息
|
||||
*/
|
||||
public IndexGeneralSituationVO getGeneralSituation(@Param("IndexQueryDTO")IndexQueryDTO dto);
|
||||
|
||||
public IndexGeneralSituationVO getGeneralSituationInfo(@Param("IndexQueryDTO")IndexQueryDTO dto);
|
||||
|
||||
/**
|
||||
|
||||
@@ -137,4 +137,14 @@ public interface SettleOrderReportMapper {
|
||||
* @param date 交易日期
|
||||
*/
|
||||
List<SettleOrderReport> selectByMerchantIdAndDate(@Param("merchantId") String merchantId, @Param("date") String date);
|
||||
|
||||
/**
|
||||
* 通过站点idList 日期范围查询订单日报列表
|
||||
*
|
||||
* @param stationIdList 站点idList
|
||||
* @param startDate 开始时间
|
||||
* @param endDate 结束时间
|
||||
* @return
|
||||
*/
|
||||
List<SettleOrderReport> queryOrderReport(@Param("stationIdList") List<String> stationIdList, @Param("startDate") String startDate, @Param("endDate") String endDate);
|
||||
}
|
||||
@@ -220,7 +220,9 @@ public interface IOrderBasicInfoService {
|
||||
*/
|
||||
OrderTotalDataVO getOrderTotalData(QueryOrderDTO orderBasicInfo);
|
||||
|
||||
/**
|
||||
OrderTotalDataVO getOrderTotalDataV2(QueryOrderDTO dto);
|
||||
|
||||
/**
|
||||
* 通过订单号查询订单信息(小程序发送消息用)
|
||||
* @param orderCode
|
||||
* @return
|
||||
|
||||
@@ -93,4 +93,6 @@ public interface ISettleOrderReportService {
|
||||
int updateBatchSelective(List<SettleOrderReport> list);
|
||||
|
||||
int batchInsert(List<SettleOrderReport> list);
|
||||
|
||||
List<SettleOrderReport> queryOrderReport(List<String> stationIdList, String startTime, String endTime);
|
||||
}
|
||||
|
||||
@@ -364,6 +364,37 @@ public class OrderBasicInfoServiceImpl implements IOrderBasicInfoService {
|
||||
return vo;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询时间段内订单总金额和总用电量V2
|
||||
* @param dto
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public OrderTotalDataVO getOrderTotalDataV2(QueryOrderDTO dto) {
|
||||
OrderTotalDataVO vo = new OrderTotalDataVO();
|
||||
String startTime = dto.getStartTime();
|
||||
String endTime = dto.getEndTime();
|
||||
vo.setDateDescription(startTime + " - " + endTime);
|
||||
List<String> stationIdList = Lists.newArrayList(dto.getStationId());
|
||||
List<SettleOrderReport> settleOrderReports = settleOrderReportService.queryOrderReport(stationIdList, startTime, endTime);
|
||||
// 总消费金额
|
||||
BigDecimal sumOrderAmount = BigDecimal.ZERO;
|
||||
// 总用电量
|
||||
BigDecimal sumUsedElectricity = BigDecimal.ZERO;
|
||||
// 总结算金额
|
||||
BigDecimal sumSettleAmount = BigDecimal.ZERO;
|
||||
for (SettleOrderReport settleOrderReport : settleOrderReports) {
|
||||
sumOrderAmount = sumOrderAmount.add(settleOrderReport.getTotalAmount());
|
||||
sumUsedElectricity = sumUsedElectricity.add(settleOrderReport.getUseElectricity());
|
||||
// 结算金额拆分为 交易金额 + 交易手续费
|
||||
sumSettleAmount = sumSettleAmount.add(settleOrderReport.getTradeAmount()).add(settleOrderReport.getTradeFee());
|
||||
}
|
||||
vo.setSumSettleAmount(sumSettleAmount);
|
||||
vo.setSumUsedElectricity(sumUsedElectricity);
|
||||
vo.setSumOrderAmount(sumOrderAmount);
|
||||
return vo;
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过订单号查询订单信息(小程序发送消息用)
|
||||
*
|
||||
|
||||
@@ -222,5 +222,10 @@ public class SettleOrderReportServiceImpl implements ISettleOrderReportService {
|
||||
public int batchInsert(List<SettleOrderReport> list) {
|
||||
return settleOrderReportMapper.batchInsert(list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SettleOrderReport> queryOrderReport(List<String> stationIdList, String startTime, String endTime) {
|
||||
return settleOrderReportMapper.queryOrderReport(stationIdList, startTime, endTime);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -309,44 +309,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
t2.pile_connector_code = #{pileConnectorCode,jdbcType=VARCHAR}
|
||||
</select>
|
||||
|
||||
|
||||
<select id="getGeneralSituation" resultType="com.jsowell.pile.vo.web.IndexGeneralSituationVO">
|
||||
SELECT
|
||||
sum( t3.total_used_electricity ) AS totalChargingDegree,
|
||||
sum( t3.total_order_amount ) AS totalChargingAmount,
|
||||
count( DISTINCT t2.order_code ) AS totalChargingQuantity,
|
||||
count( DISTINCT t1.sn ) AS totalPileQuantity,
|
||||
t4.totalMemberAmount
|
||||
FROM
|
||||
pile_basic_info t1
|
||||
LEFT JOIN order_basic_info t2 ON t1.sn = t2.pile_sn
|
||||
LEFT JOIN order_detail t3 ON t2.order_code = t3.order_code
|
||||
AND t2.order_status = '6'
|
||||
AND t2.del_flag = '0',
|
||||
(
|
||||
SELECT
|
||||
sum( t2.principal_balance + t2.gift_balance ) AS totalMemberAmount
|
||||
FROM
|
||||
member_basic_info t1
|
||||
JOIN member_wallet_info t2 ON t1.member_id = t2.member_id
|
||||
AND t1.del_flag = '0'
|
||||
AND t1.STATUS = '1'
|
||||
) t4
|
||||
WHERE
|
||||
t1.del_flag = '0'
|
||||
<if test="IndexQueryDTO.stationId != null and IndexQueryDTO.stationId != ''">
|
||||
and t1.station_id = #{IndexQueryDTO.stationId,jdbcType=VARCHAR}
|
||||
</if>
|
||||
<!-- 数据范围过滤 -->
|
||||
<if test="IndexQueryDTO.stationIdList != null and IndexQueryDTO.stationIdList.size() != 0">
|
||||
and t1.station_id in
|
||||
<foreach collection="IndexQueryDTO.stationIdList" item="item" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
</if>
|
||||
group by t4.totalMemberAmount
|
||||
</select>
|
||||
|
||||
<select id="getPileInfoByMemberId" resultType="com.jsowell.pile.vo.uniapp.PersonalPileInfoVO">
|
||||
SELECT
|
||||
t1.pile_sn as pileSn,
|
||||
|
||||
@@ -808,7 +808,8 @@
|
||||
</select>
|
||||
|
||||
<select id="selectByStationIdAndDate" resultMap="BaseResultMap">
|
||||
select <include refid="Base_Column_List" />
|
||||
select
|
||||
<include refid="Base_Column_List" />
|
||||
from settle_order_report
|
||||
where del_flag = '0'
|
||||
and station_id = #{stationId,jdbcType=VARCHAR}
|
||||
@@ -816,10 +817,23 @@
|
||||
</select>
|
||||
|
||||
<select id="selectByMerchantIdAndDate" resultMap="BaseResultMap">
|
||||
select <include refid="Base_Column_List" />
|
||||
select
|
||||
<include refid="Base_Column_List" />
|
||||
from settle_order_report
|
||||
where del_flag = '0'
|
||||
and merchant_id = #{merchantId,jdbcType=VARCHAR}
|
||||
and trade_date = #{date,jdbcType=VARCHAR}
|
||||
</select>
|
||||
|
||||
<select id="queryOrderReport" resultMap="BaseResultMap">
|
||||
select
|
||||
<include refid="Base_Column_List" />
|
||||
from settle_order_report
|
||||
where del_flag = '0'
|
||||
and station_id in
|
||||
<foreach collection="stationIdList" item="stationId" open="(" separator="," close=")">
|
||||
#{stationId,jdbcType=VARCHAR}
|
||||
</foreach>
|
||||
and trade_date between #{startDate,jdbcType=VARCHAR} and #{endDate,jdbcType=VARCHAR}
|
||||
</select>
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user