diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/fantang/controller/ClientController.java b/ruoyi-system/src/main/java/com/ruoyi/system/fantang/controller/ClientController.java index d99692f6e..af2d13f0c 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/fantang/controller/ClientController.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/fantang/controller/ClientController.java @@ -1,10 +1,9 @@ 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.domain.FtOrderDao; import com.ruoyi.system.fantang.service.*; import lombok.RequiredArgsConstructor; import org.springframework.beans.factory.annotation.Autowired; @@ -12,6 +11,7 @@ import org.springframework.web.bind.annotation.*; import java.util.Calendar; import java.util.Date; +import java.util.List; @RequiredArgsConstructor(onConstructor_ = @Autowired) @@ -36,6 +36,9 @@ public class ClientController extends BaseController { @Autowired private IFtWeekMenuDaoService weekMenuDaoService; + @Autowired + private IFtReportMealsDaoService reportMealsDaoService; + /** * 获取用餐时间信息 * 日期:2020年12月11日 @@ -65,7 +68,7 @@ public class ClientController extends BaseController { * 获取员工某一天的订单信息 * 日期:2020年12月11日 * 作者:陈智兴 - * + *

* return */ @GetMapping("/getOrderOfDay") @@ -89,7 +92,7 @@ public class ClientController extends BaseController { * 获取员工停餐信息 * 日期:2020年12月21日 * 作者:陈智兴 - * + *

* param JSONObject staffId: 员工id * return */ @@ -103,25 +106,25 @@ public class ClientController extends BaseController { * 推送订单信息 * 日期:2020年12月11日 * 作者:陈智兴 - * + *

* param JSONObject staffId: 员工id - * orderType:订餐类型 - * demandDate: 订餐用餐日期 + * orderType:订餐类型 + * demandDate: 订餐用餐日期 * return */ @PostMapping("/PostOrder") public AjaxResult postOrder(@RequestBody JSONObject params) { - return AjaxResult.success(orderDaoService.insertOrder(params.getLong("staffId"), params.getInteger("orderType"), params.getDate("demandDate"))); + return AjaxResult.success(orderDaoService.insertOrder(params.getLong("staffId"), params.getInteger("orderType"), params.getDate("demandDate"))); } /** * 推送停餐信息 * 日期:2020年12月21日 * 作者:陈智兴 - * + *

* param staffId: 员工id - * type:订餐类型 - * demandDate: 订餐用餐日期 + * type:订餐类型 + * demandDate: 订餐用餐日期 * return -1: 已报停餐信息, 1: 停餐成功 */ @PostMapping("/postStopOrder") @@ -133,10 +136,10 @@ public class ClientController extends BaseController { * 员工取消订餐信息 * 日期:2020年12月21日 * 作者:陈智兴 - * + *

* param staffId: 员工id - * type:订餐类型 - * demandDate: 订餐用餐日期 + * type:订餐类型 + * demandDate: 订餐用餐日期 * return -1: 已报停餐信息, 1: 停餐成功 */ @PostMapping("/postCancelOrder") @@ -148,10 +151,10 @@ public class ClientController extends BaseController { * 推送取消停餐信息 * 日期:2020年12月21日 * 作者:陈智兴 - * + *

* param staffId: 员工id - * type:订餐类型 - * demandDate: 订餐用餐日期 + * type:订餐类型 + * demandDate: 订餐用餐日期 * return -1: 已报停餐信息, 1: 停餐成功 */ @PostMapping("/postCancelStopOrder") @@ -170,10 +173,10 @@ public class ClientController extends BaseController { * 日期:2020年12月10日 * 作者: 陈智兴 * 修改:首次创建 - * + *

* param { tel: 手机号码; - * password: 密码 - * } + * password: 密码 + * } * return 返回员工信息 */ @GetMapping("/login") @@ -252,7 +255,7 @@ public class ClientController extends BaseController { */ @PostMapping("/getMenuOfDay") public AjaxResult getMenuOfDay(@RequestBody JSONObject params) { - String[] weekDays = { "周日", "周一", "周二", "周三", "周四", "周五", "周六" }; + String[] weekDays = {"周日", "周一", "周二", "周三", "周四", "周五", "周六"}; Calendar cal = Calendar.getInstance(); cal.setTime(params.getDate("date")); int w = cal.get(Calendar.DAY_OF_WEEK) - 1; @@ -265,4 +268,36 @@ public class ClientController extends BaseController { public AjaxResult statisGetOrderOfDate(@RequestParam Date date) { return orderDaoService.statisGetOrderOfDate(date); } + + /** + * 获取指定日期的订单明细 + * 类型,日期 + * 类型 = 0 ,所有 + * type = 1,2,3:早,午,晚 + */ + @PostMapping("/getOrderDetailedByDate") + public AjaxResult getOrderDetailedByDate(@RequestBody JSONObject params) { + + String createAt = params.getString("createAt"); + Integer orderType = params.getInteger("orderType"); + String start = createAt + " 00:00:00"; + String end = createAt + " 23:59:59"; + +// QueryWrapper wrapper = new QueryWrapper<>(); +// if (orderType != 0) { +// wrapper.eq("order_type", orderType); +// } +// wrapper.between("create_at", start, end); +// orderDaoService.list(wrapper); + + List orderList; + + if (orderType != 0) { + orderList = orderDaoService.listDetailedByDate(orderType, start, end); + }else { + orderList = orderDaoService.listAllDetailedByDate(start, end); + } + + return AjaxResult.success(orderList); + } } diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/fantang/controller/ClientPatientController.java b/ruoyi-system/src/main/java/com/ruoyi/system/fantang/controller/ClientPatientController.java index 9e51a1a7e..a2a33dd9f 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/fantang/controller/ClientPatientController.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/fantang/controller/ClientPatientController.java @@ -2,20 +2,23 @@ package com.ruoyi.system.fantang.controller; import cn.hutool.core.date.DateTime; import cn.hutool.core.date.DateUtil; +import com.alibaba.fastjson.JSONObject; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.system.fantang.domain.FtFoodDao; +import com.ruoyi.system.fantang.domain.FtFoodDemandDao; +import com.ruoyi.system.fantang.domain.FtReportMealsDao; import com.ruoyi.system.fantang.domain.FtStaffInfoDao; -import com.ruoyi.system.fantang.service.IFtDepartDaoService; -import com.ruoyi.system.fantang.service.IFtPatientDaoService; -import com.ruoyi.system.fantang.service.IFtStaffInfoDaoService; +import com.ruoyi.system.fantang.service.*; import com.ruoyi.system.fantang.vo.FtDepartVo; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; import java.text.SimpleDateFormat; import java.util.Date; -import java.util.Map; +import java.util.List; @RestController @@ -31,6 +34,18 @@ public class ClientPatientController extends BaseController { @Autowired private IFtDepartDaoService iFtDepartDaoService; + @Autowired + private IFtReportMealsDaoService iFtReportMealsDaoService; + + @Autowired + private IFtFoodDemandDaoService iFtFoodDemandDaoService; + + @Autowired + private IFtNutritionFoodDaoService iFftNutritionFoodDaoService; + + @Autowired + private IFtFoodDaoService iftFoodDaoService; + /** * 根据病人获取今日报餐信息 */ @@ -92,10 +107,10 @@ public class ClientPatientController extends BaseController { /** * 更改默认报餐部门 */ - @PostMapping("/updateDepart") - public AjaxResult updateDepart(@RequestBody Map data) { - Long staffId = Long.parseLong(data.get("staffId").toString()); - String departId = data.get("departId").toString(); + @PutMapping("/updateDepart") + public AjaxResult updateDepart(@RequestBody JSONObject params) { + Long staffId = params.getLong("staffId"); + String departId = params.getString("departId"); UpdateWrapper wrapper = new UpdateWrapper<>(); wrapper.eq("staff_id", staffId); @@ -104,4 +119,47 @@ public class ClientPatientController extends BaseController { return AjaxResult.success(iFtStaffInfoDaoService.update(staffInfoDao, wrapper)); } + + /** + * 批量更新报餐记录 + */ + @PutMapping("/batchUpdateReportMeals") + public AjaxResult batchUpdateReportMeals(@RequestBody List reportMealsDaoList) { + return AjaxResult.success(iFtReportMealsDaoService.updateBatchById(reportMealsDaoList)); + } + + /** + * 更新指定病患的报餐记录 + */ + @PutMapping("/updateReportMeals") + public AjaxResult updateReportMeals(@RequestBody FtReportMealsDao ftReportMealsDao) { + return AjaxResult.success(iFtReportMealsDaoService.updateById(ftReportMealsDao)); + } + + /** + * 更新指定病患默认报餐数据 + */ + @PutMapping("/updateFoodDemand") + public AjaxResult updateFoodDemand(@RequestBody FtFoodDemandDao ftFoodDemandDao) { + return AjaxResult.success(iFtFoodDemandDaoService.updateById(ftFoodDemandDao)); + } + + /** + * 获取营养配餐配置信息 + */ + @GetMapping("getNutritionFood") + public AjaxResult getNutritionFood() { + return AjaxResult.success(iFftNutritionFoodDaoService.list()); + } + + /** + * 获取菜品价格 + */ + @GetMapping("/getFoodPrice/{foodId}") + public AjaxResult getFoodPrice(@PathVariable("foodId") Long foodId) { + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq("type", 1); + wrapper.eq("food_id", foodId); + return AjaxResult.success(iftFoodDaoService.getOne(wrapper).getPrice()); + } } diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/fantang/domain/FtOrderDao.java b/ruoyi-system/src/main/java/com/ruoyi/system/fantang/domain/FtOrderDao.java index 1ad4d09d7..0d34474ee 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/fantang/domain/FtOrderDao.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/fantang/domain/FtOrderDao.java @@ -52,6 +52,12 @@ public class FtOrderDao implements Serializable { */ private Long staffId; + /** + * 员工姓名 + */ + @TableField(exist = false) + private String name; + /** * 清单 */ @@ -147,4 +153,7 @@ public class FtOrderDao implements Serializable { @TableField(exist = false) private String departName; + + @TableField(exist = false) + private Long departId; } diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/fantang/mapper/FtOrderDaoMapper.java b/ruoyi-system/src/main/java/com/ruoyi/system/fantang/mapper/FtOrderDaoMapper.java index ad298361f..07adfc072 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/fantang/mapper/FtOrderDaoMapper.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/fantang/mapper/FtOrderDaoMapper.java @@ -6,7 +6,6 @@ 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; /** @@ -24,5 +23,10 @@ public interface FtOrderDaoMapper extends BaseMapper { " LEFT JOIN ft_staff_info b on a.staff_id = b.staff_id\n" + " LEFT JOIN ft_depart c on b.depart_id = c.depart_id where a.order_date BETWEEN #{start} and #{end}\n" + " GROUP BY a.order_type, c.depart_name") - List statisGetOrderOfDate(@Param("start")String start,@Param("end") String end); + List statisGetOrderOfDate(@Param("start") String start, @Param("end") String end); + + + List listDetailedByDate(@Param("orderType") Integer orderType, @Param("start") String start, @Param("end") String end); + + List listAllDetailedByDate(String start, String end); } diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/fantang/service/IFtOrderDaoService.java b/ruoyi-system/src/main/java/com/ruoyi/system/fantang/service/IFtOrderDaoService.java index 68907b864..a9f30f713 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/fantang/service/IFtOrderDaoService.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/fantang/service/IFtOrderDaoService.java @@ -5,6 +5,7 @@ import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.system.fantang.domain.FtOrderDao; import java.util.Date; +import java.util.List; /** * 订单管理Service接口 @@ -31,4 +32,8 @@ public interface IFtOrderDaoService extends IService { AjaxResult cancelStopOrder(Long orderId); AjaxResult statisGetOrderOfDate(Date date); + + List listDetailedByDate(Integer orderType, String start, String end); + + List listAllDetailedByDate(String start, String end); } diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/fantang/service/impl/FtOrderDaoServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/fantang/service/impl/FtOrderDaoServiceImpl.java index fbca1f883..44b0931b7 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/fantang/service/impl/FtOrderDaoServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/fantang/service/impl/FtOrderDaoServiceImpl.java @@ -91,7 +91,7 @@ public class FtOrderDaoServiceImpl extends ServiceImpl wrapper = new QueryWrapper<>(); - wrapper.eq("staff_id", staffId); + wrapper.eq("staff_id", staffId); wrapper.eq("order_type", orderType); wrapper.between("order_date", DateUtil.beginOfDay(demandDate), DateUtil.endOfDay(demandDate)); this.baseMapper.delete(wrapper); @@ -129,4 +129,14 @@ public class FtOrderDaoServiceImpl extends ServiceImpl listDetailedByDate(Integer orderType, String start, String end) { + return this.baseMapper.listDetailedByDate(orderType, start, end); + } + + @Override + public List listAllDetailedByDate(String start, String end) { + return this.baseMapper.listAllDetailedByDate(start, end); + } } diff --git a/ruoyi-system/src/main/resources/mapper/fantang/FtOrderDaoMapper.xml b/ruoyi-system/src/main/resources/mapper/fantang/FtOrderDaoMapper.xml index 507c7fe6c..4da6e8526 100644 --- a/ruoyi-system/src/main/resources/mapper/fantang/FtOrderDaoMapper.xml +++ b/ruoyi-system/src/main/resources/mapper/fantang/FtOrderDaoMapper.xml @@ -1,29 +1,56 @@ + PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> - + - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file