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.SysDictData;
|
import com.ruoyi.common.core.domain.entity.SysUser;
|
import com.ruoyi.common.utils.StringUtils;
|
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;
|
|
@Autowired
|
private ISysUserService userService;
|
|
/**
|
* 根据字典类型获取字典列表
|
*
|
* @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);
|
}
|
}
|