package com.fzzy.igds;
|
|
import com.bstek.dorado.annotation.DataProvider;
|
import com.bstek.dorado.annotation.Expose;
|
import com.fzzy.common.utils.Base64Util;
|
import com.fzzy.igds.domain.FileInfo;
|
import com.fzzy.igds.service.FileService;
|
import com.fzzy.igds.utils.ContextUtil;
|
import lombok.extern.slf4j.Slf4j;
|
import org.springframework.stereotype.Component;
|
import javax.annotation.Resource;
|
import java.util.HashMap;
|
import java.util.List;
|
import java.util.Map;
|
|
/**
|
* @Description 文件上传
|
* @Author CZT
|
* @Date 2025/11/29 11:02
|
*/
|
@Slf4j
|
@Component
|
public class FilePR {
|
|
@Resource
|
private FileService fileService;
|
|
/**
|
* filePR#parseExcel
|
*
|
* @param fileName
|
* @return
|
*/
|
@Expose
|
public String parseExcel(String fileName) {
|
return fileName;
|
}
|
|
/**
|
* filePR#listFile 根据条件获取列表数据
|
*
|
* @param bizId
|
* @param bizId
|
* @return
|
*/
|
@DataProvider
|
public List<FileInfo> listFile(String bizId) {
|
if (null == bizId){
|
return null;
|
}
|
|
return fileService.listFile(ContextUtil.getCompanyId(),ContextUtil.subDeptId(null), bizId, null);
|
}
|
|
/**
|
*
|
* filePR#getImg
|
* 获取图片信息
|
*
|
* @param file
|
* @return
|
*/
|
@Expose
|
public Map<String, String> getImg(FileInfo file) {
|
Map<String, String> result = new HashMap<String, String>();
|
result.put("code", "SUCCESS");
|
String basePath = fileService.getFileSavePath("COMMON");
|
|
String imgData = Base64Util.getImageStr(basePath + file.getFileName());
|
|
if (null == imgData) {
|
result.put("code", "ERROR");
|
}
|
result.put("data", imgData);
|
return result;
|
}
|
|
}
|