package com.ld.igds.file;
|
|
import com.bstek.dorado.annotation.DataProvider;
|
import com.bstek.dorado.annotation.Expose;
|
import com.ld.igds.file.dto.FileData;
|
import com.ld.igds.models.FileInfo;
|
import com.ld.igds.util.Base64Util;
|
import com.ld.igds.util.ContextUtil;
|
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.stereotype.Component;
|
|
import java.util.HashMap;
|
import java.util.List;
|
import java.util.Map;
|
|
/**
|
*
|
* @author: andy.jia
|
* @description:
|
* @version:
|
* @data:2020年6月24日
|
*
|
*/
|
@Component("sys.fileManager")
|
public class FileManager {
|
|
@Autowired
|
private CoreFileService fileService;
|
|
/**
|
* sys.fileManager#parseExcel
|
*
|
* @param fileName
|
* @return
|
*/
|
@Expose
|
public String parseExcel(String fileName) {
|
return fileName;
|
}
|
|
/**
|
* sys.fileManager#listFile 根据条件获取列表数据
|
*
|
* @param bizId
|
* @param bizId
|
* @return
|
*/
|
@DataProvider
|
public List<FileData> listFile(String bizId) {
|
if (null == bizId)
|
return null;
|
String companyId = ContextUtil.getCompanyId();
|
return fileService.listFile(companyId, bizId);
|
}
|
|
/**
|
*
|
* sys.fileManager#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.getCommonFilePath(file.getCreateTime());
|
|
String imgData = Base64Util.getImageStr(basePath + file.getFileName());
|
|
if (null == imgData) {
|
result.put("code", "ERROR");
|
}
|
result.put("data", imgData);
|
return result;
|
}
|
|
}
|