Commit 24df301e authored by wdy's avatar wdy

Merge branch 'dev' into 'master'

dev - master 35

See merge request !394
parents 5b84472b 66cda2a3
...@@ -9,6 +9,7 @@ import java.util.Date; ...@@ -9,6 +9,7 @@ import java.util.Date;
import java.util.List; import java.util.List;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import com.ruoyi.domain.vo.AttachmentsVO;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
...@@ -69,11 +70,17 @@ public class ReviewEnterpriseArchive implements Serializable { ...@@ -69,11 +70,17 @@ public class ReviewEnterpriseArchive implements Serializable {
private String storage; private String storage;
/** /**
* 图片地址 * 附件地址
*/ */
@ApiModelProperty("图片地址") @ApiModelProperty("附件地址")
private String photo; private String photo;
/**
* 附件名称
*/
@ApiModelProperty("附件名称")
private String photoName;
/** /**
* 关联到任务id * 关联到任务id
*/ */
...@@ -90,6 +97,6 @@ public class ReviewEnterpriseArchive implements Serializable { ...@@ -90,6 +97,6 @@ public class ReviewEnterpriseArchive implements Serializable {
@ApiModelProperty("附件") @ApiModelProperty("附件")
@TableField(exist = false) @TableField(exist = false)
private String[] url; List<AttachmentsVO> url;
} }
\ No newline at end of file
package com.ruoyi.domain.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;
@Data
@Accessors(chain = true)
public class AttachmentsVO {
// 附件路径
@ApiModelProperty("附件路径")
String path;
// 附件名称
@ApiModelProperty("附件名称")
String name;
// 构造函数
public AttachmentsVO(String path, String name) {
this.path = path;
this.name = name;
}
// 默认构造函数
public AttachmentsVO() {
// 可以为空,或者初始化一些默认值
}
}
...@@ -11,9 +11,7 @@ import com.ruoyi.common.utils.SecurityUtils; ...@@ -11,9 +11,7 @@ import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.StringUtils; import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.domain.ReviewEnterpriseArchive; import com.ruoyi.domain.ReviewEnterpriseArchive;
import com.ruoyi.domain.Task; import com.ruoyi.domain.Task;
import com.ruoyi.domain.vo.EnterpriseImportFileVO; import com.ruoyi.domain.vo.*;
import com.ruoyi.domain.vo.ReviewEnterpriseArchiveViewItemVO;
import com.ruoyi.domain.vo.ReviewEnterpriseArchiveViewVO;
import com.ruoyi.mapper.TaskMapper; import com.ruoyi.mapper.TaskMapper;
import com.ruoyi.service.ReviewEnterpriseArchiveService; import com.ruoyi.service.ReviewEnterpriseArchiveService;
import com.ruoyi.mapper.ReviewEnterpriseArchiveMapper; import com.ruoyi.mapper.ReviewEnterpriseArchiveMapper;
...@@ -34,6 +32,7 @@ import java.util.Date; ...@@ -34,6 +32,7 @@ import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Objects; import java.util.Objects;
import java.util.*; import java.util.*;
import java.util.stream.Collectors;
import static com.ruoyi.common.utils.DateUtils.getNowDate; import static com.ruoyi.common.utils.DateUtils.getNowDate;
...@@ -151,9 +150,18 @@ public class ReviewEnterpriseArchiveServiceImpl extends ServiceImpl<ReviewEnterp ...@@ -151,9 +150,18 @@ public class ReviewEnterpriseArchiveServiceImpl extends ServiceImpl<ReviewEnterp
throw new ServiceException("新增文件名称重复,请检查", HttpStatus.ERROR); throw new ServiceException("新增文件名称重复,请检查", HttpStatus.ERROR);
} else { } else {
// 将附件地址存入photo字段中 // 将附件地址存入photo字段中
if (reviewEnterpriseArchive.getUrl() != null && reviewEnterpriseArchive.getUrl().length != 0) { if (reviewEnterpriseArchive.getUrl() != null && reviewEnterpriseArchive.getUrl().size() != 0) {
String joinUrl = StringUtils.join(reviewEnterpriseArchive.getUrl(),",");
reviewEnterpriseArchive.setPhoto(joinUrl); String photo = reviewEnterpriseArchive.getUrl().stream()
.map(AttachmentsVO::getPath)
.collect(Collectors.joining(","));
String photoName = reviewEnterpriseArchive.getUrl().stream()
.map(AttachmentsVO::getName)
.collect(Collectors.joining(","));
reviewEnterpriseArchive.setPhoto(photo);
reviewEnterpriseArchive.setPhotoName(photoName);
} }
reviewEnterpriseArchiveService.save(reviewEnterpriseArchive); reviewEnterpriseArchiveService.save(reviewEnterpriseArchive);
...@@ -185,7 +193,18 @@ public class ReviewEnterpriseArchiveServiceImpl extends ServiceImpl<ReviewEnterp ...@@ -185,7 +193,18 @@ public class ReviewEnterpriseArchiveServiceImpl extends ServiceImpl<ReviewEnterp
@Override @Override
public ReviewEnterpriseArchive getInfo(ReviewEnterpriseArchiveGetInfoRequest request) { public ReviewEnterpriseArchive getInfo(ReviewEnterpriseArchiveGetInfoRequest request) {
ReviewEnterpriseArchive reviewEnterpriseArchive = reviewEnterpriseArchiveMapper.selectById(request.getId()); ReviewEnterpriseArchive reviewEnterpriseArchive = reviewEnterpriseArchiveMapper.selectById(request.getId());
reviewEnterpriseArchive.setUrl(reviewEnterpriseArchive.getPhoto().split(","));
// 按逗号拆分字符串
String[] photoUrls = reviewEnterpriseArchive.getPhoto().split(",");
String[] photoNames = reviewEnterpriseArchive.getPhotoName().split(",");
// 将拆分后的字符串配对创建AttachmentsVO对象,并加入到List中
List<AttachmentsVO> attachmentsVOList = new ArrayList<>();
for (int i = 0; i < photoUrls.length; i++) {
AttachmentsVO vo = new AttachmentsVO(photoUrls[i], photoNames[i]);
attachmentsVOList.add(vo);
}
reviewEnterpriseArchive.setUrl(attachmentsVOList);
return reviewEnterpriseArchive; return reviewEnterpriseArchive;
} }
...@@ -251,9 +270,18 @@ public class ReviewEnterpriseArchiveServiceImpl extends ServiceImpl<ReviewEnterp ...@@ -251,9 +270,18 @@ public class ReviewEnterpriseArchiveServiceImpl extends ServiceImpl<ReviewEnterp
@Override @Override
public void editEnterpriseArchive(ReviewEnterpriseArchive reviewEnterpriseArchive) { public void editEnterpriseArchive(ReviewEnterpriseArchive reviewEnterpriseArchive) {
// 将附件地址存入photo字段中 // 将附件地址存入photo字段中
if (reviewEnterpriseArchive.getUrl() != null && reviewEnterpriseArchive.getUrl().length != 0) { if (reviewEnterpriseArchive.getUrl() != null && reviewEnterpriseArchive.getUrl().size() != 0) {
String joinUrl = StringUtils.join(reviewEnterpriseArchive.getUrl(),",");
reviewEnterpriseArchive.setPhoto(joinUrl); String photo = reviewEnterpriseArchive.getUrl().stream()
.map(AttachmentsVO::getPath)
.collect(Collectors.joining(","));
String photoName = reviewEnterpriseArchive.getUrl().stream()
.map(AttachmentsVO::getName)
.collect(Collectors.joining(","));
reviewEnterpriseArchive.setPhoto(photo);
reviewEnterpriseArchive.setPhotoName(photoName);
} }
reviewEnterpriseArchiveService.updateById(reviewEnterpriseArchive); reviewEnterpriseArchiveService.updateById(reviewEnterpriseArchive);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment