Commit c13666fb by wuwenlong

Merge remote-tracking branch 'origin/main'

# Conflicts:
#	share-admin/src/main/java/share/web/controller/system/SOrderController.java
#	share-system/src/main/java/share/system/service/ISOrderService.java
parents 580a17ec 1014745e
...@@ -4,6 +4,9 @@ import java.util.List; ...@@ -4,6 +4,9 @@ import java.util.List;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
...@@ -44,6 +47,17 @@ public class SOrderController extends BaseController ...@@ -44,6 +47,17 @@ public class SOrderController extends BaseController
} }
/** /**
* 查询退款订单列表
*/
@PreAuthorize("@ss.hasPermi('system:order:list')")
@GetMapping("/query")
public TableDataInfo query() {
startPage();
List<SOrder> list = sOrderService.queryList();
return getDataTable(list);
}
/**
* 导出订单列表 * 导出订单列表
*/ */
@PreAuthorize("@ss.hasPermi('system:order:export')") @PreAuthorize("@ss.hasPermi('system:order:export')")
......
...@@ -30,7 +30,7 @@ import share.common.core.page.TableDataInfo; ...@@ -30,7 +30,7 @@ import share.common.core.page.TableDataInfo;
* @date 2023-09-28 * @date 2023-09-28
*/ */
@RestController @RestController
@RequestMapping("/app/cleanRecords") @RequestMapping("/front/cleanRecords")
public class SCleanRecordsController extends BaseController public class SCleanRecordsController extends BaseController
{ {
@Autowired @Autowired
......
package share.quartz.task; package share.quartz.task;
import org.omg.CORBA.ORB;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import org.springframework.util.CollectionUtils;
import share.common.utils.DateUtils;
import share.common.utils.StringUtils; import share.common.utils.StringUtils;
import share.system.domain.SOrder;
import share.system.domain.SRoom;
import share.system.domain.vo.SRoomVo;
import share.system.mapper.SRoomMapper;
import share.system.service.ISOrderService;
import share.system.service.ISRoomService;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
/** /**
* 定时任务调度测试 * 定时任务调度测试
...@@ -11,6 +25,10 @@ import share.common.utils.StringUtils; ...@@ -11,6 +25,10 @@ import share.common.utils.StringUtils;
@Component("ryTask") @Component("ryTask")
public class RyTask public class RyTask
{ {
@Autowired
private ISOrderService orderService;
@Autowired
private SRoomMapper roomMapper;
public void ryMultipleParams(String s, Boolean b, Long l, Double d, Integer i) public void ryMultipleParams(String s, Boolean b, Long l, Double d, Integer i)
{ {
System.out.println(StringUtils.format("执行多参方法: 字符串类型{},布尔类型{},长整型{},浮点型{},整形{}", s, b, l, d, i)); System.out.println(StringUtils.format("执行多参方法: 字符串类型{},布尔类型{},长整型{},浮点型{},整形{}", s, b, l, d, i));
...@@ -25,4 +43,32 @@ public class RyTask ...@@ -25,4 +43,32 @@ public class RyTask
{ {
System.out.println("执行无参方法"); System.out.println("执行无参方法");
} }
//预约订单到期自动更新订单状态,更新房间状态
public void autoToStore() {
//查询所有已支付的订单
SOrder order = new SOrder();
order.setPayStatus(1);
order.setStatus(0);
order.setRefundStatus(0);
List<SOrder> sOrders = orderService.selectSOrderList(order);
if (CollectionUtils.isEmpty(sOrders)) {
return;
}
sOrders.forEach(item -> {
//判断预约开始时间是否已到期
if ((Math.abs(item.getPreStartDate().getTime() - new Date().getTime())) / (60 * 1000) == 0) {
//更改订单状态,房间状态,开始时间,结束时间
item.setStatus(1);
item.setUpdateTime(new Date());
item.setStartDate(item.getPreStartDate());
item.setEndDate(item.getPreEndDate());
orderService.updateSOrder(item);
SRoom sRoom = roomMapper.selectById(item.getRoomId());
sRoom.setStatus("2");
sRoom.setUpdateTime(new Date());
roomMapper.updateById(sRoom);
}
});
}
} }
...@@ -108,4 +108,6 @@ public interface ISOrderService extends IService<SOrder> ...@@ -108,4 +108,6 @@ public interface ISOrderService extends IService<SOrder>
* @return * @return
*/ */
boolean refundAudit(OrderRefundRequest request); boolean refundAudit(OrderRefundRequest request);
List<SOrder> queryList();
} }
...@@ -62,7 +62,16 @@ public class SConsumerCouponServiceImpl extends ServiceImpl<SConsumerCouponMappe ...@@ -62,7 +62,16 @@ public class SConsumerCouponServiceImpl extends ServiceImpl<SConsumerCouponMappe
*/ */
@Override @Override
public List<SConsumerCoupon> selectSConsumerCouponList(SConsumerCoupon sConsumerCoupon) { public List<SConsumerCoupon> selectSConsumerCouponList(SConsumerCoupon sConsumerCoupon) {
return sConsumerCouponMapper.selectSConsumerCouponList(sConsumerCoupon); List<SConsumerCoupon> sConsumerCoupons = sConsumerCouponMapper.selectSConsumerCouponList(sConsumerCoupon);
sConsumerCoupons.forEach(item -> {
if (item.getUseStatus().equals(0)) {
if (item.getEndDate().compareTo(new Date()) < 0) {
item.setUseStatus(2);
sConsumerCouponMapper.updateSConsumerCoupon(item);
}
}
});
return sConsumerCoupons;
} }
/** /**
......
...@@ -343,6 +343,14 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper,SOrder> implemen ...@@ -343,6 +343,14 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper,SOrder> implemen
} }
@Override @Override
public List<SOrder> queryList() {
LambdaQueryWrapper<SOrder> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(SOrder::getPayStatus, 1);
queryWrapper.ne(SOrder::getRefundStatus, 0);
return sOrderMapper.selectList(queryWrapper);
}
@Override
public String openDoor(Long id) { public String openDoor(Long id) {
SOrder sOrder = sOrderMapper.selectSOrderById(id); SOrder sOrder = sOrderMapper.selectSOrderById(id);
if (Objects.isNull(sOrder)) { if (Objects.isNull(sOrder)) {
...@@ -358,6 +366,14 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper,SOrder> implemen ...@@ -358,6 +366,14 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper,SOrder> implemen
String password = sRoomVo.getPassword(); String password = sRoomVo.getPassword();
if(true){ if(true){
//TODO 开门成功 //TODO 开门成功
//更改订单状态,房间状态,开始时间,结束时间
sOrder.setStatus(1);
//计算预约开始和结束时间时长
BigDecimal bigDecimal = DateUtils.differentHour(sOrder.getPreStartDate(), sOrder.getPreEndDate());
sOrder.setStartDate(new Date());
//结束时间为开始时间+预约时长
sOrder.setEndDate(DateUtils.addHours(new Date(), bigDecimal.intValue()));
sOrderMapper.updateById(sOrder);
return "开门成功"; return "开门成功";
}else{ }else{
//TODO 开门失败 //TODO 开门失败
......
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