新增员工订单生成和取消接口
This commit is contained in:
parent
9e62938b1f
commit
638ad47e35
@ -94,9 +94,37 @@ public class ClientController extends BaseController {
|
||||
*/
|
||||
@PostMapping("/PostOrder")
|
||||
public AjaxResult postOrder(@RequestBody JSONObject params) {
|
||||
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")));
|
||||
}
|
||||
|
||||
return AjaxResult.success("调用提交订单成功");
|
||||
/**
|
||||
* 推送停餐信息
|
||||
* 日期:2020年12月21日
|
||||
* 作者:陈智兴
|
||||
*
|
||||
* param staffId: 员工id
|
||||
* type:订餐类型
|
||||
* demandDate: 订餐用餐日期
|
||||
* return -1: 已报停餐信息, 1: 停餐成功
|
||||
*/
|
||||
@PostMapping("/postStopOrder")
|
||||
public AjaxResult postStopOrder(@RequestBody JSONObject params) {
|
||||
return AjaxResult.success(orderDaoService.stopOrder(params.getLong("staffId"), params.getInteger("orderType"), params.getDate("demandDate")));
|
||||
}
|
||||
|
||||
/**
|
||||
* 员工取消订餐信息
|
||||
* 日期:2020年12月21日
|
||||
* 作者:陈智兴
|
||||
*
|
||||
* param staffId: 员工id
|
||||
* type:订餐类型
|
||||
* demandDate: 订餐用餐日期
|
||||
* return -1: 已报停餐信息, 1: 停餐成功
|
||||
*/
|
||||
@PostMapping("/postCancelOrder")
|
||||
public AjaxResult postCancelOrder(@RequestBody JSONObject params) {
|
||||
return orderDaoService.cancelOrder(params.getLong("orderId"));
|
||||
}
|
||||
|
||||
// 获取配置信息
|
||||
@ -151,21 +179,6 @@ public class ClientController extends BaseController {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 推送停餐信息
|
||||
* 日期:2020年12月11日
|
||||
* 作者:陈智兴
|
||||
*
|
||||
* param staffId: 员工id
|
||||
* type:订餐类型
|
||||
* demandDate: 订餐用餐日期
|
||||
* return
|
||||
*/
|
||||
@PostMapping("/postStopOrder")
|
||||
public AjaxResult postStopOrder(@RequestBody JSONObject params) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@PostMapping("/postRestoreOrder")
|
||||
public AjaxResult postRestoreOrder() {
|
||||
return null;
|
||||
|
@ -21,4 +21,8 @@ public interface IFtOrderDaoService extends IService<FtOrderDao> {
|
||||
AjaxResult getAvailableOrder(Integer staffId);
|
||||
|
||||
AjaxResult getOrderOfDay(Long staffId, Date orderDate);
|
||||
|
||||
AjaxResult stopOrder(Long staffId, Integer orderType, Date demandDate);
|
||||
|
||||
AjaxResult cancelOrder(Long orderId);
|
||||
}
|
||||
|
@ -1,14 +1,12 @@
|
||||
package com.ruoyi.system.fantang.service.impl;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
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;
|
||||
@ -44,7 +42,15 @@ public class FtOrderDaoServiceImpl extends ServiceImpl<FtOrderDaoMapper, FtOrder
|
||||
dao.setStaffId(staffId);
|
||||
dao.setOrderType(orderType);
|
||||
dao.setOrderDate(demandDate);
|
||||
return this.baseMapper.insert(dao);
|
||||
QueryWrapper<FtOrderDao> wrapper = new QueryWrapper<>();
|
||||
wrapper.eq("staff_id", staffId);
|
||||
wrapper.eq("order_type", orderType);
|
||||
wrapper.between("order_date", DateUtil.beginOfDay(demandDate), DateUtil.endOfDay(demandDate));
|
||||
Integer count = this.baseMapper.selectCount(wrapper);
|
||||
if (count > 0)
|
||||
return -1;
|
||||
else
|
||||
return this.baseMapper.insert(dao);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -63,4 +69,16 @@ public class FtOrderDaoServiceImpl extends ServiceImpl<FtOrderDaoMapper, FtOrder
|
||||
List<FtOrderDao> daos = this.baseMapper.selectList(wrapper);
|
||||
return AjaxResult.success(daos);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AjaxResult stopOrder(Long staffId, Integer orderType, Date demandDate) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AjaxResult cancelOrder(Long orderId) {
|
||||
FtOrderDao dao = new FtOrderDao();
|
||||
dao.setOrderId(orderId);
|
||||
return AjaxResult.success(this.baseMapper.deleteById(dao));
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user