From de37d6f4d2f0cebe141e5137097867d31bb171be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=84=E6=AD=A3=E5=9B=BD?= <438926402@qq.com> Date: Mon, 17 Nov 2025 10:18:53 +0800 Subject: [PATCH] =?UTF-8?q?2025-1-17=E7=A8=BB=E8=8A=B1=E9=A6=99=E6=B5=81?= =?UTF-8?q?=E7=A8=8B=E5=B9=B3=E5=8F=B0=E9=A1=B9=E7=9B=AE=E5=88=9D=E5=A7=8B?= =?UTF-8?q?=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- v5/apps-customize/pom.xml | 61 +++ v5/apps-customize/src/main/java/GitDiff.java | 111 +++++ .../src_flowbacklog/FlowBacklogPluginApi.java | 47 ++ .../constants/FlowConstants.java | 35 ++ .../listener/FlowEventListener.java | 186 +++++++ .../src_flowbacklog/sso/FlowBacklogsso.java | 58 +++ .../util/InterfaceListUtil.java | 223 +++++++++ .../apps/src_flowbacklog/util/ParamUtil.java | 91 ++++ .../vo/WaitingProcessingVo.java | 168 +++++++ .../PersonnelFlowPluginApi.java | 47 ++ .../config/PluginConfigProvider.java | 20 + .../constants/PersonnelFlowConstants.java | 42 ++ .../event/FVNewBackoutFlowCancelEvent.java | 134 +++++ .../OrganizationUnifyOnBeforeStartEvent.java | 132 +++++ .../event/PersonnelFlowCancelEvent.java | 129 +++++ .../node/AccountCloseCommonNode.java | 214 ++++++++ .../node/AccountCloseOrganizationNode.java | 146 ++++++ .../node/ApplyForFullMemberNode.java | 169 +++++++ .../node/LeaveAndBusinessTriNode.java | 170 +++++++ .../node/MemberInternalMobilizationNode.java | 130 +++++ .../MemberInternalMobilizationRecordNode.java | 210 ++++++++ .../node/MerchantCloseCommonNode.java | 213 ++++++++ .../node/MerchantCloseOrganizationNode.java | 141 ++++++ .../node/PersonnelInfoCommonNode.java | 167 +++++++ .../node/YdAccountCloseNode.java | 214 ++++++++ .../node/YdAccountOpenNode.java | 327 +++++++++++++ .../src_personnelflow/tool/HttpClient.java | 339 +++++++++++++ .../tool/HttpRequestUtils.java | 80 +++ .../src_personnelflow/tool/WeaverUtil.java | 152 ++++++ .../util/DataProcessingUtil.java | 53 ++ .../src_personnelflow/util/ParamUtil.java | 437 +++++++++++++++++ .../apps/src_personnelflow/util/ProtUtil.java | 461 ++++++++++++++++++ .../vo/MemberManagerResponse.java | 76 +++ .../seeyon/apps/src_qyba/FVCommonNode.java | 166 +++++++ .../apps/src_qyba/FVTongyongbeianNode.java | 136 ++++++ .../seeyon/apps/src_qyba/QYBAPluginApi.java | 40 ++ .../apps/src_qyba/constants/FVConstants.java | 46 ++ .../src_qyba/node/FVNewStateReturnNode.java | 30 ++ .../apps/src_qyba/node/FVNewZhengceNode.java | 30 ++ .../src_qyba/node/FVOldStateReturnNode.java | 30 ++ .../apps/src_qyba/node/FVOldZhengceNode.java | 30 ++ .../apps/src_qyba/service/FVService.java | 291 +++++++++++ .../src_qyba/service/FVTongyongService.java | 125 +++++ .../seeyon/apps/src_qyba/util/FVHttpUtil.java | 57 +++ .../seeyon/apps/src_qyba/util/FanWeiUtil.java | 301 ++++++++++++ .../apps/src_qyba/util/InterfaceListUtil.java | 344 +++++++++++++ .../seeyon/apps/src_qyba/vo/FVResponse.java | 72 +++ .../main/resources/needless_check_login.xml | 322 ++++++++++++ .../needless_check_login_recheck.xml | 426 ++++++++++++++++ .../plugin/src_flowbacklog/pluginCfg.xml | 6 + .../spring/spring-listener.xml | 5 + .../src_flowbacklog/spring/spring-sso.xml | 14 + .../plugin/src_flowbacklog/spring/spring.xml | 5 + .../plugin/src_personnelflow/pluginCfg.xml | 6 + .../src_personnelflow/spring/spring.xml | 22 + .../cfgHome/plugin/src_qyba/pluginCfg.xml | 6 + .../plugin/src_qyba/spring/spring-node.xml | 8 + .../plugin/src_qyba/spring/spring-service.xml | 6 + .../cfgHome/plugin/src_qyba/spring/spring.xml | 5 + .../jsp/plugin/qrCodeForm/qrCodeFormIndex.jsp | 249 ++++++++++ .../cap4/form/utils/qrcodeform/index.js | 13 + .../cap4/form/utils/qrcodeform/index.js | 11 + 62 files changed, 7985 insertions(+) create mode 100644 v5/apps-customize/pom.xml create mode 100644 v5/apps-customize/src/main/java/GitDiff.java create mode 100644 v5/apps-customize/src/main/java/com/seeyon/apps/src_flowbacklog/FlowBacklogPluginApi.java create mode 100644 v5/apps-customize/src/main/java/com/seeyon/apps/src_flowbacklog/constants/FlowConstants.java create mode 100644 v5/apps-customize/src/main/java/com/seeyon/apps/src_flowbacklog/listener/FlowEventListener.java create mode 100644 v5/apps-customize/src/main/java/com/seeyon/apps/src_flowbacklog/sso/FlowBacklogsso.java create mode 100644 v5/apps-customize/src/main/java/com/seeyon/apps/src_flowbacklog/util/InterfaceListUtil.java create mode 100644 v5/apps-customize/src/main/java/com/seeyon/apps/src_flowbacklog/util/ParamUtil.java create mode 100644 v5/apps-customize/src/main/java/com/seeyon/apps/src_flowbacklog/vo/WaitingProcessingVo.java create mode 100644 v5/apps-customize/src/main/java/com/seeyon/apps/src_personnelflow/PersonnelFlowPluginApi.java create mode 100644 v5/apps-customize/src/main/java/com/seeyon/apps/src_personnelflow/config/PluginConfigProvider.java create mode 100644 v5/apps-customize/src/main/java/com/seeyon/apps/src_personnelflow/constants/PersonnelFlowConstants.java create mode 100644 v5/apps-customize/src/main/java/com/seeyon/apps/src_personnelflow/event/FVNewBackoutFlowCancelEvent.java create mode 100644 v5/apps-customize/src/main/java/com/seeyon/apps/src_personnelflow/event/OrganizationUnifyOnBeforeStartEvent.java create mode 100644 v5/apps-customize/src/main/java/com/seeyon/apps/src_personnelflow/event/PersonnelFlowCancelEvent.java create mode 100644 v5/apps-customize/src/main/java/com/seeyon/apps/src_personnelflow/node/AccountCloseCommonNode.java create mode 100644 v5/apps-customize/src/main/java/com/seeyon/apps/src_personnelflow/node/AccountCloseOrganizationNode.java create mode 100644 v5/apps-customize/src/main/java/com/seeyon/apps/src_personnelflow/node/ApplyForFullMemberNode.java create mode 100644 v5/apps-customize/src/main/java/com/seeyon/apps/src_personnelflow/node/LeaveAndBusinessTriNode.java create mode 100644 v5/apps-customize/src/main/java/com/seeyon/apps/src_personnelflow/node/MemberInternalMobilizationNode.java create mode 100644 v5/apps-customize/src/main/java/com/seeyon/apps/src_personnelflow/node/MemberInternalMobilizationRecordNode.java create mode 100644 v5/apps-customize/src/main/java/com/seeyon/apps/src_personnelflow/node/MerchantCloseCommonNode.java create mode 100644 v5/apps-customize/src/main/java/com/seeyon/apps/src_personnelflow/node/MerchantCloseOrganizationNode.java create mode 100644 v5/apps-customize/src/main/java/com/seeyon/apps/src_personnelflow/node/PersonnelInfoCommonNode.java create mode 100644 v5/apps-customize/src/main/java/com/seeyon/apps/src_personnelflow/node/YdAccountCloseNode.java create mode 100644 v5/apps-customize/src/main/java/com/seeyon/apps/src_personnelflow/node/YdAccountOpenNode.java create mode 100644 v5/apps-customize/src/main/java/com/seeyon/apps/src_personnelflow/tool/HttpClient.java create mode 100644 v5/apps-customize/src/main/java/com/seeyon/apps/src_personnelflow/tool/HttpRequestUtils.java create mode 100644 v5/apps-customize/src/main/java/com/seeyon/apps/src_personnelflow/tool/WeaverUtil.java create mode 100644 v5/apps-customize/src/main/java/com/seeyon/apps/src_personnelflow/util/DataProcessingUtil.java create mode 100644 v5/apps-customize/src/main/java/com/seeyon/apps/src_personnelflow/util/ParamUtil.java create mode 100644 v5/apps-customize/src/main/java/com/seeyon/apps/src_personnelflow/util/ProtUtil.java create mode 100644 v5/apps-customize/src/main/java/com/seeyon/apps/src_personnelflow/vo/MemberManagerResponse.java create mode 100644 v5/apps-customize/src/main/java/com/seeyon/apps/src_qyba/FVCommonNode.java create mode 100644 v5/apps-customize/src/main/java/com/seeyon/apps/src_qyba/FVTongyongbeianNode.java create mode 100644 v5/apps-customize/src/main/java/com/seeyon/apps/src_qyba/QYBAPluginApi.java create mode 100644 v5/apps-customize/src/main/java/com/seeyon/apps/src_qyba/constants/FVConstants.java create mode 100644 v5/apps-customize/src/main/java/com/seeyon/apps/src_qyba/node/FVNewStateReturnNode.java create mode 100644 v5/apps-customize/src/main/java/com/seeyon/apps/src_qyba/node/FVNewZhengceNode.java create mode 100644 v5/apps-customize/src/main/java/com/seeyon/apps/src_qyba/node/FVOldStateReturnNode.java create mode 100644 v5/apps-customize/src/main/java/com/seeyon/apps/src_qyba/node/FVOldZhengceNode.java create mode 100644 v5/apps-customize/src/main/java/com/seeyon/apps/src_qyba/service/FVService.java create mode 100644 v5/apps-customize/src/main/java/com/seeyon/apps/src_qyba/service/FVTongyongService.java create mode 100644 v5/apps-customize/src/main/java/com/seeyon/apps/src_qyba/util/FVHttpUtil.java create mode 100644 v5/apps-customize/src/main/java/com/seeyon/apps/src_qyba/util/FanWeiUtil.java create mode 100644 v5/apps-customize/src/main/java/com/seeyon/apps/src_qyba/util/InterfaceListUtil.java create mode 100644 v5/apps-customize/src/main/java/com/seeyon/apps/src_qyba/vo/FVResponse.java create mode 100644 v5/apps-customize/src/main/resources/needless_check_login.xml create mode 100644 v5/apps-customize/src/main/resources/needless_check_login_recheck.xml create mode 100644 v5/apps-customize/src/main/webapp/WEB-INF/cfgHome/plugin/src_flowbacklog/pluginCfg.xml create mode 100644 v5/apps-customize/src/main/webapp/WEB-INF/cfgHome/plugin/src_flowbacklog/spring/spring-listener.xml create mode 100644 v5/apps-customize/src/main/webapp/WEB-INF/cfgHome/plugin/src_flowbacklog/spring/spring-sso.xml create mode 100644 v5/apps-customize/src/main/webapp/WEB-INF/cfgHome/plugin/src_flowbacklog/spring/spring.xml create mode 100644 v5/apps-customize/src/main/webapp/WEB-INF/cfgHome/plugin/src_personnelflow/pluginCfg.xml create mode 100644 v5/apps-customize/src/main/webapp/WEB-INF/cfgHome/plugin/src_personnelflow/spring/spring.xml create mode 100644 v5/apps-customize/src/main/webapp/WEB-INF/cfgHome/plugin/src_qyba/pluginCfg.xml create mode 100644 v5/apps-customize/src/main/webapp/WEB-INF/cfgHome/plugin/src_qyba/spring/spring-node.xml create mode 100644 v5/apps-customize/src/main/webapp/WEB-INF/cfgHome/plugin/src_qyba/spring/spring-service.xml create mode 100644 v5/apps-customize/src/main/webapp/WEB-INF/cfgHome/plugin/src_qyba/spring/spring.xml create mode 100644 v5/apps-customize/src/main/webapp/WEB-INF/jsp/plugin/qrCodeForm/qrCodeFormIndex.jsp create mode 100644 v5/apps-customize/src/main/webapp/common/capextend/cap4/form/utils/qrcodeform/index.js create mode 100644 v5/apps-customize/src/main/webapp/m3/apps/v5/capextend/cap4/form/utils/qrcodeform/index.js diff --git a/v5/apps-customize/pom.xml b/v5/apps-customize/pom.xml new file mode 100644 index 0000000..05e2716 --- /dev/null +++ b/v5/apps-customize/pom.xml @@ -0,0 +1,61 @@ + + + + + com.seeyon + apps-root + 5371630367615140082-standard-V8.1SP2-release_20220812-SNAPSHOT + + + 4.0.0 + + apps-customize + ${apps.version} + + + + org.apache.maven.plugins + maven-compiler-plugin + + 8 + 8 + + + + + + + + + + + + open.seeyon.3rd + hutool + 5.5.7 + system + ${basedir}/src/main/webapp/WEB-INF/lib/hutool-all-5.5.7.jar + + + open.seeyon.3rd + seeyon-extend + 3.0 + system + ${basedir}/src/main/webapp/WEB-INF/lib/seeyon-extend-v3.0.jar + + + + + + + + + + + + + + + + diff --git a/v5/apps-customize/src/main/java/GitDiff.java b/v5/apps-customize/src/main/java/GitDiff.java new file mode 100644 index 0000000..ba65538 --- /dev/null +++ b/v5/apps-customize/src/main/java/GitDiff.java @@ -0,0 +1,111 @@ +import org.apache.commons.io.FileUtils; +import org.apache.commons.io.IOUtils; + +import java.io.File; +import java.io.IOException; +import java.net.URLDecoder; +import java.net.URLEncoder; +import java.sql.SQLOutput; +import java.util.*; +import java.util.stream.Collectors; + +public class GitDiff { + public static void main(String[] args) throws Exception { + packFolder("/Users/mac/Desktop", "A8V5_8.2_橙阳科技运维申请单填报集成开发_20240201","d2cd64d3","9630006d"); + } + + private static File packFolder(String path, String name,String startV,String endV) throws Exception { + String destPath = path + File.separator + name; + String javaCode = "/src/main/java"; + String webCode = "/src/main/webapp"; + String resCode = "src/main/resources"; + String targetClass = "/target/classes"; + File file = new File(GitDiff.class.getResource("").getPath()); + String[] split = file.getPath().split("v5"); + File rootFile = new File(URLDecoder.decode(split[0], "utf-8")); + File[] files = rootFile.listFiles(); + List filePaths = new ArrayList<>(); + for (File v5 : files) { + if ("cap_code".equals(v5.getName())) { + File capCore = new File(v5.getAbsoluteFile() + File.separator + "core" + File.separator + "target" + File.separator + "classes"); + if (capCore.exists()) { + traverseFile(capCore, filePaths); + } + } + if ("v5".equals(v5.getName())) { + File[] v5Files = v5.listFiles(); + for (File v5File : v5Files) { + File v5Classes = new File(v5File.getAbsoluteFile() + File.separator + "target" + File.separator + "classes"); + File v5Webapps = new File(v5File.getAbsoluteFile() + File.separator + "src" + File.separator + "main" + File.separator + "webapp"); + if (v5Classes.exists()) { + traverseFile(v5Classes, filePaths); + } + if (v5Webapps.exists()) { + traverseFile(v5Webapps, filePaths); + } + } + } + } + + System.out.println("\r\n产品编译后编译后文件列表"); + filePaths.forEach(System.out::println); + + System.out.println("\r\n异常源码列表"); + Process process = Runtime.getRuntime().exec("git diff "+startV+" "+endV+" --name-only"); + //process.waitFor(); + List gitFiles = IOUtils.readLines(process.getInputStream(), "utf-8").stream().filter(p -> p.contains(javaCode) || p.contains(webCode) || p.contains(resCode)).map(p -> { + if (p.contains(javaCode)) { + return p.split(javaCode)[1]; + } else if (p.contains(resCode)) { + return p.split(resCode)[1]; + } else { + return p.split(webCode)[1]; + } + }).collect(Collectors.toList()); + + System.out.println("\r\n有效GIT变动文件列表"); + gitFiles.forEach(System.out::println); + + //有效的文件列表 + List paths = filePaths.stream().filter(p -> p.contains(targetClass) || p.contains(webCode)).collect(Collectors.toList()); + System.out.println("\r\n有效的编译文件列表"); + paths.forEach(System.out::println); + + System.out.println("\r\n有效的GIT版本文件"); + for (String filePath : paths) { + if (filePath.contains(targetClass)) { + String cp = filePath.split(targetClass)[1]; + for (String gitFile : gitFiles) { + if (cp.contains(gitFile.replaceAll(".java", ""))) { + File destFile = new File(destPath + "/seeyon/WEB-INF/classes/" + cp); + FileUtils.copyFile(new File(filePath), destFile); + System.out.println(filePath); + } + } + } + if (filePath.contains(webCode)) { + String wp = filePath.split(webCode)[1]; + for (String gitFile : gitFiles) { + if (wp.contains(gitFile)) { + File destFile = new File(destPath + "/seeyon/" + wp); + FileUtils.copyFile(new File(filePath), destFile); + System.out.println(filePath); + } + } + } + } + return new File(destPath); + } + + private static List traverseFile(File file, List resultFileName) { + File[] files = file.listFiles(); + if (files == null) return resultFileName;// 判断目录下是不是空的 + for (File f : files) { + if (f.isDirectory()) {// 判断是否文件夹 + traverseFile(f, resultFileName);// 调用自身,查找子目录 + } else + resultFileName.add(f.getPath().replaceAll("\\\\", "/")); + } + return resultFileName; + } +} diff --git a/v5/apps-customize/src/main/java/com/seeyon/apps/src_flowbacklog/FlowBacklogPluginApi.java b/v5/apps-customize/src/main/java/com/seeyon/apps/src_flowbacklog/FlowBacklogPluginApi.java new file mode 100644 index 0000000..24e220f --- /dev/null +++ b/v5/apps-customize/src/main/java/com/seeyon/apps/src_flowbacklog/FlowBacklogPluginApi.java @@ -0,0 +1,47 @@ +package com.seeyon.apps.src_flowbacklog; + + +import com.seeyon.apps.common.plugin.api.APluginInfoApi; +import com.seeyon.apps.common.plugin.vo.ConfigVo; +import com.seeyon.apps.src_flowbacklog.constants.FlowConstants; + + +public class FlowBacklogPluginApi extends APluginInfoApi { + public FlowBacklogPluginApi() { + } + + public String getPluginId() { + System.out.println(FlowConstants.getPluginId()); + return FlowConstants.getPluginId(); + } + + public String getCreateUser() { + return "橙阳科技"; + } + + public String getDescription() { + return "稻花香待办集成管理"; + } + + public ConfigVo getDefaultConfig() { + ConfigVo configVo = new ConfigVo(); + FlowConstants[] var2 = FlowConstants.values(); + int var3 = var2.length; + + for(int var4 = 0; var4 < var3; ++var4) { + FlowConstants value = var2[var4]; + if (value != FlowConstants.plugin) { + configVo.getDevParams().put(value.name(), value.getDefaultValue()); + configVo.getProdParams().put(value.name(), value.getDefaultValue()); + configVo.getParamMap().put(value.name(), value.getDescription()); + } + } + + return configVo; + } + +// public void registerCustomEvent(Map eventAndNodes) { +// eventAndNodes.put("propertyDispose", "资产管理待办推送"); +// } +} + diff --git a/v5/apps-customize/src/main/java/com/seeyon/apps/src_flowbacklog/constants/FlowConstants.java b/v5/apps-customize/src/main/java/com/seeyon/apps/src_flowbacklog/constants/FlowConstants.java new file mode 100644 index 0000000..eea69c8 --- /dev/null +++ b/v5/apps-customize/src/main/java/com/seeyon/apps/src_flowbacklog/constants/FlowConstants.java @@ -0,0 +1,35 @@ +package com.seeyon.apps.src_flowbacklog.constants; + +public enum FlowConstants { + dhxRegisterCode("3001", "待办集成应用编码"), + dhxUrl("https://oa.dhx.com.cn", "稻花香ip"), + dhxTokenUrl("/seeyon/rest/token/", "稻花香token接口"), + dhxReceiveUrl("/seeyon/rest/thirdpartyPending/receive", "稻花香单条待办接口"), + dhxRemoveUrl("/seeyon/rest/srcFlowbacklog/removeFlowbacklog", "稻花香待办删除接口"), + dhxUpdateReceiveUrl("/seeyon/rest/thirdpartyPending/updatePendingState", "稻花香待办更新接口"), + dhxMessageUrl("/seeyon/rest/thirdpartyMessage/receive/singleMessage", "稻花香单条消息接口"), + dhxFlowssoUrl("/seeyon/dhxFlowWaitHandlesso.do", "稻花香单点登录接口"), + dhxRestName("127.0.0.1", "稻花香rest用户名"), + dhxRestPwd("127.0.0.1", "稻花香rest密码"), + plugin("src_flowbacklog", "插件ID"); + + private String defaultValue; + private String description; + + private FlowConstants(String defaultValue, String description) { + this.defaultValue = defaultValue; + this.description = description; + } + + public String getDefaultValue() { + return this.defaultValue; + } + + public String getDescription() { + return this.description; + } + + public static String getPluginId() { + return plugin.defaultValue; + } +} diff --git a/v5/apps-customize/src/main/java/com/seeyon/apps/src_flowbacklog/listener/FlowEventListener.java b/v5/apps-customize/src/main/java/com/seeyon/apps/src_flowbacklog/listener/FlowEventListener.java new file mode 100644 index 0000000..9dbd742 --- /dev/null +++ b/v5/apps-customize/src/main/java/com/seeyon/apps/src_flowbacklog/listener/FlowEventListener.java @@ -0,0 +1,186 @@ +package com.seeyon.apps.src_flowbacklog.listener; + +import cn.hutool.log.Log; +import com.alibaba.fastjson.JSONObject; +import com.seeyon.apps.collaboration.event.*; +import com.seeyon.apps.common.config.ICstConfigApi; +import com.seeyon.apps.common.plugin.vo.ConfigVo; +import com.seeyon.apps.extIntegration.vo.ExtAffair; +import com.seeyon.apps.extIntegration.vo.ExtSummary; +import com.seeyon.apps.src_flowbacklog.constants.FlowConstants; +import com.seeyon.apps.src_flowbacklog.util.InterfaceListUtil; +import com.seeyon.apps.src_flowbacklog.util.ParamUtil; +import com.seeyon.apps.weixin.todotask.listener.TodoTaskEvenListener; +import com.seeyon.apps.zhifei.event.ExtIntegrationExtendEvent; +import com.seeyon.ctp.common.AppContext; +import com.seeyon.ctp.common.exceptions.BusinessException; +import com.seeyon.ctp.event.EventTriggerMode; +import com.seeyon.ctp.organization.bo.MemberPost; +import com.seeyon.ctp.organization.bo.MemberRole; +import com.seeyon.ctp.organization.bo.OrganizationMessage; +import com.seeyon.ctp.organization.bo.V3xOrgMember; +import com.seeyon.ctp.organization.manager.OrgManager; +import com.seeyon.ctp.organization.manager.OrgManagerDirect; +import com.seeyon.ctp.util.annotation.ListenEvent; +import www.seeyon.com.utils.StringUtil; + +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.List; + +public class FlowEventListener { + + private static Log log = Log.get(FlowEventListener.class); + + private SimpleDateFormat sdf = new SimpleDateFormat("YYYY-MM-dd HH:mm"); + + private OrgManager orgManager; + public void setOrgManager(OrgManager orgManager) {this.orgManager = orgManager; } + public OrgManager getOrgManager() { + if (orgManager == null) {orgManager = (OrgManager) AppContext.getBean("orgManager");}return orgManager; + } + + protected ICstConfigApi cstConfigApi = (ICstConfigApi) AppContext.getBean("cstConfigApi"); + + public ConfigVo getFlowConfig() { + return this.cstConfigApi.getConfig(this.getPluginId()); + } + + public String getPluginId() { + return FlowConstants.getPluginId(); + } + + + + /**编写一个事件监听ExtIntegrationExtendEvent**/ + /** + * 流程待办事件 + * @param event + * @throws BusinessException + */ + @ListenEvent(event = ExtIntegrationExtendEvent.class, async = true) + public void onExtIntegrationEvent(ExtIntegrationExtendEvent event) throws BusinessException { + System.out.println("统一待办集成监听"); + InterfaceListUtil interfaceListUtil = new InterfaceListUtil(); + ParamUtil paramUtil = new ParamUtil(); + ConfigVo configVo = this.getFlowConfig(); + try { +// 获取所有待办事项信息 + ExtSummary extSummary = event.getExtSummary(); + log.info("收集所有待办信息"); + String title = extSummary.getExtSummarySubject(); + List extAffairs = extSummary.getExtAffairs(); + String dhxToken = interfaceListUtil.getDhxToken(""); + String extSummaryStartMemberId = extSummary.getExtSummaryStartMemberId(); + V3xOrgMember extSummaryStartMember = orgManager.getMemberById(Long.parseLong(extSummaryStartMemberId)); + for (int i = 0; i < extAffairs.size(); i++) { + ExtAffair extAffair = extAffairs.get(i); + log.info("当前节点状态为" + extAffair.getCtpAffairState()); + log.info("当前节点副状态为" + extAffair.getCtpAffairSubState()); + if(extAffair.getCtpAffairState()==3 && extAffair.getCtpAffairSubState() == 12){ + log.info("当前流程为已读,跳过处理"); + break; + } +// 当前事项人员 + long ctpAffairMemberId = extAffair.getCtpAffairMemberId(); + V3xOrgMember ctpAffairMember = orgManager.getMemberById(ctpAffairMemberId); + if(ctpAffairMember==null){ + log.info("当前事务人员信息为跳过处理"); + break; + } +// 获取当前人员待办人 + String ip = configVo.getParamVal(FlowConstants.dhxUrl.name()); + String receiveUrl = configVo.getParamVal(FlowConstants.dhxReceiveUrl.name()); + String removeUrl = configVo.getParamVal(FlowConstants.dhxRemoveUrl.name()); + String updateReceiveUrl = configVo.getParamVal(FlowConstants.dhxUpdateReceiveUrl.name()); +// 设置待办推送参数,执行待办推送方法 + JSONObject param = paramUtil.waitingProcessingParam(extAffair,configVo,ctpAffairMember,title,extSummaryStartMember,extSummary); + if(StringUtil.isEmpty(param.getString("state"))){ + log.info("当前待办信息流程状态设置为空,取消待办推送"); + return ; + } + log.info("当前token为:"+dhxToken); + + String state = param.getString("state"); + if("1".equals(state)){ +// 判断当前情况是否为已办情况 + JSONObject paramState = new JSONObject(); + paramState.put("taskId",param.getString("taskId")); + paramState.put("registerCode","3004"); + paramState.put("state","1"); + paramState.put("subState","0"); + log.info("当前流程为已办流程,参数转换,更新待办状态"+paramState); + JSONObject res = interfaceListUtil.doPost(paramState.toString(),ip+updateReceiveUrl,dhxToken); + log.info(res.toString()); + }else if ("2".equals(state)){ + // 判断当前情况是否为已办情况 + JSONObject removeParam = new JSONObject(); + removeParam.put("taskId",param.getString("taskId")); + removeParam.put("registerCode","3004"); + log.info("当前流程为竞争执行流程,参数转换,删除待办状态"+removeParam); + JSONObject res = interfaceListUtil.doPost(removeParam.toString(),ip+removeUrl,dhxToken); + log.info(res.toString()); + }else{ + JSONObject res = interfaceListUtil.doPost(param.toString(),ip+receiveUrl,dhxToken); + log.info(res.toString()); + } +// JSONObject res = interfaceListUtil.doPost(param.toString(),ip+receiveUrl,dhxToken); + } + + }catch (Exception e){ + e.printStackTrace(); + } + // 监听到对象时,执行对应的业务逻辑操作,比如将对象推送给第三方 +// todo(extSummary); + } + + /** + * 流程发起事件监听 + * @param event + */ + @ListenEvent(event= CollaborationStartEvent.class,mode= EventTriggerMode.afterCommit)//协同发起成功提交事务后执行,异步模式。 + public void onCollaborationStart(CollaborationStartEvent event){ + System.out.println("流程发起事件"); + } + + /** + * 流程处理事件 + * @param event + */ + @ListenEvent(event= CollaborationProcessEvent.class,mode= EventTriggerMode.afterCommit)//协同发起成功提交事务后执行,异步模式。 + public void onCollaborationProcess(CollaborationProcessEvent event){ + System.out.println("流程处理事件"); + } + + /** + * 流程回退事件 + * @param event + */ + @ListenEvent(event= CollaborationStepBackEvent.class,mode= EventTriggerMode.afterCommit)//协同发起成功提交事务后执行,异步模式。 + public void onCollaborationStepBack(CollaborationStepBackEvent event){ + System.out.println("流程回退事件"); + } + + /** + * 流程撤销事件 + * @param event + */ + @ListenEvent(event= CollaborationCancelEvent.class,mode= EventTriggerMode.afterCommit)//协同发起成功提交事务后执行,异步模式。 + public void onCollaborationCancel(CollaborationCancelEvent event){ + System.out.println("流程撤销事件"); + } + + /** + * 流程取回事件 + * @param event + */ + @ListenEvent(event= CollaborationTakeBackEvent.class,mode= EventTriggerMode.afterCommit)//协同发起成功提交事务后执行,异步模式。 + public void onCollaborationTakeBack(CollaborationTakeBackEvent event){ + System.out.println("流程取回事件"); + } + + + + + +} diff --git a/v5/apps-customize/src/main/java/com/seeyon/apps/src_flowbacklog/sso/FlowBacklogsso.java b/v5/apps-customize/src/main/java/com/seeyon/apps/src_flowbacklog/sso/FlowBacklogsso.java new file mode 100644 index 0000000..983c17e --- /dev/null +++ b/v5/apps-customize/src/main/java/com/seeyon/apps/src_flowbacklog/sso/FlowBacklogsso.java @@ -0,0 +1,58 @@ +package com.seeyon.apps.src_flowbacklog.sso; + +import cn.hutool.log.Log; +import com.seeyon.apps.common.config.ICstConfigApi; +import com.seeyon.apps.common.plugin.vo.ConfigVo; +import com.seeyon.apps.src_flowbacklog.constants.FlowConstants; +import com.seeyon.apps.src_flowbacklog.util.ParamUtil; +import com.seeyon.ctp.portal.sso.SSOLoginHandshakeAbstract; +import com.seeyon.ctp.util.HttpClientUtil; + +import javax.inject.Inject; + +public class FlowBacklogsso extends SSOLoginHandshakeAbstract { + private static Log log = Log.get(FlowBacklogsso.class); + + @Inject + private ICstConfigApi cstConfigApi; + + public ConfigVo getFlowBacklogConfig() { + return this.cstConfigApi.getConfig(this.getPluginId()); + } + + public String getPluginId() { + return FlowConstants.getPluginId(); + } + + + public FlowBacklogsso() { + } + + public String handshake(String ticket) { + String loginNameticket = ""; + ConfigVo configVo = this.getFlowBacklogConfig(); + try { + if (ticket == null || ticket.equals("")) { + return null; + } + System.out.println("登录名参数:"+ticket); + String[] tickets = ticket.split("-"); + System.out.println("拆分后参数"+tickets[0]); + if (!ParamUtil.isLong(ticket)) { + loginNameticket = tickets[0]; + } else { + String LoginNameUrl = configVo.getParamVal(FlowConstants.dhxUrl.name())+"/seeyon/thirdpartyController.do?ticket=" + ticket; + String loginName = HttpClientUtil.getContent(LoginNameUrl).trim(); + loginNameticket = loginName; + } + } catch (Exception var8) { + log.error("单点登录握手类处理异常!", var8); + } + log.info("单点登录账号==" + loginNameticket); + return loginNameticket; + } + + public void logoutNotify(String s) { + } +} + diff --git a/v5/apps-customize/src/main/java/com/seeyon/apps/src_flowbacklog/util/InterfaceListUtil.java b/v5/apps-customize/src/main/java/com/seeyon/apps/src_flowbacklog/util/InterfaceListUtil.java new file mode 100644 index 0000000..492e2c9 --- /dev/null +++ b/v5/apps-customize/src/main/java/com/seeyon/apps/src_flowbacklog/util/InterfaceListUtil.java @@ -0,0 +1,223 @@ +package com.seeyon.apps.src_flowbacklog.util; + +import com.alibaba.fastjson.JSONObject; +import com.seeyon.apps.common.config.ICstConfigApi; +import com.seeyon.apps.common.plugin.vo.ConfigVo; +import com.seeyon.apps.src_flowbacklog.constants.FlowConstants; +import com.seeyon.ctp.common.AppContext; +import org.apache.commons.httpclient.Header; +import org.apache.commons.httpclient.HttpClient; +import org.apache.commons.httpclient.HttpException; +import org.apache.commons.httpclient.methods.PostMethod; +import org.apache.commons.httpclient.methods.StringRequestEntity; +import org.apache.http.HttpResponse; +import org.apache.http.client.methods.HttpGet; +import org.apache.http.impl.client.DefaultHttpClient; +import org.apache.http.util.EntityUtils; + +import java.io.*; +import java.net.HttpURLConnection; +import java.net.MalformedURLException; +import java.net.URL; +import java.text.SimpleDateFormat; +import java.util.Date; + +public class InterfaceListUtil { + protected ICstConfigApi cstConfigApi = (ICstConfigApi) AppContext.getBean("cstConfigApi"); + + public InterfaceListUtil() { + } + + public ConfigVo getFlowConfig() { + return this.cstConfigApi.getConfig(this.getPluginId()); + } + + public String getPluginId() { + return FlowConstants.getPluginId(); + } + + public String getDhxToken(String loginName) throws FileNotFoundException, IOException { + + + ConfigVo configVo = this.getFlowConfig(); + String address = configVo.getParamVal(FlowConstants.dhxUrl.name()) + + configVo.getParamVal(FlowConstants.dhxTokenUrl.name()) + "/" + + configVo.getParamVal(FlowConstants.dhxRestName.name()) + "/" + + configVo.getParamVal(FlowConstants.dhxRestPwd.name()); + String token = ""; + if (!"".equals(loginName)) { + address = address + "?loginName=" + loginName; + } + + HttpURLConnection connection = (HttpURLConnection)(new URL(address)).openConnection(); + connection.setRequestMethod("GET"); + connection.setRequestProperty("Accept", "application/json"); + int responseCode = connection.getResponseCode(); + if (responseCode == 200) { + BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream())); + StringBuffer response = new StringBuffer(); + + String inputLine; + while((inputLine = in.readLine()) != null) { + response.append(inputLine); + } + + in.close(); + String result = response.toString(); + if (result.contains("{")) { + JSONObject jsObj = JSONObject.parseObject(result); + System.out.println(jsObj); + token = jsObj.get("id").toString(); + } else { + token = result; + } + + System.out.println(token); + } else { + System.out.println("GET request not worked"); + } + + return token; + } + + public String doGet(String par, String strUrl, String token) { + String address = strUrl + "?token=" + token; + DefaultHttpClient client = new DefaultHttpClient(); + String result = ""; + HttpGet get = new HttpGet(address); + + try { + HttpResponse res = client.execute(get); + if (res.getStatusLine().getStatusCode() == 200) { + result = EntityUtils.toString(res.getEntity()); + } + + return result; + } catch (Exception var9) { + throw new RuntimeException(var9); + } + } + + public JSONObject doPost(String str, String urlStr, String token) { + HttpURLConnection connection = null; + InputStream is = null; + OutputStream os = null; + BufferedReader br = null; + String result = null; + + try { + URL url = new URL(urlStr + "?token=" + token); + connection = (HttpURLConnection)url.openConnection(); + connection.setRequestMethod("POST"); + connection.setConnectTimeout(15000); + connection.setReadTimeout(60000); + connection.setDoOutput(true); + connection.setDoInput(true); + connection.setRequestProperty("Content-Type", "application/json"); + os = connection.getOutputStream(); + if (!"".equals(str) && str != null) { + os.write(str.getBytes("UTF-8")); + } + System.out.println(connection.getResponseMessage()); + if (connection.getResponseCode() == 200) { + is = connection.getInputStream(); + br = new BufferedReader(new InputStreamReader(is, "UTF-8")); + StringBuffer sbf = new StringBuffer(); + String temp = null; + + while((temp = br.readLine()) != null) { + sbf.append(temp); + sbf.append("\r\n"); + } + result = sbf.toString(); + } + } catch (MalformedURLException var32) { + var32.printStackTrace(); + } catch (IOException var33) { + var33.printStackTrace(); + } finally { + if (null != br) { + try { + br.close(); + } catch (IOException var31) { + var31.printStackTrace(); + } + } + + if (null != os) { + try { + os.close(); + } catch (IOException var30) { + var30.printStackTrace(); + } + } + + if (null != is) { + try { + is.close(); + } catch (IOException var29) { + var29.printStackTrace(); + } + } + + connection.disconnect(); + } + + JSONObject json = JSONObject.parseObject(result); + return json; + } + + public String doSoap(String action, String xml, String id) throws HttpException, IOException { + String wsdl = ""; + if (!"createDepartment".equals(action) && !"updateDepartment".equals(action) && !"createPractitioner".equals(action) && "updatePractitioner".equals(action)) { + } + + System.out.println("wsdl:" + wsdl); + int timeout = 10000; + StringBuffer sb = new StringBuffer(""); + sb.append(""); + sb.append(""); + sb.append(""); + sb.append(" "); + sb.append("" + action + "" + xml + ""); + sb.append(""); + sb.append(""); + sb.append(""); + HttpClient client = new HttpClient(); + PostMethod postMethod = new PostMethod(wsdl); + new Header(); + client.getHttpConnectionManager().getParams().setConnectionTimeout(timeout); + client.getHttpConnectionManager().getParams().setSoTimeout(timeout); + StringRequestEntity requestEntity = null; + + try { + requestEntity = new StringRequestEntity(sb.toString(), "text/xml", "UTF-8"); + } catch (UnsupportedEncodingException var21) { + var21.printStackTrace(); + } + + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + Date businessTime = new Date(); + Date operationTime = new Date(); + SimpleDateFormat sdf1 = new SimpleDateFormat("yyyyMMddHHmmss"); + Date root = new Date(); + String rootId = sdf1.format(root); + postMethod.setRequestHeader("SOAPAction", ""); + postMethod.setRequestHeader("Content-Type", "application/fhir+json"); + postMethod.setRequestHeader("rootId", rootId); + postMethod.setRequestHeader("token", id); + postMethod.setRequestHeader("domain", "OA"); + postMethod.setRequestHeader("businessTime", sdf.format(businessTime)); + postMethod.setRequestHeader("key", "806c1571-35de-41a2-b3c9-06ae5474d43a"); + postMethod.setRequestHeader("operationTime", sdf.format(operationTime)); + postMethod.setRequestEntity(requestEntity); + client.executeMethod(postMethod); + InputStream is = postMethod.getResponseBodyAsStream(); + byte[] bytes = new byte[is.available()]; + is.read(bytes); + String result = new String(bytes); + return result; + } + + +} diff --git a/v5/apps-customize/src/main/java/com/seeyon/apps/src_flowbacklog/util/ParamUtil.java b/v5/apps-customize/src/main/java/com/seeyon/apps/src_flowbacklog/util/ParamUtil.java new file mode 100644 index 0000000..6c1d3de --- /dev/null +++ b/v5/apps-customize/src/main/java/com/seeyon/apps/src_flowbacklog/util/ParamUtil.java @@ -0,0 +1,91 @@ +package com.seeyon.apps.src_flowbacklog.util; + +import cn.hutool.log.Log; +import com.alibaba.fastjson.JSONObject; +import com.seeyon.apps.common.plugin.vo.ConfigVo; +import com.seeyon.apps.extIntegration.vo.ExtAffair; +import com.seeyon.apps.extIntegration.vo.ExtSummary; +import com.seeyon.apps.src_flowbacklog.constants.FlowConstants; +import com.seeyon.apps.src_flowbacklog.vo.WaitingProcessingVo; +import com.seeyon.ctp.organization.bo.V3xOrgMember; + +import java.net.URLEncoder; +import java.text.SimpleDateFormat; +import java.util.Date; + +public class ParamUtil { + private static Log log = Log.get(ParamUtil.class); + private SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm"); + + + public JSONObject waitingProcessingParam(ExtAffair extAffair, ConfigVo configVo, V3xOrgMember ctpAffairMember, String title, V3xOrgMember extSummaryStartMember, ExtSummary extSummary) throws Exception { +// 创建待办推送对象 + WaitingProcessingVo waitingProcessingVo = new WaitingProcessingVo(); +// 获取第三方应用注册编码 + waitingProcessingVo.setRegisterCode(configVo.getParamVal(FlowConstants.dhxRegisterCode.name())); +// 获取当前流程唯一ID + waitingProcessingVo.setTaskId(extAffair.getCtpAffairId()); +// 设置流程标题 + waitingProcessingVo.setTitle(title); +// waitingProcessingVo.setSenderName(extSummaryStartMember.getLoginName()); + waitingProcessingVo.setSenderName("-"); +// 根据流程状态判断是否为待办或者已办 + int subState = extAffair.getCtpAffairSubState(); + int state = extAffair.getCtpAffairState(); +// 是否被竞争执行 + if(state==8 ){ +// 竞争执行完成后其他人不可查看流程,同步取消第三方人员的待办信息 + waitingProcessingVo.setState("2"); + }else if (state==11){ +// 竞争执行完成后其他人可以查看流程,其他人待办转已办 + waitingProcessingVo.setState("1"); + } else{ + if(subState==0 || subState ==15 || subState ==21 || subState == 22 || subState == 23 || subState == 24 || subState == 25){ +// 正常(流转审批)、指定回退(我回退给别人)、流程终止(流程被终止)、删除、归档、超期跳过、;流程终止(主动终止) + waitingProcessingVo.setState("1"); + }else if(subState==6 || subState==7 || subState ==11|| subState ==13 || subState == 14 || subState == 16) { +// 流程取回、流程被回退、待办未读、暂存待办、知会、指定回退(别人回退给我) + waitingProcessingVo.setState("0"); + }else{ + System.out.println("当前流程所执行的状态为"+state+"子状态为"+subState); + } + } +// 特殊情况流程移交状态为5子状态为12 + + if(state == 5 && subState == 12){ + waitingProcessingVo.setState("1"); + } +// 设置免校验推送的登录名 + waitingProcessingVo.setNoneBindingReceiver(ctpAffairMember.getLoginName()); + waitingProcessingVo.setNoneBindingSender(ctpAffairMember.getLoginName()); +// 设置推送时间 +// Date StartDateString = new Date(extSummary.getExtSummaryStartDate()); + Date StartDateString = new Date(); + waitingProcessingVo.setCreationDate(sdf.format(StartDateString)); +// 设置推送手机端地址 + String mobileUrl = extAffair.getMobileUrl(); + String mobileEncoderUrl = URLEncoder.encode(mobileUrl, "UTF-8"); + String h5url = configVo.getParamVal(FlowConstants.dhxUrl.name()) + configVo.getParamVal(FlowConstants.dhxFlowssoUrl.name()) + "?type=H5&tourl=%2Fseeyon" + mobileEncoderUrl; + log.info(h5url); +// 设置推送的电脑端地址 + String pcUrl = extAffair.getPcUrl(); + String pcEncodeUrl = URLEncoder.encode(pcUrl, "UTF-8"); + String url = configVo.getParamVal(FlowConstants.dhxUrl.name()) + configVo.getParamVal(FlowConstants.dhxFlowssoUrl.name()) + "?type=PC&tourl=%2Fseeyon" + pcEncodeUrl; + log.info(url); + waitingProcessingVo.setH5url(h5url); + waitingProcessingVo.setUrl(url); + JSONObject jsonObject = waitingProcessingVo.toJSON(); + log.info(jsonObject.toString()); + return jsonObject; + } + + public static boolean isLong(String str) { + try { + Long.parseLong(str); + return true; + } catch (NumberFormatException var2) { + return false; + } + } + +} diff --git a/v5/apps-customize/src/main/java/com/seeyon/apps/src_flowbacklog/vo/WaitingProcessingVo.java b/v5/apps-customize/src/main/java/com/seeyon/apps/src_flowbacklog/vo/WaitingProcessingVo.java new file mode 100644 index 0000000..c94578c --- /dev/null +++ b/v5/apps-customize/src/main/java/com/seeyon/apps/src_flowbacklog/vo/WaitingProcessingVo.java @@ -0,0 +1,168 @@ +package com.seeyon.apps.src_flowbacklog.vo; + +import com.alibaba.fastjson.JSONObject; + +public class WaitingProcessingVo { + private String registerCode; + private String taskId; + private String title; + private String senderName; + private String classify; + private String contentType; + private String state; + private String thirdSenderId; + private String thirdReceiverId; + private String creationDate; + private String content; + private String h5url; + private String url; + private String noneBindingSender; + private String noneBindingReceiver; + + public WaitingProcessingVo() { + } + + public String toString() { + return "[注册系统编码:" + this.registerCode + ";第三方系统待办主键:" + this.taskId + ";待办标题:" + this.title + ";待办发起人姓名:" + this.senderName + ";类别:" + this.classify + ";内容类别:" + this.contentType + ";状态:" + this.state + ";第三方系统发起者主键:" + this.thirdSenderId + ";第三方系统接收人主键:" + this.thirdReceiverId + ";待办发起日期:" + this.creationDate + ";原生app的下载地址:" + this.content + ";H5穿透地址:" + this.h5url + ";PC穿透地址:" + this.url + ";登录名:" + this.noneBindingSender + "," + this.noneBindingReceiver + "]"; + } + + public JSONObject toJSON() { + JSONObject jsonObject = new JSONObject(); + jsonObject.put("registerCode", this.registerCode); + jsonObject.put("taskId", this.taskId); + jsonObject.put("title", this.title); + jsonObject.put("senderName", this.senderName); + jsonObject.put("classify", this.classify); + jsonObject.put("contentType", this.contentType); + jsonObject.put("state", this.state); + jsonObject.put("thirdSenderId", this.thirdSenderId); + jsonObject.put("thirdReceiverId", this.thirdReceiverId); + jsonObject.put("creationDate", this.creationDate); + jsonObject.put("content", this.content); + jsonObject.put("h5url", this.h5url); + jsonObject.put("url", this.url); + jsonObject.put("noneBindingSender", this.noneBindingSender); + jsonObject.put("noneBindingReceiver", this.noneBindingReceiver); + return jsonObject; + } + + public String getRegisterCode() { + return this.registerCode; + } + + public void setRegisterCode(String registerCode) { + this.registerCode = registerCode; + } + + public String getTaskId() { + return this.taskId; + } + + public void setTaskId(String taskId) { + this.taskId = taskId; + } + + public String getTitle() { + return this.title; + } + + public void setTitle(String title) { + this.title = title; + } + + public String getSenderName() { + return this.senderName; + } + + public void setSenderName(String senderName) { + this.senderName = senderName; + } + + public String getClassify() { + return this.classify; + } + + public void setClassify(String classify) { + this.classify = classify; + } + + public String getContentType() { + return this.contentType; + } + + public void setContentType(String contentType) { + this.contentType = contentType; + } + + public String getState() { + return this.state; + } + + public void setState(String state) { + this.state = state; + } + + public String getThirdSenderId() { + return this.thirdSenderId; + } + + public void setThirdSenderId(String thirdSenderId) { + this.thirdSenderId = thirdSenderId; + } + + public String getThirdReceiverId() { + return this.thirdReceiverId; + } + + public void setThirdReceiverId(String thirdReceiverId) { + this.thirdReceiverId = thirdReceiverId; + } + + public String getCreationDate() { + return this.creationDate; + } + + public void setCreationDate(String creationDate) { + this.creationDate = creationDate; + } + + public String getContent() { + return this.content; + } + + public void setContent(String content) { + this.content = content; + } + + public String getH5url() { + return this.h5url; + } + + public void setH5url(String h5url) { + this.h5url = h5url; + } + + public String getUrl() { + return this.url; + } + + public void setUrl(String url) { + this.url = url; + } + + public String getNoneBindingSender() { + return this.noneBindingSender; + } + + public void setNoneBindingSender(String noneBindingSender) { + this.noneBindingSender = noneBindingSender; + } + + public String getNoneBindingReceiver() { + return this.noneBindingReceiver; + } + + public void setNoneBindingReceiver(String noneBindingReceiver) { + this.noneBindingReceiver = noneBindingReceiver; + } +} diff --git a/v5/apps-customize/src/main/java/com/seeyon/apps/src_personnelflow/PersonnelFlowPluginApi.java b/v5/apps-customize/src/main/java/com/seeyon/apps/src_personnelflow/PersonnelFlowPluginApi.java new file mode 100644 index 0000000..ba4b501 --- /dev/null +++ b/v5/apps-customize/src/main/java/com/seeyon/apps/src_personnelflow/PersonnelFlowPluginApi.java @@ -0,0 +1,47 @@ +package com.seeyon.apps.src_personnelflow; + + +import com.seeyon.apps.common.plugin.api.APluginInfoApi; +import com.seeyon.apps.common.plugin.vo.ConfigVo; +import com.seeyon.apps.src_personnelflow.constants.PersonnelFlowConstants; + + +public class PersonnelFlowPluginApi extends APluginInfoApi { + public PersonnelFlowPluginApi() { + } + + public String getPluginId() { + System.out.println(PersonnelFlowConstants.getPluginId()); + return PersonnelFlowConstants.getPluginId(); + } + + public String getCreateUser() { + return "橙阳科技"; + } + + public String getDescription() { + return "稻花香待办集成管理"; + } + + public ConfigVo getDefaultConfig() { + ConfigVo configVo = new ConfigVo(); + PersonnelFlowConstants[] var2 = PersonnelFlowConstants.values(); + int var3 = var2.length; + + for(int var4 = 0; var4 < var3; ++var4) { + PersonnelFlowConstants value = var2[var4]; + if (value != PersonnelFlowConstants.plugin) { + configVo.getDevParams().put(value.name(), value.getDefaultValue()); + configVo.getProdParams().put(value.name(), value.getDefaultValue()); + configVo.getParamMap().put(value.name(), value.getDescription()); + } + } + + return configVo; + } + +// public void registerCustomEvent(Map eventAndNodes) { +// eventAndNodes.put("propertyDispose", "资产管理待办推送"); +// } +} + diff --git a/v5/apps-customize/src/main/java/com/seeyon/apps/src_personnelflow/config/PluginConfigProvider.java b/v5/apps-customize/src/main/java/com/seeyon/apps/src_personnelflow/config/PluginConfigProvider.java new file mode 100644 index 0000000..0629717 --- /dev/null +++ b/v5/apps-customize/src/main/java/com/seeyon/apps/src_personnelflow/config/PluginConfigProvider.java @@ -0,0 +1,20 @@ +package com.seeyon.apps.src_personnelflow.config; + +import com.seeyon.apps.common.config.ICstConfigApi; +import com.seeyon.apps.common.plugin.vo.ConfigVo; +import com.seeyon.apps.src_personnelflow.constants.PersonnelFlowConstants; +import com.seeyon.ctp.common.AppContext; + +public class PluginConfigProvider { + protected ICstConfigApi cstConfigApi = (ICstConfigApi) AppContext.getBean("cstConfigApi"); + public String getBizConfigByKey(PersonnelFlowConstants key) { + ConfigVo config = cstConfigApi.getConfig(getPluginId()); + return config.getParamVal(key.name()); + } + private String getPluginId() { + return PersonnelFlowConstants.getPluginId(); + } + + public PluginConfigProvider() { + } +} diff --git a/v5/apps-customize/src/main/java/com/seeyon/apps/src_personnelflow/constants/PersonnelFlowConstants.java b/v5/apps-customize/src/main/java/com/seeyon/apps/src_personnelflow/constants/PersonnelFlowConstants.java new file mode 100644 index 0000000..98a69f6 --- /dev/null +++ b/v5/apps-customize/src/main/java/com/seeyon/apps/src_personnelflow/constants/PersonnelFlowConstants.java @@ -0,0 +1,42 @@ +package com.seeyon.apps.src_personnelflow.constants; + +public enum PersonnelFlowConstants { + plugin("src_personnelflow","插件ID"), + dowUrl("http://127.0.0.1/seeyon/rest/attachment/file","附件下载路径"), + uploadUrl("http://10.0.1.55/seeyon/rest/attachment","主数据平台上传接口"), + weaverApiIpPort("https://crm.zwinfor.cn","ip和端口号"), + weaverAppId("SEEYON","泛微appId"), + weaverAppSecret("FBp0AgIema2nhDr1Qlg1p8ijw2cPp38g52CpBzNE/Dl+tXro3DphXKZx7MS4jgiSsX+vAJeyBPHOcByjK0ehdbjyYgAP5SLtoUV9mXsjt+ge3nAL+77Dc9h1YXLnjnwB4NAuH2bq4S5zUKyw5EadmWX29Ol1N6LnrMUbg7aiMXnbptHnMj8a0JTrqb6xEHwSzdyb8KWpoRp6XIv/TQX5kkKsqYVPwSqa0db1xeS+DG77K0VeF2dcZTiNUxApBslQIbdDpWWoYNbprkiA7VWcFI5TRczYi2wHTA5ijFZEN6tiANM/7wdYfwvbbSOXejuUGrGsl3ioeSTdn0jTKHIFHg==","泛微secret"), + weaverAppSpk("MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAp02D+7wAe29/DKBC4TLVzEJyrwtRISBnkXUlibx5/XkDTYweXXHmKbnRHwG3pgExfjjljR7JG2x0/QN1AoXWlPqebNy4Xmraq7F3ZO9WtWdfwwhQQwyvpLLAr7+bsKL9jLpzg44OxYKBv5L9YQFPfpI7aY+OO8E95QRytPZ+FeeM2a/qRkrG+aUj6Hxd3gGV5JJtotYnCKrRwBe8hbH5MRelOXHUezEi7M6GX6ABNYne7Hj78hgTKN7fDywUtSUwXNOnjpaN5hoa3SoSSBvyq4yzs/4V+9nzv5OIc4vZjiEArimMjI3hesnYX0VmZb9LX4Ou/rqGcRu5kSUmKVueGQIDAQAB","泛微spk"), + weaverBpmId("1352","泛微bpmId"), + getzsjTokenUrl("http://10.0.1.55/seeyon/rest/token", "主数据TOKEN接口路径"), + restzsjUserName("sys", "主数据REST用户名"), + restzsjPassword("751f86d5-2e4c-4fe0-9a90-50d568359a1f", "主数据REST密码"), + zsjloginName("demo1", "主数据管理员账号"), + getTokenUrl("http://10.0.1.56/seeyon/rest/token", "流程TOKEN接口路径"), + restUserName("flowdata", "流程REST用户名"), + restPassword("1cd9ffb0-39ee-4690-8773-e183f233b3b9", "流程REST密码"), + loginName("demo1", "流程管理员账号"), + mainUrl("http://10.0.1.55","主数据平台ip端口") + ; + + PersonnelFlowConstants(String defaultValue, String description) { + this.defaultValue = defaultValue; + this.description = description; + } + + private String defaultValue; + private String description; + + public String getDefaultValue() { + return defaultValue; + } + + public String getDescription() { + return description; + } + + public static String getPluginId() { + return plugin.defaultValue; + } +} diff --git a/v5/apps-customize/src/main/java/com/seeyon/apps/src_personnelflow/event/FVNewBackoutFlowCancelEvent.java b/v5/apps-customize/src/main/java/com/seeyon/apps/src_personnelflow/event/FVNewBackoutFlowCancelEvent.java new file mode 100644 index 0000000..8fe84a7 --- /dev/null +++ b/v5/apps-customize/src/main/java/com/seeyon/apps/src_personnelflow/event/FVNewBackoutFlowCancelEvent.java @@ -0,0 +1,134 @@ +package com.seeyon.apps.src_personnelflow.event; + +import cn.hutool.log.Log; +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; +import com.seeyon.apps.common.workflow.constants.WorkFlowType; +import com.seeyon.apps.common.workflow.event.ACommonWorkflowEvent; +import com.seeyon.apps.ext.workflow.vo.FormDataVo; +import com.seeyon.apps.ext.workflow.vo.WorkflowEventContext; +import com.seeyon.apps.src_personnelflow.config.PluginConfigProvider; +import com.seeyon.apps.src_personnelflow.constants.PersonnelFlowConstants; +import com.seeyon.apps.src_personnelflow.tool.WeaverUtil; +import com.seeyon.cap4.form.bean.FormDataMasterBean; +import com.seeyon.ctp.common.AppContext; + +import java.util.HashMap; +import java.util.Map; +import java.util.Set; + +public class FVNewBackoutFlowCancelEvent extends ACommonWorkflowEvent { + private static Log log = Log.get(FVNewBackoutFlowCancelEvent.class); + private PluginConfigProvider configProvider = (PluginConfigProvider) AppContext.getBean("pluginConfigProvider"); + + private Map buildParams(String flowId) { + Map map = new HashMap<>(); + map.put("requestId",flowId); + map.put("ipPort",configProvider.getBizConfigByKey(PersonnelFlowConstants.weaverApiIpPort)); + map.put("secret",configProvider.getBizConfigByKey(PersonnelFlowConstants.weaverAppSecret)); + map.put("appId",configProvider.getBizConfigByKey(PersonnelFlowConstants.weaverAppId)); + map.put("userId",configProvider.getBizConfigByKey(PersonnelFlowConstants.weaverBpmId)); + map.put("spk",configProvider.getBizConfigByKey(PersonnelFlowConstants.weaverAppSpk)); + return map; + } + + @Override + protected WorkflowEventContext proceed(String templateJson, FormDataVo formDataVo, WorkFlowType workFlowType, FormDataMasterBean formDataMasterBean) throws Exception { + log.info("进入备案流程回退处理"); + WorkflowEventContext context = new WorkflowEventContext(); + context.setNeedSave(true); + try { + String waveFlowId = formDataVo.getFieldData("流程请求ID").getStringValue(); + log.info("流程请求ID"+waveFlowId); +// List> callbackParams = new ArrayList<>(); +// 封装请求参数 + JSONObject jsonObject = JSONObject.parseObject(templateJson); +// 处理流程审批意见 +// String remark = formatRemark(jsonObject.getString("yjsm")); +// jsonObject.put("yjsm",remark); +// 当前为默认字段,只有回退操作才需要赋值 +// jsonObject.put("sfth","1");//是否退回 +// String remark = formatRemark(formDataVo.getFieldData("审批意见").getStringValue()); +// for (Map.Entry entry : jsonObject.entrySet()) { +// Map temp = new HashMap<>(); +// temp.put("fieldName",) +// } + log.info("请求参数:"+jsonObject); + Set jsonObjectKeys = jsonObject.keySet(); +// Map temp = new HashMap<>(); + JSONArray temps = new JSONArray(); + for(String jsonObjectKey : jsonObjectKeys){ + JSONObject temp = new JSONObject(); + temp.put("fieldName",jsonObjectKey); + temp.put("fieldValue",jsonObject.getString(jsonObjectKey)); +// temp.put(jsonObjectKey,jsonObject.getString(jsonObjectKey)); + temps.add(temp); + } + log.info(temps.toString()); +// Map temp = new HashMap<>(); +// temp.put("fieldName","spyj"); +// temp.put("fieldValue",remark); + Map params = buildParams(waveFlowId); + params.put("mainData",temps.toString()); + context.setRequest(params.toString()); + String resp = WeaverUtil.bareject(params); + context.setResponse(resp); + JSONObject response = JSONObject.parseObject(resp); + if("SUCCESS".equals(response.get("code"))) { + log.info("成功"); + context.setSuccess(true); + context.setErrMsg("流程 回退成功"); + formDataVo.getNewFieldDataMap().put("流程回退客户平台结果", "流程回退成功"); + } else { + context.setSuccess(false); + log.info("流程回退失败:" + response.get("errMsg")); + log.info("响应结果:" + resp); + context.setErrMsg("流程回退失败:" + response.get("errMsg")); + formDataVo.getNewFieldDataMap().put("流程回退客户平台结果", "流程回退失败:" + response.get("errMsg")); + } + } catch (Exception e) { + context.setSuccess(false); + log.info("回退流程失败:OA处理异常:" + e.getMessage()); + context.setErrMsg("回退流程失败:OA处理异常:" + e.getMessage()); + e.printStackTrace(); + formDataVo.getNewFieldDataMap().put("调用泛微OA返回结果", "回退流程失败:OA处理异常" + e.getMessage()); + } + return context; + } + + @Override + public String getPluginId() { + return PersonnelFlowConstants.getPluginId(); + } + + @Override + public String getFormParse() { + return "json"; + } + + @Override + public WorkFlowType[] getTypes() { + return new WorkFlowType[]{WorkFlowType.onBeforeCancel,WorkFlowType.onBeforeStop}; + } + + @Override + public String getId() { + return "fvNewBackoutFlowCancelEvent"; + } + + @Override + public String getLabel() { + return "客户服务平台备案流程撤销事件"; + } + + private String formatRemark(String source) { + String[] split = source.split(System.lineSeparator()); + StringBuilder sb = new StringBuilder(""); + for (String s : split) { + if(s.contains("【")) { + sb.append(s + System.lineSeparator()); + } + } + return sb.toString(); + } +} diff --git a/v5/apps-customize/src/main/java/com/seeyon/apps/src_personnelflow/event/OrganizationUnifyOnBeforeStartEvent.java b/v5/apps-customize/src/main/java/com/seeyon/apps/src_personnelflow/event/OrganizationUnifyOnBeforeStartEvent.java new file mode 100644 index 0000000..3602e2f --- /dev/null +++ b/v5/apps-customize/src/main/java/com/seeyon/apps/src_personnelflow/event/OrganizationUnifyOnBeforeStartEvent.java @@ -0,0 +1,132 @@ +package com.seeyon.apps.src_personnelflow.event; + +import cn.hutool.log.Log; +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; +import com.aspose.words.FieldData; +import com.seeyon.apps.common.workflow.constants.WorkFlowType; +import com.seeyon.apps.common.workflow.event.ACommonWorkflowEvent; +import com.seeyon.apps.ext.workflow.vo.FieldDataVo; +import com.seeyon.apps.ext.workflow.vo.FormDataVo; +import com.seeyon.apps.ext.workflow.vo.WorkflowEventContext; +import com.seeyon.apps.src_personnelflow.config.PluginConfigProvider; +import com.seeyon.apps.src_personnelflow.constants.PersonnelFlowConstants; +import com.seeyon.apps.src_personnelflow.tool.WeaverUtil; +import com.seeyon.cap4.form.bean.FormDataMasterBean; +import com.seeyon.ctp.common.AppContext; +import com.seeyon.ctp.organization.bo.V3xOrgDepartment; +import com.seeyon.ctp.organization.bo.V3xOrgLevel; +import com.seeyon.ctp.organization.bo.V3xOrgPost; +import com.seeyon.ctp.organization.manager.OrgManager; + +import javax.inject.Inject; +import java.util.*; + +public class OrganizationUnifyOnBeforeStartEvent extends ACommonWorkflowEvent { + private static Log log = Log.get(OrganizationUnifyOnBeforeStartEvent.class); + private PluginConfigProvider configProvider = (PluginConfigProvider) AppContext.getBean("pluginConfigProvider"); + + @Inject + private OrgManager orgManager; + + @Override + protected WorkflowEventContext proceed(String templateJson, FormDataVo formDataVo, WorkFlowType workFlowType, FormDataMasterBean formDataMasterBean) throws Exception { + log.info("明细表组织架构同一单位校验流程发起前监听"); + System.out.println("明细表组织架构同一单位校验流程发起前监听"); + WorkflowEventContext context = new WorkflowEventContext(); + context.setNeedSave(true); + String res = ""; + JSONObject template = JSONObject.parseObject(templateJson); + try { + String subTableName = template.getString("subTableName"); + log.info("当前获取表单名称为"+subTableName); + Map> subFormMap = formDataVo.getSubFormMap(); + List subFormDataVos = subFormMap.get(subTableName); + for(FormDataVo subFormDataVo:subFormDataVos){ + FieldDataVo memberFieldData = subFormDataVo.getFieldData(template.getString("memberName")); + String memberName = memberFieldData.getDisplay(); + FieldDataVo accountFieldData = subFormDataVo.getFieldData(template.getString("accountName")); + String accountId = ""; + if(accountFieldData.getDbValue()!=null){ + accountId = accountFieldData.getDbValue().toString(); +// 部门 + FieldDataVo departmentFieldData = subFormDataVo.getFieldData(template.getString("departmentName")); + String departmentId = ""; + if(departmentFieldData.getDbValue()!=null){ + departmentId = departmentFieldData.getDbValue().toString(); + log.info("当前部门信息为:"+departmentFieldData.getStringValue()+departmentFieldData.getDbValue()); + V3xOrgDepartment v3xOrgDepartment = orgManager.getDepartmentById(Long.parseLong(departmentId)); + long orgAccountId = v3xOrgDepartment.getOrgAccountId(); + if(!accountId.equals(String.valueOf(orgAccountId))){ + res = res + memberName+"所在明细行填写部门不在填写单位下,请重新选择;"; + } + } +// 岗位 + FieldDataVo postFieldData = subFormDataVo.getFieldData(template.getString("postName")); + String postId = ""; + if(postFieldData.getDbValue()!=null){ + postId = postFieldData.getDbValue().toString(); + log.info("当前岗位信息为:"+postFieldData.getStringValue()+postFieldData.getDbValue()); + V3xOrgPost v3xOrgPost = orgManager.getPostById(Long.parseLong(postId)); + long orgAccountId = v3xOrgPost.getOrgAccountId(); + if(!accountId.equals(String.valueOf(orgAccountId))){ + res = res + memberName+"所在明细行填写岗位不在填写单位下,请重新选择;"; + } + } +// 职务级别 + FieldDataVo levelFieldData = subFormDataVo.getFieldData(template.getString("levelName")); + String levelId = ""; + if(levelFieldData.getDbValue()!=null){ + levelId = levelFieldData.getDbValue().toString(); + log.info("当前职务级别信息为:"+levelFieldData.getStringValue()+levelFieldData.getDbValue()); + V3xOrgLevel v3xOrgLevel = orgManager.getLevelById(Long.parseLong(levelId)); + long orgAccountId = v3xOrgLevel.getOrgAccountId(); + if(!accountId.equals(String.valueOf(orgAccountId))){ + res = res + memberName+"所在明细行填写职务级别不在填写单位下,请重新选择;"; + } + } + }else{ + res = res + memberName+"所在明细行未查询到单位信息,请选择;"; + } + } + } catch (Exception e) { + context.setSuccess(false); + context.setErrMsg("流程发起失败:OA处理异常:" + e.getMessage()); + } + if(res.length()>0){ + context.setSuccess(false); + context.setErrMsg(res); + }else{ + context.setSuccess(true); + context.setErrMsg("校验成功提交流程"); + } + return context; + } + + @Override + public String getPluginId() { + return PersonnelFlowConstants.getPluginId(); + } + + @Override + public String getFormParse() { + return "json"; + } + + @Override + public WorkFlowType[] getTypes() { + return new WorkFlowType[]{WorkFlowType.onBeforeStart,WorkFlowType.onBeforeStop}; + } + + @Override + public String getId() { + return "OrganizationUnifyOnBeforeStartEvent"; + } + + @Override + public String getLabel() { + return "明细表组织架构同一单位校验流程发起前监听"; + } + + +} diff --git a/v5/apps-customize/src/main/java/com/seeyon/apps/src_personnelflow/event/PersonnelFlowCancelEvent.java b/v5/apps-customize/src/main/java/com/seeyon/apps/src_personnelflow/event/PersonnelFlowCancelEvent.java new file mode 100644 index 0000000..76c8c50 --- /dev/null +++ b/v5/apps-customize/src/main/java/com/seeyon/apps/src_personnelflow/event/PersonnelFlowCancelEvent.java @@ -0,0 +1,129 @@ +package com.seeyon.apps.src_personnelflow.event; + +import cn.hutool.log.Log; +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; +import com.seeyon.apps.common.workflow.constants.WorkFlowType; +import com.seeyon.apps.common.workflow.event.ACommonWorkflowEvent; +import com.seeyon.apps.ext.workflow.vo.FormDataVo; +import com.seeyon.apps.ext.workflow.vo.WorkflowEventContext; +import com.seeyon.apps.src_personnelflow.config.PluginConfigProvider; +import com.seeyon.apps.src_personnelflow.constants.PersonnelFlowConstants; +import com.seeyon.apps.src_personnelflow.tool.WeaverUtil; +import com.seeyon.cap4.form.bean.FormDataMasterBean; +import com.seeyon.ctp.common.AppContext; + +import java.util.*; + +public class PersonnelFlowCancelEvent extends ACommonWorkflowEvent { + private static Log log = Log.get(PersonnelFlowCancelEvent.class); + private PluginConfigProvider configProvider = (PluginConfigProvider) AppContext.getBean("pluginConfigProvider"); + + private Map buildParams(String flowId) { + Map map = new HashMap<>(); + map.put("requestId",flowId); + map.put("ipPort",configProvider.getBizConfigByKey(PersonnelFlowConstants.weaverApiIpPort)); + map.put("secret",configProvider.getBizConfigByKey(PersonnelFlowConstants.weaverAppSecret)); + map.put("appId",configProvider.getBizConfigByKey(PersonnelFlowConstants.weaverAppId)); + map.put("userId",configProvider.getBizConfigByKey(PersonnelFlowConstants.weaverBpmId)); + map.put("spk",configProvider.getBizConfigByKey(PersonnelFlowConstants.weaverAppSpk)); + return map; + } + + @Override + protected WorkflowEventContext proceed(String templateJson, FormDataVo formDataVo, WorkFlowType workFlowType, FormDataMasterBean formDataMasterBean) throws Exception { + log.info("进入人事流程回退处理"); + WorkflowEventContext context = new WorkflowEventContext(); + context.setNeedSave(true); + try { + String waveFlowId = formDataVo.getFieldData("泛微流程ID").getStringValue(); + log.info("泛微流程ID"+waveFlowId); +// List> callbackParams = new ArrayList<>(); +// 封装请求参数 + JSONObject jsonObject = JSONObject.parseObject(templateJson); +// 处理流程审批意见 + String remark = formatRemark(jsonObject.getString("hxyj")); + jsonObject.put("hxyj",remark); +// 当前为默认字段,只有回退操作才需要赋值 + jsonObject.put("sfth","1");//是否退回 +// String remark = formatRemark(formDataVo.getFieldData("审批意见").getStringValue()); +// for (Map.Entry entry : jsonObject.entrySet()) { +// Map temp = new HashMap<>(); +// temp.put("fieldName",) +// } + Set jsonObjectKeys = jsonObject.keySet(); +// Map temp = new HashMap<>(); + JSONArray temps = new JSONArray(); + for(String jsonObjectKey : jsonObjectKeys){ + JSONObject temp = new JSONObject(); + temp.put("fieldName",jsonObjectKey); + temp.put("fieldValue",jsonObject.getString(jsonObjectKey)); +// temp.put(jsonObjectKey,jsonObject.getString(jsonObjectKey)); + temps.add(temp); + } + log.info(temps.toString()); +// Map temp = new HashMap<>(); +// temp.put("fieldName","spyj"); +// temp.put("fieldValue",remark); + Map params = buildParams(waveFlowId); + params.put("mainData",temps.toString()); + context.setRequest(params.toString()); + String resp = WeaverUtil.reject(params); + context.setResponse(resp); + JSONObject response = JSONObject.parseObject(resp); + if("SUCCESS".equals(response.get("code"))) { + log.info("成功"); + context.setSuccess(true); + context.setErrMsg("流程 回退成功"); + formDataVo.getNewFieldDataMap().put("流程回退客户平台结果", "流程回退成功"); + } else { + context.setSuccess(false); + log.info("流程回退失败:" + response.get("errMsg")); + context.setErrMsg("流程回退失败:" + response.get("errMsg")); + formDataVo.getNewFieldDataMap().put("流程回退客户平台结果", "流程回退失败:" + response.get("errMsg")); + } + } catch (Exception e) { + context.setSuccess(false); + log.info("回退流程失败:OA处理异常:" + e.getMessage()); + context.setErrMsg("回退流程失败:OA处理异常:" + e.getMessage()); + formDataVo.getNewFieldDataMap().put("调用泛微OA返回结果", "回退流程失败:OA处理异常" + e.getMessage()); + } + return context; + } + + @Override + public String getPluginId() { + return PersonnelFlowConstants.getPluginId(); + } + + @Override + public String getFormParse() { + return "json"; + } + + @Override + public WorkFlowType[] getTypes() { + return new WorkFlowType[]{WorkFlowType.onBeforeCancel,WorkFlowType.onBeforeStop}; + } + + @Override + public String getId() { + return "personnelFlowCancelEvent"; + } + + @Override + public String getLabel() { + return "客户服务平台流程撤销事件"; + } + + private String formatRemark(String source) { + String[] split = source.split(System.lineSeparator()); + StringBuilder sb = new StringBuilder(""); + for (String s : split) { + if(s.contains("【")) { + sb.append(s + System.lineSeparator()); + } + } + return sb.toString(); + } +} diff --git a/v5/apps-customize/src/main/java/com/seeyon/apps/src_personnelflow/node/AccountCloseCommonNode.java b/v5/apps-customize/src/main/java/com/seeyon/apps/src_personnelflow/node/AccountCloseCommonNode.java new file mode 100644 index 0000000..e2268b6 --- /dev/null +++ b/v5/apps-customize/src/main/java/com/seeyon/apps/src_personnelflow/node/AccountCloseCommonNode.java @@ -0,0 +1,214 @@ +package com.seeyon.apps.src_personnelflow.node; + +import cn.hutool.log.Log; +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; +import com.seeyon.apps.common.config.ICstConfigApi; +import com.seeyon.apps.common.plugin.vo.ConfigVo; +import com.seeyon.apps.common.workflow.node.ACommonSuperNode; +import com.seeyon.apps.ext.workflow.vo.FieldDataVo; +import com.seeyon.apps.ext.workflow.vo.FormDataVo; +import com.seeyon.apps.ext.workflow.vo.SuperNodeContext; +import com.seeyon.apps.src_personnelflow.constants.PersonnelFlowConstants; +import com.seeyon.apps.src_personnelflow.util.DataProcessingUtil; +import com.seeyon.apps.src_personnelflow.util.ProtUtil; +import com.seeyon.apps.src_personnelflow.vo.MemberManagerResponse; +import com.seeyon.cap4.form.bean.FormDataMasterBean; +import com.seeyon.ctp.common.AppContext; +import com.seeyon.ctp.util.UUIDLong; +import www.seeyon.com.utils.StringUtil; + +import java.util.List; +import java.util.Map; + +public class AccountCloseCommonNode extends ACommonSuperNode { + + private static Log log = Log.get(AccountCloseCommonNode.class); + + protected ICstConfigApi cstConfigApi = (ICstConfigApi) AppContext.getBean("cstConfigApi"); + + public ConfigVo getPersonnelFloweConfig() { + return cstConfigApi.getConfig(getPluginId()); + } + + @Override + public String getFormParse() { + return ""; + } + + public ConfigVo getPlConfig() { + return cstConfigApi.getConfig(getPluginId()); + } + + public ConfigVo getMemberMamageConfig() { + return cstConfigApi.getConfig(getPluginId()); + } + + public SuperNodeContext proceed(String request, FormDataVo formDataVo, FormDataMasterBean formDataMasterBean) throws Exception { + log.info("进入人事档案表离职处理流程"+getNodeId()); + ConfigVo configVo = getMemberMamageConfig(); + SuperNodeContext context = new SuperNodeContext(); + context.setNeedSave(true); + JSONObject paramJson = JSONObject.parseObject(request); + String enumFields = paramJson.getString("enumFields"); + String mainUrl = configVo.getParamVal(PersonnelFlowConstants.mainUrl.name()); + String getzsjTokenUrl = configVo.getParamVal(PersonnelFlowConstants.getzsjTokenUrl.name()); + String restzsjUserName = configVo.getParamVal(PersonnelFlowConstants.restzsjUserName.name()); + String restzsjPassword = configVo.getParamVal(PersonnelFlowConstants.restzsjPassword.name()); + String zsjloginName = configVo.getParamVal(PersonnelFlowConstants.zsjloginName.name()); +// 调用接口查询主数据token + String mainToken = ProtUtil.getToken(getzsjTokenUrl,restzsjUserName,restzsjPassword,zsjloginName); +// 获取当前表单数据 + Map> SubFormMap = formDataVo.getSubFormMap(); + List subForms = SubFormMap.get("人员明细"); + for (FormDataVo subFormDataVo : subForms) { +// 每一行就是一个变更数据封装封装修改的人员参数执行修改操作 + JSONObject isExistUpdateParam = new JSONObject(); + isExistUpdateParam.put("formCode",paramJson.getString("formCode")); + JSONObject uniqueness = new JSONObject(); + JSONObject uniquenessjson = paramJson.getJSONObject("uniqueness"); + for (Map.Entry entry:uniquenessjson.entrySet()) { + FieldDataVo fieldDataVo = subFormDataVo.getFieldData(entry.getValue().toString()); + uniqueness.put(entry.getKey(),fieldDataVo.getDbValue()); + } + isExistUpdateParam.put("uniqueness",uniqueness); +// 调用接口查询当前数据是否存在 + String isExistUpdateUrl = mainUrl+"/seeyon/rest/formTable/quart?token="+mainToken; + String formmainIdUpdate = ProtUtil.doGet(isExistUpdateUrl,isExistUpdateParam); + JSONObject formmainIdUpdatejson = JSONObject.parseObject(formmainIdUpdate); + JSONObject formmainIdUpdateData = formmainIdUpdatejson.getJSONObject("data"); + String formmainUpdate = formmainIdUpdateData.getString("id"); + if(StringUtil.isNotEmpty(formmainUpdate)){ +// 当前数据已经存在执行修改逻辑 + JSONObject param = new JSONObject(); +// 设置基本数据 + param.put("doTrigger",paramJson.getBooleanValue("doTrigger")); + param.put("formCode",paramJson.getString("formCode")); + param.put("loginName",paramJson.getString("loginName")); + param.put("rightId",paramJson.getString("rightIdUpdate")); + JSONArray dataList = new JSONArray(); + JSONObject data = new JSONObject(); + JSONObject paramDataList = paramJson.getJSONObject("dataList"); + JSONObject paramMasterTable = paramDataList.getJSONObject("masterTable"); + JSONObject masterTable = new JSONObject(); + masterTable.put("name",paramMasterTable.getString("name")); + JSONObject record = new JSONObject(); + record.put("id",formmainUpdate); +// 根据主表字段信息,设置主表参数 + JSONArray fields = new JSONArray(); + for (Map.Entry entry : paramMasterTable.getJSONObject("fields").entrySet()) { + JSONObject jsonObject = new JSONObject(); + jsonObject.put("name",entry.getKey()); + String value = entry.getValue().toString(); + FieldDataVo subFieldDataVo; + try { + subFieldDataVo = subFormDataVo.getFieldData(value); + } catch (NoSuchFieldException e) { + subFieldDataVo = formDataVo.getFieldData(value); + } + if(enumFields.contains(entry.getKey())){ + String subFieldValue = subFieldDataVo.getStringValue(); + jsonObject.put("showValue",subFieldValue); + }else{ + String subFieldDataDb = subFieldDataVo.getDbValue().toString(); + jsonObject.put("value",subFieldDataDb); + } + fields.add(jsonObject); + } + record.put("fields",fields); + masterTable.put("record",record); + data.put("masterTable",masterTable); +// 根据明细表字段信息,设置明细表参数 + JSONArray subTables = new JSONArray(); + JSONArray paramSubTables = paramDataList.getJSONArray("subTables"); + for(int i = 0 ; i < paramSubTables.size();i++){ + JSONObject paramSubTable = paramSubTables.getJSONObject(i); + JSONObject subTable = new JSONObject(); + subTable.put("name",paramSubTable.getString("tableName")); + JSONArray subRecords = new JSONArray(); + JSONObject subRecord = new JSONObject(); + subRecord.put("id", UUIDLong.longUUID()+""); + JSONArray subFields = new JSONArray(); + for (Map.Entry entry : paramSubTable.getJSONObject("fields").entrySet()) { + JSONObject jsonObject = new JSONObject(); + jsonObject.put("name",entry.getKey()); + String value = entry.getValue().toString(); + FieldDataVo subFieldDataVo ; + try { + subFieldDataVo = subFormDataVo.getFieldData(value); + } catch (NoSuchFieldException e) { + subFieldDataVo = formDataVo.getFieldData(value); + } + if(subFieldDataVo.getDbValue() == null){ + jsonObject.put("value",""); + }else{ + String subFieldDataDb = subFieldDataVo.getDbValue().toString(); + jsonObject.put("value",subFieldDataDb); + } + subFields.add(jsonObject); + } + subRecord.put("fields",subFields); + subRecords.add(subRecord); + subTable.put("records",subRecords); + subTables.add(subTable); + } + data.put("subTables",subTables); + dataList.add(data); + param.put("dataList",dataList); + context.setRequest(param.toString()); + log.info(param.toString()); +// 获取调用接口路径 + String formmainUpdateUrl = mainUrl+"/seeyon/rest/cap4/form/soap/batch-update?token="+mainToken; + context.setUrl(formmainUpdateUrl); + JSONObject res = ProtUtil.doPost(param.toString(),formmainUpdateUrl); + log.info(res.toString()); + context.setResponse(res.toString()); + MemberManagerResponse mmr = new MemberManagerResponse(res); + if(mmr.isSuccess()){ + String resDatastr = mmr.getData(); + Map resData = DataProcessingUtil.convertStringToMap(resDatastr); + List successIdList = (List)resData.get("successIdList"); + if(successIdList.size()>0){ + String fid = successIdList.get(0); + log.info("档案表修改完成,返回结果为"+resDatastr); + context.success("档案表修改完成,当前档案表ID为"+fid,false); + formDataVo.getNewFieldDataMap().put("返回结果", "档案表修改完成,当前档案表ID为"+fid); + }else{ + Map failedData = (Map)resData.get("failedData"); + for (Map.Entry entry:failedData.entrySet()) { + context.back("档案表修改失败:创建异常:" + entry.getValue()); + context.setErrMsg(mmr.getMsg()); + formDataVo.getNewFieldDataMap().put("返回结果", "档案表修改失败:创建异常:"+entry.getValue()); + } + } + + }else{ + context.back("档案表修改失败:修改异常:" + mmr.getMsg()); + context.setErrMsg(mmr.getMsg()); + formDataVo.getNewFieldDataMap().put("返回结果", "档案表修改失败:修改异常:"+mmr.getMsg()); + } + }else{ + context.success("没有查询到需要修改的数据,跳过处理"); + formDataVo.getNewFieldDataMap().put("返回结果", "没有查询到需要修改的数据,跳过处理"); + } + } + return context; + } + + @Override + public String getPluginId() { + return PersonnelFlowConstants.getPluginId(); + } + + @Override + public String getNodeId() { + return "AccountCloseCommonNode"; + } + + @Override + public String getNodeName() { + return "人员账号批量关闭档案表超级节点"; + } + + +} diff --git a/v5/apps-customize/src/main/java/com/seeyon/apps/src_personnelflow/node/AccountCloseOrganizationNode.java b/v5/apps-customize/src/main/java/com/seeyon/apps/src_personnelflow/node/AccountCloseOrganizationNode.java new file mode 100644 index 0000000..d783cc1 --- /dev/null +++ b/v5/apps-customize/src/main/java/com/seeyon/apps/src_personnelflow/node/AccountCloseOrganizationNode.java @@ -0,0 +1,146 @@ +package com.seeyon.apps.src_personnelflow.node; + +import cn.hutool.log.Log; +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; +import com.seeyon.apps.common.config.ICstConfigApi; +import com.seeyon.apps.common.plugin.vo.ConfigVo; +import com.seeyon.apps.common.workflow.node.ACommonSuperNode; +import com.seeyon.apps.ext.workflow.vo.FieldDataVo; +import com.seeyon.apps.ext.workflow.vo.FormDataVo; +import com.seeyon.apps.ext.workflow.vo.SuperNodeContext; +import com.seeyon.apps.src_personnelflow.constants.PersonnelFlowConstants; +import com.seeyon.apps.src_personnelflow.util.DataProcessingUtil; +import com.seeyon.apps.src_personnelflow.util.ProtUtil; +import com.seeyon.apps.src_personnelflow.vo.MemberManagerResponse; +import com.seeyon.cap4.form.bean.FormDataMasterBean; +import com.seeyon.ctp.common.AppContext; +import com.seeyon.ctp.organization.bo.V3xOrgMember; +import com.seeyon.ctp.organization.manager.OrgManager; +import com.seeyon.ctp.util.UUIDLong; +import www.seeyon.com.utils.StringUtil; + +import javax.inject.Inject; +import java.util.List; +import java.util.Map; + +public class AccountCloseOrganizationNode extends ACommonSuperNode { + + private static Log log = Log.get(AccountCloseOrganizationNode.class); + + protected ICstConfigApi cstConfigApi = (ICstConfigApi) AppContext.getBean("cstConfigApi"); + + public ConfigVo getPersonnelFloweConfig() { + return cstConfigApi.getConfig(getPluginId()); + } + + @Inject + private OrgManager orgManager; + + @Override + public String getFormParse() { + return ""; + } + + public ConfigVo getPlConfig() { + return cstConfigApi.getConfig(getPluginId()); + } + + public ConfigVo getMemberMamageConfig() { + return cstConfigApi.getConfig(getPluginId()); + } + + public SuperNodeContext proceed(String request, FormDataVo formDataVo, FormDataMasterBean formDataMasterBean) throws Exception { + log.info("进入人事组织机构处理流程"+getNodeId()); + ConfigVo configVo = getMemberMamageConfig(); + SuperNodeContext context = new SuperNodeContext(); + context.setNeedSave(true); + String mainUrl = configVo.getParamVal(PersonnelFlowConstants.mainUrl.name()); + String getzsjTokenUrl = configVo.getParamVal(PersonnelFlowConstants.getzsjTokenUrl.name()); + String restzsjUserName = configVo.getParamVal(PersonnelFlowConstants.restzsjUserName.name()); + String restzsjPassword = configVo.getParamVal(PersonnelFlowConstants.restzsjPassword.name()); + String zsjloginName = configVo.getParamVal(PersonnelFlowConstants.zsjloginName.name()); +// 调用接口查询主数据token + String mainToken = ProtUtil.getToken(getzsjTokenUrl,restzsjUserName,restzsjPassword,zsjloginName); + + JSONObject req = JSONObject.parseObject(request); + JSONArray subTables = req.getJSONArray("subTable"); + int isSuccess = 0; + String ret = ""; + String subTableName = req.getString("subTableName"); + List subFormDataVos = formDataVo.getSubFormMap().get(subTableName); + for(int i = 0 ; i < subTables.size() ; i++){ + JSONObject subTable = subTables.getJSONObject(i); + FormDataVo subFormDataVo = subFormDataVos.get(i); +// 查询当前人员是否存在 + String memberIdName = subTable.getString("id"); + FieldDataVo memberField = subFormDataVo.getFieldData(memberIdName); + String memberId = memberField.getDbValue().toString(); + String accountIdName = subTable.getString("orgAccountId"); + FieldDataVo accountField = subFormDataVo.getFieldData(accountIdName); + String accountId = accountField.getDbValue().toString(); + subTable.put("orgAccountId",accountId); + V3xOrgMember v3xOrgMember = orgManager.getMemberById(Long.parseLong(memberId)); + String isExistUpdateUrl = mainUrl+"/seeyon/rest/orgMember/"+memberId+"?token="+mainToken; + String memberstr = ProtUtil.doGet(isExistUpdateUrl, new JSONObject()); + if(!"null".equals(memberstr)){ + isSuccess++; +// 当前人员已存在 + JSONObject memberjson = JSONObject.parseObject(memberstr); + if(memberjson.getBooleanValue("isDeleted")){ +// 当前人员已经删除 + ret = ret+memberjson.getString("name")+"已经删除,无法修改;"; + }else{ +// 当前人员存在,执行修改 + subTable.put("id",memberId); + String memberOrganizationUpdateUrl = mainUrl+"/seeyon/rest/orgMember/updateMemberMain?token="+mainToken; + JSONObject res = ProtUtil.doPost(subTable.toString(),memberOrganizationUpdateUrl); + log.info(res.toString()); + + if(res.getInteger("code")==0){ + JSONObject data = res.getJSONObject("data"); + ret+=data.getString("name")+"修改成功"; + log.info("人员组织架构修改完成:人员名称为"+data.getString("name")+",ID为"+data.getString("id")); + + }else{ + isSuccess--; + String message = res.getString("message"); + ret+=memberjson.getString("name")+"修改失败"+message; + log.info("人员组织架构修改失败:人员名称为"+memberjson.getString("name")+",ID为"+memberjson.getString("id")+message); + } + } + }else{ +// 人员不存在 + ret = ret+v3xOrgMember.getName()+"不存在,无法修改;"; + } + context.setRequest(subTables.toString()); + context.setResponse(ret); + } + if(isSuccess == subTables.size()){ + context.success(ret,false); + formDataVo.getNewFieldDataMap().put("组织返回结果", ret); + }else{ + log.info(ret); + context.back(ret); + formDataVo.getNewFieldDataMap().put("组织返回结果", ret); + } + return context; + } + + @Override + public String getPluginId() { + return PersonnelFlowConstants.getPluginId(); + } + + @Override + public String getNodeId() { + return "AccountCloseOrganizationNode"; + } + + @Override + public String getNodeName() { + return "人员账号批量关闭组织架构超级节点"; + } + + +} diff --git a/v5/apps-customize/src/main/java/com/seeyon/apps/src_personnelflow/node/ApplyForFullMemberNode.java b/v5/apps-customize/src/main/java/com/seeyon/apps/src_personnelflow/node/ApplyForFullMemberNode.java new file mode 100644 index 0000000..5d77eff --- /dev/null +++ b/v5/apps-customize/src/main/java/com/seeyon/apps/src_personnelflow/node/ApplyForFullMemberNode.java @@ -0,0 +1,169 @@ +package com.seeyon.apps.src_personnelflow.node; + +import cn.hutool.log.Log; +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; +import com.seeyon.aicloud.common.JsonUtils; +import com.seeyon.apps.common.config.ICstConfigApi; +import com.seeyon.apps.common.plugin.vo.ConfigVo; +import com.seeyon.apps.common.workflow.node.ACommonSuperNode; +import com.seeyon.apps.ext.workflow.vo.FormDataVo; +import com.seeyon.apps.ext.workflow.vo.SuperNodeContext; +import com.seeyon.apps.src_personnelflow.constants.PersonnelFlowConstants; +import com.seeyon.apps.src_personnelflow.tool.WeaverUtil; +import com.seeyon.cap4.form.bean.FormDataMasterBean; +import com.seeyon.ctp.common.AppContext; + +import java.util.*; + +public class ApplyForFullMemberNode extends ACommonSuperNode { + private static Log log = Log.get(ApplyForFullMemberNode.class); + protected ICstConfigApi cstConfigApi = (ICstConfigApi) AppContext.getBean("cstConfigApi"); + +// protected String ip = "10.0.1.55"; +// protected String port = "80"; + @Override + public String getFormParse() { + return ""; + } + + public ConfigVo getPlConfig() { + return cstConfigApi.getConfig(getPluginId()); + } + + private Map buildParams(String flowId) { + Map map = new HashMap<>(); + map.put("requestId",flowId); + map.put("ipPort",getBizConfigByKey(PersonnelFlowConstants.weaverApiIpPort)); + map.put("secret",getBizConfigByKey(PersonnelFlowConstants.weaverAppSecret)); + map.put("appId",getBizConfigByKey(PersonnelFlowConstants.weaverAppId)); + map.put("userId",getBizConfigByKey(PersonnelFlowConstants.weaverBpmId)); + map.put("spk",getBizConfigByKey(PersonnelFlowConstants.weaverAppSpk)); + return map; + } + private String formatRemark(String source) { + String[] split = source.split(System.lineSeparator()); + StringBuilder sb = new StringBuilder(""); + for (String s : split) { + if(s.contains("【")) { + sb.append(s + System.lineSeparator()); + } + } + return sb.toString(); + } + + public SuperNodeContext proceed(String templateJson, FormDataVo formDataVo, FormDataMasterBean formDataMasterBean) throws Exception { + SuperNodeContext context = new SuperNodeContext(); +// Map temp = new HashMap<>(); + log.info("进入转正流程数据超级节点中"); + Map map = new HashMap<>(); + context.setNeedSave(true); + JSONObject jsonObject = null; + JSONArray temps = new JSONArray(); + try { + jsonObject = JSONObject.parseObject(templateJson); + }catch (Exception e) { + } + try { + List> callbackParams = new ArrayList<>(); +// 审批意见 + String remark = formatRemark(jsonObject.getString("hxyj")); + jsonObject.put("hxyj",remark); +// 人事意见 + String rsyj = jsonObject.getString("rsyj"); + jsonObject.put("rsyj",rsyj); +// 试用期延长后日期 + String syqychrq = jsonObject.getString("syqychrq"); + jsonObject.put("syqychrq",syqychrq); +// 延长试用期 + String ycsyq = jsonObject.getString("ycsyq"); + jsonObject.put("ycsyq",ycsyq); +// 不予录用理由 + String bylyly = jsonObject.getString("bylyly"); + jsonObject.put("bylyly",bylyly); +// 意见说明 + String yjsm = jsonObject.getString("yjsm"); + jsonObject.put("yjsm",yjsm); + + Set jsonObjectKeys = jsonObject.keySet(); +// Map temp = new HashMap<>(); + for(String jsonObjectKey : jsonObjectKeys){ + JSONObject temp = new JSONObject(); + temp.put("fieldName",jsonObjectKey); + temp.put("fieldValue",jsonObject.getString(jsonObjectKey)); + temps.add(temp); +// temp.put(jsonObjectKey,jsonObject.getString(jsonObjectKey)); + } + String waveFlowId = formDataVo.getFieldData("泛微流程ID").getStringValue(); + Map params = buildParams(waveFlowId); + System.out.println(params); + params.put("mainData",temps.toString()); + String resp = WeaverUtil.submit(params); + JSONObject response = JSONObject.parseObject(resp); + log.info(resp); + log.info("调泛微OA code:" + response.get("code")); + if ("SUCCESS".equals(response.get("code"))) { + //调用提交接口 + map.put("code", "200"); + map.put("msg", "提交成功"); + map.put("response", resp); + } else { +// Map data = (Map) returnMsg.get("errMsg"); + map.put("code", "300"); + map.put("msg", "提交流程失败!"+ response.get("errMsg")); + map.put("response", resp); + } + } catch (Exception e) { + context.setErrMsg("调用失败:"+e); + context.setException(true); + context.back("调用失败:"+e); + } + try{ + context.setRequest(temps.toString()); + context.setResponse(map.get("response").toString()); + Object jsoncode = map.get("code"); + if ("200".equals(jsoncode.toString())) { + context.success(map.get("msg").toString(), false); + formDataVo.getNewFieldDataMap().put("返回结果",map.get("msg").toString()); + } else { + context.setErrMsg(map.get("msg").toString()); + context.setException(true); + context.back("推送失败:" +map.get("msg").toString()); + formDataVo.getNewFieldDataMap().put("返回结果","推送失败:"+map.get("msg").toString()); + } + }catch (Exception e){ + context.setException(true); + context.back("推送失败:OA处理异常:" + e.getMessage()); + formDataVo.getNewFieldDataMap().put("返回结果","推送失败:OA处理异常:"+map.get("msg").toString()); + } + return context; + } + + protected String getBizConfigByKey(PersonnelFlowConstants key) { + ConfigVo config = cstConfigApi.getConfig(getPluginId()); + return config.getParamVal(key.name()); + } + + protected String buildOrgData(Map params) { + Map data = new HashMap<>(); + for (String key : params.keySet()) { + data.put(key,params.get(key)); + } + return JsonUtils.toJSONString(data); + } + + @Override + public String getPluginId() { + return PersonnelFlowConstants.getPluginId(); + } + + @Override + public String getNodeId() { + return "ApplyForFullMemberNode"; + } + + @Override + public String getNodeName() { + return "客户服务平台转正流程提交超级节点"; + } +} diff --git a/v5/apps-customize/src/main/java/com/seeyon/apps/src_personnelflow/node/LeaveAndBusinessTriNode.java b/v5/apps-customize/src/main/java/com/seeyon/apps/src_personnelflow/node/LeaveAndBusinessTriNode.java new file mode 100644 index 0000000..4fd04b6 --- /dev/null +++ b/v5/apps-customize/src/main/java/com/seeyon/apps/src_personnelflow/node/LeaveAndBusinessTriNode.java @@ -0,0 +1,170 @@ +package com.seeyon.apps.src_personnelflow.node; + +import cn.hutool.log.Log; +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; +import com.seeyon.aicloud.common.JsonUtils; +import com.seeyon.apps.common.config.ICstConfigApi; +import com.seeyon.apps.common.plugin.vo.ConfigVo; +import com.seeyon.apps.common.workflow.node.ACommonSuperNode; +import com.seeyon.apps.ext.workflow.vo.FormDataVo; +import com.seeyon.apps.ext.workflow.vo.SuperNodeContext; +import com.seeyon.apps.src_personnelflow.constants.PersonnelFlowConstants; +import com.seeyon.apps.src_personnelflow.tool.WeaverUtil; +import com.seeyon.cap4.form.bean.FormDataMasterBean; +import com.seeyon.ctp.common.AppContext; + +import java.util.*; + +public class LeaveAndBusinessTriNode extends ACommonSuperNode { + private static Log log = Log.get(LeaveAndBusinessTriNode.class); + protected ICstConfigApi cstConfigApi = (ICstConfigApi) AppContext.getBean("cstConfigApi"); + +// protected String ip = "10.0.1.55"; +// protected String port = "80"; + @Override + public String getFormParse() { + return ""; + } + + public ConfigVo getPlConfig() { + return cstConfigApi.getConfig(getPluginId()); + } + + private Map buildParams(String flowId) { + Map map = new HashMap<>(); + map.put("requestId",flowId); + map.put("ipPort",getBizConfigByKey(PersonnelFlowConstants.weaverApiIpPort)); + map.put("secret",getBizConfigByKey(PersonnelFlowConstants.weaverAppSecret)); + map.put("appId",getBizConfigByKey(PersonnelFlowConstants.weaverAppId)); + map.put("userId",getBizConfigByKey(PersonnelFlowConstants.weaverBpmId)); + map.put("spk",getBizConfigByKey(PersonnelFlowConstants.weaverAppSpk)); + return map; + } + private String formatRemark(String source) { + String[] split = source.split(System.lineSeparator()); + StringBuilder sb = new StringBuilder(""); + for (String s : split) { + if(s.contains("【")) { + sb.append(s + System.lineSeparator()); + } + } + return sb.toString(); + } + + public SuperNodeContext proceed(String templateJson, FormDataVo formDataVo, FormDataMasterBean formDataMasterBean) throws Exception { + SuperNodeContext context = new SuperNodeContext(); +// Map temp = new HashMap<>(); + log.info("进入请假出差流程数据超级节点中"); + Map map = new HashMap<>(); + context.setNeedSave(true); + JSONObject jsonObject = null; + JSONArray temps = new JSONArray(); + try { + jsonObject = JSONObject.parseObject(templateJson); + }catch (Exception e) { + } + try { + List> callbackParams = new ArrayList<>(); + +// 处理流程审批意见 + String remark = formatRemark(jsonObject.getString("hxyj")); + jsonObject.put("hxyj",remark); + + String tybty = jsonObject.getString("tybty"); + jsonObject.put("tybty",tybty); + + String yjsm = jsonObject.getString("yjsm"); + jsonObject.put("yjsm",yjsm); + + Set jsonObjectKeys = jsonObject.keySet(); +// Map temp = new HashMap<>(); + for(String jsonObjectKey : jsonObjectKeys){ + JSONObject temp = new JSONObject(); + temp.put("fieldName",jsonObjectKey); + temp.put("fieldValue",jsonObject.getString(jsonObjectKey)); + temps.add(temp); +// temp.put(jsonObjectKey,jsonObject.getString(jsonObjectKey)); + } +// context.setRequest(temps.toString()); +// String remark = formatRemark(formDataVo.getFieldData("审批意见").getStringValue()); +// for (Map.Entry entry : jsonObject.entrySet()) { +// Map temp = new HashMap<>(); +// temp.put("fieldName",) +// } +// temp.put("fieldName","spyj"); +// temp.put("fieldValue",remark); + String waveFlowId = formDataVo.getFieldData("泛微流程ID").getStringValue(); + Map params = buildParams(waveFlowId); + System.out.println(params); + params.put("mainData",temps.toString()); + String resp = WeaverUtil.submit(params); + JSONObject response = JSONObject.parseObject(resp); + log.info(resp); + log.info("调泛微OA code:" + response.get("code")); + if ("SUCCESS".equals(response.get("code"))) { + //调用提交接口 + map.put("code", "200"); + map.put("msg", "提交成功"); + map.put("response", resp); + } else { +// Map data = (Map) returnMsg.get("errMsg"); + map.put("code", "300"); + map.put("msg", "提交流程失败!"+ response.get("errMsg")); + map.put("response", resp); + } + } catch (Exception e) { + context.setErrMsg("调用失败:"+e); + context.setException(true); + context.back("调用失败:"+e); + } + try{ + context.setRequest(temps.toString()); + context.setResponse(map.get("response").toString()); + Object jsoncode = map.get("code"); + if ("200".equals(jsoncode.toString())) { + context.success(map.get("msg").toString(), false); + formDataVo.getNewFieldDataMap().put("返回结果",map.get("msg").toString()); + } else { + context.setErrMsg(map.get("msg").toString()); + context.setException(true); + context.back("推送失败:" +map.get("msg").toString()); + formDataVo.getNewFieldDataMap().put("返回结果","推送失败:"+map.get("msg").toString()); + } + }catch (Exception e){ + context.setException(true); + context.back("推送失败:OA处理异常:" + e.getMessage()); + formDataVo.getNewFieldDataMap().put("返回结果","推送失败:OA处理异常:"+map.get("msg").toString()); + } + + return context; + } + + protected String getBizConfigByKey(PersonnelFlowConstants key) { + ConfigVo config = cstConfigApi.getConfig(getPluginId()); + return config.getParamVal(key.name()); + } + + protected String buildOrgData(Map params) { + Map data = new HashMap<>(); + for (String key : params.keySet()) { + data.put(key,params.get(key)); + } + return JsonUtils.toJSONString(data); + } + + @Override + public String getPluginId() { + return PersonnelFlowConstants.getPluginId(); + } + + @Override + public String getNodeId() { + return "LeaveAndBusinessTriNode"; + } + + @Override + public String getNodeName() { + return "客户服务平台请假出差流程提交超级节点"; + } +} diff --git a/v5/apps-customize/src/main/java/com/seeyon/apps/src_personnelflow/node/MemberInternalMobilizationNode.java b/v5/apps-customize/src/main/java/com/seeyon/apps/src_personnelflow/node/MemberInternalMobilizationNode.java new file mode 100644 index 0000000..0a9b59c --- /dev/null +++ b/v5/apps-customize/src/main/java/com/seeyon/apps/src_personnelflow/node/MemberInternalMobilizationNode.java @@ -0,0 +1,130 @@ +package com.seeyon.apps.src_personnelflow.node; + +import cn.hutool.log.Log; +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; +import com.seeyon.apps.common.config.ICstConfigApi; +import com.seeyon.apps.common.plugin.vo.ConfigVo; +import com.seeyon.apps.common.workflow.node.ACommonSuperNode; +import com.seeyon.apps.ext.workflow.vo.FieldDataVo; +import com.seeyon.apps.ext.workflow.vo.FormDataVo; +import com.seeyon.apps.ext.workflow.vo.SuperNodeContext; +import com.seeyon.apps.src_personnelflow.constants.PersonnelFlowConstants; +import com.seeyon.apps.src_personnelflow.util.ProtUtil; +import com.seeyon.cap4.form.bean.FormDataMasterBean; +import com.seeyon.ctp.common.AppContext; +import www.seeyon.com.utils.StringUtil; + +import java.util.*; + +public class MemberInternalMobilizationNode extends ACommonSuperNode { + private static Log log = Log.get(MemberInternalMobilizationNode.class); + protected ICstConfigApi cstConfigApi = (ICstConfigApi) AppContext.getBean("cstConfigApi"); + + public ConfigVo getPersonnelFloweConfig() { + return cstConfigApi.getConfig(getPluginId()); + } + + @Override + public String getFormParse() { + return ""; + } + + public ConfigVo getPlConfig() { + return cstConfigApi.getConfig(getPluginId()); + } + + public SuperNodeContext proceed(String templateJson, FormDataVo formDataVo, FormDataMasterBean formDataMasterBean) throws Exception { + SuperNodeContext context = new SuperNodeContext(); + ConfigVo configVo = getPersonnelFloweConfig(); +// Map temp = new HashMap<>(); + log.info("进入人员内部批量调动超级节点中"); + Map map = new HashMap<>(); + context.setNeedSave(true); + JSONObject jsonObject = null; + JSONArray temps = new JSONArray(); + String mainUrl = configVo.getParamVal(PersonnelFlowConstants.mainUrl.name()); + String getzsjTokenUrl = configVo.getParamVal(PersonnelFlowConstants.getzsjTokenUrl.name()); + String restzsjUserName = configVo.getParamVal(PersonnelFlowConstants.restzsjUserName.name()); + String restzsjPassword = configVo.getParamVal(PersonnelFlowConstants.restzsjPassword.name()); + String zsjloginName = configVo.getParamVal(PersonnelFlowConstants.zsjloginName.name()); +// 调用接口查询主数据token + String mainToken = ProtUtil.getToken(getzsjTokenUrl,restzsjUserName,restzsjPassword,zsjloginName); + try { +// 文本转换成json + jsonObject = JSONObject.parseObject(templateJson); + Map> subFormMap = formDataVo.getSubFormMap(); + List subFormDataVos = subFormMap.get(jsonObject.getString("subTableName")); + for (FormDataVo subFormDataVo:subFormDataVos) { +// 获取调动人ID + FieldDataVo memberFieldDataVo = subFormDataVo.getFieldData(jsonObject.getString("memberName")); + String memberId = memberFieldDataVo.getDbValue().toString(); +// 获取当前调动人,被调动进入的单位 + FieldDataVo accountFieldDataVo = subFormDataVo.getFieldData(jsonObject.getString("accountName")); + String accountId = accountFieldDataVo.getDbValue().toString(); +// 获取当前调动人,被调动进入的部门 + FieldDataVo departmentFieldDataVo = subFormDataVo.getFieldData(jsonObject.getString("departmentName")); + String departmentId = departmentFieldDataVo.getDbValue().toString(); +// 获取当前调动人,被调动进入的岗位 + FieldDataVo postFieldDataVo = subFormDataVo.getFieldData(jsonObject.getString("postName")); + String postId = postFieldDataVo.getDbValue().toString(); +// 获取当前调动人,被调动进入的职务级别 + FieldDataVo levelFieldDataVo = subFormDataVo.getFieldData(jsonObject.getString("levelName")); + String levelId = levelFieldDataVo.getDbValue().toString(); +// 封装当前行的人员调动数据 + JSONObject updateParamJson = new JSONObject(); + updateParamJson.put("id",memberId); + updateParamJson.put("orgAccountId",accountId); + updateParamJson.put("orgDepartmentId",departmentId); + updateParamJson.put("orgPostId",postId); + updateParamJson.put("orgLevelId",levelId); + + String isExistUpdateUrl = mainUrl+"/seeyon/rest/orgMember/"+memberId+"?token="+mainToken; + String isExistUpdate = ProtUtil.doGet(isExistUpdateUrl,new JSONObject()); +// 判断当前人员是否存在 + if(StringUtil.isNotEmpty(isExistUpdate)&&!"null".equals(isExistUpdate)) { +// 如果存在则执行修改操作 + String memberOrganizationUpdateUrl = mainUrl + "/seeyon/rest/orgMember/updateMemberMain?token=" + mainToken; + JSONObject res = ProtUtil.doPost(updateParamJson.toString(), memberOrganizationUpdateUrl); + log.info(res.toString()); + context.setResponse(res.toString()); + if (res.getInteger("code") == 0) { + String resDatastr = res.getString("data"); + JSONObject resDatajson = JSONObject.parseObject(resDatastr); + log.info("人员组织架构修改完成:人员名称为" + resDatajson.getString("name") + ",ID为" + resDatajson.getString("id")); +// context.success("人员组织架构修改完成:人员名称为" + resDatajson.getString("name"), false); + context.success("人员组织架构修改完成", false); +// formDataVo.getNewFieldDataMap().put("组织返回结果", "人员组织架构修改完成:人员名称为" + resDatajson.getString("name")); + } else { + String message = res.getString("message"); + log.info("人员组织架构修改失败:" + message); + context.back("人员组织架构修改失败:" + message); +// formDataVo.getNewFieldDataMap().put("组织返回结果", "人员组织架构修改失败:" + message); + context.setErrMsg(message); + break; + } + } + } + }catch (Exception e){ + context.setException(true); + context.back("推送失败:OA处理异常:" + e.getMessage()); +// formDataVo.getNewFieldDataMap().put("返回结果","OA处理异常:"+map.get("msg").toString()); + } + return context; + } + + @Override + public String getPluginId() { + return PersonnelFlowConstants.getPluginId(); + } + + @Override + public String getNodeId() { + return "MemberInternalMobilizationNode"; + } + + @Override + public String getNodeName() { + return "员工内部调动审批超级节点"; + } +} diff --git a/v5/apps-customize/src/main/java/com/seeyon/apps/src_personnelflow/node/MemberInternalMobilizationRecordNode.java b/v5/apps-customize/src/main/java/com/seeyon/apps/src_personnelflow/node/MemberInternalMobilizationRecordNode.java new file mode 100644 index 0000000..426449a --- /dev/null +++ b/v5/apps-customize/src/main/java/com/seeyon/apps/src_personnelflow/node/MemberInternalMobilizationRecordNode.java @@ -0,0 +1,210 @@ +package com.seeyon.apps.src_personnelflow.node; + +import cn.hutool.log.Log; +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; +import com.seeyon.apps.common.config.ICstConfigApi; +import com.seeyon.apps.common.plugin.vo.ConfigVo; +import com.seeyon.apps.common.workflow.node.ACommonSuperNode; +import com.seeyon.apps.ext.workflow.vo.FieldDataVo; +import com.seeyon.apps.ext.workflow.vo.FormDataVo; +import com.seeyon.apps.ext.workflow.vo.SuperNodeContext; +import com.seeyon.apps.src_personnelflow.constants.PersonnelFlowConstants; +import com.seeyon.apps.src_personnelflow.util.DataProcessingUtil; +import com.seeyon.apps.src_personnelflow.util.ProtUtil; +import com.seeyon.apps.src_personnelflow.vo.MemberManagerResponse; +import com.seeyon.cap4.form.bean.FormDataMasterBean; +import com.seeyon.ctp.common.AppContext; +import com.seeyon.ctp.util.UUIDLong; +import www.seeyon.com.utils.StringUtil; + +import java.util.List; +import java.util.Map; + +public class MemberInternalMobilizationRecordNode extends ACommonSuperNode { + + private static Log log = Log.get(MemberInternalMobilizationRecordNode.class); + + protected ICstConfigApi cstConfigApi = (ICstConfigApi) AppContext.getBean("cstConfigApi"); + + public ConfigVo getPersonnelFloweConfig() { + return cstConfigApi.getConfig(getPluginId()); + } + + @Override + public String getFormParse() { + return ""; + } + + public ConfigVo getPlConfig() { + return cstConfigApi.getConfig(getPluginId()); + } + + public ConfigVo getMemberMamageConfig() { + return cstConfigApi.getConfig(getPluginId()); + } + + public SuperNodeContext proceed(String request, FormDataVo formDataVo, FormDataMasterBean formDataMasterBean) throws Exception { + log.info("进入人事档案表处理流程"+getNodeId()); + ConfigVo configVo = getMemberMamageConfig(); + SuperNodeContext context = new SuperNodeContext(); + context.setNeedSave(true); + JSONObject paramJson = JSONObject.parseObject(request); + String mainUrl = configVo.getParamVal(PersonnelFlowConstants.mainUrl.name()); + String getzsjTokenUrl = configVo.getParamVal(PersonnelFlowConstants.getzsjTokenUrl.name()); + String restzsjUserName = configVo.getParamVal(PersonnelFlowConstants.restzsjUserName.name()); + String restzsjPassword = configVo.getParamVal(PersonnelFlowConstants.restzsjPassword.name()); + String zsjloginName = configVo.getParamVal(PersonnelFlowConstants.zsjloginName.name()); +// 调用接口查询主数据token + String mainToken = ProtUtil.getToken(getzsjTokenUrl,restzsjUserName,restzsjPassword,zsjloginName); +// 获取当前表单数据 + Map> SubFormMap = formDataVo.getSubFormMap(); + List subForms = SubFormMap.get("人员明细"); + for (FormDataVo subFormDataVo : subForms) { +// 每一行就是一个变更数据封装封装修改的人员参数执行修改操作 +// 创建唯一值查询参数 + JSONObject isExistUpdateParam = new JSONObject(); + isExistUpdateParam.put("formCode",paramJson.getString("formCode")); + JSONObject uniqueness = new JSONObject(); + JSONObject uniquenessjson = paramJson.getJSONObject("uniqueness"); + for (Map.Entry entry:uniquenessjson.entrySet()) { + FieldDataVo fieldDataVo = subFormDataVo.getFieldData(entry.getValue().toString()); + uniqueness.put(entry.getKey(),fieldDataVo.getDbValue()); + } + isExistUpdateParam.put("uniqueness",uniqueness); +// 调用接口查询当前数据是否存在 + String isExistUpdateUrl = mainUrl+"/seeyon/rest/formTable/quart?token="+mainToken; + String formmainIdUpdate = ProtUtil.doGet(isExistUpdateUrl,isExistUpdateParam); + JSONObject formmainIdUpdatejson = JSONObject.parseObject(formmainIdUpdate); + JSONObject formmainIdUpdateData = formmainIdUpdatejson.getJSONObject("data"); + String formmainUpdate = formmainIdUpdateData.getString("id"); + if(StringUtil.isNotEmpty(formmainUpdate)){ +// 当前数据已经存在执行修改逻辑 + JSONObject param = new JSONObject(); +// 设置基本数据 + param.put("doTrigger",paramJson.getBooleanValue("doTrigger")); + param.put("formCode",paramJson.getString("formCode")); + param.put("loginName",paramJson.getString("loginName")); + param.put("rightId",paramJson.getString("rightIdUpdate")); + JSONArray dataList = new JSONArray(); + JSONObject data = new JSONObject(); + JSONObject paramDataList = paramJson.getJSONObject("dataList"); + JSONObject paramMasterTable = paramDataList.getJSONObject("masterTable"); + JSONObject masterTable = new JSONObject(); + masterTable.put("name",paramMasterTable.getString("name")); + JSONObject record = new JSONObject(); + record.put("id",formmainUpdate); +// 根据主表字段信息,设置主表参数 + JSONArray fields = new JSONArray(); + for (Map.Entry entry : paramMasterTable.getJSONObject("fields").entrySet()) { + JSONObject jsonObject = new JSONObject(); + jsonObject.put("name",entry.getKey()); + String value = entry.getValue().toString(); + FieldDataVo subFieldDataVo; + try { + subFieldDataVo = subFormDataVo.getFieldData(value); + } catch (NoSuchFieldException e) { + subFieldDataVo = formDataVo.getFieldData(value); + } + String subFieldDataDb = subFieldDataVo.getDbValue().toString(); + jsonObject.put("value",subFieldDataDb); + fields.add(jsonObject); + } + record.put("fields",fields); + masterTable.put("record",record); + data.put("masterTable",masterTable); +// 根据明细表字段信息,设置明细表参数 + JSONArray subTables = new JSONArray(); + JSONArray paramSubTables = paramDataList.getJSONArray("subTables"); + for(int i = 0 ; i < paramSubTables.size();i++){ + JSONObject paramSubTable = paramSubTables.getJSONObject(i); + JSONObject subTable = new JSONObject(); + subTable.put("name",paramSubTable.getString("tableName")); + JSONArray subRecords = new JSONArray(); + JSONObject subRecord = new JSONObject(); + subRecord.put("id", UUIDLong.longUUID()+""); + JSONArray subFields = new JSONArray(); + for (Map.Entry entry : paramSubTable.getJSONObject("fields").entrySet()) { + JSONObject jsonObject = new JSONObject(); + jsonObject.put("name",entry.getKey()); + String value = entry.getValue().toString(); + FieldDataVo subFieldDataVo ; + try { + subFieldDataVo = subFormDataVo.getFieldData(value); + } catch (NoSuchFieldException e) { + subFieldDataVo = formDataVo.getFieldData(value); + } + if(subFieldDataVo.getDbValue() == null){ + jsonObject.put("value",""); + }else{ + String subFieldDataDb = subFieldDataVo.getDbValue().toString(); + jsonObject.put("value",subFieldDataDb); + } + subFields.add(jsonObject); + } + subRecord.put("fields",subFields); + subRecords.add(subRecord); + subTable.put("records",subRecords); + subTables.add(subTable); + } + data.put("subTables",subTables); + + dataList.add(data); + param.put("dataList",dataList); + + context.setRequest(param.toString()); + log.info(param.toString()); +// 获取调用接口路径 + String formmainUpdateUrl = mainUrl+"/seeyon/rest/cap4/form/soap/batch-update?token="+mainToken; + context.setUrl(formmainUpdateUrl); + JSONObject res = ProtUtil.doPost(param.toString(),formmainUpdateUrl); + log.info(res.toString()); + context.setResponse(res.toString()); + MemberManagerResponse mmr = new MemberManagerResponse(res); + if(mmr.isSuccess()){ + String resDatastr = mmr.getData(); + Map resData = DataProcessingUtil.convertStringToMap(resDatastr); + List successIdList = (List)resData.get("successIdList"); + if(successIdList.size()>0){ + String fid = successIdList.get(0); + log.info("档案表修改完成,返回结果为"+resDatastr); + context.success("档案表修改完成,当前档案表ID为"+fid,false); + formDataVo.getNewFieldDataMap().put("返回结果", "档案表修改完成,当前档案表ID为"+fid); + }else{ + Map failedData = (Map)resData.get("failedData"); + for (Map.Entry entry:failedData.entrySet()) { + context.back("档案表修改失败:创建异常:" + entry.getValue()); + context.setErrMsg(mmr.getMsg()); + formDataVo.getNewFieldDataMap().put("返回结果", "档案表修改失败:创建异常:"+entry.getValue()); + } + } + + }else{ + context.back("档案表修改失败:修改异常:" + mmr.getMsg()); + context.setErrMsg(mmr.getMsg()); + formDataVo.getNewFieldDataMap().put("返回结果", "档案表修改失败:修改异常:"+mmr.getMsg()); + } + }else{ + context.success("没有查询到需要修改的数据,跳过处理"); + formDataVo.getNewFieldDataMap().put("返回结果", "没有查询到需要修改的数据,跳过处理"); + } + } + return context; + } + + @Override + public String getPluginId() { + return PersonnelFlowConstants.getPluginId(); + } + + @Override + public String getNodeId() { + return "MemberInternalMobilizationRecordNode"; + } + + @Override + public String getNodeName() { + return "员工内部调动审批档案表超级节点"; + } + +} diff --git a/v5/apps-customize/src/main/java/com/seeyon/apps/src_personnelflow/node/MerchantCloseCommonNode.java b/v5/apps-customize/src/main/java/com/seeyon/apps/src_personnelflow/node/MerchantCloseCommonNode.java new file mode 100644 index 0000000..296b3ea --- /dev/null +++ b/v5/apps-customize/src/main/java/com/seeyon/apps/src_personnelflow/node/MerchantCloseCommonNode.java @@ -0,0 +1,213 @@ +package com.seeyon.apps.src_personnelflow.node; + +import cn.hutool.log.Log; +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; +import com.seeyon.apps.common.config.ICstConfigApi; +import com.seeyon.apps.common.plugin.vo.ConfigVo; +import com.seeyon.apps.common.workflow.node.ACommonSuperNode; +import com.seeyon.apps.ext.workflow.vo.FieldDataVo; +import com.seeyon.apps.ext.workflow.vo.FormDataVo; +import com.seeyon.apps.ext.workflow.vo.SuperNodeContext; +import com.seeyon.apps.src_personnelflow.constants.PersonnelFlowConstants; +import com.seeyon.apps.src_personnelflow.util.DataProcessingUtil; +import com.seeyon.apps.src_personnelflow.util.ProtUtil; +import com.seeyon.apps.src_personnelflow.vo.MemberManagerResponse; +import com.seeyon.cap4.form.bean.FormDataMasterBean; +import com.seeyon.ctp.common.AppContext; +import com.seeyon.ctp.util.UUIDLong; +import www.seeyon.com.utils.StringUtil; + +import java.util.List; +import java.util.Map; + +public class MerchantCloseCommonNode extends ACommonSuperNode { + + private static Log log = Log.get(MerchantCloseCommonNode.class); + + protected ICstConfigApi cstConfigApi = (ICstConfigApi) AppContext.getBean("cstConfigApi"); + + public ConfigVo getPersonnelFloweConfig() { + return cstConfigApi.getConfig(getPluginId()); + } + + @Override + public String getFormParse() { + return ""; + } + + public ConfigVo getPlConfig() { + return cstConfigApi.getConfig(getPluginId()); + } + + public ConfigVo getMemberMamageConfig() { + return cstConfigApi.getConfig(getPluginId()); + } + + public SuperNodeContext proceed(String request, FormDataVo formDataVo, FormDataMasterBean formDataMasterBean) throws Exception { + log.info("进入人事档案表离职处理流程"+getNodeId()); + ConfigVo configVo = getMemberMamageConfig(); + SuperNodeContext context = new SuperNodeContext(); + context.setNeedSave(true); + JSONObject paramJson = JSONObject.parseObject(request); + String enumFields = paramJson.getString("enumFields"); + String mainUrl = configVo.getParamVal(PersonnelFlowConstants.mainUrl.name()); + String getzsjTokenUrl = configVo.getParamVal(PersonnelFlowConstants.getzsjTokenUrl.name()); + String restzsjUserName = configVo.getParamVal(PersonnelFlowConstants.restzsjUserName.name()); + String restzsjPassword = configVo.getParamVal(PersonnelFlowConstants.restzsjPassword.name()); + String zsjloginName = configVo.getParamVal(PersonnelFlowConstants.zsjloginName.name()); +// 调用接口查询主数据token + String mainToken = ProtUtil.getToken(getzsjTokenUrl,restzsjUserName,restzsjPassword,zsjloginName); +// 获取当前表单数据 + Map> SubFormMap = formDataVo.getSubFormMap(); + List subForms = SubFormMap.get("人员明细"); + for (FormDataVo subFormDataVo : subForms) { +// 每一行就是一个变更数据封装封装修改的人员参数执行修改操作 + JSONObject isExistUpdateParam = new JSONObject(); + isExistUpdateParam.put("formCode",paramJson.getString("formCode")); + JSONObject uniqueness = new JSONObject(); + JSONObject uniquenessjson = paramJson.getJSONObject("uniqueness"); + for (Map.Entry entry:uniquenessjson.entrySet()) { + FieldDataVo fieldDataVo = subFormDataVo.getFieldData(entry.getValue().toString()); + uniqueness.put(entry.getKey(),fieldDataVo.getDbValue()); + } + isExistUpdateParam.put("uniqueness",uniqueness); +// 调用接口查询当前数据是否存在 + String isExistUpdateUrl = mainUrl+"/seeyon/rest/formTable/quart?token="+mainToken; + String formmainIdUpdate = ProtUtil.doGet(isExistUpdateUrl,isExistUpdateParam); + JSONObject formmainIdUpdatejson = JSONObject.parseObject(formmainIdUpdate); + JSONObject formmainIdUpdateData = formmainIdUpdatejson.getJSONObject("data"); + String formmainUpdate = formmainIdUpdateData.getString("id"); + if(StringUtil.isNotEmpty(formmainUpdate)){ +// 当前数据已经存在执行修改逻辑 + JSONObject param = new JSONObject(); +// 设置基本数据 + param.put("doTrigger",paramJson.getBooleanValue("doTrigger")); + param.put("formCode",paramJson.getString("formCode")); + param.put("loginName",paramJson.getString("loginName")); + param.put("rightId",paramJson.getString("rightIdUpdate")); + JSONArray dataList = new JSONArray(); + JSONObject data = new JSONObject(); + JSONObject paramDataList = paramJson.getJSONObject("dataList"); + JSONObject paramMasterTable = paramDataList.getJSONObject("masterTable"); + JSONObject masterTable = new JSONObject(); + masterTable.put("name",paramMasterTable.getString("name")); + JSONObject record = new JSONObject(); + record.put("id",formmainUpdate); +// 根据主表字段信息,设置主表参数 + JSONArray fields = new JSONArray(); + for (Map.Entry entry : paramMasterTable.getJSONObject("fields").entrySet()) { + JSONObject jsonObject = new JSONObject(); + jsonObject.put("name",entry.getKey()); + String value = entry.getValue().toString(); + FieldDataVo subFieldDataVo; + try { + subFieldDataVo = subFormDataVo.getFieldData(value); + } catch (NoSuchFieldException e) { + subFieldDataVo = formDataVo.getFieldData(value); + } + if(enumFields.contains(entry.getKey())){ + String subFieldValue = subFieldDataVo.getStringValue(); + jsonObject.put("showValue",subFieldValue); + }else{ + String subFieldDataDb = subFieldDataVo.getDbValue().toString(); + jsonObject.put("value",subFieldDataDb); + } + fields.add(jsonObject); + } + record.put("fields",fields); + masterTable.put("record",record); + data.put("masterTable",masterTable); +// 根据明细表字段信息,设置明细表参数 + JSONArray subTables = new JSONArray(); + JSONArray paramSubTables = paramDataList.getJSONArray("subTables"); + for(int i = 0 ; i < paramSubTables.size();i++){ + JSONObject paramSubTable = paramSubTables.getJSONObject(i); + JSONObject subTable = new JSONObject(); + subTable.put("name",paramSubTable.getString("tableName")); + JSONArray subRecords = new JSONArray(); + JSONObject subRecord = new JSONObject(); + subRecord.put("id", UUIDLong.longUUID()+""); + JSONArray subFields = new JSONArray(); + for (Map.Entry entry : paramSubTable.getJSONObject("fields").entrySet()) { + JSONObject jsonObject = new JSONObject(); + jsonObject.put("name",entry.getKey()); + String value = entry.getValue().toString(); + FieldDataVo subFieldDataVo ; + try { + subFieldDataVo = subFormDataVo.getFieldData(value); + } catch (NoSuchFieldException e) { + subFieldDataVo = formDataVo.getFieldData(value); + } + if(subFieldDataVo.getDbValue() == null){ + jsonObject.put("value",""); + }else{ + String subFieldDataDb = subFieldDataVo.getDbValue().toString(); + jsonObject.put("value",subFieldDataDb); + } + subFields.add(jsonObject); + } + subRecord.put("fields",subFields); + subRecords.add(subRecord); + subTable.put("records",subRecords); + subTables.add(subTable); + } + data.put("subTables",subTables); + dataList.add(data); + param.put("dataList",dataList); + context.setRequest(param.toString()); + log.info(param.toString()); +// 获取调用接口路径 + String formmainUpdateUrl = mainUrl+"/seeyon/rest/cap4/form/soap/batch-update?token="+mainToken; + context.setUrl(formmainUpdateUrl); + JSONObject res = ProtUtil.doPost(param.toString(),formmainUpdateUrl); + log.info(res.toString()); + context.setResponse(res.toString()); + MemberManagerResponse mmr = new MemberManagerResponse(res); + if(mmr.isSuccess()){ + String resDatastr = mmr.getData(); + Map resData = DataProcessingUtil.convertStringToMap(resDatastr); + List successIdList = (List)resData.get("successIdList"); + if(successIdList.size()>0){ + String fid = successIdList.get(0); + log.info("档案表修改完成,返回结果为"+resDatastr); + context.success("档案表修改完成,当前档案表ID为"+fid,false); + formDataVo.getNewFieldDataMap().put("返回结果", "档案表修改完成,当前档案表ID为"+fid); + }else{ + Map failedData = (Map)resData.get("failedData"); + for (Map.Entry entry:failedData.entrySet()) { + context.back("档案表修改失败:创建异常:" + entry.getValue()); + context.setErrMsg(mmr.getMsg()); + formDataVo.getNewFieldDataMap().put("返回结果", "档案表修改失败:创建异常:"+entry.getValue()); + } + } + }else{ + context.back("档案表修改失败:修改异常:" + mmr.getMsg()); + context.setErrMsg(mmr.getMsg()); + formDataVo.getNewFieldDataMap().put("返回结果", "档案表修改失败:修改异常:"+mmr.getMsg()); + } + }else{ + context.success("没有查询到需要修改的数据,跳过处理"); + formDataVo.getNewFieldDataMap().put("返回结果", "没有查询到需要修改的数据,跳过处理"); + } + } + return context; + } + + @Override + public String getPluginId() { + return PersonnelFlowConstants.getPluginId(); + } + + @Override + public String getNodeId() { + return "MerchantCloseCommonNode"; + } + + @Override + public String getNodeName() { + return "商家人员关闭档案表超级节点"; + } + + +} diff --git a/v5/apps-customize/src/main/java/com/seeyon/apps/src_personnelflow/node/MerchantCloseOrganizationNode.java b/v5/apps-customize/src/main/java/com/seeyon/apps/src_personnelflow/node/MerchantCloseOrganizationNode.java new file mode 100644 index 0000000..d474775 --- /dev/null +++ b/v5/apps-customize/src/main/java/com/seeyon/apps/src_personnelflow/node/MerchantCloseOrganizationNode.java @@ -0,0 +1,141 @@ +package com.seeyon.apps.src_personnelflow.node; + +import cn.hutool.log.Log; +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; +import com.seeyon.apps.common.config.ICstConfigApi; +import com.seeyon.apps.common.plugin.vo.ConfigVo; +import com.seeyon.apps.common.workflow.node.ACommonSuperNode; +import com.seeyon.apps.ext.workflow.vo.FieldDataVo; +import com.seeyon.apps.ext.workflow.vo.FormDataVo; +import com.seeyon.apps.ext.workflow.vo.SuperNodeContext; +import com.seeyon.apps.src_personnelflow.constants.PersonnelFlowConstants; +import com.seeyon.apps.src_personnelflow.util.ProtUtil; +import com.seeyon.cap4.form.bean.FormDataMasterBean; +import com.seeyon.ctp.common.AppContext; +import com.seeyon.ctp.organization.bo.V3xOrgMember; +import com.seeyon.ctp.organization.manager.OrgManager; + +import javax.inject.Inject; +import java.util.List; + +public class MerchantCloseOrganizationNode extends ACommonSuperNode { + + private static Log log = Log.get(MerchantCloseOrganizationNode.class); + + protected ICstConfigApi cstConfigApi = (ICstConfigApi) AppContext.getBean("cstConfigApi"); + + public ConfigVo getPersonnelFloweConfig() { + return cstConfigApi.getConfig(getPluginId()); + } + + @Inject + private OrgManager orgManager; + + @Override + public String getFormParse() { + return ""; + } + + public ConfigVo getPlConfig() { + return cstConfigApi.getConfig(getPluginId()); + } + + public ConfigVo getMemberMamageConfig() { + return cstConfigApi.getConfig(getPluginId()); + } + + public SuperNodeContext proceed(String request, FormDataVo formDataVo, FormDataMasterBean formDataMasterBean) throws Exception { + log.info("进入人事组织机构处理流程"+getNodeId()); + ConfigVo configVo = getMemberMamageConfig(); + SuperNodeContext context = new SuperNodeContext(); + context.setNeedSave(true); + String mainUrl = configVo.getParamVal(PersonnelFlowConstants.mainUrl.name()); + String getzsjTokenUrl = configVo.getParamVal(PersonnelFlowConstants.getzsjTokenUrl.name()); + String restzsjUserName = configVo.getParamVal(PersonnelFlowConstants.restzsjUserName.name()); + String restzsjPassword = configVo.getParamVal(PersonnelFlowConstants.restzsjPassword.name()); + String zsjloginName = configVo.getParamVal(PersonnelFlowConstants.zsjloginName.name()); +// 调用接口查询主数据token + String mainToken = ProtUtil.getToken(getzsjTokenUrl,restzsjUserName,restzsjPassword,zsjloginName); + + JSONObject req = JSONObject.parseObject(request); + JSONArray subTables = req.getJSONArray("subTable"); + int isSuccess = 0; + String ret = ""; + String subTableName = req.getString("subTableName"); + List subFormDataVos = formDataVo.getSubFormMap().get(subTableName); + for(int i = 0 ; i < subTables.size() ; i++){ + JSONObject subTable = subTables.getJSONObject(i); + FormDataVo subFormDataVo = subFormDataVos.get(i); +// 查询当前人员是否存在 + String memberIdName = subTable.getString("id"); + FieldDataVo memberField = subFormDataVo.getFieldData(memberIdName); + String memberId = memberField.getDbValue().toString(); + String accountIdName = subTable.getString("orgAccountId"); + FieldDataVo accountField = subFormDataVo.getFieldData(accountIdName); + String accountId = accountField.getDbValue().toString(); + subTable.put("orgAccountId",accountId); + V3xOrgMember v3xOrgMember = orgManager.getMemberById(Long.parseLong(memberId)); + String isExistUpdateUrl = mainUrl+"/seeyon/rest/orgMember/"+memberId+"?token="+mainToken; + String memberstr = ProtUtil.doGet(isExistUpdateUrl, new JSONObject()); + if(!"null".equals(memberstr)){ + isSuccess++; +// 当前人员已存在 + JSONObject memberjson = JSONObject.parseObject(memberstr); + if(memberjson.getBooleanValue("isDeleted")){ +// 当前人员已经删除 + ret = ret+memberjson.getString("name")+"已经删除,无法修改;"; + }else{ +// 当前人员存在,执行修改 + subTable.put("id",memberId); + String memberOrganizationUpdateUrl = mainUrl+"/seeyon/rest/orgMember/updateMemberMain?token="+mainToken; + JSONObject res = ProtUtil.doPost(subTable.toString(),memberOrganizationUpdateUrl); + log.info(res.toString()); + + if(res.getInteger("code")==0){ + JSONObject data = res.getJSONObject("data"); + ret+=data.getString("name")+"修改成功"; + log.info("人员组织架构修改完成:人员名称为"+data.getString("name")+",ID为"+data.getString("id")); + + }else{ + isSuccess--; + String message = res.getString("message"); + ret+=memberjson.getString("name")+"修改失败"+message; + log.info("人员组织架构修改失败:人员名称为"+memberjson.getString("name")+",ID为"+memberjson.getString("id")+message); + } + } + }else{ +// 人员不存在 + ret = ret+v3xOrgMember.getName()+"不存在,无法修改;"; + } + context.setRequest(subTables.toString()); + context.setResponse(ret); + } + if(isSuccess == subTables.size()){ + context.success(ret,false); + formDataVo.getNewFieldDataMap().put("组织返回结果", ret); + }else{ + log.info(ret); + context.back(ret); + formDataVo.getNewFieldDataMap().put("组织返回结果", ret); + } + return context; + } + + @Override + public String getPluginId() { + return PersonnelFlowConstants.getPluginId(); + } + + @Override + public String getNodeId() { + return "MerchantCloseOrganizationNode"; + } + + @Override + public String getNodeName() { + return "商家人员关闭关闭组织架构超级节点"; + } + + +} diff --git a/v5/apps-customize/src/main/java/com/seeyon/apps/src_personnelflow/node/PersonnelInfoCommonNode.java b/v5/apps-customize/src/main/java/com/seeyon/apps/src_personnelflow/node/PersonnelInfoCommonNode.java new file mode 100644 index 0000000..0c3475f --- /dev/null +++ b/v5/apps-customize/src/main/java/com/seeyon/apps/src_personnelflow/node/PersonnelInfoCommonNode.java @@ -0,0 +1,167 @@ +package com.seeyon.apps.src_personnelflow.node; + +import cn.hutool.log.Log; +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; +import com.seeyon.aicloud.common.JsonUtils; +import com.seeyon.apps.common.config.ICstConfigApi; +import com.seeyon.apps.common.plugin.vo.ConfigVo; +import com.seeyon.apps.common.workflow.node.ACommonSuperNode; +import com.seeyon.apps.ext.workflow.vo.FormDataVo; +import com.seeyon.apps.ext.workflow.vo.SuperNodeContext; +import com.seeyon.apps.src_personnelflow.constants.PersonnelFlowConstants; +import com.seeyon.apps.src_personnelflow.tool.WeaverUtil; +import com.seeyon.cap4.form.bean.FormDataMasterBean; +import com.seeyon.ctp.common.AppContext; + +import java.util.*; + +public class PersonnelInfoCommonNode extends ACommonSuperNode { + private static Log log = Log.get(PersonnelInfoCommonNode.class); + protected ICstConfigApi cstConfigApi = (ICstConfigApi) AppContext.getBean("cstConfigApi"); + +// protected String ip = "10.0.1.55"; +// protected String port = "80"; + @Override + public String getFormParse() { + return ""; + } + + public ConfigVo getPlConfig() { + return cstConfigApi.getConfig(getPluginId()); + } + + private Map buildParams(String flowId) { + Map map = new HashMap<>(); + map.put("requestId",flowId); + map.put("ipPort",getBizConfigByKey(PersonnelFlowConstants.weaverApiIpPort)); + map.put("secret",getBizConfigByKey(PersonnelFlowConstants.weaverAppSecret)); + map.put("appId",getBizConfigByKey(PersonnelFlowConstants.weaverAppId)); + map.put("userId",getBizConfigByKey(PersonnelFlowConstants.weaverBpmId)); + map.put("spk",getBizConfigByKey(PersonnelFlowConstants.weaverAppSpk)); + return map; + } + private String formatRemark(String source) { + String[] split = source.split(System.lineSeparator()); + StringBuilder sb = new StringBuilder(""); + for (String s : split) { + if(s.contains("【")) { + sb.append(s + System.lineSeparator()); + } + } + return sb.toString(); + } + + public SuperNodeContext proceed(String templateJson, FormDataVo formDataVo, FormDataMasterBean formDataMasterBean) throws Exception { + SuperNodeContext context = new SuperNodeContext(); +// Map temp = new HashMap<>(); + log.info("进入人事流程数据超级节点中"); + Map map = new HashMap<>(); + context.setNeedSave(true); + JSONObject jsonObject = null; + JSONArray temps = new JSONArray(); + try { + jsonObject = JSONObject.parseObject(templateJson); + }catch (Exception e) { + } + try { + List> callbackParams = new ArrayList<>(); + +// 处理流程审批意见 + String remark = formatRemark(jsonObject.getString("hxyj")); + jsonObject.put("hxyj",remark); + // 意见说明 + String yjsm = formatRemark(jsonObject.getString("yjsm")); + jsonObject.put("yjsm",yjsm); + + Set jsonObjectKeys = jsonObject.keySet(); +// Map temp = new HashMap<>(); + for(String jsonObjectKey : jsonObjectKeys){ + JSONObject temp = new JSONObject(); + temp.put("fieldName",jsonObjectKey); + temp.put("fieldValue",jsonObject.getString(jsonObjectKey)); + temps.add(temp); +// temp.put(jsonObjectKey,jsonObject.getString(jsonObjectKey)); + } +// context.setRequest(temps.toString()); +// String remark = formatRemark(formDataVo.getFieldData("审批意见").getStringValue()); +// for (Map.Entry entry : jsonObject.entrySet()) { +// Map temp = new HashMap<>(); +// temp.put("fieldName",) +// } +// temp.put("fieldName","spyj"); +// temp.put("fieldValue",remark); + String waveFlowId = formDataVo.getFieldData("泛微流程ID").getStringValue(); + Map params = buildParams(waveFlowId); + System.out.println(params); + params.put("mainData",temps.toString()); + String resp = WeaverUtil.submit(params); + JSONObject response = JSONObject.parseObject(resp); + log.info(resp); + log.info("调泛微OA code:" + response.get("code")); + if ("SUCCESS".equals(response.get("code"))) { + //调用提交接口 + map.put("code", "200"); + map.put("msg", "提交成功"); + map.put("response", resp); + } else { +// Map data = (Map) returnMsg.get("errMsg"); + map.put("code", "300"); + map.put("msg", "提交流程失败!"+ response.get("errMsg")); + map.put("response", resp); + } + } catch (Exception e) { + context.setErrMsg("调用失败:"+e); + context.setException(true); + context.back("调用失败:"+e); + } + try{ + context.setRequest(temps.toString()); + context.setResponse(map.get("response").toString()); + Object jsoncode = map.get("code"); + if ("200".equals(jsoncode.toString())) { + context.success(map.get("msg").toString(), false); + formDataVo.getNewFieldDataMap().put("返回结果",map.get("msg").toString()); + } else { + context.setErrMsg(map.get("msg").toString()); + context.setException(true); + context.back("推送失败:" +map.get("msg").toString()); + formDataVo.getNewFieldDataMap().put("返回结果","推送失败:"+map.get("msg").toString()); + } + }catch (Exception e){ + context.setException(true); + context.back("推送失败:OA处理异常:" + e.getMessage()); + formDataVo.getNewFieldDataMap().put("返回结果","推送失败:OA处理异常:"+map.get("msg").toString()); + } + + return context; + } + + protected String getBizConfigByKey(PersonnelFlowConstants key) { + ConfigVo config = cstConfigApi.getConfig(getPluginId()); + return config.getParamVal(key.name()); + } + + protected String buildOrgData(Map params) { + Map data = new HashMap<>(); + for (String key : params.keySet()) { + data.put(key,params.get(key)); + } + return JsonUtils.toJSONString(data); + } + + @Override + public String getPluginId() { + return PersonnelFlowConstants.getPluginId(); + } + + @Override + public String getNodeId() { + return "PersonnelInfoCommonNode"; + } + + @Override + public String getNodeName() { + return "客户服务平台流程提交超级节点"; + } +} diff --git a/v5/apps-customize/src/main/java/com/seeyon/apps/src_personnelflow/node/YdAccountCloseNode.java b/v5/apps-customize/src/main/java/com/seeyon/apps/src_personnelflow/node/YdAccountCloseNode.java new file mode 100644 index 0000000..88d0e91 --- /dev/null +++ b/v5/apps-customize/src/main/java/com/seeyon/apps/src_personnelflow/node/YdAccountCloseNode.java @@ -0,0 +1,214 @@ +package com.seeyon.apps.src_personnelflow.node; + +import cn.hutool.log.Log; +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; +import com.seeyon.apps.common.config.ICstConfigApi; +import com.seeyon.apps.common.plugin.vo.ConfigVo; +import com.seeyon.apps.common.workflow.node.ACommonSuperNode; +import com.seeyon.apps.ext.workflow.vo.FieldDataVo; +import com.seeyon.apps.ext.workflow.vo.FormDataVo; +import com.seeyon.apps.ext.workflow.vo.SuperNodeContext; +import com.seeyon.apps.src_personnelflow.constants.PersonnelFlowConstants; +import com.seeyon.apps.src_personnelflow.util.DataProcessingUtil; +import com.seeyon.apps.src_personnelflow.util.ProtUtil; +import com.seeyon.apps.src_personnelflow.vo.MemberManagerResponse; +import com.seeyon.cap4.form.bean.FormDataMasterBean; +import com.seeyon.ctp.common.AppContext; +import com.seeyon.ctp.util.UUIDLong; +import www.seeyon.com.utils.StringUtil; + +import java.util.List; +import java.util.Map; + +public class YdAccountCloseNode extends ACommonSuperNode { + + private static Log log = Log.get(YdAccountCloseNode.class); + + protected ICstConfigApi cstConfigApi = (ICstConfigApi) AppContext.getBean("cstConfigApi"); + + public ConfigVo getPersonnelFloweConfig() { + return cstConfigApi.getConfig(getPluginId()); + } + + @Override + public String getFormParse() { + return ""; + } + + public ConfigVo getPlConfig() { + return cstConfigApi.getConfig(getPluginId()); + } + + public ConfigVo getMemberMamageConfig() { + return cstConfigApi.getConfig(getPluginId()); + } + + public SuperNodeContext proceed(String request, FormDataVo formDataVo, FormDataMasterBean formDataMasterBean) throws Exception { + log.info("进入人事档案表处理流程"+getNodeId()); + ConfigVo configVo = getMemberMamageConfig(); + SuperNodeContext context = new SuperNodeContext(); + context.setNeedSave(true); + JSONObject paramJson = JSONObject.parseObject(request); + String enumFields = paramJson.getString("enumFields"); + String mainUrl = configVo.getParamVal(PersonnelFlowConstants.mainUrl.name()); + String getzsjTokenUrl = configVo.getParamVal(PersonnelFlowConstants.getzsjTokenUrl.name()); + String restzsjUserName = configVo.getParamVal(PersonnelFlowConstants.restzsjUserName.name()); + String restzsjPassword = configVo.getParamVal(PersonnelFlowConstants.restzsjPassword.name()); + String zsjloginName = configVo.getParamVal(PersonnelFlowConstants.zsjloginName.name()); +// 调用接口查询主数据token + String mainToken = ProtUtil.getToken(getzsjTokenUrl,restzsjUserName,restzsjPassword,zsjloginName); +// 获取当前表单数据 + Map> SubFormMap = formDataVo.getSubFormMap(); + List subForms = SubFormMap.get("人员明细"); + for (FormDataVo subFormDataVo : subForms) { +// 每一行就是一个变更数据封装封装修改的人员参数执行修改操作 + JSONObject isExistUpdateParam = new JSONObject(); + isExistUpdateParam.put("formCode",paramJson.getString("formCode")); + JSONObject uniqueness = new JSONObject(); + JSONObject uniquenessjson = paramJson.getJSONObject("uniqueness"); + for (Map.Entry entry:uniquenessjson.entrySet()) { + FieldDataVo fieldDataVo = subFormDataVo.getFieldData(entry.getValue().toString()); + uniqueness.put(entry.getKey(),fieldDataVo.getDbValue()); + } + isExistUpdateParam.put("uniqueness",uniqueness); +// 调用接口查询当前数据是否存在 + String isExistUpdateUrl = mainUrl+"/seeyon/rest/formTable/quart?token="+mainToken; + String formmainIdUpdate = ProtUtil.doGet(isExistUpdateUrl,isExistUpdateParam); + JSONObject formmainIdUpdatejson = JSONObject.parseObject(formmainIdUpdate); + JSONObject formmainIdUpdateData = formmainIdUpdatejson.getJSONObject("data"); + String formmainUpdate = formmainIdUpdateData.getString("id"); + if(StringUtil.isNotEmpty(formmainUpdate)){ +// 当前数据已经存在执行修改逻辑 + JSONObject param = new JSONObject(); +// 设置基本数据 + param.put("doTrigger",paramJson.getBooleanValue("doTrigger")); + param.put("formCode",paramJson.getString("formCode")); + param.put("loginName",paramJson.getString("loginName")); + param.put("rightId",paramJson.getString("rightIdUpdate")); + JSONArray dataList = new JSONArray(); + JSONObject data = new JSONObject(); + JSONObject paramDataList = paramJson.getJSONObject("dataList"); + JSONObject paramMasterTable = paramDataList.getJSONObject("masterTable"); + JSONObject masterTable = new JSONObject(); + masterTable.put("name",paramMasterTable.getString("name")); + JSONObject record = new JSONObject(); + record.put("id",formmainUpdate); +// 根据主表字段信息,设置主表参数 + JSONArray fields = new JSONArray(); + for (Map.Entry entry : paramMasterTable.getJSONObject("fields").entrySet()) { + JSONObject jsonObject = new JSONObject(); + jsonObject.put("name",entry.getKey()); + String value = entry.getValue().toString(); + FieldDataVo subFieldDataVo; + try { + subFieldDataVo = subFormDataVo.getFieldData(value); + } catch (NoSuchFieldException e) { + subFieldDataVo = formDataVo.getFieldData(value); + } + if(enumFields.contains(entry.getKey())){ + String subFieldValue = subFieldDataVo.getStringValue(); + jsonObject.put("showValue",subFieldValue); + }else{ + String subFieldDataDb = subFieldDataVo.getDbValue().toString(); + jsonObject.put("value",subFieldDataDb); + } + fields.add(jsonObject); + } + record.put("fields",fields); + masterTable.put("record",record); + data.put("masterTable",masterTable); +// 根据明细表字段信息,设置明细表参数 + JSONArray subTables = new JSONArray(); + JSONArray paramSubTables = paramDataList.getJSONArray("subTables"); + for(int i = 0 ; i < paramSubTables.size();i++){ + JSONObject paramSubTable = paramSubTables.getJSONObject(i); + JSONObject subTable = new JSONObject(); + subTable.put("name",paramSubTable.getString("tableName")); + JSONArray subRecords = new JSONArray(); + JSONObject subRecord = new JSONObject(); + subRecord.put("id", UUIDLong.longUUID()+""); + JSONArray subFields = new JSONArray(); + for (Map.Entry entry : paramSubTable.getJSONObject("fields").entrySet()) { + JSONObject jsonObject = new JSONObject(); + jsonObject.put("name",entry.getKey()); + String value = entry.getValue().toString(); + FieldDataVo subFieldDataVo ; + try { + subFieldDataVo = subFormDataVo.getFieldData(value); + } catch (NoSuchFieldException e) { + subFieldDataVo = formDataVo.getFieldData(value); + } + if(subFieldDataVo.getDbValue() == null){ + jsonObject.put("value",""); + }else{ + String subFieldDataDb = subFieldDataVo.getDbValue().toString(); + jsonObject.put("value",subFieldDataDb); + } + subFields.add(jsonObject); + } + subRecord.put("fields",subFields); + subRecords.add(subRecord); + subTable.put("records",subRecords); + subTables.add(subTable); + } + data.put("subTables",subTables); + dataList.add(data); + param.put("dataList",dataList); + context.setRequest(param.toString()); + log.info(param.toString()); +// 获取调用接口路径 + String formmainUpdateUrl = mainUrl+"/seeyon/rest/cap4/form/soap/batch-update?token="+mainToken; + context.setUrl(formmainUpdateUrl); + JSONObject res = ProtUtil.doPost(param.toString(),formmainUpdateUrl); + log.info(res.toString()); + context.setResponse(res.toString()); + MemberManagerResponse mmr = new MemberManagerResponse(res); + if(mmr.isSuccess()){ + String resDatastr = mmr.getData(); + Map resData = DataProcessingUtil.convertStringToMap(resDatastr); + List successIdList = (List)resData.get("successIdList"); + if(successIdList.size()>0){ + String fid = successIdList.get(0); + log.info("档案表修改完成,返回结果为"+resDatastr); + context.success("档案表修改完成,当前档案表ID为"+fid,false); + formDataVo.getNewFieldDataMap().put("返回结果", "档案表修改完成,当前档案表ID为"+fid); + }else{ + Map failedData = (Map)resData.get("failedData"); + for (Map.Entry entry:failedData.entrySet()) { + context.back("档案表修改失败:创建异常:" + entry.getValue()); + context.setErrMsg(mmr.getMsg()); + formDataVo.getNewFieldDataMap().put("返回结果", "档案表修改失败:创建异常:"+entry.getValue()); + } + } + + }else{ + context.back("档案表修改失败:修改异常:" + mmr.getMsg()); + context.setErrMsg(mmr.getMsg()); + formDataVo.getNewFieldDataMap().put("返回结果", "档案表修改失败:修改异常:"+mmr.getMsg()); + } + }else{ + context.success("没有查询到需要修改的数据,跳过处理"); + formDataVo.getNewFieldDataMap().put("返回结果", "没有查询到需要修改的数据,跳过处理"); + } + } + return context; + } + + @Override + public String getPluginId() { + return PersonnelFlowConstants.getPluginId(); + } + + @Override + public String getNodeId() { + return "YdAccountCloseNode"; + } + + @Override + public String getNodeName() { + return "业代账号批量关闭档案表超级节点"; + } + + +} diff --git a/v5/apps-customize/src/main/java/com/seeyon/apps/src_personnelflow/node/YdAccountOpenNode.java b/v5/apps-customize/src/main/java/com/seeyon/apps/src_personnelflow/node/YdAccountOpenNode.java new file mode 100644 index 0000000..d5165d3 --- /dev/null +++ b/v5/apps-customize/src/main/java/com/seeyon/apps/src_personnelflow/node/YdAccountOpenNode.java @@ -0,0 +1,327 @@ +package com.seeyon.apps.src_personnelflow.node; + +import cn.hutool.log.Log; +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; +import com.seeyon.apps.common.config.ICstConfigApi; +import com.seeyon.apps.common.plugin.vo.ConfigVo; +import com.seeyon.apps.common.workflow.node.ACommonSuperNode; +import com.seeyon.apps.ext.workflow.vo.FieldDataVo; +import com.seeyon.apps.ext.workflow.vo.FormDataVo; +import com.seeyon.apps.ext.workflow.vo.SuperNodeContext; +import com.seeyon.apps.src_personnelflow.constants.PersonnelFlowConstants; +import com.seeyon.apps.src_personnelflow.util.DataProcessingUtil; +import com.seeyon.apps.src_personnelflow.util.ProtUtil; +import com.seeyon.apps.src_personnelflow.vo.MemberManagerResponse; +import com.seeyon.cap4.form.bean.FormDataMasterBean; +import com.seeyon.ctp.common.AppContext; +import com.seeyon.ctp.util.UUIDLong; +import www.seeyon.com.utils.StringUtil; + +import java.util.List; +import java.util.Map; + +public class YdAccountOpenNode extends ACommonSuperNode { + + private static Log log = Log.get(YdAccountOpenNode.class); + + protected ICstConfigApi cstConfigApi = (ICstConfigApi) AppContext.getBean("cstConfigApi"); + + public ConfigVo getPersonnelFloweConfig() { + return cstConfigApi.getConfig(getPluginId()); + } + + @Override + public String getFormParse() { + return ""; + } + + public ConfigVo getPlConfig() { + return cstConfigApi.getConfig(getPluginId()); + } + + public ConfigVo getMemberMamageConfig() { + return cstConfigApi.getConfig(getPluginId()); + } + + public SuperNodeContext proceed(String request, FormDataVo formDataVo, FormDataMasterBean formDataMasterBean) throws Exception { + log.info("进入人事档案表处理流程"+getNodeId()); + ConfigVo configVo = getMemberMamageConfig(); + SuperNodeContext context = new SuperNodeContext(); + context.setNeedSave(true); + JSONObject paramJson = JSONObject.parseObject(request); + String enumFields = paramJson.getString("enumFields"); + String mainUrl = configVo.getParamVal(PersonnelFlowConstants.mainUrl.name()); + String getzsjTokenUrl = configVo.getParamVal(PersonnelFlowConstants.getzsjTokenUrl.name()); + String restzsjUserName = configVo.getParamVal(PersonnelFlowConstants.restzsjUserName.name()); + String restzsjPassword = configVo.getParamVal(PersonnelFlowConstants.restzsjPassword.name()); + String zsjloginName = configVo.getParamVal(PersonnelFlowConstants.zsjloginName.name()); +// 调用接口查询主数据token + String mainToken = ProtUtil.getToken(getzsjTokenUrl,restzsjUserName,restzsjPassword,zsjloginName); +// 获取当前表单数据 + Map> SubFormMap = formDataVo.getSubFormMap(); + List subForms = SubFormMap.get("人员明细"); + for (FormDataVo subFormDataVo : subForms) { +// 每一行就是一个变更数据封装封装修改的人员参数执行修改操作 + JSONObject isExistUpdateParam = new JSONObject(); + isExistUpdateParam.put("formCode",paramJson.getString("formCode")); + JSONObject uniqueness = new JSONObject(); + JSONObject uniquenessjson = paramJson.getJSONObject("uniqueness"); + for (Map.Entry entry:uniquenessjson.entrySet()) { + FieldDataVo fieldDataVo = subFormDataVo.getFieldData(entry.getValue().toString()); + uniqueness.put(entry.getKey(),fieldDataVo.getDbValue()); + } + isExistUpdateParam.put("uniqueness",uniqueness); +// 调用接口查询当前数据是否存在 + String isExistUpdateUrl = mainUrl+"/seeyon/rest/formTable/quart?token="+mainToken; + String formmainIdUpdate = ProtUtil.doGet(isExistUpdateUrl,isExistUpdateParam); + JSONObject formmainIdUpdatejson = JSONObject.parseObject(formmainIdUpdate); + JSONObject formmainIdUpdateData = formmainIdUpdatejson.getJSONObject("data"); + String formmainUpdate = formmainIdUpdateData.getString("id"); + if(StringUtil.isNotEmpty(formmainUpdate)){ +// 当前数据已经存在执行修改逻辑 + JSONObject param = new JSONObject(); +// 设置基本数据 + param.put("doTrigger",paramJson.getBooleanValue("doTrigger")); + param.put("formCode",paramJson.getString("formCode")); + param.put("loginName",paramJson.getString("loginName")); + param.put("rightId",paramJson.getString("rightIdUpdate")); + JSONArray dataList = new JSONArray(); + JSONObject data = new JSONObject(); + JSONObject paramDataList = paramJson.getJSONObject("dataList"); + JSONObject paramMasterTable = paramDataList.getJSONObject("masterTable"); + JSONObject masterTable = new JSONObject(); + masterTable.put("name",paramMasterTable.getString("name")); + JSONObject record = new JSONObject(); + record.put("id",formmainUpdate); +// 根据主表字段信息,设置主表参数 + JSONArray fields = new JSONArray(); + for (Map.Entry entry : paramMasterTable.getJSONObject("fields").entrySet()) { + JSONObject jsonObject = new JSONObject(); + jsonObject.put("name",entry.getKey()); + String value = entry.getValue().toString(); + FieldDataVo subFieldDataVo; + try { + subFieldDataVo = subFormDataVo.getFieldData(value); + } catch (NoSuchFieldException e) { + subFieldDataVo = formDataVo.getFieldData(value); + } + if(enumFields.contains(entry.getKey())){ + String subFieldValue = subFieldDataVo.getStringValue(); + jsonObject.put("showValue",subFieldValue); + }else{ + String subFieldDataDb = subFieldDataVo.getDbValue().toString(); + jsonObject.put("value",subFieldDataDb); + } + fields.add(jsonObject); + } + record.put("fields",fields); + masterTable.put("record",record); + data.put("masterTable",masterTable); +// 根据明细表字段信息,设置明细表参数 + JSONArray subTables = new JSONArray(); + JSONArray paramSubTables = paramDataList.getJSONArray("subTables"); + for(int i = 0 ; i < paramSubTables.size();i++){ + JSONObject paramSubTable = paramSubTables.getJSONObject(i); + JSONObject subTable = new JSONObject(); + subTable.put("name",paramSubTable.getString("tableName")); + JSONArray subRecords = new JSONArray(); + JSONObject subRecord = new JSONObject(); + subRecord.put("id", UUIDLong.longUUID()+""); + JSONArray subFields = new JSONArray(); + for (Map.Entry entry : paramSubTable.getJSONObject("fields").entrySet()) { + JSONObject jsonObject = new JSONObject(); + jsonObject.put("name",entry.getKey()); + String value = entry.getValue().toString(); + FieldDataVo subFieldDataVo; + try { + subFieldDataVo = subFormDataVo.getFieldData(value); + } catch (NoSuchFieldException e) { + subFieldDataVo = formDataVo.getFieldData(value); + } + if(subFieldDataVo.getDbValue() == null){ + jsonObject.put("value",""); + }else{ + String subFieldDataDb = subFieldDataVo.getDbValue().toString(); + jsonObject.put("value",subFieldDataDb); + } + subFields.add(jsonObject); + } + subRecord.put("fields",subFields); + subRecords.add(subRecord); + subTable.put("records",subRecords); + subTables.add(subTable); + } + data.put("subTables",subTables); + dataList.add(data); + param.put("dataList",dataList); + context.setRequest(param.toString()); + log.info(param.toString()); +// 获取调用接口路径 + String formmainUpdateUrl = mainUrl+"/seeyon/rest/cap4/form/soap/batch-update?token="+mainToken; + context.setUrl(formmainUpdateUrl); + JSONObject res = ProtUtil.doPost(param.toString(),formmainUpdateUrl); + log.info(res.toString()); + context.setResponse(res.toString()); + MemberManagerResponse mmr = new MemberManagerResponse(res); + if(mmr.isSuccess()){ + String resDatastr = mmr.getData(); + Map resData = DataProcessingUtil.convertStringToMap(resDatastr); + List successIdList = (List)resData.get("successIdList"); + if(successIdList.size()>0){ + String fid = successIdList.get(0); + log.info("档案表修改完成,返回结果为"+resDatastr); + context.success("档案表修改完成,当前档案表ID为"+fid,false); + formDataVo.getNewFieldDataMap().put("返回结果", "档案表修改完成,当前档案表ID为"+fid); + }else{ + Map failedData = (Map)resData.get("failedData"); + for (Map.Entry entry:failedData.entrySet()) { + context.back("档案表修改失败:创建异常:" + entry.getValue()); + context.setErrMsg(mmr.getMsg()); + formDataVo.getNewFieldDataMap().put("返回结果", "档案表修改失败:创建异常:"+entry.getValue()); + } + } + + }else{ + context.back("档案表修改失败:修改异常:" + mmr.getMsg()); + context.setErrMsg(mmr.getMsg()); + formDataVo.getNewFieldDataMap().put("返回结果", "档案表修改失败:修改异常:"+mmr.getMsg()); + } + }else{ System.out.println("新增"); +// 当前数据已经存在执行修改逻辑 + JSONObject param = new JSONObject(); +// 设置基本数据 + param.put("doTrigger",paramJson.getBooleanValue("doTrigger")); + param.put("formCode",paramJson.getString("formCode")); + param.put("loginName",paramJson.getString("loginName")); + param.put("rightId",paramJson.getString("rightIdAdd")); + JSONArray dataList = new JSONArray(); + JSONObject data = new JSONObject(); + JSONObject paramDataList = paramJson.getJSONObject("dataList"); + JSONObject paramMasterTable = paramDataList.getJSONObject("masterTable"); + JSONObject masterTable = new JSONObject(); + masterTable.put("name",paramMasterTable.getString("name")); + JSONObject record = new JSONObject(); + record.put("id",formmainUpdate); +// 根据主表字段信息,设置主表参数 + JSONArray fields = new JSONArray(); + for (Map.Entry entry : paramMasterTable.getJSONObject("fields").entrySet()) { + JSONObject jsonObject = new JSONObject(); + jsonObject.put("name",entry.getKey()); + String value = entry.getValue().toString(); + FieldDataVo subFieldDataVo; + try { + subFieldDataVo = subFormDataVo.getFieldData(value); + } catch (NoSuchFieldException e) { + subFieldDataVo = formDataVo.getFieldData(value); + } + if(subFieldDataVo.getDbValue() == null){ + jsonObject.put("value",""); + }else{ + if(enumFields.contains(entry.getKey())){ + String subFieldValue = subFieldDataVo.getStringValue(); + jsonObject.put("showValue",subFieldValue); + }else{ + String subFieldDataDb = subFieldDataVo.getDbValue().toString(); + jsonObject.put("value",subFieldDataDb); + } + } + fields.add(jsonObject); + } + record.put("fields",fields); + masterTable.put("record",record); + data.put("masterTable",masterTable); +// 根据明细表字段信息,设置明细表参数 + JSONArray subTables = new JSONArray(); + JSONArray paramSubTables = paramDataList.getJSONArray("subTables"); + for(int i = 0 ; i < paramSubTables.size();i++){ + JSONObject paramSubTable = paramSubTables.getJSONObject(i); + JSONObject subTable = new JSONObject(); + subTable.put("name",paramSubTable.getString("tableName")); + JSONArray subRecords = new JSONArray(); + JSONObject subRecord = new JSONObject(); + subRecord.put("id", UUIDLong.longUUID()+""); + JSONArray subFields = new JSONArray(); + for (Map.Entry entry : paramSubTable.getJSONObject("fields").entrySet()) { + JSONObject jsonObject = new JSONObject(); + jsonObject.put("name",entry.getKey()); + String value = entry.getValue().toString(); + FieldDataVo subFieldDataVo ; + try { + subFieldDataVo = subFormDataVo.getFieldData(value); + } catch (NoSuchFieldException e) { + subFieldDataVo = formDataVo.getFieldData(value); + } + if(subFieldDataVo.getDbValue() == null){ + jsonObject.put("value",""); + }else{ + if(enumFields.contains(entry.getKey())){ + String subFieldValue = subFieldDataVo.getStringValue(); + jsonObject.put("showValue",subFieldValue); + }else{ + String subFieldDataDb = subFieldDataVo.getDbValue().toString(); + jsonObject.put("value",subFieldDataDb); + } + } + subFields.add(jsonObject); + } + subRecord.put("fields",subFields); + subRecords.add(subRecord); + subTable.put("records",subRecords); + subTables.add(subTable); + } + data.put("subTables",subTables); + dataList.add(data); + param.put("dataList",dataList); + log.info(param.toString()); + context.setRequest(param.toString()); +// 获取调用接口路径 + String formmainAddUrl = mainUrl+"/seeyon/rest/cap4/form/soap/batch-add?token="+mainToken; + JSONObject res = ProtUtil.doPost(param.toString(),formmainAddUrl); + log.info(res.toString()); + context.setResponse(res.toString()); + MemberManagerResponse mmr = new MemberManagerResponse(res); + if(mmr.isSuccess()){ + String resDatastr = mmr.getData(); + Map resData = DataProcessingUtil.convertStringToMap(resDatastr); + List successIdList = (List)resData.get("successIdList"); + if(successIdList.size()>0){ + String fid = successIdList.get(0); + log.info("档案表创建完成,返回结果为"+resDatastr); + context.success("档案表创建完成,当前档案表ID为"+fid,false); + formDataVo.getNewFieldDataMap().put("返回结果", "档案表创建完成,当前档案表ID为"+fid); + }else{ + Map failedData = (Map)resData.get("failedData"); + for (Map.Entry entry:failedData.entrySet()) { + context.back("档案表创建失败:创建异常:" + entry.getValue()); + context.setErrMsg(mmr.getMsg()); + formDataVo.getNewFieldDataMap().put("返回结果", "档案表创建失败:创建异常:"+entry.getValue()); + } + } + }else{ + context.back("档案表创建失败:修改异常:" + mmr.getMsg()); + context.setErrMsg(mmr.getMsg()); + formDataVo.getNewFieldDataMap().put("返回结果", "档案表创建失败:修改异常:"+mmr.getMsg()); + } + } + } + return context; + } + + @Override + public String getPluginId() { + return PersonnelFlowConstants.getPluginId(); + } + + @Override + public String getNodeId() { + return "YdAccountOpenNode"; + } + + @Override + public String getNodeName() { + return "业代账号批量开通档案表超级节点"; + } + + +} diff --git a/v5/apps-customize/src/main/java/com/seeyon/apps/src_personnelflow/tool/HttpClient.java b/v5/apps-customize/src/main/java/com/seeyon/apps/src_personnelflow/tool/HttpClient.java new file mode 100644 index 0000000..8110eb3 --- /dev/null +++ b/v5/apps-customize/src/main/java/com/seeyon/apps/src_personnelflow/tool/HttpClient.java @@ -0,0 +1,339 @@ +package com.seeyon.apps.src_personnelflow.tool; + +import org.apache.http.HttpEntity; +import org.apache.http.NameValuePair; +import org.apache.http.client.entity.UrlEncodedFormEntity; +import org.apache.http.client.methods.*; +import org.apache.http.entity.ContentType; +import org.apache.http.entity.StringEntity; +import org.apache.http.entity.mime.HttpMultipartMode; +import org.apache.http.entity.mime.MultipartEntityBuilder; +import org.apache.http.impl.client.CloseableHttpClient; +import org.apache.http.impl.client.HttpClientBuilder; +import org.apache.http.impl.client.HttpClients; +import org.apache.http.message.BasicNameValuePair; +import org.apache.http.util.EntityUtils; + +import java.io.File; +import java.io.IOException; +import java.nio.charset.Charset; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Set; + +/** + * @ClassName: HttpClient + * @Description: HTTP请求工具类 + * @Author: GiikJc + * @Date: 2022/7/12 15:03 + */ +/** + * 发送Get请求:HttpResponse httpGet(String url,Map headers,String encode) + *发送Post请求,同表单Post提交:HttpResponse httpPostForm(String url,Map params, Map headers,String encode) + *发送Post Raw请求:HttpResponse httpPostRaw(String url,String stringJson,Map headers, String encode) + *发送Put Raw请求:HttpResponse httpPutRaw(String url,String stringJson,Map headers, String encode) + *发送Delete请求:HttpResponse httpDelete(String url,Map headers,String encode) + */ +public class HttpClient { + + /** + * 发送http get请求 + */ + public static String httpGet(String url,Map headers,String encode){ + + if(encode == null){ + encode = "utf-8"; + } + CloseableHttpResponse httpResponse = null; + CloseableHttpClient closeableHttpClient = null; + String content = null; + //since 4.3 不再使用 DefaultHttpClient + try { + closeableHttpClient = HttpClientBuilder.create().build(); + HttpGet httpGet = new HttpGet(url); + //设置header + if (headers != null && headers.size() > 0) { + for (Map.Entry entry : headers.entrySet()) { + httpGet.setHeader(entry.getKey(),entry.getValue()); + } + } + + httpResponse = closeableHttpClient.execute(httpGet); + HttpEntity entity = httpResponse.getEntity(); + content = EntityUtils.toString(entity, encode); + } catch (Exception e) { + e.printStackTrace(); + }finally{ + try { + httpResponse.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + try { //关闭连接、释放资源 + closeableHttpClient.close(); + } catch (IOException e) { + e.printStackTrace(); + } + return content; + } + /** + * 发送 http post 请求,参数以form表单键值对的形式提交。 + */ + public static String httpPostForm(String url,Map params, Map headers,String encode){ + + if(encode == null){ + encode = "utf-8"; + } + + String content = null; + CloseableHttpResponse httpResponse = null; + CloseableHttpClient closeableHttpClient = null; + try { + + closeableHttpClient = HttpClients.createDefault(); + HttpPost httpost = new HttpPost(url); + + //设置header + if (headers != null && headers.size() > 0) { + for (Map.Entry entry : headers.entrySet()) { + httpost.setHeader(entry.getKey(),entry.getValue()); + } + } + //组织请求参数 + List paramList = new ArrayList (); + if(params != null && params.size() > 0){ + Set keySet = params.keySet(); + for(String key : keySet) { + paramList.add(new BasicNameValuePair(key, params.get(key))); + } + } + httpost.setEntity(new UrlEncodedFormEntity(paramList, encode)); + + + httpResponse = closeableHttpClient.execute(httpost); + HttpEntity entity = httpResponse.getEntity(); + content = EntityUtils.toString(entity, encode); + } catch (Exception e) { + e.printStackTrace(); + }finally{ + try { + httpResponse.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + try { //关闭连接、释放资源 + closeableHttpClient.close(); + } catch (IOException e) { + e.printStackTrace(); + } + return content; + } + + /** + * 发送 http post 请求,参数以原生字符串进行提交 + * @param url + * @param encode + * @return + */ + public static String httpPostRaw(String url,String stringJson,Map headers, String encode){ + if(encode == null){ + encode = "utf-8"; + } + String content = null; + CloseableHttpResponse httpResponse = null; + CloseableHttpClient closeableHttpClient = null; + try { + + //HttpClients.createDefault()等价于 HttpClientBuilder.create().build(); + closeableHttpClient = HttpClients.createDefault(); + HttpPost httpost = new HttpPost(url); + + //设置header + httpost.setHeader("Content-type", "application/json"); + if (headers != null && headers.size() > 0) { + for (Map.Entry entry : headers.entrySet()) { + httpost.setHeader(entry.getKey(),entry.getValue()); + } + } + //组织请求参数 + StringEntity stringEntity = new StringEntity(stringJson, encode); + httpost.setEntity(stringEntity); + + + //响应信息 + httpResponse = closeableHttpClient.execute(httpost); + HttpEntity entity = httpResponse.getEntity(); + content = EntityUtils.toString(entity, encode); + } catch (Exception e) { + e.printStackTrace(); + }finally{ + try { + httpResponse.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + try { //关闭连接、释放资源 + closeableHttpClient.close(); + } catch (IOException e) { + e.printStackTrace(); + } + return content; + } + + /** + * 发送 http put 请求,参数以原生字符串进行提交 + * @param url + * @param encode + * @return + */ + public static String httpPutRaw(String url,String stringJson,Map headers, String encode){ + if(encode == null){ + encode = "utf-8"; + } + CloseableHttpResponse httpResponse = null; + CloseableHttpClient closeableHttpClient = null; + String content = null; + //since 4.3 不再使用 DefaultHttpClient + try { + + //HttpClients.createDefault()等价于 HttpClientBuilder.create().build(); + closeableHttpClient = HttpClients.createDefault(); + HttpPut httpput = new HttpPut(url); + + //设置header + httpput.setHeader("Content-type", "application/json"); + if (headers != null && headers.size() > 0) { + for (Map.Entry entry : headers.entrySet()) { + httpput.setHeader(entry.getKey(),entry.getValue()); + } + } + //组织请求参数 + StringEntity stringEntity = new StringEntity(stringJson, encode); + httpput.setEntity(stringEntity); + //响应信息 + httpResponse = closeableHttpClient.execute(httpput); + HttpEntity entity = httpResponse.getEntity(); + content = EntityUtils.toString(entity, encode); + } catch (Exception e) { + e.printStackTrace(); + }finally{ + try { + httpResponse.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + try { + closeableHttpClient.close(); //关闭连接、释放资源 + } catch (IOException e) { + e.printStackTrace(); + } + return content; + } + /** + * 发送http delete请求 + */ + public static String httpDelete(String url,Map headers,String encode){ + if(encode == null){ + encode = "utf-8"; + } + String content = null; + CloseableHttpResponse httpResponse = null; + CloseableHttpClient closeableHttpClient = null; + try { + //since 4.3 不再使用 DefaultHttpClient + closeableHttpClient = HttpClientBuilder.create().build(); + HttpDelete httpdelete = new HttpDelete(url); + //设置header + if (headers != null && headers.size() > 0) { + for (Map.Entry entry : headers.entrySet()) { + httpdelete.setHeader(entry.getKey(),entry.getValue()); + } + } + + httpResponse = closeableHttpClient.execute(httpdelete); + HttpEntity entity = httpResponse.getEntity(); + content = EntityUtils.toString(entity, encode); + } catch (Exception e) { + e.printStackTrace(); + }finally{ + try { + httpResponse.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + try { //关闭连接、释放资源 + closeableHttpClient.close(); + } catch (IOException e) { + e.printStackTrace(); + } + return content; + } + + /** + * 发送 http post 请求,支持文件上传 + */ + public static String httpPostFormMultipart(String url,Map params, List files,Map headers,String encode){ + if(encode == null){ + encode = "utf-8"; + } + CloseableHttpResponse httpResponse = null; + CloseableHttpClient closeableHttpClient = null; + String content = null; + //since 4.3 不再使用 DefaultHttpClient + try { + + closeableHttpClient = HttpClients.createDefault(); + HttpPost httpost = new HttpPost(url); + + //设置header + if (headers != null && headers.size() > 0) { + for (Map.Entry entry : headers.entrySet()) { + httpost.setHeader(entry.getKey(),entry.getValue()); + } + } + MultipartEntityBuilder mEntityBuilder = MultipartEntityBuilder.create(); + mEntityBuilder.setMode(HttpMultipartMode.BROWSER_COMPATIBLE); + mEntityBuilder.setCharset(Charset.forName(encode)); + + // 普通参数 + ContentType contentType = ContentType.create("text/plain",Charset.forName(encode));//解决中文乱码 + if (params != null && params.size() > 0) { + Set keySet = params.keySet(); + for (String key : keySet) { + mEntityBuilder.addTextBody(key, params.get(key),contentType); + } + } + //二进制参数 + if (files != null && files.size() > 0) { + for (File file : files) { + mEntityBuilder.addBinaryBody("file", file); + } + } + httpost.setEntity(mEntityBuilder.build()); + httpResponse = closeableHttpClient.execute(httpost); + HttpEntity entity = httpResponse.getEntity(); + content = EntityUtils.toString(entity, encode); + } catch (Exception e) { + e.printStackTrace(); + }finally{ + try { + httpResponse.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + try { //关闭连接、释放资源 + closeableHttpClient.close(); + } catch (IOException e) { + e.printStackTrace(); + } + return content; + } + +} diff --git a/v5/apps-customize/src/main/java/com/seeyon/apps/src_personnelflow/tool/HttpRequestUtils.java b/v5/apps-customize/src/main/java/com/seeyon/apps/src_personnelflow/tool/HttpRequestUtils.java new file mode 100644 index 0000000..0987d13 --- /dev/null +++ b/v5/apps-customize/src/main/java/com/seeyon/apps/src_personnelflow/tool/HttpRequestUtils.java @@ -0,0 +1,80 @@ +package com.seeyon.apps.src_personnelflow.tool; + +import org.apache.commons.httpclient.util.HttpURLConnection; + +import java.io.BufferedReader; +import java.io.InputStreamReader; +import java.io.OutputStream; +import java.net.URL; +import java.util.Map; + +public class HttpRequestUtils { + + // Send a GET request + public static String sendGet(String url, Map headers) throws Exception { + HttpURLConnection connection = (HttpURLConnection) new URL(url).openConnection(); + connection.setRequestMethod("GET"); + + if (headers != null) { + for (Map.Entry header : headers.entrySet()) { + connection.setRequestProperty(header.getKey(), header.getValue()); + } + } + + return getResponse(connection); + } + + // Send a POST request + public static String sendPost(String url, String body, Map headers) throws Exception { + return sendRequestWithBody(url, "POST", body, headers); + } + + // Send a PUT request + public static String sendPut(String url, String body, Map headers) throws Exception { + return sendRequestWithBody(url, "PUT", body, headers); + } + + // Internal method for POST and PUT requests + private static String sendRequestWithBody(String url, String method, String body, Map headers) throws Exception { + HttpURLConnection connection = (HttpURLConnection) new URL(url).openConnection(); + connection.setRequestMethod(method); + connection.setDoOutput(true); + + if (headers != null) { + for (Map.Entry header : headers.entrySet()) { + connection.setRequestProperty(header.getKey(), header.getValue()); + } + } + + if (body != null && !body.isEmpty()) { + try (OutputStream os = connection.getOutputStream()) { + os.write(body.getBytes()); + os.flush(); + } + } + + return getResponse(connection); + } + + // Handle the response + private static String getResponse(HttpURLConnection connection) throws Exception { + int status = connection.getResponseCode(); + BufferedReader reader; + + if (status >= 200 && status < 300) { + reader = new BufferedReader(new InputStreamReader(connection.getInputStream())); + } else { + reader = new BufferedReader(new InputStreamReader(connection.getErrorStream())); + } + + StringBuilder response = new StringBuilder(); + String line; + while ((line = reader.readLine()) != null) { + response.append(line); + } + reader.close(); + connection.disconnect(); + + return response.toString(); + } +} diff --git a/v5/apps-customize/src/main/java/com/seeyon/apps/src_personnelflow/tool/WeaverUtil.java b/v5/apps-customize/src/main/java/com/seeyon/apps/src_personnelflow/tool/WeaverUtil.java new file mode 100644 index 0000000..0edd212 --- /dev/null +++ b/v5/apps-customize/src/main/java/com/seeyon/apps/src_personnelflow/tool/WeaverUtil.java @@ -0,0 +1,152 @@ +package com.seeyon.apps.src_personnelflow.tool; + +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; +import org.songjian.utils.json.JSON; +import weaver.rsa.security.RSA; + +import java.util.HashMap; +import java.util.Map; + +/** + * @ClassName:WeaverUtil + * @Author: 86131 + * @Date: 2025/01/17 14:37 + * @Description: 必须描述类做什么事情, 实现什么功能 + */ +public class WeaverUtil { + + /* * + * @Title: submit + * @Author: 86131 + * @Date: 2025/01/17 23:14 + * @Params: [requestId] 泛微流程ID + * @Return: String + * @Description: 流程提交 + */ + public static String submit(Map params){ + // 获取Token + String bpmUserID = params.get("userId") + "";//固定值 泛微提供 + String bak2 = applytoken(params.get("secret")+"",params.get("appId")+"",params.get("ipPort")+""); + JSONObject objecttoken = JSONObject.parseObject(bak2); + String token = objecttoken.getString("token"); + System.out.println("token:"+token); + Map heads=new HashMap(); + RSA rsa = new RSA(); + // + String userid = rsa.encrypt(null, bpmUserID, null, "utf8", params.get("spk") +"", false); + heads.put("token", token); + heads.put("appid", (String) params.get("appId")); + heads.put("userid", userid); + String url = params.get("ipPort") + "/api/workflow/paService/submitRequest"; + Map inMap = new HashMap(); + inMap.put("requestId", params.get("requestId")); + inMap.put("mainData", params.get("mainData")); + String back1 = HttpClient.httpPostForm(url,inMap,heads,"utf-8"); + //{"code":"SUCCESS","errMsg":{},"reqFailMsg":{"keyParameters":{},"msgInfo":{},"otherParams":{"doAutoApprove":"0"}}} + //code:SUCCESS 成功, + return back1; + } + + /* * + * @Title: reject + * @Author: 86131 + * @Date: 2025/01/17 23:15 + * @Params: [requestId] 泛微流程ID + * @Return: String + * @Description: 流程回退 + */ + public static String reject(Map params){ + String bpmUserID = params.get("userId") + "";//固定值 泛微提供 + + String bak2 = applytoken(params.get("secret")+"",params.get("appId")+"",params.get("ipPort")+""); + JSONObject objecttoken = JSONObject.parseObject(bak2); + String token = objecttoken.getString("token"); + System.out.println("token:"+token); + Map heads = new HashMap(); + RSA rsa = new RSA(); + + String userid = rsa.encrypt(null, bpmUserID, null, "utf8", params.get("spk")+"", false); + heads.put("token", token); + heads.put("appid", params.get("appId")+""); + heads.put("userid", userid); + String url = params.get("ipPort") + "/api/workflow/paService/rejectRequest"; + Map inMap = new HashMap(); + inMap.put("requestId", params.get("requestId")); +// inMap.put("mainData",JSONObject.toJSONString(params.get("mainData"))); + inMap.put("mainData",params.get("mainData")); + String back1 = HttpClient.httpPostForm(url,inMap,heads,"utf-8"); + + //{"code":"SUCCESS","errMsg":{},"reqFailMsg":{"keyParameters":{},"msgInfo":{},"otherParams":{"doAutoApprove":"0"}}} + //code:SUCCESS 成功, + return back1; + } + + /* * + * @Title: reject + * @Author: 86131 + * @Date: 2025/01/17 23:15 + * @Params: [requestId] 泛微流程ID + * @Return: String + * @Description: 流程回退 + */ + public static String bareject(Map params){ + String bpmUserID = "1";//固定值 泛微提供 + + String bak2 = applytoken(params.get("secret")+"",params.get("appId")+"",params.get("ipPort")+""); + JSONObject objecttoken = JSONObject.parseObject(bak2); + String token = objecttoken.getString("token"); + System.out.println("token:"+token); + Map heads = new HashMap(); + RSA rsa = new RSA(); + + String userid = rsa.encrypt(null, bpmUserID, null, "utf8", params.get("spk")+"", false); + heads.put("token", token); + heads.put("appid", params.get("appId")+""); + heads.put("userid", userid); + String url = params.get("ipPort") + "/api/workflow/paService/rejectRequest"; + Map inMap = new HashMap(); + inMap.put("requestId", params.get("requestId")); +// inMap.put("mainData",JSONObject.toJSONString(params.get("mainData"))); + inMap.put("mainData",params.get("mainData")); + String back1 = HttpClient.httpPostForm(url,inMap,heads,"utf-8"); + + //{"code":"SUCCESS","errMsg":{},"reqFailMsg":{"keyParameters":{},"msgInfo":{},"otherParams":{"doAutoApprove":"0"}}} + //code:SUCCESS 成功, + return back1; + } + + + /** + * 注册 + * @return + */ + public static String getRegist() { + Map heads = new HashMap(); + String cpk = new RSA().getRSA_PUB(); + heads.put("appid", ""); + heads.put("cpk", cpk); + String data = HttpClient.httpPostForm("" + "/api/ec/dev/auth/regist", null, heads,"utf-8"); + return data; + } + + /** + * 获取token + * @param secret + * @return + */ + public static String applytoken(String secret,String appId,String ipPort) { + Map heads = new HashMap(); + //String secret_2 = rsa.encrypt(null, secrit, null, "utf-8", spk, false); + heads.put("appid", appId); + heads.put("secret", secret); + String data = HttpClient.httpPostForm(ipPort + "/api/ec/dev/auth/applytoken", null, heads,"utf-8"); + System.out.println("applytoken: " + data); + return data; + } + + + + + +} diff --git a/v5/apps-customize/src/main/java/com/seeyon/apps/src_personnelflow/util/DataProcessingUtil.java b/v5/apps-customize/src/main/java/com/seeyon/apps/src_personnelflow/util/DataProcessingUtil.java new file mode 100644 index 0000000..72cc48a --- /dev/null +++ b/v5/apps-customize/src/main/java/com/seeyon/apps/src_personnelflow/util/DataProcessingUtil.java @@ -0,0 +1,53 @@ +package com.seeyon.apps.src_personnelflow.util; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class DataProcessingUtil { + + public static Map convertStringToMap(String input) { + Map resultMap = new HashMap<>(); + input = input.substring(1, input.length() - 1); + String[] keyValuePairs = input.split(", "); + + for (String pair : keyValuePairs) { + String[] parts = pair.split("=", 2); + String key = parts[0]; + String valueStr = parts[1]; + + if (valueStr.startsWith("[")) { + List list = new ArrayList<>(); + String listContent = valueStr.substring(1, valueStr.length() - 1); + if (!listContent.isEmpty()) { + String[] items = listContent.split(","); + for (String item : items) { + list.add(item.trim()); + } + } + resultMap.put(key, list); + } else if (valueStr.startsWith("{")) { + Map nestedMap = new HashMap<>(); + String nestedStr = valueStr.substring(1, valueStr.length() - 1); + if (!nestedStr.isEmpty()) { + String[] nestedPairs = nestedStr.split(", "); + for (String nestedPair : nestedPairs) { + String[] nestedParts = nestedPair.split("=", 2); + nestedMap.put(nestedParts[0], nestedParts[1]); + } + } + resultMap.put(key, nestedMap); + } else { + try { + int intValue = Integer.parseInt(valueStr); + resultMap.put(key, intValue); + } catch (NumberFormatException e) { + resultMap.put(key, valueStr); + } + } + } + return resultMap; + } + +} diff --git a/v5/apps-customize/src/main/java/com/seeyon/apps/src_personnelflow/util/ParamUtil.java b/v5/apps-customize/src/main/java/com/seeyon/apps/src_personnelflow/util/ParamUtil.java new file mode 100644 index 0000000..9a247d7 --- /dev/null +++ b/v5/apps-customize/src/main/java/com/seeyon/apps/src_personnelflow/util/ParamUtil.java @@ -0,0 +1,437 @@ +package com.seeyon.apps.src_personnelflow.util; + +import cn.hutool.log.Log; +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; +import com.jingan.auth.server.factory.LogFactory; +import com.seeyon.apps.common.plugin.vo.ConfigVo; +import com.seeyon.apps.ext.workflow.vo.FieldDataVo; +import com.seeyon.apps.ext.workflow.vo.FormDataVo; + +import com.seeyon.apps.src_personnelflow.constants.PersonnelFlowConstants; +import com.seeyon.ctp.common.AppContext; +import com.seeyon.ctp.common.SystemEnvironment; +import com.seeyon.ctp.common.ctpenumnew.manager.EnumManager; +import com.seeyon.ctp.common.exceptions.BusinessException; +import com.seeyon.ctp.common.filemanager.manager.AttachmentManager; +import com.seeyon.ctp.common.po.ctpenumnew.CtpEnumItem; +import com.seeyon.ctp.common.po.filemanager.Attachment; +import com.seeyon.ctp.organization.bo.*; +import com.seeyon.ctp.organization.manager.OrgManager; +import com.seeyon.ctp.util.UUIDLong; + +import java.io.IOException; +import java.util.List; +import java.util.Map; + +public class ParamUtil { + + private static Log log = Log.get(ParamUtil.class); + + private EnumManager enumManagerNew; + public void setEnumManagerNew(EnumManager enumManagerNew) {this.enumManagerNew = enumManagerNew; } + public EnumManager getEnumManagerNew() { + if (enumManagerNew == null) {enumManagerNew = (EnumManager) AppContext.getBean("enumManagerNew");}return enumManagerNew; + } + + private OrgManager orgManager; + public void setOrgManager(OrgManager orgManager) {this.orgManager = orgManager; } + public OrgManager getOrgManager() { + if (orgManager == null) {orgManager = (OrgManager) AppContext.getBean("orgManager");}return orgManager; + } + + private AttachmentManager attachmentManager; + public void setAttachmentManager(AttachmentManager attachmentManager) {this.attachmentManager = attachmentManager;} + public AttachmentManager getAttachmentManager() { + if (this.attachmentManager == null) {this.attachmentManager = (AttachmentManager) AppContext.getBean("attachmentManager");}return this.attachmentManager; + } + + public String formUpdateParam(String param, FormDataVo formDataVo, String nodeId, ConfigVo configVo, String formId) throws BusinessException, NoSuchFieldException, IOException { + String res = filesTableUpdate(param,formDataVo,configVo,formId); + return res; + } + + public String filesTableUpdate(String param, FormDataVo formDataVo, ConfigVo configVo, String formId) throws NoSuchFieldException, BusinessException, IOException { + JSONObject jsonObject = new JSONObject(); + JSONObject paramJson = JSONObject.parseObject(param); + String formType = paramJson.getString("formType"); + if("formmain".equals(formType)){ + jsonObject = handleFormmainUpdate(jsonObject,paramJson,formDataVo,configVo,formId); + } + return jsonObject.toString(); + } + public JSONObject handleFormmainUpdate(JSONObject jsonObject, JSONObject paramJson, FormDataVo formDataVo, ConfigVo configVo, String formId) throws NoSuchFieldException, BusinessException, IOException { + // 附件控件,选人控件,部门控件,单位控件,岗位控件,职务级别控件,枚举控件 + String memberFields = paramJson.getString("memberFields")==null?"":paramJson.getString("memberFields"); + String deptFields = paramJson.getString("deptFields")==null?"":paramJson.getString("deptFields"); + String accountFields = paramJson.getString("accountFields")==null?"":paramJson.getString("accountFields"); + String postFields = paramJson.getString("postFields")==null?"":paramJson.getString("postFields"); + String levelFields = paramJson.getString("levelFields")==null?"":paramJson.getString("levelFields"); + String enumFields = paramJson.getString("enumFields")==null?"":paramJson.getString("enumFields"); + String fileFields = paramJson.getString("fileFields")==null?"":paramJson.getString("fileFields"); +// 设置主参数字段 + jsonObject.put("formCode",paramJson.getString("formCode")); + jsonObject.put("loginName",paramJson.getString("loginName")); + jsonObject.put("rightId",paramJson.getString("rightIdUpdate")); + jsonObject.put("doTrigger",paramJson.getBooleanValue("doTrigger")); + JSONArray dataList = new JSONArray(); + + JSONObject paramDataList = paramJson.getJSONObject("dataList"); + JSONObject paramMasterTable = paramDataList.getJSONObject("masterTable"); + String paramMainname = paramMasterTable.getString("name"); + JSONObject paramMasterfields = paramMasterTable.getJSONObject("fields"); + +// 设置表单主表字段 + JSONObject data = new JSONObject(); + JSONObject masterTable = new JSONObject(); + masterTable.put("name",paramMainname); + JSONObject record = new JSONObject(); + JSONArray attachmentInfos = new JSONArray(); + JSONArray fields = handleFields(paramMasterfields,formDataVo,null,enumFields,accountFields,deptFields,postFields,levelFields, + memberFields,fileFields,configVo,attachmentInfos); + record.put("id",formId); + record.put("fields",fields); + masterTable.put("record",record); +// 添加主表数据 + data.put("masterTable",masterTable); + + JSONArray paramSubTables = paramDataList.getJSONArray("subTables"); + JSONArray subTables = new JSONArray(); + Map> subFormMap = formDataVo.getSubFormMap(); +// 遍历所有流程表数据 + for (int i = 0 ; i < paramSubTables.size();i++) { +// 获取参数配置中的字段信息 + JSONObject paramSubTable = paramSubTables.getJSONObject(i); +// 获取当前流程表单名称 + String paramSubTableName = paramSubTable.getString("name"); + if("个人履历".equals(paramSubTableName)){ +// 创建推送参数对象 + JSONObject paramFields = paramSubTable.getJSONObject("fields"); + JSONObject subTable = new JSONObject(); + subTable.put("name", paramSubTable.getString("tableName")); + JSONArray subRecords = new JSONArray(); + JSONObject subRecord = new JSONObject(); + JSONArray subFields = handleFields(paramFields,formDataVo,null,enumFields,accountFields,deptFields,postFields,levelFields, + memberFields,fileFields,configVo,attachmentInfos); + subRecord.put("id", UUIDLong.longUUID()); + subRecord.put("fields",subFields); + subRecords.add(subRecord); + subTable.put("records",subRecords); + subTables.add(subTable); + }else{ + // 根据名称获取表单中明细表信息 + List subForm = subFormMap.get(paramSubTableName); +// 获取参数配置中的字段信息 + JSONObject paramFields = paramSubTable.getJSONObject("fields"); +//// 创建推送参数对象 + JSONObject subTable = new JSONObject(); + subTable.put("name", paramSubTable.getString("tableName")); + JSONArray subRecords = new JSONArray(); + if(subForm==null){ + JSONObject subRecord = new JSONObject(); + JSONArray subFields = handleFields(paramFields,formDataVo,null,enumFields,accountFields,deptFields,postFields,levelFields, + memberFields,fileFields,configVo,attachmentInfos); + subRecord.put("id", UUIDLong.longUUID()); + subRecord.put("fields",subFields); + subRecords.add(subRecord); + }else{ + for (FormDataVo subFormDataVo : subForm) { + JSONObject subRecord = new JSONObject(); + JSONArray subFields = handleFields(paramFields,formDataVo,subFormDataVo,enumFields,accountFields,deptFields,postFields,levelFields, + memberFields,fileFields,configVo,attachmentInfos); + subRecord.put("id", UUIDLong.longUUID()); + subRecord.put("fields",subFields); + subRecords.add(subRecord); + } + } + subTable.put("records",subRecords); + subTables.add(subTable); + } + } + data.put("subTables",subTables); +// 添加附件数据 + data.put("attachmentInfos",attachmentInfos); +// 插入档案表参数 + dataList.add(data); + jsonObject.put("dataList",dataList); + + return jsonObject; + } + + public String formAddParam(String param, FormDataVo formDataVo, String nodeId, ConfigVo configVo) throws BusinessException, NoSuchFieldException, IOException { + String res =filesTableAdd(param,formDataVo,configVo); + return res; + } + + public String filesTableAdd(String param, FormDataVo formDataVo, ConfigVo configVo) throws NoSuchFieldException, BusinessException, IOException { + JSONObject jsonObject = new JSONObject(); + JSONObject paramJson = JSONObject.parseObject(param); + String formType = paramJson.getString("formType"); + if("formmain".equals(formType)){ + jsonObject = handleFormmainAdd(jsonObject,paramJson,formDataVo,configVo); + } + return jsonObject.toString(); + } + + public JSONObject handleFormmainAdd(JSONObject jsonObject, JSONObject paramJson, FormDataVo formDataVo, ConfigVo configVo) throws NoSuchFieldException, BusinessException, IOException { + // 附件控件,选人控件,部门控件,单位控件,岗位控件,职务级别控件,枚举控件 + String memberFields = paramJson.getString("memberFields")==null?"":paramJson.getString("memberFields"); + String deptFields = paramJson.getString("deptFields")==null?"":paramJson.getString("deptFields"); + String accountFields = paramJson.getString("accountFields")==null?"":paramJson.getString("accountFields"); + String postFields = paramJson.getString("postFields")==null?"":paramJson.getString("postFields"); + String levelFields = paramJson.getString("levelFields")==null?"":paramJson.getString("levelFields"); + String enumFields = paramJson.getString("enumFields")==null?"":paramJson.getString("enumFields"); + String fileFields = paramJson.getString("fileFields")==null?"":paramJson.getString("fileFields"); +// 设置主参数字段 + jsonObject.put("formCode",paramJson.getString("formCode")); + jsonObject.put("loginName",paramJson.getString("loginName")); + jsonObject.put("rightId",paramJson.getString("rightIdAdd")); + jsonObject.put("doTrigger",paramJson.getBooleanValue("doTrigger")); + JSONArray dataList = new JSONArray(); + + JSONObject paramDataList = paramJson.getJSONObject("dataList"); + JSONObject paramMasterTable = paramDataList.getJSONObject("masterTable"); + String paramMainname = paramMasterTable.getString("name"); + JSONObject paramMasterfields = paramMasterTable.getJSONObject("fields"); + +// 设置表单主表字段 + JSONObject data = new JSONObject(); + JSONObject masterTable = new JSONObject(); + masterTable.put("name",paramMainname); + JSONObject record = new JSONObject(); + JSONArray attachmentInfos = new JSONArray(); + JSONArray fields = handleFields(paramMasterfields,formDataVo,null,enumFields,accountFields,deptFields,postFields,levelFields, + memberFields,fileFields,configVo,attachmentInfos); + + record.put("fields",fields); + masterTable.put("record",record); +// 添加主表数据 + data.put("masterTable",masterTable); + + JSONArray paramSubTables = paramDataList.getJSONArray("subTables"); + JSONArray subTables = new JSONArray(); + Map> subFormMap = formDataVo.getSubFormMap(); +// 遍历所有流程表数据 + for (int i = 0 ; i < paramSubTables.size();i++) { + JSONObject paramSubTable = paramSubTables.getJSONObject(i); +// 获取当前流程表单名称 + String paramSubTableName = paramSubTable.getString("name"); + if("个人履历".equals(paramSubTableName)){ +// 获取参数配置中的字段信息 + JSONObject paramFields = paramSubTable.getJSONObject("fields"); +//// 创建推送参数对象 + JSONObject subTable = new JSONObject(); + subTable.put("name", paramSubTable.getString("tableName")); + JSONArray subRecords = new JSONArray(); + JSONObject subRecord = new JSONObject(); + JSONArray subFields = handleFields(paramFields,formDataVo,null,enumFields,accountFields,deptFields,postFields,levelFields, + memberFields,fileFields,configVo,attachmentInfos); + subRecord.put("fields",subFields); + subRecords.add(subRecord); + subTable.put("records",subRecords); + subTables.add(subTable); + }else{ +// 根据名称获取表单中明细表信息 + List subForm = subFormMap.get(paramSubTableName); + // 获取参数配置中的字段信息 + JSONObject paramFields = paramSubTable.getJSONObject("fields"); + if(subForm==null){ +//// 创建推送参数对象 + JSONObject subTable = new JSONObject(); + subTable.put("name", paramSubTable.getString("tableName")); + JSONArray subRecords = new JSONArray(); + JSONObject subRecord = new JSONObject(); + JSONArray subFields = handleFields(paramFields,formDataVo,null,enumFields,accountFields,deptFields,postFields,levelFields, + memberFields,fileFields,configVo,attachmentInfos); + subRecord.put("fields",subFields); + subRecords.add(subRecord); + subTable.put("records",subRecords); + subTables.add(subTable); + }else{ + // 创建推送参数对象 + JSONObject subTable = new JSONObject(); + subTable.put("name", paramSubTable.getString("tableName")); + JSONArray subRecords = new JSONArray(); +// 遍历所有明细表数据 + for (FormDataVo subFormDataVo : subForm) { + JSONObject subRecord = new JSONObject(); + JSONArray subFields = handleFields(paramFields,formDataVo,subFormDataVo,enumFields,accountFields,deptFields,postFields,levelFields, + memberFields,fileFields,configVo,attachmentInfos); + subRecord.put("fields",subFields); + subRecords.add(subRecord); + } + subTable.put("records",subRecords); + subTables.add(subTable); + } + } + } + data.put("subTables",subTables); +// 添加附件数据 + data.put("attachmentInfos",attachmentInfos); +// 插入档案表参数 + dataList.add(data); + jsonObject.put("dataList",dataList); + + return jsonObject; + } + + public String getlcToken(ConfigVo configVo) throws IOException { + String getTokenUrl = configVo.getParamVal(PersonnelFlowConstants.getTokenUrl.name()); + String restUserName = configVo.getParamVal(PersonnelFlowConstants.restUserName.name()); + String restPassword = configVo.getParamVal(PersonnelFlowConstants.restPassword.name()); + String loginName = configVo.getParamVal(PersonnelFlowConstants.loginName.name()); + String jttoken = ProtUtil.getToken(getTokenUrl,restUserName,restPassword,loginName); + return jttoken; + } + + public String getzsjToken(ConfigVo configVo) throws IOException { + String getzsjTokenUrl = configVo.getParamVal(PersonnelFlowConstants.getzsjTokenUrl.name()); + String restzsjUserName = configVo.getParamVal(PersonnelFlowConstants.restzsjUserName.name()); + String restzsjPassword = configVo.getParamVal(PersonnelFlowConstants.restzsjPassword.name()); + String zsjloginName = configVo.getParamVal(PersonnelFlowConstants.zsjloginName.name()); + String zsjtoken = ProtUtil.getToken(getzsjTokenUrl,restzsjUserName,restzsjPassword,zsjloginName); + return zsjtoken; + } + + + + private JSONArray handleFields(JSONObject paramFields, FormDataVo formDataVo, FormDataVo subFormDataVo, String enumFields, + String accountFields, String deptFileds, String postFields, String levelFields, String memberFields, + String fileFields, ConfigVo configVo, JSONArray attachmentInfos) throws BusinessException, IOException, NoSuchFieldException { + JSONArray subFields = new JSONArray(); + for (Map.Entry entry : paramFields.entrySet()) { + JSONObject subField = new JSONObject(); + FieldDataVo fieldDataVo = null; + try { + fieldDataVo = formDataVo.getFieldData(entry.getValue().toString()); + } catch (NoSuchFieldException e) { + if(fieldDataVo==null&&subFormDataVo!=null){ + fieldDataVo = subFormDataVo.getFieldData(entry.getValue().toString()); + } + } + if(fieldDataVo.getDbValue()==null){ + continue; + } + subField.put("name", entry.getKey()); +// 设置默认值,避免出现空参数的情况 + subField.put("value",""); + subField.put("showValue",""); +// 判断当前处理字段是否为枚举 + if (enumFields.contains(entry.getKey())) { +// 查询枚举信息 + if (fieldDataVo.getDbValue() != null) { + String dbValue = fieldDataVo.getDbValue().toString(); + long enumItemId = Long.parseLong(dbValue); + CtpEnumItem ctpEnumItem = getEnumManagerNew().getCtpEnumItem(enumItemId); +// 设置枚举数据值 + subField.put("value", ""); + subField.put("showValue", ctpEnumItem.getShowvalue()); + } +// 判断当前处理字段是否为单位 + } else if (accountFields.contains(entry.getKey())) { +// 查询单位控件信息 + if (fieldDataVo.getDbValue() != null) { + String dbValue = fieldDataVo.getDbValue().toString(); + long accountId = Long.parseLong(dbValue); + V3xOrgAccount v3xOrgAccount = getOrgManager().getAccountById(accountId); +// 设置单位数据值 + subField.put("value", v3xOrgAccount.getId()); + subField.put("showValue", ""); + } +// 判断当前处理字段是否为部门 + } else if (deptFileds.contains(entry.getKey())) { +// 查询部门控件信息 + if (fieldDataVo.getDbValue() != null) { + String dbValue = fieldDataVo.getDbValue().toString(); + long departmentId = Long.parseLong(dbValue); + V3xOrgDepartment v3xOrgDepartment = getOrgManager().getDepartmentById(departmentId); +// 设置部门数据值 + subField.put("value", v3xOrgDepartment.getId()); + subField.put("showValue", ""); + } +// 判断当前处理字段是否为岗位 + } else if (postFields.contains(entry.getKey())) { +// 查询岗位控件信息 + if (fieldDataVo.getDbValue() != null) { + String dbValue = fieldDataVo.getDbValue().toString(); + long postId = Long.parseLong(dbValue); + V3xOrgPost v3xOrgPost = getOrgManager().getPostById(postId); +// 设置岗位数据值 + subField.put("value", v3xOrgPost.getId()); + subField.put("showValue", ""); + } +// 判断当前处理字段是否为职务级别 + } else if (levelFields.contains(entry.getKey())) { +// 查询职务级别控件信息 + if (fieldDataVo.getDbValue() != null) { + String dbValue = fieldDataVo.getDbValue().toString(); + long levelId = Long.parseLong(dbValue); + V3xOrgLevel v3xOrglevel = getOrgManager().getLevelById(levelId); +// 设置职务级别数据值 + subField.put("value", v3xOrglevel.getId()); + subField.put("showValue", ""); + } +// 判断当前处理字段是否为人员 + } else if (memberFields.contains(entry.getKey())) { +// 查询人员控件信息 + if (fieldDataVo.getDbValue() != null) { + String dbValue = fieldDataVo.getDbValue().toString(); + long memberId = Long.parseLong(dbValue); + V3xOrgMember v3xOrgMember = getOrgManager().getMemberById(memberId); +// 设置人员数据值 + subField.put("value", v3xOrgMember.getId()); + subField.put("showValue", ""); + } +// 判断当前处理字段是否为附件 + } else if (fileFields.contains(entry.getKey())) { +// 获取附件控件的数据 + if (fieldDataVo.getDbValue() != null) { + String dbValue = fieldDataVo.getDbValue().toString(); + List attachmentIds = getAttachmentManager().getBySubReference(Long.parseLong(dbValue)); +// 获取当前附件控件的所有附件信息 + for (int n = 0; n < attachmentIds.size(); n++) { +// 进行附件下载后上传至目标系统中 + Attachment attachment = getAttachmentManager().getAttachmentByFileURL(attachmentIds.get(n)); + Long fileUrl = attachment.getFileUrl(); + String filename = attachment.getFilename(); +// String[] fileType = filename.split("\\."); + String fileType = filename.substring(filename.lastIndexOf(".") + 1); + String oaFileName = filename.substring(0, filename.lastIndexOf(".")); +// 调用接口下载文件,文件存放在指定的路径下 + String dowUrl = configVo.getParamVal(PersonnelFlowConstants.dowUrl.name()) + "/" + fileUrl + "?fileName=" + fileType + "&token=" + getlcToken(configVo); + log.info("下载URL:" + dowUrl); + String str = SystemEnvironment.getApplicationFolder(); + String dowPath = str + "/memberfiles/" + formDataVo.getId() + "/" + filename; + log.info("下载地址:" + dowPath); + String download = ProtUtil.download(dowUrl, dowPath); +// String str = SystemEnvironment.getApplicationFolder(); + String uploadUrl = configVo.getParamVal(PersonnelFlowConstants.uploadUrl.name()); + String targetUrl = uploadUrl + "?token=" + getzsjToken(configVo); + String uploadData = ProtUtil.uploadFile(targetUrl, dowPath); + JSONObject uploadFile = JSON.parseObject(uploadData); + JSONArray atts = uploadFile.getJSONArray("atts"); + if (atts.size() > 0) { + JSONObject att = atts.getJSONObject(0); + JSONObject attachmentInfo = new JSONObject(); + attachmentInfo.put("subReference", dbValue); + attachmentInfo.put("fileUrl", att.getString("fileUrl")); + attachmentInfo.put("sort", n); + attachmentInfos.add(attachmentInfo); + } + } + subField.put("value", dbValue); + subField.put("showValue", ""); + } + } else { +// 设置文本控件数据 + subField.put("value", ""); + subField.put("showValue", fieldDataVo.getStringValue()); + } + subFields.add(subField); + } + return subFields; + } + + +} diff --git a/v5/apps-customize/src/main/java/com/seeyon/apps/src_personnelflow/util/ProtUtil.java b/v5/apps-customize/src/main/java/com/seeyon/apps/src_personnelflow/util/ProtUtil.java new file mode 100644 index 0000000..fa5ab08 --- /dev/null +++ b/v5/apps-customize/src/main/java/com/seeyon/apps/src_personnelflow/util/ProtUtil.java @@ -0,0 +1,461 @@ +package com.seeyon.apps.src_personnelflow.util; + +import com.alibaba.fastjson.JSONObject; +import org.apache.commons.httpclient.HttpStatus; +import org.apache.http.HttpEntity; +import org.apache.http.HttpResponse; +import org.apache.http.client.methods.CloseableHttpResponse; +import org.apache.http.client.methods.HttpGet; +import org.apache.http.client.methods.HttpPut; +import org.apache.http.client.utils.URIBuilder; +import org.apache.http.entity.StringEntity; +import org.apache.http.impl.client.CloseableHttpClient; +import org.apache.http.impl.client.DefaultHttpClient; +import org.apache.http.impl.client.HttpClients; +import org.apache.http.message.BasicHeader; +import org.apache.http.util.EntityUtils; +import www.seeyon.com.utils.StringUtil; + +import java.io.*; +import java.net.*; +import java.nio.file.Files; +import java.util.Map; + +public class ProtUtil { + + public static String uploadFile(String targetUrl, String filePath) throws IOException { + String boundary = Long.toHexString(System.currentTimeMillis()); // 随机边界 + InputStream is = null; + BufferedReader br = null; + String result = null; + String CRLF = "\r\n"; // 换行符 + URL url = new URL(targetUrl); + HttpURLConnection connection = (HttpURLConnection) url.openConnection(); + + connection.setDoOutput(true); + connection.setRequestMethod("POST"); + connection.setRequestProperty("Content-Type", "multipart/form-data; boundary=" + boundary); + + try ( + OutputStream output = connection.getOutputStream(); + PrintWriter writer = new PrintWriter(new OutputStreamWriter(output, "UTF-8"), true); + ) { + writer.append("--" + boundary).append(CRLF); + writer.append("Content-Disposition: form-data; name=\"title\"").append(CRLF); + writer.append(CRLF).append("测试11").append(CRLF).flush(); + writer.append("--" + boundary).append(CRLF); + writer.append("Content-Disposition: form-data; name=\"fileType\"").append(CRLF); + writer.append(CRLF).append("pdf").append(CRLF).flush(); + // 发送文件数据 + File file = new File(filePath); + writer.append("--" + boundary).append(CRLF); + writer.append("Content-Disposition: form-data; name=\"file\"; filename=\"" + file.getName() + "\"").append(CRLF); + writer.append("Content-Type: " + URLConnection.guessContentTypeFromName(file.getName())).append(CRLF); + writer.append(CRLF).flush(); + + Files.copy(file.toPath(), output); + output.flush(); // 确保文件数据发送完毕 + + writer.append(CRLF).flush(); // 结束行 + writer.append("--" + boundary + "--").append(CRLF); + } + + int responseCode = connection.getResponseCode(); + // 连接对象获取一个输入流,向远程读取 + if (connection.getResponseCode() == 200) { + + is = connection.getInputStream(); + // 对输入流对象进行包装:charset根据工作项目组的要求来设置 + br = new BufferedReader(new InputStreamReader(is, "UTF-8")); + + StringBuffer sbf = new StringBuffer(); + String temp = null; + // 循环遍历一行一行读取数据 + while ((temp = br.readLine()) != null) { + sbf.append(temp); + sbf.append("\r\n"); + } + result = sbf.toString(); + System.out.println(result); + } + // 关闭资源 + if (null != br) { + try { + br.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + if (null != is) { + try { + is.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + connection.disconnect(); + return result; + } + + /** + * 调用post接口 + * + * @param str 调用接口传递的参数json + * @param urlStr 需要调用的url对应的参数文件中的编码 + * @return + */ + public static JSONObject doPost(String str, String urlStr) { + HttpURLConnection connection = null; + InputStream is = null; + OutputStream os = null; + BufferedReader br = null; + String result = null; + try { + URL url = new URL(urlStr); + // 通过远程url连接对象打开连接 + connection = (HttpURLConnection) url.openConnection(); + // 设置连接请求方式 + connection.setRequestMethod("POST"); + // 设置连接主机服务器超时时间:15000毫秒 + connection.setConnectTimeout(15000); + // 设置读取主机服务器返回数据超时时间:60000毫秒 + connection.setReadTimeout(60000); + + // 默认值为:false,当向远程服务器传送数据/写数据时,需要设置为true + connection.setDoOutput(true); + // 默认值为:true,当前向远程服务读取数据时,设置为true,该参数可有可无 + connection.setDoInput(true); + // 设置传入参数的格式:请求参数应该是 name1=value1&name2=value2 的形式。 + connection.setRequestProperty("Content-Type", "application/json"); + // 通过连接对象获取一个输出流 + os = connection.getOutputStream(); + // 通过输出流对象将参数写出去/传输出去,它是通过字节数组写出的 + if (!("".equals(str) || str == null)) { + os.write(str.getBytes("UTF-8")); + } + // 连接对象获取一个输入流,向远程读取 + if (connection.getResponseCode() == 200) { + + is = connection.getInputStream(); + // 对输入流对象进行包装:charset根据工作项目组的要求来设置 + br = new BufferedReader(new InputStreamReader(is, "UTF-8")); + + StringBuffer sbf = new StringBuffer(); + String temp = null; + // 循环遍历一行一行读取数据 + while ((temp = br.readLine()) != null) { + sbf.append(temp); + sbf.append("\r\n"); + } + result = sbf.toString(); + } + } catch (MalformedURLException e) { + e.printStackTrace(); + } catch (IOException e) { + e.printStackTrace(); + } finally { + // 关闭资源 + if (null != br) { + try { + br.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + if (null != os) { + try { + os.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + if (null != is) { + try { + is.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + // 断开与远程地址url的连接 + connection.disconnect(); + } + JSONObject json = JSONObject.parseObject(result); + return json; + + } + + + public static void downloadFile(String urlStr, String filePath){ + String accesstoken = "T3KbU3zlRL"; + String appSecret = "owmMX93AfGZQBF2NCuH9a7i9TOeF5x"; + HttpURLConnection conn = null; + OutputStream out = null; + try { + + StringBuilder urlBuilder = new StringBuilder(urlStr); + + URL url = new URL(urlBuilder.toString()); + conn = (HttpURLConnection) url.openConnection(); + conn.setRequestMethod("GET"); + conn.setRequestProperty("Host", url.getHost()); + conn.setRequestProperty("Accept", "text/plain,application/json"); + conn.setRequestProperty("User-Agent", "privateapp-java-api-client"); + conn.setDoOutput(true); + conn.setDoInput(true); + conn.setUseCaches(false); + + + int statusCode = conn.getResponseCode(); + StringBuilder response = new StringBuilder(); + if (statusCode == 200) { + try (InputStream ins = conn.getInputStream()){ + try (OutputStream outputStream = new FileOutputStream(filePath)) { + int bytesRead; + byte[] buffer = new byte[4096]; + while ((bytesRead = ins.read(buffer)) != -1) { + outputStream.write(buffer, 0, bytesRead); + } + } + //process response data + } catch (Exception e){ + // 处理异常情况 + } + } else { + // 处理异常情况 + } + } catch (IOException e) { + e.printStackTrace(); + } finally { + try { + if (conn != null) { + conn.disconnect(); + } + if (out != null) { + out.close(); + } + } catch (IOException e) { + e.printStackTrace(); + } + } + } + + + /** + * 执行get请求 + * + * @return + * @throws IOException + * @throws FileNotFoundException + */ + public static String doGet(String geturl, JSONObject param) throws FileNotFoundException, IOException, URISyntaxException { +// 创建 HttpClient 实例 + CloseableHttpClient httpClient = HttpClients.createDefault(); + String responseBody = ""; + try { + // 构建包含参数的 URI + URIBuilder uriBuilder = new URIBuilder(geturl); + if(param.size()>0){ + uriBuilder.addParameter("params", param.toString()); + } + URI uri = uriBuilder.build(); + // 创建 HttpGet 对象 + HttpGet httpGet = new HttpGet(uri); + + // 发送请求并获取响应 + CloseableHttpResponse response = httpClient.execute(httpGet); + + try { + // 获取响应实体并转换为字符串 + responseBody = EntityUtils.toString(response.getEntity()); + } finally { + // 关闭响应 + response.close(); + } + } catch (URISyntaxException e) { + System.err.println("URI 构建错误: " + e.getMessage()); + } catch (IOException e) { + System.err.println("请求发送或响应处理错误: " + e.getMessage()); + } finally { + try { + // 关闭 HttpClient + httpClient.close(); + } catch (IOException e) { + System.err.println("关闭 HttpClient 错误: " + e.getMessage()); + } + } + return responseBody; + } + + /** + * 获取一个token + * + * @return + * @throws IOException + * @throws FileNotFoundException + */ + public static String getToken(String oatokenurl,String restName,String restPassword,String loginName) throws FileNotFoundException, IOException { + String address = oatokenurl +"/"+ restName + "/" + restPassword; + if(StringUtil.isNotEmpty(loginName)){ + address = address +"?loginName="+loginName; + } + DefaultHttpClient client = new DefaultHttpClient(); + String result = ""; + HttpGet get = new HttpGet(address); + // 添加 Headers 信息 + get.addHeader(new BasicHeader("Accept", "application/json")); + try { + HttpResponse res = client.execute(get); + if (res.getStatusLine().getStatusCode() == HttpStatus.SC_OK) { + result = EntityUtils.toString(res.getEntity()); + } + } catch (Exception e) { + throw new RuntimeException(e); + } + String token = ""; + if(result.contains("{")) { + JSONObject jsObj = JSONObject.parseObject(result); + token = jsObj.get("id").toString(); + }else { + token = result; + } + return token; + } + /** + * 下载文件到指定目录 + * @param dowUrl:http地址 + * @param dowPath:指定目录 + * */ + public static String download(String dowUrl, String dowPath){ + try { +// log.info("下载地址是:"+dowUrl+",存储地址是:"+dowPath); + URL url = new URL(dowUrl); + + URLConnection urlConnection = url.openConnection(); + + HttpURLConnection httpURLConnection = (HttpURLConnection) urlConnection;// http的连接类 + + //String contentType = httpURLConnection.getContentType();//请求类型,可用来过滤请求, + + httpURLConnection.setConnectTimeout(1000*5);//设置超时 + + httpURLConnection.setRequestMethod("GET");//设置请求方式,默认是GET + + httpURLConnection.setRequestProperty("Charset", "UTF-8");// 设置字符编码 + + httpURLConnection.connect();// 打开连接 + + BufferedInputStream bin = new BufferedInputStream(httpURLConnection.getInputStream()); + + String path = dowPath;// 指定存放位置 + File filed = new File(path); + String mergePdfPath = dowPath ; + String[] paths = mergePdfPath.split("/"); + String mpath = ""; + for(int i = 0 ; i headers, String encode){ + if(encode == null){ + encode = "utf-8"; + } + CloseableHttpResponse httpResponse = null; + CloseableHttpClient closeableHttpClient = null; + String content = null; + //since 4.3 不再使用 DefaultHttpClient + try { + + //HttpClients.createDefault()等价于 HttpClientBuilder.create().build(); + closeableHttpClient = HttpClients.createDefault(); + HttpPut httpput = new HttpPut(url); + + //设置header + httpput.setHeader("Content-type", "application/json"); + if (headers != null && headers.size() > 0) { + for (Map.Entry entry : headers.entrySet()) { + httpput.setHeader(entry.getKey(),entry.getValue().toString()); + } + } + //组织请求参数 + StringEntity stringEntity = new StringEntity(stringJson, encode); + httpput.setEntity(stringEntity); + //响应信息 + httpResponse = closeableHttpClient.execute(httpput); + HttpEntity entity = httpResponse.getEntity(); + content = EntityUtils.toString(entity, encode); + } catch (Exception e) { + e.printStackTrace(); + }finally{ + try { + httpResponse.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + try { + closeableHttpClient.close(); //关闭连接、释放资源 + } catch (IOException e) { + e.printStackTrace(); + } + return content; + } + + + + + +} diff --git a/v5/apps-customize/src/main/java/com/seeyon/apps/src_personnelflow/vo/MemberManagerResponse.java b/v5/apps-customize/src/main/java/com/seeyon/apps/src_personnelflow/vo/MemberManagerResponse.java new file mode 100644 index 0000000..71a5bef --- /dev/null +++ b/v5/apps-customize/src/main/java/com/seeyon/apps/src_personnelflow/vo/MemberManagerResponse.java @@ -0,0 +1,76 @@ +package com.seeyon.apps.src_personnelflow.vo; + +import com.alibaba.fastjson.JSONObject; + +/** + * 功能描述:
+ *
+ *
+ * 
+ * + * @Author: HuangZhengguo + * @Date: 2024/4/28 + */ +public class MemberManagerResponse { + + private boolean success; + private int status; + private String msg; + private String data; + + + public MemberManagerResponse(JSONObject object) { + if(object.containsKey("code")) { + this.status = object.getString("code").equals("0")?1:2; + } else { + this.status = object.getString("status").equals("success")?1:2; + } + this.success = (1 == status); + if(object.containsKey("message")) { + this.msg = object.getString("message"); + } else { + this.msg = object.getString("errormsg"); + } + if(object.containsKey("data")) { + this.data = object.getString("data"); + } else { + this.data = object.getString("data"); + } + } + + public boolean isSuccess() { + return success; + } + + public MemberManagerResponse setSuccess(boolean success) { + this.success = success; + return this; + } + + public int getStatus() { + return status; + } + + public MemberManagerResponse setStatus(int status) { + this.status = status; + return this; + } + + public String getMsg() { + return msg; + } + + public MemberManagerResponse setMsg(String msg) { + this.msg = msg; + return this; + } + + public String getData() { + return data; + } + + public MemberManagerResponse setData(String data) { + this.data = data; + return this; + } +} diff --git a/v5/apps-customize/src/main/java/com/seeyon/apps/src_qyba/FVCommonNode.java b/v5/apps-customize/src/main/java/com/seeyon/apps/src_qyba/FVCommonNode.java new file mode 100644 index 0000000..b22ad1c --- /dev/null +++ b/v5/apps-customize/src/main/java/com/seeyon/apps/src_qyba/FVCommonNode.java @@ -0,0 +1,166 @@ +package com.seeyon.apps.src_qyba; + +import cn.hutool.log.Log; +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; +import com.seeyon.apps.common.config.ICstConfigApi; +import com.seeyon.apps.common.plugin.vo.ConfigVo; +import com.seeyon.apps.common.workflow.constants.WorkFlowType; +import com.seeyon.apps.common.workflow.node.ACommonSuperNode; +import com.seeyon.apps.ext.workflow.vo.FieldDataVo; +import com.seeyon.apps.ext.workflow.vo.FormDataVo; +import com.seeyon.apps.ext.workflow.vo.SuperNodeContext; +import com.seeyon.apps.src_qyba.constants.FVConstants; +import com.seeyon.apps.src_qyba.service.FVService; +import com.seeyon.apps.src_qyba.util.FanWeiUtil; +import com.seeyon.cap4.form.bean.FormDataMasterBean; +import com.seeyon.ctp.common.AppContext; +import org.springframework.beans.factory.annotation.Autowired; +import www.seeyon.com.utils.StringUtil; + +import java.util.HashMap; +import java.util.Map; + +/** + * 功能描述:
+ *
+ *
+ * 
+ * + * @Author: HuangZhengguo + * @Date: 2024/2/27 + */ +public abstract class FVCommonNode extends ACommonSuperNode { + private static Log log = Log.get(FVCommonNode.class); + protected ICstConfigApi cstConfigApi = (ICstConfigApi) AppContext.getBean("cstConfigApi"); + + @Autowired + FVService fvService; + + @Override + public String getPluginId() { + return FVConstants.getPluginId(); + } + + @Override + public String getFormParse() { + return "json"; + } + + @Override + public WorkFlowType[] getTypes() { + return new WorkFlowType[] {WorkFlowType.superNode}; + } + + public ConfigVo getFVConfig() { + return cstConfigApi.getConfig(getPluginId()); + } + + + @Override + public SuperNodeContext proceed(String request, FormDataVo formDataVo, FormDataMasterBean formDataMasterBean) throws Exception { + SuperNodeContext context = new SuperNodeContext(); + log.info("进入区域备案处理超级节点中"); + try { + FieldDataVo fhjg = formDataVo.getFieldData("返回结果"); + String value = fhjg.getStringValue(); + if(value.startsWith("推送经销商平台成功")) { + return context.success("跳过:" + value); + } + } catch (Exception e) { + context.setErrMsg("调用失败:"+e); + context.setException(true); + context.back("调用失败:"+e); + } + ConfigVo configVo = getFVConfig(); + context.setNeedSave(true); + String url = ""; +// 进行新老接口分发 + FieldDataVo xttb = formDataVo.getFieldData("系统同步"); + String xttbvalue = xttb.getStringValue(); + String s = ""; + Map parm = new HashMap(); + if("CRM".equals(xttbvalue) || StringUtil.isEmpty(xttbvalue)){ +// 设置附件路径 + JSONArray filePath = fvService.getFilePath(formDataVo,configVo); +// 参数封装 + parm = FVService.createWF(filePath,formDataVo,configVo); + //调用新建接口 + String userid = formDataVo.getFieldData("经办人").getStringValue(); + s = FanWeiUtil.PostRestful(parm, userid,configVo); + } if ("NCRM".equals(xttbvalue) || StringUtil.isEmpty(xttbvalue)){ +// 设置附件路径 + JSONArray filePath = fvService.getFilePath(formDataVo,configVo); + //封装参数 + parm = FVService.createNewWF(filePath,formDataVo,configVo); + //调用新建接口 + String userid = formDataVo.getFieldData("经办人").getStringValue(); + s = FanWeiUtil.NewPostRestful(parm, userid,configVo); + } + JSONObject returnMsg = JSONObject.parseObject(s); + Object code = returnMsg.get("code"); + log.info("新建code:" + code); + Map map = new HashMap<>(); + if ("SUCCESS".equals(code.toString())) { + //调用提交接口 + map.put("code", "200"); + map.put("msg", "推送成功"); + map.put("request", parm.toString()); + map.put("response", s); + } else { +// Map data = (Map) returnMsg.get("errMsg"); + map.put("code", "300"); + map.put("msg", "新建流程失败!"+returnMsg.getString("msg")); + map.put("request", parm.toString()); + map.put("response", s); + } + try{ + context.setRequest(map.get("request").toString()); + context.setResponse(map.get("response").toString()); + Object jsoncode = map.get("code"); + if ("200".equals(jsoncode.toString())) { + context.success(map.get("msg").toString(), false); + formDataVo.getNewFieldDataMap().put("返回结果",map.get("msg").toString()); + } else { + context.setErrMsg(map.get("msg").toString()); + context.setException(true); + context.back("推送失败:" +map.get("msg").toString()); + formDataVo.getNewFieldDataMap().put("返回结果","推送失败:"+map.get("msg").toString()); + } + }catch (Exception e){ + context.setException(true); + context.back("推送失败:OA处理异常:" + e.getMessage()); + formDataVo.getNewFieldDataMap().put("返回结果","推送失败:OA处理异常:"+map.get("msg").toString()); + } + + return context; + } + public abstract String getMethod(); +} + +// url += getMethod(); +// context.setRequest(request); +// context.setUrl(url); +// try { +// String response = FVHttpUtil.doPost(url, "", configVo.getParamVal(FVConstants.fvOldUrl.name()), configVo.getParamVal(FVConstants.client_security.name())); +// context.setResponse(response); +// FVResponse fvResponse = FVHttpUtil.parseResponse(response); +// if(fvResponse.isSuccess()) { +// context.success("推送BIP成功:" + fvResponse.getMsg(), false); +// formDataVo.getNewFieldDataMap().put("返回结果", "推送成功:" + fvResponse.getMsg()); +// } else { +// context.setErrMsg(fvResponse.getMsg()); +// context.setException(true); +// context.back("推送BIP失败:" + fvResponse.getMsg()); +// formDataVo.getNewFieldDataMap().put("返回结果", "推送失败:" + fvResponse.getMsg()); +// } +// } catch (Exception e) { +// context.setException(true); +// context.back("推送BIP失败:OA处理异常:" + e.getMessage()); +// formDataVo.getNewFieldDataMap().put("返回结果", "推送失败:OA处理异常" + e.getMessage()); +// } + + + + + diff --git a/v5/apps-customize/src/main/java/com/seeyon/apps/src_qyba/FVTongyongbeianNode.java b/v5/apps-customize/src/main/java/com/seeyon/apps/src_qyba/FVTongyongbeianNode.java new file mode 100644 index 0000000..407f899 --- /dev/null +++ b/v5/apps-customize/src/main/java/com/seeyon/apps/src_qyba/FVTongyongbeianNode.java @@ -0,0 +1,136 @@ +package com.seeyon.apps.src_qyba; + +import cn.hutool.log.Log; +import com.alibaba.fastjson.JSONObject; +import com.seeyon.apps.common.config.ICstConfigApi; +import com.seeyon.apps.common.plugin.vo.ConfigVo; +import com.seeyon.apps.common.workflow.constants.WorkFlowType; +import com.seeyon.apps.common.workflow.node.ACommonSuperNode; +import com.seeyon.apps.ext.workflow.vo.FieldDataVo; +import com.seeyon.apps.ext.workflow.vo.FormDataVo; +import com.seeyon.apps.ext.workflow.vo.SuperNodeContext; +import com.seeyon.apps.src_qyba.constants.FVConstants; +import com.seeyon.apps.src_qyba.service.FVService; +import com.seeyon.apps.src_qyba.service.FVTongyongService; +import com.seeyon.apps.src_qyba.util.FanWeiUtil; +import com.seeyon.cap4.form.bean.FormDataMasterBean; +import com.seeyon.ctp.common.AppContext; +import org.springframework.beans.factory.annotation.Autowired; + +import java.util.HashMap; +import java.util.Map; + +/** + * 功能描述:
+ *
+ *
+ * 
+ * + * @Author: HuangZhengguo + * @Date: 2024/2/27 + */ +public abstract class FVTongyongbeianNode extends ACommonSuperNode { + private static Log log = Log.get(FVTongyongbeianNode.class); + protected ICstConfigApi cstConfigApi = (ICstConfigApi) AppContext.getBean("cstConfigApi"); + + @Autowired + FVService fvService; + + @Override + public String getPluginId() { + return FVConstants.getPluginId(); + } + + @Override + public String getFormParse() { + return "json"; + } + + @Override + public WorkFlowType[] getTypes() { + return new WorkFlowType[] {WorkFlowType.superNode}; + } + + public ConfigVo getFVConfig() { + return cstConfigApi.getConfig(getPluginId()); + } + + + @Override + public SuperNodeContext proceed(String request, FormDataVo formDataVo, FormDataMasterBean formDataMasterBean) throws Exception { + SuperNodeContext context = new SuperNodeContext(); + log.info("进入备案审批结果回传处理超级节点中"); + try { + FieldDataVo fhjg = formDataVo.getFieldData("返回结果"); + String value = fhjg.getStringValue(); + if(value.startsWith("推送经销商平台成功")) { + return context.success("跳过:" + value); + } + } catch (Exception e) { + e.printStackTrace(); + context.setErrMsg("调用失败:"+e); + context.setException(true); + context.back("调用失败:"+e); + return context; + } + ConfigVo configVo = getFVConfig(); + context.setNeedSave(true); + String url = ""; +// 进行新老接口分发 + FieldDataVo xttb = formDataVo.getFieldData("系统同步"); + String xttbvalue = xttb.getStringValue(); + String s = ""; +// Map parm = new HashMap(); + //封装参数 + Map parm = FVTongyongService.createWF(formDataVo,configVo); + if("CRM".equals(xttbvalue)){ + s = FanWeiUtil.PostSubmitRestful(parm,configVo); + } if ("NCRM".equals(xttbvalue)){ + s = FanWeiUtil.NewPostSubmitRestful(parm,configVo); + } + JSONObject returnMsg = JSONObject.parseObject(s); + Object code = returnMsg.get("code"); + log.info("新建code:" + code); + Map map = new HashMap<>(); + if ("SUCCESS".equals(code.toString())) { + //调用提交接口 + map.put("code", "200"); + map.put("msg", "推送成功"); + map.put("request", parm.toString()); + map.put("response", s); + } else { +// Map data = (Map) returnMsg.get("errMsg"); + map.put("code", "300"); + map.put("msg", "新建流程失败!"+returnMsg.getString("errMsg")); + map.put("request", parm.toString()); + map.put("response", s); + } + try{ + context.setRequest(map.get("request").toString()); + context.setResponse(map.get("response").toString()); + Object jsoncode = map.get("code"); + if ("200".equals(jsoncode.toString())) { + context.success(map.get("msg").toString(), false); + formDataVo.getNewFieldDataMap().put("返回结果",map.get("msg").toString()); + } else { + context.setErrMsg(map.get("msg").toString()); + context.setException(true); + context.back("推送失败:" +map.get("msg").toString()); + formDataVo.getNewFieldDataMap().put("返回结果","推送失败:"+map.get("msg").toString()); + } + }catch (Exception e){ + context.setException(true); + context.back("推送失败:OA处理异常:" + e.getMessage()); + formDataVo.getNewFieldDataMap().put("返回结果","推送失败:OA处理异常:"+map.get("msg").toString()); + } + + return context; + } + public abstract String getMethod(); +} + + + + + + diff --git a/v5/apps-customize/src/main/java/com/seeyon/apps/src_qyba/QYBAPluginApi.java b/v5/apps-customize/src/main/java/com/seeyon/apps/src_qyba/QYBAPluginApi.java new file mode 100644 index 0000000..5c3824f --- /dev/null +++ b/v5/apps-customize/src/main/java/com/seeyon/apps/src_qyba/QYBAPluginApi.java @@ -0,0 +1,40 @@ +package com.seeyon.apps.src_qyba; + +import com.seeyon.apps.common.plugin.api.APluginInfoApi; +import com.seeyon.apps.common.plugin.vo.ConfigVo; +import com.seeyon.apps.src_qyba.constants.FVConstants; + +/** + * 功能描述:
+ *
+ *
+ * 
+ * + * @Author: huangzhengguo + * @Date: 2024/03/04 + */ +public class QYBAPluginApi extends APluginInfoApi { + + @Override + public String getPluginId() { + return FVConstants.getPluginId(); + } + + @Override + public String getCreateUser() { + return "湖北橙阳"; + } + + @Override + public ConfigVo getDefaultConfig() { + ConfigVo configVo = new ConfigVo(); + for (FVConstants value : FVConstants.values()) { + if(value != FVConstants.plugin) { + configVo.getDevParams().put(value.name(), value.getDefaultValue()); + configVo.getProdParams().put(value.name(), value.getDefaultValue()); + configVo.getParamMap().put(value.name(), value.getDescription()); + } + } + return configVo; + } +} diff --git a/v5/apps-customize/src/main/java/com/seeyon/apps/src_qyba/constants/FVConstants.java b/v5/apps-customize/src/main/java/com/seeyon/apps/src_qyba/constants/FVConstants.java new file mode 100644 index 0000000..6e5261d --- /dev/null +++ b/v5/apps-customize/src/main/java/com/seeyon/apps/src_qyba/constants/FVConstants.java @@ -0,0 +1,46 @@ +package com.seeyon.apps.src_qyba.constants; + +public enum FVConstants { + plugin("src_qyba","插件ID"), + loginName("test11", "流程操作登录名"), + oaTokenUrl("https://flow.dhx.com.cn/seeyon/rest/token", "oaToken查询地址"), + restName("", "oarest用户名"), + restPassword("", "oarest密码"), + dhxbaFile("https://flow.dhx.com.cn/seeyon/dhxfile", "稻花香备案文件路径地址"), + workflowId("8521", "workflowId"), + newWorkflowId("2026", "newWorkflowId"), + dowurl("https://oa.dhx.com.cn/seeyon/rest/attachment/file", "dowurl"), + addRess("https://crm.dhx9.com", "addRess"), + newAddRess("https://crm.zwinfor.cn/", "newAddRess"), + spk("MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAymEn8vp0E8pg6op/WXJ4A67jHAYeUBtut8vJgk09t4Bw3kheWnHUjVHDBEZ8iC/iX9YyBzL76WZR+lpDqdFh2iKYk+yctHKc4dt9r0vw6HYMUWDrYmctdKJtdOGpWxz4apBr7Rc/2A3FDxwsiXzPqpG/GY+/1IHp7E3jEX0nxzuJn/YUm/SoSgfMB4NCHF9n3rrIsp4jJ5SOSwLr68nlwT3djF2f8vQcqRxmT0J7X2xKehlpeiubszQj5TeFcA+onkOBKkoKc+83G8Gg8J1IWZLsd50cjawrmg8lxl+UBEsPZHEh0AhWDHKLRG+9jyZJ94hoWaQRSgwEIdGyShNMnwIDAQAB", "SPK"), + newspk("MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAvcOew5NM41jK7CFBnirP4Zz0QIexYEweS+4LTuQOVY+BqHu2EMxlPYRsjtvzZj7Pm9SsiNiEIeGXZ3mkAMbNNqu7G7kGb10pJzpBBTE80cRCY0bHoD3PhD8cBiKjpsRXJ+1mPdwD4fGEr0IcG6bKhBM3xsCmc4JiEvsv/+nPm9G7NQgoPGEKHkZk0IgyaBF5m6F2NKah92klxuz+vWCQoVsCpCjHN1sijQioWc6lRLgP7d6IZFEbOrLL7HdlOc8yKOAOZhURd78CqiVYBc1vP0pyC1/UW0Lq0f2MFpg/7Z18VwAf1vFUb+oiIdjFYMr5dgS+i784FaMUDzKUvndDWwIDAQAB", "NEWSPK"), + tongyongApi("/api/workflow/paService/doCreateRequest", "tongyongApi"), + tongyonSubmitgApi("/api/workflow/paService/submitRequest", "tongyonSubmitgApi"), + appId("oa", "appId"), + secret("b44da0ec-6ba5-4d6e-b3d7-e0571b3bcdd6", "secret"), + newSecret("6553bad7-51f0-4d56-af44-3d64a8ce9814", "newSecret"), + client_security("30dcf9a3cfef4b98a157e926db6369f0", "client_security"), + dsname("BIPKF", "dsname"), + busicentercode("sxbip", "busicentercode"); + + FVConstants(String defaultValue, String description) { + this.defaultValue = defaultValue; + this.description = description; + } + + private String defaultValue; + private String description; + + public String getDefaultValue() { + return defaultValue; + } + + public String getDescription() { + return description; + } + + public static String getPluginId() { + return plugin.defaultValue; + } + +} diff --git a/v5/apps-customize/src/main/java/com/seeyon/apps/src_qyba/node/FVNewStateReturnNode.java b/v5/apps-customize/src/main/java/com/seeyon/apps/src_qyba/node/FVNewStateReturnNode.java new file mode 100644 index 0000000..219d258 --- /dev/null +++ b/v5/apps-customize/src/main/java/com/seeyon/apps/src_qyba/node/FVNewStateReturnNode.java @@ -0,0 +1,30 @@ +package com.seeyon.apps.src_qyba.node; + +import com.seeyon.apps.src_qyba.FVTongyongbeianNode; + +/** + * 功能描述:
+ *
+ *
+ * 
+ * + * @Author: HuangZhengguo + * @Date: 2024/2/27 + */ +public class FVNewStateReturnNode extends FVTongyongbeianNode { + + @Override + public String getMethod() { + return ""; + } + + @Override + public String getNodeId() { + return "fvNewStateReturnNode"; + } + + @Override + public String getNodeName() { + return "新平台备案状态回传推送"; + } +} \ No newline at end of file diff --git a/v5/apps-customize/src/main/java/com/seeyon/apps/src_qyba/node/FVNewZhengceNode.java b/v5/apps-customize/src/main/java/com/seeyon/apps/src_qyba/node/FVNewZhengceNode.java new file mode 100644 index 0000000..82beba0 --- /dev/null +++ b/v5/apps-customize/src/main/java/com/seeyon/apps/src_qyba/node/FVNewZhengceNode.java @@ -0,0 +1,30 @@ +package com.seeyon.apps.src_qyba.node; + +import com.seeyon.apps.src_qyba.FVCommonNode; + +/** + * 功能描述:
+ *
+ *
+ * 
+ * + * @Author: HuangZhengguo + * @Date: 2024/2/27 + */ +public class FVNewZhengceNode extends FVCommonNode { + + @Override + public String getMethod() { + return ""; + } + + @Override + public String getNodeId() { + return "fvNewZhengceNode"; + } + + @Override + public String getNodeName() { + return "新平台政策推送"; + } +} \ No newline at end of file diff --git a/v5/apps-customize/src/main/java/com/seeyon/apps/src_qyba/node/FVOldStateReturnNode.java b/v5/apps-customize/src/main/java/com/seeyon/apps/src_qyba/node/FVOldStateReturnNode.java new file mode 100644 index 0000000..895c033 --- /dev/null +++ b/v5/apps-customize/src/main/java/com/seeyon/apps/src_qyba/node/FVOldStateReturnNode.java @@ -0,0 +1,30 @@ +package com.seeyon.apps.src_qyba.node; + +import com.seeyon.apps.src_qyba.FVTongyongbeianNode; + +/** + * 功能描述:
+ *
+ *
+ * 
+ * + * @Author: HuangZhengguo + * @Date: 2024/2/27 + */ +public class FVOldStateReturnNode extends FVTongyongbeianNode { + + @Override + public String getMethod() { + return ""; + } + + @Override + public String getNodeId() { + return "fvOldStateReturnNode"; + } + + @Override + public String getNodeName() { + return "老平台备案状态回传推送"; + } +} \ No newline at end of file diff --git a/v5/apps-customize/src/main/java/com/seeyon/apps/src_qyba/node/FVOldZhengceNode.java b/v5/apps-customize/src/main/java/com/seeyon/apps/src_qyba/node/FVOldZhengceNode.java new file mode 100644 index 0000000..87f7698 --- /dev/null +++ b/v5/apps-customize/src/main/java/com/seeyon/apps/src_qyba/node/FVOldZhengceNode.java @@ -0,0 +1,30 @@ +package com.seeyon.apps.src_qyba.node; + +import com.seeyon.apps.src_qyba.FVCommonNode; + +/** + * 功能描述:
+ *
+ *
+ * 
+ * + * @Author: HuangZhengguo + * @Date: 2024/2/27 + */ +public class FVOldZhengceNode extends FVCommonNode { + + @Override + public String getMethod() { + return ""; + } + + @Override + public String getNodeId() { + return "fvOldZhengceNode"; + } + + @Override + public String getNodeName() { + return "老平台政策推送"; + } +} \ No newline at end of file diff --git a/v5/apps-customize/src/main/java/com/seeyon/apps/src_qyba/service/FVService.java b/v5/apps-customize/src/main/java/com/seeyon/apps/src_qyba/service/FVService.java new file mode 100644 index 0000000..8efd7fb --- /dev/null +++ b/v5/apps-customize/src/main/java/com/seeyon/apps/src_qyba/service/FVService.java @@ -0,0 +1,291 @@ +package com.seeyon.apps.src_qyba.service; + +import cn.hutool.json.JSONUtil; +import cn.hutool.log.Log; +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; +import com.seeyon.apps.common.plugin.vo.ConfigVo; +import com.seeyon.apps.ext.workflow.vo.FormDataVo; +import com.seeyon.apps.src_personnelflow.constants.PersonnelFlowConstants; +import com.seeyon.apps.src_qyba.constants.FVConstants; +import com.seeyon.apps.src_qyba.util.InterfaceListUtil; +import com.seeyon.ctp.common.AppContext; +import com.seeyon.ctp.common.SystemEnvironment; +import com.seeyon.ctp.common.filemanager.manager.AttachmentManager; +import com.seeyon.ctp.common.po.filemanager.Attachment; + +import java.io.IOException; +import java.util.*; + +public class FVService { + + private static Log log = Log.get(FVService.class); + + private AttachmentManager attachmentManager; + + public void setAttachmentManager(AttachmentManager attachmentManager) { + this.attachmentManager = attachmentManager; + } + + public AttachmentManager getAttachmentManagery() { + if (attachmentManager == null) { + attachmentManager = (AttachmentManager) AppContext.getBean("attachmentManager"); + } + return attachmentManager; + } + + public JSONArray getFilePath(FormDataVo formDataVo, ConfigVo configVo) throws Exception { + String pathId = formDataVo.getFieldData("上传附件").getStringValue(); + //附件 + JSONArray faths = null; + if (pathId == null || "".equals(pathId)) { + faths = new JSONArray(); + } else { + faths = getPathUrl(pathId,configVo); + } + return faths; + } + public JSONArray getnewFilePath(FormDataVo formDataVo, ConfigVo configVo) throws Exception { + String pathId = formDataVo.getFieldData("上传附件").getStringValue(); + //附件 + JSONArray faths = null; + if (pathId == null || "".equals(pathId)) { + faths = new JSONArray(); + } else { + faths = getPathUrl(pathId,configVo); + } + return faths; + } + + + + + + /** + * 创建流程 + */ + public static Map createWF(JSONArray faths, FormDataVo formDataVo, ConfigVo configVo) throws NoSuchFieldException, IOException { + //主表信息 + List mainlist = new ArrayList(); + + //标题 + Map mainmap2 = new HashMap(); + mainmap2.put("fieldName","bt");//OA字段名-同行人员(多人力资源浏览框) + mainmap2.put("fieldValue",formDataVo.getFieldData("表头").getStringValue());//字段值(OA人员ID,多个以英文逗号分隔) + mainlist.add(mainmap2); + + //单号 + Map mainmap3 = new HashMap(); + mainmap3.put("fieldName","dh"); + mainmap3.put("fieldValue",formDataVo.getFieldData("流水号").getStringValue()); + mainlist.add(mainmap3); + + //申请日期 + Map mainmap4 = new HashMap(); + mainmap4.put("fieldName","sqrq"); + mainmap4.put("fieldValue",formDataVo.getFieldData("申请日期").getStringValue()); + mainlist.add(mainmap4); + + //投入金额 + Map mainmap5 = new HashMap(); + mainmap5.put("fieldName","trje"); + mainmap5.put("fieldValue",formDataVo.getFieldData("投入金额").getStringValue()); + mainlist.add(mainmap5); + + //备案意见 + Map mainmap6 = new HashMap(); + mainmap6.put("fieldName","bayj"); + mainmap6.put("fieldValue",formDataVo.getFieldData("备案意见").getStringValue()); + mainlist.add(mainmap6); + + //备案简述 + Map mainmap11 = new HashMap(); + mainmap11.put("fieldName","bajs"); + mainmap11.put("fieldValue",formDataVo.getFieldData("内容").getStringValue()); + mainlist.add(mainmap11); + + //备案类型 + Map mainmap12 = new HashMap(); + mainmap12.put("fieldName","balx"); + String type = formDataVo.getFieldData("备案类型").getStringValue(); + if("全区域".equals(type)){ + mainmap12.put("fieldValue","3"); + }else if ("区域".equals(type)){ + mainmap12.put("fieldValue","1"); + } + mainlist.add(mainmap12); + + //区域 + Map mainmap13 = new HashMap(); + mainmap13.put("fieldName","qy"); + mainmap13.put("fieldValue",formDataVo.getFieldData("区域文本").getStringValue()); + mainlist.add(mainmap13); + + //经办人 +// Map mainmap10 = new HashMap(); +// mainmap10.put("fieldName","jbr"); +// mainmap10.put("fieldValue",formDataVo.getFieldData("经办人").getStringValue()); +// mainlist.add(mainmap10); + + //附件 + if(faths.size() > 0) { + Map jsonFile = new HashMap(); + jsonFile.put("fieldName","banr"); + List fujianValue = new ArrayList(); + for (int i = 0; i < faths.size(); i++) { + Map fath = (Map) faths.get(i); + Map fujianMap = new HashMap(); + fujianMap.put("filePath", fath.get("url")); + fujianMap.put("fileName", fath.get("name")); + fujianValue.add(fujianMap); + } + jsonFile.put("fieldValue",fujianValue); + mainlist.add(jsonFile); + } + + //接口主参数 + Map m = new LinkedHashMap(); +// JSONObject p = new JSONObject(); + //流程ID + m.put("workflowId", configVo.getParamVal(FVConstants.workflowId.name())); + //流程标题 + m.put("requestName",formDataVo.getColSummary().getSubject()); + //主表 + m.put("mainData", JSONUtil.toJsonStr(mainlist)); + log.info(m.toString()); + return m; + } + + /** + * 创建流程 + */ + public static Map createNewWF(JSONArray faths, FormDataVo formDataVo, ConfigVo configVo) throws NoSuchFieldException, IOException { + //主表信息 + List mainlist = new ArrayList(); + + //标题 + Map mainmap2 = new HashMap(); + mainmap2.put("fieldName","bt");//OA字段名-同行人员(多人力资源浏览框) + mainmap2.put("fieldValue",formDataVo.getFieldData("表头").getStringValue());//字段值(OA人员ID,多个以英文逗号分隔) + mainlist.add(mainmap2); + + //单号 + Map mainmap3 = new HashMap(); + mainmap3.put("fieldName","dh"); + mainmap3.put("fieldValue",formDataVo.getFieldData("流水号").getStringValue()); + mainlist.add(mainmap3); + + //申请日期 + Map mainmap4 = new HashMap(); + mainmap4.put("fieldName","sqrq"); + mainmap4.put("fieldValue",formDataVo.getFieldData("申请日期").getStringValue()); + mainlist.add(mainmap4); + + //投入金额 + Map mainmap5 = new HashMap(); + mainmap5.put("fieldName","trje"); + mainmap5.put("fieldValue",formDataVo.getFieldData("投入金额").getStringValue()); + mainlist.add(mainmap5); + + //备案意见 + Map mainmap6 = new HashMap(); + mainmap6.put("fieldName","bayj"); + mainmap6.put("fieldValue",formDataVo.getFieldData("备案意见").getStringValue()); + mainlist.add(mainmap6); + + //备案简述 + Map mainmap9 = new HashMap(); + mainmap9.put("fieldName","bajs"); + mainmap9.put("fieldValue",formDataVo.getFieldData("内容").getStringValue()); + mainlist.add(mainmap9); + + //经办人 + Map mainmap10 = new HashMap(); + mainmap10.put("fieldName","jbr"); + mainmap10.put("fieldValue",formDataVo.getFieldData("经办人").getStringValue()); + mainlist.add(mainmap10); + + + //公司名称 + Map mainmap12 = new HashMap(); + mainmap12.put("fieldName","ssschxsgs"); + mainmap12.put("fieldValue",formDataVo.getFieldData("馫香事业部公司名称").getStringValue()); + mainlist.add(mainmap12); + + //备案类型 + Map mainmap11 = new HashMap(); + mainmap11.put("fieldName","balx"); + String type = formDataVo.getFieldData("备案类型").getStringValue(); + if("全区域".equals(type)){ + mainmap11.put("fieldValue","3"); + }else if ("区域".equals(type)){ + mainmap11.put("fieldValue","2"); + } + mainlist.add(mainmap11); + + //附件 + if(faths.size() > 0) { + Map jsonFile = new HashMap(); + jsonFile.put("fieldName","banr"); + JSONArray fujianValue = new JSONArray(); + for (int i = 0; i < faths.size(); i++) { + Map fath = (Map) faths.get(i); + Map fujianMap = new HashMap(); + fujianMap.put("filePath", fath.get("url")); + fujianMap.put("fileName", fath.get("name")); + fujianValue.add(fujianMap); + } + jsonFile.put("fieldValue",fujianValue); + mainlist.add(jsonFile); + } + //接口主参数 + Map m = new LinkedHashMap(); +// JSONObject p = new JSONObject(); + //流程ID + m.put("workflowId", configVo.getParamVal(FVConstants.newWorkflowId.name())); + //流程标题 + m.put("requestName",formDataVo.getColSummary().getSubject()); + //主表 + m.put("mainData", JSONUtil.toJsonStr(mainlist)); + log.info(m.toString()); + return m; + } + + + + + + /** + * 获取附件路径 + * @param pathId + * @return + */ + public JSONArray getPathUrl(String pathId, ConfigVo configVo) throws IOException { + InterfaceListUtil interfaceListUtil = new InterfaceListUtil(); + String oatoken = interfaceListUtil.getToken(configVo.getParamVal(FVConstants.loginName.name()),configVo); + long aLong = Long.parseLong(pathId); + final List attachmentIds = attachmentManager.getBySubReference(aLong); + JSONArray jsonArray = new JSONArray(); + for (int i = 0 ; i < attachmentIds.size();i++) { + Attachment attachment = attachmentManager.getAttachmentByFileURL(attachmentIds.get(i)); + Long fileUrl = attachment.getFileUrl(); + String filename = attachment.getFilename(); + String fileType = filename.substring(filename.lastIndexOf(".")+1); + String oaFileName = filename.substring(0,filename.lastIndexOf(".")); + //调用接口下载文件,文件存放在指定的路径下 +// String dowUrl = PropKit.getProp(PropKit.DOWURL)+"/"+fileUrl+"?fileName="+fileType+"&token="+oatoken; + String dowUrl = configVo.getParamVal(FVConstants.dowurl.name())+"/"+fileUrl+"?fileName="+fileType+"&token="+oatoken; + String str = SystemEnvironment.getApplicationFolder(); + String dowPath = str+"/dhxfile/"+filename; + String download = interfaceListUtil.download(dowUrl, dowPath); + JSONObject jsonObject = new JSONObject(); + jsonObject.put("name", filename); + jsonObject.put("type", fileType); + jsonObject.put("url", configVo.getParamVal(FVConstants.dhxbaFile.name())+"/"+filename); + jsonArray.add(jsonObject); + } + return jsonArray; + } + + +} \ No newline at end of file diff --git a/v5/apps-customize/src/main/java/com/seeyon/apps/src_qyba/service/FVTongyongService.java b/v5/apps-customize/src/main/java/com/seeyon/apps/src_qyba/service/FVTongyongService.java new file mode 100644 index 0000000..4428f3d --- /dev/null +++ b/v5/apps-customize/src/main/java/com/seeyon/apps/src_qyba/service/FVTongyongService.java @@ -0,0 +1,125 @@ +package com.seeyon.apps.src_qyba.service; + +import cn.hutool.json.JSONUtil; +import cn.hutool.log.Log; +import com.aspose.words.FieldData; +import com.seeyon.apps.common.plugin.vo.ConfigVo; +import com.seeyon.apps.ext.workflow.vo.FieldDataVo; +import com.seeyon.apps.ext.workflow.vo.FormDataVo; +import com.seeyon.ctp.common.AppContext; +import com.seeyon.ctp.common.filemanager.manager.AttachmentManager; + +import java.io.IOException; +import java.util.*; + +public class FVTongyongService { + + private static Log log = Log.get(FVTongyongService.class); + private AttachmentManager attachmentManager; + + public void setAttachmentManager(AttachmentManager attachmentManager) { + this.attachmentManager = attachmentManager; + } + + public AttachmentManager getAttachmentManagery() { + if (attachmentManager == null) { + attachmentManager = (AttachmentManager) AppContext.getBean("attachmentManager"); + } + return attachmentManager; + } + + /** + * 创建流程 + */ + public static Map createWF(FormDataVo formDataVo, ConfigVo configVo) throws NoSuchFieldException, IOException { + //主表信息 + List mainlist = new ArrayList(); + + //备案类型 + Map mainmap = new HashMap(); + mainmap.put("fieldName","bayj"); + String type = formDataVo.getFieldData("备案").getStringValue(); + if("同意备案".equals(type)){ + mainmap.put("fieldValue","0"); + }else if ("不同意备案".equals(type)){ + mainmap.put("fieldValue","1"); + }else if ("满足条件备案".equals(type)){ + mainmap.put("fieldValue","2"); + } + mainlist.add(mainmap); + Map sfxwtsmap = new HashMap(); + sfxwtsmap.put("fieldName","sfxwts"); + String sfxwts = formDataVo.getFieldData("是否下委托书").getStringValue(); + if("是".equals(sfxwts)){ + sfxwtsmap.put("fieldValue","0"); + }else if ("否".equals(sfxwts)){ + sfxwtsmap.put("fieldValue","1"); + } + mainlist.add(sfxwtsmap); + + Map yjsmmap = new HashMap(); + yjsmmap.put("fieldName","yjsm"); + try{ + FieldDataVo yjsmVo = formDataVo.getFieldData("意见说明"); + yjsmmap.put("fieldValue",yjsmVo.getStringValue()); + }catch (Exception e){ + log.error(e.getMessage()); + yjsmmap.put("fieldValue",""); + } + mainlist.add(yjsmmap); + + //接口主参数 + Map m = new LinkedHashMap(); + //工作流ID + m.put("workflowId", formDataVo.getFieldData("工作流ID").getStringValue()); + //流程请求ID + m.put("requestId", formDataVo.getFieldData("流程请求ID").getStringValue()); + //流程标题 + m.put("requestName",formDataVo.getColSummary().getSubject()); + //主表 + m.put("mainData", JSONUtil.toJsonStr(mainlist)); + log.info(m.toString()); + return m; + } + + /** + * 创建流程 + */ + public static Map createNewWF(FormDataVo formDataVo, ConfigVo configVo) throws NoSuchFieldException, IOException { + //主表信息 + List mainlist = new ArrayList(); + //流程表单名 + Map tableDBName = new HashMap(); + tableDBName.put("tableDBName",formDataVo.getFieldData("流程表单名").getStringValue()); + mainlist.add(tableDBName); + + //备案类型 + Map mainmap = new HashMap(); + mainmap.put("fieldName","bayj"); + String type = formDataVo.getFieldData("备案").getStringValue(); + if("同意备案".equals(type)){ + mainmap.put("fieldValue","0"); + }else if ("不同意备案".equals(type)){ + mainmap.put("fieldValue","1"); + }else if ("满足条件备案".equals(type)){ + mainmap.put("fieldValue","2"); + } + mainlist.add(mainmap); + + //接口主参数 + Map m = new LinkedHashMap(); +// JSONObject p = new JSONObject(); + //工作流ID + m.put("workflowid", formDataVo.getFieldData("工作流ID").getStringValue()); + //流程请求ID + m.put("requestId", formDataVo.getFieldData("流程请求ID").getStringValue()); + //流程标题 + m.put("requestName",formDataVo.getColSummary().getSubject()); + //主表 + m.put("mainData", JSONUtil.toJsonStr(mainlist)); + log.info(m.toString()); + return m; + } + + +} \ No newline at end of file diff --git a/v5/apps-customize/src/main/java/com/seeyon/apps/src_qyba/util/FVHttpUtil.java b/v5/apps-customize/src/main/java/com/seeyon/apps/src_qyba/util/FVHttpUtil.java new file mode 100644 index 0000000..790ad23 --- /dev/null +++ b/v5/apps-customize/src/main/java/com/seeyon/apps/src_qyba/util/FVHttpUtil.java @@ -0,0 +1,57 @@ +package com.seeyon.apps.src_qyba.util; + +import cn.hutool.http.HttpRequest; +import com.alibaba.fastjson.JSONObject; +import com.seeyon.apps.src_qyba.vo.FVResponse; +import com.seeyon.ctp.util.json.JSONUtil; +import org.springframework.util.DigestUtils; + +import java.util.Base64; + +/** + * 功能描述:
+ *
+ *
+ * 
+ * + * @Author: HuangZhengguo + * @Date: 2024/2/27 + */ +public class FVHttpUtil { + + private FVHttpUtil() { + + } + + public static String doPost(String url, String body, String clientId, String security) throws Exception { + String ts = System.currentTimeMillis() + ""; + String signature = ts + security; + byte[] bytes = DigestUtils.md5Digest(signature.getBytes("UTF-8")); + signature = Base64.getEncoder().encodeToString(bytes); + return HttpRequest.post(url).header("Content-Type", "application/json;charset=utf-8") + .header("ts", ts) + .header("signature", signature) + .header("client_id", clientId) + .body(body).execute().body(); + } + + public static FVResponse parseResponse(String response) throws Exception { + try { + JSONObject object = JSONUtil.parseJSONString(response, JSONObject.class); + return new FVResponse(object); + } catch (Exception e) { + JSONObject jsonObject = new JSONObject(); + jsonObject.put("Status", "0"); + jsonObject.put("Msg", "解析json异常"); + jsonObject.put("Data", response); + return new FVResponse(jsonObject); + } + } + + + + public static void main(String[] args) { + String url = "http://10.1.90.21:9083/servlet/NCTokenServlet?dsname=BIPcs&usercode=UFYJY&system=OA&busicentercode=sxbip"; + } + +} diff --git a/v5/apps-customize/src/main/java/com/seeyon/apps/src_qyba/util/FanWeiUtil.java b/v5/apps-customize/src/main/java/com/seeyon/apps/src_qyba/util/FanWeiUtil.java new file mode 100644 index 0000000..886b6cf --- /dev/null +++ b/v5/apps-customize/src/main/java/com/seeyon/apps/src_qyba/util/FanWeiUtil.java @@ -0,0 +1,301 @@ +package com.seeyon.apps.src_qyba.util; + +import cn.hutool.core.util.CharsetUtil; +import cn.hutool.core.util.StrUtil; +import cn.hutool.crypto.asymmetric.KeyType; +import cn.hutool.crypto.asymmetric.RSA; +import cn.hutool.http.HttpRequest; +import cn.hutool.json.JSONUtil; +import cn.hutool.log.Log; +import com.seeyon.apps.common.plugin.vo.ConfigVo; +import com.seeyon.apps.src_qyba.constants.FVConstants; +import com.seeyon.apps.src_qyba.service.FVTongyongService; + +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; + +/** + * 描述: + * + * @Author: huangzhengguo + * @Date: 2024/03/04 + */ +public class FanWeiUtil { + + private static Log log = Log.get(FanWeiUtil.class); + + /** + * 模拟缓存服务 + */ + private static final Map SYSTEM_CACHE = new HashMap<>(); + + private static String privateKey = ""; + private static String publicKey = ""; + + + /** + * ecology系统发放的授权许可证(appid) + * ce14aaca-fa08-4eb7-9f10-c2294285c4ea + */ + private static String APPID = "e47a15d2-95f2-4bf6-a546-8076ce445a19"; + + + /** + * 第一步: + * + * 调用ecology注册接口,根据appid进行注册,将返回服务端公钥和Secret信息 + */ + public static Map Regist(String address){ + + //获取当前系统RSA加密的公钥 + RSA rsa = new RSA(); + if(publicKey.equals("")) { + publicKey = rsa.getPublicKeyBase64(); + } + if(privateKey.equals("")) { + privateKey = rsa.getPrivateKeyBase64(); + } + + log.info("publicKey:"+publicKey+" privateKey:"+privateKey); + // 客户端RSA私钥 + SYSTEM_CACHE.put("LOCAL_PRIVATE_KEY",privateKey); + // 客户端RSA公钥 + SYSTEM_CACHE.put("LOCAL_PUBLIC_KEY",publicKey); + + //调用ECOLOGY系统接口进行注册 + String data = HttpRequest.post(address + "/api/ec/dev/auth/regist") + .header("appid",APPID) + .header("cpk",publicKey) + .timeout(2000) + .execute().body(); + + // 打印ECOLOGY响应信息 + log.info("Regist():"+data); + Map datas = JSONUtil.parseObj(data); + + //ECOLOGY返回的系统公钥 + SYSTEM_CACHE.put("SERVER_PUBLIC_KEY", StrUtil.nullToEmpty((String)datas.get("spk"))); + //ECOLOGY返回的系统密钥 + SYSTEM_CACHE.put("SERVER_SECRET", StrUtil.nullToEmpty((String)datas.get("secrit"))); + return datas; + } + + + + /** + * 第二步: + * + * 通过第一步中注册系统返回信息进行获取token信息 + */ + public static Map Getoken(String address, ConfigVo configVo) throws IOException { + // 从系统缓存或者数据库中获取ECOLOGY系统公钥和Secret信息 +// String secret = PropKit.getProp(PropKit.SECRET); + String secret = configVo.getParamVal(FVConstants.secret.name()); +// String spk = PropKit.getProp(PropKit.SPK); + String spk = configVo.getParamVal(FVConstants.spk.name()); + + + // 公钥加密,所以RSA对象私钥为null + RSA rsa = new RSA(null,spk); + //对秘钥进行加密传输,防止篡改数据 + String encryptSecret = rsa.encryptBase64(secret, CharsetUtil.CHARSET_UTF_8, KeyType.PublicKey); + + //调用ECOLOGY系统接口进行注册 + String data = HttpRequest.post(address+ "/api/ec/dev/auth/applytoken") + .header("appid",configVo.getParamVal(FVConstants.appId.name())) + .header("secret",encryptSecret) + .header("time","3600") + .execute().body(); + + log.info("Getoken():"+data); + Map datas = JSONUtil.parseObj(data); + + //ECOLOGY返回的token + // TODO 为Token缓存设置过期时间 + SYSTEM_CACHE.put("SERVER_TOKEN", StrUtil.nullToEmpty((String)datas.get("token"))); + + return datas; + } + + /** + * 第三步:新增 + * + * 调用ecology系统的rest接口,请求头部带上token和用户标识认证信息 + * + * @param params 请求参数map,创建流程之类的post接口是以模拟form表单提交的方式,其他get接口以json字符串方式提交 + * + * 注意:ECOLOGY系统所有POST接口调用请求头请设置 "Content-Type","application/x-www-form-urlencoded; charset=utf-8" + */ + public static String PostRestful(Map params, String userid, ConfigVo configVo) throws IOException { + + //ECOLOGY返回的token +// String token = (String) Getoken(PropKit.getProp(PropKit.ADDRESS)).get("token"); + String token = (String) Getoken(configVo.getParamVal(FVConstants.addRess.name()),configVo).get("token"); + + //封装请求头参数 +// RSA rsa = new RSA(null, PropKit.getProp(PropKit.SPK)); + RSA rsa = new RSA(null, configVo.getParamVal(FVConstants.spk.name())); + //对用户信息进行加密传输,暂仅支持传输OA用户ID + String encryptUserid = rsa.encryptBase64(userid, CharsetUtil.CHARSET_UTF_8, KeyType.PublicKey); + + //调用ECOLOGY系统接口 +// String data = HttpRequest.post(PropKit.getProp(PropKit.ADDRESS) + PropKit.getProp(PropKit.TONGYONGAPI)) +// .header("appid",PropKit.getProp(PropKit.APPID)) +// .header("token",token) +// .header("userid",encryptUserid) +// // .header("skipsession", "1") +// .form(params) +// .execute().body(); + String data = HttpRequest.post(configVo.getParamVal(FVConstants.addRess.name()) + configVo.getParamVal(FVConstants.tongyongApi.name())) + .header("appid",configVo.getParamVal(FVConstants.appId.name())) + .header("token",token) + .header("userid",encryptUserid) + // .header("skipsession", "1") + .form(params) + .execute().body(); +// Map headermap = new HashMap(); +// headermap.put("appid",APPID); +// headermap.put("token",token); +// headermap.put("userid",encryptUserid); +// String data = HttpClientUtil.doPostFORM(address + api,headermap,params); + log.info("PostRestfulby():"+data); + return data; + } + + /** + * 第三步:提交 + * + * 调用ecology系统的rest接口,请求头部带上token和用户标识认证信息 + * + * @param params 请求参数map,创建流程之类的post接口是以模拟form表单提交的方式,其他get接口以json字符串方式提交 + * + * 注意:ECOLOGY系统所有POST接口调用请求头请设置 "Content-Type","application/x-www-form-urlencoded; charset=utf-8" + */ + public static String PostSubmitRestful(Map params, ConfigVo configVo) throws IOException { + + //ECOLOGY返回的token + String token = (String) Getoken(configVo.getParamVal(FVConstants.addRess.name()),configVo).get("token"); + + //封装请求头参数 + RSA rsa = new RSA(null, configVo.getParamVal(FVConstants.spk.name())); + //对用户信息进行加密传输,暂仅支持传输OA用户ID + String encryptUserid = rsa.encryptBase64("1", CharsetUtil.CHARSET_UTF_8, KeyType.PublicKey); + + //调用ECOLOGY系统接口 + log.info(configVo.getParamVal(FVConstants.addRess.name())); + log.info(configVo.getParamVal(FVConstants.tongyonSubmitgApi.name())); + log.info(configVo.getParamVal(FVConstants.appId.name())); + log.info(encryptUserid); + String data = HttpRequest.post(configVo.getParamVal(FVConstants.addRess.name()) + configVo.getParamVal(FVConstants.tongyonSubmitgApi.name())) + .header("appid",configVo.getParamVal(FVConstants.appId.name())) + .header("token",token) + .header("userid",encryptUserid) + // .header("skipsession", "1") + .form(params) + .execute().body(); + log.info("PostRestfulby():"+data); + return data; + } + + + /** + * 第二步: + * + * 通过第一步中注册系统返回信息进行获取token信息 + */ + public static Map NewGetoken(String address, ConfigVo configVo) throws IOException { + // 从系统缓存或者数据库中获取ECOLOGY系统公钥和Secret信息 + String secret = configVo.getParamVal(FVConstants.newSecret.name()); + String spk = configVo.getParamVal(FVConstants.newspk.name()); + + + // 公钥加密,所以RSA对象私钥为null + RSA rsa = new RSA(null,spk); + //对秘钥进行加密传输,防止篡改数据 + String encryptSecret = rsa.encryptBase64(secret, CharsetUtil.CHARSET_UTF_8, KeyType.PublicKey); + + //调用ECOLOGY系统接口进行注册 + String data = HttpRequest.post(address+ "/api/ec/dev/auth/applytoken") + .header("appid",configVo.getParamVal(FVConstants.appId.name())) + .header("secret",encryptSecret) + .header("time","3600") + .execute().body(); + + log.info("Getoken():"+data); + Map datas = JSONUtil.parseObj(data); + + //ECOLOGY返回的token + // TODO 为Token缓存设置过期时间 + SYSTEM_CACHE.put("SERVER_TOKEN", StrUtil.nullToEmpty((String)datas.get("token"))); + + return datas; + } + + /** + * 第三步:新增 + * + * 调用ecology系统的rest接口,请求头部带上token和用户标识认证信息 + * + * @param params 请求参数map,创建流程之类的post接口是以模拟form表单提交的方式,其他get接口以json字符串方式提交 + * + * 注意:ECOLOGY系统所有POST接口调用请求头请设置 "Content-Type","application/x-www-form-urlencoded; charset=utf-8" + */ + public static String NewPostRestful(Map params, String userid, ConfigVo configVo) throws IOException { + + //ECOLOGY返回的token +// String token = (String) Getoken(PropKit.getProp(PropKit.NEWADDRESS)).get("token"); + String token = (String) NewGetoken(configVo.getParamVal(FVConstants.newAddRess.name()),configVo).get("token"); + + + //封装请求头参数 + RSA rsa = new RSA(null, configVo.getParamVal(FVConstants.newspk.name())); + //对用户信息进行加密传输,暂仅支持传输OA用户ID + String encryptUserid = rsa.encryptBase64(userid, CharsetUtil.CHARSET_UTF_8, KeyType.PublicKey); + + //调用ECOLOGY系统接口 + String data = HttpRequest.post(configVo.getParamVal(FVConstants.newAddRess.name()) + configVo.getParamVal(FVConstants.tongyongApi.name())) + .header("appid",configVo.getParamVal(FVConstants.appId.name())) + .header("token",token) + .header("userid",encryptUserid) + .form(params) + .execute().body(); + log.info("PostRestfulby():"+data); + return data; + } + + /** + * 第三步:提交 + * + * 调用ecology系统的rest接口,请求头部带上token和用户标识认证信息 + * + * @param params 请求参数map,创建流程之类的post接口是以模拟form表单提交的方式,其他get接口以json字符串方式提交 + * + * 注意:ECOLOGY系统所有POST接口调用请求头请设置 "Content-Type","application/x-www-form-urlencoded; charset=utf-8" + */ + public static String NewPostSubmitRestful(Map params, ConfigVo configVo) throws IOException { + + //ECOLOGY返回的token + String token = (String) NewGetoken(configVo.getParamVal(FVConstants.newAddRess.name()),configVo).get("token"); + log.info(token); + + //封装请求头参数 + RSA rsa = new RSA(null, configVo.getParamVal(FVConstants.newspk.name())); + //对用户信息进行加密传输,暂仅支持传输OA用户ID + String encryptUserid = rsa.encryptBase64("1", CharsetUtil.CHARSET_UTF_8, KeyType.PublicKey); + + //调用ECOLOGY系统接口 + log.info(configVo.getParamVal(FVConstants.newAddRess.name())); + log.info(configVo.getParamVal(FVConstants.tongyonSubmitgApi.name())); + log.info(configVo.getParamVal(FVConstants.appId.name())); + log.info(encryptUserid); + String data = HttpRequest.post(configVo.getParamVal(FVConstants.newAddRess.name()) + configVo.getParamVal(FVConstants.tongyonSubmitgApi.name())) + .header("appid",configVo.getParamVal(FVConstants.appId.name())) + .header("token",token) + .header("userid",encryptUserid) + .form(params) + .execute().body(); + log.info("PostRestfulby():"+data); + return data; + } +} diff --git a/v5/apps-customize/src/main/java/com/seeyon/apps/src_qyba/util/InterfaceListUtil.java b/v5/apps-customize/src/main/java/com/seeyon/apps/src_qyba/util/InterfaceListUtil.java new file mode 100644 index 0000000..0058478 --- /dev/null +++ b/v5/apps-customize/src/main/java/com/seeyon/apps/src_qyba/util/InterfaceListUtil.java @@ -0,0 +1,344 @@ +package com.seeyon.apps.src_qyba.util; + +import com.alibaba.fastjson.JSONObject; +import com.seeyon.apps.common.plugin.vo.ConfigVo; +import com.seeyon.apps.src_qyba.constants.FVConstants; +import org.apache.commons.httpclient.Header; +import org.apache.commons.httpclient.HttpClient; +import org.apache.commons.httpclient.HttpException; +import org.apache.commons.httpclient.HttpStatus; +import org.apache.commons.httpclient.methods.PostMethod; +import org.apache.commons.httpclient.methods.RequestEntity; +import org.apache.commons.httpclient.methods.StringRequestEntity; +import org.apache.http.HttpResponse; +import org.apache.http.client.methods.HttpGet; +import org.apache.http.impl.client.DefaultHttpClient; +import org.apache.http.util.EntityUtils; +import org.springframework.core.io.support.PropertiesLoaderUtils; + +import java.io.*; +import java.net.HttpURLConnection; +import java.net.MalformedURLException; +import java.net.URL; +import java.net.URLConnection; +import java.text.MessageFormat; +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.Properties; + +/** + * 接口调用工具类 + * 2021-06-08 + * @author huangzhengguo + * + */ +public class InterfaceListUtil { + + /** + * 获取一个token + * + + * @return + * @throws IOException + * @throws FileNotFoundException + */ + public String getToken(String loginName,ConfigVo configVo) throws FileNotFoundException, IOException { + String address = ""; + String token = ""; + if("".equals(loginName)) { +// address = PropKit.getProp(PropKit.OATOKENURL)+"/"+PropKit.getProp(PropKit.RESTNAME)+"/"+PropKit.getProp(PropKit.RESTPASSWORD); + address = configVo.getParamVal(FVConstants.oaTokenUrl.name())+"/" + +configVo.getParamVal(FVConstants.restName.name())+"/" + +configVo.getParamVal(FVConstants.restPassword.name()); + }else { +// address = PropKit.getProp(PropKit.OATOKENURL)+"/"+PropKit.getProp(PropKit.RESTNAME)+"/"+PropKit.getProp(PropKit.RESTPASSWORD)+"?loginName="+loginName; + address = configVo.getParamVal(FVConstants.oaTokenUrl.name())+"/"+ + configVo.getParamVal(FVConstants.restName.name())+"/"+ + configVo.getParamVal(FVConstants.restPassword.name())+"?loginName="+loginName; + } + HttpURLConnection connection = (HttpURLConnection) new URL(address).openConnection(); + connection.setRequestMethod("GET"); + int responseCode = connection.getResponseCode(); + if (responseCode == HttpURLConnection.HTTP_OK) { + BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream())); + String inputLine; + StringBuffer response = new StringBuffer(); + while ((inputLine = in.readLine()) != null) { + response.append(inputLine); + } + in.close(); + String result = response.toString(); + if(result.contains("{")) { + JSONObject jsObj = JSONObject.parseObject(result); + System.out.println(jsObj); + token = jsObj.get("id").toString(); + }else { + token = result; + } + System.out.println(token); + } else { + System.out.println("GET request not worked"); + } + return token; + } + + /** + * 调用get接口 + * + * @param par 拼接在url中的参数 + * @param strUrl 需要调用的url对应的配置文件的key + * @return + */ + public String doGet(String par, String strUrl, String token) { + String address = MessageFormat.format(getProperties(strUrl), par + "?token=") + token; + + DefaultHttpClient client = new DefaultHttpClient(); + String result = ""; + HttpGet get = new HttpGet(address); + try { + HttpResponse res = client.execute(get); + if (res.getStatusLine().getStatusCode() == HttpStatus.SC_OK) { + result = EntityUtils.toString(res.getEntity()); + } + } catch (Exception e) { + throw new RuntimeException(e); + } +// JSONObject jsObj = JSONObject.parseObject(result); + return result; + + } + + /** + * 调用post接口 + * + * @param str 调用接口传递的参数json + * @param urlStr 需要调用的url对应的参数文件中的编码 + * @return + */ + public JSONObject doPost(String str, String urlStr, String token) { + HttpURLConnection connection = null; + InputStream is = null; + OutputStream os = null; + BufferedReader br = null; + String result = null; + try { +// String token = getToken(getProperties("restUserName"), getProperties("restPassword")); + URL url = new URL(getProperties(urlStr) + "?token=" + token); + // 通过远程url连接对象打开连接 + connection = (HttpURLConnection) url.openConnection(); + // 设置连接请求方式 + connection.setRequestMethod("POST"); + // 设置连接主机服务器超时时间:15000毫秒 + connection.setConnectTimeout(15000); + // 设置读取主机服务器返回数据超时时间:60000毫秒 + connection.setReadTimeout(60000); + + // 默认值为:false,当向远程服务器传送数据/写数据时,需要设置为true + connection.setDoOutput(true); + // 默认值为:true,当前向远程服务读取数据时,设置为true,该参数可有可无 + connection.setDoInput(true); + // 设置传入参数的格式:请求参数应该是 name1=value1&name2=value2 的形式。 + connection.setRequestProperty("Content-Type", "application/json"); + // 通过连接对象获取一个输出流 + os = connection.getOutputStream(); + // 通过输出流对象将参数写出去/传输出去,它是通过字节数组写出的 + if (!("".equals(str) || str == null)) { + os.write(str.getBytes("UTF-8")); + } + // 连接对象获取一个输入流,向远程读取 + if (connection.getResponseCode() == 200) { + + is = connection.getInputStream(); + // 对输入流对象进行包装:charset根据工作项目组的要求来设置 + br = new BufferedReader(new InputStreamReader(is, "UTF-8")); + + StringBuffer sbf = new StringBuffer(); + String temp = null; + // 循环遍历一行一行读取数据 + while ((temp = br.readLine()) != null) { + sbf.append(temp); + sbf.append("\r\n"); + } + result = sbf.toString(); + } + } catch (MalformedURLException e) { + e.printStackTrace(); + } catch (IOException e) { + e.printStackTrace(); + } finally { + // 关闭资源 + if (null != br) { + try { + br.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + if (null != os) { + try { + os.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + if (null != is) { + try { + is.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + // 断开与远程地址url的连接 + connection.disconnect(); + } + JSONObject json = JSONObject.parseObject(result); + return json; + + } + + /** + * 获取指定参数文件的值(pa.properties) + * + * @param str 参数文件中的key + * @return + */ + public String getProperties(String str) { + Properties properties = null; + try { + properties = PropertiesLoaderUtils.loadAllProperties("pa.properties"); + } catch (IOException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + return (String) properties.get(str); + } + + /** + * 调用Soap接口 对接平台使用 + * @param action 平台接口中的方法参数名称 + * @param xml 传递平台的XML数据参数 + * @return 返回调取soap接口后接口的返回值(未处理) + * @throws HttpException + * @throws IOException + */ + public String doSoap(String action, String xml,String id) throws HttpException, IOException { + String wsdl = ""; + if("createDepartment".equals(action)||"updateDepartment".equals(action)) { + wsdl = getProperties("DeptWsdl"); + }else if("createPractitioner".equals(action)||"updatePractitioner".equals(action)) { + wsdl = getProperties("MemberWsdl"); + } + System.out.println("wsdl:"+wsdl); + int timeout = 10000; + + // 构造soap请求信息 + StringBuffer sb = new StringBuffer(""); + sb.append( + ""); + sb.append(""); + sb.append(""); + sb.append(" "); + sb.append("" + action + "" + xml + ""); + sb.append(""); + sb.append(""); + sb.append(""); + + // HttpClient发送SOAP请求 +// System.out.println("HttpClient 发送SOAP请求"); + HttpClient client = new HttpClient(); + PostMethod postMethod = new PostMethod(wsdl); + Header header = new Header(); + // 设置连接超时 + client.getHttpConnectionManager().getParams().setConnectionTimeout(timeout); + // 设置读取时间超时 + client.getHttpConnectionManager().getParams().setSoTimeout(timeout); + // 然后把Soap请求数据添加到PostMethod中 + RequestEntity requestEntity = null; + try { + requestEntity = new StringRequestEntity(sb.toString(), "text/xml", "UTF-8"); + } catch (UnsupportedEncodingException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + // 设置请求头部,否则可能会报 “no SOAPAction header” 的错误 + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + Date businessTime = new Date(); + Date operationTime = new Date(); + SimpleDateFormat sdf1 = new SimpleDateFormat("yyyyMMddHHmmss"); + Date root = new Date(); + String rootId = sdf1.format(root); + postMethod.setRequestHeader("SOAPAction", ""); + postMethod.setRequestHeader("Content-Type", "application/fhir+json"); + postMethod.setRequestHeader("rootId", rootId); + postMethod.setRequestHeader("token", id); + postMethod.setRequestHeader("domain", "OA"); + postMethod.setRequestHeader("businessTime", sdf.format(businessTime)); + postMethod.setRequestHeader("key", "806c1571-35de-41a2-b3c9-06ae5474d43a"); + postMethod.setRequestHeader("operationTime", sdf.format(operationTime)); + // 设置请求体 + postMethod.setRequestEntity(requestEntity); + int status = client.executeMethod(postMethod); + // 打印请求状态码 +// System.out.println("status:" + status); + // 获取响应体输入流 + InputStream is = postMethod.getResponseBodyAsStream(); + // 获取请求结果字符串 + byte[] bytes = new byte[is.available()]; + is.read(bytes); + String result = new String(bytes); + + return result; + } + + /** + * 下载文件到指定目录 + * @param dowUrl:http地址 + * @param dowPath:指定目录 + * */ + public String download(String dowUrl, String dowPath){ + try { +// log.info("下载地址是:"+dowUrl+",存储地址是:"+dowPath); + URL url = new URL(dowUrl); + + URLConnection urlConnection = url.openConnection(); + + HttpURLConnection httpURLConnection = (HttpURLConnection) urlConnection;// http的连接类 + + //String contentType = httpURLConnection.getContentType();//请求类型,可用来过滤请求, + + httpURLConnection.setConnectTimeout(1000*5);//设置超时 + + httpURLConnection.setRequestMethod("GET");//设置请求方式,默认是GET + + httpURLConnection.setRequestProperty("Charset", "UTF-8");// 设置字符编码 + + httpURLConnection.connect();// 打开连接 + + BufferedInputStream bin = new BufferedInputStream(httpURLConnection.getInputStream()); + + String path = dowPath;// 指定存放位置 + File filed = new File(path); + + OutputStream out = new FileOutputStream(filed); + int size = 0; + + byte[] b = new byte[2048]; + //把输入流的文件读取到字节数据b中,然后输出到指定目录的文件 + while ((size = bin.read(b)) != -1) { + out.write(b, 0, size); + } + // 关闭资源 + bin.close(); + out.close(); + return "200"; + } catch (MalformedURLException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + return "500"; + } catch (IOException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + return "400"; + } + } +} diff --git a/v5/apps-customize/src/main/java/com/seeyon/apps/src_qyba/vo/FVResponse.java b/v5/apps-customize/src/main/java/com/seeyon/apps/src_qyba/vo/FVResponse.java new file mode 100644 index 0000000..6a5ed97 --- /dev/null +++ b/v5/apps-customize/src/main/java/com/seeyon/apps/src_qyba/vo/FVResponse.java @@ -0,0 +1,72 @@ +package com.seeyon.apps.src_qyba.vo; + +import com.alibaba.fastjson.JSONObject; + +/** + * 功能描述:
+ *
+ *
+ * 
+ * + * @Author: huangzhengguo + * @Date: 2024/03/04 + */ +public class FVResponse { + + private boolean success; + private int status; + private String msg; + private String data; + + + public FVResponse(JSONObject object) { + if(object.containsKey("Status")) { + this.status = object.getInteger("Status"); + } else { + this.status = object.getInteger("status"); + } + this.success = (1 == status); + if(object.containsKey("Msg")) { + this.msg = object.getString("Msg"); + } else { + this.msg = object.getString("msg"); + } + this.data = object.getString("Data"); + } + + public boolean isSuccess() { + return success; + } + + public FVResponse setSuccess(boolean success) { + this.success = success; + return this; + } + + public int getStatus() { + return status; + } + + public FVResponse setStatus(int status) { + this.status = status; + return this; + } + + public String getMsg() { + return msg; + } + + public FVResponse setMsg(String msg) { + this.msg = msg; + return this; + } + + public String getData() { + return data; + } + + public FVResponse setData(String data) { + this.data = data; + return this; + } +} diff --git a/v5/apps-customize/src/main/resources/needless_check_login.xml b/v5/apps-customize/src/main/resources/needless_check_login.xml new file mode 100644 index 0000000..97114bc --- /dev/null +++ b/v5/apps-customize/src/main/resources/needless_check_login.xml @@ -0,0 +1,322 @@ + + + + /qrCodeForm.do + + index + newMain + + + + /sc.do + + qr + + + + /elearning.do + + error + m3Redirect + message + pcRedirect + + + + /phoneLogin/phoneLogin.do + + getMessageCode + validateMessageCode + + + + /wechat/miniprogram.do + + a8home + bind + bindMemberPhone + login + unbind + + + + /portal/spaceController.do + + showThemSpace + + + + /identification.do + + getSessionId + + + + /fileUpload.do + + showRTE + + + + /fileDownload.do + + showRTE + + + + /form/formUpgrade.do + + toUpgrade + upgrade + viewUpgrade + + + + formtalkFormMapperController.do + + importFormtalkData + + + + /thirdpartyController.do + + access + index + logoutNotify + show + mailAuth + + + + /main.do + + changeLocale + hangup + headerjs + index + login + login4Ucpc + login4Ucpc3 + login4Vjoin + logout + logout4Session + logout4Vjoin + logout4ZX + main + login4QrCode + qrCodeHelp + updateLoginSeed + + + + /trustdo/A8/XRD.do + + getLoginAccount + getLoginAcctoken + webLogin + + + + /share.do + + index + + + + /genericController.do + + index + + + + /edoc/edocUpgradeControllor.do + + upgrade + download + + + + /uploadService.do + + processUploadService + + + + /autoinstall.do + + ieSetDown + regInstallDown + regInstallDown64 + downloadAssistant + + + + /personalBind.do + + getBindTypeByLoginName + isCanUse + retrievePassword + sendVerificationCodeToBindEmail + sendVerificationCodeToBindNum + validateVerificationCode + + + + + + + + + + + /commonimage.do + + showImage + + + + /individualManager.do + + resetPassword + + + + /wechat/dingding.do + + binding + index + main + newIndex + newMain + viewh5Message + + + + /uc/rest.do + + commonPierce + downloadImage + getBgTimeStamp + getLoginsecurityMsg + sendsms + smsrequired + testIp + isQrLogin + getDigitalCodeInfo + + + + portalManager + + sendSMSLoginCode + smsLoginEnabled + + + + loginUserManager + + getLockTime + + + + qrCodeLoginManager + + isLogin + + + + meetingAjaxManager + + meetingPanelData + meetingPanelDisplay + + + + /m3/loginController.do + + transLogin + transLogout + getProfile + + + + /m3/mClientBindController.do + + bindApply + + + + m3ProductManager + + productInfo + productStatus + + + + /m3/homeSkinController.do + + downloadImage + getSkinImageUrl + + + + /m3/transModeController.do + + getTransModeForMobile + + + + /media/media.do + + mediaShow + + + + /ocipEdoc.do + + index + + + + /colView.do + + index + + + + /caAccountManagerController.do + + findKeyNumByLoginName + + + + /fddCallbackController.do + + asynch + synch + + + + /seeyonReport/seeyonReportController.do + + redirectSeeyonReport + + + + /imc.do + + index + logout + + + + + /cloudbuild.do + + download + getDownloadPageInfo + getLatestVersionInfo + getDownloadQrUrl + + + \ No newline at end of file diff --git a/v5/apps-customize/src/main/resources/needless_check_login_recheck.xml b/v5/apps-customize/src/main/resources/needless_check_login_recheck.xml new file mode 100644 index 0000000..0e84aeb --- /dev/null +++ b/v5/apps-customize/src/main/resources/needless_check_login_recheck.xml @@ -0,0 +1,426 @@ + + + + + + /qrCodeForm.do + com.seeyon.apps.qrCodeForm.controller.QrCodeFormController + + index + newMain + + + + + /sc.do + com.seeyon.cap4.form.modules.smartCode.controller.SmartCodeController + + qr + + + + /media/media.do + com.seeyon.ctp.common.media.controller.MediaController + + mediaShow + + + + /phoneLogin/phoneLogin.do + com.seeyon.ctp.login.controller.PhoneLoginController + + getMessageCode + validateMessageCode + + + + portalManager + com.seeyon.ctp.portal.manager.PortalManagerImpl + + sendSMSLoginCode + smsLoginEnabled + + + + /fileDownload.do + com.seeyon.ctp.common.fileupload.FileUploadController + + showRTE + + + + loginUserManager + com.seeyon.ctp.login.LoginUserManagerImpl + + getLockTime + + + + /main.do + com.seeyon.ctp.login.controller.MainController + + changeLocale + hangup + headerjs + index + login + login4Ucpc + login4Ucpc3 + login4Vjoin + logout + logout4Session + logout4Vjoin + logout4ZX + main + login4QrCode + qrCodeHelp + updateLoginSeed + + + + /trustdo/A8/XRD.do + com.seeyon.apps.trustdo.controller.XRDController + + getLoginAccount + getLoginAcctoken + webLogin + + + + /share.do + com.seeyon.v3x.system.share.controller.ShareController + + index + + + + /edoc/edocUpgradeControllor.do + com.seeyon.v3x.edoc.controller.EdocUpgradeControllor + + upgrade + download + + + + /m3/mClientBindController.do + com.seeyon.apps.m3.bind.controller.M3ClientBindController + + bindApply + + + + /uploadService.do + com.seeyon.ctp.services.FileUploadService + + processUploadService + + + + /uc/rest.do + com.seeyon.apps.zx.controller.ZxRestController + + commonPierce + downloadImage + getBgTimeStamp + getLoginsecurityMsg + sendsms + smsrequired + testIp + isQrLogin + getDigitalCodeInfo + + + + /m3/homeSkinController.do + com.seeyon.apps.m3.skin.controller.M3HomeSkinController + + downloadImage + getSkinImageUrl + + + + /colView.do + com.seeyon.apps.ocip.exchange.collaboration.controller.CollViewController + + index + + + + /autoinstall.do + com.seeyon.apps.autoinstall.controller.AutoInstallController + + ieSetDown + regInstallDown + regInstallDown64 + downloadAssistant + + + + + + + + + + + + /caAccountManagerController.do + com.seeyon.v3x.ca.caaccount.controller.CAAccountManagerController + + findKeyNumByLoginName + + + + /elearning.do + com.seeyon.apps.elearning.controller.ElearningController + + error + m3Redirect + message + pcRedirect + + + + /wechat/miniprogram.do + com.seeyon.apps.weixin.controller.MiniProgramController + + a8home + bind + bindMemberPhone + login + unbind + + + + /portal/spaceController.do + com.seeyon.ctp.portal.space.controller.SpaceController + + showThemSpace + + + + /identification.do + com.seeyon.v3x.identification.controller.IdentificationController + + getSessionId + + + + /fddCallbackController.do + com.seeyon.apps.econtract.fdd.controller.FddCallbackController + + asynch + synch + + + + m3ProductManager + com.seeyon.apps.m3.product.manager.impl.M3ProductManagerImpl + + productInfo + productStatus + + + + /ocipEdoc.do + com.seeyon.apps.ocip.exchange.edoc.OCIPEdocController + + index + + + + /m3/loginController.do + + transLogin + transLogout + getProfile + + + + /fileUpload.do + com.seeyon.ctp.common.fileupload.FileUploadController + + showRTE + processUpload + + + + qrCodeLoginManager + com.seeyon.ctp.login.manager.QrCodeLoginManagerImpl + + isLogin + + + + /form/formUpgrade.do + com.seeyon.ctp.form.service.FormUpgradeController + + toUpgrade + upgrade + viewUpgrade + + + + /seeyonReport/seeyonReportController.do + com.seeyon.apps.seeyonreport.controller.SeeyonReportController + + redirectSeeyonReport + + + + formtalkFormMapperController.do + com.seeyon.apps.formtalk.controller.FormtalkImportController + + importFormtalkData + + + + /thirdpartyController.do + com.seeyon.ctp.portal.sso.thirdpartyintegration.controller.ThirdpartyController + + access + index + logoutNotify + show + mailAuth + + + + /m3/transModeController.do + com.seeyon.apps.m3.transmissionmode.controller.M3TransModeController + + getTransModeForMobile + + + + /genericController.do + com.seeyon.v3x.common.controller.GenericController + + index + + + + /personalBind.do + com.seeyon.v3x.personalaffair.controller.PersonalBindController + + getBindTypeByLoginName + isCanUse + retrievePassword + sendVerificationCodeToBindEmail + sendVerificationCodeToBindNum + validateVerificationCode + + + + /commonimage.do + com.seeyon.apps.common.image.controller.ImageController + + showImage + + + + /individualManager.do + com.seeyon.v3x.personalaffair.controller.IndividualManagerController + + resetPassword + + + + meetingAjaxManager + com.seeyon.apps.meeting.manager.MeetingAjaxManagerImpl + + meetingPanelData + meetingPanelDisplay + + + + /wechat/dingding.do + com.seeyon.apps.weixin.controller.DingDingController + + binding + index + main + newIndex + newMain + viewh5Message + + + + /imc.do + com.seeyon.apps.imc.controller.ImcLoginController + + index + logout + + + + /wechat/feishu.do + com.seeyon.apps.weixin.controller.FeishuController + + newMain + viewh5Message + + + + + + + + + + + + + + + /wechat/pcapp.do + com.seeyon.apps.weixin.controller.PcAppController + + transferPageFromWxCoreServer + gotoPcApp + checkCodeTurnToRightPage + transfer + transferMsg + + + + /wechat/feishu/approvalData.do + com.seeyon.apps.zhifei.feishu.approval.controller.ApprovalDataController + + index + + + + /zhifei/feishu.do + com.seeyon.apps.zhifei.controller.FeishuController + + newMain + viewh5Message + + + + /zhifei/pcapp.do + com.seeyon.apps.zhifei.controller.ZhifeiPcAppController + + transferPageFromWxCoreServer + gotoPcApp + + + + /zhifei/feishu/approvalData.do + com.seeyon.apps.zhifei.feishu.approval.controller.ApprovalDataController + + index + + + + /cloudbuild.do + com.seeyon.apps.cloudbuild.controller.CloudBuildController + + download + getDownloadPageInfo + getLatestVersionInfo + getDownloadQrUrl + + + diff --git a/v5/apps-customize/src/main/webapp/WEB-INF/cfgHome/plugin/src_flowbacklog/pluginCfg.xml b/v5/apps-customize/src/main/webapp/WEB-INF/cfgHome/plugin/src_flowbacklog/pluginCfg.xml new file mode 100644 index 0000000..4ca3d50 --- /dev/null +++ b/v5/apps-customize/src/main/webapp/WEB-INF/cfgHome/plugin/src_flowbacklog/pluginCfg.xml @@ -0,0 +1,6 @@ + + + src_flowbacklog + 稻花香流程平台待办集成 + 20241226 + diff --git a/v5/apps-customize/src/main/webapp/WEB-INF/cfgHome/plugin/src_flowbacklog/spring/spring-listener.xml b/v5/apps-customize/src/main/webapp/WEB-INF/cfgHome/plugin/src_flowbacklog/spring/spring-listener.xml new file mode 100644 index 0000000..4ed0f27 --- /dev/null +++ b/v5/apps-customize/src/main/webapp/WEB-INF/cfgHome/plugin/src_flowbacklog/spring/spring-listener.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/v5/apps-customize/src/main/webapp/WEB-INF/cfgHome/plugin/src_flowbacklog/spring/spring-sso.xml b/v5/apps-customize/src/main/webapp/WEB-INF/cfgHome/plugin/src_flowbacklog/spring/spring-sso.xml new file mode 100644 index 0000000..43fee1c --- /dev/null +++ b/v5/apps-customize/src/main/webapp/WEB-INF/cfgHome/plugin/src_flowbacklog/spring/spring-sso.xml @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + diff --git a/v5/apps-customize/src/main/webapp/WEB-INF/cfgHome/plugin/src_flowbacklog/spring/spring.xml b/v5/apps-customize/src/main/webapp/WEB-INF/cfgHome/plugin/src_flowbacklog/spring/spring.xml new file mode 100644 index 0000000..78accc9 --- /dev/null +++ b/v5/apps-customize/src/main/webapp/WEB-INF/cfgHome/plugin/src_flowbacklog/spring/spring.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/v5/apps-customize/src/main/webapp/WEB-INF/cfgHome/plugin/src_personnelflow/pluginCfg.xml b/v5/apps-customize/src/main/webapp/WEB-INF/cfgHome/plugin/src_personnelflow/pluginCfg.xml new file mode 100644 index 0000000..f8540c4 --- /dev/null +++ b/v5/apps-customize/src/main/webapp/WEB-INF/cfgHome/plugin/src_personnelflow/pluginCfg.xml @@ -0,0 +1,6 @@ + + + src_personnelflow + 稻花香流程平台人事流程处理反馈 + 20250206 + diff --git a/v5/apps-customize/src/main/webapp/WEB-INF/cfgHome/plugin/src_personnelflow/spring/spring.xml b/v5/apps-customize/src/main/webapp/WEB-INF/cfgHome/plugin/src_personnelflow/spring/spring.xml new file mode 100644 index 0000000..c41c8d3 --- /dev/null +++ b/v5/apps-customize/src/main/webapp/WEB-INF/cfgHome/plugin/src_personnelflow/spring/spring.xml @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/v5/apps-customize/src/main/webapp/WEB-INF/cfgHome/plugin/src_qyba/pluginCfg.xml b/v5/apps-customize/src/main/webapp/WEB-INF/cfgHome/plugin/src_qyba/pluginCfg.xml new file mode 100644 index 0000000..2d33e76 --- /dev/null +++ b/v5/apps-customize/src/main/webapp/WEB-INF/cfgHome/plugin/src_qyba/pluginCfg.xml @@ -0,0 +1,6 @@ + + + src_qyba + 区域备案 + 20240304 + \ No newline at end of file diff --git a/v5/apps-customize/src/main/webapp/WEB-INF/cfgHome/plugin/src_qyba/spring/spring-node.xml b/v5/apps-customize/src/main/webapp/WEB-INF/cfgHome/plugin/src_qyba/spring/spring-node.xml new file mode 100644 index 0000000..7923e9d --- /dev/null +++ b/v5/apps-customize/src/main/webapp/WEB-INF/cfgHome/plugin/src_qyba/spring/spring-node.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/v5/apps-customize/src/main/webapp/WEB-INF/cfgHome/plugin/src_qyba/spring/spring-service.xml b/v5/apps-customize/src/main/webapp/WEB-INF/cfgHome/plugin/src_qyba/spring/spring-service.xml new file mode 100644 index 0000000..7aee5ee --- /dev/null +++ b/v5/apps-customize/src/main/webapp/WEB-INF/cfgHome/plugin/src_qyba/spring/spring-service.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/v5/apps-customize/src/main/webapp/WEB-INF/cfgHome/plugin/src_qyba/spring/spring.xml b/v5/apps-customize/src/main/webapp/WEB-INF/cfgHome/plugin/src_qyba/spring/spring.xml new file mode 100644 index 0000000..e991fb0 --- /dev/null +++ b/v5/apps-customize/src/main/webapp/WEB-INF/cfgHome/plugin/src_qyba/spring/spring.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/v5/apps-customize/src/main/webapp/WEB-INF/jsp/plugin/qrCodeForm/qrCodeFormIndex.jsp b/v5/apps-customize/src/main/webapp/WEB-INF/jsp/plugin/qrCodeForm/qrCodeFormIndex.jsp new file mode 100644 index 0000000..0f620b0 --- /dev/null +++ b/v5/apps-customize/src/main/webapp/WEB-INF/jsp/plugin/qrCodeForm/qrCodeFormIndex.jsp @@ -0,0 +1,249 @@ +<%@ page contentType="text/html; charset=UTF-8" isELIgnored="false" %> +<%@ page language="java" import=" com.seeyon.apps.m3.skin.enums.M3StartPageCustomEnum" %> + + + + + <%@ include file="/WEB-INF/jsp/common/common.jsp" %> + 模板二维码生成 + + + + + +
+ + + + + + + + \ No newline at end of file diff --git a/v5/apps-customize/src/main/webapp/common/capextend/cap4/form/utils/qrcodeform/index.js b/v5/apps-customize/src/main/webapp/common/capextend/cap4/form/utils/qrcodeform/index.js new file mode 100644 index 0000000..ec27f89 --- /dev/null +++ b/v5/apps-customize/src/main/webapp/common/capextend/cap4/form/utils/qrcodeform/index.js @@ -0,0 +1,13 @@ + +csdk.event.on('formRendered', function(){ + + try { + if(cmp.href.getParam().qc = "ext") { + document.getElementById("relationBtns").style.display="none"; + document.getElementById("attachment_wrap").style.display="none"; + } + } catch(e) { + + } + +}); diff --git a/v5/apps-customize/src/main/webapp/m3/apps/v5/capextend/cap4/form/utils/qrcodeform/index.js b/v5/apps-customize/src/main/webapp/m3/apps/v5/capextend/cap4/form/utils/qrcodeform/index.js new file mode 100644 index 0000000..bc09362 --- /dev/null +++ b/v5/apps-customize/src/main/webapp/m3/apps/v5/capextend/cap4/form/utils/qrcodeform/index.js @@ -0,0 +1,11 @@ +document.addEventListener('cap_form_afterFormRender', function(evt) { + try { + if(cmp.href.getParam().qc == "ext") { + document.getElementById("relationBtns").style.display="none"; + document.getElementById("attachment_wrap").style.display="none"; + document.getElementsByClassName("cmp-button-left-iconContent btn-box2")[0].style.display="none"; + } + } catch(e) { + + } +}); \ No newline at end of file