Commit 287d7118 by 吕明尚

增加劵码

parent cba43bb9
......@@ -16,7 +16,9 @@ import share.common.annotation.Log;
import share.common.core.controller.BaseController;
import share.common.core.domain.AjaxResult;
import share.common.enums.BusinessType;
import share.system.domain.SConsumer;
import share.system.domain.SConsumptionRecords;
import share.system.domain.vo.FrontTokenComponent;
import share.system.service.ISConsumptionRecordsService;
import share.common.utils.poi.ExcelUtil;
import share.common.core.page.TableDataInfo;
......@@ -41,59 +43,10 @@ public class SConsumptionRecordsController extends BaseController
@GetMapping("/list")
public TableDataInfo list(SConsumptionRecords sConsumptionRecords)
{
SConsumer user = FrontTokenComponent.getWxSConsumerEntry();
sConsumptionRecords.setConsumerId(user.getId());
startPage();
List<SConsumptionRecords> list = sConsumptionRecordsService.selectSConsumptionRecordsList(sConsumptionRecords);
return getDataTable(list);
}
/**
* 导出消费记录列表
*/
//@Log(title = "消费记录", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, SConsumptionRecords sConsumptionRecords)
{
List<SConsumptionRecords> list = sConsumptionRecordsService.selectSConsumptionRecordsList(sConsumptionRecords);
ExcelUtil<SConsumptionRecords> util = new ExcelUtil<SConsumptionRecords>(SConsumptionRecords.class);
util.exportExcel(response, list, "消费记录数据");
}
/**
* 获取消费记录详细信息
*/
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return success(sConsumptionRecordsService.selectSConsumptionRecordsById(id));
}
/**
* 新增消费记录
*/
//@Log(title = "消费记录", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody SConsumptionRecords sConsumptionRecords)
{
return toAjax(sConsumptionRecordsService.insertSConsumptionRecords(sConsumptionRecords));
}
/**
* 修改消费记录
*/
//@Log(title = "消费记录", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody SConsumptionRecords sConsumptionRecords)
{
return toAjax(sConsumptionRecordsService.updateSConsumptionRecords(sConsumptionRecords));
}
/**
* 删除消费记录
*/
//@Log(title = "消费记录", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{
return toAjax(sConsumptionRecordsService.deleteSConsumptionRecordsByIds(ids));
}
}
......@@ -57,13 +57,7 @@ public class SRoomController extends BaseController {
@ApiOperation(value = "房间详情")
@RequestMapping(value = "/info", method = RequestMethod.GET)
public R<SRoomVo> getInfo(@RequestParam("id") Long id) {
SRoom room = sRoomService.queryById(id);
SRoomVo vo = null;
if (Objects.nonNull(room)) {
vo = new SRoomVo();
BeanUtils.copyProperties(room, vo);
}
return R.ok(vo);
return R.ok(sRoomService.queryById(id));
}
......
......@@ -89,7 +89,7 @@ public interface ISRoomService extends IService<SRoom>
List<SPack> getPackByRoomId(Long id);
SRoom queryById(Long id);
SRoomVo queryById(Long id);
int addRoomDevice(Long roomId, String[] devIds);
......
......@@ -132,7 +132,7 @@ public class RoomStatusServiceImpl implements RoomStatusService {
if(Objects.isNull(user)||Objects.isNull(user.getId())||order.getConsumerId().compareTo(user.getId())!=0){
orderEndDate = DateUtils.addMinutes(orderEndDate,Constants.ROOM_LOCK_DELAY_MINUTE);
}
if(timeHourDate.compareTo(orderStartDate)==1&&timeHourDate.compareTo(orderEndDate)==0){
if (timeHourDate.compareTo(orderStartDate) > 0 && timeHourDate.compareTo(orderEndDate) < 0) {
vo.setStatus(RoomStatusEnum.HOLD.getValue());
//判断订单开始时间是否是同一个小时,如果是同一个小时,占用结束时间为订单开始时间
if(StringUtils.equals(DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH,timeHourDate)
......
......@@ -206,12 +206,14 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
LambdaQueryWrapper<SOrder> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(SOrder::getStoreId, storeId);
queryWrapper.eq(SOrder::getRoomId, roomId);
queryWrapper.notIn(SOrder::getRefundStatus, RefundStatusEnum.getNotRefundStatus());
queryWrapper.in(SOrder::getRefundStatus, RefundStatusEnum.getNotRefundStatus());
String nowDayStr = DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD, day);
String nextDayStr = DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD, DateUtils.addDays(day, 1));
queryWrapper.apply("(DATE_FORMAT(IFNULL(start_date,pre_start_date), '%Y-%m-%d') = '" + nowDayStr + "' " +
" OR DATE_FORMAT(IFNULL(start_date,pre_start_date), '%Y-%m-%d') = '" + nextDayStr + "')");
queryWrapper.last("ORDER BY IFNULL(start_date,pre_start_date) ");
queryWrapper.apply("(DATE_FORMAT(IFNULL(start_date,pre_start_date), '%Y-%m-%d') = '" + nowDayStr + "'" +
" OR DATE_FORMAT(IFNULL(end_date,pre_end_date), '%Y-%m-%d') = '" + nowDayStr + "' " +
" OR DATE_FORMAT(IFNULL(start_date,pre_start_date), '%Y-%m-%d') = '" + nextDayStr + "'" +
"OR DATE_FORMAT(IFNULL(end_date,pre_end_date), '%Y-%m-%d') = '" + nextDayStr + "')");
queryWrapper.last("ORDER BY IFNULL(pre_start_date,pre_end_date) ");
return list(queryWrapper);
}
......@@ -250,6 +252,12 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
consumerCoupon.setUseStatus(UserStatusEnum.USED.getCode());
consumerCouponService.updateById(consumerCoupon);
}
SConsumptionRecords sConsumptionRecords = new SConsumptionRecords();
sConsumptionRecords.setConsumerId(sOrder.getConsumerId());
sConsumptionRecords.setOrderId(sOrder.getId());
sConsumptionRecords.setName(sOrder.getPackName());
sConsumptionRecords.setPrice(sOrder.getPayPrice());
sConsumptionRecordsService.insertSConsumptionRecords(sConsumptionRecords);
}
save(sOrder);
return response;
......@@ -455,7 +463,12 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
public SOrder selectSOrderByOrderNo(String orderNo) {
LambdaQueryWrapper<SOrder> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(SOrder::getOrderNo, orderNo);
return getOne(queryWrapper);
SOrder one = getOne(queryWrapper);
if (ObjectUtil.isNotEmpty(one.getCouponId())) {
SConsumerCoupon consumerCoupon = consumerCouponService.getById(one.getCouponId());
one.setCouponName(consumerCoupon.getName());
}
return one;
}
@Override
......
......@@ -246,11 +246,18 @@ public class SRoomServiceImpl extends ServiceImpl<SRoomMapper, SRoom> implements
}
@Override
public SRoom queryById(Long id) {
public SRoomVo queryById(Long id) {
SRoom room = sRoomMapper.selectById(id);
room.setOpenShopUuid(sStoreService.selectSStoreById(room.getStoreId()).getOpenShopUuid());
SStore sStore = sStoreService.selectSStoreById(room.getStoreId());
room.setOpenShopUuid(sStore.getOpenShopUuid());
room.setPackList(getPackByRoomId(room.getId()));
return room;
SRoomVo vo = null;
if (Objects.nonNull(room)) {
vo = new SRoomVo();
BeanUtils.copyProperties(room, vo);
}
vo.setStoreName(sStore.getName());
return vo;
}
@Override
......
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