diff --git a/laws-modules/src/main/java/com/jero/modules/document/enums/FieldTypeEnum.java b/laws-modules/src/main/java/com/jero/modules/document/enums/FieldTypeEnum.java index 2674cb60..4d0bc7c9 100644 --- a/laws-modules/src/main/java/com/jero/modules/document/enums/FieldTypeEnum.java +++ b/laws-modules/src/main/java/com/jero/modules/document/enums/FieldTypeEnum.java @@ -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; diff --git a/laws-modules/src/main/java/com/jero/modules/document/service/impl/BussDocumentLibraryEOServiceImpl.java b/laws-modules/src/main/java/com/jero/modules/document/service/impl/BussDocumentLibraryEOServiceImpl.java index c9705c40..5db0fa11 100644 --- a/laws-modules/src/main/java/com/jero/modules/document/service/impl/BussDocumentLibraryEOServiceImpl.java +++ b/laws-modules/src/main/java/com/jero/modules/document/service/impl/BussDocumentLibraryEOServiceImpl.java @@ -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 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())//文本框 diff --git a/laws-modules/src/main/java/com/jero/modules/laws/documenttool/service/IDocumentSplitService.java b/laws-modules/src/main/java/com/jero/modules/laws/documenttool/service/IDocumentSplitService.java index 706205fa..b85b14f4 100644 --- a/laws-modules/src/main/java/com/jero/modules/laws/documenttool/service/IDocumentSplitService.java +++ b/laws-modules/src/main/java/com/jero/modules/laws/documenttool/service/IDocumentSplitService.java @@ -60,6 +60,17 @@ public interface IDocumentSplitService { */ void add(SarFileSplitInfoEO sarFileSplitInfoEO); + /** + * 拆分文档保存 + * @param sarFileSplitInfoEO + */ + void saveDocumentSplitInfo(SarFileSplitInfoEO sarFileSplitInfoEO); + + /** + * 唯一性校验 + */ + void uniqueCheck(SarFileSplitInfoEO sarFileSplitInfoEO); + /** * 文档拆分详情-编辑 * @param parameter diff --git a/laws-modules/src/main/java/com/jero/modules/laws/documenttool/service/impl/DocumentSplitServiceImpl.java b/laws-modules/src/main/java/com/jero/modules/laws/documenttool/service/impl/DocumentSplitServiceImpl.java index f845643b..5003f542 100644 --- a/laws-modules/src/main/java/com/jero/modules/laws/documenttool/service/impl/DocumentSplitServiceImpl.java +++ b/laws-modules/src/main/java/com/jero/modules/laws/documenttool/service/impl/DocumentSplitServiceImpl.java @@ -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()); diff --git a/laws-modules/src/main/java/com/jero/modules/split/common/ConvertHtml2Excel.java b/laws-modules/src/main/java/com/jero/modules/split/common/ConvertHtml2Excel.java index 15151a09..6f5c4735 100644 --- a/laws-modules/src/main/java/com/jero/modules/split/common/ConvertHtml2Excel.java +++ b/laws-modules/src/main/java/com/jero/modules/split/common/ConvertHtml2Excel.java @@ -278,13 +278,16 @@ public class ConvertHtml2Excel { } public static void main(String[] args) throws Exception { - String cnt = "\n"; - List c =new ArrayList<>(); - c.add(1); - String tableHtml = "
111111113333333333444444444
555555566666
324234
"; - tableHtml = tableHtml.replaceAll("<[\\s]*?br[^>]*?>|<[\\s]*?\\/[\\s]*?br[\\s]*?>", cnt); +// String cnt = "\n"; +// List c =new ArrayList<>(); +// c.add(1); +// String tableHtml = "
111111113333333333444444444
555555566666
324234
"; +// 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 = "
自动切换前照灯近光的条件
外界环境光近光灯响应时间
小于1000 lx开启不大于2 s
1000 lx〜7000 lx由制造商确定由制造商确定
大于7000 lx关闭大于5 s,不大于300 s
注:使用经过余弦修正的照度计与车辆传感器安装位置等高的水平面上进行测量。
"; + Document data = DocumentHelper.parseText(tableHtml); + System.out.println(); } } diff --git a/laws-modules/src/main/java/com/jero/modules/split/controller/FileSplitItemsEOController.java b/laws-modules/src/main/java/com/jero/modules/split/controller/FileSplitItemsEOController.java index 254a945b..fd0b4dc9 100644 --- a/laws-modules/src/main/java/com/jero/modules/split/controller/FileSplitItemsEOController.java +++ b/laws-modules/src/main/java/com/jero/modules/split/controller/FileSplitItemsEOController.java @@ -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 upload(HttpServletRequest request, HttpServletResponse response, @RequestParam(value = "state",required = false) String state, @RequestParam(value = "cut",required = false) String cut) { - Result 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); } } diff --git a/laws-modules/src/main/java/com/jero/modules/split/service/IFileSplitItemsEOService.java b/laws-modules/src/main/java/com/jero/modules/split/service/IFileSplitItemsEOService.java index 5dc2bacf..b00a28cb 100644 --- a/laws-modules/src/main/java/com/jero/modules/split/service/IFileSplitItemsEOService.java +++ b/laws-modules/src/main/java/com/jero/modules/split/service/IFileSplitItemsEOService.java @@ -85,4 +85,6 @@ public interface IFileSplitItemsEOService extends IService List> getHeader(String flag, String cut); List selectByInfoId(String infoId); + + Result upload(HttpServletRequest request, HttpServletResponse response, String state, String cut); } diff --git a/laws-modules/src/main/java/com/jero/modules/split/service/impl/FileSplitItemsEOServiceImpl.java b/laws-modules/src/main/java/com/jero/modules/split/service/impl/FileSplitItemsEOServiceImpl.java index 1f2842f1..db13ad7a 100644 --- a/laws-modules/src/main/java/com/jero/modules/split/service/impl/FileSplitItemsEOServiceImpl.java +++ b/laws-modules/src/main/java/com/jero/modules/split/service/impl/FileSplitItemsEOServiceImpl.java @@ -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 parameter){ @@ -326,20 +339,26 @@ public class FileSplitItemsEOServiceImpl extends ServiceImpl fieldList = lawsCommonMapper.getFieldList(TableNameEnum.DOCUMENT_SPLIT.getTableName()); + // 列表展示字段 + List fieldListSelect = fieldList.stream().filter(v -> YesOrNoEnum.YES.getValue() + .equals(String.valueOf(v.getIsShowList()))).collect(Collectors.toList()); + // 查询全部字段属性 - List fieldList = onlCgformFieldService.getFieldList(ModuleEnum.FILE_SPLIT_ITEMS.getValue()); +// List fieldList = onlCgformFieldService.getFieldList(ModuleEnum.FILE_SPLIT_ITEMS.getValue()); // 文件类型字段 - List onlFieldFileList = fieldList.stream().filter(e -> FieldTypeEnum.FILE.getValue().equals(e.getFieldShowType())).collect(Collectors.toList()); - List fieldFieldList = onlFieldFileList.stream().map(OnlCgformField::getDbFieldName).collect(Collectors.toList()); + List onlFieldFileList = fieldListSelect.stream().filter(e -> FieldTypeEnum.FILE.getValue().equals(e.getFieldShowType())).collect(Collectors.toList()); + List fieldFieldList = onlFieldFileList.stream().map(LawsTag::getDbFieldName).collect(Collectors.toList()); // 日期类型字段(单日期选择) - List onlFieldDateList = fieldList.stream().filter(e -> FieldTypeEnum.DATE_SINGLE.getValue().equals(e.getFieldShowType())).collect(Collectors.toList()); - List fieldDateList = onlFieldDateList.stream().map(OnlCgformField::getDbFieldName).collect(Collectors.toList()); + List onlFieldDateList = fieldListSelect.stream().filter(e -> FieldTypeEnum.DATE_SINGLE.getValue().equals(e.getFieldShowType())).collect(Collectors.toList()); + List fieldDateList = onlFieldDateList.stream().map(LawsTag::getDbFieldName).collect(Collectors.toList()); // 人员选择类型 - List onlFieldPersonList = fieldList.stream().filter(e -> FieldTypeEnum.PERSON.getValue().equals(e.getFieldShowType())).collect(Collectors.toList()); - List fieldPersonList = onlFieldPersonList.stream().map(OnlCgformField::getDbFieldName).collect(Collectors.toList()); + List onlFieldPersonList = fieldListSelect.stream().filter(e -> FieldTypeEnum.PERSON.getValue().equals(e.getFieldShowType())).collect(Collectors.toList()); + List fieldPersonList = onlFieldPersonList.stream().map(LawsTag::getDbFieldName).collect(Collectors.toList()); // 标准选择类型 - List onlFieldStanList = fieldList.stream().filter(e -> FieldTypeEnum.STANDARD.getValue().equals(e.getFieldShowType())).collect(Collectors.toList()); - List fieldStanList = onlFieldStanList.stream().map(OnlCgformField::getDbFieldName).collect(Collectors.toList()); + List onlFieldStanList = fieldListSelect.stream().filter(e -> FieldTypeEnum.STANDARD.getValue().equals(e.getFieldShowType())).collect(Collectors.toList()); + List fieldStanList = onlFieldStanList.stream().map(LawsTag::getDbFieldName).collect(Collectors.toList()); List fieldPersonIdList = new ArrayList<>(); fieldPersonList.forEach(item->{ @@ -356,7 +375,7 @@ public class FileSplitItemsEOServiceImpl extends ServiceImpl { @@ -1060,7 +1079,7 @@ public class FileSplitItemsEOServiceImpl extends ServiceImpl oldItemMap : oldItemMapList){ if(ObjectUtil.isNotEmpty(oldItemMap.get(dbFieldName))) { @@ -1151,25 +1170,30 @@ public class FileSplitItemsEOServiceImpl extends ServiceImpl getSheetTableList) { //此处需要做各种验证,数据库操作 try { - List onlCgformFieldList = onlCgformFieldService.getFieldList(ModuleEnum.FILE_SPLIT_ITEMS.getValue()); + // 查询全部字段列表 + List fieldLists = lawsCommonMapper.getFieldList(TableNameEnum.DOCUMENT_SPLIT.getTableName()); + // 列表展示字段 + List fieldListSelect = fieldLists.stream().filter(v -> YesOrNoEnum.YES.getValue() + .equals(String.valueOf(v.getIsShowList()))).collect(Collectors.toList()); +// List onlCgformFieldList = onlCgformFieldService.getFieldList(ModuleEnum.FILE_SPLIT_ITEMS.getValue()); // 树形数据字典 dictId - List dictIdList = onlCgformFieldList.stream() + List 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 dictCodeList = onlCgformFieldList.stream() + List 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 addItemValList = new ArrayList<>(); if (addItemsEOList != null && !addItemsEOList.isEmpty()) { Map 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) 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 0) { for (int i = 0; i < valArr.length; i++) { SarFileSplitItemsValEO valEO = new SarFileSplitItemsValEO(); @@ -1298,17 +1322,18 @@ public class FileSplitItemsEOServiceImpl extends ServiceImpl"; +// String imgCon = ""; valEO.setType("IMG"); // valEO.setItemContent(imgCon); valEO.setItemContent(path); @@ -1326,8 +1351,8 @@ public class FileSplitItemsEOServiceImpl extends ServiceImpl 0) { for (int i = 0; i < valArr.length; i++) { SarFileSplitItemsValEO valEO = new SarFileSplitItemsValEO(); @@ -1346,16 +1371,17 @@ public class FileSplitItemsEOServiceImpl extends ServiceImpl"; +// String imgCon = ""; valEO.setType("IMG"); // valEO.setItemContent(imgCon); valEO.setItemContent(path); @@ -1648,18 +1674,31 @@ public class FileSplitItemsEOServiceImpl extends ServiceImpl 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>() { @Override public int compare(Map o1, Map 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 treeNodeList = new ArrayList<>(); String regex = "^[0-9]{0}([0-9]|[.])+$"; //TODO 待优化:数字和点必须交替 for (Map 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 sysDictItems, Map.Entry entry, List 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 dictItemsCh = new ArrayList<>(); + List dictItemsEn = new ArrayList<>(); + if (StringUtils.isNotBlank(value)) { + for (String itemValue : value.split(",")) { + //字段的数据字典 + List dictItemList = sysDictItems.stream() + .filter(e -> StringUtils.isNotBlank(e.getDictCode()) && e.getDictCode().equals(dictCode)) + .collect(Collectors.toList()); + if (dictItemList.size() != 0) { + List dictItems = dictItemList.stream() + .filter(e -> itemValue.equals(e.getItemValue())) + .collect(Collectors.toList()); + if (dictItems.size() != 0) { + List 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 categoryList, Map.Entry entry, List treeFieldList, String cut) { + List 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 idList = Arrays.asList(value.split(",")); + List sysCategoryList = categoryList.stream().filter(e -> idList.contains(e.getId())).collect(Collectors.toList()); + if (LanguageEnum.CN.getValue().equals(cut)) { + List nameList = sysCategoryList.stream().map(SysCategory::getName).collect(Collectors.toList()); + entry.setValue(StringUtils.join(nameList, ",")); + } else { + List nameEnList = sysCategoryList.stream().map(SysCategory::getEnName).collect(Collectors.toList()); + entry.setValue(StringUtils.join(nameEnList, ",")); + } + } + } + } + /** * 下拉选处理数据字典 * @@ -3004,19 +3117,24 @@ public class FileSplitItemsEOServiceImpl extends ServiceImpl> getImportOnlField(String flag, String cut) { - List fieldList = onlCgformFieldService.getFieldList(flag); +// List fieldList = onlCgformFieldService.getFieldList(flag); + // 查询全部字段列表 + List 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 sysCategoryTree = sysCategoryService.getSysCategoryTreeByCut(cut); // 查询所有 并以树结构返回 List> list = new ArrayList<>(); - for (OnlCgformField onlCgformField : fieldList) { + for (LawsTag onlCgformField : fieldList) { Map map = new HashMap<>(); if (FieldTypeEnum.TREE.getValue().equals(onlCgformField.getFieldShowType())) { List sysCategoryTreeVOList = sysCategoryTree.stream() @@ -3068,22 +3186,28 @@ public class FileSplitItemsEOServiceImpl extends ServiceImpl> itemsDataForExport = dao.queryByOrdersForExport(field, idList, condition); // 查询条款表所有字段 - List fieldList = onlCgformFieldService.getFieldList(ModuleEnum.FILE_SPLIT_ITEMS.getValue()); +// List fieldList = onlCgformFieldService.getFieldList(ModuleEnum.FILE_SPLIT_ITEMS.getValue()); + // 查询全部字段列表 + List fieldList = lawsCommonMapper.getFieldList(TableNameEnum.DOCUMENT_SPLIT.getTableName()); + // 列表展示字段 + fieldList = fieldList.stream().filter(v -> YesOrNoEnum.YES.getValue() + .equals(String.valueOf(v.getIsShowList()))).collect(Collectors.toList()); + // 日期类型字段 - List onlCgformFieldList = fieldList.stream() + List onlCgformFieldList = fieldList.stream() .filter(e -> FieldTypeEnum.DATE_SINGLE.getValue().equals(e.getFieldShowType())) .collect(Collectors.toList()); - List fieldDateList = onlCgformFieldList.stream().map(OnlCgformField::getDbFieldName).collect(Collectors.toList()); + List fieldDateList = onlCgformFieldList.stream().map(LawsTag::getDbFieldName).collect(Collectors.toList()); // 人员选择 - List onlCgformFieldPersonList = fieldList.stream() + List onlCgformFieldPersonList = fieldList.stream() .filter(e -> FieldTypeEnum.PERSON.getValue().equals(e.getFieldShowType())) .collect(Collectors.toList()); - List fieldPersonList = onlCgformFieldPersonList.stream().map(OnlCgformField::getDbFieldName).collect(Collectors.toList()); + List fieldPersonList = onlCgformFieldPersonList.stream().map(LawsTag::getDbFieldName).collect(Collectors.toList()); // 标准选择 - List onlCgformFieldStanList = fieldList.stream() + List onlCgformFieldStanList = fieldList.stream() .filter(e -> FieldTypeEnum.STANDARD.getValue().equals(e.getFieldShowType())) .collect(Collectors.toList()); - List fieldStanList = onlCgformFieldStanList.stream().map(OnlCgformField::getDbFieldName).collect(Collectors.toList()); + List fieldStanList = onlCgformFieldStanList.stream().map(LawsTag::getDbFieldName).collect(Collectors.toList()); // 文件字段 // List onlCgformFieldFileList = fieldList.stream() // .filter(e -> FieldTypeEnum.FILE.getValue().equals(e.getFieldShowType())) @@ -3093,14 +3217,14 @@ public class FileSplitItemsEOServiceImpl extends ServiceImpl 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 categoryList = sysCategoryService.list(); //过滤出树形字段 - List treeFieldList = fieldList.stream() + List treeFieldList = fieldList.stream() .filter(e -> FieldTypeEnum.TREE.getValue().equals(e.getFieldShowType())) .collect(Collectors.toList()); //数据字典 @@ -3110,18 +3234,18 @@ public class FileSplitItemsEOServiceImpl extends ServiceImpl record1 = (Map) record; for (Map.Entry entry : record1.entrySet()) { - List collect = fieldList.stream() + List 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 sysUserList = sysUserService.listByIds(Arrays.asList(entry.getValue().toString().split(","))); @@ -3265,7 +3389,7 @@ public class FileSplitItemsEOServiceImpl extends ServiceImpl 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 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> allItemsList = queryByOrdersForExport(cut, field, itemIdList, parameter); // id记得去掉 // 文件类型字段 - List allFieldList = onlCgformFieldService.getFieldList(ModuleEnum.FILE_SPLIT_ITEMS.getValue()); // 查询条款表所有字段 - List onlCgformFieldFileList = allFieldList.stream() + // 查询全部字段列表 + List fieldLists = lawsCommonMapper.getFieldList(TableNameEnum.DOCUMENT_SPLIT.getTableName()); + // 列表展示字段 + fieldLists = fieldLists.stream().filter(v -> YesOrNoEnum.YES.getValue() + .equals(String.valueOf(v.getIsShowList()))).collect(Collectors.toList()); +// List allFieldList = onlCgformFieldService.getFieldList(ModuleEnum.FILE_SPLIT_ITEMS.getValue()); // 查询条款表所有字段 + List onlCgformFieldFileList = fieldLists.stream() .filter(e -> FieldTypeEnum.FILE.getValue().equals(e.getFieldShowType())) .collect(Collectors.toList()); - List fileList = onlCgformFieldFileList.stream().map(OnlCgformField::getDbFieldName).collect(Collectors.toList()); + List fileList = onlCgformFieldFileList.stream().map(LawsTag::getDbFieldName).collect(Collectors.toList()); // 开始处理工作表 List allTableList = new ArrayList<>(); // 存储表格数据 @@ -3391,7 +3523,7 @@ public class FileSplitItemsEOServiceImpl extends ServiceImpl",""); + content = content.replaceAll("

","\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 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 fieldList = lawsCommonMapper.getFieldList(TableNameEnum.DOCUMENT_SPLIT.getTableName()); + // 列表展示字段 + List fieldListSelect = fieldList.stream().filter(v -> YesOrNoEnum.YES.getValue() + .equals(String.valueOf(v.getIsShowList()))).collect(Collectors.toList()); List 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 fieldList = onlCgformFieldService.getFieldList(ModuleEnum.FILE_SPLIT_ITEMS.getValue()); - List 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 fieldList = onlCgformFieldService.getFieldList(ModuleEnum.FILE_SPLIT_ITEMS.getValue()); +// List 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 fieldList = lawsCommonMapper.getFieldList(TableNameEnum.DOCUMENT_SPLIT.getTableName()); + // 列表展示字段 + List 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 upload(HttpServletRequest request, HttpServletResponse response, String state, String cut) { + Result 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; + } + }