Commit 2feb3817 by 吕明尚

优化订单查询接口

parent 8187d59e
......@@ -43,7 +43,10 @@ public class SOrderController extends BaseController
@GetMapping("/list")
public TableDataInfoVo list(SOrder sOrder)
{
return sOrderService.pageList(sOrder);
startPage();
List<SOrder> list = sOrderService.selectSOrderList(sOrder);
TableDataInfo dataTable = getDataTable(list);
return sOrderService.pageList(dataTable, sOrder);
}
@GetMapping("/queryList")
......
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<!-- 日志存放路径 -->
<property name="log.path" value=" /Users/liwenjun/logs/share" />
<property name="log.path" value="/var/gxpt/logs/admin"/>
<!-- 日志输出格式 -->
<property name="log.pattern" value="%d{HH:mm:ss.SSS} [%thread] %-5level %logger{20} - [%method,%line] - %msg%n" />
......@@ -27,7 +27,7 @@
</encoder>
<filter class="ch.qos.logback.classic.filter.LevelFilter">
<!-- 过滤的级别 -->
<level>INFO</level>
<level>DEBUG</level>
<!-- 匹配时的操作:接收(记录) -->
<onMatch>ACCEPT</onMatch>
<!-- 不匹配时的操作:拒绝(不记录) -->
......
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<!-- 日志存放路径 -->
<property name="log.path" value="/home/gxpt/logs" />
<property name="log.path" value="/var/gxpt/logs/front"/>
<!-- 日志输出格式 -->
<property name="log.pattern" value="%d{HH:mm:ss.SSS} [%thread] %-5level %logger{20} - [%method,%line] - %msg%n" />
......@@ -27,7 +27,7 @@
</encoder>
<filter class="ch.qos.logback.classic.filter.LevelFilter">
<!-- 过滤的级别 -->
<level>INFO</level>
<level>DEBUG</level>
<!-- 匹配时的操作:接收(记录) -->
<onMatch>ACCEPT</onMatch>
<!-- 不匹配时的操作:拒绝(不记录) -->
......
......@@ -73,4 +73,6 @@ public interface SConsumerCouponMapper extends BaseMapper<SConsumerCoupon>
List<SConsumerCoupon> queryList();
int removeByIdList(@Param("couponIds") List<Long> expiredCoupons);
SConsumerCoupon sumPayPrice(@Param("couponIds") List<Long> ids);
}
......@@ -3,6 +3,7 @@ package share.system.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import share.system.domain.SOrder;
import java.util.HashMap;
import java.util.List;
/**
......@@ -70,4 +71,8 @@ public interface SOrderMapper extends BaseMapper<SOrder>
List<SOrder> selectSOrderByMaxTime(SOrder order);
List<SOrder> selectSOrderByStoreIdAndMaxTime(SOrder order);
HashMap<String, Object> sumPrice(SOrder sOrder);
List<Long> couponIds(SOrder sOrder);
}
package share.system.service;
import java.util.List;
import com.baomidou.mybatisplus.extension.service.IService;
import share.system.domain.SPack;
import java.util.List;
/**
* 套餐Service接口
*
......@@ -65,4 +65,6 @@ public interface IPackService extends IService<SPack> {
Long addPack(SPack sPack);
List<SPack> pageList(SPack sPack);
List<SPack> packNameByIds(List<Long> longs);
}
......@@ -89,4 +89,8 @@ public interface ISConsumerCouponService extends IService<SConsumerCoupon>
int removeByIdList(List<Long> expiredCoupons);
SConsumerCoupon selectSConsumerCouponByCode(String code);
SConsumerCoupon sumPayPrice(List<Long> couponIds);
List<SConsumerCoupon> couponNameByIds(List<Long> longs);
}
......@@ -194,7 +194,7 @@ public interface ISOrderService extends IService<SOrder>
int modifyOrder(SOrderDto sOrderDto);
TableDataInfoVo pageList(SOrder sOrder);
TableDataInfoVo pageList(TableDataInfo dataTable, SOrder sOrder);
/**
* 订单退款(人工退款)
......
......@@ -108,4 +108,6 @@ public interface ISRoomService extends IService<SRoom>
List<SRoom> selectByStoreIds(List<Long> storeIds);
List<SRoomVo> convertDoListToVoList(List<SRoom> roomList);
List<SRoom> roomNameByIds(List<Long> longs);
}
......@@ -112,4 +112,6 @@ public interface ISStoreService extends IService<SStore>
int updateStoreConsumers(SStoreConsumerVo storeConsumer);
SConsumerVo queryBySStoreConsumer(SStoreConsumerVo dto);
List<SStore> storeNameByIds(List<Long> longs);
}
package share.system.service.impl;
import java.util.*;
import java.util.Arrays;
import java.util.stream.Collectors;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import share.common.enums.YesNoEnum;
import share.common.exception.base.BaseException;
import share.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import share.system.domain.SConsumer;
import share.system.domain.SOrder;
import share.system.mapper.PackMapper;
import share.system.domain.SPack;
import share.system.mapper.PackMapper;
import share.system.service.IPackService;
import share.system.service.ISOrderService;
import share.system.service.SConsumerService;
import java.util.*;
import java.util.stream.Collectors;
/**
* 套餐Service业务层处理
*
......@@ -158,4 +157,14 @@ public class PackServiceImpl extends ServiceImpl<PackMapper, SPack> implements I
public List<SPack> pageList(SPack sPack) {
return baseMapper.selectPackList(sPack);
}
@Override
public List<SPack> packNameByIds(List<Long> longs) {
LambdaQueryWrapper<SPack> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.select(SPack::getId, SPack::getName);
if (org.apache.commons.collections4.CollectionUtils.isNotEmpty(longs)) {
queryWrapper.in(SPack::getId, longs);
}
return this.list(queryWrapper);
}
}
......@@ -574,6 +574,22 @@ public class SConsumerCouponServiceImpl extends ServiceImpl<SConsumerCouponMappe
return baseMapper.selectOne(new LambdaQueryWrapper<>(SConsumerCoupon.class).eq(SConsumerCoupon::getCouponCode, code));
}
@Override
public SConsumerCoupon sumPayPrice(List<Long> couponIds) {
return baseMapper.sumPayPrice(couponIds);
}
@Override
public List<SConsumerCoupon> couponNameByIds(List<Long> longs) {
LambdaQueryWrapper<SConsumerCoupon> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.select(SConsumerCoupon::getId, SConsumerCoupon::getName, SConsumerCoupon::getCouponPayPrice,
SConsumerCoupon::getPlatformType, SConsumerCoupon::getDealgroupId, SConsumerCoupon::getTiktokSkuId);
if (org.apache.commons.collections4.CollectionUtils.isNotEmpty(longs)) {
queryWrapper.in(SConsumerCoupon::getId, longs);
}
return this.list(queryWrapper);
}
private void extracted(SConsumerCoupon item, BigDecimal bigDecimal, SRoom byId, BigDecimal subtract, SStore sStore) {
//计算价格
BigDecimal multiply = bigDecimal.multiply(byId.getPrice());
......
......@@ -475,4 +475,14 @@ public class SRoomServiceImpl extends ServiceImpl<SRoomMapper, SRoom> implements
return voList;
}
@Override
public List<SRoom> roomNameByIds(List<Long> longs) {
LambdaQueryWrapper<SRoom> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.select(SRoom::getId, SRoom::getName, SRoom::getImages, SRoom::getRoomType);
if (CollectionUtils.isNotEmpty(longs)) {
queryWrapper.in(SRoom::getId, longs);
}
return this.list(queryWrapper);
}
}
......@@ -366,6 +366,16 @@ public class SStoreServiceImpl extends ServiceImpl<SStoreMapper, SStore> impleme
return storeConsumerMapper.queryBySStoreConsumer(dto);
}
@Override
public List<SStore> storeNameByIds(List<Long> ids) {
LambdaQueryWrapper<SStore> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.select(SStore::getId, SStore::getName, SStore::getAddress);
if (CollectionUtils.isNotEmpty(ids)) {
queryWrapper.in(SStore::getId, ids);
}
return this.list(queryWrapper);
}
/**
* 门店DO集合转换VO集合,按距离排序
*
......
......@@ -164,6 +164,14 @@
<select id="queryList" resultType="share.system.domain.SConsumerCoupon">
<include refid="selectSConsumerCouponVo"/>
</select>
<select id="sumPayPrice" resultType="share.system.domain.SConsumerCoupon">
select sum(ifnull(coupon_pay_price,0)) AS couponPayPrice
from s_consumer_coupon
where id in
<foreach item="id" collection="couponIds" open="(" separator="," close=")">
#{id}
</foreach>
</select>
<insert id="insertSConsumerCoupon" parameterType="SConsumerCoupon" useGeneratedKeys="true" keyProperty="id">
insert into s_consumer_coupon
......
......@@ -250,6 +250,136 @@
and create_time >= #{createTime}
group by store_id) t on t.id = s.id
</select>
<select id="sumPrice" resultType="java.util.HashMap">
select sum(ifnull(total_price,0)) as totalPrice,
sum(ifnull(pay_price,0)) as payPrice ,
SUM( CASE WHEN
pay_status=1 AND refund_status = 3
THEN ifnull( pay_price,0) ELSE 0 END
) AS totalRealRefundAmount,
SUM( CASE WHEN
pay_status=1 AND refund_status = 3
THEN ifnull(refund_price,0) ELSE 0 END
) AS refundPrice
from s_order
where pay_status = 1
and is_delete = 0
<if test="orderNo != null and orderNo != ''">and order_no = #{orderNo}</if>
<if test="historicalOrderNo != null and historicalOrderNo != ''">and historical_order_no =
#{historicalOrderNo}
</if>
<if test="outTradeNo != null and outTradeNo != ''">and out_trade_no = #{outTradeNo}</if>
<if test="orderType != null and orderType != ''">and order_type = #{orderType}</if>
<if test="payType != null and payType != ''">and pay_type = #{payType}</if>
<!-- <if test="payStatus != null and payStatus != ''">and pay_status = #{payStatus}</if>-->
<if test="storeId != null and storeId != ''">and store_id = #{storeId}</if>
<if test="roomId != null and roomId != ''">and room_id = #{roomId}</if>
<if test="consumerId != null and consumerId != ''">and consumer_id = #{consumerId}</if>
<if test="consumerName != null and consumerName != ''">and consumer_name = #{consumerName}</if>
<if test="consumerPhone != null and consumerPhone != ''">and consumer_phone = #{consumerPhone}</if>
<if test="packId != null and packId != ''">and pack_id = #{packId}</if>
<if test="packPrice != null and packPrice != ''">and pack_price = #{packPrice}</if>
<if test="couponId != null and couponId != ''">and coupon_id = #{couponId}</if>
<if test="couponPrice != null and couponPrice != ''">and coupon_price = #{couponPrice}</if>
<if test="totalPrice != null and totalPrice != ''">and total_price = #{totalPrice}</if>
<if test="payPrice != null and payPrice != ''">and pay_price = #{payPrice}</if>
<if test="startPayTime != null">
and DATE_FORMAT(pay_time, '%Y-%m-%d') &gt;= DATE_FORMAT(#{startPayTime}, '%Y-%m-%d')
</if>
<if test="endPayTime != null">
and DATE_FORMAT(pay_time, '%Y-%m-%d') &lt;= DATE_FORMAT(#{endPayTime}, '%Y-%m-%d')
</if>
<if test="payTime != null and payTime != ''">and pay_time = #{payTime}</if>
<if test="timeLong != null and timeLong != ''">and time_long = #{timeLong}</if>
<if test="preStartDate != null">
and DATE_FORMAT(pre_start_date, '%Y-%m-%d') &gt;= DATE_FORMAT(#{preStartDate}, '%Y-%m-%d')
</if>
<if test="preEndDate != null">
and DATE_FORMAT(pre_end_date, '%Y-%m-%d') &lt;= DATE_FORMAT(#{preEndDate}, '%Y-%m-%d')
</if>
<if test="startDate != null">
and DATE_FORMAT(create_time, '%Y-%m-%d') &gt;= DATE_FORMAT(#{startDate}, '%Y-%m-%d')
</if>
<if test="endDate != null">
and DATE_FORMAT(create_time, '%Y-%m-%d') &lt;= DATE_FORMAT(#{endDate}, '%Y-%m-%d')
</if>
<if test="status != null and status != '' or status==0">and status = #{status}</if>
<if test="refundStatus != null and refundStatus != ''">and refund_status = #{refundStatus}</if>
<if test="refundReason != null and refundReason != ''">and refund_reason = #{refundReason}</if>
<if test="refundReasonTime != null">and refund_reason_time =
#{refundReasonTime}
</if>
<if test="refundPrice != null and refundPrice != ''">and refund_price = #{refundPrice}</if>
<if test="isDelete != null and isDelete != ''">and is_delete = #{isDelete}</if>
<if test="createBy != null and createBy != ''">and create_by = #{createBy}</if>
<if test="createTime != null and createTime != ''">and create_time = #{createTime}</if>
<if test="updateBy != null and updateBy != ''">and update_by = #{updateBy}</if>
<if test="updateTime != null and updateTime != ''">and update_time = #{updateTime}</if>
<if test="arrivalTime != null and arrivalTime != ''">and arrival_time = #{arrivalTime}</if>
<if test="remark != null and remark != ''">and remark = #{remark}</if>
</select>
<select id="couponIds" resultType="java.lang.Long">
select consumer_id
from s_order
where pay_status = 1
and is_delete = 0
<if test="orderNo != null and orderNo != ''">and order_no = #{orderNo}</if>
<if test="historicalOrderNo != null and historicalOrderNo != ''">and historical_order_no =
#{historicalOrderNo}
</if>
<if test="outTradeNo != null and outTradeNo != ''">and out_trade_no = #{outTradeNo}</if>
<if test="orderType != null and orderType != ''">and order_type = #{orderType}</if>
<if test="payType != null and payType != ''">and pay_type = #{payType}</if>
<!-- <if test="payStatus != null and payStatus != ''">and pay_status = #{payStatus}</if>-->
<if test="storeId != null and storeId != ''">and store_id = #{storeId}</if>
<if test="roomId != null and roomId != ''">and room_id = #{roomId}</if>
<if test="consumerId != null and consumerId != ''">and consumer_id = #{consumerId}</if>
<if test="consumerName != null and consumerName != ''">and consumer_name = #{consumerName}</if>
<if test="consumerPhone != null and consumerPhone != ''">and consumer_phone = #{consumerPhone}</if>
<if test="packId != null and packId != ''">and pack_id = #{packId}</if>
<if test="packPrice != null and packPrice != ''">and pack_price = #{packPrice}</if>
<if test="couponId != null and couponId != ''">and coupon_id = #{couponId}</if>
<if test="couponPrice != null and couponPrice != ''">and coupon_price = #{couponPrice}</if>
<if test="totalPrice != null and totalPrice != ''">and total_price = #{totalPrice}</if>
<if test="payPrice != null and payPrice != ''">and pay_price = #{payPrice}</if>
<if test="startPayTime != null">
and DATE_FORMAT(pay_time, '%Y-%m-%d') &gt;= DATE_FORMAT(#{startPayTime}, '%Y-%m-%d')
</if>
<if test="endPayTime != null">
and DATE_FORMAT(pay_time, '%Y-%m-%d') &lt;= DATE_FORMAT(#{endPayTime}, '%Y-%m-%d')
</if>
<if test="payTime != null and payTime != ''">and pay_time = #{payTime}</if>
<if test="timeLong != null and timeLong != ''">and time_long = #{timeLong}</if>
<if test="preStartDate != null">
and DATE_FORMAT(pre_start_date, '%Y-%m-%d') &gt;= DATE_FORMAT(#{preStartDate}, '%Y-%m-%d')
</if>
<if test="preEndDate != null">
and DATE_FORMAT(pre_end_date, '%Y-%m-%d') &lt;= DATE_FORMAT(#{preEndDate}, '%Y-%m-%d')
</if>
<if test="startDate != null">
and DATE_FORMAT(create_time, '%Y-%m-%d') &gt;= DATE_FORMAT(#{startDate}, '%Y-%m-%d')
</if>
<if test="endDate != null">
and DATE_FORMAT(create_time, '%Y-%m-%d') &lt;= DATE_FORMAT(#{endDate}, '%Y-%m-%d')
</if>
<if test="status != null and status != '' or status==0">and status = #{status}</if>
<if test="refundStatus != null and refundStatus != ''">and refund_status = #{refundStatus}</if>
<if test="refundReason != null and refundReason != ''">and refund_reason = #{refundReason}</if>
<if test="refundReasonTime != null">and refund_reason_time =
#{refundReasonTime}
</if>
<if test="refundPrice != null and refundPrice != ''">and refund_price = #{refundPrice}</if>
<if test="isDelete != null and isDelete != ''">and is_delete = #{isDelete}</if>
<if test="createBy != null and createBy != ''">and create_by = #{createBy}</if>
<if test="createTime != null and createTime != ''">and create_time = #{createTime}</if>
<if test="updateBy != null and updateBy != ''">and update_by = #{updateBy}</if>
<if test="updateTime != null and updateTime != ''">and update_time = #{updateTime}</if>
<if test="arrivalTime != null and arrivalTime != ''">and arrival_time = #{arrivalTime}</if>
<if test="remark != null and remark != ''">and remark = #{remark}</if>
</select>
<insert id="insertSOrder" parameterType="SOrder" useGeneratedKeys="true" keyProperty="id">
insert into s_order
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment