update 首页订单列表数据更换接口

This commit is contained in:
Lemon
2023-08-03 13:49:50 +08:00
parent 963adbe46e
commit 382d9bdcac
5 changed files with 301 additions and 232 deletions

View File

@@ -116,11 +116,11 @@ public class AgentDevService {
}
String redisKey = CacheConstants.COMPONENT_VERIFY_TICKET + PLATFORM_APP_ID;
// 查缓存,看是否已经过期
String verifyTicket = redisCache.getCacheObject(redisKey);
if (verifyTicket != null) {
// 先删除旧缓存
redisCache.deleteObject(redisKey);
}
// String verifyTicket = redisCache.getCacheObject(redisKey);
// if (verifyTicket != null) {
// // 先删除旧缓存
// redisCache.deleteObject(redisKey);
// }
// 存入Redis 过期时间: 官方12小时但十分钟推送一次, 因此可设置 20 分钟过期
redisCache.setCacheObject(redisKey, componentVerifyTicket, 20, TimeUnit.MINUTES);
String newVerifyTicket = redisCache.getCacheObject(redisKey);

View File

@@ -159,6 +159,13 @@ public interface OrderBasicInfoMapper {
*/
List<IndexOrderInfoVO> getIndexOrderInfo(@Param("dto") IndexQueryDTO dto);
/**
* 首页订单数据展示 V2
* @param dto 首页信息查询dto
* @return
*/
List<IndexOrderInfoVO> getIndexOrderInfoV2(@Param("dto") IndexQueryDTO dto);
/**
* 获取超过15分钟的待支付状态订单
* @return
@@ -225,4 +232,11 @@ public interface OrderBasicInfoMapper {
* @return
*/
List<OrderBasicInfo> queryOrderList(@Param("orderCodeList") List<String> orderCodeList);
/**
* 获取首页订单详情
* @param orderCodeList
* @return
*/
IndexOrderInfoVO getIndexOrderDetail(@Param("list") List<String> orderCodeList);
}

View File

@@ -1546,7 +1546,27 @@ public class OrderBasicInfoServiceImpl implements IOrderBasicInfoService {
}
}
dto.setStationIdList(stationIdList);
return orderBasicInfoMapper.getIndexOrderInfo(dto);
// return orderBasicInfoMapper.getIndexOrderInfo(dto);
List<IndexOrderInfoVO> voList = orderBasicInfoMapper.getIndexOrderInfoV2(dto);
for (IndexOrderInfoVO indexOrderInfoVO : voList) {
String orderCodes = indexOrderInfoVO.getOrderCodes();
// 获取到所有的订单号列表
if (StringUtils.isBlank(orderCodes)) {
continue;
}
List<String> orderCodeList = Arrays.asList(orderCodes.split(","));
// 查询对应数据
IndexOrderInfoVO detailInfo = orderBasicInfoMapper.getIndexOrderDetail(orderCodeList);
if (detailInfo == null) {
continue;
}
indexOrderInfoVO.setTotalSharpUsedElectricity(detailInfo.getTotalSharpUsedElectricity());
indexOrderInfoVO.setTotalPeakUsedElectricity(detailInfo.getTotalPeakUsedElectricity());
indexOrderInfoVO.setTotalFlatUsedElectricity(detailInfo.getTotalFlatUsedElectricity());
indexOrderInfoVO.setTotalValleyUsedElectricity(detailInfo.getTotalValleyUsedElectricity());
}
return voList;
}
/**

View File

@@ -15,6 +15,11 @@ public class IndexOrderInfoVO {
*/
private String date;
/**
* 订单号数组
*/
private String orderCodes;
/**
* 总用电量
*/

View File

@@ -40,7 +40,8 @@
<result property="delFlag" column="del_flag"/>
</resultMap>
<resultMap id="OrderBasicInfoOrderDetailResult" type="com.jsowell.pile.domain.OrderBasicInfo" extends="OrderBasicInfoResult">
<resultMap id="OrderBasicInfoOrderDetailResult" type="com.jsowell.pile.domain.OrderBasicInfo"
extends="OrderBasicInfoResult">
<collection property="orderDetailList" notNullColumn="sub_id" javaType="java.util.List"
resultMap="OrderDetailResult"/>
</resultMap>
@@ -156,9 +157,9 @@
del_flag
</sql>
<select id="selectOrderBasicInfoList" parameterType="com.jsowell.pile.dto.QueryOrderDTO" resultType="com.jsowell.pile.vo.web.OrderListVO">
SELECT
t1.id as id,
<select id="selectOrderBasicInfoList" parameterType="com.jsowell.pile.dto.QueryOrderDTO"
resultType="com.jsowell.pile.vo.web.OrderListVO">
SELECT t1.id as id,
t1.order_code as orderCode,
t1.transaction_code as transactionCode,
t1.order_status as orderStatus,
@@ -234,12 +235,12 @@
and t1.merchant_id = #{merchantId,jdbcType=VARCHAR}
</if>
<!-- 数据范围过滤 -->
<!-- <if test="merchantDeptIds != null and merchantDeptIds.size() != 0">-->
<!-- and t3.dept_id in-->
<!-- <foreach collection="merchantDeptIds" item="merchantDeptId" open="(" separator="," close=")">-->
<!-- #{merchantDeptId}-->
<!-- </foreach>-->
<!-- </if>-->
<!-- <if test="merchantDeptIds != null and merchantDeptIds.size() != 0">-->
<!-- and t3.dept_id in-->
<!-- <foreach collection="merchantDeptIds" item="merchantDeptId" open="(" separator="," close=")">-->
<!-- #{merchantDeptId}-->
<!-- </foreach>-->
<!-- </if>-->
<if test="stationDeptIds != null and stationDeptIds.size() != 0">
and t3.dept_id in
<foreach collection="stationDeptIds" item="stationDeptId" open="(" separator="," close=")">
@@ -297,7 +298,8 @@
where a.id = #{id}
</select>
<insert id="insertOrderBasicInfo" parameterType="com.jsowell.pile.domain.OrderBasicInfo" useGeneratedKeys="true" keyProperty="id">
<insert id="insertOrderBasicInfo" parameterType="com.jsowell.pile.domain.OrderBasicInfo" useGeneratedKeys="true"
keyProperty="id">
insert into order_basic_info
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="orderCode != null">
@@ -629,19 +631,29 @@
</delete>
<insert id="batchOrderDetail">
insert into order_detail(id, order_code, total_used_electricity, total_order_amount, total_electricity_amount,total_service_amount,
sharp_price, sharp_used_electricity, sharp_electricity_price, sharp_service_price, sharp_amount,
peak_price, peak_used_electricity, peak_electricity_price, peak_service_price, peak_amount,
flat_price, flat_used_electricity, flat_electricity_price, flat_service_price, flat_amount,
valley_price, valley_used_electricity, valley_electricity_price, valley_service_price, valley_amount,
create_by,update_by)
insert into order_detail(id, order_code, total_used_electricity, total_order_amount, total_electricity_amount,
total_service_amount,
sharp_price, sharp_used_electricity, sharp_electricity_price, sharp_service_price,
sharp_amount,
peak_price, peak_used_electricity, peak_electricity_price, peak_service_price,
peak_amount,
flat_price, flat_used_electricity, flat_electricity_price, flat_service_price,
flat_amount,
valley_price, valley_used_electricity, valley_electricity_price, valley_service_price,
valley_amount,
create_by, update_by)
values
<foreach item="item" index="index" collection="list" separator=",">
(#{item.id}, #{item.orderCode}, #{item.totalUsedElectricity}, #{item.totalOrderAmount}, #{item.totalElectricityAmount}, #{item.totalServiceAmount},
#{item.sharpPrice}, #{item.sharpUsedElectricity}, #{item.sharpElectricityPrice}, #{item.sharpServicePrice}, #{item.sharpAmount},
#{item.peakPrice}, #{item.peakUsedElectricity}, #{item.peakElectricityPrice}, #{item.peakServicePrice}, #{item.peakAmount},
#{item.flatPrice}, #{item.flatUsedElectricity}, #{item.flatElectricityPrice}, #{item.flatServicePrice}, #{item.flatAmount},
#{item.valleyPrice}, #{item.valleyUsedElectricity}, #{item.valleyElectricityPrice}, #{item.valleyServicePrice}, #{item.valleyAmount},
(#{item.id}, #{item.orderCode}, #{item.totalUsedElectricity}, #{item.totalOrderAmount},
#{item.totalElectricityAmount}, #{item.totalServiceAmount},
#{item.sharpPrice}, #{item.sharpUsedElectricity}, #{item.sharpElectricityPrice}, #{item.sharpServicePrice},
#{item.sharpAmount},
#{item.peakPrice}, #{item.peakUsedElectricity}, #{item.peakElectricityPrice}, #{item.peakServicePrice},
#{item.peakAmount},
#{item.flatPrice}, #{item.flatUsedElectricity}, #{item.flatElectricityPrice}, #{item.flatServicePrice},
#{item.flatAmount},
#{item.valleyPrice}, #{item.valleyUsedElectricity}, #{item.valleyElectricityPrice},
#{item.valleyServicePrice}, #{item.valleyAmount},
#{item.createBy}, #{item.updateBy})
</foreach>
</insert>
@@ -777,8 +789,7 @@
</select>
<select id="getListByMemberIdAndOrderStatus" resultType="com.jsowell.pile.vo.uniapp.OrderVO">
SELECT
t1.id,
SELECT t1.id,
t1.order_code as orderCode,
t1.order_status as orderStatus,
t1.reason,
@@ -818,26 +829,24 @@
</select>
<update id="updateOrderStatusByOrderCode">
update order_basic_info set order_status = #{orderStatus,jdbcType=VARCHAR}
update order_basic_info
set order_status = #{orderStatus,jdbcType=VARCHAR}
where del_flag = '0'
and order_code = #{orderCode,jdbcType=VARCHAR}
</update>
<select id="getIndexOrderInfo" resultType="com.jsowell.pile.vo.web.IndexOrderInfoVO">
SELECT
DATE_FORMAT(t1.create_time,'%Y-%m-%d') as date,
sum( t2.total_used_electricity ) AS totalElectricity,
sum( t2.total_order_amount ) AS totalOrderAmount,
sum( t2.sharp_used_electricity ) AS totalSharpUsedElectricity,
sum( t2.peak_used_electricity ) AS totalPeakUsedElectricity,
sum( t2.flat_used_electricity ) AS totalFlatUsedElectricity,
sum( t2.valley_used_electricity ) AS totalValleyUsedElectricity
FROM
order_basic_info t1
SELECT DATE_FORMAT(t1.create_time, '%Y-%m-%d') as date,
sum(t2.total_used_electricity) AS totalElectricity,
sum(t2.total_order_amount) AS totalOrderAmount,
sum(t2.sharp_used_electricity) AS totalSharpUsedElectricity,
sum(t2.peak_used_electricity) AS totalPeakUsedElectricity,
sum(t2.flat_used_electricity) AS totalFlatUsedElectricity,
sum(t2.valley_used_electricity) AS totalValleyUsedElectricity
FROM order_basic_info t1
JOIN order_detail t2 ON t1.order_code = t2.order_code
AND t1.del_flag = '0'
WHERE
date(t1.create_time) >= DATE_SUB(CURDATE(),INTERVAL 30 day)
WHERE date(t1.create_time) >= DATE_SUB(CURDATE(), INTERVAL 30 day)
and t1.order_status = '6'
<if test="dto.stationId != null and dto.stationId != ''">
and t1.station_id = #{dto.stationId,jdbcType=VARCHAR}
@@ -848,7 +857,7 @@
#{item,jdbcType=VARCHAR}
</foreach>
</if>
group by DATE_FORMAT(t1.create_time,'%Y-%m-%d')
group by DATE_FORMAT(t1.create_time, '%Y-%m-%d')
</select>
<select id="getUnpaidOrderListOver15Min" resultMap="OrderBasicInfoResult">
@@ -881,17 +890,17 @@
</select>
<update id="updateOrderStatusById">
update order_basic_info set order_status = #{orderStatus,jdbcType=VARCHAR}
update order_basic_info
set order_status = #{orderStatus,jdbcType=VARCHAR}
where del_flag = '0'
and id in
<foreach collection="orderIds" item="orderId" open="(" separator="," close=")" >
<foreach collection="orderIds" item="orderId" open="(" separator="," close=")">
#{orderId,jdbcType=VARCHAR}
</foreach>
</update>
<select id="selectOrderInfoByOrderCode" resultType="com.jsowell.pile.vo.uniapp.SendMessageVO">
SELECT
t1.order_code as orderCode,
SELECT t1.order_code as orderCode,
t1.pile_sn as pileSn,
t1.connector_code as connectorCode,
t1.charge_start_time as chargeStartTime,
@@ -902,8 +911,7 @@
t3.total_order_amount as orderAmount,
t3.total_used_electricity as chargingDegree,
t4.open_id as openId
FROM
order_basic_info t1
FROM order_basic_info t1
JOIN pile_station_info t2 ON t1.station_id = t2.id
join order_detail t3 on t1.order_code = t3.order_code
join member_basic_info t4 on t1.member_id = t4.member_id
@@ -933,18 +941,15 @@
<select id="getAccumulativeInfo" resultType="com.jsowell.pile.vo.uniapp.PersonPileConnectorSumInfoVO">
SELECT
t1.member_id as memberId,
SELECT t1.member_id as memberId,
t1.pile_connector_code as pileConnectorCode,
t1.pile_sn as pileSn,
t1.charge_start_time as chargeStartTime,
t1.charge_end_time as chargeEndTime,
t2.total_used_electricity as sumChargingDegree
FROM
order_basic_info t1
FROM order_basic_info t1
JOIN order_detail t2 ON t1.order_code = t2.order_code
WHERE
t1.pile_connector_code = #{pileConnectorCode,jdbcType=VARCHAR}
WHERE t1.pile_connector_code = #{pileConnectorCode,jdbcType=VARCHAR}
AND t1.member_id = #{memberId,jdbcType=VARCHAR}
AND t1.create_time <![CDATA[ >= ]]> #{startTime,jdbcType=VARCHAR}
AND t1.create_time <![CDATA[ <= ]]> #{endTime,jdbcType=VARCHAR}
@@ -964,8 +969,7 @@
</select>
<select id="getListByOrderCodes" resultType="com.jsowell.pile.vo.uniapp.OrderVO">
SELECT
t1.order_code as orderCode,
SELECT t1.order_code as orderCode,
t1.order_status as orderStatus,
t1.reason,
t1.station_id,
@@ -991,21 +995,17 @@
</select>
<select id="getAccumulativeInfoForLianLian" resultType="com.jsowell.pile.vo.lianlian.AccumulativeInfoVO">
SELECT
t1.order_code as orderCode,
SELECT t1.order_code as orderCode,
t1.pile_connector_code as pileConnectorCode,
t1.pile_sn as pileSn,
t1.station_id as stationId,
IFNULL(t2.total_used_electricity,0.00) as connectorElectricity
FROM
order_basic_info t1
IFNULL(t2.total_used_electricity, 0.00) as connectorElectricity
FROM order_basic_info t1
JOIN order_detail t2 ON t1.order_code = t2.order_code
WHERE
t1.del_flag = '0'
WHERE t1.del_flag = '0'
AND t1.station_id = #{stationID,jdbcType=VARCHAR}
AND t1.create_time <![CDATA[ >= ]]> #{startTime,jdbcType=VARCHAR}
AND t1.create_time <![CDATA[ <= ]]> #{endTime,jdbcType=VARCHAR}
</select>
<select id="queryElecAmountNullList" resultMap="OrderDetailResult">
@@ -1023,22 +1023,22 @@
<trim prefix="set" suffixOverrides=",">
<trim prefix="total_electricity_amount =case" suffix="end,">
<foreach collection="list" item="item" index="index">
<if test="item.totalElectricityAmount!=null">
when id=#{item.id} then #{item.totalElectricityAmount}
<if test="item.totalElectricityAmount != null">
when id = #{item.id} then #{item.totalElectricityAmount}
</if>
</foreach>
</trim>
<trim prefix="total_service_amount =case" suffix="end,">
<foreach collection="list" item="item" index="index">
<if test="item.totalServiceAmount!=null">
when id=#{item.id} then #{item.totalServiceAmount}
<if test="item.totalServiceAmount != null">
when id = #{item.id} then #{item.totalServiceAmount}
</if>
</foreach>
</trim>
</trim>
where
<foreach collection="list" separator="or" item="i" index="index" >
id=#{i.id}
<foreach collection="list" separator="or" item="i" index="index">
id = #{i.id}
</foreach>
</update>
@@ -1063,8 +1063,7 @@
</select>
<select id="getMerchantOrderInfoList" resultType="com.jsowell.pile.vo.base.MerchantOrderInfoVO">
select
t1.order_code as orderCode,
select t1.order_code as orderCode,
t1.transaction_code as transactionCode,
t1.order_status as orderStatus,
t1.station_id as stationId,
@@ -1073,29 +1072,26 @@
t1.settlement_time as orderSettleTime
from order_basic_info t1
left join pile_station_info t2 on t1.station_id = t2.id
where
t1.del_flag = '0'
where t1.del_flag = '0'
and t1.merchant_id = #{dto.merchantId,jdbcType=VARCHAR}
<if test="dto.startTime != null" >
<if test="dto.startTime != null">
and t1.create_time <![CDATA[ >= ]]> #{dto.startTime,jdbcType=VARCHAR}
</if>
<if test="dto.endTime != null" >
<if test="dto.endTime != null">
and t1.settlement_time <![CDATA[ <= ]]> #{dto.endTime,jdbcType=VARCHAR}
</if>
order by t1.create_time desc
</select>
<select id="batchRefundQuery" resultType="com.jsowell.pile.vo.web.RefundOrder">
SELECT
t1.order_code as orderCode,
SELECT t1.order_code as orderCode,
t1.`order_status` as orderStatus,
t1.station_id as stationId,
t2.station_name AS stationName,
t1.pay_amount AS payAmount,
t1.order_amount AS orderAmount,
t1.refund_amount AS refundAmount
FROM
order_basic_info t1
FROM order_basic_info t1
JOIN pile_station_info t2 ON t1.station_id = t2.id
WHERE
t1.order_code IN
@@ -1114,4 +1110,38 @@
#{item,jdbcType=VARCHAR}
</foreach>
</select>
<select id="getIndexOrderInfoV2" resultType="com.jsowell.pile.vo.web.IndexOrderInfoVO">
SELECT trade_date AS date,
order_codes as orderCodes,
use_electricity AS totalElectricity,
total_amount as totalOrderAmount
from settle_order_report
where date(trade_date) >= DATE_SUB(CURDATE(), INTERVAL 30 day)
<if test="dto.stationId != null and dto.stationId != ''">
and station_id = #{dto.stationId,jdbcType=VARCHAR}
</if>
<if test="dto.stationIdList != null and dto.stationIdList.size() != 0">
and station_id in
<foreach collection="dto.stationIdList" item="item" open="(" separator="," close=")">
#{item,jdbcType=VARCHAR}
</foreach>
</if>
group by trade_date
</select>
<select id="getIndexOrderDetail" resultType="com.jsowell.pile.vo.web.IndexOrderInfoVO">
select
sum(sharp_used_electricity) AS totalSharpUsedElectricity,
sum(peak_used_electricity) AS totalPeakUsedElectricity,
sum(flat_used_electricity) AS totalFlatUsedElectricity,
sum(valley_used_electricity) AS totalValleyUsedElectricity
from order_detail
<if test="list != null and list.size() != 0">
where order_code in
<foreach collection="list" item="orderCode" open="(" separator="," close=")">
#{orderCode,jdbcType=VARCHAR}
</foreach>
</if>
</select>
</mapper>