|
|
|
@ -85,7 +85,12 @@ public class SceneTabServiceImpl implements ISceneTabService { |
|
|
|
* @return 结果 |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
public int insertSceneTab(MultipartFile[] files, SceneTab sceneTab) { |
|
|
|
public ZDResponse insertSceneTab(MultipartFile[] files, SceneTab sceneTab) { |
|
|
|
if (ObjectUtil.isEmpty(files) || files.length > 1) { |
|
|
|
return ZDResponse.error("文件不能为空且只允许上传一张图片"); |
|
|
|
} |
|
|
|
String uploadPath = fileUploadApi.upload(files[0]); |
|
|
|
zdxtFileCommonApi.insertZdxtFile(files[0], sceneTab.getGuid() + "", uploadPath); |
|
|
|
UserBean userBean = userApi.getCurrentUser(); |
|
|
|
if (Objects.nonNull(userBean)) { |
|
|
|
sceneTab.setCreator(userBean.getUserName()); |
|
|
|
@ -95,14 +100,14 @@ public class SceneTabServiceImpl implements ISceneTabService { |
|
|
|
if (!StringUtils.isEmpty(sceneTab.getPagePath())) { |
|
|
|
sceneTab.setType(TYPE_TAB.get(sceneTab.getPagePath())); |
|
|
|
} |
|
|
|
sceneTab.setIconPath(uploadPath); |
|
|
|
int result = sceneTabMapper.insertSceneTab(sceneTab); |
|
|
|
// 上传文件,并在附件表中添加记录
|
|
|
|
if (result > 0 && ObjectUtil.isNotEmpty(files)) { |
|
|
|
for (MultipartFile file : files) { |
|
|
|
zdxtFileCommonApi.insertZdxtFile(file, sceneTab.getGuid() + "", fileUploadApi.upload(file)); |
|
|
|
} |
|
|
|
if (result > 0) { |
|
|
|
zdxtFileCommonApi.insertZdxtFile(files[0], sceneTab.getGuid() + "", uploadPath); |
|
|
|
return ZDResponse.success(); |
|
|
|
} |
|
|
|
return result; |
|
|
|
return ZDResponse.error("新增失败"); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
@ -112,16 +117,20 @@ public class SceneTabServiceImpl implements ISceneTabService { |
|
|
|
* @return 结果 |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
public int selected(MultipartFile[] files, SceneTab sceneTab) { |
|
|
|
int result = 0; |
|
|
|
public ZDResponse selected(MultipartFile[] files, SceneTab sceneTab) { |
|
|
|
if (ObjectUtil.isEmpty(files) || files.length > 1) { |
|
|
|
return ZDResponse.error("文件不能为空且只允许上传一张图片"); |
|
|
|
} |
|
|
|
String uploadPath = fileUploadApi.upload(files[0]); |
|
|
|
sceneTab.setSelectedIconPath(uploadPath); |
|
|
|
int result = sceneTabMapper.updateSceneTab(sceneTab); |
|
|
|
// 上传文件,并在附件表中添加记录
|
|
|
|
if (ObjectUtil.isNotEmpty(files)) { |
|
|
|
if (result > 0) { |
|
|
|
zdxtFileCommonApi.deleteZdxtFileByIds(sceneTab.getGuid() + "0000"); |
|
|
|
for (MultipartFile file : files) { |
|
|
|
result = zdxtFileCommonApi.insertZdxtFile(file, sceneTab.getGuid() + "0000", fileUploadApi.upload(file)); |
|
|
|
} |
|
|
|
zdxtFileCommonApi.insertZdxtFile(files[0], sceneTab.getGuid() + "0000", uploadPath); |
|
|
|
return ZDResponse.success(); |
|
|
|
} |
|
|
|
return result; |
|
|
|
return ZDResponse.error("编辑选中图片失败"); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
@ -131,16 +140,20 @@ public class SceneTabServiceImpl implements ISceneTabService { |
|
|
|
* @return 结果 |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
public int updateSceneTab(MultipartFile[] files, SceneTab sceneTab) { |
|
|
|
public ZDResponse updateSceneTab(MultipartFile[] files, SceneTab sceneTab) { |
|
|
|
if (ObjectUtil.isEmpty(files) || files.length > 1) { |
|
|
|
return ZDResponse.error("文件不能为空且只允许上传一张图片"); |
|
|
|
} |
|
|
|
String uploadPath = fileUploadApi.upload(files[0]); |
|
|
|
sceneTab.setIconPath(uploadPath); |
|
|
|
int result = sceneTabMapper.updateSceneTab(sceneTab); |
|
|
|
// 上传文件,并在附件表中添加记录
|
|
|
|
if (result > 0 && ObjectUtil.isNotEmpty(files)) { |
|
|
|
if (result > 0) { |
|
|
|
zdxtFileCommonApi.deleteZdxtFileByIds(sceneTab.getGuid()); |
|
|
|
for (MultipartFile file : files) { |
|
|
|
zdxtFileCommonApi.insertZdxtFile(file, sceneTab.getGuid() + "", fileUploadApi.upload(file)); |
|
|
|
} |
|
|
|
zdxtFileCommonApi.insertZdxtFile(files[0], sceneTab.getGuid() + "", uploadPath); |
|
|
|
return ZDResponse.success(); |
|
|
|
} |
|
|
|
return result; |
|
|
|
return ZDResponse.error("编辑失败"); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
|