From 638ad47e356a07754185e8203af32b50a2c8331e Mon Sep 17 00:00:00 2001 From: czx <28353131@qq.com> Date: Mon, 21 Dec 2020 14:08:13 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=91=98=E5=B7=A5?= =?UTF-8?q?=E8=AE=A2=E5=8D=95=E7=94=9F=E6=88=90=E5=92=8C=E5=8F=96=E6=B6=88?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fantang/controller/ClientController.java | 47 ++++++++++++------- .../fantang/service/IFtOrderDaoService.java | 4 ++ .../service/impl/FtOrderDaoServiceImpl.java | 24 ++++++++-- 3 files changed, 55 insertions(+), 20 deletions(-) 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 517b2df64..c8f568f2c 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 @@ -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; 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 402204ab9..6e492d9ef 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 @@ -21,4 +21,8 @@ public interface IFtOrderDaoService extends IService { AjaxResult getAvailableOrder(Integer staffId); AjaxResult getOrderOfDay(Long staffId, Date orderDate); + + AjaxResult stopOrder(Long staffId, Integer orderType, Date demandDate); + + AjaxResult cancelOrder(Long orderId); } 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 212f4e999..619999c22 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 @@ -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 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 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)); + } } From 96b6b349dc0d9e58b2ed3e695f04b40567ce5146 Mon Sep 17 00:00:00 2001 From: czx <28353131@qq.com> Date: Mon, 21 Dec 2020 14:48:57 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=91=98=E5=B7=A5?= =?UTF-8?q?=E5=81=9C=E9=A4=90=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fantang/controller/ClientController.java | 30 +++++++++++ .../fantang/domain/FtStaffStopMealsDao.java | 54 +++++++++++++++++++ .../mapper/FtStaffStopMealsDaoMapper.java | 16 ++++++ .../fantang/service/IFtOrderDaoService.java | 4 ++ .../service/impl/FtOrderDaoServiceImpl.java | 25 ++++++++- 5 files changed, 128 insertions(+), 1 deletion(-) create mode 100644 ruoyi-system/src/main/java/com/ruoyi/system/fantang/domain/FtStaffStopMealsDao.java create mode 100644 ruoyi-system/src/main/java/com/ruoyi/system/fantang/mapper/FtStaffStopMealsDaoMapper.java 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 c8f568f2c..c93586602 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 @@ -82,6 +82,21 @@ public class ClientController extends BaseController { return AjaxResult.success(orderDaoService.getAvailableOrder(staffId)); } + + /** + * 获取员工停餐信息 + * 日期:2020年12月21日 + * 作者:陈智兴 + * + * param JSONObject staffId: 员工id + * return + */ + @GetMapping("/getAvailableStopOrder") + public AjaxResult getAvailableStopOrder(@RequestBody JSONObject params) { + return AjaxResult.success(orderDaoService.getAvailableStopOrder(params.getLong("staffId"))); + } + + /** * 推送订单信息 * 日期:2020年12月11日 @@ -127,6 +142,21 @@ public class ClientController extends BaseController { return orderDaoService.cancelOrder(params.getLong("orderId")); } + /** + * 推送取消停餐信息 + * 日期:2020年12月21日 + * 作者:陈智兴 + * + * param staffId: 员工id + * type:订餐类型 + * demandDate: 订餐用餐日期 + * return -1: 已报停餐信息, 1: 停餐成功 + */ + @PostMapping("/postCancelStopOrder") + public AjaxResult postCancelStopOrder(@RequestBody JSONObject params) { + return AjaxResult.success(orderDaoService.cancelStopOrder(params.getLong("orderId"))); + } + // 获取配置信息 @GetMapping("/getConfiguration/{staffId}") public AjaxResult getConfiguration(@PathVariable("staffId") Long staffId) { diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/fantang/domain/FtStaffStopMealsDao.java b/ruoyi-system/src/main/java/com/ruoyi/system/fantang/domain/FtStaffStopMealsDao.java new file mode 100644 index 000000000..e1bd20d40 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/fantang/domain/FtStaffStopMealsDao.java @@ -0,0 +1,54 @@ +package com.ruoyi.system.fantang.domain; + +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.fasterxml.jackson.annotation.JsonFormat; +import com.ruoyi.common.annotation.Excel; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.NoArgsConstructor; +import lombok.ToString; +import lombok.experimental.Accessors; + +import java.io.Serializable; +import java.util.Date; + +/** + * 员工报餐对象 ft_staff_demand + * + * @author ft + * @date 2020-12-07 + */ +@Data +@ToString +@EqualsAndHashCode +@NoArgsConstructor +@Accessors(chain = true) +@TableName("ft_staff_stop_meals") +public class FtStaffStopMealsDao implements Serializable { + +private static final long serialVersionUID=1L; + + + /** id */ + @TableId(value = "id") + private Long id; + + /** 员工 id */ + @Excel(name = "员工 id") + private Long staffId; + + /** 用餐类型 */ + @Excel(name = "用餐类型") + private Integer type; + + /** 创建时间 */ + @Excel(name = "创建时间" , width = 30, dateFormat = "yyyy-MM-dd") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private Date createAt; + + /** 停餐时间 */ + @Excel(name = "停餐时间" , width = 30, dateFormat = "yyyy-MM-dd") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private Date demandDate; +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/fantang/mapper/FtStaffStopMealsDaoMapper.java b/ruoyi-system/src/main/java/com/ruoyi/system/fantang/mapper/FtStaffStopMealsDaoMapper.java new file mode 100644 index 000000000..3bab09a41 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/fantang/mapper/FtStaffStopMealsDaoMapper.java @@ -0,0 +1,16 @@ +package com.ruoyi.system.fantang.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.ruoyi.system.fantang.domain.FtStaffStopMealsDao; +import org.springframework.stereotype.Repository; + +/** + * 员工报餐Mapper接口 + * + * @author ft + * @date 2020-12-07 + */ +@Repository +public interface FtStaffStopMealsDaoMapper extends BaseMapper { + +} 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 6e492d9ef..4c6f3f6fe 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 @@ -25,4 +25,8 @@ public interface IFtOrderDaoService extends IService { AjaxResult stopOrder(Long staffId, Integer orderType, Date demandDate); AjaxResult cancelOrder(Long orderId); + + AjaxResult getAvailableStopOrder(Long staffId); + + AjaxResult cancelStopOrder(Long orderId); } 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 619999c22..2fd7cf0b0 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 @@ -5,8 +5,11 @@ 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.domain.FtStaffStopMealsDao; import com.ruoyi.system.fantang.mapper.FtOrderDaoMapper; +import com.ruoyi.system.fantang.mapper.FtStaffStopMealsDaoMapper; import com.ruoyi.system.fantang.service.IFtOrderDaoService; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.Date; @@ -21,6 +24,9 @@ import java.util.List; @Service public class FtOrderDaoServiceImpl extends ServiceImpl implements IFtOrderDaoService { + @Autowired + FtStaffStopMealsDaoMapper staffStopMealsDaoMapper; + public void GenerateStaffTomorrowOrder() { this.baseMapper.GenerateStaffTomorrowOrder(); @@ -72,7 +78,12 @@ public class FtOrderDaoServiceImpl extends ServiceImpl wrapper = new QueryWrapper<>(); + wrapper.eq("staff_id", staffId); + return AjaxResult.success(staffStopMealsDaoMapper.selectList(wrapper)); + } + + @Override + public AjaxResult cancelStopOrder(Long orderId) { + return AjaxResult.success(staffStopMealsDaoMapper.deleteById(orderId)); + } } From fd7108f4124dec97b8447665d3673f3ffb03453f Mon Sep 17 00:00:00 2001 From: czx <28353131@qq.com> Date: Mon, 21 Dec 2020 15:54:44 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E4=BC=98=E5=8C=96=E8=8E=B7=E5=8F=96?= =?UTF-8?q?=E7=94=A8=E9=A4=90=E4=BF=A1=E6=81=AF=E7=9A=84=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/FtConfigDaoServiceImpl.java | 39 ++++++------------- 1 file changed, 11 insertions(+), 28 deletions(-) diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/fantang/service/impl/FtConfigDaoServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/fantang/service/impl/FtConfigDaoServiceImpl.java index d92aac0a5..125a74c81 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/fantang/service/impl/FtConfigDaoServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/fantang/service/impl/FtConfigDaoServiceImpl.java @@ -7,6 +7,8 @@ import com.ruoyi.system.fantang.mapper.FtConfigDaoMapper; import com.ruoyi.system.fantang.service.IFtConfigDaoService; import org.springframework.stereotype.Service; +import java.lang.reflect.Array; +import java.util.ArrayList; import java.util.HashMap; import java.util.Map; @@ -24,34 +26,15 @@ public class FtConfigDaoServiceImpl extends ServiceImpl map = new HashMap<>(); QueryWrapper breakfastStartWrapper = new QueryWrapper<>(); - breakfastStartWrapper.eq("config_key", "breakfast_start"); - String breakfastStart = this.baseMapper.selectOne(breakfastStartWrapper).getConfigValue(); - map.put("breakfastStart", breakfastStart); - - QueryWrapper breakfastEndWrapper = new QueryWrapper<>(); - breakfastEndWrapper.eq("config_key", "breakfast_end"); - String breakfastEnd = this.baseMapper.selectOne(breakfastStartWrapper).getConfigValue(); - map.put("breakfastEnd", breakfastEnd); - - QueryWrapper lunchStartWrapper = new QueryWrapper<>(); - lunchStartWrapper.eq("config_key", "lunch_start"); - String lunchStart = this.baseMapper.selectOne(lunchStartWrapper).getConfigValue(); - map.put("lunchStart", lunchStart); - - QueryWrapper lunchEndWrapper = new QueryWrapper<>(); - lunchEndWrapper.eq("config_key", "lunch_end"); - String lunchEnd = this.baseMapper.selectOne(lunchEndWrapper).getConfigValue(); - map.put("lunchEnd", lunchEnd); - - QueryWrapper dinnerStartWrapper = new QueryWrapper<>(); - dinnerStartWrapper.eq("config_key", "dinner_start"); - String dinnerStart = this.baseMapper.selectOne(dinnerStartWrapper).getConfigValue(); - map.put("dinnerStart", dinnerStart); - - QueryWrapper dinnerEndWrapper = new QueryWrapper<>(); - dinnerEndWrapper.eq("config_key", "dinner_end"); - String dinnerEnd = this.baseMapper.selectOne(dinnerEndWrapper).getConfigValue(); - map.put("dinnerEnd", dinnerEnd); + breakfastStartWrapper.eq("config_key", "dinner_string"); + String dinnerString = this.baseMapper.selectOne(breakfastStartWrapper).getConfigValue(); + String[] split = dinnerString.split(","); + map.put("breakfastStart", split[0]); + map.put("breakfastEnd", split[1]); + map.put("lunchStart", split[2]); + map.put("lunchEnd", split[3]); + map.put("dinnerStart", split[4]); + map.put("dinnerEnd", split[5]); return map; }