Commit 74abb526 authored by yanzg's avatar yanzg

表结构修改

parent 5aa581f9
......@@ -12,7 +12,6 @@ import com.yanzuoguang.util.helper.JsonHelper;
import com.yanzuoguang.util.helper.StringHelper;
import com.yanzuoguang.util.vo.PageSizeData;
import com.yanzuoguang.util.vo.ResponseResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import javax.servlet.http.HttpServletResponse;
......@@ -28,14 +27,15 @@ import java.util.Date;
@Component
public class YzgExcelService {
@Autowired
private CloudConfig cloudConfig;
private final CloudConfig cloudConfig;
private final YzgFileDao fileDao;
private final YzgFileProcedure fileProcedure;
@Autowired
private YzgFileDao fileDao;
@Autowired
private YzgFileProcedure fileProcedure;
public YzgExcelService(CloudConfig cloudConfig, YzgFileDao fileDao, YzgFileProcedure fileProcedure) {
this.cloudConfig = cloudConfig;
this.fileDao = fileDao;
this.fileProcedure = fileProcedure;
}
/**
* 创建文件,不需要开启事务
......@@ -51,13 +51,12 @@ public class YzgExcelService {
fileDao.create(load);
}
// 生成回调参数
String serverFile = getServerPath(load);
String serverAbsolutePath = getServerAbsolutePath(load);
YzgFileCallbackReqVo callbackReq = new YzgFileCallbackReqVo(
fileReq.getFileId(), fileReq.getCompanyId(),
fileReq.getCallbackMQ(), fileReq.getCallbackParameter(),
serverFile
serverAbsolutePath
);
// 判断文件状态
int fileStatus = StringHelper.toInt(load.getFileStatus());
switch (fileStatus) {
......@@ -80,11 +79,11 @@ public class YzgExcelService {
fileProcedure.fileCreateDelay(json);
break;
default:
return;
break;
}
} catch (CodeException ex) {
if (fileReq != null && !StringHelper.isEmpty(fileReq.getFileId())) {
ResponseResult error = ExceptionHelper.getError(ex);
ResponseResult<?> error = ExceptionHelper.getError(ex);
fileDao.updateStatus(new YzgFileStatusReqVo(fileReq.getFileId(), fileReq.getCompanyId(), error.getMessage()));
}
}
......@@ -173,9 +172,13 @@ public class YzgExcelService {
}
private String getServerPath(YzgFileVo load) {
return String.format("%s/%s", cloudConfig.getServerUrl(), getServerAbsolutePath(load));
}
private String getServerAbsolutePath(YzgFileVo load) {
Date date = DateHelper.getDateTime(load.getCreateDate());
// 获取临时文件路径
String tempFolder = cloudConfig.getTempFolder(load.getCompanyId(), date);
return String.format("%s/%s/%s.xlsx", cloudConfig.getServerUrl(), tempFolder, load.getFileId());
return String.format("%s/%s.xlsx", tempFolder, load.getFileId());
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment