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

View File

@@ -159,6 +159,13 @@ public interface OrderBasicInfoMapper {
*/ */
List<IndexOrderInfoVO> getIndexOrderInfo(@Param("dto") IndexQueryDTO dto); List<IndexOrderInfoVO> getIndexOrderInfo(@Param("dto") IndexQueryDTO dto);
/**
* 首页订单数据展示 V2
* @param dto 首页信息查询dto
* @return
*/
List<IndexOrderInfoVO> getIndexOrderInfoV2(@Param("dto") IndexQueryDTO dto);
/** /**
* 获取超过15分钟的待支付状态订单 * 获取超过15分钟的待支付状态订单
* @return * @return
@@ -225,4 +232,11 @@ public interface OrderBasicInfoMapper {
* @return * @return
*/ */
List<OrderBasicInfo> queryOrderList(@Param("orderCodeList") List<String> orderCodeList); 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); 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 date;
/**
* 订单号数组
*/
private String orderCodes;
/** /**
* 总用电量 * 总用电量
*/ */

View File

@@ -40,7 +40,8 @@
<result property="delFlag" column="del_flag"/> <result property="delFlag" column="del_flag"/>
</resultMap> </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" <collection property="orderDetailList" notNullColumn="sub_id" javaType="java.util.List"
resultMap="OrderDetailResult"/> resultMap="OrderDetailResult"/>
</resultMap> </resultMap>
@@ -156,49 +157,49 @@
del_flag del_flag
</sql> </sql>
<select id="selectOrderBasicInfoList" parameterType="com.jsowell.pile.dto.QueryOrderDTO" resultType="com.jsowell.pile.vo.web.OrderListVO"> <select id="selectOrderBasicInfoList" parameterType="com.jsowell.pile.dto.QueryOrderDTO"
SELECT resultType="com.jsowell.pile.vo.web.OrderListVO">
t1.id as id, SELECT t1.id as id,
t1.order_code as orderCode, t1.order_code as orderCode,
t1.transaction_code as transactionCode, t1.transaction_code as transactionCode,
t1.order_status as orderStatus, t1.order_status as orderStatus,
t1.member_id as memberId, t1.member_id as memberId,
t2.nick_name as nickName, t2.nick_name as nickName,
t2.mobile_number as mobileNumber, t2.mobile_number as mobileNumber,
t1.station_id as stationId, t1.station_id as stationId,
t3.station_name as stationName, t3.station_name as stationName,
t1.pile_sn as pileSn, t1.pile_sn as pileSn,
t1.connector_code as connectorCode, t1.connector_code as connectorCode,
t1.logic_card as logicCard, t1.logic_card as logicCard,
t1.vin_code as vinCode, t1.vin_code as vinCode,
t1.start_mode as startMode, t1.start_mode as startMode,
t1.pay_mode as payMode, t1.pay_mode as payMode,
t1.pay_status as payStatus, t1.pay_status as payStatus,
t1.pay_amount as payAmount, t1.pay_amount as payAmount,
t1.pay_time as payTime, t1.pay_time as payTime,
t1.order_amount as orderAmount, t1.order_amount as orderAmount,
t1.virtual_amount as virtualAmount, t1.virtual_amount as virtualAmount,
t1.settle_amount as settleAmount, t1.settle_amount as settleAmount,
t1.start_soc as startSoc, t1.start_soc as startSoc,
t1.end_soc as endSoc, t1.end_soc as endSoc,
t1.charge_start_time as chargeStartTime, t1.charge_start_time as chargeStartTime,
t1.charge_end_time as chargeEndTime, t1.charge_end_time as chargeEndTime,
t1.create_time as createTime, t1.create_time as createTime,
t4.total_used_electricity as chargingDegree, t4.total_used_electricity as chargingDegree,
t4.total_electricity_amount as totalElectricityAmount, t4.total_electricity_amount as totalElectricityAmount,
t4.total_service_amount as totalServiceAmount, t4.total_service_amount as totalServiceAmount,
t5.payment_institutions as paymentInstitutions t5.payment_institutions as paymentInstitutions
from order_basic_info t1 from order_basic_info t1
left join member_basic_info t2 on t1.member_id = t2.member_id left join member_basic_info t2 on t1.member_id = t2.member_id
join pile_station_info t3 on t1.station_id = t3.id join pile_station_info t3 on t1.station_id = t3.id
join order_detail t4 on t4.order_code = t1.order_code join order_detail t4 on t4.order_code = t1.order_code
left join member_transaction_record t5 on t5.order_code = t1.order_code and action_type = 'forward' left join member_transaction_record t5 on t5.order_code = t1.order_code and action_type = 'forward'
where t1.del_flag = '0' where t1.del_flag = '0'
<if test="pileSn != null and pileSn != ''"> <if test="pileSn != null and pileSn != ''">
and t1.pile_sn = #{pileSn,jdbcType=VARCHAR} and t1.pile_sn = #{pileSn,jdbcType=VARCHAR}
</if> </if>
<if test="connectorCode != null and connectorCode != ''"> <if test="connectorCode != null and connectorCode != ''">
and t1.connector_code = #{connectorCode,jdbcType=VARCHAR} and t1.connector_code = #{connectorCode,jdbcType=VARCHAR}
</if> </if>
<if test="memberId != null and memberId != ''"> <if test="memberId != null and memberId != ''">
and t1.member_id = #{memberId,jdbcType=VARCHAR} and t1.member_id = #{memberId,jdbcType=VARCHAR}
@@ -234,12 +235,12 @@
and t1.merchant_id = #{merchantId,jdbcType=VARCHAR} and t1.merchant_id = #{merchantId,jdbcType=VARCHAR}
</if> </if>
<!-- 数据范围过滤 --> <!-- 数据范围过滤 -->
<!-- <if test="merchantDeptIds != null and merchantDeptIds.size() != 0">--> <!-- <if test="merchantDeptIds != null and merchantDeptIds.size() != 0">-->
<!-- and t3.dept_id in--> <!-- and t3.dept_id in-->
<!-- <foreach collection="merchantDeptIds" item="merchantDeptId" open="(" separator="," close=")">--> <!-- <foreach collection="merchantDeptIds" item="merchantDeptId" open="(" separator="," close=")">-->
<!-- #{merchantDeptId}--> <!-- #{merchantDeptId}-->
<!-- </foreach>--> <!-- </foreach>-->
<!-- </if>--> <!-- </if>-->
<if test="stationDeptIds != null and stationDeptIds.size() != 0"> <if test="stationDeptIds != null and stationDeptIds.size() != 0">
and t3.dept_id in and t3.dept_id in
<foreach collection="stationDeptIds" item="stationDeptId" open="(" separator="," close=")"> <foreach collection="stationDeptIds" item="stationDeptId" open="(" separator="," close=")">
@@ -297,7 +298,8 @@
where a.id = #{id} where a.id = #{id}
</select> </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 insert into order_basic_info
<trim prefix="(" suffix=")" suffixOverrides=","> <trim prefix="(" suffix=")" suffixOverrides=",">
<if test="orderCode != null"> <if test="orderCode != null">
@@ -629,20 +631,30 @@
</delete> </delete>
<insert id="batchOrderDetail"> <insert id="batchOrderDetail">
insert into order_detail(id, order_code, total_used_electricity, total_order_amount, total_electricity_amount,total_service_amount, insert into order_detail(id, order_code, total_used_electricity, total_order_amount, total_electricity_amount,
sharp_price, sharp_used_electricity, sharp_electricity_price, sharp_service_price, sharp_amount, total_service_amount,
peak_price, peak_used_electricity, peak_electricity_price, peak_service_price, peak_amount, sharp_price, sharp_used_electricity, sharp_electricity_price, sharp_service_price,
flat_price, flat_used_electricity, flat_electricity_price, flat_service_price, flat_amount, sharp_amount,
valley_price, valley_used_electricity, valley_electricity_price, valley_service_price, valley_amount, peak_price, peak_used_electricity, peak_electricity_price, peak_service_price,
create_by,update_by) 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 values
<foreach item="item" index="index" collection="list" separator=","> <foreach item="item" index="index" collection="list" separator=",">
(#{item.id}, #{item.orderCode}, #{item.totalUsedElectricity}, #{item.totalOrderAmount}, #{item.totalElectricityAmount}, #{item.totalServiceAmount}, (#{item.id}, #{item.orderCode}, #{item.totalUsedElectricity}, #{item.totalOrderAmount},
#{item.sharpPrice}, #{item.sharpUsedElectricity}, #{item.sharpElectricityPrice}, #{item.sharpServicePrice}, #{item.sharpAmount}, #{item.totalElectricityAmount}, #{item.totalServiceAmount},
#{item.peakPrice}, #{item.peakUsedElectricity}, #{item.peakElectricityPrice}, #{item.peakServicePrice}, #{item.peakAmount}, #{item.sharpPrice}, #{item.sharpUsedElectricity}, #{item.sharpElectricityPrice}, #{item.sharpServicePrice},
#{item.flatPrice}, #{item.flatUsedElectricity}, #{item.flatElectricityPrice}, #{item.flatServicePrice}, #{item.flatAmount}, #{item.sharpAmount},
#{item.valleyPrice}, #{item.valleyUsedElectricity}, #{item.valleyElectricityPrice}, #{item.valleyServicePrice}, #{item.valleyAmount}, #{item.peakPrice}, #{item.peakUsedElectricity}, #{item.peakElectricityPrice}, #{item.peakServicePrice},
#{item.createBy}, #{item.updateBy}) #{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> </foreach>
</insert> </insert>
@@ -753,7 +765,7 @@
<include refid="Base_Column_List"/> <include refid="Base_Column_List"/>
from order_basic_info from order_basic_info
where del_flag = '0' where del_flag = '0'
and transaction_code = #{transactionCode,jdbcType=VARCHAR} and transaction_code = #{transactionCode,jdbcType=VARCHAR}
</select> </select>
<select id="queryOrderBasicInfo" resultMap="OrderBasicInfoResult"> <select id="queryOrderBasicInfo" resultMap="OrderBasicInfoResult">
@@ -761,9 +773,9 @@
<include refid="Base_Column_List"/> <include refid="Base_Column_List"/>
from order_basic_info from order_basic_info
where del_flag = '0' where del_flag = '0'
and pile_sn = #{pileSn,jdbcType=VARCHAR} and pile_sn = #{pileSn,jdbcType=VARCHAR}
and connector_code = #{connectorCode,jdbcType=VARCHAR} and connector_code = #{connectorCode,jdbcType=VARCHAR}
and order_status = #{orderStatus,jdbcType=VARCHAR} and order_status = #{orderStatus,jdbcType=VARCHAR}
order by create_time DESC order by create_time DESC
limit 1 limit 1
</select> </select>
@@ -773,33 +785,32 @@
<include refid="Detail_Base_Column_List"/> <include refid="Detail_Base_Column_List"/>
from order_detail from order_detail
where del_flag = '0' where del_flag = '0'
and order_code = #{orderCode,jdbcType=VARCHAR} and order_code = #{orderCode,jdbcType=VARCHAR}
</select> </select>
<select id="getListByMemberIdAndOrderStatus" resultType="com.jsowell.pile.vo.uniapp.OrderVO"> <select id="getListByMemberIdAndOrderStatus" resultType="com.jsowell.pile.vo.uniapp.OrderVO">
SELECT SELECT t1.id,
t1.id, t1.order_code as orderCode,
t1.order_code as orderCode, t1.order_status as orderStatus,
t1.order_status as orderStatus, t1.reason,
t1.reason, t1.station_id as stationId,
t1.station_id as stationId, t3.station_name as stationName,
t3.station_name as stationName, t1.pile_sn as pileSn,
t1.pile_sn as pileSn, t1.connector_code as connectorCode,
t1.connector_code as connectorCode, t1.pay_status as payStatus,
t1.pay_status as payStatus, t1.start_mode as startMode,
t1.start_mode as startMode, t1.order_amount as orderAmount,
t1.order_amount as orderAmount, t1.virtual_amount as virtualAmount,
t1.virtual_amount as virtualAmount, t1.settle_amount as settleAmount,
t1.settle_amount as settleAmount, t1.pay_amount as payAmount,
t1.pay_amount as payAmount, t2.total_used_electricity as chargingDegree,
t2.total_used_electricity as chargingDegree, t1.charge_start_time as startTime,
t1.charge_start_time as startTime, t1.charge_end_time as endTime,
t1.charge_end_time as endTime, t2.total_electricity_amount as totalElectricityAmount,
t2.total_electricity_amount as totalElectricityAmount, t2.total_service_amount as totalServiceAmount
t2.total_service_amount as totalServiceAmount
from order_basic_info t1 from order_basic_info t1
join order_detail t2 on t1.order_code = t2.order_code join order_detail t2 on t1.order_code = t2.order_code
join pile_station_info t3 on t1.station_id = t3.id join pile_station_info t3 on t1.station_id = t3.id
where t1.del_flag = '0' where t1.del_flag = '0'
and t1.member_id = #{memberId,jdbcType=VARCHAR} and t1.member_id = #{memberId,jdbcType=VARCHAR}
<if test="stationId != null and stationId != ''"> <if test="stationId != null and stationId != ''">
@@ -818,37 +829,35 @@
</select> </select>
<update id="updateOrderStatusByOrderCode"> <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' where del_flag = '0'
and order_code = #{orderCode,jdbcType=VARCHAR} and order_code = #{orderCode,jdbcType=VARCHAR}
</update> </update>
<select id="getIndexOrderInfo" resultType="com.jsowell.pile.vo.web.IndexOrderInfoVO"> <select id="getIndexOrderInfo" resultType="com.jsowell.pile.vo.web.IndexOrderInfoVO">
SELECT SELECT DATE_FORMAT(t1.create_time, '%Y-%m-%d') as date,
DATE_FORMAT(t1.create_time,'%Y-%m-%d') as date, sum(t2.total_used_electricity) AS totalElectricity,
sum( t2.total_used_electricity ) AS totalElectricity, sum(t2.total_order_amount) AS totalOrderAmount,
sum( t2.total_order_amount ) AS totalOrderAmount, sum(t2.sharp_used_electricity) AS totalSharpUsedElectricity,
sum( t2.sharp_used_electricity ) AS totalSharpUsedElectricity, sum(t2.peak_used_electricity) AS totalPeakUsedElectricity,
sum( t2.peak_used_electricity ) AS totalPeakUsedElectricity, sum(t2.flat_used_electricity) AS totalFlatUsedElectricity,
sum( t2.flat_used_electricity ) AS totalFlatUsedElectricity, sum(t2.valley_used_electricity) AS totalValleyUsedElectricity
sum( t2.valley_used_electricity ) AS totalValleyUsedElectricity FROM order_basic_info t1
FROM JOIN order_detail t2 ON t1.order_code = t2.order_code
order_basic_info t1 AND t1.del_flag = '0'
JOIN order_detail t2 ON t1.order_code = t2.order_code WHERE date(t1.create_time) >= DATE_SUB(CURDATE(), INTERVAL 30 day)
AND t1.del_flag = '0'
WHERE
date(t1.create_time) >= DATE_SUB(CURDATE(),INTERVAL 30 day)
and t1.order_status = '6' and t1.order_status = '6'
<if test="dto.stationId != null and dto.stationId != ''"> <if test="dto.stationId != null and dto.stationId != ''">
and t1.station_id = #{dto.stationId,jdbcType=VARCHAR} and t1.station_id = #{dto.stationId,jdbcType=VARCHAR}
</if> </if>
<if test="dto.stationIdList != null and dto.stationIdList.size() != 0"> <if test="dto.stationIdList != null and dto.stationIdList.size() != 0">
and t1.station_id in and t1.station_id in
<foreach collection="dto.stationIdList" item="item" open="(" separator="," close=")"> <foreach collection="dto.stationIdList" item="item" open="(" separator="," close=")">
#{item,jdbcType=VARCHAR} #{item,jdbcType=VARCHAR}
</foreach> </foreach>
</if> </if>
group by DATE_FORMAT(t1.create_time,'%Y-%m-%d') group by DATE_FORMAT(t1.create_time, '%Y-%m-%d')
</select> </select>
<select id="getUnpaidOrderListOver15Min" resultMap="OrderBasicInfoResult"> <select id="getUnpaidOrderListOver15Min" resultMap="OrderBasicInfoResult">
@@ -856,14 +865,14 @@
<include refid="Base_Column_List"/> <include refid="Base_Column_List"/>
from order_basic_info from order_basic_info
where del_flag = '0' where del_flag = '0'
and order_status = '0' and order_status = '0'
and pay_status = '0' and pay_status = '0'
and create_time <![CDATA[ <= ]]> #{createTime,jdbcType=VARCHAR} and create_time <![CDATA[ <= ]]> #{createTime,jdbcType=VARCHAR}
</select> </select>
<select id="selectOrderListByTimeRangeAndStatus" resultMap="OrderBasicInfoResult"> <select id="selectOrderListByTimeRangeAndStatus" resultMap="OrderBasicInfoResult">
select select
<include refid="Base_Column_List"/> <include refid="Base_Column_List"/>
from order_basic_info from order_basic_info
where del_flag = '0' where del_flag = '0'
<if test="startTime != null and startTime != ''"> <if test="startTime != null and startTime != ''">
@@ -881,32 +890,31 @@
</select> </select>
<update id="updateOrderStatusById"> <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' where del_flag = '0'
and id in and id in
<foreach collection="orderIds" item="orderId" open="(" separator="," close=")" > <foreach collection="orderIds" item="orderId" open="(" separator="," close=")">
#{orderId,jdbcType=VARCHAR} #{orderId,jdbcType=VARCHAR}
</foreach> </foreach>
</update> </update>
<select id="selectOrderInfoByOrderCode" resultType="com.jsowell.pile.vo.uniapp.SendMessageVO"> <select id="selectOrderInfoByOrderCode" resultType="com.jsowell.pile.vo.uniapp.SendMessageVO">
SELECT SELECT t1.order_code as orderCode,
t1.order_code as orderCode, t1.pile_sn as pileSn,
t1.pile_sn as pileSn, t1.connector_code as connectorCode,
t1.connector_code as connectorCode, t1.charge_start_time as chargeStartTime,
t1.charge_start_time as chargeStartTime, t1.charge_end_time as chargeStopTime,
t1.charge_end_time as chargeStopTime, t1.reason as stopReason,
t1.reason as stopReason, t1.station_id as stationId,
t1.station_id as stationId, t2.station_name as stationName,
t2.station_name as stationName, t3.total_order_amount as orderAmount,
t3.total_order_amount as orderAmount, t3.total_used_electricity as chargingDegree,
t3.total_used_electricity as chargingDegree, t4.open_id as openId
t4.open_id as openId FROM order_basic_info t1
FROM JOIN pile_station_info t2 ON t1.station_id = t2.id
order_basic_info t1 join order_detail t3 on t1.order_code = t3.order_code
JOIN pile_station_info t2 ON t1.station_id = t2.id join member_basic_info t4 on t1.member_id = t4.member_id
join order_detail t3 on t1.order_code = t3.order_code
join member_basic_info t4 on t1.member_id = t4.member_id
where t1.order_code = #{orderCode,jdbcType=VARCHAR} where t1.order_code = #{orderCode,jdbcType=VARCHAR}
</select> </select>
@@ -933,23 +941,20 @@
<select id="getAccumulativeInfo" resultType="com.jsowell.pile.vo.uniapp.PersonPileConnectorSumInfoVO"> <select id="getAccumulativeInfo" resultType="com.jsowell.pile.vo.uniapp.PersonPileConnectorSumInfoVO">
SELECT SELECT t1.member_id as memberId,
t1.member_id as memberId, t1.pile_connector_code as pileConnectorCode,
t1.pile_connector_code as pileConnectorCode, t1.pile_sn as pileSn,
t1.pile_sn as pileSn, t1.charge_start_time as chargeStartTime,
t1.charge_start_time as chargeStartTime, t1.charge_end_time as chargeEndTime,
t1.charge_end_time as chargeEndTime, t2.total_used_electricity as sumChargingDegree
t2.total_used_electricity as sumChargingDegree FROM order_basic_info t1
FROM JOIN order_detail t2 ON t1.order_code = t2.order_code
order_basic_info t1 WHERE t1.pile_connector_code = #{pileConnectorCode,jdbcType=VARCHAR}
JOIN order_detail t2 ON t1.order_code = t2.order_code
WHERE
t1.pile_connector_code = #{pileConnectorCode,jdbcType=VARCHAR}
AND t1.member_id = #{memberId,jdbcType=VARCHAR} AND t1.member_id = #{memberId,jdbcType=VARCHAR}
AND t1.create_time <![CDATA[ >= ]]> #{startTime,jdbcType=VARCHAR} AND t1.create_time <![CDATA[ >= ]]> #{startTime,jdbcType=VARCHAR}
AND t1.create_time <![CDATA[ <= ]]> #{endTime,jdbcType=VARCHAR} AND t1.create_time <![CDATA[ <= ]]> #{endTime,jdbcType=VARCHAR}
AND t1.order_status = '6' AND t1.order_status = '6'
AND t1.del_flag = '0' AND t1.del_flag = '0'
</select> </select>
<select id="getAppointmentOrder" resultMap="OrderBasicInfoResult"> <select id="getAppointmentOrder" resultMap="OrderBasicInfoResult">
@@ -957,65 +962,60 @@
<include refid="Base_Column_List"/> <include refid="Base_Column_List"/>
from order_basic_info from order_basic_info
where del_flag = '0' where del_flag = '0'
and pay_status = '1' and pay_status = '1'
and start_type = 'appointment' and start_type = 'appointment'
and order_status = '0' and order_status = '0'
and appointment_time <![CDATA[ <= ]]> #{dateTime,jdbcType=TIMESTAMP} and appointment_time <![CDATA[ <= ]]> #{dateTime,jdbcType=TIMESTAMP}
</select> </select>
<select id="getListByOrderCodes" resultType="com.jsowell.pile.vo.uniapp.OrderVO"> <select id="getListByOrderCodes" resultType="com.jsowell.pile.vo.uniapp.OrderVO">
SELECT SELECT t1.order_code as orderCode,
t1.order_code as orderCode, t1.order_status as orderStatus,
t1.order_status as orderStatus, t1.reason,
t1.reason, t1.station_id,
t1.station_id, t3.station_name as stationName,
t3.station_name as stationName, t1.pile_sn as pileSn,
t1.pile_sn as pileSn, t1.connector_code as connectorCode,
t1.connector_code as connectorCode, t1.pay_status as payStatus,
t1.pay_status as payStatus, t1.order_amount as orderAmount,
t1.order_amount as orderAmount, t1.pay_amount as payAmount,
t1.pay_amount as payAmount, t2.total_used_electricity as chargingDegree,
t2.total_used_electricity as chargingDegree, t1.charge_start_time as startTime,
t1.charge_start_time as startTime, t1.charge_end_time as endTime,
t1.charge_end_time as endTime, t2.total_electricity_amount as totalElectricityAmount,
t2.total_electricity_amount as totalElectricityAmount, t2.total_service_amount as totalServiceAmount
t2.total_service_amount as totalServiceAmount
from order_basic_info t1 from order_basic_info t1
join order_detail t2 on t1.order_code = t2.order_code join order_detail t2 on t1.order_code = t2.order_code
join pile_station_info t3 on t1.station_id = t3.id join pile_station_info t3 on t1.station_id = t3.id
where t1.del_flag = '0' where t1.del_flag = '0'
and t1.order_code in and t1.order_code in
<foreach collection="orderCodes" item="orderCode" open="(" separator="," close=")"> <foreach collection="orderCodes" item="orderCode" open="(" separator="," close=")">
#{orderCode,jdbcType=VARCHAR} #{orderCode,jdbcType=VARCHAR}
</foreach> </foreach>
</select> </select>
<select id="getAccumulativeInfoForLianLian" resultType="com.jsowell.pile.vo.lianlian.AccumulativeInfoVO"> <select id="getAccumulativeInfoForLianLian" resultType="com.jsowell.pile.vo.lianlian.AccumulativeInfoVO">
SELECT SELECT t1.order_code as orderCode,
t1.order_code as orderCode, t1.pile_connector_code as pileConnectorCode,
t1.pile_connector_code as pileConnectorCode, t1.pile_sn as pileSn,
t1.pile_sn as pileSn, t1.station_id as stationId,
t1.station_id as stationId, IFNULL(t2.total_used_electricity, 0.00) as connectorElectricity
IFNULL(t2.total_used_electricity,0.00) as connectorElectricity FROM order_basic_info t1
FROM JOIN order_detail t2 ON t1.order_code = t2.order_code
order_basic_info t1 WHERE t1.del_flag = '0'
JOIN order_detail t2 ON t1.order_code = t2.order_code
WHERE
t1.del_flag = '0'
AND t1.station_id = #{stationID,jdbcType=VARCHAR} AND t1.station_id = #{stationID,jdbcType=VARCHAR}
AND t1.create_time <![CDATA[ >= ]]> #{startTime,jdbcType=VARCHAR} AND t1.create_time <![CDATA[ >= ]]> #{startTime,jdbcType=VARCHAR}
AND t1.create_time <![CDATA[ <= ]]> #{endTime,jdbcType=VARCHAR} AND t1.create_time <![CDATA[ <= ]]> #{endTime,jdbcType=VARCHAR}
</select> </select>
<select id="queryElecAmountNullList" resultMap="OrderDetailResult"> <select id="queryElecAmountNullList" resultMap="OrderDetailResult">
select select
<include refid="Detail_Base_Column_List"/> <include refid="Detail_Base_Column_List"/>
from order_detail from order_detail
where del_flag = '0' where del_flag = '0'
and total_order_amount is not null and total_order_amount is not null
AND total_order_amount > '0.00' AND total_order_amount > '0.00'
and total_electricity_amount is null and total_electricity_amount is null
</select> </select>
<update id="batchUpdateOrderDetail"> <update id="batchUpdateOrderDetail">
@@ -1023,22 +1023,22 @@
<trim prefix="set" suffixOverrides=","> <trim prefix="set" suffixOverrides=",">
<trim prefix="total_electricity_amount =case" suffix="end,"> <trim prefix="total_electricity_amount =case" suffix="end,">
<foreach collection="list" item="item" index="index"> <foreach collection="list" item="item" index="index">
<if test="item.totalElectricityAmount!=null"> <if test="item.totalElectricityAmount != null">
when id=#{item.id} then #{item.totalElectricityAmount} when id = #{item.id} then #{item.totalElectricityAmount}
</if> </if>
</foreach> </foreach>
</trim> </trim>
<trim prefix="total_service_amount =case" suffix="end,"> <trim prefix="total_service_amount =case" suffix="end,">
<foreach collection="list" item="item" index="index"> <foreach collection="list" item="item" index="index">
<if test="item.totalServiceAmount!=null"> <if test="item.totalServiceAmount != null">
when id=#{item.id} then #{item.totalServiceAmount} when id = #{item.id} then #{item.totalServiceAmount}
</if> </if>
</foreach> </foreach>
</trim> </trim>
</trim> </trim>
where where
<foreach collection="list" separator="or" item="i" index="index" > <foreach collection="list" separator="or" item="i" index="index">
id=#{i.id} id = #{i.id}
</foreach> </foreach>
</update> </update>
@@ -1047,56 +1047,52 @@
<include refid="Detail_Base_Column_List"/> <include refid="Detail_Base_Column_List"/>
from order_detail from order_detail
where del_flag = '0' where del_flag = '0'
and order_code in and order_code in
<foreach collection="list" item="item" open="(" separator="," close=")"> <foreach collection="list" item="item" open="(" separator="," close=")">
#{item,jdbcType=VARCHAR} #{item,jdbcType=VARCHAR}
</foreach> </foreach>
</select> </select>
<select id="tempQueryWeChatRefundOrders" resultMap="OrderBasicInfoResult"> <select id="tempQueryWeChatRefundOrders" resultMap="OrderBasicInfoResult">
select select
<include refid="Base_Column_List"/> <include refid="Base_Column_List"/>
from order_basic_info from order_basic_info
where del_flag = '0' where del_flag = '0'
and pay_mode = '4' and pay_mode = '4'
and refund_amount > '0.00' and refund_amount > '0.00'
and create_time BETWEEN #{startTime} and #{endTime} and create_time BETWEEN #{startTime} and #{endTime}
</select> </select>
<select id="getMerchantOrderInfoList" resultType="com.jsowell.pile.vo.base.MerchantOrderInfoVO"> <select id="getMerchantOrderInfoList" resultType="com.jsowell.pile.vo.base.MerchantOrderInfoVO">
select select t1.order_code as orderCode,
t1.order_code as orderCode, t1.transaction_code as transactionCode,
t1.transaction_code as transactionCode, t1.order_status as orderStatus,
t1.order_status as orderStatus, t1.station_id as stationId,
t1.station_id as stationId, t2.station_name as stationName,
t2.station_name as stationName, t1.order_amount as orderAmount,
t1.order_amount as orderAmount, t1.settlement_time as orderSettleTime
t1.settlement_time as orderSettleTime
from order_basic_info t1 from order_basic_info t1
left join pile_station_info t2 on t1.station_id = t2.id left join pile_station_info t2 on t1.station_id = t2.id
where where t1.del_flag = '0'
t1.del_flag = '0' and t1.merchant_id = #{dto.merchantId,jdbcType=VARCHAR}
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} and t1.create_time <![CDATA[ >= ]]> #{dto.startTime,jdbcType=VARCHAR}
</if> </if>
<if test="dto.endTime != null" > <if test="dto.endTime != null">
and t1.settlement_time <![CDATA[ <= ]]> #{dto.endTime,jdbcType=VARCHAR} and t1.settlement_time <![CDATA[ <= ]]> #{dto.endTime,jdbcType=VARCHAR}
</if> </if>
order by t1.create_time desc order by t1.create_time desc
</select> </select>
<select id="batchRefundQuery" resultType="com.jsowell.pile.vo.web.RefundOrder"> <select id="batchRefundQuery" resultType="com.jsowell.pile.vo.web.RefundOrder">
SELECT SELECT t1.order_code as orderCode,
t1.order_code as orderCode, t1.`order_status` as orderStatus,
t1.`order_status` as orderStatus, t1.station_id as stationId,
t1.station_id as stationId, t2.station_name AS stationName,
t2.station_name AS stationName, t1.pay_amount AS payAmount,
t1.pay_amount AS payAmount, t1.order_amount AS orderAmount,
t1.order_amount AS orderAmount, t1.refund_amount AS refundAmount
t1.refund_amount AS refundAmount FROM order_basic_info t1
FROM JOIN pile_station_info t2 ON t1.station_id = t2.id
order_basic_info t1
JOIN pile_station_info t2 ON t1.station_id = t2.id
WHERE WHERE
t1.order_code IN t1.order_code IN
<foreach collection="list" item="itme" open="(" separator="," close=")"> <foreach collection="list" item="itme" open="(" separator="," close=")">
@@ -1106,12 +1102,46 @@
<select id="queryOrderList" resultMap="OrderBasicInfoResult"> <select id="queryOrderList" resultMap="OrderBasicInfoResult">
select select
<include refid="Base_Column_List"/> <include refid="Base_Column_List"/>
from order_basic_info from order_basic_info
where del_flag = '0' where del_flag = '0'
and order_code in and order_code in
<foreach collection="orderCodeList" item="item" open="(" separator="," close=")"> <foreach collection="orderCodeList" item="item" open="(" separator="," close=")">
#{item,jdbcType=VARCHAR} #{item,jdbcType=VARCHAR}
</foreach> </foreach>
</select> </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> </mapper>