Commit 04d634bc by 吕明尚

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

parent 7c596eca
......@@ -46,9 +46,7 @@ public class SOrderController extends BaseController
@GetMapping("/queryList")
public TableDataInfo queryOrderList(SOrder sOrder) {
startPage();
List<SOrder> list = sOrderService.queryOrderList(sOrder);
return getDataTable(list);
return sOrderService.queryOrderList(sOrder);
}
/**
......
package share.system.service;
import com.baomidou.mybatisplus.extension.service.IService;
import share.common.core.page.TableDataInfo;
import share.common.vo.TableDataInfoVo;
import share.system.domain.SConsumerCoupon;
import share.system.domain.SOrder;
......@@ -202,7 +203,7 @@ public interface ISOrderService extends IService<SOrder>
*/
int refundOp(AdminRefundRequest request);
List<SOrder> queryOrderList(SOrder sOrder);
TableDataInfo queryOrderList(SOrder sOrder);
List<SRoomVo> changeRoomList(Long id);
......
......@@ -22,6 +22,7 @@ import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.ObjectUtils;
import share.common.constant.Constants;
import share.common.core.page.PageDomain;
import share.common.core.page.TableDataInfo;
import share.common.core.page.TableSupport;
import share.common.core.redis.RedisUtil;
import share.common.enums.*;
......@@ -492,8 +493,27 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
}
@Override
public List<SOrder> queryOrderList(SOrder sOrder) {
return baseMapper.queryList(sOrder.getRoomId());
public TableDataInfo queryOrderList(SOrder sOrder) {
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
......@@ -944,6 +964,9 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
if (ObjectUtil.isNotEmpty(request.getCouponId())) {
//查询优惠卷金额
SConsumerCoupon coupon = consumerCouponService.getById(request.getCouponId());
if (ObjectUtils.isEmpty(coupon)) {
throw new BaseException("优惠券异常,联系客服!");
}
sOrder.setCouponPrice(coupon.getSubPrice());
}
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