Compare commits
7 Commits
520d1885f7
...
3bddcc2437
| Author | SHA1 | Date |
|---|---|---|
|
|
3bddcc2437 | |
|
|
8ef91dc8a1 | |
|
|
7e30c40b1a | |
|
|
01f6a63b2d | |
|
|
c35f4cfef6 | |
|
|
78b8207bb0 | |
|
|
03ee38a3f0 |
|
|
@ -4,6 +4,7 @@
|
|||
package com.electromagnetic.industry.software.data.manage.domain.boardservice.indicator.service.impl;
|
||||
|
||||
import cn.hutool.core.io.FileUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.core.util.ZipUtil;
|
||||
import cn.hutool.crypto.SecureUtil;
|
||||
import cn.hutool.crypto.symmetric.AES;
|
||||
|
|
@ -25,9 +26,11 @@ import com.fasterxml.jackson.databind.ObjectMapper;
|
|||
import com.fasterxml.jackson.databind.SerializationFeature;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import electromagnetic.data.framework.share.constants.ElectromagneticConstants;
|
||||
import electromagnetic.data.framework.share.exception.LoggerConstant;
|
||||
import electromagnetic.data.framework.share.id.IdWorker;
|
||||
import electromagnetic.data.framework.share.model.ElectromagneticResultUtil;
|
||||
import electromagnetic.data.framework.share.util.EleCommonUtil;
|
||||
import electromagnetic.data.framework.share.util.EleZipUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.slf4j.Logger;
|
||||
|
|
@ -133,7 +136,8 @@ public class EDDataServiceImpl implements EDDataService {
|
|||
categoryParent = categoryParentList.get(0);
|
||||
filePathOfFolder = categoryParent.getCategoryId() + FOLDER_NAME_SEPARATOR + categoryParent.getCategoryName();
|
||||
if(edDataInfoParent != null) {
|
||||
filePathOfFolder = filePathOfFolder + File.separator + edDataInfoParent.getDataName();
|
||||
String fileType = StrUtil.isEmpty(edDataInfoParent.getFileType()) ? "" : "." + edDataInfoParent.getFileType();
|
||||
filePathOfFolder = filePathOfFolder + File.separator + edDataInfoParent.getDataName() + fileType;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -233,13 +237,14 @@ public class EDDataServiceImpl implements EDDataService {
|
|||
|
||||
EDDataInfo edDataInfo = edDataInfoList.get(0);
|
||||
String filePathOfFolder = getFilePathOfFolder(edDataInfo.getCategoryId());
|
||||
String fileStorageFullPath = dataStoragePath + filePathOfFolder + File.separator + edDataInfo.getDataName();
|
||||
String fileType = StrUtil.isEmpty(edDataInfo.getFileType()) ? "" : "." + edDataInfo.getFileType();
|
||||
String fileStorageFullPath = dataStoragePath + filePathOfFolder + File.separator + edDataInfo.getDataName() + fileType;
|
||||
|
||||
if (!FileUtil.exist(fileStorageFullPath)){
|
||||
throw new Exception("文件不存在");
|
||||
}
|
||||
|
||||
String fileNameNew = parames.getName();
|
||||
String fileNameNew = parames.getName() + fileType;
|
||||
if(fileNameNew != null && fileNameNew != "" && !fileNameNew.equals(edDataInfo.getDataName())) {
|
||||
FileUtil.rename(Paths.get(fileStorageFullPath) ,fileNameNew,true);
|
||||
}
|
||||
|
|
@ -274,7 +279,7 @@ public class EDDataServiceImpl implements EDDataService {
|
|||
parames.setParentId(edDataInfo.getDataId());
|
||||
childFileCount += getChildFileCount(parames);
|
||||
}
|
||||
else if(edDataInfo.getDataType().equals(dataTypeFile))
|
||||
else if(edDataInfo.getDataType().equals(dataTypeFile) && edDataInfo.getEffectFlag().equals(1))
|
||||
{
|
||||
++childFileCount;
|
||||
}
|
||||
|
|
@ -305,13 +310,9 @@ public class EDDataServiceImpl implements EDDataService {
|
|||
// 获取文件名
|
||||
String fileFullName = fileInput.getOriginalFilename();
|
||||
// 获取文件类型
|
||||
String fileType = "";
|
||||
String fileType = EleCommonUtil.getFileType(fileFullName);
|
||||
// 获取文件名称
|
||||
String fileName = "";
|
||||
if (fileFullName.lastIndexOf(".") != -1 && fileFullName.lastIndexOf(".") != 0) {
|
||||
fileType = fileFullName.substring(fileFullName.lastIndexOf(".") + 1);
|
||||
fileName = fileFullName.substring(fileFullName.lastIndexOf("."));
|
||||
}
|
||||
String fileName = EleCommonUtil.getFileName(fileFullName);
|
||||
|
||||
// 判断文件名称是否存在
|
||||
EDDataParams folderParames = new EDDataParams();
|
||||
|
|
@ -342,7 +343,7 @@ public class EDDataServiceImpl implements EDDataService {
|
|||
edDataInfo.setModifier(parames.getUserId());
|
||||
edDataInfo.setModifierName(parames.getUserName());
|
||||
edDataInfo.setCategoryId(parames.getParentId());
|
||||
edDataInfo.setDataName(fileFullName);
|
||||
edDataInfo.setDataName(fileName);
|
||||
edDataInfo.setNote(parames.getNote());
|
||||
edDataInfo.setFileType(fileType);
|
||||
edDataInfo.setGmtBatchUpload(parames.getGmtBatchUpload());
|
||||
|
|
@ -561,7 +562,7 @@ public class EDDataServiceImpl implements EDDataService {
|
|||
String dateString = sdf.format(date);
|
||||
|
||||
zipPathFileName = dataCachePath + "/exportData_" + dateString;
|
||||
enCodeZipPathFileName = dataCachePath + "/exportData_" + dateString + ".comac";
|
||||
enCodeZipPathFileName = dataCachePath + "/exportData_" + dateString + ElectromagneticConstants.EXPORT_FILE_SUFFIX;
|
||||
|
||||
ZipUtil.zip(exportDataCachePath, zipPathFileName);
|
||||
|
||||
|
|
|
|||
|
|
@ -38,4 +38,6 @@ public final class ElectromagneticConstants {
|
|||
public static final String TAG_SEGMENT="TagSegment";
|
||||
|
||||
public static final String TYPE_SEGMENT="TypeSegment";
|
||||
|
||||
public static final String EXPORT_FILE_SUFFIX = ".colib";
|
||||
}
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
package electromagnetic.data.framework.share.util;
|
||||
|
||||
public final class EleCommonUtil {
|
||||
|
||||
public static String getFileName(String fileFullName) {
|
||||
if (fileFullName == null) {
|
||||
return "";
|
||||
}
|
||||
if (!fileFullName.contains(".")) {
|
||||
return fileFullName;
|
||||
}
|
||||
|
||||
int index = fileFullName.lastIndexOf(".");
|
||||
return fileFullName.substring(0, index);
|
||||
}
|
||||
|
||||
public static String getFileType(String fileFullName) {
|
||||
if (fileFullName == null || !fileFullName.contains(".")) {
|
||||
return "";
|
||||
}
|
||||
int index = fileFullName.lastIndexOf(".");
|
||||
return fileFullName.substring(index + 1);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
package com.electromagnetic.industry.software.data.manage.request.user;
|
||||
|
||||
import cn.hutool.core.date.DateTime;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import electromagnetic.data.framework.share.model.BaseRequest;
|
||||
import lombok.Data;
|
||||
|
||||
|
|
@ -46,7 +46,8 @@ public class UserModiRequest extends BaseRequest implements Serializable {
|
|||
/**
|
||||
* 入职日期
|
||||
*/
|
||||
private DateTime joinTime;
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
private Date joinTime;
|
||||
|
||||
/**
|
||||
* 工作状态
|
||||
|
|
@ -56,5 +57,6 @@ public class UserModiRequest extends BaseRequest implements Serializable {
|
|||
/**
|
||||
* 实习截止日期
|
||||
*/
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
private Date internshipEndDate;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
package com.electromagnetic.industry.software.data.manage.request.user;
|
||||
|
||||
import cn.hutool.core.date.DateTime;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import electromagnetic.data.framework.share.model.BaseRequest;
|
||||
import lombok.Data;
|
||||
|
||||
|
|
@ -41,7 +42,8 @@ public class UserRequest extends BaseRequest implements Serializable {
|
|||
/**
|
||||
* 入职日期
|
||||
*/
|
||||
private DateTime joinTime;
|
||||
@JsonFormat(pattern="yyyy-MM-dd")
|
||||
private Date joinTime;
|
||||
|
||||
/**
|
||||
* 工作状态
|
||||
|
|
@ -51,6 +53,7 @@ public class UserRequest extends BaseRequest implements Serializable {
|
|||
/**
|
||||
* 实习截止日期
|
||||
*/
|
||||
@JsonFormat(pattern="yyyy-MM-dd")
|
||||
private Date internshipEndDate;
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
package com.electromagnetic.industry.software.data.manage.response.user;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
|
|
@ -52,6 +53,7 @@ public class SingleUserResponse {
|
|||
/**
|
||||
* 入职日期
|
||||
*/
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
private Date joinTime;
|
||||
|
||||
/**
|
||||
|
|
@ -62,6 +64,7 @@ public class SingleUserResponse {
|
|||
/**
|
||||
* 实习截止日期
|
||||
*/
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
private Date internshipEndDate;
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@
|
|||
<selectKey keyProperty="id" order="AFTER" resultType="java.lang.Long">
|
||||
SELECT LAST_INSERT_ID()
|
||||
</selectKey>
|
||||
insert into ed_data_info (id,
|
||||
replace into ed_data_info (id,
|
||||
category_type_id, parent_id, category_id,
|
||||
category_name, category_status,
|
||||
creator, creator_name, gmt_create,
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@
|
|||
<selectKey keyProperty="id" order="AFTER" resultType="java.lang.Long">
|
||||
SELECT LAST_INSERT_ID()
|
||||
</selectKey>
|
||||
insert into ed_data_info (category_id,
|
||||
replace into ed_data_info (category_id,
|
||||
data_id, data_no, data_name,
|
||||
data_type, file_type, version,
|
||||
content, implant_json, data_status,
|
||||
|
|
|
|||
|
|
@ -79,7 +79,7 @@
|
|||
<if test="userTitle != null and userTitle != ''">user_title = #{userTitle},</if>
|
||||
<if test="joinTime != null">join_time = #{joinTime},</if>
|
||||
<if test="userStatus != null and userStatus != ''">user_status = #{userStatus},</if>
|
||||
<if test="internshipEndDate != null">internship_end_date = #{internshipEndDate},</if>
|
||||
internship_end_date = #{internshipEndDate},
|
||||
<if test="modifier != null and modifier != ''">modifier = #{modifier},</if>
|
||||
<if test="modifierName != null and modifierName != ''">modifier_name = #{modifierName},</if>
|
||||
gmt_modified=now()
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ import cn.hutool.core.codec.Base64;
|
|||
import cn.hutool.core.io.FileUtil;
|
||||
import cn.hutool.core.io.IoUtil;
|
||||
import cn.hutool.core.lang.Assert;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.core.util.ZipUtil;
|
||||
import cn.hutool.crypto.SecureUtil;
|
||||
import cn.hutool.crypto.symmetric.AES;
|
||||
|
|
@ -17,6 +18,7 @@ import com.electromagnetic.industry.software.data.manage.request.indicator.FileC
|
|||
import com.electromagnetic.industry.software.data.manage.request.indicator.FileChunkResultDTO;
|
||||
import com.electromagnetic.industry.software.data.manage.response.indicator.EDDataPageResponse;
|
||||
import com.electromagnetic.industry.software.data.manage.service.mappers.EDDataMappers;
|
||||
import electromagnetic.data.framework.share.constants.ElectromagneticConstants;
|
||||
import electromagnetic.data.framework.share.id.IdWorker;
|
||||
import electromagnetic.data.framework.share.model.ElectromagneticResult;
|
||||
import electromagnetic.data.framework.share.model.ElectromagneticResultUtil;
|
||||
|
|
@ -193,7 +195,8 @@ public class EDDataFacadeImpl implements EDDataFacade {
|
|||
EDDataInfo edDataInfo = edDataService.getDataInfo(parames);
|
||||
Assert.isTrue(edDataInfo != null, "没有找到该下载文件");
|
||||
String filePathOfFolder = edDataService.getFilePathOfFolder(edDataInfo.getCategoryId());
|
||||
String filePath = storageFilePath + "/" + filePathOfFolder + "/" + edDataInfo.getDataName();
|
||||
String fileType = StrUtil.isEmpty(edDataInfo.getFileType()) ? "" : "." + edDataInfo.getFileType();
|
||||
String filePath = storageFilePath + "/" + filePathOfFolder + "/" + edDataInfo.getDataName() + fileType;
|
||||
|
||||
Assert.isTrue(FileUtil.exist(filePath), "下载文件不存在。");
|
||||
FileSystemResource fileSystemResource = new FileSystemResource(filePath);
|
||||
|
|
@ -228,7 +231,7 @@ public class EDDataFacadeImpl implements EDDataFacade {
|
|||
|
||||
Map<String, String> result = new HashMap<>();
|
||||
List<String> dataIdList = Arrays.asList(dataIdArr.split(","));
|
||||
if(dataIdList.size() > 0) {
|
||||
if(!dataIdList.isEmpty()) {
|
||||
String filePath = edDataService.exportData(dataIdList);
|
||||
|
||||
Assert.isTrue(FileUtil.exist(filePath), "下载文件不存在。");
|
||||
|
|
@ -313,13 +316,12 @@ public class EDDataFacadeImpl implements EDDataFacade {
|
|||
return new ArrayList<>();
|
||||
}
|
||||
|
||||
List<Integer> uploadedFileChunkNums = FileUtil.listFileNames(destPath)
|
||||
return FileUtil.listFileNames(destPath)
|
||||
.stream()
|
||||
.filter(e -> !e.endsWith(".comac"))
|
||||
.filter(e -> !e.endsWith(ElectromagneticConstants.EXPORT_FILE_SUFFIX))
|
||||
.map(e -> e.replace(UPLOAD_FILE_CHUNK_SUFFIX, ""))
|
||||
.map(Integer::parseInt)
|
||||
.collect(Collectors.toList());
|
||||
return uploadedFileChunkNums;
|
||||
}
|
||||
|
||||
// TODO 需要验证如果一个分片上传一半网络断开,则该分片的存储情况。
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
package com.electromagnetic.industry.software.data.manage.service.mappers;
|
||||
|
||||
import com.electromagnetic.industry.software.data.manage.domain.boardservice.user.model.User;
|
||||
import com.electromagnetic.industry.software.data.manage.domain.boardservice.user.model.UserLoginInfo;
|
||||
import com.electromagnetic.industry.software.data.manage.domain.boardservice.user.params.PublishParam;
|
||||
import com.electromagnetic.industry.software.data.manage.domain.boardservice.user.params.SearchKeyWords;
|
||||
import com.electromagnetic.industry.software.data.manage.domain.boardservice.user.params.UserDeleteKeyWords;
|
||||
|
|
@ -13,13 +12,14 @@ import com.electromagnetic.industry.software.data.manage.request.user.UserPublis
|
|||
import com.electromagnetic.industry.software.data.manage.request.user.UserRequest;
|
||||
import com.electromagnetic.industry.software.data.manage.request.user.UserWorkNumRequest;
|
||||
import com.electromagnetic.industry.software.data.manage.response.user.SingleUserResponse;
|
||||
import electromagnetic.data.framework.share.model.UserLoginInfo;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import javax.annotation.Generated;
|
||||
|
||||
@Generated(
|
||||
value = "org.mapstruct.ap.MappingProcessor",
|
||||
date = "2024-11-21T15:49:09+0800",
|
||||
date = "2024-12-05T15:02:06+0800",
|
||||
comments = "version: 1.4.1.Final, compiler: javac, environment: Java 1.8.0_281 (Oracle Corporation)"
|
||||
)
|
||||
public class UserMappersImpl implements UserMappers {
|
||||
|
|
@ -41,10 +41,6 @@ public class UserMappersImpl implements UserMappers {
|
|||
user.setJoinTime( userRequest.getJoinTime() );
|
||||
user.setUserStatus( userRequest.getUserStatus() );
|
||||
user.setInternshipEndDate( userRequest.getInternshipEndDate() );
|
||||
user.setCreator( userRequest.getCreator() );
|
||||
user.setCreatorName( userRequest.getCreatorName() );
|
||||
user.setModifier( userRequest.getModifier() );
|
||||
user.setModifierName( userRequest.getModifierName() );
|
||||
|
||||
return user;
|
||||
}
|
||||
|
|
@ -58,6 +54,7 @@ public class UserMappersImpl implements UserMappers {
|
|||
UserLoginInfo userLoginInfo = new UserLoginInfo();
|
||||
|
||||
userLoginInfo.setWorkNumber( loginRequest.getWorkNumber() );
|
||||
userLoginInfo.setUserId( loginRequest.getUserId() );
|
||||
userLoginInfo.setUserPwd( loginRequest.getUserPwd() );
|
||||
|
||||
return userLoginInfo;
|
||||
|
|
@ -107,8 +104,6 @@ public class UserMappersImpl implements UserMappers {
|
|||
if ( list != null ) {
|
||||
publishParam.setUserIds( new ArrayList<String>( list ) );
|
||||
}
|
||||
publishParam.setModifier( userPublishRequest.getModifier() );
|
||||
publishParam.setModifierName( userPublishRequest.getModifierName() );
|
||||
|
||||
return publishParam;
|
||||
}
|
||||
|
|
@ -164,8 +159,6 @@ public class UserMappersImpl implements UserMappers {
|
|||
user.setJoinTime( userModiRequest.getJoinTime() );
|
||||
user.setUserStatus( userModiRequest.getUserStatus() );
|
||||
user.setInternshipEndDate( userModiRequest.getInternshipEndDate() );
|
||||
user.setModifier( userModiRequest.getModifier() );
|
||||
user.setModifierName( userModiRequest.getModifierName() );
|
||||
|
||||
return user;
|
||||
}
|
||||
|
|
@ -194,8 +187,6 @@ public class UserMappersImpl implements UserMappers {
|
|||
UserDeleteKeyWords userDeleteKeyWords = new UserDeleteKeyWords();
|
||||
|
||||
userDeleteKeyWords.setUserId( userDeleteRequest.getUserId() );
|
||||
userDeleteKeyWords.setModifier( userDeleteRequest.getModifier() );
|
||||
userDeleteKeyWords.setModifierName( userDeleteRequest.getModifierName() );
|
||||
|
||||
return userDeleteKeyWords;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue