package com.fzzy.igds.dzhwk.manager;
|
|
import com.fzzy.igds.dzhwk.data.DzhwkConfigData;
|
import com.fzzy.igds.dzhwk.data.HwkDepotDto;
|
import com.fzzy.igds.dzhwk.domain.Depot;
|
import com.fzzy.igds.dzhwk.domain.Dept;
|
import com.fzzy.igds.dzhwk.domain.HScreenSer;
|
import com.fzzy.igds.dzhwk.service.ScreenSerService;
|
import com.fzzy.igds.file.FileService;
|
import com.fzzy.igds.sys.CoreDeptService;
|
import com.fzzy.igds.sys.DepotService;
|
import com.ruoyi.common.config.FrameworkConfig;
|
import com.ruoyi.common.utils.StringUtils;
|
import lombok.extern.slf4j.Slf4j;
|
import org.springframework.stereotype.Component;
|
|
import javax.annotation.Resource;
|
import java.io.File;
|
import java.util.List;
|
|
/**
|
* @Description
|
* @Author CZT
|
* @Date 2025/6/3 16:06
|
*/
|
@Slf4j
|
@Component("WebManager")
|
public class WebManager {
|
|
@Resource
|
private CoreDeptService coreDeptService;
|
@Resource
|
private FileService fileService;
|
@Resource
|
private DzhwkConfigData dzhwkConfigData;
|
@Resource
|
private ScreenSerService screenSerService;
|
@Resource
|
private DepotService depotService;
|
|
|
/**
|
* 根据单位ID获取单位信息
|
*
|
* @param deptId
|
* @return
|
*/
|
public Dept getDeptFile(String deptId) {
|
if (StringUtils.isEmpty(deptId)) {
|
return null;
|
}
|
Dept dept = coreDeptService.getDataById(deptId);
|
dept.setImgFilePath("未上传");
|
if (StringUtils.isNotEmpty(dept.getFileId())) {
|
String imgBathPath = fileService.getDeptFilePath(dept.getCompanyId()) + dept.getFileId();
|
File imgFile = new File(imgBathPath);
|
if (imgFile.exists()) {
|
imgBathPath = imgBathPath.replace(dzhwkConfigData.getProfile(), "/profile/");
|
dept.setImgFilePath(imgBathPath);
|
}
|
}
|
|
dept.setVideoFilePath("未上传");
|
if (StringUtils.isNotEmpty(dept.getVideoId())) {
|
String imgBathPath = fileService.getDeptFilePath(dept.getCompanyId()) + dept.getVideoId();
|
File imgFile = new File(imgBathPath);
|
if (imgFile.exists()) {
|
imgBathPath = imgBathPath.replace(dzhwkConfigData.getProfile(), "/profile/");
|
dept.setVideoFilePath(imgBathPath);
|
}
|
}
|
return dept;
|
}
|
|
/**
|
*
|
* @param sid
|
* @return
|
*/
|
public List<Depot> getDepotsByGid(String sid) {
|
|
if(StringUtils.isEmpty(sid)){
|
return null;
|
}
|
//获取sid对应的廒间信息;
|
HScreenSer screenSer = screenSerService.getDataBySn(sid);
|
|
if(null == screenSer || StringUtils.isEmpty(screenSer.getAjdh())){
|
return null;
|
}
|
List<Depot> list = depotService.getCacheByAjdn(screenSer.getCompanyId(), screenSer.getAjdh());
|
if(null == list || list.isEmpty()){
|
return null;
|
}
|
|
return list;
|
}
|
}
|