送餐员报餐 APP 后端接口,todo:批量更新报餐记录,通知营养科更新营养配餐信息
This commit is contained in:
parent
f27e2de7c1
commit
595adb7ae3
@ -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日
|
||||
* 作者:陈智兴
|
||||
*
|
||||
* <p>
|
||||
* return
|
||||
*/
|
||||
@GetMapping("/getOrderOfDay")
|
||||
@ -89,7 +92,7 @@ public class ClientController extends BaseController {
|
||||
* 获取员工停餐信息
|
||||
* 日期:2020年12月21日
|
||||
* 作者:陈智兴
|
||||
*
|
||||
* <p>
|
||||
* param JSONObject staffId: 员工id
|
||||
* return
|
||||
*/
|
||||
@ -103,7 +106,7 @@ public class ClientController extends BaseController {
|
||||
* 推送订单信息
|
||||
* 日期:2020年12月11日
|
||||
* 作者:陈智兴
|
||||
*
|
||||
* <p>
|
||||
* param JSONObject staffId: 员工id
|
||||
* orderType:订餐类型
|
||||
* demandDate: 订餐用餐日期
|
||||
@ -118,7 +121,7 @@ public class ClientController extends BaseController {
|
||||
* 推送停餐信息
|
||||
* 日期:2020年12月21日
|
||||
* 作者:陈智兴
|
||||
*
|
||||
* <p>
|
||||
* param staffId: 员工id
|
||||
* type:订餐类型
|
||||
* demandDate: 订餐用餐日期
|
||||
@ -133,7 +136,7 @@ public class ClientController extends BaseController {
|
||||
* 员工取消订餐信息
|
||||
* 日期:2020年12月21日
|
||||
* 作者:陈智兴
|
||||
*
|
||||
* <p>
|
||||
* param staffId: 员工id
|
||||
* type:订餐类型
|
||||
* demandDate: 订餐用餐日期
|
||||
@ -148,7 +151,7 @@ public class ClientController extends BaseController {
|
||||
* 推送取消停餐信息
|
||||
* 日期:2020年12月21日
|
||||
* 作者:陈智兴
|
||||
*
|
||||
* <p>
|
||||
* param staffId: 员工id
|
||||
* type:订餐类型
|
||||
* demandDate: 订餐用餐日期
|
||||
@ -170,7 +173,7 @@ public class ClientController extends BaseController {
|
||||
* 日期:2020年12月10日
|
||||
* 作者: 陈智兴
|
||||
* 修改:首次创建
|
||||
*
|
||||
* <p>
|
||||
* param { tel: 手机号码;
|
||||
* password: 密码
|
||||
* }
|
||||
@ -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<FtOrderDao> wrapper = new QueryWrapper<>();
|
||||
// if (orderType != 0) {
|
||||
// wrapper.eq("order_type", orderType);
|
||||
// }
|
||||
// wrapper.between("create_at", start, end);
|
||||
// orderDaoService.list(wrapper);
|
||||
|
||||
List<FtOrderDao> orderList;
|
||||
|
||||
if (orderType != 0) {
|
||||
orderList = orderDaoService.listDetailedByDate(orderType, start, end);
|
||||
}else {
|
||||
orderList = orderDaoService.listAllDetailedByDate(start, end);
|
||||
}
|
||||
|
||||
return AjaxResult.success(orderList);
|
||||
}
|
||||
}
|
||||
|
@ -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<String, Object> 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<FtStaffInfoDao> 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<FtReportMealsDao> 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<FtFoodDao> wrapper = new QueryWrapper<>();
|
||||
wrapper.eq("type", 1);
|
||||
wrapper.eq("food_id", foodId);
|
||||
return AjaxResult.success(iftFoodDaoService.getOne(wrapper).getPrice());
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
|
||||
/**
|
||||
@ -25,4 +24,9 @@ public interface FtOrderDaoMapper extends BaseMapper<FtOrderDao> {
|
||||
" 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<FtOrderDao> statisGetOrderOfDate(@Param("start") String start, @Param("end") String end);
|
||||
|
||||
|
||||
List<FtOrderDao> listDetailedByDate(@Param("orderType") Integer orderType, @Param("start") String start, @Param("end") String end);
|
||||
|
||||
List<FtOrderDao> listAllDetailedByDate(String start, String end);
|
||||
}
|
||||
|
@ -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<FtOrderDao> {
|
||||
AjaxResult cancelStopOrder(Long orderId);
|
||||
|
||||
AjaxResult statisGetOrderOfDate(Date date);
|
||||
|
||||
List<FtOrderDao> listDetailedByDate(Integer orderType, String start, String end);
|
||||
|
||||
List<FtOrderDao> listAllDetailedByDate(String start, String end);
|
||||
}
|
||||
|
@ -129,4 +129,14 @@ public class FtOrderDaoServiceImpl extends ServiceImpl<FtOrderDaoMapper, FtOrder
|
||||
public AjaxResult statisGetOrderOfDate(Date date) {
|
||||
return AjaxResult.success(this.baseMapper.statisGetOrderOfDate(DateUtil.beginOfDay(date).toString(), DateUtil.endOfDay(date).toString()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<FtOrderDao> listDetailedByDate(Integer orderType, String start, String end) {
|
||||
return this.baseMapper.listDetailedByDate(orderType, start, end);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<FtOrderDao> listAllDetailedByDate(String start, String end) {
|
||||
return this.baseMapper.listAllDetailedByDate(start, end);
|
||||
}
|
||||
}
|
||||
|
@ -25,5 +25,32 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<result property="deviceId" column="device_id"/>
|
||||
</resultMap>
|
||||
|
||||
<select id="listDetailedByDate" resultType="com.ruoyi.system.fantang.domain.FtOrderDao">
|
||||
SELECT a.*,
|
||||
b.staff_id,
|
||||
b.`name`,
|
||||
b.depart_id,
|
||||
c.depart_name
|
||||
FROM ft_order a
|
||||
LEFT JOIN ft_staff_info b ON a.staff_id = b.staff_id
|
||||
LEFT JOIN ft_depart c ON b.depart_id = c.depart_id
|
||||
WHERE a.order_type = #{orderType}
|
||||
AND a.create_at BETWEEN #{start}
|
||||
AND #{end}
|
||||
</select>
|
||||
|
||||
<select id="listAllDetailedByDate" resultType="com.ruoyi.system.fantang.domain.FtOrderDao">
|
||||
SELECT a.*,
|
||||
b.staff_id,
|
||||
b.`name`,
|
||||
b.depart_id,
|
||||
c.depart_name
|
||||
FROM ft_order a
|
||||
LEFT JOIN ft_staff_info b ON a.staff_id = b.staff_id
|
||||
LEFT JOIN ft_depart c ON b.depart_id = c.depart_id
|
||||
AND a.create_at BETWEEN #{start}
|
||||
AND #{end}
|
||||
</select>
|
||||
|
||||
|
||||
</mapper>
|
Loading…
x
Reference in New Issue
Block a user