Commit 3925ddc6 by 吕明尚

更改查询订单列表问题

parent 9d34a7ea
...@@ -4,6 +4,7 @@ import io.swagger.annotations.Api; ...@@ -4,6 +4,7 @@ import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.CollectionUtils;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import share.common.core.controller.BaseController; import share.common.core.controller.BaseController;
...@@ -62,6 +63,11 @@ public class SConsumerCouponController extends BaseController { ...@@ -62,6 +63,11 @@ public class SConsumerCouponController extends BaseController {
@ApiOperation(value = "优惠券-查询可用优惠券") @ApiOperation(value = "优惠券-查询可用优惠券")
@PostMapping("/query") @PostMapping("/query")
public R<List<SConsumerCoupon>> query(@RequestBody @Validated CouponRequest couponRequest) { public R<List<SConsumerCoupon>> query(@RequestBody @Validated CouponRequest couponRequest) {
return R.ok(sConsumerCouponService.availableCouponList(couponRequest)); List<SConsumerCoupon> sConsumerCoupons = sConsumerCouponService.availableCouponList(couponRequest);
if (CollectionUtils.isEmpty(sConsumerCoupons)) {
return R.ok(sConsumerCoupons, "暂无可用优惠券");
} else {
return R.ok(sConsumerCoupons);
}
} }
} }
...@@ -13,7 +13,9 @@ import share.common.core.domain.AjaxResult; ...@@ -13,7 +13,9 @@ import share.common.core.domain.AjaxResult;
import share.common.core.domain.R; import share.common.core.domain.R;
import share.common.core.redis.RedisUtil; import share.common.core.redis.RedisUtil;
import share.common.utils.JsonConvertUtil; import share.common.utils.JsonConvertUtil;
import share.system.domain.SConsumer;
import share.system.domain.SOrder; import share.system.domain.SOrder;
import share.system.domain.vo.FrontTokenComponent;
import share.system.domain.vo.SOrderVo; import share.system.domain.vo.SOrderVo;
import share.system.domain.vo.MqttxVo; import share.system.domain.vo.MqttxVo;
import share.system.request.CreateOrderRequest; import share.system.request.CreateOrderRequest;
...@@ -53,7 +55,8 @@ public class SOrderController extends BaseController ...@@ -53,7 +55,8 @@ public class SOrderController extends BaseController
public TableDataInfo list(SOrder sOrder) public TableDataInfo list(SOrder sOrder)
{ {
startPage(); startPage();
sOrder.setConsumerId(getUserId()); SConsumer user = FrontTokenComponent.getWxSConsumerEntry();
sOrder.setConsumerId(user.getId());
List<SOrder> list = sOrderService.selectSOrderList(sOrder); List<SOrder> list = sOrderService.selectSOrderList(sOrder);
return getDataTable(list); return getDataTable(list);
} }
......
...@@ -134,7 +134,7 @@ public class SConsumerCouponServiceImpl extends ServiceImpl<SConsumerCouponMappe ...@@ -134,7 +134,7 @@ public class SConsumerCouponServiceImpl extends ServiceImpl<SConsumerCouponMappe
//计算时长 //计算时长
BigDecimal bigDecimal = DateUtils.differentHour(couponRequest.getPreStartDate(), couponRequest.getPreEndDate()); BigDecimal bigDecimal = DateUtils.differentHour(couponRequest.getPreStartDate(), couponRequest.getPreEndDate());
if (CollectionUtils.isEmpty(sConsumerCoupons)) { if (CollectionUtils.isEmpty(sConsumerCoupons)) {
throw new RuntimeException("用户没有可用的优惠券"); return sConsumerCoupons;
} }
//迭代 //迭代
sConsumerCoupons.forEach(item -> { sConsumerCoupons.forEach(item -> {
......
...@@ -81,44 +81,42 @@ ...@@ -81,44 +81,42 @@
<select id="selectSOrderList" parameterType="SOrder" resultMap="SOrderResult"> <select id="selectSOrderList" parameterType="SOrder" resultMap="SOrderResult">
<include refid="selectSOrderVo"/> <include refid="selectSOrderVo"/>
<where> where 1=1
1=1 <if test="orderNo != null and orderNo != ''">and order_no = #{orderNo}</if>
<if test="orderNo != null and orderNo != ''">and order_no = #{orderNo},</if> <if test="outTradeNo != null and outTradeNo != ''">and out_trade_no = #{outTradeNo}</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="orderType != null and orderType != ''">and order_type = #{orderType},</if> <if test="payType != null and payType != ''">and pay_type = #{payType}</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="payStatus != null and payStatus != ''">and pay_status = #{payStatus},</if> <if test="storeId != null and storeId != ''">and store_id = #{storeId}</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="roomId != null and roomId != ''">and room_id = #{roomId},</if> <if test="consumerId != null and consumerId != ''">and consumer_id = #{consumerId}</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="consumerName != null and consumerName != ''">and consumer_name = #{consumerName},</if> <if test="consumerPhone != null and consumerPhone != ''">and consumer_phone = #{consumerPhone</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="packId != null and packId != ''">and pack_id = #{packId},</if> <if test="packPrice != null and packPrice != ''">and pack_price = #{packPrice}</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="couponId != null and couponId != ''">and coupon_id = #{couponId},</if> <if test="couponPrice != null and couponPrice != ''">and coupon_price = #{couponPrice}</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="totalPrice != null and totalPrice != ''">and total_price = #{totalPrice},</if> <if test="payPrice != null and payPrice != ''">and pay_price = #{payPrice}</if>
<if test="payPrice != null and payPrice != ''">and pay_price = #{payPrice},</if> <if test="payTime != null and payTime != ''">and pay_time = #{payTime}</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="timeLong != null and timeLong != ''">and time_long = #{timeLong},</if> <if test="preStartDate != null and preStartDate != ''">and pre_start_date = #{preStartDate}</if>
<if test="preStartDate != null and preStartDate != ''">and pre_start_date = #{preStartDate},</if> <if test="preEndDate != null and preEndDate != ''">and pre_end_date = #{preEndDate}</if>
<if test="preEndDate != null and preEndDate != ''">and pre_end_date = #{preEndDate},</if> <if test="startDate != null and startDate != ''">and start_date = #{startDate}</if>
<if test="startDate != null and startDate != ''">and start_date = #{startDate},</if> <if test="endDate != null and endDate != ''">and end_date = #{endDate}</if>
<if test="endDate != null and endDate != ''">and end_date = #{endDate},</if> <if test="status != null and status != ''">and status = #{status}</if>
<if test="status != null and status != ''">and status = #{status},</if> <if test="refundStatus != null and refundStatus != ''">and refund_status = #{refundStatus}</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="refundReason != null and refundReason != ''">and refund_reason = #{refundReason},</if>
<if test="refundReasonTime != null and refundReasonTime != ''">and refund_reason_time = <if test="refundReasonTime != null and refundReasonTime != ''">and refund_reason_time =
#{refundReasonTime}, #{refundReasonTime}
</if> </if>
<if test="refundPrice != null and refundPrice != ''">and refund_price = #{refundPrice},</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="isDelete != null and isDelete != ''">and is_delete = #{isDelete}</if>
<if test="createBy != null and createBy != ''">and create_by = #{createBy},</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="createTime != null and createTime != ''">and create_time = #{createTime}</if>
<if test="updateBy != null and updateBy != ''">and update_by = #{updateBy},</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="updateTime != null and updateTime != ''">and update_time = #{updateTime}</if>
<if test="remark != null and remark != ''">and remark = #{remark},</if> <if test="remark != null and remark != ''">and remark = #{remark}</if>
</where>
</select> </select>
<select id="selectSOrderById" parameterType="Long" resultMap="SOrderResult"> <select id="selectSOrderById" parameterType="Long" resultMap="SOrderResult">
......
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