diff --git a/.idea/compiler.xml b/.idea/compiler.xml
new file mode 100644
index 00000000..a1757ae5
--- /dev/null
+++ b/.idea/compiler.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/haojing.iml b/.idea/haojing.iml
index b4dc7173..d901a3c5 100644
--- a/.idea/haojing.iml
+++ b/.idea/haojing.iml
@@ -10,5 +10,6 @@
+
\ No newline at end of file
diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml
new file mode 100644
index 00000000..6560a989
--- /dev/null
+++ b/.idea/inspectionProfiles/Project_Default.xml
@@ -0,0 +1,36 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/classbean.xml b/.idea/libraries/classbean.xml
new file mode 100644
index 00000000..d6f55c76
--- /dev/null
+++ b/.idea/libraries/classbean.xml
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/lib.xml b/.idea/libraries/lib.xml
new file mode 100644
index 00000000..234c843d
--- /dev/null
+++ b/.idea/libraries/lib.xml
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/lib1.xml b/.idea/libraries/lib1.xml
new file mode 100644
index 00000000..c81cf24c
--- /dev/null
+++ b/.idea/libraries/lib1.xml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/com/api/dito/web/SsoLoginAction.java b/src/com/api/dito/web/SsoLoginAction.java
new file mode 100644
index 00000000..ac472912
--- /dev/null
+++ b/src/com/api/dito/web/SsoLoginAction.java
@@ -0,0 +1,12 @@
+package com.api.dito.web;
+
+
+import javax.ws.rs.Path;
+
+/**
+ * @author Lee
+ */
+@Path("/dito/ssologin/action")
+public class SsoLoginAction extends com.engine.dito.web.SsoLoginAction {
+}
+
diff --git a/src/com/engine/dito/constant/DitoConstant.java b/src/com/engine/dito/constant/DitoConstant.java
new file mode 100644
index 00000000..0ca6222b
--- /dev/null
+++ b/src/com/engine/dito/constant/DitoConstant.java
@@ -0,0 +1,40 @@
+package com.engine.dito.constant;
+
+/**
+ * @version 1.0
+ * @Title ecology-9
+ * @Company 泛微软件
+ * @CreateDate 2022/10/26
+ * @Description ${description}
+ * @Author Lee
+ */
+public class DitoConstant {
+ /**
+ * 单点登录token缓存key
+ */
+ public static final String SSO_LOGIN_ACCESS_TOKEN = "SSO_LOGIN_ACCESS_TOKEN";
+ public static final String SSO_LOGIN_USER_ACCESS_TOKEN = "USER_ACCESS_TOKEN_";
+ /**
+ * 单点登录接口返回成功状态码
+ */
+ public static final String SUCCESS_RESULT_CODE = "0";
+ /**
+ * 同步标识:0全量,1增量
+ */
+ public static final String SYNC_ALL = "0";
+ public static final String SYNC_INCREMENT = "1";
+ /**
+ * 是否有效:0有效,1无效
+ */
+ public static final String EFFECTIVE_YES = "0";
+ public static final String EFFECTIVE_NO = "1";
+ /**
+ * 0 -添加流程1 -修改流程名称(不能修改流程代码)2 -删除流程
+ */
+ public static final String ACTION_TYPE_ADD = "0";
+ public static final String ACTION_TYPE_DELETE = "2";
+ /**
+ * 同步作用:0流程推送--有其他用途可追加
+ */
+ public static final String TIME_NODE_USE_WORKFLOW_SYNC = "0";
+}
diff --git a/src/com/engine/dito/service/MobileSsoLoginService.java b/src/com/engine/dito/service/MobileSsoLoginService.java
new file mode 100644
index 00000000..9eb17ac5
--- /dev/null
+++ b/src/com/engine/dito/service/MobileSsoLoginService.java
@@ -0,0 +1,39 @@
+package com.engine.dito.service;
+
+import weaver.hrm.User;
+
+import java.util.Map;
+
+/**
+ * @version 1.0
+ * @Title ecology-9
+ * @Company 泛微软件
+ * @CreateDate 2022/10/26
+ * @Description ${description}
+ * @Author Lee
+ */
+public interface MobileSsoLoginService {
+ /**
+ * 获取应用accessToken
+ * @param paramMap
+ * @param paramUser
+ * @return
+ */
+ Map getAccessToken(Map paramMap, User paramUser);
+
+ /**
+ * 获取userAccessToken
+ * @param paramMap
+ * @param user
+ * @return
+ */
+ Map getUserAccessToken(Map paramMap, User user);
+
+ /**
+ * 获取用户信息
+ * @param paramMap
+ * @param user
+ * @return
+ */
+ Map getUserInfo(Map paramMap, User user);
+}
diff --git a/src/com/engine/dito/service/impl/MobileSsoLoginServiceImpl.java b/src/com/engine/dito/service/impl/MobileSsoLoginServiceImpl.java
new file mode 100644
index 00000000..d958aae4
--- /dev/null
+++ b/src/com/engine/dito/service/impl/MobileSsoLoginServiceImpl.java
@@ -0,0 +1,173 @@
+package com.engine.dito.service.impl;
+
+import com.alibaba.fastjson.JSONObject;
+import com.cloudstore.dev.api.util.Util_DataCache;
+import com.engine.core.impl.Service;
+import com.engine.dito.service.MobileSsoLoginService;
+import org.apache.commons.lang3.StringUtils;
+import weaver.general.BaseBean;
+import weaver.hrm.User;
+import weaver.interfaces.util.HttpUtils;
+
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.Map;
+
+import static com.engine.dito.constant.DitoConstant.*;
+
+
+/**
+ * @version 1.0
+ * @Title ecology-9
+ * @Company 泛微软件
+ * @CreateDate 2022/10/26
+ * @Description 单点登录
+ * @Author Lee
+ */
+public class MobileSsoLoginServiceImpl extends Service implements MobileSsoLoginService {
+ @Override
+ public Map getUserAccessToken(Map paramMap, User user) {
+ Map dataMap = new HashMap<>();
+ BaseBean baseBean = new BaseBean();
+ //从缓存中获取用户accessToken
+ String userAccessTokenCache = (String) Util_DataCache.getObjVal(SSO_LOGIN_USER_ACCESS_TOKEN + user.getLoginid());
+ if (returnTokenWithCache(dataMap, userAccessTokenCache)) {
+ return dataMap;
+ }
+ //请求链接地址
+ String userAccessTokenUrl = baseBean.getPropValue("weaverssologin", "userAccessTokenUrl");
+ dataMap.put("api_status", false);
+ try {
+ String authCode = (String) paramMap.get("auth_code");
+ //获取应用access_token
+ String accessToken = getAccessToken();
+ HashMap requestMap = new HashMap<>();
+ requestMap.put("auth_code", authCode);
+ requestMap.put("access_token", accessToken);
+ //请求获取用户accessToken
+ String data = HttpUtils.doPost(userAccessTokenUrl, requestMap, null);
+ JSONObject dataJson = JSONObject.parseObject(data);
+ String resultCode = dataJson.getString("resultCode");
+ JSONObject resultJson = dataJson.getJSONObject("result");
+ if (resultJson != null && SUCCESS_RESULT_CODE.equals(resultCode)) {
+ baseBean.writeLog("获取userAccessToken", resultJson.toString());
+ String userAccessToken = resultJson.getString("access_token");
+ String expiresIn = resultJson.getString("expires_in");
+ String refreshToken = resultJson.getString("refresh_token");
+ //access_token加缓存
+ Util_DataCache.setObjValWithRedis(SSO_LOGIN_ACCESS_TOKEN, refreshToken, Integer.parseInt(expiresIn));
+ Util_DataCache.setObjValWithRedis(SSO_LOGIN_USER_ACCESS_TOKEN + user.getLoginid(), userAccessToken, Integer.parseInt(expiresIn));
+ dataMap.put("api_status", true);
+ dataMap.put("data", resultJson.getInnerMap());
+ return dataMap;
+ }
+ baseBean.writeLog("获取userAccessToken失败", dataJson.toString());
+ return dataMap;
+ } catch (Exception e) {
+ baseBean.writeLog("获取userAccessToken异常", e.getMessage());
+ dataMap.put("api_status", false);
+ dataMap.put("errorMsg", e.getMessage());
+ return dataMap;
+ }
+ }
+
+ @Override
+ public Map getUserInfo(Map paramMap, User user) {
+ Map dataMap = new HashMap<>();
+ BaseBean baseBean = new BaseBean();
+ try {
+ String authCode = (String) paramMap.get("auth_code");
+ String accessToken = (String) Util_DataCache.getObjVal(SSO_LOGIN_ACCESS_TOKEN);
+ if (StringUtils.isEmpty(accessToken)) {
+ accessToken = getAccessToken();
+ }
+// String userAccessToken = (String) Util_DataCache.getObjVal(SSO_LOGIN_USER_ACCESS_TOKEN + user.getLoginid());
+ //请求链接地址
+ String userInfoUrl = baseBean.getPropValue("weaverssologin", "userInfoUrl");
+ dataMap.put("api_status", false);
+ HashMap requestMap = new HashMap<>();
+ requestMap.put("auth_code", authCode);
+ requestMap.put("access_token", accessToken);
+ String data = HttpUtils.doPost(userInfoUrl, requestMap, null);
+ JSONObject dataJson = JSONObject.parseObject(data);
+ String resultCode = dataJson.getString("resultCode");
+ JSONObject resultJson = dataJson.getJSONObject("result");
+ if (resultJson != null && SUCCESS_RESULT_CODE.equals(resultCode)) {
+ baseBean.writeLog("获取用户信息状态码:", resultCode);
+ dataMap.put("api_status", true);
+ dataMap.put("data", resultJson.getInnerMap());
+ return dataMap;
+ }
+ baseBean.writeLog("获取用户信息失败", dataJson.toString());
+ return dataMap;
+ } catch (Exception e) {
+ baseBean.writeLog("获取用户信息异常", e.getMessage());
+ dataMap.put("api_status", false);
+ dataMap.put("errorMsg", e.getMessage());
+ return dataMap;
+ }
+ }
+
+
+ @Override
+ public Map getAccessToken(Map paramMap, User paramUser) {
+ Map dataMap = new HashMap<>();
+ BaseBean baseBean = new BaseBean();
+ String accessTokenCache = (String) Util_DataCache.getObjVal(SSO_LOGIN_ACCESS_TOKEN);
+ if (returnTokenWithCache(dataMap, accessTokenCache)) {
+ return dataMap;
+ }
+ //请求链接地址
+ String accessTokenUrl = baseBean.getPropValue("weaverssologin", "accessTokenUrl");
+ String appKey = baseBean.getPropValue("weaverssologin", "appKey");
+ String appSecret = baseBean.getPropValue("weaverssologin", "appSecret");
+ dataMap.put("api_status", false);
+ try {
+ HashMap requestMap = new HashMap<>();
+ requestMap.put("appKey", appKey);
+ requestMap.put("appSecret", appSecret);
+ String data = HttpUtils.doPost(accessTokenUrl, requestMap, null);
+ JSONObject dataJson = JSONObject.parseObject(data);
+ String resultCode = dataJson.getString("resultCode");
+ JSONObject resultJson = dataJson.getJSONObject("result");
+ if (resultJson != null && SUCCESS_RESULT_CODE.equals(resultCode)) {
+ baseBean.writeLog("获取accessToken", resultJson.toString());
+ String accessToken = resultJson.getString("access_token");
+ String expiresIn = resultJson.getString("expires_in");
+ Util_DataCache.setObjValWithRedis(SSO_LOGIN_ACCESS_TOKEN, accessToken, Integer.parseInt(expiresIn));
+ dataMap.put("api_status", true);
+ dataMap.put("data", resultJson.getInnerMap());
+ return dataMap;
+ }
+ baseBean.writeLog("获取accessToken失败", dataJson.toString());
+ return dataMap;
+ } catch (Exception e) {
+ baseBean.writeLog("获取accessToken异常", e.getMessage());
+ dataMap.put("api_status", false);
+ dataMap.put("errorMsg", e.getMessage());
+ return dataMap;
+ }
+ }
+
+ private boolean returnTokenWithCache(Map dataMap, String userAccessTokenCache) {
+ if (StringUtils.isNotEmpty(userAccessTokenCache)) {
+ dataMap.put("api_status", true);
+ Map resultMap = new HashMap<>();
+ resultMap.put("access_token", userAccessTokenCache);
+ dataMap.put("data", resultMap);
+ return true;
+ }
+ return false;
+ }
+
+ private String getAccessToken() throws IOException {
+ String accessToken = (String) Util_DataCache.getObjVal(SSO_LOGIN_ACCESS_TOKEN);
+ if (StringUtils.isEmpty(accessToken)) {
+ Map accessTokenMap = getAccessToken(null, null);
+ Map data = (Map) accessTokenMap.get("data");
+ accessToken = (String) data.get("access_token");
+ }
+ return accessToken;
+ }
+
+}
diff --git a/src/com/engine/dito/web/SsoLoginAction.java b/src/com/engine/dito/web/SsoLoginAction.java
new file mode 100644
index 00000000..ecf3e792
--- /dev/null
+++ b/src/com/engine/dito/web/SsoLoginAction.java
@@ -0,0 +1,81 @@
+package com.engine.dito.web;
+
+import com.alibaba.fastjson.JSONObject;
+import com.api.projectlistdemo2.ProjectListDemoAction;
+import com.engine.common.util.ParamUtil;
+import com.engine.common.util.ServiceUtil;
+import com.engine.dito.service.MobileSsoLoginService;
+import com.engine.dito.service.impl.MobileSsoLoginServiceImpl;
+import com.engine.projectlistdemo2.service.ProjectListService;
+import com.engine.projectlistdemo2.service.impl.ProjectListServiceImpl;
+import weaver.hrm.HrmUserVarify;
+import weaver.hrm.User;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.ws.rs.GET;
+import javax.ws.rs.POST;
+import javax.ws.rs.Path;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.Context;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * @author Lee
+ */
+public class SsoLoginAction {
+ private MobileSsoLoginService getService() {
+ return ServiceUtil.getService(MobileSsoLoginServiceImpl.class);
+ }
+
+ @GET
+ @Path("/getAccessToken")
+ @Produces({"application/json"})
+ public String getAccessToken(@Context HttpServletRequest request, @Context HttpServletResponse response) {
+ Map apidatas = new HashMap<>();
+ try {
+ User user = HrmUserVarify.getUser(request, response);
+ apidatas = getService().getAccessToken(ParamUtil.request2Map(request), user);
+ } catch (Exception e) {
+ e.printStackTrace();
+ apidatas.put("api_status", false);
+ apidatas.put("api_errormsg", "catch exception : " + e.getMessage());
+ }
+ return JSONObject.toJSONString(apidatas);
+ }
+
+
+ @POST
+ @Path("/getUserAccessToken")
+ @Produces({"application/json"})
+ public String getUserAccessToken(@Context HttpServletRequest request, @Context HttpServletResponse response) {
+ Map apidatas = new HashMap<>();
+ try {
+ User user = HrmUserVarify.getUser(request, response);
+ apidatas = getService().getUserAccessToken(ParamUtil.request2Map(request), user);
+ } catch (Exception e) {
+ e.printStackTrace();
+ apidatas.put("api_status", false);
+ apidatas.put("api_errormsg", "catch exception : " + e.getMessage());
+ }
+ return JSONObject.toJSONString(apidatas);
+ }
+
+ @POST
+ @Path("/getUserInfo")
+ @Produces({"application/json"})
+ public String getUserInfo(@Context HttpServletRequest request, @Context HttpServletResponse response) {
+ Map apidatas = new HashMap<>();
+ try {
+ User user = HrmUserVarify.getUser(request, response);
+ apidatas = getService().getUserInfo(ParamUtil.request2Map(request), user);
+ } catch (Exception e) {
+ e.printStackTrace();
+ apidatas.put("api_status", false);
+ apidatas.put("api_errormsg", "catch exception : " + e.getMessage());
+ }
+ return JSONObject.toJSONString(apidatas);
+ }
+}
+
diff --git a/src/weaver/interfaces/job/WorkflowSyncCronJob.java b/src/weaver/interfaces/job/WorkflowSyncCronJob.java
new file mode 100644
index 00000000..38e4603f
--- /dev/null
+++ b/src/weaver/interfaces/job/WorkflowSyncCronJob.java
@@ -0,0 +1,202 @@
+package weaver.interfaces.job;
+
+import org.apache.commons.collections4.CollectionUtils;
+import org.apache.commons.lang.StringUtils;
+import weaver.conn.RecordSet;
+import weaver.general.BaseBean;
+import weaver.general.TimeUtil;
+import weaver.interfaces.schedule.BaseCronJob;
+import weaver.interfaces.util.HttpUtils;
+
+import java.util.*;
+
+import static com.engine.dito.constant.DitoConstant.*;
+
+/**
+ * @version 1.0
+ * @Title ecology-9
+ * @Company 泛微软件
+ * @CreateDate 2022/10/27
+ * @Description 新建流程推送门(包含发起人权限)
+ * @Author Lee
+ */
+public class WorkflowSyncCronJob extends BaseCronJob {
+ /**
+ * 推送类型(0全量、1增量)
+ */
+ private String syncType;
+
+ @Override
+ public void execute() {
+ BaseBean bb = new BaseBean();
+ bb.writeLog("开始推送流程");
+ try {
+ //推送流程url
+ String synchronizeFlowUrl = bb.getPropValue("PORTAL_INFO", "synchronizeFlowUrl");
+ //同步人员权限url
+ String synchronizeUserUrl = bb.getPropValue("PORTAL_INFO", "synchronizeUserUrl");
+ //新建流程推送到目录code
+ String catalogueCode = bb.getPropValue("PORTAL_INFO", "catalogueCode");
+ String workflowAuthTable = bb.getPropValue("PORTAL_INFO", "workflowAuthTable");
+ String timeNodeTable = bb.getPropValue("PORTAL_INFO", "timeNodeTable");
+ String accountName = bb.getPropValue("PORTAL_INFO", "accountName");
+ String password = bb.getPropValue("PORTAL_INFO", "password");
+ String timeNodeFormModeId = bb.getPropValue("PORTAL_INFO", "timeNodeFormModeId");
+ //全量同步使用全量同步方法
+ if (SYNC_ALL.equals(syncType)) {
+ String currentTime = TimeUtil.getCurrentTimeString();
+ allSynchronizeWorkflow(bb, synchronizeFlowUrl, synchronizeUserUrl, catalogueCode, workflowAuthTable, accountName, password);
+ writeTimeNode(timeNodeTable, currentTime, SYNC_ALL, TIME_NODE_USE_WORKFLOW_SYNC, timeNodeFormModeId);
+ }
+ //增量同步使用增量同步方法
+ if (SYNC_INCREMENT.equals(syncType)) {
+ String currentTime = TimeUtil.getCurrentTimeString();
+ IncrementSynchronizeWorkflow(bb, synchronizeFlowUrl, synchronizeUserUrl, catalogueCode, workflowAuthTable, timeNodeTable, accountName, password);
+ writeTimeNode(timeNodeTable, currentTime, SYNC_INCREMENT, TIME_NODE_USE_WORKFLOW_SYNC, timeNodeFormModeId);
+ }
+
+ } catch (Exception e) {
+ bb.writeLog("流程推送异常", e.getMessage());
+ }
+ }
+
+ private void IncrementSynchronizeWorkflow(BaseBean bb, String synchronizeFlowUrl, String synchronizeUserUrl, String cataCode, String workflowAuthTable, String timeNodeTable, String accountName, String password) {
+ RecordSet recordSet = new RecordSet();
+ //查询时间节点表,上次流程推送增量同步的时间
+ String timeSql = "select tbsj from " + timeNodeTable + " where tblx=? and zy=? order by tbsj desc";
+ recordSet.executeQuery(timeSql, SYNC_INCREMENT, TIME_NODE_USE_WORKFLOW_SYNC);
+ String preTime = "";
+ if (recordSet.next()) {
+ preTime = recordSet.getString("tbsj");
+ }
+ syncWorkflowByCondition(bb, synchronizeFlowUrl, synchronizeUserUrl, cataCode, workflowAuthTable, accountName, password, preTime);
+ }
+
+ // 全量同步
+ private void allSynchronizeWorkflow(BaseBean bb, String synchronizeFlowUrl, String synchronizeUserUrl, String cataCode, String workflowAuthTable, String accountName, String password) {
+ syncWorkflowByCondition(bb, synchronizeFlowUrl, synchronizeUserUrl, cataCode, workflowAuthTable, accountName, password, null);
+ }
+
+ /**
+ * 根据不同条件请求同步方法
+ */
+ private void syncWorkflowByCondition(BaseBean bb, String synchronizeFlowUrl, String synchronizeUserUrl, String cataCode, String workflowAuthTable, String accountName, String password, String timeCondition) {
+ RecordSet recordSet = new RecordSet();
+ ArrayList