fix(文档拆分): 导入导出
This commit is contained in:
@@ -6,20 +6,38 @@ package com.jero.modules.document.enums;
|
||||
* @auth zhn
|
||||
*/
|
||||
public enum FieldTypeEnum {
|
||||
//属性类型 1输入框(字符串),2输入框(数字),3单选下拉框,4多选下拉框,5单日期选择,6多日期选择,7文件,8文本框,9人员选择,10标准选择
|
||||
TREE("树形结构","0"),
|
||||
TEXT_STRING("输入框(字符串)","1"),
|
||||
TEXT_NUMBER("输入框(数字)","2"),
|
||||
PULL_SINGLE("单选下拉框","3"),
|
||||
PULL_MORE("多选下拉框","4"),
|
||||
DATE_SINGLE("单日期选择","5"),
|
||||
DATE_MORE("多日期选择","6"),
|
||||
FILE("文件","7"),
|
||||
TEXT("文本框","8"),
|
||||
PERSON("人员选择","9"),
|
||||
STANDARD("标准选择","10"),
|
||||
TEXT_LINK("输入框(链接)","11");
|
||||
/**
|
||||
* 旧的不用了
|
||||
* //属性类型 1输入框(字符串),2输入框(数字),3单选下拉框,4多选下拉框,5单日期选择,6多日期选择,7文件,8文本框,9人员选择,10标准选择
|
||||
* TREE("树形结构","0"),
|
||||
* TEXT_STRING("输入框(字符串)","1"),
|
||||
* TEXT_NUMBER("输入框(数字)","2"),
|
||||
* PULL_SINGLE("单选下拉框","3"),
|
||||
* PULL_MORE("多选下拉框","4"),
|
||||
* DATE_SINGLE("单日期选择","5"),
|
||||
* DATE_MORE("多日期选择","6"),
|
||||
* FILE("文件","7"),
|
||||
* TEXT("文本框","8"),
|
||||
* PERSON("人员选择","9"),
|
||||
* STANDARD("标准选择","10"),
|
||||
* TEXT_LINK("输入框(链接)","11");
|
||||
*/
|
||||
|
||||
DATE_SINGLE("单日期选择","1"),
|
||||
PERSON("单选用户弹框","2"),
|
||||
GROUP_SINGLE("单选组织机构弹框","3"),
|
||||
DATE_MORE("多日期选择","4"),
|
||||
TEXT_MANY("多行文本","5"),
|
||||
STANDARD("多选标准弹框","6"),
|
||||
GROUP_MANY("多选组织机构弹框","7"),
|
||||
FILE("上传文件","8"),
|
||||
TEXT("文本框","9"),
|
||||
PULL_SINGLE("下拉单选","10"),
|
||||
PULL_MORE("下拉多选","11"),
|
||||
TREE_BOX("树型结构(多选)","12"),
|
||||
TEXT_LINK("输入框(链接)","13"),
|
||||
YEAR_OPTION("年份选择","14"),
|
||||
TREE("树型结构(单选)","15");
|
||||
|
||||
|
||||
String name;
|
||||
|
||||
+10
-56
@@ -1,46 +1,20 @@
|
||||
package com.jero.modules.document.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.core.util.ZipUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.aliyuncs.utils.IOUtils;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.jero.common.constant.CommonConstant;
|
||||
import com.jero.common.constant.WebsocketConst;
|
||||
import com.jero.common.constant.enums.*;
|
||||
import com.jero.common.constant.enums.LanguageEnum;
|
||||
import com.jero.common.constant.enums.YesOrNoEnum;
|
||||
import com.jero.common.es.JeroElasticsearchTemplate;
|
||||
import com.jero.common.exception.JeroBootException;
|
||||
import com.jero.common.system.query.QueryRuleEnum;
|
||||
import com.jero.common.system.vo.LoginUser;
|
||||
import com.jero.common.util.DateUtils;
|
||||
import com.jero.common.util.MinioUtil;
|
||||
import com.jero.generater.modules.online.cgform.entity.OnlCgformField;
|
||||
import com.jero.generater.modules.online.cgform.service.impl.OnlCgformFieldServiceImpl;
|
||||
//import com.jero.modules.document.entity.BussDocumentLibraryEO;
|
||||
import com.jero.modules.document.entity.OSSFileForDocumentLibrary;
|
||||
import com.jero.modules.document.enums.FieldTypeEnum;
|
||||
import com.jero.modules.document.enums.ImplementationTypeEnum;
|
||||
import com.jero.modules.document.enums.LawsStateEnum;
|
||||
import com.jero.modules.document.enums.SearchEnum;
|
||||
import com.jero.modules.document.mapper.BussDocumentLibraryEOMapper;
|
||||
import com.jero.modules.document.service.IBussDocumentLibraryEOService;
|
||||
import com.jero.modules.log.entity.BussLogEO;
|
||||
import com.jero.modules.log.service.IBussLogEOService;
|
||||
import com.jero.modules.message.websocket.WebSocket;
|
||||
//import com.jero.modules.ocr.service.IOcrRecordEOService;
|
||||
import com.jero.modules.oss.entity.OSSFile;
|
||||
import com.jero.modules.oss.service.IOSSFileService;
|
||||
import com.jero.modules.split.common.FileUnZip;
|
||||
import com.jero.modules.split.entity.SarFileSplitInfoEO;
|
||||
import com.jero.modules.split.service.ISarFileSplitInfoService;
|
||||
import com.jero.modules.system.entity.*;
|
||||
import com.jero.modules.system.entity.SysCategory;
|
||||
import com.jero.modules.system.entity.SysCategoryTreeVO;
|
||||
import com.jero.modules.system.mapper.SysUserMapper;
|
||||
import com.jero.modules.system.service.ISysAnnouncementService;
|
||||
import com.jero.modules.system.service.ISysDepartService;
|
||||
@@ -48,39 +22,19 @@ import com.jero.modules.system.service.ISysUserService;
|
||||
import com.jero.modules.system.service.impl.SysCategoryServiceImpl;
|
||||
import com.jero.modules.system.service.impl.SysDictItemServiceImpl;
|
||||
import com.jero.modules.system.util.MyStringUtils;
|
||||
import com.jero.modules.system.util.PDFUtils;
|
||||
import com.jero.modules.tag.entity.LawsArea;
|
||||
import com.jero.modules.tag.service.impl.LawsAreaServiceImpl;
|
||||
import lombok.SneakyThrows;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.apache.commons.collections.map.HashedMap;
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.poi.hssf.usermodel.*;
|
||||
import org.apache.poi.ss.usermodel.*;
|
||||
import org.apache.poi.ss.util.CellRangeAddress;
|
||||
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
||||
import org.apache.shiro.SecurityUtils;
|
||||
import org.aspectj.util.FileUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import org.springframework.mock.web.MockMultipartFile;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.*;
|
||||
import java.text.DateFormat;
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.*;
|
||||
import java.util.function.Predicate;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
||||
@@ -359,8 +313,8 @@ public class BussDocumentLibraryEOServiceImpl extends ServiceImpl<BussDocumentLi
|
||||
//搜索中心输入框
|
||||
fieldList = fieldList.stream()
|
||||
.filter(e -> YesOrNoEnum.YES.getValue().equals(MyStringUtils.valueOf(e.getIsShowSearch()))
|
||||
&& (FieldTypeEnum.TEXT_STRING.getValue().equals(e.getFieldShowType()) //输入框(字符串)
|
||||
|| FieldTypeEnum.TEXT_NUMBER.getValue().equals(e.getFieldShowType())//输入框(数字)
|
||||
&& (FieldTypeEnum.TEXT.getValue().equals(e.getFieldShowType()) //输入框(字符串)
|
||||
// || FieldTypeEnum.TEXT_NUMBER.getValue().equals(e.getFieldShowType())//输入框(数字)
|
||||
|| FieldTypeEnum.PERSON.getValue().equals(e.getFieldShowType())//人员选择
|
||||
|| FieldTypeEnum.STANDARD.getValue().equals(e.getFieldShowType())//标准选择
|
||||
|| FieldTypeEnum.TEXT.getValue().equals(e.getFieldShowType())//文本框
|
||||
|
||||
+11
@@ -60,6 +60,17 @@ public interface IDocumentSplitService {
|
||||
*/
|
||||
void add(SarFileSplitInfoEO sarFileSplitInfoEO);
|
||||
|
||||
/**
|
||||
* 拆分文档保存
|
||||
* @param sarFileSplitInfoEO
|
||||
*/
|
||||
void saveDocumentSplitInfo(SarFileSplitInfoEO sarFileSplitInfoEO);
|
||||
|
||||
/**
|
||||
* 唯一性校验
|
||||
*/
|
||||
void uniqueCheck(SarFileSplitInfoEO sarFileSplitInfoEO);
|
||||
|
||||
/**
|
||||
* 文档拆分详情-编辑
|
||||
* @param parameter
|
||||
|
||||
+10
-6
@@ -689,10 +689,12 @@ public class DocumentSplitServiceImpl implements IDocumentSplitService {
|
||||
workbook.write(fos);
|
||||
|
||||
// 同级创建文件夹
|
||||
File savePaperFile = new File(exportExcelTempPath+ File.separator + "外部资源");
|
||||
if (!savePaperFile.exists()) {
|
||||
savePaperFile.mkdirs();
|
||||
}
|
||||
/**
|
||||
* File savePaperFile = new File(exportExcelTempPath+ File.separator + "外部资源");
|
||||
* if (!savePaperFile.exists()) {
|
||||
* savePaperFile.mkdirs();
|
||||
* }
|
||||
*/
|
||||
}catch (Exception e){
|
||||
throw new JeroBootException(e.getMessage());
|
||||
}
|
||||
@@ -913,7 +915,8 @@ public class DocumentSplitServiceImpl implements IDocumentSplitService {
|
||||
return stringBuilder.toString();
|
||||
}
|
||||
|
||||
private void saveDocumentSplitInfo(SarFileSplitInfoEO sarFileSplitInfoEO) {
|
||||
@Override
|
||||
public void saveDocumentSplitInfo(SarFileSplitInfoEO sarFileSplitInfoEO) {
|
||||
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
||||
Date now = new Date();
|
||||
String infoId = UUID.randomUUID().toString().replace("-", "");
|
||||
@@ -926,7 +929,8 @@ public class DocumentSplitServiceImpl implements IDocumentSplitService {
|
||||
sarFileSplitInfoService.save(sarFileSplitInfoEO);
|
||||
}
|
||||
|
||||
private void uniqueCheck(SarFileSplitInfoEO sarFileSplitInfoEO) {
|
||||
@Override
|
||||
public void uniqueCheck(SarFileSplitInfoEO sarFileSplitInfoEO) {
|
||||
// 文件状态 + 标准号唯一,每个文件状态的标准只能拆分一次
|
||||
DocumentSplitInfo documentSplitInfo = new DocumentSplitInfo();
|
||||
documentSplitInfo.setSerialNumber(sarFileSplitInfoEO.getSerialNumber());
|
||||
|
||||
@@ -278,13 +278,16 @@ public class ConvertHtml2Excel {
|
||||
}
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
String cnt = "\n";
|
||||
List<Integer> c =new ArrayList<>();
|
||||
c.add(1);
|
||||
String tableHtml = "<table><tbody><tr><td colspan='2'>11111111</td><td rowspan='3'>3333333333</td><td>444444444</td></tr><tr><td>5555555</td><td>66666</td><td></td></tr><tr><td></td><td>324234</td><td></td></tr></tbody></table>";
|
||||
tableHtml = tableHtml.replaceAll("<[\\s]*?br[^>]*?>|<[\\s]*?\\/[\\s]*?br[\\s]*?>", cnt);
|
||||
// String cnt = "\n";
|
||||
// List<Integer> c =new ArrayList<>();
|
||||
// c.add(1);
|
||||
// String tableHtml = "<table><tbody><tr><td colspan='2'>11111111</td><td rowspan='3'>3333333333</td><td>444444444</td></tr><tr><td>5555555</td><td>66666</td><td></td></tr><tr><td></td><td>324234</td><td></td></tr></tbody></table>";
|
||||
// tableHtml = tableHtml.replaceAll("<[\\s]*?br[^>]*?>|<[\\s]*?\\/[\\s]*?br[\\s]*?>", cnt);
|
||||
// HSSFWorkbook hssfWorkbook = ConvertHtml2Excel.table2Excel(tableHtml,c,1);
|
||||
// hssfWorkbook.write(FileUtils.openOutputStream(new File("D:\\test\\test1.xls")));
|
||||
String tableHtml = "<table border=\"1\"><tbody><tr><td colspan='3'>自动切换前照灯近光的条件</td></tr><tr><td>外界环境光</td><td>近光灯</td><td>响应时间</td></tr><tr><td>小于1000 lx</td><td>开启</td><td>不大于2 s</td></tr><tr><td>1000 lx〜7000 lx</td><td>由制造商确定</td><td>由制造商确定</td></tr><tr><td>大于7000 lx</td><td>关闭</td><td>大于5 s,不大于300 s</td></tr><tr><td colspan='3'>注:使用经过余弦修正的照度计与车辆传感器安装位置等高的水平面上进行测量。</td></tr></tbody></table>";
|
||||
Document data = DocumentHelper.parseText(tableHtml);
|
||||
System.out.println();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+2
-31
@@ -5,10 +5,7 @@ import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.jero.common.api.vo.Result;
|
||||
import com.jero.common.aspect.annotation.AutoLog;
|
||||
import com.jero.common.constant.enums.LanguageEnum;
|
||||
import com.jero.common.system.base.controller.JeroController;
|
||||
import com.jero.common.util.oConvertUtils;
|
||||
import com.jero.modules.oss.entity.OSSFile;
|
||||
import com.jero.modules.oss.service.IOSSFileService;
|
||||
import com.jero.modules.split.entity.SarFileSplitInfoEO;
|
||||
import com.jero.modules.split.entity.SarFileSplitItemsEO;
|
||||
@@ -19,14 +16,13 @@ import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.commons.lang3.StringEscapeUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import org.springframework.web.multipart.MultipartHttpServletRequest;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
@@ -271,32 +267,7 @@ public class FileSplitItemsEOController extends JeroController<SarFileSplitItems
|
||||
public Result<?> upload(HttpServletRequest request, HttpServletResponse response,
|
||||
@RequestParam(value = "state",required = false) String state,
|
||||
@RequestParam(value = "cut",required = false) String cut) {
|
||||
Result<OSSFile> result = new Result<>();
|
||||
String bizPath = request.getParameter("biz");
|
||||
MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
|
||||
MultipartFile file = multipartRequest.getFile("file");// 获取上传文件对象
|
||||
if (oConvertUtils.isEmpty(bizPath)) {
|
||||
bizPath = "";
|
||||
// if (CommonConstant.UPLOAD_TYPE_OSS.equals(uploadType)) {
|
||||
// //未指定目录,则用阿里云默认目录 upload
|
||||
// bizPath = "upload";
|
||||
// } else {
|
||||
// bizPath = "";
|
||||
// }
|
||||
}
|
||||
OSSFile oSSFile = ossFileService.uploadLocalForSplit(file, bizPath,state,cut);
|
||||
if (oConvertUtils.isNotEmpty(oSSFile)) {
|
||||
result.setResult(oSSFile);
|
||||
result.setSuccess(true);
|
||||
} else {
|
||||
if("cut".equals(LanguageEnum.CN.getValue())){
|
||||
result.setMessage("上传失败!");
|
||||
}else{
|
||||
result.setMessage("fail to upload!");
|
||||
}
|
||||
result.setSuccess(false);
|
||||
}
|
||||
return result;
|
||||
return fileSplitItemsEOService.upload(request, response, state, cut);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+2
@@ -85,4 +85,6 @@ public interface IFileSplitItemsEOService extends IService<SarFileSplitItemsEO>
|
||||
List<Map<String, Object>> getHeader(String flag, String cut);
|
||||
|
||||
List<SarFileSplitItemsEO> selectByInfoId(String infoId);
|
||||
|
||||
Result<OSSFile> upload(HttpServletRequest request, HttpServletResponse response, String state, String cut);
|
||||
}
|
||||
|
||||
+311
-127
@@ -11,8 +11,8 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.jero.common.api.vo.Result;
|
||||
import com.jero.common.constant.enums.LanguageEnum;
|
||||
import com.jero.common.constant.enums.IsMustEnum;
|
||||
import com.jero.common.constant.enums.LanguageEnum;
|
||||
import com.jero.common.constant.enums.ModuleEnum;
|
||||
import com.jero.common.constant.enums.YesOrNoEnum;
|
||||
import com.jero.common.exception.JeroBootException;
|
||||
@@ -20,10 +20,13 @@ import com.jero.common.system.vo.LoginUser;
|
||||
import com.jero.common.util.DateUtils;
|
||||
import com.jero.common.util.MinioUtil;
|
||||
import com.jero.common.util.UUIDUtils;
|
||||
import com.jero.common.util.oConvertUtils;
|
||||
import com.jero.generater.modules.online.cgform.entity.OnlCgformField;
|
||||
import com.jero.generater.modules.online.cgform.service.impl.OnlCgformFieldServiceImpl;
|
||||
import com.jero.modules.document.enums.FieldTypeEnum;
|
||||
import com.jero.modules.document.service.IBussDocumentLibraryEOService;
|
||||
import com.jero.modules.laws.common.mapper.LawsCommonMapper;
|
||||
import com.jero.modules.laws.documenttool.service.IDocumentSplitService;
|
||||
import com.jero.modules.oss.entity.OSSFile;
|
||||
import com.jero.modules.oss.service.IOSSFileService;
|
||||
import com.jero.modules.split.common.ConvertHtml2Excel;
|
||||
@@ -34,6 +37,7 @@ import com.jero.modules.split.dto.FileSpiltValTableExportDto;
|
||||
import com.jero.modules.split.dto.FileSplitValExportDto;
|
||||
import com.jero.modules.split.dto.FileSplitValImgExportDto;
|
||||
import com.jero.modules.split.entity.*;
|
||||
import com.jero.modules.split.enums.SplitEnum;
|
||||
import com.jero.modules.split.mapper.FileSplitItemsEOMapper;
|
||||
import com.jero.modules.split.mapper.SarFileSplitItemsValEOMapper;
|
||||
import com.jero.modules.split.mapper.SarFileSplitMenuEOMapper;
|
||||
@@ -55,6 +59,8 @@ import com.jero.modules.system.service.impl.SysCategoryServiceImpl;
|
||||
import com.jero.modules.system.service.impl.SysDictItemServiceImpl;
|
||||
import com.jero.modules.system.util.MyStringUtils;
|
||||
import com.jero.modules.system.util.UserUtils;
|
||||
import com.jero.modules.tag.entity.LawsTag;
|
||||
import com.jero.modules.tag.enums.TableNameEnum;
|
||||
import org.apache.commons.collections.map.HashedMap;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.commons.io.FileUtils;
|
||||
@@ -79,6 +85,7 @@ import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Propagation;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import org.springframework.web.multipart.MultipartHttpServletRequest;
|
||||
import sun.misc.BASE64Decoder;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
@@ -130,12 +137,18 @@ public class FileSplitItemsEOServiceImpl extends ServiceImpl<FileSplitItemsEOMap
|
||||
private ISysUserService sysUserService;
|
||||
@Autowired
|
||||
private ISarFileSplitMenuEOService sarFileSplitMenuEOService;
|
||||
@Autowired
|
||||
private LawsCommonMapper lawsCommonMapper;
|
||||
@Autowired
|
||||
private IDocumentSplitService documentSplitService;
|
||||
|
||||
|
||||
@Value(value = "${jero.path.upload}")
|
||||
private String uploadpath;
|
||||
@Value(value = "${jero.splitUrl}")
|
||||
private String splitUrl;
|
||||
@Value(value = "${jero.path.uploadCos}")
|
||||
private String uploadCospath;
|
||||
|
||||
@Override
|
||||
public int addItemContent(Map<String, Object> parameter){
|
||||
@@ -326,20 +339,26 @@ public class FileSplitItemsEOServiceImpl extends ServiceImpl<FileSplitItemsEOMap
|
||||
StringBuilder fieldsBuilder = new StringBuilder(); // 字段名称
|
||||
StringBuilder valuesBuilder = new StringBuilder(); // 字段值
|
||||
|
||||
// 查询全部字段列表
|
||||
List<LawsTag> fieldList = lawsCommonMapper.getFieldList(TableNameEnum.DOCUMENT_SPLIT.getTableName());
|
||||
// 列表展示字段
|
||||
List<LawsTag> fieldListSelect = fieldList.stream().filter(v -> YesOrNoEnum.YES.getValue()
|
||||
.equals(String.valueOf(v.getIsShowList()))).collect(Collectors.toList());
|
||||
|
||||
// 查询全部字段属性
|
||||
List<OnlCgformField> fieldList = onlCgformFieldService.getFieldList(ModuleEnum.FILE_SPLIT_ITEMS.getValue());
|
||||
// List<OnlCgformField> fieldList = onlCgformFieldService.getFieldList(ModuleEnum.FILE_SPLIT_ITEMS.getValue());
|
||||
// 文件类型字段
|
||||
List<OnlCgformField> onlFieldFileList = fieldList.stream().filter(e -> FieldTypeEnum.FILE.getValue().equals(e.getFieldShowType())).collect(Collectors.toList());
|
||||
List<String> fieldFieldList = onlFieldFileList.stream().map(OnlCgformField::getDbFieldName).collect(Collectors.toList());
|
||||
List<LawsTag> onlFieldFileList = fieldListSelect.stream().filter(e -> FieldTypeEnum.FILE.getValue().equals(e.getFieldShowType())).collect(Collectors.toList());
|
||||
List<String> fieldFieldList = onlFieldFileList.stream().map(LawsTag::getDbFieldName).collect(Collectors.toList());
|
||||
// 日期类型字段(单日期选择)
|
||||
List<OnlCgformField> onlFieldDateList = fieldList.stream().filter(e -> FieldTypeEnum.DATE_SINGLE.getValue().equals(e.getFieldShowType())).collect(Collectors.toList());
|
||||
List<String> fieldDateList = onlFieldDateList.stream().map(OnlCgformField::getDbFieldName).collect(Collectors.toList());
|
||||
List<LawsTag> onlFieldDateList = fieldListSelect.stream().filter(e -> FieldTypeEnum.DATE_SINGLE.getValue().equals(e.getFieldShowType())).collect(Collectors.toList());
|
||||
List<String> fieldDateList = onlFieldDateList.stream().map(LawsTag::getDbFieldName).collect(Collectors.toList());
|
||||
// 人员选择类型
|
||||
List<OnlCgformField> onlFieldPersonList = fieldList.stream().filter(e -> FieldTypeEnum.PERSON.getValue().equals(e.getFieldShowType())).collect(Collectors.toList());
|
||||
List<String> fieldPersonList = onlFieldPersonList.stream().map(OnlCgformField::getDbFieldName).collect(Collectors.toList());
|
||||
List<LawsTag> onlFieldPersonList = fieldListSelect.stream().filter(e -> FieldTypeEnum.PERSON.getValue().equals(e.getFieldShowType())).collect(Collectors.toList());
|
||||
List<String> fieldPersonList = onlFieldPersonList.stream().map(LawsTag::getDbFieldName).collect(Collectors.toList());
|
||||
// 标准选择类型
|
||||
List<OnlCgformField> onlFieldStanList = fieldList.stream().filter(e -> FieldTypeEnum.STANDARD.getValue().equals(e.getFieldShowType())).collect(Collectors.toList());
|
||||
List<String> fieldStanList = onlFieldStanList.stream().map(OnlCgformField::getDbFieldName).collect(Collectors.toList());
|
||||
List<LawsTag> onlFieldStanList = fieldListSelect.stream().filter(e -> FieldTypeEnum.STANDARD.getValue().equals(e.getFieldShowType())).collect(Collectors.toList());
|
||||
List<String> fieldStanList = onlFieldStanList.stream().map(LawsTag::getDbFieldName).collect(Collectors.toList());
|
||||
|
||||
List<String> fieldPersonIdList = new ArrayList<>();
|
||||
fieldPersonList.forEach(item->{
|
||||
@@ -356,7 +375,7 @@ public class FileSplitItemsEOServiceImpl extends ServiceImpl<FileSplitItemsEOMap
|
||||
Object value = entry.getValue();
|
||||
// 处理日期,文件,人员选择类型的字段
|
||||
//处理日期格式
|
||||
if (fieldDateList.contains(key) && ("creation_time".equals(key) || "modify_time".equals(key))) {
|
||||
if (fieldDateList.contains(key) && ("create_time".equals(key) || "update_time".equals(key))) {
|
||||
if (ObjectUtils.isNotEmpty(value)) {
|
||||
if(value.toString().equals("") || value.toString().equals("null")){
|
||||
continue;
|
||||
@@ -429,7 +448,7 @@ public class FileSplitItemsEOServiceImpl extends ServiceImpl<FileSplitItemsEOMap
|
||||
} else if(fieldPersonIdList.contains(key) || standardIdList.contains(key)){
|
||||
continue;
|
||||
} else {
|
||||
if ("iterms_conditions".equals(key)) {
|
||||
if ("item_content".equals(key)) {
|
||||
value = value.toString().replaceAll("\\\\", "\\\\\\\\").replaceAll("'", "\\\\'");
|
||||
}
|
||||
valuesBuilder.append("," + "'" + value + "'");
|
||||
@@ -750,7 +769,7 @@ public class FileSplitItemsEOServiceImpl extends ServiceImpl<FileSplitItemsEOMap
|
||||
if (key.equals(fieldName)) {
|
||||
//字段类型(判断是输入框还是下拉,等等)
|
||||
String fieldType = (String) map.get("field_show_type");//字段类型
|
||||
if (FieldTypeEnum.TEXT_STRING.getValue().equals(fieldType) || FieldTypeEnum.TEXT_LINK.getValue().equals(fieldType)) {
|
||||
if (FieldTypeEnum.TEXT.getValue().equals(fieldType) || FieldTypeEnum.TEXT_LINK.getValue().equals(fieldType)) {
|
||||
String value = (String) entry.getValue();
|
||||
//输入框 LIKE CONCAT("%", '/%', "%") ESCAPE '/'
|
||||
if(value.contains("%")){
|
||||
@@ -781,7 +800,7 @@ public class FileSplitItemsEOServiceImpl extends ServiceImpl<FileSplitItemsEOMap
|
||||
} else {
|
||||
conditionSb.append(" and " + "date_format(laws_document_split." + key + ",'%Y-%m-%d') = '" + value + "'");
|
||||
}
|
||||
} else if (FieldTypeEnum.TEXT_NUMBER.getValue().equals(fieldType)) {
|
||||
} else if (FieldTypeEnum.TEXT.getValue().equals(fieldType)) {
|
||||
Double value = Double.valueOf(entry.getValue().toString());
|
||||
conditionSb.append(" and laws_document_split." + key + " =" + value);
|
||||
} else if (FieldTypeEnum.PERSON.getValue().equals(fieldType)) {
|
||||
@@ -1016,7 +1035,7 @@ public class FileSplitItemsEOServiceImpl extends ServiceImpl<FileSplitItemsEOMap
|
||||
StringBuilder conditionSb = new StringBuilder();
|
||||
String fieldType = onlCgformField.getFieldShowType();
|
||||
String dbFieldName = onlCgformField.getDbFieldName();
|
||||
if ((FieldTypeEnum.TEXT_STRING.getValue().equals(fieldType) && !"条款号".equals(onlCgformField.getDbFieldTxt()))
|
||||
if ((FieldTypeEnum.TEXT.getValue().equals(fieldType) && !"条文号".equals(onlCgformField.getDbFieldTxt()))
|
||||
|| FieldTypeEnum.TEXT.getValue().equals(fieldType)) {
|
||||
// 追加合并内容
|
||||
oldItemMapList.forEach(item -> {
|
||||
@@ -1060,7 +1079,7 @@ public class FileSplitItemsEOServiceImpl extends ServiceImpl<FileSplitItemsEOMap
|
||||
});
|
||||
ossFileService.updateFileInfo(ossFileList);
|
||||
}
|
||||
} else if(FieldTypeEnum.TEXT_NUMBER.getValue().equals(fieldType)){
|
||||
} else if(FieldTypeEnum.TEXT.getValue().equals(fieldType)){
|
||||
Double num = 0.0;
|
||||
for(Map<String, Object> oldItemMap : oldItemMapList){
|
||||
if(ObjectUtil.isNotEmpty(oldItemMap.get(dbFieldName))) {
|
||||
@@ -1151,25 +1170,30 @@ public class FileSplitItemsEOServiceImpl extends ServiceImpl<FileSplitItemsEOMap
|
||||
List<SplitTableInfo> getSheetTableList) {
|
||||
//此处需要做各种验证,数据库操作
|
||||
try {
|
||||
List<OnlCgformField> onlCgformFieldList = onlCgformFieldService.getFieldList(ModuleEnum.FILE_SPLIT_ITEMS.getValue());
|
||||
// 查询全部字段列表
|
||||
List<LawsTag> fieldLists = lawsCommonMapper.getFieldList(TableNameEnum.DOCUMENT_SPLIT.getTableName());
|
||||
// 列表展示字段
|
||||
List<LawsTag> fieldListSelect = fieldLists.stream().filter(v -> YesOrNoEnum.YES.getValue()
|
||||
.equals(String.valueOf(v.getIsShowList()))).collect(Collectors.toList());
|
||||
// List<OnlCgformField> onlCgformFieldList = onlCgformFieldService.getFieldList(ModuleEnum.FILE_SPLIT_ITEMS.getValue());
|
||||
// 树形数据字典 dictId
|
||||
List<String> dictIdList = onlCgformFieldList.stream()
|
||||
List<String> dictIdList = fieldListSelect.stream()
|
||||
.filter(e -> (YesOrNoEnum.YES.getValue().equals(String.valueOf(e.getIsShowForm()))
|
||||
|| "条款内容".equals(e.getDbFieldName()))
|
||||
|| "条文内容".equals(e.getDbFieldName()))
|
||||
&& FieldTypeEnum.TREE.getValue().equals(e.getFieldShowType())
|
||||
&& StringUtils.isNotBlank(e.getDictId())
|
||||
)
|
||||
.map(OnlCgformField :: getDictId)
|
||||
.map(LawsTag :: getDictId)
|
||||
.distinct()
|
||||
.collect(Collectors.toList());
|
||||
// 普通数据字典 dictCode
|
||||
List<String> dictCodeList = onlCgformFieldList.stream()
|
||||
List<String> dictCodeList = fieldListSelect.stream()
|
||||
.filter(e -> (YesOrNoEnum.YES.getValue().equals(String.valueOf(e.getIsShowForm()))
|
||||
|| "条款内容".equals(e.getDbFieldName()))
|
||||
|| "条文内容".equals(e.getDbFieldName()))
|
||||
&& (FieldTypeEnum.PULL_SINGLE.getValue().equals(e.getFieldShowType()) || FieldTypeEnum.PULL_MORE.getValue().equals(e.getFieldShowType()))
|
||||
&& StringUtils.isNotBlank(e.getDictField())
|
||||
)
|
||||
.map(OnlCgformField :: getDictField)
|
||||
.map(LawsTag :: getDictField)
|
||||
.distinct()
|
||||
.collect(Collectors.toList());
|
||||
|
||||
@@ -1217,15 +1241,15 @@ public class FileSplitItemsEOServiceImpl extends ServiceImpl<FileSplitItemsEOMap
|
||||
List<SarFileSplitItemsValEO> addItemValList = new ArrayList<>();
|
||||
if (addItemsEOList != null && !addItemsEOList.isEmpty()) {
|
||||
Map<String, Object> oldItems = addItemsEOList.get(addItemsEOList.size()-1);
|
||||
if (itemNum > 0 && importDto.get("items_num").equals(oldItems.get("items_num"))
|
||||
&& importDto.get("items_name").equals(oldItems.get("items_name"))) {
|
||||
if(ObjectUtil.isEmpty(importDto.get("iterms_conditions"))){
|
||||
if (itemNum > 0 && importDto.get("item_num").equals(oldItems.get("item_num"))
|
||||
&& importDto.get("item_num").equals(oldItems.get("item_title"))) {
|
||||
if(ObjectUtil.isEmpty(importDto.get("item_content"))){
|
||||
continue;
|
||||
}
|
||||
addItemValList = (List<SarFileSplitItemsValEO>) oldItems.get("itemValEOList");
|
||||
String itemContent = oldItems.get("iterms_conditions").toString() + importDto.get("iterms_conditions").toString();
|
||||
oldItems.put("iterms_conditions", itemContent);
|
||||
String[] valArr = importDto.get("iterms_conditions").toString().split("\n");
|
||||
String itemContent = oldItems.get("item_content").toString() + importDto.get("item_content").toString();
|
||||
oldItems.put("item_content", itemContent);
|
||||
String[] valArr = importDto.get("item_content").toString().split("\n");
|
||||
if (valArr != null && valArr.length > 0) {
|
||||
for (int i=0;i<valArr.length;i++) {
|
||||
SarFileSplitItemsValEO valEO = new SarFileSplitItemsValEO();
|
||||
@@ -1273,8 +1297,8 @@ public class FileSplitItemsEOServiceImpl extends ServiceImpl<FileSplitItemsEOMap
|
||||
}
|
||||
oldItems.put("itemValEOList", addItemValList);
|
||||
}else {
|
||||
if(ObjectUtil.isNotEmpty(importDto.get("iterms_conditions"))) {
|
||||
String[] valArr = importDto.get("iterms_conditions").toString().split("\n");
|
||||
if(ObjectUtil.isNotEmpty(importDto.get("item_content"))) {
|
||||
String[] valArr = importDto.get("item_content").toString().split("\n");
|
||||
if (valArr != null && valArr.length > 0) {
|
||||
for (int i = 0; i < valArr.length; i++) {
|
||||
SarFileSplitItemsValEO valEO = new SarFileSplitItemsValEO();
|
||||
@@ -1298,17 +1322,18 @@ public class FileSplitItemsEOServiceImpl extends ServiceImpl<FileSplitItemsEOMap
|
||||
// if (fileTypeStr.contains(fileSuffix)) {
|
||||
// state = "1";
|
||||
// }
|
||||
OSSFile oSSFile = ossFileService.uploadLocalOfCos(multipartFile, "", state,null);
|
||||
oSSFile = ossFileService.getById(oSSFile.getId());
|
||||
// OSSFile oSSFile = ossFileService.uploadLocalOfCos(multipartFile, "", state,null);
|
||||
OSSFile oSSFile = ossFileService.uploadLocalForSplit(multipartFile, "",state,null);
|
||||
// oSSFile = ossFileService.getById(oSSFile.getId());
|
||||
if (oSSFile != null) {
|
||||
oSSFile = ossFileService.getById(oSSFile.getId());
|
||||
isText = false;
|
||||
|
||||
// BASE64Encoder base64Encoder = new BASE64Encoder();
|
||||
// String encode = base64Encoder.encode(oSSFile.getUrl().getBytes(StandardCharsets.UTF_8));
|
||||
String path = splitUrl + oSSFile.getUrl();
|
||||
String path = oSSFile.getUrl();
|
||||
// String path = imgpath + oSSFile.getUrl().substring(oSSFile.getUrl().lastIndexOf(File.separator)+1);
|
||||
String imgCon = "<img class=\"wordImg\" src=\"" + path + "\">";
|
||||
// String imgCon = "<img class=\"wordImg\" src=\"" + path + "\">";
|
||||
valEO.setType("IMG");
|
||||
// valEO.setItemContent(imgCon);
|
||||
valEO.setItemContent(path);
|
||||
@@ -1326,8 +1351,8 @@ public class FileSplitItemsEOServiceImpl extends ServiceImpl<FileSplitItemsEOMap
|
||||
addItemsEOList.add(importDto);
|
||||
}
|
||||
} else {
|
||||
if(ObjectUtil.isNotEmpty(importDto.get("iterms_conditions"))) {
|
||||
String[] valArr = importDto.get("iterms_conditions").toString().split("\n");
|
||||
if(ObjectUtil.isNotEmpty(importDto.get("item_content"))) {
|
||||
String[] valArr = importDto.get("item_content").toString().split("\n");
|
||||
if (valArr != null && valArr.length > 0) {
|
||||
for (int i = 0; i < valArr.length; i++) {
|
||||
SarFileSplitItemsValEO valEO = new SarFileSplitItemsValEO();
|
||||
@@ -1346,16 +1371,17 @@ public class FileSplitItemsEOServiceImpl extends ServiceImpl<FileSplitItemsEOMap
|
||||
String url = nowfilelist.get(0).getPath();
|
||||
MultipartFile multipartFile = createMfileByPath(url);
|
||||
String state = "0";
|
||||
OSSFile oSSFile = ossFileService.uploadLocalOfCos(multipartFile, "", state,null);
|
||||
oSSFile = ossFileService.getById(oSSFile.getId());
|
||||
// OSSFile oSSFile = ossFileService.uploadLocalOfCos(multipartFile, "", state,null);
|
||||
OSSFile oSSFile = ossFileService.uploadLocalForSplit(multipartFile, "",state,null);
|
||||
// oSSFile = ossFileService.getById(oSSFile.getId());
|
||||
if (oSSFile != null) {
|
||||
isText = false;
|
||||
|
||||
// BASE64Encoder base64Encoder = new BASE64Encoder();
|
||||
// String encode = base64Encoder.encode(oSSFile.getUrl().getBytes(StandardCharsets.UTF_8));
|
||||
String path = splitUrl + oSSFile.getUrl();
|
||||
String path = oSSFile.getUrl();
|
||||
// String path = imgpath + oSSFile.getUrl().substring(oSSFile.getUrl().lastIndexOf(File.separator)+1);
|
||||
String imgCon = "<img class=\"wordImg\" src=\"" + path + "\">";
|
||||
// String imgCon = "<img class=\"wordImg\" src=\"" + path + "\">";
|
||||
valEO.setType("IMG");
|
||||
// valEO.setItemContent(imgCon);
|
||||
valEO.setItemContent(path);
|
||||
@@ -1648,18 +1674,31 @@ public class FileSplitItemsEOServiceImpl extends ServiceImpl<FileSplitItemsEOMap
|
||||
|
||||
@Override
|
||||
public Result<?> importSplitResult(String splitFileId, String cut, SarFileSplitInfoEO sarFileSplitInfoEO) throws IOException {
|
||||
// 唯一校验
|
||||
documentSplitService.uniqueCheck(sarFileSplitInfoEO);
|
||||
|
||||
// MultipartFile mFile = createMfileByPath(url);
|
||||
|
||||
// 新增拆分记录
|
||||
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
||||
Date now = new Date();
|
||||
String infoId = UUID.randomUUID().toString().replace("-", "");
|
||||
sarFileSplitInfoEO.setId(infoId);
|
||||
sarFileSplitInfoEO.setSplitResult("成功");
|
||||
sarFileSplitInfoEO.setSplitStatus(SplitEnum.SPLIT_STATUS1.getValue());
|
||||
sarFileSplitInfoEO.setAuthor(sysUser.getId());
|
||||
sarFileSplitInfoEO.setCreateTime(now);
|
||||
sarFileSplitInfoEO.setUpdateTime(now);
|
||||
sarFileSplitInfoService.save(sarFileSplitInfoEO);
|
||||
|
||||
// // 新增拆分记录
|
||||
// Date now = new Date();
|
||||
// String infoId = UUID.randomUUID().toString().replace("-", "");
|
||||
// sarFileSplitInfoEO.setId(infoId);
|
||||
// sarFileSplitInfoEO.setSplitResult("成功");
|
||||
// sarFileSplitInfoEO.setCreateTime(now);
|
||||
// sarFileSplitInfoEO.setUpdateTime(now);
|
||||
// sarFileSplitInfoService.save(sarFileSplitInfoEO);
|
||||
|
||||
// 添加条款总目录
|
||||
SarFileSplitMenuEO sarFileSplitMenuEO = new SarFileSplitMenuEO();
|
||||
String menuId = UUID.randomUUID().toString().replace("-", "");
|
||||
@@ -1742,35 +1781,35 @@ public class FileSplitItemsEOServiceImpl extends ServiceImpl<FileSplitItemsEOMap
|
||||
int cellLength = sheet.getRow(0).getPhysicalNumberOfCells();
|
||||
// 验证模板表头是否正确
|
||||
Row rowTitle = sheet.getRow(0);
|
||||
for (int i = 0; i < cellLength; i++) {
|
||||
if (rowTitle != null) {
|
||||
Cell cell = rowTitle.getCell(i);
|
||||
if(ObjectUtil.isNotNull(cell)){
|
||||
//设置单元格类型
|
||||
cell.setCellType(CellType.STRING);
|
||||
String cellValue = cell.getStringCellValue().substring(cell.getStringCellValue().indexOf("*")+1);
|
||||
if(!cellValue.equals(titles[i])){
|
||||
if(LanguageEnum.CN.getValue().equals(cut)){
|
||||
throw new JeroBootException("请导入正确模板!");
|
||||
} else {
|
||||
throw new JeroBootException("Please import the correct template");
|
||||
}
|
||||
}
|
||||
} else{
|
||||
if(LanguageEnum.CN.getValue().equals(cut)){
|
||||
throw new JeroBootException("请导入正确模板!");
|
||||
} else {
|
||||
throw new JeroBootException("Please import the correct template");
|
||||
}
|
||||
}
|
||||
}else{
|
||||
if(LanguageEnum.CN.getValue().equals(cut)){
|
||||
throw new JeroBootException("请导入正确模板!");
|
||||
} else {
|
||||
throw new JeroBootException("Please import the correct template");
|
||||
}
|
||||
}
|
||||
}
|
||||
// for (int i = 0; i < cellLength; i++) {
|
||||
// if (rowTitle != null) {
|
||||
// Cell cell = rowTitle.getCell(i);
|
||||
// if(ObjectUtil.isNotNull(cell)){
|
||||
// //设置单元格类型
|
||||
// cell.setCellType(CellType.STRING);
|
||||
// String cellValue = cell.getStringCellValue().substring(cell.getStringCellValue().indexOf("*")+1);
|
||||
// if(!cellValue.equals(titles[i])){
|
||||
// if(LanguageEnum.CN.getValue().equals(cut)){
|
||||
// throw new JeroBootException("请导入正确模板!");
|
||||
// } else {
|
||||
// throw new JeroBootException("Please import the correct template");
|
||||
// }
|
||||
// }
|
||||
// } else{
|
||||
// if(LanguageEnum.CN.getValue().equals(cut)){
|
||||
// throw new JeroBootException("请导入正确模板!");
|
||||
// } else {
|
||||
// throw new JeroBootException("Please import the correct template");
|
||||
// }
|
||||
// }
|
||||
// }else{
|
||||
// if(LanguageEnum.CN.getValue().equals(cut)){
|
||||
// throw new JeroBootException("请导入正确模板!");
|
||||
// } else {
|
||||
// throw new JeroBootException("Please import the correct template");
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
Row rowDescription= sheet.getRow(1);
|
||||
if (rowDescription != null) {
|
||||
Cell cell = rowDescription.getCell(0);
|
||||
@@ -1778,7 +1817,7 @@ public class FileSplitItemsEOServiceImpl extends ServiceImpl<FileSplitItemsEOMap
|
||||
//设置单元格类型
|
||||
cell.setCellType(CellType.STRING);
|
||||
String cellValue = cell.getStringCellValue();
|
||||
if(!cellValue.contains("填写说明")){
|
||||
if(!cellValue.contains("模版说明")){
|
||||
if(LanguageEnum.CN.getValue().equals(cut)){
|
||||
throw new JeroBootException("请导入正确模板!");
|
||||
} else {
|
||||
@@ -2041,7 +2080,7 @@ public class FileSplitItemsEOServiceImpl extends ServiceImpl<FileSplitItemsEOMap
|
||||
value = StringUtils.join(valueIdList, ",");
|
||||
}
|
||||
|
||||
} else if (FieldTypeEnum.TEXT_STRING.getValue().equals(fieldShowType)) {
|
||||
} else if (FieldTypeEnum.TEXT.getValue().equals(fieldShowType)) {
|
||||
//输入框
|
||||
//判断是否必填
|
||||
if (IsMustEnum.YES.getValue().equals(mustInput) && StringUtils.isBlank(value)) {
|
||||
@@ -2062,7 +2101,7 @@ public class FileSplitItemsEOServiceImpl extends ServiceImpl<FileSplitItemsEOMap
|
||||
countError++;
|
||||
}
|
||||
|
||||
} else if (FieldTypeEnum.TEXT_NUMBER.getValue().equals(fieldShowType)) {
|
||||
} else if (FieldTypeEnum.TEXT.getValue().equals(fieldShowType)) {
|
||||
//输入框(数字)
|
||||
//判断是否必填
|
||||
if (IsMustEnum.YES.getValue().equals(mustInput) && StringUtils.isBlank(value)) {
|
||||
@@ -2485,7 +2524,7 @@ public class FileSplitItemsEOServiceImpl extends ServiceImpl<FileSplitItemsEOMap
|
||||
ind++;
|
||||
}
|
||||
sarFileSplitItemsValEOMapper.insertForeach(getValList);
|
||||
sarFileSplitItemsEO.put("iterms_conditions", itemConditions);
|
||||
sarFileSplitItemsEO.put("item_content", itemConditions);
|
||||
}
|
||||
String id = (String)sarFileSplitItemsEO.get("id");
|
||||
sarFileSplitItemsEO.remove("id");
|
||||
@@ -2499,14 +2538,14 @@ public class FileSplitItemsEOServiceImpl extends ServiceImpl<FileSplitItemsEOMap
|
||||
Collections.sort(addItemsEOList, new Comparator<Map<String, Object>>() {
|
||||
@Override
|
||||
public int compare(Map<String, Object> o1, Map<String, Object> o2) {
|
||||
return o1.get("items_num").toString().compareTo(o2.get("items_num").toString());
|
||||
return o1.get("item_num").toString().compareTo(o2.get("item_num").toString());
|
||||
}
|
||||
});
|
||||
|
||||
List<SarFileSplitMenuTreeNode> treeNodeList = new ArrayList<>();
|
||||
String regex = "^[0-9]{0}([0-9]|[.])+$"; //TODO 待优化:数字和点必须交替
|
||||
for (Map<String, Object> itemEO : addItemsEOList) {
|
||||
String itemNum = itemEO.get("items_num").toString();
|
||||
String itemNum = itemEO.get("item_num").toString();
|
||||
// if(itemNum.matches(regex) || itemNum.contains("附录")) { // TODO 解除条款号格式限制
|
||||
SarFileSplitMenuTreeNode treeNode = new SarFileSplitMenuTreeNode();
|
||||
treeNode.setId(UUIDUtils.randomUUID20());
|
||||
@@ -2532,7 +2571,7 @@ public class FileSplitItemsEOServiceImpl extends ServiceImpl<FileSplitItemsEOMap
|
||||
}
|
||||
++treeListDisplay;
|
||||
treeNode.setOrderNum(treeListDisplay);
|
||||
treeNode.setItemName(itemEO.get("items_name").toString());
|
||||
treeNode.setItemName(itemEO.get("item_title").toString());
|
||||
treeNode.setItemId(itemEO.get("id").toString());
|
||||
treeNodeList.add(treeNode);
|
||||
// }
|
||||
@@ -2608,7 +2647,7 @@ public class FileSplitItemsEOServiceImpl extends ServiceImpl<FileSplitItemsEOMap
|
||||
|
||||
for (int j = 0; j < headerArr.length; j++) {
|
||||
// 条款号和输入框数字类型 列 设置单元格格式为文本
|
||||
if ("条款号".equals(headerArr[j]) || "Item No.".equals(headerArr[j]) || FieldTypeEnum.TEXT_NUMBER.getValue().equals(headerTypeArr[j])) {
|
||||
if ("条文号".equals(headerArr[j]) || "Item No.".equals(headerArr[j]) || FieldTypeEnum.TEXT.getValue().equals(headerTypeArr[j])) {
|
||||
sheet.setDefaultColumnStyle(j, cellStyle);
|
||||
}
|
||||
row.createCell(j).setCellValue(headerArr[j]);
|
||||
@@ -2712,10 +2751,10 @@ public class FileSplitItemsEOServiceImpl extends ServiceImpl<FileSplitItemsEOMap
|
||||
} else if (FieldTypeEnum.FILE.getValue().equals(map.get(fieldShowType))) {
|
||||
//文件字段
|
||||
fileList.add((String) map.get("db_field_txt"));
|
||||
} else if (FieldTypeEnum.TEXT_NUMBER.getValue().equals(map.get(fieldShowType))) {
|
||||
} else if (FieldTypeEnum.TEXT.getValue().equals(map.get(fieldShowType))) {
|
||||
//数字输入框字段
|
||||
textNumberList.add((String) map.get("db_field_txt"));
|
||||
} else if (FieldTypeEnum.TEXT_STRING.getValue().equals(map.get(fieldShowType))) {
|
||||
} else if (FieldTypeEnum.TEXT.getValue().equals(map.get(fieldShowType))) {
|
||||
//字符串输入框字段
|
||||
textStringList.add((String) map.get("db_field_txt"));
|
||||
} else if (FieldTypeEnum.DATE_SINGLE.getValue().equals(map.get(fieldShowType))) {
|
||||
@@ -2887,6 +2926,80 @@ public class FileSplitItemsEOServiceImpl extends ServiceImpl<FileSplitItemsEOMap
|
||||
return list;
|
||||
}
|
||||
|
||||
/**
|
||||
* 下拉选处理数据字典
|
||||
*
|
||||
* @param sysDictItems 所有数据字典值信息
|
||||
* @param entry 需要处理的某个字段数据
|
||||
* @param collect 该字段对应的字段信息
|
||||
* @param cut 需切换的语言类别
|
||||
*/
|
||||
public void dictItem2(List<SysDictItem> sysDictItems, Map.Entry<String, Object> entry, List<LawsTag> collect, String cut) {
|
||||
//通过dictField判断字段是否为下拉选(不为空则为下拉选)
|
||||
if (collect.size() != 0 && StringUtils.isNotBlank(collect.get(0).getDictField())) {
|
||||
String dictCode = collect.get(0).getDictField();
|
||||
String value = (String) entry.getValue();
|
||||
//数据字典中文
|
||||
List<String> dictItemsCh = new ArrayList<>();
|
||||
List<String> dictItemsEn = new ArrayList<>();
|
||||
if (StringUtils.isNotBlank(value)) {
|
||||
for (String itemValue : value.split(",")) {
|
||||
//字段的数据字典
|
||||
List<SysDictItem> dictItemList = sysDictItems.stream()
|
||||
.filter(e -> StringUtils.isNotBlank(e.getDictCode()) && e.getDictCode().equals(dictCode))
|
||||
.collect(Collectors.toList());
|
||||
if (dictItemList.size() != 0) {
|
||||
List<SysDictItem> dictItems = dictItemList.stream()
|
||||
.filter(e -> itemValue.equals(e.getItemValue()))
|
||||
.collect(Collectors.toList());
|
||||
if (dictItems.size() != 0) {
|
||||
List<String> itemText = new ArrayList<>();
|
||||
if (LanguageEnum.CN.getValue().equals(cut)) {
|
||||
itemText = dictItems.stream().map(SysDictItem::getItemText).collect(Collectors.toList());
|
||||
} else {
|
||||
itemText = dictItems.stream().map(SysDictItem::getEnName).collect(Collectors.toList());
|
||||
}
|
||||
dictItemsCh.addAll(itemText);
|
||||
dictItemsEn.addAll(itemText);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (LanguageEnum.CN.getValue().equals(cut)) {
|
||||
entry.setValue(StringUtils.join(dictItemsCh, ","));
|
||||
} else {
|
||||
entry.setValue(StringUtils.join(dictItemsEn, ","));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 属性字典处理中文
|
||||
*
|
||||
* @param categoryList 所有树形字典值信息
|
||||
* @param entry 需要处理的某个字段数据
|
||||
* @param treeFieldList 列表字段红的树形字段
|
||||
* @param cut 需切换的语言类别
|
||||
*/
|
||||
public void treeDictItem2(List<SysCategory> categoryList, Map.Entry<String, Object> entry, List<LawsTag> treeFieldList, String cut) {
|
||||
List<String> treeFields = treeFieldList.stream().map(LawsTag::getDbFieldName).collect(Collectors.toList());
|
||||
String key = entry.getKey();
|
||||
if (treeFields.contains(entry.getKey())) {
|
||||
String value = (String) entry.getValue();
|
||||
if (StringUtils.isNotBlank(value)) {
|
||||
List<String> idList = Arrays.asList(value.split(","));
|
||||
List<SysCategory> sysCategoryList = categoryList.stream().filter(e -> idList.contains(e.getId())).collect(Collectors.toList());
|
||||
if (LanguageEnum.CN.getValue().equals(cut)) {
|
||||
List<String> nameList = sysCategoryList.stream().map(SysCategory::getName).collect(Collectors.toList());
|
||||
entry.setValue(StringUtils.join(nameList, ","));
|
||||
} else {
|
||||
List<String> nameEnList = sysCategoryList.stream().map(SysCategory::getEnName).collect(Collectors.toList());
|
||||
entry.setValue(StringUtils.join(nameEnList, ","));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 下拉选处理数据字典
|
||||
*
|
||||
@@ -3004,19 +3117,24 @@ public class FileSplitItemsEOServiceImpl extends ServiceImpl<FileSplitItemsEOMap
|
||||
}
|
||||
|
||||
private List<Map<String, Object>> getImportOnlField(String flag, String cut) {
|
||||
List<OnlCgformField> fieldList = onlCgformFieldService.getFieldList(flag);
|
||||
// List<OnlCgformField> fieldList = onlCgformFieldService.getFieldList(flag);
|
||||
// 查询全部字段列表
|
||||
List<LawsTag> fieldList = lawsCommonMapper.getFieldList(TableNameEnum.DOCUMENT_SPLIT.getTableName());
|
||||
// 列表展示字段
|
||||
fieldList = fieldList.stream().filter(v -> YesOrNoEnum.YES.getValue()
|
||||
.equals(String.valueOf(v.getIsShowList()))).collect(Collectors.toList());
|
||||
if (fieldList.size() != 0) {
|
||||
//过滤出导入字段
|
||||
fieldList = fieldList.stream()
|
||||
.filter(e -> YesOrNoEnum.YES.getValue().equals(String.valueOf(e.getIsShowForm()))
|
||||
|| "条款内容".equals(e.getDbFieldName()))
|
||||
|| "条文内容".equals(e.getDbFieldName()))
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
//树形数据字典
|
||||
List<SysCategoryTreeVO> sysCategoryTree = sysCategoryService.getSysCategoryTreeByCut(cut); // 查询所有 并以树结构返回
|
||||
|
||||
List<Map<String, Object>> list = new ArrayList<>();
|
||||
for (OnlCgformField onlCgformField : fieldList) {
|
||||
for (LawsTag onlCgformField : fieldList) {
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
if (FieldTypeEnum.TREE.getValue().equals(onlCgformField.getFieldShowType())) {
|
||||
List<SysCategoryTreeVO> sysCategoryTreeVOList = sysCategoryTree.stream()
|
||||
@@ -3068,22 +3186,28 @@ public class FileSplitItemsEOServiceImpl extends ServiceImpl<FileSplitItemsEOMap
|
||||
List<Map<String, Object>> itemsDataForExport = dao.queryByOrdersForExport(field, idList, condition);
|
||||
|
||||
// 查询条款表所有字段
|
||||
List<OnlCgformField> fieldList = onlCgformFieldService.getFieldList(ModuleEnum.FILE_SPLIT_ITEMS.getValue());
|
||||
// List<OnlCgformField> fieldList = onlCgformFieldService.getFieldList(ModuleEnum.FILE_SPLIT_ITEMS.getValue());
|
||||
// 查询全部字段列表
|
||||
List<LawsTag> fieldList = lawsCommonMapper.getFieldList(TableNameEnum.DOCUMENT_SPLIT.getTableName());
|
||||
// 列表展示字段
|
||||
fieldList = fieldList.stream().filter(v -> YesOrNoEnum.YES.getValue()
|
||||
.equals(String.valueOf(v.getIsShowList()))).collect(Collectors.toList());
|
||||
|
||||
// 日期类型字段
|
||||
List<OnlCgformField> onlCgformFieldList = fieldList.stream()
|
||||
List<LawsTag> onlCgformFieldList = fieldList.stream()
|
||||
.filter(e -> FieldTypeEnum.DATE_SINGLE.getValue().equals(e.getFieldShowType()))
|
||||
.collect(Collectors.toList());
|
||||
List<String> fieldDateList = onlCgformFieldList.stream().map(OnlCgformField::getDbFieldName).collect(Collectors.toList());
|
||||
List<String> fieldDateList = onlCgformFieldList.stream().map(LawsTag::getDbFieldName).collect(Collectors.toList());
|
||||
// 人员选择
|
||||
List<OnlCgformField> onlCgformFieldPersonList = fieldList.stream()
|
||||
List<LawsTag> onlCgformFieldPersonList = fieldList.stream()
|
||||
.filter(e -> FieldTypeEnum.PERSON.getValue().equals(e.getFieldShowType()))
|
||||
.collect(Collectors.toList());
|
||||
List<String> fieldPersonList = onlCgformFieldPersonList.stream().map(OnlCgformField::getDbFieldName).collect(Collectors.toList());
|
||||
List<String> fieldPersonList = onlCgformFieldPersonList.stream().map(LawsTag::getDbFieldName).collect(Collectors.toList());
|
||||
// 标准选择
|
||||
List<OnlCgformField> onlCgformFieldStanList = fieldList.stream()
|
||||
List<LawsTag> onlCgformFieldStanList = fieldList.stream()
|
||||
.filter(e -> FieldTypeEnum.STANDARD.getValue().equals(e.getFieldShowType()))
|
||||
.collect(Collectors.toList());
|
||||
List<String> fieldStanList = onlCgformFieldStanList.stream().map(OnlCgformField::getDbFieldName).collect(Collectors.toList());
|
||||
List<String> fieldStanList = onlCgformFieldStanList.stream().map(LawsTag::getDbFieldName).collect(Collectors.toList());
|
||||
// 文件字段
|
||||
// List<OnlCgformField> onlCgformFieldFileList = fieldList.stream()
|
||||
// .filter(e -> FieldTypeEnum.FILE.getValue().equals(e.getFieldShowType()))
|
||||
@@ -3093,14 +3217,14 @@ public class FileSplitItemsEOServiceImpl extends ServiceImpl<FileSplitItemsEOMap
|
||||
// 过滤导出字段
|
||||
if (fieldList.size() != 0) {
|
||||
fieldList = fieldList.stream()
|
||||
.filter(e -> YesOrNoEnum.YES.getValue().equals(String.valueOf(e.getIsShowForm())) || "条款内容".equals(e.getDbFieldTxt()))
|
||||
.filter(e -> YesOrNoEnum.YES.getValue().equals(String.valueOf(e.getIsShowForm())) || "条文内容".equals(e.getDbFieldTxt()))
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
//树形数据字典
|
||||
List<SysCategory> categoryList = sysCategoryService.list();
|
||||
//过滤出树形字段
|
||||
List<OnlCgformField> treeFieldList = fieldList.stream()
|
||||
List<LawsTag> treeFieldList = fieldList.stream()
|
||||
.filter(e -> FieldTypeEnum.TREE.getValue().equals(e.getFieldShowType()))
|
||||
.collect(Collectors.toList());
|
||||
//数据字典
|
||||
@@ -3110,18 +3234,18 @@ public class FileSplitItemsEOServiceImpl extends ServiceImpl<FileSplitItemsEOMap
|
||||
for (Map record : itemsDataForExport) {
|
||||
Map<String, Object> record1 = (Map) record;
|
||||
for (Map.Entry<String, Object> entry : record1.entrySet()) {
|
||||
List<OnlCgformField> collect = fieldList.stream()
|
||||
List<LawsTag> collect = fieldList.stream()
|
||||
.filter(e -> entry.getKey().equals(e.getDbFieldName()) && !FieldTypeEnum.TREE.getValue().equals(e.getFieldShowType()))
|
||||
.collect(Collectors.toList());
|
||||
//下拉选处理数据字典
|
||||
dictItem(sysDictItems, entry, collect, cut);
|
||||
dictItem2(sysDictItems, entry, collect, cut);
|
||||
// 树形结构处理数据字典
|
||||
treeDictItem(categoryList, entry, treeFieldList, cut);
|
||||
treeDictItem2(categoryList, entry, treeFieldList, cut);
|
||||
// 单日期
|
||||
if(fieldDateList.contains(entry.getKey()) && ObjectUtil.isNotEmpty(entry.getValue())){
|
||||
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
|
||||
entry.setValue(dateFormat.format((Date)entry.getValue()));
|
||||
}
|
||||
// if(fieldDateList.contains(entry.getKey()) && ObjectUtil.isNotEmpty(entry.getValue())){
|
||||
// SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
|
||||
// entry.setValue(dateFormat.format((Date)entry.getValue()));
|
||||
// }
|
||||
// 人员选择
|
||||
if(fieldPersonList.contains(entry.getKey()) && StringUtils.isNotBlank((String)entry.getValue())) {
|
||||
List<SysUser> sysUserList = sysUserService.listByIds(Arrays.asList(entry.getValue().toString().split(",")));
|
||||
@@ -3265,7 +3389,7 @@ public class FileSplitItemsEOServiceImpl extends ServiceImpl<FileSplitItemsEOMap
|
||||
@Override
|
||||
public void downLoadImgList(List<FileSplitValImgExportDto> allImgList, String fileNowPath) {
|
||||
for(FileSplitValImgExportDto imgExportDto : allImgList){
|
||||
String oldPath = imgExportDto.getImgPath();
|
||||
String oldPath = uploadCospath + "/" + imgExportDto.getImgPath();
|
||||
String newPath = fileNowPath + File.separator + imgExportDto.getImgName();
|
||||
if (MinioUtil.doesObjectExist(oldPath)){
|
||||
try (InputStream in = MinioUtil.download(oldPath);) {
|
||||
@@ -3339,7 +3463,7 @@ public class FileSplitItemsEOServiceImpl extends ServiceImpl<FileSplitItemsEOMap
|
||||
nowFile.mkdirs();
|
||||
String fileName = fileOriName + ".xls";
|
||||
// 设置表格相关属性
|
||||
HSSFSheet sheetItems = workbook.createSheet("条款内容");
|
||||
HSSFSheet sheetItems = workbook.createSheet("条文内容");
|
||||
String[] headers = getWorkbookTitleForExport(cut); // 获取表头
|
||||
HSSFCellStyle cellStyle =workbook.createCellStyle();
|
||||
cellStyle.setWrapText(true);
|
||||
@@ -3355,6 +3479,9 @@ public class FileSplitItemsEOServiceImpl extends ServiceImpl<FileSplitItemsEOMap
|
||||
|
||||
// 处理勾选导出相关字段
|
||||
List<String> itemIdList = new ArrayList<>();
|
||||
if (StringUtils.isNotBlank(idList)){
|
||||
itemIdList = Arrays.asList(idList.split(","));
|
||||
}
|
||||
SarFileSplitItemsEOPage page = new SarFileSplitItemsEOPage();
|
||||
// 查询需要导出的字段
|
||||
String field = getFieldForExport(); // 字符串形式
|
||||
@@ -3362,11 +3489,16 @@ public class FileSplitItemsEOServiceImpl extends ServiceImpl<FileSplitItemsEOMap
|
||||
// 查询导出数据
|
||||
List<Map<String, Object>> allItemsList = queryByOrdersForExport(cut, field, itemIdList, parameter); // id记得去掉
|
||||
// 文件类型字段
|
||||
List<OnlCgformField> allFieldList = onlCgformFieldService.getFieldList(ModuleEnum.FILE_SPLIT_ITEMS.getValue()); // 查询条款表所有字段
|
||||
List<OnlCgformField> onlCgformFieldFileList = allFieldList.stream()
|
||||
// 查询全部字段列表
|
||||
List<LawsTag> fieldLists = lawsCommonMapper.getFieldList(TableNameEnum.DOCUMENT_SPLIT.getTableName());
|
||||
// 列表展示字段
|
||||
fieldLists = fieldLists.stream().filter(v -> YesOrNoEnum.YES.getValue()
|
||||
.equals(String.valueOf(v.getIsShowList()))).collect(Collectors.toList());
|
||||
// List<OnlCgformField> allFieldList = onlCgformFieldService.getFieldList(ModuleEnum.FILE_SPLIT_ITEMS.getValue()); // 查询条款表所有字段
|
||||
List<LawsTag> onlCgformFieldFileList = fieldLists.stream()
|
||||
.filter(e -> FieldTypeEnum.FILE.getValue().equals(e.getFieldShowType()))
|
||||
.collect(Collectors.toList());
|
||||
List<String> fileList = onlCgformFieldFileList.stream().map(OnlCgformField::getDbFieldName).collect(Collectors.toList());
|
||||
List<String> fileList = onlCgformFieldFileList.stream().map(LawsTag::getDbFieldName).collect(Collectors.toList());
|
||||
|
||||
// 开始处理工作表
|
||||
List<FileSpiltValTableExportDto> allTableList = new ArrayList<>(); // 存储表格数据
|
||||
@@ -3391,7 +3523,7 @@ public class FileSplitItemsEOServiceImpl extends ServiceImpl<FileSplitItemsEOMap
|
||||
cell.setCellValue(text);
|
||||
cell.setCellStyle(cellStyle1);
|
||||
// 设置单元格宽度
|
||||
if("条款内容".equals(headers[i])) {
|
||||
if("条文内容".equals(headers[i]) || "条文解读".equals(headers[i])) {
|
||||
sheetItems.setColumnWidth(i, 80 * 256);
|
||||
} else {
|
||||
sheetItems.setColumnWidth(i, 20 * 256);
|
||||
@@ -3411,7 +3543,9 @@ public class FileSplitItemsEOServiceImpl extends ServiceImpl<FileSplitItemsEOMap
|
||||
HSSFRow row1 = sheetItems.createRow(allRow);
|
||||
// 开始向单元格添加数据
|
||||
for(int cellNum = 0; cellNum < fieldList.size(); cellNum++){
|
||||
if (!"iterms_conditions".equals(fieldList.get(cellNum)) && ObjectUtils.isNotEmpty(exportDto.get(fieldList.get(cellNum)))) {
|
||||
if (!"item_content".equals(fieldList.get(cellNum)) &&
|
||||
!"interpretation_articles".equals(fieldList.get(cellNum)) &&
|
||||
ObjectUtils.isNotEmpty(exportDto.get(fieldList.get(cellNum)))) {
|
||||
// 处理文件
|
||||
if(fileList.contains(fieldList.get(cellNum))) {
|
||||
String connectId = (String) exportDto.get(fieldList.get(cellNum));
|
||||
@@ -3443,7 +3577,7 @@ public class FileSplitItemsEOServiceImpl extends ServiceImpl<FileSplitItemsEOMap
|
||||
row1.getCell(cellNum).setCellStyle(cellStyle);
|
||||
}
|
||||
|
||||
} else if ("iterms_conditions".equals(fieldList.get(cellNum))) {
|
||||
} else if ("item_content".equals(fieldList.get(cellNum))) {
|
||||
// 条款内容特殊处理
|
||||
HSSFCell cell2 = row1.createCell(cellNum);
|
||||
row1.getCell(cellNum).setCellStyle(cellStyle);
|
||||
@@ -3454,6 +3588,7 @@ public class FileSplitItemsEOServiceImpl extends ServiceImpl<FileSplitItemsEOMap
|
||||
content = content.substring(0,content.lastIndexOf("\n"));
|
||||
}
|
||||
}
|
||||
|
||||
if("TABLE".equals(valList.get(valRow).getValType())){
|
||||
/* 连接跳转*/
|
||||
CreationHelper createHelper = workbook.getCreationHelper();
|
||||
@@ -3473,11 +3608,25 @@ public class FileSplitItemsEOServiceImpl extends ServiceImpl<FileSplitItemsEOMap
|
||||
}
|
||||
cell2.setCellValue(content); // IllegalArgumentException异常,excel单元格最大字符长度有限制
|
||||
}
|
||||
else if ("interpretation_articles".equals(fieldList.get(cellNum))) {
|
||||
// 条文解读特殊处理
|
||||
HSSFCell cell2 = row1.createCell(cellNum);
|
||||
row1.getCell(cellNum).setCellStyle(cellStyle);
|
||||
String content = (String) allItemsList.get(0).get("interpretation_articles");
|
||||
if (StringUtils.isNotEmpty(content)) {
|
||||
content = content.replaceAll("<p>","");
|
||||
content = content.replaceAll("</p>","\n");
|
||||
if (content.lastIndexOf("\n") > -1) {
|
||||
content = content.substring(0,content.lastIndexOf("\n"));
|
||||
}
|
||||
}
|
||||
cell2.setCellValue(content); // IllegalArgumentException异常,excel单元格最大字符长度有限制
|
||||
}
|
||||
}
|
||||
}
|
||||
if (allRow > startRow) {
|
||||
for(int cellNum = 0; cellNum < fieldList.size(); cellNum++) {
|
||||
if (!"iterms_conditions".equals(fieldList.get(cellNum))) {
|
||||
if (!"item_content".equals(fieldList.get(cellNum))) {
|
||||
sheetItems.addMergedRegion(new CellRangeAddress(startRow, allRow, cellNum, cellNum));
|
||||
}
|
||||
}
|
||||
@@ -3491,7 +3640,7 @@ public class FileSplitItemsEOServiceImpl extends ServiceImpl<FileSplitItemsEOMap
|
||||
allRow++;
|
||||
HSSFRow row1 = sheetItems.createRow(allRow);
|
||||
for(int cellNum = 0; cellNum < fieldList.size(); cellNum++){
|
||||
if (!"iterms_conditions".equals(fieldList.get(cellNum)) && ObjectUtils.isNotEmpty(exportDto.get(fieldList.get(cellNum)))) {
|
||||
if (!"item_content".equals(fieldList.get(cellNum)) && ObjectUtils.isNotEmpty(exportDto.get(fieldList.get(cellNum)))) {
|
||||
// 处理文件
|
||||
if(fileList.contains(fieldList.get(cellNum))) {
|
||||
String connectId = (String) exportDto.get(fieldList.get(cellNum));
|
||||
@@ -3523,7 +3672,7 @@ public class FileSplitItemsEOServiceImpl extends ServiceImpl<FileSplitItemsEOMap
|
||||
row1.getCell(cellNum).setCellStyle(cellStyle);
|
||||
}
|
||||
|
||||
} else if ("iterms_conditions".equals(fieldList.get(cellNum))) {
|
||||
} else if ("item_content".equals(fieldList.get(cellNum))) {
|
||||
row1.createCell(cellNum).setCellValue("");
|
||||
row1.getCell(cellNum).setCellStyle(cellStyle);
|
||||
}
|
||||
@@ -3611,18 +3760,16 @@ public class FileSplitItemsEOServiceImpl extends ServiceImpl<FileSplitItemsEOMap
|
||||
*/
|
||||
@Override
|
||||
public String[] getWorkbookTitleForExport(String cut) {
|
||||
// 查询所有字段
|
||||
List<OnlCgformField> fieldList = onlCgformFieldService.getFieldList(ModuleEnum.FILE_SPLIT_ITEMS.getValue());
|
||||
// 过滤出需要导出的字段
|
||||
fieldList = fieldList.stream()
|
||||
.filter(e-> YesOrNoEnum.YES.getValue().equals(String.valueOf(e.getIsShowForm())) || "条款内容".equals(e.getDbFieldTxt()))
|
||||
.sorted(Comparator.comparing(OnlCgformField::getOrderNum)) // 必须按顺序 才能导出时表头和数据一致
|
||||
.collect(Collectors.toList());
|
||||
// 查询全部字段列表
|
||||
List<LawsTag> fieldList = lawsCommonMapper.getFieldList(TableNameEnum.DOCUMENT_SPLIT.getTableName());
|
||||
// 列表展示字段
|
||||
List<LawsTag> fieldListSelect = fieldList.stream().filter(v -> YesOrNoEnum.YES.getValue()
|
||||
.equals(String.valueOf(v.getIsShowList()))).collect(Collectors.toList());
|
||||
List<String> fieldForExport = new ArrayList<>();
|
||||
if (LanguageEnum.EN.getValue().equals(cut)){
|
||||
fieldForExport = fieldList.stream().map(OnlCgformField::getDbFieldEnName).collect(Collectors.toList());
|
||||
fieldForExport = fieldListSelect.stream().map(LawsTag::getDbFieldEnName).collect(Collectors.toList());
|
||||
} else {
|
||||
fieldForExport = fieldList.stream().map(OnlCgformField::getDbFieldTxt).collect(Collectors.toList());
|
||||
fieldForExport = fieldListSelect.stream().map(LawsTag::getDbFieldTxt).collect(Collectors.toList());
|
||||
}
|
||||
return StringUtils.join(fieldForExport, ",").split(",");
|
||||
}
|
||||
@@ -3640,13 +3787,20 @@ public class FileSplitItemsEOServiceImpl extends ServiceImpl<FileSplitItemsEOMap
|
||||
@Override
|
||||
public String getFieldForExport() {
|
||||
// 查询条款表所有字段
|
||||
List<OnlCgformField> fieldList = onlCgformFieldService.getFieldList(ModuleEnum.FILE_SPLIT_ITEMS.getValue());
|
||||
List<String> fields = fieldList.stream()
|
||||
.filter(e-> YesOrNoEnum.YES.getValue().equals(String.valueOf(e.getIsShowForm())) || "条款内容".equals(e.getDbFieldTxt()))
|
||||
.sorted(Comparator.comparing(OnlCgformField::getOrderNum)) // 必须按顺序 才能导出时表头和数据一致
|
||||
.map(OnlCgformField::getDbFieldName)
|
||||
.collect(Collectors.toList());
|
||||
return StringUtils.join(fields, ",");
|
||||
// List<OnlCgformField> fieldList = onlCgformFieldService.getFieldList(ModuleEnum.FILE_SPLIT_ITEMS.getValue());
|
||||
// List<String> fields = fieldList.stream()
|
||||
// .filter(e-> YesOrNoEnum.YES.getValue().equals(String.valueOf(e.getIsShowForm())) || "条款内容".equals(e.getDbFieldTxt()))
|
||||
// .sorted(Comparator.comparing(OnlCgformField::getOrderNum)) // 必须按顺序 才能导出时表头和数据一致
|
||||
// .map(OnlCgformField::getDbFieldName)
|
||||
// .collect(Collectors.toList());
|
||||
|
||||
|
||||
// 查询全部字段列表
|
||||
List<LawsTag> fieldList = lawsCommonMapper.getFieldList(TableNameEnum.DOCUMENT_SPLIT.getTableName());
|
||||
// 列表展示字段
|
||||
List<String> fieldListSelect = fieldList.stream().filter(v -> YesOrNoEnum.YES.getValue()
|
||||
.equals(String.valueOf(v.getIsShowList()))).map(LawsTag::getDbFieldName).collect(Collectors.toList());
|
||||
return StringUtils.join(fieldListSelect, ",");
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -3726,4 +3880,34 @@ public class FileSplitItemsEOServiceImpl extends ServiceImpl<FileSplitItemsEOMap
|
||||
return dao.selectByInfoId(infoId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result<OSSFile> upload(HttpServletRequest request, HttpServletResponse response, String state, String cut) {
|
||||
Result<OSSFile> result = new Result<>();
|
||||
String bizPath = request.getParameter("biz");
|
||||
MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
|
||||
MultipartFile file = multipartRequest.getFile("file");// 获取上传文件对象
|
||||
if (oConvertUtils.isEmpty(bizPath)) {
|
||||
bizPath = "";
|
||||
// if (CommonConstant.UPLOAD_TYPE_OSS.equals(uploadType)) {
|
||||
// //未指定目录,则用阿里云默认目录 upload
|
||||
// bizPath = "upload";
|
||||
// } else {
|
||||
// bizPath = "";
|
||||
// }
|
||||
}
|
||||
OSSFile oSSFile = ossFileService.uploadLocalForSplit(file, bizPath,state,cut);
|
||||
if (oConvertUtils.isNotEmpty(oSSFile)) {
|
||||
result.setResult(oSSFile);
|
||||
result.setSuccess(true);
|
||||
} else {
|
||||
if("cut".equals(LanguageEnum.CN.getValue())){
|
||||
result.setMessage("上传失败!");
|
||||
}else{
|
||||
result.setMessage("fail to upload!");
|
||||
}
|
||||
result.setSuccess(false);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user