sgj
2026-03-02 abeb8c05479f200448197c7e6d9fc0d39bee08b3
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
115
116
117
package com.fzzy.security;
 
 
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fzzy.common.manager.CommonManager;
import com.fzzy.igds.constant.Constant;
import com.fzzy.igds.constant.RespCodeEnum;
import com.fzzy.igds.data.IgdsBaseParam;
import com.fzzy.igds.data.PageResponse;
import com.fzzy.igds.domain.Company;
import com.fzzy.igds.domain.Dept;
import com.fzzy.igds.domain.WeighbridgeSnap;
import com.fzzy.igds.service.InoutConfService;
import com.fzzy.igds.utils.ContextUtil;
import com.fzzy.security.manager.WeighbridgeSnapManager;
import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.utils.StringUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.*;
 
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
 
@Slf4j
@Controller
@RequestMapping("/security/weighbridgeSnap")
public class WeighbridgeSnapController {
 
 
    private static final String prefix = "security";
 
    @Resource
    private WeighbridgeSnapManager weighbridgeSnapManager;
 
    @Resource
    private CommonManager commonManager;
 
    @Resource
    private InoutConfService inoutConfService;
 
 
    /**
     * 获取地磅抓拍页面
     *
     * @param viewType
     * @param model
     * @author sgj
     * @since 2026/02/25
     */
    @GetMapping
    public String getWeighbridgeSnap(@RequestParam(value = "viewType", required = false) String viewType, Model model) {
        //获取当前登录人
        SysUser user = ContextUtil.getLoginUser();
        //获取公司数据
        List<Company> companies = commonManager.listCompanyData();
        String defaultCompany = "";
        if (companies != null && !companies.isEmpty()) {
            defaultCompany = companies.get(0).getId();
        }
        //获取库区数据
        List<Dept> depts = new ArrayList<>();
        String defaultDeptId = "";
        if (Constant.USER_TYPE_30.equals(user.getUserType())) {
            depts = commonManager.listDeptData(null);
            defaultDeptId = user.getDeptId() + "";
        } else {
            depts = commonManager.listDeptData(defaultCompany);
            //在首位添加所有选项
            Dept all = new Dept();
            all.setId("");
            all.setKqmc("所有");
            depts.add(0, all);
        }
        IgdsBaseParam param = new IgdsBaseParam();
        param.setPage(1);
        param.setLimit(8);
        param.setKey(defaultCompany);
        param.setDeptId(defaultDeptId);
        Page<WeighbridgeSnap> events = weighbridgeSnapManager.pageData(param);
        model.addAttribute("weighbridgeSnapList", events.getRecords());
        model.addAttribute("currentPage", events.getCurrent());
        model.addAttribute("totalItems", events.getTotal());
        model.addAttribute("pageSize", events.getSize());
        if (StringUtils.isEmpty(viewType)) {
            // 1 安防页面  2 监管页面
            viewType = "1";
        }
        //页面展示类型
        model.addAttribute("viewType", viewType);
        //设备数据
        model.addAttribute("cameraList", inoutConfService.getInoutConfList(null,null));
        //库区数据
        model.addAttribute("deptList", depts);
        model.addAttribute("defaultDeptId", defaultDeptId);
        //公司数据
        model.addAttribute("companyList", companies);
        model.addAttribute("defaultCompany", defaultCompany);
        return prefix + "/weighbridgeSnap";
    }
 
    /**
     * 分页获取数据
     *
     * @param param
     * @return
     */
    @RequestMapping("/pageData")
    @ResponseBody
    public PageResponse<Page<WeighbridgeSnap>> pageData(@RequestBody IgdsBaseParam param) {
        Page<WeighbridgeSnap> weighbridgeSnapPage = weighbridgeSnapManager.pageData(param);
        return new PageResponse<>(RespCodeEnum.CODE_0000, weighbridgeSnapPage);
    }
 
}