jiazx0107@163.com
2023-11-06 69cd9f59a0fabf12f8c9147fcba7f69817a870b3
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
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);
    }
 
}