Commit 74abb526 authored by yanzg's avatar yanzg

表结构修改

parent 5aa581f9
...@@ -12,7 +12,6 @@ import com.yanzuoguang.util.helper.JsonHelper; ...@@ -12,7 +12,6 @@ import com.yanzuoguang.util.helper.JsonHelper;
import com.yanzuoguang.util.helper.StringHelper; import com.yanzuoguang.util.helper.StringHelper;
import com.yanzuoguang.util.vo.PageSizeData; import com.yanzuoguang.util.vo.PageSizeData;
import com.yanzuoguang.util.vo.ResponseResult; import com.yanzuoguang.util.vo.ResponseResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
...@@ -28,14 +27,15 @@ import java.util.Date; ...@@ -28,14 +27,15 @@ import java.util.Date;
@Component @Component
public class YzgExcelService { public class YzgExcelService {
@Autowired private final CloudConfig cloudConfig;
private CloudConfig cloudConfig; private final YzgFileDao fileDao;
private final YzgFileProcedure fileProcedure;
@Autowired public YzgExcelService(CloudConfig cloudConfig, YzgFileDao fileDao, YzgFileProcedure fileProcedure) {
private YzgFileDao fileDao; this.cloudConfig = cloudConfig;
this.fileDao = fileDao;
@Autowired this.fileProcedure = fileProcedure;
private YzgFileProcedure fileProcedure; }
/** /**
* 创建文件,不需要开启事务 * 创建文件,不需要开启事务
...@@ -51,13 +51,12 @@ public class YzgExcelService { ...@@ -51,13 +51,12 @@ public class YzgExcelService {
fileDao.create(load); fileDao.create(load);
} }
// 生成回调参数 // 生成回调参数
String serverFile = getServerPath(load); String serverAbsolutePath = getServerAbsolutePath(load);
YzgFileCallbackReqVo callbackReq = new YzgFileCallbackReqVo( YzgFileCallbackReqVo callbackReq = new YzgFileCallbackReqVo(
fileReq.getFileId(), fileReq.getCompanyId(), fileReq.getFileId(), fileReq.getCompanyId(),
fileReq.getCallbackMQ(), fileReq.getCallbackParameter(), fileReq.getCallbackMQ(), fileReq.getCallbackParameter(),
serverFile serverAbsolutePath
); );
// 判断文件状态 // 判断文件状态
int fileStatus = StringHelper.toInt(load.getFileStatus()); int fileStatus = StringHelper.toInt(load.getFileStatus());
switch (fileStatus) { switch (fileStatus) {
...@@ -80,11 +79,11 @@ public class YzgExcelService { ...@@ -80,11 +79,11 @@ public class YzgExcelService {
fileProcedure.fileCreateDelay(json); fileProcedure.fileCreateDelay(json);
break; break;
default: default:
return; break;
} }
} catch (CodeException ex) { } catch (CodeException ex) {
if (fileReq != null && !StringHelper.isEmpty(fileReq.getFileId())) { 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())); fileDao.updateStatus(new YzgFileStatusReqVo(fileReq.getFileId(), fileReq.getCompanyId(), error.getMessage()));
} }
} }
...@@ -173,9 +172,13 @@ public class YzgExcelService { ...@@ -173,9 +172,13 @@ public class YzgExcelService {
} }
private String getServerPath(YzgFileVo load) { 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()); Date date = DateHelper.getDateTime(load.getCreateDate());
// 获取临时文件路径 // 获取临时文件路径
String tempFolder = cloudConfig.getTempFolder(load.getCompanyId(), date); 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