解决合并冲突
This commit is contained in:
commit
1bc5ab6c4d
|
|
@ -5,12 +5,12 @@ import com.electromagnetic.industry.software.data.manage.request.indicator.EDDat
|
||||||
import electromagnetic.data.framework.share.model.ElectromagneticResult;
|
import electromagnetic.data.framework.share.model.ElectromagneticResult;
|
||||||
import electromagnetic.data.framework.share.model.ElectromagneticResultUtil;
|
import electromagnetic.data.framework.share.model.ElectromagneticResultUtil;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
import org.springframework.web.bind.annotation.RequestMethod;
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
@RequestMapping("/data/ed/file")
|
@RequestMapping("/data/ed/file")
|
||||||
@RestController
|
@RestController
|
||||||
|
|
@ -33,16 +33,29 @@ public class EDDataController {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ApiOperation(value = "更新文件占用状态",notes = "")
|
@ApiOperation(value = "更新文件信息",notes = "")
|
||||||
@RequestMapping(value = "/updateFileStatus",method = RequestMethod.POST)
|
@RequestMapping(value = "/updateFileInfo",method = RequestMethod.POST)
|
||||||
public ElectromagneticResult<?> updateFileStatus(@RequestBody EDDataRequest request){
|
public ElectromagneticResult<?> updateFileInfo(@RequestBody EDDataRequest request){
|
||||||
return edDataFacade.updateFileStatus(request);
|
return edDataFacade.updateFileInfo(request);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ApiOperation(value = "获取子文件数量",notes = "")
|
||||||
|
@RequestMapping(value = "/getChildFileCount",method = RequestMethod.POST)
|
||||||
|
public ElectromagneticResult<?> getChildFileCount(@RequestBody EDDataRequest request){
|
||||||
|
return edDataFacade.getChildFileCount(request);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ApiOperation(value = "上传",notes = "")
|
@ApiOperation(value = "上传",notes = "")
|
||||||
@RequestMapping(value = "/upload",method = RequestMethod.POST)
|
@RequestMapping(value = "/upload", consumes = "multipart/form-data",method = RequestMethod.POST)
|
||||||
public ElectromagneticResult<?> upload(@RequestBody EDDataRequest request){
|
public ElectromagneticResult<?> upload(@RequestParam("parentId") String parentId,
|
||||||
|
@RequestParam("file") MultipartFile file,
|
||||||
|
@RequestParam("gmtBatchUpload") Long gmtBatchUpload){
|
||||||
|
EDDataRequest request = new EDDataRequest();
|
||||||
|
request.setParentId(parentId);
|
||||||
|
request.setFileData(file);
|
||||||
|
request.setGmtBatchUpload(new Date(gmtBatchUpload));
|
||||||
return edDataFacade.upload(request);
|
return edDataFacade.upload(request);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -61,10 +74,4 @@ public class EDDataController {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ApiOperation(value = "重命名",notes = "")
|
|
||||||
@RequestMapping(value = "/rename",method = RequestMethod.POST)
|
|
||||||
public ElectromagneticResult<?> rename(@RequestBody EDDataRequest request){
|
|
||||||
return ElectromagneticResultUtil.success("重命名");
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -53,6 +53,22 @@ public class EDDataInfo {
|
||||||
* 状态:publish:发布,occupy:占用
|
* 状态:publish:发布,occupy:占用
|
||||||
*/
|
*/
|
||||||
private String dataStatus;
|
private String dataStatus;
|
||||||
|
/**
|
||||||
|
* 备注
|
||||||
|
*/
|
||||||
|
private String note;
|
||||||
|
/**
|
||||||
|
* 编辑人
|
||||||
|
*/
|
||||||
|
private String editor;
|
||||||
|
/**
|
||||||
|
* 批量上传时间
|
||||||
|
*/
|
||||||
|
private Date gmtBatchUpload;
|
||||||
|
/**
|
||||||
|
* 保存状态
|
||||||
|
*/
|
||||||
|
private String saveStatus;
|
||||||
/**
|
/**
|
||||||
* 创建人
|
* 创建人
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,10 @@
|
||||||
package com.electromagnetic.industry.software.data.manage.domain.boardservice.indicator.parames;
|
package com.electromagnetic.industry.software.data.manage.domain.boardservice.indicator.parames;
|
||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
public class EDDataParams implements Serializable {
|
public class EDDataParams implements Serializable {
|
||||||
|
|
@ -18,21 +20,49 @@ public class EDDataParams implements Serializable {
|
||||||
/**
|
/**
|
||||||
* 上级文件夹数据码,为空是顶级
|
* 上级文件夹数据码,为空是顶级
|
||||||
*/
|
*/
|
||||||
private Long parentId;
|
private String parentId;
|
||||||
/**
|
|
||||||
* 文件夹名称
|
|
||||||
*/
|
|
||||||
private String name;
|
|
||||||
/**
|
|
||||||
* 关键词
|
|
||||||
*/
|
|
||||||
private String keyWord;
|
|
||||||
/**
|
/**
|
||||||
* 文件数据编码
|
* 文件数据编码
|
||||||
*/
|
*/
|
||||||
private String dataId;
|
private String dataId;
|
||||||
|
/**
|
||||||
|
* 文件夹名称
|
||||||
|
*/
|
||||||
|
private String name;
|
||||||
|
/**
|
||||||
|
* 创建日期排序
|
||||||
|
*/
|
||||||
|
private String gmtCreate;
|
||||||
/**
|
/**
|
||||||
* 文件数据状态
|
* 文件数据状态
|
||||||
*/
|
*/
|
||||||
private String dataStatus;
|
private String dataStatus;
|
||||||
|
/**
|
||||||
|
* 备注
|
||||||
|
*/
|
||||||
|
private String note;
|
||||||
|
/**
|
||||||
|
* 是否有效
|
||||||
|
*/
|
||||||
|
private String effectFlag;
|
||||||
|
/**
|
||||||
|
* 关键词
|
||||||
|
*/
|
||||||
|
private String keyWord;
|
||||||
|
/**
|
||||||
|
* 批量上传时间
|
||||||
|
*/
|
||||||
|
private Date gmtBatchUpload;
|
||||||
|
/**
|
||||||
|
* 保存状态
|
||||||
|
*/
|
||||||
|
private String saveStatus;
|
||||||
|
/**
|
||||||
|
* 文件数据编码数组
|
||||||
|
*/
|
||||||
|
private String[] dataIdArr;
|
||||||
|
/**
|
||||||
|
* 文件数据
|
||||||
|
*/
|
||||||
|
private MultipartFile fileData;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,8 @@ import com.electromagnetic.industry.software.data.manage.domain.boardservice.ind
|
||||||
import com.electromagnetic.industry.software.data.manage.domain.boardservice.indicator.parames.EDDataParams;
|
import com.electromagnetic.industry.software.data.manage.domain.boardservice.indicator.parames.EDDataParams;
|
||||||
import com.github.pagehelper.PageInfo;
|
import com.github.pagehelper.PageInfo;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author
|
* @author
|
||||||
* @version $Id: EDDataRepos.java, v 0.1 2024-07-29 19:02
|
* @version $Id: EDDataRepos.java, v 0.1 2024-07-29 19:02
|
||||||
|
|
@ -14,32 +16,32 @@ import com.github.pagehelper.PageInfo;
|
||||||
public interface EDDataRepository {
|
public interface EDDataRepository {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 创建文件夹
|
* 创建文件/文件夹数据信息
|
||||||
* @param edDataInfo
|
* @param edDataInfo
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
Boolean createFolder(EDDataInfo edDataInfo);
|
Boolean createDataInfo(EDDataInfo edDataInfo);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取文件信息列表
|
* 获取文件信息列表
|
||||||
* @param parames
|
* @param parames
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
PageInfo<EDDataInfo> getDataInfoList(EDDataParams parames);
|
List<EDDataInfo> getDataInfoList(EDDataParams parames);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 更新文件占用状态
|
* 获取文件信息
|
||||||
* @param parames
|
* @param parames
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
Boolean updateFileStatus(EDDataParams parames);
|
EDDataInfo getDataInfo(EDDataParams parames);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 上传
|
* 更新文件信息
|
||||||
* @param parames
|
* @param parames
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
Boolean upload(EDDataParams parames);
|
Boolean updateFileInfo(EDDataParams parames);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 下载
|
* 下载
|
||||||
|
|
|
||||||
|
|
@ -7,11 +7,11 @@ import com.electromagnetic.industry.software.data.manage.domain.boardservice.ind
|
||||||
public interface EDDataService {
|
public interface EDDataService {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 创建文件夹
|
* 创建文件/文件夹数据信息
|
||||||
* @param edDataInfo
|
* @param edDataInfo
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
Boolean createFolder(EDDataInfo edDataInfo);
|
Boolean createDataInfo(EDDataInfo edDataInfo);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取文件信息列表
|
* 获取文件信息列表
|
||||||
|
|
@ -21,18 +21,25 @@ public interface EDDataService {
|
||||||
EDDataPage getDataInfoList(EDDataParams parames);
|
EDDataPage getDataInfoList(EDDataParams parames);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 更新文件占用状态
|
* 获取文件信息
|
||||||
* @param parames
|
* @param parames
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
Boolean updateFileStatus(EDDataParams parames);
|
EDDataInfo getDataInfo(EDDataParams parames);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 上传
|
* 更新文件信息
|
||||||
* @param parames
|
* @param parames
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
Boolean upload(EDDataParams parames);
|
Boolean updateFileInfo(EDDataParams parames);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取子文件数量
|
||||||
|
* @param parames
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
Integer getChildFileCount(EDDataParams parames);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 下载
|
* 下载
|
||||||
|
|
@ -41,4 +48,18 @@ public interface EDDataService {
|
||||||
*/
|
*/
|
||||||
Boolean download(EDDataParams parames);
|
Boolean download(EDDataParams parames);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 检查文件夹是否存在
|
||||||
|
* @param path
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
Boolean checkFolderIsExist(String path);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建多级目录
|
||||||
|
* @param path
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
Boolean createMultiLevelDirectory(String path);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,11 +3,13 @@
|
||||||
*/
|
*/
|
||||||
package com.electromagnetic.industry.software.data.manage.domain.boardservice.indicator.service.impl;
|
package com.electromagnetic.industry.software.data.manage.domain.boardservice.indicator.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.poi.excel.cell.CellSetter;
|
||||||
import com.electromagnetic.industry.software.data.manage.domain.boardservice.indicator.model.EDDataInfo;
|
import com.electromagnetic.industry.software.data.manage.domain.boardservice.indicator.model.EDDataInfo;
|
||||||
import com.electromagnetic.industry.software.data.manage.domain.boardservice.indicator.model.EDDataPage;
|
import com.electromagnetic.industry.software.data.manage.domain.boardservice.indicator.model.EDDataPage;
|
||||||
import com.electromagnetic.industry.software.data.manage.domain.boardservice.indicator.parames.EDDataParams;
|
import com.electromagnetic.industry.software.data.manage.domain.boardservice.indicator.parames.EDDataParams;
|
||||||
import com.electromagnetic.industry.software.data.manage.domain.boardservice.indicator.repository.EDDataRepository;
|
import com.electromagnetic.industry.software.data.manage.domain.boardservice.indicator.repository.EDDataRepository;
|
||||||
import com.electromagnetic.industry.software.data.manage.domain.boardservice.indicator.service.EDDataService;
|
import com.electromagnetic.industry.software.data.manage.domain.boardservice.indicator.service.EDDataService;
|
||||||
|
import com.github.pagehelper.PageHelper;
|
||||||
import com.github.pagehelper.PageInfo;
|
import com.github.pagehelper.PageInfo;
|
||||||
import electromagnetic.data.framework.share.exception.LoggerConstant;
|
import electromagnetic.data.framework.share.exception.LoggerConstant;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
|
|
@ -15,6 +17,10 @@ import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.nio.file.Files;
|
||||||
|
import java.nio.file.Paths;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author
|
* @author
|
||||||
|
|
@ -30,13 +36,13 @@ public class EDDataServiceImpl implements EDDataService {
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 创建文件夹
|
* 创建文件/文件夹数据信息
|
||||||
* @param edDataInfo
|
* @param edDataInfo
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public Boolean createFolder(EDDataInfo edDataInfo)
|
public Boolean createDataInfo(EDDataInfo edDataInfo)
|
||||||
{
|
{
|
||||||
edDataRepository.createFolder(edDataInfo);
|
edDataRepository.createDataInfo(edDataInfo);
|
||||||
return Boolean.TRUE;
|
return Boolean.TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -47,33 +53,59 @@ public class EDDataServiceImpl implements EDDataService {
|
||||||
*/
|
*/
|
||||||
public EDDataPage getDataInfoList(EDDataParams parames)
|
public EDDataPage getDataInfoList(EDDataParams parames)
|
||||||
{
|
{
|
||||||
|
PageHelper.startPage(parames.getPageIndex(), parames.getPageSize());
|
||||||
|
List<EDDataInfo> edDataInfoList = edDataRepository.getDataInfoList(parames);
|
||||||
|
PageInfo<EDDataInfo> pageInfo = new PageInfo<>(edDataInfoList);
|
||||||
|
|
||||||
EDDataPage edDataPage=new EDDataPage();
|
EDDataPage edDataPage=new EDDataPage();
|
||||||
//数据查询
|
|
||||||
PageInfo<EDDataInfo> pageInfo = edDataRepository.getDataInfoList(parames);
|
|
||||||
edDataPage.setEdDataInfo(pageInfo);
|
edDataPage.setEdDataInfo(pageInfo);
|
||||||
return edDataPage;
|
return edDataPage;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 更新文件占用状态
|
* 获取文件信息
|
||||||
* @param parames
|
* @param parames
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public Boolean updateFileStatus(EDDataParams parames)
|
public EDDataInfo getDataInfo(EDDataParams parames)
|
||||||
{
|
{
|
||||||
edDataRepository.updateFileStatus(parames);
|
return edDataRepository.getDataInfo(parames);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新文件信息
|
||||||
|
* @param parames
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public Boolean updateFileInfo(EDDataParams parames)
|
||||||
|
{
|
||||||
|
edDataRepository.updateFileInfo(parames);
|
||||||
return Boolean.TRUE;
|
return Boolean.TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 上传
|
* 获取子文件数量
|
||||||
* @param parames
|
* @param parames
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public Boolean upload(EDDataParams parames)
|
public Integer getChildFileCount(EDDataParams parames)
|
||||||
{
|
{
|
||||||
edDataRepository.upload(parames);
|
Integer childFileCount = 0;
|
||||||
return Boolean.TRUE;
|
|
||||||
|
List<EDDataInfo> edDataInfoList = edDataRepository.getDataInfoList(parames);
|
||||||
|
for (EDDataInfo edDataInfo : edDataInfoList) {
|
||||||
|
if(edDataInfo.getDataType().equals("folder"))
|
||||||
|
{
|
||||||
|
parames.setParentId(edDataInfo.getDataId());
|
||||||
|
childFileCount += getChildFileCount(parames);
|
||||||
|
}
|
||||||
|
else if(edDataInfo.getDataType().equals("file"))
|
||||||
|
{
|
||||||
|
++childFileCount;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return childFileCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -87,6 +119,30 @@ public class EDDataServiceImpl implements EDDataService {
|
||||||
return Boolean.TRUE;
|
return Boolean.TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 检查文件夹是否存在
|
||||||
|
* @param path
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public Boolean checkFolderIsExist(String path)
|
||||||
|
{
|
||||||
|
return Files.exists(Paths.get(path));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建多级目录
|
||||||
|
* @param path
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public Boolean createMultiLevelDirectory(String path)
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
Files.createDirectories(Paths.get(path));
|
||||||
|
return Boolean.TRUE;
|
||||||
|
} catch (IOException e) {
|
||||||
|
return Boolean.FALSE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -18,6 +18,10 @@
|
||||||
<groupId>com.electromagnetic.data</groupId>
|
<groupId>com.electromagnetic.data</groupId>
|
||||||
<artifactId>electromagnetic-framework</artifactId>
|
<artifactId>electromagnetic-framework</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework</groupId>
|
||||||
|
<artifactId>spring-web</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,9 @@ import com.electromagnetic.industry.software.data.manage.request.indicator.EDDat
|
||||||
import com.electromagnetic.industry.software.data.manage.response.indicator.EDDataPageResponse;
|
import com.electromagnetic.industry.software.data.manage.response.indicator.EDDataPageResponse;
|
||||||
import electromagnetic.data.framework.share.model.ElectromagneticResult;
|
import electromagnetic.data.framework.share.model.ElectromagneticResult;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
public interface EDDataFacade {
|
public interface EDDataFacade {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -22,11 +25,18 @@ public interface EDDataFacade {
|
||||||
ElectromagneticResult<EDDataPageResponse> getDataInfoList(EDDataRequest request);
|
ElectromagneticResult<EDDataPageResponse> getDataInfoList(EDDataRequest request);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 更新文件占用状态
|
* 更新文件信息
|
||||||
* @param request
|
* @param request
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
ElectromagneticResult<Boolean> updateFileStatus(EDDataRequest request);
|
ElectromagneticResult<Boolean> updateFileInfo(EDDataRequest request);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取子文件数量
|
||||||
|
* @param request
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
ElectromagneticResult<Map<String, Integer>> getChildFileCount(EDDataRequest request);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 上传
|
* 上传
|
||||||
|
|
@ -40,6 +50,20 @@ public interface EDDataFacade {
|
||||||
* @param request
|
* @param request
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
ElectromagneticResult<Boolean> download(EDDataRequest request);
|
ElectromagneticResult<Map<String, List<String>>> download(EDDataRequest request);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出
|
||||||
|
* @param request
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
ElectromagneticResult<String> batchExport(EDDataRequest request);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导入
|
||||||
|
* @param request
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
ElectromagneticResult<String> batchImport(EDDataRequest request);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,11 @@
|
||||||
package com.electromagnetic.industry.software.data.manage.request.indicator;
|
package com.electromagnetic.industry.software.data.manage.request.indicator;
|
||||||
|
|
||||||
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
import electromagnetic.data.framework.share.model.BaseRequest;
|
import electromagnetic.data.framework.share.model.BaseRequest;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
public class EDDataRequest extends BaseRequest {
|
public class EDDataRequest extends BaseRequest {
|
||||||
|
|
||||||
|
|
@ -17,21 +20,49 @@ public class EDDataRequest extends BaseRequest {
|
||||||
/**
|
/**
|
||||||
* 上级文件夹数据码,为空是顶级
|
* 上级文件夹数据码,为空是顶级
|
||||||
*/
|
*/
|
||||||
private Long parentId;
|
private String parentId;
|
||||||
/**
|
|
||||||
* 文件夹名称
|
|
||||||
*/
|
|
||||||
private String name;
|
|
||||||
/**
|
|
||||||
* 关键词
|
|
||||||
*/
|
|
||||||
private String keyWord;
|
|
||||||
/**
|
/**
|
||||||
* 文件数据编码
|
* 文件数据编码
|
||||||
*/
|
*/
|
||||||
private String dataId;
|
private String dataId;
|
||||||
|
/**
|
||||||
|
* 文件夹名称
|
||||||
|
*/
|
||||||
|
private String name;
|
||||||
|
/**
|
||||||
|
* 创建日期排序
|
||||||
|
*/
|
||||||
|
private String gmtCreate;
|
||||||
/**
|
/**
|
||||||
* 文件数据状态
|
* 文件数据状态
|
||||||
*/
|
*/
|
||||||
private String dataStatus;
|
private String dataStatus;
|
||||||
|
/**
|
||||||
|
* 备注
|
||||||
|
*/
|
||||||
|
private String note;
|
||||||
|
/**
|
||||||
|
* 是否有效
|
||||||
|
*/
|
||||||
|
private String effectFlag;
|
||||||
|
/**
|
||||||
|
* 关键词
|
||||||
|
*/
|
||||||
|
private String keyWord;
|
||||||
|
/**
|
||||||
|
* 批量上传时间
|
||||||
|
*/
|
||||||
|
private Date gmtBatchUpload;
|
||||||
|
/**
|
||||||
|
* 保存状态
|
||||||
|
*/
|
||||||
|
private String saveStatus;
|
||||||
|
/**
|
||||||
|
* 文件数据编码数组
|
||||||
|
*/
|
||||||
|
private String[] dataIdArr;
|
||||||
|
/**
|
||||||
|
* 文件数据
|
||||||
|
*/
|
||||||
|
private MultipartFile fileData;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,8 @@ package com.electromagnetic.industry.software.data.manage.repository.dao;
|
||||||
|
|
||||||
import com.electromagnetic.industry.software.data.manage.domain.boardservice.indicator.model.EDDataInfo;
|
import com.electromagnetic.industry.software.data.manage.domain.boardservice.indicator.model.EDDataInfo;
|
||||||
import com.electromagnetic.industry.software.data.manage.domain.boardservice.indicator.parames.EDDataParams;
|
import com.electromagnetic.industry.software.data.manage.domain.boardservice.indicator.parames.EDDataParams;
|
||||||
|
import com.electromagnetic.industry.software.data.manage.request.indicator.EDDataRequest;
|
||||||
|
import electromagnetic.data.framework.share.model.ElectromagneticResult;
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
@ -24,11 +26,10 @@ public interface EDDataMapper {
|
||||||
List<EDDataInfo> getDataInfoList(EDDataParams parames);
|
List<EDDataInfo> getDataInfoList(EDDataParams parames);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 更新文件占用状态
|
* 更新文件信息
|
||||||
* @param parames
|
* @param parames
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
Boolean updateFileStatus(EDDataParams parames);
|
Boolean updateFileInfo(EDDataParams parames);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -25,13 +25,13 @@ public class EDDataRepositoryImpl implements EDDataRepository {
|
||||||
private EDDataMapper edDataMapper;
|
private EDDataMapper edDataMapper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 创建文件夹
|
* 创建文件/文件夹数据信息
|
||||||
*
|
*
|
||||||
* @param edDataInfo
|
* @param edDataInfo
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Boolean createFolder(EDDataInfo edDataInfo)
|
public Boolean createDataInfo(EDDataInfo edDataInfo)
|
||||||
{
|
{
|
||||||
return edDataMapper.createDataInfo(edDataInfo);
|
return edDataMapper.createDataInfo(edDataInfo);
|
||||||
}
|
}
|
||||||
|
|
@ -42,35 +42,35 @@ public class EDDataRepositoryImpl implements EDDataRepository {
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public PageInfo<EDDataInfo> getDataInfoList(EDDataParams parames)
|
public List<EDDataInfo> getDataInfoList(EDDataParams parames)
|
||||||
|
{
|
||||||
|
return edDataMapper.getDataInfoList(parames);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取文件信息
|
||||||
|
* @param parames
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public EDDataInfo getDataInfo(EDDataParams parames)
|
||||||
{
|
{
|
||||||
PageHelper.startPage(parames.getPageIndex(), parames.getPageSize());
|
|
||||||
List<EDDataInfo> edDataInfoList=edDataMapper.getDataInfoList(parames);
|
List<EDDataInfo> edDataInfoList=edDataMapper.getDataInfoList(parames);
|
||||||
return new PageInfo<>(edDataInfoList);
|
if(edDataInfoList.size()>0)
|
||||||
|
return edDataInfoList.get(0);
|
||||||
|
else
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 更新文件占用状态
|
* 更新文件信息
|
||||||
* @param parames
|
* @param parames
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Boolean updateFileStatus(EDDataParams parames)
|
public Boolean updateFileInfo(EDDataParams parames)
|
||||||
{
|
{
|
||||||
return edDataMapper.updateFileStatus(parames);
|
return edDataMapper.updateFileInfo(parames);
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 上传
|
|
||||||
* @param parames
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public Boolean upload(EDDataParams parames)
|
|
||||||
{
|
|
||||||
//return edDataMapper.upload(parames);
|
|
||||||
//edDataMapper.createDataInfo(edDataInfo);
|
|
||||||
return Boolean.TRUE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -86,4 +86,5 @@ public class EDDataRepositoryImpl implements EDDataRepository {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -14,6 +14,10 @@
|
||||||
<result column="content" jdbcType="VARCHAR" property="content" />
|
<result column="content" jdbcType="VARCHAR" property="content" />
|
||||||
<result column="implant_json" jdbcType="VARCHAR" property="implantJson" />
|
<result column="implant_json" jdbcType="VARCHAR" property="implantJson" />
|
||||||
<result column="data_status" jdbcType="VARCHAR" property="dataStatus" />
|
<result column="data_status" jdbcType="VARCHAR" property="dataStatus" />
|
||||||
|
<result column="note" jdbcType="VARCHAR" property="note" />
|
||||||
|
<result column="editor" jdbcType="VARCHAR" property="editor" />
|
||||||
|
<result column="gmt_batch_upload" jdbcType="TIMESTAMP" property="gmtBatchUpload" />
|
||||||
|
<result column="save_status" jdbcType="VARCHAR" property="saveStatus" />
|
||||||
<result column="creator" jdbcType="VARCHAR" property="creator" />
|
<result column="creator" jdbcType="VARCHAR" property="creator" />
|
||||||
<result column="creator_name" jdbcType="VARCHAR" property="creatorName" />
|
<result column="creator_name" jdbcType="VARCHAR" property="creatorName" />
|
||||||
<result column="gmt_create" jdbcType="TIMESTAMP" property="gmtCreate" />
|
<result column="gmt_create" jdbcType="TIMESTAMP" property="gmtCreate" />
|
||||||
|
|
@ -24,7 +28,7 @@
|
||||||
</resultMap>
|
</resultMap>
|
||||||
<sql id="Base_Column_list">
|
<sql id="Base_Column_list">
|
||||||
id,category_id,data_id,data_no,data_name,data_type,file_type,version,content,
|
id,category_id,data_id,data_no,data_name,data_type,file_type,version,content,
|
||||||
implant_json,data_status,creator,creator_name,gmt_create,modifier,modifier_name,
|
implant_json,data_status,note,editor,gmt_batch_upload,save_status,creator,creator_name,gmt_create,modifier,modifier_name,
|
||||||
gmt_modified,effect_flag
|
gmt_modified,effect_flag
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
|
|
@ -35,16 +39,18 @@
|
||||||
</selectKey>
|
</selectKey>
|
||||||
insert into ed_data_info (id, category_id,
|
insert into ed_data_info (id, category_id,
|
||||||
data_id, data_no, data_name,
|
data_id, data_no, data_name,
|
||||||
data_type, file_type,
|
data_type, file_type, version,
|
||||||
version,content, implant_json, data_status,
|
content, implant_json, data_status,
|
||||||
|
note, editor, gmt_batch_upload, save_status,
|
||||||
creator, creator_name, gmt_create,
|
creator, creator_name, gmt_create,
|
||||||
modifier, modifier_name, gmt_modified,
|
modifier, modifier_name, gmt_modified,
|
||||||
effect_flag
|
effect_flag
|
||||||
)
|
)
|
||||||
values (#{id,jdbcType=VARCHAR}, #{categoryId,jdbcType=VARCHAR},
|
values (#{id,jdbcType=VARCHAR}, #{categoryId,jdbcType=VARCHAR},
|
||||||
#{dataId,jdbcType=VARCHAR}, #{dataNo,jdbcType=VARCHAR}, #{dataName,jdbcType=VARCHAR},
|
#{dataId,jdbcType=VARCHAR}, #{dataNo,jdbcType=VARCHAR}, #{dataName,jdbcType=VARCHAR},
|
||||||
#{dataType,jdbcType=VARCHAR}, #{fileType,jdbcType=VARCHAR},
|
#{dataType,jdbcType=VARCHAR}, #{fileType,jdbcType=VARCHAR},#{version,jdbcType=VARCHAR},
|
||||||
#{version,jdbcType=VARCHAR},#{content,jdbcType=VARCHAR}, #{implantJson,jdbcType=VARCHAR}, #{dataStatus,jdbcType=VARCHAR},
|
#{content,jdbcType=VARCHAR}, #{implantJson,jdbcType=VARCHAR}, #{dataStatus,jdbcType=VARCHAR},
|
||||||
|
#{note,jdbcType=VARCHAR}, #{editor,jdbcType=VARCHAR}, #{gmtBatchUpload,jdbcType=TIMESTAMP}, #{saveStatus,jdbcType=VARCHAR},
|
||||||
#{creator,jdbcType=VARCHAR}, #{creatorName,jdbcType=VARCHAR}, now(), #{modifier,jdbcType=VARCHAR},
|
#{creator,jdbcType=VARCHAR}, #{creatorName,jdbcType=VARCHAR}, now(), #{modifier,jdbcType=VARCHAR},
|
||||||
#{modifierName,jdbcType=VARCHAR},now(),1
|
#{modifierName,jdbcType=VARCHAR},now(),1
|
||||||
)
|
)
|
||||||
|
|
@ -61,23 +67,45 @@
|
||||||
<if test="parentId!=null and parentId!=''">
|
<if test="parentId!=null and parentId!=''">
|
||||||
and category_id='${parentId}'
|
and category_id='${parentId}'
|
||||||
</if>
|
</if>
|
||||||
|
<if test="dataId!=null and dataId!=''">
|
||||||
|
and data_id='${dataId}'
|
||||||
|
</if>
|
||||||
<if test="keyWord!=null and keyWord!=''">
|
<if test="keyWord!=null and keyWord!=''">
|
||||||
and data_name LIKE '%${keyWord}%'
|
and data_name LIKE '%${keyWord}%'
|
||||||
</if>
|
</if>
|
||||||
|
<if test="saveStatus!=null and saveStatus!=''">
|
||||||
|
and save_status='${saveStatus}'
|
||||||
|
</if>
|
||||||
GROUP BY id
|
GROUP BY id
|
||||||
order by gmt_modified asc
|
<if test="gmtCreate == 'asc' or gmtCreate =='desc'">
|
||||||
|
order by gmt_create ${gmtCreate}
|
||||||
|
</if>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<update id="updateFileStatus" parameterType="com.electromagnetic.industry.software.data.manage.domain.boardservice.indicator.parames.EDDataParams">
|
<update id="updateFileInfo" parameterType="com.electromagnetic.industry.software.data.manage.domain.boardservice.indicator.parames.EDDataParams">
|
||||||
update ed_data_info
|
update ed_data_info
|
||||||
<set>
|
<set>
|
||||||
|
<if test="name != null and name!=''">
|
||||||
|
data_name = #{name,jdbcType=VARCHAR},
|
||||||
|
</if>
|
||||||
<if test="dataStatus != null and dataStatus!=''">
|
<if test="dataStatus != null and dataStatus!=''">
|
||||||
data_status = #{dataStatus,jdbcType=VARCHAR},
|
data_status = #{dataStatus,jdbcType=VARCHAR},
|
||||||
</if>
|
</if>
|
||||||
|
<if test="note != null and note!=''">
|
||||||
|
note = #{note,jdbcType=VARCHAR},
|
||||||
|
</if>
|
||||||
|
<if test="saveStatus != null and note!=''">
|
||||||
|
save_status = #{saveStatus,jdbcType=VARCHAR},
|
||||||
|
</if>
|
||||||
|
<if test="effectFlag != null and effectFlag!=''">
|
||||||
|
effect_flag = #{effectFlag,jdbcType=VARCHAR},
|
||||||
|
</if>
|
||||||
gmt_modified = now()
|
gmt_modified = now()
|
||||||
</set>
|
</set>
|
||||||
where data_id = #{dataId,jdbcType=VARCHAR} and effect_flag = 1
|
where data_id = #{dataId,jdbcType=VARCHAR} and effect_flag = 1
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,7 @@
|
||||||
package com.electromagnetic.industry.software.data.manage.service.facade;
|
package com.electromagnetic.industry.software.data.manage.service.facade;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSON;
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.electromagnetic.industry.software.data.manage.domain.boardservice.indicator.model.EDDataInfo;
|
import com.electromagnetic.industry.software.data.manage.domain.boardservice.indicator.model.EDDataInfo;
|
||||||
import com.electromagnetic.industry.software.data.manage.domain.boardservice.indicator.model.EDDataPage;
|
import com.electromagnetic.industry.software.data.manage.domain.boardservice.indicator.model.EDDataPage;
|
||||||
import com.electromagnetic.industry.software.data.manage.domain.boardservice.indicator.parames.EDDataParams;
|
import com.electromagnetic.industry.software.data.manage.domain.boardservice.indicator.parames.EDDataParams;
|
||||||
|
|
@ -11,9 +13,16 @@ import com.electromagnetic.industry.software.data.manage.service.mappers.EDDataM
|
||||||
import electromagnetic.data.framework.share.id.IdWorker;
|
import electromagnetic.data.framework.share.id.IdWorker;
|
||||||
import electromagnetic.data.framework.share.model.ElectromagneticResult;
|
import electromagnetic.data.framework.share.model.ElectromagneticResult;
|
||||||
import electromagnetic.data.framework.share.model.ElectromagneticResultUtil;
|
import electromagnetic.data.framework.share.model.ElectromagneticResultUtil;
|
||||||
|
import org.springframework.http.HttpStatus;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
import java.io.File;
|
||||||
|
import java.nio.file.Files;
|
||||||
|
import java.nio.file.Path;
|
||||||
|
import java.nio.file.Paths;
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
public class EDDataFacadeImpl implements EDDataFacade {
|
public class EDDataFacadeImpl implements EDDataFacade {
|
||||||
|
|
@ -32,21 +41,73 @@ public class EDDataFacadeImpl implements EDDataFacade {
|
||||||
@Override
|
@Override
|
||||||
public ElectromagneticResult<Boolean> createFolder(EDDataRequest request) {
|
public ElectromagneticResult<Boolean> createFolder(EDDataRequest request) {
|
||||||
EDDataInfo edDataInfo = EDDataMappers.INSTANCE.getEDDataInfo(request);
|
EDDataInfo edDataInfo = EDDataMappers.INSTANCE.getEDDataInfo(request);
|
||||||
edDataInfo.setCreator(request.getUserId());
|
|
||||||
edDataInfo.setCreatorName(request.getPersonName());
|
|
||||||
//edDataInfo.setModifier(request.getUserId());
|
|
||||||
edDataInfo.setModifierName(request.getPersonName());
|
|
||||||
edDataInfo.setModifier(IdWorker.getSnowFlakeIdString());
|
|
||||||
|
|
||||||
edDataInfo.setCategoryId(IdWorker.getSnowFlakeIdString());
|
// 临时数据设置
|
||||||
edDataInfo.setDataNo(IdWorker.getSnowFlakeIdString());
|
if(Boolean.TRUE) {
|
||||||
|
if (request.getUserId() == null || request.getUserId().isEmpty()) request.setUserId(IdWorker.getSnowFlakeIdString());
|
||||||
|
if (request.getUserName() == null || request.getUserName().isEmpty()) request.setUserName("user");
|
||||||
|
if (request.getName() == null || request.getName().isEmpty()) request.setName("testFolder");
|
||||||
|
//if (request.getParentId() == null || request.getParentId().isEmpty()) request.setParentId(IdWorker.getSnowFlakeIdString());
|
||||||
|
}
|
||||||
|
|
||||||
|
edDataInfo.setCreator(request.getUserId());
|
||||||
|
edDataInfo.setCreatorName(request.getUserName());
|
||||||
|
edDataInfo.setModifier(request.getUserId());
|
||||||
|
edDataInfo.setModifierName(request.getUserName());
|
||||||
|
edDataInfo.setCategoryId(request.getParentId());
|
||||||
|
edDataInfo.setDataName(request.getName());
|
||||||
|
edDataInfo.setNote(request.getNote());
|
||||||
|
|
||||||
edDataInfo.setDataId(IdWorker.getSnowFlakeIdString());
|
edDataInfo.setDataId(IdWorker.getSnowFlakeIdString());
|
||||||
|
edDataInfo.setDataNo(IdWorker.getSnowFlakeIdString());
|
||||||
edDataInfo.setDataType("folder");
|
edDataInfo.setDataType("folder");
|
||||||
edDataInfo.setDataName("testFolder");
|
|
||||||
edDataInfo.setVersion("1.0.0");
|
edDataInfo.setVersion("1.0.0");
|
||||||
edDataInfo.setDataStatus("publish");
|
edDataInfo.setDataStatus("publish");
|
||||||
|
|
||||||
edDataService.createFolder(edDataInfo);
|
String parentFolderPath = "";
|
||||||
|
// 获取上级目录的名称
|
||||||
|
if(!request.getParentId().isEmpty()) {
|
||||||
|
EDDataParams parames = new EDDataParams();
|
||||||
|
parames.setDataId(request.getParentId());
|
||||||
|
EDDataInfo edDataInfoParent = edDataService.getDataInfo(parames);
|
||||||
|
if(edDataInfoParent == null) {
|
||||||
|
ElectromagneticResultUtil.fail(HttpStatus.BAD_REQUEST.toString(),"上级文件夹为空!");
|
||||||
|
}
|
||||||
|
|
||||||
|
String folderNameParent = edDataInfoParent.getDataName();
|
||||||
|
String folderIdParent = edDataInfoParent.getDataId();
|
||||||
|
|
||||||
|
// 记录当前目录的文件夹路径和文件夹id路径
|
||||||
|
JSONObject implantJsonObject = JSON.parseObject(edDataInfoParent.getImplantJson());
|
||||||
|
if(implantJsonObject == null) {
|
||||||
|
implantJsonObject = new JSONObject();
|
||||||
|
parentFolderPath = folderNameParent;
|
||||||
|
implantJsonObject.put("folderPath", parentFolderPath);
|
||||||
|
implantJsonObject.put("folderIdPath", folderIdParent);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
String folderPath = implantJsonObject.getString("folderPath");
|
||||||
|
String folderIdPath = implantJsonObject.getString("folderIdPath");
|
||||||
|
parentFolderPath = folderPath + "/" + folderNameParent;
|
||||||
|
implantJsonObject.put("folderPath", parentFolderPath);
|
||||||
|
implantJsonObject.put("folderIdPath", folderIdPath + "/" + folderIdParent);
|
||||||
|
}
|
||||||
|
|
||||||
|
String newImplantJson = implantJsonObject.toJSONString();
|
||||||
|
edDataInfo.setImplantJson(newImplantJson);
|
||||||
|
}
|
||||||
|
|
||||||
|
boolean isSuccess = edDataService.createDataInfo(edDataInfo);
|
||||||
|
if(isSuccess)
|
||||||
|
{
|
||||||
|
// 获取文件存储的文件夹路径
|
||||||
|
String storageDirectory = "D:/fileTemp/" + parentFolderPath + "/" + edDataInfo.getDataName();
|
||||||
|
if(!edDataService.checkFolderIsExist(storageDirectory)) {
|
||||||
|
edDataService.createMultiLevelDirectory(storageDirectory);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return ElectromagneticResultUtil.success(Boolean.TRUE);
|
return ElectromagneticResultUtil.success(Boolean.TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -61,6 +122,7 @@ public class EDDataFacadeImpl implements EDDataFacade {
|
||||||
*/
|
*/
|
||||||
public ElectromagneticResult<EDDataPageResponse> getDataInfoList(EDDataRequest request)
|
public ElectromagneticResult<EDDataPageResponse> getDataInfoList(EDDataRequest request)
|
||||||
{
|
{
|
||||||
|
|
||||||
EDDataParams parames= EDDataMappers.INSTANCE.getEDDataParames(request);
|
EDDataParams parames= EDDataMappers.INSTANCE.getEDDataParames(request);
|
||||||
//获取中支指标配置列表
|
//获取中支指标配置列表
|
||||||
EDDataPage edDataPage = edDataService.getDataInfoList(parames);
|
EDDataPage edDataPage = edDataService.getDataInfoList(parames);
|
||||||
|
|
@ -70,19 +132,35 @@ public class EDDataFacadeImpl implements EDDataFacade {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 更新文件占用状态
|
* 更新文件信息
|
||||||
* WISDOM_UPDATE_FILESTATUS
|
* WISDOM_UPDATE_FILEINFO
|
||||||
* /data/ed/file/updateFileStatus
|
* /data/ed/file/updateFileInfo
|
||||||
* @param request
|
* @param request
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public ElectromagneticResult<Boolean> updateFileStatus(EDDataRequest request)
|
public ElectromagneticResult<Boolean> updateFileInfo(EDDataRequest request)
|
||||||
{
|
{
|
||||||
EDDataParams parames= EDDataMappers.INSTANCE.getEDDataParames(request);
|
EDDataParams parames= EDDataMappers.INSTANCE.getEDDataParames(request);
|
||||||
edDataService.updateFileStatus(parames);
|
edDataService.updateFileInfo(parames);
|
||||||
return ElectromagneticResultUtil.success(Boolean.TRUE);
|
return ElectromagneticResultUtil.success(Boolean.TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取子文件数量
|
||||||
|
* WISDOM_GET_CHILDFILECOUNT
|
||||||
|
* /data/ed/file/getChildFileCount
|
||||||
|
* @param request
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public ElectromagneticResult<Map<String, Integer>> getChildFileCount(EDDataRequest request)
|
||||||
|
{
|
||||||
|
EDDataParams parames= EDDataMappers.INSTANCE.getEDDataParames(request);
|
||||||
|
Integer fileCount = edDataService.getChildFileCount(parames);
|
||||||
|
Map<String, Integer> result = new HashMap<>();
|
||||||
|
result.put("fileCount", fileCount);
|
||||||
|
return ElectromagneticResultUtil.success(result);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 上传
|
* 上传
|
||||||
* WISDOM_UPLOAD
|
* WISDOM_UPLOAD
|
||||||
|
|
@ -93,8 +171,146 @@ public class EDDataFacadeImpl implements EDDataFacade {
|
||||||
public ElectromagneticResult<Boolean> upload(EDDataRequest request)
|
public ElectromagneticResult<Boolean> upload(EDDataRequest request)
|
||||||
{
|
{
|
||||||
EDDataParams parames= EDDataMappers.INSTANCE.getEDDataParames(request);
|
EDDataParams parames= EDDataMappers.INSTANCE.getEDDataParames(request);
|
||||||
edDataService.upload(parames);
|
|
||||||
|
try {
|
||||||
|
// 获取目录编码ID
|
||||||
|
String categoryId = request.getParentId();
|
||||||
|
|
||||||
|
// 获取要上传的文件
|
||||||
|
MultipartFile fileInput = request.getFileData();
|
||||||
|
|
||||||
|
// 检查文件是否为空
|
||||||
|
if (fileInput == null || fileInput.isEmpty()) {
|
||||||
|
return ElectromagneticResultUtil.fail(HttpStatus.BAD_REQUEST.toString(),"上传的文件为空");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取文件名
|
||||||
|
String fileFullName = fileInput.getOriginalFilename();
|
||||||
|
// 获取文件类型
|
||||||
|
String fileType = "";
|
||||||
|
// 获取文件名称
|
||||||
|
String fileName = "";
|
||||||
|
if (fileFullName.lastIndexOf(".") != -1 && fileFullName.lastIndexOf(".") != 0) {
|
||||||
|
fileType = fileFullName.substring(fileFullName.lastIndexOf(".") + 1);
|
||||||
|
fileName = fileFullName.substring(fileFullName.lastIndexOf("."));
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取文件存储的文件夹路径
|
||||||
|
String storageDirectory = "D:/fileTemp";
|
||||||
|
if(!edDataService.checkFolderIsExist(storageDirectory)) {
|
||||||
|
edDataService.createMultiLevelDirectory(storageDirectory);
|
||||||
|
}
|
||||||
|
|
||||||
|
String parentFolderPath = ""; //上级文件夹路径
|
||||||
|
String parentFolderIdPath = ""; //上级文件夹ID路径
|
||||||
|
String parentFolderName = ""; //上级文件夹名称
|
||||||
|
|
||||||
|
// 获取上级文件夹路径
|
||||||
|
{
|
||||||
|
EDDataParams folderParames = new EDDataParams();
|
||||||
|
folderParames.setDataId(categoryId);
|
||||||
|
EDDataInfo edDataInfoParent = edDataService.getDataInfo(folderParames);
|
||||||
|
if(edDataInfoParent == null) {
|
||||||
|
ElectromagneticResultUtil.fail(HttpStatus.BAD_REQUEST.toString(),"上级文件夹为空!");
|
||||||
|
}
|
||||||
|
JSONObject implantJsonObject = JSON.parseObject(edDataInfoParent.getImplantJson());
|
||||||
|
parentFolderPath = implantJsonObject.getString("folderPath");
|
||||||
|
parentFolderIdPath = implantJsonObject.getString("folderIdPath");
|
||||||
|
if(!parentFolderPath.isEmpty())
|
||||||
|
parentFolderPath += "/" ;
|
||||||
|
if(!parentFolderIdPath.isEmpty())
|
||||||
|
parentFolderIdPath += "/" ;
|
||||||
|
parentFolderPath += edDataInfoParent.getDataName();
|
||||||
|
parentFolderIdPath += edDataInfoParent.getDataId();
|
||||||
|
parentFolderName = edDataInfoParent.getDataName();
|
||||||
|
}
|
||||||
|
|
||||||
|
// 文件保存目录路径
|
||||||
|
String fileSavePath = storageDirectory + "/" + parentFolderPath;
|
||||||
|
String treeName = "目录树名称";
|
||||||
|
String newFileName = treeName + "," + parentFolderName + "," + fileFullName;
|
||||||
|
|
||||||
|
// 文件数据信息写到数据库
|
||||||
|
{
|
||||||
|
// 临时数据设置
|
||||||
|
if(Boolean.TRUE) {
|
||||||
|
if (request.getUserId() == null || request.getUserId().isEmpty()) request.setUserId(IdWorker.getSnowFlakeIdString());
|
||||||
|
if (request.getUserName() == null || request.getUserName().isEmpty()) request.setUserName("user");
|
||||||
|
//if (request.getName() == null || request.getName().isEmpty()) request.setName("testFolder");
|
||||||
|
if (request.getParentId() == null || request.getParentId().isEmpty()) request.setParentId(IdWorker.getSnowFlakeIdString());
|
||||||
|
}
|
||||||
|
|
||||||
|
// 创建新文件数据
|
||||||
|
EDDataInfo edDataInfo = new EDDataInfo();
|
||||||
|
edDataInfo.setCreator(request.getUserId());
|
||||||
|
edDataInfo.setCreatorName(request.getUserName());
|
||||||
|
edDataInfo.setModifier(request.getUserId());
|
||||||
|
edDataInfo.setModifierName(request.getUserName());
|
||||||
|
edDataInfo.setCategoryId(request.getParentId());
|
||||||
|
edDataInfo.setDataName(newFileName);
|
||||||
|
edDataInfo.setNote(request.getNote());
|
||||||
|
edDataInfo.setFileType(fileType);
|
||||||
|
edDataInfo.setGmtBatchUpload(request.getGmtBatchUpload());
|
||||||
|
|
||||||
|
edDataInfo.setDataId(IdWorker.getSnowFlakeIdString());
|
||||||
|
edDataInfo.setDataNo(IdWorker.getSnowFlakeIdString());
|
||||||
|
edDataInfo.setDataType("file");
|
||||||
|
edDataInfo.setVersion("1.0.0");
|
||||||
|
edDataInfo.setDataStatus("publish");
|
||||||
|
edDataInfo.setSaveStatus("saving");
|
||||||
|
|
||||||
|
JSONObject newImplantJsonObject = new JSONObject();
|
||||||
|
newImplantJsonObject.put("folderPath", parentFolderPath);
|
||||||
|
newImplantJsonObject.put("folderIdPath", parentFolderIdPath);
|
||||||
|
edDataInfo.setImplantJson(newImplantJsonObject.toJSONString());
|
||||||
|
|
||||||
|
boolean isSuccess = edDataService.createDataInfo(edDataInfo);
|
||||||
|
|
||||||
|
String userHome = System.getProperty("user.home");
|
||||||
|
File cacheDirectory = new File(userHome + "\\AppData\\Local\\Temp\\EDData");
|
||||||
|
if (!cacheDirectory.exists()) {
|
||||||
|
cacheDirectory.mkdirs();
|
||||||
|
}
|
||||||
|
|
||||||
|
String cacheFolder = cacheDirectory.getAbsolutePath();
|
||||||
|
|
||||||
|
String cachePath = cacheFolder + "/" + newFileName;
|
||||||
|
System.out.println("文件缓存路径为: " + cacheDirectory.getAbsolutePath());
|
||||||
|
fileSavePath += "/" + newFileName;
|
||||||
|
|
||||||
|
|
||||||
|
// 这里可以添加将文件保存到本地磁盘或其他存储介质的逻辑
|
||||||
|
File saveFile = new File(cachePath);//fileSavePath
|
||||||
|
|
||||||
|
// 将文件保存到硬盘
|
||||||
|
fileInput.transferTo(saveFile);
|
||||||
|
|
||||||
|
EDDataParams fileParames = new EDDataParams();
|
||||||
|
fileParames.setDataId(edDataInfo.getDataId());
|
||||||
|
if(fileInput.getSize() == saveFile.length())
|
||||||
|
{
|
||||||
|
Path source = Paths.get(cachePath);
|
||||||
|
Path target = Paths.get(fileSavePath);
|
||||||
|
Files.move(source, target);
|
||||||
|
fileParames.setSaveStatus("success");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
saveFile.delete();
|
||||||
|
fileParames.setSaveStatus("failure");
|
||||||
|
}
|
||||||
|
|
||||||
|
isSuccess = edDataService.updateFileInfo(fileParames);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// 如果文件上传成功,返回成功消息
|
||||||
return ElectromagneticResultUtil.success(Boolean.TRUE);
|
return ElectromagneticResultUtil.success(Boolean.TRUE);
|
||||||
|
} catch (Exception e) {
|
||||||
|
// 如果出现异常,返回异常消息
|
||||||
|
return ElectromagneticResultUtil.fail(HttpStatus.INTERNAL_SERVER_ERROR.toString(),"文件上传失败" + e.getMessage());
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -104,13 +320,63 @@ public class EDDataFacadeImpl implements EDDataFacade {
|
||||||
* @param request
|
* @param request
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public ElectromagneticResult<Boolean> download(EDDataRequest request)
|
public ElectromagneticResult<Map<String, List<String>>> download(EDDataRequest request)
|
||||||
{
|
{
|
||||||
EDDataParams parames= EDDataMappers.INSTANCE.getEDDataParames(request);
|
//EDDataParams parames= EDDataMappers.INSTANCE.getEDDataParames(request);
|
||||||
edDataService.download(parames);
|
|
||||||
return ElectromagneticResultUtil.success(Boolean.TRUE);
|
// 获取文件存储的文件夹路径
|
||||||
|
String storageDirectory = "D:/fileTemp";
|
||||||
|
EDDataParams parames = new EDDataParams();
|
||||||
|
List<String> dataPathArr = new ArrayList();
|
||||||
|
for(String dataId : request.getDataIdArr())
|
||||||
|
{
|
||||||
|
parames.setDataId(dataId);
|
||||||
|
EDDataInfo edDataInfo = edDataService.getDataInfo(parames);
|
||||||
|
if(edDataInfo != null)
|
||||||
|
{
|
||||||
|
JSONObject implantJsonObject = JSON.parseObject(edDataInfo.getImplantJson());
|
||||||
|
String filePath = implantJsonObject.getString("folderPath");
|
||||||
|
filePath = storageDirectory + "/" + filePath + "/" + edDataInfo.getDataName();
|
||||||
|
dataPathArr.add(filePath);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<String, List<String>> result = new HashMap<>();
|
||||||
|
result.put("urlArr", dataPathArr);
|
||||||
|
|
||||||
|
return ElectromagneticResultUtil.success(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出
|
||||||
|
* @param request
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public ElectromagneticResult<String> batchExport(EDDataRequest request) {
|
||||||
|
//1、根据用户选择层级树编码查出所有文件和文件夹list
|
||||||
|
//2、循环list将每个文件复制到新建目录并进行重命名,命名规则:目录树编码+,+文件夹编码(有则填写无则为空)+,+文件编码
|
||||||
|
//3、打包新建为zip,并根据生产下载地址(域名+文件路径+文件)
|
||||||
|
//4、返回前端下载的地址
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导入
|
||||||
|
* @param request
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public ElectromagneticResult<String> batchImport(EDDataRequest request) {
|
||||||
|
//1、上传文件到指定目录,并重命名
|
||||||
|
//2、接下压缩包
|
||||||
|
//3、扫码解压文件夹的所有文件
|
||||||
|
//4、循环处理文件:读取文件名称,根据名称规则,进行数据库查询,匹配层级树、文件夹和文件是否跳过
|
||||||
|
//5、如果不存在则新建文件记录
|
||||||
|
//6、并移动文件到上传目录
|
||||||
|
//7、处理完成返回成功
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue