Commit 04d634bc by 吕明尚

修改优惠卷作废,下单提示

parent 7c596eca
...@@ -46,9 +46,7 @@ public class SOrderController extends BaseController ...@@ -46,9 +46,7 @@ public class SOrderController extends BaseController
@GetMapping("/queryList") @GetMapping("/queryList")
public TableDataInfo queryOrderList(SOrder sOrder) { public TableDataInfo queryOrderList(SOrder sOrder) {
startPage(); return sOrderService.queryOrderList(sOrder);
List<SOrder> list = sOrderService.queryOrderList(sOrder);
return getDataTable(list);
} }
/** /**
......
package share.system.service; package share.system.service;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import share.common.core.page.TableDataInfo;
import share.common.vo.TableDataInfoVo; import share.common.vo.TableDataInfoVo;
import share.system.domain.SConsumerCoupon; import share.system.domain.SConsumerCoupon;
import share.system.domain.SOrder; import share.system.domain.SOrder;
...@@ -202,7 +203,7 @@ public interface ISOrderService extends IService<SOrder> ...@@ -202,7 +203,7 @@ public interface ISOrderService extends IService<SOrder>
*/ */
int refundOp(AdminRefundRequest request); int refundOp(AdminRefundRequest request);
List<SOrder> queryOrderList(SOrder sOrder); TableDataInfo queryOrderList(SOrder sOrder);
List<SRoomVo> changeRoomList(Long id); List<SRoomVo> changeRoomList(Long id);
......
...@@ -22,6 +22,7 @@ import org.springframework.transaction.annotation.Transactional; ...@@ -22,6 +22,7 @@ import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.ObjectUtils; import org.springframework.util.ObjectUtils;
import share.common.constant.Constants; import share.common.constant.Constants;
import share.common.core.page.PageDomain; import share.common.core.page.PageDomain;
import share.common.core.page.TableDataInfo;
import share.common.core.page.TableSupport; import share.common.core.page.TableSupport;
import share.common.core.redis.RedisUtil; import share.common.core.redis.RedisUtil;
import share.common.enums.*; import share.common.enums.*;
...@@ -492,8 +493,27 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme ...@@ -492,8 +493,27 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
} }
@Override @Override
public List<SOrder> queryOrderList(SOrder sOrder) { public TableDataInfo queryOrderList(SOrder sOrder) {
return baseMapper.queryList(sOrder.getRoomId()); List<SOrder> sOrderList = baseMapper.queryList(sOrder.getRoomId());
List<SOrderVo> sOrderVos = convertDosToVos(sOrderList);
List<SStore> list = storeService.list();
List<SRoom> list1 = roomService.list();
sOrderVos.stream().forEach(vo -> {
vo.setRoomName(list1.stream().filter(room -> room.getId().equals(vo.getRoomId())).findFirst().get().getName());
vo.setStoreName(list.stream().filter(store -> store.getId().equals(vo.getStoreId())).findFirst().get().getName());
});
PageDomain pageDomain = TableSupport.buildPageRequest();
Integer pageNum = pageDomain.getPageNum();
Integer pageSize = pageDomain.getPageSize();
int start = (pageNum - 1) * pageSize;
int end = Math.min(start + pageSize, sOrderVos.size());
List<SOrderVo> pagedList = sOrderVos.subList(start, end);
TableDataInfo tableDataInfo = new TableDataInfo();
tableDataInfo.setRows(pagedList);
tableDataInfo.setTotal(sOrderVos.size());
tableDataInfo.setCode(200);
tableDataInfo.setMsg("查询成功");
return tableDataInfo;
} }
@Override @Override
...@@ -944,6 +964,9 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme ...@@ -944,6 +964,9 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
if (ObjectUtil.isNotEmpty(request.getCouponId())) { if (ObjectUtil.isNotEmpty(request.getCouponId())) {
//查询优惠卷金额 //查询优惠卷金额
SConsumerCoupon coupon = consumerCouponService.getById(request.getCouponId()); SConsumerCoupon coupon = consumerCouponService.getById(request.getCouponId());
if (ObjectUtils.isEmpty(coupon)) {
throw new BaseException("优惠券异常,联系客服!");
}
sOrder.setCouponPrice(coupon.getSubPrice()); sOrder.setCouponPrice(coupon.getSubPrice());
} }
sOrder.setPayPrice(request.getPayFee()); sOrder.setPayPrice(request.getPayFee());
......
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