添加定时器,定时生成员工订餐记录

This commit is contained in:
czx 2020-12-10 13:33:17 +08:00
parent 84125a0f72
commit cb8614201d
3 changed files with 18 additions and 0 deletions

View File

@ -2,6 +2,7 @@ package com.ruoyi.quartz.task;
import com.ruoyi.system.fantang.mapper.FtReportMealVoMapper;
import com.ruoyi.system.fantang.service.impl.FtFoodDemandDaoServiceImpl;
import com.ruoyi.system.fantang.service.impl.FtOrderDaoServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@ -19,6 +20,9 @@ public class FtGenerateOrderTask {
@Autowired
private FtReportMealVoMapper ftReportMealVoMapper;
@Autowired
private FtOrderDaoServiceImpl orderDaoService;
public void GenerateOrderTask() {
System.out.println("执行生成一条病患默认订餐配置记录");
foodDemandDaoService.GenerateOrderForNewPatient();
@ -28,4 +32,10 @@ public class FtGenerateOrderTask {
System.out.println("生成次日病患报餐记录");
ftReportMealVoMapper.insertTomorrowReportMeal();
}
// 生成次日员工订餐记录
public void GenerateStaffTomorrowOrder() {
System.out.println("生成次日员工订餐记录");
orderDaoService.GenerateStaffTomorrowOrder();
}
}

View File

@ -2,6 +2,7 @@ package com.ruoyi.system.fantang.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ruoyi.system.fantang.domain.FtOrderDao;
import org.apache.ibatis.annotations.Insert;
/**
* 订单管理Mapper接口
@ -11,4 +12,6 @@ import com.ruoyi.system.fantang.domain.FtOrderDao;
*/
public interface FtOrderDaoMapper extends BaseMapper<FtOrderDao> {
@Insert("insert into ft_order (order_type, staff_id, order_src, create_at, order_date) select type as order_type, b.staff_id, 1 as order_src, now() as create_at, date_add(now(), interval 1 day) as order_date from ft_staff_demand b where b.demand_mode = 1")
void GenerateStaffTomorrowOrder();
}

View File

@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.system.fantang.domain.FtOrderDao;
import com.ruoyi.system.fantang.mapper.FtOrderDaoMapper;
import com.ruoyi.system.fantang.service.IFtOrderDaoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
@ -15,4 +16,8 @@ import org.springframework.stereotype.Service;
@Service
public class FtOrderDaoServiceImpl extends ServiceImpl<FtOrderDaoMapper, FtOrderDao> implements IFtOrderDaoService {
public void GenerateStaffTomorrowOrder() {
this.baseMapper.GenerateStaffTomorrowOrder();
}
}