Compare commits
No commits in common. "520d1885f7ac6ccf73978b141c8dc601a9aaf6ce" and "e34973d774c531f57bc5b3b671257bb3e1ce623c" have entirely different histories.
520d1885f7
...
e34973d774
|
|
@ -34,7 +34,7 @@ public interface EDDataService {
|
||||||
* @param edDataInfo
|
* @param edDataInfo
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
Boolean createDataInfo(EDDataInfo edDataInfo) throws Exception;
|
Boolean createDataInfo(EDDataInfo edDataInfo) throws FileNotFoundException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取文件信息列表
|
* 获取文件信息列表
|
||||||
|
|
@ -55,7 +55,7 @@ public interface EDDataService {
|
||||||
* @param parames
|
* @param parames
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
Boolean updateFileInfo(EDDataParams parames) throws Exception;
|
Boolean updateFileInfo(EDDataParams parames) throws FileNotFoundException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取子文件数量
|
* 获取子文件数量
|
||||||
|
|
@ -69,7 +69,7 @@ public interface EDDataService {
|
||||||
* @param parames
|
* @param parames
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
Boolean uploadFile(EDDataParams parames) throws Exception;
|
Boolean uploadFile(EDDataParams parames) throws FileNotFoundException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 文件下载
|
* 文件下载
|
||||||
|
|
|
||||||
|
|
@ -145,14 +145,14 @@ public class EDDataServiceImpl implements EDDataService {
|
||||||
* @param edDataInfo
|
* @param edDataInfo
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public Boolean createDataInfo(EDDataInfo edDataInfo) throws Exception
|
public Boolean createDataInfo(EDDataInfo edDataInfo) throws FileNotFoundException
|
||||||
{
|
{
|
||||||
// 获取上级目录的名称
|
// 获取上级目录的名称
|
||||||
Category categoryParent = new Category();
|
Category categoryParent = new Category();
|
||||||
categoryParent.setCategoryId(edDataInfo.getCategoryId());
|
categoryParent.setCategoryId(edDataInfo.getCategoryId());
|
||||||
List<Category> categoryParentList = categoryRepository.selectCategories(categoryParent);
|
List<Category> categoryParentList = categoryRepository.selectCategories(categoryParent);
|
||||||
if(categoryParentList.size() < 1) {
|
if(categoryParentList.size() < 1) {
|
||||||
throw new Exception("上级文件夹不存在");
|
throw new FileNotFoundException("上级文件夹不存在");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
@ -170,7 +170,7 @@ public class EDDataServiceImpl implements EDDataService {
|
||||||
for(EDDataInfo fileInfo : childFileInfoList)
|
for(EDDataInfo fileInfo : childFileInfoList)
|
||||||
{
|
{
|
||||||
if(fileInfo.getDataName().equals(edDataInfo.getDataName())){
|
if(fileInfo.getDataName().equals(edDataInfo.getDataName())){
|
||||||
throw new Exception("文件夹已存在");
|
throw new FileNotFoundException("文件夹已存在");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -216,19 +216,19 @@ public class EDDataServiceImpl implements EDDataService {
|
||||||
* @param parames
|
* @param parames
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public Boolean updateFileInfo(EDDataParams parames) throws Exception
|
public Boolean updateFileInfo(EDDataParams parames) throws FileNotFoundException
|
||||||
{
|
{
|
||||||
|
|
||||||
String dataStoragePath = getDataStoragePath();
|
String dataStoragePath = getDataStoragePath();
|
||||||
if (!FileUtil.exist(dataStoragePath)){
|
if (!FileUtil.exist(dataStoragePath)){
|
||||||
throw new Exception("数据存储文件夹不存在");
|
throw new FileNotFoundException("数据存储文件夹不存在");
|
||||||
}
|
}
|
||||||
|
|
||||||
EDDataParams paramesFind = new EDDataParams();
|
EDDataParams paramesFind = new EDDataParams();
|
||||||
paramesFind.setDataId(parames.getDataId());
|
paramesFind.setDataId(parames.getDataId());
|
||||||
List<EDDataInfo> edDataInfoList = edDataRepository.getDataInfoList(paramesFind);
|
List<EDDataInfo> edDataInfoList = edDataRepository.getDataInfoList(paramesFind);
|
||||||
if(edDataInfoList.size() < 1) {
|
if(edDataInfoList.size() < 1) {
|
||||||
throw new Exception("文件信息不存在");
|
throw new FileNotFoundException("文件信息不存在");
|
||||||
}
|
}
|
||||||
|
|
||||||
EDDataInfo edDataInfo = edDataInfoList.get(0);
|
EDDataInfo edDataInfo = edDataInfoList.get(0);
|
||||||
|
|
@ -236,7 +236,7 @@ public class EDDataServiceImpl implements EDDataService {
|
||||||
String fileStorageFullPath = dataStoragePath + filePathOfFolder + File.separator + edDataInfo.getDataName();
|
String fileStorageFullPath = dataStoragePath + filePathOfFolder + File.separator + edDataInfo.getDataName();
|
||||||
|
|
||||||
if (!FileUtil.exist(fileStorageFullPath)){
|
if (!FileUtil.exist(fileStorageFullPath)){
|
||||||
throw new Exception("文件不存在");
|
throw new FileNotFoundException("文件不存在");
|
||||||
}
|
}
|
||||||
|
|
||||||
String fileNameNew = parames.getName();
|
String fileNameNew = parames.getName();
|
||||||
|
|
@ -288,7 +288,7 @@ public class EDDataServiceImpl implements EDDataService {
|
||||||
* @param parames
|
* @param parames
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public Boolean uploadFile(EDDataParams parames) throws Exception
|
public Boolean uploadFile(EDDataParams parames) throws FileNotFoundException
|
||||||
{
|
{
|
||||||
|
|
||||||
// 获取目录编码ID
|
// 获取目录编码ID
|
||||||
|
|
@ -299,7 +299,7 @@ public class EDDataServiceImpl implements EDDataService {
|
||||||
|
|
||||||
// 检查文件是否为空
|
// 检查文件是否为空
|
||||||
if (fileInput == null || fileInput.isEmpty()) {
|
if (fileInput == null || fileInput.isEmpty()) {
|
||||||
throw new Exception("上传的文件为空");
|
throw new FileNotFoundException("上传的文件为空");
|
||||||
}
|
}
|
||||||
|
|
||||||
// 获取文件名
|
// 获取文件名
|
||||||
|
|
@ -320,7 +320,7 @@ public class EDDataServiceImpl implements EDDataService {
|
||||||
for(EDDataInfo fileInfo : childFileInfoList)
|
for(EDDataInfo fileInfo : childFileInfoList)
|
||||||
{
|
{
|
||||||
if(fileInfo.getDataName().equals(fileFullName)){
|
if(fileInfo.getDataName().equals(fileFullName)){
|
||||||
throw new Exception("上传的文件已存在");
|
throw new FileNotFoundException("上传的文件已存在");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -413,7 +413,7 @@ public class EDDataServiceImpl implements EDDataService {
|
||||||
fileParames.setSaveStatus("failure");
|
fileParames.setSaveStatus("failure");
|
||||||
edDataRepository.updateFileInfo(fileParames);
|
edDataRepository.updateFileInfo(fileParames);
|
||||||
log.info("文件保存失败: " + fileSaveFullPath);
|
log.info("文件保存失败: " + fileSaveFullPath);
|
||||||
throw new Exception(e.getMessage());
|
throw new FileNotFoundException(e.getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -575,7 +575,7 @@ public class EDDataServiceImpl implements EDDataService {
|
||||||
log.error("文件加密错误..", e);
|
log.error("文件加密错误..", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
log.info("目录树数据+文件数据已成功复制到目标目录。" + enCodeZipPathFileName);
|
log.info("目录树数据+文件数据已成功复制到目标目录。" + zipPathFileName);
|
||||||
}
|
}
|
||||||
catch (Exception e) {
|
catch (Exception e) {
|
||||||
log.error("导出数据异常..", e);
|
log.error("导出数据异常..", e);
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,6 @@ import com.electromagnetic.industry.software.data.manage.domain.boardservice.use
|
||||||
import com.electromagnetic.industry.software.data.manage.domain.boardservice.user.params.UserDeleteKeyWords;
|
import com.electromagnetic.industry.software.data.manage.domain.boardservice.user.params.UserDeleteKeyWords;
|
||||||
import com.electromagnetic.industry.software.data.manage.domain.boardservice.user.repository.UserRepository;
|
import com.electromagnetic.industry.software.data.manage.domain.boardservice.user.repository.UserRepository;
|
||||||
import com.electromagnetic.industry.software.data.manage.domain.boardservice.user.service.UserService;
|
import com.electromagnetic.industry.software.data.manage.domain.boardservice.user.service.UserService;
|
||||||
import electromagnetic.data.framework.share.constants.UserConstants;
|
|
||||||
import electromagnetic.data.framework.share.exception.LoggerConstant;
|
import electromagnetic.data.framework.share.exception.LoggerConstant;
|
||||||
import electromagnetic.data.framework.share.util.SignUtils;
|
import electromagnetic.data.framework.share.util.SignUtils;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
|
|
@ -113,11 +112,6 @@ public class UserServiceImpl implements UserService {
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Boolean deleteUser(UserDeleteKeyWords userDeleteKeyWords) {
|
public Boolean deleteUser(UserDeleteKeyWords userDeleteKeyWords) {
|
||||||
|
|
||||||
String workNumber = userRepository.getSingleUser(userDeleteKeyWords.getUserId()).getWorkNumber();
|
|
||||||
if (UserConstants.ADMIN_WORK_NUMBER.equals(workNumber)) {
|
|
||||||
throw new RuntimeException("管理员用户无法删除");
|
|
||||||
}
|
|
||||||
return userRepository.deleteUser(userDeleteKeyWords)>0;
|
return userRepository.deleteUser(userDeleteKeyWords)>0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -80,10 +80,6 @@
|
||||||
<artifactId>zip4j</artifactId>
|
<artifactId>zip4j</artifactId>
|
||||||
<version>2.11.5</version>
|
<version>2.11.5</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
|
||||||
<groupId>io.jsonwebtoken</groupId>
|
|
||||||
<artifactId>jjwt</artifactId>
|
|
||||||
</dependency>
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
</project>
|
</project>
|
||||||
|
|
@ -28,9 +28,4 @@ public class UserConstants {
|
||||||
public static final String LOGIN_USER_NAME = "userName";
|
public static final String LOGIN_USER_NAME = "userName";
|
||||||
public static final String LOGIN_WORK_NUMBER = "workNumber";
|
public static final String LOGIN_WORK_NUMBER = "workNumber";
|
||||||
public static final String LOGIN_USER_ID = "userId";
|
public static final String LOGIN_USER_ID = "userId";
|
||||||
|
|
||||||
/**
|
|
||||||
* 管理员账号
|
|
||||||
*/
|
|
||||||
public static final String ADMIN_WORK_NUMBER = "100000";
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -104,12 +104,6 @@
|
||||||
<if test="effectFlag != null and effectFlag!=''">
|
<if test="effectFlag != null and effectFlag!=''">
|
||||||
effect_flag = #{effectFlag,jdbcType=VARCHAR},
|
effect_flag = #{effectFlag,jdbcType=VARCHAR},
|
||||||
</if>
|
</if>
|
||||||
<if test="userId != null and userId!=''">
|
|
||||||
modifier = #{userId,jdbcType=VARCHAR},
|
|
||||||
</if>
|
|
||||||
<if test="userName != null and userName!=''">
|
|
||||||
modifier_name = #{userName,jdbcType=VARCHAR},
|
|
||||||
</if>
|
|
||||||
gmt_modified = now()
|
gmt_modified = now()
|
||||||
</set>
|
</set>
|
||||||
<where>
|
<where>
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,6 @@ 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 electromagnetic.data.framework.share.util.UserThreadLocal;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
|
|
||||||
|
|
@ -74,10 +73,10 @@ public class EDDataFacadeImpl implements EDDataFacade {
|
||||||
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(UserThreadLocal.getUserId());
|
edDataInfo.setCreator(request.getUserId());
|
||||||
edDataInfo.setCreatorName(UserThreadLocal.getUsername());
|
edDataInfo.setCreatorName(request.getUserName());
|
||||||
edDataInfo.setModifier(UserThreadLocal.getUserId());
|
edDataInfo.setModifier(request.getUserId());
|
||||||
edDataInfo.setModifierName(UserThreadLocal.getUsername());
|
edDataInfo.setModifierName(request.getUserName());
|
||||||
edDataInfo.setCategoryId(request.getParentId());
|
edDataInfo.setCategoryId(request.getParentId());
|
||||||
edDataInfo.setDataName(request.getName());
|
edDataInfo.setDataName(request.getName());
|
||||||
edDataInfo.setNote(request.getNote());
|
edDataInfo.setNote(request.getNote());
|
||||||
|
|
@ -92,7 +91,7 @@ public class EDDataFacadeImpl implements EDDataFacade {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
return ElectromagneticResultUtil.success(edDataService.createDataInfo(edDataInfo));
|
return ElectromagneticResultUtil.success(edDataService.createDataInfo(edDataInfo));
|
||||||
} catch (Exception e) {
|
} catch (FileNotFoundException e) {
|
||||||
log.error("创建文件夹失败。。。", e);
|
log.error("创建文件夹失败。。。", e);
|
||||||
return ElectromagneticResultUtil.fail("500", e.getMessage());
|
return ElectromagneticResultUtil.fail("500", e.getMessage());
|
||||||
}
|
}
|
||||||
|
|
@ -128,11 +127,9 @@ public class EDDataFacadeImpl implements EDDataFacade {
|
||||||
public ElectromagneticResult<Boolean> updateFileInfo(EDDataRequest request)
|
public ElectromagneticResult<Boolean> updateFileInfo(EDDataRequest request)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
EDDataParams parames = EDDataMappers.INSTANCE.getEDDataParames(request);
|
EDDataParams parames= EDDataMappers.INSTANCE.getEDDataParames(request);
|
||||||
parames.setUserId(UserThreadLocal.getUserId());
|
|
||||||
parames.setUserName(UserThreadLocal.getUsername());
|
|
||||||
return ElectromagneticResultUtil.success(edDataService.updateFileInfo(parames));
|
return ElectromagneticResultUtil.success(edDataService.updateFileInfo(parames));
|
||||||
} catch (Exception e) {
|
} catch (FileNotFoundException e) {
|
||||||
log.error("文件信息更新失败。。。", e);
|
log.error("文件信息更新失败。。。", e);
|
||||||
return ElectromagneticResultUtil.fail("500", e.getMessage());
|
return ElectromagneticResultUtil.fail("500", e.getMessage());
|
||||||
}
|
}
|
||||||
|
|
@ -165,10 +162,8 @@ public class EDDataFacadeImpl implements EDDataFacade {
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
EDDataParams parames= EDDataMappers.INSTANCE.getEDDataParames(request);
|
EDDataParams parames= EDDataMappers.INSTANCE.getEDDataParames(request);
|
||||||
parames.setUserId(UserThreadLocal.getUserId());
|
|
||||||
parames.setUserName(UserThreadLocal.getUsername());
|
|
||||||
return ElectromagneticResultUtil.success(edDataService.uploadFile(parames));
|
return ElectromagneticResultUtil.success(edDataService.uploadFile(parames));
|
||||||
} catch (Exception e) {
|
} catch (FileNotFoundException e) {
|
||||||
log.error("上传文件失败。。。", e);
|
log.error("上传文件失败。。。", e);
|
||||||
return ElectromagneticResultUtil.fail("500", e.getMessage());
|
return ElectromagneticResultUtil.fail("500", e.getMessage());
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue