Helius
2021-03-17 8f9e3814fd49efd763f06305ffbfff6d87012627
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
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);
    }
     
}