package com.ld.igds.grain.controller;
|
|
import com.bstek.bdf2.core.business.IUser;
|
import com.ld.igds.basic.manager.BasicOrderManager;
|
import com.ld.igds.constant.BizType;
|
import com.ld.igds.constant.Constant;
|
import com.ld.igds.data.BaseParam;
|
import com.ld.igds.data.LayPage;
|
import com.ld.igds.data.PageResponse;
|
import com.ld.igds.order.data.ExeRequest;
|
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.List;
|
|
/**
|
* 粮情相关的其他请求
|
*/
|
@RestController
|
@RequestMapping("basic/grain")
|
public class GrainController2 {
|
|
@Autowired
|
private BasicOrderManager basicOrderManager;
|
|
/**
|
* 获取执行命令记录
|
*
|
* @param depotId
|
* @param deptId
|
* @return
|
*/
|
@RequestMapping("/order-list")
|
public ModelAndView orderList(
|
@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);
|
}
|
view.addObject("deptId", deptId);
|
|
view.addObject("bizType", BizType.GRAIN.getCode());
|
view.addObject("depotId", depotId);
|
|
view.setViewName("admin/grain/order-list");
|
return view;
|
}
|
|
/**
|
* 根据参数获取打印的模板-ALL
|
*
|
* @return
|
*/
|
@SuppressWarnings({"unchecked", "rawtypes"})
|
@ResponseBody
|
@RequestMapping("/query-order-list")
|
public LayPage<List<ExeRequest>> queryOrderList(@RequestParam(value = "depotId", required = false) String depotId,
|
@RequestParam(value = "deptId", required = false) String deptId) {
|
if (StringUtils.isEmpty(deptId))
|
deptId = ContextUtil.subDeptId(null);
|
|
List<ExeRequest> result = basicOrderManager.orderList(depotId, deptId);
|
|
return new LayPage(result);
|
}
|
|
|
/**
|
* 清除执行日志
|
*
|
* @return
|
*/
|
@ResponseBody
|
@RequestMapping("/clean-order-list")
|
public PageResponse<String> cleanOrderList(@RequestBody BaseParam param) {
|
|
if (StringUtils.isEmpty(param.getCompanyId())) {
|
param.setCompanyId(ContextUtil.getCompanyId());
|
}
|
if (StringUtils.isEmpty(param.getDeptId())) {
|
param.setDeptId(ContextUtil.subDeptId(null));
|
}
|
|
return basicOrderManager.cleanOrderList(param);
|
}
|
|
}
|