Преглед изворни кода

修改钉钉,微信,WeLink同步的说明

zhourui пре 5 година
родитељ
комит
daa347720e

+ 1 - 1
o2server/x_base_core_project/src/main/java/com/x/base/core/project/config/Dingding.java

@@ -31,7 +31,7 @@ public class Dingding extends ConfigObject {
 	@FieldDescribe("应用的密钥")
 	private String appSecret;
 
-	@FieldDescribe("组织同步cron,默认每10分钟同步一次.")
+	@FieldDescribe("回调信号触发同步检查,默认每10分钟运行一次,如果期间内有钉钉回调信号接收到,那么触发同步任务进行人员同步.")
 	private String syncCron;
 
 	@FieldDescribe("强制拉入同步cron,默认在每天的8点和12点强制进行同步.")

Разлика између датотеке није приказан због своје велике величине
+ 2 - 4
o2server/x_base_core_project/src/main/java/com/x/base/core/project/config/Qiyeweixin.java


+ 214 - 217
o2server/x_base_core_project/src/main/java/com/x/base/core/project/config/WeLink.java

@@ -10,231 +10,228 @@ import java.util.Calendar;
 import java.util.Date;
 
 /**
- * Created by fancyLou on 2020-07-24.
- * Copyright © 2020 O2. All rights reserved.
+ * Created by fancyLou on 2020-07-24. Copyright © 2020 O2. All rights reserved.
  */
 public class WeLink extends ConfigObject {
 
-    @FieldDescribe("是否启用")
-    private Boolean enable;
+	@FieldDescribe("是否启用")
+	private Boolean enable;
 
-    @FieldDescribe("WeLink应用的client_id")
-    private String clientId;
+	@FieldDescribe("WeLink应用的client_id")
+	private String clientId;
 
-    @FieldDescribe("WeLink应用的client_secret")
-    private String clientSecret;
+	@FieldDescribe("WeLink应用的client_secret")
+	private String clientSecret;
 
+	@FieldDescribe("回调信号触发同步检查,默认每10分钟运行一次,如果期间内有WeLink回调信号接收到,那么触发同步任务进行人员同步.")
+	private String syncCron;
 
-    @FieldDescribe("组织同步cron,默认每10分钟同步一次.")
-    private String syncCron;
+	@FieldDescribe("强制拉入同步cron,默认在每天的8点和12点强制进行同步.")
+	private String forceSyncCron;
 
-    @FieldDescribe("强制拉入同步cron,默认在每天的8点和12点强制进行同步.")
-    private String forceSyncCron;
+	@FieldDescribe("WeLink api服务器地址")
+	private String oapiAddress;
 
-    @FieldDescribe("WeLink api服务器地址")
-    private String oapiAddress;
+	@FieldDescribe("是否启用消息推送")
+	private Boolean messageEnable;
 
-    @FieldDescribe("是否启用消息推送")
-    private Boolean messageEnable;
-
-    @FieldDescribe("WeLink消息打开工作的url地址,如:http://dev.o2oa.net/x_desktop/")
-    private String workUrl = "";
-
-    @FieldDescribe("WeLink消息处理完成后跳转到特定的门户页面的Id")
-    private String messageRedirectPortal = "";
-
-
-
-    public static WeLink defaultInstance() {
-        return new WeLink();
-    }
-
-    public static final Boolean default_enable = false;
-    public static final String default_clientId = "";
-    public static final String default_clientSecret = "";
-    public static final String default_syncCron = "10 0/10 * * * ?";
-    public static final String default_forceSyncCron = "10 45 8,12 * * ?";
-    public static final String default_oapiAddress = "https://open.welink.huaweicloud.com/api";
-    public static final Boolean default_messageEnable = false;
-    public static final String default_workUrl = "";
-    public static final String default_messageRedirectPortal = "";
-
-
-    public WeLink() {
-        this.enable = default_enable;
-        this.clientId = default_clientId;
-        this.clientSecret = default_clientSecret;
-        this.syncCron = default_syncCron;
-        this.forceSyncCron = default_forceSyncCron;
-        this.oapiAddress = default_oapiAddress;
-        this.messageEnable = default_messageEnable;
-        this.workUrl = default_workUrl;
-        this.messageRedirectPortal = default_messageRedirectPortal;
-    }
-
-    public static String WeLink_Auth_Head_Key = "x-wlk-Authorization";
-
-    private static String cachedAccessToken;
-    private static Date cachedAccessTokenDate;
-
-    public static class AccessTokenReq {
-       private String client_id;
-       private String client_secret;
-
-        public String getClient_id() {
-            return client_id;
-        }
-
-        public void setClient_id(String client_id) {
-            this.client_id = client_id;
-        }
-
-        public String getClient_secret() {
-            return client_secret;
-        }
-
-        public void setClient_secret(String client_secret) {
-            this.client_secret = client_secret;
-        }
-    }
-    public static class AccessTokenResp {
-
-        private String access_token;
-        private String code;
-        private String message;
-        private Integer expires_in;
-
-        public String getAccess_token() {
-            return access_token;
-        }
-
-        public void setAccess_token(String access_token) {
-            this.access_token = access_token;
-        }
-
-        public String getCode() {
-            return code;
-        }
-
-        public void setCode(String code) {
-            this.code = code;
-        }
-
-        public String getMessage() {
-            return message;
-        }
-
-        public void setMessage(String message) {
-            this.message = message;
-        }
-
-        public Integer getExpires_in() {
-            return expires_in;
-        }
-
-        public void setExpires_in(Integer expires_in) {
-            this.expires_in = expires_in;
-        }
-    }
-
-    /**
-     * 获取WeLink AccessToken
-     * @return
-     * @throws Exception
-     */
-    public String accessToken() throws Exception {
-        if ((StringUtils.isNotEmpty(cachedAccessToken) && (null != cachedAccessTokenDate))
-                && (cachedAccessTokenDate.after(new Date()))) {
-            return cachedAccessToken;
-        } else {
-            String address = this.getOapiAddress() + "/auth/v2/tickets";
-            AccessTokenReq req = new AccessTokenReq();
-            req.setClient_id(this.getClientId());
-            req.setClient_secret(this.getClientSecret());
-            AccessTokenResp resp = HttpConnection.postAsObject(address, null, XGsonBuilder.instance().toJson(req), AccessTokenResp.class);
-            if (!resp.getCode().equals("0")) {
-                throw new ExceptionWeLinkAccessToken(resp.getCode(), resp.getMessage());
-            }
-            cachedAccessToken = resp.getAccess_token();
-            Integer second = resp.expires_in;//过期时间 秒
-            Calendar cal = Calendar.getInstance();
-            cal.add(Calendar.SECOND, (second - 300));
-            cachedAccessTokenDate = cal.getTime();
-            return cachedAccessToken;
-        }
-    }
-
-
-
-    public Boolean getEnable() {
-        return BooleanUtils.isTrue(this.enable);
-    }
-
-    public void setEnable(Boolean enable) {
-        this.enable = enable;
-    }
-
-    public String getClientId() {
-        return StringUtils.isEmpty(this.clientId) ? default_clientId : this.clientId;
-    }
-
-    public void setClientId(String clientId) {
-        this.clientId = clientId;
-    }
-
-    public String getClientSecret() {
-        return StringUtils.isEmpty(this.clientSecret) ? default_clientSecret : this.clientSecret;
-    }
-
-    public void setClientSecret(String clientSecret) {
-        this.clientSecret = clientSecret;
-    }
-
-    public String getSyncCron() {
-        return StringUtils.isEmpty(this.syncCron) ? default_syncCron : this.syncCron;
-    }
-
-    public void setSyncCron(String syncCron) {
-        this.syncCron = syncCron;
-    }
-
-    public String getForceSyncCron() {
-        return StringUtils.isEmpty(this.forceSyncCron) ? default_forceSyncCron : this.forceSyncCron;
-    }
-
-    public void setForceSyncCron(String forceSyncCron) {
-        this.forceSyncCron = forceSyncCron;
-    }
-
-    public String getOapiAddress() {
-        return StringUtils.isEmpty(this.oapiAddress) ? default_oapiAddress : this.oapiAddress;
-    }
-
-    public void setOapiAddress(String oapiAddress) {
-        this.oapiAddress = oapiAddress;
-    }
-
-    public Boolean getMessageEnable() {
-        return BooleanUtils.isTrue(this.messageEnable);
-    }
-
-    public void setMessageEnable(Boolean messageEnable) {
-        this.messageEnable = messageEnable;
-    }
-
-    public String getWorkUrl() {
-        return StringUtils.isEmpty(this.workUrl) ? default_workUrl : this.workUrl;
-    }
-
-    public void setWorkUrl(String workUrl) {
-        this.workUrl = workUrl;
-    }
-
-    public String getMessageRedirectPortal() {
-        return StringUtils.isEmpty(this.messageRedirectPortal) ? default_messageRedirectPortal : this.messageRedirectPortal;
-    }
-
-    public void setMessageRedirectPortal(String messageRedirectPortal) {
-        this.messageRedirectPortal = messageRedirectPortal;
-    }
+	@FieldDescribe("WeLink消息打开工作的url地址,如:http://dev.o2oa.net/x_desktop/")
+	private String workUrl = "";
+
+	@FieldDescribe("WeLink消息处理完成后跳转到特定的门户页面的Id")
+	private String messageRedirectPortal = "";
+
+	public static WeLink defaultInstance() {
+		return new WeLink();
+	}
+
+	public static final Boolean default_enable = false;
+	public static final String default_clientId = "";
+	public static final String default_clientSecret = "";
+	public static final String default_syncCron = "10 0/10 * * * ?";
+	public static final String default_forceSyncCron = "10 45 8,12 * * ?";
+	public static final String default_oapiAddress = "https://open.welink.huaweicloud.com/api";
+	public static final Boolean default_messageEnable = false;
+	public static final String default_workUrl = "";
+	public static final String default_messageRedirectPortal = "";
+
+	public WeLink() {
+		this.enable = default_enable;
+		this.clientId = default_clientId;
+		this.clientSecret = default_clientSecret;
+		this.syncCron = default_syncCron;
+		this.forceSyncCron = default_forceSyncCron;
+		this.oapiAddress = default_oapiAddress;
+		this.messageEnable = default_messageEnable;
+		this.workUrl = default_workUrl;
+		this.messageRedirectPortal = default_messageRedirectPortal;
+	}
+
+	public static String WeLink_Auth_Head_Key = "x-wlk-Authorization";
+
+	private static String cachedAccessToken;
+	private static Date cachedAccessTokenDate;
+
+	public static class AccessTokenReq {
+		private String client_id;
+		private String client_secret;
+
+		public String getClient_id() {
+			return client_id;
+		}
+
+		public void setClient_id(String client_id) {
+			this.client_id = client_id;
+		}
+
+		public String getClient_secret() {
+			return client_secret;
+		}
+
+		public void setClient_secret(String client_secret) {
+			this.client_secret = client_secret;
+		}
+	}
+
+	public static class AccessTokenResp {
+
+		private String access_token;
+		private String code;
+		private String message;
+		private Integer expires_in;
+
+		public String getAccess_token() {
+			return access_token;
+		}
+
+		public void setAccess_token(String access_token) {
+			this.access_token = access_token;
+		}
+
+		public String getCode() {
+			return code;
+		}
+
+		public void setCode(String code) {
+			this.code = code;
+		}
+
+		public String getMessage() {
+			return message;
+		}
+
+		public void setMessage(String message) {
+			this.message = message;
+		}
+
+		public Integer getExpires_in() {
+			return expires_in;
+		}
+
+		public void setExpires_in(Integer expires_in) {
+			this.expires_in = expires_in;
+		}
+	}
+
+	/**
+	 * 获取WeLink AccessToken
+	 * 
+	 * @return
+	 * @throws Exception
+	 */
+	public String accessToken() throws Exception {
+		if ((StringUtils.isNotEmpty(cachedAccessToken) && (null != cachedAccessTokenDate))
+				&& (cachedAccessTokenDate.after(new Date()))) {
+			return cachedAccessToken;
+		} else {
+			String address = this.getOapiAddress() + "/auth/v2/tickets";
+			AccessTokenReq req = new AccessTokenReq();
+			req.setClient_id(this.getClientId());
+			req.setClient_secret(this.getClientSecret());
+			AccessTokenResp resp = HttpConnection.postAsObject(address, null, XGsonBuilder.instance().toJson(req),
+					AccessTokenResp.class);
+			if (!resp.getCode().equals("0")) {
+				throw new ExceptionWeLinkAccessToken(resp.getCode(), resp.getMessage());
+			}
+			cachedAccessToken = resp.getAccess_token();
+			Integer second = resp.expires_in;// 过期时间 秒
+			Calendar cal = Calendar.getInstance();
+			cal.add(Calendar.SECOND, (second - 300));
+			cachedAccessTokenDate = cal.getTime();
+			return cachedAccessToken;
+		}
+	}
+
+	public Boolean getEnable() {
+		return BooleanUtils.isTrue(this.enable);
+	}
+
+	public void setEnable(Boolean enable) {
+		this.enable = enable;
+	}
+
+	public String getClientId() {
+		return StringUtils.isEmpty(this.clientId) ? default_clientId : this.clientId;
+	}
+
+	public void setClientId(String clientId) {
+		this.clientId = clientId;
+	}
+
+	public String getClientSecret() {
+		return StringUtils.isEmpty(this.clientSecret) ? default_clientSecret : this.clientSecret;
+	}
+
+	public void setClientSecret(String clientSecret) {
+		this.clientSecret = clientSecret;
+	}
+
+	public String getSyncCron() {
+		return StringUtils.isEmpty(this.syncCron) ? default_syncCron : this.syncCron;
+	}
+
+	public void setSyncCron(String syncCron) {
+		this.syncCron = syncCron;
+	}
+
+	public String getForceSyncCron() {
+		return StringUtils.isEmpty(this.forceSyncCron) ? default_forceSyncCron : this.forceSyncCron;
+	}
+
+	public void setForceSyncCron(String forceSyncCron) {
+		this.forceSyncCron = forceSyncCron;
+	}
+
+	public String getOapiAddress() {
+		return StringUtils.isEmpty(this.oapiAddress) ? default_oapiAddress : this.oapiAddress;
+	}
+
+	public void setOapiAddress(String oapiAddress) {
+		this.oapiAddress = oapiAddress;
+	}
+
+	public Boolean getMessageEnable() {
+		return BooleanUtils.isTrue(this.messageEnable);
+	}
+
+	public void setMessageEnable(Boolean messageEnable) {
+		this.messageEnable = messageEnable;
+	}
+
+	public String getWorkUrl() {
+		return StringUtils.isEmpty(this.workUrl) ? default_workUrl : this.workUrl;
+	}
+
+	public void setWorkUrl(String workUrl) {
+		this.workUrl = workUrl;
+	}
+
+	public String getMessageRedirectPortal() {
+		return StringUtils.isEmpty(this.messageRedirectPortal) ? default_messageRedirectPortal
+				: this.messageRedirectPortal;
+	}
+
+	public void setMessageRedirectPortal(String messageRedirectPortal) {
+		this.messageRedirectPortal = messageRedirectPortal;
+	}
 }

+ 1 - 1
o2server/x_base_core_project/src/main/java/com/x/base/core/project/config/ZhengwuDingding.java

@@ -22,7 +22,7 @@ public class ZhengwuDingding extends ConfigObject {
 	private String appSecret;
 	@FieldDescribe("政务钉钉agentId")
 	private String agentId;
-	@FieldDescribe("拉入同步cron,默认每10分钟同步一次.")
+	@FieldDescribe("回调信号触发同步检查,默认每10分钟运行一次,如果期间内有政务钉钉回调信号接收到,那么触发同步任务进行人员同步.")
 	private String syncCron;
 	@FieldDescribe("强制拉入同步cron,默认在每天的8点和12点强制进行同步.")
 	private String forceSyncCron;

+ 9 - 0
o2server/x_organization_assemble_authentication/src/main/java/com/x/organization/assemble/authentication/jaxrs/oauth/ActionToken.java

@@ -52,6 +52,15 @@ class ActionToken extends StandardJaxrsAction {
 	public static class WoToken extends GsonPropertyObject {
 		private String access_token;
 		private Integer expires_in;
+		private String token_type = "bearer";
+
+		public String getToken_type() {
+			return token_type;
+		}
+
+		public void setToken_type(String token_type) {
+			this.token_type = token_type;
+		}
 
 		public String getAccess_token() {
 			return access_token;

+ 2 - 3
o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/read/ActionCreateWithWork.java

@@ -1,12 +1,12 @@
 package com.x.processplatform.assemble.surface.jaxrs.read;
 
-import java.net.URLEncoder;
 import java.util.ArrayList;
 import java.util.List;
 
 import com.google.gson.JsonElement;
 import com.x.base.core.container.EntityManagerContainer;
 import com.x.base.core.container.factory.EntityManagerContainerFactory;
+import com.x.base.core.project.Applications;
 import com.x.base.core.project.x_processplatform_service_processing;
 import com.x.base.core.project.annotation.FieldDescribe;
 import com.x.base.core.project.exception.ExceptionAccessDenied;
@@ -15,7 +15,6 @@ import com.x.base.core.project.gson.GsonPropertyObject;
 import com.x.base.core.project.http.ActionResult;
 import com.x.base.core.project.http.EffectivePerson;
 import com.x.base.core.project.jaxrs.WoId;
-import com.x.base.core.project.tools.DefaultCharset;
 import com.x.base.core.project.tools.ListTools;
 import com.x.processplatform.assemble.surface.Business;
 import com.x.processplatform.assemble.surface.ThisApplication;
@@ -49,7 +48,7 @@ class ActionCreateWithWork extends BaseAction {
 
 		List<Wo> wos = ThisApplication.context().applications()
 				.postQuery(effectivePerson.getDebugger(), x_processplatform_service_processing.class,
-						"read/work/" + URLEncoder.encode(work.getId(), DefaultCharset.name), wi, work.getJob())
+						Applications.joinQueryUri("read", "work", work.getId()), wi, work.getJob())
 				.getDataAsList(Wo.class);
 		result.setData(wos);
 		return result;

Неке датотеке нису приказане због велике количине промена