|
|
|
@ -3,6 +3,7 @@ package com.glxp.api.controller.sync;
|
|
|
|
|
import cn.hutool.core.collection.CollUtil;
|
|
|
|
|
import cn.hutool.core.collection.CollectionUtil;
|
|
|
|
|
import cn.hutool.core.lang.Dict;
|
|
|
|
|
import cn.hutool.core.util.IdUtil;
|
|
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
|
|
import cn.hutool.json.JSONObject;
|
|
|
|
|
import cn.hutool.json.JSONUtil;
|
|
|
|
@ -43,6 +44,7 @@ import com.glxp.api.service.sync.BasicDownloadService;
|
|
|
|
|
import com.glxp.api.service.sync.BasicExportService;
|
|
|
|
|
import com.glxp.api.service.sync.SpsSyncDownloadService;
|
|
|
|
|
import com.glxp.api.util.CustomUtil;
|
|
|
|
|
import com.glxp.api.util.DateUtil;
|
|
|
|
|
import com.glxp.api.util.JsonUtils;
|
|
|
|
|
import io.swagger.annotations.Api;
|
|
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
|
@ -52,6 +54,7 @@ import org.apache.ibatis.session.SqlSession;
|
|
|
|
|
import org.apache.ibatis.session.SqlSessionFactory;
|
|
|
|
|
import org.apache.ibatis.session.TransactionIsolationLevel;
|
|
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
|
|
|
import org.springframework.web.bind.annotation.PostMapping;
|
|
|
|
@ -60,9 +63,7 @@ import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
|
import javax.validation.Valid;
|
|
|
|
|
import java.io.FileNotFoundException;
|
|
|
|
|
import java.io.FileReader;
|
|
|
|
|
import java.io.IOException;
|
|
|
|
|
import java.io.*;
|
|
|
|
|
import java.util.Date;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
|
@ -323,6 +324,8 @@ public class SpsSyncDownloadController {
|
|
|
|
|
return baseResponse;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Value("${file_path}")
|
|
|
|
|
private String filePrefix;
|
|
|
|
|
|
|
|
|
|
@ApiOperation("上传同步数据")
|
|
|
|
|
@PostMapping("sps/sync/upload/data")
|
|
|
|
@ -363,6 +366,8 @@ public class SpsSyncDownloadController {
|
|
|
|
|
.idDatas(upLoadRequest.getExportType().getKey())
|
|
|
|
|
.scheduleType(1)
|
|
|
|
|
.build();
|
|
|
|
|
String fileFullPath = writeFile(filePrefix, upLoadRequest.getExportType().getRemark(), JSONUtil.toJsonStr(upLoadRequest.getData()));
|
|
|
|
|
downloadStatus.setCacheFilePath(fileFullPath);
|
|
|
|
|
basicDownloadService.insertDownloadStatus(downloadStatus);
|
|
|
|
|
return ResultVOUtils.success();
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
@ -372,6 +377,27 @@ public class SpsSyncDownloadController {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private String writeFile(String filePath, String fileDesc, String content) throws IOException {
|
|
|
|
|
filePath = String.format("%s/%s", filePath, DateUtil.getDate());
|
|
|
|
|
String fileFullPath = String.format("%s/%s-%s.udi", filePath, fileDesc, IdUtil.fastSimpleUUID());
|
|
|
|
|
File file = new File(filePath);
|
|
|
|
|
if (!file.exists()) {
|
|
|
|
|
file.mkdirs();
|
|
|
|
|
}
|
|
|
|
|
file = new File(fileFullPath);
|
|
|
|
|
while (!file.createNewFile()) {
|
|
|
|
|
fileFullPath = String.format("%s/%s/%s-%s.udi", filePath, DateUtil.getDate(), fileDesc, IdUtil.fastSimpleUUID());
|
|
|
|
|
file = new File(fileFullPath);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
FileWriter fileWriter = new FileWriter(file);
|
|
|
|
|
fileWriter.write(content);
|
|
|
|
|
fileWriter.flush();
|
|
|
|
|
fileWriter.close();
|
|
|
|
|
return fileFullPath;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private final SystemParamConfigDao systemParamConfigDao;
|
|
|
|
|
private final EntrustReceDao entrustReceDao;
|
|
|
|
|
private final SystemPDFModuleDao systemPDFModuleDao;
|
|
|
|
|