From 83f6ca026ccd7d7999e20a4d437705e8f34f84c1 Mon Sep 17 00:00:00 2001 From: "youhong.ai" Date: Tue, 18 Jul 2023 11:38:06 +0800 Subject: [PATCH] =?UTF-8?q?=E8=87=AA=E5=8A=A8=E6=89=93=E5=8C=85=E4=BC=98?= =?UTF-8?q?=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 8 +- .../api/test/aiyh/controller/TestServlet.java | 34 ++ .../controller/SsoLoginAuthController.java | 40 ++ .../controller/WorkflowTaskController.java | 42 ++ .../todolist/mapper/WorkflowTaskMapper.java | 20 + .../todolist/service/WorkflowTaskService.java | 23 + .../controller/ExamBtnControlController.java | 2 + .../service/ExamBtnControlService.java | 4 +- .../RequestFormServiceMultilingualImpl.java | 444 ++++++++++++++++++ .../java/builderpackage/FileTreeBuilder.java | 16 +- .../ai/pcn/multilingual/MultilingualTest.java | 68 +++ .../ai/pcn/multilingual/StringFinder.java | 2 + 12 files changed, 690 insertions(+), 13 deletions(-) create mode 100644 src/main/java/com/api/test/aiyh/controller/TestServlet.java create mode 100644 src/main/java/com/api/youhong/ai/guojun/sso/controller/SsoLoginAuthController.java create mode 100644 src/main/java/com/api/youhong/ai/guojun/todolist/controller/WorkflowTaskController.java create mode 100644 src/main/java/com/api/youhong/ai/guojun/todolist/mapper/WorkflowTaskMapper.java create mode 100644 src/main/java/com/api/youhong/ai/guojun/todolist/service/WorkflowTaskService.java create mode 100644 src/main/java/com/customization/youhong/pcn/datasmultilingual/impl/RequestFormServiceMultilingualImpl.java create mode 100644 src/test/java/youhong/ai/pcn/multilingual/MultilingualTest.java diff --git a/pom.xml b/pom.xml index 8509d5e..583e774 100644 --- a/pom.xml +++ b/pom.xml @@ -130,7 +130,13 @@ easypoi-annotation 4.0.0 - + + + javax.servlet + javax.servlet-api + 3.1.0 + + diff --git a/src/main/java/com/api/test/aiyh/controller/TestServlet.java b/src/main/java/com/api/test/aiyh/controller/TestServlet.java new file mode 100644 index 0000000..9525e65 --- /dev/null +++ b/src/main/java/com/api/test/aiyh/controller/TestServlet.java @@ -0,0 +1,34 @@ +package com.api.test.aiyh.controller; + +import aiyh.utils.ApiResult; + +import javax.servlet.ServletException; +import javax.servlet.annotation.WebServlet; +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import javax.ws.rs.core.MediaType; +import java.io.IOException; + +/** + *

ceshi servlet

+ * + *

create: 2023/7/18 10:36

+ * + * @author youHong.ai + */ +@WebServlet("/test/servlet/v1") +public class TestServlet extends HttpServlet { + + @Override + protected void doGet(HttpServletRequest req, HttpServletResponse res) throws IOException { + String success = ApiResult.success("成功!"); + res.setContentType(MediaType.APPLICATION_JSON + ";charset=utf-8"); + res.getWriter().write(success); + } + + @Override + protected void doPost(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { + super.doPost(req, res); + } +} diff --git a/src/main/java/com/api/youhong/ai/guojun/sso/controller/SsoLoginAuthController.java b/src/main/java/com/api/youhong/ai/guojun/sso/controller/SsoLoginAuthController.java new file mode 100644 index 0000000..179e6da --- /dev/null +++ b/src/main/java/com/api/youhong/ai/guojun/sso/controller/SsoLoginAuthController.java @@ -0,0 +1,40 @@ +package com.api.youhong.ai.guojun.sso.controller; + +import aiyh.utils.Util; +import com.sun.jersey.api.view.Viewable; +import org.apache.log4j.Logger; +import weaver.integration.util.SessionUtil; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import javax.ws.rs.GET; +import javax.ws.rs.Path; +import javax.ws.rs.QueryParam; +import javax.ws.rs.core.Context; + +/** + *

国泰君安期货poc阶段小程序集成认证

+ * + *

create: 2023/7/18 11:03

+ * + * @author youHong.ai + */ +@Path("aiyh/guojun/sso") +public class SsoLoginAuthController { + private final Logger log = Util.getLogger(); + + @GET + @Path("/auth") + public Viewable authSso(@Context HttpServletRequest request, @Context HttpServletResponse response, + @QueryParam("account") String account, + @QueryParam("redirectChannel") String redirectChannel) { + try { + String userId = Util.getCusConfigValue(account); + SessionUtil.createSession(userId, request, response); + response.sendRedirect(redirectChannel); + } catch (Exception e) { + log.error("认证失败:" + Util.getErrString(e)); + } + return null; + } +} diff --git a/src/main/java/com/api/youhong/ai/guojun/todolist/controller/WorkflowTaskController.java b/src/main/java/com/api/youhong/ai/guojun/todolist/controller/WorkflowTaskController.java new file mode 100644 index 0000000..7bb2d76 --- /dev/null +++ b/src/main/java/com/api/youhong/ai/guojun/todolist/controller/WorkflowTaskController.java @@ -0,0 +1,42 @@ +package com.api.youhong.ai.guojun.todolist.controller; + +import aiyh.utils.ApiResult; +import com.api.youhong.ai.guojun.todolist.service.WorkflowTaskService; +import weaver.hrm.HrmUserVarify; +import weaver.hrm.User; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import javax.ws.rs.Consumes; +import javax.ws.rs.GET; +import javax.ws.rs.Path; +import javax.ws.rs.Produces; +import javax.ws.rs.core.Context; +import javax.ws.rs.core.MediaType; + +/** + *

流程待办等信息

+ * + *

create: 2023/7/18 11:23

+ * + * @author youHong.ai + */ +@Path("/aiyh/guojun/workflow-task") +public class WorkflowTaskController { + + private final WorkflowTaskService service = new WorkflowTaskService(); + + @Path("/todo-list") + @GET + @Produces(MediaType.APPLICATION_JSON) + @Consumes(MediaType.APPLICATION_JSON) + public String getTodoList(@Context HttpServletRequest request, @Context HttpServletResponse response) { + + try { + User user = HrmUserVarify.getUser(request, response); + return ApiResult.success(service.getTodoList(user), 0, "成功"); + } catch (Exception e) { + return ApiResult.error(-1, "system error"); + } + } +} diff --git a/src/main/java/com/api/youhong/ai/guojun/todolist/mapper/WorkflowTaskMapper.java b/src/main/java/com/api/youhong/ai/guojun/todolist/mapper/WorkflowTaskMapper.java new file mode 100644 index 0000000..2d54e83 --- /dev/null +++ b/src/main/java/com/api/youhong/ai/guojun/todolist/mapper/WorkflowTaskMapper.java @@ -0,0 +1,20 @@ +package com.api.youhong.ai.guojun.todolist.mapper; + +import aiyh.utils.annotation.recordset.SqlMapper; + +import java.util.List; +import java.util.Map; + +/** + *

+ * + *

create: 2023/7/18 11:33

+ * + * @author youHong.ai + */ +@SqlMapper +public interface WorkflowTaskMapper { + + + List> selectTodoList(); +} diff --git a/src/main/java/com/api/youhong/ai/guojun/todolist/service/WorkflowTaskService.java b/src/main/java/com/api/youhong/ai/guojun/todolist/service/WorkflowTaskService.java new file mode 100644 index 0000000..ab3cc76 --- /dev/null +++ b/src/main/java/com/api/youhong/ai/guojun/todolist/service/WorkflowTaskService.java @@ -0,0 +1,23 @@ +package com.api.youhong.ai.guojun.todolist.service; + +import aiyh.utils.Util; +import com.api.youhong.ai.guojun.todolist.mapper.WorkflowTaskMapper; +import weaver.hrm.User; + +/** + *

+ * + *

create: 2023/7/18 11:29

+ * + * @author youHong.ai + */ +public class WorkflowTaskService { + + + private final WorkflowTaskMapper mapper = Util.getMapper(WorkflowTaskMapper.class); + + public Object getTodoList(User user) { + + return null; + } +} diff --git a/src/main/java/com/api/youhong/ai/pcn/examcontrol/controller/ExamBtnControlController.java b/src/main/java/com/api/youhong/ai/pcn/examcontrol/controller/ExamBtnControlController.java index 63b43f3..76e0634 100644 --- a/src/main/java/com/api/youhong/ai/pcn/examcontrol/controller/ExamBtnControlController.java +++ b/src/main/java/com/api/youhong/ai/pcn/examcontrol/controller/ExamBtnControlController.java @@ -44,6 +44,8 @@ public class ExamBtnControlController { @Consumes(MediaType.APPLICATION_JSON) public String isReadDoc(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody Map params) { + + try { User user = HrmUserVarify.getUser(request, response); return ApiResult.success(service.isReadDoc(user, params)); diff --git a/src/main/java/com/api/youhong/ai/pcn/examcontrol/service/ExamBtnControlService.java b/src/main/java/com/api/youhong/ai/pcn/examcontrol/service/ExamBtnControlService.java index 84630a5..f6de644 100644 --- a/src/main/java/com/api/youhong/ai/pcn/examcontrol/service/ExamBtnControlService.java +++ b/src/main/java/com/api/youhong/ai/pcn/examcontrol/service/ExamBtnControlService.java @@ -99,8 +99,8 @@ public class ExamBtnControlService { } // 循环对比 for (Map map : docInfo) { - String docId = Util.null2String(map.get(docIdField)); - String time = Util.null2String(map.get(timeField)); + String docId = Util.null2String(map.get("docId")); + String time = Util.null2String(map.get("readTime")); if (!readDocTime.containsKey(docId)) { return false; } diff --git a/src/main/java/com/customization/youhong/pcn/datasmultilingual/impl/RequestFormServiceMultilingualImpl.java b/src/main/java/com/customization/youhong/pcn/datasmultilingual/impl/RequestFormServiceMultilingualImpl.java new file mode 100644 index 0000000..7a6cfed --- /dev/null +++ b/src/main/java/com/customization/youhong/pcn/datasmultilingual/impl/RequestFormServiceMultilingualImpl.java @@ -0,0 +1,444 @@ +package com.customization.youhong.pcn.datasmultilingual.impl; + +import aiyh.utils.Util; +import aiyh.utils.tool.cn.hutool.core.collection.CollectionUtil; +import aiyh.utils.tool.cn.hutool.core.util.StrUtil; +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONObject; +import com.customization.youhong.pcn.datasmultilingual.MultilingualUtil; +import com.engine.common.constant.ParamConstant; +import com.engine.core.cfg.annotation.ServiceDynamicProxy; +import com.engine.core.impl.aop.AbstractServiceProxy; +import com.engine.workflow.entity.requestForm.AutoApproveEntity; +import com.engine.workflow.entity.requestForm.FieldValueBean; +import com.engine.workflow.service.RequestFormService; +import com.engine.workflow.service.impl.RequestFormServiceImpl; +import org.apache.log4j.Logger; +import weaver.hrm.HrmUserVarify; +import weaver.hrm.User; +import weaver.workflow.request.RequestManager; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.concurrent.ConcurrentHashMap; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +/** + *

多语言表单解析拦截

+ * + *

create: 2023/7/17 15:24

+ * + * @author youHong.ai + */ +@ServiceDynamicProxy(target = RequestFormServiceImpl.class, desc = "拦截解析多语言") +public class RequestFormServiceMultilingualImpl extends AbstractServiceProxy implements RequestFormService { + + private final Logger log = Util.getLogger(); + + private final Map ipLanguageMap = new ConcurrentHashMap<>(); + + private final String startPattern = "~`~`"; + private final String endPattern = "`~`~"; + + @Override + public Map judgeCreateRight(HttpServletRequest request) { + return null; + } + + @Override + public String loadForm(HttpServletRequest request) { + String o = (String) executeMethod(request); + log.info("加载主表数据信息:" + JSON.toJSONString(o)); + try { + User user = HrmUserVarify.getUser(request, null); + String ipAddr = Util.getIpAddr(request); + ipLanguageMap.put(ipAddr, user.getUID()); + JSONObject jsonObject = JSON.parseObject(o); + Object mainData = jsonObject.get("maindata"); + if (Objects.isNull(mainData)) { + return o; + } + String mainDataStr = JSON.toJSONString(mainData); + + // 构建正则表达式模式 + String pattern = Pattern.quote(startPattern) + "(.*?)" + Pattern.quote(endPattern); + Pattern regex = Pattern.compile(pattern); + Matcher matcher = regex.matcher(mainDataStr); + List valueList = new ArrayList<>(); + while (matcher.find()) { + String multilingualStr = matcher.group(1); + Map languageMap = MultilingualUtil.getLanguageMap(multilingualStr); + String value = languageMap.get(user.getLanguage()); + valueList.add(value); + } + if (CollectionUtil.isEmpty(valueList)) { + return o; + } + for (String value : valueList) { + mainDataStr = mainDataStr.replaceFirst(pattern, value); + } + jsonObject.put("maindata", mainDataStr); + return jsonObject.toJSONString(); + } catch (Exception e) { + log.error("解析转换失败:" + Util.getErrString(e)); + } + return o; + } + + @Override + public String loadPreView(Map map) { + return null; + } + + @Override + public Map loadDetailData(Map map) { + Map o = (Map) executeMethod(map); + log.info("加载明细数据信息:" + JSON.toJSONString(o)); + try { + String ip = Util.null2String(o.get(ParamConstant.PARAM_IP)); + Integer languageId = ipLanguageMap.get(ip); + for (Map.Entry entry : o.entrySet()) { + Object value = entry.getValue(); + if (value instanceof Map) { + Map valueMap = (Map) value; + for (Map.Entry valueEntry : valueMap.entrySet()) { + Object filed = valueEntry.getValue(); + if (filed instanceof FieldValueBean) { + FieldValueBean filedValueBean = (FieldValueBean) filed; + String filedValue = filedValueBean.getValue(); + String multilingualStr = MultilingualUtil.findString(filedValue, startPattern, endPattern); + if (StrUtil.isNotBlank(multilingualStr)) { + Map languageMap = MultilingualUtil.getLanguageMap(multilingualStr); + String parseValue = languageMap.get(languageId); + filedValueBean.setValue(parseValue); + } + } + } + } + } + } catch (Exception e) { + log.error("解析转换明细失败:" + Util.getErrString(e)); + } + return o; + } + + @Override + public Map saveDetailPaging(Map params) { + return null; + } + + @Override + public Map copyCustomPageFile(String custompage) { + return null; + } + + @Override + public Map updateReqInfo(HttpServletRequest request) { + return null; + } + + @Override + public Map getLinkageResult(HttpServletRequest request, String type) { + return null; + } + + @Override + public Map getRightMenu(HttpServletRequest httpServletRequest, Map map) { + return null; + } + + @Override + public Map getStatusData(Map params) { + return null; + } + + @Override + public Map getStatusCount(Map params) { + return null; + } + + @Override + public Map getResourcesKey(Map params) { + return null; + } + + @Override + public Map getModifyLog(HttpServletRequest request) { + return null; + } + + @Override + public Map requestBatchSubmit(HttpServletRequest request) { + return null; + } + + @Override + public Map judgeRejectWay(HttpServletRequest request) { + return null; + } + + @Override + public Map getRejectOption(Map params) { + return null; + } + + @Override + public Map requestSubmit(HttpServletRequest request) { + return null; + } + + @Override + public Map forwardSubmit(HttpServletRequest request) { + return null; + } + + @Override + public Map requestWithdraw(HttpServletRequest httpServletRequest) { + return null; + } + + @Override + public Map remarkSubmit(HttpServletRequest request) { + return null; + } + + @Override + public Map functionManage(HttpServletRequest request, HttpServletResponse response) { + return null; + } + + @Override + public Map triggerSubWf(HttpServletRequest request) { + return null; + } + + @Override + public Map uploadFile(HttpServletRequest request, HttpServletResponse response) { + return null; + } + + @Override + public Map getFileFieldObj(Map params) { + return null; + } + + @Override + public Map createWfCode(Map params) { + return null; + } + + @Override + public Map getWfCodeFieldValue(Map params) { + return null; + } + + @Override + public Map requestImport(Map params) { + return null; + } + + @Override + public Map requestDetailImport(HttpServletRequest request) { + return null; + } + + @Override + public Map chooseExceptionOperator(Map params) { + return null; + } + + @Override + public Map overTimeSetting(HttpServletRequest request) { + return null; + } + + @Override + public Map getPrintLogBase(Map params) { + return null; + } + + @Override + public Map getPrintLogData(Map params) { + return null; + } + + @Override + public Map freeFlowRead(Map params) { + return null; + } + + @Override + public Map freeFlowSave(Map params) { + return null; + } + + @Override + public Map editLockOper(Map params) { + return null; + } + + @Override + public Map loadPrintTemplates(Map params) { + return null; + } + + @Override + public Map doEvalExpression(Map params) { + return null; + } + + @Override + public Map generatePrintLog(HttpServletRequest request) { + return null; + } + + @Override + public Map getForwardDatas(Map params) { + return null; + } + + @Override + public Map doBack(Map params) { + return null; + } + + @Override + public Map getFormTab(Map params) { + return null; + } + + @Override + public Map getSelectNextFlowCondition(Map params) { + return null; + } + + @Override + public Map getSelectNextFlowNodes(Map params) { + return null; + } + + @Override + public Map getRemindData(Map params) { + return null; + } + + @Override + public Map judgeRequestIsValid(Map map) { + return null; + } + + @Override + public Map takeBack(Map map) { + return null; + } + + @Override + public Map getCustomOperation(Map map) { + return null; + } + + @Override + public Map runCustomOperationAction(Map map) { + return null; + } + + @Override + public Map JudgeAutoApprove(AutoApproveEntity autoApproveEntity) { + return null; + } + + @Override + public Map delApproveLog(AutoApproveEntity autoApproveEntity) { + return null; + } + + @Override + public Map verifyRequestForView(Map map) { + return null; + } + + @Override + public Map doTakEnd(HttpServletRequest httpServletRequest, Map map) { + return null; + } + + @Override + public Map importFieldLinkageCfg(Map map) { + return null; + } + + @Override + public Map importFormulaCfg(Map map) { + return null; + } + + @Override + public Map getDetailDataKeyId(Map map) { + return null; + } + + @Override + public Map judgeWorkflowPenetrate(AutoApproveEntity autoApproveEntity, RequestManager requestManager) { + return null; + } + + @Override + public Map getThPreviewUrl(Map map) { + return null; + } + + @Override + public Map getThMouldList(Map map) { + return null; + } + + @Override + public Map getDetailExpSet(Map map) { + return null; + } + + @Override + public Map saveDetailExpSet(Map map) { + return null; + } + + @Override + public Map exportFieldSet(Map map) { + return null; + } + + @Override + public Map getNextNodeContent(Map map) { + return null; + } + + @Override + public Map delRequestVerify(Map map) { + return null; + } + + @Override + public Map getFreeNodeBrowserItem(Map map) { + return null; + } + + @Override + public Map saveFreeNodeFormConfig(Map map) { + return null; + } + + @Override + public Map conformCheck(Map map) { + return null; + } + + @Override + public Map getDetailByRequestId(Map map) { + return null; + } +} diff --git a/src/test/java/builderpackage/FileTreeBuilder.java b/src/test/java/builderpackage/FileTreeBuilder.java index 1c964e4..ddc0ded 100644 --- a/src/test/java/builderpackage/FileTreeBuilder.java +++ b/src/test/java/builderpackage/FileTreeBuilder.java @@ -2,8 +2,6 @@ package builderpackage; import aiyh.utils.excention.CustomerException; import aiyh.utils.tool.cn.hutool.core.util.StrUtil; -import org.apache.commons.lang3.StringUtils; -import weaver.common.util.string.StringUtil; import java.io.*; import java.nio.charset.StandardCharsets; @@ -11,8 +9,8 @@ import java.util.*; public class FileTreeBuilder { - public static final String DIRECTORY_TYPE = "文件夹"; - public static final String FILE_TYPE = "文件"; + public static final String DIRECTORY_TYPE = "folder"; + public static final String FILE_TYPE = "file"; public static String targetPath; @@ -21,7 +19,7 @@ public class FileTreeBuilder { public static String zipDefaultName; public static String defaultDir; - + public static String cusDateFormat; public static FileInfo buildFileTree() { @@ -55,7 +53,7 @@ public class FileTreeBuilder { zipDefaultName = properties.getProperty("zipDefaultName"); defaultDir = properties.getProperty("defaultDir"); cusDateFormat = properties.getProperty("cusDateFormat"); - if(StrUtil.isBlank(cusDateFormat)){ + if (StrUtil.isBlank(cusDateFormat)) { cusDateFormat = "yyyyMMdd"; } List blacklistPrefixes = Arrays.asList( @@ -94,12 +92,11 @@ public class FileTreeBuilder { private static FileInfo buildFileTreeRecursively(File directory, List blacklistPrefixes) { String filePath = directory.getAbsolutePath(); String fileName = directory.getName(); - String fileType = DIRECTORY_TYPE; boolean isSelected = false; FileInfo fileInfo = new FileInfo(); fileInfo.setFilePath(filePath); fileInfo.setFileName(fileName); - fileInfo.setFileType(fileType); + fileInfo.setFileType(DIRECTORY_TYPE); fileInfo.setSelected(isSelected); File[] files = directory.listFiles(); if (files != null) { @@ -115,12 +112,11 @@ public class FileTreeBuilder { } String childFilePath = file.getAbsolutePath(); String childFileName = file.getName(); - String childFileType = FILE_TYPE; boolean childIsSelected = false; FileInfo childFileInfo = new FileInfo(); childFileInfo.setFilePath(childFilePath); childFileInfo.setFileName(childFileName); - childFileInfo.setFileType(childFileType); + childFileInfo.setFileType(FILE_TYPE); childFileInfo.setSelected(childIsSelected); fileInfo.addChild(childFileInfo); } diff --git a/src/test/java/youhong/ai/pcn/multilingual/MultilingualTest.java b/src/test/java/youhong/ai/pcn/multilingual/MultilingualTest.java new file mode 100644 index 0000000..e8a7695 --- /dev/null +++ b/src/test/java/youhong/ai/pcn/multilingual/MultilingualTest.java @@ -0,0 +1,68 @@ +package youhong.ai.pcn.multilingual; + +import basetest.BaseTest; +import org.junit.Test; + +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +/** + *

ceshi

+ * + *

create: 2023/7/17 15:48

+ * + * @author youHong.ai + */ +public class MultilingualTest extends BaseTest { + + + @Test + public void test() { + String mainDataStr = "{\n" + + " \"detail_1\":\n" + + " {\n" + + " \"indexnum\": 1,\n" + + " \"rowDatas\":\n" + + " {\n" + + " \"row_0\":\n" + + " {\n" + + " \"field24478\":\n" + + " {\n" + + " \"value\": \"A:\\nB:\\nC:\\nD:\"\n" + + " },\n" + + " \"field24632\":\n" + + " {\n" + + " \"value\": \"\"\n" + + " },\n" + + " \"field24631\":\n" + + " {\n" + + " \"value\": \"~`~`7当与商业伙伴、客户或第三方打交道时,必须避免留下任何保时捷进行不寻常的业务实践或有针对性的措施以对业务决策施加不公平的影响的印象。因此,如果向商业伙伴、客户或第三方提供/收取的利益不符合以下容许标准,或者发现给予方的动机不纯正时,则不得寻求或鼓励、且应拒绝从商业伙伴、客户或第三方那里获得或向其提供利益。\\n(1) 无(潜在)利益冲突:根据员工和直线经理的评估,以及经咨询集团或本地合规咨询平台(如适用),提供或收取利益不构成利益冲突。\\n(2) 不得给予好处:不得采取意在影响商业决策或获得对价、超出内部批准的促销或客户保留措施、无法被定义为一般商业惯例或显示不公平的动机的措施。\\n(3) 非关键时刻:不得于例如招标邀请时、合同谈判和谈判结束时或进行业务关系审计时(或于接近的时间)收取或提供利益。\\n(4) 适当价值:利益应当有符合社交的适当需要(即利益价值应当与接收者或提供者的生活水平相符),或符合第三方的惯例(即与行业水平相当或是在相关措施的背景下)。且遵守礼物的价格限额:每份礼物为800元人民币(税前)或每一项邀请为1600元人民币(税前)。提供或接受的邀请,主办方代表应同样参加。\\n(5) 不得形成固定惯例:利益不得由同一人定期地或频繁地收取或提供,即,每个商业伙伴,一年之内,仅限一份总价值为800元人民币的礼物或两份总价值不超过800元人民币的礼物。\\n(6) 非私人场合:应在商业背景下,而非私人活动(例如生日或婚礼)的场合中提供或接受利益。\\n(7) 批准:在上述容许范围内向商业伙伴、客户或第三方收取或提供利益前需获得直线经理的批准。任何上述容许范围的例外情形及提供给或自政府工作人员收取的利益必须由合规咨询平台检查和批准。`~`8When dealing with Business Partners, Customers or Third Parties, it is essential to avoid any impression that PCN engages in unusual business practices or targeted measures to exercise unfair influence on business decisions. Therefore, benefits from / to Business Partners, Customers or Third Parties must not be solicited or encouraged but should be rejected, if these are not in accordance with the following admissibility criteria or if unfair motivation of the giver is identified.\\n(1) No (potential) conflict of interest: On the basis of the assessment by the employee and the Line Manager and, if applicable, after consultation with the central or local Compliance Helpdesk, granting or accepting the benefit does not cause a Conflict of Interest.\\n(2) No granting of advantages: No measures have been taken which are specifically intended to influence a business decision or in the expectation of consideration, which either exceed an internally approved sales promotion or customer retention measures, which cannot be regarded as customary business practice, or which reveals an unfair motivation.\\n(3) No critical timing: Benefits are not granted or accepted in connection with (or close in time to), for instance, an invitation of tender, contract negotiations and the conclusion of such negotiations or auditing the business relationship.\\n(4) Appropriate value: Benefits are socially appropriate (i.e. the value of the benefit is consistent with the standard of living of the recipient or giver) or customary among Third Parties (i.e. comparable in the industry or in the context of the measure) and stay within the value limits for gifts of RMB 800 (pre-tax) per gift or RMB 1600 (pre-tax) per invitation. An invitation should only be granted or accepted if the host's representative(s) participate in the event.\\n(5) Not applied practice: The benefits are not granted or accepted by the same person on a regular or frequent basis, i.e. only one gift with a total value of RMB 800 or two gifts up to a maximum limit of RMB 800 per Business Partner per year are permitted.\\n(6) No personal occasion: Benefits are granted or accepted in a business context and not on the occasion of a personal event such as a birthday or a wedding.\\n(7) Approval: Benefits to/from Business Partner(s) or from Customers or Third Parties within the above mentioned admissibility criteria must be checked and approved by the Line Manager. Exceptions to the above admissibility criteria and benefits to/from Public Official(s) must be checked and approved by the Compliance Helpdesk.`~`~\"\n" + + " },\n" + + " \"field24629\":\n" + + " {\n" + + " \"value\": \"当与商业伙伴、客户或第三方打交道时,必须避免留下任何保时捷进行不寻常的业务实践或有针对性的措施以对业务决策施加不公平的影响的印象。因此,如果向商业伙伴、客户或第三方提供/收取的利益不符合以下容许标准,或者发现给予方的动机不纯正时,则不得寻求或鼓励、且应拒绝从商业伙伴、客户或第三方那里获得或向其提供利益。\\n(1) 无(潜在)利益冲突:根据员工和直线经理的评估,以及经咨询集团或本地合规咨询平台(如适用),提供或收取利益不构成利益冲突。\\n(2) 不得给予好处:不得采取意在影响商业决策或获得对价、超出内部批准的促销或客户保留措施、无法被定义为一般商业惯例或显示不公平的动机的措施。\\n(3) 非关键时刻:不得于例如招标邀请时、合同谈判和谈判结束时或进行业务关系审计时(或于接近的时间)收取或提供利益。\\n(4) 适当价值:利益应当有符合社交的适当需要(即利益价值应当与接收者或提供者的生活水平相符),或符合第三方的惯例(即与行业水平相当或是在相关措施的背景下)。且遵守礼物的价格限额:每份礼物为800元人民币(税前)或每一项邀请为1600元人民币(税前)。提供或接受的邀请,主办方代表应同样参加。\\n(5) 不得形成固定惯例:利益不得由同一人定期地或频繁地收取或提供,即,每个商业伙伴,一年之内,仅限一份总价值为800元人民币的礼物或两份总价值不超过800元人民币的礼物。\\n(6) 非私人场合:应在商业背景下,而非私人活动(例如生日或婚礼)的场合中提供或接受利益。\\n(7) 批准:在上述容许范围内向商业伙伴、客户或第三方收取或提供利益前需获得直线经理的批准。任何上述容许范围的例外情形及提供给或自政府工作人员收取的利益必须由合规咨询平台检查和批准。\"\n" + + " },\n" + + " \"field24631\":\n" + + " {\n" + + " \"value\": \"~`~`7当与商业伙伴、客户或第三方打交道时,益不符合以下容许标准,或者发现给予方益冲突:根据员工和直线经理的评估,以及得给予好处:近的时间)收取或提供利益。\\n(4) 适当价值:利益应当有符合社交的适当需要(即利益价值应当与接收者或提供者的生活水平相符),或符合第三方的惯例(即与行业水平相当或是在相关措施的背景下)。且遵守礼物的价格限额:每份礼物为台检查和批准。`~`8When dealing with Business Partners, Customers or Third Parties, it is essential to avoid any impression that PCN engages in unusual business practices or targeted measures to exercise unfair influence on business decisions. Therefore, benefits from / to Business Partners, Customers or Thirdmer retention measures, which cannot be regarded as customary business practice, or which reveals an unfair motivation.\\n(3) No critical timing: Benefits are not granted or accepted in connection with (or close in time to), for instance, an invitation of tender, contract negotiations and the conclusion of such negotiations or auditing the business relationship.\\n(4) Appropriate value: Benefits are socially appropriate (i.e. the value of the benefit is consistent with the standard of living of the recipient or giver) or customary among Third Parties (i.e. comparable in the industry or in the context of the measure) and stay within the value limits for gifts of RMB 800 (pre-tax) per gift or RMB 1600 (pre-tax) per invitation. An invitation should only be granted or accepted if the host's representative(s) participate in the event.\\n(5) Not applied practice: The benefits are not granted or accepted by the same person on a regular or frequent basis, i.e. only one gift with a total value of RMB 800 or two gifts up to a maximum limit of RMB 800 per Business Partner per year are permitted.\\n(6) No ps to/from Public Official(s) must be checked and approved by the Compliance Helpdesk.`~`~\"\n" + + " },\n" + + " \"keyid\": 65,\n" + + " \"field24476\":\n" + + " {\n" + + " \"value\": \"When dealing with Business Partners, Customers or Third Parties, it is essential to avoid any impression that PCN engages in unusual business practices or targeted measures to exercise unfair influence on business decisions. Therefore, benefits from / to Business Partners, Customers or Third Parties must not be solicited or encouraged but should be rejected, if these are not in accordance with the following admissibility criteria or if unfair motivation of the giver is identified.\\n(1) No (potential) conflict of interest: On the basis of the assessment by the employee and the Line Manager and, if applicable, after consultation with the central or local Compliance Helpdesk, granting or accepting the benefit does not cause a Conflict of Interest.\\n(2) No granting of advantages: No measures have been taken which are specifically intended to influence a business decision or in the expectation of consideration, which either exceed an internally approved sales promotion or customer retention measures, which cannot be regarded as customary business practice, or which reveals an unfair motivation.\\n(3) No critical timing: Benefits are not granted or accepted in connection with (or close in time to), for instance, an invitation of tender, contract negotiations and the conclusion of such negotiations or auditing the business relationship.\\n(4) Appropriate value: Benefits are socially appropriate (i.e. the value of the benefit is consistent with the standard of living of the recipient or giver) or customary among Third Parties (i.e. comparable in the industry or in the context of the measure) and stay within the value limits for gifts of RMB 800 (pre-tax) per gift or RMB 1600 (pre-tax) per invitation. An invitation should only be granted or accepted if the host's representative(s) participate in the event.\\n(5) Not applied practice: The benefits are not granted or accepted by the same person on a regular or frequent basis, i.e. only one gift with a total value of RMB 800 or two gifts up to a maximum limit of RMB 800 per Business Partner per year are permitted.\\n(6) No personal occasion: Benefits are granted or accepted in a business context and not on the occasion of a personal event such as a birthday or a wedding.\\n(7) Approval: Benefits to/from Business Partner(s) or from Customers or Third Parties within the above mentioned admissibility criteria must be checked and approved by the Line Manager. Exceptions to the above admissibility criteria and benefits to/from Public Official(s) must be checked and approved by the Compliance Helpdesk.\"\n" + + " }\n" + + " }\n" + + " }\n" + + " }\n" + + "}"; + String startPattern = "~`~`"; + String endPattern = "`~`~"; + // 构建正则表达式模式 + String pattern = Pattern.quote(startPattern) + "(.*?)" + Pattern.quote(endPattern); + Pattern regex = Pattern.compile(pattern); + Matcher matcher = regex.matcher(mainDataStr); + while (matcher.find()) { + System.out.println(matcher.group(1)); + } + } +} diff --git a/src/test/java/youhong/ai/pcn/multilingual/StringFinder.java b/src/test/java/youhong/ai/pcn/multilingual/StringFinder.java index bd25064..0def2df 100644 --- a/src/test/java/youhong/ai/pcn/multilingual/StringFinder.java +++ b/src/test/java/youhong/ai/pcn/multilingual/StringFinder.java @@ -37,4 +37,6 @@ public class StringFinder { System.out.println(remainingString); } } + + }