From 66003cd78ba46c999490b5dda0bca98b589b40e5 Mon Sep 17 00:00:00 2001 From: zer0Black <694429613@qq.com> Date: Fri, 29 Sep 2023 15:45:40 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E5=88=A0=E9=99=A4=E3=80=91=E5=8E=BB?= =?UTF-8?q?=E6=8E=89=E6=95=B4=E4=B8=AAOCR=E5=8C=85=E3=80=81=E5=8E=BB?= =?UTF-8?q?=E6=8E=89=E9=A2=86=E5=9F=9F=E5=92=8C=E4=BA=BA=E7=9A=84=E5=85=B3?= =?UTF-8?q?=E7=B3=BB=E4=BB=A3=E7=A0=81=E3=80=81=E5=8E=BB=E6=8E=89=E6=90=9C?= =?UTF-8?q?=E7=B4=A2=E4=B8=AD=E5=BF=83=E4=BB=A3=E7=A0=81=20=E3=80=90?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=E3=80=91=E6=9B=B4=E6=8D=A2=E9=83=A8=E5=88=86?= =?UTF-8?q?=E5=B7=A5=E5=85=B7=E7=B1=BB=E7=9A=84=E4=BD=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/jero/common}/util/LineHumpUtil.java | 2 +- .../com/jero/common}/util/RandomUtils.java | 2 +- .../java/com/jero/common}/util/UUIDUtils.java | 14 +- .../BussDocumentLibraryEOServiceImpl.java | 15 +- .../modules/domain/entity/DomainUserRel.java | 47 -- .../domain/mapper/DomainUserRelMapper.java | 11 - .../domain/mapper/xml/DomainManageMapper.xml | 11 - .../domain/service/DomainUserRelService.java | 29 - .../service/impl/DomainManageServiceImpl.java | 103 ---- .../enums/ExtRepoMamagerRoleIdEnum.java | 1 + .../controller/LanguageSwitchController.java | 72 --- .../service/ILanguageSwitchService.java | 36 -- .../impl/LanguageSwitchServiceImpl.java | 169 ------ .../modules/ocr/entity/CommentGroups.java | 17 - .../jero/modules/ocr/entity/FileModel.java | 370 ------------ .../com/jero/modules/ocr/entity/FileType.java | 26 - .../ocr/entity/OcrCallBackResultEO.java | 38 -- .../jero/modules/ocr/entity/OcrRecordEO.java | 151 ----- .../jero/modules/ocr/entity/OcrRequestEO.java | 83 --- .../jero/modules/ocr/entity/OcrResultEO.java | 30 - .../com/jero/modules/ocr/entity/User.java | 48 -- .../jero/modules/ocr/enums/CheckFlagEnum.java | 35 -- .../modules/ocr/enums/FileSourceEnum.java | 36 -- .../modules/ocr/enums/FileSyncStateEnum.java | 36 -- .../jero/modules/ocr/enums/FileTypeEnum.java | 37 -- .../modules/ocr/enums/ResultContentEnum.java | 36 -- .../modules/ocr/helpers/ConfigManager.java | 61 -- .../modules/ocr/helpers/CookieManager.java | 45 -- .../modules/ocr/helpers/DocumentManager.java | 531 ----------------- .../jero/modules/ocr/helpers/FileUtility.java | 132 ----- .../modules/ocr/helpers/ServiceConverter.java | 269 --------- .../modules/ocr/helpers/TrackManager.java | 323 ----------- .../com/jero/modules/ocr/helpers/Users.java | 110 ---- .../modules/ocr/mapper/OcrRecordEOMapper.java | 14 - .../ocr/mapper/xml/OcrRecordEOMapper.xml | 28 - .../ocr/service/IOcrRecordEOService.java | 98 ---- .../service/impl/OcrRecordEOServiceImpl.java | 328 ----------- .../service/impl/AttFileEOServiceImpl.java | 3 +- .../modules/phone/entity/RecentBrowse.java | 86 --- .../modules/phone/enums/BrowseTypeEnum.java | 52 -- .../phone/mapper/RecentBrowseMapper.java | 14 - .../phone/mapper/xml/RecentBrowseMapper.xml | 14 - .../phone/service/ISearchCenterService.java | 14 - .../service/impl/SearchCenterServiceImpl.java | 349 ------------ .../entity/ProjectLawsInventoryEO.java | 539 ------------------ .../enums/ModuleTypeFlagEnum.java | 31 - .../jero/modules/split/common/FileUnZip.java | 64 --- .../SarFileSplitInfoController.java | 6 +- .../split/service/impl/FileSpiltService.java | 2 +- .../impl/FileSplitItemsEOServiceImpl.java | 2 +- .../service/impl/FileSplitPdfService.java | 19 +- .../impl/SarFileSplitInfoServiceImpl.java | 3 +- 52 files changed, 24 insertions(+), 4568 deletions(-) rename {laws-modules/src/main/java/com/jero/modules/ocr => laws-base/laws-base-core/src/main/java/com/jero/common}/util/LineHumpUtil.java (97%) rename {laws-modules/src/main/java/com/jero/modules/ocr => laws-base/laws-base-core/src/main/java/com/jero/common}/util/RandomUtils.java (97%) rename {laws-modules/src/main/java/com/jero/modules/ocr => laws-base/laws-base-core/src/main/java/com/jero/common}/util/UUIDUtils.java (95%) delete mode 100644 laws-modules/src/main/java/com/jero/modules/domain/entity/DomainUserRel.java delete mode 100644 laws-modules/src/main/java/com/jero/modules/domain/mapper/DomainUserRelMapper.java delete mode 100644 laws-modules/src/main/java/com/jero/modules/domain/mapper/xml/DomainManageMapper.xml delete mode 100644 laws-modules/src/main/java/com/jero/modules/domain/service/DomainUserRelService.java delete mode 100644 laws-modules/src/main/java/com/jero/modules/domain/service/impl/DomainManageServiceImpl.java delete mode 100644 laws-modules/src/main/java/com/jero/modules/lanswitch/controller/LanguageSwitchController.java delete mode 100644 laws-modules/src/main/java/com/jero/modules/lanswitch/service/ILanguageSwitchService.java delete mode 100644 laws-modules/src/main/java/com/jero/modules/lanswitch/service/impl/LanguageSwitchServiceImpl.java delete mode 100644 laws-modules/src/main/java/com/jero/modules/ocr/entity/CommentGroups.java delete mode 100644 laws-modules/src/main/java/com/jero/modules/ocr/entity/FileModel.java delete mode 100644 laws-modules/src/main/java/com/jero/modules/ocr/entity/FileType.java delete mode 100644 laws-modules/src/main/java/com/jero/modules/ocr/entity/OcrCallBackResultEO.java delete mode 100644 laws-modules/src/main/java/com/jero/modules/ocr/entity/OcrRecordEO.java delete mode 100644 laws-modules/src/main/java/com/jero/modules/ocr/entity/OcrRequestEO.java delete mode 100644 laws-modules/src/main/java/com/jero/modules/ocr/entity/OcrResultEO.java delete mode 100644 laws-modules/src/main/java/com/jero/modules/ocr/entity/User.java delete mode 100644 laws-modules/src/main/java/com/jero/modules/ocr/enums/CheckFlagEnum.java delete mode 100644 laws-modules/src/main/java/com/jero/modules/ocr/enums/FileSourceEnum.java delete mode 100644 laws-modules/src/main/java/com/jero/modules/ocr/enums/FileSyncStateEnum.java delete mode 100644 laws-modules/src/main/java/com/jero/modules/ocr/enums/FileTypeEnum.java delete mode 100644 laws-modules/src/main/java/com/jero/modules/ocr/enums/ResultContentEnum.java delete mode 100644 laws-modules/src/main/java/com/jero/modules/ocr/helpers/ConfigManager.java delete mode 100644 laws-modules/src/main/java/com/jero/modules/ocr/helpers/CookieManager.java delete mode 100644 laws-modules/src/main/java/com/jero/modules/ocr/helpers/DocumentManager.java delete mode 100644 laws-modules/src/main/java/com/jero/modules/ocr/helpers/FileUtility.java delete mode 100644 laws-modules/src/main/java/com/jero/modules/ocr/helpers/ServiceConverter.java delete mode 100644 laws-modules/src/main/java/com/jero/modules/ocr/helpers/TrackManager.java delete mode 100644 laws-modules/src/main/java/com/jero/modules/ocr/helpers/Users.java delete mode 100644 laws-modules/src/main/java/com/jero/modules/ocr/mapper/OcrRecordEOMapper.java delete mode 100644 laws-modules/src/main/java/com/jero/modules/ocr/mapper/xml/OcrRecordEOMapper.xml delete mode 100644 laws-modules/src/main/java/com/jero/modules/ocr/service/IOcrRecordEOService.java delete mode 100644 laws-modules/src/main/java/com/jero/modules/ocr/service/impl/OcrRecordEOServiceImpl.java delete mode 100644 laws-modules/src/main/java/com/jero/modules/phone/entity/RecentBrowse.java delete mode 100644 laws-modules/src/main/java/com/jero/modules/phone/enums/BrowseTypeEnum.java delete mode 100644 laws-modules/src/main/java/com/jero/modules/phone/mapper/RecentBrowseMapper.java delete mode 100644 laws-modules/src/main/java/com/jero/modules/phone/mapper/xml/RecentBrowseMapper.xml delete mode 100644 laws-modules/src/main/java/com/jero/modules/phone/service/ISearchCenterService.java delete mode 100644 laws-modules/src/main/java/com/jero/modules/phone/service/impl/SearchCenterServiceImpl.java delete mode 100644 laws-modules/src/main/java/com/jero/modules/project/entity/ProjectLawsInventoryEO.java delete mode 100644 laws-modules/src/main/java/com/jero/modules/searchcenter/enums/ModuleTypeFlagEnum.java diff --git a/laws-modules/src/main/java/com/jero/modules/ocr/util/LineHumpUtil.java b/laws-base/laws-base-core/src/main/java/com/jero/common/util/LineHumpUtil.java similarity index 97% rename from laws-modules/src/main/java/com/jero/modules/ocr/util/LineHumpUtil.java rename to laws-base/laws-base-core/src/main/java/com/jero/common/util/LineHumpUtil.java index 1f37a99b..649c77c5 100644 --- a/laws-modules/src/main/java/com/jero/modules/ocr/util/LineHumpUtil.java +++ b/laws-base/laws-base-core/src/main/java/com/jero/common/util/LineHumpUtil.java @@ -1,4 +1,4 @@ -package com.jero.modules.ocr.util; +package com.jero.common.util; import java.util.regex.Matcher; import java.util.regex.Pattern; diff --git a/laws-modules/src/main/java/com/jero/modules/ocr/util/RandomUtils.java b/laws-base/laws-base-core/src/main/java/com/jero/common/util/RandomUtils.java similarity index 97% rename from laws-modules/src/main/java/com/jero/modules/ocr/util/RandomUtils.java rename to laws-base/laws-base-core/src/main/java/com/jero/common/util/RandomUtils.java index a727749f..e8f5c52c 100644 --- a/laws-modules/src/main/java/com/jero/modules/ocr/util/RandomUtils.java +++ b/laws-base/laws-base-core/src/main/java/com/jero/common/util/RandomUtils.java @@ -1,4 +1,4 @@ -package com.jero.modules.ocr.util; +package com.jero.common.util; import java.awt.*; import java.util.Random; diff --git a/laws-modules/src/main/java/com/jero/modules/ocr/util/UUIDUtils.java b/laws-base/laws-base-core/src/main/java/com/jero/common/util/UUIDUtils.java similarity index 95% rename from laws-modules/src/main/java/com/jero/modules/ocr/util/UUIDUtils.java rename to laws-base/laws-base-core/src/main/java/com/jero/common/util/UUIDUtils.java index b94deb1a..4c48e213 100644 --- a/laws-modules/src/main/java/com/jero/modules/ocr/util/UUIDUtils.java +++ b/laws-base/laws-base-core/src/main/java/com/jero/common/util/UUIDUtils.java @@ -1,4 +1,4 @@ -package com.jero.modules.ocr.util; +package com.jero.common.util; import java.util.Random; @@ -8,15 +8,15 @@ public class UUIDUtils { public static String randomUUID10() { return RandomUtils.randomString(10); } - + public static String randomUUID20() { return RandomUtils.randomString(20); } - + public static String randomUUID(int length) { return RandomUtils.randomString(length); } - + public static String getUUIDPath(String uuid){ StringBuilder builder=new StringBuilder(); builder.append("/"); @@ -25,7 +25,7 @@ public class UUIDUtils { builder.append((uuid.substring(11,14).hashCode())%100+"").append("/"); return builder.toString(); } - + public static String getAttTable(){ Random rand = new Random(); int nextInt = rand.nextInt(10)+1; @@ -33,6 +33,6 @@ public class UUIDUtils { builder.append("ATT_FILE_").append(String.format("%02d", nextInt)); return builder.toString(); } - - + + } 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 41345879..fd3ad4f2 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 @@ -34,17 +34,16 @@ import com.jero.modules.document.service.IBussDocumentLibraryEOService; import com.jero.modules.document.utils.ReadPdfUtil; import com.jero.modules.document.utils.ReadWordUtil; import com.jero.modules.document.vo.QueryConditionVO; -import com.jero.modules.domain.entity.DomainUserRel; -import com.jero.modules.domain.service.impl.DomainManageServiceImpl; +//import com.jero.modules.domain.entity.DomainUserRel; +//import com.jero.modules.domain.service.impl.DomainManageServiceImpl; import com.jero.modules.home.entity.HomeDocumentDynamicEO; import com.jero.modules.home.service.IHomeDocumentDynamicEOService; 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.ocr.service.IOcrRecordEOService; import com.jero.modules.oss.entity.OSSFile; import com.jero.modules.oss.service.IOSSFileService; -import com.jero.modules.searchcenter.enums.ModuleTypeFlagEnum; import com.jero.modules.split.common.FileUnZip; import com.jero.modules.split.entity.SarFileSplitInfoEO; import com.jero.modules.split.service.ISarFileSplitInfoService; @@ -133,10 +132,10 @@ public class BussDocumentLibraryEOServiceImpl extends ServiceImpl { -} diff --git a/laws-modules/src/main/java/com/jero/modules/domain/mapper/xml/DomainManageMapper.xml b/laws-modules/src/main/java/com/jero/modules/domain/mapper/xml/DomainManageMapper.xml deleted file mode 100644 index a660a16f..00000000 --- a/laws-modules/src/main/java/com/jero/modules/domain/mapper/xml/DomainManageMapper.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - \ No newline at end of file diff --git a/laws-modules/src/main/java/com/jero/modules/domain/service/DomainUserRelService.java b/laws-modules/src/main/java/com/jero/modules/domain/service/DomainUserRelService.java deleted file mode 100644 index 73303cab..00000000 --- a/laws-modules/src/main/java/com/jero/modules/domain/service/DomainUserRelService.java +++ /dev/null @@ -1,29 +0,0 @@ -package com.jero.modules.domain.service; - -import com.alibaba.fastjson.JSONObject; -import com.baomidou.mybatisplus.extension.service.IService; -import com.jero.common.api.vo.Result; -import com.jero.modules.domain.entity.DomainUserRel; - -import java.util.List; -import java.util.Map; - -/** - * 领域与用户关系 - *@Author: wzj - *@Date: 2022/3/2 11:40 - **/ -public interface DomainUserRelService extends IService { - - Result insert(JSONObject jsonObject); - - Result queryList(); - - /** - * 查询领域、文档关联的用户 - * @param params - * @return - */ - List queryDomainUserRelInfo(Map params); - -} diff --git a/laws-modules/src/main/java/com/jero/modules/domain/service/impl/DomainManageServiceImpl.java b/laws-modules/src/main/java/com/jero/modules/domain/service/impl/DomainManageServiceImpl.java deleted file mode 100644 index b5a27c4f..00000000 --- a/laws-modules/src/main/java/com/jero/modules/domain/service/impl/DomainManageServiceImpl.java +++ /dev/null @@ -1,103 +0,0 @@ -package com.jero.modules.domain.service.impl; - -import com.alibaba.fastjson.JSONObject; -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.jero.common.api.vo.Result; -import com.jero.common.exception.JeroBootException; -import com.jero.common.system.vo.LoginUser; -import com.jero.modules.domain.entity.DomainUserRel; -import com.jero.modules.domain.mapper.DomainUserRelMapper; -import com.jero.modules.domain.service.DomainUserRelService; -import com.jero.modules.system.mapper.SysUserMapper; -import me.zhyd.oauth.utils.StringUtils; -import org.apache.commons.collections4.CollectionUtils; -import org.apache.shiro.SecurityUtils; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import java.util.*; -import java.util.stream.Collectors; - -/** - * 领域与用户关系 - *@Author: wzj - *@Date: 2022/3/2 11:41 - **/ -@Service -public class DomainManageServiceImpl extends ServiceImpl implements DomainUserRelService { - - //我的订阅 - //@Autowired - //private OnlCgformSubscribeMapper onlCgformSubscribeMapper; - - @Autowired - private SysUserMapper sysUserMapper; - - @Override - public Result insert(JSONObject jsonObject) { - try { - List domainIdList = jsonObject.getJSONArray("domainIdList").toJavaList(String.class); - LoginUser currentUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); - String userName = currentUser.getUsername(); - String userId = currentUser.getId(); - QueryWrapper deleteWrapepr = new QueryWrapper<>(); - deleteWrapepr.lambda().eq(DomainUserRel::getUserId,userId); - super.baseMapper.delete(deleteWrapepr); - - List domainUserRelList = new ArrayList<>(); - domainIdList.forEach(domainId -> { - DomainUserRel domainUserRel = new DomainUserRel(); - domainUserRel.setCreateBy(userName); - domainUserRel.setDomainId(domainId); - domainUserRel.setUserId(userId); - domainUserRel.setCreateTime(new Date()); - domainUserRelList.add(domainUserRel); - }); - if (CollectionUtils.isNotEmpty(domainIdList)) { - super.saveBatch(domainUserRelList); - } - }catch (Exception ex){ - log.error("添加领域与用户关系失败:" + ex.getMessage()); - throw new JeroBootException("添加失败!"); - } - return Result.OK("添加成功!"); - } - - @Override - public Result queryList() { - LoginUser currentUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); - String userId = currentUser.getId(); - QueryWrapper queryWrapper = new QueryWrapper<>(); - queryWrapper.lambda().eq(DomainUserRel::getUserId,userId); - List domainUserRels = super.baseMapper.selectList(queryWrapper); - return Result.OK(domainUserRels); - } - - /** - * 查询领域、文档关联的用户 - * @param params - * @return - */ - @Override - public List queryDomainUserRelInfo(Map params) { - String domainId = (String) params.get("domainId"); - String documentId = (String) params.get("documentId"); - List result = new ArrayList<>(); - try { - //获取订阅该领域的所有用户信息 - if(StringUtils.isNotEmpty(domainId)){ - QueryWrapper queryDomain = new QueryWrapper<>(); - queryDomain.lambda().in(DomainUserRel::getDomainId, Arrays.asList(domainId.split(","))); - List domainUserRelList = super.baseMapper.selectList(queryDomain); - if(CollectionUtils.isNotEmpty(domainUserRelList)){ - result = domainUserRelList.stream().map(DomainUserRel::getUserId).distinct().collect(Collectors.toList()); - } - } - }catch (Exception ex){ - log.error("根据领域id、文档id查询用户失败:" + ex.getMessage()); - throw new JeroBootException("根据领域id、文档id查询用户失败!"); - } - return result; - } -} diff --git a/laws-modules/src/main/java/com/jero/modules/extRepo/enums/ExtRepoMamagerRoleIdEnum.java b/laws-modules/src/main/java/com/jero/modules/extRepo/enums/ExtRepoMamagerRoleIdEnum.java index 323de148..7a23cc4e 100644 --- a/laws-modules/src/main/java/com/jero/modules/extRepo/enums/ExtRepoMamagerRoleIdEnum.java +++ b/laws-modules/src/main/java/com/jero/modules/extRepo/enums/ExtRepoMamagerRoleIdEnum.java @@ -3,6 +3,7 @@ package com.jero.modules.extRepo.enums; import java.util.ArrayList; import java.util.List; +// TODO 需要进行修改,此处是写死的角色id public enum ExtRepoMamagerRoleIdEnum { MANAGER_ID("系统管理员", "Administrator", "admin", "f6817f48af4fb3af11b9e8bf182f618b", 1), ERMANAGER_ID("资料中心管理员", "ExternalReportsManager", "ExternalReportsManager", "1552536424587862017", 2); diff --git a/laws-modules/src/main/java/com/jero/modules/lanswitch/controller/LanguageSwitchController.java b/laws-modules/src/main/java/com/jero/modules/lanswitch/controller/LanguageSwitchController.java deleted file mode 100644 index 002ffc2c..00000000 --- a/laws-modules/src/main/java/com/jero/modules/lanswitch/controller/LanguageSwitchController.java +++ /dev/null @@ -1,72 +0,0 @@ -//package com.jero.modules.lanswitch.controller; -// -//import com.jero.common.api.vo.Result; -//import com.jero.common.aspect.annotation.AutoLog; -//import com.jero.modules.lanswitch.service.ILanguageSwitchService; -//import io.swagger.annotations.Api; -//import io.swagger.annotations.ApiOperation; -//import lombok.extern.slf4j.Slf4j; -//import org.springframework.beans.factory.annotation.Autowired; -//import org.springframework.web.bind.annotation.GetMapping; -//import org.springframework.web.bind.annotation.RequestMapping; -//import org.springframework.web.bind.annotation.RequestParam; -//import org.springframework.web.bind.annotation.RestController; -// -//import java.util.List; -//import java.util.Map; -// -///** -// * @Author: liyawei -// * @Description: -// * @Date: Created in 12:07 2022/3/22 -// */ -//@RestController -//@RequestMapping("/language/switch") -//@Api(tags="中英文切换通用接口") -//@Slf4j -//public class LanguageSwitchController { -// @Autowired -// private ILanguageSwitchService languageSwitchService; -// -// /** -// * 表头中英文切换 -// * -// * @return -// */ -// @AutoLog(value = "表头中英文切换") -// @ApiOperation(value="表头中英文切换", notes="表头中英文切换") -// @GetMapping(value = "/getHeader") -// public Result>> getHeader(@RequestParam(name = "flag") String flag, -// @RequestParam(name = "cut") String cut) { -// List> list = languageSwitchService.getHeader(flag, cut); -// return Result.OK(list); -// } -// -// /** -// * 查询条件中英文切换 -// * -// * @return -// */ -// @AutoLog(value = "查询条件中英文切换") -// @ApiOperation(value="查询条件中英文切换", notes="查询条件中英文切换") -// @GetMapping(value = "/queryCondition") -// public Result>> queryCondition(@RequestParam(name = "flag") String flag, -// @RequestParam(name = "cut") String cut) { -// List> list = languageSwitchService.queryCondition(flag, cut); -// return Result.OK(list); -// } -// /** -// * 表单中英文切换 -// * -// * @return -// */ -// @AutoLog(value = "表单中英文切换") -// @ApiOperation(value="表单中英文切换", notes="表单中英文切换") -// @GetMapping(value = "/getForm") -// public Result>> getForm(@RequestParam(name = "flag") String flag, -// @RequestParam(name = "cut") String cut) { -// List> list = languageSwitchService.getForm(flag, cut); -// return Result.OK(list); -// } -// -//} diff --git a/laws-modules/src/main/java/com/jero/modules/lanswitch/service/ILanguageSwitchService.java b/laws-modules/src/main/java/com/jero/modules/lanswitch/service/ILanguageSwitchService.java deleted file mode 100644 index 6d1b5765..00000000 --- a/laws-modules/src/main/java/com/jero/modules/lanswitch/service/ILanguageSwitchService.java +++ /dev/null @@ -1,36 +0,0 @@ -//package com.jero.modules.lanswitch.service; -// -//import java.util.List; -//import java.util.Map; -// -///** -// * @Author: liyawei -// * @Description: -// * @Date: Created in 12:08 2022/3/22 -// */ -//public interface ILanguageSwitchService { -// -// /** -// * 列表表头中英文切换 -// * @param flag -// * @param cut -// * @return -// */ -// List> getHeader(String flag, String cut); -// -// /** -// * 查询条件中英文切换 -// * @param flag -// * @param cut -// * @return -// */ -// List> queryCondition(String flag, String cut); -// -// /** -// * 表单中英文切换 -// * @param flag -// * @param cut -// * @return -// */ -// List> getForm(String flag, String cut); -//} diff --git a/laws-modules/src/main/java/com/jero/modules/lanswitch/service/impl/LanguageSwitchServiceImpl.java b/laws-modules/src/main/java/com/jero/modules/lanswitch/service/impl/LanguageSwitchServiceImpl.java deleted file mode 100644 index d2a26338..00000000 --- a/laws-modules/src/main/java/com/jero/modules/lanswitch/service/impl/LanguageSwitchServiceImpl.java +++ /dev/null @@ -1,169 +0,0 @@ -//package com.jero.modules.lanswitch.service.impl; -// -//import com.jero.common.constant.enums.LanguageEnum; -//import com.jero.common.constant.enums.ModuleEnum; -//import com.jero.common.constant.enums.YesOrNoEnum; -//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.lanswitch.service.ILanguageSwitchService; -//import com.jero.modules.ocr.util.LineHumpUtil; -//import com.jero.modules.system.entity.SysCategoryTreeVO; -//import com.jero.modules.system.service.impl.SysCategoryServiceImpl; -//import org.springframework.beans.factory.annotation.Autowired; -//import org.springframework.stereotype.Service; -// -//import java.util.ArrayList; -//import java.util.HashMap; -//import java.util.List; -//import java.util.Map; -//import java.util.stream.Collectors; -// -///** -// * @Author: liyawei -// * @Description: -// * @Date: Created in 12:08 2022/3/22 -// */ -//@Service -//public class LanguageSwitchServiceImpl implements ILanguageSwitchService { -// @Autowired -// private OnlCgformFieldServiceImpl onlCgformFieldService; -// -// @Autowired -// private SysCategoryServiceImpl sysCategoryService; -// -// /** -// * 列表表头中英文切换 -// * -// * @return -// */ -// @Override -// public List> getHeader(String flag, String cut) { -// List fieldList = onlCgformFieldService.getFieldList(flag); -// if (fieldList.size() != 0) { -// //过滤列表字段(is_show_list-->列表是否显示0否 1是) -// fieldList = fieldList.stream().filter(e -> YesOrNoEnum.YES.getValue().equals(String.valueOf(e.getIsShowList()))).collect(Collectors.toList()); -// } -// List> list = new ArrayList<>(); -// for (OnlCgformField onlCgformField : fieldList) { -// Map map = new HashMap<>(); -// if(FieldTypeEnum.TEXT_LINK.getValue().equals(onlCgformField.getFieldShowType())){ -// map.put("urlClick","true"); -// } -// if("file_name".equals(onlCgformField.getDbFieldName())){ -// //跳转详情的标识 -// map.put("click","true"); -// } -// //日期添加排序标识 -// if ("create_time".equals(onlCgformField.getDbFieldName())) { -// map.put("sort", "true");//列表排序标识 -// } -// if ("update_time".equals(onlCgformField.getDbFieldName())) { -// map.put("sort", "true");//列表排序标识 -// } -// -// String dbFieldName = onlCgformField.getDbFieldName(); -// if (ModuleEnum.FILE_SPLIT_ITEMS.getValue().equals(flag)) { -// map.put("db_field_name", dbFieldName); -// } else { -// map.put("db_field_name", LineHumpUtil.lineToHump(dbFieldName)); -// } -// -// if(LanguageEnum.CN.getValue().equals(cut)){ -// map.put("db_field_txt", onlCgformField.getDbFieldTxt());//字段中文名 -// }else{ -// map.put("db_field_txt", onlCgformField.getDbFieldEnName());//字段英文名 -// } -// list.add(map); -// } -// return list; -// } -// -// /** -// * 查询条件中英文切换 -// * -// * @return -// */ -// @Override -// public List> queryCondition(String flag, String cut) { -// List fieldList = onlCgformFieldService.getFieldList(flag); -// if (fieldList.size() != 0) { -// //过滤出搜索条件() -// fieldList = fieldList.stream().filter(e -> YesOrNoEnum.YES.getValue().equals(String.valueOf(e.getIsQuery()))).collect(Collectors.toList()); -// } -// //树形数据字典 -// List sysCategoryTree = sysCategoryService.getSysCategoryTreeByCut(cut); // 查询所有 并以树结构返回 -// -// List> list = new ArrayList<>(); -// for (OnlCgformField onlCgformField : fieldList) { -// Map map = new HashMap<>(); -// -// if (FieldTypeEnum.TREE.getValue().equals(onlCgformField.getFieldShowType())) { -// List sysCategoryTreeVOList = sysCategoryTree.stream() -// .filter(e -> onlCgformField.getDictId().equals(e.getDictId())) -// .collect(Collectors.toList()); -// map.put("tree", sysCategoryTreeVOList); // 树形结构字段 设置树形结构字段值 -// } else { -// map.put("tree", new ArrayList<>()); // 其他类型字段 该key为空 -// } -// -// map.put("field_show_type", onlCgformField.getFieldShowType());//类型(判断是下拉还是输入框,等等) -// map.put("dict_field", onlCgformField.getDictField()); //下拉类型的数据字典编码 -// if (ModuleEnum.FILE_SPLIT_ITEMS.getValue().equals(flag)) { -// map.put("db_field_name", onlCgformField.getDbFieldName());//字段 -// } else { -// map.put("db_field_name", LineHumpUtil.lineToHump(onlCgformField.getDbFieldName()));//字段 -// } -// -// if (LanguageEnum.CN.getValue().equals(cut)) { -// map.put("db_field_txt", onlCgformField.getDbFieldTxt());//字段中文名 -// } else { -// map.put("db_field_txt", onlCgformField.getDbFieldEnName());//字段英文名 -// } -// list.add(map); -// } -// return list; -// } -// -// @Override -// public List> getForm(String flag, String cut) { -// List fieldList = onlCgformFieldService.getFieldList(flag); -// if (fieldList.size() != 0) { -// //过滤出搜索条件() -// fieldList = fieldList.stream().filter(e -> YesOrNoEnum.YES.getValue().equals(String.valueOf(e.getIsShowForm()))).collect(Collectors.toList()); -// } -// //树形数据字典 -// List sysCategoryTree = sysCategoryService.getSysCategoryTreeByCut(cut); // 查询所有 并以树结构返回 -// -// List> list = new ArrayList<>(); -// for (OnlCgformField onlCgformField : fieldList) { -// Map map = new HashMap<>(); -// if (FieldTypeEnum.TREE.getValue().equals(onlCgformField.getFieldShowType())) { -// List sysCategoryTreeVOList = sysCategoryTree.stream() -// .filter(e -> onlCgformField.getDictId().equals(e.getDictId())) -// .collect(Collectors.toList()); -// map.put("tree", sysCategoryTreeVOList); // 树形结构字段 设置树形结构字段值 -// } else { -// map.put("tree", new ArrayList<>()); // 其他类型字段 该key为空 -// } -// -// map.put("area", null);//展示区域。没用到 -// map.put("field_show_type", onlCgformField.getFieldShowType());//类型(判断是下拉还是输入框,等等) -// map.put("field_must_input", onlCgformField.getFieldMustInput());//是否必填 -// map.put("dict_field", onlCgformField.getDictField()); //下拉类型的数据字典编码 -// if (ModuleEnum.FILE_SPLIT_ITEMS.getValue().equals(flag)) { -// map.put("db_field_name", onlCgformField.getDbFieldName());//字段 -// } else { -// map.put("db_field_name", LineHumpUtil.lineToHump(onlCgformField.getDbFieldName()));//字段 -// } -// map.put("db_length", onlCgformField.getDbLength());//字段长度 -// if (LanguageEnum.CN.getValue().equals(cut)) { -// map.put("db_field_txt", onlCgformField.getDbFieldTxt());//字段中文名 -// } else { -// map.put("db_field_txt", onlCgformField.getDbFieldEnName());//字段英文名 -// } -// list.add(map); -// } -// return list; -// } -//} diff --git a/laws-modules/src/main/java/com/jero/modules/ocr/entity/CommentGroups.java b/laws-modules/src/main/java/com/jero/modules/ocr/entity/CommentGroups.java deleted file mode 100644 index 4a6629f7..00000000 --- a/laws-modules/src/main/java/com/jero/modules/ocr/entity/CommentGroups.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.jero.modules.ocr.entity; - -import java.util.List; - -public class CommentGroups { - public List view; - public List edit; - public List remove; - public CommentGroups(){ - - } - public CommentGroups(List view, List edit, List remove){ - this.view = view; - this.edit = edit; - this.remove = remove; - } -} diff --git a/laws-modules/src/main/java/com/jero/modules/ocr/entity/FileModel.java b/laws-modules/src/main/java/com/jero/modules/ocr/entity/FileModel.java deleted file mode 100644 index d45af8a5..00000000 --- a/laws-modules/src/main/java/com/jero/modules/ocr/entity/FileModel.java +++ /dev/null @@ -1,370 +0,0 @@ -/** - * - * (c) Copyright Ascensio System SIA 2021 - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -package com.jero.modules.ocr.entity; - -import com.google.gson.Gson; -import com.google.gson.reflect.TypeToken; -import com.jero.modules.ocr.helpers.DocumentManager; -import com.jero.modules.ocr.helpers.FileUtility; -import com.jero.modules.ocr.helpers.ServiceConverter; -import org.json.simple.JSONArray; -import org.json.simple.JSONObject; -import org.json.simple.parser.JSONParser; - -import java.io.File; -import java.io.FileInputStream; -import java.util.*; - -public class FileModel -{ - public String type = "desktop"; - public String mode = "edit"; - public String documentType; - public Document document; - public EditorConfig editorConfig; - public String token; - - // create file model - public FileModel(String fileName, String lang, String actionData, User user) - { - if (fileName == null) fileName = ""; - fileName = fileName.trim(); // remove extra spaces in the file name - - // get file type from the file name (word, cell or slide) - documentType = FileUtility.GetFileType(fileName).toString().toLowerCase(); - - // set the document parameters - document = new Document(); - document.title = fileName; - document.url = DocumentManager.GetDownloadUrl(fileName); // get file url - document.urlUser = DocumentManager.GetFileUri(fileName, false); - document.fileType = FileUtility.GetFileExtension(fileName).replace(".", ""); // get file extension from the file name - // generate document key - document.key = ServiceConverter.GenerateRevisionId(DocumentManager.CurUserHostAddress(null) + "/" + fileName + "/" + Long.toString(new File(DocumentManager.StoragePath(fileName, null)).lastModified())); - document.info = new Info(); - document.info.favorite = user.favorite; - - String templatesImageUrl = DocumentManager.GetTemplateImageUrl(FileUtility.GetFileType(fileName)); - List> templates = new ArrayList<>(); - String createUrl = DocumentManager.GetCreateUrl(FileUtility.GetFileType(fileName)); - - // add templates for the "Create New" from menu option - Map templateForBlankDocument = new HashMap<>(); - templateForBlankDocument.put("image", ""); - templateForBlankDocument.put("title", "Blank"); - templateForBlankDocument.put("url", createUrl); - templates.add(templateForBlankDocument); - Map templateForDocumentWithSampleContent = new HashMap<>(); - templateForDocumentWithSampleContent.put("image", templatesImageUrl); - templateForDocumentWithSampleContent.put("title", "With sample content"); - templateForDocumentWithSampleContent.put("url", createUrl + "&sample=true"); - templates.add(templateForDocumentWithSampleContent); - - // set the editor config parameters - editorConfig = new EditorConfig(actionData); - editorConfig.callbackUrl = DocumentManager.GetCallback(fileName); // get callback url - - if (lang != null) editorConfig.lang = lang; // write language parameter to the config - - editorConfig.createUrl = !user.id.equals("uid-0") ? createUrl : null; - editorConfig.templates = user.templates ? templates : null; - - // write user information to the config (id, name and group) - editorConfig.user.id = user.id; - editorConfig.user.name = user.name; - editorConfig.user.group = user.group; - - // write the absolute URL to the file location - editorConfig.customization.goback.url = DocumentManager.GetServerUrl(false) + "/IndexServlet"; - - changeType(mode, type, user); - } - - // change the document type - public void changeType(String _mode, String _type, User user) - { - if (_mode != null) mode = _mode; - if (_type != null) type = _type; - - // check if the file with such an extension can be edited - String fileExt = FileUtility.GetFileExtension(document.title); - Boolean canEdit = DocumentManager.GetEditedExts().contains(fileExt); - // check if the Submit form button is displayed or not - editorConfig.customization.submitForm = mode.equals("fillForms") && user.id.equals("uid-1") && false; - - if ((!canEdit && mode.equals("edit") || mode.equals("fillForms")) && DocumentManager.GetFillExts().contains(fileExt)) { - canEdit = true; - mode = "fillForms"; - } - // set the mode parameter: change it to view if the document can't be edited - editorConfig.mode = canEdit && !mode.equals("view") ? "edit" : "view"; - - // set document permissions - document.permissions = new Permissions(mode, type, canEdit, user); - - if (type.equals("embedded")) InitDesktop(); // set parameters for the embedded document - } - - public void InitDesktop() - { - editorConfig.InitDesktop(document.urlUser); - } - - // generate document token - public void BuildToken() - { - // write all the necessary document parameters to the map - Map map = new HashMap<>(); - map.put("type", type); - map.put("documentType", documentType); - map.put("document", document); - map.put("editorConfig", editorConfig); - - // and create token from them - token = DocumentManager.CreateToken(map); - } - - // get document history - public String[] GetHistory() - { - JSONParser parser = new JSONParser(); - String histDir = DocumentManager.HistoryDir(DocumentManager.StoragePath(document.title, null)); // get history directory - if (DocumentManager.GetFileVersion(histDir) > 0) { - Integer curVer = DocumentManager.GetFileVersion(histDir); // get current file version if it is greater than 0 - - List hist = new ArrayList<>(); - Map histData = new HashMap(); - - for (Integer i = 1; i <= curVer; i++) { // run through all the file versions - Map obj = new HashMap(); - Map dataObj = new HashMap(); - String verDir = DocumentManager.VersionDir(histDir, i); // get the path to the given file version - - try { - String key = null; - - // get document key - key = i == curVer ? document.key : readFileToEnd(new File(verDir + File.separator + "key.txt")); - - obj.put("key", key); - obj.put("version", i); - - if (i == 1) { // check if the version number is equal to 1 - String createdInfo = readFileToEnd(new File(histDir + File.separator + "createdInfo.json")); // get file with meta data - JSONObject json = (JSONObject) parser.parse(createdInfo); // and turn it into json object - - // write meta information to the object (user information and creation date) - obj.put("created", json.get("created")); - Map user = new HashMap(); - user.put("id", json.get("id")); - user.put("name", json.get("name")); - obj.put("user", user); - } - - dataObj.put("key", key); - dataObj.put("url", i == curVer ? document.url : DocumentManager.GetPathUri(verDir + File.separator + "prev" + FileUtility.GetFileExtension(document.title))); - dataObj.put("version", i); - - if (i > 1) { //check if the version number is greater than 1 - // if so, get the path to the changes.json file - JSONObject changes = (JSONObject) parser.parse(readFileToEnd(new File(DocumentManager.VersionDir(histDir, i - 1) + File.separator + "changes.json"))); - JSONObject change = (JSONObject) ((JSONArray) changes.get("changes")).get(0); - - // write information about changes to the object - obj.put("changes", !change.isEmpty() ? changes.get("changes") : null); - obj.put("serverVersion", changes.get("serverVersion")); - obj.put("created", !change.isEmpty() ? change.get("created") : null); - obj.put("user", !change.isEmpty() ? change.get("user") : null); - - Map prev = (Map) histData.get(Integer.toString(i - 2)); // get the history data from the previous file version - Map prevInfo = new HashMap(); - prevInfo.put("key", prev.get("key")); // write key and url information about previous file version - prevInfo.put("url", prev.get("url")); - dataObj.put("previous", prevInfo); // write information about previous file version to the data object - // write the path to the diff.zip archive with differences in this file version - dataObj.put("changesUrl", DocumentManager.GetPathUri(DocumentManager.VersionDir(histDir, i - 1) + File.separator + "diff.zip")); - } - - if (DocumentManager.TokenEnabled()) - { - dataObj.put("token", DocumentManager.CreateToken(dataObj)); - } - - hist.add(obj); - histData.put(Integer.toString(i - 1), dataObj); - - } catch (Exception ex) { } - } - - // write history information about the current file version to the history object - Map histObj = new HashMap(); - histObj.put("currentVersion", curVer); - histObj.put("history", hist); - - Gson gson = new Gson(); - return new String[] { gson.toJson(histObj), gson.toJson(histData) }; - } - return new String[] { "", "" }; - } - - // read a file - private String readFileToEnd(File file) { - String output = ""; - try { - try(FileInputStream is = new FileInputStream(file)) - { - Scanner scanner = new Scanner(is); // read data from the source - scanner.useDelimiter("\\A"); - while (scanner.hasNext()) { - output += scanner.next(); - } - scanner.close(); - } - } catch (Exception e) { } - return output; - } - - // the document parameters - public class Document - { - public String title; - public String url; - public String urlUser; - public String fileType; - public String key; - public Info info; - public Permissions permissions; - } - - // the permissions parameters - public class Permissions - { - public Boolean comment; - public Boolean сopy; - public Boolean download; - public Boolean edit; - public Boolean print; - public Boolean fillForms; - public Boolean modifyFilter; - public Boolean modifyContentControl; - public Boolean review; - public List reviewGroups; - public CommentGroups commentGroups; - - // defines what can be done with a document - public Permissions(String mode, String type, Boolean canEdit, User user) - { - comment = !mode.equals("view") && !mode.equals("fillForms") && !mode.equals("embedded") && !mode.equals("blockcontent"); - сopy = !user.deniedPermissions.contains("сopy"); - download = !user.deniedPermissions.contains("download"); - edit = canEdit && (mode.equals("edit") || mode.equals("view") || mode.equals("filter") || mode.equals("blockcontent")); - print = !user.deniedPermissions.contains("print"); - fillForms = !mode.equals("view") && !mode.equals("comment") && !mode.equals("embedded") && !mode.equals("blockcontent"); - modifyFilter = !mode.equals("filter"); - modifyContentControl = !mode.equals("blockcontent"); - review = canEdit && (mode.equals("edit") || mode.equals("review")); - reviewGroups = user.reviewGroups; - commentGroups = user.commentGroups; - } - } - - // the Favorite icon state - public class Info - { - public Boolean favorite; - } - // the editor config parameters - public class EditorConfig - { - public HashMap actionLink = null; - public String mode = "edit"; - public String callbackUrl; - public String lang = "en"; - public String createUrl; - public List> templates; - public User user; - public Customization customization; - public Embedded embedded; - - public EditorConfig(String actionData) - { - // get the action in the document that will be scrolled to (bookmark or comment) - if (actionData != null) { - Gson gson = new Gson(); - actionLink = gson.fromJson(actionData, new TypeToken>() { }.getType()); - } - user = new User(); - customization = new Customization(); - } - - // set parameters for the embedded document - public void InitDesktop(String url) - { - embedded = new Embedded(); - embedded.saveUrl = url; // the absolute URL that will allow the document to be saved onto the user personal computer - embedded.embedUrl = url; // the absolute URL to the document serving as a source file for the document embedded into the web page - embedded.shareUrl = url; // the absolute URL that will allow other users to share this document - embedded.toolbarDocked = "top"; // the place for the embedded viewer toolbar, can be either top or bottom - } - - // default user parameters (id, name and group) - public class User - { - public String id; - public String name; - public String group; - } - - // customization parameters - public class Customization - { - public Goback goback; - public Boolean forcesave; - public Boolean submitForm; - - public Customization() - { - forcesave = false; - goback = new Goback(); - } - - public class Goback - { - public String url; - } - } - - // parameters for embedded document - public class Embedded - { - public String saveUrl; - public String embedUrl; - public String shareUrl; - public String toolbarDocked; - } - } - - - // turn java objects into json strings - public static String Serialize(FileModel model) - { - Gson gson = new Gson(); - return gson.toJson(model); - } -} diff --git a/laws-modules/src/main/java/com/jero/modules/ocr/entity/FileType.java b/laws-modules/src/main/java/com/jero/modules/ocr/entity/FileType.java deleted file mode 100644 index 12f4162e..00000000 --- a/laws-modules/src/main/java/com/jero/modules/ocr/entity/FileType.java +++ /dev/null @@ -1,26 +0,0 @@ -/** - * - * (c) Copyright Ascensio System SIA 2021 - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -package com.jero.modules.ocr.entity; - -public enum FileType -{ - Word, - Cell, - Slide -} \ No newline at end of file diff --git a/laws-modules/src/main/java/com/jero/modules/ocr/entity/OcrCallBackResultEO.java b/laws-modules/src/main/java/com/jero/modules/ocr/entity/OcrCallBackResultEO.java deleted file mode 100644 index 1be64efe..00000000 --- a/laws-modules/src/main/java/com/jero/modules/ocr/entity/OcrCallBackResultEO.java +++ /dev/null @@ -1,38 +0,0 @@ -package com.jero.modules.ocr.entity; - -/** - * @program: OcrDemo - * @description: orc调取回调函数的参数 - * @author: duyunbao - * @create: 2019-03-13 16:14 - */ -public class OcrCallBackResultEO { - - private String result ; - private String taskID ; - private String key; - - public String getResult() { - return result; - } - - public void setResult(String result) { - this.result = result; - } - - public String getTaskID() { - return taskID; - } - - public void setTaskID(String taskID) { - this.taskID = taskID; - } - - public String getKey() { - return key; - } - - public void setKey(String key) { - this.key = key; - } -} diff --git a/laws-modules/src/main/java/com/jero/modules/ocr/entity/OcrRecordEO.java b/laws-modules/src/main/java/com/jero/modules/ocr/entity/OcrRecordEO.java deleted file mode 100644 index bd9f210f..00000000 --- a/laws-modules/src/main/java/com/jero/modules/ocr/entity/OcrRecordEO.java +++ /dev/null @@ -1,151 +0,0 @@ -package com.jero.modules.ocr.entity; - -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableField; -import com.baomidou.mybatisplus.annotation.TableId; -import com.baomidou.mybatisplus.annotation.TableName; -import com.fasterxml.jackson.annotation.JsonFormat; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; -import lombok.EqualsAndHashCode; -import lombok.experimental.Accessors; -import org.jeecgframework.poi.excel.annotation.Excel; -import org.springframework.format.annotation.DateTimeFormat; - -import java.io.Serializable; - - -/** - * @Description: OCR识别转换记录表 - * @Author: jero-boot - * @Date: 2022-02-16 - * @Version: V1.0 - */ -@Data -@TableName("ocr_record") -@Accessors(chain = true) -@EqualsAndHashCode(callSuper = false) -@ApiModel(value="ocr_record对象", description="OCR识别转换记录表") -public class OcrRecordEO implements Serializable { - private static final long serialVersionUID = 1L; - - /**主键*/ - @TableId(type = IdType.ASSIGN_ID) - @ApiModelProperty(value = "主键") - private String id; - - /**创建人*/ - @ApiModelProperty(value = "创建人") - private String createBy; - - /**创建日期*/ - @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss") - @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") - @ApiModelProperty(value = "创建日期") - private java.util.Date createTime; - - /**更新人*/ - @ApiModelProperty(value = "更新人") - private String updateBy; - - /**更新日期*/ - @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss") - @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") - @ApiModelProperty(value = "更新日期") - private java.util.Date updateTime; - - /**所属部门*/ - @ApiModelProperty(value = "所属部门") - private String sysOrgCode; - - /**标准名称*/ - @Excel(name = "标准名称", width = 15) - @ApiModelProperty(value = "标准名称") - private String standName; - - /**标准英文名称*/ - @Excel(name = "标准英文名称", width = 15) - @ApiModelProperty(value = "标准英文名称") - private String standNameEn; - - /**标准编号*/ - @Excel(name = "标准编号", width = 15) - @ApiModelProperty(value = "标准编号") - private String standNumber; - - /**文本状态*/ - @Excel(name = "文本状态", width = 15, dicCode = "file_type") -// @Dict(dicCode = "file_type") - @ApiModelProperty(value = "文本状态") - private String fileType; - - /**文件名称*/ - @Excel(name = "文件名称", width = 15) - @ApiModelProperty(value = "文件名称") - private String fileName; - - /**转换结果*/ - @Excel(name = "转换结果", width = 15) -// @Dict(dicCode = "result_content") - @ApiModelProperty(value = "转换结果") - private String resultContent; - - /**doc本地存放全路径*/ - @Excel(name = "doc本地存放全路径", width = 15) - @ApiModelProperty(value = "doc本地存放全路径") - private String docName; - - /**doc文件名称*/ - @Excel(name = "doc文件名称", width = 15) - @ApiModelProperty(value = "doc文件名称") - private String docRealName; - - /**doc文件编码*/ - @Excel(name = "doc文件编码", width = 15) - @ApiModelProperty(value = "doc文件编码") - private String wordFileCode; - - /**json文件本地存放全路径*/ - @Excel(name = "json文件本地存放全路径", width = 15) - @ApiModelProperty(value = "json文件本地存放全路径") - private String jsonName; - - /**json文件名称*/ - @Excel(name = "json文件名称", width = 15) - @ApiModelProperty(value = "json文件名称") - private String jsonRealName; - - /**json文件编码*/ - @Excel(name = "json文件编码", width = 15) - @ApiModelProperty(value = "json文件编码") - private String jsonFileCode; - - /**pdf文件id*/ - @Excel(name = "pdf文件id", width = 15) - @ApiModelProperty(value = "pdf文件id") - private String attId; - - /**同步状态*/ - @Excel(name = "同步状态", width = 15) -// @Dict(dicCode = "sync_state") - @ApiModelProperty(value = "同步状态") - private String syncState; - - /**文档库关联文件id*/ - @ApiModelProperty(value = "文档库关联文件id") - private String connectId; - - /**校核锁定标识*/ - @ApiModelProperty(value = "校核锁定标识") - private String checkFlag; - - @TableField(exist = false) - private String docRealFile; - @TableField(exist = false) - private String jsonRealFile; - @TableField(exist = false) - private String fileSource; //文件来源:0-上传 1-导入 - @TableField(exist = false) - private String cut; -} diff --git a/laws-modules/src/main/java/com/jero/modules/ocr/entity/OcrRequestEO.java b/laws-modules/src/main/java/com/jero/modules/ocr/entity/OcrRequestEO.java deleted file mode 100644 index 75002c3f..00000000 --- a/laws-modules/src/main/java/com/jero/modules/ocr/entity/OcrRequestEO.java +++ /dev/null @@ -1,83 +0,0 @@ -package com.jero.modules.ocr.entity; - -/** - * @program: OcrDemo - * @description: ocr接口请求实体类 - * @author: duyunbao - * @create: 2019-03-13 20:46 - */ -public class OcrRequestEO { - - private String userId; - private String authCode; - private String convertType; - private String Filename; - private String taskId; - private String callBackUrl; - private String callBackMethod; - private String fileContent; - - public String getUserId() { - return userId; - } - - public void setUserId(String userId) { - this.userId = userId; - } - - public String getAuthCode() { - return authCode; - } - - public void setAuthCode(String authCode) { - this.authCode = authCode; - } - - public String getConvertType() { - return convertType; - } - - public void setConvertType(String convertType) { - this.convertType = convertType; - } - - public String getFilename() { - return Filename; - } - - public void setFilename(String filename) { - Filename = filename; - } - - public String getTaskId() { - return taskId; - } - - public void setTaskId(String taskId) { - this.taskId = taskId; - } - - public String getCallBackUrl() { - return callBackUrl; - } - - public void setCallBackUrl(String callBackUrl) { - this.callBackUrl = callBackUrl; - } - - public String getCallBackMethod() { - return callBackMethod; - } - - public void setCallBackMethod(String callBackMethod) { - this.callBackMethod = callBackMethod; - } - - public String getFileContent() { - return fileContent; - } - - public void setFileContent(String fileContent) { - this.fileContent = fileContent; - } -} diff --git a/laws-modules/src/main/java/com/jero/modules/ocr/entity/OcrResultEO.java b/laws-modules/src/main/java/com/jero/modules/ocr/entity/OcrResultEO.java deleted file mode 100644 index d602943e..00000000 --- a/laws-modules/src/main/java/com/jero/modules/ocr/entity/OcrResultEO.java +++ /dev/null @@ -1,30 +0,0 @@ -package com.jero.modules.ocr.entity; - -/** - * @program: OcrDemo - * @description: ocr返回结果 - * @author: duyunbao - * @create: 2019-03-13 15:35 - */ -public class OcrResultEO { - - private String resultCode; - - private String returnMessage; - - public String getResultCode() { - return resultCode; - } - - public void setResultCode(String resultCode) { - this.resultCode = resultCode; - } - - public String getReturnMessage() { - return returnMessage; - } - - public void setReturnMessage(String returnMessage) { - this.returnMessage = returnMessage; - } -} diff --git a/laws-modules/src/main/java/com/jero/modules/ocr/entity/User.java b/laws-modules/src/main/java/com/jero/modules/ocr/entity/User.java deleted file mode 100644 index bb1933fd..00000000 --- a/laws-modules/src/main/java/com/jero/modules/ocr/entity/User.java +++ /dev/null @@ -1,48 +0,0 @@ -/** - * - * (c) Copyright Ascensio System SIA 2021 - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -package com.jero.modules.ocr.entity; - -import java.util.List; - -public class User { - public String id; - public String name; - public String email; - public String group; - public List reviewGroups; - public CommentGroups commentGroups; - public Boolean favorite; - public List deniedPermissions; - public List descriptions; - public Boolean templates; - - public User(String id, String name, String email, String group, List reviewGroups, CommentGroups commentGroups, - Boolean favorite, List deniedPermissions, List descriptions, Boolean templates) { - this.id = id; - this.name = name; - this.email = email; - this.group = group; - this.reviewGroups = reviewGroups; - this.commentGroups = commentGroups; - this.favorite = favorite; - this.deniedPermissions = deniedPermissions; - this.descriptions = descriptions; - this.templates = templates; - } -} \ No newline at end of file diff --git a/laws-modules/src/main/java/com/jero/modules/ocr/enums/CheckFlagEnum.java b/laws-modules/src/main/java/com/jero/modules/ocr/enums/CheckFlagEnum.java deleted file mode 100644 index 7b1156a8..00000000 --- a/laws-modules/src/main/java/com/jero/modules/ocr/enums/CheckFlagEnum.java +++ /dev/null @@ -1,35 +0,0 @@ -package com.jero.modules.ocr.enums; - -/** - * @Author: liyawei - * @Description: - * @Date: Created in 11:20 2022/4/14 - */ -public enum CheckFlagEnum { - LOCK("锁定","1"), - UNLOCK("解锁","0"); - - String name; - String value; - - CheckFlagEnum(String name, String value) { - this.name = name; - this.value = value; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getValue() { - return value; - } - - public void setValue(String value) { - this.value = value; - } -} diff --git a/laws-modules/src/main/java/com/jero/modules/ocr/enums/FileSourceEnum.java b/laws-modules/src/main/java/com/jero/modules/ocr/enums/FileSourceEnum.java deleted file mode 100644 index 92e6f5b3..00000000 --- a/laws-modules/src/main/java/com/jero/modules/ocr/enums/FileSourceEnum.java +++ /dev/null @@ -1,36 +0,0 @@ -package com.jero.modules.ocr.enums; - -/** - * @Author: liyawei - * @Description: - * @Date: Created in 16:04 2022/3/8 - */ -public enum FileSourceEnum { - UPLOAD("上传","0"), - IMPORT("导入","1"); - - String name; - String value; - - FileSourceEnum(String name, String value) { - this.name = name; - this.value = value; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getValue() { - return value; - } - - public void setValue(String value) { - this.value = value; - } - -} diff --git a/laws-modules/src/main/java/com/jero/modules/ocr/enums/FileSyncStateEnum.java b/laws-modules/src/main/java/com/jero/modules/ocr/enums/FileSyncStateEnum.java deleted file mode 100644 index bb50eb54..00000000 --- a/laws-modules/src/main/java/com/jero/modules/ocr/enums/FileSyncStateEnum.java +++ /dev/null @@ -1,36 +0,0 @@ -package com.jero.modules.ocr.enums; - -/** - * @Author: liyawei - * @Description: - * @Date: Created in 14:49 2022/2/16 - */ -public enum FileSyncStateEnum { - SYNC_NO("未同步","未同步"), - SYNC_YES("已同步","已同步"); - - String name; - String value; - - private FileSyncStateEnum(String name, String value) { - this.name = name; - this.value = value; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getValue() { - return value; - } - - public void setValue(String value) { - this.value = value; - } - -} diff --git a/laws-modules/src/main/java/com/jero/modules/ocr/enums/FileTypeEnum.java b/laws-modules/src/main/java/com/jero/modules/ocr/enums/FileTypeEnum.java deleted file mode 100644 index 25868947..00000000 --- a/laws-modules/src/main/java/com/jero/modules/ocr/enums/FileTypeEnum.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.jero.modules.ocr.enums; - -/** - * @Author: liyawei - * @Description: - * @Date: Created in 14:49 2022/2/16 - */ -public enum FileTypeEnum { - RELEASE_DRAFT("发布稿","1"), - SUPPLEMENT("增补件","2"), - APPROVAL_DRAFT("报批稿","3"), - EXPOSURE_DRAFT("征求意见稿","4"); - - String name; - String value; - - private FileTypeEnum(String name, String value) { - this.name = name; - this.value = value; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getValue() { - return value; - } - - public void setValue(String value) { - this.value = value; - } -} diff --git a/laws-modules/src/main/java/com/jero/modules/ocr/enums/ResultContentEnum.java b/laws-modules/src/main/java/com/jero/modules/ocr/enums/ResultContentEnum.java deleted file mode 100644 index 8823c736..00000000 --- a/laws-modules/src/main/java/com/jero/modules/ocr/enums/ResultContentEnum.java +++ /dev/null @@ -1,36 +0,0 @@ -package com.jero.modules.ocr.enums; - -/** - * @Author: liyawei - * @Description: - * @Date: Created in 14:49 2022/2/16 - */ -public enum ResultContentEnum { - OCR_CONVERTING("转换中","转换中"), - OCR_CONVERT_SUCCESS("转换成功","转换成功"), - OCR_CONVERT_FAIL("转换失败","转换失败"); - - String name; - String value; - - private ResultContentEnum(String name, String value) { - this.name = name; - this.value = value; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getValue() { - return value; - } - - public void setValue(String value) { - this.value = value; - } -} diff --git a/laws-modules/src/main/java/com/jero/modules/ocr/helpers/ConfigManager.java b/laws-modules/src/main/java/com/jero/modules/ocr/helpers/ConfigManager.java deleted file mode 100644 index 8ad7fafe..00000000 --- a/laws-modules/src/main/java/com/jero/modules/ocr/helpers/ConfigManager.java +++ /dev/null @@ -1,61 +0,0 @@ -/** - * - * (c) Copyright Ascensio System SIA 2021 - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -package com.jero.modules.ocr.helpers; - -import java.io.InputStream; -import java.util.Properties; - -public class ConfigManager -{ - private static Properties properties; - - static - { - Init(); - } - - private static void Init() - { - try - { - // get from the settings.properties resource and load it - properties = new Properties(); - InputStream stream = Thread.currentThread().getContextClassLoader().getResourceAsStream("settings.properties"); - properties.load(stream); - } - catch (Exception ex) - { - properties = null; - } - } - - // get name from the settings.properties file - public static String GetProperty(String name) - { - if (properties == null) - { - return ""; - } - - // get property by its name - String property = properties.getProperty(name); - - return property == null ? "" : property; - } -} diff --git a/laws-modules/src/main/java/com/jero/modules/ocr/helpers/CookieManager.java b/laws-modules/src/main/java/com/jero/modules/ocr/helpers/CookieManager.java deleted file mode 100644 index 39cd2eeb..00000000 --- a/laws-modules/src/main/java/com/jero/modules/ocr/helpers/CookieManager.java +++ /dev/null @@ -1,45 +0,0 @@ -/** - * - * (c) Copyright Ascensio System SIA 2021 - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -package com.jero.modules.ocr.helpers; - -import javax.servlet.http.Cookie; -import javax.servlet.http.HttpServletRequest; -import java.io.UnsupportedEncodingException; -import java.net.URLDecoder; -import java.util.HashMap; - -public class CookieManager { - private HashMap cookiesMap; - - public CookieManager(HttpServletRequest request) throws UnsupportedEncodingException { - cookiesMap = new HashMap(); - - Cookie[] cookies = request.getCookies(); // get all the cookies from the request - if (cookies != null) { - for (Cookie cookie : cookies) { // run through all the cookies - cookiesMap.putIfAbsent(cookie.getName(), URLDecoder.decode(cookie.getValue(), "UTF-8")); // add cookie to the cookies map if its name isn't in the map yet - } - } - } - - // get cookie by its name - public String getCookie(String name) { - return cookiesMap.get(name); - } -} \ No newline at end of file diff --git a/laws-modules/src/main/java/com/jero/modules/ocr/helpers/DocumentManager.java b/laws-modules/src/main/java/com/jero/modules/ocr/helpers/DocumentManager.java deleted file mode 100644 index 31ac2868..00000000 --- a/laws-modules/src/main/java/com/jero/modules/ocr/helpers/DocumentManager.java +++ /dev/null @@ -1,531 +0,0 @@ -/** - * - * (c) Copyright Ascensio System SIA 2021 - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -package com.jero.modules.ocr.helpers; - -import com.jero.modules.ocr.entity.FileType; -import com.jero.modules.ocr.entity.User; -import org.json.simple.JSONObject; -import org.primeframework.jwt.Signer; -import org.primeframework.jwt.Verifier; -import org.primeframework.jwt.domain.JWT; -import org.primeframework.jwt.hmac.HMACSigner; -import org.primeframework.jwt.hmac.HMACVerifier; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import java.io.*; -import java.math.BigDecimal; -import java.math.RoundingMode; -import java.net.InetAddress; -import java.net.URLEncoder; -import java.nio.file.Files; -import java.nio.file.Path; -import java.nio.file.Paths; -import java.text.SimpleDateFormat; -import java.util.*; - -public class DocumentManager -{ - private static HttpServletRequest request; - - public static void Init(HttpServletRequest req, HttpServletResponse resp) - { - request = req; - } - - // get max file size - public static long GetMaxFileSize() - { - long size; - - try - { - size = Long.parseLong(ConfigManager.GetProperty("filesize-max")); - } - catch (Exception ex) - { - size = 0; - } - - return size > 0 ? size : 5 * 1024 * 1024; - } - - // get all the supported file extensions - public static List GetFileExts() - { - List res = new ArrayList<>(); - - res.addAll(GetViewedExts()); - res.addAll(GetEditedExts()); - res.addAll(GetConvertExts()); - res.addAll(GetFillExts()); - - return res; - } - - public static List GetFillExts() { - String exts = ConfigManager.GetProperty("files.docservice.fill-docs"); - return Arrays.asList(exts.split("\\|")); - } - - // get file extensions that can be viewed - public static List GetViewedExts() - { - String exts = ConfigManager.GetProperty("files.docservice.viewed-docs"); - return Arrays.asList(exts.split("\\|")); - } - - // get file extensions that can be edited - public static List GetEditedExts() - { - String exts = ConfigManager.GetProperty("files.docservice.edited-docs"); - return Arrays.asList(exts.split("\\|")); - } - - // get file extensions that can be converted - public static List GetConvertExts() - { - String exts = ConfigManager.GetProperty("files.docservice.convert-docs"); - return Arrays.asList(exts.split("\\|")); - } - - // get current user host address - public static String CurUserHostAddress(String userAddress) - { - if(userAddress == null) - { - try - { - // use InetAddress class to get the user address if it wasn't passed to the function - userAddress = InetAddress.getLocalHost().getHostAddress(); - } - catch (Exception ex) - { - userAddress = ""; - } - } - - return userAddress.replaceAll("[^0-9a-zA-Z.=]", "_"); - } - - // get the root directory of the user host - public static String FilesRootPath(String userAddress) - { - String hostAddress = CurUserHostAddress(userAddress); // get current user host address - String serverPath = request.getSession().getServletContext().getRealPath(""); // get the server url - String storagePath = ConfigManager.GetProperty("storage-folder"); // get the storage directory - String directory = serverPath + storagePath + File.separator + hostAddress + File.separator; - - File file = new File(directory); - - // if the root directory doesn't exist - if (!file.exists()) - { - // create it - file.mkdirs(); - } - - return directory; - } - - // get the storage path of the file - public static String StoragePath(String fileName, String userAddress) - { - String directory = FilesRootPath(userAddress); - return directory + FileUtility.GetFileName(fileName); - } - - // get the path to the forcesaved file version - public static String ForcesavePath(String fileName, String userAddress, Boolean create) - { - String hostAddress = CurUserHostAddress(userAddress); - String serverPath = request.getSession().getServletContext().getRealPath(""); - String storagePath = ConfigManager.GetProperty("storage-folder"); - - // create the directory to this file version - String directory = serverPath + storagePath + File.separator + hostAddress + File.separator; - - File file = new File(directory); - if (!file.exists()) { - return ""; - } - - // create the directory to the history of this file version - directory = directory + fileName + "-hist" + File.separator; - file = new File(directory); - if (!create && !file.exists()) { - return ""; - } - - file.mkdirs(); - - directory = directory + fileName; - file = new File(directory); - if (!create && !file.exists()) { - return ""; - } - - return directory; - } - - // get the history directory - public static String HistoryDir(String storagePath) - { - return storagePath += "-hist"; - } - - // get the path to the file version by the history path and file version - public static String VersionDir(String histPath, Integer version) - { - return histPath + File.separator + Integer.toString(version); - } - - // get the path to the file version by the file name, user address and file version - public static String VersionDir(String fileName, String userAddress, Integer version) - { - return VersionDir(HistoryDir(StoragePath(fileName, userAddress)), version); - } - - // get the file version by the history path - public static Integer GetFileVersion(String historyPath) - { - File dir = new File(historyPath); - - if (!dir.exists()) { - return 1; // if the history path doesn't exist, then the file version is 1 - } - - File[] dirs = dir.listFiles(new FileFilter() { // take only directories from the history folder - @Override - public boolean accept(File pathname) { - return pathname.isDirectory(); - } - }); - - return dirs.length + 1; // count the directories - } - - // get the file version by the file name and user address - public static int GetFileVersion(String fileName, String userAddress) - { - return GetFileVersion(HistoryDir(StoragePath(fileName, userAddress))); - } - - // get a file name with an index if the file with such a name already exists - public static String GetCorrectName(String fileName, String userAddress) - { - String baseName = FileUtility.GetFileNameWithoutExtension(fileName); - String ext = FileUtility.GetFileExtension(fileName); - String name = baseName + ext; - - File file = new File(StoragePath(name, userAddress)); - - for (int i = 1; file.exists(); i++) // run through all the files with such a name in the storage directory - { - name = baseName + " (" + i + ")" + ext; // and add an index to the base name - file = new File(StoragePath(name, userAddress)); - } - - return name; - } - - // create meta information - public static void CreateMeta(String fileName, String uid, String uname, String userAddress) throws Exception - { - String histDir = HistoryDir(StoragePath(fileName, userAddress)); - - File dir = new File(histDir); // create history directory - dir.mkdir(); - - // create json object and put there file information (creation time, user id and name) - JSONObject json = new JSONObject(); - json.put("created", new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date())); - json.put("id", uid); - json.put("name", uname); - - // create createdInfo.json file with meta information in the history directory - File meta = new File(histDir + File.separator + "createdInfo.json"); - try (FileWriter writer = new FileWriter(meta)) { - json.writeJSONString(writer); // write information from the json object into this file - } - } - - // get all the stored files from the user host address - public static File[] GetStoredFiles(String userAddress) - { - String directory = FilesRootPath(userAddress); - - File file = new File(directory); - return file.listFiles(new FileFilter() { // take only files from the root directory - @Override - public boolean accept(File pathname) { - return pathname.isFile(); - } - }); - } - - // create demo document - public static String CreateDemo(String fileExt, Boolean sample, User user) throws Exception - { - String demoName = (sample ? "sample." : "new.") + fileExt; // create sample or new template file with the necessary extension - String demoPath = "assets" + File.separator + (sample ? "sample" : "new") + File.separator; // get the path to the sample document - String fileName = GetCorrectName(demoName, null); // get a file name with an index if the file with such a name already exists - - InputStream stream = Thread.currentThread().getContextClassLoader().getResourceAsStream(demoPath + demoName); // get the input file stream - - CreateFile(Paths.get(StoragePath(fileName, null)), stream); - - // create meta information of the demo file - CreateMeta(fileName, user.id, user.name, null); - - return fileName; - } - - public static boolean CreateFile(Path path, InputStream stream) { - if (Files.exists(path)){ - return true; - } - try { - File file = Files.createFile(path).toFile(); - try (FileOutputStream out = new FileOutputStream(file)) - { - int read; - final byte[] bytes = new byte[1024]; - while ((read = stream.read(bytes)) != -1) - { - out.write(bytes, 0, read); - } - out.flush(); - } - } catch (IOException e) { - e.printStackTrace(); - } - return false; - } - - // get file url - public static String GetFileUri(String fileName, Boolean forDocumentServer) - { - try - { - String serverPath = GetServerUrl(forDocumentServer); - String storagePath = ConfigManager.GetProperty("storage-folder"); - String hostAddress = CurUserHostAddress(null); - - String filePath = serverPath + "/" + storagePath + "/" + hostAddress + "/" + URLEncoder.encode(fileName, java.nio.charset.StandardCharsets.UTF_8.toString()).replace("+", "%20"); -// String filePath = serverPath + "?fileName=" + URLEncoder.encode(fileName, java.nio.charset.StandardCharsets.UTF_8.toString()).replace("+", "%20") + "&useraddress=" + hostAddress; - - return filePath; - } - catch (UnsupportedEncodingException e) - { - return ""; - } - } - - // get file information - public static ArrayList> GetFilesInfo(){ - ArrayList> files = new ArrayList<>(); - - // run through all the stored files - for(File file : GetStoredFiles(null)){ - Map map = new LinkedHashMap<>(); // write all the parameters to the map - map.put("version", GetFileVersion(file.getName(), null)); - map.put("id", ServiceConverter.GenerateRevisionId(CurUserHostAddress(null) + "/" + file.getName() + "/" + Long.toString(new File(StoragePath(file.getName(), null)).lastModified()))); - map.put("contentLength", new BigDecimal(String.valueOf((file.length()/1024.0))).setScale(2, RoundingMode.HALF_UP) + " KB"); - map.put("pureContentLength", file.length()); - map.put("title", file.getName()); - map.put("updated", String.valueOf(new Date(file.lastModified()))); - files.add(map); - } - - return files; - } - - // get file information by its id - public static ArrayList> GetFilesInfo(String fileId){ - ArrayList> file = new ArrayList<>(); - - for (Map map : GetFilesInfo()){ - if (map.get("id").equals(fileId)){ - file.add(map); - break; - } - } - - return file; - } - - // get the path url - public static String GetPathUri(String path) - { - String serverPath = GetServerUrl(true); - String storagePath = ConfigManager.GetProperty("storage-folder"); - String hostAddress = CurUserHostAddress(null); - - String filePath = serverPath + "/" + storagePath + "/" + hostAddress + "/" + path.replace(File.separator, "/").substring(FilesRootPath(null).length()).replace(" ", "%20"); - - return filePath; - } - - - // get the server url - public static String GetServerUrl(Boolean forDocumentServer) { - if (forDocumentServer && !ConfigManager.GetProperty("files.docservice.url.example").equals("")) { - return ConfigManager.GetProperty("files.docservice.url.example"); - } else { - return request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + request.getContextPath(); - } - } - - // get the callback url - public static String GetCallback(String fileName) - { - String serverPath = GetServerUrl(true); - String hostAddress = CurUserHostAddress(null); - try - { - String query = "?type=track&fileName=" + URLEncoder.encode(fileName, java.nio.charset.StandardCharsets.UTF_8.toString()) + "&userAddress=" + URLEncoder.encode(hostAddress, java.nio.charset.StandardCharsets.UTF_8.toString()); - - return serverPath + "/IndexServlet" + query; - } - catch (UnsupportedEncodingException e) - { - return ""; - } - } - - // get url to the created file - public static String GetCreateUrl (FileType fileType) { - String serverPath = GetServerUrl(false); - String fileExt = GetInternalExtension(fileType).replace(".", ""); - String query = "?fileExt=" + fileExt; - - return serverPath + "/EditorServlet" + query; - } - - // get url to download a file - public static String GetDownloadUrl(String fileName) { - String serverPath = GetServerUrl(true); - String hostAddress = CurUserHostAddress(null); - try - { - String query = "?type=download&fileName=" + URLEncoder.encode(fileName, java.nio.charset.StandardCharsets.UTF_8.toString()) + "&userAddress=" + URLEncoder.encode(hostAddress, java.nio.charset.StandardCharsets.UTF_8.toString()); - - return serverPath + "/IndexServlet" + query; - } - catch (UnsupportedEncodingException e) - { - return ""; - } - } - - // get an editor internal extension - public static String GetInternalExtension(FileType fileType) - { - // .docx for word file type - if (fileType.equals(FileType.Word)) { - return ".docx"; - } - - // .xlsx for cell file type - if (fileType.equals(FileType.Cell)) { - return ".xlsx"; - } - - // .pptx for slide file type - if (fileType.equals(FileType.Slide)) { - return ".pptx"; - } - - // the default file type is .docx - return ".docx"; - } - - // get image url for templates - public static String GetTemplateImageUrl(FileType fileType) - { - String path = GetServerUrl(true) + "/css/img/"; - // for word file type - if (fileType.equals(FileType.Word)) { - return path + "file_docx.svg"; - } - - // .xlsx for cell file type - if (fileType.equals(FileType.Cell)) { - return path + "file_xlsx.svg"; - } - - // .pptx for slide file type - if (fileType.equals(FileType.Slide)) { - return path + "file_pptx.svg"; - } - - // the default file type - return path + "file_docx.svg"; - } - - // create document token - public static String CreateToken(Map payloadClaims) - { - try - { - // build a HMAC signer using a SHA-256 hash - Signer signer = HMACSigner.newSHA256Signer(GetTokenSecret()); - JWT jwt = new JWT(); - for (String key : payloadClaims.keySet()) // run through all the keys from the payload - { - jwt.addClaim(key, payloadClaims.get(key)); // and write each claim to the jwt - } - return JWT.getEncoder().encode(jwt, signer); // sign and encode the JWT to a JSON string representation - } - catch (Exception e) - { - return ""; - } - } - - // read document token - public static JWT ReadToken(String token) - { - try - { - // build a HMAC verifier using the token secret - Verifier verifier = HMACVerifier.newVerifier(GetTokenSecret()); - return JWT.getDecoder().decode(token, verifier); // verify and decode the encoded string JWT to a rich object - } - catch (Exception exception) - { - return null; - } - } - - // check if the token is enabled - public static Boolean TokenEnabled() - { - String secret = GetTokenSecret(); - return secret != null && !secret.isEmpty(); - } - - // get token secret from the config parameters - public static String GetTokenSecret() - { - return ConfigManager.GetProperty("files.docservice.secret"); - } -} \ No newline at end of file diff --git a/laws-modules/src/main/java/com/jero/modules/ocr/helpers/FileUtility.java b/laws-modules/src/main/java/com/jero/modules/ocr/helpers/FileUtility.java deleted file mode 100644 index 46f1dd6b..00000000 --- a/laws-modules/src/main/java/com/jero/modules/ocr/helpers/FileUtility.java +++ /dev/null @@ -1,132 +0,0 @@ -/** - * - * (c) Copyright Ascensio System SIA 2021 - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -package com.jero.modules.ocr.helpers; - -import com.jero.modules.ocr.entity.FileType; - -import java.net.URL; -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -public class FileUtility -{ - static {} - - // get file type - public static FileType GetFileType(String fileName) - { - String ext = GetFileExtension(fileName).toLowerCase(); - - // word type for document extensions - if (ExtsDocument.contains(ext)) - return FileType.Word; - - // cell type for spreadsheet extensions - if (ExtsSpreadsheet.contains(ext)) - return FileType.Cell; - - // slide type for presentation extensions - if (ExtsPresentation.contains(ext)) - return FileType.Slide; - - // default file type is word - return FileType.Word; - } - - // document extensions - public static List ExtsDocument = Arrays.asList - ( - ".doc", ".docx", ".docm", - ".dot", ".dotx", ".dotm", - ".odt", ".fodt", ".ott", ".rtf", ".txt", - ".html", ".htm", ".mht", ".xml", - ".pdf", ".djvu", ".fb2", ".epub", ".xps", ".oxps", ".oform" - ); - - // spreadsheet extensions - public static List ExtsSpreadsheet = Arrays.asList - ( - ".xls", ".xlsx", ".xlsm", - ".xlt", ".xltx", ".xltm", - ".ods", ".fods", ".ots", ".csv" - ); - - // presentation extensions - public static List ExtsPresentation = Arrays.asList - ( - ".pps", ".ppsx", ".ppsm", - ".ppt", ".pptx", ".pptm", - ".pot", ".potx", ".potm", - ".odp", ".fodp", ".otp" - ); - - - // get file name from the url - public static String GetFileName(String url) - { - if (url == null) return ""; - - // get file name from the last part of url - String fileName = url.substring(url.lastIndexOf('/') + 1, url.length()); - fileName = fileName.split("\\?")[0]; - return fileName; - } - - // get file name without extension - public static String GetFileNameWithoutExtension(String url) - { - String fileName = GetFileName(url); - if (fileName == null) return null; - String fileNameWithoutExt = fileName.substring(0, fileName.lastIndexOf('.')); - return fileNameWithoutExt; - } - - // get file extension from url - public static String GetFileExtension(String url) - { - String fileName = GetFileName(url); - if (fileName == null) return null; - String fileExt = fileName.substring(fileName.lastIndexOf(".")); - return fileExt.toLowerCase(); - } - - // get url parameters - public static Map GetUrlParams(String url) - { - try - { - String query = new URL(url).getQuery(); // take all the parameters which are placed after ? sign in the file url - String[] params = query.split("&"); // parameters are separated by & sign - Map map = new HashMap<>(); - for (String param : params) // write parameters and their values to the map dictionary - { - String name = param.split("=")[0]; - String value = param.split("=")[1]; - map.put(name, value); - } - return map; - } - catch (Exception ex) - { - return null; - } - } -} diff --git a/laws-modules/src/main/java/com/jero/modules/ocr/helpers/ServiceConverter.java b/laws-modules/src/main/java/com/jero/modules/ocr/helpers/ServiceConverter.java deleted file mode 100644 index 352270fd..00000000 --- a/laws-modules/src/main/java/com/jero/modules/ocr/helpers/ServiceConverter.java +++ /dev/null @@ -1,269 +0,0 @@ -/** - * - * (c) Copyright Ascensio System SIA 2021 - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -package com.jero.modules.ocr.helpers; - -import com.google.gson.Gson; -import com.jero.modules.ocr.util.UUIDUtils; -import org.json.simple.JSONObject; -import org.json.simple.parser.JSONParser; -import org.json.simple.parser.ParseException; - -import java.io.*; -import java.net.URL; -import java.nio.charset.StandardCharsets; -import java.util.HashMap; -import java.util.Map; -import java.util.UUID; - - -public class ServiceConverter -{ - private static int ConvertTimeout = 120000; - private static final String DocumentConverterUrl = ConfigManager.GetProperty("files.docservice.url.site") + ConfigManager.GetProperty("files.docservice.url.converter"); - private static final String DocumentJwtHeader = ConfigManager.GetProperty("files.docservice.header"); - - public static class ConvertBody - { - public String region; - public String url; - public String outputtype; - public String filetype; - public String title; - public String key; - public Boolean async; - public String token; - public String password; - } - - static - { - try - { - // get timeout value from the settings.properties - int timeout = Integer.parseInt(ConfigManager.GetProperty("files.docservice.timeout")); - if (timeout > 0) // if it's greater than 0 - { - ConvertTimeout = timeout; // assign this value to a convert timeout - } - } - catch (Exception ex) - { - } - } - - // get the url of the converted file - public static String GetConvertedUri(String documentUri, String fromExtension, String toExtension, String documentRevisionId, String filePass, Boolean isAsync, String lang) throws Exception - { - // check if the fromExtension parameter is defined; if not, get it from the document url - fromExtension = fromExtension == null || fromExtension.isEmpty() ? FileUtility.GetFileExtension(documentUri) : fromExtension; - - // check if the file name parameter is defined; if not, get random uuid for this file - String title = FileUtility.GetFileName(documentUri); - title = title == null || title.isEmpty() ? UUID.randomUUID().toString() : title; - - documentRevisionId = documentRevisionId == null || documentRevisionId.isEmpty() ? documentUri : documentRevisionId; - - documentRevisionId = GenerateRevisionId(documentRevisionId); // create document token - - // write all the necessary parameters to the body object - ConvertBody body = new ConvertBody(); - body.region = lang; - body.url = documentUri; - body.outputtype = toExtension.replace(".", ""); - body.filetype = fromExtension.replace(".", ""); - body.title = title; - body.key = documentRevisionId; - body.password = filePass; - if (isAsync) - body.async = true; - - String headerToken = ""; - if (DocumentManager.TokenEnabled()) - { - HashMap map = new HashMap(); - map.put("region", lang); - map.put("url", body.url); - map.put("outputtype", body.outputtype); - map.put("filetype", body.filetype); - map.put("title", body.title); - map.put("key", body.key); - map.put("password", body.password); - if (isAsync) - map.put("async", body.async); - - // add token to the body if it is enabled - String token = DocumentManager.CreateToken(map); - body.token = token; - - Map payloadMap = new HashMap(); - payloadMap.put("payload", map); // create payload object - headerToken = DocumentManager.CreateToken(payloadMap); // create header token - } - - Gson gson = new Gson(); - String bodyString = gson.toJson(body); - - byte[] bodyByte = bodyString.getBytes(StandardCharsets.UTF_8); - - // specify request parameters - URL url = new URL(DocumentConverterUrl); - java.net.HttpURLConnection connection = (java.net.HttpURLConnection) url.openConnection(); - connection.setRequestMethod("POST"); - connection.setDoOutput(true); - connection.setRequestProperty("Content-Type", "application/json; charset=UTF-8"); - connection.setFixedLengthStreamingMode(bodyByte.length); - connection.setRequestProperty("Accept", "application/json"); - connection.setConnectTimeout(ConvertTimeout); - - // write header token to the request - if (DocumentManager.TokenEnabled()) - { - connection.setRequestProperty(DocumentJwtHeader.equals("") ? "Authorization" : DocumentJwtHeader, "Bearer " + headerToken); - } - - connection.connect(); - try (OutputStream os = connection.getOutputStream()) { - os.write(bodyByte); - } - - InputStream stream = connection.getInputStream(); - - if (stream == null) - throw new Exception("Could not get an answer"); - - // convert string to json - String jsonString = ConvertStreamToString(stream); - - connection.disconnect(); - - return GetResponseUri(jsonString); - } - - // generate document key - public static String GenerateRevisionId(String expectedKey) - { - if (expectedKey.length() > 20) // if the expected key length is greater than 20 - expectedKey = Integer.toString(expectedKey.hashCode()); // the expected key is hashed and a fixed length value is stored in the string format - - String key = UUIDUtils.randomUUID(2) + expectedKey.replace("[^0-9-.a-zA-Z_=]", "_"); - - return key.substring(0, Math.min(key.length(), 20)); // the resulting key length is 20 or less - } - - // create an error message for an error code - private static void ProcessConvertServiceResponceError(int errorCode) throws Exception - { - String errorMessage = ""; - String errorMessageTemplate = "Error occurred in the ConvertService: "; - - // add the error message to the error message template depending on the error code - switch (errorCode) - { - case -8: - errorMessage = errorMessageTemplate + "Error document VKey"; - break; - case -7: - errorMessage = errorMessageTemplate + "Error document request"; - break; - case -6: - errorMessage = errorMessageTemplate + "Error database"; - break; - case -5: - errorMessage = errorMessageTemplate + "Incorrect password"; - break; - case -4: - errorMessage = errorMessageTemplate + "Error download error"; - break; - case -3: - errorMessage = errorMessageTemplate + "Error convertation error"; - break; - case -2: - errorMessage = errorMessageTemplate + "Error convertation timeout"; - break; - case -1: - errorMessage = errorMessageTemplate + "Error convertation unknown"; - break; - case 0: // if the error code is equal to 0, the error message is empty - break; - default: - errorMessage = "ErrorCode = " + errorCode; // default value for the error message - break; - } - - throw new Exception(errorMessage); - } - - // get the response url - private static String GetResponseUri(String jsonString) throws Exception - { - JSONObject jsonObj = ConvertStringToJSON(jsonString); - - Object error = jsonObj.get("error"); - if (error != null) // if an error occurs - ProcessConvertServiceResponceError(Math.toIntExact((long)error)); // then get an error message - - // check if the conversion is completed and save the result to a variable - Boolean isEndConvert = (Boolean) jsonObj.get("endConvert"); - - Long resultPercent = 0l; - String responseUri = null; - - if (isEndConvert) // if the conversion is completed - { - resultPercent = 100l; - responseUri = (String) jsonObj.get("fileUrl"); // get the file url - } - else // if the conversion isn't completed - { - resultPercent = (Long) jsonObj.get("percent"); - resultPercent = resultPercent >= 100l ? 99l : resultPercent; // get the percentage value - } - - return resultPercent >= 100l ? responseUri : ""; - } - - // convert stream to string - public static String ConvertStreamToString(InputStream stream) throws IOException - { - InputStreamReader inputStreamReader = new InputStreamReader(stream); // create an object to get incoming stream - StringBuilder stringBuilder = new StringBuilder(); // create a string builder object - BufferedReader bufferedReader = new BufferedReader(inputStreamReader); // create an object to read incoming streams - String line = bufferedReader.readLine(); // get incoming streams by lines - - while (line != null) - { - stringBuilder.append(line); // concatenate strings using the string builder - line = bufferedReader.readLine(); - } - - String result = stringBuilder.toString(); - - return result; - } - - // convert string to json - public static JSONObject ConvertStringToJSON(String jsonString) throws ParseException - { - JSONParser parser = new JSONParser(); - Object obj = parser.parse(jsonString); // parse json string - JSONObject jsonObj = (JSONObject) obj; // and turn it into a json object - - return jsonObj; - } -} \ No newline at end of file diff --git a/laws-modules/src/main/java/com/jero/modules/ocr/helpers/TrackManager.java b/laws-modules/src/main/java/com/jero/modules/ocr/helpers/TrackManager.java deleted file mode 100644 index 30f70155..00000000 --- a/laws-modules/src/main/java/com/jero/modules/ocr/helpers/TrackManager.java +++ /dev/null @@ -1,323 +0,0 @@ -/** - * - * (c) Copyright Ascensio System SIA 2021 - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -package com.jero.modules.ocr.helpers; - -import com.google.gson.Gson; -import org.json.simple.JSONArray; -import org.json.simple.JSONObject; -import org.json.simple.parser.JSONParser; -import org.primeframework.jwt.domain.JWT; - -import javax.servlet.http.HttpServletRequest; -import java.io.*; -import java.net.URL; -import java.nio.charset.StandardCharsets; -import java.util.HashMap; -import java.util.LinkedHashMap; -import java.util.Map; -import java.util.Scanner; - -public class TrackManager { - private static final String DocumentJwtHeader = ConfigManager.GetProperty("files.docservice.header"); - - // read request body - public static JSONObject readBody(HttpServletRequest request, PrintWriter writer) throws Exception { - String bodyString = ""; - - try { - // read request body by streams - Scanner scanner = new Scanner(request.getInputStream()); - scanner.useDelimiter("\\A"); - bodyString = scanner.hasNext() ? scanner.next() : ""; - scanner.close(); - } - catch (Exception ex) { - writer.write("get request.getInputStream error:" + ex.getMessage()); - throw ex; - } - - // error when the bodyString object is empty - if (bodyString.isEmpty()) { - writer.write("empty request.getInputStream"); - throw new Exception("empty request.getInputStream"); - } - - JSONParser parser = new JSONParser(); - JSONObject body; - - try { - Object obj = parser.parse(bodyString); // parse bodyString object - body = (JSONObject) obj; - } catch (Exception ex) { - writer.write("JSONParser.parse error:" + ex.getMessage()); - throw ex; - } - - // if the secret key to generate token exists - if (DocumentManager.TokenEnabled()) { - String token = (String) body.get("token"); // get the document token - - if (token == null) { // if JSON web token is not received - String header = (String) request.getHeader(DocumentJwtHeader == null || DocumentJwtHeader.isEmpty() ? "Authorization" : DocumentJwtHeader); // get it from the Authorization header - if (header != null && !header.isEmpty()) { - token = header.startsWith("Bearer ") ? header.substring(7) : header; // and save it without Authorization prefix - } - } - - if (token == null || token.isEmpty()) { // if the token is not received - writer.write("{\"error\":1,\"message\":\"JWT expected\"}"); // an error occurs - throw new Exception("{\"error\":1,\"message\":\"JWT expected\"}"); - } - - JWT jwt = DocumentManager.ReadToken(token); // read token - if (jwt == null) { - writer.write("{\"error\":1,\"message\":\"JWT validation failed\"}"); // an error occurs - throw new Exception("{\"error\":1,\"message\":\"JWT validation failed\"}"); - } - - if (jwt.getObject("payload") != null) { // get the payload object from the request body - try { - @SuppressWarnings("unchecked") LinkedHashMap payload = - (LinkedHashMap)jwt.getObject("payload"); - - jwt.claims = payload; - } catch (Exception ex) { - writer.write("{\"error\":1,\"message\":\"Wrong payload\"}"); - throw ex; - } - } - - try { - Gson gson = new Gson(); - Object obj = parser.parse(gson.toJson(jwt.claims)); - body = (JSONObject) obj; - } catch (Exception ex) { - writer.write("JSONParser.parse error:" + ex.getMessage()); - throw ex; - } - } - - return body; - } - - // file saving process - public static void processSave(JSONObject body, String fileName, String userAddress) throws Exception { - if (body.get("url") == null) { - throw new Exception("DownloadUrl is null"); - } - String downloadUri = (String) body.get("url"); - String changesUri = (String) body.get("changesurl"); - String key = (String) body.get("key"); - String newFileName = fileName; - - String curExt = FileUtility.GetFileExtension(fileName); // get current file extension - String downloadExt = FileUtility.GetFileExtension(downloadUri); // get the extension of the downloaded file - - // convert downloaded file to the file with the current extension if these extensions aren't equal - if (!curExt.equals(downloadExt)) { - try { - String newFileUri = ServiceConverter.GetConvertedUri(downloadUri, downloadExt, curExt, ServiceConverter.GenerateRevisionId(downloadUri), null, false, null); // convert file and get url to a new file - if (newFileUri.isEmpty()) { - newFileName = DocumentManager.GetCorrectName(FileUtility.GetFileNameWithoutExtension(fileName) + downloadExt, userAddress); // get the correct file name if it already exists - } else { - downloadUri = newFileUri; - } - } catch (Exception e){ - newFileName = DocumentManager.GetCorrectName(FileUtility.GetFileNameWithoutExtension(fileName) + downloadExt, userAddress); - } - } - - String storagePath = DocumentManager.StoragePath(newFileName, userAddress); // get the file path - File histDir = new File(DocumentManager.HistoryDir(storagePath)); // get the path to the history direction - if (!histDir.exists()) histDir.mkdirs(); // if the path doesn't exist, create it - - String versionDir = DocumentManager.VersionDir(histDir.getAbsolutePath(), DocumentManager.GetFileVersion(histDir.getAbsolutePath())); // get the path to the file version - File ver = new File(versionDir); - File lastVersion = new File(DocumentManager.StoragePath(fileName, userAddress)); - File toSave = new File(storagePath); - - if (!ver.exists()) ver.mkdirs(); - - lastVersion.renameTo(new File(versionDir + File.separator + "prev" + curExt)); // get the path to the previous file version and rename the last file version with it - - downloadToFile(downloadUri, toSave); // save file to the storage path - downloadToFile(changesUri, new File(versionDir + File.separator + "diff.zip")); // save file changes to the diff.zip archive - - String history = (String) body.get("changeshistory"); - if (history == null && body.containsKey("history")) { - history = ((JSONObject) body.get("history")).toJSONString(); - } - if (history != null && !history.isEmpty()) { - FileWriter fw = new FileWriter(new File(versionDir + File.separator + "changes.json")); // write the history changes to the changes.json file - fw.write(history); - fw.close(); - } - - FileWriter fw = new FileWriter(new File(versionDir + File.separator + "key.txt")); // write the key value to the key.txt file - fw.write(key); - fw.close(); - - String forcesavePath = DocumentManager.ForcesavePath(newFileName, userAddress, false); // get the path to the forcesaved file version - if (!forcesavePath.equals("")) { // if the forcesaved file version exists - File forceSaveFile = new File(forcesavePath); - forceSaveFile.delete(); // remove it - } - } - - // file force saving process - public static void processForceSave(JSONObject body, String fileName, String userAddress) throws Exception { - if (body.get("url") == null) { - throw new Exception("DownloadUrl is null"); - } - String downloadUri = (String) body.get("url"); - - String curExt = FileUtility.GetFileExtension(fileName); // get current file extension - String downloadExt = FileUtility.GetFileExtension(downloadUri); // get the extension of the downloaded file - Boolean newFileName = false; - - // convert downloaded file to the file with the current extension if these extensions aren't equal - if (!curExt.equals(downloadExt)) { - try { - String newFileUri = ServiceConverter.GetConvertedUri(downloadUri, downloadExt, curExt, ServiceConverter.GenerateRevisionId(downloadUri), null, false, null); // convert file and get url to a new file - if (newFileUri.isEmpty()) { - newFileName = true; - } else { - downloadUri = newFileUri; - } - } catch (Exception e){ - newFileName = true; - } - } - - String forcesavePath = ""; - boolean isSubmitForm = body.get("forcesavetype").toString().equals("3"); // SubmitForm - - if (isSubmitForm) { // if the form is submitted - // new file - if (newFileName){ - fileName = DocumentManager.GetCorrectName(FileUtility.GetFileNameWithoutExtension(fileName) + "-form" + downloadExt, userAddress); // get the correct file name if it already exists - } else { - fileName = DocumentManager.GetCorrectName(FileUtility.GetFileNameWithoutExtension(fileName) + "-form" + curExt, userAddress); - } - forcesavePath = DocumentManager.StoragePath(fileName, userAddress); - } else { - if (newFileName){ - fileName = DocumentManager.GetCorrectName(FileUtility.GetFileNameWithoutExtension(fileName) + downloadExt, userAddress); - } - - // create forcesave path if it doesn't exist - forcesavePath = DocumentManager.ForcesavePath(fileName, userAddress, false); - if (forcesavePath == "") { - forcesavePath = DocumentManager.ForcesavePath(fileName, userAddress, true); - } - } - - File toSave = new File(forcesavePath); - downloadToFile(downloadUri, toSave); - - if (isSubmitForm) { - JSONArray actions = (JSONArray) body.get("actions"); - JSONObject action = (JSONObject) actions.get(0); - String user = (String) action.get("userid"); // get the user id - DocumentManager.CreateMeta(fileName, user, "Filling Form", userAddress); // create meta data for forcesaved file - } - } - - // save file information from the url to the file specified - private static void downloadToFile(String url, File file) throws Exception { - if (url == null || url.isEmpty()) throw new Exception("argument url"); // url isn't specified - if (file == null) throw new Exception("argument path"); // file isn't specified - - URL uri = new URL(url); - java.net.HttpURLConnection connection = (java.net.HttpURLConnection) uri.openConnection(); - InputStream stream = connection.getInputStream(); // get input stream of the file information from the url - - if (stream == null) - { - throw new Exception("Stream is null"); - } - - try (FileOutputStream out = new FileOutputStream(file)) - { - int read; - final byte[] bytes = new byte[1024]; - while ((read = stream.read(bytes)) != -1) - { - out.write(bytes, 0, read); // write bytes to the output stream - } - - // force write data to the output stream that can be cached in the current thread - out.flush(); - } - - connection.disconnect(); - } - - // create a command request - public static void commandRequest(String method, String key) throws Exception { - String DocumentCommandUrl = ConfigManager.GetProperty("files.docservice.url.site") + ConfigManager.GetProperty("files.docservice.url.command"); - - URL url = new URL(DocumentCommandUrl); - java.net.HttpURLConnection connection = (java.net.HttpURLConnection) url.openConnection(); - - HashMap params = new HashMap(); - params.put("c", method); - params.put("key", key); - - String headerToken = ""; - if (DocumentManager.TokenEnabled()) // check if a secret key to generate token exists or not - { - Map payloadMap = new HashMap(); - payloadMap.put("payload", params); - headerToken = DocumentManager.CreateToken(payloadMap); // encode a payload object into a header token - - // add a header Authorization with a header token and Authorization prefix in it - connection.setRequestProperty(DocumentJwtHeader.equals("") ? "Authorization" : DocumentJwtHeader, "Bearer " + headerToken); - - String token = DocumentManager.CreateToken(params); // encode a payload object into a body token - params.put("token", token); - } - - Gson gson = new Gson(); - String bodyString = gson.toJson(params); - - byte[] bodyByte = bodyString.getBytes(StandardCharsets.UTF_8); - - connection.setRequestMethod("POST"); // set the request method - connection.setRequestProperty("Content-Type", "application/json; charset=UTF-8"); // set the Content-Type header - connection.setDoOutput(true); // set the doOutput field to true - - connection.connect(); - try (OutputStream os = connection.getOutputStream()) { - os.write(bodyByte); // write bytes to the output stream - } - InputStream stream = connection.getInputStream();; // get input stream - - if (stream == null) - throw new Exception("Could not get an answer"); - - String jsonString = ServiceConverter.ConvertStreamToString(stream); // convert stream to json string - connection.disconnect(); - - JSONObject response = ServiceConverter.ConvertStringToJSON(jsonString); // convert json string to json object - if (!response.get("error").toString().equals("0")){ - throw new Exception(response.toJSONString()); - } - } -} diff --git a/laws-modules/src/main/java/com/jero/modules/ocr/helpers/Users.java b/laws-modules/src/main/java/com/jero/modules/ocr/helpers/Users.java deleted file mode 100644 index 2c74f007..00000000 --- a/laws-modules/src/main/java/com/jero/modules/ocr/helpers/Users.java +++ /dev/null @@ -1,110 +0,0 @@ -/** - * - * (c) Copyright Ascensio System SIA 2021 - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -package com.jero.modules.ocr.helpers; - -import com.jero.modules.ocr.entity.CommentGroups; -import com.jero.modules.ocr.entity.User; - -import java.util.*; - -public class Users { - - static List descr_user_1 = new ArrayList() {{ - add("File author by default"); - add("Doesn’t belong to any group"); - add("Can review all the changes"); - add("Can perform all actions with comments"); - add("The file favorite state is undefined"); - add("Can create files from templates using data from the editor"); - }}; - - static List descr_user_2 = new ArrayList() {{ - add("Belongs to Group2"); - add("Can review only his own changes or changes made by users with no group"); - add("Can view comments, edit his own comments and comments left by users with no group. Can remove his own comments only"); - add("This file is marked as favorite"); - add("Can create new files from the editor"); - }}; - - static List descr_user_3 = new ArrayList() {{ - add("Belongs to Group3"); - add("Can review changes made by Group2 users"); - add("Can view comments left by Group2 and Group3 users. Can edit comments left by Group2 users"); - add("This file isn’t marked as favorite"); - add("Can’t copy data from the file to clipboard"); - add("Can’t download the file"); - add("Can’t print the file"); - add("Can create new files from the editor"); - }}; - - static List descr_user_0 = new ArrayList() {{ - add("The name is requested when the editor is opened"); - add("Doesn’t belong to any group"); - add("Can review all the changes"); - add("Can perform all actions with comments"); - add("The file favorite state is undefined"); - add("Can't mention others in comments"); - add("Can't create new files from the editor"); - }}; - - private static List users = new ArrayList() {{ - add(new User("uid-1", "John Smith", "smith@example.com", - null, null, new CommentGroups(), - null, new ArrayList(), descr_user_1, true)); - add(new User("uid-2", "Mark Pottato", "pottato@example.com", - "group-2", Arrays.asList("group-2", ""), new CommentGroups(null, Arrays.asList("group-2", ""), Arrays.asList("group-2")), - true, new ArrayList(), descr_user_2, false)); - add(new User("uid-3", "Hamish Mitchell", "mitchell@example.com", - "group-3", Arrays.asList("group-2"), new CommentGroups(Arrays.asList("group-3", "group-2"), Arrays.asList("group-2"), new ArrayList()), - false, Arrays.asList("copy", "download", "print"), descr_user_3, false)); - add(new User("uid-0", null, null, - null, null, new CommentGroups(), - null, new ArrayList(), descr_user_0, false)); - }}; - - // get a user by id specified - public static User getUser (String id) { - for (User user : users) { - if (user.id.equals(id)) { - return user; - } - } - return users.get(0); - } - - // get a list of all the users - public static List getAllUsers () { - return users; - } - - // get a list of users with their names and emails for mentions - public static List> getUsersForMentions (String id) { - List> usersData = new ArrayList<>(); - for (User user : users) { - if (!user.id.equals(id) && user.name != null && user.email != null) { - Map data = new HashMap<>(); - data.put("name", user.name); - data.put("email", user.email); - usersData.add(data); - } - } - return usersData; - } -} - diff --git a/laws-modules/src/main/java/com/jero/modules/ocr/mapper/OcrRecordEOMapper.java b/laws-modules/src/main/java/com/jero/modules/ocr/mapper/OcrRecordEOMapper.java deleted file mode 100644 index 0cb1c3f6..00000000 --- a/laws-modules/src/main/java/com/jero/modules/ocr/mapper/OcrRecordEOMapper.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.jero.modules.ocr.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.jero.modules.ocr.entity.OcrRecordEO; - -/** - * @Description: OCR识别转换记录表 - * @Author: jero-boot - * @Date: 2022-02-16 - * @Version: V1.0 - */ -public interface OcrRecordEOMapper extends BaseMapper { - -} diff --git a/laws-modules/src/main/java/com/jero/modules/ocr/mapper/xml/OcrRecordEOMapper.xml b/laws-modules/src/main/java/com/jero/modules/ocr/mapper/xml/OcrRecordEOMapper.xml deleted file mode 100644 index 39be2473..00000000 --- a/laws-modules/src/main/java/com/jero/modules/ocr/mapper/xml/OcrRecordEOMapper.xml +++ /dev/null @@ -1,28 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/laws-modules/src/main/java/com/jero/modules/ocr/service/IOcrRecordEOService.java b/laws-modules/src/main/java/com/jero/modules/ocr/service/IOcrRecordEOService.java deleted file mode 100644 index 3fe66a4b..00000000 --- a/laws-modules/src/main/java/com/jero/modules/ocr/service/IOcrRecordEOService.java +++ /dev/null @@ -1,98 +0,0 @@ -package com.jero.modules.ocr.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import com.jero.modules.ocr.entity.OcrRecordEO; - -import java.util.List; -import java.util.Map; - -/** - * @Description: OCR识别转换记录表 - * @Author: jero-boot - * @Date: 2022-02-16 - * @Version: V1.0 - */ -public interface IOcrRecordEOService extends IService { - - /** - * 保存 - * - * @param ocrRecordEO - * @return - */ - void add(OcrRecordEO ocrRecordEO); - - /** - * 更新 - * - * @param ocrRecordEO - * @return - */ - void editById(OcrRecordEO ocrRecordEO); - - /** - * 通过id删除 - * - * @param id - * @return - */ - void deleteById(String id); - - /** - * 批量删除 - * - * @param ids - * @return - */ - void deleteByIds(List ids); - - /** - * 通过id查询 - * - * @param id - * @return - */ - OcrRecordEO queryById(String id); - - /** - * 列表查询 - * - * @return - */ - List queryList(); - - /** - * 列表表头中英文切换 - * @param flag - * @param cut - * @return - */ - List> getHeader(String flag, String cut); - - /** - * 查询条件中英文切换 - * @param flag - * @param cut - * @return - */ - List> queryCondition(String flag, String cut); - - /** - * 表单中英文切换 - * @param flag - * @param cut - * @return - */ - List> getForm(String flag, String cut); - - /** - * 处理列表数据字典值中英文切换 - * @param cut - * @param ocrRecordEOList - * @return - */ - void dataProcessing(String cut, List ocrRecordEOList); - - void batchUpdateByDocumentSerialNumber(String oldSerialNumber,String newSerialNumber,String newTitle,String newTitleEn); - -} diff --git a/laws-modules/src/main/java/com/jero/modules/ocr/service/impl/OcrRecordEOServiceImpl.java b/laws-modules/src/main/java/com/jero/modules/ocr/service/impl/OcrRecordEOServiceImpl.java deleted file mode 100644 index 7fc70086..00000000 --- a/laws-modules/src/main/java/com/jero/modules/ocr/service/impl/OcrRecordEOServiceImpl.java +++ /dev/null @@ -1,328 +0,0 @@ -package com.jero.modules.ocr.service.impl; - -import cn.hutool.core.collection.CollectionUtil; -import cn.hutool.core.util.ObjectUtil; -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.jero.common.constant.enums.LanguageEnum; -import com.jero.common.constant.enums.ModuleEnum; -import com.jero.common.constant.enums.YesOrNoEnum; -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.ocr.entity.OcrRecordEO; -import com.jero.modules.ocr.enums.FileSourceEnum; -import com.jero.modules.ocr.mapper.OcrRecordEOMapper; -import com.jero.modules.ocr.service.IOcrRecordEOService; -import com.jero.modules.ocr.util.LineHumpUtil; -import com.jero.modules.system.entity.SysDictItem; -import com.jero.modules.system.service.ISysDictItemService; -import org.apache.commons.lang3.StringUtils; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.stereotype.Service; - -import java.util.*; -import java.util.stream.Collectors; - -/** - * @Description: OCR识别转换记录表 - * @Author: jero-boot - * @Date: 2022-02-16 - * @Version: V1.0 - */ -@Service -public class OcrRecordEOServiceImpl extends ServiceImpl implements IOcrRecordEOService { - - @Autowired - private OnlCgformFieldServiceImpl onlCgformFieldService; - - @Autowired - private ISysDictItemService sysDictItemService; - - @Value("${OCR.ocrDownPath}") - private String ocrDownPath; - - /** - * 保存 - * - * @param ocrRecordEO - * @return - */ - @Override - public void add(OcrRecordEO ocrRecordEO) { - Date now = new Date(); - ocrRecordEO.setCreateTime(now); - ocrRecordEO.setUpdateTime(now); - save(ocrRecordEO); - } - - /** - * 更新 - * - * @param ocrRecordEO - * @return - */ - @Override - public void editById(OcrRecordEO ocrRecordEO) { - Date now = new Date(); - ocrRecordEO.setUpdateTime(now); - saveOrUpdate(ocrRecordEO); - } - - /** - * 通过id删除 - * - * @param id - * @return - */ - @Override - public void deleteById(String id) { - //TODO 删除对应的本地文件 - removeById(id); - } - - /** - * 批量删除 - * - * @param ids - * @return - */ - @Override - public void deleteByIds(List ids) { - //TODO 删除对应的本地文件 - removeByIds(ids); - } - - /** - * 通过id查询 - * - * @param id - * @return - */ - @Override - public OcrRecordEO queryById(String id) { - return getById(id); - } - - /** - * 列表查询 - * - * @return - */ - @Override - public List queryList() { - return list(); - } - - /** - * 列表表头中英文切换 - * - * @return - */ - @Override - public List> getHeader(String flag, String cut) { - List fieldList = onlCgformFieldService.getFieldList(flag); - if (fieldList.size() != 0) { - //过滤列表字段(is_show_list-->列表是否显示0否 1是) - fieldList = fieldList.stream().filter(e -> YesOrNoEnum.YES.getValue().equals(String.valueOf(e.getIsShowList()))).collect(Collectors.toList()); - } - List> list = new ArrayList<>(); - for (OnlCgformField onlCgformField : fieldList) { - Map map = new HashMap<>(); - if("file_name".equals(onlCgformField.getDbFieldName())){ - //跳转详情的标识 - map.put("click","true"); - } - //单独处理发布日期和标准实施日期 - if ("update_time".equals(onlCgformField.getDbFieldName())) { - map.put("sort", "true");//列表排序标识 - } - - String dbFieldName = onlCgformField.getDbFieldName(); - if(LanguageEnum.CN.getValue().equals(cut) && "stand_name_en".equals(onlCgformField.getDbFieldName())) { - continue; - } - if(LanguageEnum.EN.getValue().equals(cut) && "stand_name".equals(onlCgformField.getDbFieldName())) { - continue; - } - - map.put("db_field_name", LineHumpUtil.lineToHump(dbFieldName));//字段 - if(LanguageEnum.CN.getValue().equals(cut)){ - map.put("db_field_txt", onlCgformField.getDbFieldTxt());//字段中文名 - }else{ - map.put("db_field_txt", onlCgformField.getDbFieldEnName());//字段英文名 - } - list.add(map); - } - return list; - } - - /** - * 查询条件中英文切换 - * - * @return - */ - @Override - public List> queryCondition(String flag, String cut) { - List fieldList = onlCgformFieldService.getFieldList(flag); - if (fieldList.size() != 0) { - //过滤出搜索条件() - fieldList = fieldList.stream().filter(e -> YesOrNoEnum.YES.getValue().equals(String.valueOf(e.getIsQuery()))).collect(Collectors.toList()); - } - List> list = new ArrayList<>(); - for (OnlCgformField onlCgformField : fieldList) { - Map map = new HashMap<>(); - map.put("field_show_type", onlCgformField.getFieldShowType());//类型(判断是下拉还是输入框,等等) - map.put("dict_field", onlCgformField.getDictField()); //下拉类型的数据字典编码 - map.put("db_field_name", LineHumpUtil.lineToHump(onlCgformField.getDbFieldName()));//字段 - if (LanguageEnum.CN.getValue().equals(cut)) { - map.put("db_field_txt", onlCgformField.getDbFieldTxt());//字段中文名 - } else { - map.put("db_field_txt", onlCgformField.getDbFieldEnName());//字段英文名 - } - list.add(map); - } - return list; - } - - /** - * 表单中英文切换 - * - * @return - */ - @Override - public List> getForm(String flag, String cut) { - List fieldList = onlCgformFieldService.getFieldList(flag); - if (fieldList.size() != 0) { - //过滤出表单字段 - fieldList = fieldList.stream().filter(e -> YesOrNoEnum.YES.getValue().equals(String.valueOf(e.getIsShowForm()))).collect(Collectors.toList()); - } - List> list = new ArrayList<>(); - for (OnlCgformField onlCgformField : fieldList) { - Map map = new HashMap<>(); - map.put("area", null);//展示区域。没用到 - map.put("field_show_type", onlCgformField.getFieldShowType());//类型(判断是下拉还是输入框,等等) - map.put("field_must_input", onlCgformField.getFieldMustInput());//是否必填 - map.put("dict_field", onlCgformField.getDictField()); //下拉类型的数据字典编码 - map.put("db_field_name", LineHumpUtil.lineToHump(onlCgformField.getDbFieldName()));//字段 - if (LanguageEnum.CN.getValue().equals(cut)) { - map.put("db_field_txt", onlCgformField.getDbFieldTxt());//字段中文名 - } else { - if("stand_name_en".equals(onlCgformField.getDbFieldName())) { // 英文标题字段特殊处理 - map.put("db_field_txt", "English Title"); - } else { - map.put("db_field_txt", onlCgformField.getDbFieldEnName());//字段英文名 - } - } - if("文本状态".equals(onlCgformField.getDbFieldTxt())){ - // 查询文档库所有文件类型的字段名称 - List documentLibraryFieldList = onlCgformFieldService.getFieldList(ModuleEnum.DOCUMENT_LIBRARY.getValue()); - documentLibraryFieldList = documentLibraryFieldList.stream() - .filter(e -> FieldTypeEnum.FILE.getValue().equals(e.getFieldShowType())).collect(Collectors.toList()); - List> fieldFileList = new ArrayList<>(); - for (OnlCgformField field : documentLibraryFieldList) { - Map map1 = new HashMap<>(); - if (LanguageEnum.CN.getValue().equals(cut)) { - map1.put("label",field.getDbFieldTxt()); - map1.put("value",field.getId()); - - } else { - map1.put("label",field.getDbFieldEnName()); - map1.put("value",field.getId()); - - } - fieldFileList.add(map1); - } - map.put("value_list",fieldFileList); - } - list.add(map); - } - return list; - } - - @Override - public void dataProcessing(String cut, List ocrRecordEOList) { - // 查询文档拆分表中类型是下拉选的字段 - List fieldList = onlCgformFieldService.getFieldList(ModuleEnum.OCR_RECORD.getValue()); - if (fieldList.size() != 0) { - //过滤列表字段(is_show_list-->列表是否显示0否 1是 且 有数据字典编码) - fieldList = fieldList.stream() - .filter(e -> YesOrNoEnum.YES.getValue().equals(String.valueOf(e.getIsShowList())) - && StringUtils.isNotBlank(e.getDictField())) - .collect(Collectors.toList()); - } - // 根据切换语言 查询下拉选字段的下拉值 - List dictItemListAll = new ArrayList<>(); - for (OnlCgformField onlCgformField : fieldList) { - // 查询数据字典值 - List dictItemList = sysDictItemService.selectItemsByDictCode(onlCgformField.getDictField()); - if(CollectionUtil.isNotEmpty(dictItemList)) { - dictItemListAll.addAll(dictItemList); - } - } - - // 处理数据中所有下拉字典值 - for (OcrRecordEO ocrRecordEO : ocrRecordEOList){ - String fileType = null; - OnlCgformField fileTypeField = onlCgformFieldService.queryById(ocrRecordEO.getFileType()); - if (ObjectUtil.isNotEmpty(fileTypeField)) { - if (LanguageEnum.CN.getValue().equals(cut)) { - fileType = fileTypeField.getDbFieldTxt(); - } else { - fileType = fileTypeField.getDbFieldEnName(); - } - } - if (LanguageEnum.CN.getValue().equals(cut)) { - Map cnMap = dictItemListAll.stream() - .filter(e->e.getItemValue().equals(ocrRecordEO.getResultContent()) - || e.getItemValue().equals(ocrRecordEO.getSyncState())) - .collect(Collectors.toMap(SysDictItem::getItemValue, SysDictItem::getItemText)); // 优化 - ocrRecordEO.setResultContent(cnMap.get(ocrRecordEO.getResultContent())); - ocrRecordEO.setSyncState(cnMap.get(ocrRecordEO.getSyncState())); - } else { - Map enMap = dictItemListAll.stream() - .filter(e->e.getItemValue().equals(ocrRecordEO.getResultContent()) - || e.getItemValue().equals(ocrRecordEO.getSyncState())) - .collect(Collectors.toMap(SysDictItem::getItemValue, SysDictItem::getEnName)); // 优化 - - ocrRecordEO.setResultContent(enMap.get(ocrRecordEO.getResultContent())); - ocrRecordEO.setSyncState(enMap.get(ocrRecordEO.getSyncState())); - } - ocrRecordEO.setFileType(fileType); - if(StringUtils.isNotEmpty(ocrRecordEO.getConnectId())) { - ocrRecordEO.setFileSource(FileSourceEnum.IMPORT.getValue()); - }else{ - ocrRecordEO.setFileSource(FileSourceEnum.UPLOAD.getValue()); - } - if(StringUtils.isNotEmpty(ocrRecordEO.getDocRealName())) { - ocrRecordEO.setDocRealFile(ocrDownPath + ocrRecordEO.getDocRealName()); - } - if(StringUtils.isNotEmpty(ocrRecordEO.getJsonRealName())) { - ocrRecordEO.setJsonRealFile(ocrDownPath + ocrRecordEO.getJsonRealName()); - } - } - } - - @Override - public void batchUpdateByDocumentSerialNumber(String oldSerialNumber,String newSerialNumber,String newTitle,String newTitleEn) { - LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper<>(); - lambdaQueryWrapper.eq(OcrRecordEO::getStandNumber, oldSerialNumber); - List ocrRecordEOList = list(lambdaQueryWrapper); - - if (CollectionUtil.isNotEmpty(ocrRecordEOList)) { - List updateOcrRecordEOList = new ArrayList<>(); - ocrRecordEOList.forEach(ocrRecordEO ->{ - OcrRecordEO updateEO = new OcrRecordEO(); - updateEO.setId(ocrRecordEO.getId()); - updateEO.setStandNumber(newSerialNumber); - updateEO.setStandName(newTitle); - updateEO.setStandNameEn(newTitleEn); - - updateOcrRecordEOList.add(updateEO); - }); - - updateBatchById(updateOcrRecordEOList); - } - } -} diff --git a/laws-modules/src/main/java/com/jero/modules/onlyoffice/service/impl/AttFileEOServiceImpl.java b/laws-modules/src/main/java/com/jero/modules/onlyoffice/service/impl/AttFileEOServiceImpl.java index 8d480f68..34da1e51 100644 --- a/laws-modules/src/main/java/com/jero/modules/onlyoffice/service/impl/AttFileEOServiceImpl.java +++ b/laws-modules/src/main/java/com/jero/modules/onlyoffice/service/impl/AttFileEOServiceImpl.java @@ -1,7 +1,8 @@ package com.jero.modules.onlyoffice.service.impl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.jero.modules.ocr.util.UUIDUtils; +//import com.jero.modules.ocr.util.UUIDUtils; +import com.jero.common.util.UUIDUtils; import com.jero.modules.onlyoffice.entity.AttFileEO; import com.jero.modules.onlyoffice.entity.AttFileVo; import com.jero.modules.onlyoffice.mapper.AttFileEODao; diff --git a/laws-modules/src/main/java/com/jero/modules/phone/entity/RecentBrowse.java b/laws-modules/src/main/java/com/jero/modules/phone/entity/RecentBrowse.java deleted file mode 100644 index 911af9af..00000000 --- a/laws-modules/src/main/java/com/jero/modules/phone/entity/RecentBrowse.java +++ /dev/null @@ -1,86 +0,0 @@ -package com.jero.modules.phone.entity; - -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableField; -import com.baomidou.mybatisplus.annotation.TableId; -import com.baomidou.mybatisplus.annotation.TableName; -import com.fasterxml.jackson.annotation.JsonFormat; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; -import lombok.EqualsAndHashCode; -import lombok.experimental.Accessors; -import org.jeecgframework.poi.excel.annotation.Excel; -import org.springframework.format.annotation.DateTimeFormat; - -import java.io.Serializable; - - -/** - * @Description: 最近浏览表 - * @Author: jero-boot - * @Date: 2023-06-08 - * @Version: V1.0 - */ -@Data -@TableName("recent_browse") -@Accessors(chain = true) -@EqualsAndHashCode(callSuper = false) -@ApiModel(value="recent_browse对象", description="最近浏览表") -public class RecentBrowse implements Serializable { - private static final long serialVersionUID = 1L; - - /**主键*/ - @TableId(type = IdType.ASSIGN_ID) - @ApiModelProperty(value = "主键") - private String id; - - /**创建人*/ - @ApiModelProperty(value = "创建人") - private String createBy; - - /**创建日期*/ - @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss") - @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") - @ApiModelProperty(value = "创建日期") - private java.util.Date createTime; - - /**更新人*/ - @ApiModelProperty(value = "更新人") - private String updateBy; - - /**更新日期*/ - @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss") - @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") - @ApiModelProperty(value = "更新日期") - private java.util.Date updateTime; - - /**所属部门*/ - @ApiModelProperty(value = "所属部门") - private String sysOrgCode; - - /**浏览类型*/ - @Excel(name = "浏览类型", width = 15) - @ApiModelProperty(value = "浏览类型") - private String browseType; - - /**浏览数据id*/ - @Excel(name = "浏览数据id", width = 15) - @ApiModelProperty(value = "浏览数据id") - private String browseDataId; - - // 展示标题 - @TableField(exist = false) - private String title; - - // 浏览类型展示字段 - @TableField(exist = false) - private String browseTypeName; - - @TableField(exist = false) - private String cut; - - // 法规月报专用 - @TableField(exist = false) - private String fileId; -} diff --git a/laws-modules/src/main/java/com/jero/modules/phone/enums/BrowseTypeEnum.java b/laws-modules/src/main/java/com/jero/modules/phone/enums/BrowseTypeEnum.java deleted file mode 100644 index 243ce7a9..00000000 --- a/laws-modules/src/main/java/com/jero/modules/phone/enums/BrowseTypeEnum.java +++ /dev/null @@ -1,52 +0,0 @@ -package com.jero.modules.phone.enums; - -import com.jero.common.constant.enums.LanguageEnum; -import org.apache.commons.lang3.StringUtils; - -/** - * 浏览类型枚举类 - */ -public enum BrowseTypeEnum { - WDK("Document Library", "文档库", "Document Library"), - ZSFX("Knowledge sharing", "知识分享", "Knowledge Sharing"), - FGYB("Regulatory Monthly Report", "法规月报", "Regulatory Monthly Report"), - ; - - - String cnName; - String enName; - String value; - - private BrowseTypeEnum(String value, String cnName, String enName) { - this.value = value; - this.cnName = cnName; - this.enName = enName; - } - - public String getValue() { - return value; - } - - public String getCnName() { - return cnName; - } - - public String getEnName() { - return enName; - } - - - public static String getTextByValue(String value, String cut) { - BrowseTypeEnum[] values = values(); - for (BrowseTypeEnum taskStatusEnum : values) { - if (taskStatusEnum.value.equals(value)) { - if (StringUtils.equals(cut, LanguageEnum.CN.getValue())) { - return taskStatusEnum.cnName; - } else { - return taskStatusEnum.enName; - } - } - } - return null; - } -} diff --git a/laws-modules/src/main/java/com/jero/modules/phone/mapper/RecentBrowseMapper.java b/laws-modules/src/main/java/com/jero/modules/phone/mapper/RecentBrowseMapper.java deleted file mode 100644 index 302e5350..00000000 --- a/laws-modules/src/main/java/com/jero/modules/phone/mapper/RecentBrowseMapper.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.jero.modules.phone.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.jero.modules.phone.entity.RecentBrowse; - -/** - * @Description: 最近浏览表 - * @Author: jero-boot - * @Date: 2023-06-08 - * @Version: V1.0 - */ -public interface RecentBrowseMapper extends BaseMapper { - -} diff --git a/laws-modules/src/main/java/com/jero/modules/phone/mapper/xml/RecentBrowseMapper.xml b/laws-modules/src/main/java/com/jero/modules/phone/mapper/xml/RecentBrowseMapper.xml deleted file mode 100644 index 1cd51d84..00000000 --- a/laws-modules/src/main/java/com/jero/modules/phone/mapper/xml/RecentBrowseMapper.xml +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - - - - - - - - - \ No newline at end of file diff --git a/laws-modules/src/main/java/com/jero/modules/phone/service/ISearchCenterService.java b/laws-modules/src/main/java/com/jero/modules/phone/service/ISearchCenterService.java deleted file mode 100644 index 3bfa2b13..00000000 --- a/laws-modules/src/main/java/com/jero/modules/phone/service/ISearchCenterService.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.jero.modules.phone.service; - -import com.jero.common.api.vo.Result; - -import java.util.Map; - -public interface ISearchCenterService { - -// Result> getDataCount(); - -// Result> getWdkCollectAndSubscribeInfoByUser(Map params); - -// Result getWdkPage(Map params); -} diff --git a/laws-modules/src/main/java/com/jero/modules/phone/service/impl/SearchCenterServiceImpl.java b/laws-modules/src/main/java/com/jero/modules/phone/service/impl/SearchCenterServiceImpl.java deleted file mode 100644 index d005f6e5..00000000 --- a/laws-modules/src/main/java/com/jero/modules/phone/service/impl/SearchCenterServiceImpl.java +++ /dev/null @@ -1,349 +0,0 @@ -package com.jero.modules.phone.service.impl; - -import com.alibaba.fastjson.JSONArray; -import com.alibaba.fastjson.JSONObject; -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.jero.common.api.vo.Result; -import com.jero.common.constant.enums.LanguageEnum; -import com.jero.common.es.JeroElasticsearchTemplate; -import com.jero.common.system.vo.LoginUser; -import com.jero.common.util.DateUtils; -//import com.jero.modules.collection.entity.OnlCgformCollection; -//import com.jero.modules.collection.service.IOnlCgformCollectionService; -import com.jero.modules.document.enums.SearchEnum; -import com.jero.modules.document.service.IBussDocumentLibraryEOService; -import com.jero.modules.enums.DictCodeEnum; -import com.jero.modules.phone.service.ISearchCenterService; -import com.jero.modules.system.entity.SysDictItem; -import com.jero.modules.system.service.impl.SysDictItemServiceImpl; -import org.apache.commons.collections.CollectionUtils; -import org.apache.commons.lang3.ObjectUtils; -import org.apache.commons.lang3.StringUtils; -import org.apache.shiro.SecurityUtils; -import org.jetbrains.annotations.NotNull; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -@Service -public class SearchCenterServiceImpl implements ISearchCenterService { - - @Autowired - private IBussDocumentLibraryEOService bussDocumentLibraryEOService; -// @Autowired -// private IOnlCgformCollectionService onlCgformCollectionService; - @Autowired - private JeroElasticsearchTemplate jeroElasticsearchTemplate; - public static final String SEARCH_FLAG = "魑";//标识(es数据带此标识的代表全文和段落的数据,不带此标识的代表列表数据) - @Autowired - private SysDictItemServiceImpl sysDictItemServiceImpl; - -// @Override -// public Result> getDataCount() { -// Map result = new HashMap<>(); -// Map params = new HashMap<>(); -// params.put("cut", LanguageEnum.CN.getValue()); -// params.put("pageNo", "1"); -// params.put("pageSize", "10"); -// IPage documentLibraryInfoPage = this.bussDocumentLibraryEOService.getInfoPage(params); -// long documentLibraryCount = documentLibraryInfoPage.getTotal(); -// -// result.put("documentLibraryCount", documentLibraryCount); -// return Result.OK(result); -// } - -// @Override -// public Result> getWdkCollectAndSubscribeInfoByUser(Map params) { -// LoginUser currentUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); -// Map result = new HashMap<>(); -// -// String id = (String) params.get("id"); -// QueryWrapper collectionQueryWrap = new QueryWrapper<>(); -// collectionQueryWrap.lambda().eq(OnlCgformCollection::getDocumentId, id); -// collectionQueryWrap.lambda().eq(OnlCgformCollection::getCreateBy, currentUser.getUsername()); -// List collectionList = this.onlCgformCollectionService.list(collectionQueryWrap); -// -// result.put("collectionList", collectionList); -// return Result.OK(result); -// } - -// @Override -// public Result getWdkPage(Map params) { -// boolean indexExistsFlag = true; -// String cut = (String) params.get("cut"); -// Integer pageNo = Integer.parseInt(params.get("pageNo").toString()); -// Integer pageSize = Integer.parseInt(params.get("pageSize").toString()); -// if (StringUtils.equals(cut, LanguageEnum.CN.getValue())) { -// indexExistsFlag = jeroElasticsearchTemplate.indexExists(SearchEnum.FULL_TEXT_SEARCH_CN.getValue()); -// } else if (StringUtils.equals(cut, LanguageEnum.EN.getValue())) { -// indexExistsFlag = jeroElasticsearchTemplate.indexExists(SearchEnum.FULL_TEXT_SEARCH_EN.getValue()); -// } -// if (!indexExistsFlag) { -// Page page = new Page(pageNo, pageSize); -// return Result.OK(page); -// } -// -// // 定义需要查询的字段数组 -// List fieldList = new ArrayList<>(); -// fieldList.add("serial_number"); -// if (StringUtils.equals(cut, LanguageEnum.EN.getValue())) { -// fieldList.add("title_en"); -// } else if (StringUtils.equals(cut, LanguageEnum.CN.getValue())){ -// fieldList.add("title"); -// } -// fieldList.add("content"); -// fieldList.add("flag"); -// -// JSONArray queryMapJsonAll = new JSONArray(); -// JSONArray queryJsonMustNot = new JSONArray(); -// -// JSONArray queryMapInputJson = new JSONArray(); -// Map mapHighlight = new HashMap<>(); -// Map mapHighlight1 = new HashMap<>(); -// -// String selectValue = (String) params.get("selectValue"); -// if(StringUtils.isNotBlank(selectValue)){ -// Map map = new HashMap<>(); -// Map map1 = new HashMap<>(); -// Map map2 = new HashMap<>(); -// map.put("query",SEARCH_FLAG); -// map1.put("flag",map); -// map2.put("match",map1); -// queryJsonMustNot.add(map2); -// }else { -// selectValue = SEARCH_FLAG; -// } -// if (StringUtils.isNotBlank(selectValue)) { -// for (String field : fieldList) { -// this.setQueryMapJson(queryMapInputJson, selectValue, field); -// //高亮 -// if(!"flag".equals(field)){ -// this.wdkHighlight(mapHighlight, field); -// } else { -// // query_string查询 -// Map map25 = new HashMap<>(); -// Map map45 = new HashMap<>(); -// map25.put("query", selectValue); -// map25.put("fields", fieldList.toArray()); -// map25.put("allow_leading_wildcard", false); //禁用了前置通配符 -// map45.put("query_string", map25); -// queryMapInputJson.add(map45); -// } -// } -// mapHighlight1.put("fields", mapHighlight); -// -// if (CollectionUtils.isNotEmpty(queryMapInputJson)) { -// JSONObject jsonObject = jeroElasticsearchTemplate.buildBoolQuery(null, null, queryMapInputJson); -// queryMapJsonAll.add(jsonObject); -// } -// } -// -// //指定module_type_flag= WDK -// JSONArray moduleTypeFlagQueryJsonArrMust = new JSONArray(); -// Map moduleTypeFlagValueMap = new HashMap<>(); -// Map moduleTypeFlagFieldMap = new HashMap<>(); -// Map moduleTypeFlagMatchMap = new HashMap<>(); -// moduleTypeFlagValueMap.put("query", "WDK"); -// moduleTypeFlagFieldMap.put("module_type_flag", moduleTypeFlagValueMap); -// moduleTypeFlagMatchMap.put("match", moduleTypeFlagFieldMap); -// moduleTypeFlagQueryJsonArrMust.add(moduleTypeFlagMatchMap); -// JSONObject moduleTypeFlagQueryJson = jeroElasticsearchTemplate.buildBoolQuery(moduleTypeFlagQueryJsonArrMust, null, null); -// queryMapJsonAll.add(moduleTypeFlagQueryJson); -// -// JSONObject querySort = new JSONObject(); -// if (StringUtils.isEmpty(selectValue) || StringUtils.equals(selectValue, SEARCH_FLAG)) { -// Map createTime = new HashMap<>(); -// Map createTime1 = new HashMap<>(); -// createTime.put("order", "desc"); -// createTime1.put("create_time", createTime); -// querySort.putAll(createTime1); -// } else { -// Map score = new HashMap<>(); -// Map score1 = new HashMap<>(); -// score.put("order", "desc"); -// score1.put("_score", score); -// querySort.putAll(score1); -// } -// -// IPage page = this.getWdkPage( -// queryMapJsonAll, -// mapHighlight1, -// pageNo, -// pageSize, -// cut, -// querySort, -// queryJsonMustNot, -// null -// ); -// return Result.OK(page); -// } - -// @NotNull -// private IPage getWdkPage(JSONArray queryMapJson, -// Map highlightMap, -// Integer pageNo, -// Integer pageSize, -// String cut, -// JSONObject querySort, -// JSONArray queryMustNot, -// JSONArray queryShould) { -// JSONObject jsonObject = jeroElasticsearchTemplate.buildBoolQuery(queryMapJson, queryMustNot, queryShould); -// JSONArray jsonArraySort = new JSONArray(); -// jsonArraySort.add(querySort); -// -// //1. 条件,分页 -// JSONObject queryObject = jeroElasticsearchTemplate.buildQuery( -// null, -// jsonObject, -// highlightMap, -// jsonArraySort, -// pageNo - 1, -// pageSize -// ); -// -// //2. 数据查询 -// JSONObject search = new JSONObject(); -// if (LanguageEnum.CN.getValue().equals(cut)) { -// search = jeroElasticsearchTemplate.search( -// SearchEnum.FULL_TEXT_SEARCH_CN.getValue(), -// SearchEnum.FULL_TEXT_SEARCH_CN.getValue(), -// queryObject -// ); -// } else { -// search = jeroElasticsearchTemplate.search( -// SearchEnum.FULL_TEXT_SEARCH_EN.getValue(), -// SearchEnum.FULL_TEXT_SEARCH_EN.getValue(), -// queryObject -// ); -// } -// -// List stateSysDictItems = this.sysDictItemServiceImpl.selectItemsByDictCode(DictCodeEnum.STATE.getValue()); -// -// List> list = (List>) (((Map) search.get("hits")).get("hits")); -// List> mapList = new ArrayList<>(); -// for (Map map : list) { -// Map mapSource = (Map) map.get("_source"); -// Map mapHighlight = (Map) map.get("highlight"); -// if(ObjectUtils.isNotEmpty(mapHighlight)){ -// for (Map.Entry entry : mapHighlight.entrySet()) { -// String key = entry.getKey(); -// List value = (List) entry.getValue(); -// String fieldConyent= ""; -// for (String s : value) { -// fieldConyent += s; -// } -// mapSource.put(key,fieldConyent); -// } -// } -// String state = (String) mapSource.get("state"); -// String state_dictText = ""; -// for (SysDictItem dictItem : stateSysDictItems) { -// if (StringUtils.equals(dictItem.getItemValue(), state)) { -// if (StringUtils.equals(cut, LanguageEnum.CN.getValue())) { -// state_dictText = dictItem.getItemText(); -// } else { -// state_dictText = dictItem.getEnName(); -// } -// break; -// } -// } -// mapSource.put("state_dictText", state_dictText); -// -// String create_time_str = ""; -// if(ObjectUtils.isNotEmpty(mapSource.get("create_time"))){ -// create_time_str = DateUtils.formatTime((Long) mapSource.get("create_time")); -// } -// mapSource.put("create_time_str",create_time_str); -// // 处理中英文切换的时候 展示的标题 -// if (StringUtils.equals(cut, LanguageEnum.EN.getValue())) { -// mapSource.put("title",mapSource.get("title_en")); -// } -// mapList.add(mapSource); -// } -// -// //处理分页 -// IPage page = new Page(pageNo, pageSize); -// page.setTotal(Long.parseLong(String.valueOf(((Map) search.get("hits")).get("total")))); -// page.setRecords(mapList); -// return page; -// } - - /** - * 设置文档库高亮字段 - * @param mapHighlight - * @param key - */ -// private void wdkHighlight(Map mapHighlight, String key) { -// Map mapTemp = new HashMap<>(); -// List list = new ArrayList<>(); -// list.add(""); -// List list1 = new ArrayList<>(); -// list1.add(""); -// mapTemp.put("pre_tags", list); -// mapTemp.put("post_tags", list1); -// mapTemp.put("fragment_size", 320); -// mapTemp.put("number_of_fragments", 1); -// mapTemp.put("type", "plain"); -// mapHighlight.put(key, mapTemp); -// } -// -// private void setQueryMapJson(JSONArray queryMapJson, String selectValue, String field) { -// // 前缀匹配 缺点是前缀一定不能断开 -// // 情况举例:用户只记得前面那段字 -// Map map21 = new HashMap<>(); -// Map map31 = new HashMap<>(); -// Map map41 = new HashMap<>(); -// if ("title".equals(field)) { -// map31.put("boost", 10); -// } else if ("content".equals(field)) { -// map31.put("boost", 0.01); -// } -// map31.put("value", selectValue); -// map21.put(field + ".keyword", map31); -// map41.put("prefix", map21); -// queryMapJson.add(map41); -// -// // match_phrase_prefix 词组匹配查询,允许最后词组与文中的任意分词前缀匹配 -// Map map22 = new HashMap<>(); -// Map map32 = new HashMap<>(); -// Map map42 = new HashMap<>(); -// if ("title".equals(field)) { -// map32.put("boost", 10); -// } else if ("content".equals(field)) { -// map32.put("boost", 0.01); -// } -// map32.put("query", selectValue); -// map22.put(field, map32); -// map42.put("match_phrase_prefix", map22); -// queryMapJson.add(map42); -// -// // match分词匹配查询 -// // 情况举例:用户可能他知道开头的前缀几个字,知道中间的几个字 -// Map map23 = new HashMap<>(); -// Map map33 = new HashMap<>(); -// Map map43 = new HashMap<>(); -// if ("title".equals(field)) { -// map33.put("boost", 10); -// } else if ("content".equals(field)) { -// map33.put("boost", 0.01); -// } -// map33.put("query", selectValue); -// map23.put(field, map33); -// map43.put("match", map23); -// queryMapJson.add(map43); -// -// // wildcard模糊查询 -// // 情况举例:用户只记得中间那段字 -// Map map24 = new HashMap<>(); -// Map map44 = new HashMap<>(); -// map24.put(field, "*" + selectValue + "*"); -// map44.put("wildcard", map24); -// queryMapJson.add(map44); -// } -} diff --git a/laws-modules/src/main/java/com/jero/modules/project/entity/ProjectLawsInventoryEO.java b/laws-modules/src/main/java/com/jero/modules/project/entity/ProjectLawsInventoryEO.java deleted file mode 100644 index d0cae03b..00000000 --- a/laws-modules/src/main/java/com/jero/modules/project/entity/ProjectLawsInventoryEO.java +++ /dev/null @@ -1,539 +0,0 @@ -package com.jero.modules.project.entity; - -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableField; -import com.baomidou.mybatisplus.annotation.TableId; -import com.baomidou.mybatisplus.annotation.TableName; -import com.fasterxml.jackson.annotation.JsonFormat; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; -import lombok.EqualsAndHashCode; -import lombok.experimental.Accessors; -import org.jeecgframework.poi.excel.annotation.Excel; -import org.springframework.format.annotation.DateTimeFormat; - -import java.io.Serializable; -import java.util.Date; - - -/** - * @Description: 项目库-法规清单表 - * @Author: jero-boot - * @Date: 2022-04-14 - * @Version: V1.0 - */ -@Data -@TableName("project_laws_inventory") -@Accessors(chain = true) -@EqualsAndHashCode(callSuper = false) -@ApiModel(value="project_laws_inventory对象", description="项目库-法规清单表") -public class ProjectLawsInventoryEO implements Serializable { - private static final long serialVersionUID = 1L; - - /**主键*/ - @TableId(type = IdType.ASSIGN_ID) - @ApiModelProperty(value = "主键") - private String id; - - /**创建人*/ - @ApiModelProperty(value = "创建人") - private String createBy; - - /**创建日期*/ - @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss") - @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") - @ApiModelProperty(value = "创建日期") - private Date createTime; - - /**更新人*/ - @ApiModelProperty(value = "更新人") - private String updateBy; - - /**更新日期*/ - @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss") - @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") - @ApiModelProperty(value = "更新日期") - private Date updateTime; - - /**所属部门*/ - @ApiModelProperty(value = "所属部门") - private String sysOrgCode; - - /**项目库id*/ - @ApiModelProperty(value = "项目库id") - private String projectLibraryId; - - /**编号*/ - @Excel(name = "*编号", width = 20) - @ApiModelProperty(value = "编号") - private String serialNumber; - - /**标题*/ - @Excel(name = "标题", width = 20) - @ApiModelProperty(value = "标题") - private String title; - - /**子标题*/ - @Excel(name = "子标题", width = 20) - @ApiModelProperty(value = "子标题") - private String subtitle; - - /**清单确认状态*/ - @ApiModelProperty(value = "清单确认状态") - private String inventoryAffirmStatus; - - @TableField(exist = false) - // @Excel(name = "清单确认状态", width = 20) - @ApiModelProperty(value = "清单确认状态名称") - private String inventoryAffirmStatusName;//清单确认状态名称 - - /**任务确认状态*/ - @ApiModelProperty(value = "任务确认状态") - private String taskAffirmStatus; - - @TableField(exist = false) - @ApiModelProperty(value = "任务发布状态名称") - // @Excel(name = "任务确认状态", width = 20) - private String taskAffirmStatusName;//任务发布状态名称 - - /**适用地区*/ - @ApiModelProperty(value = "适用地区") - //@Dict(dicCode ="region") -// @Excel(name = "适用地区", width = 15, dicCode = "region") - private String region; - - @TableField(exist = false) - private String region_dictText; - - /**对应标准*/ -// @Excel(name = "对应标准", width = 20) - @ApiModelProperty(value = "对应标准") - private String correspondingStandard; - - /**实施类别*/ -// @Excel(name = "实施类别", width = 20,dicCode ="implement_type") - @ApiModelProperty(value = "实施类别") - //@Dict(dicCode ="implement_type") - private String implementType; - @TableField(exist = false) - private String implementType_dictText; - - /**新车型实施日期*/ -// @Excel(name = "新车型实施日期", width = 20, format = "yyyy-MM-dd") - @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd") - @DateTimeFormat(pattern="yyyy-MM-dd") - @ApiModelProperty(value = "新车型实施日期") - //@TableField(updateStrategy = FieldStrategy.IGNORED) - private Date xin1Che1Xing2Shi2Shi1Ri4Qi1; - @TableField(exist = false) - private String xin1Che1Xing2Shi2Shi1Ri4Qi1String; - - /**在产车实施日期*/ -// @Excel(name = "在产车实施日期", width = 20, format = "yyyy-MM-dd") - @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd") - @DateTimeFormat(pattern="yyyy-MM-dd") - @ApiModelProperty(value = "在产车实施日期") - //@TableField(updateStrategy = FieldStrategy.IGNORED) - private Date implementTime; - @TableField(exist = false) - private String implementTimeString; - - /**认证类型*/ - @Excel(name = "认证类型", width = 20,dicCode ="attestation_type") - @ApiModelProperty(value = "认证类型") - //@Dict(dicCode ="attestation_type") - private String attestationType; - @TableField(exist = false) - private String attestationType_dictText; - - /**认证级别*/ - @Excel(name = "*认证级别", width = 20,dicCode ="attestation_rank") - @ApiModelProperty(value = "认证级别") - //@Dict(dicCode ="attestation_rank") - private String attestationRank; - @TableField(exist = false) - private String attestationRank_dictText; - - //适用增补件 - @Excel(name = "适用增补件", width = 20) - private String applicableSupplement; - - /**WVTA ID*/ -// @Excel(name = "WVTA ID", width = 20) - @ApiModelProperty(value = "WVTA ID") - private String wvtaId; - - /**责任领域*/ - @Excel(name = "*责任领域", width = 20,dicCode ="duty_territory") - @ApiModelProperty(value = "责任领域") - //@Dict(dicCode ="duty_territory") - private String dutyTerritory; - @TableField(exist = false) - private String dutyTerritory_dictText; - - /**责任部门*/ - @ApiModelProperty(value = "责任部门") - private String dutyDepart; - - /**法规工程师id*/ - @ApiModelProperty(value = "法规工程师id") - private String regulationOwnerId; - - @Excel(name = "法规工程师", width = 20) - @TableField(exist = false) - @ApiModelProperty(value = "法规工程师名称") - private String regulationOwnerName;//法规工程师名称 - - /**认证工程师id*/ - @ApiModelProperty(value = "认证工程师id") - private String homologationEngineerId; - -// @Excel(name = "认证工程师", width = 20) - @TableField(exist = false) - @ApiModelProperty(value = "认证工程师名称") - private String homologationEngineerName;//认证工程师名称 - - /**工程接口人id*/ - @ApiModelProperty(value = "工程接口人id") - private String engineeringInterfacePerson; - - @Excel(name = "工程接口人", width = 20) - @TableField(exist = false) - @ApiModelProperty(value = "工程接口人名称") - private String engineeringInterfacePersonName;//工程接口人名称 - - /**备注*/ - @Excel(name = "备注", width = 20) - @ApiModelProperty(value = "备注") - private String remark; - - /**设计符合性确认-交付物类型*/ - @Excel(name = "交付物类型", width = 20,dicCode ="deliverable_template",groupName = "设计符合性确认") - @ApiModelProperty(value = "设计符合性确认-交付物类型") - //@Dict(dicCode ="deliverable_template") - private String designDeliverableType; - @TableField(exist = false) - private String designDeliverableTypeName; - @TableField(exist = false) - private String designDeliverableType_dictText; - - /**设计符合性确认-交付物模板*/ - @ApiModelProperty(value = "设计符合性确认-交付物模板") - private String designDeliverableTemplate; - - /**设计符合性确认-交付物模板名称*/ - @TableField(exist = false) - @Excel(name = "交付物模板", width = 20,groupName = "设计符合性确认") - private String designDeliverableTemplateName; - - /**设计符合性确认-发起人角色*/ - @ApiModelProperty(value = "设计符合性确认-发起人角色") - //@Dict(dicCode ="fa1_qi3_ren2") - private String designInitiator; - @TableField(exist = false) - private String designInitiator_dictText; - - /**设计符合性确认-发起人id*/ - //@TableField(updateStrategy = FieldStrategy.IGNORED) - @ApiModelProperty(value = "设计符合性确认-发起人id") - private String designInitiatorId; - - /**设计符合性确认-发起人名称*/ -// @Excel(name = "发起人", width = 20,groupName = "设计符合性确认") - @TableField(exist = false) - private String designInitiatorName; - - /**设计符合性确认-责任人角色*/ - @ApiModelProperty(value = "设计符合性确认-责任人角色") - //@Dict(dicCode ="ze2_ren4_ren2") - private String designDuty; - @TableField(exist = false) - private String designDuty_dictText; - - /**设计符合性确认-责任人id*/ - @ApiModelProperty(value = "设计符合性确认-责任人id") - //@TableField(updateStrategy = FieldStrategy.IGNORED) - private String designDutyId; - - /**设计符合性确认-责任人名称*/ - @Excel(name = "责任人", width = 20,groupName = "设计符合性确认") - @TableField(exist = false) - private String designDutyIdName; - - /**设计符合性确认-截止时间*/ - @Excel(name = "截止时间", width = 20, format = "yyyy-MM-dd",groupName = "设计符合性确认") - @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd") - @DateTimeFormat(pattern="yyyy-MM-dd") - @ApiModelProperty(value = "设计符合性确认-截止时间") - //@TableField(updateStrategy = FieldStrategy.IGNORED) - private Date designDueDate; - @TableField(exist = false) - private String designDueDateString; - - //交付物说明 - @Excel(name = "交付物说明", width = 20,groupName = "设计符合性确认") - private String designRemark; - - /**prehomo确认-交付物类型*/ -// @Excel(name = "交付物类型", width = 20,dicCode ="deliverable_template",groupName = "Pre-homo确认") - @ApiModelProperty(value = "prehomo确认-1") - ////@Dict(dicCode ="deliverable_template") - private String prehomoDeliverableType; - @TableField(exist = false) - private String prehomoDeliverableType_dictText; - @TableField(exist = false) - private String prehomoDeliverableTypeName; - - /**prehomo确认-交付物模板*/ - @ApiModelProperty(value = "prehomo确认-交付物模板") - private String prehomoDeliverableTemplate; - - /**prehomo确认-交付物模板名称*/ - @TableField(exist = false) -// @Excel(name = "交付物模板", width = 20,groupName = "Pre-homo确认") - private String prehomoDeliverableTemplateName; - - /**prehomo确认-发起人角色*/ - @ApiModelProperty(value = "prehomo确认-发起人角色") - //@Dict(dicCode ="fa1_qi3_ren2") - private String prehomoInitiator; - @TableField(exist = false) - private String prehomoInitiator_dictText; - - /**prehomo确认-发起人id*/ - @ApiModelProperty(value = "prehomo确认-发起人id") - //@TableField(updateStrategy = FieldStrategy.IGNORED) - private String prehomoInitiatorId; - - /**prehomo确认-发起人名称*/ -// @Excel(name = "发起人", width = 20,groupName = "Pre-homo确认") - @TableField(exist = false) - private String prehomoInitiatorName; - - /**prehomo确认-责任人角色*/ - @ApiModelProperty(value = "prehomo确认-责任人角色") - //@Dict(dicCode ="ze2_ren4_ren2") - private String prehomoDuty; - @TableField(exist = false) - private String prehomoDuty_dictText; - - /**prehomo确认-责任人id*/ - @ApiModelProperty(value = "prehomo确认-责任人id") - //@TableField(updateStrategy = FieldStrategy.IGNORED) - private String prehomoDutyId; - - /**prehomo确认-责任人名称*/ -// @Excel(name = "责任人", width = 20,groupName = "Pre-homo确认") - @TableField(exist = false) - private String prehomoDutyName; - - /**prehomo确认-截止时间*/ -// @Excel(name = "截止时间", width = 20, format = "yyyy-MM-dd",groupName = "Pre-homo确认") - @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd") - @DateTimeFormat(pattern="yyyy-MM-dd") - @ApiModelProperty(value = "prehomo确认-截止时间") - //@TableField(updateStrategy = FieldStrategy.IGNORED) - private Date prehomoDueDate; - @TableField(exist = false) - private String prehomoDueDateString; - - //prehomo确认-交付物说明 -// @Excel(name = "交付物说明", width = 20,groupName = "Pre-homo确认") - private String prehomoRemark; - - /**验证符合性确认-交付物类型*/ - @Excel(name = "交付物类型", width = 20,dicCode ="deliverable_template",groupName = "验证符合性确认") - @ApiModelProperty(value = "验证符合性确认-交付物类型") - //@Dict(dicCode ="deliverable_template") - private String verifyDeliverableType; - @TableField(exist = false) - private String verifyDeliverableType_dictText; - @TableField(exist = false) - private String verifyDeliverableTypeName; - - /**验证符合性确认-交付物模板*/ - @ApiModelProperty(value = "验证符合性确认-交付物模板") - private String verifyDeliverableTemplate; - - /**验证符合性确认-交付物模板名称*/ - @Excel(name = "交付物模板", width = 20,groupName = "验证符合性确认") - @TableField(exist = false) - private String verifyDeliverableTemplateName; - - /**验证符合性确认-发起人角色*/ - @ApiModelProperty(value = "验证符合性确认-发起人角色") - //@Dict(dicCode ="fa1_qi3_ren2") - private String verifyInitiator; - @TableField(exist = false) - private String verifyInitiator_dictText; - - /**验证符合性确认-发起人id*/ - @ApiModelProperty(value = "验证符合性确认-发起人id") - //@TableField(updateStrategy = FieldStrategy.IGNORED) - private String verifyInitiatorId; - - /**验证符合性确认-发起人名称*/ -// @Excel(name = "发起人", width = 20,groupName = "验证符合性确认") - @TableField(exist = false) - private String verifyInitiatorName; - - /**验证符合性确认-责任人角色*/ - @ApiModelProperty(value = "验证符合性确认-责任人角色") - //@Dict(dicCode ="ze2_ren4_ren2") - private String verifyDuty; - @TableField(exist = false) - private String verifyDuty_dictText; - - /**验证符合性确认-责任人id*/ - @ApiModelProperty(value = "验证符合性确认-责任人id") - //@TableField(updateStrategy = FieldStrategy.IGNORED) - private String verifyDutyId; - - /**验证符合性确认-责任人名称*/ - @Excel(name = "责任人", width = 20,groupName = "验证符合性确认") - @TableField(exist = false) - private String verifyDutyIdName; - - /**验证符合性确认-截止时间*/ - @Excel(name = "截止时间", width = 20, format = "yyyy-MM-dd",groupName = "验证符合性确认") - @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd") - @DateTimeFormat(pattern="yyyy-MM-dd") - @ApiModelProperty(value = "验证符合性确认-截止时间") - //@TableField(updateStrategy = FieldStrategy.IGNORED) - private Date verifyDueDate; - @TableField(exist = false) - private String verifyDueDateString; - - //验证备注 - @Excel(name = "交付物说明", width = 20,groupName = "验证符合性确认") - private String verifyRemark; - - @TableField(exist = false) - @ApiModelProperty(value = "角色代码") - private String roleCode;//角色代码 - @TableField(exist = false) - @ApiModelProperty(value = "角色名称") - private String roleName;//角色名称 - - - /**法规工程师提交状态 :0通过 1驳回 */ - @ApiModelProperty(value = "法规工程师提交状态") -// @TableField(updateStrategy = FieldStrategy.IGNORED) - private String regulationOwnerSubmitStatus; - //这两个只要有一个是拒绝 那么该数据的清单确认状态就为拒绝 - /**认证工程师提交状态 :0通过 1驳回 */ - @ApiModelProperty(value = "认证工程师提交状态") -// @TableField(updateStrategy = FieldStrategy.IGNORED) - private String homologationEngineerSubmitStatus; - - @TableField(exist = false) - @ApiModelProperty(value = "文档库id") - private String ids;//文档库id 多个之间用英文逗号拼接 - - /**清单确认-截止时间*/ - @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd") - @DateTimeFormat(pattern="yyyy-MM-dd") - @ApiModelProperty(value = "清单确认-截止时间") - private Date inventoryAffirmDueDate; - - /**任务确认-截止时间*/ - @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd") - @DateTimeFormat(pattern="yyyy-MM-dd") - @ApiModelProperty(value = "任务确认-截止时间") - private Date taskAffirmDueDate; - - /**发送消息标识 三天*/ - @ApiModelProperty(value = "发送消息标识 三天") - private String sendMsgFlag; - - /**发送消息标识 结束当天*/ - @ApiModelProperty(value = "发送消息标识 结束当天") - private String sendMsgCurrentFlag; - - @TableField(exist = false) - @ApiModelProperty(value = "中英文切换标识") - private String cut; - - @TableField(exist = false) - @ApiModelProperty(value = "虚拟清单iD") - private String dummyInventoryBaseId; - - //flag为空时第一次调取,flag不为空时,为二次确认 - @TableField(exist = false) - @ApiModelProperty(value = "调取虚拟清单,虚拟清单中维护数据为空时,进行二次确认") - private String flag; - - @ApiModelProperty(value = "报告id") - private String fileId; - - @ApiModelProperty(value = "文档库id/标准id") - private String standId; - - @TableField(exist = false) - @ApiModelProperty(value = "调取虚拟清单中文档ids") - private String dummyids;//调取虚拟清单中文档ids - - //排序(1->正序, 2->倒序) - @TableField(exist = false) - private String orderBy; - - //排序字段 - @TableField(exist = false) - private String orderByField; - - @ApiModelProperty(value = "导出的excel的名称") - @TableField(exist = false) - private String excelName; - - /**设计符合性确认-流程状态*/ - @ApiModelProperty(value = "设计符合性确认-流程状态") - private String designFlowStatus; - @TableField(exist = false) - @Excel(name = "流程状态", width = 20,groupName = "设计符合性确认") - private String designFlowStatusName; - - /**验证符合性确认-流程状态*/ - @ApiModelProperty(value = "验证符合性确认-流程状态") - private String verifyFlowStatus; - @TableField(exist = false) - @Excel(name = "流程状态", width = 20,groupName = "验证符合性确认") - private String verifyFlowStatusName; - - /**验证符合性确认-流程实例id*/ - @TableField(exist = false) - private String verifyPId; - - /**设计符合性确认-流程实例id*/ - @TableField(exist = false) - private String designPId; - - /**流程结束时间 最后的时间*/ - @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss") - @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") - @ApiModelProperty(value = "流程结束时间 最后的时间") - private Date processEndTime; - - /**设计符合性确认-责任确认截止时间*/ - @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd") - @DateTimeFormat(pattern="yyyy-MM-dd") - @ApiModelProperty(value = "设计符合性确认-责任确认截止时间") - private Date designDutyDueDate; - /**验证符合性确认-责任确认截止时间*/ - @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd") - @DateTimeFormat(pattern="yyyy-MM-dd") - @ApiModelProperty(value = "验证符合性确认-责任确认截止时间") - private Date verifyDutyDueDate; - - /**流程类型*/ - @TableField(exist = false) - private String flowType; - - /**流程类型展示名称*/ - @TableField(exist = false) - private String flowTypeName; - - /**一级责任领域**/ - @TableField(exist = false) - private String firstLevelDutyTerritory; -} diff --git a/laws-modules/src/main/java/com/jero/modules/searchcenter/enums/ModuleTypeFlagEnum.java b/laws-modules/src/main/java/com/jero/modules/searchcenter/enums/ModuleTypeFlagEnum.java deleted file mode 100644 index fd9c7f0e..00000000 --- a/laws-modules/src/main/java/com/jero/modules/searchcenter/enums/ModuleTypeFlagEnum.java +++ /dev/null @@ -1,31 +0,0 @@ -package com.jero.modules.searchcenter.enums; - -public enum ModuleTypeFlagEnum { - DOCUMENT_LIBRARY("文档库","WDK"), - LAWS_MONTHLY_REPORT("法规月报","FGYB"), - PROBLEM_KNOWLEDGE_BASE_CLASSIFY("知识分享","WTZSK"); - - String name; - String value; - - private ModuleTypeFlagEnum(String name, String value) { - this.name = name; - this.value = value; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getValue() { - return value; - } - - public void setValue(String value) { - this.value = value; - } -} diff --git a/laws-modules/src/main/java/com/jero/modules/split/common/FileUnZip.java b/laws-modules/src/main/java/com/jero/modules/split/common/FileUnZip.java index 69bbff14..d23528bd 100644 --- a/laws-modules/src/main/java/com/jero/modules/split/common/FileUnZip.java +++ b/laws-modules/src/main/java/com/jero/modules/split/common/FileUnZip.java @@ -1,7 +1,6 @@ package com.jero.modules.split.common; import com.jero.common.constant.enums.LanguageEnum; -import com.jero.modules.project.entity.ProjectLawsInventoryEO; import com.xkcoding.http.util.StringUtil; import org.apache.commons.lang3.StringUtils; import org.apache.tools.zip.ZipEntry; @@ -166,69 +165,6 @@ public class FileUnZip { return resultlist; } - /** - * 根据文件名称读取固定目录下文件 - * 适用范围:filename内容 dir/file - * gaoyan - * @param filename - */ - public static List readFileByFilenameDataList(String path, - String filename, - String cut, - String errorMsg, - List msgList, - String nameCn, - String nameEn, - ProjectLawsInventoryEO projectLawsInventoryEO) { - //法规清单列表数据导入的时候,交付物模板字段为文件属性,填写时需要在本文件同级目录下以标准号为名称建立文件夹,并在文件夹下放置文件,假设在AAA标准号下放置了B.docx,则应填写AAA/B.docx - filename = projectLawsInventoryEO.getSerialNumber()+"/"+filename; - String filenameOne = ""; - String filenameTwo = ""; - if(filename.contains("/")){ - filenameOne = filename.split("/")[0]; - filenameTwo = filename.split("/")[1]; - } - List resultlist = new ArrayList<>(); - if (StringUtil.isNotEmpty(path)){ - File file = new File(path); - if (file.isDirectory()) { - File[] files = file.listFiles(); - for (File fi : files) { - if(fi.isDirectory()){ - File[] filesTemp = fi.listFiles(); - for (File fileTemp : filesTemp) { - // 对文件进行过滤 - if (fileTemp.getName().equals(filenameTwo) && fi.getName().equals(filenameOne) && StringUtils.isNotBlank(filenameOne)) { - resultlist.add(fileTemp); - } - } - }else{ - // 对文件进行过滤 - if (fi.getName().equals(filenameTwo) && fi.getPath().contains(filenameOne) && StringUtils.isNotBlank(filenameOne)) { - resultlist.add(fi); - } - } - } - } - } - if(resultlist.size() == 0){ - String name = ""; - if(filename.contains("/")){ - name = filenameTwo; - }else{ - name = filename; - } - if(LanguageEnum.CN.getValue().equals(cut)){ - errorMsg += nameCn + name + "格式不正确或者压缩包中没有" + name + "文件,请参考模板下载中的说明"; - }else{ - errorMsg += nameEn + name + " Incorrect format or not present in compressed package " + name + " file please refer to the description in template download;"; - } - if(msgList != null){ - msgList.add(errorMsg); - } - } - return resultlist; - } /** * 根据文件名称读取固定目录下文件 * 适用范围:filename内容 dir/file diff --git a/laws-modules/src/main/java/com/jero/modules/split/controller/SarFileSplitInfoController.java b/laws-modules/src/main/java/com/jero/modules/split/controller/SarFileSplitInfoController.java index 963aa409..51fd509c 100644 --- a/laws-modules/src/main/java/com/jero/modules/split/controller/SarFileSplitInfoController.java +++ b/laws-modules/src/main/java/com/jero/modules/split/controller/SarFileSplitInfoController.java @@ -1,20 +1,16 @@ package com.jero.modules.split.controller; -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.jero.common.api.vo.Result; import com.jero.common.aspect.annotation.AutoLog; import com.jero.common.constant.enums.LanguageEnum; -import com.jero.common.exception.JeroBootException; import com.jero.common.system.base.controller.JeroController; +import com.jero.common.util.LineHumpUtil; import com.jero.modules.document.service.IBussDocumentLibraryEOService; -import com.jero.modules.laws.common.constant.ResultCommon; -import com.jero.modules.ocr.util.LineHumpUtil; import com.jero.modules.oss.entity.OSSFile; import com.jero.modules.oss.service.IOSSFileService; -import com.jero.modules.oss.service.impl.OSSFileServiceImpl; import com.jero.modules.split.entity.SarFileSplitInfoEO; import com.jero.modules.split.page.SarFileSplitInfoEOPage; import com.jero.modules.split.service.ISarFileSplitInfoService; diff --git a/laws-modules/src/main/java/com/jero/modules/split/service/impl/FileSpiltService.java b/laws-modules/src/main/java/com/jero/modules/split/service/impl/FileSpiltService.java index e8f72455..847ed82b 100644 --- a/laws-modules/src/main/java/com/jero/modules/split/service/impl/FileSpiltService.java +++ b/laws-modules/src/main/java/com/jero/modules/split/service/impl/FileSpiltService.java @@ -6,7 +6,7 @@ import com.itextpdf.text.ListLabel; import com.jero.common.exception.JeroBootException; import com.jero.common.system.vo.LoginUser; import com.jero.common.util.MinioUtil; -import com.jero.modules.ocr.util.UUIDUtils; +import com.jero.common.util.UUIDUtils; import com.jero.modules.oss.entity.OSSFile; import com.jero.modules.oss.service.IOSSFileService; import com.jero.modules.split.entity.*; 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 59936e58..01b501e2 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 @@ -19,11 +19,11 @@ import com.jero.common.exception.JeroBootException; 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.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.ocr.util.UUIDUtils; import com.jero.modules.oss.entity.OSSFile; import com.jero.modules.oss.service.IOSSFileService; import com.jero.modules.split.common.ConvertHtml2Excel; diff --git a/laws-modules/src/main/java/com/jero/modules/split/service/impl/FileSplitPdfService.java b/laws-modules/src/main/java/com/jero/modules/split/service/impl/FileSplitPdfService.java index 19746bbe..4ffcec9d 100644 --- a/laws-modules/src/main/java/com/jero/modules/split/service/impl/FileSplitPdfService.java +++ b/laws-modules/src/main/java/com/jero/modules/split/service/impl/FileSplitPdfService.java @@ -1,25 +1,8 @@ package com.jero.modules.split.service.impl; -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.jero.common.exception.JeroBootException; -import com.jero.common.util.MinioUtil; -import com.jero.modules.document.utils.ReadPdfUtil; -import com.jero.modules.ocr.util.UUIDUtils; -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; -import com.jero.modules.split.entity.SarFileSplitItemsValEO; -import com.jero.modules.split.entity.SarFileSplitMenuEO; -import com.jero.modules.split.enums.SplitFileTypeTypeEnum; -import com.jero.modules.split.mapper.SarFileSplitMenuEOMapper; -import com.jero.modules.split.service.IFileSplitItemsEOService; -import com.jero.modules.split.service.ISarFileSplitItemsValEOService; -import com.jero.modules.split.util.FileSplitUtils; -import org.apache.commons.collections4.CollectionUtils; + import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Propagation; import org.springframework.transaction.annotation.Transactional; diff --git a/laws-modules/src/main/java/com/jero/modules/split/service/impl/SarFileSplitInfoServiceImpl.java b/laws-modules/src/main/java/com/jero/modules/split/service/impl/SarFileSplitInfoServiceImpl.java index 9c80715d..d5787dbd 100644 --- a/laws-modules/src/main/java/com/jero/modules/split/service/impl/SarFileSplitInfoServiceImpl.java +++ b/laws-modules/src/main/java/com/jero/modules/split/service/impl/SarFileSplitInfoServiceImpl.java @@ -11,6 +11,7 @@ import com.jero.common.constant.enums.ModuleEnum; import com.jero.common.constant.enums.YesOrNoEnum; import com.jero.common.exception.JeroBootException; import com.jero.common.system.vo.DictModel; +import com.jero.common.util.LineHumpUtil; import com.jero.common.util.MessageUtils; import com.jero.generater.modules.online.cgform.entity.OnlCgformField; import com.jero.generater.modules.online.cgform.service.impl.OnlCgformFieldServiceImpl; @@ -20,8 +21,6 @@ import com.jero.modules.laws.standard.entity.LawsDomesticStandard; import com.jero.modules.laws.standard.entity.LawsEnterpriseStandard; import com.jero.modules.laws.standard.service.ILawsDomesticStandardService; import com.jero.modules.laws.standard.service.ILawsEnterpriseStandardService; -import com.jero.modules.laws.standard.service.ILawsOverseasStandardService; -import com.jero.modules.ocr.util.LineHumpUtil; import com.jero.modules.oss.entity.OSSFile; import com.jero.modules.oss.service.IOSSFileService; import com.jero.modules.split.entity.SarFileSplitInfoEO;