修改获取员工订餐配置信息记录方式

This commit is contained in:
czx 2020-12-21 11:54:05 +08:00
parent 690b4e56e8
commit 9e62938b1f
4 changed files with 15 additions and 20 deletions

View File

@ -105,23 +105,16 @@ public class ClientController extends BaseController {
return AjaxResult.success(staffDemandDaoService.getConfiguration(staffId));
}
// 推送配置信息
@PostMapping("/postConfiguration/{staffId}")
public AjaxResult postConfiguration(@PathVariable("staffId") Long staffId) {
return AjaxResult.success("推送个人配置");
}
/**
* 设置订餐模式
* 员工登录
* 日期2020年12月10日
* 作者 陈智兴
* 修改首次创建
*
* @param { tel: 手机号码;
* param { tel: 手机号码;
* password 密码
* }
* @return 返回员工信息
* return 返回员工信息
*/
@GetMapping("/login")
public AjaxResult login(String tel, String password) {
@ -192,7 +185,8 @@ public class ClientController extends BaseController {
@PostMapping("/setDemandMode")
public AjaxResult setDemandMode(@RequestBody JSONObject params) {
Long id = params.getLong("id");
Integer type = params.getInteger("type");
Boolean demandMode = params.getBoolean("demandModeFlag");
return staffDemandDaoService.setDemandMode(id, demandMode);
return staffDemandDaoService.setDemandMode(id, type, demandMode);
}
}

View File

@ -16,7 +16,4 @@ public interface FtOrderDaoMapper extends BaseMapper<FtOrderDao> {
@Insert("insert into ft_order (order_type, staff_id, order_src, create_at, order_date, order_list, total_price) select type as order_type, staff_id, 1 as order_src, now() as create_at, date_add(now(), interval 1 day) as order_date, foods, (select sum(price) from ft_food f where FIND_IN_SET(f.food_id,d.foods)) as price from ft_staff_demand d where d.demand_mode = 1")
void GenerateStaffTomorrowOrder();
List<FtOrderDao> getOrderOfToday(Long staffId);
}

View File

@ -14,5 +14,5 @@ public interface IFtStaffDemandDaoService extends IService<FtStaffDemandDao> {
AjaxResult getConfiguration(Long staffId);
AjaxResult setDemandMode(Long id, Boolean demandModeFlag);
AjaxResult setDemandMode(Long id, Integer type, Boolean demandModeFlag);
}

View File

@ -8,6 +8,8 @@ import com.ruoyi.system.fantang.mapper.FtStaffDemandDaoMapper;
import com.ruoyi.system.fantang.domain.FtStaffDemandDao;
import com.ruoyi.system.fantang.service.IFtStaffDemandDaoService;
import java.util.List;
/**
* 员工报餐Service业务层处理
*
@ -21,18 +23,20 @@ public class FtStaffDemandDaoServiceImpl extends ServiceImpl<FtStaffDemandDaoMap
public AjaxResult getConfiguration(Long staffId) {
QueryWrapper<FtStaffDemandDao> wrapper = new QueryWrapper<>();
wrapper.eq("staff_id", staffId);
FtStaffDemandDao dao = this.baseMapper.selectOne(wrapper);
if (dao == null)
List<FtStaffDemandDao> daos = this.baseMapper.selectList(wrapper);
if (daos.size() == 0 )
return AjaxResult.error("获取个人配置信息错误");
return AjaxResult.success(dao);
return AjaxResult.success(daos);
}
@Override
public AjaxResult setDemandMode(Long id, Boolean demandMode) {
public AjaxResult setDemandMode(Long id, Integer type, Boolean demandMode) {
FtStaffDemandDao dao = new FtStaffDemandDao();
dao.setId(id);
dao.setDemandMode(demandMode);
int ret = this.baseMapper.updateById(dao);
QueryWrapper<FtStaffDemandDao> wrapper = new QueryWrapper<>();
wrapper.eq("type", type);
int ret = this.baseMapper.update(dao, wrapper);
if (ret == 0)
return AjaxResult.error("更新订餐状态失败");
return AjaxResult.success();