czt
10 小时以前 85c867db36989f6ec7fe3962fad72665bc97d2ed
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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
package com.fzzy.sys.manager.common;
 
import com.fzzy.igds.constant.DepotType;
import com.fzzy.igds.domain.Depot;
import com.fzzy.igds.domain.Dept;
import com.fzzy.igds.service.CoreDeptService;
import com.fzzy.igds.service.DepotService;
import com.fzzy.igds.service.DicService;
import com.fzzy.igds.utils.ContextUtil;
import com.ruoyi.common.core.domain.entity.SysDept;
import com.ruoyi.common.core.domain.entity.SysDictData;
import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.system.service.ISysDeptService;
import com.ruoyi.system.service.ISysUserService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
 
import javax.annotation.Resource;
import java.util.List;
 
/**
 * @Description
 * @Author CZT
 * @Date 2025/11/29 15:19
 */
@Slf4j
@Component
public class CommonManager {
 
    @Resource
    private DepotService depotService;
    @Resource
    private DicService dicService;
    @Resource
    private CoreDeptService coreDeptService;
 
    @Resource
    private ISysUserService userService;
    @Resource
    private ISysDeptService iSysDeptService;
 
    /**
     * 根据库区编码获取库区下所有仓库列表
     *
     * @param id
     * @return
     */
    public SysDept getDeptById(String id) {
 
        return iSysDeptService.selectDeptById(Long.valueOf(id));
    }
 
    /**
     * 获取库区鸟瞰图
     * @param deptId
     * @return
     */
    public String getDeptImg(String deptId) {
 
        String imgPath = "/img/deptImg.jpg";   //默认图
        Dept dept = coreDeptService.getDeptById(deptId);
        if(null !=  dept && StringUtils.isNotEmpty(dept.getImgPath())){
            imgPath =  dept.getImgPath();
        }
        return imgPath;
    }
 
    /**
     * 根据字典类型获取字典列表
     *
     * @param parentCode
     * @param companyId
     * @return
     */
    public List<SysDictData> getDicTrigger(String parentCode, String companyId) {
        return dicService.getDictDataByType(parentCode, companyId);
    }
 
    /**
     * 根据库区编码获取库区下所有仓库列表
     *
     * @param deptId
     * @return
     */
    public List<Depot> listDepotByDeptId(String deptId) {
 
        if (StringUtils.isEmpty(deptId)) {
            deptId = ContextUtil.subDeptId(null);
        }
 
        return depotService.getCacheDepotList(ContextUtil.getCompanyId(), deptId);
    }
 
    /**
     * @return
     */
    public List<SysDictData> getInoutType() {
        return dicService.getInoutType();
    }
 
 
    /**
     * 获取分库列表
     *
     * @author sgj
     * @date 2025/12/12
     */
    public List<Dept> listDeptData() {
        return coreDeptService.getDeptData();
    }
 
    /**
     * 根据仓库编码获取仓库类型
     *
     * @param depotId
     * @return
     */
    public String getDepotTypeById(String depotId) {
        String depotType = DepotType.TYPE_01.getCode();
 
        Depot depot = depotService.getCacheDepot(ContextUtil.getCompanyId(), depotId);
        if (null != depot && StringUtils.isNotEmpty(depot.getDepotType())) {
            depotType = depot.getDepotType();
        }
 
        return depotType;
    }
 
    /**
     * 获取用户列表
     *
     * @author sgj
     * @date 2025/12/12
     */
    public List<SysUser>  listUserData() {
        SysUser user = new SysUser() ;
        user.setCompanyId(ContextUtil.getCompanyId());
        user.setDeptId(Long.valueOf(ContextUtil.subDeptId(null)));
        return userService.selectUserList(user);
    }
}