package com.matrix.system.hive.action;
|
|
import com.matrix.core.anotations.RemoveRequestToken;
|
import com.matrix.core.anotations.SaveRequestToken;
|
import com.matrix.core.constance.MatrixConstance;
|
import com.matrix.core.pojo.AjaxResult;
|
import com.matrix.core.pojo.PaginationVO;
|
import com.matrix.core.tools.WebUtil;
|
import com.matrix.system.common.bean.SysUsers;
|
import com.matrix.system.hive.bean.SysBedInfo;
|
import com.matrix.system.hive.bean.SysProjServices;
|
import com.matrix.system.hive.service.SysBedInfoService;
|
import com.matrix.system.hive.service.SysShopInfoService;
|
import org.springframework.stereotype.Controller;
|
import org.springframework.web.bind.annotation.RequestBody;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.ResponseBody;
|
|
import javax.annotation.Resource;
|
import java.util.List;
|
|
|
@Controller
|
@RequestMapping(value = "admin/bedInfo")
|
public class BedInfoController extends BaseController {
|
|
|
@Resource
|
private SysBedInfoService bedInfoService; //床位Service
|
@Resource
|
private SysShopInfoService shopInfoService; //店铺Service
|
|
/**
|
* 查询空闲的床位 @Title: showFreedBed @sysProjServices
|
* startTime 开始时间 totalTime 时长 @return AjaxResult 返回类型 @date 2016年8月10日
|
* 下午3:13:49 @throws
|
*/
|
@RequestMapping(value = "/showFreedBed")
|
public @ResponseBody
|
AjaxResult showFreedBed(@RequestBody SysProjServices sysProjServices) {
|
sysProjServices.setShopId(getMe().getShopId());
|
List<SysBedInfo> beds = bedInfoService.findFreeBed(sysProjServices);
|
return new AjaxResult(AjaxResult.STATUS_SUCCESS, beds, 0);
|
}
|
|
|
|
/**
|
* 列表显示床位
|
* @author jiangyouyao
|
* 2016-7-07-12
|
*/
|
@RequestMapping(value = "/showList")
|
public @ResponseBody
|
AjaxResult showBedList(SysBedInfo bedInfo, PaginationVO pageVo) {
|
//员工岗位不是管理员,则是能看本店的床
|
// if(!getMe().getShopRole().equals(Dictionary.FLAG_YES_Y)){
|
bedInfo.setShopId(getMe().getShopId());
|
// }
|
|
return showList(bedInfoService, bedInfo, pageVo);
|
}
|
|
/**
|
* 新增或修改床位页面
|
* @author jiangyouyao
|
* 2016-7-07-12
|
*/
|
@RequestMapping(value = "/addOrModify")
|
@RemoveRequestToken
|
public @ResponseBody AjaxResult addOrModifyBed(SysBedInfo bedInfo) {
|
SysUsers users = WebUtil.getSessionAttribute(MatrixConstance.LOGIN_KEY);
|
bedInfo.setShopId(users.getShopId());
|
if (bedInfo.getId() != null) {
|
|
return modify(bedInfoService,bedInfo, "床位");
|
} else {
|
|
return add(bedInfoService, bedInfo, "床位");
|
}
|
}
|
|
/**
|
* 进入修改床位界面
|
* @author jiangyouyao
|
* 2016-7-07-12
|
*/
|
@RequestMapping(value = "/editForm")
|
@SaveRequestToken
|
public String editBedForm(Long id) {
|
SysBedInfo bedInfo;
|
/*SysShopInfo shopInfo = new SysShopInfo();
|
List<SysShopInfo> shopInfoList = shopInfoService.findByModel(shopInfo);
|
getRequest().setAttribute("shopInfoList", shopInfoList);*/
|
if (id != null) {
|
bedInfo = bedInfoService.findById(id);
|
WebUtil.getRequest().setAttribute("obj", bedInfo);
|
}
|
return "admin/hive/store/bed-form";
|
}
|
|
|
/**
|
* 删除床位
|
* @author jiangyouyao
|
* 2016-7-07-12
|
*/
|
@RequestMapping(value = "/del")
|
public @ResponseBody AjaxResult delBed(String keys) {
|
|
return remove(bedInfoService, keys);
|
}
|
|
}
|