fix: 不符合项库文件无法上传
This commit is contained in:
+9
-9
@@ -4,20 +4,19 @@ import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import java.io.Serializable;
|
||||
import java.util.Collections;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.jero.common.aspect.annotation.Dict;
|
||||
import com.jero.modules.assessmentLibrary.entity.vo.MaterialFile;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import org.jeecgframework.poi.excel.annotation.Excel;
|
||||
import org.jeecgframework.poi.excel.annotation.ExcelCollection;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Collections;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 不符合项库
|
||||
* @TableName laws_evaluation_not_met_library
|
||||
@@ -109,8 +108,8 @@ public class LawsEvaluationNotMetLibrary implements Serializable {
|
||||
* 评估人
|
||||
*/
|
||||
@ApiModelProperty(value = "评估人")
|
||||
@Excel(name = "评估人", width = 15, orderNum = "8", dictTable = "sys_user", dicCode = "id", dicText = "realname")
|
||||
@Dict(dictTable = "sys_user", dicCode = "id", dicText = "realname")
|
||||
@Excel(name = "评估人", width = 15, orderNum = "8", dictTable = "sys_user", dicCode = "id", dicText = "CONCAT(realname, '(', username, ')')")
|
||||
private String assessor;
|
||||
|
||||
/**
|
||||
@@ -217,8 +216,9 @@ public class LawsEvaluationNotMetLibrary implements Serializable {
|
||||
* 附件
|
||||
*/
|
||||
@ApiModelProperty(value = "附件")
|
||||
@ExcelCollection(name = "")
|
||||
private List<MaterialFile> materialFileList = Collections.emptyList();
|
||||
@ExcelCollection(name = "", orderNum = "13")
|
||||
@TableField(exist = false)
|
||||
private List<NotMetFile> fileList = Collections.emptyList();
|
||||
|
||||
/**
|
||||
* 标准ID
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.jero.modules.assessmentLibrary.entity;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import org.jeecgframework.poi.excel.annotation.Excel;
|
||||
|
||||
@Data
|
||||
public class NotMetFile {
|
||||
@ApiModelProperty(value = "id")
|
||||
private String id;
|
||||
|
||||
@Excel(name = "附件", width = 15)
|
||||
@ApiModelProperty(value = "附件")
|
||||
private String fileName;
|
||||
}
|
||||
+9
-16
@@ -4,7 +4,6 @@ import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.jero.common.exception.JeroBootException;
|
||||
@@ -12,14 +11,10 @@ import com.jero.common.system.query.QueryGenerator;
|
||||
import com.jero.common.util.FileUtils;
|
||||
import com.jero.common.util.MinioUtil;
|
||||
import com.jero.common.util.ZipUtil;
|
||||
import com.jero.modules.assessmentLibrary.entity.LawsConformityAssessmentLibrary;
|
||||
import com.jero.modules.assessmentLibrary.entity.LawsConformityAssessmentLibraryDetail;
|
||||
import com.jero.modules.assessmentLibrary.entity.LawsEvaluationNotMetLibrary;
|
||||
import com.jero.modules.assessmentLibrary.entity.vo.LawsConformityAssessmentLibraryExportVO;
|
||||
import com.jero.modules.assessmentLibrary.entity.vo.MaterialFile;
|
||||
import com.jero.modules.assessmentLibrary.entity.NotMetFile;
|
||||
import com.jero.modules.assessmentLibrary.mapper.LawsEvaluationNotMetLibraryMapper;
|
||||
import com.jero.modules.assessmentLibrary.service.ILawsEvaluationNotMetLibraryService;
|
||||
import com.jero.modules.laws.enterprise.util.BeanCopyUtils;
|
||||
import com.jero.modules.oss.entity.OSSFile;
|
||||
import com.jero.modules.oss.service.IOSSFileService;
|
||||
import com.jero.modules.projectLibrary.common.AssessCommon;
|
||||
@@ -40,8 +35,6 @@ import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.net.URLEncoder;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
@@ -158,11 +151,11 @@ public class LawsEvaluationNotMetLibraryServiceImpl extends ServiceImpl<LawsEval
|
||||
cellStyle.setWrapText(true);
|
||||
int i = 1;
|
||||
for (LawsEvaluationNotMetLibrary vo : vos) {
|
||||
if (!Objects.isNull(vo.getMaterial()) && !vo.getMaterialFileList().isEmpty()) {
|
||||
for (MaterialFile materialFile : vo.getMaterialFileList()) {
|
||||
if (!Objects.isNull(vo.getFile()) && !vo.getFileList().isEmpty()) {
|
||||
for (NotMetFile notMetFile : vo.getFileList()) {
|
||||
Row row = sheet.getRow(i);
|
||||
Cell cell = row.getCell(18);
|
||||
cell.setCellFormula("HYPERLINK(\"" + materialFile.getFileName() + "\", \"" + materialFile.getFileName() + "\")");
|
||||
Cell cell = row.getCell(12);
|
||||
cell.setCellFormula("HYPERLINK(\"" + notMetFile.getFileName() + "\", \"" + notMetFile.getFileName() + "\")");
|
||||
cell.setCellStyle(cellStyle);
|
||||
i += 1;
|
||||
}
|
||||
@@ -176,13 +169,13 @@ public class LawsEvaluationNotMetLibraryServiceImpl extends ServiceImpl<LawsEval
|
||||
IOException {
|
||||
for (LawsEvaluationNotMetLibrary vo : excelVos) {
|
||||
// 查询文件
|
||||
if (StringUtils.isNotBlank(vo.getMaterial())) {
|
||||
List<String> fileIdList = Arrays.asList(vo.getMaterial().split(","));
|
||||
if (StringUtils.isNotBlank(vo.getFile())) {
|
||||
List<String> fileIdList = Arrays.asList(vo.getFile().split(","));
|
||||
List<OSSFile> ossFileList = ossFileService.listByIds(fileIdList);
|
||||
if (!ossFileList.isEmpty()) {
|
||||
// 赋值
|
||||
List<MaterialFile> materialFileList = com.jero.common.util.BeanCopyUtils.copyBeanList(ossFileList, MaterialFile.class);
|
||||
vo.setMaterialFileList(materialFileList);
|
||||
List<NotMetFile> notMetFileList = com.jero.common.util.BeanCopyUtils.copyBeanList(ossFileList, NotMetFile.class);
|
||||
vo.setFileList(notMetFileList);
|
||||
// 写出文件
|
||||
for (OSSFile ossFile : ossFileList) {
|
||||
InputStream inputStream = MinioUtil.getMinioFile(MinioUtil.getBucketName(), ossFile.getUrl());
|
||||
|
||||
Reference in New Issue
Block a user