package com.ld.igds.verb.controller;
|
|
import com.bstek.bdf2.core.business.IUser;
|
import com.ld.igds.common.manager.CommonManager;
|
import com.ld.igds.constant.BizType;
|
import com.ld.igds.constant.Constant;
|
import com.ld.igds.constant.DepotType;
|
import com.ld.igds.data.ConfigVerbImg;
|
import com.ld.igds.data.PageResponse;
|
import com.ld.igds.io.response.DeviceControlResponse;
|
import com.ld.igds.models.Depot;
|
import com.ld.igds.models.Device;
|
import com.ld.igds.models.DicTrigger;
|
import com.ld.igds.util.ContextUtil;
|
import com.ld.igds.verb.dto.VerbParam;
|
import com.ld.igds.verb.manager.VerbManager;
|
|
import org.apache.commons.lang3.StringUtils;
|
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.web.bind.annotation.RequestBody;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestParam;
|
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.servlet.ModelAndView;
|
|
import java.util.List;
|
|
/**
|
* 通风模块管理-手动通风
|
*
|
* 包括通风相关页面入口
|
*/
|
@RestController
|
@RequestMapping("basic/verb")
|
public class VerbController {
|
|
@Autowired
|
private VerbManager verbManager;
|
@Autowired
|
private CommonManager commonManager;
|
@Autowired
|
private ConfigVerbImg verbImg;
|
|
|
/**
|
* 根据仓库信息获取仓库配置等,跳转不同的显示页面
|
*
|
* @param depotId 仓库编码
|
* @param depotType 仓库类型
|
* @param deptId 所属分库
|
* @return
|
*/
|
@RequestMapping("/gateway")
|
public ModelAndView gateway(
|
@RequestParam(value = "depotId", required = false) String depotId,
|
@RequestParam(value = "depotType", required = true) String depotType,
|
@RequestParam(value = "deptId", required = false) String deptId) {
|
ModelAndView view = new ModelAndView();
|
|
IUser user = ContextUtil.getLoginUser();
|
view.addObject(Constant.MODEL_KEY_LOGIN_USER, user);
|
|
if(StringUtils.isEmpty(deptId)){
|
deptId = ContextUtil.subDeptId(user);
|
}
|
|
// 获取当前用户所在的分库名称
|
// DefaultDept dept = commonManager.getSubDept(user, deptId);
|
// view.addObject("dept", dept);
|
|
view.addObject("deptId", deptId);
|
|
// 获取当前部门,所有仓库列表
|
List<Depot> listDepot = commonManager.listDepot(deptId);
|
view.addObject(Constant.MODEL_KEY_DEPOT_LIST, listDepot);
|
|
|
view.addObject("bizType", BizType.AREATION.getCode());
|
view.addObject("depotType", depotType);
|
view.addObject("depotId", depotId);
|
|
if (StringUtils.isEmpty(depotType)) {
|
view.setViewName("admin/verb/verb-hand1");
|
}
|
|
if (DepotType.TYPE_02.getCode().equals(depotType) || DepotType.TYPE_04.getCode().equals(depotType)) {
|
view.setViewName("admin/verb/verb-hand2");
|
} else {
|
view.setViewName("admin/verb/verb-hand1");
|
}
|
// 每个仓库正面和背面图片
|
view.addObject("verbImgMap", verbImg.getVerbImg(listDepot, deptId));
|
|
return view;
|
}
|
|
|
/**
|
* 页面控制--手动通风页面-平房仓
|
*
|
* @param depotId
|
* @return
|
*/
|
@RequestMapping("/verb-hand1")
|
public ModelAndView verbHand(@RequestParam(value = "depotId", required = false) String depotId) {
|
ModelAndView view = new ModelAndView();
|
|
IUser user = ContextUtil.getLoginUser();
|
|
//当前人所在分库
|
String deptId = ContextUtil.subDeptId(user);
|
view.addObject("deptId", deptId);
|
|
// 仓库列表做下拉框使用
|
List<Depot> listDepot = commonManager.listDepot(deptId);
|
view.addObject(Constant.MODEL_KEY_DEPOT_LIST, listDepot);
|
|
view.addObject("depotId", depotId);
|
|
|
view.addObject("depotType", DepotType.TYPE_01.getCode());
|
|
// 每个仓库正面和背面图片
|
view.addObject("verbImgMap", verbImg.getVerbImg(listDepot, deptId));
|
|
view.addObject(Constant.MODEL_KEY_LOGIN_USER, user);
|
view.addObject(Constant.MODEL_KEY_BIZ_TYPE, BizType.AREATION.getCode());
|
|
view.setViewName("admin/verb/verb-hand1");
|
return view;
|
}
|
|
/**
|
* 页面控制--手动通风页面-筒仓
|
*
|
* @param depotId
|
* @return
|
*/
|
@RequestMapping("/verb-hand2")
|
public ModelAndView verbHand2(@RequestParam(value = "depotId", required = false) String depotId) {
|
ModelAndView view = new ModelAndView();
|
|
IUser user = ContextUtil.getLoginUser();
|
|
//当前人所在分库
|
String deptId = ContextUtil.subDeptId(user);
|
view.addObject("deptId", deptId);
|
|
// 仓库列表做下拉框使用
|
List<Depot> listDepot = commonManager.listDepot(deptId);
|
view.addObject(Constant.MODEL_KEY_DEPOT_LIST, listDepot);
|
|
view.addObject("depotId", depotId);
|
|
view.addObject("depotType", DepotType.TYPE_02.getCode());
|
|
// 每个仓库正面和背面图片
|
view.addObject("verbImgMap", verbImg.getVerbImg(listDepot, deptId));
|
|
view.addObject(Constant.MODEL_KEY_LOGIN_USER, user);
|
view.addObject(Constant.MODEL_KEY_BIZ_TYPE, BizType.AREATION.getCode());
|
|
view.setViewName("admin/verb/verb-hand2");
|
return view;
|
}
|
|
/**
|
* 自动通风配置页面
|
*
|
* @param depotId
|
* @return
|
*/
|
@RequestMapping("/verb-auto")
|
public ModelAndView verbAuto(
|
@RequestParam(value = "depotId", required = false) String depotId) {
|
ModelAndView view = new ModelAndView();
|
// 仓库列表做下拉框使用
|
List<Depot> listDepot = commonManager.listDepot(null);
|
view.addObject(Constant.MODEL_KEY_DEPOT_LIST, listDepot);
|
|
IUser user = ContextUtil.getLoginUser();
|
view.addObject(Constant.MODEL_KEY_LOGIN_USER, user);
|
|
String deptId = ContextUtil.subDeptId(user);
|
view.addObject("deptId", deptId);
|
|
// 通风目的
|
List<DicTrigger> listTrigger = commonManager.getListByParent(
|
Constant.TRIGGER_PARENT_AREATION_TARGIT, user.getCompanyId());
|
view.addObject("listTrigger", listTrigger);
|
|
//获取模式标签
|
List<DicTrigger> listModelTag = verbManager.listAreationModelTag();
|
view.addObject("listModelTag", listModelTag);
|
view.addObject("bizType", BizType.AREATION.getCode());
|
|
view.setViewName("admin/verb/verb-auto");
|
return view;
|
}
|
|
/**
|
* 通风标准
|
*
|
* @param
|
* @return
|
*/
|
@RequestMapping("/verb-standard")
|
public ModelAndView verbStandard() {
|
ModelAndView view = new ModelAndView();
|
view.setViewName("admin/verb/verb-standard");
|
return view;
|
}
|
|
/**
|
* 根据仓库编号,获取与当前仓库相同建筑的所有设备列表
|
*
|
* @param param
|
* @return
|
*/
|
@RequestMapping("/list-device-manual")
|
public PageResponse<List<Device>> listDeviceManual(@RequestBody VerbParam param) {
|
|
if (null == param.getDepotType()) {
|
param.setDepotType(DepotType.TYPE_01.getCode());
|
}
|
param.setCompanyId(ContextUtil.getCompanyId());
|
|
if (DepotType.TYPE_01.getCode().equals(param.getDepotType())) {
|
param.setOnlyCurDepot(false);
|
} else {
|
param.setOnlyCurDepot(true);
|
}
|
|
return verbManager.listDeviceManual(param);
|
}
|
|
/**
|
* 设备操作接口
|
*
|
* @param param
|
* @return
|
*/
|
@RequestMapping("/control-device")
|
public DeviceControlResponse controlDevice(@RequestBody VerbParam param) {
|
return verbManager.controlDevice(param);
|
}
|
|
/***
|
* 设备状态查询
|
*
|
* @param param
|
* @return
|
*/
|
@RequestMapping("/query-status")
|
public DeviceControlResponse queryStatus(@RequestBody VerbParam param) {
|
return verbManager.queryDeviceStatus(param);
|
}
|
|
}
|