Merge remote-tracking branch 'origin/master' into master
This commit is contained in:
commit
ff2e63e3b7
@ -2,6 +2,7 @@ package com.ruoyi.system.fantang.controller;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.system.fantang.service.*;
|
||||
@ -92,7 +93,7 @@ public class ClientController extends BaseController {
|
||||
* param JSONObject staffId: 员工id
|
||||
* return
|
||||
*/
|
||||
@GetMapping("/getAvailableStopOrder")
|
||||
@PostMapping("/getAvailableStopOrder")
|
||||
public AjaxResult getAvailableStopOrder(@RequestBody JSONObject params) {
|
||||
return AjaxResult.success(orderDaoService.getAvailableStopOrder(params.getLong("staffId")));
|
||||
}
|
||||
@ -215,6 +216,16 @@ public class ClientController extends BaseController {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 初始化员工订餐配置文件,并返回初始化后的记录给前端
|
||||
* params: staffId
|
||||
* return
|
||||
*/
|
||||
@PostMapping("/initDemandMode")
|
||||
public AjaxResult initDemandMode(@RequestBody JSONObject params) {
|
||||
return staffDemandDaoService.initDemandMode(params.getLong("staffId"));
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置订餐模式
|
||||
* 日期:2020年12月11日
|
||||
@ -235,18 +246,23 @@ public class ClientController extends BaseController {
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当天菜谱
|
||||
* 返回某天的菜单
|
||||
* param today
|
||||
* return
|
||||
*/
|
||||
@GetMapping("/getTodayMenu")
|
||||
public AjaxResult getTodayMenu(@RequestBody JSONObject params) {
|
||||
@PostMapping("/getMenuOfDay")
|
||||
public AjaxResult getMenuOfDay(@RequestBody JSONObject params) {
|
||||
String[] weekDays = { "周日", "周一", "周二", "周三", "周四", "周五", "周六" };
|
||||
Calendar cal = Calendar.getInstance();
|
||||
cal.setTime(params.getDate("date"));
|
||||
int w = cal.get(Calendar.DAY_OF_WEEK) - 1;
|
||||
if (w < 0)
|
||||
w = 0;
|
||||
return weekMenuDaoService.getTodayMenu(weekDays[w]);
|
||||
return weekMenuDaoService.getMenuOfDay(weekDays[w]);
|
||||
}
|
||||
|
||||
@GetMapping("/StatisGetOrderOfDate")
|
||||
public AjaxResult statisGetOrderOfDate(@RequestParam Date date) {
|
||||
return orderDaoService.statisGetOrderOfDate(date);
|
||||
}
|
||||
}
|
||||
|
@ -141,4 +141,7 @@ public class FtOrderDao implements Serializable {
|
||||
|
||||
// 订用餐日期
|
||||
private Date orderDate;
|
||||
|
||||
@TableField(exist = false)
|
||||
private Integer countOrder;
|
||||
}
|
||||
|
@ -3,7 +3,10 @@ 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;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@ -16,4 +19,7 @@ public interface FtOrderDaoMapper extends BaseMapper<FtOrderDao> {
|
||||
|
||||
@Insert("insert into ft_order (order_type, staff_id, order_src, create_at, order_date, order_list, total_price) select type as order_type, staff_id, 1 as order_src, now() as create_at, date_add(now(), interval 1 day) as order_date, foods, (select sum(price) from ft_food f where FIND_IN_SET(f.food_id,d.foods)) as price from ft_staff_demand d where d.demand_mode = 1")
|
||||
void GenerateStaffTomorrowOrder();
|
||||
|
||||
@Select("select order_type, count(*) as count_order from ft_order where order_date BETWEEN #{start} and #{end} GROUP BY order_type")
|
||||
List<FtOrderDao> statisGetOrderOfDate(@Param("start")String start,@Param("end") String end);
|
||||
}
|
||||
|
@ -1,7 +1,9 @@
|
||||
package com.ruoyi.system.fantang.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.ruoyi.system.fantang.domain.FtStaffDemandDao;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Insert;
|
||||
|
||||
/**
|
||||
* 员工报餐Mapper接口
|
||||
@ -11,4 +13,6 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
*/
|
||||
public interface FtStaffDemandDaoMapper extends BaseMapper<FtStaffDemandDao> {
|
||||
|
||||
@Insert("INSERT into ft_staff_demand (staff_id, type, demand_mode) VALUES (#{staffId}, 1, 0),(#{staffId}, 2, 0),(#{staffId}, 3, 0)")
|
||||
Integer initDemandMode(Long staffId);
|
||||
}
|
||||
|
@ -1,10 +1,12 @@
|
||||
package com.ruoyi.system.fantang.mapper;
|
||||
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.system.fantang.domain.FtWeekMenuDao;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 每周菜单Mapper接口
|
||||
*
|
||||
@ -16,5 +18,5 @@ public interface FtWeekMenuDaoMapper extends BaseMapper<FtWeekMenuDao> {
|
||||
// 非聚合方式转换参考
|
||||
// SELECT a.weekday, a.dinner_type, CONCAT(b.name ) name FROM ft_week_menu a LEFT JOIN ft_food b ON FIND_IN_SET(b.food_id,a.foods) WHERE a.weekday = '周一'
|
||||
@Select("SELECT a.weekday, a.dinner_type, GROUP_CONCAT(b.name ) name FROM ft_week_menu a LEFT JOIN ft_food b ON FIND_IN_SET(b.food_id,a.foods) WHERE a.weekday = #{weekDay} GROUP BY a.dinner_type")
|
||||
AjaxResult getTodayMenu(String weekDay);
|
||||
List<FtWeekMenuDao> getTodayMenu(@Param("weekDay")String weekDay);
|
||||
}
|
||||
|
@ -29,4 +29,6 @@ public interface IFtOrderDaoService extends IService<FtOrderDao> {
|
||||
AjaxResult getAvailableStopOrder(Long staffId);
|
||||
|
||||
AjaxResult cancelStopOrder(Long orderId);
|
||||
|
||||
AjaxResult statisGetOrderOfDate(Date date);
|
||||
}
|
||||
|
@ -15,4 +15,6 @@ public interface IFtStaffDemandDaoService extends IService<FtStaffDemandDao> {
|
||||
AjaxResult getConfiguration(Long staffId);
|
||||
|
||||
AjaxResult setDemandMode(Long id, Integer type, Boolean demandModeFlag);
|
||||
|
||||
AjaxResult initDemandMode(Long staffId);
|
||||
}
|
||||
|
@ -12,5 +12,5 @@ import com.baomidou.mybatisplus.extension.service.IService;
|
||||
*/
|
||||
public interface IFtWeekMenuDaoService extends IService<FtWeekMenuDao> {
|
||||
|
||||
AjaxResult getTodayMenu(String weekDay);
|
||||
AjaxResult getMenuOfDay(String weekDay);
|
||||
}
|
||||
|
@ -63,6 +63,7 @@ public class FtOrderDaoServiceImpl extends ServiceImpl<FtOrderDaoMapper, FtOrder
|
||||
public AjaxResult getAvailableOrder(Integer staffId) {
|
||||
QueryWrapper<FtOrderDao> wrapper = new QueryWrapper<>();
|
||||
wrapper.eq("staff_id", staffId);
|
||||
wrapper.ge("order_date", DateUtil.beginOfDay(new Date()));
|
||||
List<FtOrderDao> daos = this.baseMapper.selectList(wrapper);
|
||||
return AjaxResult.success(daos);
|
||||
}
|
||||
@ -105,4 +106,9 @@ public class FtOrderDaoServiceImpl extends ServiceImpl<FtOrderDaoMapper, FtOrder
|
||||
public AjaxResult cancelStopOrder(Long orderId) {
|
||||
return AjaxResult.success(staffStopMealsDaoMapper.deleteById(orderId));
|
||||
}
|
||||
|
||||
@Override
|
||||
public AjaxResult statisGetOrderOfDate(Date date) {
|
||||
return AjaxResult.success(this.baseMapper.statisGetOrderOfDate(DateUtil.beginOfDay(date).toString(), DateUtil.endOfDay(date).toString()));
|
||||
}
|
||||
}
|
||||
|
@ -8,7 +8,9 @@ import com.ruoyi.system.fantang.mapper.FtStaffDemandDaoMapper;
|
||||
import com.ruoyi.system.fantang.domain.FtStaffDemandDao;
|
||||
import com.ruoyi.system.fantang.service.IFtStaffDemandDaoService;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 员工报餐Service业务层处理
|
||||
@ -42,4 +44,19 @@ public class FtStaffDemandDaoServiceImpl extends ServiceImpl<FtStaffDemandDaoMap
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
@Override
|
||||
public AjaxResult initDemandMode(Long staffId) {
|
||||
// 先删除该员工的配置信息
|
||||
HashMap<String, Object> map = new HashMap<>();
|
||||
map.put("staff_id", staffId);
|
||||
int ret = this.baseMapper.deleteByMap(map);
|
||||
// 初始化三条订餐配置信息
|
||||
this.baseMapper.initDemandMode(staffId);
|
||||
|
||||
// 重新检索返回给前端
|
||||
QueryWrapper<FtStaffDemandDao> wrapper = new QueryWrapper<>();
|
||||
wrapper.eq("staff_id", staffId);
|
||||
return AjaxResult.success(this.baseMapper.selectList(wrapper));
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -28,16 +28,22 @@ public class FtStaffInfoDaoServiceImpl extends ServiceImpl<FtStaffInfoDaoMapper,
|
||||
|
||||
@Override
|
||||
public AjaxResult login(String tel, String password) {
|
||||
QueryWrapper<FtStaffInfoDao> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("tel", tel);
|
||||
queryWrapper.eq("password", password);
|
||||
FtStaffInfoDao dao = this.baseMapper.selectOne(queryWrapper);
|
||||
if (dao == null)
|
||||
return AjaxResult.error(-1, "查无记录");
|
||||
dao.setLoginFlag(true);
|
||||
dao.setToken(IdUtils.fastUUID());
|
||||
this.baseMapper.updateById(dao);
|
||||
return AjaxResult.success(dao);
|
||||
// 查询是否有该员工
|
||||
QueryWrapper<FtStaffInfoDao> wrapper = new QueryWrapper<>();
|
||||
wrapper.eq("tel", tel);
|
||||
FtStaffInfoDao dao = this.baseMapper.selectOne(wrapper);
|
||||
if (dao == null) {
|
||||
return AjaxResult.error(-2, "无该员工信息");
|
||||
} else {
|
||||
wrapper.eq("password", password);
|
||||
dao = this.baseMapper.selectOne(wrapper);
|
||||
if (dao == null)
|
||||
return AjaxResult.error(-1, "密码错误");
|
||||
dao.setLoginFlag(true);
|
||||
dao.setToken(IdUtils.fastUUID());
|
||||
this.baseMapper.updateById(dao);
|
||||
return AjaxResult.success(dao);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -17,7 +17,7 @@ import com.ruoyi.system.fantang.service.IFtWeekMenuDaoService;
|
||||
public class FtWeekMenuDaoServiceImpl extends ServiceImpl<FtWeekMenuDaoMapper, FtWeekMenuDao> implements IFtWeekMenuDaoService {
|
||||
|
||||
@Override
|
||||
public AjaxResult getTodayMenu(String weekDay) {
|
||||
return this.baseMapper.getTodayMenu(weekDay);
|
||||
public AjaxResult getMenuOfDay(String weekDay) {
|
||||
return AjaxResult.success(this.baseMapper.getTodayMenu(weekDay));
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user