员工订餐前端获取配置信息接口

This commit is contained in:
28353131@qq.com 2020-12-10 22:45:45 +08:00
parent 9e1f48d9d8
commit a01ff2cbc4
6 changed files with 68 additions and 9 deletions

View File

@ -1,14 +1,17 @@
package com.ruoyi.system.fantang.controller;
import com.alibaba.fastjson.JSONObject;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.system.fantang.domain.FtStaffInfoDao;
import com.ruoyi.system.fantang.service.IFtConfigDaoService;
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.*;
import java.util.List;
import java.util.Map;
@RequiredArgsConstructor(onConstructor_ = @Autowired)
@ -24,6 +27,9 @@ public class ClientController extends BaseController {
@Autowired
private IFtStaffInfoDaoService staffInfoDaoService;
@Autowired
private IFtStaffDemandDaoService staffDemandDaoService;
@GetMapping("/getDinnerTimeSetting")
public AjaxResult getDinnerTimeSetting() {
return AjaxResult.success(iFtConfigDaoService.getDinnerTimeSetting());
@ -49,13 +55,17 @@ public class ClientController extends BaseController {
return AjaxResult.success("调用提交订单成功");
}
// 获取配置信息
@GetMapping("/getConfiguration/{staffId}")
public AjaxResult getConfiguration(@PathVariable("staffId") Integer staffId) {
staffDemandDaoService.getConfiguration(staffId);
return AjaxResult.success("调用个人配置");
}
@PostMapping("/postConfiguration")
public AjaxResult postConfiguration() {
// 获取配置信息
@PostMapping("/postConfiguration/{staffId}")
public AjaxResult postConfiguration(@PathVariable("staffId") Long staffId) {
return AjaxResult.success("推送个人配置");
}
@ -65,6 +75,7 @@ public class ClientController extends BaseController {
}
@PostMapping("/logout/{staffId}")
public AjaxResult logout(@PathVariable("staffId") Long staffId) {
staffInfoDaoService.logout(staffId);
return AjaxResult.success("登录成功");
}
@ -82,20 +93,27 @@ 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;
}
@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

@ -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

@ -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(Integer staffId);
AjaxResult setDemandMode(Long id, Boolean demandModeFlag);
}

View File

@ -17,4 +17,6 @@ public interface IFtStaffInfoDaoService extends IService<FtStaffInfoDao> {
List<FtStaffInfoDao> selectStaffInfoWithDepart();
AjaxResult login(String tel, String password);
AjaxResult logout(Long staffId);
}

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(Integer 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

@ -39,4 +39,16 @@ public class FtStaffInfoDaoServiceImpl extends ServiceImpl<FtStaffInfoDaoMapper,
this.baseMapper.insert(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);
}
}