package com.ld.igds.gas.controller;
|
|
import com.bstek.bdf2.core.business.IUser;
|
import com.bstek.bdf2.core.model.DefaultDept;
|
import com.ld.igds.common.manager.CommonManager;
|
import com.ld.igds.constant.BizType;
|
import com.ld.igds.constant.Constant;
|
import com.ld.igds.data.ConfigGasImg;
|
import com.ld.igds.data.PageResponse;
|
import com.ld.igds.gas.dto.GasData;
|
import com.ld.igds.gas.dto.GasParam;
|
import com.ld.igds.gas.manager.GasManager;
|
import com.ld.igds.io.response.GasResponse;
|
import com.ld.igds.models.Depot;
|
import com.ld.igds.models.DepotConf;
|
import com.ld.igds.util.ContextUtil;
|
|
import org.apache.commons.lang3.StringUtils;
|
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.servlet.ModelAndView;
|
|
import java.util.*;
|
|
/**
|
* 气体模块控制层,当前层只定义入口,业务逻辑在Manager中实现
|
*/
|
@RestController
|
@RequestMapping("basic/gas")
|
public class GasController {
|
|
@Autowired
|
private CommonManager commonManager;
|
@Autowired
|
private GasManager gasManager;
|
@Autowired
|
private ConfigGasImg gasImg;
|
|
/**
|
* 页面控制
|
*
|
* @param depotId
|
* @return
|
*/
|
@RequestMapping("/view-check")
|
public ModelAndView viewCheck(
|
@RequestParam(value = "depotId", required = false) String depotId,
|
@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);
|
}
|
|
// 仓库列表做下拉框使用
|
List<Depot> listDepot = commonManager.listDepot(deptId);
|
view.addObject(Constant.MODEL_KEY_DEPOT_LIST, listDepot);
|
|
|
view.addObject("bizType", BizType.GAS.getCode());
|
//获取当前用户所在的分库名称
|
DefaultDept dept = commonManager.getSubDept(user, deptId);
|
view.addObject("dept", dept);
|
|
// 每个仓库正面和背面图片
|
view.addObject("gasImgMap", gasImg.getGasImg(listDepot, deptId));
|
|
if (StringUtils.isEmpty(deptId)) {
|
deptId = ContextUtil.subDeptId(user);
|
}
|
view.addObject("deptId", deptId);
|
|
view.setViewName("admin/gas/gas-check");
|
return view;
|
}
|
|
/**
|
* 实际使用页面
|
*
|
* @param
|
* @return
|
*/
|
@RequestMapping("/gas-line")
|
public ModelAndView gasLine() {
|
ModelAndView view = new ModelAndView();
|
// 仓库列表做下拉框使用
|
List<Depot> listDepot = commonManager.listDepot(null);
|
view.addObject(Constant.MODEL_KEY_DEPOT_LIST, listDepot);
|
view.addObject(Constant.MODEL_KEY_BIZ_TYPE, BizType.GAS.getCode());
|
|
view.setViewName("admin/gas/gas-line");
|
return view;
|
}
|
|
/**
|
* 获取默认列表
|
*
|
* @param param
|
* @return
|
*/
|
@RequestMapping("/list-data")
|
public PageResponse<List<GasData>> queryListPest(@RequestBody GasParam param) {
|
return gasManager.queryListPest(param);
|
}
|
|
/**
|
* 获取气体配置信息
|
*
|
* @param param
|
* @return
|
*/
|
@RequestMapping("/gas-conf")
|
public PageResponse<DepotConf> gasConf(@RequestBody GasParam param) {
|
return gasManager.gasConf(param);
|
}
|
|
/**
|
* 页面控制--手动通风页面
|
*
|
* @param depotId
|
* @return
|
*/
|
@RequestMapping("/new-gas")
|
public ModelAndView newGas(
|
@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);
|
|
view.addObject("bizType", BizType.GAS.getCode());
|
|
view.setViewName("admin/gas/newGas");
|
return view;
|
}
|
|
/**
|
* @return
|
*/
|
@RequestMapping(value = "/flush-gas")
|
public @ResponseBody
|
PageResponse<GasData> flushGas(@RequestBody GasParam param) {
|
return gasManager.flushGas(param);
|
}
|
|
|
/**
|
* 获取当前仓库最新的气体信息
|
*
|
* @return
|
*/
|
@RequestMapping(value = "/flush-gas-depot")
|
public @ResponseBody
|
PageResponse<GasData> flushGasByDepot(@RequestBody GasParam param) {
|
if (null == param.getDeptId()) {
|
param.setDeptId(ContextUtil.subDeptId(null));
|
}
|
if (StringUtils.isEmpty(param.getCompanyId())) {
|
param.setCompanyId(ContextUtil.getCompanyId());
|
}
|
|
param.setTagPressure(true);
|
return gasManager.flushGasByDepot(param);
|
}
|
|
/**
|
* 粮情检测-单仓检测
|
*
|
* @param param
|
* @return
|
*/
|
@RequestMapping("/check-single")
|
public @ResponseBody
|
GasResponse checkSingle(@RequestBody GasParam param) {
|
return gasManager.checkGas(param);
|
}
|
|
/**
|
* 选择采集点检测
|
*
|
* @param param
|
* @return
|
*/
|
@RequestMapping("/check-select")
|
public @ResponseBody
|
GasResponse checkSelect(@RequestBody GasParam param) {
|
return gasManager.checkSelect(param);
|
}
|
|
/**
|
* 根据仓库批量检测
|
*
|
* @param param
|
* @return
|
*/
|
@RequestMapping("/check-batch")
|
public @ResponseBody
|
GasResponse checkBatch(@RequestBody GasParam param) {
|
return gasManager.checkBatch(param);
|
}
|
|
/**
|
* 根据条件获取列表数据 返回根据检测时间内的数据Map
|
*
|
* @param param
|
* @return
|
*/
|
@RequestMapping("/query-checkDate-map")
|
public PageResponse<Map<String, GasData>> queryCheckDateMap(
|
@RequestBody GasParam param) {
|
return gasManager.queryCheckDateMap(param);
|
}
|
|
/**
|
* @return 当前批次的各个采集点信息
|
*/
|
@RequestMapping(value = "/list-chart")
|
public @ResponseBody
|
Map<String, Object> listChart(
|
@RequestBody GasParam param) {
|
return gasManager.lineChart(param);
|
}
|
}
|