commit e8e6c7efb14c91189f63eca032759c8dbf2611e6 Author: pioneer Date: Tue Nov 29 16:44:36 2022 +0800 open diff --git a/README.md b/README.md new file mode 100644 index 0000000..2b14d34 --- /dev/null +++ b/README.md @@ -0,0 +1,6 @@ +# open-JSD-10220 + +JSD-10220 总公司和子公司共用一个bi系统,但是需要集成多个消息推送平台\ +免责说明:该源码为第三方爱好者提供,不保证源码和方案的可靠性,也不提供任何形式的源码教学指导和协助!\ +仅作为开发者学习参考使用!禁止用于任何商业用途!\ +为保护开发者隐私,开发者信息已隐去!若原开发者希望公开自己的信息,可联系【pioneer】处理。 \ No newline at end of file diff --git a/lib/finekit-10.0-20220427.jar b/lib/finekit-10.0-20220427.jar new file mode 100644 index 0000000..6793f18 Binary files /dev/null and b/lib/finekit-10.0-20220427.jar differ diff --git a/lib/httpasyncclient-4.1.4.jar b/lib/httpasyncclient-4.1.4.jar new file mode 100644 index 0000000..e6b3b29 Binary files /dev/null and b/lib/httpasyncclient-4.1.4.jar differ diff --git a/lib/httpclient-4.5.jar b/lib/httpclient-4.5.jar new file mode 100644 index 0000000..970c989 Binary files /dev/null and b/lib/httpclient-4.5.jar differ diff --git a/lib/httpclient-cache-4.5.jar b/lib/httpclient-cache-4.5.jar new file mode 100644 index 0000000..5540226 Binary files /dev/null and b/lib/httpclient-cache-4.5.jar differ diff --git a/lib/httpcore-4.4.9.jar b/lib/httpcore-4.4.9.jar new file mode 100644 index 0000000..cddba28 Binary files /dev/null and b/lib/httpcore-4.4.9.jar differ diff --git a/lib/httpcore-nio-4.4.9.jar b/lib/httpcore-nio-4.4.9.jar new file mode 100644 index 0000000..00b3444 Binary files /dev/null and b/lib/httpcore-nio-4.4.9.jar differ diff --git a/lib/httpmime-4.5.jar b/lib/httpmime-4.5.jar new file mode 100644 index 0000000..b631ceb Binary files /dev/null and b/lib/httpmime-4.5.jar differ diff --git a/lib/json-20090211.jar b/lib/json-20090211.jar new file mode 100644 index 0000000..ef29094 Binary files /dev/null and b/lib/json-20090211.jar differ diff --git a/lib/unirest-java-1.4.9.jar b/lib/unirest-java-1.4.9.jar new file mode 100644 index 0000000..59bb357 Binary files /dev/null and b/lib/unirest-java-1.4.9.jar differ diff --git a/plugin.xml b/plugin.xml new file mode 100644 index 0000000..1c1d741 --- /dev/null +++ b/plugin.xml @@ -0,0 +1,51 @@ + + + com.fr.plugin.yituan + + yes + 1.3.8 + 10.0 + 2019-03-10 + fr.open + + + + [2020-04-08]项目启动

+

[2021-11-08]支持多企业

+

[2022-6-01]支持pc登录

+

[2022-6-10]支持多企业

+ ]]> +
+ com.fr.plugin.yt + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ diff --git a/src/main/java/com/fr/plugin/beans/MyAgentBean.java b/src/main/java/com/fr/plugin/beans/MyAgentBean.java new file mode 100644 index 0000000..ddb61d5 --- /dev/null +++ b/src/main/java/com/fr/plugin/beans/MyAgentBean.java @@ -0,0 +1,95 @@ +package com.fr.plugin.beans; + +import com.fr.general.ComparatorUtils; +import com.fr.json.JSONException; +import com.fr.json.JSONObject; +import com.fr.plugin.entitys.YTAgentEntity; +import com.fr.stable.db.data.BaseDataRecord; + +import java.io.Serializable; + +public class MyAgentBean extends BaseDataRecord implements Serializable { + private String agentName; + private String teamId; + private String groupId; + private String clientId; + private String secret; + private int type; + private long timeStamp; + + public YTAgentEntity createEntity(YTAgentEntity var1) { + var1.setId(this.getId()); + var1.setAgentName(this.agentName); + var1.setAgentId(this.groupId); + var1.setCorpId(this.clientId); + var1.setSecret(this.secret); + var1.setType(this.type); + var1.setTimeStamp(this.timeStamp); + return var1; + } + + private boolean isAgentTypeValidate() { + return ComparatorUtils.equals(this.type, 2); + } + + + public String getAgentName() { + return this.agentName; + } + + public void setAgentName(String var1) { + this.agentName = var1; + } + + public String getGroupId() { + return this.groupId; + } + + public void setGroupId(String var1) { + this.groupId = var1; + } + + public String getClientId() { + return this.clientId; + } + + public void setClientId(String var1) { + this.clientId = var1; + } + + public String getSecret() { + return this.secret; + } + + public void setSecret(String var1) { + this.secret = var1; + } + + public int getType() { + return this.type; + } + + public void setType(int var1) { + this.type = var1; + } + + public long getTimeStamp() { + return this.timeStamp; + } + + public void setTimeStamp(long var1) { + this.timeStamp = var1; + } + + + public JSONObject toJSONObject() throws JSONException { + JSONObject var1 = JSONObject.create(); + var1.put("id", this.getId()); + var1.put("agentName", this.agentName); + var1.put("agentId", this.groupId); + var1.put("corpId", this.clientId); + var1.put("secret", this.secret); + var1.put("type", this.type); + return var1; + } +} diff --git a/src/main/java/com/fr/plugin/beans/MyDepBean.java b/src/main/java/com/fr/plugin/beans/MyDepBean.java new file mode 100644 index 0000000..2c27a2f --- /dev/null +++ b/src/main/java/com/fr/plugin/beans/MyDepBean.java @@ -0,0 +1,90 @@ +package com.fr.plugin.beans; + +import com.fr.json.JSONArray; +import com.fr.json.JSONException; +import com.fr.json.JSONObject; +import com.fr.plugin.entitys.YtDepEntity; + +import java.io.Serializable; + + +public class MyDepBean implements Serializable { + private String name; + private String depName; + private String id; + private int order; + private String parentId; + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getDepName() { + return depName; + } + + public void setDepName(String depName) { + this.depName = depName; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public int getOrder() { + return order; + } + + public void setOrder(int order) { + this.order = order; + } + + public String getParentId() { + return parentId; + } + + public void setParentId(String parentId) { + this.parentId = parentId; + } + public JSONObject createJSONConfig() throws JSONException { + JSONObject var1 = JSONObject.create(); + var1.put("id", this.getId()); + var1.put("text", this.getName()); + var1.put("pId", this.getParentId()); + var1.put("value", this.getDepName()); + return var1; + } + @Override + public String toString() { + return "MyDepBean{" + + "name='" + name + '\'' + + ", depName='" + depName + '\'' + + ", id='" + id + '\'' + + ", order=" + order + + ", parentId='" + parentId + '\'' + + '}'; + } + + public JSONArray generateDepartmentTree() { + return null; + } + + public YtDepEntity createEntity(){ + YtDepEntity bean=new YtDepEntity(); + bean.setDepName(this.depName); + bean.setId(this.getId()); + bean.setName(this.name); + bean.setParentId(this.parentId); + bean.setTop1(this.order); + return bean; + } + +} diff --git a/src/main/java/com/fr/plugin/beans/MyGroupBean.java b/src/main/java/com/fr/plugin/beans/MyGroupBean.java new file mode 100644 index 0000000..fca79d9 --- /dev/null +++ b/src/main/java/com/fr/plugin/beans/MyGroupBean.java @@ -0,0 +1,59 @@ +package com.fr.plugin.beans; + +import com.fr.json.JSONArray; +import com.fr.json.JSONException; +import com.fr.json.JSONObject; +import com.fr.plugin.entitys.YtDepEntity; + +import java.io.Serializable; + + +public class MyGroupBean implements Serializable { + private String name; + private String groupId; + private String id; + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getGroupId() { + return groupId; + } + + public void setGroupId(String groupId) { + this.groupId = groupId; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public JSONObject createJSONConfig() throws JSONException { + JSONObject var1 = JSONObject.create(); + var1.put("id", this.getGroupId()); + var1.put("text", this.getName()); + return var1; + } + + + public JSONArray generateDepartmentTree() { + return null; + } + + public YtDepEntity createEntity(){ + YtDepEntity bean=new YtDepEntity(); + bean.setName(this.name); + bean.setId(this.getId()); + bean.setName(this.name); + return bean; + } + +} diff --git a/src/main/java/com/fr/plugin/beans/MyUserBean.java b/src/main/java/com/fr/plugin/beans/MyUserBean.java new file mode 100644 index 0000000..adcde44 --- /dev/null +++ b/src/main/java/com/fr/plugin/beans/MyUserBean.java @@ -0,0 +1,128 @@ +package com.fr.plugin.beans; + +import com.fr.json.JSONObject; +import com.fr.plugin.entitys.YTUserEntity; +import com.fr.stable.db.data.BaseDataRecord; +import com.fr.third.fasterxml.jackson.annotation.JsonSubTypes; + +import java.io.Serializable; + +@JsonSubTypes.Type( + value = MyUserBean.class, + name = "UserBean" +) +public class MyUserBean extends BaseDataRecord implements Serializable { + + private String openId; + private String name; + private String photoUrl; + private String phone; + private String jobNo; + private String department; + private int status; + private String fsUserName; + + public String getFsUserName() { + return fsUserName; + } + + public void setFsUserName(String fsUserName) { + this.fsUserName = fsUserName; + } + + public YTUserEntity createEntity() { + YTUserEntity var1=new YTUserEntity(); + var1.setId(this.getOpenId()); + var1.setStatus(this.getStatus()); + var1.setPhotoUrl(this.getPhotoUrl()); + var1.setJobNo(this.jobNo); + var1.setPhone(this.phone); + var1.setName(this.name); + var1.setDepartment(this.department); + var1.setStatus(this.status); + var1.setOpenId(this.openId); + var1.setFsUserName(this.fsUserName); + return var1; + } + + public String getPhone() { + return phone; + } + + public void setPhone(String phone) { + this.phone = phone; + } + + public String getOpenId() { + return openId; + } + + public void setOpenId(String openId) { + this.openId = openId; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getPhotoUrl() { + return photoUrl; + } + + public void setPhotoUrl(String photoUrl) { + this.photoUrl = photoUrl; + } + + public String getJobNo() { + return jobNo; + } + + public void setJobNo(String jobNo) { + this.jobNo = jobNo; + } + + public String getDepartment() { + return department; + } + + public void setDepartment(String department) { + this.department = department; + } + + public int getStatus() { + return status; + } + + public void setStatus(int status) { + this.status = status; + } + + public JSONObject createJSONConfig() { + JSONObject var1 = JSONObject.create(); + var1.put("id", this.getId()); + var1.put("name", this.getName()); + var1.put("phone", this.getPhone()); + var1.put("fsUserName",fsUserName); + return var1; + } + + @Override + public String toString() { + return "MyUserBean{" + + "openId='" + openId + '\'' + + ", name='" + name + '\'' + + ", photoUrl='" + photoUrl + '\'' + + ", phone='" + phone + '\'' + + ", jobNo='" + jobNo + '\'' + + ", department='" + department + '\'' + + ", status=" + status + + ", fsUserName='" + fsUserName + '\'' + + '}'; + } + + +} diff --git a/src/main/java/com/fr/plugin/beans/MyYituanBean.java b/src/main/java/com/fr/plugin/beans/MyYituanBean.java new file mode 100644 index 0000000..8def9d1 --- /dev/null +++ b/src/main/java/com/fr/plugin/beans/MyYituanBean.java @@ -0,0 +1,102 @@ +package com.fr.plugin.beans; + +import com.fr.general.ComparatorUtils; +import com.fr.json.JSONException; +import com.fr.json.JSONObject; +import com.fr.plugin.entitys.YTYiTuanEntity; +import com.fr.stable.db.data.BaseDataRecord; + +import java.io.Serializable; + +public class MyYituanBean extends BaseDataRecord implements Serializable { + private String agentName; + private String teamId; + private String groupId; + private String clientId; + private String secret; + private int type; + private long timeStamp; + + public YTYiTuanEntity createEntity(YTYiTuanEntity yiTuanEntity) { + yiTuanEntity.setId(this.getId()); + yiTuanEntity.setAgentName(this.agentName); + yiTuanEntity.setGroupId(this.groupId); + yiTuanEntity.setTeamId(this.teamId); + yiTuanEntity.setClientId(this.clientId); + yiTuanEntity.setSecret(this.secret); + return yiTuanEntity; + } + + public String getTeamId() { + return teamId; + } + + public void setTeamId(String teamId) { + this.teamId = teamId; + } + + private boolean isAgentTypeValidate() { + return ComparatorUtils.equals(this.type, 2); + } + + + public String getAgentName() { + return this.agentName; + } + + public void setAgentName(String var1) { + this.agentName = var1; + } + + public String getGroupId() { + return this.groupId; + } + + public void setGroupId(String var1) { + this.groupId = var1; + } + + public String getClientId() { + return this.clientId; + } + + public void setClientId(String var1) { + this.clientId = var1; + } + + public String getSecret() { + return this.secret; + } + + public void setSecret(String var1) { + this.secret = var1; + } + + public int getType() { + return this.type; + } + + public void setType(int var1) { + this.type = var1; + } + + public long getTimeStamp() { + return this.timeStamp; + } + + public void setTimeStamp(long var1) { + this.timeStamp = var1; + } + + + public JSONObject toJSONObject() throws JSONException { + JSONObject var1 = JSONObject.create(); + var1.put("id", this.getId()); + var1.put("agentName", this.agentName); + var1.put("groupId", this.groupId); + var1.put("clientId", this.clientId); + var1.put("secret", this.secret); + var1.put("teamId", this.teamId); + return var1; + } +} diff --git a/src/main/java/com/fr/plugin/beans/YTOutputBean.java b/src/main/java/com/fr/plugin/beans/YTOutputBean.java new file mode 100644 index 0000000..a281560 --- /dev/null +++ b/src/main/java/com/fr/plugin/beans/YTOutputBean.java @@ -0,0 +1,182 @@ +package com.fr.plugin.beans; + +import com.fr.decision.system.bean.message.MessageUrlType; +import com.fr.decision.system.bean.message.MobileMessageType; +import com.fr.plugin.entitys.YtOutputMyEntity; +import com.fr.schedule.base.bean.output.BaseOutputAction; +import com.fr.schedule.base.entity.AbstractScheduleEntity; +import com.fr.schedule.base.type.RunType; +import com.fr.third.fasterxml.jackson.annotation.JsonSubTypes; + +@JsonSubTypes.Type( + value = YTOutputBean.class, + name = "OutputYT" +) +public class YTOutputBean extends BaseOutputAction { + private int terminal = 128; + private String agentId = null; + private String clientId = null; + private String subject; + private String content; + private int linkOpenType; + private String customizeLink; + private String goUrl; + private int type; + private String mediaId; + private String fromUserId; + private int runType; + private int sendType; + + public String getGoUrl() { + return goUrl; + } + + public void setGoUrl(String goUrl) { + this.goUrl = goUrl; + } + + public String getClientId() { + return clientId; + } + + public void setClientId(String clientId) { + this.clientId = clientId; + } + + public int getTerminal() { + return terminal; + } + + public void setTerminal(int terminal) { + this.terminal = terminal; + } + + public String getAgentId() { + return agentId; + } + + public void setAgentId(String agentId) { + this.agentId = agentId; + } + + public String getSubject() { + return subject; + } + + public void setSubject(String subject) { + this.subject = subject; + } + + public String getContent() { + return content; + } + + public void setContent(String content) { + this.content = content; + } + + public int getSendType() { + return sendType; + } + + public void setSendType(int sendType) { + this.sendType = sendType; + } + + public int getLinkOpenType() { + return linkOpenType; + } + + public void setLinkOpenType(int linkOpenType) { + this.linkOpenType = linkOpenType; + } + + public String getCustomizeLink() { + return customizeLink; + } + + public void setCustomizeLink(String customizeLink) { + this.customizeLink = customizeLink; + } + + public int getType() { + return type; + } + + public void setType(int type) { + this.type = type; + } + + public String getMediaId() { + return mediaId; + } + + public void setMediaId(String mediaId) { + this.mediaId = mediaId; + } + + public int getRunType() { + return runType; + } + + public void setRunType(int runType) { + this.runType = runType; + } + //这里直接关联第一步的entity类 + public Class outputActionEntityClass() { + return YtOutputMyEntity.class; + } + + public String getFromUserId() { + return fromUserId; + } + + public void setFromUserId(String fromUserId) { + this.fromUserId = fromUserId; + } + + @Override + public AbstractScheduleEntity createOutputActionEntity() { + YtOutputMyEntity var1 = new YtOutputMyEntity(); + var1.setId(this.getId()); + var1.setTerminal(this.getTerminal()); + var1.setAgentId(this.getAgentId()); + var1.setSubject(this.getSubject()); + var1.setContent(this.getContent()); + var1.setGoUrl(this.getGoUrl()); + var1.setLinkOpenType(this.getLinkOpenType()); + var1.setCustomizeLink(this.getCustomizeLink()); + var1.setType(this.getType()); + var1.setMediaId(this.getMediaId()); + var1.setActionName(this.getActionName()); + var1.setResultURL(this.getResultURL()); + var1.setClientId(this.getClientId()); + var1.setRunType(this.getRunType()); + var1.setSendType(this.getSendType()); + var1.setFromUserId(this.getFromUserId()); +// var1.setExecuteByUser(this.willExecuteByUser()); + return var1; + } + +// @Override +// public OutputMyEntity createEntity() { +// +// } + + public YTOutputBean() { + this.linkOpenType = MessageUrlType.INNER.toInt(); + this.type = MobileMessageType.TEXT.toInt(); + this.runType = RunType.CLIENT_NOTIFICATION.getValue(); + } + + @Override + public boolean willExecuteByUser() { + return true; + } + + @Override + public RunType runType() { + + return RunType.CLIENT_NOTIFICATION; + } +} diff --git a/src/main/java/com/fr/plugin/beans/msg/MyMessageType.java b/src/main/java/com/fr/plugin/beans/msg/MyMessageType.java new file mode 100644 index 0000000..22a3ac0 --- /dev/null +++ b/src/main/java/com/fr/plugin/beans/msg/MyMessageType.java @@ -0,0 +1,14 @@ +package com.fr.plugin.beans.msg; + +import com.fr.decision.system.message.type.MessageType; + +public class MyMessageType extends MessageType { + public static final MyMessageType KEY = new MyMessageType(); + public static final String TEXT = "text"; + public static final String FILE = "file"; + public static final String NEWS = "news"; + @Override + public int toInteger() { + return 128; + } +} diff --git a/src/main/java/com/fr/plugin/config/YituanPri.java b/src/main/java/com/fr/plugin/config/YituanPri.java new file mode 100644 index 0000000..1e328d3 --- /dev/null +++ b/src/main/java/com/fr/plugin/config/YituanPri.java @@ -0,0 +1,206 @@ +package com.fr.plugin.config; + +import com.fr.config.ConfigContext; +import com.fr.config.DefaultConfiguration; +import com.fr.config.holder.Conf; +import com.fr.config.holder.factory.Holders; +import com.fr.stable.StringUtils; + +/** + * xx中不适用这个!废弃 + */ +public class YituanPri extends DefaultConfiguration { + private static volatile YituanPri config = null; + private Conf appId = Holders.simple(StringUtils.EMPTY); + private Conf eid = Holders.simple(StringUtils.EMPTY); + private Conf secret = Holders.simple(StringUtils.EMPTY); + private Conf url = Holders.simple(StringUtils.EMPTY); + private Conf readKey = Holders.simple(StringUtils.EMPTY); + private Conf match = Holders.simple(StringUtils.EMPTY); + private Conf cloudHost = Holders.simple("https://www.xxx.com"); + private Conf scanId = Holders.simple(StringUtils.EMPTY); + private Conf scanSecret = Holders.simple(StringUtils.EMPTY); + private Conf dataSet = Holders.simple(StringUtils.EMPTY); + private Conf dataSetFsName = Holders.simple(0); + private Conf dataSetUserId = Holders.simple(0); + private volatile boolean isAuthorityInited = false; + private volatile boolean isDBAccessAvailable = false; + private volatile boolean isThreadAlreadyStart = false; + private Conf lastSyncUserTime = Holders.simple(StringUtils.EMPTY); + private Conf lastSyncDepTime = Holders.simple(StringUtils.EMPTY); + private Conf synToken = Holders.simple(StringUtils.EMPTY); + + public static YituanPri getInstance() { + if (config == null) { + config = ConfigContext.getConfigInstance(YituanPri.class); + } + return config; + } + + public String getCloudHost() { + return cloudHost.get(); + } + + public void setCloudHost(String cloudHost) { + this.cloudHost.set(cloudHost); + } + + public String getLastSyncUserTime() { + return lastSyncUserTime.get(); + } + + public void setLastSyncUserTime(String lastSyncUserTime) { + this.lastSyncUserTime .set( lastSyncUserTime); + } + + public String getLastSyncDepTime() { + return lastSyncDepTime.get(); + } + + public void setSynToken(String token) { + this.synToken .set( token); + } + + public String getSynToken() { + return synToken.get(); + } + + public void setLastSyncDepTime(String lastSyncDepTime) { + this.lastSyncDepTime.set(lastSyncDepTime); + } + + public String getAppId() { + return appId.get(); + } + + public void setAppId(String appId) { + this.appId.set(appId); + } + + public String getEid() { + return eid.get(); + } + + public void setEid(String eid) { + this.eid.set(eid); + } + + public String getSecret() { + return secret.get(); + } + + public void setSecret(String secret) { + this.secret.set(secret); + } + + public String getUrl() { + return url.get(); + } + + public void setUrl(String url) { + this.url.set(url); + } + + public String getReadKey() { + return readKey.get(); + } + + public void setReadKey(String readKey) { + this.readKey.set(readKey); + } + + public boolean isAuthorityInited() { + return isAuthorityInited; + } + + public void setAuthorityInited(boolean authorityInited) { + isAuthorityInited = authorityInited; + } + + public boolean isDBAccessAvailable() { + return isDBAccessAvailable; + } + + public void setDBAccessAvailable(boolean DBAccessAvailable) { + isDBAccessAvailable = DBAccessAvailable; + } + + public boolean isThreadAlreadyStart() { + return isThreadAlreadyStart; + } + + public void setThreadAlreadyStart(boolean threadAlreadyStart) { + isThreadAlreadyStart = threadAlreadyStart; + } + + public String getMatch() { + return match.get(); + } + + public void setMatch(String match) { + this.match.set(match); + } + + public String getScanId() { + return scanId.get(); + } + + public void setScanId(String scanId) { + this.scanId .set(scanId); + } + + public String getScanSecret() { + return scanSecret.get(); + } + + public void setScanSecret(String scanSecret) { + this.scanSecret .set(scanSecret); + } + + public String getDataSet() { + return dataSet.get(); + } + + public void setDataSet(String dataSet) { + this.dataSet.set(dataSet); + } + + public Integer getDataSetFsName() { + return dataSetFsName.get(); + } + + public void setDataSetFsName(Integer dataSetFsName) { + this.dataSetFsName .set(dataSetFsName); + } + + public Integer getDataSetUserId() { + return dataSetUserId.get(); + } + + public void setDataSetUserId(Integer dataSetUserId) { + this.dataSetUserId .set( dataSetUserId); + } + + @Override + public Object clone() throws CloneNotSupportedException { + YituanPri clone = (YituanPri) super.clone(); + clone.secret = (Conf) secret.clone(); + clone.appId = (Conf) appId.clone(); + clone.eid = (Conf) eid.clone(); + clone.url = (Conf) url.clone(); + clone.cloudHost = (Conf) cloudHost.clone(); + clone.readKey = (Conf) readKey.clone(); + clone.match = (Conf) match.clone(); + + clone.scanId = (Conf) scanId.clone(); + clone.lastSyncUserTime = (Conf) lastSyncUserTime.clone(); + clone.lastSyncDepTime = (Conf) lastSyncDepTime.clone(); + clone.synToken = (Conf) synToken.clone(); + clone.scanSecret = (Conf) scanSecret.clone(); + + clone.dataSetUserId = (Conf) dataSetUserId.clone(); + clone.dataSetFsName = (Conf) dataSetFsName.clone(); + clone.dataSet = (Conf) dataSet.clone(); + return clone; + } +} diff --git a/src/main/java/com/fr/plugin/dao/MyAgentDao.java b/src/main/java/com/fr/plugin/dao/MyAgentDao.java new file mode 100644 index 0000000..6da3d56 --- /dev/null +++ b/src/main/java/com/fr/plugin/dao/MyAgentDao.java @@ -0,0 +1,15 @@ +package com.fr.plugin.dao; + +import com.fr.plugin.entitys.YTAgentEntity; +import com.fr.stable.db.dao.BaseDAO; +import com.fr.stable.db.session.DAOSession; + +public class MyAgentDao extends BaseDAO { + public MyAgentDao(DAOSession daoSession) { + super(daoSession); + } + + protected Class getEntityClass() { + return YTAgentEntity.class; + } +} diff --git a/src/main/java/com/fr/plugin/dao/MyDepDao.java b/src/main/java/com/fr/plugin/dao/MyDepDao.java new file mode 100644 index 0000000..2d8accd --- /dev/null +++ b/src/main/java/com/fr/plugin/dao/MyDepDao.java @@ -0,0 +1,14 @@ +package com.fr.plugin.dao; + +import com.fr.plugin.entitys.YtDepEntity; +import com.fr.stable.db.dao.BaseDAO; +import com.fr.stable.db.session.DAOSession; + +public class MyDepDao extends BaseDAO { + public MyDepDao(DAOSession daoSession) { + super(daoSession); + } + protected Class getEntityClass() { + return YtDepEntity.class; + } +} diff --git a/src/main/java/com/fr/plugin/dao/MyEntityDao.java b/src/main/java/com/fr/plugin/dao/MyEntityDao.java new file mode 100644 index 0000000..8fea553 --- /dev/null +++ b/src/main/java/com/fr/plugin/dao/MyEntityDao.java @@ -0,0 +1,14 @@ +package com.fr.plugin.dao; + +import com.fr.plugin.entitys.YtOutputMyEntity; +import com.fr.stable.db.dao.BaseDAO; +import com.fr.stable.db.session.DAOSession; + +public class MyEntityDao extends BaseDAO { + public MyEntityDao(DAOSession daoSession) { + super(daoSession); + } + protected Class getEntityClass() { + return YtOutputMyEntity.class; + } +} diff --git a/src/main/java/com/fr/plugin/dao/MyGroupDao.java b/src/main/java/com/fr/plugin/dao/MyGroupDao.java new file mode 100644 index 0000000..2bcf734 --- /dev/null +++ b/src/main/java/com/fr/plugin/dao/MyGroupDao.java @@ -0,0 +1,15 @@ +package com.fr.plugin.dao; + +import com.fr.plugin.entitys.YtGroupEntity; +import com.fr.stable.db.dao.BaseDAO; +import com.fr.stable.db.session.DAOSession; + +public class MyGroupDao extends BaseDAO { + public MyGroupDao(DAOSession daoSession) { + super(daoSession); + } + protected Class getEntityClass() { + return YtGroupEntity.class; + } + +} diff --git a/src/main/java/com/fr/plugin/dao/MyUserDao.java b/src/main/java/com/fr/plugin/dao/MyUserDao.java new file mode 100644 index 0000000..0cf7ea7 --- /dev/null +++ b/src/main/java/com/fr/plugin/dao/MyUserDao.java @@ -0,0 +1,15 @@ +package com.fr.plugin.dao; + +import com.fr.plugin.entitys.YTUserEntity; +import com.fr.stable.db.dao.BaseDAO; +import com.fr.stable.db.session.DAOSession; + +public class MyUserDao extends BaseDAO { + public MyUserDao(DAOSession daoSession) { + super(daoSession); + } + protected Class getEntityClass() { + return YTUserEntity.class; + } + +} diff --git a/src/main/java/com/fr/plugin/dao/MyYiTuanDao.java b/src/main/java/com/fr/plugin/dao/MyYiTuanDao.java new file mode 100644 index 0000000..d9612d2 --- /dev/null +++ b/src/main/java/com/fr/plugin/dao/MyYiTuanDao.java @@ -0,0 +1,14 @@ +package com.fr.plugin.dao; + +import com.fr.plugin.entitys.YTYiTuanEntity; +import com.fr.stable.db.dao.BaseDAO; +import com.fr.stable.db.session.DAOSession; + +public class MyYiTuanDao extends BaseDAO { + public MyYiTuanDao(DAOSession daoSession) { + super(daoSession); + } + protected Class getEntityClass() { + return YTYiTuanEntity.class; + } +} diff --git a/src/main/java/com/fr/plugin/entitys/YTAgentEntity.java b/src/main/java/com/fr/plugin/entitys/YTAgentEntity.java new file mode 100644 index 0000000..0067a65 --- /dev/null +++ b/src/main/java/com/fr/plugin/entitys/YTAgentEntity.java @@ -0,0 +1,133 @@ +package com.fr.plugin.entitys; + +import com.fr.plugin.beans.MyAgentBean; +import com.fr.stable.db.entity.BaseEntity; +import com.fr.third.javax.persistence.Column; +import com.fr.third.javax.persistence.Entity; +import com.fr.third.javax.persistence.Table; + +@Entity +@Table( + name = "fine_yt_agent" +) +public class YTAgentEntity extends BaseEntity { + + @Column( + name = "agentName" + ) + private String agentName = ""; + @Column( + name = "agentId" + ) + private String agentId = ""; + @Column( + name = "corpId" + ) + private String corpId = ""; + @Column( + name = "secret" + ) + private String secret = ""; + @Column( + name = "type" + ) + private Integer type = 2; + @Column( + name = "timeStamp" + ) + private Long timeStamp = 0L; + + public MyAgentBean createBean(MyAgentBean var1) { + var1.setId(this.getId()); + var1.setAgentName(this.getAgentName()); + var1.setGroupId(this.getAgentId()); + var1.setClientId(this.getCorpId()); + var1.setSecret(this.getSecret()); + var1.setType(this.getType()); + var1.setTimeStamp(this.getTimeStamp()); + return var1; + } + + public YTAgentEntity id(String var1) { + this.setId(var1); + return this; + } + + public String getAgentName() { + return this.agentName; + } + + public void setAgentName(String var1) { + this.agentName = var1; + } + + public YTAgentEntity agentName(String var1) { + this.setAgentName(var1); + return this; + } + + public String getAgentId() { + return this.agentId; + } + + public void setAgentId(String var1) { + this.agentId = var1; + } + + public YTAgentEntity agentId(String var1) { + this.setAgentId(var1); + return this; + } + + public String getCorpId() { + return this.corpId; + } + + public void setCorpId(String var1) { + this.corpId = var1; + } + + public YTAgentEntity corpId(String var1) { + this.setCorpId(var1); + return this; + } + + public String getSecret() { + return this.secret; + } + + public void setSecret(String var1) { + this.secret = var1; + } + + public YTAgentEntity secret(String var1) { + this.setSecret(var1); + return this; + } + + public Integer getType() { + return this.type; + } + + public void setType(int var1) { + this.type = var1; + } + + public YTAgentEntity type(int var1) { + this.setType(var1); + return this; + } + + public Long getTimeStamp() { + return timeStamp; + } + + public void setTimeStamp(Long timeStamp) { + this.timeStamp = timeStamp; + } + + public YTAgentEntity timeStamp(long var1) { + this.setTimeStamp(var1); + return this; + } +} diff --git a/src/main/java/com/fr/plugin/entitys/YTUserEntity.java b/src/main/java/com/fr/plugin/entitys/YTUserEntity.java new file mode 100644 index 0000000..6004b55 --- /dev/null +++ b/src/main/java/com/fr/plugin/entitys/YTUserEntity.java @@ -0,0 +1,125 @@ +package com.fr.plugin.entitys; + +import com.fr.plugin.beans.MyUserBean; +import com.fr.stable.db.entity.BaseEntity; +import com.fr.third.javax.persistence.Column; +import com.fr.third.javax.persistence.Entity; +import com.fr.third.javax.persistence.Table; + +@Entity +@Table( + name = "fine_yt_user" +) +public class YTUserEntity extends BaseEntity { + @Column( + name = "openId" + ) + private String openId; + @Column( + name = "name" + ) + private String name; + @Column( + name = "photoUrl" + ) + private String photoUrl; + @Column( + name = "jobNo" + ) + private String jobNo; + @Column( + name = "depName" + ) + private String department; + @Column( + name = "status" + ) + private int status; + @Column( + name = "phone" + ) + private String phone; + @Column( + name = "fsUserName" + ) + private String fsUserName; + + public String getFsUserName() { + return fsUserName; + } + + public void setFsUserName(String fsUserName) { + this.fsUserName = fsUserName; + } + + public String getPhone() { + return phone; + } + + public void setPhone(String phone) { + this.phone = phone; + } + + public MyUserBean createBean() { + MyUserBean var1 =new MyUserBean(); + var1.setId(this.getId()); + var1.setName(this.getName()); + var1.setDepartment(this.getDepartment()); + var1.setJobNo(this.getJobNo()); + var1.setPhotoUrl(this.getPhotoUrl()); + var1.setStatus(this.getStatus()); + var1.setPhone(this.getPhone()); + var1.setFsUserName(this.getFsUserName()); + return var1; + } + + public String getOpenId() { + return openId; + } + + public void setOpenId(String openId) { + this.openId = openId; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getPhotoUrl() { + return photoUrl; + } + + public void setPhotoUrl(String photoUrl) { + this.photoUrl = photoUrl; + } + + public String getJobNo() { + return jobNo; + } + + public void setJobNo(String jobNo) { + this.jobNo = jobNo; + } + + public String getDepartment() { + return department; + } + + public void setDepartment(String department) { + this.department = department; + } + + public int getStatus() { + return status; + } + + public void setStatus(int status) { + this.status = status; + } + + +} diff --git a/src/main/java/com/fr/plugin/entitys/YTYiTuanEntity.java b/src/main/java/com/fr/plugin/entitys/YTYiTuanEntity.java new file mode 100644 index 0000000..43bd452 --- /dev/null +++ b/src/main/java/com/fr/plugin/entitys/YTYiTuanEntity.java @@ -0,0 +1,102 @@ +package com.fr.plugin.entitys; + +import com.fr.plugin.beans.MyYituanBean; +import com.fr.stable.db.entity.BaseEntity; +import com.fr.third.javax.persistence.Column; +import com.fr.third.javax.persistence.Entity; +import com.fr.third.javax.persistence.Table; + +@Entity +@Table( + name = "fine_yt_config" +) +public class YTYiTuanEntity extends BaseEntity { + + @Column( + name = "agentName" + ) + private String agentName = ""; + @Column( + name = "teamId" + ) + private String teamId = ""; + @Column( + name = "groupId" + ) + private String groupId = ""; + @Column( + name = "clientId" + ) + private String clientId = ""; + @Column( + name = "secret" + ) + private String secret = ""; + + public String getTeamId() { + return teamId; + } + + public void setTeamId(String teamId) { + this.teamId = teamId; + } + + public String getGroupId() { + return groupId; + } + + public void setGroupId(String groupId) { + this.groupId = groupId; + } + + public String getClientId() { + return clientId; + } + + public void setClientId(String clientId) { + this.clientId = clientId; + } + + public MyYituanBean createBean(MyYituanBean var1) { + var1.setId(this.getId()); + var1.setAgentName(this.getAgentName()); + var1.setGroupId(this.getGroupId()); + var1.setTeamId(this.getTeamId()); + var1.setClientId(this.getClientId()); + var1.setSecret(this.getSecret()); + return var1; + } + + public YTYiTuanEntity id(String var1) { + this.setId(var1); + return this; + } + + public String getAgentName() { + return this.agentName; + } + + public void setAgentName(String var1) { + this.agentName = var1; + } + + public YTYiTuanEntity agentName(String var1) { + this.setAgentName(var1); + return this; + } + + public String getSecret() { + return this.secret; + } + + public void setSecret(String var1) { + this.secret = var1; + } + + public YTYiTuanEntity secret(String var1) { + this.setSecret(var1); + return this; + } + + +} diff --git a/src/main/java/com/fr/plugin/entitys/YtDepEntity.java b/src/main/java/com/fr/plugin/entitys/YtDepEntity.java new file mode 100644 index 0000000..7b4cdcc --- /dev/null +++ b/src/main/java/com/fr/plugin/entitys/YtDepEntity.java @@ -0,0 +1,72 @@ +package com.fr.plugin.entitys; + +import com.fr.plugin.beans.MyDepBean; +import com.fr.stable.db.entity.BaseEntity; +import com.fr.third.javax.persistence.Column; +import com.fr.third.javax.persistence.Entity; +import com.fr.third.javax.persistence.Table; + +@Entity +@Table( + name = "fine_yt_dep" +) +public class YtDepEntity extends BaseEntity { + @Column( + name = "name" + ) + private String name; + @Column( + name = "depName" + ) + private String depName; + + @Column( + name = "top1" + ) + private int top1; + @Column( + name = "parentId" + ) + private String parentId; + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getDepName() { + return depName; + } + + public void setDepName(String depName) { + this.depName = depName; + } + + public int getTop1() { + return top1; + } + + public void setTop1(int top) { + this.top1 = top; + } + + public String getParentId() { + return parentId; + } + + public void setParentId(String parentId) { + this.parentId = parentId; + } + public MyDepBean createBean(){ + MyDepBean bean=new MyDepBean(); + bean.setDepName(this.depName); + bean.setId(this.getId()); + bean.setName(this.name); + bean.setParentId(this.parentId); + bean.setOrder(this.top1); + return bean; + } +} diff --git a/src/main/java/com/fr/plugin/entitys/YtGroupEntity.java b/src/main/java/com/fr/plugin/entitys/YtGroupEntity.java new file mode 100644 index 0000000..11ec76d --- /dev/null +++ b/src/main/java/com/fr/plugin/entitys/YtGroupEntity.java @@ -0,0 +1,46 @@ +package com.fr.plugin.entitys; + +import com.fr.plugin.beans.MyGroupBean; +import com.fr.stable.db.entity.BaseEntity; +import com.fr.third.javax.persistence.Column; +import com.fr.third.javax.persistence.Entity; +import com.fr.third.javax.persistence.Table; + +@Entity +@Table( + name = "fine_yt_group" +) +public class YtGroupEntity extends BaseEntity { + @Column( + name = "name" + ) + private String name; + @Column( + name = "groupId" + ) + private String groupId; + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getGroupId() { + return groupId; + } + + public void setGroupId(String groupId) { + this.groupId = groupId; + } + + public MyGroupBean createBean(){ + MyGroupBean bean=new MyGroupBean(); + bean.setId(this.getId()); + bean.setName(this.name); + bean.setGroupId(this.groupId); + return bean; + } +} diff --git a/src/main/java/com/fr/plugin/entitys/YtOutputMyEntity.java b/src/main/java/com/fr/plugin/entitys/YtOutputMyEntity.java new file mode 100644 index 0000000..238fe2c --- /dev/null +++ b/src/main/java/com/fr/plugin/entitys/YtOutputMyEntity.java @@ -0,0 +1,246 @@ +package com.fr.plugin.entitys; + +import com.fr.plugin.beans.YTOutputBean; +import com.fr.schedule.base.entity.AbstractScheduleEntity; +import com.fr.schedule.base.entity.output.BaseOutputActionEntity; +import com.fr.stable.db.entity.TableAssociation; +import com.fr.third.javax.persistence.Column; +import com.fr.third.javax.persistence.Entity; +import com.fr.third.javax.persistence.Table; + +@Entity +@Table( + name = "fine_yt_output" +) +@TableAssociation( + associated = true +) +public class YtOutputMyEntity extends AbstractScheduleEntity { + private static final String COLUMN_TERMINAL = "terminal"; + private static final String COLUMN_AGENTID = "agentId"; + private static final String COLUMN_CLIENTID = "clientId"; + private static final String COLUMN_SUBJECT = "subject"; + private static final String COLUMN_CONTENT = "content"; + private static final String COLUMN_LINK_OPEN_TYPE = "linkOpenType"; + private static final String COLUMN_CUSTOMIZE_LINK = "customizeLink"; + private static final String COLUMN_TYPE = "type"; + private static final String COLUMN_MEDIA_ID = "mediaId"; + @Column( + name = "terminal" + ) + private int terminal = 128;// 般应该使用 2 4 8 16 32 64 128 这样的表示其实就是 000001 000010 0000100 00001000类似这个二进制 + @Column( + name = "agentId" + ) + private String agentId = null; + @Column( + name = "clientId" + ) + private String clientId = null; + @Column( + name = "subject", + length = 65536 + ) + + private String subject; + @Column( + name = "actionName", + nullable = false + ) + private String actionName = "com.fr.plugin.beans.YTOutputBean"; + @Column( + name = "goUrl", + length = 1022 + ) + private String goUrl = ""; + @Column( + name = "content", + length = 65536 + ) + private String content; + @Column( + name = "linkOpenType" + ) + private int linkOpenType = -1; + @Column( + name = "customizeLink", + length = 65536 + ) + private String customizeLink; + @Column( + name = "resultURL", + length = 1000 + ) + private String resultURL = null; + @Column( + name = "outputId" + ) + private String outputId = null; + + @Column( + name = "type" + ) + private int type; + @Column( + name = "runType" + ) + private int runType; + @Column( + name = "sendType" + ) + private int sendType; + @Column( + name = "mediaId" + ) + private String mediaId; + @Column( + name = "fromUserId" + ) + private String fromUserId; + + public YtOutputMyEntity() { + } + + public String getClientId() { + return clientId; + } + + public void setClientId(String clientId) { + this.clientId = clientId; + } + + public String getGoUrl() { + return goUrl; + } + + public void setGoUrl(String goUrl) { + this.goUrl = goUrl; + } + + public YTOutputBean createBean() { + YTOutputBean var1 = new YTOutputBean(); + var1.setId(this.getId()); + var1.setAgentId(this.getAgentId()); + var1.setTerminal(this.getTerminal()); + var1.setSubject(this.getSubject()); + var1.setContent(this.getContent()); + var1.setGoUrl(this.getGoUrl()); + var1.setLinkOpenType(this.getLinkOpenType()); + var1.setCustomizeLink(this.getCustomizeLink()); + var1.setType(this.getType()); + var1.setClientId(this.getClientId()); + var1.setMediaId(this.getMediaId()); + var1.setActionName(this.getActionName()); + var1.setResultURL(this.getResultURL()); + var1.setRunType(this.getRunType()); + var1.setFromUserId(this.getFromUserId()); + var1.setSendType(this.getSendType()); + return var1; + } + + public int getSendType() { + return sendType; + } + + public void setSendType(int sendType) { + this.sendType = sendType; + } + + public int getRunType() { + return runType; + } + + public void setRunType(int runType) { + this.runType = runType; + } + + public String getFromUserId() { + return fromUserId; + } + + public void setFromUserId(String fromUserId) { + this.fromUserId = fromUserId; + } + + public String getActionName() { + return this.actionName; + } + + public void setActionName(String var1) { + this.actionName = var1; + } + + + public String getResultURL() { + return this.resultURL; + } + + public void setResultURL(String var1) { + this.resultURL = var1; + } + + + public String getAgentId() { + return this.agentId; + } + + public void setAgentId(String var1) { + this.agentId = var1; + } + + public int getTerminal() { + return this.terminal; + } + + public void setTerminal(int var1) { + this.terminal = var1; + } + + public String getSubject() { + return this.subject; + } + + public void setSubject(String var1) { + this.subject = var1; + } + + public String getContent() { + return this.content; + } + + public void setContent(String var1) { + this.content = var1; + } + + public int getLinkOpenType() { + return this.linkOpenType; + } + + public void setLinkOpenType(int var1) { + this.linkOpenType = var1; + } + + public String getCustomizeLink() { + return this.customizeLink; + } + + public void setCustomizeLink(String var1) { + this.customizeLink = var1; + } + + public int getType() { + return this.type; + } + + public void setType(int var1) { + this.type = var1; + } + + public String getMediaId() { + return this.mediaId; + } + + public void setMediaId(String var1) { + this.mediaId = var1; + } +} diff --git a/src/main/java/com/fr/plugin/utils/MyAgentUtils.java b/src/main/java/com/fr/plugin/utils/MyAgentUtils.java new file mode 100644 index 0000000..d937cab --- /dev/null +++ b/src/main/java/com/fr/plugin/utils/MyAgentUtils.java @@ -0,0 +1,34 @@ +package com.fr.plugin.utils; + +import com.fr.plugin.yt.MyCoreDBAccess; +import com.fr.plugin.dao.MyAgentDao; +import com.fr.plugin.entitys.YTAgentEntity; +import com.fr.stable.db.action.DBAction; +import com.fr.stable.db.dao.DAOContext; +import com.fr.stable.query.QueryFactory; +import com.fr.stable.query.restriction.RestrictionFactory; + +import java.util.List; + +public class MyAgentUtils { + public static String getAgentIdBySecret(String var9, String var10) { + + return ""; + } + public static List getAgentsSortedByTimeStamp() throws Exception { + return (List) MyCoreDBAccess.getAccessor().runQueryAction(new DBAction>() { + public List run(DAOContext var1) throws Exception { + return ((MyAgentDao)var1.getDAO(MyAgentDao.class)).find(QueryFactory.create().addSort("timeStamp", true)); + } + }); + } + + + public static YTAgentEntity getAgentById(String agentId) throws Exception { + return MyCoreDBAccess.getAccessor().runQueryAction(new DBAction() { + public YTAgentEntity run(DAOContext var1) throws Exception { + return var1.getDAO(MyAgentDao.class).findOne(QueryFactory.create().addRestriction(RestrictionFactory.eq("id",agentId))); + } + }); + } +} diff --git a/src/main/java/com/fr/plugin/utils/MyUtils.java b/src/main/java/com/fr/plugin/utils/MyUtils.java new file mode 100644 index 0000000..ec8e380 --- /dev/null +++ b/src/main/java/com/fr/plugin/utils/MyUtils.java @@ -0,0 +1,75 @@ +package com.fr.plugin.utils; + +import com.fr.json.JSONObject; +import com.fr.plugin.PluginLicense; +import com.fr.plugin.PluginLicenseManager; +import com.fr.plugin.dao.MyGroupDao; +import com.fr.plugin.dao.MyYiTuanDao; +import com.fr.plugin.entitys.YTYiTuanEntity; +import com.fr.plugin.entitys.YtGroupEntity; +import com.fr.plugin.yt.MyCoreDBAccess; +import com.fr.plugin.yt.MyStartupThred; +import com.fr.plugin.dao.MyAgentDao; +import com.fr.plugin.entitys.YTAgentEntity; +import com.fr.stable.db.action.DBAction; +import com.fr.stable.db.dao.DAOContext; +import com.fr.stable.query.QueryFactory; +import com.fr.stable.query.condition.QueryCondition; +import java.util.List; + +public class MyUtils { + public static boolean isLicenseAvailable() { + PluginLicense var0 = PluginLicenseManager.getInstance().getPluginLicenseByID("com.fr.plugin.yituan"); + return var0.isAvailable(); + } + + + + public static JSONObject createSuccessResponseJSONObject() { + JSONObject var0 = JSONObject.create(); + var0.put("errorCode", 0); + var0.put("status", "success"); + return var0; + } + + public static List getCompanysSortedByTimeStamp() throws Exception { + return MyCoreDBAccess.getAccessor().runQueryAction(new DBAction>() { + public List run(DAOContext var1) throws Exception { + QueryCondition queryCondition = QueryFactory.create(); + return var1.getDAO(MyYiTuanDao.class).find(queryCondition + .addSort("id", true)); + } + }); + + } + + public static List getAgentsSortedByTimeStamp() throws Exception { + return MyCoreDBAccess.getAccessor().runQueryAction(new DBAction>() { + public List run(DAOContext var1) throws Exception { + QueryCondition queryCondition = QueryFactory.create(); + return var1.getDAO(MyAgentDao.class).find(queryCondition + .addSort("id", true)); + } + }); + + } + + public static List getGroupsSortedByTimeStamp() throws Exception { + return MyCoreDBAccess.getAccessor().runQueryAction(new DBAction>() { + public List run(DAOContext var1) throws Exception { + QueryCondition queryCondition = QueryFactory.create(); + return var1.getDAO(MyGroupDao.class).find(queryCondition + .addSort("id", true)); + } + }); + } + + public static void startUpUserSyncThread() { + new MyStartupThred().start(); + } + + public static void startSyncThread() { + new Thread(new SyncThread("user")).start(); + new Thread(new SyncThread("dep")).start(); + } +} diff --git a/src/main/java/com/fr/plugin/utils/PushUtils.java b/src/main/java/com/fr/plugin/utils/PushUtils.java new file mode 100644 index 0000000..04f8329 --- /dev/null +++ b/src/main/java/com/fr/plugin/utils/PushUtils.java @@ -0,0 +1,40 @@ +package com.fr.plugin.utils; + +import com.fr.json.JSONObject; +import com.fr.log.FineLoggerFactory; +import com.fr.plugin.config.YituanPri; +import com.fr.third.org.apache.commons.lang3.StringUtils; +import org.apache.commons.codec.digest.DigestUtils; + +import java.util.Arrays; + +public class PushUtils { + + public static void sendPush(JSONObject params) { + String cloudHost = YituanPri.getInstance().getCloudHost(); + String url = cloudHost + "/pubacc/pubsend"; + String s = WebUtils.sendJsonPost(url, params.toString()); + JSONObject resp = new JSONObject(s); + String pubId = resp.getString("pubId"); + FineLoggerFactory.getLogger().info("推送成功:{}", pubId); + } + + public static JSONObject genernateFrom(String no, String pubId, String pubsercet, String nonce, String time) { + JSONObject jsonFrom = new JSONObject(); + jsonFrom.put("no", no); + jsonFrom.put("pub", pubId); + jsonFrom.put("nonce", nonce); + jsonFrom.put("time", time); + String pubtoken = sha(no, pubId, pubsercet, nonce, time); + jsonFrom.put("pubtoken", pubtoken); + return jsonFrom; + } + + private static String sha(String... data) { + Arrays.sort(data); + String join = StringUtils.join(data); + String pubtoken = DigestUtils.sha1Hex(join); + return pubtoken; + } + +} diff --git a/src/main/java/com/fr/plugin/utils/SyncThread.java b/src/main/java/com/fr/plugin/utils/SyncThread.java new file mode 100644 index 0000000..6059c72 --- /dev/null +++ b/src/main/java/com/fr/plugin/utils/SyncThread.java @@ -0,0 +1,108 @@ +package com.fr.plugin.utils; + +import com.fr.general.ComparatorUtils; +import com.fr.json.JSONArray; +import com.fr.json.JSONObject; +import com.fr.log.FineLoggerFactory; +import com.fr.plugin.beans.MyDepBean; +import com.fr.plugin.beans.MyUserBean; +import com.fr.plugin.config.YituanPri; +import com.fr.plugin.yt.MyCorpManager; +import com.fr.plugin.yt.MyUserSyncManager; +import com.fr.stable.StringUtils; +import com.fr.third.org.apache.commons.lang3.time.DateFormatUtils; + +import java.util.Date; + +public class SyncThread implements Runnable { + private String operation; + + public SyncThread(String operation) { + this.operation = operation; + } + + @Override + public void run() { + MyUserSyncManager corpManager = MyUserSyncManager.getInstance(); + if (ComparatorUtils.equalsIgnoreCase("user", operation)) { + FineLoggerFactory.getLogger().info("增量同步用户开始"); + String lastSyncUserTime = YituanPri.getInstance().getLastSyncUserTime();//格式:“2014-08-02 01:40:38” + String format = DateFormatUtils.format(new Date(), "yyyy-MM-dd HH:mm:ss"); + if(StringUtils.isBlank(lastSyncUserTime)){ + lastSyncUserTime=format; + } + YituanPri.getInstance().setLastSyncUserTime(format); + JSONArray userLastSyn = WebUtils.getUserLastSyn(0,lastSyncUserTime); + int count = 0; + while (userLastSyn != null && !userLastSyn.isEmpty()) { + if (userLastSyn.isEmpty()) { + break; + } + int size = userLastSyn.size(); + for (int i = 0; i < size; i++) { + JSONObject userJson = userLastSyn.getJSONObject(i); + int status = userJson.getInt("status"); + String id = userJson.getString("openId"); + String photoUrl = userJson.getString("photoUrl"); + String name = userJson.getString("name"); + String jobNo = userJson.getString("jobNo"); + String phone = userJson.getString("phone"); + String depName = userJson.getString("department"); + MyUserBean entity = new MyUserBean(); + entity.setPhone(phone); + entity.setPhotoUrl(photoUrl); + entity.setStatus(status); + entity.setOpenId(id); + entity.setName(name); + entity.setDepartment(depName); + entity.setJobNo(jobNo); + try { + corpManager.saveOrUpdateUser(entity); + } catch (Exception e) { + e.printStackTrace(); + } + count++; + } + FineLoggerFactory.getLogger().info("增量同步用户count:{},当前页面:{} 条", count,size); + userLastSyn = WebUtils.getUserLastSyn(count,lastSyncUserTime); + } + FineLoggerFactory.getLogger().info("增量同步用户完成 修改了:{}个用户信息", count); + } else { + FineLoggerFactory.getLogger().info("增量同步部门开始"); + JSONArray depLastSyn = WebUtils.getDepLastSyn(); + MyCorpManager myCorpManager = MyCorpManager.getInstance(); + int count = 0; + if (depLastSyn != null && !depLastSyn.isEmpty()) { + int size = depLastSyn.size(); + for (int i = 0; i < size; i++) { + JSONObject depJson = depLastSyn.getJSONObject(i); + String id = depJson.getString("id"); + String pid = depJson.getString("parentId"); + String name = depJson.getString("name"); + String depName = depJson.getString("department"); + int order = depJson.getInt("weights"); + String opera = depJson.getString(""); + MyDepBean depBean = new MyDepBean(); + depBean.setDepName(depName); + depBean.setId(id); + depBean.setOrder(order); + depBean.setParentId(pid); + depBean.setName(name); + try { + if(ComparatorUtils.equalsIgnoreCase(opera,"3")){ + myCorpManager.removeDep(depBean); + }else{ + myCorpManager.saveOrUpdateDep(depBean); + } + } catch (Exception e) { + e.printStackTrace(); + } + count++; + } + } + FineLoggerFactory.getLogger().info("增量同步部门完成 修改了:{}个部门信息", count); + } + } + + +} diff --git a/src/main/java/com/fr/plugin/utils/UserSync.java b/src/main/java/com/fr/plugin/utils/UserSync.java new file mode 100644 index 0000000..7547704 --- /dev/null +++ b/src/main/java/com/fr/plugin/utils/UserSync.java @@ -0,0 +1,178 @@ +package com.fr.plugin.utils; + +import com.fr.log.FineLoggerFactory; +import com.fr.plugin.dao.MyUserDao; +import com.fr.plugin.dao.MyYiTuanDao; +import com.fr.plugin.entitys.YTUserEntity; +import com.fr.plugin.entitys.YTYiTuanEntity; +import com.fr.plugin.yt.MyCoreDBAccess; +import com.fr.stable.db.action.DBAction; +import com.fr.stable.db.dao.DAOContext; +import com.fr.stable.query.QueryFactory; +import com.fr.stable.query.condition.QueryCondition; +import com.fr.stable.query.restriction.RestrictionFactory; +import org.json.JSONArray; +import org.json.JSONObject; + +import java.util.ArrayList; +import java.util.List; + +public class UserSync { + + + public static void startSyncUser() { + YiTuanMaManager manager = YiTuanMaManager.getInstance(); + /** + * 循环所有的agent + */ + List ytYiTuanEntities = null; + try { + ytYiTuanEntities = MyCoreDBAccess.getAccessor().runQueryAction(new DBAction>() { + @Override + public List run(DAOContext daoContext) throws Exception { + return daoContext.getDAO(MyYiTuanDao.class).find(QueryFactory.create()); + } + }); + + if (ytYiTuanEntities.isEmpty()) { + FineLoggerFactory.getLogger().info(" 用户同步 未配置任何的一团企业配置 "); + return; + } + List fromCloud = new ArrayList<>(); + for (YTYiTuanEntity ytYiTuanEntity : ytYiTuanEntities) { + String access_token = YiTuanMaUtils.getAccessToken(ytYiTuanEntity.getClientId()); + FineLoggerFactory.getLogger().info("同步用户获取的accessTOken:{} ", access_token); + try { + JSONArray userInfo = YiTuanMaUtils.getUserInfo(ytYiTuanEntity.getClientId() , access_token); + int length = userInfo.length(); + FineLoggerFactory.getLogger().info("同步用户获取的数量:{} ", length); + for (int i = 0; i < length; i++) { + JSONObject userModel = userInfo.getJSONObject(i); + String userid; + if (userModel.has("id")) { + userid = userModel.getString("id"); + userModel.put("userId", userid); + userModel.remove("id"); + } else { + userid = userModel.getString("userId"); + } + fromCloud.add(userid); + String name = userModel.getString("name"); + String mobile = userModel.getString("mobile"); + YTUserEntity entity = new YTUserEntity(); + entity.setId(userid); + entity.setName(name); + entity.setPhone(mobile); + FineLoggerFactory.getLogger().info("同步用户:{} name{} mob:{} ", userid, name, mobile); + if (existEntity(userid)) { + update(entity); + } else { + save(entity); + } + } + + } catch (Exception e) { + e.printStackTrace(); + } + } + List allUserId = getAllUserId(); + allUserId.removeAll(fromCloud); + for (String id : allUserId) { + FineLoggerFactory.getLogger().info("同步用户--删除用户 {} ", id); + remove(id); + } + + } catch (Exception e) { + e.printStackTrace(); + } + } + + private static List getAllUserId() { + try { + List ytUserEntities = MyCoreDBAccess.getAccessor().runQueryAction(new DBAction>() { + public List run(DAOContext content) throws Exception { + return content.getDAO(MyUserDao.class).find(QueryFactory.create()); + } + }); + int size = ytUserEntities.size(); + ArrayList objects = new ArrayList<>(size); + for (int i = 0; i < size; i++) { + YTUserEntity entity = ytUserEntities.get(i); + objects.add(entity.getId()); + } + return objects; + } catch (Exception e) { + e.printStackTrace(); + } + return new ArrayList<>(); + } + + private static boolean existEntity(String id) { + try { + YTUserEntity entity = MyCoreDBAccess.getAccessor().runQueryAction(new DBAction() { + public YTUserEntity run(DAOContext content) throws Exception { + return content.getDAO(MyUserDao.class).findOne(QueryFactory.create().addRestriction(RestrictionFactory.eq("id", id))); + } + }); + return entity != null; + } catch (Exception e) { + e.printStackTrace(); + } + return false; + } + + private static void remove(String id) { + try { + MyCoreDBAccess.getAccessor().runDMLAction(new DBAction() { + public YTUserEntity run(DAOContext content) throws Exception { + content.getDAO(MyUserDao.class).remove(id); + return null; + } + }); + } catch (Exception e) { + e.printStackTrace(); + } + } + + private static void save(YTUserEntity entity) { + try { + MyCoreDBAccess.getAccessor().runDMLAction(new DBAction() { + public YTUserEntity run(DAOContext content) throws Exception { + content.getDAO(MyUserDao.class).add(entity); + return null; + } + }); + } catch (Exception e) { + e.printStackTrace(); + } + } + + private static void update(YTUserEntity entity) { + try { + MyCoreDBAccess.getAccessor().runDMLAction(new DBAction() { + public YTUserEntity run(DAOContext content) throws Exception { + content.getDAO(MyUserDao.class).update(entity); + return null; + } + }); + } catch (Exception e) { + e.printStackTrace(); + } + } + + public static YTUserEntity findById(String id) { + try { + YTUserEntity entity = MyCoreDBAccess.getAccessor().runDMLAction(new DBAction() { + public YTUserEntity run(DAOContext content) throws Exception { + QueryCondition queryCondition = QueryFactory.create().addRestriction(RestrictionFactory.eq("id", id)); + return content.getDAO(MyUserDao.class).findOne(queryCondition); + } + }); + return entity; + } catch (Exception e) { + e.printStackTrace(); + } + return null; + } + +} diff --git a/src/main/java/com/fr/plugin/utils/WebUtils.java b/src/main/java/com/fr/plugin/utils/WebUtils.java new file mode 100644 index 0000000..9364891 --- /dev/null +++ b/src/main/java/com/fr/plugin/utils/WebUtils.java @@ -0,0 +1,380 @@ +package com.fr.plugin.utils; + +import com.fr.base.FRContext; +import com.fr.base.ServerConfig; +import com.fr.json.JSONArray; +import com.fr.json.JSONObject; +import com.fr.log.FineLoggerFactory; +import com.fr.plugin.beans.MyDepBean; +import com.fr.plugin.beans.MyUserBean; +import com.fr.plugin.config.YituanPri; +import com.fr.plugin.web.hander.LoginUserModel; +import com.fr.stable.StringUtils; +import com.fr.third.org.apache.commons.lang3.RandomStringUtils; +import com.fr.third.org.apache.commons.lang3.time.DateFormatUtils; + +import java.io.*; +import java.net.HttpURLConnection; +import java.net.URL; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.*; + +public class WebUtils { + public static String post(String path, Map param) { + String var3 = getParam(param,ServerConfig.getInstance().getServerCharset()); + PrintWriter var4 = null; + BufferedReader var5 = null; + String var6 = ""; + + try { + URL var7 = new URL(path); + HttpURLConnection var8 = (HttpURLConnection) var7.openConnection(); + var8.setRequestProperty("accept", "*/*"); + var8.setRequestProperty("connection", "Keep-Alive"); + var8.setRequestProperty("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;SV1)"); +// var8.setRequestProperty("Accept-Charset", "UTF-8"); + var8.setRequestMethod("POST"); + var8.setDoOutput(true); + var8.setDoInput(true); + var4 = new PrintWriter(new OutputStreamWriter(var8.getOutputStream(), StandardCharsets.UTF_8)); + var4.print(var3); + var4.flush(); + + String var9; + for (var5 = new BufferedReader(new InputStreamReader(var8.getInputStream(), "UTF-8")); (var9 = var5.readLine()) != null; var6 = var6 + var9) { + ; + } + } catch (Exception var18) { + var18.printStackTrace(); + } finally { + try { + if (var4 != null) { + var4.close(); + } + + if (var5 != null) { + var5.close(); + } + } catch (Exception var17) { + ; + } + + } + + return var6; + } + + /** + * 发送json 模式的请求 + * + * @param url + * @param param + * @return + */ + public static String sendJsonPost(String url, String param) { + StringBuilder sb = new StringBuilder(); + PrintWriter out = null; + BufferedReader in = null; + HttpURLConnection conn = null; + try { + URL realUrl = new URL(url); + // 打开和URL之间的连接 + conn = (HttpURLConnection) realUrl.openConnection(); + // 设置通用的请求属性 + conn.setRequestProperty("accept", "*/*"); + conn.setRequestMethod("POST"); +// conn.setRequestProperty("connection", "Keep-Alive"); + String property = System.getProperty("os.name"); + String serverCharset="utf-8"; +// if (property.contains("windows")) { +// serverCharset="GBK"; +// } + conn.setRequestProperty("Content-Type", "application/json; charset="+serverCharset); + + conn.setRequestProperty("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;SV1)"); + // 发送POST请求必须设置如下两行 + conn.setDoOutput(true); + conn.setDoInput(true); + // 获取URLConnection对象对应的输出流 + out = new PrintWriter(new OutputStreamWriter(conn.getOutputStream(), StandardCharsets.UTF_8)); + // 发送请求参数 + if (StringUtils.isNotBlank(param)) { + out.print(param); + } + // flush输出流的缓冲 + out.flush(); + // 定义BufferedReader输入流来读取URL的响应 + in = new BufferedReader(new InputStreamReader(conn.getInputStream())); + String line; + sb = new StringBuilder(); + while ((line = in.readLine()) != null) { + sb.append(line); + } + } catch (Exception e) { + if (conn != null) { + InputStream errorStream = ( conn).getErrorStream(); + in = new BufferedReader(new InputStreamReader(errorStream)); + sb = new StringBuilder(); + String line; + try { + while ((line = in.readLine()) != null) { + sb.append(line); + } + } catch (Exception ee) { + + } + System.out.println("错误响应:=======》" + sb); + } + System.out.println("发送 POST 请求出现异常!" + e); + e.printStackTrace(); + } + // 使用finally块来关闭输出流、输入流 + finally { + try { + if (null != in) { + in.close(); + } + if (out != null) { + out.close(); + } + } catch (IOException ex) { + ex.printStackTrace(); + } + } + return sb.toString(); + } + + private static String getParam(Map var0,String enc) { + String var1 = ""; + Set var2 = var0.keySet(); + Iterator var3 = var2.iterator(); + + while (var3.hasNext()) { + String var4 = (String) var3.next(); + String var5 = var0.get(var4) + ""; + + try { + var1 = var1 + (var1.length() == 0 ? "" : "&") + URLEncoder.encode(var4, enc) + "=" + URLEncoder.encode(var5, enc); + } catch (Exception var7) { + ; + } + } + + return var1; + } + + + + public static String getSyncDepOrUserAccessToken(String eid, String secret) { + Map parms = new HashMap(); + parms.put("eid", eid); + parms.put("secret", secret); + parms.put("scope", "resGroupSecret"); + + return getAccessToken(parms); + } + + public static LoginUserModel getUserInfo(String appid, String acc, String tick) throws Exception { + String cloudHost = YituanPri.getInstance().getCloudHost(); + String var2 = cloudHost + "/gateway/ticket/user/acquirecontext?accessToken=" + acc; + JSONObject params = new JSONObject(); + params.put("appid", appid); + params.put("ticket", tick); + String resp = sendJsonPost(var2, params.toString()); + JSONObject jsonObject = new JSONObject(resp); + if (jsonObject.getBoolean("success")) { + JSONObject data = jsonObject.getJSONObject("data"); + LoginUserModel model = new LoginUserModel(); + model.setAppid(data.getString("appid")); + model.setUsername(data.getString("username")); + model.setUserid(data.getString("userid")); + model.setJobNo(data.getString("jobNo")); + model.setOpenid(data.getString("openid")); + return model; + } else { + FRContext.getLogger().info("登陆用户失败,响应:" + resp); + } + return null; + } + + /** + * 根据不同的scope获取accessToken + * resGroupSecret 组织人员通讯录读取密钥、组织人员通讯录同步密钥、签到数据密钥、时间助手密钥、 + * 生态圈同步密钥 + * + * @param appId + * @param secret + * @return + */ + public static String getAppAccessToken(String appId, String secret) { + Map parms = new HashMap(); + parms.put("appId", appId); + parms.put("secret", secret); + parms.put("scope", "app"); + + return getAccessToken(parms); + } + + public static String getAccessToken(Map parms) { + String cloudHost = YituanPri.getInstance().getCloudHost(); + String url = cloudHost + "/gateway/oauth2/token/getAccessToken"; + parms.put("timestamp", System.currentTimeMillis() + ""); + String content = post(url, parms); + FineLoggerFactory.getLogger().error("获取ticket:{}", content); + JSONObject object = new JSONObject(content); + Boolean success = object.getBoolean("success"); + if (success) { + JSONObject data = object.getJSONObject("data"); + return data.getString("accessToken"); + } + return null; + } + + public static List getUserByPage(String eid, String sect, int page) { + String cloudHost = YituanPri.getInstance().getCloudHost(); + String url = cloudHost +"/gateway/openimport/open/person/getall?accessToken=" + getSyncDepOrUserAccessToken(eid, sect); + Map params = new HashMap<>(); + params.put("nonce", RandomStringUtils.randomAlphabetic(8)); + params.put("eid", eid); + JSONObject object = new JSONObject(); + object.put("begin", page * 1000); + object.put("count", 1000); + params.put("data", object.toString()); + String post = post(url, params); + JSONObject json = new JSONObject(post); + List list = new ArrayList<>(); + if (json.getBoolean("success")) { + JSONArray deps = json.getJSONArray("data"); + for (int i = 0; i < deps.size(); i++) { + JSONObject userJson = deps.getJSONObject(i); + /* + * 人员 + "openId":String, //人员的openid + "name":String, //姓名 + "photoUrl":String, //头像URL + "phone":String, //手机号码 + "isHidePhone":String, //是否在通讯录中隐藏手机号码,0: 不隐藏; 1: 隐藏,默认为0 + "email":String, //邮箱 + "department":String, //组织长名称 + "jobNo":String, //企业工号 + "jobTitle":String, //职位 + "gender":int, //性别,0: 不确定; 1: 男; 2: 女 + "status":int, //状态 0: 注销,1: 正常,2: 禁用 + "orgUserType":int //是否部门负责人 0:否, 1:是 + */ + String id = userJson.getString("openId"); + String photoUrl = userJson.getString("photoUrl"); + String name = userJson.getString("name"); + String jobNo = userJson.getString("jobNo"); + String phone = userJson.getString("phone"); + String depName = userJson.getString("department"); + int status = userJson.getInt("status"); + MyUserBean entity = new MyUserBean(); + entity.setPhone(phone); + entity.setPhotoUrl(photoUrl); + entity.setStatus(status); + entity.setOpenId(id); + entity.setName(name); + entity.setDepartment(depName); + entity.setJobNo(jobNo); + list.add(entity); + } + } else { + FRContext.getLogger().info("同步用户失败,响应:" + post); + } + return list; + } + + /** + * sect 组织人员通讯录读取密钥 + * + * @param eid + * @param sect + */ + public static List getAllDep(String eid, String sect) { + String cloudHost = YituanPri.getInstance().getCloudHost(); + String url = cloudHost +"/gateway/openimport/open/dept/getall?accessToken=" + getSyncDepOrUserAccessToken(eid, sect); + Map params = new HashMap<>(); + params.put("nonce", RandomStringUtils.randomAlphabetic(8)); + params.put("eid", eid); + String post = post(url, params); + JSONObject json = new JSONObject(post); + List list = new ArrayList<>(); + if (json.getBoolean("success")) { + JSONArray deps = json.getJSONArray("data"); + for (int i = 0; i < deps.size(); i++) { + JSONObject depJson = deps.getJSONObject(i); + /** + * { //组织列表 + * "id":String, //组织的id + * "parentId":String, //组织父Id + * "name":String, //组织名称 + * "department":String, //组织长名称 + * "weights":int //排序码 + * } + */ + String id = depJson.getString("id"); + String pid = depJson.getString("parentId"); + String name = depJson.getString("name"); + String depName = depJson.getString("department"); + int order = depJson.getInt("weights"); + MyDepBean depBean = new MyDepBean(); + depBean.setDepName(depName); + depBean.setId(id); + depBean.setOrder(order); + depBean.setParentId(pid); + depBean.setName(name); + list.add(depBean); + } + } else { + FRContext.getLogger().info("同步部门失败,响应:" + post); + } + return list; + } + + public static JSONArray getUserLastSyn(int begin, String lastSyncUserTime) { + YituanPri myConfig = YituanPri.getInstance(); + String eid = myConfig.getEid(); + String sect = myConfig.getReadKey(); + String cloudHost = myConfig.getCloudHost(); + String url = cloudHost +"/gateway/openimport/open/person/getAtTime?accessToken=" + getSyncDepOrUserAccessToken(eid, sect); + Map params = new HashMap<>(); + params.put("eid", eid); + params.put("time", lastSyncUserTime); + params.put("begin", begin); + String post = post(url, params); +// FineLoggerFactory.getLogger().info("同步的用户数据:{}",post); + JSONObject json = new JSONObject(post); + if (json.getBoolean("success")) { + return json.getJSONArray("data"); + } + return JSONArray.create(); + } + + public static JSONArray getDepLastSyn() { + YituanPri myConfig = YituanPri.getInstance(); + String eid = myConfig.getEid(); + String sect = myConfig.getReadKey(); + String cloudHost = myConfig.getCloudHost(); + String url = cloudHost+"/gateway/openimport/open/dept/getAtTime?accessToken=" + getSyncDepOrUserAccessToken(eid, sect); + String lastSyncUserTime = myConfig.getLastSyncDepTime();//格式:“2014-08-02 01:40:38” + String format = DateFormatUtils.format(new Date(), "yyyy-MM-dd HH:mm:ss"); + if (StringUtils.isBlank(lastSyncUserTime)) { + lastSyncUserTime = format; + } + myConfig.setLastSyncDepTime(format); + Map params = new HashMap<>(); + params.put("eid", eid); + params.put("time", lastSyncUserTime); + String post = post(url, params); + FineLoggerFactory.getLogger().info("同步的部门数据:{}", post); + JSONObject json = new JSONObject(post); + if (json.getBoolean("success")) { + JSONArray users = json.getJSONArray("data"); + return users; + } + return JSONArray.create(); + } + +} diff --git a/src/main/java/com/fr/plugin/utils/YiTuanMaManager.java b/src/main/java/com/fr/plugin/utils/YiTuanMaManager.java new file mode 100644 index 0000000..d323b7d --- /dev/null +++ b/src/main/java/com/fr/plugin/utils/YiTuanMaManager.java @@ -0,0 +1,85 @@ +package com.fr.plugin.utils; + +import com.fr.config.ConfigContext; +import com.fr.config.DefaultConfiguration; +import com.fr.config.holder.Conf; +import com.fr.config.holder.factory.Holders; +import com.fr.stable.StringUtils; + + +public class YiTuanMaManager extends DefaultConfiguration { + + private static volatile YiTuanMaManager config = null; + + private Conf eid = Holders.simple("xxx"); + private Conf url = Holders.simple(""); + private Conf clientId = Holders.simple("xxx"); + private Conf clientSecret = Holders.simple("xxx"); + private Conf sendUserId = Holders.simple("xxx"); + private Conf groupId = Holders.simple("xxx"); + private Conf reportServerUrl = Holders.simple(StringUtils.EMPTY); + + + public static YiTuanMaManager getInstance() { + if (config == null) { + config = ConfigContext.getConfigInstance(YiTuanMaManager.class); + } + return config; + } + + public String getReportServerUrl() { + return reportServerUrl.get(); + } + + public void setReportServerUrl(String reportServerUrl) { + this.reportServerUrl.set(reportServerUrl); + } + + public String getEid() { + return eid.get(); + } + + public void setEid(String eid) { + this.eid.set(eid); + } + + public String getUrl() { + return url.get(); + } + + public void setUrl(String url) { + this.url.set(url); + } + + public String getClientId() { + return clientId.get(); + } + + public void setClientId(String clientId) { + this.clientId.set(clientId); + } + + public String getClientSecret() { + return clientSecret.get(); + } + + public void setClientSecret(String clientSecret) { + this.clientSecret.set(clientSecret); + } + + public String getGroupId() { + return groupId.get(); + } + + public void setGroupId(String groupId) { + this.groupId.set(groupId); + } + + public String getSendUserId() { + return sendUserId.get(); + } + + public void setSendUserId(String sendUserId) { + this.sendUserId.set(sendUserId); + } +} diff --git a/src/main/java/com/fr/plugin/utils/YiTuanMaUtils.java b/src/main/java/com/fr/plugin/utils/YiTuanMaUtils.java new file mode 100644 index 0000000..60fee22 --- /dev/null +++ b/src/main/java/com/fr/plugin/utils/YiTuanMaUtils.java @@ -0,0 +1,677 @@ +package com.fr.plugin.utils; + +import com.fanruan.api.log.LogKit; +import com.fanruan.api.net.http.HttpKit; +import com.fr.general.ComparatorUtils; +import com.fr.log.FineLoggerFactory; +import com.fr.plugin.dao.MyYiTuanDao; +import com.fr.plugin.entitys.YTYiTuanEntity; +import com.fr.plugin.yt.MyCoreDBAccess; +import com.fr.report.stable.fun.Actor; +import com.fr.stable.ActorConstants; +import com.fr.stable.ActorFactory; +import com.fr.stable.StringUtils; +import com.fr.stable.db.action.DBAction; +import com.fr.stable.db.dao.DAOContext; +import com.fr.stable.query.QueryFactory; +import com.fr.stable.query.restriction.RestrictionFactory; +import com.fr.third.guava.cache.*; +import com.mashape.unirest.http.HttpResponse; +import com.mashape.unirest.http.JsonNode; +import com.mashape.unirest.http.Unirest; +import org.json.JSONArray; +import org.json.JSONObject; + +import java.io.IOException; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.concurrent.TimeUnit; + +/** + * xx码API调用工具类 + * Created by Shinelon on 2017/12/13. + */ +public class YiTuanMaUtils { + public final static String API_BASE_URL = "https://xxxx.cn/openapi/" ; + public final static String APP_TOKEN_URL = API_BASE_URL + "oauth/token" ; + public final static String APP_TICKET_URL = API_BASE_URL + "oauth/ticket" ; + public final static String APP_AUTHCODE_URL = API_BASE_URL + "oauth/authorize" ; + public final static String APP_AUTHUSERID_URL = API_BASE_URL + "user/get-user-ids?authCode=" ; + public final static String GET_ALLUSER_URL = API_BASE_URL + "group/members/" ; + public final static String APP_SENDMSG_URL = API_BASE_URL + "message/send-to-eapp" ; + public final static String APP_SENDMSG_TO_USER = API_BASE_URL + "message/send-to-users" ; + public final static String GROUP_SENDMSG_URL = API_BASE_URL + "message/send-to-group" ; + + public final static String ACCOUNT_URL = "https://xxxx.cn/esenaccount/openapi/account" ; + + + public final static int SUCCESS_CODE = 200; + public final static int EXPIRE_CODE = 400; + public final static int ERROR_CODE = 401; + public final static int SYS_ERROR_CODE = 500; + + public final static String APPLICATION_JSON_UTF8 = "application/json;charset=UTF-8" ; + + /** + * token缓存,2小时有效期 + */ + private static LoadingCache tokenCache = CacheBuilder.newBuilder() + .expireAfterWrite(2, TimeUnit.HOURS) + .removalListener(new RemovalListener() { + @Override + public void onRemoval( + RemovalNotification notification) { + LogKit.debug(notification.getKey() + " was removed, cause is " + notification.getCause()); + } + }).build(new CacheLoader() { + @Override + public String load(String key) throws Exception { + return getAccessTokenFromAPI(key); + } + }); + + /** + * ticket缓存,10分钟有效期 + */ + private static LoadingCache ticketCache = CacheBuilder.newBuilder() + .expireAfterWrite(10, TimeUnit.MINUTES) + .removalListener(new RemovalListener() { + @Override + public void onRemoval( + RemovalNotification notification) { + LogKit.debug(notification.getKey() + " was removed, cause is " + notification.getCause()); + } + }).build(new CacheLoader() { + @Override + public String load(String key) throws Exception { + return getTicketFromAPI(key); + } + }); + + private static LoadingCache testCache = CacheBuilder.newBuilder() + .expireAfterWrite(5, TimeUnit.SECONDS) + .removalListener(new RemovalListener() { + @Override + public void onRemoval(RemovalNotification notification) { + LogKit.debug(notification.getKey() + " was removed, cause is " + notification.getCause()); + } + }).build(new CacheLoader() { + @Override + public String load(String key) throws Exception { + return getTicketFromAPI(key); + } + }); + + + /** + * post请求 + * + * @param bodyJSON + * @param url + * @return + * @throws Exception + */ + private static HttpResponse buildPostResponce(JSONObject bodyJSON, String url) throws Exception { + HttpResponse jsonResponse = null; + jsonResponse = Unirest + .post(url) + .header("Content-Type" , APPLICATION_JSON_UTF8) + .body(bodyJSON.toString()).asJson(); + return jsonResponse; + } + + /** + * post请求(header处理) + * + * @param bodyJSON + * @param url + * @param access_token + * @return + * @throws Exception + */ + private static HttpResponse buildPostResponceWithToken(JSONObject bodyJSON, String url, String access_token) throws Exception { + HttpResponse jsonResponse = null; + jsonResponse = Unirest + .post(url) + .header("Content-Type" , APPLICATION_JSON_UTF8) + .header("Authorization" , getAuthorizationHeader(access_token)) + .body(bodyJSON.toString()).asJson(); + return jsonResponse; + } + + /** + * get请求 + * + * @param url + * @param access_token + * @return + * @throws Exception + */ + private static HttpResponse buildGetResponceWithToken(String url, String access_token) throws Exception { + HttpResponse jsonResponse = null; + jsonResponse = Unirest + .get(url) + .header("Content-Type" , APPLICATION_JSON_UTF8) + .header("Authorization" , getAuthorizationHeader(access_token)) + .asJson(); + return jsonResponse; + } + + /** + * 获取缓存中的token + * + * @return + */ + public static String getAccessToken(String clientId) { + try { + String token = tokenCache.get(clientId); + if (StringUtils.isEmpty(token)) { + token = getAccessTokenFromAPI(clientId); + if (StringUtils.isNotBlank(token)) { + tokenCache.put(clientId, token); + } + } + return token; + } catch (Exception e) { + FineLoggerFactory.getLogger().debug("==================== 获取缓存access_token失败!"); + } + return "" ; + } + + /** + * 根据clientId以及clientSecret获取token + * + * @param clientId + * @param clientSecret + * @return + * @throws Exception + */ + public static String getAccessTokenFromConfig(String clientId, String clientSecret) throws Exception { + JSONObject jsonObject = new JSONObject(); + jsonObject.put("clientId" , clientId); + jsonObject.put("clientSecret" , clientSecret); + HttpResponse jsonResponse = buildPostResponce(jsonObject, APP_TOKEN_URL); + if (jsonResponse.getStatus() == SUCCESS_CODE) { + JsonNode jsonNode = jsonResponse.getBody(); + return jsonNode.getObject().getString("access_token"); + } else { + FineLoggerFactory.getLogger().debug("==================== 获取xx码access_token失败!"); + FineLoggerFactory.getLogger().debug("==================== 获取xx码access_token失败! responseCode = " + jsonResponse.getStatus()); + FineLoggerFactory.getLogger().debug("==================== responseBody = " + jsonResponse.getBody().toString()); + } + return "" ; + } + + /** + * 缓存build时专用,获取token + * todo 改成查询clientId + * + * @return + * @throws Exception + */ + public static String getAccessTokenFromAPI(String clientId) throws Exception { +// YiTuanMaManager manager = YiTuanMaManager.getInstance(); +// return getAccessTokenFromConfig(manager.getClientId(), manager.getClientSecret()); + YTYiTuanEntity entity = getYituanEntityByClientId(clientId); + if (entity != null) { + String secret = entity.getSecret(); + return getAccessTokenFromConfig(clientId, secret); + } + return "" ; + } + + public static YTYiTuanEntity getYituanEntityByClientId(String clientId) throws Exception { + List ytYiTuanEntities = MyCoreDBAccess.getAccessor().runQueryAction(new DBAction>() { + @Override + public List run(DAOContext daoContext) throws Exception { + return daoContext.getDAO(MyYiTuanDao.class).find(QueryFactory.create().addRestriction(RestrictionFactory.eq("clientId" , clientId))); + } + }); + if (!ytYiTuanEntities.isEmpty()) { + return ytYiTuanEntities.get(0); + } + return null; + } + + /** + * 获取缓存中的ticket + * + * @return + */ + public static String getTicket(String clientid) { + try { + String ticket = ticketCache.get(clientid); + if (StringUtils.isEmpty(ticket)) { + ticket = getTicketFromAPI(clientid); + ticketCache.put(clientid, ticket); + } + return ticket; + } catch (Exception e) { + FineLoggerFactory.getLogger().debug("==================== 获取缓存ticket失败!"); + } + return "" ; + } + + public static String refreshToken(String clientId) throws Exception { + String access_token = getAccessTokenFromAPI(clientId); + if (StringUtils.isNotBlank(access_token)) { + tokenCache.put(clientId, access_token); + } + return access_token; + } + + + /** + * 根据token获取ticket + * + * @param access_token + * @return + * @throws Exception + */ + public static String getTicketWithToken(String clientId, String access_token) throws Exception { + LogKit.debug("==================== :获取ticket token=" + access_token); + return getTicket4ThreeTimes(clientId, access_token, 0); + + } + + private static String getTicket4ThreeTimes(String clientId, String access_token, int count) throws Exception { + if (count < 3) { + JSONObject jsonObject = new JSONObject(); + jsonObject.put("accessToken" , access_token); + HttpResponse jsonResponse = buildPostResponceWithToken(jsonObject, APP_TICKET_URL, access_token); + if (jsonResponse.getStatus() == SUCCESS_CODE) { + JsonNode jsonNode = jsonResponse.getBody(); + return jsonNode.getObject().getString("ticket"); + } else if (jsonResponse.getStatus() == EXPIRE_CODE || jsonResponse.getStatus() == ERROR_CODE) { + LogKit.debug("==================== 获取xx码ticket失败! token失效,重新获取"); + access_token = refreshToken(clientId); + count++; + return getTicket4ThreeTimes(clientId, access_token, count); + } else { + FineLoggerFactory.getLogger().debug("==================== 获取xx码ticket失败!"); + FineLoggerFactory.getLogger().debug("==================== 获取xx码ticket失败! responseCode = " + jsonResponse.getStatus()); + FineLoggerFactory.getLogger().debug("==================== responseBody = " + jsonResponse.getBody().toString()); + return "" ; + } + } else { + FineLoggerFactory.getLogger().debug("==================== 3次获取xx码ticket失败!"); + return "" ; + } + } + + /** + * 缓存build时专用,获取ticket + * + * @return + * @throws Exception + */ + public static String getTicketFromAPI(String clientId) throws Exception { + String access_token = getAccessToken(clientId); + if (StringUtils.isNotEmpty(access_token)) { + return getTicketWithToken(clientId, access_token); + } + return "" ; + } + + /** + * 获取authCode,已弃 + * + * @param ticket + * @param access_token + * @return + * @throws Exception + */ + public static String getAuthCode(String ticket, String access_token) throws Exception { + LogKit.debug("==================== :获取authCode token=" + access_token); + JSONObject jsonObject = new JSONObject(); + jsonObject.put("ticket" , ticket); + HttpResponse jsonResponse = buildPostResponceWithToken(jsonObject, APP_AUTHCODE_URL, access_token); + if (jsonResponse.getStatus() == SUCCESS_CODE) { + JsonNode jsonNode = jsonResponse.getBody(); + return jsonNode.getObject().getString("authCode"); + } else { + FineLoggerFactory.getLogger().debug("==================== 获取xx码authCode失败!"); + FineLoggerFactory.getLogger().debug("==================== 获取xx码authCode失败! responseCode = " + jsonResponse.getStatus()); + FineLoggerFactory.getLogger().debug("==================== responseBody = " + jsonResponse.getBody().toString()); + } + return null; + } + + /** + * 获取当前xx码用户id + * + * @param authCode + * @param access_token + * @return + * @throws Exception + */ + public static String getCurrentUserId(String clientId, String authCode, String access_token) throws Exception { + LogKit.debug("==================== :获取当前xx码用户id token=" + access_token); + return getCurrentUserId4ThreeTimes(clientId, authCode, access_token, 0); + } + + private static String getCurrentUserId4ThreeTimes(String clientId, String authCode, String access_token, int count) throws Exception { + if (count < 3) { + HttpResponse jsonResponse = buildGetResponceWithToken(APP_AUTHUSERID_URL + authCode, access_token); + if (jsonResponse.getStatus() == SUCCESS_CODE) { + JsonNode jsonNode = jsonResponse.getBody(); + return jsonNode.getObject().getString("userId"); + } else if (jsonResponse.getStatus() == EXPIRE_CODE || jsonResponse.getStatus() == ERROR_CODE) { + LogKit.debug("==================== 获取xx码用户ID失败! token失效,重新获取"); + access_token = refreshToken(clientId); + count++; + return getCurrentUserId4ThreeTimes(clientId, authCode, access_token, count); + } else { + FineLoggerFactory.getLogger().debug("==================== 获取xx码用户ID失败!"); + FineLoggerFactory.getLogger().debug("==================== 获取xx码用户ID失败! responseCode = " + jsonResponse.getStatus()); + FineLoggerFactory.getLogger().debug("==================== responseBody = " + jsonResponse.getBody().toString()); + return null; + } + } else { + FineLoggerFactory.getLogger().debug("==================== 3次获取xx码用户ID失败!"); + return null; + } + } + + /** + * 获取团队id,已弃 + * + * @param authCode + * @param access_token + * @return + * @throws Exception + */ + public static String getGroupId(String authCode, String access_token) throws Exception { + LogKit.debug("==================== :获取团队id token=" + access_token); + HttpResponse jsonResponse = buildGetResponceWithToken(APP_AUTHUSERID_URL + authCode, access_token); + if (jsonResponse.getStatus() == SUCCESS_CODE) { + JsonNode jsonNode = jsonResponse.getBody(); + return jsonNode.getObject().getString("tenantId"); + } else { + FineLoggerFactory.getLogger().debug("==================== 获取BI团队ID失败!"); + FineLoggerFactory.getLogger().debug("==================== 获取BI团队ID失败! responseCode = " + jsonResponse.getStatus()); + FineLoggerFactory.getLogger().debug("==================== responseBody = " + jsonResponse.getBody().toString()); + } + return null; + } + + /** + * 获取团队下所有用户 + * + * @param access_token + * @return + * @throws Exception + */ + public static JSONArray getUserInfo(String clientId, String access_token) throws Exception { + YTYiTuanEntity tuanEntity = getYituanEntityByClientId(clientId); + if (tuanEntity != null) { + String groupId = tuanEntity.getGroupId(); + return getUserInfo4ThreeTimes(clientId, groupId, access_token, 0); + } + LogKit.error("同步 client ID : {} 无法获取到对应的配置" , clientId); + return new JSONArray(); + } + + private static JSONArray getUserInfo4ThreeTimes(String clientId, String groupId, String access_token, int count) throws Exception { + if (count < 3) { + HttpResponse jsonResponse = buildGetResponceWithToken(GET_ALLUSER_URL + groupId, access_token); + if (jsonResponse.getStatus() == SUCCESS_CODE) { + JsonNode jsonNode = jsonResponse.getBody(); + return jsonNode.getObject().getJSONArray("members"); + } else if (jsonResponse.getStatus() == EXPIRE_CODE || jsonResponse.getStatus() == ERROR_CODE) { + LogKit.debug("==================== 获取xx码团队所有用户失败! token失效,重新获取"); + access_token = refreshToken(clientId); + count++; + return getUserInfo4ThreeTimes(clientId, groupId, access_token, count); + } else { + FineLoggerFactory.getLogger().debug("==================== 获取xx码团队所有用户失败!"); + FineLoggerFactory.getLogger().debug("==================== 获取xx码团队所有用户失败! responseCode = " + jsonResponse.getStatus()); + FineLoggerFactory.getLogger().debug("==================== responseBody = " + jsonResponse.getBody().toString()); + return null; + } + } else { + FineLoggerFactory.getLogger().debug("==================== 3次获取xx码团队所有用户失败!"); + return null; + } + } + + /** + * build请求header + * + * @param access_token + * @return + */ + private static String getAuthorizationHeader(String access_token) { + String authorization = "Bearer " + access_token; + return authorization; + } + + /** + * 兼容旧报表h5插件 + * + * @return + */ + public static String getCprOP() { + //兼容老的h5插件 + Actor newH5Actor = ActorFactory.getActor("h5"); + if (newH5Actor == null || ComparatorUtils.equalsIgnoreCase(ActorFactory.getType(newH5Actor), ActorConstants.TYPE_PAGE)) { + return "h5_page" ; + } + return "h5" ; + } + + /** + * 消息发送接口message实体拼接 + * + * @param title + * @param content + * @param linkUrl + * @return + * @throws Exception + */ + private static JSONObject buildMessage(String title, String content, String linkUrl, String image) throws Exception { + JSONObject message = new JSONObject(); + message.put("content" , content); + if (StringUtils.isNotEmpty(linkUrl)) { + message.put("linkUrl" , linkUrl); + } + message.put("msgType" , "TEXT"); + message.put("appletName" , "BI平台"); + YiTuanMaManager manager = YiTuanMaManager.getInstance(); + String logourl = manager.getUrl() + "/url/ytlogo"; +// String logourl = manager.getUrl() + "/resources?path=com/fr/plugin/web/images/log.jpg" ; + message.put("appletLogoUrl" , logourl); + message.put("avatar" , logourl); + message.put("msgType" , "TEXT"); + message.put("msgType" , "TEXT"); + message.put("imageUrl" , image); + message.put("title" , StringUtils.isNotEmpty(title) ? title : "BI消息推送"); + return message; + } + + /** + * 发送应用消息 + * + * @param access_token + * @param eappId + * @param targetIds + * @param title + * @param content + * @param linkUrl + * @throws Exception + */ + public static void sendMsgToUserFromAppWithToken(String clientId, String access_token, String eappId, List targetIds, String title, String content, String linkUrl, String imageUrl) throws Exception { + LogKit.debug("ASP ==================== :发送应用消息clientId:{} token={}" , clientId, access_token); + JSONObject jsonObject = new JSONObject(); + jsonObject.put("eappId" , eappId); + jsonObject.put("appId" , eappId); + jsonObject.put("targetIds" , targetIds); + jsonObject.put("message" , buildMessage(title, content, linkUrl, imageUrl)); + LogKit.debug("==================== 消息内容为:" + jsonObject.toString()); + sendMsgToUserFromAppWithToken4ThreeTimes(clientId, jsonObject, access_token, 0); + } + + private static void sendMsgToUserFromAppWithToken4ThreeTimes(String clientId, JSONObject jsonObject, String access_token, int count) throws Exception { + if (count < 3) { + HttpResponse jsonResponse = buildPostResponceWithToken(jsonObject, APP_SENDMSG_URL, access_token); + if (jsonResponse.getStatus() == SUCCESS_CODE) { + LogKit.debug("==================== 发送应用消息成功!"); + LogKit.debug("==================== 响应{}" , jsonResponse.getBody()); + } else if (jsonResponse.getStatus() == EXPIRE_CODE || jsonResponse.getStatus() == ERROR_CODE) { + LogKit.debug("==================== 发送应用消息失败! token失效,重新获取:{}",jsonResponse.getBody()); + access_token = refreshToken(clientId); + count++; + sendMsgToUserFromAppWithToken4ThreeTimes(clientId, jsonObject, access_token, count); + } else { + FineLoggerFactory.getLogger().debug("==================== 发送应用消息失败!"); + FineLoggerFactory.getLogger().debug("==================== 发送应用消息失败! responseCode = " + jsonResponse.getStatus()); + FineLoggerFactory.getLogger().debug("==================== responseBody = " + jsonResponse.getBody().toString()); + } + } else { + FineLoggerFactory.getLogger().debug("==================== 3次发送应用消息失败!"); + } + } + + /** + * 发送应用消息 + * + * @param targetIds + * @param title + * @param content + * @param linkUrl + * @throws Exception + */ + public static void sendMsgToUserFromApp(String clientId, List targetIds, String title, String content, String linkUrl, String imageUrl) throws Exception { + YTYiTuanEntity entity = getYituanEntityByClientId(clientId); + if (entity != null) { + LogKit.debug("发送请求到clientId {} 团队ID:{}" , clientId, entity.getTeamId()); + sendMsgToUserFromAppWithToken(clientId, getAccessToken(clientId), entity.getTeamId(), targetIds, title, content, linkUrl, imageUrl); + } else { + LogKit.debug("发送请求到clientId 未能找到?????" , clientId); + } + } + + /** + * 发送用户信息 + * + * @param targetIds + * @param title + * @param content + * @param linkUrl + * @throws Exception + */ + public static void sendMSGtoUser(String clientId, String fromUserId, List targetIds, String title, String content, String linkUrl, String imageUrl) throws Exception { + JSONObject params = new JSONObject(); + params.put("fromUserId" , fromUserId); + JSONObject message = buildMessage(title, content, linkUrl, imageUrl); + params.put("message" , message); + JSONArray targets = new JSONArray(); + for (String targetId : targetIds) { + targets.put(targetId); + } + params.put("targetIds" , targets); + sendMSGtoUserWithToken(clientId, params, getAccessToken(clientId), 0); + } + + private static void sendMSGtoUserWithToken(String clientId, JSONObject jsonObject, String access_token, int count) throws Exception { + if (count < 3) { + HttpResponse jsonResponse = buildPostResponceWithToken(jsonObject, APP_SENDMSG_TO_USER, access_token); + if (jsonResponse.getStatus() == SUCCESS_CODE) { + LogKit.debug("==================== 发送个人成功!"); + } else if (jsonResponse.getStatus() == EXPIRE_CODE || jsonResponse.getStatus() == ERROR_CODE) { + LogKit.debug("==================== 发送个人! token失效,重新获取"); + access_token = refreshToken(clientId); + count++; + sendMSGtoUserWithToken(clientId, jsonObject, access_token, count); + } else { + FineLoggerFactory.getLogger().debug("==================== 发送个人失败!"); + FineLoggerFactory.getLogger().debug("==================== 发送个人失败! responseCode = " + jsonResponse.getStatus()); + FineLoggerFactory.getLogger().debug("==================== responseBody = " + jsonResponse.getBody().toString()); + } + } else { + FineLoggerFactory.getLogger().debug("==================== 3次个人失败!"); + } + } + + /** + * 发送聊天群消息 + * + * @param access_token + * @param groupId + * @param fromUserId + * @param title + * @param content + * @param linkUrl + * @throws Exception + */ + public static void sendMsgToGroupWithToken(String clientId, String access_token, String groupId, String fromUserId, String title, String content, String linkUrl, String image) throws Exception { + LogKit.debug("==================== :发送聊天群消息 token=" + access_token); + JSONObject jsonObject = new JSONObject(); + jsonObject.put("groupId" , groupId); + jsonObject.put("fromUserId" , fromUserId); + jsonObject.put("message" , buildMessage(title, content, linkUrl, image)); + LogKit.debug("==================== 消息内容为:" + jsonObject.toString()); + sendMsgToGroupWithToken4ThreeTimes(clientId, jsonObject, access_token, 0); + } + + private static void sendMsgToGroupWithToken4ThreeTimes(String clientId, JSONObject jsonObject, String access_token, int count) throws Exception { + if (count < 3) { + HttpResponse jsonResponse = buildPostResponceWithToken(jsonObject, GROUP_SENDMSG_URL, access_token); + if (jsonResponse.getStatus() == SUCCESS_CODE) { + LogKit.debug("==================== 发送聊天群消息成功!"); + } else if (jsonResponse.getStatus() == EXPIRE_CODE || jsonResponse.getStatus() == ERROR_CODE) { + LogKit.debug("==================== 发送聊天群消息失败! token失效,重新获取"); + access_token = refreshToken(clientId); + count++; + sendMsgToGroupWithToken4ThreeTimes(clientId, jsonObject, access_token, count); + } else { + FineLoggerFactory.getLogger().debug("==================== 发送聊天群消息失败!"); + FineLoggerFactory.getLogger().debug("==================== 发送聊天群消息失败! responseCode = " + jsonResponse.getStatus()); + FineLoggerFactory.getLogger().debug("==================== responseBody = " + jsonResponse.getBody().toString()); + } + } else { + FineLoggerFactory.getLogger().debug("==================== 3次发送聊天群消息失败!"); + } + } + + /** + * 发送聊天群消息 + * + * @param groupId + * @param fromUserId + * @param title + * @param content + * @param linkUrl + * @throws Exception + */ + public static void sendMsgToGroup(String clientId, String groupId, String fromUserId, String title, String content, String linkUrl, String image) throws Exception { + sendMsgToGroupWithToken(clientId, getAccessToken(clientId), groupId, fromUserId, title, content, linkUrl, image); + } + + /** + * 发送公告号消息,未实现 + * + * @param pubOrGroupId + * @param userIds + * @param title + * @param content + * @param url + * @throws Exception + */ + public static void sendMsgToUserFromPublicNum(String pubOrGroupId, List userIds, String title, String content, String url) throws Exception { + LogKit.debug("==================== 发送公告号消息未实现!"); + FineLoggerFactory.getLogger().warn("==================== 发送公告号消息未实现!"); + } + + public static String getUserInfoByAccessToken(String accessToken) throws IOException { + String url = ACCOUNT_URL; + Map headers = new HashMap<>(); + headers.put("Authorization" , "Bearer " + accessToken); + headers.put("Content-Type" , "application/json; charset=utf-8"); + String resp = HttpKit.get(url, new HashMap<>(), headers); + LogKit.error("==================== 获取用户信息返回结果ByAccessToken:" + resp); + com.fr.json.JSONObject jsonObject = new com.fr.json.JSONObject(resp); + return jsonObject.getString("id"); + } +} diff --git a/src/main/java/com/fr/plugin/web/hander/DelAgentHander.java b/src/main/java/com/fr/plugin/web/hander/DelAgentHander.java new file mode 100644 index 0000000..d5eff29 --- /dev/null +++ b/src/main/java/com/fr/plugin/web/hander/DelAgentHander.java @@ -0,0 +1,46 @@ +package com.fr.plugin.web.hander; + +import com.fr.decision.fun.impl.BaseHttpHandler; +import com.fr.json.JSONObject; +import com.fr.plugin.yt.MyCoreDBAccess; +import com.fr.plugin.dao.MyAgentDao; +import com.fr.plugin.entitys.YTAgentEntity; +import com.fr.plugin.utils.MyUtils; +import com.fr.stable.db.action.DBAction; +import com.fr.stable.db.dao.DAOContext; +import com.fr.third.springframework.web.bind.annotation.RequestMethod; +import com.fr.web.utils.WebUtils; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.util.List; + +public class DelAgentHander extends BaseHttpHandler { + @Override + public RequestMethod getMethod() { + return RequestMethod.DELETE; + } + + @Override + public String getPath() { + return "/yt/agent"; + } + + @Override + public boolean isPublic() { + return false; + } + + @Override + public void handle(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse) throws Exception { + final String var3 = WebUtils.getHTTPRequestParameter(httpServletRequest, "id"); + MyCoreDBAccess.getAccessor().runDMLAction(new DBAction>() { + public List run(DAOContext var1) throws Exception { + var1.getDAO(MyAgentDao.class).remove(var3); + return null; + } + }); + JSONObject var4 = MyUtils.createSuccessResponseJSONObject(); + WebUtils.flushSuccessMessageAutoClose(httpServletRequest, httpServletResponse, var4); + } +} diff --git a/src/main/java/com/fr/plugin/web/hander/DelGroupHandler.java b/src/main/java/com/fr/plugin/web/hander/DelGroupHandler.java new file mode 100644 index 0000000..3e64270 --- /dev/null +++ b/src/main/java/com/fr/plugin/web/hander/DelGroupHandler.java @@ -0,0 +1,93 @@ +package com.fr.plugin.web.hander; + +import com.fr.decision.fun.impl.BaseHttpHandler; +import com.fr.json.JSONArray; +import com.fr.json.JSONObject; +import com.fr.plugin.dao.MyGroupDao; +import com.fr.plugin.entitys.YtGroupEntity; +import com.fr.plugin.yt.MyCoreDBAccess; +import com.fr.stable.StringUtils; +import com.fr.stable.db.action.DBAction; +import com.fr.stable.db.dao.DAOContext; +import com.fr.stable.query.QueryFactory; +import com.fr.stable.query.condition.QueryCondition; +import com.fr.stable.query.restriction.RestrictionFactory; +import com.fr.third.springframework.web.bind.annotation.RequestMethod; +import com.fr.web.utils.WebUtils; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.util.ArrayList; +import java.util.List; +import java.util.UUID; + +public class DelGroupHandler extends BaseHttpHandler { + @Override + public RequestMethod getMethod() { + return RequestMethod.POST; + } + + @Override + public String getPath() { + return "/yt/delgroup"; + } + + @Override + public boolean isPublic() { + return false; + } + + @Override + public void handle(HttpServletRequest request, HttpServletResponse httpServletResponse) throws Exception { + JSONArray resp = new JSONArray(); + String groupId = WebUtils.getHTTPRequestParameter(request, "groupId"); + JSONObject respJson = JSONObject.create(); + List ytGroupEntities = checkExist(groupId); + if (StringUtils.isBlank(groupId)) { + respJson.put("msg", "group id 为空"); + respJson.put("errorCode", 1); + WebUtils.flushSuccessMessageAutoClose(request, httpServletResponse, respJson); + return; + } + if (ytGroupEntities.isEmpty()) { + respJson.put("msg", "群组不存在"); + respJson.put("errorCode", 1); + WebUtils.flushSuccessMessageAutoClose(request, httpServletResponse, respJson); + return; + } + delGroup(ytGroupEntities.get(0)); + respJson.put("errorCode", 0); + WebUtils.flushSuccessMessageAutoClose(request, httpServletResponse, respJson); + } + + private void delGroup(YtGroupEntity entity) { + try { + MyCoreDBAccess.getAccessor().runDMLAction(new DBAction() { + @Override + public Object run(DAOContext daoContext) throws Exception { + daoContext.getDAO(MyGroupDao.class).remove(entity.getId()); + return null; + } + }); + } catch (Exception e) { + e.printStackTrace(); + } + } + + private List checkExist(String id) { + List entityList = null; + try { + entityList = MyCoreDBAccess.getAccessor().runQueryAction(new DBAction>() { + public List run(DAOContext content) throws Exception { + QueryCondition queryCondition = QueryFactory.create(); + queryCondition.addRestriction(RestrictionFactory.and(RestrictionFactory.like("groupId", id))); + return content.getDAO(MyGroupDao.class).find(queryCondition); + } + }); + return entityList; + } catch (Exception e) { + e.printStackTrace(); + } + return new ArrayList<>(); + } +} diff --git a/src/main/java/com/fr/plugin/web/hander/GetAgentHandler.java b/src/main/java/com/fr/plugin/web/hander/GetAgentHandler.java new file mode 100644 index 0000000..c9141f9 --- /dev/null +++ b/src/main/java/com/fr/plugin/web/hander/GetAgentHandler.java @@ -0,0 +1,59 @@ +package com.fr.plugin.web.hander; + +import com.fr.decision.fun.impl.BaseHttpHandler; +import com.fr.json.JSONArray; +import com.fr.json.JSONObject; +import com.fr.plugin.beans.MyAgentBean; +import com.fr.plugin.entitys.YTAgentEntity; +import com.fr.plugin.utils.MyUtils; +import com.fr.third.springframework.web.bind.annotation.RequestMethod; +import com.fr.web.utils.WebUtils; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.util.Iterator; +import java.util.List; + +public class GetAgentHandler extends BaseHttpHandler { + @Override + public RequestMethod getMethod() { + return RequestMethod.GET; + } + + @Override + public String getPath() { + return "/yt/agent"; + } + + @Override + public boolean isPublic() { + return false; + } + + @Override + public void handle(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse) throws Exception { + int var3 = WebUtils.getHTTPRequestIntParameter(httpServletRequest, "startIdx", -1); + int var4 = WebUtils.getHTTPRequestIntParameter(httpServletRequest, "count", -1); + List var5 = MyUtils.getAgentsSortedByTimeStamp(); + JSONArray var6 = new JSONArray(); + JSONObject var7 = MyUtils.createSuccessResponseJSONObject(); + if (var3 == -1 && var4 == -1) { + Iterator var11 = var5.iterator(); + while(var11.hasNext()) { + YTAgentEntity var12 = (YTAgentEntity)var11.next(); + var6.put(var12.createBean(new MyAgentBean()).toJSONObject()); + } + } else if (var3 > -1 && var4 > -1) { + int var8 = Math.min(var4 + var3, var5.size()); + + for(int var9 = var3; var9 < var8; ++var9) { + YTAgentEntity var10 = (YTAgentEntity)var5.get(var9); + var6.put(var10.createBean(new MyAgentBean()).toJSONObject()); + } + } + + var7.put("total", var5.size()); + var7.put("agentList", var6); + WebUtils.flushSuccessMessageAutoClose(httpServletRequest, httpServletResponse, var7); + } +} diff --git a/src/main/java/com/fr/plugin/web/hander/GetConfigHandler.java b/src/main/java/com/fr/plugin/web/hander/GetConfigHandler.java new file mode 100644 index 0000000..51fee50 --- /dev/null +++ b/src/main/java/com/fr/plugin/web/hander/GetConfigHandler.java @@ -0,0 +1,44 @@ +package com.fr.plugin.web.hander; + +import com.fr.decision.fun.impl.BaseHttpHandler; +import com.fr.json.JSONObject; +import com.fr.plugin.config.YituanPri; +import com.fr.plugin.utils.MyUtils; +import com.fr.plugin.utils.YiTuanMaManager; +import com.fr.third.springframework.web.bind.annotation.RequestMethod; +import com.fr.web.utils.WebUtils; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +public class GetConfigHandler extends BaseHttpHandler { + @Override + public RequestMethod getMethod() { + return RequestMethod.GET; + } + + @Override + public String getPath() { + return "/yt/report/server/url"; + } + + @Override + public boolean isPublic() { + return false; + } + + @Override + public void handle(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse) throws Exception { + JSONObject var3 = MyUtils.createSuccessResponseJSONObject(); + YiTuanMaManager var4 = YiTuanMaManager.getInstance(); + var3.put("reportServerUrl", var4.getReportServerUrl()); + var3.put("appId", var4.getClientId()); + var3.put("eid", var4.getEid()); + var3.put("appSecret", var4.getClientSecret()); + var3.put("readKey", var4.getGroupId());//groupid + var3.put("reportServerUrl", var4.getUrl()); + var3.put("sendUserId", var4.getSendUserId()); + + WebUtils.flushSuccessMessageAutoClose(httpServletRequest, httpServletResponse, var3); + } +} diff --git a/src/main/java/com/fr/plugin/web/hander/GetGroupsHandler.java b/src/main/java/com/fr/plugin/web/hander/GetGroupsHandler.java new file mode 100644 index 0000000..ef5432c --- /dev/null +++ b/src/main/java/com/fr/plugin/web/hander/GetGroupsHandler.java @@ -0,0 +1,119 @@ +package com.fr.plugin.web.hander; + +import com.fr.decision.fun.impl.BaseHttpHandler; +import com.fr.json.JSONArray; +import com.fr.json.JSONObject; +import com.fr.plugin.beans.MyDepBean; +import com.fr.plugin.beans.MyGroupBean; +import com.fr.plugin.dao.MyGroupDao; +import com.fr.plugin.entitys.YtGroupEntity; +import com.fr.plugin.utils.MyUtils; +import com.fr.plugin.yt.MyCoreDBAccess; +import com.fr.plugin.yt.MyUserSyncManager; +import com.fr.stable.StringUtils; +import com.fr.stable.db.action.DBAction; +import com.fr.stable.db.dao.DAOContext; +import com.fr.stable.query.QueryFactory; +import com.fr.stable.query.condition.QueryCondition; +import com.fr.stable.query.restriction.RestrictionFactory; +import com.fr.third.springframework.web.bind.annotation.RequestMethod; +import com.fr.web.utils.WebUtils; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.util.Iterator; +import java.util.List; +import java.util.stream.Collectors; + +public class GetGroupsHandler extends BaseHttpHandler { + @Override + public RequestMethod getMethod() { + return RequestMethod.GET; + } + + @Override + public String getPath() { + return "/yt/groups"; + } + + @Override + public boolean isPublic() { + return false; + } + + @Override + public void handle(HttpServletRequest request, HttpServletResponse response) throws Exception { + int startIdx = WebUtils.getHTTPRequestIntParameter(request, "startIdx", 0); + int count = WebUtils.getHTTPRequestIntParameter(request, "count", 10); + String keyword = WebUtils.getHTTPRequestParameter(request, "keyword"); + List users; + Long size = 0L; + try { + users = this.getGroups(keyword, startIdx, count); + size = this.countSelectedUser(keyword); + JSONObject jsonObject = toUserResultJo(users, size); + JSONObject responseJSONObject = MyUtils.createSuccessResponseJSONObject(); + responseJSONObject.put("userList", jsonObject); + WebUtils.flushSuccessMessageAutoClose(request, response, responseJSONObject); + } catch (Exception e) { + e.printStackTrace(response.getWriter()); + } + } + + private Long countSelectedDepartmentUser( ) throws Exception { + return MyUserSyncManager.getInstance().countDepartmentUserList( ); + } + + private List getGroups(String name, int start, int count) throws Exception { + if (StringUtils.isNotBlank(name)) { + List entityList = MyCoreDBAccess.getAccessor().runQueryAction(new DBAction>() { + public List run(DAOContext content) throws Exception { + QueryCondition queryCondition = QueryFactory.create(); + queryCondition.addRestriction(RestrictionFactory.and(RestrictionFactory.like("name", name))); + queryCondition.setSkip(start); + queryCondition.setCount(count); + return content.getDAO(MyGroupDao.class).find(queryCondition); + } + }); + return entityList.stream().map(YtGroupEntity::createBean).collect(Collectors.toList()); + } else { + List entityList = MyCoreDBAccess.getAccessor().runQueryAction(new DBAction>() { + public List run(DAOContext content) throws Exception { + QueryCondition queryCondition = QueryFactory.create(); + queryCondition.setSkip(start); + queryCondition.setCount(count); + return content.getDAO(MyGroupDao.class).find(queryCondition); + } + }); + return entityList.stream().map(YtGroupEntity::createBean).collect(Collectors.toList()); + } + + } + + + private Long countSelectedUser(String key) throws Exception { + return MyCoreDBAccess.getAccessor().runQueryAction(new DBAction() { + public Long run(DAOContext content) throws Exception { + QueryCondition queryCondition = QueryFactory.create(); + queryCondition.addRestriction(RestrictionFactory.and(RestrictionFactory.like("name", key))); + System.out.println(queryCondition); + return content.getDAO(MyGroupDao.class).count(queryCondition); + } + }); + } + + public static JSONObject toUserResultJo(List users, Long var1) throws Exception { + JSONObject var2 = JSONObject.create(); + JSONArray var3 = JSONArray.create(); + + JSONObject var6; + for (Iterator var4 = users.iterator(); var4.hasNext(); var3.put(var6)) { + MyGroupBean var5 = (MyGroupBean) var4.next(); + var6 = var5.createJSONConfig(); + } + + var2.put("total", var1); + var2.put("users", var3); + return var2; + } +} diff --git a/src/main/java/com/fr/plugin/web/hander/GetTicketHandler.java b/src/main/java/com/fr/plugin/web/hander/GetTicketHandler.java new file mode 100644 index 0000000..cfd599a --- /dev/null +++ b/src/main/java/com/fr/plugin/web/hander/GetTicketHandler.java @@ -0,0 +1,45 @@ +package com.fr.plugin.web.hander; + +import com.fr.decision.fun.impl.BaseHttpHandler; +import com.fr.json.JSONObject; +import com.fr.log.FineLoggerFactory; +import com.fr.plugin.utils.YiTuanMaUtils; +import com.fr.stable.StringUtils; +import com.fr.third.springframework.web.bind.annotation.RequestMethod; +import com.fr.web.utils.WebUtils; +import io.netty.util.internal.StringUtil; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +public class GetTicketHandler extends BaseHttpHandler { + @Override + public RequestMethod getMethod() { + return null; + } + + @Override + public String getPath() { + return "/yt/ticket"; + } + + @Override + public boolean isPublic() { + return true; + } + + + @Override + public void handle(HttpServletRequest req, HttpServletResponse httpServletResponse) throws Exception { + JSONObject jsonObject=new JSONObject(); + String clientId = req.getParameter("clientId"); + String ticket = YiTuanMaUtils.getTicket(clientId); + if (StringUtils.isBlank(ticket)) { + FineLoggerFactory.getLogger().info("==================== 单点登录获取缓存ticket失败,通过配置获取"); + ticket = YiTuanMaUtils.getTicketWithToken(clientId,YiTuanMaUtils.getAccessTokenFromAPI(clientId)); + FineLoggerFactory.getLogger().info("==================== 单点登录通过配置获取ticket为:" + ticket); + } + jsonObject.put("ticket", ticket); + WebUtils.printAsJSON(httpServletResponse,jsonObject); + } +} diff --git a/src/main/java/com/fr/plugin/web/hander/H5LoginHandler.java b/src/main/java/com/fr/plugin/web/hander/H5LoginHandler.java new file mode 100644 index 0000000..727b266 --- /dev/null +++ b/src/main/java/com/fr/plugin/web/hander/H5LoginHandler.java @@ -0,0 +1,175 @@ +package com.fr.plugin.web.hander; + +import com.fanruan.api.log.LogKit; +import com.fr.decision.authority.AuthorityContext; +import com.fr.decision.authority.data.User; +import com.fr.decision.fun.impl.BaseHttpHandler; +import com.fr.decision.webservice.v10.login.LoginService; +import com.fr.general.FRLogger; +import com.fr.json.JSONObject; +import com.fr.log.FineLoggerFactory; +import com.fr.plugin.dao.MyEntityDao; +import com.fr.plugin.entitys.YTUserEntity; +import com.fr.plugin.entitys.YtOutputMyEntity; +import com.fr.plugin.utils.UserSync; +import com.fr.plugin.utils.YiTuanMaManager; +import com.fr.plugin.utils.YiTuanMaUtils; +import com.fr.plugin.yt.MyDecisionDBAccess; +import com.fr.stable.StringUtils; +import com.fr.stable.db.action.DBAction; +import com.fr.stable.db.dao.DAOContext; +import com.fr.stable.query.QueryFactory; +import com.fr.stable.query.restriction.RestrictionFactory; +import com.fr.third.springframework.web.bind.annotation.RequestMethod; +import com.fr.web.utils.WebUtils; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.util.HashMap; + +public class H5LoginHandler extends BaseHttpHandler { + @Override + public RequestMethod getMethod() { + return null; + } + + @Override + public String getPath() { + return "/yt/h5login"; + } + + @Override + public boolean isPublic() { + return true; + } + + private boolean autoLogin(HttpServletRequest req, HttpServletResponse res) throws Exception { + + String authCode = WebUtils.getHTTPRequestParameter(req, "authCode"); + String clientId = WebUtils.getHTTPRequestParameter(req, "clientId"); + if (StringUtils.isBlank(clientId)) { + String id = req.getParameter("callBack"); + clientId = getClientIdById(id); + } + if (StringUtils.isEmpty(authCode)) { + FRLogger.getLogger().error("==================== 获取xx码authCode失败!"); + FineLoggerFactory.getLogger().info("登陆用户失败,响应:" + res); + return false; + } + String access_token = YiTuanMaUtils.getAccessToken(clientId); + String yiTuanMaUserId = YiTuanMaUtils.getCurrentUserId(clientId, authCode, access_token); + YTUserEntity userEntity = UserSync.findById(yiTuanMaUserId); + String fsUserName = ""; + if (userEntity != null) { + String phone = userEntity.getPhone(); + User user = getUserByPhone(phone); + if (user != null) { + fsUserName = user.getUserName(); + } + } + if (StringUtils.isNotBlank(fsUserName)) { + String callBack = req.getParameter("callBack"); + LoginService.getInstance().login(req, res, fsUserName); + if ("false".equalsIgnoreCase(callBack)) { + callBack = ""; + } + if (StringUtils.isNotBlank(callBack)) { + if (!callBack.startsWith("http")) { + callBack = getCallbackUrlById(callBack); + } + sendRedirect(req, res, callBack); + } else { + String header = req.getHeader("user-agent"); + String cloudHost = YiTuanMaManager.getInstance().getUrl(); + if (isH5(header)) { + cloudHost += "/url/mobile"; + } + sendRedirect(req, res, cloudHost); + } + } + return false; + } + + private String getCallbackUrlById(String id) { + + try { + return MyDecisionDBAccess.getAccessor().runDMLAction(new DBAction() { + @Override + public String run(DAOContext daoContext) throws Exception { + MyEntityDao dao = daoContext.getDAO(MyEntityDao.class); + YtOutputMyEntity myEntity = dao.findOne(QueryFactory.create().addRestriction(RestrictionFactory.eq("id", id))); + LogKit.error("查询到:{} 回调地址为:{}", id, myEntity.getGoUrl()); + return myEntity.getGoUrl(); + } + }); + } catch (Exception e) { + LogKit.error("查询配置失败", e); + } + return ""; + } + + private boolean isH5(String header) { + //Mozilla/5.0 (iPhone; CPU iPhone OS 13_4_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 TencentMTA/1 ESENYUN_TOKEN:cd97af45-7c7b-4da7-81ca-655347629c79 + if (StringUtils.isNotBlank(header)) { + return header.contains("ESENYUN_TOKEN"); + } + return false; + } + + private void sendRedirect(HttpServletRequest req, HttpServletResponse res, String url) { + + res.setStatus(HttpServletResponse.SC_MOVED_TEMPORARILY); + res.setHeader("Location", url); + } + + private User getUserByPhone(String phone) { + try { + return AuthorityContext.getInstance().getUserController().findOne(QueryFactory.create().addRestriction(RestrictionFactory.eq("mobile", phone))); + } catch (Exception e) { + e.printStackTrace(); + } + return null; + } + + @Override + public void handle(HttpServletRequest req, HttpServletResponse httpServletResponse) throws Exception { + String authCode = req.getParameter("authCode"); + String clientId = req.getParameter("clientId"); + if (StringUtils.isNotBlank(authCode)) { + boolean login = autoLogin(req, httpServletResponse); + JSONObject jsonObject = new JSONObject(); + if (login) { + jsonObject.put("status", -1); + jsonObject.put("message", "登录失败"); + com.fr.web.utils.WebUtils.flushSuccessMessageAutoClose(req, httpServletResponse, jsonObject); + return; + } + } else { + HashMap hashMap = new HashMap<>(); + if (StringUtils.isBlank(clientId)) { + String id = req.getParameter("callBack"); + clientId = getClientIdById(id); + } + hashMap.put("ticket", YiTuanMaUtils.getTicket(clientId)); + hashMap.put("clientId", clientId); + hashMap.put("servletURL", req.getContextPath() + req.getServletPath()); + WebUtils.writeOutTemplate("/com/fr/plugin/web/login.tpl", httpServletResponse, hashMap); + } + } + + private String getClientIdById(String id) { + try { + return MyDecisionDBAccess.getAccessor().runQueryAction(new DBAction() { + @Override + public String run(DAOContext daoContext) throws Exception { + MyEntityDao dao = daoContext.getDAO(MyEntityDao.class); + YtOutputMyEntity myEntity = dao.findOne(QueryFactory.create().addRestriction(RestrictionFactory.eq("id", id))); + return myEntity.getClientId(); + } + }); + } catch (Exception e) { + e.printStackTrace(); + } + return ""; + } +} diff --git a/src/main/java/com/fr/plugin/web/hander/LoginUserModel.java b/src/main/java/com/fr/plugin/web/hander/LoginUserModel.java new file mode 100644 index 0000000..b404f06 --- /dev/null +++ b/src/main/java/com/fr/plugin/web/hander/LoginUserModel.java @@ -0,0 +1,95 @@ +package com.fr.plugin.web.hander; + +public class LoginUserModel { + + private String appid; + private String xtid; + private String oid; + private String eid; + private String username; + private String userid; + private String tid; + private String deviceId; + private String openid; + private String jobNo; + + public String getJobNo() { + return jobNo; + } + + public void setJobNo(String jobNo) { + this.jobNo = jobNo; + } + + public String getAppid() { + return appid; + } + + public void setAppid(String appid) { + this.appid = appid; + } + + public String getXtid() { + return xtid; + } + + public void setXtid(String xtid) { + this.xtid = xtid; + } + + public String getOid() { + return oid; + } + + public void setOid(String oid) { + this.oid = oid; + } + + public String getEid() { + return eid; + } + + public void setEid(String eid) { + this.eid = eid; + } + + public String getUsername() { + return username; + } + + public void setUsername(String username) { + this.username = username; + } + + public String getUserid() { + return userid; + } + + public void setUserid(String userid) { + this.userid = userid; + } + + public String getTid() { + return tid; + } + + public void setTid(String tid) { + this.tid = tid; + } + + public String getDeviceId() { + return deviceId; + } + + public void setDeviceId(String deviceId) { + this.deviceId = deviceId; + } + + public String getOpenid() { + return openid; + } + + public void setOpenid(String openid) { + this.openid = openid; + } +} diff --git a/src/main/java/com/fr/plugin/web/hander/LogoHandeler.java b/src/main/java/com/fr/plugin/web/hander/LogoHandeler.java new file mode 100644 index 0000000..4a435e5 --- /dev/null +++ b/src/main/java/com/fr/plugin/web/hander/LogoHandeler.java @@ -0,0 +1,37 @@ +package com.fr.plugin.web.hander; + +import com.fanruan.api.runtime.ResourceKit; +import com.fanruan.api.util.IOKit; +import com.fr.decision.fun.impl.BaseHttpHandler; +import com.fr.json.JSONObject; +import com.fr.plugin.utils.UserSync; +import com.fr.third.springframework.web.bind.annotation.RequestMethod; +import com.fr.web.utils.WebUtils; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.io.FileOutputStream; + +public class LogoHandeler extends BaseHttpHandler { + @Override + public RequestMethod getMethod() { + return RequestMethod.GET; + } + + @Override + public String getPath() { + return "/ytlogo"; + } + + @Override + public boolean isPublic() { + return true; + } + + @Override + public void handle(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse) throws Exception { + httpServletResponse.setContentType("image/png"); + IOKit.copyBinaryTo(LogoHandeler.class.getResourceAsStream("/com/fr/plugin/web/images/log.jpg"), httpServletResponse.getOutputStream()); + } +} + diff --git a/src/main/java/com/fr/plugin/web/hander/MyCheckLicenseHandler.java b/src/main/java/com/fr/plugin/web/hander/MyCheckLicenseHandler.java new file mode 100644 index 0000000..547dbff --- /dev/null +++ b/src/main/java/com/fr/plugin/web/hander/MyCheckLicenseHandler.java @@ -0,0 +1,38 @@ +package com.fr.plugin.web.hander; + +import com.fr.decision.fun.impl.BaseHttpHandler; +import com.fr.json.JSONObject; +import com.fr.plugin.PluginLicense; +import com.fr.plugin.PluginLicenseManager; +import com.fr.plugin.utils.MyUtils; +import com.fr.third.springframework.web.bind.annotation.RequestMethod; +import com.fr.web.utils.WebUtils; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +public class MyCheckLicenseHandler extends BaseHttpHandler { + @Override + public RequestMethod getMethod() { + return null; + } + + @Override + public String getPath() { + return "/yt/check/license"; + } + + @Override + public boolean isPublic() { + return false; + } + + @Override + public void handle(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse) throws Exception { + PluginLicense var3 = PluginLicenseManager.getInstance().getPluginLicenseByID("com.fr.plugin.yituan"); + JSONObject var4 = MyUtils.createSuccessResponseJSONObject(); + boolean var5 = var3.isAvailable(); + var4.put("authorized", var5); + WebUtils.flushSuccessMessageAutoClose(httpServletRequest, httpServletResponse, var4); + } +} diff --git a/src/main/java/com/fr/plugin/web/hander/PCLoginHandler.java b/src/main/java/com/fr/plugin/web/hander/PCLoginHandler.java new file mode 100644 index 0000000..73ea404 --- /dev/null +++ b/src/main/java/com/fr/plugin/web/hander/PCLoginHandler.java @@ -0,0 +1,97 @@ +package com.fr.plugin.web.hander; + +import com.fr.decision.authority.AuthorityContext; +import com.fr.decision.authority.data.User; +import com.fr.decision.fun.impl.BaseHttpHandler; +import com.fr.decision.webservice.v10.login.LoginService; +import com.fr.log.FineLoggerFactory; +import com.fr.plugin.entitys.YTUserEntity; +import com.fr.plugin.utils.UserSync; +import com.fr.plugin.utils.YiTuanMaManager; +import com.fr.plugin.utils.YiTuanMaUtils; +import com.fr.stable.StringUtils; +import com.fr.stable.query.QueryFactory; +import com.fr.stable.query.restriction.RestrictionFactory; +import com.fr.third.springframework.web.bind.annotation.RequestMethod; +import com.fr.web.utils.WebUtils; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.util.HashMap; + +public class PCLoginHandler extends BaseHttpHandler { + @Override + public RequestMethod getMethod() { + return null; + } + + @Override + public String getPath() { + return "/yt/pclogin"; + } + + @Override + public boolean isPublic() { + return true; + } + + + private void sendRedirect(HttpServletResponse res, String url) { + res.setStatus(HttpServletResponse.SC_MOVED_TEMPORARILY); + res.setHeader("Location", url); + } + + private void login(HttpServletRequest req, HttpServletResponse res, String username) { + String token = null; + try { + token = LoginService.getInstance().login(req, res, username); + req.setAttribute("fine_auth_token", token); + FineLoggerFactory.getLogger().error("login success"); + } catch (Exception e) { + FineLoggerFactory.getLogger().error(e.getMessage(), e); + FineLoggerFactory.getLogger().error("login failed"); + } + } + + private User getUserByPhone(String phone) { + try { + return AuthorityContext.getInstance().getUserController().findOne(QueryFactory.create().addRestriction(RestrictionFactory.eq("mobile", phone))); + } catch (Exception e) { + e.printStackTrace(); + } + return null; + } + + @Override + public void handle(HttpServletRequest req, HttpServletResponse httpServletResponse) throws Exception { + String authCode = req.getParameter("access_token"); + String clientId = req.getParameter("clientId"); + if (StringUtils.isNotBlank(authCode)) { + String accessToken = WebUtils.getHTTPRequestParameter(req, "access_token"); + String userId = YiTuanMaUtils.getUserInfoByAccessToken(accessToken); + YTUserEntity userEntity = UserSync.findById(userId); + String fsUserName = ""; + if (userEntity != null) { + String phone = userEntity.getPhone(); + User user = getUserByPhone(phone); + if (user != null) { + fsUserName = user.getUserName(); + } + } + if (StringUtils.isBlank(fsUserName)) { + WebUtils.printAsString(httpServletResponse, "无法解析用户,请重新登录"); + return; + } + String callback = req.getParameter("callBack"); + login(req, httpServletResponse, fsUserName); + if (StringUtils.isNotBlank(callback)) { + sendRedirect(httpServletResponse, callback); + return; + } + YiTuanMaManager yiTuanMaManager = YiTuanMaManager.getInstance(); + sendRedirect(httpServletResponse, yiTuanMaManager.getUrl()); + } else { + WebUtils.printAsString(httpServletResponse,"未收到授权码"); + } + } +} diff --git a/src/main/java/com/fr/plugin/web/hander/SaveAgentHandler.java b/src/main/java/com/fr/plugin/web/hander/SaveAgentHandler.java new file mode 100644 index 0000000..58ba388 --- /dev/null +++ b/src/main/java/com/fr/plugin/web/hander/SaveAgentHandler.java @@ -0,0 +1,106 @@ +package com.fr.plugin.web.hander; + +import com.fr.decision.base.util.UUIDUtil; +import com.fr.decision.fun.impl.BaseHttpHandler; +import com.fr.general.ComparatorUtils; +import com.fr.json.JSONArray; +import com.fr.json.JSONObject; +import com.fr.plugin.yt.MyCoreDBAccess; +import com.fr.plugin.dao.MyAgentDao; +import com.fr.plugin.entitys.YTAgentEntity; +import com.fr.stable.StringUtils; +import com.fr.stable.db.action.DBAction; +import com.fr.stable.db.dao.DAOContext; +import com.fr.stable.query.QueryFactory; +import com.fr.third.springframework.web.bind.annotation.RequestMethod; +import com.fr.web.utils.WebUtils; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.util.Iterator; +import java.util.List; + +public class SaveAgentHandler extends BaseHttpHandler { + @Override + public RequestMethod getMethod() { + return RequestMethod.POST; + } + + @Override + public String getPath() { + return "/yt/agent"; + } + + @Override + public boolean isPublic() { + return false; + } + + @Override + public void handle(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse) throws Exception { + JSONArray agentArr = new JSONArray(WebUtils.getHTTPRequestParameter(httpServletRequest, "agentArr")); + JSONArray resp = new JSONArray(); + + for(int i = 0; i < agentArr.length(); ++i) { + String agent_uid = agentArr.optJSONObject(i).optString("id"); + final boolean agent_exist = StringUtils.isNotBlank(agent_uid); + if (StringUtils.isEmpty(agent_uid)) { + agent_uid = UUIDUtil.generate(); + } + + String agent_name = agentArr.optJSONObject(i).optString("agentName"); + String agent_id = agentArr.optJSONObject(i).optString("corpId");//公共号编号 + String secret = agentArr.optJSONObject(i).optString("secret"); + + + List agent_lists = MyCoreDBAccess.getAccessor().runQueryAction(new DBAction>() { + public List run(DAOContext content) throws Exception { + return content.getDAO(MyAgentDao.class) .find(QueryFactory.create()); + } + }); + Iterator var13 = agent_lists.iterator(); + YTAgentEntity temp_agent; + while(var13.hasNext()) { + temp_agent = (YTAgentEntity)var13.next(); + if (ComparatorUtils.equals(temp_agent.getAgentName(), agent_name) && !agent_exist) { + WebUtils.flushFailureMessageAutoClose(httpServletRequest, httpServletResponse, 11205018, "存在同名公共号"); + return; + } + + if (agent_exist && ComparatorUtils.equals(temp_agent.getAgentName(), agent_name) && !ComparatorUtils.equals(agent_uid, temp_agent.getId())) { + WebUtils.flushFailureMessageAutoClose(httpServletRequest, httpServletResponse, 11205018, "公共号已经存在"); + return; + } + } + +// String var16 = MyAgentUtils.getAgentIdBySecret(agent_id, secret); + //插入或更新这个公共号,全看id + temp_agent = new YTAgentEntity().id(agent_uid) + .agentName(agent_name) + .agentId(agent_id) + .secret(secret) + .type(1) + .timeStamp(System.currentTimeMillis()); + YTAgentEntity finalVar1 = temp_agent; + MyCoreDBAccess.getAccessor().runDMLAction(new DBAction() { + public YTAgentEntity run(DAOContext var1) throws Exception { + if (agent_exist) { + var1.getDAO(MyAgentDao.class).update(finalVar1); + } else { + var1.getDAO(MyAgentDao.class).add(finalVar1); + } + + return null; + } + }); + + + resp.put(agent_uid); + } + + JSONObject var15 = JSONObject.create(); + var15.put("errorCode", 0); + var15.put("agentIds", resp); + WebUtils.flushSuccessMessageAutoClose(httpServletRequest, httpServletResponse, var15); + } +} diff --git a/src/main/java/com/fr/plugin/web/hander/SaveConfigHandler.java b/src/main/java/com/fr/plugin/web/hander/SaveConfigHandler.java new file mode 100644 index 0000000..8ad108e --- /dev/null +++ b/src/main/java/com/fr/plugin/web/hander/SaveConfigHandler.java @@ -0,0 +1,58 @@ +package com.fr.plugin.web.hander; + +import com.fr.decision.fun.impl.BaseHttpHandler; +import com.fr.json.JSONObject; +import com.fr.plugin.config.YituanPri; +import com.fr.plugin.utils.MyUtils; +import com.fr.plugin.utils.YiTuanMaManager; +import com.fr.stable.StringUtils; +import com.fr.third.springframework.web.bind.annotation.RequestMethod; +import com.fr.web.utils.WebUtils; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +public class SaveConfigHandler extends BaseHttpHandler { + @Override + public RequestMethod getMethod() { + return RequestMethod.POST; + } + + @Override + public String getPath() { + return "/yt/report/server/url"; + } + + @Override + public boolean isPublic() { + return false; + } + + @Override + public void handle(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse) throws Exception { + String var3 = WebUtils.getHTTPRequestParameter(httpServletRequest, "reportServerUrl"); + if (StringUtils.isNotEmpty(var3)) { + String var4; + if (var3.contains("?")) { + var4 = var3.substring(0, var3.indexOf("?")); + } else { + var4 = var3; + } + String appId = WebUtils.getHTTPRequestParameter(httpServletRequest, "appId"); + String eid = WebUtils.getHTTPRequestParameter(httpServletRequest, "eid"); + String appSecret = WebUtils.getHTTPRequestParameter(httpServletRequest, "appSecret"); + String readKey = WebUtils.getHTTPRequestParameter(httpServletRequest, "readKey"); + String sendUserId = WebUtils.getHTTPRequestParameter(httpServletRequest, "sendUserId"); + YiTuanMaManager myConfig = YiTuanMaManager.getInstance(); + myConfig.setEid(eid); + myConfig.setGroupId(readKey); + myConfig.setClientSecret(appSecret); + myConfig.setClientId(appId); + myConfig.setUrl(var4); + myConfig.setSendUserId(sendUserId); + } + + JSONObject var5 = MyUtils.createSuccessResponseJSONObject(); + WebUtils.flushSuccessMessageAutoClose(httpServletRequest, httpServletResponse, var5); + } +} diff --git a/src/main/java/com/fr/plugin/web/hander/SaveGroupHandler.java b/src/main/java/com/fr/plugin/web/hander/SaveGroupHandler.java new file mode 100644 index 0000000..941e0bd --- /dev/null +++ b/src/main/java/com/fr/plugin/web/hander/SaveGroupHandler.java @@ -0,0 +1,102 @@ +package com.fr.plugin.web.hander; + +import com.fr.decision.fun.impl.BaseHttpHandler; +import com.fr.json.JSONArray; +import com.fr.json.JSONObject; +import com.fr.plugin.dao.MyGroupDao; +import com.fr.plugin.entitys.YtGroupEntity; +import com.fr.plugin.yt.MyCoreDBAccess; +import com.fr.stable.StringUtils; +import com.fr.stable.db.action.DBAction; +import com.fr.stable.db.dao.DAOContext; +import com.fr.stable.query.QueryFactory; +import com.fr.stable.query.condition.QueryCondition; +import com.fr.stable.query.restriction.RestrictionFactory; +import com.fr.third.springframework.web.bind.annotation.RequestMethod; +import com.fr.web.utils.WebUtils; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.util.List; +import java.util.UUID; + +public class SaveGroupHandler extends BaseHttpHandler { + @Override + public RequestMethod getMethod() { + return RequestMethod.POST; + } + + @Override + public String getPath() { + return "/yt/group"; + } + + @Override + public boolean isPublic() { + return false; + } + + @Override + public void handle(HttpServletRequest request, HttpServletResponse httpServletResponse) throws Exception { + JSONArray resp = new JSONArray(); + String groupId = WebUtils.getHTTPRequestParameter(request, "groupId"); + String groupName = WebUtils.getHTTPRequestParameter(request, "groupName"); + JSONObject respJson = JSONObject.create(); + if (checkExist(groupId)) { + respJson.put("msg", "群组已经存在"); + respJson.put("errorCode", 1); + WebUtils.flushSuccessMessageAutoClose(request, httpServletResponse, respJson); + return; + } + if (StringUtils.isBlank(groupId)) { + respJson.put("msg", "group id 为空"); + respJson.put("errorCode", 1); + WebUtils.flushSuccessMessageAutoClose(request, httpServletResponse, respJson); + return; + } + if (StringUtils.isBlank(groupName)) { + respJson.put("msg", "group name 为空"); + respJson.put("errorCode", 1); + WebUtils.flushSuccessMessageAutoClose(request, httpServletResponse, respJson); + return; + } + YtGroupEntity entity = new YtGroupEntity(); + entity.setGroupId(groupId); + entity.setName(groupName); + entity.setId(UUID.randomUUID().toString()); + saveGroup(entity); + respJson.put("errorCode", 0); + WebUtils.flushSuccessMessageAutoClose(request, httpServletResponse, respJson); + } + + private void saveGroup(YtGroupEntity entity) { + try { + MyCoreDBAccess.getAccessor().runDMLAction(new DBAction() { + @Override + public Object run(DAOContext daoContext) throws Exception { + daoContext.getDAO(MyGroupDao.class).add(entity); + return null; + } + }); + } catch (Exception e) { + e.printStackTrace(); + } + } + + private boolean checkExist(String id) { + List entityList = null; + try { + entityList = MyCoreDBAccess.getAccessor().runQueryAction(new DBAction>() { + public List run(DAOContext content) throws Exception { + QueryCondition queryCondition = QueryFactory.create(); + queryCondition.addRestriction(RestrictionFactory.and(RestrictionFactory.like("groupId", id))); + return content.getDAO(MyGroupDao.class).find(queryCondition); + } + }); + return !entityList.isEmpty(); + } catch (Exception e) { + e.printStackTrace(); + } + return false; + } +} diff --git a/src/main/java/com/fr/plugin/web/hander/ScanLoginHandler.java b/src/main/java/com/fr/plugin/web/hander/ScanLoginHandler.java new file mode 100644 index 0000000..5beb72c --- /dev/null +++ b/src/main/java/com/fr/plugin/web/hander/ScanLoginHandler.java @@ -0,0 +1,100 @@ +package com.fr.plugin.web.hander; + +import com.fr.base.ServerConfig; +import com.fr.decision.authority.data.User; +import com.fr.decision.fun.impl.BaseHttpHandler; +import com.fr.decision.webservice.v10.login.LoginService; +import com.fr.json.JSONObject; +import com.fr.plugin.beans.MyUserBean; +import com.fr.plugin.config.YituanPri; +import com.fr.plugin.yt.MyUserSyncManager; +import com.fr.plugin.utils.MyUtils; +import com.fr.plugin.utils.WebUtils; +import com.fr.stable.StringUtils; +import com.fr.third.springframework.web.bind.annotation.RequestMethod; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +public class ScanLoginHandler extends BaseHttpHandler { + @Override + public RequestMethod getMethod() { + return null; + } + + @Override + public String getPath() { + return "/yt/scan_login"; + } + + @Override + public boolean isPublic() { + return true; + } + + @Override + public void handle(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse) throws Exception { + String ticket = httpServletRequest.getParameter("ticket"); + YituanPri instance = YituanPri.getInstance(); + String secret = instance.getScanSecret(); + String appId = instance.getScanId(); + JSONObject jsonObject = new JSONObject(); + String appAccessToken = WebUtils.getAppAccessToken(appId, secret); + if (!MyUtils.isLicenseAvailable()) { + jsonObject.put("status", -1); + jsonObject.put("message", "请购买授权后使用"); + com.fr.web.utils.WebUtils.flushSuccessMessageAutoClose(httpServletRequest, httpServletResponse, jsonObject); + return; + } + if (StringUtils.isNotBlank(appAccessToken)) { + try { + LoginUserModel userInfo = WebUtils.getUserInfo(appId, appAccessToken, ticket); + if (userInfo != null) { + String openid = userInfo.getOpenid(); + MyUserSyncManager userSyncManager = MyUserSyncManager.getInstance(); + MyUserBean userBean = userSyncManager.getUserByOpenId(openid); + if (userBean == null) { + jsonObject.put("status", -1); + jsonObject.put("message", userInfo.getUsername() + "登陆成功,但是未绑定帆软系统用户"); + com.fr.web.utils.WebUtils.flushSuccessMessageAutoClose(httpServletRequest, httpServletResponse, jsonObject); + return; + } + String fsUserName=""; + String match = instance.getMatch(); + if("1".equals(match)){//手机号 + User byMobile = MyUserSyncManager.getFSUserByPhone(userBean.getPhone()); + if (byMobile != null) { + fsUserName=byMobile.getUserName(); + } + }else{ + fsUserName=userBean.getFsUserName(); + } + if (StringUtils.isBlank(fsUserName)) { + jsonObject.put("status", -1); + jsonObject.put("message", userInfo.getUsername() + "登陆成功,但是未绑定帆软系统用户"); + com.fr.web.utils.WebUtils.flushSuccessMessageAutoClose(httpServletRequest, httpServletResponse, jsonObject); + return; + } + String callBack = httpServletRequest.getParameter("callBack"); + LoginService.getInstance().login(httpServletRequest, httpServletResponse, fsUserName, "", ""); + if (StringUtils.isNotBlank(callBack)) { + httpServletResponse.sendRedirect(callBack); + } else { +// jsonObject.put("status", 0); +// jsonObject.put("message", userInfo.getUsername() + "登陆成功, 绑定帆软系统用户" + userBean.getFsUserName()); + String servletName = ServerConfig.getInstance().getServletName(); + String url = instance.getUrl()+servletName; + httpServletResponse.sendRedirect(url); +// com.fr.web.utils.WebUtils.flushSuccessMessageAutoClose(httpServletRequest, httpServletResponse, jsonObject); + } + return; + } + } catch (Exception e) { + e.printStackTrace(); + } + } + jsonObject.put("status", -1); + jsonObject.put("message", "登陆失败"); + com.fr.web.utils.WebUtils.flushSuccessMessageAutoClose(httpServletRequest, httpServletResponse, jsonObject); + } +} diff --git a/src/main/java/com/fr/plugin/web/hander/ShowImageHandler.java b/src/main/java/com/fr/plugin/web/hander/ShowImageHandler.java new file mode 100644 index 0000000..f71f8ce --- /dev/null +++ b/src/main/java/com/fr/plugin/web/hander/ShowImageHandler.java @@ -0,0 +1,46 @@ +package com.fr.plugin.web.hander; + +import com.fr.decision.fun.impl.BaseHttpHandler; +import com.fr.decision.webservice.v10.attach.AttachmentService; +import com.fr.json.JSONArray; +import com.fr.json.JSONObject; +import com.fr.plugin.dao.MyGroupDao; +import com.fr.plugin.entitys.YtGroupEntity; +import com.fr.plugin.yt.MyCoreDBAccess; +import com.fr.stable.StringUtils; +import com.fr.stable.db.action.DBAction; +import com.fr.stable.db.dao.DAOContext; +import com.fr.stable.query.QueryFactory; +import com.fr.stable.query.condition.QueryCondition; +import com.fr.stable.query.restriction.RestrictionFactory; +import com.fr.third.springframework.web.bind.annotation.RequestMethod; +import com.fr.web.utils.WebUtils; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.util.ArrayList; +import java.util.List; + +public class ShowImageHandler extends BaseHttpHandler { + @Override + public RequestMethod getMethod() { + return RequestMethod.GET; + } + + @Override + public String getPath() { + return "/yt/image"; + } + + @Override + public boolean isPublic() { + return true; + } + + @Override + public void handle(HttpServletRequest req, HttpServletResponse res) throws Exception { + String attachId=req.getParameter("attachId"); + AttachmentService.getInstance().showImage(req, res, attachId, null, false); + } + +} diff --git a/src/main/java/com/fr/plugin/web/hander/SingleLoginHandler.java b/src/main/java/com/fr/plugin/web/hander/SingleLoginHandler.java new file mode 100644 index 0000000..070c8cb --- /dev/null +++ b/src/main/java/com/fr/plugin/web/hander/SingleLoginHandler.java @@ -0,0 +1,71 @@ +package com.fr.plugin.web.hander; + +import com.fr.decision.authority.data.User; +import com.fr.decision.fun.impl.BaseHttpHandler; +import com.fr.decision.webservice.v10.user.UserService; +import com.fr.log.FineLoggerFactory; +import com.fr.plugin.utils.xxUtils; +import com.fr.stable.StringUtils; +import com.fr.third.springframework.web.bind.annotation.RequestMethod; +import com.fr.web.utils.WebUtils; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +public class SingleLoginHandler extends BaseHttpHandler { + @Override + public RequestMethod getMethod() { + return null; + } + + @Override + public String getPath() { + return "/yt/login"; + } + + @Override + public boolean isPublic() { + return true; + } + + @Override + public void handle(HttpServletRequest req, HttpServletResponse res) throws Exception { + try { + //先做登录 + if (!autoLogin(req, res)) { + FineLoggerFactory.getLogger().error("==================== xx user login to FS failed!"); + FineLoggerFactory.getLogger().error("==================== xx user login to FS failed!"); + + } + String originalUrl = WebUtils.getOriginalURL(req); + + } catch (Exception e) { + FineLoggerFactory.getLogger().error(e.getMessage()); + } + } + + + private boolean autoLogin(HttpServletRequest req, HttpServletResponse res) throws Exception { + String authCode = WebUtils.getHTTPRequestParameter(req, "authCode"); + String clientId = WebUtils.getHTTPRequestParameter(req, "clientId"); + if (StringUtils.isEmpty(authCode)) { + FineLoggerFactory.getLogger().error("==================== 获取xx码authCode失败!"); + FineLoggerFactory.getLogger().error("==================== 获取xx码authCode失败!"); + return false; + } + String access_token = xxUtils.getAccessToken(clientId); + String xxUserId = xxUtils.getCurrentUserId(clientId,authCode, access_token); + FineLoggerFactory.getLogger().info("==================== 获取xx码用户ID:" + xxUserId); + FineLoggerFactory.getLogger().info("==================== 获取xx码用户ID:" + xxUserId); + String username = null; + if (StringUtils.isNotEmpty(xxUserId)) { + FineLoggerFactory.getLogger().info("==================== 识别BI用户为:" + username); + FineLoggerFactory.getLogger().info("==================== 识别BI用户为:" + username); + User user = UserService.getInstance().getUserByUserName(username); + if (user != null) { + + } + } + return false; + } +} diff --git a/src/main/java/com/fr/plugin/web/hander/UpdateGroupHandler.java b/src/main/java/com/fr/plugin/web/hander/UpdateGroupHandler.java new file mode 100644 index 0000000..cc32fa9 --- /dev/null +++ b/src/main/java/com/fr/plugin/web/hander/UpdateGroupHandler.java @@ -0,0 +1,104 @@ +package com.fr.plugin.web.hander; + +import com.fr.decision.fun.impl.BaseHttpHandler; +import com.fr.json.JSONArray; +import com.fr.json.JSONObject; +import com.fr.plugin.dao.MyGroupDao; +import com.fr.plugin.entitys.YtGroupEntity; +import com.fr.plugin.yt.MyCoreDBAccess; +import com.fr.stable.StringUtils; +import com.fr.stable.db.action.DBAction; +import com.fr.stable.db.dao.DAOContext; +import com.fr.stable.query.QueryFactory; +import com.fr.stable.query.condition.QueryCondition; +import com.fr.stable.query.restriction.RestrictionFactory; +import com.fr.third.springframework.web.bind.annotation.RequestMethod; +import com.fr.web.utils.WebUtils; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.util.ArrayList; +import java.util.List; +import java.util.UUID; + +public class UpdateGroupHandler extends BaseHttpHandler { + @Override + public RequestMethod getMethod() { + return RequestMethod.POST; + } + + @Override + public String getPath() { + return "/yt/groupUpdate"; + } + + @Override + public boolean isPublic() { + return false; + } + + @Override + public void handle(HttpServletRequest request, HttpServletResponse httpServletResponse) throws Exception { + JSONArray resp = new JSONArray(); + String groupId = WebUtils.getHTTPRequestParameter(request, "groupId"); + String groupName = WebUtils.getHTTPRequestParameter(request, "groupName"); + JSONObject respJson = JSONObject.create(); + List ytGroupEntities = checkExist(groupId); + if (ytGroupEntities.isEmpty()) { + respJson.put("msg", "群组不存在"); + respJson.put("errorCode", 1); + WebUtils.flushSuccessMessageAutoClose(request, httpServletResponse, respJson); + return; + } + if (StringUtils.isBlank(groupId)) { + respJson.put("msg", "group id 为空"); + respJson.put("errorCode", 1); + WebUtils.flushSuccessMessageAutoClose(request, httpServletResponse, respJson); + return; + } + if (StringUtils.isBlank(groupName)) { + respJson.put("msg", "group name 为空"); + respJson.put("errorCode", 1); + WebUtils.flushSuccessMessageAutoClose(request, httpServletResponse, respJson); + return; + } + YtGroupEntity entity = ytGroupEntities.get(0); + entity.setGroupId(groupId); + entity.setName(groupName); + entity.setId(UUID.randomUUID().toString()); + saveGroup(entity); + respJson.put("errorCode", 0); + WebUtils.flushSuccessMessageAutoClose(request, httpServletResponse, respJson); + } + + private void saveGroup(YtGroupEntity entity) { + try { + MyCoreDBAccess.getAccessor().runDMLAction(new DBAction() { + @Override + public Object run(DAOContext daoContext) throws Exception { + daoContext.getDAO(MyGroupDao.class).update(entity); + return null; + } + }); + } catch (Exception e) { + e.printStackTrace(); + } + } + + private List checkExist(String id) { + List entityList = null; + try { + entityList = MyCoreDBAccess.getAccessor().runQueryAction(new DBAction>() { + public List run(DAOContext content) throws Exception { + QueryCondition queryCondition = QueryFactory.create(); + queryCondition.addRestriction(RestrictionFactory.and(RestrictionFactory.like("groupId", id))); + return content.getDAO(MyGroupDao.class).find(queryCondition); + } + }); + return entityList; + } catch (Exception e) { + e.printStackTrace(); + } + return new ArrayList<>(); + } +} diff --git a/src/main/java/com/fr/plugin/web/hander/member/GetDepTree.java b/src/main/java/com/fr/plugin/web/hander/member/GetDepTree.java new file mode 100644 index 0000000..6691be1 --- /dev/null +++ b/src/main/java/com/fr/plugin/web/hander/member/GetDepTree.java @@ -0,0 +1,38 @@ +package com.fr.plugin.web.hander.member; + +import com.fr.decision.fun.impl.BaseHttpHandler; +import com.fr.json.JSONArray; +import com.fr.json.JSONObject; +import com.fr.plugin.yt.MyCorpManager; +import com.fr.plugin.utils.MyUtils; +import com.fr.third.springframework.web.bind.annotation.RequestMethod; +import com.fr.web.utils.WebUtils; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +public class GetDepTree extends BaseHttpHandler { + @Override + public RequestMethod getMethod() { + return RequestMethod.GET; + } + + @Override + public String getPath() { + return "/yt/dep/tree"; + } + + @Override + public boolean isPublic() { + return false; + } + + @Override + public void handle(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse) throws Exception { + JSONArray var3 = MyCorpManager.getInstance().generateDepartmentTree(); + JSONObject var4 = MyUtils.createSuccessResponseJSONObject(); + var4.put("depTree", var3); + WebUtils.flushSuccessMessageAutoClose(httpServletRequest, httpServletResponse, var4); + } +} + diff --git a/src/main/java/com/fr/plugin/web/hander/member/GetMatch.java b/src/main/java/com/fr/plugin/web/hander/member/GetMatch.java new file mode 100644 index 0000000..39d8cf6 --- /dev/null +++ b/src/main/java/com/fr/plugin/web/hander/member/GetMatch.java @@ -0,0 +1,46 @@ +package com.fr.plugin.web.hander.member; + +import com.fr.decision.fun.impl.BaseHttpHandler; +import com.fr.json.JSONObject; +import com.fr.plugin.config.YituanPri; +import com.fr.plugin.utils.MyUtils; +import com.fr.third.org.apache.commons.lang3.math.NumberUtils; +import com.fr.third.springframework.web.bind.annotation.RequestMethod; +import com.fr.web.utils.WebUtils; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +public class GetMatch extends BaseHttpHandler { + @Override + public RequestMethod getMethod() { + return RequestMethod.GET; + } + + @Override + public String getPath() { + return "/yt/match/method"; + } + + @Override + public boolean isPublic() { + return false; + } + + @Override + public void handle(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse) throws Exception { + JSONObject jsonObject = MyUtils.createSuccessResponseJSONObject(); + YituanPri config = YituanPri.getInstance(); + if (config != null) { + String match = config.getMatch(); + int c = NumberUtils.isDigits(match) ? Integer.parseInt(match) : 1; + jsonObject.put("matchingFsWay", c); + jsonObject.put("dataSetFsName", config.getDataSetFsName()); + jsonObject.put("dataSet", config.getDataSet()); + jsonObject.put("dataSetUserId", config.getDataSetUserId()); + + } + WebUtils.flushSuccessMessageAutoClose(httpServletRequest, httpServletResponse, jsonObject); + } +} + diff --git a/src/main/java/com/fr/plugin/web/hander/member/GetMemberHandler.java b/src/main/java/com/fr/plugin/web/hander/member/GetMemberHandler.java new file mode 100644 index 0000000..c471606 --- /dev/null +++ b/src/main/java/com/fr/plugin/web/hander/member/GetMemberHandler.java @@ -0,0 +1,91 @@ +package com.fr.plugin.web.hander.member; + +import com.fr.decision.fun.impl.BaseHttpHandler; +import com.fr.json.JSONArray; +import com.fr.json.JSONObject; +import com.fr.plugin.beans.MyUserBean; +import com.fr.plugin.utils.MyUtils; +import com.fr.plugin.yt.MyUserSyncManager; +import com.fr.stable.StringUtils; +import com.fr.third.springframework.web.bind.annotation.RequestMethod; +import com.fr.web.utils.WebUtils; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.util.Iterator; +import java.util.List; + +public class GetMemberHandler extends BaseHttpHandler { + @Override + public RequestMethod getMethod() { + return RequestMethod.POST; + } + + @Override + public String getPath() { + return "/yt/dep/member"; + } + + @Override + public boolean isPublic() { + return false; + } + + @Override + public void handle(HttpServletRequest request, HttpServletResponse response) throws Exception { + int startIdx = WebUtils.getHTTPRequestIntParameter(request, "startIdx", 0); + int count = WebUtils.getHTTPRequestIntParameter(request, "count", 10); + String keyword = WebUtils.getHTTPRequestParameter(request, "keyword"); +// String var7 = WebUtils.getHTTPRequestParameter(request, "secret"); + String depId = WebUtils.getHTTPRequestParameter(request, "depId"); + List users; + Long size = 0L; + try { + if (StringUtils.isNotEmpty(keyword)) { + users = this.getSelectedUser(keyword, startIdx, count); + size = this.countSelectedUser(keyword); + } else { + users = this.getSelectedDepartmentUser(startIdx, count); + size = this.countSelectedDepartmentUser(); + } + JSONObject jsonObject = toUserResultJo(users, size); + JSONObject responseJSONObject = MyUtils.createSuccessResponseJSONObject(); + responseJSONObject.put("userList", jsonObject); + WebUtils.flushSuccessMessageAutoClose(request, response, responseJSONObject); + } catch (Exception e) { + e.printStackTrace(response.getWriter()); + } + } + + private Long countSelectedDepartmentUser() throws Exception { + return MyUserSyncManager.getInstance().countDepartmentUserList(); + } + + private List getSelectedDepartmentUser(int start, int count) throws Exception { + return MyUserSyncManager.getInstance().getDepartmentUserList(start, count); + + } + + private List getSelectedUser(String key, int start, int count) throws Exception { + return MyUserSyncManager.getInstance().getUserList(key, start, count); + } + + private Long countSelectedUser(String key) throws Exception { + return MyUserSyncManager.getInstance().countUserList(key); + } + + public static JSONObject toUserResultJo(List users, Long var1) throws Exception { + JSONObject var2 = JSONObject.create(); + JSONArray var3 = JSONArray.create(); + + JSONObject var6; + for (Iterator var4 = users.iterator(); var4.hasNext(); var3.put(var6)) { + MyUserBean var5 = (MyUserBean) var4.next(); + var6 = var5.createJSONConfig(); + } + + var2.put("total", var1); + var2.put("users", var3); + return var2; + } +} diff --git a/src/main/java/com/fr/plugin/web/hander/member/SaveMatch.java b/src/main/java/com/fr/plugin/web/hander/member/SaveMatch.java new file mode 100644 index 0000000..51e0672 --- /dev/null +++ b/src/main/java/com/fr/plugin/web/hander/member/SaveMatch.java @@ -0,0 +1,50 @@ +package com.fr.plugin.web.hander.member; + +import com.fr.decision.fun.impl.BaseHttpHandler; +import com.fr.json.JSONObject; +import com.fr.plugin.config.YituanPri; +import com.fr.plugin.utils.MyUtils; +import com.fr.third.springframework.web.bind.annotation.RequestMethod; +import com.fr.web.utils.WebUtils; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +public class SaveMatch extends BaseHttpHandler { + @Override + public RequestMethod getMethod() { + return RequestMethod.POST; + } + + @Override + public String getPath() { + return "/yt/match/method"; + } + + @Override + public boolean isPublic() { + return false; + } + + @Override + public void handle(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse) throws Exception { + String match= WebUtils.getHTTPRequestParameter(httpServletRequest, "matchingFsWay"); + String dataSetUserId= WebUtils.getHTTPRequestParameter(httpServletRequest, "dataSetUserId"); + String dataSet= WebUtils.getHTTPRequestParameter(httpServletRequest, "dataSet"); + String dataSetFsName= WebUtils.getHTTPRequestParameter(httpServletRequest, "dataSetFsName"); + JSONObject jsonObject = MyUtils.createSuccessResponseJSONObject(); + YituanPri config= YituanPri.getInstance(); + if (config != null) { + config.setMatch(match); + config.setDataSet(dataSet); + if(dataSetFsName!=null&&!"null".equals(dataSetFsName)){ + config.setDataSetFsName(Integer.valueOf(dataSetFsName)); + } + if (dataSetUserId != null&&!"null".equals(dataSetUserId)) { + config.setDataSetUserId(Integer.valueOf(dataSetUserId)); + } + } + WebUtils.flushSuccessMessageAutoClose(httpServletRequest, httpServletResponse, jsonObject); + } +} + diff --git a/src/main/java/com/fr/plugin/web/hander/member/SaveRelation.java b/src/main/java/com/fr/plugin/web/hander/member/SaveRelation.java new file mode 100644 index 0000000..58c538a --- /dev/null +++ b/src/main/java/com/fr/plugin/web/hander/member/SaveRelation.java @@ -0,0 +1,60 @@ +package com.fr.plugin.web.hander.member; + +import com.fr.decision.fun.impl.BaseHttpHandler; +import com.fr.json.JSONObject; +import com.fr.plugin.yt.MyCoreDBAccess; +import com.fr.plugin.dao.MyUserDao; +import com.fr.plugin.entitys.YTUserEntity; +import com.fr.plugin.utils.MyUtils; +import com.fr.stable.db.action.DBAction; +import com.fr.stable.db.dao.DAOContext; +import com.fr.stable.query.QueryFactory; +import com.fr.stable.query.condition.QueryCondition; +import com.fr.stable.query.restriction.RestrictionFactory; +import com.fr.third.springframework.web.bind.annotation.RequestMethod; +import com.fr.web.utils.WebUtils; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +public class SaveRelation extends BaseHttpHandler { + @Override + public RequestMethod getMethod() { + return RequestMethod.POST; + } + + @Override + public String getPath() { + return "/yt/user/relation"; + } + + @Override + public boolean isPublic() { + return false; + } + + @Override + public void handle(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse) throws Exception { + String opendId = WebUtils.getHTTPRequestParameter(httpServletRequest, "weiXinUser"); + String fsUser = WebUtils.getHTTPRequestParameter(httpServletRequest, "fsUser"); + + YTUserEntity entity = MyCoreDBAccess.getAccessor().runQueryAction(new DBAction() { + public YTUserEntity run(DAOContext content) throws Exception { + QueryCondition queryCondition = QueryFactory.create(); + queryCondition.addRestriction(RestrictionFactory.eq("openId", opendId)); + return content.getDAO(MyUserDao.class).findOne(queryCondition); + } + }); + entity.setFsUserName(fsUser); + MyCoreDBAccess.getAccessor().runDMLAction(new DBAction() { + public YTUserEntity run(DAOContext content) throws Exception { + content.getDAO(MyUserDao.class).update(entity); + return null; + } + }); + JSONObject responseJSONObject = MyUtils.createSuccessResponseJSONObject(); + responseJSONObject.put("id", entity.getId()); + WebUtils.flushSuccessMessageAutoClose(httpServletRequest, httpServletResponse, responseJSONObject); + } +} + diff --git a/src/main/java/com/fr/plugin/web/hander/member/StartLogin.java b/src/main/java/com/fr/plugin/web/hander/member/StartLogin.java new file mode 100644 index 0000000..f6dccff --- /dev/null +++ b/src/main/java/com/fr/plugin/web/hander/member/StartLogin.java @@ -0,0 +1,34 @@ +package com.fr.plugin.web.hander.member; + +import com.fr.decision.fun.impl.BaseHttpHandler; +import com.fr.json.JSONObject; +import com.fr.plugin.utils.UserSync; +import com.fr.third.springframework.web.bind.annotation.RequestMethod; +import com.fr.web.utils.WebUtils; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +public class StartLogin extends BaseHttpHandler { + @Override + public RequestMethod getMethod() { + return RequestMethod.GET; + } + + @Override + public String getPath() { + return "/yt/startLogin"; + } + + @Override + public boolean isPublic() { + return true; + } + + @Override + public void handle(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse) throws Exception { + UserSync.startSyncUser(); + WebUtils.printAsJSON(httpServletResponse,new JSONObject()); + } +} + diff --git a/src/main/java/com/fr/plugin/web/hander/member/SynUserHander.java b/src/main/java/com/fr/plugin/web/hander/member/SynUserHander.java new file mode 100644 index 0000000..9ae0567 --- /dev/null +++ b/src/main/java/com/fr/plugin/web/hander/member/SynUserHander.java @@ -0,0 +1,36 @@ +package com.fr.plugin.web.hander.member; + +import com.fr.decision.fun.impl.BaseHttpHandler; +import com.fr.json.JSONObject; +import com.fr.plugin.utils.MyUtils; +import com.fr.plugin.utils.UserSync; +import com.fr.third.org.apache.commons.lang3.math.NumberUtils; +import com.fr.third.springframework.web.bind.annotation.RequestMethod; +import com.fr.web.utils.WebUtils; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +public class SynUserHander extends BaseHttpHandler { + @Override + public RequestMethod getMethod() { + return RequestMethod.POST; + } + + @Override + public String getPath() { + return "/yt/syn/member"; + } + + @Override + public boolean isPublic() { + return false; + } + + @Override + public void handle(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse) throws Exception { + JSONObject jsonObject = MyUtils.createSuccessResponseJSONObject(); + UserSync.startSyncUser(); + WebUtils.flushSuccessMessageAutoClose(httpServletRequest, httpServletResponse, jsonObject); + } +} \ No newline at end of file diff --git a/src/main/java/com/fr/plugin/web/hander/ytconfig/DelCompanyHander.java b/src/main/java/com/fr/plugin/web/hander/ytconfig/DelCompanyHander.java new file mode 100644 index 0000000..2093d23 --- /dev/null +++ b/src/main/java/com/fr/plugin/web/hander/ytconfig/DelCompanyHander.java @@ -0,0 +1,47 @@ +package com.fr.plugin.web.hander.ytconfig; + +import com.fr.decision.fun.impl.BaseHttpHandler; +import com.fr.json.JSONObject; +import com.fr.plugin.dao.MyAgentDao; +import com.fr.plugin.dao.MyYiTuanDao; +import com.fr.plugin.entitys.YTAgentEntity; +import com.fr.plugin.utils.MyUtils; +import com.fr.plugin.yt.MyCoreDBAccess; +import com.fr.stable.db.action.DBAction; +import com.fr.stable.db.dao.DAOContext; +import com.fr.third.springframework.web.bind.annotation.RequestMethod; +import com.fr.web.utils.WebUtils; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.util.List; + +public class DelCompanyHander extends BaseHttpHandler { + @Override + public RequestMethod getMethod() { + return RequestMethod.DELETE; + } + + @Override + public String getPath() { + return "/yt/configList"; + } + + @Override + public boolean isPublic() { + return false; + } + + @Override + public void handle(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse) throws Exception { + final String var3 = WebUtils.getHTTPRequestParameter(httpServletRequest, "id"); + MyCoreDBAccess.getAccessor().runDMLAction(new DBAction>() { + public List run(DAOContext var1) throws Exception { + var1.getDAO(MyYiTuanDao.class).remove(var3); + return null; + } + }); + JSONObject var4 = MyUtils.createSuccessResponseJSONObject(); + WebUtils.flushSuccessMessageAutoClose(httpServletRequest, httpServletResponse, var4); + } +} diff --git a/src/main/java/com/fr/plugin/web/hander/ytconfig/GetCompanyHandler.java b/src/main/java/com/fr/plugin/web/hander/ytconfig/GetCompanyHandler.java new file mode 100644 index 0000000..262cbec --- /dev/null +++ b/src/main/java/com/fr/plugin/web/hander/ytconfig/GetCompanyHandler.java @@ -0,0 +1,59 @@ +package com.fr.plugin.web.hander.ytconfig; + +import com.fr.decision.fun.impl.BaseHttpHandler; +import com.fr.json.JSONArray; +import com.fr.json.JSONObject; +import com.fr.plugin.beans.MyYituanBean; +import com.fr.plugin.beans.MyYituanBean; +import com.fr.plugin.entitys.YTYiTuanEntity; +import com.fr.plugin.entitys.YTYiTuanEntity; +import com.fr.plugin.utils.MyUtils; +import com.fr.third.springframework.web.bind.annotation.RequestMethod; +import com.fr.web.utils.WebUtils; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.util.Iterator; +import java.util.List; + +public class GetCompanyHandler extends BaseHttpHandler { + @Override + public RequestMethod getMethod() { + return RequestMethod.GET; + } + + @Override + public String getPath() { + return "/yt/configList"; + } + + @Override + public boolean isPublic() { + return false; + } + + @Override + public void handle(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse) throws Exception { + int startIdx = WebUtils.getHTTPRequestIntParameter(httpServletRequest, "startIdx", -1); + int count = WebUtils.getHTTPRequestIntParameter(httpServletRequest, "count", -1); + List companys = MyUtils.getCompanysSortedByTimeStamp(); + JSONArray lists = new JSONArray(); + JSONObject var7 = MyUtils.createSuccessResponseJSONObject(); + if (startIdx == -1 && count == -1) { + for (YTYiTuanEntity company : companys) { + lists.put(company.createBean(new MyYituanBean()).toJSONObject()); + } + } else if (startIdx > -1 && count > -1) { + int var8 = Math.min(count + startIdx, companys.size()); + + for(int var9 = startIdx; var9 < var8; ++var9) { + YTYiTuanEntity var10 = (YTYiTuanEntity)companys.get(var9); + lists.put(var10.createBean(new MyYituanBean()).toJSONObject()); + } + } + + var7.put("total", companys.size()); + var7.put("companys", lists); + WebUtils.flushSuccessMessageAutoClose(httpServletRequest, httpServletResponse, var7); + } +} diff --git a/src/main/java/com/fr/plugin/web/hander/ytconfig/SaveCompanyHandler.java b/src/main/java/com/fr/plugin/web/hander/ytconfig/SaveCompanyHandler.java new file mode 100644 index 0000000..525e8a3 --- /dev/null +++ b/src/main/java/com/fr/plugin/web/hander/ytconfig/SaveCompanyHandler.java @@ -0,0 +1,114 @@ +package com.fr.plugin.web.hander.ytconfig; + +import com.fr.decision.base.util.UUIDUtil; +import com.fr.decision.fun.impl.BaseHttpHandler; +import com.fr.general.ComparatorUtils; +import com.fr.json.JSONArray; +import com.fr.json.JSONObject; +import com.fr.plugin.dao.MyYiTuanDao; +import com.fr.plugin.dao.MyYiTuanDao; +import com.fr.plugin.entitys.YTYiTuanEntity; +import com.fr.plugin.yt.MyCoreDBAccess; +import com.fr.stable.StringUtils; +import com.fr.stable.db.action.DBAction; +import com.fr.stable.db.dao.DAOContext; +import com.fr.stable.query.QueryFactory; +import com.fr.stable.query.restriction.RestrictionFactory; +import com.fr.third.springframework.web.bind.annotation.RequestMethod; +import com.fr.web.utils.WebUtils; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.util.Iterator; +import java.util.List; + +public class SaveCompanyHandler extends BaseHttpHandler { + @Override + public RequestMethod getMethod() { + return RequestMethod.POST; + } + + @Override + public String getPath() { + return "/yt/configList"; + } + + @Override + public boolean isPublic() { + return false; + } + + @Override + public void handle(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse) throws Exception { + JSONArray agentArr = new JSONArray(WebUtils.getHTTPRequestParameter(httpServletRequest, "companyArr")); + JSONArray resp = new JSONArray(); + + for(int i = 0; i < agentArr.length(); ++i) { + String agent_uid = agentArr.optJSONObject(i).optString("id"); + final boolean agent_exist = StringUtils.isNotBlank(agent_uid); + if (StringUtils.isEmpty(agent_uid)) { + agent_uid = UUIDUtil.generate(); + } + + String agent_name = agentArr.optJSONObject(i).optString("agentName"); + String clientId = agentArr.optJSONObject(i).optString("clientId"); + String teamId = agentArr.optJSONObject(i).optString("teamId"); + String groupId = agentArr.optJSONObject(i).optString("groupId"); + String clientSecret = agentArr.optJSONObject(i).optString("clientSecret"); + + + List agent_lists = MyCoreDBAccess.getAccessor().runQueryAction(new DBAction>() { + public List run(DAOContext content) throws Exception { + return content.getDAO(MyYiTuanDao.class) .find(QueryFactory.create()); + } + }); + Iterator var13 = agent_lists.iterator(); + YTYiTuanEntity temp_agent; + while(var13.hasNext()) { + temp_agent = (YTYiTuanEntity)var13.next(); + if (ComparatorUtils.equals(temp_agent.getAgentName(), agent_name) && !agent_exist) { + WebUtils.flushFailureMessageAutoClose(httpServletRequest, httpServletResponse, 11205018, "存在同名公司"); + return; + } + + if (agent_exist && ComparatorUtils.equals(temp_agent.getAgentName(), agent_name) && !ComparatorUtils.equals(agent_uid, temp_agent.getId())) { + WebUtils.flushFailureMessageAutoClose(httpServletRequest, httpServletResponse, 11205018, "公司已经存在"); + return; + } + } + +// String var16 = MyAgentUtils.getAgentIdBySecret(agent_id, secret); + //插入或更新这个公共号,全看id + temp_agent = new YTYiTuanEntity().id(agent_uid); + temp_agent .setAgentName(agent_name); + temp_agent.setGroupId(groupId); + temp_agent.setSecret(clientSecret); + temp_agent.setTeamId(teamId); + temp_agent.setClientId(clientId); + YTYiTuanEntity finalVar1 = temp_agent; + MyCoreDBAccess.getAccessor().runDMLAction(new DBAction() { + public YTYiTuanEntity run(DAOContext var1) throws Exception { + if (agent_exist) { + var1.getDAO(MyYiTuanDao.class).update(finalVar1); + } else { + var1.getDAO(MyYiTuanDao.class).add(finalVar1); + } + + return null; + } + }); +// if (agent_exist) { +// WeiXinCorpManager.getInstance().updateAgentInWeiXinCorpList(temp_agent.createBean(new WeiXinAgent())); +// } else { +// WeiXinCorpManager.getInstance().addAgentToWeiXinCorpList(temp_agent.createBean(new WeiXinAgent())); +// } + + resp.put(agent_uid); + } + + JSONObject var15 = JSONObject.create(); + var15.put("errorCode", 0); + var15.put("agentIds", resp); + WebUtils.flushSuccessMessageAutoClose(httpServletRequest, httpServletResponse, var15); + } +} diff --git a/src/main/java/com/fr/plugin/yt/LoginJS.java b/src/main/java/com/fr/plugin/yt/LoginJS.java new file mode 100644 index 0000000..ef3a56a --- /dev/null +++ b/src/main/java/com/fr/plugin/yt/LoginJS.java @@ -0,0 +1,39 @@ +package com.fr.plugin.yt; + +import com.fr.base.ServerConfig; +import com.fr.base.TemplateUtils; +import com.fr.gen.TextGenerator; +import com.fr.plugin.config.YituanPri; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.net.URLEncoder; +import java.util.HashMap; +import java.util.Map; + +public class LoginJS implements TextGenerator { + + + public String text(HttpServletRequest req, HttpServletResponse res) throws Exception { + Map renderMap = new HashMap(); + YituanPri instance = YituanPri.getInstance(); + String appid = instance.getScanId(); + String servletName = ServerConfig.getInstance().getServletName(); + String url = instance.getUrl() + servletName; + url += "/file?path=/com/fr/plugin/web/css/login.css"; + String ret = URLEncoder.encode(instance.getUrl() + servletName + "/plugin/public/com.fr.plugin.yituan/yt/scan_login", "UTF-8"); + renderMap.put("url", URLEncoder.encode(url, "UTF-8")); + renderMap.put("appId", appid); + renderMap.put("redirect_url", ret); + renderMap.put("cloud_url", instance.getCloudHost()); + return TemplateUtils.renderTemplate(this.template(), renderMap); + } + + public String mimeType() { + return "text/javascript"; + } + + public String template() { + return "/com/fr/plugin/web/js/qr.tpl"; + } +} diff --git a/src/main/java/com/fr/plugin/yt/LoginJSHander.java b/src/main/java/com/fr/plugin/yt/LoginJSHander.java new file mode 100644 index 0000000..d4d77a3 --- /dev/null +++ b/src/main/java/com/fr/plugin/yt/LoginJSHander.java @@ -0,0 +1,18 @@ +package com.fr.plugin.yt; + +import com.fr.decision.fun.impl.AbstractWebResourceProvider; +import com.fr.decision.web.LoginComponent; +import com.fr.web.struct.Atom; +import com.fr.web.utils.WebUtils; + +public class LoginJSHander extends AbstractWebResourceProvider { + @Override + public Atom attach() { + return LoginComponent.KEY; + } + + @Override + public Atom client() { + return LoginsComponent.KEY; + } +} \ No newline at end of file diff --git a/src/main/java/com/fr/plugin/yt/LoginsComponent.java b/src/main/java/com/fr/plugin/yt/LoginsComponent.java new file mode 100644 index 0000000..91791b4 --- /dev/null +++ b/src/main/java/com/fr/plugin/yt/LoginsComponent.java @@ -0,0 +1,18 @@ +package com.fr.plugin.yt; + +import com.fr.web.struct.Component; +import com.fr.web.struct.browser.RequestClient; +import com.fr.web.struct.category.FileType; +import com.fr.web.struct.category.ScriptPath; + +public class LoginsComponent extends Component { + public static LoginsComponent KEY = new LoginsComponent(); + + public LoginsComponent() { + } + + + public ScriptPath script(RequestClient var1) { + return ScriptPath.build("com.fr.plugin.yt.LoginJS", FileType.CLASS); + } +} diff --git a/src/main/java/com/fr/plugin/yt/MyComponent.java b/src/main/java/com/fr/plugin/yt/MyComponent.java new file mode 100644 index 0000000..fd96987 --- /dev/null +++ b/src/main/java/com/fr/plugin/yt/MyComponent.java @@ -0,0 +1,40 @@ +package com.fr.plugin.yt; + +import com.fr.web.struct.AssembleComponent; +import com.fr.web.struct.Atom; +import com.fr.web.struct.Component; +import com.fr.web.struct.browser.RequestClient; +import com.fr.web.struct.category.ScriptPath; +import com.fr.web.struct.category.StylePath; + +public class MyComponent extends AssembleComponent { + public static MyComponent KEY = new MyComponent(); + + public MyComponent() { + } + + @Override + public Atom[] refer() { + return new Atom[]{ + new Component() { + @Override + public ScriptPath script(RequestClient requestClient) { + return ScriptPath.build("/com/fr/plugin/web/js/group.js"); + } + },new Component() { + @Override + public ScriptPath script(RequestClient requestClient) { + return ScriptPath.build("/com/fr/plugin/web/js/push.js"); + } + } + }; + } + + public ScriptPath script() { + return ScriptPath.build("/com/fr/plugin/web/js/yt.js"); + } + + public StylePath style() { + return StylePath.build("/com/fr/plugin/web/css/yt.css"); + } +} diff --git a/src/main/java/com/fr/plugin/yt/MyCoreDBAccess.java b/src/main/java/com/fr/plugin/yt/MyCoreDBAccess.java new file mode 100644 index 0000000..654d872 --- /dev/null +++ b/src/main/java/com/fr/plugin/yt/MyCoreDBAccess.java @@ -0,0 +1,72 @@ +package com.fr.plugin.yt; + +import com.fr.plugin.dao.*; +import com.fr.plugin.db.AbstractDBAccessProvider; +import com.fr.plugin.entitys.*; +import com.fr.stable.db.accessor.DBAccessor; +import com.fr.stable.db.dao.BaseDAO; +import com.fr.stable.db.dao.DAOProvider; + +public class MyCoreDBAccess extends AbstractDBAccessProvider { + private static DBAccessor accessor; + public static DBAccessor getAccessor() { + return accessor; + } + @Override + public DAOProvider[] registerDAO() { + return new DAOProvider[]{ + new DAOProvider() { + public Class getEntityClass() { + return YTAgentEntity.class; + } + + public Class getDAOClass() { + return MyAgentDao.class; + } + }, + new DAOProvider() { + public Class getEntityClass() { + return YTYiTuanEntity.class; + } + + public Class getDAOClass() { + return MyYiTuanDao.class; + } + }, + new DAOProvider() { + public Class getEntityClass() { + return YTUserEntity.class; + } + + public Class getDAOClass() { + return MyUserDao.class; + } + }, + new DAOProvider() { + public Class getEntityClass() { + return YtGroupEntity.class; + } + + public Class getDAOClass() { + return MyGroupDao.class; + } + }, + new DAOProvider() { + public Class getEntityClass() { + return YtDepEntity.class; + } + + public Class getDAOClass() { + return MyDepDao.class; + } + } + + }; + } + + @Override + public void onDBAvailable(DBAccessor dbAccessor) { + accessor = dbAccessor; + + } +} diff --git a/src/main/java/com/fr/plugin/yt/MyCorpManager.java b/src/main/java/com/fr/plugin/yt/MyCorpManager.java new file mode 100644 index 0000000..0983a50 --- /dev/null +++ b/src/main/java/com/fr/plugin/yt/MyCorpManager.java @@ -0,0 +1,183 @@ +package com.fr.plugin.yt; + +import com.fr.json.JSONArray; +import com.fr.log.FineLoggerFactory; +import com.fr.plugin.beans.MyDepBean; +import com.fr.plugin.config.YituanPri; +import com.fr.plugin.dao.MyDepDao; +import com.fr.plugin.entitys.YtDepEntity; +import com.fr.plugin.utils.WebUtils; +import com.fr.stable.StringUtils; +import com.fr.stable.db.action.DBAction; +import com.fr.stable.db.dao.DAOContext; +import com.fr.stable.query.QueryFactory; +import com.fr.stable.query.condition.QueryCondition; +import com.fr.stable.query.restriction.RestrictionFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.util.*; +import java.util.stream.Collectors; + +public class MyCorpManager { + // private List corpList; + private List depList = new ArrayList<>(); + + private MyCorpManager() { + + } + + public static MyCorpManager getInstance() { + return MyCorpManager.HOLDER.INSTANCE; + } + + + public JSONArray generateDepartmentTree() { + JSONArray var1 = new JSONArray(); + try { + this.depList = this.getDepFormDB(); + } catch (Exception e) { + e.printStackTrace(); + } + if (this.depList.isEmpty()) { + return new JSONArray(); + } +// Map parentTree = new HashMap<>(); + for (MyDepBean depBean : this.depList) { + var1.add(depBean.createJSONConfig()); + } + return var1; + } + + private List getDepFormDB() throws Exception { + List entities = MyCoreDBAccess.getAccessor().runQueryAction(new DBAction>() { + @Override + public List run(DAOContext daoContext) throws Exception { + return daoContext.getDAO(MyDepDao.class).find(QueryFactory.create()); + } + }); + return entities.stream().map(YtDepEntity::createBean).collect(Collectors.toList()); + } + + + public void syncDepList() throws Exception { + YituanPri instance = YituanPri.getInstance(); + String eid = instance.getEid(); + String readKey = instance.getReadKey(); + if (StringUtils.isNotBlank(eid) && StringUtils.isNotBlank(readKey)) { + List allDep = WebUtils.getAllDep(eid, readKey); + Logger logger = LoggerFactory.getLogger("部门同步"); + List idsFromService = new ArrayList<>(allDep.size()); + if (allDep.isEmpty()) { + return; + } + int count=0; + for (MyDepBean depBean : allDep) { + String id = depBean.getId(); + idsFromService.add(id); + if (depNotExist(id)) { + logger.error("同步一个新的部门:{}", depBean.getName()); + save(depBean.createEntity()); + logger.error("同步一个新的部门:{} 完成", depBean.getName()); + } else { + logger.error("同步更新部门:{}", depBean.getName()); + update(depBean.createEntity()); + logger.error("同步更新部门完成:{}", depBean.getName()); + } + count++; + } + logger.error("共处理更新{}个部门",count); + int delCount=0; + List allDepId = findAllDepId(); + if (allDepId.removeAll(idsFromService)) { + for (String id : allDepId) { + logger.error("删除了一个部门:{}",id); + delCount++; + remove(id); + } + } + logger.error("共处理删除{}个部门",delCount); + } + } + + private List findAllDepId() throws Exception { + List entityList = MyCoreDBAccess.getAccessor().runQueryAction(new DBAction>() { + public List run(DAOContext content) throws Exception { + QueryCondition queryCondition = QueryFactory.create(); + return content.getDAO(MyDepDao.class).find(queryCondition); + } + }); + List ids = new ArrayList<>(entityList.size()); + for (YtDepEntity entity : entityList) { + ids.add(entity.getId()); + } + return ids; + } + + private boolean depNotExist(final String id) throws Exception { + return MyCoreDBAccess.getAccessor().runQueryAction(new DBAction>() { + @Override + public List run(DAOContext daoContext) throws Exception { + return daoContext.getDAO(MyDepDao.class).find(QueryFactory.create().addRestriction(RestrictionFactory.eq("id", id))); + } + }).isEmpty(); + } + + public void saveOrUpdateDep(MyDepBean depBean) throws Exception { + String id = depBean.getId(); + if (depNotExist(id)) { + save(depBean.createEntity()); + } else { + update(depBean.createEntity()); + } + } + + private boolean save(final YtDepEntity entity) throws Exception { + return MyCoreDBAccess.getAccessor().runDMLAction(new DBAction() { + @Override + public YtDepEntity run(DAOContext daoContext) throws Exception { + daoContext.getDAO(MyDepDao.class).add(entity); + return null; + } + }) == null; + } + + + private void remove(final String id) throws Exception { + MyCoreDBAccess.getAccessor().runDMLAction(new DBAction() { + @Override + public YtDepEntity run(DAOContext daoContext) throws Exception { + daoContext.getDAO(MyDepDao.class).remove(id); + return null; + } + }); + } + + private boolean update(final YtDepEntity entity) throws Exception { + return MyCoreDBAccess.getAccessor().runDMLAction(new DBAction() { + @Override + public YtDepEntity run(DAOContext daoContext) throws Exception { + daoContext.getDAO(MyDepDao.class).update(entity); + return null; + } + }) == null; + } + + public void removeDep(MyDepBean depBean) throws Exception { + FineLoggerFactory.getLogger().error("移除了一个部门:{},id :{}", depBean.getDepName(), depBean.getId()); + MyCoreDBAccess.getAccessor().runDMLAction(new DBAction() { + @Override + public YtDepEntity run(DAOContext daoContext) throws Exception { + daoContext.getDAO(MyDepDao.class).remove(depBean.getId()); + return null; + } + }); + } + + private static class HOLDER { + private static final MyCorpManager INSTANCE = new MyCorpManager(); + + private HOLDER() { + } + } +} diff --git a/src/main/java/com/fr/plugin/yt/MyDecisionDBAccess.java b/src/main/java/com/fr/plugin/yt/MyDecisionDBAccess.java new file mode 100644 index 0000000..3425a8d --- /dev/null +++ b/src/main/java/com/fr/plugin/yt/MyDecisionDBAccess.java @@ -0,0 +1,34 @@ +package com.fr.plugin.yt; + +import com.fr.decision.plugin.db.AbstractDecisionDBAccessProvider; +import com.fr.plugin.dao.MyEntityDao; +import com.fr.plugin.entitys.YtOutputMyEntity; +import com.fr.stable.db.accessor.DBAccessor; +import com.fr.stable.db.dao.BaseDAO; +import com.fr.stable.db.dao.DAOProvider; +public class MyDecisionDBAccess extends AbstractDecisionDBAccessProvider { + private static DBAccessor accessor; + + @Override + + public DAOProvider[] registerDAO() { + return new DAOProvider[]{new DAOProvider() { + public Class getEntityClass() { + return YtOutputMyEntity.class; + } + + public Class getDAOClass() { + return MyEntityDao.class; + } + }}; + } + + public static DBAccessor getAccessor() { + return accessor; + } + + @Override + public void onDBAvailable(DBAccessor dbAccessor) { + accessor = dbAccessor; + } +} diff --git a/src/main/java/com/fr/plugin/yt/MyFormulaProvider.java b/src/main/java/com/fr/plugin/yt/MyFormulaProvider.java new file mode 100644 index 0000000..93a2526 --- /dev/null +++ b/src/main/java/com/fr/plugin/yt/MyFormulaProvider.java @@ -0,0 +1,22 @@ +package com.fr.plugin.yt; + +import com.fr.main.workbook.ResultWorkBook; +import com.fr.plugin.beans.YTOutputBean; +import com.fr.schedule.base.provider.impl.AbstractOutputFormulaProvider; +import com.fr.schedule.extension.report.util.ScheduleParameterUtils; + +import java.util.List; +import java.util.Map; + +public class MyFormulaProvider extends AbstractOutputFormulaProvider { + @Override + public void dealWithFormulaParam(YTOutputBean myOutputBean, ResultWorkBook resultWorkBook, List> list) throws Exception { + myOutputBean.setSubject(ScheduleParameterUtils.dealWithParameter(myOutputBean.getSubject(), list.get(0), resultWorkBook)); + myOutputBean.setContent(ScheduleParameterUtils.dealWithParameter(myOutputBean.getContent(), list.get(0), resultWorkBook)); + } + + @Override + public String getActionClassName() { + return YTOutputBean.class.getName(); + } +} diff --git a/src/main/java/com/fr/plugin/yt/MyHttpHander.java b/src/main/java/com/fr/plugin/yt/MyHttpHander.java new file mode 100644 index 0000000..6148538 --- /dev/null +++ b/src/main/java/com/fr/plugin/yt/MyHttpHander.java @@ -0,0 +1,48 @@ +package com.fr.plugin.yt; + +import com.fr.decision.fun.HttpHandler; +import com.fr.decision.fun.impl.AbstractHttpHandlerProvider; +import com.fr.plugin.web.hander.*; +import com.fr.plugin.web.hander.member.*; +import com.fr.plugin.web.hander.ytconfig.DelCompanyHander; +import com.fr.plugin.web.hander.ytconfig.GetCompanyHandler; +import com.fr.plugin.web.hander.ytconfig.SaveCompanyHandler; + +public class MyHttpHander extends AbstractHttpHandlerProvider { + HttpHandler[] actions = new HttpHandler[]{ + new MyCheckLicenseHandler(), + new GetAgentHandler(), + new SingleLoginHandler(), + new GetConfigHandler(), + new SaveConfigHandler(), + new SaveAgentHandler(), + new DelAgentHander(), + new GetDepTree(), + new SaveMatch(), + new GetMatch(), + new GetMemberHandler(), + new SaveRelation(), + new SynUserHander(), + new GetGroupsHandler(), + new PCLoginHandler(), + new H5LoginHandler(), + new SaveGroupHandler(), + new UpdateGroupHandler(), + new DelGroupHandler(), + new ShowImageHandler(), + new StartLogin(), + new LogoHandeler(), + new GetTicketHandler(), + //新增的 + new SaveCompanyHandler(), + new GetCompanyHandler(), + new DelCompanyHander() + }; + + + + @Override + public HttpHandler[] registerHandlers() { + return actions; + } +} diff --git a/src/main/java/com/fr/plugin/yt/MyLifeCycleMonitor.java b/src/main/java/com/fr/plugin/yt/MyLifeCycleMonitor.java new file mode 100644 index 0000000..92b7f31 --- /dev/null +++ b/src/main/java/com/fr/plugin/yt/MyLifeCycleMonitor.java @@ -0,0 +1,52 @@ +package com.fr.plugin.yt; + +import com.fr.log.FineLoggerFactory; +import com.fr.plugin.beans.YTOutputBean; +import com.fr.plugin.context.PluginContext; +import com.fr.plugin.entitys.YtOutputMyEntity; +import com.fr.plugin.observer.inner.AbstractPluginLifecycleMonitor; +import com.fr.schedule.feature.ScheduleOutputActionEntityRegister; +import com.fr.schedule.feature.output.OutputActionHandler; + +import java.util.Timer; +import java.util.TimerTask; + +public class MyLifeCycleMonitor extends AbstractPluginLifecycleMonitor { + Timer timer = new Timer(); + + @Override + public void afterRun(PluginContext pluginContext) { + timer.schedule(new TimerTask() { + @Override + public void run() { + FineLoggerFactory.getLogger().info("开始同步部门和用户数据--用户数据--线程启动"); + new com.fr.plugin.yt.MyStartupThred().start(); + } + }, 2000, 60 * 60 * 1000); + this.registerOutputHandler(); + this.addScheduleTableRelation(); +// AuthorityContext.getInstance().dispatchAfterInitEvent(new AfterInitEvent() { +// public void run() { +// YituanPri.getInstance().setAuthorityInited(true); +// } +// }); + } + + private void registerOutputHandler() { + OutputActionHandler.registerHandler(new MyOutputActionHandler(), YTOutputBean.class.getName()); + } + + private void addScheduleTableRelation() { + ScheduleOutputActionEntityRegister.getInstance().addClass(YtOutputMyEntity.class); + } + + private void removeScheduleTableRelation() { + ScheduleOutputActionEntityRegister.getInstance().removeClass(YtOutputMyEntity.class); + } + + @Override + public void beforeStop(PluginContext pluginContext) { + timer.cancel(); + this.removeScheduleTableRelation(); + } +} diff --git a/src/main/java/com/fr/plugin/yt/MyMessageObject.java b/src/main/java/com/fr/plugin/yt/MyMessageObject.java new file mode 100644 index 0000000..a77af59 --- /dev/null +++ b/src/main/java/com/fr/plugin/yt/MyMessageObject.java @@ -0,0 +1,29 @@ +package com.fr.plugin.yt; + +import com.fr.decision.system.message.image.MessageImage; +import com.fr.decision.system.message.type.MessageType; +import com.fr.intelli.record.Focus; +import com.fr.intelli.record.Original; +import com.fr.plugin.beans.msg.MyMessageType; +import com.fr.record.analyzer.EnableMetrics; +import com.fr.report.fun.impl.AbstractMessageObjectProvider; +import com.fr.stable.collections.combination.Pair; +@EnableMetrics +public class MyMessageObject extends AbstractMessageObjectProvider { + @Override + public MessageType getMessageType() { + return MyMessageType.KEY; + } + + @Override + public Pair[] getValueEditorItems() { + return new Pair[0]; + } + + @Override + @Focus(id = "com.fr.plugin.yituan", text = "sendMessage", source = Original.PLUGIN) + public void sendMessage(MessageImage messageContent) { + + System.out.println(messageContent); + } +} diff --git a/src/main/java/com/fr/plugin/yt/MyOutputActionHandler.java b/src/main/java/com/fr/plugin/yt/MyOutputActionHandler.java new file mode 100644 index 0000000..21d8a3b --- /dev/null +++ b/src/main/java/com/fr/plugin/yt/MyOutputActionHandler.java @@ -0,0 +1,167 @@ +package com.fr.plugin.yt; + +import com.fanruan.api.log.LogKit; +import com.fr.base.Base64; +import com.fr.base.FRContext; +import com.fr.base.ServerConfig; +import com.fr.decision.authority.data.User; +import com.fr.decision.system.bean.message.MessageUrlType; +import com.fr.decision.webservice.v10.user.UserService; +import com.fr.general.IOUtils; +import com.fr.json.JSONObject; +import com.fr.plugin.beans.YTOutputBean; +import com.fr.plugin.dao.MyEntityDao; +import com.fr.plugin.dao.MyUserDao; +import com.fr.plugin.entitys.YTUserEntity; +import com.fr.plugin.entitys.YtOutputMyEntity; +import com.fr.plugin.utils.YiTuanMaManager; +import com.fr.plugin.utils.YiTuanMaUtils; +import com.fr.schedule.base.constant.ScheduleConstants; +import com.fr.schedule.feature.output.OutputActionHandler; +import com.fr.stable.CodeUtils; +import com.fr.stable.StringUtils; +import com.fr.stable.db.action.DBAction; +import com.fr.stable.db.dao.DAOContext; +import com.fr.stable.query.QueryFactory; +import com.fr.stable.query.condition.QueryCondition; +import com.fr.stable.query.restriction.RestrictionFactory; + +import java.io.InputStream; +import java.util.*; + +public class MyOutputActionHandler extends OutputActionHandler { + //应用消息,群,个人 + @Override + public void doAction(YTOutputBean myOutputBean, Map map) throws Exception { + Object username = map.get("username"); + String[] names = new String[0]; + if (username != null) { + String s = username.toString(); + if (StringUtils.isNotBlank(s)) { + names = new String[]{ + s + }; + } + } + if (names.length == 0) { + names = (String[]) map.get(ScheduleConstants.USERNAMES); + } + List userNames = Arrays.asList(names); + List userIds = userName2ytUserId(userNames); + int todo = myOutputBean.getSendType(); + String title = myOutputBean.getSubject(); + String content = myOutputBean.getContent(); + JSONObject param = JSONObject.create(); + //(取值 2:单文本,5:文本链接,6:图文链接) + String url = createScheduleEntryUrl(myOutputBean, map); + YiTuanMaManager manager = YiTuanMaManager.getInstance(); + String mediaId = myOutputBean.getMediaId(); + String fromUserId = myOutputBean.getFromUserId(); + + String imageUrl = ""; + if (StringUtils.isNotBlank(mediaId)) { + imageUrl = manager.getUrl() + "/url/ytImage?attachId=" + mediaId; + } + String groupId = manager.getGroupId(); + if (todo == 1) {//应用消息 + YiTuanMaUtils.sendMsgToUserFromApp(myOutputBean.getClientId(), userIds, title, content, url, imageUrl); + } else if (todo == 2) {//聊天群消息 + YiTuanMaUtils.sendMsgToGroup(myOutputBean.getClientId(),groupId, fromUserId, title, content, url, imageUrl); + } else if (todo == 3) {//公共号 + YiTuanMaUtils.sendMsgToUserFromPublicNum(groupId, userIds, title, content, url); + } else if (todo == 4) {//个人 + YiTuanMaUtils.sendMSGtoUser(myOutputBean.getClientId(),fromUserId, userIds, title, content, url, imageUrl); + } + LogKit.info("推送日志:" + map); + } + + private List userName2ytUserId(List userNames) { + try { + List userPhones = new ArrayList<>(userNames.size()); + for (String userName : userNames) { + User user = UserService.getInstance().getUserByUserName(userName); + if (user != null) { + String mobile = user.getMobile(); + if (StringUtils.isNotBlank(mobile)) { + userPhones.add(mobile); + } + } + } + + List entities = MyCoreDBAccess.getAccessor().runDMLAction(new DBAction>() { + public List run(DAOContext content) throws Exception { + HashSet phones = new HashSet<>(userPhones); + QueryCondition queryCondition = QueryFactory.create().addRestriction(RestrictionFactory.in("phone", phones)); + return content.getDAO(MyUserDao.class).find(queryCondition); + } + }); + if (entities != null) { + List userIds = new ArrayList<>(); + for (YTUserEntity entity : entities) { + String id = entity.getId(); + userIds.add(id); + } + return userIds; + } + } catch (Exception e) { + e.printStackTrace(); + } + return new ArrayList<>(); + } + + public static String createScheduleEntryUrl(YTOutputBean myBean, Map params) throws Exception { + String callBack = ""; + String servletName = ServerConfig.getInstance().getServletName(); + String baseUrl = YiTuanMaManager.getInstance().getUrl(); + String url; + if (myBean.getLinkOpenType() == MessageUrlType.INNER.toInt()) { + String taskName = CodeUtils.cjkEncode(CodeUtils.encodeURIComponent((String) params.get("taskName"))); + String savePath = CodeUtils.cjkEncode(CodeUtils.encodeURIComponent((String) params.get("saveDirectory"))); + savePath = savePath.replaceAll("\\+", "%20"); + String showtype = (String) params.get("showType"); + int taskType = (Integer) params.get("taskType"); + String username = (String) params.get("username"); + callBack = baseUrl + "/url/mobile/schedule/result?taskName=" + taskName + "&username=" + username + "&path=" + savePath + "&showType=" + showtype + "&taskType=" + taskType + "&terminal=H5"; + //2022-06-30 更新回调方式为UUID + url = baseUrl + "/url/ytlogin?callBack=" + myBean.getId(); + updateOutUrl(myBean.getId(),callBack); + } else { + url = myBean.getCustomizeLink() ; + } + return url; + } + + public static void updateOutUrl(String id,String url){ + try { + MyDecisionDBAccess.getAccessor().runDMLAction(new DBAction() { + @Override + public Object run(DAOContext daoContext) throws Exception { + MyEntityDao dao = daoContext.getDAO(MyEntityDao.class); + YtOutputMyEntity myEntity = dao.findOne(QueryFactory.create().addRestriction(RestrictionFactory.eq("id", id))); + myEntity.setGoUrl(url); + dao.update(myEntity); + return null; + } + }); + } catch (Exception e) { + e.printStackTrace(); + } + return; + } + public static String toBase64(InputStream paramInputStream) { + byte[] arrayOfByte = IOUtils.inputStream2Bytes(paramInputStream); + return Base64.encode(arrayOfByte); + } + + private String getResultUrl(Map params) { + ServerConfig.getInstance().getReportServletMapping(); + String url = ServerConfig.getInstance().getServletName() + "/schedule/result?taskName=%s&username=%s&path=%s&showType=%s&taskType=%s"; + String taskName = CodeUtils.encodeURIComponent((String) params.get("taskName")); + String saveDirectory = CodeUtils.encodeURIComponent((String) params.get("saveDirectory")); + saveDirectory = saveDirectory.replaceAll("\\+", "%20"); + String showType = (String) params.get("showType"); + int taskType = (Integer) params.get("taskType"); + String username = (String) params.get("username"); + return String.format(url, taskName, username, saveDirectory, showType, taskType); + } +} diff --git a/src/main/java/com/fr/plugin/yt/MyRequest.java b/src/main/java/com/fr/plugin/yt/MyRequest.java new file mode 100644 index 0000000..d95906b --- /dev/null +++ b/src/main/java/com/fr/plugin/yt/MyRequest.java @@ -0,0 +1,7 @@ +package com.fr.plugin.yt; + +import com.fr.plugin.transform.FunctionRecorder; + +@FunctionRecorder +public class MyRequest { +} diff --git a/src/main/java/com/fr/plugin/yt/MySingleLoginAccessProvider.java b/src/main/java/com/fr/plugin/yt/MySingleLoginAccessProvider.java new file mode 100644 index 0000000..091cb96 --- /dev/null +++ b/src/main/java/com/fr/plugin/yt/MySingleLoginAccessProvider.java @@ -0,0 +1,10 @@ +package com.fr.plugin.yt; + +import com.fr.decision.fun.impl.AbstractAccessProvider; + +public class MySingleLoginAccessProvider extends AbstractAccessProvider { + @Override + public boolean access(String username, String password, String ticket) { + return true; + } +} diff --git a/src/main/java/com/fr/plugin/yt/MyStartupThred.java b/src/main/java/com/fr/plugin/yt/MyStartupThred.java new file mode 100644 index 0000000..74c394b --- /dev/null +++ b/src/main/java/com/fr/plugin/yt/MyStartupThred.java @@ -0,0 +1,31 @@ +package com.fr.plugin.yt; + +import com.fr.log.FineLoggerFactory; +import com.fr.plugin.config.YituanPri; +import com.fr.plugin.utils.UserSync; +import com.fr.plugin.utils.YiTuanMaManager; +import com.fr.stable.StringUtils; + +import java.io.PrintWriter; +import java.io.StringWriter; + +public class MyStartupThred extends Thread { + + public void run() { + try { + if (StringUtils.isBlank(YiTuanMaManager.getInstance().getEid())) { + FineLoggerFactory.getLogger().error("未配置环境,结束。"); + return; + } + UserSync.startSyncUser(); + } catch (Exception var2) { + var2.printStackTrace(); + StringWriter writer = new StringWriter(); + PrintWriter printWriter = new PrintWriter(writer); + var2.printStackTrace(printWriter); + String s = writer.getBuffer().toString(); + FineLoggerFactory.getLogger().error("同步用户和同步部门出错:{},\n ex detail:{}", var2.getMessage(), s); + } + } + +} diff --git a/src/main/java/com/fr/plugin/yt/MyUrlAliasProvider.java b/src/main/java/com/fr/plugin/yt/MyUrlAliasProvider.java new file mode 100644 index 0000000..b0ee2e2 --- /dev/null +++ b/src/main/java/com/fr/plugin/yt/MyUrlAliasProvider.java @@ -0,0 +1,20 @@ +package com.fr.plugin.yt; + +import com.fr.decision.fun.impl.AbstractURLAliasProvider; +import com.fr.decision.webservice.url.alias.URLAlias; +import com.fr.decision.webservice.url.alias.URLAliasFactory; + +public class MyUrlAliasProvider extends AbstractURLAliasProvider { + @Override + public URLAlias[] registerAlias() { + return new URLAlias[]{ + //第一个参数就是就是别名地址,第二个就是HttpHandler中设置的地址,第三个参数就是设置该请求是否公开(需要和对应的HttpHandler.isPublic方法返回一直,要不然会报错404),返回的是一个非通配 + URLAliasFactory.createPluginAlias("/h5login", "/yt/h5login", true), + URLAliasFactory.createPluginAlias("/yt/pclogin", "/yt/pclogin", true), + URLAliasFactory.createPluginAlias("/ytlogin", "/yt/h5login", true), + URLAliasFactory.createPluginAlias("/getTicket", "/yt/ticket", true), + URLAliasFactory.createPluginAlias("/ytlogo", "/ytlogo", true), + URLAliasFactory.createPluginAlias("/ytImage", "/yt/image", true) + }; + } +} diff --git a/src/main/java/com/fr/plugin/yt/MyUserSyncManager.java b/src/main/java/com/fr/plugin/yt/MyUserSyncManager.java new file mode 100644 index 0000000..4c7d901 --- /dev/null +++ b/src/main/java/com/fr/plugin/yt/MyUserSyncManager.java @@ -0,0 +1,245 @@ +package com.fr.plugin.yt; + +import com.fr.decision.authority.AuthorityContext; +import com.fr.decision.authority.data.User; +import com.fr.log.FineLoggerFactory; +import com.fr.log.FineLoggerProvider; +import com.fr.plugin.beans.MyUserBean; +import com.fr.plugin.config.YituanPri; +import com.fr.plugin.dao.MyUserDao; +import com.fr.plugin.entitys.YTUserEntity; +import com.fr.plugin.utils.WebUtils; +import com.fr.stable.StringUtils; +import com.fr.stable.db.action.DBAction; +import com.fr.stable.db.dao.DAOContext; +import com.fr.stable.query.QueryFactory; +import com.fr.stable.query.condition.QueryCondition; +import com.fr.stable.query.restriction.RestrictionFactory; + +import java.util.ArrayList; +import java.util.List; +import java.util.stream.Collectors; + +public class MyUserSyncManager { + List list = new ArrayList<>(); + + public static MyUserSyncManager getInstance() { + return MyUserSyncManager.HOLDER.INSTANCE; + } + + private MyUserSyncManager() { + } + + /** + * 同步用户,先把数据库中的所有用户查询出来, + */ + public void synUserList() throws Exception { + YituanPri instance = YituanPri.getInstance(); + String eid = instance.getEid(); + String readKey = instance.getReadKey(); + FineLoggerProvider logger = FineLoggerFactory.getLogger(); + if (StringUtils.isNotBlank(eid) && StringUtils.isNotBlank(readKey)) { + int page = 0; + List allIdsFormService = new ArrayList<>(); + while (true) { + List userByPage = WebUtils.getUserByPage(eid, readKey, page); + if (userByPage.isEmpty()) { + break; + } + for (MyUserBean myUserBean : userByPage) { + String openId = myUserBean.getOpenId(); + allIdsFormService.add(openId); + if (userNotExist(openId)) { + YTUserEntity entity = myUserBean.createEntity(); + save(entity); + } else { + YTUserEntity entity = myUserBean.createEntity(); + update(entity); + } + } + logger.error("同步用户第:{}页", page); + page++; + } + List allUserId = findAllUserId(); + allUserId.removeAll(allIdsFormService);//减去服务端的ids,得到一个 + if (!allUserId.isEmpty()) { + for (String s : allUserId) { + logger.error("删除了一个用户:{}", s); + remove(s); + } + } + } + } + + private List findAllUserId() throws Exception { + List entityList = MyCoreDBAccess.getAccessor().runQueryAction(new DBAction>() { + public List run(DAOContext content) throws Exception { + QueryCondition queryCondition = QueryFactory.create(); + return content.getDAO(MyUserDao.class).find(queryCondition); + } + }); + List ids = new ArrayList<>(entityList.size()); + for (YTUserEntity entity : entityList) { + ids.add(entity.getOpenId()); + } + return ids; + } + + public void saveOrUpdateUser(MyUserBean userBean) throws Exception { + String openId = userBean.getOpenId(); + if (userNotExist(openId)) { + YTUserEntity entity = userBean.createEntity(); + save(entity); + } else { + YTUserEntity entity = userBean.createEntity(); + update(entity); + } + } + + private boolean userNotExist(final String openid) throws Exception { + return MyCoreDBAccess.getAccessor().runQueryAction(new DBAction>() { + public List run(DAOContext content) throws Exception { + QueryCondition queryCondition = QueryFactory.create(); + queryCondition.addRestriction(RestrictionFactory.eq("openId", openid)); + return content.getDAO(MyUserDao.class).find(queryCondition); + } + }).isEmpty(); + } + + private void remove(final String openId) throws Exception { + MyCoreDBAccess.getAccessor().runDMLAction(new DBAction() { + public YTUserEntity run(DAOContext content) throws Exception { + content.getDAO(MyUserDao.class).remove(QueryFactory.create().addRestriction(RestrictionFactory.eq("openId", openId))); + return null; + } + }); + } + + private void save(final YTUserEntity entity) throws Exception { + MyCoreDBAccess.getAccessor().runDMLAction(new DBAction() { + public YTUserEntity run(DAOContext content) throws Exception { + content.getDAO(MyUserDao.class).add(entity); + return null; + } + }); + } + + private void update(final YTUserEntity entity) throws Exception { + MyCoreDBAccess.getAccessor().runDMLAction(new DBAction() { + public YTUserEntity run(DAOContext content) throws Exception { + content.getDAO(MyUserDao.class).update(entity); + return null; + } + }); + } + + /** + * 通过部门长名取用户 + * + * @return + */ + public List getDepartmentUserList(final int start, final int size) throws Exception { + + List entityList = MyCoreDBAccess.getAccessor().runQueryAction(new DBAction>() { + public List run(DAOContext content) throws Exception { + QueryCondition queryCondition = QueryFactory.create(); + queryCondition.setSkip(start); + queryCondition.setCount(size); + return content.getDAO(MyUserDao.class).find(queryCondition); + } + }); + return entityList.stream().map(YTUserEntity::createBean).collect(Collectors.toList()); + } + + public static User getFSUserByPhone(String phone) throws Exception { + return AuthorityContext.getInstance().getUserController().findOne(QueryFactory.create().addRestriction(RestrictionFactory.eq("mobile", phone))); + } + + public static User getFSUserByName(String name) throws Exception { + return AuthorityContext.getInstance().getUserController().findOne(QueryFactory.create().addRestriction(RestrictionFactory.eq("userName", name))); + } + + public List getUserList(final String key, final int start, final int count) throws Exception { + List entityList = MyCoreDBAccess.getAccessor().runQueryAction(new DBAction>() { + public List run(DAOContext content) throws Exception { + QueryCondition queryCondition = QueryFactory.create(); + queryCondition.addRestriction(RestrictionFactory.or(RestrictionFactory.like("name", key), RestrictionFactory.like("phone", key))); + queryCondition.setSkip(start); + queryCondition.setCount(count); + System.out.println(queryCondition); + return content.getDAO(MyUserDao.class).find(queryCondition); + } + }); + return entityList.stream().map(YTUserEntity::createBean).collect(Collectors.toList()); + } + + public long countUserList(final String key) throws Exception { + + return MyCoreDBAccess.getAccessor().runQueryAction(new DBAction() { + public Long run(DAOContext content) throws Exception { + QueryCondition queryCondition = QueryFactory.create(); + queryCondition.addRestriction(RestrictionFactory.or(RestrictionFactory.like("name", key), RestrictionFactory.like("phone", key))); + System.out.println(queryCondition); + return content.getDAO(MyUserDao.class).count(queryCondition); + } + }); + } + + public Long countDepartmentUserList() throws Exception { + return MyCoreDBAccess.getAccessor().runQueryAction(new DBAction() { + public Long run(DAOContext content) throws Exception { + QueryCondition queryCondition = QueryFactory.create(); + System.out.println(queryCondition); + return content.getDAO(MyUserDao.class).count(queryCondition); + } + }); + + } + + public MyUserBean getUserByOpenId(final String openid) throws Exception { + YTUserEntity entity = MyCoreDBAccess.getAccessor().runQueryAction(new DBAction() { + public YTUserEntity run(DAOContext content) throws Exception { + QueryCondition queryCondition = QueryFactory.create(); + queryCondition.addRestriction(RestrictionFactory.eq("openId", openid)); + System.out.println(queryCondition); + queryCondition.addRestriction(RestrictionFactory.eq("status", 1)); + return content.getDAO(MyUserDao.class).findOne(queryCondition); + } + }); + return entity == null ? null : entity.createBean(); + } + + public YTUserEntity getUserByFrName(String names) throws Exception { + YTUserEntity entity = MyCoreDBAccess.getAccessor().runQueryAction(new DBAction() { + public YTUserEntity run(DAOContext content) throws Exception { + QueryCondition queryCondition = QueryFactory.create(); + queryCondition.addRestriction(RestrictionFactory.eq("fsUserName", names)); + queryCondition.addRestriction(RestrictionFactory.eq("status", 1)); + System.out.println(queryCondition); + return content.getDAO(MyUserDao.class).findOne(queryCondition); + } + }); + return entity; + } + + public YTUserEntity getUserByPhone(final String mobile) throws Exception { + YTUserEntity entity = MyCoreDBAccess.getAccessor().runQueryAction(new DBAction() { + public YTUserEntity run(DAOContext content) throws Exception { + QueryCondition queryCondition = QueryFactory.create(); + queryCondition.addRestriction(RestrictionFactory.eq("phone", mobile)); + queryCondition.addRestriction(RestrictionFactory.eq("status", 1)); + System.out.println(queryCondition); + return content.getDAO(MyUserDao.class).findOne(queryCondition); + } + }); + return entity; + } + + + private static class HOLDER { + private static final MyUserSyncManager INSTANCE = new MyUserSyncManager(); + + private HOLDER() { + } + } +} diff --git a/src/main/java/com/fr/plugin/yt/YTLocalFinder.java b/src/main/java/com/fr/plugin/yt/YTLocalFinder.java new file mode 100644 index 0000000..d812079 --- /dev/null +++ b/src/main/java/com/fr/plugin/yt/YTLocalFinder.java @@ -0,0 +1,15 @@ +package com.fr.plugin.yt; + +import com.fr.stable.fun.impl.AbstractLocaleFinder; + +public class YTLocalFinder extends AbstractLocaleFinder { + private static final int CURRENT_LEVEL = 1; + public int currentAPILevel() { + return CURRENT_LEVEL; + } + + @Override + public String find() { + return "com/fr/plugin/yt/local/i18"; + } +} diff --git a/src/main/java/com/fr/plugin/yt/YTSystemOption.java b/src/main/java/com/fr/plugin/yt/YTSystemOption.java new file mode 100644 index 0000000..9c66a45 --- /dev/null +++ b/src/main/java/com/fr/plugin/yt/YTSystemOption.java @@ -0,0 +1,42 @@ +package com.fr.plugin.yt; + +import com.fr.decision.fun.impl.AbstractSystemOptionProvider; +import com.fr.decision.web.MainComponent; +import com.fr.plugin.transform.ExecuteFunctionRecord; +import com.fr.plugin.transform.FunctionRecorder; +import com.fr.stable.fun.Authorize; +import com.fr.web.struct.Atom; + + + @FunctionRecorder +public class YTSystemOption extends AbstractSystemOptionProvider { + public YTSystemOption() { + System.out.println("xx启动了哦"); + } + + @Override + @ExecuteFunctionRecord + public String id() { + return "YTSystemOption"; + } + + @Override + public String displayName() { + return "xx配置"; + } + + @Override + public int sortIndex() { + return 2; + } + + @Override + public Atom attach() { + return MainComponent.KEY; + } + + @Override + public Atom client() { + return MyComponent.KEY; + } +} diff --git a/src/main/resources/com/fr/plugin/web/css/login.css b/src/main/resources/com/fr/plugin/web/css/login.css new file mode 100644 index 0000000..3437c09 --- /dev/null +++ b/src/main/resources/com/fr/plugin/web/css/login.css @@ -0,0 +1,19 @@ +/* 二维码外框大小 */ +.wrp_code{ + width: 100px; + height: 100px; +} +/*二维码图片大小*/ +.impowerBox .qrcode{ + width: 100px; +} +/*背景颜色*/ +body{ + background-color: white !important; +} +.title{ + display: none; +} +.info{ + display: none; +} \ No newline at end of file diff --git a/src/main/resources/com/fr/plugin/web/css/yt.css b/src/main/resources/com/fr/plugin/web/css/yt.css new file mode 100644 index 0000000..e69de29 diff --git a/src/main/resources/com/fr/plugin/web/images/1x/icon/debugger.png b/src/main/resources/com/fr/plugin/web/images/1x/icon/debugger.png new file mode 100644 index 0000000..054e32b Binary files /dev/null and b/src/main/resources/com/fr/plugin/web/images/1x/icon/debugger.png differ diff --git a/src/main/resources/com/fr/plugin/web/images/1x/icon/icon_fail.png b/src/main/resources/com/fr/plugin/web/images/1x/icon/icon_fail.png new file mode 100644 index 0000000..69699d9 Binary files /dev/null and b/src/main/resources/com/fr/plugin/web/images/1x/icon/icon_fail.png differ diff --git a/src/main/resources/com/fr/plugin/web/images/1x/icon/icon_success.png b/src/main/resources/com/fr/plugin/web/images/1x/icon/icon_success.png new file mode 100644 index 0000000..3a92586 Binary files /dev/null and b/src/main/resources/com/fr/plugin/web/images/1x/icon/icon_success.png differ diff --git a/src/main/resources/com/fr/plugin/web/images/1x/icon/loading.gif b/src/main/resources/com/fr/plugin/web/images/1x/icon/loading.gif new file mode 100644 index 0000000..8b9c4f1 Binary files /dev/null and b/src/main/resources/com/fr/plugin/web/images/1x/icon/loading.gif differ diff --git a/src/main/resources/com/fr/plugin/web/images/2x/icon/debugger.png b/src/main/resources/com/fr/plugin/web/images/2x/icon/debugger.png new file mode 100644 index 0000000..b299862 Binary files /dev/null and b/src/main/resources/com/fr/plugin/web/images/2x/icon/debugger.png differ diff --git a/src/main/resources/com/fr/plugin/web/images/2x/icon/icon_fail.png b/src/main/resources/com/fr/plugin/web/images/2x/icon/icon_fail.png new file mode 100644 index 0000000..7309922 Binary files /dev/null and b/src/main/resources/com/fr/plugin/web/images/2x/icon/icon_fail.png differ diff --git a/src/main/resources/com/fr/plugin/web/images/2x/icon/icon_success.png b/src/main/resources/com/fr/plugin/web/images/2x/icon/icon_success.png new file mode 100644 index 0000000..96d5485 Binary files /dev/null and b/src/main/resources/com/fr/plugin/web/images/2x/icon/icon_success.png differ diff --git a/src/main/resources/com/fr/plugin/web/images/2x/icon/loading.gif b/src/main/resources/com/fr/plugin/web/images/2x/icon/loading.gif new file mode 100644 index 0000000..5d81040 Binary files /dev/null and b/src/main/resources/com/fr/plugin/web/images/2x/icon/loading.gif differ diff --git a/src/main/resources/com/fr/plugin/web/images/log.jpg b/src/main/resources/com/fr/plugin/web/images/log.jpg new file mode 100644 index 0000000..30271e6 Binary files /dev/null and b/src/main/resources/com/fr/plugin/web/images/log.jpg differ diff --git a/src/main/resources/com/fr/plugin/web/js/esenyunjs.js b/src/main/resources/com/fr/plugin/web/js/esenyunjs.js new file mode 100644 index 0000000..6cfe3bf --- /dev/null +++ b/src/main/resources/com/fr/plugin/web/js/esenyunjs.js @@ -0,0 +1,81 @@ +(function() { + + if (window.EsenYunJSBridge) { + // Android加上了这个if判断,如果当前window已经定义了EsenyunBridge对象,不再重新加载 + // 避免重新初始化_callback_map等变量,导致之前的消息回调失败,返回cb404 + //alert('window already has a EsenyunBridge object!!!'); + return; + }; + + ///////////////////////////////////////////////////////////////////////////////////////////////// + ///////////////////////////////////本地调用的实际逻辑//////////////////////////////////////////// + var _CUSTOM_PROTOCOL_SCHEME = 'esenyun', + callbacksCount = 1, + callbacks = {}; + + function _handleMessage(callbackId, message) { + + try { + var callback = callbacks[callbackId]; + if (!callback) return; + callback.apply(null, [message]); + } catch (e) { + alert(e) + } + } + + /** + * 获取用户ua信息,判断OS + * @returns {string} + */ + function getOS() { + var userAgent = navigator.userAgent; + return userAgent.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/) ? 'ios' : userAgent.match(/Android/i) ? 'android' : ''; + } + /** + * + * @returns {Array|{index: number, input: string}} + */ + function isCloudHub() { + var userAgent = navigator.userAgent; + return userAgent.match(/App\/cloudhub/); + } + + // Use this in javascript to request native objective-c code + // functionName : string (I think the name is explicit :p) + // args : array of arguments + // callback : function with n-arguments that is going to be called when the native code returned + function _call(functionName, message, callback) { + //只有在手机Esenyun JSBridge + if ( !getOS() ) return false; + var hasCallback = callback && typeof callback == "function"; + var callbackId = hasCallback ? callbacksCount++ : 0; + + if (hasCallback) + callbacks[callbackId] = callback; + + var iframe = document.createElement("IFRAME"); + iframe.setAttribute("src", _CUSTOM_PROTOCOL_SCHEME + ":" + functionName + ":" + callbackId + ":" + encodeURIComponent(JSON.stringify(message))); + // For some reason we need to set a non-empty size for the iOS6 simulator... + iframe.setAttribute("height", "1px"); + iframe.setAttribute("width", "1px"); + document.documentElement.appendChild(iframe); + setTimeout(function() { + iframe.parentNode.removeChild(iframe); + iframe = null; + }, 100); + + + } + + + var __EsenYunJSBridge = { + // public + invoke: _call, + call: _call, + handleMessage: _handleMessage + }; + + window.EsenYunJSBridge = __EsenYunJSBridge; + +})(); \ No newline at end of file diff --git a/src/main/resources/com/fr/plugin/web/js/group.js b/src/main/resources/com/fr/plugin/web/js/group.js new file mode 100644 index 0000000..bc0ca75 --- /dev/null +++ b/src/main/resources/com/fr/plugin/web/js/group.js @@ -0,0 +1,446 @@ +(function () { + var e = BI.inherit(Fix.Model, { + childContext: ["depMember"], state: function () { + return {depMember: [], matchConfig: {}, serverTables: [], tableColNames: []} + }, computed: { + serverTableData: function () { + return BI.map(this.model.serverTables, function (e, t) { + return {text: t.dataSetName, value: t.dataSetValue} + }) + }, tableDataColName: function () { + return BI.map(this.model.tableColNames, function (e, t) { + return {text: t.columnName, value: t.columnValue} + }) + } + }, actions: { + initData: function () { + var n = this; + }, _getScheduleTaskConfig: function (n) { + var a = this; + Dec.YT.Util.ajax({ + url: "/weixin/timing/task", type: "GET", data: {}, complete: function (e, t) { + if ("success" === t) { + var i = BI.jsonDecode(e.responseText); + i.errorCode === Dec.YT.ERROR_CODE_OK ? BI.isFunction(n) && n.call(a, i) : Dec.Msg.alert({message: Dec.YT.Util.handleCommonErr(i)}) + } + } + }) + }, _saveGroup: function (params,success) { + Dec.YT.Util.ajax({ + url: "/yt/group", + type: "POST", + data: params, + complete: function (e, t) { + success(); + if ("success" === t) { + var i = BI.jsonDecode(e.responseText); + i.errorCode === Dec.YT.ERROR_CODE_OK ? BI.Msg.toast(BI.i18nText("Dec-Basic_Success")) : Dec.Msg.alert({message: i.msg}) + } + } + }); + }, _updateGroup: function (params) { + Dec.YT.Util.ajax({ + url: "/yt/groupUpdate", + type: "POST", + data: params, + complete: function (e, t) { + if ("success" === t) { + var i = BI.jsonDecode(e.responseText); + i.errorCode === Dec.YT.ERROR_CODE_OK ? BI.Msg.toast(BI.i18nText("Dec-Basic_Success")) : Dec.Msg.alert({message: i.msg}) + } + } + }) + }, getDataSetColumn: function (e) { + var i = this; + Dec.reqGet("/v10/" + e + "/datasetcolumns", {}, function (e) { + var t = e.data; + t && (i.model.tableColNames = t) + }) + }, getGroupsData: function (e) { + var n = this, t = "", i = "", a = "", r = "", o = 0, s = 10, l = e; + l instanceof Object && (t = l.keyword || "", i = l.corpId || "", a = l.secret || "", r = l.depId || "", o = l.startIdx || 0, s = l.count || 10); + var c = BI.Constants.getConstant("yt.constants").popup_loading_syn_users, + u = Dec.YT.Util.showLoading(".weixin-member-management-container", BI.i18nText("FS-YT_Loading"), c); + Dec.YT.Util.ajax({ + url: "/yt/groups", + type: "get", + data: {keyword: t, startIdx: o, count: s}, + complete: function (e, t) { + if (u.remove(c), "success" === t) { + var i = BI.jsonDecode(e.responseText); + i.errorCode === Dec.YT.ERROR_CODE_OK ? n.model.depMember = i : Dec.Msg.alert({message: Dec.YT.Util.handleCommonErr(i)}) + } + } + }) + } + } + }); + BI.model("yt.model.member.group", e) +}()); +(function () { + BI.constant("yt.constants.member.management.table.header.group.name", [[{ + text: "群ID", + baseCls: "", + cls: "weixin-table-header", + height: 33 + }, { + text: BI.i18nText("群名称"), + baseCls: "", + cls: "weixin-table-header", + height: 33 + }, { + text: BI.i18nText("操作"), + baseCls: "", + cls: "weixin-table-header", + height: 33 + }]]) + + + var t = BI.inherit(BI.Widget, { + _store: function () { + return BI.Models.getModel("yt.model.member.group") + }, watch: { + agentList: function () { + this._clearPageEditor() + }, depMember: function () { + (this._populateWeiXinMemberTable(this.model.depMember), this._populateWeiXinPageNumberButtons(this.model.depMember)) + }, serverTableData: function () { + this.dataSetCombo.populate(this.model.serverTableData), this.dataSetCombo.setValue(this.model.matchConfig.dataSet), this.store.getDataSetColumn(this.dataSetCombo.getValue()) + }, tableDataColName: function () { + this.userIdCombo.populate(this.model.tableDataColName), this.userIdCombo.setValue(this.model.matchConfig.dataSetUserId), this.fsUserNameCombo.populate(this.model.tableDataColName), this.fsUserNameCombo.setValue(this.model.matchConfig.dataSetFsName) + } + }, render: function () { + var e = this; + this.store.getGroupsData({ + depId: "", + keyword: "", + startIdx: 10 * (this.currentPage - 1) + }); + return e.currentPage = 1, e.totalPage = 1, e.matchConfig = {}, e.fsUserNameComboGroup = [], e.member_management_table_header_non_fsusername = BI.Constants.getConstant("yt.constants.member.management.table.header.group.name"), e.member_management_table_header_fsusername = BI.Constants.getConstant("yt.constants.member.management.table.header.fsusername"), e.matchingFsWayPane = e._createMatchingFsWayPane(), e.synMemberPane = e._createSynMemberPane(), { + type: "bi.vertical", + vgap: 14, + hgap: 14, + items: [{el: e.matchingFsWayPane}, {el: e.synMemberPane}] + } + }, mounted: function () { + Dec.YT.Util.formatTableStyle(), this.store.initData(), this._clearPageEditor() + }, _createMatchingFsWayPane: function () { + var t = this; + return { + type: "bi.vertical", + cls: "weixin-section-container", + lgap: 14, + rgap: 14, + items: [ + { + type: "bi.left_right_vertical_adapt", + height: 40, + cls: "bi-border-bottom", + items: { + left: [{ + type: "bi.label", + text: BI.i18nText("群聊配置"), + cls: "weixin-title" + }], + right: [{ + width: 80, + height: 24, + type: "bi.button", + text: BI.i18nText("添加"), + handler: function () { + t._checkValid() ? t.store._saveGroup({ + groupId: t.groupId.getValue(), + groupName: t.groupName.getValue() + },function () { + t._refreshDepartmentData(); + }) : Dec.Msg.alert({message: BI.i18nText("请配置参数")}) + } + }] + } + }, + { + el: { + type: "bi.vertical_adapt", + items: [{ + type: "bi.label", + text: BI.i18nText("群id"), + width: 116, + textAlign: "left" + }, { + type: "bi.text_editor", + width: 150, + height: 24, + ref: function (e) { + t.groupId = e; + } + }] + }, vgap: 10 + }, { + el: { + type: "bi.vertical_adapt", + items: [{ + type: "bi.label", + text: BI.i18nText("群群名称"), + width: 116, + textAlign: "left" + }, { + type: "bi.text_editor", + width: 150, + height: 24, + ref: function (e) { + t.groupName = e; + } + }] + }, vgap: 10 + } + ] + } + }, _createSynMemberPane: function () { + var t = this; + return { + type: "bi.vertical", + cls: "weixin-section-container", + lgap: 14, + rgap: 14, + items: [{ + type: "bi.left_right_vertical_adapt", + height: 54, + items: { + left: [{ + type: "bi.icon_text_item", + text: "", + cls: "weixin-refresh-font", + width: 90, + height: 20 + } + ], right: [{ + type: "bi.search_editor", width: 150, height: 24, ref: function (e) { + t.weixinMemberSearchEditor = e + }, listeners: [{ + eventName: BI.SearchEditor.EVENT_CLEAR, action: function () { + t._clearPageEditor(), t._refreshDepartmentData() + } + }, { + eventName: BI.Editor.EVENT_CONFIRM, action: function () { + t._clearPageEditor(), t._refreshDepartmentData() + } + }] + }] + } + }, { + type: "bi.htape", + height: 456, + cls: "bi-border-top", + items: [{ + type: "bi.vertical", + items: [{ + type: "bi.preview_table", + lgap: 10, + tgap: 10, + cls: "weixin-table", + isNeedMerge: !1, + isNeedFreeze: !1, + columnSize: [.264, .264, .264, .208], + header: t.member_management_table_header_non_fsusername, + items: [], + ref: function (e) { + t.memberTableNonFsUserName = e + } + }, { + type: "bi.preview_table", + lgap: 10, + tgap: 10, + cls: "weixin-table", + isNeedMerge: !1, + isNeedFreeze: !1, + columnSize: [.212, .212, .212, .212, .153], + header: t.member_management_table_header_fsusername, + invisible: !0, + items: [], + ref: function (e) { + t.memberTableWithFsUserName = e + } + }, { + type: "bi.left_right_vertical_adapt", + tgap: 10, + height: 26, + items: { + right: [{ + type: "bi.horizontal", + items: [{ + type: "bi.icon_button", + width: 24, + height: 24, + cls: "page-button dec-pager-first-font", + handler: function () { + 1 < t.currentPage && (t.currentPage = 1, t.memberPageEditor.setValue(t.currentPage.toString()), t._refreshDepartmentData()) + } + }, { + type: "bi.icon_button", + width: 24, + height: 24, + lgap: 5, + cls: "page-button dec-pager-prev-font", + disabled: !0, + ref: function (e) { + t.previousPageButton = e + }, + handler: function () { + 1 < t.currentPage && (t.currentPage -= 1, t.memberPageEditor.setValue(t.currentPage.toString()), t._refreshDepartmentData()) + } + }, { + type: "bi.editor", + cls: "bi-border", + allowBlank: !0, + width: 40, + height: 24, + lgap: 5, + rgap: 5, + value: t.currentPage.toString(), + ref: function (e) { + t.memberPageEditor = e + }, + listeners: [{ + eventName: BI.Editor.EVENT_CONFIRM, action: function () { + this.getValue() > t.totalPage ? this.setValue(t.totalPage) : this.getValue() < 1 && this.setValue(1), t.currentPage = parseInt(this.getValue()), t._refreshDepartmentData() + } + }] + }, {type: "bi.label", width: 5, height: 24, text: "/ "}, { + type: "bi.label", + height: 24, + lgap: 5, + text: "1", + ref: function (e) { + t.memberPageLabel = e + } + }, { + type: "bi.icon_button", + width: 24, + height: 24, + lgap: 5, + cls: "page-button dec-pager-next-font", + ref: function (e) { + t.nextPageButton = e + }, + handler: function () { + t.currentPage < t.totalPage && (t.currentPage += 1, t.memberPageEditor.setValue(t.currentPage.toString()), t._refreshDepartmentData()) + } + }, { + type: "bi.icon_button", + width: 24, + height: 24, + lgap: 5, + cls: "page-button dec-pager-last-font", + handler: function () { + t.currentPage < t.totalPage && (t.currentPage = t.totalPage, t.memberPageEditor.setValue(t.currentPage.toString()), t._refreshDepartmentData()) + } + }] + }] + } + }] + }] + }] + } + }, _refreshDepartmentData: function () { + this.store.getGroupsData({ + depId: "", + keyword: this.weixinMemberSearchEditor.getValue(), + startIdx: 10 * (this.currentPage - 1) + }) + }, _populateWeiXinPageNumberButtons: function (e) { + var t = e.userList.total; + this.totalPage = t ? Math.ceil(t / 10) : 1, this.memberPageLabel.setValue(this.totalPage), 1 === this.totalPage && 1 === this.currentPage ? (this.nextPageButton.setEnable(!1), this.previousPageButton.setEnable(!1)) : 1 === this.currentPage ? (this.nextPageButton.setEnable(!0), this.previousPageButton.setEnable(!1)) : (this.currentPage === this.totalPage ? this.nextPageButton.setEnable(!1) : this.nextPageButton.setEnable(!0), this.previousPageButton.setEnable(!0)) + }, _populateWeiXinMemberTable: function (e) { + var self=this; + this.rows = []; + var t, i = this, n = [], a = [], r = e.userList.users ? e.userList.users : []; + for (var o = 0; o < r.length; o++) { + var s = Dec.YT.Util.replaceDepartmentArrToString(r[o]); + n.push(function (t) { + i.rows[t] = { + id: r[t].id + }; + return [ + { + type: "bi.label", + text: r[t].id, + lgap: 5, + width: 240, + height: 24 + }, + { + type: "bi.text_editor", + value: r[t].text, + lgap: 5, + ref: function (e) { + i.rows[t].text = e; + }, + listeners: [{ + eventName: "EVENT_CHANGE", action: function (v) { + i.store._updateGroup({ + groupId: i.rows[t].id, + groupName: i.rows[t].text.getValue() + }); + } + }], + width: 240, + height: 24 + }, { + type: "bi.button", level: "warning", text: "删除", width: 5, height: 23, lgap: 5, + handler: function () { + var params={ + groupId:r[t].id + }; + Dec.YT.Util.ajax({ + url: "/yt/delgroup", + type: "POST", + data: params, + complete: function (e, t) { + self._refreshDepartmentData(); + if ("success" === t) { + var i = BI.jsonDecode(e.responseText); + i.errorCode === Dec.YT.ERROR_CODE_OK ? BI.Msg.toast(BI.i18nText("Dec-Basic_Success")) : Dec.Msg.alert({message: i.msg}) + } + } + }) + + } + }] + }(o)) + } + i.memberTableNonFsUserName.populate(n) + + Dec.YT.Util.formatTableStyle() + }, _createAutoUpdateMemberPopupPane: function (e) { + var t = BI.Constants.getConstant("yt.constants").popup_auto_update_member, i = BI.extend(e, { + type: "yt.schedule.task.popover", + listeners: [{ + eventName: "EVENT_CLOSE", action: function () { + BI.Popovers.remove(t) + } + }] + }); + BI.Popovers.create(t, { + cls: "weixin-container", + header: { + type: "bi.left_vertical_adapt", + hgap: 5, + items: [{type: "bi.label", forceCenter: !0, text: BI.i18nText("FS-YT_Set_Update")}] + }, + body: i, + width: 455, + height: 245, + listeners: [{ + eventName: "EVENT_CLOSE", action: function () { + BI.Popovers.remove(t) + } + }] + }).open(t), $(".weixin-popup-cancel-button").css("border", "1px solid #3685F2").css("border-radius", "2px").css("color", "#3685F2"), $(".weixin-popup-confirm-button").css("border-radius", "2px"), $(".weixin-auto-update-popup-content").css("top", "10px"), $(".weixin-popup-south-container").css("right", "0px").css("left", "0px") + }, _clearPageEditor: function () { + this.memberPageEditor.setValue(1), this.currentPage = 1, this.nextPageButton.setEnable(!0), this.previousPageButton.setEnable(!1) + }, _checkValid: function () { + return this.groupId.getValue() !== "" && this.groupName.getValue() !== "" + } + }); + BI.shortcut("yt.groupmanagement", t) +}()); \ No newline at end of file diff --git a/src/main/resources/com/fr/plugin/web/js/push.js b/src/main/resources/com/fr/plugin/web/js/push.js new file mode 100644 index 0000000..d2cfa67 --- /dev/null +++ b/src/main/resources/com/fr/plugin/web/js/push.js @@ -0,0 +1,224 @@ +( + (function () { + //注入定时调度 + Dec.Plugin.OutPutActionProvider.items.push({ + version: 1, + terminalType: 128, + terminalText: "xx", + getItem: function () { + var t = this; + return { + type: "yt.schedule", + invisible: !0, + height: 90, + ref: function (e) { + t.ytma = e + } + } + }, + setValue: function (e) { + var that = this; + this.ytma.setValue(e); + }, + getValue: function () { + var yt = this.ytma.getValue(); + return { + OutputYT: BI.extend(this.value, { + "@class": "com.fr.plugin.beans.YTOutputBean", + actionName: "com.fr.plugin.beans.YTOutputBean", + terminal: 128, + clientId: yt.clientId, + sendType: yt.sendType, + fromUserId: yt.fromUserId + }) + } + }, + checkValid: function () { + return this.ytma.checkValid() + }, + fireEvent: function (e) { + this.ytma.setVisible(e) + } + }) + })(), + function () { + var e = BI.inherit(BI.Widget, { + render: function () { + var that = this; + var t = this; + return { + type: "bi.vertical", + height: 100, + vgap: 5, + items: [ + { + type: "bi.htape", + height: 30, + items: [ + { + width: 100, + el: { + height: 24, + type: "bi.label", + text: "推送类型:" + } + }, { + width: "fill", + el: { + type: "bi.text_value_combo", + width: 281, + height: 24, + value: 1, + ref: function (e) { + t.combo_type = e + }, + listeners: [{ + eventName: BI.TextValueCombo.EVENT_CHANGE, + action: function () { + var sel = this.getValue()[0]; + if (sel === "4") { + t.senderLine.setVisible(true); + } else { + t.senderLine.setVisible(false); + } + } + }], + items: [ + { + text: "应用消息", + value: "1", + }, + { + text: "聊天群消息", + value: "2" + }, + { + text: "公共号", + value: "3" + }, + { + text: "个人", + value: "4" + } + ] + } + } + ] + }, + { + type: "bi.htape", + height: 30, + ref: function (e) { + t.senderLine = e; + }, + items: [ + { + width: 100, + el: { + type: "bi.label", + text: "企业:", + height: 24, + } + }, { + width: "fill", + el: { + type: "bi.single_select_combo", + width: 281, + height: 24, + valueFormatter: function (id) { + var item = BI.find(that.compnys, function (i, v) { + return v.value === id; + }) + if (item) { + return item.text + } + }, + itemsCreator: function (n, callback) { + Dec.YT.Util.ajax({ + url: "/yt/configList", + type: "GET", + complete: function (e, t) { + if ("success" === t) { + var res = BI.jsonDecode(e.responseText); + if (res.errorCode === Dec.YT.ERROR_CODE_OK) { + var compnys = that.compnys = BI.map(res.companys, function (i, v) { + return { + text: v.agentName, + value: v.clientId + } + }); + callback({items: compnys}) + } else { + Dec.Msg.alert({message: Dec.YT.Util.handleCommonErr(res)}) + } + } + } + }) + }, + ref: function (e) { + t.company = e + }, + listeners: [{ + eventName: BI.TextValueCombo.EVENT_CHANGE, + action: function () { + + } + }], + items: this.compnys + } + } + ] + }, + { + type: "bi.htape", + invisible: true, + height: 30, + ref: function (e) { + t.senderLine = e; + }, + items: [ + { + width: 100, + el: { + type: "bi.label", + text: "发送人:", + height: 24, + } + }, { + width: "fill", + el: { + type: "bi.editor", + cls: "bi-border", + height: 24, + ref: function (e) { + t.sender = e; + } + } + } + ] + } + ] + } + }, mounted: function () { + + }, getValue: function () { + var params = {}; + params.fromUserId = this.sender.getValue(); + var clients = this.company.getValue(); + params.clientId = clients; + params.sendType = this.combo_type.getValue()[0]; + return params; + }, setValue: function (e) { + this.sender.setValue(e.fromUserId); + this.company.setValue(e.clientId); + this.combo_type.setValue(e.sendType + ""); + if(e.sendType===4){ + this.senderLine.setVisible(true) + } + }, checkValid: function () { + return !BI.isEmpty(this.combo_type.getValue()[0]) + } + }); + BI.shortcut("yt.schedule", e) + }() +); \ No newline at end of file diff --git a/src/main/resources/com/fr/plugin/web/js/yituanma.js b/src/main/resources/com/fr/plugin/web/js/yituanma.js new file mode 100644 index 0000000..70f2377 --- /dev/null +++ b/src/main/resources/com/fr/plugin/web/js/yituanma.js @@ -0,0 +1,861 @@ +FS.YiTuanMa = { + YiTuanMa_ModuleID : 818, + YiTuanMa_WidgetName_Eid : "eid", + YiTuanMa_WidgetName_ClientID : "clientId", + YiTuanMa_WidgetName_ClientSecret : "clientSecret", + YiTuanMa_WidgetName_GroupId : "groupId", + YiTuanMa_WidgetName_MemberGrid : "memberGrid", + YiTuanMa_WidgetName_TableLayout : "tableLayout", + YiTuanMa_WidgetName_PubGrid : "pubGrid", + YiTuanMa_WidgetName_GroupGrid : "groupGrid", + + createYiTuanMaManagementPane : function(container) { + var self = this; + this.initData(); + var YiTuanMaMemberManageConfig = [ + self.createYiTuanMaMemberHeaderConfig(), + [self.createMemberGrid(), null, null, null, null] + ]; + new FS.LTabPane({ + width: '100%', + height: '100%', + style: 'blue', + marginLeft: 40, + renderEl: container, + items: [ + { + title: FR.i18nText("FS-YiTuanMa_Basic"), + content: { + widgetName: 'basicPanel', + type: 'confirm', + firstBtnMargin: 0, + text4OK: FR.i18nText("FS-Frame-Simple_Save"), + text4Cancel: null, + width: 700, + height: 235, + btnsAlignment: 'left', + closeAfterAction: false, + doSize: true, + onOK: function () { + self.saveConfig(); + }, + contentWidget: { + type:'tablelayout', + widgetName:this.YiTuanMa_WidgetName_TableLayout, + columnSize: [130, 500], + rowSize: [21, 21, 21, 21], + vgap: 20, + items:[ + [ + { + el: { + type:'llabel', + value:FR.i18nText("FS-YiTuanMa_Team_EID") + } + }, + { + el: { + type: "text", + widgetName: this.YiTuanMa_WidgetName_Eid + } + } + ], + [ + { + el: { + type:'llabel', + value:"ClientId" + } + }, + { + el: { + type: "text", + widgetName: this.YiTuanMa_WidgetName_ClientID + } + } + ], + [ + { + el: { + type:'llabel', + value:"ClientSecret" + } + }, + { + el: { + type: "text", + widgetName: this.YiTuanMa_WidgetName_ClientSecret + } + } + ], + [ + { + el: { + type:'llabel', + value:"groupId/tenantId" + } + }, + { + el: { + type: "text", + widgetName: this.YiTuanMa_WidgetName_GroupId + } + } + ] + ] + } + } + }, + { + title:FR.i18nText("FS-YiTuanMa_Member_Management"), + content: { + type: 'panel', + width: 710, + height: 400, + doSize: true, + contentWidget: { + type: 'tablepane', + colSize: ['auto', 200, 140, 140, 214], + rowSize: [28, 'auto'], + vgap: 15, + marginLeft: 10, + marginRight: 10, + items: YiTuanMaMemberManageConfig + } + } + }, + { + title:FR.i18nText("FS-Module-YiTuanMa_Group_Manager"), + content: { + type: 'panel', + width: 710, + height: 400, + doSize: true, + contentWidget: { + type: 'tablepane', + colSize: [20, 100, 20, 100, 200, 214], + rowSize: [28, "fill"], + vgap: 15, + items: [ + [ + {}, { + //添加按钮 + type: 'quickbutton', + text: FR.i18nText("FS-YiTuanMa_Add_Group"), + style: 'blue', + height: 28, + width: 100, + handler: function () { + self.createGroupDialog(); + } + }, {}, { + //删除按钮 + type: 'quickbutton', + text: FR.i18nText("FS-YiTuanMa_Del_Group"), + style: 'grey', + height: 28, + width: 100, + handler: function () { + var groupGrid = self.groupGrid(); + var selectedData = groupGrid.getSelectedData(); + var dgroupids = []; + for (var i = 0, len = selectedData.length; i < len; i++) { + dgroupids.push(selectedData[i].id); + } + var callback = function () { + groupGrid.refresh(); + }; + self.removeGroups(dgroupids.join(","), callback); + } + }, {}, { + type: 'search', + widgetName: 'YiTuanMaSearchGroup', + onSearch: function () { + var value = this.getValue(); + var groupGrid = self.groupGrid(); + var data = groupGrid.options.async.data; + data.startIdx = 0; + data.keyword = value; + groupGrid.activedPage = 1; + groupGrid.refresh(); + } + } + ], + [ + $('
').height(1), null, null, null, null, self.createYiTuanMaGroupConfig() + ] + ] + } + } + }, + { + title:FR.i18nText("FS-Module-YiTuanMa_Pub_Manager"), + content: { + type: 'panel', + width: 710, + height: 400, + doSize: true, + contentWidget: { + type: 'tablepane', + colSize: [20, 100, 20, 100, 200, 214], + rowSize: [28, "fill"], + vgap: 15, + items: [ + [ + {}, { + //添加按钮 + type: 'quickbutton', + text: FR.i18nText("FS-YiTuanMa_Add_Pub"), + style: 'blue', + height: 28, + width: 100, + handler: function () { + self.createPubDialog(); + } + }, {}, { + //删除按钮 + type: 'quickbutton', + text: FR.i18nText("FS-YiTuanMa_Del_Pub"), + style: 'grey', + height: 28, + width: 100, + handler: function () { + var pubGrid = self.pubGrid(); + var selectedData = pubGrid.getSelectedData(); + var dpubids = []; + for (var i = 0, len = selectedData.length; i < len; i++) { + dpubids.push(selectedData[i].id); + } + var callback = function () { + pubGrid.refresh(); + }; + self.removePubs(dpubids.join(","), callback); + } + }, {}, { + type: 'search', + widgetName: 'YiTuanMaSearchPub', + onSearch: function () { + var value = this.getValue(); + var pubGrid = self.pubGrid(); + var data = pubGrid.options.async.data; + data.startIdx = 0; + data.keyword = value; + pubGrid.activedPage = 1; + pubGrid.refresh(); + } + } + ], + [ + $('
').height(1), null, null, null, null, self.createYiTuanMaPubConfig() + ] + ] + } + } + } + ], + initAfterActions: [ + function () { + self.configTabPane = this; + self.setWidgetValue(self.YiTuanMa_WidgetName_Eid, self.data.eid); + self.setWidgetValue(self.YiTuanMa_WidgetName_ClientID, self.data.clientId); + self.setWidgetValue(self.YiTuanMa_WidgetName_ClientSecret, self.data.clientSecret); + self.setWidgetValue(self.YiTuanMa_WidgetName_GroupId, self.data.groupId); + } + ] + }); + }, + + createYiTuanMaMemberHeaderConfig : function() { + var self = this; + return [ + null, {}, {}, {}, { + type: 'search', + widgetName: 'YiTuanMaSearchUser', + onSearch: function () { + var value = this.getValue(); + var usergrid = self.configTabPane.getWidgetByName(FS.YiTuanMa.YiTuanMa_WidgetName_MemberGrid); + var data = usergrid.options.async.data; + data.startIdx = 0; + data.keyword = value; + data.needReSync = false; + usergrid.activedPage = 1; + usergrid.refresh(); + } + } + ]; + }, + + createMemberGrid : function() { + var self = this; + var colcfg = [ + { + key: "userId", + value: FR.i18nText("FS-YiTuanMa_UserID"), + width: 260 + }, + { + key: "name", + value: FR.i18nText("FS-YiTuanMa_Username"), + width: 160 + }, + { + key: 'fsUsername', + value: FR.i18nText("FS-YiTuanMa_FSUserName"), + onCellClick: function (rowIdx, colIdx, item, colCfg, $cell) { + $cell.hide(); + if (!$cell.data('editing')) { + var $combo = new FR.ComboBoxEditor({ + renderEl: $('
').insertBefore($cell), + width: 100, + height: 25, + directEdit: true, + allowBlank: true, + value: item.fsUsername, + widgetUrl: FR.servletURL + "?op=ytm&cmd=fs_getallusers&onlyRelation=false", + listeners: [ + { + eventName: FR.Events.AFTEREDIT, + action: function () { + if(this.$view.isVisible()) { + //在搜索 + return; + } + self.dealWithUserRelation(this, item, $cell); + } + }, { + eventName: FR.Events.STOPEDIT, + action: function() { + if(this.btn.hasClass("fr-trigger-btn-down")) { + return ; + } + self.dealWithUserRelation(this, item, $cell); + } + } + ] + }); + $cell.data('editing', true); + $("input.fr-trigger-texteditor", $combo.element).focus(); + } + }, + width: 160 + } + ]; + return { + type: 'quickgrid', + page: true, + autoPage: false, + pageCount: 10, + multiSelect: false, + intervalColor: true, + marginLeft: 10, + marginRight: 10, + widgetName: FS.YiTuanMa.YiTuanMa_WidgetName_MemberGrid, + async: { + url: FR.servletURL + "?op=ytm&cmd=member_get", + data: { + startIdx: 0, + count: 10, + needReSync:true + } + }, + onPageTurn: function (active, count, nav) { + var async = this.options.async; + async.data.startIdx = (active - 1) * count; + async.data.needReSync = false; + this.refresh(); + }, + onAsyncSuccess: function (res, status) { + var result = FR.jsonDecode(res); + this.options.items = result.users; + this.totalpages = Math.ceil(result.total / 10); + }, + columnsConfig: colcfg + }; + }, + + createYiTuanMaGroupConfig: function() { + var self = this; + var columns = [ + { + key: 'groupName', + value: FR.i18nText("FS-YiTuanMa_Group_Name"), + width: 190 + }, { + key: 'groupId', + value: FR.i18nText("FS-YiTuanMa_Group_ID"), + width: 400 + }, { + //删除按钮 + width: 24, + onCellCreate: function (rowIdx, colIdx, item) { + var delBtn = new FR.IconButton({ + width: 24, + height: 24, + imgsrc: 'fs-module-delete-white', + handler: function () { + var callback = function () { + self.groupGrid().refresh(); + }; + self.removeGroups(item.id, callback) + } + }); + return delBtn.element; + } + } + ]; + return { + type: 'quickgrid', + page: true, + autoPage: false, + pageCount: 10, + multiSelect: true, + intervalColor: true, + widgetName: FS.YiTuanMa.YiTuanMa_WidgetName_GroupGrid, + async: { + url: FR.servletURL + "?op=ytm&cmd=group_getall&onlyName=false", + data: { + startIdx: 0, + count: 10 + } + }, + onPageTurn: function (active, count, nav) { + var async = this.options.async; + async.data.startIdx = (active - 1) * count; + this.refresh(); + }, + onAsyncSuccess: function (res, status) { + var result = FR.jsonDecode(res); + this.options.items = result.groups; + this.totalpages = Math.ceil(result.total / 10); + }, + columnsConfig: columns + } + }, + + createYiTuanMaPubConfig: function() { + var self = this; + var columns = [ + { + //公共号名称 + key: 'pubName', + value: FR.i18nText("FS-YiTuanMa_Pub_Name"), + width: 190 + }, { + //公共号编码 + key: 'pubId', + value: FR.i18nText("FS-YiTuanMa_Pub_ID"), + width: 400 + }, { + //删除按钮 + width: 24, + onCellCreate: function (rowIdx, colIdx, item) { + var delBtn = new FR.IconButton({ + width: 24, + height: 24, + imgsrc: 'fs-module-delete-white', + handler: function () { + var callback = function () { + self.pubGrid().refresh(); + }; + self.removePubs(item.id, callback) + } + }); + return delBtn.element; + } + } + ]; + return { + type: 'quickgrid', + page: true, + autoPage: false, + pageCount: 10, + multiSelect: true, + intervalColor: true, + widgetName: FS.YiTuanMa.YiTuanMa_WidgetName_PubGrid, + async: { + url: FR.servletURL + "?op=ytm&cmd=pub_getall&onlyName=false", + data: { + startIdx: 0, + count: 10 + } + }, + onPageTurn: function (active, count, nav) { + var async = this.options.async; + async.data.startIdx = (active - 1) * count; + this.refresh(); + }, + onAsyncSuccess: function (res, status) { + var result = FR.jsonDecode(res); + this.options.items = result.pubs; + this.totalpages = Math.ceil(result.total / 10); + }, + columnsConfig: columns + } + }, + + dealWithUserRelation: function(combo, item, $cell) { + var val = combo.getValue(); + var originalValue = item["fsUsername"] ? item["fsUsername"] : ""; + item["fsUsername"] = val; + $cell.html(val).show(); + combo.destroy(); + $cell.data('editing', false); + if(val != originalValue) { + this.saveUserRelation(item, val); + } + }, + + initData: function () { + var self = this; + FR.ajax({ + url: FR.servletURL + '?op=ytm&cmd=basic_get', + type: 'POST', + async: false, + complete: function (res, status) { + self.data = FR.jsonDecode(res.responseText); + } + }); + }, + + saveConfig : function() { + var config = { + eid: this.getWidgetValue(this.YiTuanMa_WidgetName_Eid), + clientId: this.getWidgetValue(this.YiTuanMa_WidgetName_ClientID), + clientSecret:this.getWidgetValue(this.YiTuanMa_WidgetName_ClientSecret), + groupId:this.getWidgetValue(this.YiTuanMa_WidgetName_GroupId) + }; + FR.ajax({ + url: FR.servletURL + '?op=ytm&cmd=basic_set', + type: 'POST', + data: config, + complete: function (res, status) { + if (status === 'success') { + FR.Msg.toast(FR.i18nText("FS-Generic-Simple_Successfully")); + } + } + }); + }, + + saveUserRelation: function(item, fsUser) { + var id = item["id"]; + var yiTuanMaUsername = item["name"]; + var yiTuanMaUserId = item["userId"]; + + FR.ajax({ + url: FR.servletURL + "?op=ytm&cmd=saveUserRelation", + type: "POST", + data: { + "yiTuanMaUsername":yiTuanMaUsername, + "fsUser":fsUser, + "id": id, + "yiTuanMaUserId": yiTuanMaUserId + }, + complete: function (res, status) { + if(status !== "success") { + FR.Msg.toast(FR.i18nText("FS-Generic-Simple_Failed")); + } else { + var result = FR.jsonDecode(res.responseText); + item["id"] = result["id"]; + } + } + }); + }, + + createGroupDialog: function () { + var self = this; + var items = [ + [ + { + el: $('
') + } + ], + [ + { + el: $('
') + }, + { + el: { + type: 'llabel', + value: FR.i18nText("FS-YiTuanMa_Group_Name") + } + }, + { + el: $('
') + }, + { + el: { + type: 'text', + widgetName: 'groupName' + } + }, + null + ], + [ + { + el: $('
') + }, + { + el: { + type: 'llabel', + value: FR.i18nText("FS-YiTuanMa_Group_ID") + } + }, + { + el: $('
') + }, + { + el: { + type: 'text', + widgetName: 'groupId' + } + }, + null + ] + ]; + var groupDialog = new FR.Dialog({ + title: FR.i18nText("FS-YiTuanMa_Add_Group"), + width: 430, + height: 200, + modal: true, + confirm: true, + doSize: true, + border: true, + closable: true, + style: "blue", + needSeparate: 8, + contentWidget: { + widgetName: 'pubTablelayout', + type: 'tablelayout', + items: items, + columnSize: [20, 80, 10, 270, "fill"], + rowSize: [10, 25, 25], + vgap: 19 + }, + onOK: function () { + var groupName = this.getWidgetByName("groupName").getValue(); + var groupId = this.getWidgetByName("groupId").getValue(); + if (!groupName) { + FR.Msg.alert(FR.i18nText("FS-Generic-Simple_Wrong"), FR.i18nText("FS-YiTuanMa_Group_Name") + FR.i18nText("FS-Generic-NOT_NULL_Des") + FR.i18nText('FS-Process-Exclamation_mark')); + return false; + } + if (!groupId) { + FR.Msg.alert(FR.i18nText("FS-Generic-Simple_Wrong"), FR.i18nText("FS-YiTuanMa_Group_ID") + FR.i18nText("FS-Generic-NOT_NULL_Des") + FR.i18nText('FS-Process-Exclamation_mark')); + return false; + } + //不能有重名的存在 + var exists = true; + var result = FS.Sync.ajax({ + url: FR.servletURL + "?op=ytm&cmd=check_group_exists", + data: { + groupName: groupName + } + }); + exists = Boolean(result.exists); + if (exists) { + FR.Msg.alert(FR.i18nText("FS-Generic-Simple_Wrong"), FR.i18nText("FS-YiTuanMa_Group_Name_Exist")); + return false; + } + var completeFn = function (res, status) { + if (status === 'success') { + FR.Msg.toast(FR.i18nText("FS-Generic-Simple_Successfully")); + self.groupGrid().refresh(); + } else { + FR.Msg.toast(FR.i18nText("FS-Generic-Simple_Failed")); + } + }; + var config = { + url: FR.servletURL + "?op=ytm&cmd=save_group", + data: { + groupName: groupName, + groupId: groupId + }, + type: 'POST' + }; + FS.Async.ajax(config, completeFn); + return true; + }, + onCancel: function () { + } + }); + groupDialog.setVisible(true); + return groupDialog; + }, + + createPubDialog: function () { + var self = this; + var items = [ + [ + { + el: $('
') + } + ], + [ + { + el: $('
') + }, + { + el: { + type: 'llabel', + value: FR.i18nText("FS-YiTuanMa_Pub_Name") + } + }, + { + el: $('
') + }, + { + el: { + type: 'text', + widgetName: 'pubName' + } + }, + null + ], + [ + { + el: $('
') + }, + { + el: { + type: 'llabel', + value: FR.i18nText("FS-YiTuanMa_Pub_ID") + } + }, + { + el: $('
') + }, + { + el: { + type: 'text', + widgetName: 'pubId' + } + }, + null + ] + ]; + var pubDialog = new FR.Dialog({ + title: FR.i18nText("FS-YiTuanMa_Add_Pub"), + width: 430, + height: 200, + modal: true, + confirm: true, + doSize: true, + border: true, + closable: true, + style: "blue", + needSeparate: 8, + contentWidget: { + widgetName: 'pubTablelayout', + type: 'tablelayout', + items: items, + columnSize: [20, 80, 10, 270, "fill"], + rowSize: [10, 25, 25], + vgap: 19 + }, + onOK: function () { + var pubName = this.getWidgetByName("pubName").getValue(); + var pubId = this.getWidgetByName("pubId").getValue(); + if (!pubName) { + FR.Msg.alert(FR.i18nText("FS-Generic-Simple_Wrong"), FR.i18nText("FS-YiTuanMa_Pub_Name") + FR.i18nText("FS-Generic-NOT_NULL_Des") + FR.i18nText('FS-Process-Exclamation_mark')); + return false; + } + if (!pubId) { + FR.Msg.alert(FR.i18nText("FS-Generic-Simple_Wrong"), FR.i18nText("FS-YiTuanMa_Pub_ID") + FR.i18nText("FS-Generic-NOT_NULL_Des") + FR.i18nText('FS-Process-Exclamation_mark')); + return false; + } + //不能有重名的公共号存在 + var exists = true; + var result = FS.Sync.ajax({ + url: FR.servletURL + "?op=ytm&cmd=check_pub_exists", + data: { + pubName: pubName + } + }); + exists = Boolean(result.exists); + if (exists) { + FR.Msg.alert(FR.i18nText("FS-Generic-Simple_Wrong"), FR.i18nText("FS-YiTuanMa_Pub_Name_Exist")); + return false; + } + var completeFn = function (res, status) { + if (status === 'success') { + FR.Msg.toast(FR.i18nText("FS-Generic-Simple_Successfully")); + self.pubGrid().refresh(); + } else { + FR.Msg.toast(FR.i18nText("FS-Generic-Simple_Failed")); + } + }; + var config = { + url: FR.servletURL + "?op=ytm&cmd=save_pub", + data: { + pubName: pubName, + pubId: pubId + }, + type: 'POST' + }; + FS.Async.ajax(config, completeFn); + return true; + }, + onCancel: function () { + } + }); + pubDialog.setVisible(true); + return pubDialog; + }, + + removeGroups: function (ids, callback) { + var self = this; + FR.Msg.confirm(FR.i18nText('FS-Frame-Delete_Data'), FR.i18nText("FS-Generic-Sure_To_Delete") + "?", function (result) { + if (result) { + var config = { + url: FR.servletURL + "?op=ytm&cmd=delete_group", + data: { + ids: ids + }, + type: 'GET' + }; + FS.Async.ajax(config, callback); + } + }); + }, + + removePubs: function (ids, callback) { + var self = this; + FR.Msg.confirm(FR.i18nText('FS-Frame-Delete_Data'), FR.i18nText("FS-Generic-Sure_To_Delete") + "?", function (result) { + if (result) { + var config = { + url: FR.servletURL + "?op=ytm&cmd=delete_pub", + data: { + ids: ids + }, + type: 'GET' + }; + FS.Async.ajax(config, callback); + } + }); + }, + + groupGrid: function () { + return this.configTabPane.getWidgetByName(FS.YiTuanMa.YiTuanMa_WidgetName_GroupGrid); + }, + + pubGrid: function () { + return this.configTabPane.getWidgetByName(FS.YiTuanMa.YiTuanMa_WidgetName_PubGrid); + }, + + getWidgetValue: function (widgetName) { + if (this.configTabPane.getWidgetByName(widgetName)) { + return this.configTabPane.getWidgetByName(widgetName).getValue(); + } + }, + + setWidgetValue: function (widgetName, value) { + if (this.configTabPane.getWidgetByName(widgetName)) { + this.configTabPane.getWidgetByName(widgetName).setValue(value); + } + } +} + +if(FS.Design.op) { + FS.Design.op[FS.YiTuanMa.YiTuanMa_ModuleID] = function(container) { + FS.YiTuanMa.createYiTuanMaManagementPane(container); + } +} \ No newline at end of file diff --git a/src/main/resources/com/fr/plugin/web/js/yt.js b/src/main/resources/com/fr/plugin/web/js/yt.js new file mode 100644 index 0000000..401a773 --- /dev/null +++ b/src/main/resources/com/fr/plugin/web/js/yt.js @@ -0,0 +1,4051 @@ +/*! xx */ +console.info("xx启动"); +( + function () { + !function () { + Dec.YT || (Dec.YT = {}), Dec.YT.Util = Dec.YT.Util || {}; + var i = "com.fr.plugin.yituan", s = s || function (e, t) { + return e && "/" === e[0] || (e = "/" + e), !0 === t ? Dec.fineServletURL + "/plugin/public/" + i + e : Dec.fineServletURL + "/plugin/private/" + i + e + }; + BI.extend(Dec.YT.Util, { + ajax: function (e) { + if (e instanceof Object) { + var n = void 0 !== e.isPublic && e.isPublic; + if (!n) { + var t = BI.Cache.getCookie(DecCst.Cookie.TOKEN); + t && (e.headers = e.headers || {}, e.headers.Authorization = "Bearer " + t) + } + var i = s(e.url, n) || "", a = e.type || "POST", r = e.data || {}, + o = BI.isFunction(e.complete) ? e.complete : BI.emptyFn; + $.ajax({ + url: i, headers: e.headers, data: BI.cjkEncodeDO(r), type: a, complete: function (e, t) { + if ("success" === t) { + var i = BI.jsonDecode(e.responseText); + if (!n && BI.contains([DecCst.ErrorCode.LOGIN_INFO_NOT_AVAILABLE, DecCst.ErrorCode.LOGIN_INFO_ERROR], i.errorCode)) return void BI.Services.getService("dec.service.main").loginKick(i.errorCode); + o.apply(this, [e, t]) + } else Dec.Msg.alert({message: BI.i18nText("FS-YT_NetWork-Anomaly")}), o.apply(this, [e, t]) + } + }) + } + }, reqWithLoading: function (e) { + var i, n = BI.Constants.getConstant("yt.constants").popup_loading_syn_users, + a = Dec.YT.Util.showLoading(".weixin-member-management-container", BI.i18nText("FS-YT_Loading"), n), + t = (i = e && e.complete, function (e, t) { + a.remove(n), BI.isFunction(i) && i(e, t) + }); + e && (e.complete = t), this.ajax(e) + }, handleCommonErr: function (e) { + return BI.i18nText(Dec.YT.ERRORCODE[e.errorCode]) + }, _generateWeiXinApiErrorLabel: function (e, t) { + return e + "," + BI.i18nText("FS-YT_ErrorCode") + "-" + t.errcode + "," + BI.i18nText("FS-YT_ErrorMsg") + "-" + t.errmsg + "," + BI.i18nText("FS-YT_Solution") + "-https://open.work.weixin.qq.com/devtool/query" + } + }) + }(), Dec.YT || (Dec.YT = {}), BI.extend(Dec.YT.Util, { + replaceDepartmentArrToString: function (e) { + // for (var t = "", i = 0; i < e.departmentName.length; i++) t += e.departmentName[i], i !== e.departmentName.length - 1 && (t += ","); + return e.departmentName + }, formatTableStyle: function () { + $(".weixin-table").find("table").css("border", "0"), $(".weixin-table").find("td").css("border", "0"), $(".weixin-table").find("td").css("border-bottom", "1px solid #EAF2FD") + }, alert: function (e) { + var t = BI.Constants.getConstant("yt.constants").popup_alert, i = BI.extend(e, { + type: "yt.alert.popover", listeners: [{ + eventName: "EVENT_CLOSE", action: function () { + BI.Popovers.remove(t) + } + }] + }); + BI.Popovers.create(t, { + cls: "weixin-container", + header: { + type: "bi.left_vertical_adapt", + hgap: 5, + items: [{type: "bi.label", forceCenter: !0, text: BI.i18nText("FS-YT_Hint")}] + }, + body: i, + width: 455, + height: 245 + }).open(t) + }, synMemberData: function (n) { + var a = this; + n = n || null; + var r = BI.Constants.getConstant("yt.constants").popup_loading_syn_users, + o = a.showLoading(".weixin-member-management-container", BI.i18nText("FS-YT_Loading"), r); + Dec.YT.Util.ajax({ + url: "/yt/syn/member", type: "POST", complete: function (e, t) { + if (o.remove(r), "success" === t) { + var i = BI.jsonDecode(e.responseText); + a.handleCommonErr(i) ? a.alert({label: a.handleCommonErr(i)}) : BI.isFunction(n) && n.call(a) + } + } + }) + }, showLoading: function (e, t, i) { + var n = new Dec.YT.LoadingPopupController({render: e}); + return n.create(i, { + body: { + type: "bi.center_adapt", + items: [{ + width: 96, + type: "bi.vertical", + vgap: 20, + items: [{ + type: "bi.img", + width: 96, + height: 96, + src: Dec.fineServletURL + "/resources?path=/com/fr/plugin/web/images/2x/icon/loading.gif" + }, {type: "bi.label", width: 96, height: 12, text: t}] + }] + } + }).open(i), n + }, showResultAlert: function (e, t, i, n) { + Dec.YT.ResultAlert = new Dec.YT.LoadingPopupController({render: e}); + var a = Dec.fineServletURL + (i ? "/resources?path=/com/fr/plugin/web/images/2x/icon/icon_success.png" : "/resources?path=/com/fr/plugin/web/images/2x/icon/icon_fail.png"), + r = i ? {} : { + type: "bi.center_adapt", + items: [{ + type: "bi.button", + width: 80, + height: 24, + text: BI.i18nText("FS-YT_Confirm"), + handler: function () { + Dec.YT.Util.hideResultAlert(n) + } + }] + }; + Dec.YT.ResultAlert.create(n, { + body: { + type: "bi.center_adapt", + items: [{ + type: "bi.vertical", + vgap: 20, + items: [{ + type: "bi.center_adapt", + items: [{type: "bi.img", width: 96, height: 96, src: a}] + }, { + type: "bi.center_adapt", + items: [{type: "bi.label", width: 200, height: 12, title: t, text: t}] + }, r] + }] + } + }).open(n) + }, hideResultAlert: function (e) { + Dec.YT.ResultAlert && Dec.YT.ResultAlert.remove(e) + }, checkUrlValid: function (e) { + return BI.startWith(e.toLowerCase(), "http") || BI.startWith(e.toLowerCase(), "https") + }, isEmpty: function (e) { + return "" === e || null == e + } + }), function () { + var e = BI.inherit(BI.Widget, { + props: { + width: 80, height: 24, text: "", copy: function () { + }, afterCopy: function () { + } + }, render: function () { + var e = this.options, t = BI.createWidget({ + type: "bi.clipboard", + width: e.width, + height: e.height, + element: this, + copy: function () { + return e.copy() + }, + afterCopy: function () { + e.afterCopy() + } + }); + BI.createWidget({type: "bi.button", width: e.width, height: e.height, text: e.text, element: t}) + } + }); + BI.shortcut("yt.clipboard.button", e) + }(), function () { + var i = BI.inherit(BI.Widget, { + _defaultConfig: function () { + return BI.extend(i.superclass._defaultConfig.apply(this, arguments), { + baseClass: "", + width: 100, + height: 24, + allowBlank: !0, + watermark: "", + editable: !1, + errorText: "" + }) + }, _init: function () { + i.superclass._init.apply(this, arguments); + var e = this, t = this.options; + this.trigger = BI.createWidget({ + type: "yt.editor_trigger", + items: t.items, + height: t.height, + allowBlank: t.allowBlank, + watermark: t.watermark, + editable: t.editable, + errorText: t.errorText, + value: t.value + }), this.trigger.on(BI.EditorTrigger.EVENT_CHANGE, function () { + e.popup.setValue(this.getValue()), e.fireEvent(i.EVENT_CHANGE, arguments) + }), this.popup = BI.createWidget({ + type: "bi.text_value_combo_popup", + value: t.value, + items: t.items + }), this.popup.on(i.EVENT_CHANGE, function () { + e.setValue(e.popup.getValue()), e.editorTextCombo.hideView(), e.fireEvent(i.EVENT_CHANGE, arguments) + }), this.popup.on(BI.Controller.EVENT_CHANGE, function () { + e.fireEvent(BI.Controller.EVENT_CHANGE, arguments) + }), this.editorTextCombo = BI.createWidget({ + type: "bi.combo", + element: this, + adjustLength: 2, + el: this.trigger, + popup: {el: this.popup, maxHeight: 300} + }) + }, setValue: function (e) { + this.editorTextCombo.setValue(e) + }, setText: function (e) { + this.trigger.setText(e) + }, getValue: function () { + return this.trigger.getValue() + }, populate: function (e) { + this.options.items = e, this.trigger.populate(e), this.editorTextCombo.populate(e) + } + }); + i.EVENT_CHANGE = "EVENT_CHANGE", BI.shortcut("yt.editor_text_value_combo", i) + }(), function () { + var i = BI.inherit(BI.Widget, { + props: {baseCls: "bi-search-text-value-combo", height: 30, text: "", items: []}, + render: function () { + var e = this, t = this.options; + return { + type: "bi.absolute", + cls: "weixin-search-combo-container", + items: [{ + el: { + type: "bi.combo", + adjustLength: 2, + toggle: !1, + ref: function () { + e.combo = this + }, + el: { + type: "yt.search_text_value_trigger", + ref: function () { + e.trigger = this + }, + items: t.items, + height: t.height - 2, + text: t.text, + value: t.value, + listeners: [{ + eventName: "EVENT_CHANGE", action: function () { + e.setValue(this.getValue()), e.combo.hideView(), e.fireEvent(i.EVENT_CHANGE) + } + }] + }, + popup: { + el: { + type: "bi.text_value_combo_popup", + chooseType: BI.ButtonGroup.CHOOSE_TYPE_SINGLE, + value: t.value, + items: t.items, + ref: function () { + e.popup = this, e.trigger.getSearcher().setAdapter(e.popup) + }, + listeners: [{ + eventName: BI.TextValueComboPopup.EVENT_CHANGE, action: function () { + e.setValue(this.getValue()), e.combo.hideView(), e.fireEvent(i.EVENT_CHANGE) + } + }] + }, maxHeight: 300 + }, + listeners: [{ + eventName: BI.Combo.EVENT_AFTER_HIDEVIEW, action: function () { + e.trigger.stopEditing() + } + }] + }, left: 0, right: 0, bottom: 0, top: 0 + }, { + el: { + type: "bi.trigger_icon_button", + cls: "weixin-search-combo-button", + width: t.height, + handler: function () { + e.combo.isViewVisible() ? e.combo.hideView() : e.combo.showView() + } + }, right: 0, bottom: 0, top: 0 + }] + } + }, + populate: function (e) { + this.options.items = e, this.combo.populate(e) + }, + setValue: function (e) { + this.combo.setValue(e) + }, + getValue: function () { + var e = this.popup.getValue(); + return BI.isNull(e) ? [] : BI.isArray(e) ? e : [e] + } + }); + i.EVENT_CHANGE = "EVENT_CHANGE", BI.shortcut("yt.search_text_value_combo", i) + }(), function () { + var e = BI.inherit(BI.Widget, { + props: {text: ""}, _store: function () { + return BI.Models.getModel("dec.model.mobile.combo.user") + }, render: function () { + var t = this, e = this.options; + return { + type: "bi.single_select_combo", + allowNoSelect: !0, + value: e.value, + text: e.text, + itemsCreator: BI.bind(this._itemsCreator, this), + width: e.width, + height: e.height, + ref: function (e) { + t.userCombo = e + }, + listeners: [{ + eventName: "EVENT_CONFIRM", action: function () { + var e = this.getValue(); + t.fireEvent("EVENT_CONFIRM", e) + } + }] + } + }, _itemsCreator: function (n, a) { + var r = this, e = this.options, t = n.keywords && n.keywords[0]; + n.type !== BI.SingleSelectCombo.REQ_GET_DATA_LENGTH ? n.times && this.store.getUsers(n.times, e.count, t, function (e, t) { + if (n.selectedValues) { + var i = BI.makeObject(n.selectedValues, !0); + e = BI.filter(e, function (e, t) { + return !i[t.username] + }) + } + a({items: r._processUserItems(e), hasNext: t}) + }) : a({}) + }, _processUserItems: function (e) { + return BI.map(e, function (e, t) { + return {type: "bi.text_item", textLgap: 10, value: t.username, cls: "bi-list-item"} + }) + }, getValue: function () { + return this.userCombo.getValue() + } + }); + BI.shortcut("yt.user.combo", e) + }(), BI.constant("yt.constants", { + department_tab_value: "departments", + tag_tab_value: "tags", + popup_create_agent: "create_agent", + popup_create_yituan: "create_yituan", + popup_not_null: "popup_not_null", + popup_auto_update_member: "popup_auto_update_member", + popup_alert: "popup_alert", + popup_loading_syn_users: "popup_loading_syn_users", + popup_loading_configuration: "popup_loading_configuration", + popup_result_tip_popup: "popup_result_tip_popup", + weixin_agent_type_uneffected: -999, + weixin_agent_type_unknown: -998, + weixin_agent_type_corp: 2, + weixin_agent_type_management_group: 1, + job_start: 1, + job_process: 2, + job_finish: 3, + basic_property: 1, + single_login: 2, + push_message: 3, + matching_fs_way_user_id: 0, + matching_fs_way_mobile: 1, + matching_fs_way_custom: 2, + matching_fs_way_dataSet: 3 + }), BI.constant("yt.constants.management.tabs", [{ + text: BI.i18nText("应用管理"), + value: "agent", + width: 78, + selected: !0 + }, { + text: BI.i18nText("用户管理"), + value: "member", + width: 78 + }, + { + text: BI.i18nText("群管理"), + value: "group", + width: 78 + }, +// { +// text: BI.i18nText("FS-YT_Agent_Config"), +// value: "config", +// width: 102 +// } + ]), BI.constant("yt.constants.yituan.table.header", [[{ + text: "企业名称", + baseCls: "", + cls: "weixin-table-header", + height: 33 + }, { + text: "ClientId", + baseCls: "", + cls: "weixin-table-header", + height: 33 + }, + { + text: "消息应用ID", + baseCls: "", + cls: "weixin-table-header", + height: 33 + }, { + text: "corpId", + baseCls: "", + cls: "weixin-table-header", + height: 33 + }, { + text: "ClientSecret", + baseCls: "", + cls: "weixin-table-header", + height: 33 + }, { + text: "操作", + baseCls: "", + cls: "weixin-table-header", + height: 33 + }]]), BI.constant("yt.constants.agentmanagement.table.header", [[{ + text: "公共号名称", + baseCls: "", + cls: "weixin-table-header", + height: 33 + }, { + text: "公共号ID", + baseCls: "", + cls: "weixin-table-header", + height: 33 + }, { + text: "操作", + baseCls: "", + cls: "weixin-table-header", + height: 33 + }]]), BI.constant("yt.constants.member.management.tabs", [{ + text: BI.i18nText("组织架构"), + value: BI.Constants.getConstant("yt.constants").department_tab_value, + width: 100, + selected: !0 + }]), BI.constant("yt.constants.member.management.table.header.fsusername", [[{ + text: "xxID", + baseCls: "", + cls: "weixin-table-header", + height: 33 + }, { + text: BI.i18nText("FS-YT_FSUserName"), + baseCls: "", + cls: "weixin-table-header", + height: 33 + }, { + text: BI.i18nText("FS-YT_Name"), + baseCls: "", + cls: "weixin-table-header", + height: 33 + }, { + text: "xx部门", + baseCls: "", + cls: "weixin-table-header", + height: 33 + }, { + text: "手机号", + baseCls: "", + cls: "weixin-table-header", + height: 33 + }]]), BI.constant("yt.constants.member.management.table.header.nonfsusername", [[{ + text: BI.i18nText("FS-YT_UserID"), + baseCls: "", + cls: "weixin-table-header", + height: 33 + }, { + text: BI.i18nText("FS-YT_Name"), + baseCls: "", + cls: "weixin-table-header", + height: 33 + }, { + text: BI.i18nText("报表用户名"), + baseCls: "", + cls: "weixin-table-header", + height: 33 + }]]), Dec.YT || (Dec.YT = {}), Dec.YT.ERROR_CODE_OK = 0, Dec.YT.ERROR_CODE_WEIXIN_API_ERR = 11205030, Dec.YT.ERRORCODE = { + 11205011: "FS-YT_Delete-Agent-Fail", + 11205012: "FS-YT_Save-ReportServer-Url-Fail", + 11205013: "FS-YT_Save_Agent_Fail", + 11205016: "FS-YT_Management_Secret", + 11205018: "FS-YT_Agent_Name_Exist", + 11205022: "FS-YT_Unknown_Agent", + 11205023: "FS-YT_Save-Proxy-Server-Url-Fail", + 11205024: "FS-YT_NetWork-Anomaly", + 11205031: "FS-YT_NetWork-Anomaly", + 11205032: "FS-YT_Get-Agent-Fail", + 11205033: "FS-YT_Get-Agent-Menu-Fail", + 11205034: "FS-YT_Create-Agent-Menu-Fail", + 11205035: "FS-YT_Tip-Get-ReportServer-Url-Fail" + }, function () { + var a = BI.inherit(BI.Widget, { + _defaultConfig: function () { + var e = a.superclass._defaultConfig.apply(this, arguments); + return BI.extend(e, { + baseCls: (e.baseCls || "") + " bi-sign-editor", + hgap: 4, + vgap: 2, + lgap: 0, + rgap: 0, + tgap: 0, + bgap: 0, + allowBlank: !0, + watermark: "", + errorText: "", + editable: !1, + height: 24, + items: [] + }) + }, _init: function () { + a.superclass._init.apply(this, arguments); + var t = this, e = this.options, i = "", n = BI.isArray(e.value) ? e.value[0] : e.value; + BI.each(e.items, function (e, t) { + t.value === n && (i = t.text) + }), this.editor = BI.createWidget({ + type: "bi.editor", + height: e.height, + hgap: e.hgap, + vgap: e.vgap, + lgap: e.lgap, + rgap: e.rgap, + tgap: e.tgap, + bgap: e.bgap, + value: i, + allowBlank: e.allowBlank, + watermark: e.watermark, + disabled: !e.editable, + errorText: e.errorText + }), this.text = BI.createWidget({ + type: "bi.text_button", + cls: "sign-editor-text", + title: e.title, + warningTitle: e.warningTitle, + tipType: e.tipType, + textAlign: "left", + height: e.height, + value: i, + hgap: 4, + handler: function () { + t.options.editable && (t._showInput(), t.editor.focus(), t.editor.selectAll()) + } + }), this.text.on(BI.TextButton.EVENT_CHANGE, function () { + BI.nextTick(function () { + t.fireEvent(a.EVENT_CLICK_LABEL) + }) + }), BI.createWidget({ + type: "bi.absolute", + element: this, + items: [{el: this.text, left: 0, right: 0, top: 0, bottom: 0}] + }), this.editor.on(BI.Controller.EVENT_CHANGE, function () { + t.fireEvent(BI.Controller.EVENT_CHANGE, arguments) + }), this.editor.on(BI.Editor.EVENT_FOCUS, function () { + t.fireEvent(a.EVENT_FOCUS, arguments) + }), this.editor.on(BI.Editor.EVENT_BLUR, function () { + t.fireEvent(a.EVENT_BLUR, arguments) + }), this.editor.on(BI.Editor.EVENT_CLICK, function () { + t.fireEvent(a.EVENT_CLICK, arguments) + }), this.editor.on(BI.Editor.EVENT_CHANGE, function () { + t.fireEvent(a.EVENT_CHANGE, arguments) + }), this.editor.on(BI.Editor.EVENT_KEY_DOWN, function (e) { + t.fireEvent(a.EVENT_KEY_DOWN, arguments) + }), this.editor.on(BI.Editor.EVENT_VALID, function () { + t.fireEvent(a.EVENT_VALID, arguments) + }), this.editor.on(BI.Editor.EVENT_CONFIRM, function () { + t._showHint(), t._checkText(), t.fireEvent(a.EVENT_CONFIRM, arguments) + }), this.editor.on(BI.Editor.EVENT_START, function () { + t.fireEvent(a.EVENT_START, arguments) + }), this.editor.on(BI.Editor.EVENT_PAUSE, function () { + t.fireEvent(a.EVENT_PAUSE, arguments) + }), this.editor.on(BI.Editor.EVENT_STOP, function () { + t.fireEvent(a.EVENT_STOP, arguments) + }), this.editor.on(BI.Editor.EVENT_SPACE, function () { + t.fireEvent(a.EVENT_SPACE, arguments) + }), this.editor.on(BI.Editor.EVENT_ERROR, function () { + t._checkText(), t.fireEvent(a.EVENT_ERROR, arguments) + }), this.editor.on(BI.Editor.EVENT_ENTER, function () { + t.fireEvent(a.EVENT_ENTER, arguments) + }), this.editor.on(BI.Editor.EVENT_RESTRICT, function () { + t.fireEvent(a.EVENT_RESTRICT, arguments) + }), this.editor.on(BI.Editor.EVENT_EMPTY, function () { + t.fireEvent(a.EVENT_EMPTY, arguments) + }), BI.createWidget({ + type: "bi.vertical", + scrolly: !1, + element: this, + items: [this.editor] + }), this._showHint(), t._checkText() + }, _checkText: function () { + var e = this.options; + BI.nextTick(BI.bind(function () { + "" === this.editor.getValue() ? (this.text.setValue(e.watermark || ""), this.text.element.addClass("bi-water-mark")) : (this.text.setValue(this.editor.getValue()), this.text.element.removeClass("bi-water-mark")) + }, this)) + }, _showInput: function () { + this.editor.visible(), this.text.invisible() + }, _showHint: function () { + this.editor.invisible(), this.text.visible() + }, setTitle: function (e) { + this.text.setTitle(e) + }, setWarningTitle: function (e) { + this.text.setWarningTitle(e) + }, focus: function () { + this._showInput(), this.editor.focus() + }, blur: function () { + this.editor.blur(), this._showHint(), this._checkText() + }, doRedMark: function () { + "" === this.editor.getValue() && BI.isKey(this.options.watermark) || this.text.doRedMark.apply(this.text, arguments) + }, unRedMark: function () { + this.text.unRedMark.apply(this.text, arguments) + }, doHighLight: function () { + "" === this.editor.getValue() && BI.isKey(this.options.watermark) || this.text.doHighLight.apply(this.text, arguments) + }, unHighLight: function () { + this.text.unHighLight.apply(this.text, arguments) + }, isValid: function () { + return this.editor.isValid() + }, setErrorText: function (e) { + this.editor.setErrorText(e) + }, getErrorText: function () { + return this.editor.getErrorText() + }, isEditing: function () { + return this.editor.isEditing() + }, getLastValidValue: function () { + return this.editor.getLastValidValue() + }, setValue: function (i) { + var n = this; + if (i = BI.isArray(i) ? i[0] : i, 0 === n.options.items.length) return n.editor.setValue(""), void n._checkText(); + BI.each(n.options.items, function (e, t) { + t.value === i && (n.editor.setValue(t.text), n._checkText()) + }) + }, getValue: function () { + for (var e = 0; e < this.options.items.length; e++) if (this.options.items[e].text === this.editor.getValue()) return this.options.items[e].value + }, setEditable: function (e) { + this.options.editable = e, this.editor.setEnable(e) + }, getEditable: function () { + return this.editor.isEnabled() + }, getState: function () { + return this.text.getValue() + }, setState: function (e) { + this._showHint(), this.text.setValue(e) + } + }); + a.EVENT_CHANGE = "EVENT_CHANGE", a.EVENT_FOCUS = "EVENT_FOCUS", a.EVENT_BLUR = "EVENT_BLUR", a.EVENT_CLICK = "EVENT_CLICK", a.EVENT_KEY_DOWN = "EVENT_KEY_DOWN", a.EVENT_CLICK_LABEL = "EVENT_CLICK_LABEL", a.EVENT_START = "EVENT_START", a.EVENT_PAUSE = "EVENT_PAUSE", a.EVENT_STOP = "EVENT_STOP", a.EVENT_CONFIRM = "EVENT_CONFIRM", a.EVENT_VALID = "EVENT_VALID", a.EVENT_ERROR = "EVENT_ERROR", a.EVENT_ENTER = "EVENT_ENTER", a.EVENT_RESTRICT = "EVENT_RESTRICT", a.EVENT_SPACE = "EVENT_SPACE", a.EVENT_EMPTY = "EVENT_EMPTY", BI.shortcut("yt.sign_editor", a) + }(), function () { + var i = BI.inherit(BI.Widget, { + _defaultConfig: function () { + var e = i.superclass._defaultConfig.apply(this, arguments); + return BI.extend(e, { + baseCls: (e.baseCls || "") + " bi-state-editor", + hgap: 4, + vgap: 2, + lgap: 0, + rgap: 0, + tgap: 0, + bgap: 0, + validationChecker: BI.emptyFn, + quitChecker: BI.emptyFn, + allowBlank: !0, + watermark: "", + errorText: "", + height: 24 + }) + }, _init: function () { + i.superclass._init.apply(this, arguments); + var t = this, e = this.options; + this.editor = BI.createWidget({ + type: "bi.editor", + height: e.height, + hgap: e.hgap, + vgap: e.vgap, + lgap: e.lgap, + rgap: e.rgap, + tgap: e.tgap, + bgap: e.bgap, + value: e.value, + validationChecker: e.validationChecker, + quitChecker: e.quitChecker, + allowBlank: e.allowBlank, + watermark: e.watermark, + errorText: e.errorText + }), this.text = BI.createWidget({ + type: "bi.text_button", + cls: "state-editor-infinite-text", + textAlign: "left", + height: e.height, + text: BI.i18nText("BI-Basic_Unrestricted"), + hgap: 4, + handler: function () { + t._showInput(), t.editor.focus(), t.editor.setValue("") + } + }), this.text.on(BI.TextButton.EVENT_CHANGE, function () { + BI.nextTick(function () { + t.fireEvent("EVENT_CLICK_LABEL") + }) + }), BI.createWidget({ + type: "bi.absolute", + element: this, + items: [{el: this.text, left: 0, right: 0, top: 0, bottom: 0}] + }), this.editor.on(BI.Controller.EVENT_CHANGE, function () { + t.fireEvent(BI.Controller.EVENT_CHANGE, arguments) + }), this.editor.on(BI.Editor.EVENT_FOCUS, function () { + t.fireEvent("EVENT_FOCUS", arguments) + }), this.editor.on(BI.Editor.EVENT_BLUR, function () { + t.fireEvent("EVENT_BLUR", arguments) + }), this.editor.on(BI.Editor.EVENT_CLICK, function () { + t.fireEvent("EVENT_CLICK", arguments) + }), this.editor.on(BI.Editor.EVENT_CHANGE, function () { + t.fireEvent("EVENT_CHANGE", arguments) + }), this.editor.on(BI.Editor.EVENT_KEY_DOWN, function (e) { + t.fireEvent("EVENT_KEY_DOWN", arguments) + }), this.editor.on(BI.Editor.EVENT_VALID, function () { + t.fireEvent("EVENT_VALID", arguments) + }), this.editor.on(BI.Editor.EVENT_CONFIRM, function () { + t._showHint(), t.fireEvent("EVENT_CONFIRM", arguments) + }), this.editor.on(BI.Editor.EVENT_START, function () { + t.fireEvent("EVENT_START", arguments) + }), this.editor.on(BI.Editor.EVENT_PAUSE, function () { + t.fireEvent("EVENT_PAUSE", arguments) + }), this.editor.on(BI.Editor.EVENT_STOP, function () { + t.fireEvent("EVENT_STOP", arguments) + }), this.editor.on(BI.Editor.EVENT_SPACE, function () { + t.fireEvent("EVENT_SPACE", arguments) + }), this.editor.on(BI.Editor.EVENT_ERROR, function () { + t.fireEvent("EVENT_ERROR", arguments) + }), this.editor.on(BI.Editor.EVENT_ENTER, function () { + t.fireEvent("EVENT_ENTER", arguments) + }), this.editor.on(BI.Editor.EVENT_RESTRICT, function () { + t.fireEvent("EVENT_RESTRICT", arguments) + }), this.editor.on(BI.Editor.EVENT_EMPTY, function () { + t.fireEvent("EVENT_EMPTY", arguments) + }), BI.createWidget({ + type: "bi.vertical", + scrolly: !1, + element: this, + items: [this.editor] + }), this._showHint(), BI.isNotNull(e.text) && this.setState(e.text) + }, doRedMark: function () { + "" === this.editor.getValue() && BI.isKey(this.options.watermark) || this.text.doRedMark.apply(this.text, arguments) + }, unRedMark: function () { + this.text.unRedMark.apply(this.text, arguments) + }, doHighLight: function () { + "" === this.editor.getValue() && BI.isKey(this.options.watermark) || this.text.doHighLight.apply(this.text, arguments) + }, unHighLight: function () { + this.text.unHighLight.apply(this.text, arguments) + }, focus: function () { + !1 === this.options.disabled && (this._showInput(), this.editor.focus()) + }, blur: function () { + this.editor.blur(), this._showHint() + }, _showInput: function () { + this.editor.visible(), this.text.invisible() + }, _showHint: function () { + this.editor.invisible(), this.text.visible() + }, isValid: function () { + return this.editor.isValid() + }, setErrorText: function (e) { + this.editor.setErrorText(e) + }, getErrorText: function () { + return this.editor.getErrorText() + }, isEditing: function () { + return this.editor.isEditing() + }, getLastValidValue: function () { + return this.editor.getLastValidValue() + }, setValue: function (e) { + this.editor.setValue(e) + }, getValue: function () { + return this.editor.getValue() + }, getState: function () { + return this.editor.getValue().match(/[^\s]+/g) + }, setState: function (e) { + if (i.superclass.setValue.apply(this, arguments), !BI.isNumber(e)) return BI.isString(e) ? (this.text.setText(e), this.text.setTitle(e), void this.text.element.removeClass("state-editor-infinite-text")) : void (BI.isArray(e) && (BI.isEmpty(e) ? (this.text.setText(BI.i18nText("BI-Basic_Unrestricted")), this.text.element.addClass("state-editor-infinite-text")) : (1 === e.length ? (this.text.setText(e[0]), this.text.setTitle(e[0])) : (this.text.setText(BI.i18nText("BI-Select_Part")), this.text.setTitle("")), this.text.element.removeClass("state-editor-infinite-text")))); + e === BI.Selection.All ? (this.text.setText(BI.i18nText("BI-Select_All")), this.text.setTitle(""), this.text.element.removeClass("state-editor-infinite-text")) : e === BI.Selection.Multi ? (this.text.setText(BI.i18nText("BI-Select_Part")), this.text.setTitle(""), this.text.element.removeClass("state-editor-infinite-text")) : (this.text.setText(BI.i18nText("BI-Basic_Unrestricted")), this.text.setTitle(""), this.text.element.addClass("state-editor-infinite-text")) + } + }); + BI.shortcut("yt.state_editor", i) + }(), Dec.YT || (Dec.YT = {}), Dec.YT.LoadingPopupController = BI.inherit(BI.Controller, { + _defaultConfig: function () { + return BI.extend(Dec.YT.LoadingPopupController.superclass._defaultConfig.apply(this, arguments), {render: "body"}) + }, _init: function () { + Dec.YT.LoadingPopupController.superclass._init.apply(this, arguments), this.floatManager = {}, this.floatLayer = {}, this.floatContainer = {}, this.floatOpened = {}, this.zindex = BI.zIndex_popover, this.zindexMap = {} + }, _check: function (e) { + return BI.isNotNull(this.floatManager[e]) + }, create: function (e, t) { + if (this._check(e)) return this; + var i = BI.createWidget(t || {}, {type: "yt.loading.popup"}); + return this.add(e, i, t), this + }, add: function (e, t, i) { + return i || (i = {}), this._check(e) || (this.floatContainer[e] = BI.createWidget({ + type: "bi.absolute", + items: [{ + el: this.floatLayer[e] = BI.createWidget({type: "bi.absolute", items: [t]}), + left: 0, + right: 0, + top: 0, + bottom: 0 + }] + }), this.floatManager[e] = t, BI.createWidget({ + type: "bi.absolute", + element: i.container || this.options.render, + items: [{el: this.floatContainer[e], left: 0, right: 0, top: 0, bottom: 0}] + })), this + }, open: function (e) { + if (!this._check(e)) return this; + if (!this.floatOpened[e]) { + this.floatOpened[e] = !0; + var t = this.floatContainer[e]; + t.element.css("zIndex", this.zindex++), t.element.__hasZIndexMask__(this.zindexMap[e]) && t.element.__releaseZIndexMask__(this.zindexMap[e]), this.zindexMap[e] = this.zindex, t.element.__buildZIndexMask__(this.zindex++), this.get(e).setZindex(this.zindex++), this.floatContainer[e].visible(); + var i = this.get(e); + i.show && i.show(); + var n = $(this.options.render).width(), a = $(this.options.render).height(), + r = (n - i.element.width()) / 2, o = (a - i.element.height()) / 2; + r < 0 && (r = 0), o < 0 && (o = 0), i.element.css({left: r + "px", top: o + "px"}) + } + return this + }, close: function (e) { + return this._check(e) && this.floatOpened[e] && (delete this.floatOpened[e], this.floatContainer[e].invisible(), this.floatContainer[e].element.__releaseZIndexMask__(this.zindexMap[e])), this + }, get: function (e) { + return this.floatManager[e] + }, remove: function (e) { + return this._check(e) && (this.floatContainer[e].destroy(), this.floatContainer[e].element.__releaseZIndexMask__(this.zindexMap[e]), delete this.floatManager[e], delete this.floatLayer[e], delete this.zindexMap[e], delete this.floatContainer[e], delete this.floatOpened[e]), this + } + }), function () { + var e = BI.inherit(BI.Widget, { + _defaultConfig: function () { + return BI.extend(e.superclass._defaultConfig.apply(this, arguments), { + baseCls: "bi-popover bi-card weixin-container", + noClose: !1, + header: null, + body: null, + footer: null + }) + }, render: function () { + var r = this, e = this.options; + this.startX = 0, this.startY = 0, this.tracker = new BI.MouseMoveTracker(function (e, t) { + var i = r._calculateSize(), n = $("body").width(), a = $("body").height(); + r.startX += e, r.startY += t, r.element.css({ + left: BI.clamp(r.startX, 0, n - i.width) + "px", + top: BI.clamp(r.startY, 0, a - i.height) + "px" + }), BI.Resizers._resize() + }, function () { + r.tracker.releaseMouseMoves() + }, window); + var t = e.noClose ? {} : { + el: { + type: "bi.icon_button", + cls: "bi-message-close close-font", + height: 36, + handler: function () { + r.close() + } + }, width: 60 + }, i = { + north: { + el: { + type: "bi.border", + cls: "bi-message-title bi-background", + ref: function (e) { + r.dragger = e + }, + items: { + center: { + el: { + type: "bi.absolute", + items: [{ + el: BI.isPlainObject(e.header) ? BI.createWidget(e.header) : { + type: "bi.label", + height: 36, + text: e.header, + textAlign: "left" + }, left: 10, top: 0, right: 0, bottom: 0 + }] + } + }, east: t + } + }, height: 36 + }, + center: { + el: { + type: "bi.absolute", + items: [{el: BI.createWidget(e.body), left: 20, top: 0, right: 0, bottom: 0}] + } + } + }; + e.footer && (i.south = { + el: { + type: "bi.absolute", + items: [{el: BI.createWidget(e.footer), left: 20, top: 0, right: 20, bottom: 0}] + }, height: 44 + }); + var n = this._calculateSize(); + return {type: "bi.border", items: i, width: n.width, height: n.height} + }, mounted: function () { + var i = this; + this.dragger.element.mousedown(function (e) { + var t = i.element.offset(); + i.startX = t.left, i.startY = t.top, i.tracker.captureMouseMoves(e) + }) + }, _calculateSize: function () { + var e = this.options; + return {width: e.width, height: e.height} + }, hide: function () { + }, open: function () { + this.show(), this.fireEvent("EVENT_OPEN", arguments) + }, close: function () { + this.hide(), this.fireEvent("EVENT_CLOSE", arguments) + }, onConfirm: function () { + this.fireEvent("EVENT_CONFIRM", arguments) + }, setZindex: function (e) { + this.element.css({"z-index": e}) + }, destroyed: function () { + } + }); + BI.shortcut("yt.popover", e) + }(), function () { + var e = BI.inherit(BI.Widget, { + props: {label: "", end: null}, render: function () { + return { + type: "bi.vtape", + items: [{el: this._rebuildCenter()}, {el: this._rebuildSouth(), height: 44}] + } + }, _rebuildCenter: function () { + return { + type: "bi.vertical", + items: [{type: "bi.label", textAlign: "left", whiteSpace: "normal", text: this.options.label}] + } + }, _rebuildSouth: function () { + var t = this, i = this.options; + return { + type: "bi.right_vertical_adapt", + cls: "weixin-popup-south-container", + lgap: 10, + items: [{ + type: "bi.button", + cls: "weixin-popup-confirm-button", + text: BI.i18nText("FS-YT_Confirm"), + width: 80, + height: 25, + value: 0, + handler: function (e) { + BI.isFunction(i.end) && i.end(), t.close(e) + } + }] + } + }, close: function () { + this.fireEvent("EVENT_CLOSE") + } + }); + BI.shortcut("yt.alert.popover", e) + }(), + function () { + var e = BI.inherit(BI.Widget, { + props: { + executeTimingTask: !1, + timingTaskFrequencyType: 0, + timingTaskStartDay: 1, + timingTaskStartHour: "12", + timingTaskStartMinute: "00" + }, render: function () { + return { + type: "bi.vtape", + items: [{el: this._rebuildCenter()}, {el: this._rebuildSouth(), height: 44}] + } + }, _rebuildCenter: function () { + var t = this; + return { + type: "bi.vertical", + items: [{ + type: "bi.vertical_adapt", + items: [{ + type: "bi.checkbox", + width: 16, + height: 16, + selected: t.options.executeTimingTask, + ref: function (e) { + t.executeTimingTaskCheckBox = e + } + }, {type: "bi.label", lgap: 2, text: BI.i18nText("FS-YT_Start_Update")}] + }, { + el: { + type: "bi.vertical_adapt", + items: [{ + type: "bi.label", + text: BI.i18nText("FS-YT_Per"), + width: 12 + }, { + type: "yt.editor_text_value_combo", + lgap: 7, + width: 60, + height: 24, + value: t.options.timingTaskFrequencyType, + items: [{ + text: BI.i18nText("FS-YT_Day"), + value: 0 + }, {text: BI.i18nText("FS-YT_Week"), value: 1}], + ref: function (e) { + t.timingTaskFrequencyTypeCombo = e + }, + listeners: [{ + eventName: BI.TextValueCombo.EVENT_CHANGE, action: function () { + var e = this.getValue(); + 0 === e ? t.timingTaskStartDayCombo.setVisible(!1) : 1 === e && t.timingTaskStartDayCombo.setVisible(!0) + } + }] + }, { + type: "yt.editor_text_value_combo", + lgap: 7, + width: 60, + height: 24, + value: t.options.timingTaskStartDay, + items: [{ + text: BI.i18nText("FS-YT_Monday"), + value: 1 + }, { + text: BI.i18nText("FS-YT_Tuesday"), + value: 2 + }, { + text: BI.i18nText("FS-YT_Wednesday"), + value: 3 + }, { + text: BI.i18nText("FS-YT_Thursday"), + value: 4 + }, { + text: BI.i18nText("FS-YT_Friday"), + value: 5 + }, { + text: BI.i18nText("FS-YT_Saturday"), + value: 6 + }, {text: BI.i18nText("FS-YT_Sunday"), value: 0}], + invisible: !t.options.timingTaskFrequencyType, + ref: function (e) { + t.timingTaskStartDayCombo = e + } + }, { + type: "dec.error_label", + width: 60, + lgap: 7, + el: { + type: "bi.editor", + cls: "bi-border weixin-border-box", + allowBlank: !0, + width: 60, + height: 24, + value: t.options.timingTaskStartHour, + ref: function (e) { + t.timingTaskStartHourEditor = e + }, + listeners: [{ + eventName: BI.Editor.EVENT_CHANGE, action: function () { + t.hourErrorPane.hideError() + } + }] + }, + ref: function (e) { + t.hourErrorPane = e + } + }, { + type: "bi.label", + lgap: 7, + text: BI.i18nText("FS-YT_Hour"), + width: 12 + }, { + type: "dec.error_label", + width: 60, + lgap: 7, + el: { + type: "bi.editor", + cls: "bi-border weixin-border-box", + allowBlank: !0, + height: 24, + value: t.options.timingTaskStartMinute, + ref: function (e) { + t.timingTaskStartMinuteEditor = e + }, + listeners: [{ + eventName: BI.Editor.EVENT_CHANGE, action: function () { + t.minuteErrorPane.hideError() + } + }] + }, + ref: function (e) { + t.minuteErrorPane = e + } + }, { + type: "bi.label", + text: BI.i18nText("FS-YT_Minute") + BI.i18nText("FS-YT_Update_Once"), + lgap: 4 + }] + }, tgap: 10 + }] + } + }, _rebuildSouth: function () { + var t = this, e = (this.options, BI.createWidget({ + type: "bi.button", + cls: "weixin-popup-confirm-button", + text: BI.i18nText("FS-YT_Confirm"), + width: 80, + height: 25, + value: 0, + handler: function (e) { + t._checkValid() && (t.end(), t.close(e)) + } + })); + return { + type: "bi.right_vertical_adapt", + cls: "weixin-popup-south-container", + lgap: 10, + items: [BI.createWidget({ + type: "bi.button", + cls: "weixin-popup-cancel-button", + text: BI.i18nText("FS-YT_Cancel"), + width: 80, + height: 25, + value: 1, + level: "ignore", + handler: function (e) { + t.close(e) + } + }), e] + } + }, end: function () { + this._saveTimingTaskData() + }, _checkValid: function () { + var e = this, t = !0; + return BI.isKey(e.timingTaskStartHourEditor.getValue()) ? e._isHourValid() || (t = !1, e.hourErrorPane.showError(BI.i18nText("FS-YT_Illegal"))) : (t = !1, e.hourErrorPane.showError(BI.i18nText("FS-YT_Not_Null"))), BI.isKey(e.timingTaskStartMinuteEditor.getValue()) ? e._isMinuteValid() || (t = !1, e.minuteErrorPane.showError(BI.i18nText("FS-YT_Illegal"))) : (t = !1, e.minuteErrorPane.showError(BI.i18nText("FS-YT_Not_Null"))), t + }, _saveTimingTaskData: function () { + Dec.YT.Util.ajax({ + url: "/weixin/timing/task", + type: "POST", + data: { + executeTimingTask: this.executeTimingTaskCheckBox.isSelected(), + timingTaskFrequencyType: this.timingTaskFrequencyTypeCombo.getValue(), + timingTaskStartDay: this.timingTaskStartDayCombo.getValue(), + timingTaskStartHour: parseInt(this.timingTaskStartHourEditor.getValue()), + timingTaskStartMinute: parseInt(this.timingTaskStartMinuteEditor.getValue()) + }, + complete: function (e, t) { + if ("success" === t) { + var i = BI.jsonDecode(e.responseText); + i.errorCode === Dec.YT.ERROR_CODE_OK ? BI.Msg.toast(BI.i18nText("Dec-Basic_Success")) : Dec.Msg.alert({message: Dec.YT.Util.handleCommonErr(i)}) + } + } + }) + }, close: function () { + this.fireEvent("EVENT_CLOSE") + }, _isHourValid: function () { + return this._isNumber(this.timingTaskStartHourEditor.getValue()) && parseInt(this.timingTaskStartHourEditor.getValue()) < 24 && 0 <= parseInt(this.timingTaskStartHourEditor.getValue()) + }, _isMinuteValid: function () { + return this._isNumber(this.timingTaskStartMinuteEditor.getValue()) && parseInt(this.timingTaskStartMinuteEditor.getValue()) < 60 && 0 <= parseInt(this.timingTaskStartMinuteEditor.getValue()) + }, _isNumber: function (e) { + return /^\d{1,2}$/.test(e) + } + }); + BI.shortcut("yt.schedule.task.popover", e) + }(), + function () { + var e = BI.inherit(BI.Widget, { + props: { + id: [], + agentName: [], + corpId: [], + tipLabel: "", + refreshAgentList: null, + noClose: !1 + }, render: function () { + this.secArr = [] + return { + type: "bi.vtape", + items: [{el: this._rebuildCenter()}, {el: this._rebuildSouth(), height: 44}] + } + }, + getValue: function () { + for (var arrs = [], t = 0; t < this.secArr.length; t++) { + var i = {}; + this.secArr[t].id && (i.id = this.secArr[t].id); + i.agentName = this.secArr[t].agentName.getValue(); + i.teamId = this.secArr[t].teamId.getValue(); + i.groupId = this.secArr[t].groupId.getValue(); + i.clientId = this.secArr[t].clientId.getValue(); + i.clientSecret = this.secArr[t].clientSecret.getValue(); + arrs.push(i) + } + return {agents: arrs, compatible: this.options.noClose} + }, + _rebuildCenter: function () { + var e = this, t = this.options, i = {}; + e.options.tipLabel && (i = { + type: "bi.label", + cls: "weixin-gray-color", + text: e.options.tipLabel, + textAlign: "left", + whiteSpace: "normal" + }); + var n, a, r = []; + r.push(i) + debugger + if (0 < t.agentName.length) { + for (var o = 0; o < t.agentName.length; o++) { + n = o + a = e._createYituanSection({ + id: t.id[n], + agentName: t.agentName[n], + teamId: t.teamId[n], + groupId: t.groupId[n], + clientId: t.clientId[n], + clientSecret: t.clientSecret[n], + }) + r.push(a); + } + } else { + var s = e._createYituanSection({}); + r.push(s) + } + + return {type: "bi.vertical", cls: "weixin-create-agent-popup-content", items: r} + }, + _rebuildSouth: function () { + var t = this, e = this.options, i = { + type: "bi.button", + cls: "weixin-popup-confirm-button", + text: BI.i18nText("FS-YT_Confirm"), + width: 80, + height: 25, + value: 0, + handler: function (e) { + t._checkValid() && t.end() + } + }; + return { + type: "bi.right_vertical_adapt", + cls: "weixin-popup-south-container", + rgap: 10, + items: [e.noClose ? {} : { + type: "bi.button", + cls: "weixin-popup-cancel-button", + text: BI.i18nText("FS-YT_Cancel"), + width: 80, + height: 25, + value: 1, + level: "ignore", + handler: function (e) { + t.close(e) + } + }, i] + } + }, end: function () { + this.fireEvent("EVENT_CONFIRM") + }, + _checkValid: function () { + for (var e = this, t = !0, i = 0; i < e.secArr.length; i++) { + var agentName = e.secArr[i].agentName; + var teamId = e.secArr[i].teamId; + var groupId = e.secArr[i].groupId; + var clientId = e.secArr[i].clientId; + var clientSecret = e.secArr[i].clientSecret; + BI.isKey(agentName.getValue()) || (t = !1, e.secArr[i].agentNameErrorPane.showError("公司名 不能为空")), + BI.isKey(teamId.getValue()) || (t = !1, e.secArr[i].teamIdErrorPane.showError("团队ID 不能为空")); + BI.isKey(groupId.getValue()) || (t = !1, e.secArr[i].groupIdErrorPane.showError("groupId 不能为空")); + BI.isKey(clientId.getValue()) || (t = !1, e.secArr[i].clientIdErrorPane.showError("clientId 不能为空")); + BI.isKey(clientSecret.getValue()) || (t = !1, e.secArr[i].clientSecretErrorPane.showError("teamID 不能为空")); + } + return t + }, close: function () { + this.fireEvent("EVENT_CLOSE") + }, + _createYituanSection: function (e) { + var t = {}; + // e instanceof Object && (e.agentName = e.agentName || "", e.corpId = e.corpId || ""); + var i = { + type: "bi.vertical", + height: 200, + items: [{ + el: { + type: "bi.vertical_adapt", + items: [{ + type: "bi.label", + text: "公司名", + textAlign: "left", + width: 80, + height: 17 + }, { + type: "dec.error_label", + width: 330, + el: { + type: "bi.editor", + cls: "bi-border weixin-border-box", + height: 24, + errorTextHeight: 18, + allowBlank: !0, + value: e.agentName, + ref: function (e) { + t.agentName = e + }, + listeners: [{ + eventName: BI.Editor.EVENT_FOCUS, action: function () { + t.agentNameErrorPane.hideError() + } + }] + }, + ref: function (e) { + t.agentNameErrorPane = e + } + }] + }, tgap: 17 + }, + { + el: { + type: "bi.vertical_adapt", + items: [{ + type: "bi.label", + text: "团队ID", + textAlign: "left", + width: 80, + height: 17 + }, { + type: "dec.error_label", + width: 330, + el: { + type: "bi.editor", + cls: "bi-border weixin-border-box", + value: e.teamId, + height: 24, + errorTextHeight: 18, + allowBlank: !0, + ref: function (e) { + t.teamId = e + }, + listeners: [{ + eventName: BI.Editor.EVENT_FOCUS, action: function () { + t.teamIdErrorPane.hideError() + } + }] + }, + ref: function (e) { + t.teamIdErrorPane = e + } + }] + }, tgap: 10, + height: 26, + }, + { + el: { + type: "bi.vertical_adapt", + items: [{ + type: "bi.label", + text: "groupId", + textAlign: "left", + width: 80, + height: 17 + }, { + type: "dec.error_label", + width: 330, + el: { + type: "bi.editor", + cls: "bi-border weixin-border-box", + value: e.groupId, + height: 24, + errorTextHeight: 18, + allowBlank: !0, + ref: function (e) { + t.groupId = e + }, + listeners: [{ + eventName: BI.Editor.EVENT_FOCUS, action: function () { + t.groupIdErrorPane.hideError() + } + }] + }, + ref: function (e) { + t.groupIdErrorPane = e + } + }] + }, tgap: 10, + height: 26, + }, + { + el: { + type: "bi.vertical_adapt", + items: [{ + type: "bi.label", + text: "clientId", + textAlign: "left", + width: 80, + height: 17 + }, { + type: "dec.error_label", + width: 330, + el: { + type: "bi.editor", + cls: "bi-border weixin-border-box", + value: e.clientId, + height: 24, + errorTextHeight: 18, + allowBlank: !0, + ref: function (e) { + t.clientId = e + }, + listeners: [{ + eventName: BI.Editor.EVENT_FOCUS, action: function () { + t.clientIdErrorPane.hideError() + } + }] + }, + ref: function (e) { + t.clientIdErrorPane = e + } + }] + }, tgap: 10, + height: 26, + }, + { + el: { + type: "bi.vertical_adapt", + items: [{ + type: "bi.label", + text: "clientSecret", + textAlign: "left", + width: 80, + height: 17 + }, { + type: "dec.error_label", + width: 330, + el: { + type: "bi.editor", + cls: "bi-border weixin-border-box", + value: e.clientSecret, + height: 24, + errorTextHeight: 18, + allowBlank: !0, + ref: function (e) { + t.clientSecret = e + }, + listeners: [{ + eventName: BI.Editor.EVENT_FOCUS, action: function () { + t.clientSecretErrorPane.hideError() + } + }] + }, + ref: function (e) { + t.clientSecretErrorPane = e + } + }] + }, tgap: 10, + height: 26, + }, + ] + }; + return t.id = e.id, this.secArr.push(t), i + } + }); + BI.shortcut("yt.create.yituan.popover", e) + }(), + function () { + var e = BI.inherit(BI.Widget, { + props: { + id: [], + agentName: [], + corpId: [], + tipLabel: "", + refreshAgentList: null, + noClose: !1 + }, render: function () { + return this.secArr = [], { + type: "bi.vtape", + items: [{el: this._rebuildCenter()}, {el: this._rebuildSouth(), height: 44}] + } + }, getValue: function () { + for (var e = [], t = 0; t < this.secArr.length; t++) { + var i = {}; + this.secArr[t].id && (i.id = this.secArr[t].id), i.agentName = this.secArr[t].agentName.getValue(), i.corpId = this.secArr[t].corpId.getValue(), e.push(i) + } + return {agents: e, compatible: this.options.noClose} + }, _rebuildCenter: function () { + var e = this, t = this.options, i = {}; + e.options.tipLabel && (i = { + type: "bi.label", + cls: "weixin-gray-color", + text: e.options.tipLabel, + textAlign: "left", + whiteSpace: "normal" + }); + var n, a, r = []; + if (r.push(i), 0 < t.agentName.length) for (var o = 0; o < t.agentName.length; o++) n = o, void 0, a = e._createAgentSection({ + id: t.id[n], + agentName: t.agentName[n], + corpId: t.corpId[n], + }), r.push(a); else { + var s = e._createAgentSection({}); + r.push(s) + } + return {type: "bi.vertical", cls: "weixin-create-agent-popup-content", items: r} + }, _rebuildSouth: function () { + var t = this, e = this.options, i = { + type: "bi.button", + cls: "weixin-popup-confirm-button", + text: BI.i18nText("FS-YT_Confirm"), + width: 80, + height: 25, + value: 0, + handler: function (e) { + + t._checkValid() && t.end() + } + }; + return { + type: "bi.right_vertical_adapt", + cls: "weixin-popup-south-container", + rgap: 10, + items: [e.noClose ? {} : { + type: "bi.button", + cls: "weixin-popup-cancel-button", + text: BI.i18nText("FS-YT_Cancel"), + width: 80, + height: 25, + value: 1, + level: "ignore", + handler: function (e) { + t.close(e) + } + }, i] + } + }, end: function () { + this.fireEvent("EVENT_CONFIRM") + }, _checkValid: function () { + for (var e = this, t = !0, i = 0; i < e.secArr.length; i++) { + var n = e.secArr[i].agentName, a = e.secArr[i].corpId; + BI.isKey(n.getValue()) || (t = !1, e.secArr[i].agentNameErrorPane.showError(BI.i18nText("FS-YT_Not_Null"))), + BI.isKey(a.getValue()) || (t = !1, e.secArr[i].corpIdErrorPane.showError(BI.i18nText("FS-YT_Not_Null"))); + } + return t + }, close: function () { + this.fireEvent("EVENT_CLOSE") + }, + _createAgentSection: function (e) { + var t = {}; + e instanceof Object && (e.agentName = e.agentName || "", e.corpId = e.corpId || ""); + var i = { + type: "bi.vertical", + height: 200, + items: [{ + el: { + type: "bi.vertical_adapt", + items: [{ + type: "bi.label", + text: "公共号名称", + textAlign: "left", + width: 80, + height: 17 + }, { + type: "dec.error_label", + width: 330, + el: { + type: "bi.editor", + cls: "bi-border weixin-border-box", + height: 24, + errorTextHeight: 18, + allowBlank: !0, + value: e.agentName, + ref: function (e) { + t.agentName = e + }, + listeners: [{ + eventName: BI.Editor.EVENT_FOCUS, action: function () { + t.agentNameErrorPane.hideError() + } + }] + }, + ref: function (e) { + t.agentNameErrorPane = e + } + }] + }, tgap: 17 + }, { + el: { + type: "bi.vertical_adapt", + items: [{ + type: "bi.label", + text: "公共号编号", + textAlign: "left", + width: 80, + height: 17 + }, { + type: "dec.error_label", + width: 330, + el: { + type: "bi.editor", + cls: "bi-border weixin-border-box", + value: e.corpId, + height: 24, + errorTextHeight: 18, + allowBlank: !0, + ref: function (e) { + t.corpId = e + }, + listeners: [{ + eventName: BI.Editor.EVENT_FOCUS, action: function () { + t.corpIdErrorPane.hideError() + } + }] + }, + ref: function (e) { + t.corpIdErrorPane = e + } + }] + }, tgap: 10, + height: 26, + }, + + ] + }; + return t.id = e.id, this.secArr.push(t), i + } + }); + BI.shortcut("yt.create.agent.popover", e) + }() + , function () { + var e = BI.inherit(BI.Widget, { + _defaultConfig: function () { + return BI.extend(e.superclass._defaultConfig.apply(this, arguments), { + baseCls: "weixin-loading-popup bi-card", + width: 450, + height: 250, + body: null + }) + }, render: function () { + return { + type: "bi.border", + items: { + center: { + el: { + type: "bi.absolute", + width: this.options.width, + height: this.options.height, + items: [{ + el: BI.createWidget(this.options.body), + left: 0, + top: 0, + right: 0, + bottom: 0 + }] + } + } + }, + width: this.options.width, + height: this.options.height + } + }, open: function () { + this.show(), this.fireEvent("EVENT_OPEN", arguments) + }, close: function () { + this.hide(), this.fireEvent("EVENT_CLOSE", arguments) + }, setZindex: function (e) { + this.element.css({"z-index": e}) + } + }); + BI.shortcut("yt.loading.popup", e) + }(), function () { + var e = BI.inherit(BI.Widget, { + _store: function () { + return BI.Models.getModel("yt.model.tab.member.management") + }, + watch: { + selectedIndex: function () { + this.tab.setSelect(this.model.selectedIndex) + } + }, + props: {refreshDepartmentData: null, refreshTagData: null, clearPageEditor: null}, + render: function () { + var e = this; + return this.navTabs = BI.Constants.getConstant("yt.constants.member.management.tabs"), this.nav = this._createNavTab(), { + type: "bi.vtape", + element: this, + items: [{ + type: "bi.absolute", + height: 40, + cls: "bi-border-bottom", + items: [{el: this.nav, top: 0, left: 0, bottom: 0, right: 0}] + }, { + type: "bi.absolute", items: [{ + el: { + type: "bi.tab", + ref: function () { + e.tab = this + }, + single: !1, + showIndex: this.model.selectedIndex, + defaultShowIndex: this.model.selectedIndex, + cardCreator: BI.bind(this._createTabPane, this) + }, top: 0, right: 0, bottom: 0, left: 0 + }] + }], + bgap: 3 + } + }, + _createNavTab: function () { + var t = this; + return BI.createWidget({ + type: "yt.line_segment", + items: t.navTabs, + height: 40, + listeners: [{ + eventName: "EVENT_CHANGE", action: function (e) { + t.store.setSelectedIndex(e) + } + }], + width: 200 + }) + }, + _createTabPane: function (e) { + var t = this; + switch (e) { + case"departments": + return { + type: "yt.member.department.tab", + refreshDepartmentData: t.options.refreshDepartmentData, + clearPageEditor: t.options.clearPageEditor, + ref: function (e) { + t.weixinDepartmentTreeTab = e + } + }; + + default: + return { + type: "yt.member.department.tab", + refreshDepartmentData: t.options.refreshDepartmentData, + clearPageEditor: t.options.clearPageEditor, + ref: function (e) { + t.weixinDepartmentTreeTab = e + } + } + } + }, + caculateTree: function () { + this.weixinDepartmentTreeTab && this.weixinDepartmentTreeTab.store.getDepTreeData(), this.weixinTagTreeTab && this.weixinTagTreeTab.store.getTagTreeData() + }, + _getDepTree: function () { + return this.weixinDepartmentTreeTab._getDepTree() + }, + _getTagTree: function () { + return this.weixinTagTreeTab._getTagTree() + }, + _getTab: function () { + return this.tab + } + }); + BI.shortcut("yt.member.management.tab", e) + }(), function () { + var e = BI.inherit(Fix.Model, { + state: function () { + return {selectedIndex: BI.Constants.getConstant("yt.constants.member.management.tabs")[0].value} + }, childContext: ["selectedIndex"], actions: { + setSelectedIndex: function (e) { + this.model.selectedIndex = e + } + } + }); + BI.model("yt.model.tab.member.management", e) + }(), function () { + var e = BI.Constants.getConstant("yt.constants").department_tab_value, t = BI.inherit(BI.Widget, { + _store: function () { + return BI.Models.getModel("yt.model.member.department") + }, watch: { + depTree: function () { + var e = this.model.depTree; + e && 0 < e.length && (e[0].selected = !0, e[0].open = !0), this.weixinDepartmentTree.populate(e), this.options.clearPageEditor(), this.options.refreshDepartmentData() + }, selectedIndex: function () { + this.model.selectedIndex === e && (this.options.clearPageEditor(), this.options.refreshDepartmentData()) + } + }, props: {refreshDepartmentData: BI.emptyFn, clearPageEditor: BI.emptyFn}, render: function () { + var t = this; + return { + type: "bi.multilayer_select_level_tree", ref: function (e) { + t.weixinDepartmentTree = e + }, listeners: [{ + eventName: BI.MultiLayerSelectLevelTree.EVENT_CHANGE, action: function (e) { + t.options.refreshDepartmentData(), t.options.clearPageEditor() + } + }] + } + }, mounted: function () { + this.store.getDepTreeData() + }, _getDepTree: function () { + window.ntree = this.weixinDepartmentTree; + return this.weixinDepartmentTree + } + }); + BI.shortcut("yt.member.department.tab", t) + }(), function () { + var e = BI.inherit(Fix.Model, { + context: ["selectedIndex"], state: function () { + return {depTree: {}} + }, actions: { + getDepTreeData: function () { + var n = this; + Dec.YT.Util.reqWithLoading({ + url: "/yt/dep/tree", type: "GET", complete: function (e, t) { + if ("success" === t) { + var i = BI.jsonDecode(e.responseText); + i.errorCode === Dec.YT.ERROR_CODE_OK ? n.model.depTree = BI.jsonDecode(e.responseText).depTree : Dec.Msg.alert({message: Dec.YT.Util.handleCommonErr(i)}) + } + } + }) + } + } + }); + BI.model("yt.model.member.department", e) + }(), function () { + var e = BI.Constants.getConstant("yt.constants").tag_tab_value, t = BI.inherit(BI.Widget, { + _store: function () { + return BI.Models.getModel("yt.model.member.tag") + }, watch: { + tagTree: function () { + var e = this.model.tagTree; + e && 0 < e.length && (e[0].selected = !0, e[0].open = !0), this.weixinTagTree.populate(e), this.options.clearPageEditor(), this.options.refreshTagData() + }, selectedIndex: function () { + this.model.selectedIndex === e && (this.options.clearPageEditor(), this.options.refreshTagData()) + } + }, props: {clearPageEditor: BI.emptyFn, refreshTagData: BI.emptyFn}, render: function () { + var t = this; + return { + type: "bi.multilayer_select_level_tree", ref: function (e) { + t.weixinTagTree = e + }, listeners: [{ + eventName: BI.MultiLayerSelectLevelTree.EVENT_CHANGE, action: function () { + t.options.refreshTagData(), t.options.clearPageEditor() + } + }] + } + }, mounted: function () { + this.store.getTagTreeData() + }, _getTagTree: function () { + return this.weixinTagTree + } + }); + BI.shortcut("yt.member.tag.tab", t) + }(), function () { + var e = BI.inherit(Fix.Model, { + context: ["selectedIndex"], state: function () { + return {tagTree: {}} + }, actions: { + getTagTreeData: function () { + var n = this; + Dec.YT.Util.reqWithLoading({ + url: "/weixin/tag/tree", type: "GET", complete: function (e, t) { + if ("success" === t) { + var i = BI.jsonDecode(e.responseText); + i.errorCode === Dec.YT.ERROR_CODE_OK ? n.model.tagTree = BI.jsonDecode(e.responseText).tagTree : Dec.Msg.alert({message: Dec.YT.Util.handleCommonErr(i)}) + } + } + }) + } + } + }); + BI.model("yt.model.member.tag", e) + }(), function () { + var e = BI.inherit(BI.Widget, { + _store: function () { + return BI.Models.getModel("yt.model.management") + }, watch: { + selectedTab: function (e) { + this.tab.setSelect(e) + } + }, render: function () { + var e = this; + return this.navTabs = BI.Constants.getConstant("yt.constants.management.tabs"), this.nav = this._createNavTab(), { + type: "bi.vtape", + element: this, + items: [{ + type: "bi.absolute", + cls: "weixin-tab-title", + height: 40, + items: [{el: this.nav, top: 0, left: 0, bottom: 0, right: 0}] + }, { + type: "bi.absolute", cls: "weixin-tab-content", items: [{ + el: { + type: "bi.tab", + ref: function () { + e.tab = this + }, + single: !1, + showIndex: this.model.selectedTab, + defaultShowIndex: this.model.selectedTab, + cardCreator: BI.bind(this._createTabPane, this) + }, top: 0, right: 0, bottom: 0, left: 0 + }] + }], + bgap: 1 + } + }, _createNavTab: function () { + var t = this; + return { + type: "yt.line_segment", + items: t.navTabs, + listeners: [{ + eventName: "EVENT_CHANGE", action: function (e) { + t.store.setSelectedTab(e), "member" === e && t.memberManagementTab && (t.memberManagementTab.treeManagementPane.caculateTree(), t.memberManagementTab._clearPageEditor()) + } + }], + width: 270, + height: 40 + } + }, _createTabPane: function (e) { + var t = this; + switch (e) { + case"agent": + return { + type: "yt.agentmanagement", ref: function (e) { + t.agentManagementTab = e + } + }; + case"member": + return { + type: "bi.vertical", + cls: "weixin-member-management-container", + items: [{ + height: "100%", type: "yt.membermanagement", ref: function (e) { + t.memberManagementTab = e + } + }] + }; + case"group": + return { + type: "bi.vertical", + cls: "weixin-group-management-container", + items: [{ + height: "100%", type: "yt.groupmanagement", ref: function (e) { + t.groupManagementTab = e + } + }] + }; + case"config": + return { + type: "bi.vertical", + cls: "weixin-quick-config-container", + items: [{ + height: "100%", type: "yt.agentquickconfig", ref: function (e) { + t.quickConfigTab = e + } + }] + }; + default: + return {type: "yt.agentmanagement"} + } + } + }); + BI.shortcut("yt.Tab", e) + }(), function () { + var e = BI.inherit(Fix.Model, { + state: function () { + return { + selectedTab: BI.Constants.getConstant("yt.constants.management.tabs")[0].value, + agentList: [], + total: 0 + } + }, actions: { + setSelectedTab: function (e) { + this.model.selectedTab = e + } + }, childContext: ["selectedTab", "agentList"] + }); + BI.model("yt.model.management", e) + }(), function () { + var e = BI.inherit(BI.Widget, { + render: function () { + return this.agentUrlPane = this._createAgentUrlPane(), this.proxyPane = this._createProxyPane(), this.agentConfigPane = this._createAgentConfigPane(), { + type: "bi.vertical", + vgap: 14, + hgap: 14, + items: [{el: this.proxyPane}, {el: this.agentConfigPane}, {el: this.agentUrlPane}] + } + }, mounted: function () { + this._initData() + }, _store: function () { + return BI.Models.getModel("yt.model.quick.config") + }, watch: { + agentList: function () { + this._populateAgentListCombo() + }, weiXinUrl: function () { + this.createUrlPane.setValue(this.model.weiXinUrl) + }, proxyServer: function () { + this.proxyUrlPane.setValue(this.model.proxyServer) + } + }, _initData: function () { + this.store.getProxyServer(), this._populateAgentListCombo() + }, _populateAgentListCombo: function () { + var e = this, t = e.model.agentListComboItems; + e.agentListCUCombo.populate(t), e.agentListCUCombo.setValue(t[0] && t[0].value), e.agentListQCCombo.populate(t), e.agentListQCCombo.setValue(t[0] && t[0].value) + }, _createAgentUrlPane: function () { + var n = this; + return { + type: "bi.vertical", + cls: "weixin-section-container", + items: [{ + el: { + type: "bi.left_right_vertical_adapt", + cls: "bi-border-bottom", + height: 40, + items: { + left: [{ + type: "bi.label", + text: BI.i18nText("FS-YT_Create_WeiXin_Url"), + cls: "weixin-title" + }] + } + }, lgap: 14 + }, { + el: { + type: "bi.vertical_adapt", + height: 25, + items: [{ + type: "bi.label", + text: BI.i18nText("FS-YT_Agent_Name"), + textAlign: "left", + width: 116 + }, { + type: "yt.editor_text_value_combo", width: 150, height: 24, ref: function (e) { + n.agentListCUCombo = e + }, items: [] + }] + }, lgap: 14, tgap: 10 + }, { + el: { + type: "bi.vertical_adapt", + height: 25, + items: [{ + type: "bi.label", + text: BI.i18nText("FS-YT_Platform_Page"), + textAlign: "left", + width: 116 + }, { + type: "yt.editor_text_value_combo", + width: 150, + height: 24, + value: 1, + items: [{ + text: BI.i18nText("FS-YT_Platform"), + value: 1 + }, {text: BI.i18nText("FS-YT_Platform_Report"), value: 2}], + ref: function (e) { + n.platform = e + }, + listeners: [{ + eventName: BI.TextValueCombo.EVENT_CHANGE, action: function () { + var e = this.getValue(); + 1 === e ? n.reportFileTree.setVisible(!1) : 2 === e && n.reportFileTree.setVisible(!0) + } + }] + }, { + type: "dec.schedule.template.search", + invisible: !0, + width: 150, + height: 24, + lgap: 10, + ref: function (e) { + n.reportFileTree = e + } + }] + }, lgap: 14, tgap: 10 + }, { + el: { + type: "bi.vertical_adapt", + height: 25, + items: [{ + type: "bi.label", + text: BI.i18nText("FS-YT_WeiXin_Url"), + textAlign: "left", + width: 116 + }, { + el: { + type: "bi.editor", + cls: "bi-border", + width: 300, + height: 24, + allowBlank: !0, + ref: function (e) { + n.createUrlPane = e + } + }, rgap: 10 + }, { + el: { + width: 80, + height: 24, + type: "bi.button", + text: BI.i18nText("FS-YT_Create_Url"), + handler: function () { + var e = n.agentListCUCombo.getValue(), t = n.platform.getValue(), + i = n.reportFileTree.getValue()[0]; + n.store.createWeiXinUrl(e, t, i) + } + }, rgap: 10 + }, { + width: 80, + height: 24, + type: "yt.clipboard.button", + text: BI.i18nText("FS-YT_Copy_Url"), + copy: function () { + return n.createUrlPane.getValue() + }, + afterCopy: function () { + BI.Msg.toast(BI.i18nText("FS-YT_Copy_Success")) + } + }] + }, lgap: 14, tgap: 10, bgap: 10 + }] + } + }, _createProxyPane: function () { + var t = this; + return { + type: "bi.vertical", + cls: "weixin-section-container", + items: [{ + el: { + type: "bi.left_right_vertical_adapt", + cls: "bi-border-bottom", + height: 40, + items: { + left: [{ + type: "bi.label", + text: BI.i18nText("FS-YT_Proxy"), + cls: "weixin-title" + }], + right: [{ + width: 80, + height: 24, + type: "bi.button", + text: BI.i18nText("FS-YT_Save"), + handler: function () { + var e = t.proxyUrlPane.getValue().trim(); + t._checkReportServerUrlValid(e, function () { + this.store.saveProxyServer(e) + }) + } + }] + } + }, lgap: 14, rgap: 14 + }, { + el: { + type: "bi.vertical_adapt", + height: 25, + items: [{ + type: "bi.label", + text: BI.i18nText("FS-YT_Proxy_Address"), + textAlign: "left", + width: 116 + }, { + el: { + type: "bi.editor", + cls: "bi-border", + width: 300, + height: 24, + allowBlank: !0, + ref: function (e) { + t.proxyUrlPane = e + } + }, rgap: 10 + }, { + width: 80, + height: 24, + type: "bi.button", + text: BI.i18nText("FS-YT_Test_Proxy_Address"), + handler: function () { + var e = t.proxyUrlPane.getValue().trim(); + t._checkReportServerUrlValid(e, function () { + this.store.testProxyServer(e) + }) + } + }] + }, lgap: 14, tgap: 10, bgap: 10 + }] + } + }, _checkReportServerUrlValid: function (e, t) { + Dec.YT.Util.checkUrlValid(e) || "" === e ? BI.isFunction(t) && t.call(this) : Dec.Msg.alert({message: BI.i18nText("FS-YT_Start_With_Http")}) + }, _createAgentConfigPane: function () { + var t = this; + return { + type: "bi.vertical", + cls: "weixin-section-container", + items: [{ + el: { + type: "bi.left_right_vertical_adapt", + cls: "bi-border-bottom", + height: 40, + items: { + left: [{ + type: "bi.label", + text: BI.i18nText("FS-YT_Agent_Quick_Config"), + cls: "weixin-title" + }] + } + }, lgap: 14 + }, { + el: { + type: "bi.vertical_adapt", + height: 25, + items: [{ + type: "bi.label", + text: BI.i18nText("FS-YT_Agent_Name"), + textAlign: "left", + width: 116 + }, { + el: { + type: "yt.editor_text_value_combo", + width: 150, + height: 24, + ref: function (e) { + t.agentListQCCombo = e + }, + items: [] + }, rgap: 10 + }, { + width: 80, + height: 24, + type: "bi.button", + text: BI.i18nText("FS-YT_One_Key_Config"), + handler: function () { + var e = t.agentListQCCombo.getValue(); + t.store.oneKeyConfigPreCheck(e, function (e) { + t.store.oneKeyConfig(e) + }) + } + }] + }, lgap: 14, tgap: 10, bgap: 10 + }] + } + } + }); + BI.shortcut("yt.agentquickconfig", e) + }(), function () { + var e = BI.inherit(Fix.Model, { + context: ["agentList"], state: function () { + return {weiXinUrl: "", proxyServer: ""} + }, computed: { + agentListComboItems: function () { + for (var e = [], t = this.model.agentList, i = this.model.agentList.length, n = 0; n < i; n++) { + var a = t[n], r = {}; + r.text = a.agentName, r.value = n, e.push(r) + } + return e + } + }, actions: { + createWeiXinUrl: function (e, t, i) { + var n = this; + if (BI.isKey(e)) { + var a = n.model.agentList[e]; + a && Dec.YT.Util.ajax({ + url: "/weixin/entry/url", + type: "POST", + data: {corpId: a.corpId, id: a.id, platform: t, fileName: i}, + complete: function (e, t) { + if ("success" === t) { + var i = BI.jsonDecode(e.responseText); + i.errorCode === Dec.YT.ERROR_CODE_OK ? n.model.weiXinUrl = i.oauthUrl : Dec.Msg.alert({message: Dec.YT.Util.handleCommonErr(i)}) + } + } + }) + } + }, getProxyServer: function () { + var n = this; + Dec.YT.Util.ajax({ + url: "/weixin/proxy/server/url", type: "GET", complete: function (e, t) { + if ("success" === t) { + var i = BI.jsonDecode(e.responseText); + i.errorCode === Dec.YT.ERROR_CODE_OK ? n.model.proxyServer = i.proxyServer : Dec.Msg.alert({message: Dec.YT.Util.handleCommonErr(i)}) + } + } + }) + }, saveProxyServer: function (e) { + Dec.YT.Util.ajax({ + url: "/weixin/proxy/server/url", + type: "POST", + data: {proxyServer: e}, + complete: function (e, t) { + if ("success" === t) { + var i = BI.jsonDecode(e.responseText); + i.errorCode === Dec.YT.ERROR_CODE_OK ? BI.Msg.toast(BI.i18nText("Dec-Basic_Success")) : Dec.Msg.alert({message: Dec.YT.Util.handleCommonErr(i)}) + } + } + }) + }, testProxyServer: function (e) { + var n = this, a = BI.Constants.getConstant("yt.constants").popup_loading_configuration, + r = Dec.YT.Util.showLoading(".weixin-quick-config-container", BI.i18nText("FS-YT_Test_Connection"), a); + Dec.YT.Util.ajax({ + url: "/weixin/test/proxy/connection", + type: "POST", + data: {proxyServer: e}, + complete: function (e, t) { + if (r.remove(a), "success" === t) { + var i = BI.jsonDecode(e.responseText); + i.errorCode === Dec.YT.ERROR_CODE_OK ? (n._showResultAlert(BI.i18nText("FS-YT_Connection_Success"), !0), n._hideResultAlert()) : n._showResultAlert(Dec.YT.Util.handleCommonErr(i), !1) + } + } + }) + }, oneKeyConfigPreCheck: function (e, a) { + var r = this; + if (BI.isKey(e)) { + var o = r.model.agentList[e]; + if (o) { + var s = BI.Constants.getConstant("yt.constants").popup_loading_configuration, + l = Dec.YT.Util.showLoading(".weixin-quick-config-container", BI.i18nText("FS-YT_Configuring"), s); + Dec.YT.Util.ajax({ + url: "/weixin/one/key/pre/check/config", + type: "POST", + data: {secret: o.secret}, + complete: function (e, t) { + if (l.remove(s), "success" === t) { + var i = BI.jsonDecode(e.responseText); + if (i.errorCode === Dec.YT.ERROR_CODE_OK) i.exists ? Dec.Msg.alert({ + message: BI.i18nText("FS-YT_One_Key_Config_Tip"), + callback: function () { + BI.isFunction(a) && a.call(r, o.secret) + } + }) : BI.isFunction(a) && a.call(r, o.secret); else if (i.errorCode === Dec.YT.ERROR_CODE_WEIXIN_API_ERR) { + var n = Dec.YT.Util._generateWeiXinApiErrorLabel(BI.i18nText("FS-YT_Configure_Fail"), i.weixinApiError); + Dec.Msg.alert({message: n}) + } else Dec.Msg.alert({message: Dec.YT.Util.handleCommonErr(i)}) + } + } + }) + } + } + }, oneKeyConfig: function (e) { + var a = this, r = BI.Constants.getConstant("yt.constants").popup_loading_configuration, + o = Dec.YT.Util.showLoading(".weixin-quick-config-container", BI.i18nText("FS-YT_Configuring"), r); + Dec.YT.Util.ajax({ + url: "/weixin/one/key/config", + type: "POST", + data: {secret: e}, + complete: function (e, t) { + if ("success" === t) { + o.remove(r); + var i = BI.jsonDecode(e.responseText); + if (i.errorCode === Dec.YT.ERROR_CODE_OK) a._showResultAlert(BI.i18nText("FS-YT_Configure_Success"), !0), a._hideResultAlert(); else if (i.errorCode === Dec.YT.ERROR_CODE_WEIXIN_API_ERR) { + var n = Dec.YT.Util._generateWeiXinApiErrorLabel(BI.i18nText("FS-YT_Configure_Fail"), i.weixinApiError); + Dec.Msg.alert({message: n}) + } else Dec.Msg.alert({message: Dec.YT.Util.handleCommonErr(i)}) + } + } + }) + }, _showResultAlert: function (e, t) { + var i = BI.Constants.getConstant("yt.constants").popup_result_tip_popup; + Dec.YT.Util.showResultAlert(".weixin-quick-config-container", e, t, i) + }, _hideResultAlert: function () { + var e = BI.Constants.getConstant("yt.constants").popup_result_tip_popup; + setTimeout(function () { + Dec.YT.Util.hideResultAlert(e) + }, 1500) + } + } + }); + BI.model("yt.model.quick.config", e) + }(), + function () { + var e = BI.inherit(BI.Widget, { + render: function () { + this.yiTuancurrentPage = 1 + this.yiTuantotalPage = 1 + this.currentPage = 1 + this.totalPage = 1, + this.agent_management_table_header = BI.Constants.getConstant("yt.constants.agentmanagement.table.header"), + this.yituan_table_header = BI.Constants.getConstant("yt.constants.yituan.table.header") + this._reportServerPane = this._createReportServerPane(), + this._agentListPane = this._createAgentListPane(); + this._yituanPane = this._createYituanListPane(); + return { + type: "bi.vertical", + vgap: 14, + hgap: 14, + items: [ + {el: this._reportServerPane}, + {el: this._yituanPane}, + {el: this._agentListPane} + ] + } + }, _store: function () { + return BI.Models.getModel("yt.model.agent.management") + }, watch: { + agentList: function (e) { + this._populateWeiXinAgentTable(e, this.currentPage - 1); + this._populateWeiXinPageNumberButtons(e) + }, + yituanList: function (e) { + this._populateYituanTable(e, this.yiTuancurrentPage - 1); + this._populateYituanPageNumberButtons(e) + }, + addYituanResult: function () { + if (this.model.addYituanResult.errorText) { + Dec.Msg.alert({message: this.model.addYituanResult.errorText}) + } else { + BI.Msg.toast(BI.i18nText("Dec-Basic_Success")); + this.store.initYituanList(); + BI.Popovers.remove(BI.Constants.getConstant("yt.constants").popup_create_yituan) + } + }, + addResult: function () { + if (this.model.addResult.errorText) { + Dec.Msg.alert({message: this.model.addResult.errorText}) + } else { + BI.Msg.toast(BI.i18nText("Dec-Basic_Success")); + this.store.initAgentList(); + BI.Popovers.remove(BI.Constants.getConstant("yt.constants").popup_create_agent) + } + }, reportServerUrl: function () { + this.reportServerEditor.setValue(this.model.reportServerUrl) + this.cloudServerEditor.setValue(this.model.cloudServerUrl) + this.eid.setValue(this.model.eid) + this.appid.setValue(this.model.appId) + this.appSecret.setValue(this.model.appSecret) + this.readKey.setValue(this.model.readKey) + this.sendUserId.setValue(this.model.sendUserId) + } + }, mounted: function () { + Dec.YT.Util.formatTableStyle(), this.store.getReportServerUrl(), this.store.initAgentList(), this.store.initYituanList() + }, _createReportServerPane: function () { + var t = this; + return { + type: "bi.vertical", + cls: "weixin-section-container", + lgap: 14, + rgap: 14, + items: [{ + type: "bi.left_right_vertical_adapt", + cls: "bi-border-bottom", + height: 40, + items: { + left: [{ + type: "bi.label", + cls: "weixin-title", + text: BI.i18nText("帆软设置"), + height: 40 + }], + right: [{ + width: 80, + height: 24, + type: "bi.button", + text: BI.i18nText("FS-YT_Save"), + handler: function () { + var e = t.reportServerEditor.getValue().trim(); + var p = {}; + p.appId = t.appid.getValue().trim(); + p.appSecret = t.appSecret.getValue().trim(); + p.eid = t.eid.getValue().trim(); + p.readKey = t.readKey.getValue().trim(); + p.reportServerUrl = e; + p.cloudServerUrl = t.cloudServerEditor.getValue().trim(); + p.sendUserId = t.sendUserId.getValue().trim(); + t.store.saveReportServerUrl(p) + + } + }] + } + }, { + type: "bi.vertical", + items: [ + { + el: { + type: "bi.vertical_adapt", + cls: "weixin-reportServer-container", + height: 40, + items: [{ + type: "bi.label", + textAlign: "left", + text: "报表服务器地址", + width: 126, + height: 24 + }, { + type: "bi.editor", + cls: "bi-border", + width: 390, + height: 24, + watermark: "http://www.fanruan.com:80/webroot/decision", + allowBlank: !1, + value: t.model.reportServerUrl, + ref: function (e) { + t.reportServerEditor = e + } + }, { + el: { + type: "bi.label", + cls: "weixin-gray-color", + text: BI.i18nText("fr服务器地址"), + textAlign: "left", + height: 40 + }, lgap: 10 + }] + }, vgap: 10 + }, { + el: { + type: "bi.vertical_adapt", + cls: "weixin-reportServer-container", + invisible: true,//隐藏避免缺少组件 + height: 40, + items: [{ + type: "bi.label", + textAlign: "left", + text: "推送的发送用户id", + width: 126, + height: 24 + }, { + type: "bi.editor", + cls: "bi-border", + width: 390, + height: 24, + watermark: "https://www.yunzhijia.com", + allowBlank: !1, + value: t.model.sendUserId, + ref: function (e) { + t.sendUserId = e + } + }, { + el: { + type: "bi.label", + cls: "weixin-gray-color", + text: BI.i18nText("推送的发送用户id"), + textAlign: "left", + height: 40 + }, lgap: 10 + }] + }, vgap: 10 + }, + { + el: { + type: "bi.vertical_adapt", + cls: "weixin-reportServer-container", + invisible: true,//隐藏避免缺少组件 + height: 40, + items: [{ + type: "bi.label", + textAlign: "left", + text: "xx地址", + width: 126, + height: 24 + }, { + type: "bi.editor", + cls: "bi-border", + width: 390, + height: 24, + watermark: "https://www.yunzhijia.com", + allowBlank: !1, + value: t.model.cloudServerUrl, + ref: function (e) { + t.cloudServerEditor = e + } + }, { + el: { + type: "bi.label", + cls: "weixin-gray-color", + text: BI.i18nText("服务器地址"), + textAlign: "left", + height: 40 + }, lgap: 10 + }] + }, vgap: 10 + }, + { + el: { + invisible: true,//隐藏避免缺少组件 + type: "bi.vertical_adapt", + cls: "weixin-reportServer-container", + height: 40, + items: [{ + type: "bi.label", + textAlign: "left", + text: "团队id", + width: 126, + height: 24 + }, { + type: "bi.editor", + cls: "bi-border", + width: 390, + height: 24, + watermark: "10898", + allowBlank: !1, + value: t.model.eid, + ref: function (e) { + t.eid = e + } + }] + }, vgap: 10 + }, + { + el: { + invisible: true,//隐藏避免缺少组件 + type: "bi.vertical_adapt", + cls: "weixin-reportServer-container", + height: 40, + items: [{ + type: "bi.label", + textAlign: "left", + text: "groupId/tenantId", + width: 126, + height: 24 + }, { + type: "bi.editor", + cls: "bi-border", + width: 390, + height: 24, + watermark: "qE23eaB4pTNblPMnKf9wpj9AmMO10BND", + allowBlank: !1, + value: t.model.readKey, + ref: function (e) { + t.readKey = e + } + }] + }, vgap: 10 + }, + { + el: { + invisible: true,//隐藏避免缺少组件 + type: "bi.vertical_adapt", + cls: "weixin-reportServer-container", + height: 40, + items: [{ + type: "bi.label", + textAlign: "left", + text: "ClientId", + width: 126, + height: 24 + }, { + type: "bi.editor", + cls: "bi-border", + width: 390, + height: 24, + watermark: "500216254", + allowBlank: !1, + value: t.model.appid, + ref: function (e) { + t.appid = e + } + }] + }, vgap: 10 + }, + + { + el: { + invisible: true,//隐藏避免缺少组件 + type: "bi.vertical_adapt", + cls: "weixin-reportServer-container", + height: 40, + items: [{ + type: "bi.label", + textAlign: "left", + text: "ClientSecret", + width: 126, + height: 24 + }, { + type: "bi.editor", + cls: "bi-border", + width: 390, + height: 24, + watermark: "9B5oh2rnpPByhxPcwU9M", + allowBlank: !1, + value: t.model.appSecret, + ref: function (e) { + t.appSecret = e + } + }] + }, vgap: 10 + }, + ] + }] + } + }, _createYituanListPane: function () { + var t = this; + return { + type: "bi.vertical", + height: 300, + cls: "weixin-section-container", + lgap: 14, + rgap: 14, + items: [{ + type: "bi.left_right_vertical_adapt", + height: 40, + cls: "bi-border-bottom", + items: { + left: [{ + type: "bi.label", + text: "xx企业管理", + cls: "weixin-title", + height: 40 + }] + } + }, { + type: "bi.vertical_adapt", + height: 46, + items: [{ + type: "bi.icon_text_item", + text: "新建企业", + cls: "plus-font", + width: 100, + height: 17, + handler: function () { + t._createYituanPopupPane({ + refreshAgentList: BI.bind(t.store.initYituanList, t.store), + title: "新建企业" + }, !1) + } + }] + }, { + type: "bi.table_view", + cls: "weixin-table", + isNeedMerge: !1, + isNeedFreeze: !1, + columnSize: [234, 234, 234, 234, 234, "fill"], + items: [], + header: t.yituan_table_header, + ref: function (e) { + t.yituanTable = e + } + }, + { + type: "bi.left_right_vertical_adapt", + height: 26, + tgap: 10, + items: { + right: [{ + type: "bi.horizontal", + items: [{ + type: "bi.icon_button", + width: 24, + height: 24, + cls: "page-button dec-pager-first-font", + handler: function () { + 1 < t.yiTuancurrentPage && (t.yiTuancurrentPage = 1, t.yituanPageEditor.setValue(t.yiTuancurrentPage.toString()), t._populateYituanTable(t.model.yituanList, t.yiTuancurrentPage - 1), t._populateYituanPageNumberButtons(t.model.yituanList)) + } + }, { + type: "bi.icon_button", + lgap: 5, + width: 24, + height: 24, + cls: "page-button dec-pager-prev-font", + disabled: !0, + ref: function (e) { + t.yituanPageButton = e + }, + handler: function () { + 1 < t.yiTuancurrentPage && (t.yiTuancurrentPage -= 1, t.yituanPageEditor.setValue(t.yiTuancurrentPage.toString()), t._populateYituanTable(t.model.yituanList, t.yiTuancurrentPage - 1), t._populateYituanPageNumberButtons(t.model.yituanList)) + } + }, { + type: "bi.editor", + cls: "bi-border", + allowBlank: !0, + lgap: 5, + rgap: 5, + width: 40, + height: 24, + value: t.yiTuancurrentPage.toString(), + ref: function (e) { + t.yituanPageEditor = e + }, + listeners: [{ + eventName: BI.Editor.EVENT_CONFIRM, action: function () { + this.getValue() > t.yiTuantotalPage ? this.setValue(t.yiTuantotalPage) : this.getValue() < 1 && this.setValue(1), t.yiTuancurrentPage = parseInt(this.getValue()), t._populateYituanTable(t.model.yituanList, t.yiTuancurrentPage - 1), t._populateYituanPageNumberButtons(t.model.yituanList) + } + }] + }, {type: "bi.label", width: 5, height: 24, text: "/ "}, { + type: "bi.label", + height: 24, + lgap: 5, + text: "1", + ref: function (e) { + t.agentPageLabel = e + } + }, { + type: "bi.icon_button", + width: 24, + height: 24, + lgap: 5, + cls: "page-button dec-pager-next-font", + ref: function (e) { + t.yituannextPageButton = e + }, + handler: function () { + t.yiTuancurrentPage < t.yiTuantotalPage && (t.yiTuancurrentPage += 1, t.yituanPageEditor.setValue(t.yiTuancurrentPage.toString()), t._populateYituanTable(t.model.yituanList, t.yiTuancurrentPage - 1), t._populateYituanPageNumberButtons(t.model.yituanList)) + } + }, { + type: "bi.icon_button", + width: 24, + height: 24, + lgap: 5, + cls: "page-button dec-pager-last-font", + handler: function () { + t.yiTuancurrentPage < t.yiTuantotalPage && (t.yiTuancurrentPage = t.yiTuantotalPage, t.yituanPageEditor.setValue(t.yiTuancurrentPage.toString()), t._populateYituanTable(t.model.yituanList, t.yiTuancurrentPage - 1), t._populateYituanPageNumberButtons(t.model.yituanList)) + } + }] + }] + } + } + ] + } + }, + _createAgentListPane: function () { + var t = this; + return { + type: "bi.vertical", + height: 566, + cls: "weixin-section-container", + lgap: 14, + rgap: 14, + items: [{ + type: "bi.left_right_vertical_adapt", + height: 40, + cls: "bi-border-bottom", + items: { + left: [{ + type: "bi.label", + text: "xx公共号", + cls: "weixin-title", + height: 40 + }] + } + }, { + type: "bi.vertical_adapt", + height: 46, + items: [{ + type: "bi.icon_text_item", + text: "新建公共号", + cls: "plus-font", + width: 100, + height: 17, + handler: function () { + t._createAgentPopupPane({ + refreshAgentList: BI.bind(t.store.initAgentList, t.store), + title: "新建公共号" + }, !1) + } + }] + }, { + type: "bi.table_view", + cls: "weixin-table", + isNeedMerge: !1, + isNeedFreeze: !1, + columnSize: [234, 234, 234, "fill"], + items: [], + header: t.agent_management_table_header, + ref: function (e) { + t.agentTable = e + } + }, { + type: "bi.left_right_vertical_adapt", + height: 26, + tgap: 10, + items: { + right: [{ + type: "bi.horizontal", + items: [{ + type: "bi.icon_button", + width: 24, + height: 24, + cls: "page-button dec-pager-first-font", + handler: function () { + 1 < t.currentPage && (t.currentPage = 1, t.agentPageEditor.setValue(t.currentPage.toString()), t._populateWeiXinAgentTable(t.model.agentList, t.currentPage - 1), t._populateWeiXinPageNumberButtons(t.model.agentList)) + } + }, { + type: "bi.icon_button", + lgap: 5, + width: 24, + height: 24, + cls: "page-button dec-pager-prev-font", + disabled: !0, + ref: function (e) { + t.previousPageButton = e + }, + handler: function () { + 1 < t.currentPage && (t.currentPage -= 1, t.agentPageEditor.setValue(t.currentPage.toString()), t._populateWeiXinAgentTable(t.model.agentList, t.currentPage - 1), t._populateWeiXinPageNumberButtons(t.model.agentList)) + } + }, { + type: "bi.editor", + cls: "bi-border", + allowBlank: !0, + lgap: 5, + rgap: 5, + width: 40, + height: 24, + value: t.currentPage.toString(), + ref: function (e) { + t.agentPageEditor = e + }, + listeners: [{ + eventName: BI.Editor.EVENT_CONFIRM, action: function () { + this.getValue() > t.totalPage ? this.setValue(t.totalPage) : this.getValue() < 1 && this.setValue(1), t.currentPage = parseInt(this.getValue()), t._populateWeiXinAgentTable(t.model.agentList, t.currentPage - 1), t._populateWeiXinPageNumberButtons(t.model.agentList) + } + }] + }, {type: "bi.label", width: 5, height: 24, text: "/ "}, { + type: "bi.label", + height: 24, + lgap: 5, + text: "1", + ref: function (e) { + t.agentPageLabel = e + } + }, { + type: "bi.icon_button", + width: 24, + height: 24, + lgap: 5, + cls: "page-button dec-pager-next-font", + ref: function (e) { + t.nextPageButton = e + }, + handler: function () { + t.currentPage < t.totalPage && (t.currentPage += 1, t.agentPageEditor.setValue(t.currentPage.toString()), t._populateWeiXinAgentTable(t.model.agentList, t.currentPage - 1), t._populateWeiXinPageNumberButtons(t.model.agentList)) + } + }, { + type: "bi.icon_button", + width: 24, + height: 24, + lgap: 5, + cls: "page-button dec-pager-last-font", + handler: function () { + t.currentPage < t.totalPage && (t.currentPage = t.totalPage, t.agentPageEditor.setValue(t.currentPage.toString()), t._populateWeiXinAgentTable(t.model.agentList, t.currentPage - 1), t._populateWeiXinPageNumberButtons(t.model.agentList)) + } + }] + }] + } + }] + } + }, + _checkAgentListType: function (e) { + // for (var t = "", i = e, n = [], a = [], r = [], o = [], s = 0; s < i.length; s++) i[s].type === BI.Constants.getConstant("yt.constants").weixin_agent_type_unknown ? t = BI.i18nText("FS-YT_Unknown_Agent") : i[s].type === BI.Constants.getConstant("yt.constants").weixin_agent_type_management_group && (t = BI.i18nText("FS-YT_Management_Secret")), i[s].type !== BI.Constants.getConstant("yt.constants").weixin_agent_type_corp && (n.push(i[s].id), a.push(i[s].agentName), r.push(i[s].corpId), o.push(i[s].secret)); + // t && this._createAgentPopupPane({ + // id: n, + // agentName: a, + // corpId: r, + // secret: o, + // tipLabel: t, + // refreshAgentList: BI.bind(this.store.initAgentList, this.store), + // title: "新建公共号" + // }, !0) + }, + _populateYituanTable: function (e, t) { + for (var i = this, n = [], a = [], r = e, o = 10 * (t = t || 0), s = Math.min(o + 10, r.length), l = o; l < s; l++) n.push(function (t) { + return [ + { + type: "bi.label", + height: 32, + lgap: 5, + title: r[t].agentName, + text: r[t].agentName + }, + { + type: "bi.label", + height: 32, + lgap: 5, + title: r[t].clientId, + text: r[t].clientId + }, + { + type: "bi.label", + height: 32, + lgap: 5, + title: r[t].teamId, + text: r[t].teamId + }, + { + type: "bi.label", + height: 32, + lgap: 5, + title: r[t].groupId, + text: r[t].groupId + }, { + type: "bi.label", + height: 32, + lgap: 5, + title: r[t].secret, + text: r[t].secret + }, + { + type: "bi.left_right_vertical_adapt", + height: 32, + items: { + // left: [{type: "bi.label", lgap: 2.5, title: r[t].secret, text: r[t].secret, height: 32}], + left: [{ + type: "bi.icon_button", + cls: "edit-font", + rgap: 10, + height: 32, + handler: function () { + i._createYituanPopupPane({ + id: [r[t].id], + agentName: [r[t].agentName], + teamId: [r[t].teamId], + groupId: [r[t].groupId], + clientId: [r[t].clientId], + clientSecret: [r[t].secret], + refreshAgentList: BI.bind(i.store.initYituanList, i.store), + title: "编辑" + }, !1) + } + }, { + type: "bi.bubble_combo", + rgap: 10, + ref: function (e) { + a[t] = e + }, + el: {type: "bi.icon_button", cls: "delete-node-font", height: 32}, + stopPropagation: !0, + popup: { + type: "bi.bubble_bar_popup_view", + el: { + type: "bi.absolute", + height: 100, + items: [{ + el: { + type: "bi.label", + text: "确定删除该企业吗?", + textAlign: "left" + }, top: 25, right: 0, bottom: 0, left: 25 + }] + }, + maxHeight: 100, + minWidth: 250, + buttons: [{ + text: BI.i18nText("FS-YT_Confirm"), + value: l, + width: 80, + height: 24, + handler: function (e) { + i.store.deleteYituan(r[t].id), a[t].hideView() + } + }, + { + text: BI.i18nText("FS-YT_Cancel"), + level: "ignore", + value: l, + width: 80, + height: 24, + handler: function (e) { + a[t].hideView() + } + }] + } + }] + } + }] + }(l)); + i.yituanTable.populate(n); + Dec.YT.Util.formatTableStyle() + }, + _populateYituanPageNumberButtons: function (e) { + var t = e.length; + this.totalPage = Math.ceil(t / 10), 0 === this.totalPage && (this.totalPage = 1), this.agentPageLabel.setValue(this.totalPage), 1 === this.totalPage && 1 === this.currentPage ? (this.nextPageButton.setEnable(!1), this.previousPageButton.setEnable(!1)) : 1 === this.currentPage ? (this.nextPageButton.setEnable(!0), this.previousPageButton.setEnable(!1)) : (this.currentPage === this.totalPage ? this.nextPageButton.setEnable(!1) : this.nextPageButton.setEnable(!0), this.previousPageButton.setEnable(!0)) + }, + _populateWeiXinAgentTable: function (e, t) { + for (var i = this, n = [], a = [], r = e, o = 10 * (t = t || 0), s = Math.min(o + 10, r.length), l = o; l < s; l++) n.push(function (t) { + return [{ + type: "bi.label", + height: 32, + lgap: 5, + title: r[t].agentName, + text: r[t].agentName + }, + { + type: "bi.label", + height: 32, + lgap: 5, + title: r[t].agentId, + text: r[t].agentId + }, + + { + type: "bi.left_right_vertical_adapt", + height: 32, + items: { + // left: [{type: "bi.label", lgap: 2.5, title: r[t].secret, text: r[t].secret, height: 32}], + left: [{ + type: "bi.icon_button", + cls: "edit-font", + rgap: 10, + height: 32, + handler: function () { + i._createAgentPopupPane({ + id: [r[t].id], + agentName: [r[t].agentName], + corpId: [r[t].agentId], + secret: [r[t].secret], + refreshAgentList: BI.bind(i.store.initAgentList, i.store), + title: BI.i18nText("FS-YT_Modify_Agent") + }, !1) + } + }, { + type: "bi.bubble_combo", + rgap: 10, + ref: function (e) { + a[t] = e + }, + el: {type: "bi.icon_button", cls: "delete-node-font", height: 32}, + stopPropagation: !0, + popup: { + type: "bi.bubble_bar_popup_view", + el: { + type: "bi.absolute", + height: 100, + items: [{ + el: { + type: "bi.label", + text: "确定删除该公共号吗?", + textAlign: "left" + }, top: 25, right: 0, bottom: 0, left: 25 + }] + }, + maxHeight: 100, + minWidth: 250, + buttons: [{ + text: BI.i18nText("FS-YT_Confirm"), + value: l, + width: 80, + height: 24, + handler: function (e) { + i.store.deleteAgent(r[t].id), a[t].hideView() + } + }, { + text: BI.i18nText("FS-YT_Cancel"), + level: "ignore", + value: l, + width: 80, + height: 24, + handler: function (e) { + a[t].hideView() + } + }] + } + }] + } + }] + }(l)); + i.agentTable.populate(n), Dec.YT.Util.formatTableStyle() + }, + _populateWeiXinPageNumberButtons: function (e) { + var t = e.length; + this.totalPage = Math.ceil(t / 10), 0 === this.totalPage && (this.totalPage = 1), this.agentPageLabel.setValue(this.totalPage), 1 === this.totalPage && 1 === this.currentPage ? (this.nextPageButton.setEnable(!1), this.previousPageButton.setEnable(!1)) : 1 === this.currentPage ? (this.nextPageButton.setEnable(!0), this.previousPageButton.setEnable(!1)) : (this.currentPage === this.totalPage ? this.nextPageButton.setEnable(!1) : this.nextPageButton.setEnable(!0), this.previousPageButton.setEnable(!0)) + }, + _createYituanPopupPane: function (e, t) { + var i = this; + var that = this; + var n = BI.Constants.getConstant("yt.constants").popup_create_yituan + var a = BI.extend(e, { + type: "yt.create.yituan.popover", + noClose: t, + listeners: [{ + eventName: "EVENT_CLOSE", action: function () { + BI.Popovers.remove(n) + } + }, { + eventName: "EVENT_CONFIRM", action: function () { + var e = that.createYituanPopover.getValue(); + that.store.createYituan(e.agents, e.compatible) + } + }], + ref: function (e) { + i.createYituanPopover = e + } + }); + BI.Popovers.create(n, { + type: "yt.popover", + noClose: t, + header: { + type: "bi.left_vertical_adapt", + hgap: 5, + items: [{type: "bi.label", forceCenter: !0, text: e.title}] + }, + body: a, + width: 455, + height: 300, + listeners: [{ + eventName: "EVENT_CLOSE", action: function () { + BI.Popovers.remove(n) + } + }] + }).open(n), + $(".weixin-popup-cancel-button").css("border", "1px solid #3685F2") + .css("border-radius", "2px").css("color", "#3685F2"), + $(".weixin-popup-confirm-button").css("border-radius", "2px") + }, + _createAgentPopupPane: function (e, t) { + var i = this, n = BI.Constants.getConstant("yt.constants").popup_create_agent, + a = BI.extend(e, { + type: "yt.create.agent.popover", + noClose: t, + listeners: [{ + eventName: "EVENT_CLOSE", action: function () { + BI.Popovers.remove(n) + } + }, { + eventName: "EVENT_CONFIRM", action: function () { + var e = i.createAgentPopover.getValue(); + i.store.createAgent(e.agents, e.compatible) + } + }], + ref: function (e) { + i.createAgentPopover = e + } + }); + BI.Popovers.create(n, { + type: "yt.popover", + noClose: t, + header: { + type: "bi.left_vertical_adapt", + hgap: 5, + items: [{type: "bi.label", forceCenter: !0, text: e.title}] + }, + body: a, + width: 455, + height: 245, + listeners: [{ + eventName: "EVENT_CLOSE", action: function () { + BI.Popovers.remove(n) + } + }] + }).open(n), $(".weixin-popup-cancel-button").css("border", "1px solid #3685F2").css("border-radius", "2px").css("color", "#3685F2"), $(".weixin-popup-confirm-button").css("border-radius", "2px") + }, + + }); + BI.shortcut("yt.agentmanagement", e) + }(), + function () { + var e = BI.inherit(Fix.Model, { + context: ["agentList"], + state: function () { + return { + yituanList: [], + addResult: {}, + addYituanResult: {}, + reportServerUrl: null, + cloudServerUrl: "", + appId: "", + eid: "", + sendUserId: "", + appSecret: "", + readKey: "", + } + }, actions: { + saveReportServerUrl: function (e) { + Dec.YT.Util.ajax({ + url: "/yt/report/server/url", + type: "POST", + data: e, + complete: function (e, t) { + if ("success" === t) { + var i = BI.jsonDecode(e.responseText); + i.errorCode === Dec.YT.ERROR_CODE_OK ? BI.Msg.toast(BI.i18nText("Dec-Basic_Success")) : Dec.Msg.alert({message: Dec.YT.Util.handleCommonErr(i)}) + } + } + }) + }, + getReportServerUrl: function () { + var n = this; + Dec.YT.Util.ajax({ + url: "/yt/report/server/url", type: "GET", complete: function (e, t) { + if ("success" === t) { + var i = BI.jsonDecode(e.responseText); + if (i.errorCode === Dec.YT.ERROR_CODE_OK) { + n.model.reportServerUrl = i.reportServerUrl + n.model.cloudServerUrl = i.cloudServerUrl + n.model.appId = i.appId + n.model.eid = i.eid + n.model.appSecret = i.appSecret + n.model.readKey = i.readKey + n.model.sendUserId = i.sendUserId + } else { + Dec.Msg.alert({message: Dec.YT.Util.handleCommonErr(i)}) + } + } + } + }) + }, + initAgentList: function () { + var n = this; + Dec.YT.Util.ajax({ + url: "/yt/agent", type: "GET", complete: function (e, t) { + if ("success" === t) { + var i = BI.jsonDecode(e.responseText); + i.errorCode === Dec.YT.ERROR_CODE_OK ? n.model.agentList = i.agentList : Dec.Msg.alert({message: Dec.YT.Util.handleCommonErr(i)}) + } + } + }) + }, + initYituanList: function () { + var n = this; + Dec.YT.Util.ajax({ + url: "/yt/configList", type: "GET", complete: function (e, t) { + if ("success" === t) { + var i = BI.jsonDecode(e.responseText); + i.errorCode === Dec.YT.ERROR_CODE_OK ? n.model.yituanList = i.companys : Dec.Msg.alert({message: Dec.YT.Util.handleCommonErr(i)}) + } + } + }) + }, + createYituan: function (e, n) { + var a = this; + Dec.YT.Util.ajax({ + url: "/yt/configList", + type: "POST", + data: {companyArr: e}, + complete: function (e, t) { + if ("success" === t) { + var i = BI.jsonDecode(e.responseText); + i.errorCode === Dec.YT.ERROR_CODE_OK ? a.model.addYituanResult = { + success: !0, + compatible: n + } : a.model.addYituanResult = {errorText: Dec.YT.Util.handleCommonErr(i)} + } + } + }) + }, + createAgent: function (e, n) { + var a = this; + Dec.YT.Util.ajax({ + url: "/yt/agent", + type: "POST", + data: {agentArr: e}, + complete: function (e, t) { + if ("success" === t) { + var i = BI.jsonDecode(e.responseText); + i.errorCode === Dec.YT.ERROR_CODE_OK ? a.model.addResult = { + success: !0, + compatible: n + } : a.model.addResult = {errorText: Dec.YT.Util.handleCommonErr(i)} + } + } + }) + }, + deleteAgent: function (e) { + var n = this; + Dec.YT.Util.ajax({ + url: "/yt/agent?id=" + e, type: "DELETE", complete: function (e, t) { + if ("success" === t) { + var i = BI.jsonDecode(e.responseText); + i.errorCode === Dec.YT.ERROR_CODE_OK ? n.initAgentList() : Dec.Msg.alert({message: Dec.YT.Util.handleCommonErr(i)}) + } + } + }) + }, + deleteYituan: function (e) { + var n = this; + Dec.YT.Util.ajax({ + url: "/yt/configList?id=" + e, type: "DELETE", complete: function (e, t) { + if ("success" === t) { + var i = BI.jsonDecode(e.responseText); + i.errorCode === Dec.YT.ERROR_CODE_OK ? n.initYituanList() : Dec.Msg.alert({message: Dec.YT.Util.handleCommonErr(i)}) + } + } + }) + } + } + }); + BI.model("yt.model.agent.management", e) + }(), + + function () { + var e = BI.Constants.getConstant("yt.constants").department_tab_value, + i = BI.Constants.getConstant("yt.constants").tag_tab_value, t = BI.inherit(BI.Widget, { + _store: function () { + return BI.Models.getModel("yt.model.member.management") + }, watch: { + agentList: function () { + this._clearPageEditor() + }, depMember: function () { + this._populateWeiXinMemberTable(this.model.depMember); + this._populateWeiXinPageNumberButtons(this.model.depMember) + }, serverTableData: function () { + this.dataSetCombo.populate(this.model.serverTableData), this.dataSetCombo.setValue(this.model.matchConfig.dataSet), this.store.getDataSetColumn(this.dataSetCombo.getValue()) + }, tableDataColName: function () { + this.userIdCombo.populate(this.model.tableDataColName), this.userIdCombo.setValue(this.model.matchConfig.dataSetUserId), this.fsUserNameCombo.populate(this.model.tableDataColName), this.fsUserNameCombo.setValue(this.model.matchConfig.dataSetFsName) + } + }, render: function () { + var e = this; + return e.currentPage = 1, e.totalPage = 1, e.matchConfig = {}, e.fsUserNameComboGroup = [], e.member_management_table_header_non_fsusername = BI.Constants.getConstant("yt.constants.member.management.table.header.nonfsusername"), e.member_management_table_header_fsusername = BI.Constants.getConstant("yt.constants.member.management.table.header.fsusername"), e.matchingFsWayPane = e._createMatchingFsWayPane(), e.synMemberPane = e._createSynMemberPane(), { + type: "bi.vertical", + vgap: 14, + hgap: 14, + items: [{el: e.matchingFsWayPane}, {el: e.synMemberPane}] + } + }, mounted: function () { + this._refreshDepartmentData(); + Dec.YT.Util.formatTableStyle(), this.store.initData(), this._clearPageEditor(); + }, _createMatchingFsWayPane: function () { + var t = this; + return { + type: "bi.vertical", + cls: "weixin-section-container", + lgap: 14, + invisible: true,//隐藏避免缺少组件 + rgap: 14, + items: [{ + type: "bi.left_right_vertical_adapt", + height: 40, + cls: "bi-border-bottom", + items: { + left: [{ + type: "bi.label", + text: BI.i18nText("匹配方式"), + cls: "weixin-title" + }], + right: [{ + width: 80, + height: 24, + type: "bi.button", + text: BI.i18nText("FS-YT_Save"), + handler: function () { + t._checkValid() ? t.store._saveMatchingFSWayData({ + matchingFsWay: t.matchingFSWayCombo.getValue(), + dataSet: t.dataSetCombo.getValue(), + dataSetFsName: t.fsUserNameCombo.getValue(), + dataSetUserId: t.userIdCombo.getValue() + }) : Dec.Msg.alert({message: BI.i18nText("FS-YT_Match-Way-Not-Null")}) + } + }] + } + }, { + el: { + type: "bi.vertical_adapt", + items: [{ + type: "bi.label", + text: BI.i18nText("FS-YT_Match_Way"), + width: 116, + textAlign: "left" + }, { + type: "yt.editor_text_value_combo", + width: 150, + height: 24, + items: [ + { + text: "手工匹配", + value: 2 + }, { + text: "手机号匹配", + value: 1 + }, { + text: "员工编号", + value: 3 + } + + ], + ref: function (e) { + t.matchingFSWayCombo = e + }, + listeners: [{ + eventName: "EVENT_CHANGE", action: function () { + switch (this.getValue()) { + case 0: + case 1: + t.dataSetContainer.setVisible(false), t.memberTableNonFsUserName.setVisible(!0), t.memberTableWithFsUserName.setVisible(!1); + break; + case 2: + t.dataSetContainer.setVisible(false), t.memberTableNonFsUserName.setVisible(!1), t.memberTableWithFsUserName.setVisible(!0); + break; + case 3: + t.dataSetContainer.setVisible(true), t.memberTableNonFsUserName.setVisible(!0), t.memberTableWithFsUserName.setVisible(!1) + } + t._refreshDepartmentData() + } + }] + }] + }, vgap: 10 + }, { + el: { + type: "bi.vertical_adapt", + cls: "weixin-matching-fs-way-pane-row-gap", + invisible: !0, + items: [{ + type: "bi.label", + text: BI.i18nText("FS-YT_Match_Setting"), + width: 116, + textAlign: "left" + }, { + type: "yt.editor_text_value_combo", + width: 150, + height: 24, + rgap: 10, + watermark: BI.i18nText("FS-YT_DataSet"), + items: [], + ref: function (e) { + t.dataSetCombo = e + }, + listeners: [{ + eventName: BI.TextValueCombo.EVENT_CHANGE, action: function () { + t.store.getDataSetColumn(this.getValue()) + } + }] + }, { + type: "yt.editor_text_value_combo", + width: 150, + height: 24, + rgap: 10, + watermark: BI.i18nText("FS-YT_UserId"), + items: t.model.tableDataColName, + ref: function (e) { + t.userIdCombo = e + } + }, { + type: "yt.editor_text_value_combo", + width: 150, + height: 24, + rgap: 10, + watermark: BI.i18nText("FS-YT_FsUserName"), + items: t.model.tableDataColName, + ref: function (e) { + t.fsUserNameCombo = e + } + }], + ref: function (e) { + t.dataSetContainer = e + } + }, vgap: 10 + }] + } + }, _createSynMemberPane: function () { + var t = this; + return { + type: "bi.vertical", + cls: "weixin-section-container", + lgap: 14, + rgap: 14, + items: [{ + type: "bi.left_right_vertical_adapt", + cls: "bi-border-bottom", + height: 40, + items: { + left: [{ + type: "bi.label", + text: BI.i18nText("FS-YT_Address_Book"), + cls: "weixin-title" + }] + } + }, { + type: "bi.left_right_vertical_adapt", + height: 54, + items: { + left: [{ + type: "bi.icon_text_item", + text: BI.i18nText("FS-YT_Member_Update"), + cls: "weixin-refresh-font", + width: 90, + height: 20, + handler: function () { + t.synMember() + } + } + // , { + // type: "bi.text_button", + // cls: "weixin-member-auto-update-button", + // text: BI.i18nText("FS-YT_Set_Update"), + // handler: function () { + // t.store._getScheduleTaskConfig(function (e) { + // t._createAutoUpdateMemberPopupPane({ + // executeTimingTask: e.executeTimingTask, + // timingTaskFrequencyType: e.timingTaskFrequencyType, + // timingTaskStartDay: e.timingTaskStartDay, + // timingTaskStartHour: e.timingTaskStartHour, + // timingTaskStartMinute: e.timingTaskStartMinute + // }) + // }) + // } + // } + ], right: [{ + type: "bi.search_editor", width: 150, height: 24, ref: function (e) { + t.weixinMemberSearchEditor = e + }, listeners: [{ + eventName: BI.SearchEditor.EVENT_CLEAR, action: function () { + t._refreshDepartmentData() + } + }, { + eventName: BI.Editor.EVENT_CONFIRM, action: function () { + t._refreshDepartmentData() + } + }] + }] + } + }, { + type: "bi.htape", + height: 456, + cls: "bi-border-top", + items: [{ + type: "yt.member.management.tab", + cls: "bi-border-right", + invisible: true, + width: 0, + ref: function (e) { + t.treeManagementPane = e + }, + refreshDepartmentData: BI.bind(t._refreshDepartmentData, t), + clearPageEditor: BI.bind(t._clearPageEditor, t) + }, { + type: "bi.vertical", + items: [{ + type: "bi.preview_table", + lgap: 10, + tgap: 10, + cls: "weixin-table", + isNeedMerge: !1, + isNeedFreeze: !1, + columnSize: [.264, .264, .264, .208], + header: t.member_management_table_header_non_fsusername, + items: [], + ref: function (e) { + t.memberTableNonFsUserName = e + } + }, { + type: "bi.preview_table", + lgap: 10, + tgap: 10, + cls: "weixin-table", + isNeedMerge: !1, + isNeedFreeze: !1, + columnSize: [.212, .212, .212, .212, .153], + header: t.member_management_table_header_fsusername, + invisible: !0, + items: [], + ref: function (e) { + t.memberTableWithFsUserName = e + } + }, { + type: "bi.left_right_vertical_adapt", + tgap: 10, + height: 26, + items: { + right: [{ + type: "bi.horizontal", + items: [{ + type: "bi.icon_button", + width: 24, + height: 24, + cls: "page-button dec-pager-first-font", + handler: function () { + 1 < t.currentPage && (t.currentPage = 1, t.memberPageEditor.setValue(t.currentPage.toString()), t._refreshDepartmentData()) + } + }, { + type: "bi.icon_button", + width: 24, + height: 24, + lgap: 5, + cls: "page-button dec-pager-prev-font", + disabled: !0, + ref: function (e) { + t.previousPageButton = e + }, + handler: function () { + 1 < t.currentPage && (t.currentPage -= 1, t.memberPageEditor.setValue(t.currentPage.toString()), t._refreshDepartmentData()) + } + }, { + type: "bi.editor", + cls: "bi-border", + allowBlank: !0, + width: 40, + height: 24, + lgap: 5, + rgap: 5, + value: t.currentPage.toString(), + ref: function (e) { + t.memberPageEditor = e + }, + listeners: [{ + eventName: BI.Editor.EVENT_CONFIRM, action: function () { + this.getValue() > t.totalPage ? this.setValue(t.totalPage) : this.getValue() < 1 && this.setValue(1), t.currentPage = parseInt(this.getValue()), t._refreshDepartmentData() + } + }] + }, {type: "bi.label", width: 5, height: 24, text: "/ "}, { + type: "bi.label", + height: 24, + lgap: 5, + text: "1", + ref: function (e) { + t.memberPageLabel = e + } + }, { + type: "bi.icon_button", + width: 24, + height: 24, + lgap: 5, + cls: "page-button dec-pager-next-font", + ref: function (e) { + t.nextPageButton = e + }, + handler: function () { + t.currentPage < t.totalPage && (t.currentPage += 1, t.memberPageEditor.setValue(t.currentPage.toString()), t._refreshDepartmentData()) + } + }, { + type: "bi.icon_button", + width: 24, + height: 24, + lgap: 5, + cls: "page-button dec-pager-last-font", + handler: function () { + t.currentPage < t.totalPage && (t.currentPage = t.totalPage, t.memberPageEditor.setValue(t.currentPage.toString()), t._refreshDepartmentData()) + } + }] + }] + } + }] + }] + }] + } + }, _refreshDepartmentData: function () { + this.store.getDepMemberData({ + depId: "", + keyword: this.weixinMemberSearchEditor.getValue(), + startIdx: 10 * (this.currentPage - 1) + }) + }, _populateWeiXinPageNumberButtons: function (e) { + var t = e.userList.total; + this.totalPage = t ? Math.ceil(t / 10) : 1, this.memberPageLabel.setValue(this.totalPage), 1 === this.totalPage && 1 === this.currentPage ? (this.nextPageButton.setEnable(!1), this.previousPageButton.setEnable(!1)) : 1 === this.currentPage ? (this.nextPageButton.setEnable(!0), this.previousPageButton.setEnable(!1)) : (this.currentPage === this.totalPage ? this.nextPageButton.setEnable(!1) : this.nextPageButton.setEnable(!0), this.previousPageButton.setEnable(!0)) + }, _populateWeiXinMemberTable: function (e) { + var t, i = this, n = [], a = [], r = e.userList.users ? e.userList.users : []; + for (var o = 0; o < r.length; o++) { + a.push([ + { + type: "bi.label", + text: r[o].id, lgap: 5, height: 32 + }, + { + type: "bi.label", + text: r[o].name, + lgap: 5, + height: 32 + }, {type: "bi.label", text: r[o].phone, lgap: 5, height: 32}, + ]) + } + i.memberTableNonFsUserName.populate(a) + Dec.YT.Util.formatTableStyle() + }, _createAutoUpdateMemberPopupPane: function (e) { + var t = BI.Constants.getConstant("yt.constants").popup_auto_update_member, i = BI.extend(e, { + type: "yt.schedule.task.popover", + listeners: [{ + eventName: "EVENT_CLOSE", action: function () { + BI.Popovers.remove(t) + } + }] + }); + BI.Popovers.create(t, { + cls: "weixin-container", + header: { + type: "bi.left_vertical_adapt", + hgap: 5, + items: [{type: "bi.label", forceCenter: !0, text: BI.i18nText("FS-YT_Set_Update")}] + }, + body: i, + width: 455, + height: 245, + listeners: [{ + eventName: "EVENT_CLOSE", action: function () { + BI.Popovers.remove(t) + } + }] + }).open(t), $(".weixin-popup-cancel-button").css("border", "1px solid #3685F2").css("border-radius", "2px").css("color", "#3685F2"), $(".weixin-popup-confirm-button").css("border-radius", "2px"), $(".weixin-auto-update-popup-content").css("top", "10px"), $(".weixin-popup-south-container").css("right", "0px").css("left", "0px") + }, _getDepTree: function () { + return this.treeManagementPane._getDepTree() + }, _getTagTree: function () { + return this.treeManagementPane._getTagTree() + }, _getWeiXinMemberTab: function () { + return this.treeManagementPane._getTab() + }, _clearPageEditor: function () { + this.memberPageEditor.setValue(1), this.currentPage = 1, this.nextPageButton.setEnable(!0), this.previousPageButton.setEnable(!1) + }, synMember: function () { + var e = this; + e.store.synMemberData(function () { + e.treeManagementPane.caculateTree() + }) + }, _checkValid: function () { + return this.matchingFSWayCombo.getValue() !== BI.Constants.getConstant("yt.constants").matching_fs_way_dataSet || !(Dec.YT.Util.isEmpty(this.dataSetCombo.getValue()) || Dec.YT.Util.isEmpty(this.fsUserNameCombo.getValue()) || Dec.YT.Util.isEmpty(this.userIdCombo.getValue())) + } + }); + BI.shortcut("yt.membermanagement", t) + }(), function () { + var e = BI.inherit(Fix.Model, { + childContext: ["depMember", "tagMember"], state: function () { + return {depMember: [], tagMember: [], matchConfig: {}, serverTables: [], tableColNames: []} + }, computed: { + serverTableData: function () { + return BI.map(this.model.serverTables, function (e, t) { + return {text: t.dataSetName, value: t.dataSetValue} + }) + }, tableDataColName: function () { + return BI.map(this.model.tableColNames, function (e, t) { + return {text: t.columnName, value: t.columnValue} + }) + } + }, actions: { + initData: function () { + var n = this; + Dec.YT.Util.ajax({ + url: "/yt/match/method", type: "GET", complete: function (e, t) { + if ("success" === t) { + var i = BI.jsonDecode(e.responseText); + i.errorCode === Dec.YT.ERROR_CODE_OK ? (n.model.matchConfig = i, Dec.reqGet("/v10/serverdatasets", {}, function (e) { + n.model.serverTables = e.data + })) : Dec.Msg.alert({message: Dec.YT.Util.handleCommonErr(i)}) + } + } + }) + }, _saveMatchingFSWayData: function (e) { + Dec.YT.Util.ajax({ + url: "/yt/match/method", type: "POST", data: e, complete: function (e, t) { + if ("success" === t) { + var i = BI.jsonDecode(e.responseText); + i.errorCode === Dec.YT.ERROR_CODE_OK ? BI.Msg.toast(BI.i18nText("Dec-Basic_Success")) : Dec.Msg.alert({message: Dec.YT.Util.handleCommonErr(i)}) + } + } + }) + }, _getScheduleTaskConfig: function (n) { + var a = this; + Dec.YT.Util.ajax({ + url: "/weixin/timing/task", type: "GET", data: {}, complete: function (e, t) { + if ("success" === t) { + var i = BI.jsonDecode(e.responseText); + i.errorCode === Dec.YT.ERROR_CODE_OK ? BI.isFunction(n) && n.call(a, i) : Dec.Msg.alert({message: Dec.YT.Util.handleCommonErr(i)}) + } + } + }) + }, _saveFsUserRelationData: function (n, e) { + var t = n.userid, i = n.id, a = {weiXinUser: t, fsUser: BI.isEmpty(e) ? "" : e}; + BI.isEmpty(i) || (a.id = i), Dec.YT.Util.ajax({ + url: "/yt/user/relation", + type: "POST", + data: a, + complete: function (e, t) { + if ("success" === t) { + var i = BI.jsonDecode(e.responseText); + i.errorCode === Dec.YT.ERROR_CODE_OK ? (n.id = i.id, BI.Msg.toast(BI.i18nText("Dec-Basic_Success"))) : Dec.Msg.alert({message: Dec.YT.Util.handleCommonErr(i)}) + } + } + }) + }, getDataSetColumn: function (e) { + var i = this; + Dec.reqGet("/v10/" + e + "/datasetcolumns", {}, function (e) { + var t = e.data; + t && (i.model.tableColNames = t) + }) + }, getDepMemberData: function (e) { + var n = this, t = "", i = "", a = "", r = "", o = 0, s = 10, l = e; + l instanceof Object && (t = l.keyword || "", i = l.corpId || "", a = l.secret || "", r = l.depId || "", o = l.startIdx || 0, s = l.count || 10); + var c = BI.Constants.getConstant("yt.constants").popup_loading_syn_users, + u = Dec.YT.Util.showLoading(".weixin-member-management-container", BI.i18nText("FS-YT_Loading"), c); + Dec.YT.Util.ajax({ + url: "/yt/dep/member", + type: "POST", + data: {keyword: t, corpId: i, depId: r, startIdx: o, count: s}, + complete: function (e, t) { + if (u.remove(c), "success" === t) { + var i = BI.jsonDecode(e.responseText); + i.errorCode === Dec.YT.ERROR_CODE_OK ? n.model.depMember = i : Dec.Msg.alert({message: Dec.YT.Util.handleCommonErr(i)}) + } + } + }) + }, getTagMemberData: function (e) { + var n = this, t = "", i = "", a = "", r = 0, o = 10, s = e; + s instanceof Object && (t = s.keyword || "", i = s.corpId || "", a = s.tagId || "", r = s.startIdx || 0, o = s.count || 10); + var l = BI.Constants.getConstant("yt.constants").popup_loading_syn_users, + c = Dec.YT.Util.showLoading(".weixin-member-management-container", BI.i18nText("FS-YT_Loading"), l); + Dec.YT.Util.ajax({ + url: "/weixin/tag/member", + type: "POST", + data: {keyword: t, corpId: i, tagId: a, startIdx: r, count: o}, + complete: function (e, t) { + if (c.remove(l), "success" === t) { + var i = BI.jsonDecode(e.responseText); + i.errorCode === Dec.YT.ERROR_CODE_OK ? n.model.tagMember = i : Dec.Msg.alert({message: Dec.YT.Util.handleCommonErr(i)}) + } + } + }) + }, synMemberData: function (e) { + Dec.YT.Util.synMemberData(function () { + BI.isFunction(e) && e() + }) + } + } + }); + BI.model("yt.model.member.management", e) + }(), function () { + var i = BI.inherit(BI.Trigger, { + _const: {hgap: 4}, _defaultConfig: function () { + var e = i.superclass._defaultConfig.apply(this, arguments); + return BI.extend(e, { + baseCls: (e.baseCls || "") + " bi-editor-trigger bi-border", + height: 24, + allowBlank: !1, + watermark: "", + errorText: "", + editable: !1, + items: [] + }) + }, _init: function () { + this.options.height -= 2, i.superclass._init.apply(this, arguments); + var e = this, t = this.options; + this._const; + this.editor = BI.createWidget({ + type: "yt.sign_editor", + height: t.height, + value: t.value, + allowBlank: t.allowBlank, + watermark: t.watermark, + errorText: t.errorText, + editable: t.editable, + items: t.items + }), this.editor.on(BI.Controller.EVENT_CHANGE, function () { + e.fireEvent(BI.Controller.EVENT_CHANGE, arguments) + }), this.editor.on(BI.SignEditor.EVENT_CHANGE, function () { + e.fireEvent(i.EVENT_CHANGE, arguments) + }), BI.createWidget({ + element: this, + type: "bi.htape", + items: [{el: this.editor}, { + el: {type: "bi.trigger_icon_button", width: t.triggerWidth || t.height}, + width: t.triggerWidth || t.height + }] + }) + }, populate: function (e) { + this.editor.options.items = e + }, getValue: function () { + return this.editor.getValue() + }, setValue: function (e) { + this.editor.setValue(e) + }, setText: function (e) { + this.editor.setState(e) + } + }); + i.EVENT_CHANGE = "EVENT_CHANGE", BI.shortcut("yt.editor_trigger", i) + }(), function () { + var t = BI.inherit(BI.Trigger, { + props: {baseCls: "bi-search-text-value-trigger", height: 30}, render: function () { + var e = this, r = this.options; + return { + type: "bi.htape", items: [{ + el: { + type: "bi.searcher", + ref: function () { + e.searcher = this + }, + isAutoSearch: !1, + el: { + type: "yt.state_editor", ref: function () { + e.editor = this + }, text: this._digest(r.value, r.items), value: r.value, height: r.height + }, + popup: { + type: "bi.search_text_value_combo_popup", + cls: "bi-card", + chooseType: BI.ButtonGroup.CHOOSE_TYPE_SINGLE + }, + onSearch: function (e, t) { + var i = e.keyword, n = BI.Func.getSearchResult(r.items, i), a = n.matched; + t(n.finded, a) + }, + listeners: [{ + eventName: BI.Searcher.EVENT_CHANGE, action: function () { + e.fireEvent(t.EVENT_CHANGE) + } + }] + } + }, {el: {type: "bi.layout", width: 30}, width: 30}] + } + }, _setState: function (e) { + this.editor.setState(e) + }, _digest: function (i, e) { + var t = this.options; + i = BI.isArray(i) ? i : [i]; + var n = [], a = BI.Tree.transformToArrayFormat(e); + return BI.each(a, function (e, t) { + BI.deepContains(i, t.value) && !n.contains(t.text || t.value) && n.push(t.text || t.value) + }), 0 < n.length ? n.join(",") : t.text + }, stopEditing: function () { + this.searcher.stopSearch() + }, getSearcher: function () { + return this.searcher + }, populate: function (e) { + this.options.items = e + }, setValue: function (e) { + this._setState(this._digest(e, this.options.items)) + }, getValue: function () { + return this.searcher.getValue() + } + }); + t.EVENT_SEARCHING = "EVENT_SEARCHING", t.EVENT_STOP = "EVENT_STOP", t.EVENT_START = "EVENT_START", t.EVENT_CHANGE = "EVENT_CHANGE", BI.shortcut("yt.search_text_value_trigger", t) + }(), function () { + var t = BI.inherit(BI.BasicButton, { + props: { + baseCls: "bi-line-segment-button bi-list-item-effect cursor-pointer", + once: !0, + readonly: !0, + hgap: 10, + height: 25 + }, render: function () { + var e = this.options; + this.text = BI.createWidget({ + type: "bi.label", + element: this, + text: e.text, + width: e.width, + height: e.height, + value: e.value, + hgap: e.hgap + }), this.line = BI.createWidget({ + type: "bi.layout", + cls: "line-segment-button-line", + height: 2 + }), BI.createWidget({ + type: "bi.absolute", + element: this, + items: [{el: this.line, left: e.hgap - 1, right: e.hgap - 1, bottom: 0}] + }) + }, setSelected: function (e) { + t.superclass.setSelected.apply(this, arguments), e ? this.line.element.addClass("bi-high-light-background") : this.line.element.removeClass("bi-high-light-background") + }, setText: function (e) { + t.superclass.setText.apply(this, arguments), this.text.setText(e) + }, destroy: function () { + t.superclass.destroy.apply(this, arguments) + } + }); + BI.shortcut("yt.line_segment_button", t) + }(), function () { + var n = BI.inherit(BI.Widget, { + props: { + baseCls: "decision-line-segment", + items: [], + height: 30, + layouts: [{type: "bi.horizontal"}], + defaultValue: null + }, render: function () { + var i = this, e = this.options; + BI.isNumber(e.height) && this.element.css({ + height: e.height, + lineHeight: e.height + "px" + }), this.buttonGroup = BI.createWidget({ + element: this, + type: "bi.button_group", + items: BI.createItems(e.items, {type: "yt.line_segment_button", height: e.height}), + layouts: e.layouts + }), this.buttonGroup.on(BI.Controller.EVENT_CHANGE, function () { + i.fireEvent(BI.Controller.EVENT_CHANGE, arguments) + }), this.buttonGroup.on(BI.ButtonGroup.EVENT_CHANGE, function (e, t) { + i.fireEvent(n.EVENT_CHANGE, e, t) + }), BI.isNull(e.defaultValue) || this.setValue(e.defaultValue) + }, setValue: function (e) { + this.buttonGroup.setValue(e) + }, setEnabledValue: function (e) { + this.buttonGroup.setEnabledValue(e) + }, getValue: function () { + return this.buttonGroup.getValue() + }, populate: function (e) { + var t = this.options; + this.buttonGroup.populate(BI.createItems(e, {type: "yt.line_segment_button", height: t.height})) + } + }); + n.EVENT_CHANGE = "EVENT_CHANGE", BI.shortcut("yt.line_segment", n) + }(), (function () { + //YTSystemOption 的id + Dec.Plugin.Management.addItem({ + id: "YTSystemOption", + value: "YTSystemOption", + displayName: "xx管理", + cls: "setting-font", + cardType: "dec.plugin.yt" + }) + })() + , function () { + var e = BI.inherit(BI.Widget, { + render: function () { + return {type: "yt.Tab", cls: "weixin-container"} + } + }); + BI.shortcut("dec.plugin.yt", e) + }(); + }) +(); + \ No newline at end of file diff --git a/src/main/resources/com/fr/plugin/web/login.tpl b/src/main/resources/com/fr/plugin/web/login.tpl new file mode 100644 index 0000000..1dc9c66 --- /dev/null +++ b/src/main/resources/com/fr/plugin/web/login.tpl @@ -0,0 +1,102 @@ + + + Auth + + + + + + + + + +

页面加载中,正在获取认证代码...2

+

+ + + + diff --git a/src/main/resources/com/fr/plugin/yt/local/i18.properties b/src/main/resources/com/fr/plugin/yt/local/i18.properties new file mode 100644 index 0000000..c3f3d5c --- /dev/null +++ b/src/main/resources/com/fr/plugin/yt/local/i18.properties @@ -0,0 +1,152 @@ +FS-Module-WeiXin_Manager=\u5FAE\u4FE1\u7BA1\u7406 +FS-YT_Basic=\u57FA\u672C\u4FE1\u606F +FS-Schedule-Notification_WeiXin=\u63A8\u9001\u5FAE\u4FE1\u6D88\u606F +FS-Schedule-Notification_WeiXin_CorpID=\u4F01\u4E1A\u5E94\u7528ID\uFF1A +FS-Schedule-Notification_WeiXin_Users=\u5FAE\u4FE1\u7528\u6237\uFF1A +FS-Schedule-Notification_WeiXin_DepID=\u90E8\u95E8ID\uFF1A +FS-Schedule-Notification_WeiXin_Content=\u6D88\u606F\u5185\u5BB9\uFF1A +FS-Schedule-Notification_WeiXin_WithLink=\u5B9A\u65F6\u7ED3\u679C\u8BBF\u95EE\u94FE\u63A5 +FS-Schedule_Mobile-Push-WeiXinId-Not-Null=\u8BF7\u8BBE\u7F6E\u63A8\u9001\u7684\u5FAE\u4FE1\u5E94\u7528 +FS-YT_Recive_Data_URL=\u63A5\u6536\u6570\u636EURL +FS-YT_Corp_ID=\u5FAE\u4FE1\u4F01\u4E1A\u53F7ID +FS-YT_Secret=\u5FAE\u4FE1\u5E94\u7528\u79D8\u94A5 +FS-YT_Member_Management=\u5FAE\u4FE1\u6210\u5458\u7BA1\u7406 +FS-YT_User_Same_With_FS=\u5FAE\u4FE1\u53F7\u5339\u914D +FS-YT_Mobile_Same_With_FS=\u624B\u673A\u8D26\u53F7\u5339\u914D +FS-YT_Manual_Matching_FS=\u624B\u52A8\u5339\u914D +FS-YT_Custom_Matching_FS=\u81EA\u5B9A\u4E49\u5339\u914D +FS-YT_UserID=\u5FAE\u4FE1\u6210\u5458\u540D +FS-YT_FSUserName=\u62A5\u8868\u7528\u6237\u540D +FS-YT_Name=\u59D3\u540D +FS-YT_Department=\u5FAE\u4FE1\u90E8\u95E8 +FS-YT_UrlHint=\u670D\u52A1\u5668\u4FDD\u5B58\u7684Url: +FS-YT_Refresh_User=\u66F4\u65B0\u901A\u8BAF\u5F55 +FS-YT_Mobile=\u5FAE\u4FE1\u6210\u5458\u624B\u673A\u53F7 +FS-YT_Matching_Way=\u7528\u6237\u5339\u914D\u65B9\u5F0F +FS-YT_Hint=\u63D0\u793A +FS-YT_Loading=\u6B63\u5728\u52A0\u8F7D\u7528\u6237... +FS-YT_Mobile_Not_Supported=\u5F53\u524DHTML5\u62A5\u8868\u4E0D\u652F\u6301\u6839\u636E\u624B\u673A\u53F7\u5339\u914D\uFF0C\u8BF7\u5347\u7EA7HTML5\u63D2\u4EF6 +FS-YT_Mobile-Push-WeiXin-Terminal=\u5FAE\u4FE1\u901A\u77E5 +FS-YT_Mobile-Push-WeiXin-AgentID=\u5E94\u7528ID +FS-YT_Expired_Error=\u9519\u8BEF\u4EE3\u7801:11100016 \u60A8\u4F7F\u7528\u4E86\u672A\u6CE8\u518C\u7684\u529F\u80FD\u2014\u2014\u5FAE\u4FE1\u96C6\u6210 +FS-YT_Expired_Solution=\u5FAE\u4FE1\u529F\u80FD\u672A\u6CE8\u518C\uFF0C\u5982\u9700\u4F7F\u7528\u8BF7\u8054\u7CFB\u9500\u552E +FS-YT_Agent_Management=\u5E94\u7528\u7BA1\u7406 +FS-YT_Member_Manage=\u6210\u5458\u7BA1\u7406 +FS-YT_Agent_Config=\u5E94\u7528\u5FEB\u6377\u914D\u7F6E +FS-YT_Agent_Name=\u4F01\u4E1A\u5E94\u7528\u540D\u79F0 +FS-YT_Enterprise_WeChat=\u4F01\u4E1A\u5FAE\u4FE1 +FS-YT_New_Agent=\u65B0\u5EFA\u5E94\u7528 +FS-YT_ReportServer=\u62A5\u8868\u670D\u52A1\u5668 +FS-YT_ReportServer_Url=\u62A5\u8868\u670D\u52A1\u5668\u5730\u5740 +FS-YT_ReportServer_Tip=\u8BF7\u4F7F\u7528\u4E8C\u7EA7\u6216\u4E8C\u7EA7\u4EE5\u4E0A\u57DF\u540D\uFF0C\u4E14\u9700\u901A\u8FC7ICP\u5907\u6848\uFF0C\u7AEF\u53E3\u63A8\u8350\u4F7F\u752880\u6216443 +FS-YT_Save=\u4FDD\u5B58 +FS-YT_DeleteAgent_Confirm_Popup=\u786E\u5B9A\u5220\u9664\u6B64\u4F01\u4E1A\u5FAE\u4FE1\u5E94\u7528 +FS-YT_Confirm=\u786E\u5B9A +FS-YT_Cancel=\u53D6\u6D88 +FS-YT_Create_WeiXin_Url=\u751F\u6210\u5FAE\u4FE1\u94FE\u63A5 +FS-YT_WeiXin_Url=\u5FAE\u4FE1\u94FE\u63A5 +FS-YT_Platform_Page=\u94FE\u63A5\u9875\u9762 +FS-YT_Platform=\u51B3\u7B56\u5E73\u53F0 +FS-YT_Platform_Report=\u5355\u4E2A\u6A21\u677F +FS-YT_Create_Url=\u751F\u6210\u94FE\u63A5 +FS-YT_Copy_Url=\u590D\u5236 +FS-YT_Modify_Agent=\u4FEE\u6539\u4F01\u4E1A\u5FAE\u4FE1 +FS-YT_Attention=\u6CE8\u610F +FS-YT_CreateAgent_Not_Null=\u5FAE\u4FE1\u5E94\u7528\u540D\u79F0\uFF0CCorpID\uFF0C\u7BA1\u7406\u7EC4\u51ED\u8BC1\u79D8\u94A5\u4E0D\u53EF\u4E3A\u7A7A +BI-Basic_Search=\u641C\u7D22 +FS-YT_Default_Agent_Name=FineReport\u4F01\u4E1A\u5E94\u7528 +FS-YT_Default_Schedule_Agent_Name=\u5E94\u7528(\u5B9A\u65F6\u63A8\u9001) +FS-YT_Unknown_Agent=\u7F51\u7EDC\u5F02\u5E38\u6216\u8005\u8BF7\u786E\u8BA4\u5F53\u524D\u4F7F\u7528\u7684CorpId\u548CSecret\u662F\u5426\u6B63\u786E(\u82E5\u4E3A\u7BA1\u7406\u7EC4\u5BC6\u94A5\uFF0C\u8BF7\u6539\u4E3A\u5E94\u7528Secret) +FS-YT_Management_Secret=\u60A8\u5F53\u524D\u5E94\u7528\u7684secret\u4E3A\u7BA1\u7406\u7EC4secret\uFF0C\u4E3A\u4E86\u60A8\u6B63\u5E38\u4F7F\u7528\u5FAE\u4FE1\u96C6\u6210\u529F\u80FD\uFF0C\u8BF7\u66FF\u6362\u4E3A\u5E94\u7528secret +FS-YT_Copy_Success=\u590D\u5236\u6210\u529F +FS-YT_Match_Way=\u5339\u914D\u65B9\u5F0F +FS-YT_Match_Setting=\u5339\u914D\u8BBE\u7F6E +FS-YT_DataSet=\u6570\u636E\u96C6 +FS-YT_UserId=\u5FAE\u4FE1\u7528\u6237\u540D +FS-YT_FsUserName=\u62A5\u8868\u7528\u6237\u540D +FS-YT_Address_Book=\u901A\u8BAF\u5F55 +FS-YT_Member_Update=\u7ACB\u5373\u66F4\u65B0 +FS-YT_Set_Update=\u8BBE\u7F6E\u81EA\u52A8\u66F4\u65B0 +FS-YT_Start_Update=\u542F\u7528\u81EA\u52A8\u66F4\u65B0 +FS-YT_Per=\u6BCF +FS-YT_Day=\u5929 +FS-YT_Week=\u5468 +FS-YT_Hour=\u65F6 +FS-YT_Minute=\u5206 +FS-YT_Monday=\u5468\u4E00 +FS-YT_Tuesday=\u5468\u4E8C +FS-YT_Wednesday=\u5468\u4E09 +FS-YT_Thursday=\u5468\u56DB +FS-YT_Friday=\u5468\u4E94 +FS-YT_Saturday=\u5468\u516D +FS-YT_Sunday=\u5468\u65E5 +FS-YT_Update_Once=\u5B9A\u65F6\u540C\u6B65\u4E00\u6B21 +FS-YT_Not_Null=\u4E0D\u5141\u8BB8\u4E3A\u7A7A +FS-YT_Save_Agent_Fail=\u5B58\u50A8\u5E94\u7528\u4FE1\u606F\u5931\u8D25 +FS-YT_Agent_Name_Exist=\u5E94\u7528\u540D\u79F0\u5DF2\u5B58\u5728 +FS-YT_Secret_Exist=secret\u5DF2\u5B58\u5728 +FS-YT_Organizational_Structure=\u7EC4\u7EC7\u67B6\u6784 +FS-YT_Tag=\u6807\u7B7E +FS-YT_Illegal=\u4E0D\u5408\u6CD5 +FS-YT_Proxy=\u5FAE\u4FE1\u4EE3\u7406\u8DF3\u8F6C +FS-YT_Proxy_Address=\u4EE3\u7406\u670D\u52A1\u5668\u5730\u5740 +FS-YT_Test_Proxy_Address=\u6D4B\u8BD5\u8FDE\u63A5 +FS-YT_Connection_Success=\u8FDE\u63A5\u6210\u529F +FS-YT_Connection_Fail=\u8FDE\u63A5\u5931\u8D25 +FS-YT_Test_Connection=\u6D4B\u8BD5\u8FDE\u63A5\u4E2D... +FS-YT_Agent_Quick_Config=\u4E3B\u9875\u578B\u5E94\u7528\u5FEB\u901F\u914D\u7F6E +FS-YT_One_Key_Config=\u4E00\u952E\u914D\u7F6E +FS-YT_One_Key_Config_Tip=\u5F53\u524D\u5E94\u7528\u5DF2\u914D\u7F6E\u4E3B\u9875\u6216\u83DC\u5355\uFF0C\u7EE7\u7EED\u914D\u7F6E\u5C06\u6E05\u7A7A\u539F\u59CB\u8BBE\u7F6E +FS-YT_Adress_Book_Secret=\u901A\u8BAF\u5F55\u7BA1\u7406secret +FS-YT_Import_Adress_Book=\u5BFC\u5165\u5FAE\u4FE1\u901A\u8BAF\u5F55 +FS-YT_Syn_Adress_Book=\u540C\u6B65\u62A5\u8868\u901A\u8BAF\u5F55\u5230\u5FAE\u4FE1 +FS-YT_Env_Check=\u5FAE\u4FE1\u96C6\u6210\u73AF\u5883\u914D\u7F6E\u68C0\u6D4B +FS-YT_Check_Items=\u68C0\u6D4B\u9879\u76EE +FS-YT_Check_Result=\u72B6\u6001 +FS-YT_Check_Proposal=\u5EFA\u8BAE +FS-YT_Configuring=\u6B63\u5728\u914D\u7F6E\u4E2D... +FS-YT_Configure_Success=\u914D\u7F6E\u6210\u529F +FS-YT_Configure_Fail=\u4E00\u952E\u914D\u7F6E\u5931\u8D25 +FS-YT_Reconfigure=\u8BF7\u91CD\u65B0\u914D\u7F6E +FS-YT_Start_With_Http=\u670D\u52A1\u5668\u5730\u5740\u5FC5\u987B\u4EE5http\u6216https\u5F00\u5934 +FS-YT_Get-Agent-Fail=\u83B7\u53D6\u5E94\u7528\u5931\u8D25 +FS-YT_Sync-Contacts-Tip=\u5F53\u524D\u5FAE\u4FE1\u901A\u8BAF\u5F55\u4E0D\u4E3A\u7A7A\uFF0C\u7EE7\u7EED\u5BFC\u5165\u4F1A\u4E22\u5931\u539F\u59CB\u6210\u5458\u4FE1\u606F +FS-YT_Sync-Contacts=\u6B63\u5728\u540C\u6B65\u4E2D... +FS-YT_Sync-Contacts-Success=\u5FAE\u4FE1\u901A\u8BAF\u5F55\u5BFC\u5165\u6210\u529F +FS-YT_Sync-Contacts-Fail=\u5FAE\u4FE1\u901A\u8BAF\u5F55\u5BFC\u5165\u5931\u8D25 +FS-YT_Import-Success=\u6210\u529F\u5BFC\u5165 +FS-YT_People=\u4EBA +FS-YT_Fail=\u5931\u8D25 +FS-YT_Debugger-Content=\u8C03\u8BD5\u5185\u5BB9 +FS-YT_Debugger-Type-Basic-Property=\u57FA\u672C\u5C5E\u6027 +FS-YT_Debugger-Type-Login=\u5355\u70B9\u767B\u5F55 +FS-YT_Debugger-Type-Push-Message=\u63A8\u9001\u6D88\u606F +FS-YT_Debugger-WeiXin-Agent=\u5FAE\u4FE1\u5E94\u7528 +FS-YT_Debugger-Parameter-List=\u53C2\u6570\u5217\u8868 +FS-YT_Debugger-Input-Parameter=\u8F93\u5165\u53C2\u6570 +FS-YT_Debugger-WeiXin-User=\u5FAE\u4FE1\u7528\u6237 +FS-YT_Debugger-Fs-User=\u62A5\u8868\u7528\u6237 +FS-YT_Debugger-Push-User=\u63A8\u9001\u7528\u6237 +FS-YT_Debugger-Start-Check=\u5F00\u59CB\u68C0\u6D4B +FS-YT_Debugger-Show-Result=\u68C0\u6D4B\u7ED3\u679C +FS-YT_Debugger-Get-Token=\u83B7\u53D6token +FS-YT_Debugger-Get-Department=\u83B7\u53D6\u90E8\u95E8 +FS-YT_Debugger-Get-Domain=\u53EF\u4FE1\u57DF\u540D +FS-YT_Debugger-Home-Url=\u4E3B\u9875/\u83DC\u5355\u94FE\u63A5 +FS-YT_ErrorCode=\u5FAE\u4FE1\u8FD4\u56DE\u9519\u8BEF\u7801 +FS-YT_ErrorMsg=\u9519\u8BEF\u63CF\u8FF0 +FS-YT_Solution=\u51ED\u9519\u8BEF\u7801\u53EF\u4EE5\u81F3\u5FAE\u4FE1\u67E5\u770B\u66F4\u591A\u4FE1\u606F +FS-YT_Dep=\u90E8\u95E8 +FS-YT_Phone=\u624B\u673A\u53F7 +FS-YT_ErrorDetail=\u9519\u8BEF\u4FE1\u606F +FS-YT_None-Synchronous-User=\u65E0\u53EF\u540C\u6B65\u7528\u6237 +FS-YT_NetWork-Anomaly=\u7F51\u7EDC\u5F02\u5E38\uFF0C\u8BF7\u68C0\u67E5\u7F51\u7EDC\u914D\u7F6E +FS-YT_Delete-Agent-Fail=\u5220\u9664\u5E94\u7528\u5931\u8D25 +FS-YT_Save-ReportServer-Url-Fail=\u4FDD\u5B58\u670D\u52A1\u5668\u5730\u5740\u5931\u8D25 +FS-YT_Get-ReportServer-Url-Fail=\u83B7\u53D6\u670D\u52A1\u5668\u5730\u5740\u5931\u8D25 +FS-YT_Tip-Get-ReportServer-Url-Fail=\u8BF7\u914D\u7F6E\u670D\u52A1\u5668\u5730\u5740 +FS-YT_Create-Agent-Menu-Fail=\u521B\u5EFA\u5E94\u7528\u83DC\u5355\u5931\u8D25 +FS-YT_Get-Agent-Menu-Fail=\u83B7\u53D6\u5E94\u7528\u83DC\u5355\u5931\u8D25 +FS-YT_Save-Proxy-Server-Url-Fail=\u5B58\u50A8\u4EE3\u7406\u670D\u52A1\u5668\u5730\u5740\u5931\u8D25 +FS-YT_Match-Way-Not-Null=\u5339\u914D\u8BBE\u7F6E\u4E0D\u80FD\u4E3A\u7A7A +FS-CH_title=\u4E00\u56E2\u63D2\u4EF6 diff --git a/src/main/resources/com/fr/plugin/yt/local/i18_en_US.properties b/src/main/resources/com/fr/plugin/yt/local/i18_en_US.properties new file mode 100644 index 0000000..da43c89 --- /dev/null +++ b/src/main/resources/com/fr/plugin/yt/local/i18_en_US.properties @@ -0,0 +1,152 @@ +FS-Module-WeiXin_Manager=WeChart Management +FS-Zch_Basic=Basic +FS-Schedule-Notification_WeiXin=Push WeChart Message +FS-Schedule-Notification_WeiXin_CorpID=CorpID\: +FS-Schedule-Notification_WeiXin_Users=WeiXin Users\: +FS-Schedule-Notification_WeiXin_DepID=Department ID\: +FS-Schedule-Notification_WeiXin_Content=Message\: +FS-Schedule-Notification_WeiXin_WithLink=Cpr Link +FS-Schedule_Mobile-Push-WeiXinId-Not-Null=Please set which WeChat app to push. +FS-Zch_Recive_Data_URL=Recive Data Url +FS-Zch_Corp_ID=WeChart Corp ID +FS-Zch_Secret= Agent secret +FS-Zch_Member_Management=WeChart member management +FS-Zch_User_Same_With_FS=matching FS user according to the userId +FS-Zch_Mobile_Same_With_FS=matching FS user according to the phone number +FS-Zch_Manual_Matching_FS=matching FS user manually +FS-Zch_Custom_Matching_FS=custom matching +FS-Zch_UserID=WeChart member name +FS-Zch_FSUserName=Report user name +FS-Zch_Name=Name +FS-Zch_Department=WeChart Department +FS-Zch_UrlHint=Server Url\: +FS-Zch_Refresh_User=Refresh +FS-Zch_Mobile=WeiXin member mobile +FS-Zch_Matching_Way=The matching way to FS user +FS-Zch_Hint=Hint +FS-Zch_Loading=Loading users... +FS-Zch_Mobile_Not_Supported=The html5 report does not support matching FS user by mobile, please upgrade your html5 plugin +FS-Zch_Mobile-Push-WeiXin-Terminal=WeiXin +FS-Zch_Mobile-Push-WeiXin-AgentID=AgentID +FS-Zch_Expired_Error=Error Code\: 11100016 You are using unregistered function--WeChat integration +FS-Zch_Expired_Solution=WeChat plugin is not registered. If necessary, please contact sales. +FS-Zch_Agent_Management=Application management +FS-Zch_Member_Manage=Member management +FS-Zch_Agent_Config=Application shortcut configuration +FS-Zch_Agent_Name=Application name +FS-Zch_Enterprise_WeChat=Enterprise WeChat +FS-Zch_New_Agent=Create enterprise application +FS-Zch_ReportServer=Report server +FS-Zch_ReportServer_Url=Report server address +FS-Zch_ReportServer_Tip=Please use level two or above two domain name, and need to record through ICP, port recommended 80 or 443. +FS-Zch_Save=Save +FS-Zch_DeleteAgent_Confirm_Popup=Determine to delete the enterprise WeChat application +FS-Zch_Confirm=Confirm +FS-Zch_Cancel=Cancel +FS-Zch_Create_WeiXin_Url=Generating WeChat links +FS-Zch_WeiXin_Url=WeChat link +FS-Zch_Platform_Page=Link page +FS-Zch_Platform=Decision platform +FS-Zch_Platform_Report=A single model +FS-Zch_Create_Url=Generating links +FS-Zch_Copy_Url=Copy +FS-Zch_Modify_Agent=Revision of enterprise WeChat +FS-Zch_Attention=Attention +FS-Zch_CreateAgent_Not_Null=WeChat application name, CorpID, group key management certificate can not be empty +BI-Basic_Search=Search +FS-Zch_Default_Agent_Name=FineReport Corp Agent +FS-Zch_Default_Schedule_Agent_Name=Application (timing task) +FS-Zch_Unknown_Agent=Network anomaly or please confirm that the CorpId and Secret that are currently used are correct. If you want to manage group key, please change to Secret. +FS-Zch_Management_Secret=The secret you are currently using is the management group secret. For your normal use of WeChat integration function, please replace it with application secret. +FS-Zch_Copy_Success=Replicating success +FS-Zch_Match_Way=Matching method +FS-Zch_Match_Setting=Matching settings +FS-Zch_DataSet=data set +FS-Zch_UserId=weixin userid +FS-Zch_FsUserName=Report member name +FS-Zch_Address_Book= Address book +FS-Zch_Member_Update=Immediate update +FS-Zch_Set_Update=Setting auto update +FS-Zch_Start_Update=Enable automatic update +FS-Zch_Per=Per +FS-Zch_Day=Day +FS-Zch_Week=Week +FS-Zch_Hour=Hour +FS-Zch_Minute=Minute +FS-Zch_Monday=Monday +FS-Zch_Tuesday=Tuesday +FS-Zch_Wednesday=Wednesday +FS-Zch_Thursday=Thursday +FS-Zch_Friday=Friday +FS-Zch_Saturday=Saturday +FS-Zch_Sunday=Sunday +FS-Zch_Update_Once=to update once +FS-Zch_Not_Null=Not allowed to be empty +FS-Zch_Save_Agent_Fail=Save agent fail +FS-Zch_Agent_Name_Exist=The application name has already existed +FS-Zch_Secret_Exist=Secret already exists +FS-Zch_Organizational_Structure=organizational structure +FS-Zch_Tag=Tag +FS-Zch_Illegal=Illegal +FS-Zch_Proxy=WeChat proxy jump +FS-Zch_Proxy_Address=Proxy server address +FS-Zch_Test_Proxy_Address=Test connection +FS-Zch_Connection_Success=Connection success +FS-Zch_Connection_Fail=Connection failed +FS-Zch_Test_Connection=Test the connection... +FS-Zch_Agent_Quick_Config=Fast configuration of home page application +FS-Zch_One_Key_Config=One key configuration +FS-Zch_One_Key_Config_Tip=The home page or menu has been configured in the current application. The configuration will empty the original settings. +FS-Zch_Adress_Book_Secret=Address book management secret +FS-Zch_Import_Adress_Book=Import the WeChat address book +FS-Zch_Syn_Adress_Book=Sync report to WeChat +FS-Zch_Env_Check=WeChat integrated environment configuration detection +FS-Zch_Check_Items=Detection project +FS-Zch_Check_Result=State +FS-Zch_Check_Proposal=Proposal +FS-Zch_Configuring=Configuring... +FS-Zch_Configure_Success=Configuration success +FS-Zch_Configure_Fail=One key configuration fail +FS-Zch_Reconfigure=Please reconfigure +FS-Zch_Start_With_Http=The server address must begin with HTTP or HTTPS +FS-Zch_Get-Agent-Fail=Gain application failure +FS-Zch_Sync-Contacts-Tip=The current WeChat address book is not empty. Continuing importing will lose the original member information. +FS-Zch_Sync-Contacts=Synchronizing +FS-Zch_Sync-Contacts-Success=Synchronization success +FS-Zch_Sync-Contacts-Fail=Synchronization failure +FS-Zch_Import-Success=Successfully imported +FS-Zch_People=people +FS-Zch_Fail=fail +FS-Zch_Debugger-Content=Debug content +FS-Zch_Debugger-Type-Basic-Property=Basic property +FS-Zch_Debugger-Type-Login=Single sign on +FS-Zch_Debugger-Type-Push-Message=Push message +FS-Zch_Debugger-WeiXin-Agent=WeChat application +FS-Zch_Debugger-Parameter-List=Parameter list +FS-Zch_Debugger-Input-Parameter=Input parameter +FS-Zch_Debugger-WeiXin-User=WeChat users +FS-Zch_Debugger-Fs-User=FS Users +FS-Zch_Debugger-Push-User=Push user +FS-Zch_Debugger-Start-Check=Start detection +FS-Zch_Debugger-Show-Result=Detection result +FS-Zch_Debugger-Get-Token=Get Token +FS-Zch_Debugger-Get-Department=Access Department +FS-Zch_Debugger-Get-Domain=Trusted domain name +FS-Zch_Debugger-Home-Url=Home page / menu link +FS-Zch_ErrorCode=WeChat returns error code +FS-Zch_ErrorMsg=Error description +FS-Zch_Solution=With the error code, you can see more information from WeChat +FS-Zch_Dep=Department +FS-Zch_Phone=Mobile +FS-Zch_ErrorDetail=Error message +FS-Zch_None-Synchronous-User=Non synchronous user +FS-Zch_NetWork-Anomaly=Network exception, please check the network configuration +FS-Zch_Delete-Agent-Fail=Delete application failure +FS-Zch_Save-ReportServer-Url-Fail=Save server address failure +FS-Zch_Get-ReportServer-Url-Fail=Getting server address failure +FS-Zch_Tip-Get-ReportServer-Url-Fail=Please configure the server address +FS-Zch_Create-Agent-Menu-Fail=Create application menu failure +FS-Zch_Get-Agent-Menu-Fail=Fail to get the application menu +FS-Zch_Save-Proxy-Server-Url-Fail=Storage proxy server address failure +FS-Zch_Match-Way-Not-Null=Matching settings can not be empty +FS-CH_title=cloud home plugin diff --git a/src/main/resources/com/fr/plugin/yt/local/i18_zh_CN.properties b/src/main/resources/com/fr/plugin/yt/local/i18_zh_CN.properties new file mode 100644 index 0000000..765efce --- /dev/null +++ b/src/main/resources/com/fr/plugin/yt/local/i18_zh_CN.properties @@ -0,0 +1,152 @@ +FS-Module-YT_Manager=\u4E00\u56E2\u7BA1\u7406 +FS-YT_Basic=\u57FA\u672C\u4FE1\u606F +FS-Schedule-Notification_WeiXin=\u63A8\u9001\u4E00\u56E2\u6D88\u606F +FS-Schedule-Notification_YT_CorpID=\u4F01\u4E1A\u5E94\u7528ID\uFF1A +FS-Schedule-Notification_YT_Users=\u4E00\u56E2\u7528\u6237\uFF1A +FS-Schedule-Notification_YT_DepID=\u90E8\u95E8ID\uFF1A +FS-Schedule-Notification_YT_Content=\u6D88\u606F\u5185\u5BB9\uFF1A +FS-Schedule-Notification_YT_WithLink=\u5B9A\u65F6\u7ED3\u679C\u8BBF\u95EE\u94FE\u63A5 +FS-Schedule_Mobile-Push-WeiXinId-Not-Null=\u8BF7\u8BBE\u7F6E\u63A8\u9001\u7684\u4E00\u56E2\u5E94\u7528 +FS-YT_Recive_Data_URL=\u63A5\u6536\u6570\u636EURL +FS-YT_Corp_ID=\u4E00\u56E2\u4F01\u4E1A\u53F7ID +FS-YT_Secret=\u4E00\u56E2\u5E94\u7528\u79D8\u94A5 +FS-YT_Member_Management=\u4E00\u56E2\u6210\u5458\u7BA1\u7406 +FS-YT_User_Same_With_FS=\u4E00\u56E2\u53F7\u5339\u914D +FS-YT_Mobile_Same_With_FS=\u624B\u673A\u8D26\u53F7\u5339\u914D +FS-YT_Manual_Matching_FS=\u624B\u52A8\u5339\u914D +FS-YT_Custom_Matching_FS=\u81EA\u5B9A\u4E49\u5339\u914D +FS-YT_UserID=\u4E00\u56E2\u6210\u5458\u540D +FS-YT_FSUserName=\u62A5\u8868\u7528\u6237\u540D +FS-YT_Name=\u59D3\u540D +FS-YT_Department=\u4E00\u56E2\u90E8\u95E8 +FS-YT_UrlHint=\u670D\u52A1\u5668\u4FDD\u5B58\u7684Url: +FS-YT_Refresh_User=\u66F4\u65B0\u901A\u8BAF\u5F55 +FS-YT_Mobile=\u4E00\u56E2\u6210\u5458\u624B\u673A\u53F7 +FS-YT_Matching_Way=\u7528\u6237\u5339\u914D\u65B9\u5F0F +FS-YT_Hint=\u63D0\u793A +FS-YT_Loading=\u6B63\u5728\u52A0\u8F7D\u7528\u6237... +FS-YT_Mobile_Not_Supported=\u5F53\u524DHTML5\u62A5\u8868\u4E0D\u652F\u6301\u6839\u636E\u624B\u673A\u53F7\u5339\u914D\uFF0C\u8BF7\u5347\u7EA7HTML5\u63D2\u4EF6 +FS-YT_Mobile-Push-YT-Terminal=\u4E00\u56E2\u901A\u77E5 +FS-YT_Mobile-Push-YT-AgentID=\u5E94\u7528ID +FS-YT_Expired_Error=\u9519\u8BEF\u4EE3\u7801:11100016 \u60A8\u4F7F\u7528\u4E86\u672A\u6CE8\u518C\u7684\u529F\u80FD\u2014\u2014\u4E00\u56E2\u96C6\u6210 +FS-YT_Expired_Solution=\u4E00\u56E2\u529F\u80FD\u672A\u6CE8\u518C\uFF0C\u5982\u9700\u4F7F\u7528\u8BF7\u8054\u7CFB\u9500\u552E +FS-YT_Agent_Management=\u5E94\u7528\u7BA1\u7406 +FS-YT_Member_Manage=\u6210\u5458\u7BA1\u7406 +FS-YT_Agent_Config=\u5E94\u7528\u5FEB\u6377\u914D\u7F6E +FS-YT_Agent_Name=\u4F01\u4E1A\u5E94\u7528\u540D\u79F0 +FS-YT_Enterprise_WeChat=\u4F01\u4E1A\u4E00\u56E2 +FS-YT_New_Agent=\u65B0\u5EFA\u4E00\u56E2\u5E94\u7528 +FS-YT_ReportServer=\u62A5\u8868\u670D\u52A1\u5668 +FS-YT_ReportServer_Url=\u62A5\u8868\u670D\u52A1\u5668\u5730\u5740 +FS-YT_ReportServer_Tip=\u8BF7\u4F7F\u7528\u4E8C\u7EA7\u6216\u4E8C\u7EA7\u4EE5\u4E0A\u57DF\u540D\uFF0C\u4E14\u9700\u901A\u8FC7ICP\u5907\u6848\uFF0C\u7AEF\u53E3\u63A8\u8350\u4F7F\u752880\u6216443 +FS-YT_Save=\u4FDD\u5B58 +FS-YT_DeleteAgent_Confirm_Popup=\u786E\u5B9A\u5220\u9664\u6B64\u4F01\u4E1A\u4E00\u56E2\u5E94\u7528 +FS-YT_Confirm=\u786E\u5B9A +FS-YT_Cancel=\u53D6\u6D88 +FS-YT_Create_YT_Url=\u751F\u6210\u4E00\u56E2\u94FE\u63A5 +FS-YT_YT_Url=\u4E00\u56E2\u94FE\u63A5 +FS-YT_Platform_Page=\u94FE\u63A5\u9875\u9762 +FS-YT_Platform=\u51B3\u7B56\u5E73\u53F0 +FS-YT_Platform_Report=\u5355\u4E2A\u6A21\u677F +FS-YT_Create_Url=\u751F\u6210\u94FE\u63A5 +FS-YT_Copy_Url=\u590D\u5236 +FS-YT_Modify_Agent=\u4FEE\u6539\u4F01\u4E1A\u4E00\u56E2 +FS-YT_Attention=\u6CE8\u610F +FS-YT_CreateAgent_Not_Null=\u4E00\u56E2\u5E94\u7528\u540D\u79F0\uFF0CCorpID\uFF0C\u7BA1\u7406\u7EC4\u51ED\u8BC1\u79D8\u94A5\u4E0D\u53EF\u4E3A\u7A7A +BI-Basic_Search=\u641C\u7D22 +FS-YT_Default_Agent_Name=FineReport\u4F01\u4E1A\u5E94\u7528 +FS-YT_Default_Schedule_Agent_Name=\u5E94\u7528(\u5B9A\u65F6\u63A8\u9001) +FS-YT_Unknown_Agent=\u7F51\u7EDC\u5F02\u5E38\u6216\u8005\u8BF7\u786E\u8BA4\u5F53\u524D\u4F7F\u7528\u7684CorpId\u548CSecret\u662F\u5426\u6B63\u786E(\u82E5\u4E3A\u7BA1\u7406\u7EC4\u5BC6\u94A5\uFF0C\u8BF7\u6539\u4E3A\u5E94\u7528Secret) +FS-YT_Management_Secret=\u60A8\u5F53\u524D\u5E94\u7528\u7684secret\u4E3A\u7BA1\u7406\u7EC4secret\uFF0C\u4E3A\u4E86\u60A8\u6B63\u5E38\u4F7F\u7528\u4E00\u56E2\u96C6\u6210\u529F\u80FD\uFF0C\u8BF7\u66FF\u6362\u4E3A\u5E94\u7528secret +FS-YT_Copy_Success=\u590D\u5236\u6210\u529F +FS-YT_Match_Way=\u5339\u914D\u65B9\u5F0F +FS-YT_Match_Setting=\u5339\u914D\u8BBE\u7F6E +FS-YT_DataSet=\u6570\u636E\u96C6 +FS-YT_UserId=\u4E00\u56E2\u7528\u6237\u540D +FS-YT_FsUserName=\u62A5\u8868\u7528\u6237\u540D +FS-YT_Address_Book=\u901A\u8BAF\u5F55 +FS-YT_Member_Update=\u7ACB\u5373\u66F4\u65B0 +FS-YT_Set_Update=\u8BBE\u7F6E\u81EA\u52A8\u66F4\u65B0 +FS-YT_Start_Update=\u542F\u7528\u81EA\u52A8\u66F4\u65B0 +FS-YT_Per=\u6BCF +FS-YT_Day=\u5929 +FS-YT_Week=\u5468 +FS-YT_Hour=\u65F6 +FS-YT_Minute=\u5206 +FS-YT_Monday=\u5468\u4E00 +FS-YT_Tuesday=\u5468\u4E8C +FS-YT_Wednesday=\u5468\u4E09 +FS-YT_Thursday=\u5468\u56DB +FS-YT_Friday=\u5468\u4E94 +FS-YT_Saturday=\u5468\u516D +FS-YT_Sunday=\u5468\u65E5 +FS-YT_Update_Once=\u5B9A\u65F6\u540C\u6B65\u4E00\u6B21 +FS-YT_Not_Null=\u4E0D\u5141\u8BB8\u4E3A\u7A7A +FS-YT_Save_Agent_Fail=\u5B58\u50A8\u5E94\u7528\u4FE1\u606F\u5931\u8D25 +FS-YT_Agent_Name_Exist=\u5E94\u7528\u540D\u79F0\u5DF2\u5B58\u5728 +FS-YT_Secret_Exist=secret\u5DF2\u5B58\u5728 +FS-YT_Organizational_Structure=\u7EC4\u7EC7\u67B6\u6784 +FS-YT_Tag=\u6807\u7B7E +FS-YT_Illegal=\u4E0D\u5408\u6CD5 +FS-YT_Proxy=\u4E00\u56E2\u4EE3\u7406\u8DF3\u8F6C +FS-YT_Proxy_Address=\u4EE3\u7406\u670D\u52A1\u5668\u5730\u5740 +FS-YT_Test_Proxy_Address=\u6D4B\u8BD5\u8FDE\u63A5 +FS-YT_Connection_Success=\u8FDE\u63A5\u6210\u529F +FS-YT_Connection_Fail=\u8FDE\u63A5\u5931\u8D25 +FS-YT_Test_Connection=\u6D4B\u8BD5\u8FDE\u63A5\u4E2D... +FS-YT_Agent_Quick_Config=\u4E3B\u9875\u578B\u5E94\u7528\u5FEB\u901F\u914D\u7F6E +FS-YT_One_Key_Config=\u4E00\u952E\u914D\u7F6E +FS-YT_One_Key_Config_Tip=\u5F53\u524D\u5E94\u7528\u5DF2\u914D\u7F6E\u4E3B\u9875\u6216\u83DC\u5355\uFF0C\u7EE7\u7EED\u914D\u7F6E\u5C06\u6E05\u7A7A\u539F\u59CB\u8BBE\u7F6E +FS-YT_Adress_Book_Secret=\u901A\u8BAF\u5F55\u7BA1\u7406secret +FS-YT_Import_Adress_Book=\u5BFC\u5165\u4E00\u56E2\u901A\u8BAF\u5F55 +FS-YT_Syn_Adress_Book=\u540C\u6B65\u62A5\u8868\u901A\u8BAF\u5F55\u5230\u4E00\u56E2 +FS-YT_Env_Check=\u4E00\u56E2\u96C6\u6210\u73AF\u5883\u914D\u7F6E\u68C0\u6D4B +FS-YT_Check_Items=\u68C0\u6D4B\u9879\u76EE +FS-YT_Check_Result=\u72B6\u6001 +FS-YT_Check_Proposal=\u5EFA\u8BAE +FS-YT_Configuring=\u6B63\u5728\u914D\u7F6E\u4E2D... +FS-YT_Configure_Success=\u914D\u7F6E\u6210\u529F +FS-YT_Configure_Fail=\u4E00\u952E\u914D\u7F6E\u5931\u8D25 +FS-YT_Reconfigure=\u8BF7\u91CD\u65B0\u914D\u7F6E +FS-YT_Start_With_Http=\u670D\u52A1\u5668\u5730\u5740\u5FC5\u987B\u4EE5http\u6216https\u5F00\u5934 +FS-YT_Get-Agent-Fail=\u83B7\u53D6\u5E94\u7528\u5931\u8D25 +FS-YT_Sync-Contacts-Tip=\u5F53\u524D\u4E00\u56E2\u901A\u8BAF\u5F55\u4E0D\u4E3A\u7A7A\uFF0C\u7EE7\u7EED\u5BFC\u5165\u4F1A\u4E22\u5931\u539F\u59CB\u6210\u5458\u4FE1\u606F +FS-YT_Sync-Contacts=\u6B63\u5728\u540C\u6B65\u4E2D... +FS-YT_Sync-Contacts-Success=\u4E00\u56E2\u901A\u8BAF\u5F55\u5BFC\u5165\u6210\u529F +FS-YT_Sync-Contacts-Fail=\u4E00\u56E2\u901A\u8BAF\u5F55\u5BFC\u5165\u5931\u8D25 +FS-YT_Import-Success=\u6210\u529F\u5BFC\u5165 +FS-YT_People=\u4EBA +FS-YT_Fail=\u5931\u8D25 +FS-YT_Debugger-Content=\u8C03\u8BD5\u5185\u5BB9 +FS-YT_Debugger-Type-Basic-Property=\u57FA\u672C\u5C5E\u6027 +FS-YT_Debugger-Type-Login=\u5355\u70B9\u767B\u5F55 +FS-YT_Debugger-Type-Push-Message=\u63A8\u9001\u6D88\u606F +FS-YT_Debugger-YT-Agent=\u4E00\u56E2\u5E94\u7528 +FS-YT_Debugger-Parameter-List=\u53C2\u6570\u5217\u8868 +FS-YT_Debugger-Input-Parameter=\u8F93\u5165\u53C2\u6570 +FS-YT_Debugger-YT-User=\u4E00\u56E2\u7528\u6237 +FS-YT_Debugger-Fs-User=\u62A5\u8868\u7528\u6237 +FS-YT_Debugger-Push-User=\u63A8\u9001\u7528\u6237 +FS-YT_Debugger-Start-Check=\u5F00\u59CB\u68C0\u6D4B +FS-YT_Debugger-Show-Result=\u68C0\u6D4B\u7ED3\u679C +FS-YT_Debugger-Get-Token=\u83B7\u53D6token +FS-YT_Debugger-Get-Department=\u83B7\u53D6\u90E8\u95E8 +FS-YT_Debugger-Get-Domain=\u53EF\u4FE1\u57DF\u540D +FS-YT_Debugger-Home-Url=\u4E3B\u9875/\u83DC\u5355\u94FE\u63A5 +FS-YT_ErrorCode=\u4E00\u56E2\u8FD4\u56DE\u9519\u8BEF\u7801 +FS-YT_ErrorMsg=\u9519\u8BEF\u63CF\u8FF0 +FS-YT_Solution=\u51ED\u9519\u8BEF\u7801\u53EF\u4EE5\u81F3\u4E00\u56E2\u67E5\u770B\u66F4\u591A\u4FE1\u606F +FS-YT_Dep=\u90E8\u95E8 +FS-YT_Phone=\u624B\u673A\u53F7 +FS-YT_ErrorDetail=\u9519\u8BEF\u4FE1\u606F +FS-YT_None-Synchronous-User=\u65E0\u53EF\u540C\u6B65\u7528\u6237 +FS-YT_NetWork-Anomaly=\u7F51\u7EDC\u5F02\u5E38\uFF0C\u8BF7\u68C0\u67E5\u7F51\u7EDC\u914D\u7F6E +FS-YT_Delete-Agent-Fail=\u5220\u9664\u5E94\u7528\u5931\u8D25 +FS-YT_Save-ReportServer-Url-Fail=\u4FDD\u5B58\u670D\u52A1\u5668\u5730\u5740\u5931\u8D25 +FS-YT_Get-ReportServer-Url-Fail=\u83B7\u53D6\u670D\u52A1\u5668\u5730\u5740\u5931\u8D25 +FS-YT_Tip-Get-ReportServer-Url-Fail=\u8BF7\u914D\u7F6E\u670D\u52A1\u5668\u5730\u5740 +FS-YT_Create-Agent-Menu-Fail=\u521B\u5EFA\u5E94\u7528\u83DC\u5355\u5931\u8D25 +FS-YT_Get-Agent-Menu-Fail=\u83B7\u53D6\u5E94\u7528\u83DC\u5355\u5931\u8D25 +FS-YT_Save-Proxy-Server-Url-Fail=\u5B58\u50A8\u4EE3\u7406\u670D\u52A1\u5668\u5730\u5740\u5931\u8D25 +FS-YT_Match-Way-Not-Null=\u5339\u914D\u8BBE\u7F6E\u4E0D\u80FD\u4E3A\u7A7A +FS-CH_title=\u4E00\u56E2\u63D2\u4EF6