Merge remote-tracking branch 'origin/master' into master

# Conflicts:
#	ruoyi-ui/package.json
This commit is contained in:
ryoeiken 2020-12-14 17:42:35 +08:00
commit 145b466bbe
14 changed files with 203 additions and 25 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

@ -1,12 +1,18 @@
package com.ruoyi.system.fantang.controller;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.system.fantang.service.IFtConfigDaoService;
import com.ruoyi.system.fantang.service.IFtOrderDaoService;
import com.ruoyi.system.fantang.service.IFtStaffDemandDaoService;
import com.ruoyi.system.fantang.service.IFtStaffInfoDaoService;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@RequiredArgsConstructor(onConstructor_ = @Autowired)
@RestController
@RequestMapping("/client_api/staff")
@ -17,18 +23,27 @@ public class ClientController extends BaseController {
@Autowired
private IFtConfigDaoService iFtConfigDaoService;
@Autowired
private IFtStaffInfoDaoService staffInfoDaoService;
@Autowired
private IFtStaffDemandDaoService staffDemandDaoService;
@Autowired
private IFtOrderDaoService orderDaoService;
@GetMapping("/getDinnerTimeSetting")
public AjaxResult getDinnerTimeSetting() {
return AjaxResult.success(iFtConfigDaoService.getDinnerTimeSetting());
}
@GetMapping("/getOrderOfToday/{staffId}")
public AjaxResult getOrderOfToday(@PathVariable("staffId") Integer staffId) {
return AjaxResult.success("调用成功");
public AjaxResult getOrderOfToday(@PathVariable("staffId") Long staffId) {
return AjaxResult.success(orderDaoService.getOrderOfToday(staffId));
}
@GetMapping("/getWeekMenu")
public AjaxResult getWeekMenu(){
public AjaxResult getWeekMenu() {
return AjaxResult.success("调用每周菜谱成功");
}
@ -37,28 +52,60 @@ public class ClientController extends BaseController {
return AjaxResult.success("调用有效订单成功");
}
/**
* 推送订单信息
* 日期2020年12月11日
* 作者陈智兴
* @param JSONArray
* staffId: 员工id
* type订餐类型
* demandDate 订餐用餐日期
* @return
*/
@PostMapping("/PostOrder")
public AjaxResult postOrder() {
public AjaxResult postOrder(JSONArray params) {
// for(int i : params.size()) {
//
// }
// Long staffId = params.getLong("staffId");
// Integer type = params.getInteger("type");
// Date demandDate = params.getDate("demandDate");
// orderDaoService.postOrder();
return AjaxResult.success("调用提交订单成功");
}
// 获取配置信息
@GetMapping("/getConfiguration/{staffId}")
public AjaxResult getConfiguration(@PathVariable("staffId") Integer staffId) {
return AjaxResult.success("调用个人配置");
public AjaxResult getConfiguration(@PathVariable("staffId") Long staffId) {
return AjaxResult.success(staffDemandDaoService.getConfiguration(staffId));
}
@PostMapping("/postConfiguration")
public AjaxResult postConfiguration() {
// 获取配置信息
@PostMapping("/postConfiguration/{staffId}")
public AjaxResult postConfiguration(@PathVariable("staffId") Long staffId) {
return AjaxResult.success("推送个人配置");
}
@PostMapping("/login")
public AjaxResult login() {
return AjaxResult.success("登录成功");
/**
* 设置订餐模式
* 日期2020年12月10日
* 作者 陈智兴
* 修改首次创建
* @param {
* tel: 手机号码;
* password 密码
* }
* @return 返回员工信息
*/
@GetMapping("/login")
public AjaxResult login(String tel, String password) {
return staffInfoDaoService.login(tel, password);
}
@PostMapping("/logout")
public AjaxResult logout() {
return AjaxResult.success("登录成功");
@PostMapping("/logout/{staffId}")
public AjaxResult logout(@PathVariable("staffId") Long staffId) {
return AjaxResult.success(staffInfoDaoService.logout(staffId));
}
@GetMapping("/getWorkday")
@ -75,20 +122,42 @@ public class ClientController extends BaseController {
public AjaxResult getOtherProduct() {
return null;
}
@GetMapping("/postProductOrder")
@PostMapping("/postProductOrder")
public AjaxResult postProductOrder() {
return null;
}
@GetMapping("/postCurrentOrder")
@PostMapping("/postCurrentOrder")
public AjaxResult postCurrentOrder() {
return null;
}
@GetMapping("/postStopOrder")
@PostMapping("/postStopOrder")
public AjaxResult postStopOrder() {
return null;
}
@GetMapping("/postRestoreOrder")
@PostMapping("/postRestoreOrder")
public AjaxResult postRestoreOrder() {
return null;
}
/**
* 设置订餐模式
* 日期2020年12月11日
* 作者 陈智兴
* 修改首次创建
* @param {
* config_id: id;
* demandMode: true:自动模式false:手动模式
* }
* @return
*/
@PostMapping("/setDemandMode")
public AjaxResult setDemandMode(@RequestBody JSONObject params) {
Long id = params.getLong("id");
Boolean demandMode = params.getBoolean("demandModeFlag");
return staffDemandDaoService.setDemandMode(id, demandMode);
}
}

View File

@ -46,7 +46,7 @@ public class FtOrderDao implements Serializable {
/**
* 员工 id
*/
private Long workerId;
private Long staffId;
/**
* 清单

View File

@ -38,7 +38,7 @@ private static final long serialVersionUID=1L;
/** 员工 id */
@Excel(name = "员工 id")
private Long staffId;
private Integer staffId;
/** 正餐清单 */
@Excel(name = "正餐清单")
@ -74,7 +74,7 @@ private static final long serialVersionUID=1L;
/** 报餐模式 */
@Excel(name = "报餐模式")
private Integer demandMode;
private Boolean demandMode;
/** 停用标志 */
@Excel(name = "停用标志")

View File

@ -123,4 +123,10 @@ public class FtStaffInfoDao {
* 手机号码
*/
private String tel;
private String token;
private Boolean loginFlag;
private String expired;
}

View File

@ -2,6 +2,9 @@ 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 java.util.List;
/**
* 订单管理Mapper接口
@ -11,4 +14,9 @@ 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, 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();
List<FtOrderDao> getOrderOfToday(Long staffId);
}

View File

@ -3,6 +3,7 @@ package com.ruoyi.system.fantang.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ruoyi.system.fantang.domain.FtStaffInfoDao;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import java.util.List;
@ -16,4 +17,7 @@ public interface FtStaffInfoDaoMapper extends BaseMapper<FtStaffInfoDao> {
@Select("SELECT a.*, b.depart_name from ft_staff_info a LEFT JOIN ft_depart b on a.depart_id = b.depart_id where staff_type = 1")
List<FtStaffInfoDao> selectStaffInfoWithDepart();
@Update("update ft_staff_info set token=#{token}, login_flag=1 where staff_id=#{staff_id}")
void updateLoginStatus(FtStaffInfoDao dao);
}

View File

@ -1,6 +1,7 @@
package com.ruoyi.system.fantang.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.system.fantang.domain.FtOrderDao;
/**
@ -11,4 +12,5 @@ import com.ruoyi.system.fantang.domain.FtOrderDao;
*/
public interface IFtOrderDaoService extends IService<FtOrderDao> {
AjaxResult getOrderOfToday(Long staffId);
}

View File

@ -1,14 +1,18 @@
package com.ruoyi.system.fantang.service;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.system.fantang.domain.FtStaffDemandDao;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* 员工报餐Service接口
*
* @author ft
* @author 陈智兴
* @date 2020-12-07
*/
public interface IFtStaffDemandDaoService extends IService<FtStaffDemandDao> {
AjaxResult getConfiguration(Long staffId);
AjaxResult setDemandMode(Long id, Boolean demandModeFlag);
}

View File

@ -1,6 +1,7 @@
package com.ruoyi.system.fantang.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.system.fantang.domain.FtStaffInfoDao;
import java.util.List;
@ -15,4 +16,7 @@ public interface IFtStaffInfoDaoService extends IService<FtStaffInfoDao> {
List<FtStaffInfoDao> selectStaffInfoWithDepart();
AjaxResult login(String tel, String password);
AjaxResult logout(Long staffId);
}

View File

@ -1,11 +1,17 @@
package com.ruoyi.system.fantang.service.impl;
import cn.hutool.core.date.DateUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.common.core.domain.AjaxResult;
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;
import java.util.Date;
/**
* 订单管理Service业务层处理
*
@ -15,4 +21,17 @@ import org.springframework.stereotype.Service;
@Service
public class FtOrderDaoServiceImpl extends ServiceImpl<FtOrderDaoMapper, FtOrderDao> implements IFtOrderDaoService {
public void GenerateStaffTomorrowOrder() {
this.baseMapper.GenerateStaffTomorrowOrder();
}
@Override
public AjaxResult getOrderOfToday(Long staffId) {
QueryWrapper<FtOrderDao> wrapper = new QueryWrapper<>();
wrapper.eq("staff_id", staffId);
wrapper.between("order_date", DateUtil.beginOfDay(new Date()), DateUtil.endOfDay(new Date()));
return AjaxResult.success(this.baseMapper.selectList(wrapper));
}
}

View File

@ -1,5 +1,7 @@
package com.ruoyi.system.fantang.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.ruoyi.common.core.domain.AjaxResult;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.system.fantang.mapper.FtStaffDemandDaoMapper;
@ -15,4 +17,25 @@ import com.ruoyi.system.fantang.service.IFtStaffDemandDaoService;
@Service
public class FtStaffDemandDaoServiceImpl extends ServiceImpl<FtStaffDemandDaoMapper, FtStaffDemandDao> implements IFtStaffDemandDaoService {
@Override
public AjaxResult getConfiguration(Long staffId) {
QueryWrapper<FtStaffDemandDao> wrapper = new QueryWrapper<>();
wrapper.eq("staff_id", staffId);
FtStaffDemandDao dao = this.baseMapper.selectOne(wrapper);
if (dao == null)
return AjaxResult.error("获取个人配置信息错误");
return AjaxResult.success(dao);
}
@Override
public AjaxResult setDemandMode(Long id, Boolean demandMode) {
FtStaffDemandDao dao = new FtStaffDemandDao();
dao.setId(id);
dao.setDemandMode(demandMode);
int ret = this.baseMapper.updateById(dao);
if (ret == 0)
return AjaxResult.error("更新订餐状态失败");
return AjaxResult.success();
}
}

View File

@ -1,6 +1,9 @@
package com.ruoyi.system.fantang.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.utils.uuid.IdUtils;
import com.ruoyi.system.fantang.domain.FtStaffInfoDao;
import com.ruoyi.system.fantang.mapper.FtStaffInfoDaoMapper;
import com.ruoyi.system.fantang.service.IFtStaffInfoDaoService;
@ -22,4 +25,30 @@ public class FtStaffInfoDaoServiceImpl extends ServiceImpl<FtStaffInfoDaoMapper,
return this.baseMapper.selectStaffInfoWithDepart();
}
@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);
}
@Override
public AjaxResult logout(Long staffId) {
FtStaffInfoDao dao = new FtStaffInfoDao();
dao.setStaffId(staffId);
dao.setLoginFlag(false);
dao.setToken("");
int ret = this.baseMapper.updateById(dao);
if (ret == 0)
return AjaxResult.error("更新退出状态失败");
return AjaxResult.success(dao);
}
}

View File

@ -1,8 +1,8 @@
{
"name": "ruoyi",
"version": "3.3.0",
"description": "若依管理系统",
"author": "若依",
"description": "食堂管理系统",
"author": "食堂",
"license": "MIT",
"scripts": {
"dev": "vue-cli-service serve",