Browse Source

提交开源热任务材料

10.0
LAPTOP-SB56SG4Q\86185 3 years ago
parent
commit
37125633d6
  1. 5
      README.md
  2. BIN
      jsd 8690问题定位文档.docx
  3. 52
      plugin.xml
  4. 56
      src/main/java/com/fr/plugin/beans/MyAgentBean.java
  5. 90
      src/main/java/com/fr/plugin/beans/MyDepBean.java
  6. 171
      src/main/java/com/fr/plugin/beans/MyOutputBean.java
  7. 144
      src/main/java/com/fr/plugin/beans/MyUserBean.java
  8. 14
      src/main/java/com/fr/plugin/beans/msg/MyMessageType.java
  9. 201
      src/main/java/com/fr/plugin/config/MyConfig.java
  10. 79
      src/main/java/com/fr/plugin/config/MyTimingTaskConfig.java
  11. 49
      src/main/java/com/fr/plugin/constant/Week.java
  12. 162
      src/main/java/com/fr/plugin/core/LoginFilter.java
  13. 19
      src/main/java/com/fr/plugin/core/LoginsComponent.java
  14. 29
      src/main/java/com/fr/plugin/core/MeixinMessageObject.java
  15. 20
      src/main/java/com/fr/plugin/core/MyComponent.java
  16. 84
      src/main/java/com/fr/plugin/core/MyCoreDBAccess.java
  17. 186
      src/main/java/com/fr/plugin/core/MyCorpManager.java
  18. 37
      src/main/java/com/fr/plugin/core/MyDecisionDBAccess.java
  19. 23
      src/main/java/com/fr/plugin/core/MyFormulaProvider.java
  20. 36
      src/main/java/com/fr/plugin/core/MyHttpHander.java
  21. 45
      src/main/java/com/fr/plugin/core/MyLifeCycleMonitor.java
  22. 15
      src/main/java/com/fr/plugin/core/MyLocalFinder.java
  23. 417
      src/main/java/com/fr/plugin/core/MyOutputActionHandler.java
  24. 7
      src/main/java/com/fr/plugin/core/MyRequest.java
  25. 10
      src/main/java/com/fr/plugin/core/MySingleLoginAccessProvider.java
  26. 34
      src/main/java/com/fr/plugin/core/MyStartupThred.java
  27. 41
      src/main/java/com/fr/plugin/core/MySystemOption.java
  28. 16
      src/main/java/com/fr/plugin/core/MyUrlAliasProvider.java
  29. 279
      src/main/java/com/fr/plugin/core/MyUserSyncManager.java
  30. 17
      src/main/java/com/fr/plugin/dao/MyAgentDao.java
  31. 15
      src/main/java/com/fr/plugin/dao/MyDepDao.java
  32. 14
      src/main/java/com/fr/plugin/dao/MyEntityDao.java
  33. 18
      src/main/java/com/fr/plugin/dao/MyUserDao.java
  34. 15
      src/main/java/com/fr/plugin/dao/PushDao.java
  35. 83
      src/main/java/com/fr/plugin/entitys/MyAgentEntity.java
  36. 72
      src/main/java/com/fr/plugin/entitys/MyDepEntity.java
  37. 139
      src/main/java/com/fr/plugin/entitys/MyUserEntity.java
  38. 219
      src/main/java/com/fr/plugin/entitys/OutputMyEntity.java
  39. 49
      src/main/java/com/fr/plugin/entitys/PushEntity.java
  40. 13
      src/main/java/com/fr/plugin/utils/Filter.java
  41. 41
      src/main/java/com/fr/plugin/utils/JsonUtils.java
  42. 34
      src/main/java/com/fr/plugin/utils/MyAgentUtils.java
  43. 61
      src/main/java/com/fr/plugin/utils/MyUtils.java
  44. 41
      src/main/java/com/fr/plugin/utils/PushImageBean.java
  45. 114
      src/main/java/com/fr/plugin/utils/PushObject.java
  46. 61
      src/main/java/com/fr/plugin/utils/PushTextBean.java
  47. 266
      src/main/java/com/fr/plugin/utils/PushUtils.java
  48. 35
      src/main/java/com/fr/plugin/utils/SertUtils.java
  49. 52
      src/main/java/com/fr/plugin/utils/SignUtils.java
  50. 108
      src/main/java/com/fr/plugin/utils/SyncThread.java
  51. 153
      src/main/java/com/fr/plugin/utils/WebHookUtil.java
  52. 367
      src/main/java/com/fr/plugin/utils/WebUtils.java
  53. 46
      src/main/java/com/fr/plugin/web/hander/DelAgentHander.java
  54. 61
      src/main/java/com/fr/plugin/web/hander/GetAgentHandler.java
  55. 48
      src/main/java/com/fr/plugin/web/hander/GetConfigHandler.java
  56. 96
      src/main/java/com/fr/plugin/web/hander/LoginUserModel.java
  57. 38
      src/main/java/com/fr/plugin/web/hander/MyCheckLicenseHandler.java
  58. 98
      src/main/java/com/fr/plugin/web/hander/PCLoginHandler.java
  59. 105
      src/main/java/com/fr/plugin/web/hander/SaveAgentHandler.java
  60. 63
      src/main/java/com/fr/plugin/web/hander/SaveConfigHandler.java
  61. 100
      src/main/java/com/fr/plugin/web/hander/ScanLoginHandler.java
  62. 156
      src/main/java/com/fr/plugin/web/hander/SingleLoginHandler.java
  63. 42
      src/main/java/com/fr/plugin/web/hander/member/GetDepTree.java
  64. 41
      src/main/java/com/fr/plugin/web/hander/member/GetImageHandler.java
  65. 44
      src/main/java/com/fr/plugin/web/hander/member/GetMatch.java
  66. 95
      src/main/java/com/fr/plugin/web/hander/member/GetMemberHandler.java
  67. 73
      src/main/java/com/fr/plugin/web/hander/member/LanlingLogin.java
  68. 40
      src/main/java/com/fr/plugin/web/hander/member/SaveMatch.java
  69. 62
      src/main/java/com/fr/plugin/web/hander/member/SaveRelation.java
  70. 92
      src/main/java/com/fr/plugin/web/hander/member/SycHookHander.java
  71. 35
      src/main/java/com/fr/plugin/web/hander/member/SynUserHander.java
  72. 48
      src/main/java/com/fr/plugin/web/hander/pushBeanHandler.java
  73. 152
      src/main/resources/com/fr/plugin/core/local/i18.properties
  74. 152
      src/main/resources/com/fr/plugin/core/local/i18_en_US.properties
  75. 151
      src/main/resources/com/fr/plugin/core/local/i18_zh_CN.properties
  76. 32
      src/main/resources/com/fr/plugin/web/LoginRequire.html
  77. 0
      src/main/resources/com/fr/plugin/web/css/cloud_home.css
  78. 19
      src/main/resources/com/fr/plugin/web/css/login.css
  79. BIN
      src/main/resources/com/fr/plugin/web/images/1x/icon/debugger.png
  80. BIN
      src/main/resources/com/fr/plugin/web/images/1x/icon/icon_fail.png
  81. BIN
      src/main/resources/com/fr/plugin/web/images/1x/icon/icon_success.png
  82. BIN
      src/main/resources/com/fr/plugin/web/images/1x/icon/loading.gif
  83. BIN
      src/main/resources/com/fr/plugin/web/images/2x/icon/debugger.png
  84. BIN
      src/main/resources/com/fr/plugin/web/images/2x/icon/icon_fail.png
  85. BIN
      src/main/resources/com/fr/plugin/web/images/2x/icon/icon_success.png
  86. BIN
      src/main/resources/com/fr/plugin/web/images/2x/icon/loading.gif
  87. 3518
      src/main/resources/com/fr/plugin/web/js/login.js
  88. 3632
      src/main/resources/com/fr/plugin/web/js/meixin.js

5
README.md

@ -1,3 +1,6 @@
# open-JSD-8690
JSD-8690 开源任务材料
JSD-8690 云之家推送示例 开源任务材料\
免责说明:该源码为第三方爱好者提供,不保证源码和方案的可靠性,也不提供任何形式的源码教学指导和协助!\
仅作为开发者学习参考使用!禁止用于任何商业用途!\
为保护开发者隐私,开发者信息已隐去!若原开发者希望公开自己的信息,可联系hugh处理。

BIN
jsd 8690问题定位文档.docx

Binary file not shown.

52
plugin.xml

@ -0,0 +1,52 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<plugin>
<id>com.fr.plugin.xxxx.10</id>
<name><![CDATA[单点10]]></name>
<active>yes</active>
<version>2.0.7.2</version>
<env-version>10.0</env-version>
<jartime>2019-03-10</jartime>
<vendor>fr.open</vendor>
<description><![CDATA[]]></description>
<function-recorder class="com.fr.plugin.core.MySystemOption"/>
<change-notes>
<![CDATA[
<p>[2019-11-6]项目启动</p>
<p>[2020-01-14]修复推送问题</p>
]]>
</change-notes>
<main-package>com.fr.plugin.core</main-package>
<!--插件生命周期接口-->
<lifecycle-monitor class="com.fr.plugin.core.MyLifeCycleMonitor"/>
<extra-decision>
<!--插件注入js-->
<SystemOptionProvider class="com.fr.plugin.core.MySystemOption"/>
<!--插件注入HttpHandler-->
<HttpHandlerProvider class="com.fr.plugin.core.MyHttpHander"/>
<!--插件注入AccessProvider-->
<AccessProvider class="com.fr.plugin.core.MySingleLoginAccessProvider"/>
<!--插件注入定时调度相关的数据库-->
<DecisionDBAccessProvider class="com.fr.plugin.core.MyDecisionDBAccess"/>
<!--插件注入处理公式的类-->
<OutputFormulaProvider class="com.fr.plugin.core.MyFormulaProvider"/>
<!--插件注入短链-->
<URLAliasProvider class="com.fr.plugin.core.MyUrlAliasProvider"/>
<GlobalRequestFilterProvider class="com.fr.plugin.core.LoginFilter"/>
</extra-decision>
<extra-core>
<!--插件注入国际化-->
<LocaleFinder class="com.fr.plugin.core.MyLocalFinder"/>
<!--插件注入数据库-->
<DBAccessProvider class="com.fr.plugin.core.MyCoreDBAccess"/>
<!--插件注入数据库-->
<DBAccessProvider class="com.fr.plugin.core.MyCoreDBAccess"/>
</extra-core>
<extra-report>
<!--插件模板消息推送-->
<MessageObjectProvider class="com.fr.plugin.core.MeixinMessageObject"/>
</extra-report>
</plugin>

56
src/main/java/com/fr/plugin/beans/MyAgentBean.java

@ -0,0 +1,56 @@
package com.fr.plugin.beans;
import com.fr.json.JSONException;
import com.fr.json.JSONObject;
import com.fr.plugin.entitys.MyAgentEntity;
import com.fr.stable.db.data.BaseDataRecord;
import java.io.Serializable;
public class MyAgentBean extends BaseDataRecord implements Serializable {
private String agentName;
private String sysKey;
private String secret;
public MyAgentEntity createEntity(MyAgentEntity var1) {
var1.setId(this.getId());
var1.setAgentName(this.agentName);
var1.setSecret(this.secret);
var1.setSysKey(this.sysKey);
return var1;
}
public String getSysKey() {
return sysKey;
}
public void setSysKey(String sysKey) {
this.sysKey = sysKey;
}
public String getSecret() {
return secret;
}
public void setSecret(String secret) {
this.secret = secret;
}
public String getAgentName() {
return this.agentName;
}
public void setAgentName(String var1) {
this.agentName = var1;
}
public JSONObject toJSONObject() throws JSONException {
JSONObject var1 = JSONObject.create();
var1.put("id", this.getId());
var1.put("agentName", this.agentName);
var1.put("sysKey", this.sysKey);
var1.put("secret", this.secret);
return var1;
}
}

90
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.MyDepEntity;
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 MyDepEntity createEntity(){
MyDepEntity bean=new MyDepEntity();
bean.setDepName(this.depName);
bean.setId(this.getId());
bean.setName(this.name);
bean.setParentId(this.parentId);
bean.setTop1(this.order);
return bean;
}
}

171
src/main/java/com/fr/plugin/beans/MyOutputBean.java

@ -0,0 +1,171 @@
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.OutputMyEntity;
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 = MyOutputBean.class,
name = "Outputxxxx"
)
public class MyOutputBean extends BaseOutputAction {
private int terminal = 64;
private String sysKey = null;
private String subject;
private String content;
private int linkOpenType;
private String customizeLink;
private int type;
private String mediaId;
private String agentId;
private int runType;
private int platform;
private int messageType;
public String getAgentId() {
return agentId;
}
public int getPlatform() {
return platform;
}
public void setPlatform(int platform) {
this.platform = platform;
}
public int getMessageType() {
return messageType;
}
public void setMessageType(int messageType) {
this.messageType = messageType;
}
public void setAgentId(String agentId) {
this.agentId = agentId;
}
public int getTerminal() {
return terminal;
}
public void setTerminal(int terminal) {
this.terminal = terminal;
}
public String getSysKey() {
return sysKey;
}
public void setSysKey(String sysKey) {
this.sysKey = sysKey;
}
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 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<? extends AbstractScheduleEntity> outputActionEntityClass() {
return OutputMyEntity.class;
}
@Override
public AbstractScheduleEntity createOutputActionEntity() {
OutputMyEntity var1 = new OutputMyEntity();
var1.setId(this.getId());
var1.setTerminal(this.getTerminal());
var1.setSysKey(this.getSysKey());
var1.setSubject(this.getSubject());
var1.setContent(this.getContent());
var1.setLinkOpenType(this.getLinkOpenType());
var1.setCustomizeLink(this.getCustomizeLink());
var1.setType(this.getType());
var1.setAgentId(this.getAgentId());
var1.setMediaId(this.getMediaId());
var1.setMessageType(this.getMessageType());
var1.setPlatform(this.getPlatform());
var1.setActionName(this.getActionName());
var1.setResultURL(this.getResultURL());
// var1.setRunType(this.runType());
// var1.setExecuteByUser(this.willExecuteByUser());
return var1;
}
// @Override
// public OutputMyEntity createEntity() {
//
// }
public MyOutputBean() {
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;
}
}

144
src/main/java/com/fr/plugin/beans/MyUserBean.java

@ -0,0 +1,144 @@
package com.fr.plugin.beans;
import com.fr.json.JSONObject;
import com.fr.plugin.entitys.MyAgentEntity;
import com.fr.plugin.entitys.MyUserEntity;
import com.fr.schedule.base.bean.output.BaseOutputAction;
import com.fr.schedule.base.type.RunType;
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 MyUserEntity createEntity() {
MyUserEntity var1=new MyUserEntity();
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("userid", this.getOpenId());
var1.put("name", this.getName());
var1.put("mobile", this.getPhone());
var1.put("departmentName", department);
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 + '\'' +
'}';
}
/// "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:是
// "positiveDate":String,//转正日期,格式如:"2018-01-01"
}

14
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 518;
}
}

201
src/main/java/com/fr/plugin/config/MyConfig.java

@ -0,0 +1,201 @@
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;
public class MyConfig extends DefaultConfiguration {
private static volatile MyConfig config = null;
private Conf<String> appId = Holders.simple(StringUtils.EMPTY);
private Conf<String> eid = Holders.simple(StringUtils.EMPTY);
private Conf<String> secret = Holders.simple(StringUtils.EMPTY);
private Conf<String> url = Holders.simple(StringUtils.EMPTY);
private Conf<String> readKey = Holders.simple(StringUtils.EMPTY);
private Conf<String> match = Holders.simple(StringUtils.EMPTY);
private Conf<String> scanId = Holders.simple(StringUtils.EMPTY);
private Conf<String> scanSecret = Holders.simple(StringUtils.EMPTY);
private Conf<String> pushUrl = Holders.simple(StringUtils.EMPTY);
private Conf<String> authUrl = Holders.simple(StringUtils.EMPTY);
private Conf<String> accessToken = Holders.simple(StringUtils.EMPTY);
private Conf<String> appKey = Holders.simple(StringUtils.EMPTY);
private volatile boolean isAuthorityInited = false;
private volatile boolean isDBAccessAvailable = false;
private volatile boolean isThreadAlreadyStart = false;
private Conf<String> lastSyncUserTime = Holders.simple(StringUtils.EMPTY);
private Conf<String> lastSyncDepTime = Holders.simple(StringUtils.EMPTY);
private Conf<String> synToken = Holders.simple(StringUtils.EMPTY);
public static MyConfig getInstance() {
if (config == null) {
config = ConfigContext.getConfigInstance(MyConfig.class);
}
return config;
}
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 getAccessToken() {
return accessToken.get();
}
public void setAccessToken(String accessToken) {
this.accessToken.set(accessToken);
}
public String getAuthUrl() {
return authUrl.get();
}
public void setAuthUrl(String authUrl) {
this.authUrl.set(authUrl);
}
public String getAppKey() {
return appKey.get();
}
public void setAppKey(String appKey) {
this.appKey.set(appKey);
}
public String getPushUrl() {
return pushUrl.get();
}
public void setPushUrl(String pushUrl) {
this.pushUrl.set(pushUrl);
}
@Override
public Object clone() throws CloneNotSupportedException {
MyConfig clone = (MyConfig) super.clone();
clone.secret = (Conf<String>) secret.clone();
clone.appId = (Conf<String>) appId.clone();
clone.eid = (Conf<String>) eid.clone();
clone.url = (Conf<String>) url.clone();
clone.readKey = (Conf<String>) readKey.clone();
clone.match = (Conf<String>) match.clone();
clone.scanId = (Conf<String>) scanId.clone();
clone.lastSyncUserTime = (Conf<String>) lastSyncUserTime.clone();
clone.lastSyncDepTime = (Conf<String>) lastSyncDepTime.clone();
clone.synToken = (Conf<String>) synToken.clone();
clone.scanSecret = (Conf<String>) scanSecret.clone();
return clone;
}
}

79
src/main/java/com/fr/plugin/config/MyTimingTaskConfig.java

@ -0,0 +1,79 @@
package com.fr.plugin.config;
import com.fr.config.holder.Conf;
import com.fr.config.holder.factory.Holders;
import com.fr.plugin.constant.Week;
public class MyTimingTaskConfig {
private Conf<Boolean> executeTimingTask;
private Conf<Integer> timingTaskFrequencyType;
private Conf<Integer> timingTaskStartDay;
private Conf<String> timingTaskStartHour;
private Conf<String> timingTaskStartMinute;
public MyTimingTaskConfig() {
this.executeTimingTask = Holders.simple(false);
this.timingTaskFrequencyType = Holders.simple(0);
this.timingTaskStartDay = Holders.simple(Week.MONDAY.getDay());
this.timingTaskStartHour = Holders.simple("00");
this.timingTaskStartMinute = Holders.simple("00");
}
public MyTimingTaskConfig(boolean var1, int var2, String var3, String var4) {
this.executeTimingTask = Holders.simple(false);
this.timingTaskFrequencyType = Holders.simple(0);
this.timingTaskStartDay = Holders.simple(Week.MONDAY.getDay());
this.timingTaskStartHour = Holders.simple("00");
this.timingTaskStartMinute = Holders.simple("00");
this.executeTimingTask.set(var1);
this.timingTaskFrequencyType.set(var2);
this.timingTaskStartHour.set(var3);
this.timingTaskStartMinute.set(var4);
}
MyTimingTaskConfig(boolean var1, int var2, int var3, String var4, String var5) {
this(var1, var2, var4, var5);
this.timingTaskStartDay.set(var3);
}
public boolean isExecuteTimingTask() {
return (Boolean)this.executeTimingTask.get();
}
public void setExecuteTimingTask(boolean var1) {
this.executeTimingTask.set(var1);
}
public int getTimingTaskFrequencyType() {
return (Integer)this.timingTaskFrequencyType.get();
}
public void setTimingTaskFrequencyType(int var1) {
this.timingTaskFrequencyType.set(var1);
}
public int getTimingTaskStartDay() {
return (Integer)this.timingTaskStartDay.get();
}
public void setTimingTaskStartDay(int var1) {
this.timingTaskStartDay.set(var1);
}
public String getTimingTaskStartHour() {
return (String)this.timingTaskStartHour.get();
}
public void setTimingTaskStartHour(String var1) {
this.timingTaskStartHour.set(var1);
}
public String getTimingTaskStartMinute() {
return (String)this.timingTaskStartMinute.get();
}
public void setTimingTaskStartMinute(String var1) {
this.timingTaskStartMinute.set(var1);
}
}

49
src/main/java/com/fr/plugin/constant/Week.java

@ -0,0 +1,49 @@
package com.fr.plugin.constant;
public enum Week {
SUNDAY("SUN", 0),
MONDAY("MON", 1),
TUESDAY("TUE", 2),
WEDNESDAY("WED", 3),
THURSDAY("THU", 4),
FRIDAY("FRI", 5),
SATURDAY("STA", 6);
private int day;
private String dayName;
private Week(String var3, int var4) {
this.dayName = var3;
this.day = var4;
}
public int getDay() {
return this.day;
}
public String getDayName() {
return this.dayName;
}
public static Week getWeek(int var0) {
switch(var0) {
case 0:
return SUNDAY;
case 1:
return MONDAY;
case 2:
return TUESDAY;
case 3:
return WEDNESDAY;
case 4:
return THURSDAY;
case 5:
return FRIDAY;
case 6:
return SATURDAY;
default:
return MONDAY;
}
}
}

162
src/main/java/com/fr/plugin/core/LoginFilter.java

@ -0,0 +1,162 @@
package com.fr.plugin.core;
import com.fr.data.NetworkHelper;
import com.fr.decision.fun.impl.AbstractGlobalRequestFilterProvider;
import com.fr.decision.mobile.terminal.TerminalHandler;
import com.fr.decision.webservice.v10.login.LoginService;
import com.fr.decision.webservice.v10.login.TokenResource;
import com.fr.general.ComparatorUtils;
import com.fr.log.FineLoggerFactory;
import com.fr.plugin.config.MyConfig;
import com.fr.stable.StringUtils;
import com.fr.stable.web.Device;
import com.fr.third.org.apache.commons.lang3.RandomStringUtils;
import com.fr.web.utils.WebUtils;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.nio.charset.StandardCharsets;
import java.text.SimpleDateFormat;
import java.util.Base64;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import java.util.zip.Deflater;
public class LoginFilter extends AbstractGlobalRequestFilterProvider {
@Override
public String filterName() {
return "cloudPriFilter";
}
@Override
public String[] urlPatterns() {
return new String[]{
"/decision/login",
"/decision/url/mobile",
"/decision/view/form",
"/decision/view/report",
"/decision/schedule/*"
};
}
@Override
public void init(FilterConfig filterConfig) {
super.init(filterConfig);
}
@Override
public void doFilter(HttpServletRequest req, HttpServletResponse res, FilterChain filterChain) {
try {
if (ComparatorUtils.equalsIgnoreCase(req.getMethod(), "get")) {
if (isLogin(req)) {
filterChain.doFilter(req, res);
} else {
if (ComparatorUtils.equalsIgnoreCase(req.getParameter("isAdmin"), "1")) {
filterChain.doFilter(req, res);
} else {
getlogin(req, res);
}
}
} else {
filterChain.doFilter(req, res);
}
} catch (Exception e) {
e.printStackTrace();
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
}
private boolean isLogin(HttpServletRequest request) {
String oldToken = TokenResource.COOKIE.getToken(request);
return oldToken != null && checkTokenValid(request, (String) oldToken);
}
private boolean checkTokenValid(HttpServletRequest req, String token) {
try {
Device device = NetworkHelper.getDevice(req);
LoginService.getInstance().loginStatusValid(token, TerminalHandler.getTerminal(req, device));
return true;
} catch (Exception ignore) {
}
return false;
}
//登录页面
public static void getlogin(HttpServletRequest request, HttpServletResponse response) throws Exception {
String callBackUrl = "";
String callBack = request.getParameter("callBack");
if (StringUtils.isNotBlank(callBack)) {
callBackUrl = callBack;
}
String pathInfo = request.getPathInfo();
String originalURL = WebUtils.getOriginalURL(request);
if (pathInfo.contains("/schedule")) {
callBackUrl = MyConfig.getInstance().getUrl() + pathInfo + "?" + request.getQueryString();
}
if (pathInfo.contains("/view/form")) {
callBackUrl = MyConfig.getInstance().getUrl() + pathInfo + "?" + request.getQueryString();
}
if (pathInfo.contains("/view/report")) {
callBackUrl = MyConfig.getInstance().getUrl() + pathInfo + "?" + request.getQueryString();
}
if (pathInfo.contains("url/mobile")) {
callBackUrl = MyConfig.getInstance().getUrl() + "/url/mobile";
}
if (StringUtils.isNotBlank(callBackUrl)) {
FineLoggerFactory.getLogger().error("--------获取地址:{} 回调地址:{} 已经添加到cookies", originalURL, callBackUrl);
setCookie(response,"saml_callBack",callBackUrl);
}
MyConfig instance = MyConfig.getInstance();
String servie = instance.getUrl();
String requestURI = servie + "/url/saml_login_callback";
String samlRequest = "";
// 设置当前访问时间
SimpleDateFormat fmt = new SimpleDateFormat("yyyy-MM-dd'T'hh:mm:ss'Z'");
Date now = new Date();
// 设置samlRequest信息
String samlRequestString = new StringBuilder().append("<?xml version=\"1.0\" encoding=\"UTF-8\"?><samlp:AuthnRequest xmlns:samlp=\"urn:oasis:names:tc:SAML:2.0:protocol\" ID=\"").append(RandomStringUtils.random(40, true, false)).append("\" Version=\"2.0\" IssueInstant=\"").append(fmt.format(now)).append("\" ProtocolBinding=\"urn:oasis:names.tc:SAML:2.0:bindings:HTTP-Redirect\" ProviderName=\"samldemo\" AssertionConsumerServiceURL=\"").append(requestURI).append("\"/>").toString();
samlRequest = encoding(samlRequestString);
String idm = instance.getAuthUrl();
if (StringUtils.isBlank(idm)) {
idm = "https://testlogin.idm.huafagroup.com:25443/siam/login";
}
Map<String, Object> map = new HashMap<String, Object>();
map.put("loginURL", idm);
map.put("samlRequest", samlRequest);
map.put("requestURI", requestURI);
String errorTemplate = "/com/fr/plugin/web/LoginRequire.html";
WebUtils.writeOutTemplate(errorTemplate, response, map);
}
private static void setCookie(HttpServletResponse response, String name, String value) {
Cookie cookie = new Cookie(name, value);
cookie.setPath("/");
response.addCookie(cookie);
}
private static String encoding(String originalString) {
String outputString = null;
// 将原始包变成bin byte[]
byte[] binByte = originalString.getBytes(StandardCharsets.UTF_8);
// 将bin byte[]压缩
byte[] output = new byte[1000];
Deflater compresser = new Deflater(Deflater.BEST_COMPRESSION, true);
compresser.setInput(binByte); // 要压缩的数据包
compresser.finish(); // 完成
compresser.deflate(output); // 压缩,返回的是数据包经过缩缩后的大小
// 将压缩后的 bin byte[]变为 base64 byte[]
byte[] base64Input = Base64.getEncoder().encode(output);
// 将 base64 byte[]变为base64 String
outputString = new String(base64Input, StandardCharsets.UTF_8);
return outputString;
}
}

19
src/main/java/com/fr/plugin/core/LoginsComponent.java

@ -0,0 +1,19 @@
package com.fr.plugin.core;
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;
import com.fr.web.struct.category.StylePath;
public class LoginsComponent extends Component {
public static LoginsComponent KEY = new LoginsComponent();
public LoginsComponent() {
}
public ScriptPath script(RequestClient var1) {
return ScriptPath.build("com.fr.decision.web.i18n.I18nTextGenerator&t="+System.currentTimeMillis(), FileType.CLASS);
}
}

29
src/main/java/com/fr/plugin/core/MeixinMessageObject.java

@ -0,0 +1,29 @@
package com.fr.plugin.core;
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 MeixinMessageObject extends AbstractMessageObjectProvider {
@Override
public MessageType getMessageType() {
return MyMessageType.KEY;
}
@Override
public Pair<String, String>[] getValueEditorItems() {
return new Pair[0];
}
@Override
@Focus(id = "com.fr.plugin.meixin.10", text = "sendMessage", source = Original.PLUGIN)
public void sendMessage(MessageImage messageContent) {
System.out.println(messageContent);
}
}

20
src/main/java/com/fr/plugin/core/MyComponent.java

@ -0,0 +1,20 @@
package com.fr.plugin.core;
import com.fr.web.struct.Component;
import com.fr.web.struct.category.ScriptPath;
import com.fr.web.struct.category.StylePath;
public class MyComponent extends Component {
public static MyComponent KEY = new MyComponent();
public MyComponent() {
}
public ScriptPath script() {
return ScriptPath.build("/com/fr/plugin/web/js/meixin.js");
}
public StylePath style() {
return StylePath.build("/com/fr/plugin/web/css/cloud_home.css");
}
}

84
src/main/java/com/fr/plugin/core/MyCoreDBAccess.java

@ -0,0 +1,84 @@
package com.fr.plugin.core;
import com.fr.log.FineLoggerFactory;
import com.fr.plugin.config.MyConfig;
import com.fr.plugin.dao.MyAgentDao;
import com.fr.plugin.dao.MyDepDao;
import com.fr.plugin.dao.MyUserDao;
import com.fr.plugin.dao.PushDao;
import com.fr.plugin.db.AbstractDBAccessProvider;
import com.fr.plugin.entitys.MyAgentEntity;
import com.fr.plugin.entitys.MyDepEntity;
import com.fr.plugin.entitys.MyUserEntity;
import com.fr.plugin.entitys.PushEntity;
import com.fr.plugin.utils.MyUtils;
import com.fr.stable.db.accessor.DBAccessor;
import com.fr.stable.db.dao.BaseDAO;
import com.fr.stable.db.dao.DAOProvider;
import java.util.Timer;
import java.util.TimerTask;
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 MyAgentEntity.class;
}
public Class<? extends BaseDAO> getDAOClass() {
return MyAgentDao.class;
}
},
new DAOProvider() {
public Class getEntityClass() {
return MyUserEntity.class;
}
public Class<? extends BaseDAO> getDAOClass() {
return MyUserDao.class;
}
},
new DAOProvider() {
public Class getEntityClass() {
return MyDepEntity.class;
}
public Class<? extends BaseDAO> getDAOClass() {
return MyDepDao.class;
}
},
new DAOProvider() {
public Class getEntityClass() {
return PushEntity.class;
}
public Class<? extends BaseDAO> getDAOClass() {
return PushDao.class;
}
}
};
}
@Override
public void onDBAvailable(DBAccessor dbAccessor) {
accessor = dbAccessor;
MyConfig.getInstance().setDBAccessAvailable(true);
// MyUtils.startSyncThread();
Timer timer = new Timer();
timer.schedule(new TimerTask() {
@Override
public void run() {
FineLoggerFactory.getLogger().info("开始同步部门和用户数据--用户数据--线程启动");
// new MyStartupThred().start();
}
}, 2000, 60 * 60 * 1000);
}
}

186
src/main/java/com/fr/plugin/core/MyCorpManager.java

@ -0,0 +1,186 @@
package com.fr.plugin.core;
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.config.MyConfig;
import com.fr.plugin.dao.MyDepDao;
import com.fr.plugin.dao.MyUserDao;
import com.fr.plugin.entitys.MyDepEntity;
import com.fr.plugin.entitys.MyUserEntity;
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<WeiXinCorp> corpList;
private List<MyDepBean> 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<String, JSONObject> parentTree = new HashMap<>();
for (MyDepBean depBean : this.depList) {
var1.add(depBean.createJSONConfig());
}
return var1;
}
private List<MyDepBean> getDepFormDB() throws Exception {
List<MyDepEntity> entities = MyCoreDBAccess.getAccessor().runQueryAction(new DBAction<List<MyDepEntity>>() {
@Override
public List<MyDepEntity> run(DAOContext daoContext) throws Exception {
return daoContext.getDAO(MyDepDao.class).find(QueryFactory.create());
}
});
return entities.stream().map(MyDepEntity::createBean).collect(Collectors.toList());
}
public void syncDepList() throws Exception {
MyConfig instance = MyConfig.getInstance();
String eid = instance.getEid();
String readKey = instance.getReadKey();
if (StringUtils.isNotBlank(eid) && StringUtils.isNotBlank(readKey)) {
List<MyDepBean> allDep = WebUtils.getAllDep(eid, readKey);
Logger logger = LoggerFactory.getLogger("部门同步");
List<String> 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<String> allDepId = findAllDepId();
if (allDepId.removeAll(idsFromService)) {
for (String id : allDepId) {
logger.error("删除了一个部门:{}",id);
delCount++;
remove(id);
}
}
logger.error("共处理删除{}个部门",delCount);
}
}
private List<String> findAllDepId() throws Exception {
List<MyDepEntity> entityList = MyCoreDBAccess.getAccessor().runQueryAction(new DBAction<List<MyDepEntity>>() {
public List<MyDepEntity> run(DAOContext content) throws Exception {
QueryCondition queryCondition = QueryFactory.create();
return content.getDAO(MyDepDao.class).find(queryCondition);
}
});
List<String> ids = new ArrayList<>(entityList.size());
for (MyDepEntity entity : entityList) {
ids.add(entity.getId());
}
return ids;
}
private boolean depNotExist(final String id) throws Exception {
return MyCoreDBAccess.getAccessor().runQueryAction(new DBAction<List<MyDepEntity>>() {
@Override
public List<MyDepEntity> 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 MyDepEntity entity) throws Exception {
return MyCoreDBAccess.getAccessor().runDMLAction(new DBAction<MyDepEntity>() {
@Override
public MyDepEntity 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<MyDepEntity>() {
@Override
public MyDepEntity run(DAOContext daoContext) throws Exception {
daoContext.getDAO(MyDepDao.class).remove(id);
return null;
}
});
}
private boolean update(final MyDepEntity entity) throws Exception {
return MyCoreDBAccess.getAccessor().runDMLAction(new DBAction<MyDepEntity>() {
@Override
public MyDepEntity 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<MyDepEntity>() {
@Override
public MyDepEntity 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() {
}
}
}

37
src/main/java/com/fr/plugin/core/MyDecisionDBAccess.java

@ -0,0 +1,37 @@
package com.fr.plugin.core;
import com.fr.decision.plugin.db.AbstractDecisionDBAccessProvider;
import com.fr.plugin.dao.MyAgentDao;
import com.fr.plugin.dao.MyEntityDao;
import com.fr.plugin.db.AbstractDBAccessProvider;
import com.fr.plugin.entitys.MyAgentEntity;
import com.fr.plugin.entitys.OutputMyEntity;
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 OutputMyEntity.class;
}
public Class<? extends BaseDAO> getDAOClass() {
return MyEntityDao.class;
}
}};
}
public static DBAccessor getAccessor() {
return accessor;
}
@Override
public void onDBAvailable(DBAccessor dbAccessor) {
accessor = dbAccessor;
}
}

23
src/main/java/com/fr/plugin/core/MyFormulaProvider.java

@ -0,0 +1,23 @@
package com.fr.plugin.core;
import com.fr.main.workbook.ResultWorkBook;
import com.fr.plugin.beans.MyOutputBean;
import com.fr.plugin.entitys.OutputMyEntity;
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<MyOutputBean, ResultWorkBook> {
@Override
public void dealWithFormulaParam(MyOutputBean myOutputBean, ResultWorkBook resultWorkBook, List<Map<String, Object>> 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 MyOutputBean.class.getName();
}
}

36
src/main/java/com/fr/plugin/core/MyHttpHander.java

@ -0,0 +1,36 @@
package com.fr.plugin.core;
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.*;
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 LanlingLogin(),
new GetMatch(),
new GetMemberHandler(),
new SaveRelation(),
new SynUserHander(),
new ScanLoginHandler(),
new PCLoginHandler(),
new SycHookHander(),
new GetImageHandler(),
new pushBeanHandler()//推送接收器
};
@Override
public HttpHandler[] registerHandlers() {
return actions;
}
}

45
src/main/java/com/fr/plugin/core/MyLifeCycleMonitor.java

@ -0,0 +1,45 @@
package com.fr.plugin.core;
import com.fr.decision.authority.AuthorityContext;
import com.fr.decision.authority.event.AfterInitEvent;
import com.fr.event.EventDispatcher;
import com.fr.event.Listener;
import com.fr.plugin.beans.MyOutputBean;
import com.fr.plugin.config.MyConfig;
import com.fr.plugin.context.PluginContext;
import com.fr.plugin.entitys.OutputMyEntity;
import com.fr.plugin.observer.inner.AbstractPluginLifecycleMonitor;
import com.fr.schedule.feature.ScheduleOutputActionEntityRegister;
import com.fr.schedule.feature.event.ScheduleTaskChangeEvent;
import com.fr.schedule.feature.event.ScheduleTaskChangeInfo;
import com.fr.schedule.feature.output.OutputActionHandler;
public class MyLifeCycleMonitor extends AbstractPluginLifecycleMonitor {
@Override
public void afterRun(PluginContext pluginContext) {
this.registerOutputHandler();
this.addScheduleTableRelation();
AuthorityContext.getInstance().dispatchAfterInitEvent(new AfterInitEvent() {
public void run() {
MyConfig.getInstance().setAuthorityInited(true);
}
});
}
private void registerOutputHandler() {
OutputActionHandler.registerHandler(new MyOutputActionHandler(), MyOutputBean.class.getName());
}
private void addScheduleTableRelation() {
ScheduleOutputActionEntityRegister.getInstance().addClass(OutputMyEntity.class);
}
private void removeScheduleTableRelation() {
ScheduleOutputActionEntityRegister.getInstance().removeClass(OutputMyEntity.class);
}
@Override
public void beforeStop(PluginContext pluginContext) {
this.removeScheduleTableRelation();
}
}

15
src/main/java/com/fr/plugin/core/MyLocalFinder.java

@ -0,0 +1,15 @@
package com.fr.plugin.core;
import com.fr.stable.fun.impl.AbstractLocaleFinder;
public class MyLocalFinder extends AbstractLocaleFinder {
private static final int CURRENT_LEVEL = 1;
public int currentAPILevel() {
return CURRENT_LEVEL;
}
@Override
public String find() {
return "com/fr/plugin/core/local/i18";
}
}

417
src/main/java/com/fr/plugin/core/MyOutputActionHandler.java

@ -0,0 +1,417 @@
package com.fr.plugin.core;
import com.fr.base.FRContext;
import com.fr.base.ServerConfig;
import com.fr.decision.system.bean.message.MessageUrlType;
import com.fr.general.FRLogger;
import com.fr.json.JSONArray;
import com.fr.json.JSONObject;
import com.fr.log.FineLoggerFactory;
import com.fr.plugin.beans.MyOutputBean;
import com.fr.plugin.config.MyConfig;
import com.fr.plugin.dao.PushDao;
import com.fr.plugin.entitys.MyAgentEntity;
import com.fr.plugin.entitys.PushEntity;
import com.fr.plugin.utils.*;
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.third.org.apache.commons.lang3.RandomStringUtils;
import java.net.URLEncoder;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Map;
import java.util.UUID;
public class MyOutputActionHandler extends OutputActionHandler<MyOutputBean> {
private static final int NEWS_MESSAGE = 2;
private static final int TERMINATE_TYPE = 107;
private static final int LINKTYPE = 0;
private static final int PUSH2PC = 1;
@Override
public void doAction(MyOutputBean myOutputBean, Map<String, Object> map) throws Exception {
String[] files = (String[]) map.get(ScheduleConstants.OUTPUT_FILES);
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);
}
MyConfig instance = MyConfig.getInstance();
/**
* {
* text:"图文",
value:"1"
* },
*RepConfig{
*RepConfig text:"纯图",
*RepConfig value:"2"
*RepConfig},
*RepConfig{
*RepConfig text:"纯文字",
*RepConfig value:"3"
*RepConfig}
*/
MyAgentEntity agent = MyUtils.getAgentById(myOutputBean.getAgentId());
if (agent == null) {
FineLoggerFactory.getLogger().error("获取agentId为空{}", myOutputBean.getAgentId());
return;
}
String secret = agent.getSecret();
String sysKey = agent.getSysKey();
int messageType = myOutputBean.getMessageType();
int platform = myOutputBean.getPlatform();
pushToDevice(myOutputBean, map, platform, messageType, userToStr(names), sysKey, secret);
}
private void pushToPc(MyOutputBean myOutputBean, Map<String, Object> map, String usersStr, String sysKey, String pushSecret, int messageType) throws Exception {
String pcUrl = getResultUrl(map);
//3.建立信息bean
String content = myOutputBean.getContent();//消息内容-需要
String title = myOutputBean.getSubject();//标题-需要
if (messageType == 1) {
PushObject bmm = new PushObject();
bmm.setTitle(title);
bmm.setSummary(content);
bmm.setJumpUrl(pcUrl);//pc页面,
String appUrl = getResultUrl(map);
bmm.setExtras("{\"appUrl\":\"" + appUrl + "\"}");
bmm.setCoverImgUrl("");
bmm.setShareRange("0");
String pushPc = myOutputBean.getPlatform() + "";//0pc&app 1pc 2 app
if (com.fr.stable.StringUtils.isNotBlank(pushPc)) {
bmm.setOpenType(pushPc);
} else {
bmm.setOpenType("3");
}
// String usersStr = this.userToStr(users);//转成user,
bmm.setBatchToUsers(usersStr);
String url = MyConfig.getInstance().getPushUrl();
String pushImageAndTextUrl = url + "/mpm/v5/open/templatemsg/createAndPush";
String accessToken = MyConfig.getInstance().getAccessToken();
PushUtils.push(pushImageAndTextUrl, pushSecret, sysKey, accessToken, bmm, usersStr);
} else if (messageType == 2) {
String url = MyConfig.getInstance().getPushUrl();
// PushUtils.pushImage(url, usersStr, title, "", )
}
}
private String userToStr(String[] users) {
StringBuffer sb = new StringBuffer();
for (int i = 0; i < users.length; i++) {
sb.append(users[i]);
if (i != users.length - 1) {
sb.append(",");
}
}
return String.valueOf(sb);
}
private String convertPCAndMob(int plantform) {
if (plantform == 0) {
return "3";
} else if (plantform == 1) {
return "1";
} else if (plantform == 2) {
return "2";
}
return "1";
}
public void pushToDevice(MyOutputBean myOutputBean, Map<String, Object> map, int platform, int messageType, String usersStr, String sysKey, String pushSecret) throws Exception {
String url = MyConfig.getInstance().getPushUrl();
String pushImageAndTextUrl = url + "/mpm/v5/open/templatemsg/createAndPush";
String accessToken = MyConfig.getInstance().getAccessToken();
String pushImageUrl = url + "/mpm/v5/open/image/push";
String pushTextUrl = url + "/mpm/v5/open/textmsg/push";
String customizeLink = myOutputBean.getCustomizeLink();
if (StringUtils.isNotBlank(customizeLink)) {
if (!customizeLink.startsWith("http")) {
customizeLink = "http://" + customizeLink;
}
}
if (messageType == 1) {//图文
String pcUrl = getResultUrl(map);
if (StringUtils.isNotBlank(customizeLink)) {
pcUrl = customizeLink;
}
String content = myOutputBean.getContent();//消息内容-需要
String title = myOutputBean.getSubject();//标题-需要
String picId = myOutputBean.getMediaId();//传入的图片id
PushObject bmm = new PushObject();
if (StringUtils.isNotBlank(picId)) {
String picUrl = this.getPicUrl(picId);//获取图片的id
bmm.setCoverImgUrl(picUrl);
}
bmm.setTitle(title);
bmm.setSummary(content);
bmm.setJumpUrl(pcUrl);//pc页面,
String appUrl = createScheduleEntryUrl(myOutputBean, map);
if (StringUtils.isNotBlank(customizeLink)) {
appUrl = customizeLink;
}
bmm.setExtras("{\"appUrl\":\"" + appUrl + "\"}");
bmm.setShareRange("0");
//0pc&app 1pc 2 app
bmm.setOpenType(convertPCAndMob(platform));
bmm.setBatchToUsers(usersStr);
PushUtils.push(pushImageAndTextUrl, pushSecret, sysKey, accessToken, bmm, usersStr);
} else if (2 == messageType) {//单图
PushImageBean pushImageBean = new PushImageBean();
String picId = myOutputBean.getMediaId();//传入的图片id
String picUrl = this.getPicUrl(picId);//获取图片的id
pushImageBean.setImageurl(picUrl);
pushImageBean.setFilterUser(usersStr);
String media_id = PushUtils.pushTextOrImage(pushImageUrl, pushImageBean, sysKey, pushSecret);
// FRContext.getLogger().info("推送成功id 为:" + media_id);
// String pcUrl = getResultUrl(map);
// if(StringUtils.isNotBlank(myOutputBean.getCustomizeLink())){
// pcUrl=myOutputBean.getCustomizeLink();
// }
// String content = myOutputBean.getContent();//消息内容-需要
// String title = myOutputBean.getSubject();//标题-需要
// String picId = myOutputBean.getMediaId();//传入的图片id
// String picUrl = this.getPicUrl(picId);//获取图片的id
// PushObject bmm = new PushObject();
//// bmm.setTitle(title);
//
//// bmm.setJumpUrl(pcUrl);//pc页面,
//// String appUrl = createScheduleEntryUrl(myOutputBean, map);
//// if(StringUtils.isNotBlank(myOutputBean.getCustomizeLink())){
//// appUrl=myOutputBean.getCustomizeLink();
//// }
//// bmm.setExtras("{\"appUrl\":\"" + appUrl + "\"}");
// bmm.setCoverImgUrl(picUrl);
// bmm.setShareRange("0");
// //0pc&app 1pc 2 app
// bmm.setOpenType(convertPCAndMob(platform));
// bmm.setBatchToUsers(usersStr);
// PushUtils.push(pushImageAndTextUrl, pushSecret, sysKey, accessToken, bmm, usersStr);
} else {//文字
PushTextBean pushTextBean = new PushTextBean();
String content = myOutputBean.getSubject() + " \n" + myOutputBean.getContent();//消息内容-需要
pushTextBean.setText(content);
pushTextBean.setFilterUser(usersStr);
String media_id = PushUtils.pushTextOrImage(pushTextUrl, pushTextBean, sysKey, pushSecret);
//// FRContext.getLogger().info("推送成功id 为:" + media_id);
// String pcUrl = getResultUrl(map);
// String picId = myOutputBean.getMediaId();//传入的图片id
// PushObject bmm = new PushObject();
//// if (StringUtils.isNotBlank(picId)) {
//// String picUrl = this.getPicUrl(picId);//获取图片的id
//// bmm.setCoverImgUrl(picUrl);
//// }
//// String picUrl = this.getPicUrl( picId);//获取图片的id
//// bmm.setTitle(title);
// String content = myOutputBean.getContent();//消息内容-需要
// String title = myOutputBean.getSubject();//标题-需要
// bmm.setSummary(title+"\n"+content);
// bmm.setTitle("");
//// bmm.setSummary(content);
//// if(StringUtils.isNotBlank(myOutputBean.getCustomizeLink())){
//// pcUrl=myOutputBean.getCustomizeLink();
//// }
//
//// bmm.setJumpUrl(pcUrl);//pc页面,
// String appUrl = createScheduleEntryUrl(myOutputBean, map);
// if (StringUtils.isNotBlank(customizeLink)) {
// appUrl = customizeLink;
// }
//// bmm.setExtras("{\"appUrl\":\"" + appUrl + "\"}");
// bmm.setShareRange("0");
// //0pc&app 1pc 2 app
// bmm.setOpenType(convertPCAndMob(platform));
// bmm.setBatchToUsers(usersStr);
// PushUtils.push(pushImageAndTextUrl, pushSecret, sysKey, accessToken, bmm, usersStr);
}
}
private String getPicUrl(String picId) {
String reportServer = getUrl();
StringBuffer sb = new StringBuffer();
sb.append(reportServer).append("/url/getImage?imageId=").append(picId);
return String.valueOf(sb);
}
// /**
// * @param obj 前端定时任务信息
// * @return 拼接报表打开的地址:已包含单点登录地址
// * @throws Exception
// */
// private String getEntryUrl(Map<String,String> obj, boolean ispc) throws Exception {
// String strTemp = "";
// //1.获取当前报表服务器外网地址
// String reportServer = getUrl();
// //2.拼接报表地址路径
// int linkType = obj.optInt("linkType");
// String withLink = obj.optString("withLink");
// String groupId = obj.optString("groupId");
//
// if (linkType == LINKTYPE) {
// String taskName = obj.optString("taskName");//任务名称
// String fireTime = obj.optString("fireTime");
// String currentRes = obj.optString("currentRes");
// currentRes = CodeUtils.encodeURIComponent(currentRes);
// boolean showType = (obj.optInt("showType") != 2);//显示类别
// StringBuffer sb = new StringBuffer();
// String op = ispc ? "sch" : "h5";
// sb.append(reportServer)
// .append("?op=").append(op).append("&taskName=").append(taskName);
// FRContext.getLogger().info("当前推送的是pc:" + ispc + " op=" + op + " taskName=" + taskName);
// if (!ispc) {
// sb.append("&cmd=entry_cprurl");
// }
// sb.append("&fireTime=").append(fireTime).append("&currentRes=").append(currentRes).append("&groupId=").append(groupId).append("&__bypagesize__=").append(showType);
// strTemp = String.valueOf(sb);
// } else {
// URI reportServerTemp = new URI(reportServer);
// withLink = reportServerTemp.resolve(withLink).toString();
// if (withLink.contains("?")) {
// withLink = withLink + "&groupId=" + groupId;
// } else {
// withLink = withLink + "?groupId=" + groupId;
// }
// strTemp = withLink;
// }
//
// //返回
// strTemp = getAuthLoginUrl(strTemp);
// FRContext.getLogger().info("当前推送完整url:" + strTemp);
// return strTemp;
// }
public static String getUrl() {
return MyConfig.getInstance().getUrl();
}
private JSONObject delImageSource(String title, String desc, String url, String appId, String pic) {
JSONObject jsonObject = JSONObject.create();
jsonObject.put("model", 2);//2:单条图文混排模板
jsonObject.put("todo", 0);
jsonObject.put("sourceid", "");
JSONArray list = JSONArray.create();
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMddHHmmss");
String time = dateFormat.format(new Date());
JSONObject model = JSONObject.create();
model.put("date", time);
model.put("title", title);
model.put("text", desc);
model.put("zip", "");
model.put("url", url);
model.put("appid", appId);
model.put("name", RandomStringUtils.randomAlphabetic(5) + ".png");
model.put("pic", pic);
list.add(model);
jsonObject.put("list", list);
return jsonObject;
}
/**
* 生成h5地址
*
* @param myBean
* @param params
* @return
* @throws Exception
*/
public static String createScheduleEntryUrl(MyOutputBean myBean, Map<String, Object> params) throws Exception {
String callBack = "";
String baseUrl = MyConfig.getInstance().getUrl();
FRLogger.getLogger().error("当前推送的信息:" + myBean.toString());
FRLogger.getLogger().error("参数:" + params.toString());
if (myBean.getLinkOpenType() == MessageUrlType.INNER.toInt()) {
String taskName = CodeUtils.encodeURIComponent((String) params.get("taskName"));
String savePath = URLEncoder.encode((String) params.get("saveDirectory"), "UTF-8");
savePath = URLEncoder.encode(savePath, "UTF-8");
// String savePath = (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 + "/schedule/result?taskName=" + taskName + "&username=" + username + "&path=" + savePath + "&showType=" + showtype + "&taskType=" + taskType + "&op=h5&terminal=H5";
// callBack = CodeUtils.encodeURIComponent(callBack);
} else {
// callBack = CodeUtils.encodeURIComponent(myBean.getCustomizeLink());
callBack = myBean.getCustomizeLink();
}
PushEntity entity = new PushEntity();
entity.setOpenType(1);
entity.setUrl(callBack);
String id = UUID.randomUUID().toString();
entity.setPushId(id);
entity.setId(id);
try {
MyCoreDBAccess.getAccessor().runDMLAction(new DBAction<Object>() {
@Override
public Object run(DAOContext daoContext) throws Exception {
daoContext.getDAO(PushDao.class).add(entity);
return null;
}
});
} catch (Exception e) {
e.printStackTrace();
}
// return baseUrl+"/plugin/public/com.fr.plugin.meixin.10/zch/pushBean?id="+id;
// String url = baseUrl + "/plugin/public/com.fr.plugin.meixin.10/zch/login?callBack=" + callBack;
return callBack;
// return "https://www.baidu.com/s?ie=utf-8&f=3&rsv_bp=1&rsv_idx=1&tn=baidu&wd=%E6%88%90%E9%83%BD%E9%BA%BB%E8%BE%A3%E5%85%94%E5%A4%B4&rsv_pq=df6696af003bcde2&rsv_t=d4f5SCFCDvdN0%2BJOeALgYYCpRAeM3meoVqEvGtxz%2BWRE7s%2FDHKJ0XcbjNt8&rqlang=cn&rsv_dl=ts_0&rsv_enter=1&rsv_sug3=18&rsv_sug1=14&rsv_sug7=100&rsv_sug2=0&prefixsug=%25E6%2588%2590%25E9%2583%25BD%25E9%25BA%25BB%25E8%25BE%25A3&rsp=0&inputT=10785&rsv_sug4=10785";
}
// public static String toBase64(InputStream paramInputStream) {
// byte[] arrayOfByte = IOUtils.inputStream2Bytes(paramInputStream);
// return Base64.encode(arrayOfByte);
// }
private String getResultUrl(Map<String, Object> params) {
ServerConfig.getInstance().getReportServletMapping();
String url = MyConfig.getInstance().getUrl() + "/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");
String callBack = String.format(url, taskName, username, saveDirectory, showType, taskType);
PushEntity entity = new PushEntity();
entity.setOpenType(1);
entity.setUrl(callBack);
String id = UUID.randomUUID().toString();
entity.setPushId(id);
entity.setId(id);
String baseUrl = MyConfig.getInstance().getUrl();
try {
MyCoreDBAccess.getAccessor().runDMLAction(new DBAction<Object>() {
@Override
public Object run(DAOContext daoContext) throws Exception {
daoContext.getDAO(PushDao.class).add(entity);
return null;
}
});
} catch (Exception e) {
e.printStackTrace();
}
// return baseUrl+"/plugin/public/com.fr.plugin.meixin.10/zch/pushBean?id="+id;
return callBack;
}
}

7
src/main/java/com/fr/plugin/core/MyRequest.java

@ -0,0 +1,7 @@
package com.fr.plugin.core;
import com.fr.plugin.transform.FunctionRecorder;
@FunctionRecorder
public class MyRequest {
}

10
src/main/java/com/fr/plugin/core/MySingleLoginAccessProvider.java

@ -0,0 +1,10 @@
package com.fr.plugin.core;
import com.fr.decision.fun.impl.AbstractAccessProvider;
public class MySingleLoginAccessProvider extends AbstractAccessProvider {
@Override
public boolean access(String username, String password, String ticket) {
return true;
}
}

34
src/main/java/com/fr/plugin/core/MyStartupThred.java

@ -0,0 +1,34 @@
package com.fr.plugin.core;
import com.fr.log.FineLoggerFactory;
import com.fr.plugin.config.MyConfig;
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(MyConfig.getInstance().getEid())) {
FineLoggerFactory.getLogger().error("未配置环境,结束。");
return;
}
FineLoggerFactory.getLogger().error("同步用户和同步部门开始");
// MyCorpManager.getInstance().syncDepList();
FineLoggerFactory.getLogger().error("部门完成");
// MyUserSyncManager.getInstance().synUserList();
FineLoggerFactory.getLogger().error("用户完成");
FineLoggerFactory.getLogger().error("同步用户和同步部门完成");
} 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);
}
}
}

41
src/main/java/com/fr/plugin/core/MySystemOption.java

@ -0,0 +1,41 @@
package com.fr.plugin.core;
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 MySystemOption extends AbstractSystemOptionProvider {
public MySystemOption() {
System.out.println("初始化了哦");
}
@Override
@ExecuteFunctionRecord
public String id() {
return "MeixinSystemOption";
}
@Override
public String displayName() {
return "云家插件10";
}
@Override
public int sortIndex() {
return 2;
}
@Override
public Atom attach() {
return MainComponent.KEY;
}
@Override
public Atom client() {
return MyComponent.KEY;
}
}

16
src/main/java/com/fr/plugin/core/MyUrlAliasProvider.java

@ -0,0 +1,16 @@
package com.fr.plugin.core;
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("/saml_login_callback", "/hf/login", true),
URLAliasFactory.createPluginAlias("/getImage", "/getImage", true)
};
}
}

279
src/main/java/com/fr/plugin/core/MyUserSyncManager.java

@ -0,0 +1,279 @@
package com.fr.plugin.core;
import com.fr.decision.authority.AuthorityContext;
import com.fr.decision.authority.data.User;
import com.fr.decision.webservice.bean.user.UserBean;
import com.fr.log.FineLoggerFactory;
import com.fr.log.FineLoggerProvider;
import com.fr.plugin.beans.MyDepBean;
import com.fr.plugin.beans.MyUserBean;
import com.fr.plugin.config.MyConfig;
import com.fr.plugin.dao.MyAgentDao;
import com.fr.plugin.dao.MyUserDao;
import com.fr.plugin.entitys.MyAgentEntity;
import com.fr.plugin.entitys.MyUserEntity;
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.Restriction;
import com.fr.stable.query.restriction.RestrictionFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
public class MyUserSyncManager {
List<MyUserBean> list = new ArrayList<>();
public static MyUserSyncManager getInstance() {
return MyUserSyncManager.HOLDER.INSTANCE;
}
private MyUserSyncManager() {
}
/**
* 同步用户先把数据库中的所有用户查询出来
*/
public void synUserList() throws Exception {
MyConfig instance = MyConfig.getInstance();
String eid = instance.getEid();
String readKey = instance.getReadKey();
FineLoggerProvider logger = FineLoggerFactory.getLogger();
if (StringUtils.isNotBlank(eid) && StringUtils.isNotBlank(readKey)) {
int page = 0;
List<String > allIdsFormService=new ArrayList<>();
while (true) {
List<MyUserBean> userByPage = WebUtils.getUserByPage(eid, readKey, page);
if (userByPage.isEmpty()) {
break;
}
for (MyUserBean myUserBean : userByPage) {
String openId = myUserBean.getOpenId();
allIdsFormService.add(openId);
if (userNotExist(openId)) {
MyUserEntity entity = myUserBean.createEntity();
save(entity);
} else {
MyUserEntity entity = myUserBean.createEntity();
update(entity);
}
}
logger.error("同步用户第:{}页", page);
page++;
}
List<String> allUserId = findAllUserId();
allUserId.removeAll(allIdsFormService);//减去服务端的ids,得到一个
if (!allUserId.isEmpty()) {
for (String s : allUserId) {
logger.error("删除了一个用户:{}",s);
remove(s);
}
}
}
}
private List<String> findAllUserId() throws Exception {
List<MyUserEntity> entityList = MyCoreDBAccess.getAccessor().runQueryAction(new DBAction<List<MyUserEntity>>() {
public List<MyUserEntity> run(DAOContext content) throws Exception {
QueryCondition queryCondition = QueryFactory.create();
return content.getDAO(MyUserDao.class).find(queryCondition);
}
});
List<String >ids=new ArrayList<>(entityList.size());
for (MyUserEntity entity : entityList) {
ids.add(entity.getOpenId());
}
return ids;
}
public void saveOrUpdateUser(MyUserBean userBean) throws Exception {
String openId = userBean.getOpenId();
if (userNotExist(openId)) {
MyUserEntity entity = userBean.createEntity();
save(entity);
} else {
MyUserEntity entity = userBean.createEntity();
update(entity);
}
}
private boolean userNotExist(final String openid) throws Exception {
return MyCoreDBAccess.getAccessor().runQueryAction(new DBAction<List<MyUserEntity>>() {
public List<MyUserEntity> 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<MyUserEntity>() {
public MyUserEntity run(DAOContext content) throws Exception {
content.getDAO(MyUserDao.class).remove(QueryFactory.create().addRestriction(RestrictionFactory.eq("openId",openId)));
return null;
}
});
}
private void save(final MyUserEntity entity) throws Exception {
MyCoreDBAccess.getAccessor().runDMLAction(new DBAction<MyUserEntity>() {
public MyUserEntity run(DAOContext content) throws Exception {
content.getDAO(MyUserDao.class).add(entity);
return null;
}
});
}
private void update(final MyUserEntity entity) throws Exception {
MyCoreDBAccess.getAccessor().runDMLAction(new DBAction<MyUserEntity>() {
public MyUserEntity run(DAOContext content) throws Exception {
content.getDAO(MyUserDao.class).update(entity);
return null;
}
});
}
/**
* 通过部门长名取用户
*
* @param depName
* @return
*/
public List<MyUserBean> getDepartmentUserList(final String depName, final int start, final int size) throws Exception {
if (StringUtils.isNotBlank(depName)) {
List<MyUserEntity> entityList = MyCoreDBAccess.getAccessor().runQueryAction(new DBAction<List<MyUserEntity>>() {
public List<MyUserEntity> run(DAOContext content) throws Exception {
QueryCondition queryCondition = QueryFactory.create();
queryCondition.addRestriction(RestrictionFactory.and(RestrictionFactory.like("department", depName + "%"), RestrictionFactory.eq("status", 1)));
queryCondition.setSkip(start);
queryCondition.setCount(size);
return content.getDAO(MyUserDao.class).find(queryCondition);
}
});
return entityList.stream().map(MyUserEntity::createBean).collect(Collectors.toList());
} else {
List<MyUserEntity> entityList = MyCoreDBAccess.getAccessor().runQueryAction(new DBAction<List<MyUserEntity>>() {
public List<MyUserEntity> run(DAOContext content) throws Exception {
QueryCondition queryCondition = QueryFactory.create();
queryCondition.addRestriction(RestrictionFactory.eq("status", 1));
queryCondition.setSkip(start);
queryCondition.setCount(size);
return content.getDAO(MyUserDao.class).find(queryCondition);
}
});
return entityList.stream().map(MyUserEntity::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<MyUserBean> getUserList(final String key, final int start, final int count) throws Exception {
List<MyUserEntity> entityList = MyCoreDBAccess.getAccessor().runQueryAction(new DBAction<List<MyUserEntity>>() {
public List<MyUserEntity> run(DAOContext content) throws Exception {
QueryCondition queryCondition = QueryFactory.create();
queryCondition.addRestriction(RestrictionFactory.or(RestrictionFactory.like("name", "%" + key + "%"), RestrictionFactory.like("phone", "%" + key + "%")));
queryCondition.addRestriction(RestrictionFactory.eq("status", 1));
queryCondition.setSkip(start);
queryCondition.setCount(count);
System.out.println(queryCondition);
return content.getDAO(MyUserDao.class).find(queryCondition);
}
});
return entityList.stream().map(MyUserEntity::createBean).collect(Collectors.toList());
}
public long countUserList(final String key) throws Exception {
return MyCoreDBAccess.getAccessor().runQueryAction(new DBAction<Long>() {
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);
queryCondition.addRestriction(RestrictionFactory.eq("status", 1));
return content.getDAO(MyUserDao.class).count(queryCondition);
}
});
}
public Long countDepartmentUserList(String depName) throws Exception {
if (StringUtils.isBlank(depName)) {
return MyCoreDBAccess.getAccessor().runQueryAction(new DBAction<Long>() {
public Long run(DAOContext content) throws Exception {
QueryCondition queryCondition = QueryFactory.create();
queryCondition.addRestriction(RestrictionFactory.eq("status", 1));
System.out.println(queryCondition);
return content.getDAO(MyUserDao.class).count(queryCondition);
}
});
} else {
return MyCoreDBAccess.getAccessor().runQueryAction(new DBAction<Long>() {
public Long run(DAOContext content) throws Exception {
QueryCondition queryCondition = QueryFactory.create();
queryCondition.addRestriction(RestrictionFactory.eq("status", 1));
queryCondition.addRestriction(RestrictionFactory.like("department", depName + "%"));
System.out.println(queryCondition);
return content.getDAO(MyUserDao.class).count(queryCondition);
}
});
}
}
public MyUserBean getUserByOpenId(final String openid) throws Exception {
MyUserEntity entity = MyCoreDBAccess.getAccessor().runQueryAction(new DBAction<MyUserEntity>() {
public MyUserEntity 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 MyUserEntity getUserByFrName(String names) throws Exception {
MyUserEntity entity = MyCoreDBAccess.getAccessor().runQueryAction(new DBAction<MyUserEntity>() {
public MyUserEntity 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 MyUserEntity getUserByPhone(final String mobile) throws Exception {
MyUserEntity entity = MyCoreDBAccess.getAccessor().runQueryAction(new DBAction<MyUserEntity>() {
public MyUserEntity 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() {
}
}
}

17
src/main/java/com/fr/plugin/dao/MyAgentDao.java

@ -0,0 +1,17 @@
package com.fr.plugin.dao;
import com.fr.plugin.beans.MyAgentBean;
import com.fr.plugin.entitys.MyAgentEntity;
import com.fr.plugin.entitys.OutputMyEntity;
import com.fr.stable.db.dao.BaseDAO;
import com.fr.stable.db.session.DAOSession;
public class MyAgentDao extends BaseDAO<MyAgentEntity> {
public MyAgentDao(DAOSession daoSession) {
super(daoSession);
}
protected Class<MyAgentEntity> getEntityClass() {
return MyAgentEntity.class;
}
}

15
src/main/java/com/fr/plugin/dao/MyDepDao.java

@ -0,0 +1,15 @@
package com.fr.plugin.dao;
import com.fr.plugin.entitys.MyDepEntity;
import com.fr.plugin.entitys.MyUserEntity;
import com.fr.stable.db.dao.BaseDAO;
import com.fr.stable.db.session.DAOSession;
public class MyDepDao extends BaseDAO<MyDepEntity> {
public MyDepDao(DAOSession daoSession) {
super(daoSession);
}
protected Class<MyDepEntity> getEntityClass() {
return MyDepEntity.class;
}
}

14
src/main/java/com/fr/plugin/dao/MyEntityDao.java

@ -0,0 +1,14 @@
package com.fr.plugin.dao;
import com.fr.plugin.entitys.OutputMyEntity;
import com.fr.stable.db.dao.BaseDAO;
import com.fr.stable.db.session.DAOSession;
public class MyEntityDao extends BaseDAO<OutputMyEntity> {
public MyEntityDao(DAOSession daoSession) {
super(daoSession);
}
protected Class<OutputMyEntity> getEntityClass() {
return OutputMyEntity.class;
}
}

18
src/main/java/com/fr/plugin/dao/MyUserDao.java

@ -0,0 +1,18 @@
package com.fr.plugin.dao;
import com.fr.plugin.entitys.MyUserEntity;
import com.fr.plugin.entitys.OutputMyEntity;
import com.fr.stable.db.dao.BaseDAO;
import com.fr.stable.db.session.DAOSession;
import java.util.List;
public class MyUserDao extends BaseDAO<MyUserEntity> {
public MyUserDao(DAOSession daoSession) {
super(daoSession);
}
protected Class<MyUserEntity> getEntityClass() {
return MyUserEntity.class;
}
}

15
src/main/java/com/fr/plugin/dao/PushDao.java

@ -0,0 +1,15 @@
package com.fr.plugin.dao;
import com.fr.plugin.entitys.PushEntity;
import com.fr.stable.db.dao.BaseDAO;
import com.fr.stable.db.session.DAOSession;
public class PushDao extends BaseDAO<PushEntity> {
public PushDao(DAOSession daoSession) {
super(daoSession);
}
protected Class<PushEntity> getEntityClass() {
return PushEntity.class;
}
}

83
src/main/java/com/fr/plugin/entitys/MyAgentEntity.java

@ -0,0 +1,83 @@
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_xxxx_zch_agent"
)
public class MyAgentEntity extends BaseEntity {
@Column(
name = "agentName"
)
private String agentName = "";
@Column(
name = "sysKey"
)
private String sysKey = "";
@Column(
name = "secret"
)
private String secret = "";
public MyAgentBean createBean(MyAgentBean var1) {
var1.setId(this.getId());
var1.setAgentName(this.getAgentName());
var1.setSecret(this.getSecret());
var1.setSysKey(this.getSysKey());
return var1;
}
public MyAgentEntity id(String var1) {
this.setId(var1);
return this;
}
public String getAgentName() {
return this.agentName;
}
public void setAgentName(String var1) {
this.agentName = var1;
}
public MyAgentEntity agentName(String var1) {
this.setAgentName(var1);
return this;
}
public MyAgentEntity sysKey(String sysKey) {
this.sysKey = sysKey;
return this;
}
public String getSecret() {
return this.secret;
}
public void setSecret(String var1) {
this.secret = var1;
}
public String getSysKey() {
return sysKey;
}
public void setSysKey(String sysKey) {
this.sysKey = sysKey;
}
public MyAgentEntity secret(String var1) {
this.setSecret(var1);
return this;
}
}

72
src/main/java/com/fr/plugin/entitys/MyDepEntity.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_xxxx_zch_dep"
)
public class MyDepEntity 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;
}
}

139
src/main/java/com/fr/plugin/entitys/MyUserEntity.java

@ -0,0 +1,139 @@
package com.fr.plugin.entitys;
import com.fr.plugin.beans.MyAgentBean;
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_xxxx_zch_user"
)
public class MyUserEntity 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.openId);
var1.setOpenId(this.getOpenId());
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;
}
/// "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:是
// "positiveDate":String,//转正日期,格式如:"2018-01-01"
}

219
src/main/java/com/fr/plugin/entitys/OutputMyEntity.java

@ -0,0 +1,219 @@
package com.fr.plugin.entitys;
import com.fr.plugin.beans.MyOutputBean;
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_xxxx_output"
)
@TableAssociation(
associated = true
)
public class OutputMyEntity extends AbstractScheduleEntity {
private static final String COLUMN_TERMINAL = "terminal";
private static final String COLUMN_AGENTID = "agentId";
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 = 518;
@Column(
name = "messageType"
)
private int messageType = 1;
@Column(
name = "platform"
)
private int platform = 1;
@Column(
name = "agentId"
)
private String agentId = null;
@Column(
name = "subject",
length = 65536
)
private String subject;
@Column(
name = "actionName",
nullable = false
)
private String actionName = null;
@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 = "mediaId"
)
private String mediaId;
@Column(
name = "sysKey"
)
private String sysKey;
public OutputMyEntity() {
}
public int getMessageType() {
return messageType;
}
public void setMessageType(int messageType) {
this.messageType = messageType;
}
public int getPlatform() {
return platform;
}
public void setPlatform(int platform) {
this.platform = platform;
}
public MyOutputBean createBean() {
MyOutputBean var1 = new MyOutputBean();
var1.setId(this.getId());
var1.setSysKey(this.getSysKey());
var1.setTerminal(this.getTerminal());
var1.setSubject(this.getSubject());
var1.setContent(this.getContent());
var1.setLinkOpenType(this.getLinkOpenType());
var1.setCustomizeLink(this.getCustomizeLink());
var1.setType(this.getType());
var1.setMediaId(this.getMediaId());
var1.setActionName(this.getActionName());
var1.setAgentId(this.getAgentId());
var1.setPlatform(this.getPlatform());
var1.setMessageType(this.getMessageType());
var1.setResultURL(this.getResultURL());
return var1;
}
public String getActionName() {
return this.actionName;
}
public void setActionName(String var1) {
this.actionName = var1;
}
public String getSysKey() {
return sysKey;
}
public void setSysKey(String sysKey) {
this.sysKey = sysKey;
}
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;
}
}

49
src/main/java/com/fr/plugin/entitys/PushEntity.java

@ -0,0 +1,49 @@
package com.fr.plugin.entitys;
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_xxxx_pushs"
)
public class PushEntity extends BaseEntity {
@Column(
name = "pushId"
)
private String pushId;
@Column(
name = "url",
length = 2048
)
private String url;
@Column(
name = "openType"
)
private Integer openType;
public String getPushId() {
return pushId;
}
public void setPushId(String pushId) {
this.pushId = pushId;
}
public String getUrl() {
return url;
}
public void setUrl(String url) {
this.url = url;
}
public Integer getOpenType() {
return openType;
}
public void setOpenType(Integer openType) {
this.openType = openType;
}
}

13
src/main/java/com/fr/plugin/utils/Filter.java

@ -0,0 +1,13 @@
package com.fr.plugin.utils;
public class Filter {
private String user_id;
public String getUser_id() {
return user_id;
}
public void setUser_id(String user_id) {
this.user_id = user_id;
}
}

41
src/main/java/com/fr/plugin/utils/JsonUtils.java

@ -0,0 +1,41 @@
package com.fr.plugin.utils;
import com.fr.stable.StringUtils;
import com.fr.third.fasterxml.jackson.core.JsonGenerator;
import com.fr.third.fasterxml.jackson.databind.JsonNode;
import com.fr.third.fasterxml.jackson.databind.ObjectMapper;
import java.io.IOException;
import java.io.StringWriter;
public class JsonUtils {
private JsonUtils() {
}
public static JsonNode parseToJsonNode(String json) throws IOException {
ObjectMapper objectMapper = new ObjectMapper();
if (StringUtils.isBlank(json)) {
return objectMapper.createObjectNode();
} else {
try {
return objectMapper.readTree(json);
} catch (Exception var3) {
throw new IOException(var3);
}
}
}
public static String toJsonString(Object obj) {
ObjectMapper objectMapper = new ObjectMapper();
StringWriter stringWriter = new StringWriter();
JsonGenerator jsonGenerator = null;
try {
jsonGenerator = objectMapper.getJsonFactory().createJsonGenerator(stringWriter);
objectMapper.writeValue(jsonGenerator, obj);
} catch (IOException var5) {
}
return stringWriter.toString();
}
}

34
src/main/java/com/fr/plugin/utils/MyAgentUtils.java

@ -0,0 +1,34 @@
package com.fr.plugin.utils;
import com.fr.plugin.core.MyCoreDBAccess;
import com.fr.plugin.dao.MyAgentDao;
import com.fr.plugin.entitys.MyAgentEntity;
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<MyAgentEntity> getAgentsSortedByTimeStamp() throws Exception {
return (List) MyCoreDBAccess.getAccessor().runQueryAction(new DBAction<List<MyAgentEntity>>() {
public List<MyAgentEntity> run(DAOContext var1) throws Exception {
return ((MyAgentDao)var1.getDAO(MyAgentDao.class)).find(QueryFactory.create().addSort("timeStamp", true));
}
});
}
public static MyAgentEntity getAgentById(String agentId) throws Exception {
return MyCoreDBAccess.getAccessor().runQueryAction(new DBAction<MyAgentEntity>() {
public MyAgentEntity run(DAOContext var1) throws Exception {
return var1.getDAO(MyAgentDao.class).findOne(QueryFactory.create().addRestriction(RestrictionFactory.eq("id",agentId)));
}
});
}
}

61
src/main/java/com/fr/plugin/utils/MyUtils.java

@ -0,0 +1,61 @@
package com.fr.plugin.utils;
import com.fr.json.JSONObject;
import com.fr.plugin.PluginLicense;
import com.fr.plugin.PluginLicenseManager;
import com.fr.plugin.config.MyTimingTaskConfig;
import com.fr.plugin.constant.Week;
import com.fr.plugin.core.MyCoreDBAccess;
import com.fr.plugin.core.MyStartupThred;
import com.fr.plugin.dao.MyAgentDao;
import com.fr.plugin.entitys.MyAgentEntity;
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.Restriction;
import com.fr.stable.query.restriction.RestrictionFactory;
import java.util.List;
public class MyUtils {
public static boolean isLicenseAvailable() {
PluginLicense var0 = PluginLicenseManager.getInstance().getPluginLicenseByID("com.fr.plugin.meixin.10");
return var0.isAvailable();
}
public static JSONObject createSuccessResponseJSONObject() {
JSONObject var0 = JSONObject.create();
var0.put("errorCode", 0);
var0.put("status", "success");
return var0;
}
public static List getAgentsSortedByTimeStamp() throws Exception {
return MyCoreDBAccess.getAccessor().runQueryAction(new DBAction<List<MyAgentEntity>>() {
public List<MyAgentEntity> run(DAOContext var1) throws Exception {
QueryCondition queryCondition = QueryFactory.create();
return var1.getDAO(MyAgentDao.class).find(queryCondition
.addSort("id", true));
}
});
}
public static MyAgentEntity getAgentById(String id) throws Exception {
return MyCoreDBAccess.getAccessor().runQueryAction(new DBAction<MyAgentEntity>() {
public MyAgentEntity run(DAOContext var1) throws Exception {
QueryCondition queryCondition = QueryFactory.create();
return var1.getDAO(MyAgentDao.class).findOne(queryCondition.addRestriction(RestrictionFactory.eq("id",id)));
}
});
}
public static void startUpUserSyncThread() {
// new MyStartupThred().start();
}
}

41
src/main/java/com/fr/plugin/utils/PushImageBean.java

@ -0,0 +1,41 @@
package com.fr.plugin.utils;
import com.fr.plugin.config.MyConfig;
import java.io.Serializable;
public class PushImageBean implements Serializable {
private String appKey;
private Filter filter = new Filter();
private String imageurl;
public PushImageBean() {
String appKey = MyConfig.getInstance().getAppKey();
this.appKey=appKey;
}
public String getAppKey() {
return appKey;
}
public void setAppKey(String appKey) {
this.appKey = appKey;
}
public Filter getFilter() {
return filter;
}
public void setFilterUser(String users) {
this.filter.setUser_id(users);
}
public String getImageurl() {
return imageurl;
}
public void setImageurl(String imageurl) {
this.imageurl = imageurl;
}
}

114
src/main/java/com/fr/plugin/utils/PushObject.java

@ -0,0 +1,114 @@
package com.fr.plugin.utils;
import java.text.SimpleDateFormat;
import java.util.Date;
public class PushObject {
private String title,
noticeTitle="",
summary,
jumpUrl,
shareRange="",
openType,
createTime,
coverImgUrl,
extras="",
mc_widget_identifier="huafa.push.common",
batchToUsers;
public PushObject() {
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
this.createTime = format.format(new Date());
this.openType="3";//都可以打开
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getNoticeTitle() {
return noticeTitle;
}
public void setNoticeTitle(String noticeTitle) {
this.noticeTitle = noticeTitle;
}
public String getSummary() {
return summary;
}
public void setSummary(String summary) {
this.summary = summary;
}
public String getJumpUrl() {
return jumpUrl;
}
public void setJumpUrl(String jumpUrl) {
this.jumpUrl = jumpUrl;
}
public String getShareRange() {
return shareRange;
}
public void setShareRange(String shareRange) {
this.shareRange = shareRange;
}
public String getOpenType() {
return openType;
}
public void setOpenType(String openType) {
this.openType = openType;
}
public String getCreateTime() {
return createTime;
}
public void setCreateTime(String createTime) {
this.createTime = createTime;
}
public String getCoverImgUrl() {
return coverImgUrl;
}
public void setCoverImgUrl(String coverImgUrl) {
this.coverImgUrl = coverImgUrl;
}
public String getExtras() {
return extras;
}
public void setExtras(String extras) {
this.extras = extras;
}
public String getMc_widget_identifier() {
return mc_widget_identifier;
}
public void setMc_widget_identifier(String mc_widget_identifier) {
this.mc_widget_identifier = mc_widget_identifier;
}
public String getBatchToUsers() {
return batchToUsers;
}
public void setBatchToUsers(String batchToUsers) {
this.batchToUsers = batchToUsers;
}
}

61
src/main/java/com/fr/plugin/utils/PushTextBean.java

@ -0,0 +1,61 @@
package com.fr.plugin.utils;
import com.fr.plugin.config.MyConfig;
import java.io.Serializable;
public class PushTextBean implements Serializable {
private String appKey;
private Filter filter = new Filter();
private Text text = new Text();
private String msgtype = "text";
public PushTextBean() {
String appKey = MyConfig.getInstance().getAppKey();
this.appKey = appKey;
}
public String getAppKey() {
return appKey;
}
public void setAppKey(String appKey) {
this.appKey = appKey;
}
public Filter getFilter() {
return filter;
}
public void setFilterUser(String users) {
this.filter.setUser_id(users);
}
public Text getText() {
return text;
}
public void setText(String text) {
this.text.setContent(text);
}
public String getMsgtype() {
return msgtype;
}
}
class Text {
private String content;
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content;
}
}

266
src/main/java/com/fr/plugin/utils/PushUtils.java

@ -0,0 +1,266 @@
package com.fr.plugin.utils;
import com.fr.base.FRContext;
import com.fr.json.JSONObject;
import com.fr.log.FineLoggerFactory;
import com.fr.plugin.config.MyConfig;
import com.fr.third.fasterxml.jackson.databind.JsonNode;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.net.HttpURLConnection;
import java.net.URL;
import java.nio.charset.StandardCharsets;
import java.util.HashMap;
import java.util.Map;
public class PushUtils {
private static final int NEWS_MESSAGE = 2;
private static final int TERMINATE_TYPE = 107;
private static final int LINKTYPE = 0;
// public static void sendPush(JSONObject params) {
// String url = "https://www.yunzhijia.com/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;
// }
/**
* {
* "code": 0,
* "msg": "成功",
* "data": {
* "errcode": 1,
* "pushId": "",
* "errmsg": "推送成功,推送回执:,推送到以下人员:,推送到以下部门:"
* }
*
* @param pushObject
* @param users
*/
public static boolean push(String url, String pushSecret, String pushSysKey, String accessToken, PushObject pushObject, String users) {
String body = JsonUtils.toJsonString(pushObject);
Map<String, Object> params = new HashMap<String, Object>();
params.put("appKey", MyConfig.getInstance().getAppKey());
params.put("sourceType", "todo");
params.put("touser", users);
params.put("timestamp", System.currentTimeMillis());
params.put("accessToken", accessToken);
String sysKey = pushSysKey;
params.put("sysKey", sysKey);
String sign = SignUtils.getSign(params, pushSecret);
params.put("sign", sign);
String param = SignUtils.pinParam(params);
url = url + "?" + param;
FRContext.getLogger().info("请求url:" + url);
FRContext.getLogger().info("请求body:" + body);
String s = sendPost(url, body);
FRContext.getLogger().info("响应内容:" + s);
if (com.fr.stable.StringUtils.isNotBlank(s)) {
try {
JsonNode jsonNode = JsonUtils.parseToJsonNode(s);
String code = jsonNode.get("code").asText();
if ("0".equalsIgnoreCase(code)) {
return true;
}
} catch (IOException e) {
}
}
return false;
}
/**
* 向指定 URL 发送POST方法的请求
*
* @param url 发送请求的 URL
* @param param 请求参数请求参数应该是 name1=value1&name2=value2 的形式
* @return 所代表远程资源的响应结果
*/
public static String sendPost(String url, String param) {
OutputStreamWriter out = null;
BufferedReader in = null;
StringBuilder result = new StringBuilder();
try {
URL realUrl = new URL(url);
HttpURLConnection conn = null;
conn = (HttpURLConnection) realUrl.openConnection();
// 打开和URL之间的连接
// 发送POST请求必须设置如下两行
conn.setDoOutput(true);
conn.setDoInput(true);
conn.setRequestMethod("POST"); // POST方法
// 设置通用的请求属性
conn.setRequestProperty("accept", "*/*");
conn.setRequestProperty("connection", "Keep-Alive");
conn.setRequestProperty("user-agent",
"Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;SV1)");
conn.setRequestProperty("Content-Type", "application/json");
conn.connect();
// 获取URLConnection对象对应的输出流
out = new OutputStreamWriter(conn.getOutputStream(), StandardCharsets.UTF_8);
// 发送请求参数
out.write(param);
// flush输出流的缓冲
out.flush();
// 定义BufferedReader输入流来读取URL的响应
in = new BufferedReader(
new InputStreamReader(conn.getInputStream()));
String line;
while ((line = in.readLine()) != null) {
result.append(line);
}
} catch (Exception e) {
}
//使用finally块来关闭输出流、输入流
finally {
try {
if (out != null) {
out.close();
}
if (in != null) {
in.close();
}
} catch (IOException ex) {
}
}
return result.toString();
}
public static String pushTextOrImage(String url, Object pushImageBean, String sysKey, String secrct) {
String body = JsonUtils.toJsonString(pushImageBean);
Map<String, Object> params = new HashMap<String, Object>();
String accessToken = MyConfig.getInstance().getAccessToken();
params.put("sysKey", sysKey);
params.put("timestamp", System.currentTimeMillis());
params.put("accessToken", accessToken);
String sign = SignUtils.getSign(params, secrct);
params.put("sign", sign);
String param = SignUtils.pinParam(params);
url = url + "?" + param;
String s = sendPost(url, body);
FineLoggerFactory.getLogger().error("推送图文响应:{}", s);
FineLoggerFactory.getLogger().info("请求url:" + url);
FineLoggerFactory.getLogger().info("请求body:" + body);
if (com.fr.stable.StringUtils.isNotBlank(s)) {
try {
JsonNode jsonNode = JsonUtils.parseToJsonNode(s);
String code = jsonNode.get("code").asText();
if ("0".equalsIgnoreCase(code)) {
return jsonNode.get("data").get("msg_data_id").asText();
}
} catch (IOException e) {
}
}
return null;
}
/**
* 创建单图推送
* 流程1先创建image 2推送
*
* @param url
* @param pushImageBean
* @param sysKey
* @param secrct
* @return
*/
public static String pushImage(String baseurl, String userId, String title, String sid, String imageUrl, String jumpUrl, int openType, String sysKey, String secrct) {
Map<String, Object> params = new HashMap<String, Object>();
String accessToken = MyConfig.getInstance().getAccessToken();
params.put("sysKey", sysKey);
params.put("timestamp", System.currentTimeMillis());
params.put("accessToken", accessToken);
String sign = SignUtils.getSign(params, secrct);
params.put("sign", sign);
String param = SignUtils.pinParam(params);
String url=baseurl+"/mpm/v5/open/imgtext/upload";
url = url + "?" + param;
//创建图片
JSONObject createImage = new JSONObject();
createImage.put("sid", sid);
createImage.put("title", title);
createImage.put("jump_url", jumpUrl);
createImage.put("cover_thumb_s", imageUrl);
createImage.put("openType", openType);
String createBody = createImage.toString();
String s = sendPost(url, createBody);
FineLoggerFactory.getLogger().error("创建图片响应:{}", s);
FineLoggerFactory.getLogger().info("请求url:" + url);
FineLoggerFactory.getLogger().info("请求body:" + createBody);
String imageId = "";
if (com.fr.stable.StringUtils.isNotBlank(s)) {
try {
JsonNode jsonNode = JsonUtils.parseToJsonNode(s);
String code = jsonNode.get("code").asText();
if ("0".equalsIgnoreCase(code)) {
imageId = jsonNode.get("msg_data_id").asText();
}
} catch (IOException e) {
}
}
/**
* 推送图片
*/
url=baseurl+"/mpm/v5/open/imgtext/pushMsg";
JSONObject pushImageBean = new JSONObject();
pushImageBean.put("appKey", MyConfig.getInstance().getAppKey());
JSONObject filter = new JSONObject();
filter.put("user_id", userId);
pushImageBean.put("filter", filter);
// pushImageBean.put("sid", )
JSONObject news = new JSONObject();
news.put("media_id", imageId);
pushImageBean.put("news", pushImageBean);
params = new HashMap<String, Object>();
params.put("sysKey", sysKey);
params.put("timestamp", System.currentTimeMillis());
params.put("accessToken", accessToken);
sign = SignUtils.getSign(params, secrct);
params.put("sign", sign);
param = SignUtils.pinParam(params);
url = url + "?" + param;
String json = sendPost(url, pushImageBean.toString());
FineLoggerFactory.getLogger().error("创建图片响应:{}", json);
FineLoggerFactory.getLogger().info("请求url:" + url);
FineLoggerFactory.getLogger().info("请求body:" + pushImageBean);
if (com.fr.stable.StringUtils.isNotBlank(json)) {
try {
JsonNode jsonNode = JsonUtils.parseToJsonNode(json);
String code = jsonNode.get("code").asText();
if ("0".equalsIgnoreCase(code)) {
jsonNode.get("msg_id").asText();
}
} catch (IOException e) {
}
}
return null;
}
}

35
src/main/java/com/fr/plugin/utils/SertUtils.java

@ -0,0 +1,35 @@
package com.fr.plugin.utils;
import com.fr.base.Base64;
import java.io.ByteArrayInputStream;
import java.io.InputStream;
import java.security.PublicKey;
import java.security.cert.CertificateException;
import java.security.cert.CertificateFactory;
public class SertUtils {
final static String str = "xxxxB64";
static byte[] bs;
static PublicKey statePublicKey = null;
static {
bs = Base64.decode(str);
}
public static PublicKey getSert() {
if (statePublicKey != null) {
return statePublicKey;
}
CertificateFactory cf;
InputStream in2;
java.security.cert.Certificate c2 = null;
try {
cf = CertificateFactory.getInstance("X.509");
c2 = cf.generateCertificate(new ByteArrayInputStream(bs));
} catch (CertificateException e) {
}
statePublicKey = c2.getPublicKey();
return statePublicKey;
}
}

52
src/main/java/com/fr/plugin/utils/SignUtils.java

@ -0,0 +1,52 @@
package com.fr.plugin.utils;
import com.fr.third.springframework.util.DigestUtils;
import java.util.Arrays;
import java.util.Map;
import java.util.Set;
public class SignUtils {
public static String getSign(Map<String, Object> map, String secret) {
// TreeMap<String, Object> map = new TreeMap<String, Object>(parms);
// StringBuilder query = new StringBuilder();
// Set<String> set = map.keySet();
// query.append(secret);
// for (String key : set) {
// String value = String.valueOf(map.get(key));
// query.append(key).append(value);
// }
// query.append(secret);
// return DigestUtils.md5DigestAsHex(query.toString().getBytes());
// 第一步:检查参数是否已经排序
String[] keys = map.keySet().toArray(new String[0]);
Arrays.sort(keys);
// 第二步:把所有参数名和参数值串在一起
StringBuilder query = new StringBuilder();
query.append(secret);
for (String key : keys) {
String value = String.valueOf(map.get(key));
query.append(key).append(value);
}
query.append(secret);
// 第三步:计算签名
String sign = DigestUtils.md5DigestAsHex(query.toString().getBytes());
return sign;
}
public static String pinParam(Map<String, Object> parms) {
StringBuilder query = new StringBuilder();
Set<String> set = parms.keySet();
for (String key : set) {
String value = String.valueOf(parms.get(key));
query.append(key).append("=").append(value).append("&");
}
return query.substring(0, query.length() - 1);
}
}

108
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.MyConfig;
import com.fr.plugin.core.MyCorpManager;
import com.fr.plugin.core.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 = MyConfig.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;
}
MyConfig.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);
}
}
}

153
src/main/java/com/fr/plugin/utils/WebHookUtil.java

@ -0,0 +1,153 @@
package com.fr.plugin.utils;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.Locale;
import java.util.Map;
import java.util.TimeZone;
import com.fr.ftp.util.Base64;
import com.fr.log.FineLoggerFactory;
import com.fr.log.FineLoggerProvider;
import com.fr.third.org.apache.commons.codec.digest.DigestUtils;
/**
* 由云之家提供未作修改
*/
public class WebHookUtil {
private static FineLoggerProvider logger = FineLoggerFactory.getLogger();
public static boolean checkAuth(String appid,String appkey,String content,Map<String,String> headers){
boolean ret = false;
if(content!=null &&headers!=null){
String contentType = headers.get("Content-Type");
if(contentType==null){
contentType = headers.get("content-type");
}
String contentMd5 = headers.get("Content-MD5");
if(contentMd5==null){
contentMd5 = headers.get("content-md5");
}
String date = headers.get("Date");
if(date==null){
date = headers.get("date");
}
String auth = headers.get("Authorization");
if(auth==null){
auth = headers.get("authorization");
}
logger.info("auth header:content-type={},md5={},date={},authorization={}",contentType,contentMd5,date,auth);
String md5 = WebHookUtil.getContentMd5(content);
logger.info("auth header:local product MD5={},check={}",md5,(md5!=null&&md5.equals(contentMd5)));
if(md5!=null&&md5.equals(contentMd5)){
String authorization = WebHookUtil.getAuthorization( appid, appkey,contentMd5, contentType, date);
logger.info("auth header:local authorization={},check={}",authorization,(auth!=null&&auth.equals(authorization)));
if(auth!=null&&auth.equals(authorization)){
ret = true;
}
}
}
return ret;
}
public static boolean checkAuth(String token,String content,Map<String,String> headers){
boolean ret = false;
if(content!=null &&headers!=null){
String contentType = headers.get("Content-Type");
if(contentType==null){
contentType = headers.get("content-type");
}
String contentMd5 = headers.get("Content-MD5");
if(contentMd5==null){
contentMd5 = headers.get("content-md5");
}
String date = headers.get("Date");
if(date==null){
date = headers.get("date");
}
String auth = headers.get("Authorization");
if(auth==null){
auth = headers.get("authorization");
}
logger.info("auth header:content-type={},md5={},date={},authorization={}",contentType,contentMd5,date,auth);
String md5 = WebHookUtil.getContentMd5(content);
logger.info("auth header:local product MD5={},check={}",md5,(md5!=null&&md5.equals(contentMd5)));
if(md5!=null&&md5.equals(contentMd5)){
String authorization = WebHookUtil.getAuthorization( token,contentMd5, contentType, date);
logger.info("auth header:local authorization={},check={}",authorization,(auth!=null&&auth.equals(authorization)));
if(auth!=null&&auth.equals(authorization)){
ret = true;
}
}
}
return ret;
}
public static String getAuthorization(String appid,String appkey,String contentMd5,String contentType,String date){
String auth = appid +":"+sha(appkey,contentMd5,contentType,date);
return auth;
}
public static String getAuthorization(String token,String contentMd5,String contentType,String date){
String auth = sha(token,contentMd5,contentType,date);
return auth;
}
public static String sha(String... data){
String str = "";
int n = data.length;
for (int i=0;i<n;i++){
str =str+data[i];
}
return DigestUtils.sha1Hex(str);
}
public static String getContentMd5(String content){
return Base64.encodeBase64String(DigestUtils.md5(content));
}
public static String getGMTTime(){
Date d=new Date();
DateFormat format=new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss z",Locale.US);
format.setTimeZone(TimeZone.getTimeZone("GMT"));
return format.format(d);
}
public static Map<Object,Object> getHeaders(String appid,String appkey,String content,String contentType){
Map<Object,Object> headers = new HashMap<Object,Object>();
String contentMd5 = WebHookUtil.getContentMd5(content);
String date = WebHookUtil.getGMTTime();
headers.put("Content-Md5",contentMd5 );
headers.put("Content-Type",contentType );
headers.put("Date", date);
headers.put("Authorization", WebHookUtil.getAuthorization(appid,appkey,contentMd5, contentType, date));
headers.put("User-Agent", "kingdee yunzhijia webhook client-1.0");
return headers;
}
public static Map<String,Object> getCommonParams(String appid, String access_token){
Map<String,Object> params=new HashMap<String,Object>();
params.put("appid", appid);
params.put("access_token", access_token);
return params;
}
}

367
src/main/java/com/fr/plugin/utils/WebUtils.java

@ -0,0 +1,367 @@
package com.fr.plugin.utils;
import com.fr.base.FRContext;
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.MyConfig;
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 sun.net.www.protocol.https.HttpsURLConnectionImpl;
import java.io.*;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.URLEncoder;
import java.util.*;
public class WebUtils {
public static String post(String path, Map<String, Object> param) {
String var3 = getParam(param);
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", "GBK");
var8.setRequestMethod("POST");
var8.setDoOutput(true);
var8.setDoInput(true);
var4 = new PrintWriter(var8.getOutputStream());
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) {
FRContext.getLogger().info("请将后面的内容发送给开发者:" + new String(Base64.getUrlEncoder().encode(param.getBytes())));
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");
conn.setRequestProperty("Content-Type", "application/json; charset=GBK");
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(conn.getOutputStream());
// 发送请求参数
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 = ((HttpsURLConnectionImpl) 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<String, Object> var0) {
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, "UTF-8") + "=" + URLEncoder.encode(var5, "UTF-8");
} catch (Exception var7) {
;
}
}
return var1;
}
public static String getSyncDepOrUserAccessToken(String eid, String secret) {
Map<String, Object> parms = new HashMap<String, Object>();
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 var2 = "https://www.yunzhijia.com/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<String, Object> parms = new HashMap<String, Object>();
parms.put("appId", appId);
parms.put("secret", secret);
parms.put("scope", "app");
return getAccessToken(parms);
}
public static String getAccessToken(Map<String, Object> parms) {
String url = "https://www.yunzhijia.com/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<MyUserBean> getUserByPage(String eid, String sect, int page) {
String url = "https://www.yunzhijia.com/gateway/openimport/open/person/getall?accessToken=" + getSyncDepOrUserAccessToken(eid, sect);
Map<String, Object> 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<MyUserBean> 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<MyDepBean> getAllDep(String eid, String sect) {
String url = "https://www.yunzhijia.com/gateway/openimport/open/dept/getall?accessToken=" + getSyncDepOrUserAccessToken(eid, sect);
Map<String, Object> params = new HashMap<>();
params.put("nonce", RandomStringUtils.randomAlphabetic(8));
params.put("eid", eid);
String post = post(url, params);
JSONObject json = new JSONObject(post);
List<MyDepBean> 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) {
MyConfig myConfig = MyConfig.getInstance();
String eid = myConfig.getEid();
String sect = myConfig.getReadKey();
String url = "https://www.yunzhijia.com/gateway/openimport/open/person/getAtTime?accessToken=" + getSyncDepOrUserAccessToken(eid, sect);
Map<String, Object> 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( ) {
MyConfig myConfig = MyConfig.getInstance();
String eid = myConfig.getEid();
String sect = myConfig.getReadKey();
String url = "https://www.yunzhijia.com/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<String, Object> 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();
}
}

46
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.core.MyCoreDBAccess;
import com.fr.plugin.dao.MyAgentDao;
import com.fr.plugin.entitys.MyAgentEntity;
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 "/xxx/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<List<MyAgentEntity>>() {
public List<MyAgentEntity> run(DAOContext var1) throws Exception {
var1.getDAO(MyAgentDao.class).remove(var3);
return null;
}
});
JSONObject var4 = MyUtils.createSuccessResponseJSONObject();
WebUtils.flushSuccessMessageAutoClose(httpServletRequest, httpServletResponse, var4);
}
}

61
src/main/java/com/fr/plugin/web/hander/GetAgentHandler.java

@ -0,0 +1,61 @@
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.PluginLicense;
import com.fr.plugin.PluginLicenseManager;
import com.fr.plugin.beans.MyAgentBean;
import com.fr.plugin.entitys.MyAgentEntity;
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 "/xxx/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()) {
MyAgentEntity var12 = (MyAgentEntity)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) {
MyAgentEntity var10 = (MyAgentEntity)var5.get(var9);
var6.put(var10.createBean(new MyAgentBean()).toJSONObject());
}
}
var7.put("total", var5.size());
var7.put("agentList", var6);
WebUtils.flushSuccessMessageAutoClose(httpServletRequest, httpServletResponse, var7);
}
}

48
src/main/java/com/fr/plugin/web/hander/GetConfigHandler.java

@ -0,0 +1,48 @@
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.config.MyConfig;
import com.fr.plugin.entitys.MyAgentEntity;
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 GetConfigHandler extends BaseHttpHandler {
@Override
public RequestMethod getMethod() {
return RequestMethod.GET;
}
@Override
public String getPath() {
return "/xxx/report/server/url";
}
@Override
public boolean isPublic() {
return false;
}
@Override
public void handle(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse) throws Exception {
JSONObject var3 = MyUtils.createSuccessResponseJSONObject();
MyConfig var4 = MyConfig.getInstance();
var3.put("reportServerUrl", var4.getUrl());
var3.put("authUrl", var4.getAuthUrl());
var3.put("pushUrl", var4.getPushUrl());
var3.put("appKey", var4.getAppKey());
var3.put("accessToken", var4.getAccessToken());
// var3.put("scanSecret", var4.getScanSecret());
// var3.put("scanId", var4.getScanId());
WebUtils.flushSuccessMessageAutoClose(httpServletRequest, httpServletResponse, var3);
}
}

96
src/main/java/com/fr/plugin/web/hander/LoginUserModel.java

@ -0,0 +1,96 @@
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;
}
}

38
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 "/xxx/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.meixin.10");
JSONObject var4 = MyUtils.createSuccessResponseJSONObject();
boolean var5 = var3.isAvailable();
var4.put("authorized", var5);
WebUtils.flushSuccessMessageAutoClose(httpServletRequest, httpServletResponse, var4);
}
}

98
src/main/java/com/fr/plugin/web/hander/PCLoginHandler.java

@ -0,0 +1,98 @@
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.MyConfig;
import com.fr.plugin.core.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 PCLoginHandler extends BaseHttpHandler {
@Override
public RequestMethod getMethod() {
return null;
}
@Override
public String getPath() {
return "/xxx/pc/login";
}
@Override
public boolean isPublic() {
return true;
}
@Override
public void handle(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse) throws Exception {
String ticket = httpServletRequest.getParameter("ticket");
String isApp = httpServletRequest.getParameter("isApp");
MyConfig instance = MyConfig.getInstance();
String secret = instance.getSecret();
String appId = instance.getAppId();
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 {
String servletName = ServerConfig.getInstance().getServletName();
String url = instance.getUrl()+servletName;
httpServletResponse.sendRedirect(url);
}
return;
}
} catch (Exception e) {
e.printStackTrace();
}
}
jsonObject.put("status", -1);
jsonObject.put("message", "登陆失败");
com.fr.web.utils.WebUtils.flushSuccessMessageAutoClose(httpServletRequest, httpServletResponse, jsonObject);
}
}

105
src/main/java/com/fr/plugin/web/hander/SaveAgentHandler.java

@ -0,0 +1,105 @@
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.core.MyCoreDBAccess;
import com.fr.plugin.dao.MyAgentDao;
import com.fr.plugin.entitys.MyAgentEntity;
import com.fr.plugin.utils.MyAgentUtils;
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 "/xxx/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("sysKey");//公共号编号
String secret = agentArr.optJSONObject(i).optString("secret");
List<MyAgentEntity> agent_lists = MyCoreDBAccess.getAccessor().runQueryAction(new DBAction<List<MyAgentEntity>>() {
public List<MyAgentEntity> run(DAOContext content) throws Exception {
return content.getDAO(MyAgentDao.class) .find(QueryFactory.create());
}
});
Iterator var13 = agent_lists.iterator();
MyAgentEntity temp_agent;
while(var13.hasNext()) {
temp_agent = (MyAgentEntity)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 MyAgentEntity().id(agent_uid)
.agentName(agent_name)
.sysKey(agent_id)
.secret(secret);
MyAgentEntity finalVar1 = temp_agent;
MyCoreDBAccess.getAccessor().runDMLAction(new DBAction<MyAgentEntity>() {
public MyAgentEntity 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);
}
}

63
src/main/java/com/fr/plugin/web/hander/SaveConfigHandler.java

@ -0,0 +1,63 @@
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.config.MyConfig;
import com.fr.plugin.entitys.MyAgentEntity;
import com.fr.plugin.utils.MyUtils;
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 SaveConfigHandler extends BaseHttpHandler {
@Override
public RequestMethod getMethod() {
return RequestMethod.POST;
}
@Override
public String getPath() {
return "/xxx/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 pushUrl = WebUtils.getHTTPRequestParameter(httpServletRequest, "pushUrl");
String accessToken = WebUtils.getHTTPRequestParameter(httpServletRequest, "accessToken");
String appKey = WebUtils.getHTTPRequestParameter(httpServletRequest, "appKey");
String authUrl = WebUtils.getHTTPRequestParameter(httpServletRequest, "authUrl");
// String scanId = WebUtils.getHTTPRequestParameter(httpServletRequest, "scanId");
MyConfig myConfig = MyConfig.getInstance();
myConfig.setPushUrl(pushUrl);
myConfig.setAppKey(appKey);
myConfig.setAccessToken(accessToken);
myConfig.setAuthUrl(authUrl);
myConfig.setUrl(var4);
}
JSONObject var5 = MyUtils.createSuccessResponseJSONObject();
WebUtils.flushSuccessMessageAutoClose(httpServletRequest, httpServletResponse, var5);
}
}

100
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.MyConfig;
import com.fr.plugin.core.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 "/xxx/scan_login";
}
@Override
public boolean isPublic() {
return true;
}
@Override
public void handle(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse) throws Exception {
String ticket = httpServletRequest.getParameter("ticket");
MyConfig instance = MyConfig.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);
}
}

156
src/main/java/com/fr/plugin/web/hander/SingleLoginHandler.java

@ -0,0 +1,156 @@
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.login.LoginService;
import com.fr.decision.webservice.v10.user.UserService;
import com.fr.json.JSONObject;
import com.fr.log.FineLoggerFactory;
import com.fr.log.FineLoggerProvider;
import com.fr.plugin.config.MyConfig;
import com.fr.plugin.transform.ExecuteFunctionRecord;
import com.fr.plugin.transform.FunctionRecorder;
import com.fr.plugin.utils.SertUtils;
import com.fr.stable.CodeUtils;
import com.fr.stable.StringUtils;
import com.fr.third.springframework.web.bind.annotation.RequestMethod;
import com.fr.web.utils.WebUtils;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import org.xml.sax.InputSource;
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import javax.xml.crypto.dom.DOMStructure;
import javax.xml.crypto.dsig.Reference;
import javax.xml.crypto.dsig.XMLSignature;
import javax.xml.crypto.dsig.XMLSignatureFactory;
import javax.xml.crypto.dsig.dom.DOMValidateContext;
import javax.xml.parsers.DocumentBuilderFactory;
import java.io.StringReader;
import java.security.PublicKey;
import java.util.List;
public class SingleLoginHandler extends BaseHttpHandler {
@Override
public RequestMethod getMethod() {
return null;
}
@Override
public String getPath() {
return "/hf/login";
}
@Override
public boolean isPublic() {
return true;
}
@Override
public void handle(HttpServletRequest request, HttpServletResponse response) throws Exception {
MyConfig instance = MyConfig.getInstance();
JSONObject jsonObject = new JSONObject();
HttpSession session = request.getSession();
String loginame = "";
FineLoggerProvider logger = FineLoggerFactory.getLogger();
logger.error("");
logger.info(request.getParameter("SAMLResponse"));
logger.info(request.getParameter("RelayState"));
try {
// 获取认证后信息,首先验证信息有效性,并返回认证信息中的登录账号
loginame = validate(request.getParameter("SAMLResponse"));
UserService userControl = UserService.getInstance();
User userByUserName = userControl.getUserByUserName(loginame);
if (userByUserName != null) {
String cookieName = "saml_callBack";
String login = LoginService.getInstance().login(request, response, loginame);
//wei : 跨域的时候如果返回相对路径,就又跳到跨域前的url+op=fs了。
Cookie samlCallBack = com.fr.third.springframework.web.util.WebUtils.getCookie(request, cookieName);
FineLoggerFactory.getLogger().error("by cookies 回到系统=====登陆用户:{} 回调地址:{}", loginame, samlCallBack);
if (samlCallBack != null && StringUtils.isNotBlank(samlCallBack.getValue())) {
String value = samlCallBack.getValue();
deleteCookieByName(request,response,cookieName);
if (value.contains("decision/login")) {
response.sendRedirect(instance.getUrl());
} else {
response.sendRedirect(value);
}
return;
}
FineLoggerFactory.getLogger().error("------回到系统=====登陆用户:{} 回调地址: 去主页", loginame);
response.sendRedirect(instance.getUrl());
} else {
WebUtils.printAsString(response, "login fail:" + loginame + " not find");
}
} catch (Exception e) {
}
com.fr.web.utils.WebUtils.flushSuccessMessageAutoClose(request, response, jsonObject);
}
private void deleteCookieByName(HttpServletRequest request, HttpServletResponse response, String name) {
Cookie[] cookies = request.getCookies();
if (null == cookies) {
FineLoggerFactory.getLogger().info("没有cookie");
} else {
for (Cookie cookie : cookies) {
if (cookie.getName().equals(name)) {
//设置值为null
cookie.setValue(null);
//立即销毁cookie
cookie.setMaxAge(0);
cookie.setPath("/");
FineLoggerFactory.getLogger().info("被删除的cookie名字为:{}", cookie.getName(),cookie.getValue());
response.addCookie(cookie);
break;
}
}
}
}
private String validate(String responseString) throws Exception {
StringReader sr = new StringReader(responseString);
String loginName = "";
InputSource is = new InputSource(sr);
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
dbf.setNamespaceAware(true);
Document doc = dbf.newDocumentBuilder().parse(is);
// Search the Signature element
NodeList nl = doc.getElementsByTagNameNS(XMLSignature.XMLNS, "Signature");
if (nl.getLength() == 0) {
throw new Exception("Cannot find Signature element");
}
Node signatureNode = nl.item(0);
XMLSignatureFactory fac = XMLSignatureFactory.getInstance("DOM");
XMLSignature signature = fac.unmarshalXMLSignature(new DOMStructure(signatureNode));
PublicKey pubKey = SertUtils.getSert();
// Create ValidateContext
DOMValidateContext valCtx = new DOMValidateContext(pubKey, signatureNode);
// Validate the XMLSignature
boolean coreValidity = signature.validate(valCtx);
// Check core validation status
if (coreValidity == false) {
// Check the signature validation status
List refs = signature.getSignedInfo().getReferences();
for (int i = 0; i < refs.size(); i++) {
Reference ref = (Reference) refs.get(i);
boolean refValid = ref.validate(valCtx);
}
} else {
// 获取登录账号节点信息
NodeList node = doc.getElementsByTagName("NameID");
Element e = (Element) node.item(0);
loginName = e.getTextContent().trim();
}
return loginName;
}
}

42
src/main/java/com/fr/plugin/web/hander/member/GetDepTree.java

@ -0,0 +1,42 @@
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.MyAgentBean;
import com.fr.plugin.core.MyCorpManager;
import com.fr.plugin.entitys.MyAgentEntity;
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 GetDepTree extends BaseHttpHandler {
@Override
public RequestMethod getMethod() {
return RequestMethod.GET;
}
@Override
public String getPath() {
return "/xxx/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);
}
}

41
src/main/java/com/fr/plugin/web/hander/member/GetImageHandler.java

@ -0,0 +1,41 @@
package com.fr.plugin.web.hander.member;
import com.fr.decision.fun.impl.BaseHttpHandler;
import com.fr.decision.webservice.v10.attach.AttachmentService;
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 GetImageHandler extends BaseHttpHandler {
@Override
public RequestMethod getMethod() {
return RequestMethod.GET;
}
@Override
public String getPath() {
return "/getImage";
}
@Override
public boolean isPublic() {
return true;
}
@Override
public void handle(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse) throws Exception {
String imageId = httpServletRequest.getParameter("imageId");
AttachmentService.getInstance().showImage(httpServletRequest, httpServletResponse, imageId, "png", false);
// InputStream inputStream = ResourceIOUtils.read("/assets/temp_attach/" + imageId);
// if (inputStream != null) {
// httpServletResponse.setContentType("image/png");
// IOUtil.copyCompletely(inputStream,httpServletResponse.getOutputStream());
// }
// WebUtils.printAsString(httpServletResponse, "文件未找到");
}
}

44
src/main/java/com/fr/plugin/web/hander/member/GetMatch.java

@ -0,0 +1,44 @@
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.config.MyConfig;
import com.fr.plugin.core.MyCorpManager;
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 "/xxx/match/method";
}
@Override
public boolean isPublic() {
return false;
}
@Override
public void handle(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse) throws Exception {
JSONObject jsonObject = MyUtils.createSuccessResponseJSONObject();
MyConfig config = MyConfig.getInstance();
if (config != null) {
String match = config.getMatch();
int c = NumberUtils.isDigits(match) ? Integer.parseInt(match) : 1;
jsonObject.put("matchingFsWay", c);
}
WebUtils.flushSuccessMessageAutoClose(httpServletRequest, httpServletResponse, jsonObject);
}
}

95
src/main/java/com/fr/plugin/web/hander/member/GetMemberHandler.java

@ -0,0 +1,95 @@
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.MyDepBean;
import com.fr.plugin.beans.MyUserBean;
import com.fr.plugin.core.MyUserSyncManager;
import com.fr.plugin.utils.MyUtils;
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 "/xxx/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<MyUserBean> users;
Long size = 0L;
try{
if (StringUtils.isNotEmpty(keyword)) {
users = this.getSelectedUser(keyword, startIdx, count);
size = this.countSelectedUser(keyword);
} else {
MyDepBean var10 = new MyDepBean();
var10.setId("");
var10.setDepName(depId);
users = this.getSelectedDepartmentUser(var10, startIdx, count);
size = this.countSelectedDepartmentUser(var10);
}
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(MyDepBean bean) throws Exception {
return MyUserSyncManager.getInstance().countDepartmentUserList(bean.getDepName());
}
private List<MyUserBean> getSelectedDepartmentUser(MyDepBean bean, int start, int count) throws Exception {
return MyUserSyncManager.getInstance().getDepartmentUserList(bean.getDepName(), start, count);
}
private List<MyUserBean> 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<MyUserBean> 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;
}
}

73
src/main/java/com/fr/plugin/web/hander/member/LanlingLogin.java

@ -0,0 +1,73 @@
package com.fr.plugin.web.hander.member;
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.decision.webservice.v10.user.UserService;
import com.fr.json.JSONObject;
import com.fr.plugin.config.MyConfig;
import com.fr.stable.StringUtils;
import com.fr.third.jodd.util.Base64;
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.PrintWriter;
import java.io.StringWriter;
public class LanlingLogin extends BaseHttpHandler {
@Override
public RequestMethod getMethod() {
return RequestMethod.GET;
}
@Override
public String getPath() {
return "/xxx/lanlin/login";
}
@Override
public boolean isPublic() {
return true;
}
@Override
public void handle(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse) throws Exception {
String token = httpServletRequest.getParameter("token");
String callBack = httpServletRequest.getParameter("callBack");
JSONObject jsonObject = new JSONObject();
MyConfig instance = MyConfig.getInstance();
if (StringUtils.isBlank(token)) {
jsonObject.put("status", -1);
jsonObject.put("message", "未找到token");
com.fr.web.utils.WebUtils.flushSuccessMessageAutoClose(httpServletRequest, httpServletResponse, jsonObject);
return;
}
try {
token = Base64.decodeToString(token);
JSONObject json = new JSONObject(token);
String username = json.getString("username");
User user = UserService.getInstance().getUserByUserName(username);
if (user != null) {
LoginService.getInstance().login(httpServletRequest, httpServletResponse, username, "", "");
if (StringUtils.isNotBlank(callBack)) {
httpServletResponse.sendRedirect(callBack);
return;
}
String servletName = ServerConfig.getInstance().getServletName();
String url = instance.getUrl() + servletName;
httpServletResponse.sendRedirect(url);
}
} catch (Exception e) {
e.printStackTrace();
StringWriter writer = new StringWriter();
PrintWriter printWriter = new PrintWriter(writer);
e.printStackTrace(printWriter);
String s = writer.getBuffer().toString();
WebUtils.printAsString(httpServletResponse,s);
}
}
}

40
src/main/java/com/fr/plugin/web/hander/member/SaveMatch.java

@ -0,0 +1,40 @@
package com.fr.plugin.web.hander.member;
import com.fr.decision.fun.impl.BaseHttpHandler;
import com.fr.json.JSONObject;
import com.fr.plugin.config.MyConfig;
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 "/xxx/match/method";
}
@Override
public boolean isPublic() {
return false;
}
@Override
public void handle(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse) throws Exception {
String match= WebUtils.getHTTPRequestParameter(httpServletRequest, "matchingFsWay");
JSONObject jsonObject = MyUtils.createSuccessResponseJSONObject();
MyConfig config=MyConfig.getInstance();
if (config != null) {
config.setMatch(match);
}
WebUtils.flushSuccessMessageAutoClose(httpServletRequest, httpServletResponse, jsonObject);
}
}

62
src/main/java/com/fr/plugin/web/hander/member/SaveRelation.java

@ -0,0 +1,62 @@
package com.fr.plugin.web.hander.member;
import com.fr.decision.fun.impl.BaseHttpHandler;
import com.fr.json.JSONObject;
import com.fr.plugin.config.MyConfig;
import com.fr.plugin.core.MyCoreDBAccess;
import com.fr.plugin.dao.MyUserDao;
import com.fr.plugin.entitys.MyUserEntity;
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;
import java.util.List;
public class SaveRelation extends BaseHttpHandler {
@Override
public RequestMethod getMethod() {
return RequestMethod.POST;
}
@Override
public String getPath() {
return "/xxx/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");
MyUserEntity entity = MyCoreDBAccess.getAccessor().runQueryAction(new DBAction<MyUserEntity>() {
public MyUserEntity 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<MyUserEntity>() {
public MyUserEntity 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);
}
}

92
src/main/java/com/fr/plugin/web/hander/member/SycHookHander.java

@ -0,0 +1,92 @@
package com.fr.plugin.web.hander.member;
import com.fr.decision.fun.impl.BaseHttpHandler;
import com.fr.json.JSONObject;
import com.fr.log.FineLoggerFactory;
import com.fr.plugin.utils.SyncThread;
import com.fr.plugin.utils.WebHookUtil;
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.*;
/**
* 接受云之家回调接口
*/
public class SycHookHander extends BaseHttpHandler {
@Override
public RequestMethod getMethod() {
return RequestMethod.GET;
}
@Override
public String getPath() {
return "/syn_hook";
}
@Override
public boolean isPublic() {
return true;
}
@Override
public void handle(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse) throws Exception {
String eid = httpServletRequest.getParameter("eid");
String eventId = httpServletRequest.getParameter("eventId");
String createTime = httpServletRequest.getParameter("createTime");
String eventType = httpServletRequest.getParameter("eventType");
Enumeration<String> names = httpServletRequest.getHeaderNames();
Map<String ,String > header=new HashMap<>();
while (names.hasMoreElements()) {
String key = names.nextElement();
String v = httpServletRequest.getHeader(key);
header.put(key,v);
}
String contentBody = "eid=" + eid+ "&eventType=" + eventType + "&eventId=" + eventId+"&createTime="+createTime;
FineLoggerFactory.getLogger().info(contentBody);
Map<String,String> paramsMap = new TreeMap<String,String>();
paramsMap.put("eid", eid);
paramsMap.put("eventType", eventType);
paramsMap.put("eventId", eventId);
paramsMap.put("createTime", createTime);
contentBody = mapToString(paramsMap);
if(WebHookUtil.checkAuth("123", contentBody, header)){
FineLoggerFactory.getLogger().info("接收到一个合法推送,内容为: "+contentBody);
switch (eventType){
case "user_enter":
case "person_update":
case "user_leave":
case "user_phone_update":
new Thread(new SyncThread("user")).start();
break;
case "org_add":
case "org_update":
case "org_admin":
case "org_delete":
case "person_role":
new Thread(new SyncThread("dep")).start();
break;
}
WebUtils.printAsString(httpServletResponse,"ok");
}else{
FineLoggerFactory.getLogger().info("接收到一个非法推送");
WebUtils.printAsString(httpServletResponse,"ok");
}
}
// 按key字段顺序排序,组装k1=v1&k2=v2形式
private String mapToString(Map<String, String> map) {
StringBuilder sb = new StringBuilder();
Set<String> keys = map.keySet();
for (String key : keys) {
sb.append(key).append("=").append(map.get(key)).append("&");
}
if (sb.length() > 0) {
return sb.substring(0, sb.length() - 1);
} else {
return sb.toString();
}
}
}

35
src/main/java/com/fr/plugin/web/hander/member/SynUserHander.java

@ -0,0 +1,35 @@
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.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 "/xxx/syn/member";
}
@Override
public boolean isPublic() {
return false;
}
@Override
public void handle(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse) throws Exception {
JSONObject jsonObject = MyUtils.createSuccessResponseJSONObject();
MyUtils.startUpUserSyncThread();//启动一次同步
WebUtils.flushSuccessMessageAutoClose(httpServletRequest, httpServletResponse, jsonObject);
}
}

48
src/main/java/com/fr/plugin/web/hander/pushBeanHandler.java

@ -0,0 +1,48 @@
package com.fr.plugin.web.hander;
import com.fr.decision.fun.impl.BaseHttpHandler;
import com.fr.plugin.core.MyCoreDBAccess;
import com.fr.plugin.dao.PushDao;
import com.fr.plugin.entitys.PushEntity;
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;
public class pushBeanHandler extends BaseHttpHandler {
@Override
public RequestMethod getMethod() {
return RequestMethod.GET;
}
@Override
public String getPath() {
return "/xxx/pushBean";
}
@Override
public boolean isPublic() {
return true;
}
@Override
public void handle(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse) throws Exception {
String id = httpServletRequest.getParameter("id");
PushEntity entity = MyCoreDBAccess.getAccessor().runQueryAction(new DBAction<PushEntity>() {
@Override
public PushEntity run(DAOContext daoContext) throws Exception {
return daoContext.getDAO(PushDao.class).findOne(QueryFactory.create().addRestriction(RestrictionFactory.eq("pushId", id)));
}
});
if (entity != null) {
String url = entity.getUrl();
httpServletResponse.sendRedirect(url);
}
WebUtils.printAsString(httpServletResponse, "未找到这个推送");
}
}

152
src/main/resources/com/fr/plugin/core/local/i18.properties

@ -0,0 +1,152 @@
FS-Module-WeiXin_Manager=\u5FAE\u4FE1\u7BA1\u7406
FS-Zch_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-Zch_Recive_Data_URL=\u63A5\u6536\u6570\u636EURL
FS-Zch_Corp_ID=\u5FAE\u4FE1\u4F01\u4E1A\u53F7ID
FS-Zch_Secret=\u5FAE\u4FE1\u5E94\u7528\u79D8\u94A5
FS-Zch_Member_Management=\u5FAE\u4FE1\u6210\u5458\u7BA1\u7406
FS-Zch_User_Same_With_FS=\u5FAE\u4FE1\u53F7\u5339\u914D
FS-Zch_Mobile_Same_With_FS=\u624B\u673A\u8D26\u53F7\u5339\u914D
FS-Zch_Manual_Matching_FS=\u624B\u52A8\u5339\u914D
FS-Zch_Custom_Matching_FS=\u81EA\u5B9A\u4E49\u5339\u914D
FS-Zch_UserID=\u5FAE\u4FE1\u6210\u5458\u540D
FS-Zch_FSUserName=\u62A5\u8868\u7528\u6237\u540D
FS-Zch_Name=\u59D3\u540D
FS-Zch_Department=\u5FAE\u4FE1\u90E8\u95E8
FS-Zch_UrlHint=\u670D\u52A1\u5668\u4FDD\u5B58\u7684Url:
FS-Zch_Refresh_User=\u66F4\u65B0\u901A\u8BAF\u5F55
FS-Zch_Mobile=\u5FAE\u4FE1\u6210\u5458\u624B\u673A\u53F7
FS-Zch_Matching_Way=\u7528\u6237\u5339\u914D\u65B9\u5F0F
FS-Zch_Hint=\u63D0\u793A
FS-Zch_Loading=\u6B63\u5728\u52A0\u8F7D\u7528\u6237...
FS-Zch_Mobile_Not_Supported=\u5F53\u524DHTML5\u62A5\u8868\u4E0D\u652F\u6301\u6839\u636E\u624B\u673A\u53F7\u5339\u914D\uFF0C\u8BF7\u5347\u7EA7HTML5\u63D2\u4EF6
FS-Zch_Mobile-Push-WeiXin-Terminal=\u5FAE\u4FE1\u901A\u77E5
FS-Zch_Mobile-Push-WeiXin-AgentID=\u5E94\u7528ID
FS-Zch_Expired_Error=\u9519\u8BEF\u4EE3\u7801:11100016 \u60A8\u4F7F\u7528\u4E86\u672A\u6CE8\u518C\u7684\u529F\u80FD\u2014\u2014\u5FAE\u4FE1\u96C6\u6210
FS-Zch_Expired_Solution=\u5FAE\u4FE1\u529F\u80FD\u672A\u6CE8\u518C\uFF0C\u5982\u9700\u4F7F\u7528\u8BF7\u8054\u7CFB\u9500\u552E
FS-Zch_Agent_Management=\u5E94\u7528\u7BA1\u7406
FS-Zch_Member_Manage=\u6210\u5458\u7BA1\u7406
FS-Zch_Agent_Config=\u5E94\u7528\u5FEB\u6377\u914D\u7F6E
FS-Zch_Agent_Name=\u4F01\u4E1A\u5E94\u7528\u540D\u79F0
FS-Zch_Enterprise_WeChat=\u4F01\u4E1A\u5FAE\u4FE1
FS-Zch_New_Agent=\u65B0\u5EFA\u5E94\u7528
FS-Zch_ReportServer=\u62A5\u8868\u670D\u52A1\u5668
FS-Zch_ReportServer_Url=\u62A5\u8868\u670D\u52A1\u5668\u5730\u5740
FS-Zch_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-Zch_Save=\u4FDD\u5B58
FS-Zch_DeleteAgent_Confirm_Popup=\u786E\u5B9A\u5220\u9664\u6B64\u4F01\u4E1A\u5FAE\u4FE1\u5E94\u7528
FS-Zch_Confirm=\u786E\u5B9A
FS-Zch_Cancel=\u53D6\u6D88
FS-Zch_Create_WeiXin_Url=\u751F\u6210\u5FAE\u4FE1\u94FE\u63A5
FS-Zch_WeiXin_Url=\u5FAE\u4FE1\u94FE\u63A5
FS-Zch_Platform_Page=\u94FE\u63A5\u9875\u9762
FS-Zch_Platform=\u51B3\u7B56\u5E73\u53F0
FS-Zch_Platform_Report=\u5355\u4E2A\u6A21\u677F
FS-Zch_Create_Url=\u751F\u6210\u94FE\u63A5
FS-Zch_Copy_Url=\u590D\u5236
FS-Zch_Modify_Agent=\u4FEE\u6539\u4F01\u4E1A\u5FAE\u4FE1
FS-Zch_Attention=\u6CE8\u610F
FS-Zch_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-Zch_Default_Agent_Name=FineReport\u4F01\u4E1A\u5E94\u7528
FS-Zch_Default_Schedule_Agent_Name=\u5E94\u7528(\u5B9A\u65F6\u63A8\u9001)
FS-Zch_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-Zch_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-Zch_Copy_Success=\u590D\u5236\u6210\u529F
FS-Zch_Match_Way=\u5339\u914D\u65B9\u5F0F
FS-Zch_Match_Setting=\u5339\u914D\u8BBE\u7F6E
FS-Zch_DataSet=\u6570\u636E\u96C6
FS-Zch_UserId=\u5FAE\u4FE1\u7528\u6237\u540D
FS-Zch_FsUserName=\u62A5\u8868\u7528\u6237\u540D
FS-Zch_Address_Book=\u901A\u8BAF\u5F55
FS-Zch_Member_Update=\u7ACB\u5373\u66F4\u65B0
FS-Zch_Set_Update=\u8BBE\u7F6E\u81EA\u52A8\u66F4\u65B0
FS-Zch_Start_Update=\u542F\u7528\u81EA\u52A8\u66F4\u65B0
FS-Zch_Per=\u6BCF
FS-Zch_Day=\u5929
FS-Zch_Week=\u5468
FS-Zch_Hour=\u65F6
FS-Zch_Minute=\u5206
FS-Zch_Monday=\u5468\u4E00
FS-Zch_Tuesday=\u5468\u4E8C
FS-Zch_Wednesday=\u5468\u4E09
FS-Zch_Thursday=\u5468\u56DB
FS-Zch_Friday=\u5468\u4E94
FS-Zch_Saturday=\u5468\u516D
FS-Zch_Sunday=\u5468\u65E5
FS-Zch_Update_Once=\u5B9A\u65F6\u540C\u6B65\u4E00\u6B21
FS-Zch_Not_Null=\u4E0D\u5141\u8BB8\u4E3A\u7A7A
FS-Zch_Save_Agent_Fail=\u5B58\u50A8\u5E94\u7528\u4FE1\u606F\u5931\u8D25
FS-Zch_Agent_Name_Exist=\u5E94\u7528\u540D\u79F0\u5DF2\u5B58\u5728
FS-Zch_Secret_Exist=secret\u5DF2\u5B58\u5728
FS-Zch_Organizational_Structure=\u7EC4\u7EC7\u67B6\u6784
FS-Zch_Tag=\u6807\u7B7E
FS-Zch_Illegal=\u4E0D\u5408\u6CD5
FS-Zch_Proxy=\u5FAE\u4FE1\u4EE3\u7406\u8DF3\u8F6C
FS-Zch_Proxy_Address=\u4EE3\u7406\u670D\u52A1\u5668\u5730\u5740
FS-Zch_Test_Proxy_Address=\u6D4B\u8BD5\u8FDE\u63A5
FS-Zch_Connection_Success=\u8FDE\u63A5\u6210\u529F
FS-Zch_Connection_Fail=\u8FDE\u63A5\u5931\u8D25
FS-Zch_Test_Connection=\u6D4B\u8BD5\u8FDE\u63A5\u4E2D...
FS-Zch_Agent_Quick_Config=\u4E3B\u9875\u578B\u5E94\u7528\u5FEB\u901F\u914D\u7F6E
FS-Zch_One_Key_Config=\u4E00\u952E\u914D\u7F6E
FS-Zch_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-Zch_Adress_Book_Secret=\u901A\u8BAF\u5F55\u7BA1\u7406secret
FS-Zch_Import_Adress_Book=\u5BFC\u5165\u5FAE\u4FE1\u901A\u8BAF\u5F55
FS-Zch_Syn_Adress_Book=\u540C\u6B65\u62A5\u8868\u901A\u8BAF\u5F55\u5230\u5FAE\u4FE1
FS-Zch_Env_Check=\u5FAE\u4FE1\u96C6\u6210\u73AF\u5883\u914D\u7F6E\u68C0\u6D4B
FS-Zch_Check_Items=\u68C0\u6D4B\u9879\u76EE
FS-Zch_Check_Result=\u72B6\u6001
FS-Zch_Check_Proposal=\u5EFA\u8BAE
FS-Zch_Configuring=\u6B63\u5728\u914D\u7F6E\u4E2D...
FS-Zch_Configure_Success=\u914D\u7F6E\u6210\u529F
FS-Zch_Configure_Fail=\u4E00\u952E\u914D\u7F6E\u5931\u8D25
FS-Zch_Reconfigure=\u8BF7\u91CD\u65B0\u914D\u7F6E
FS-Zch_Start_With_Http=\u670D\u52A1\u5668\u5730\u5740\u5FC5\u987B\u4EE5http\u6216https\u5F00\u5934
FS-Zch_Get-Agent-Fail=\u83B7\u53D6\u5E94\u7528\u5931\u8D25
FS-Zch_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-Zch_Sync-Contacts=\u6B63\u5728\u540C\u6B65\u4E2D...
FS-Zch_Sync-Contacts-Success=\u5FAE\u4FE1\u901A\u8BAF\u5F55\u5BFC\u5165\u6210\u529F
FS-Zch_Sync-Contacts-Fail=\u5FAE\u4FE1\u901A\u8BAF\u5F55\u5BFC\u5165\u5931\u8D25
FS-Zch_Import-Success=\u6210\u529F\u5BFC\u5165
FS-Zch_People=\u4EBA
FS-Zch_Fail=\u5931\u8D25
FS-Zch_Debugger-Content=\u8C03\u8BD5\u5185\u5BB9
FS-Zch_Debugger-Type-Basic-Property=\u57FA\u672C\u5C5E\u6027
FS-Zch_Debugger-Type-Login=\u5355\u70B9\u767B\u5F55
FS-Zch_Debugger-Type-Push-Message=\u63A8\u9001\u6D88\u606F
FS-Zch_Debugger-WeiXin-Agent=\u5FAE\u4FE1\u5E94\u7528
FS-Zch_Debugger-Parameter-List=\u53C2\u6570\u5217\u8868
FS-Zch_Debugger-Input-Parameter=\u8F93\u5165\u53C2\u6570
FS-Zch_Debugger-WeiXin-User=\u5FAE\u4FE1\u7528\u6237
FS-Zch_Debugger-Fs-User=\u62A5\u8868\u7528\u6237
FS-Zch_Debugger-Push-User=\u63A8\u9001\u7528\u6237
FS-Zch_Debugger-Start-Check=\u5F00\u59CB\u68C0\u6D4B
FS-Zch_Debugger-Show-Result=\u68C0\u6D4B\u7ED3\u679C
FS-Zch_Debugger-Get-Token=\u83B7\u53D6token
FS-Zch_Debugger-Get-Department=\u83B7\u53D6\u90E8\u95E8
FS-Zch_Debugger-Get-Domain=\u53EF\u4FE1\u57DF\u540D
FS-Zch_Debugger-Home-Url=\u4E3B\u9875/\u83DC\u5355\u94FE\u63A5
FS-Zch_ErrorCode=\u5FAE\u4FE1\u8FD4\u56DE\u9519\u8BEF\u7801
FS-Zch_ErrorMsg=\u9519\u8BEF\u63CF\u8FF0
FS-Zch_Solution=\u51ED\u9519\u8BEF\u7801\u53EF\u4EE5\u81F3\u5FAE\u4FE1\u67E5\u770B\u66F4\u591A\u4FE1\u606F
FS-Zch_Dep=\u90E8\u95E8
FS-Zch_Phone=\u624B\u673A\u53F7
FS-Zch_ErrorDetail=\u9519\u8BEF\u4FE1\u606F
FS-Zch_None-Synchronous-User=\u65E0\u53EF\u540C\u6B65\u7528\u6237
FS-Zch_NetWork-Anomaly=\u7F51\u7EDC\u5F02\u5E38\uFF0C\u8BF7\u68C0\u67E5\u7F51\u7EDC\u914D\u7F6E
FS-Zch_Delete-Agent-Fail=\u5220\u9664\u5E94\u7528\u5931\u8D25
FS-Zch_Save-ReportServer-Url-Fail=\u4FDD\u5B58\u670D\u52A1\u5668\u5730\u5740\u5931\u8D25
FS-Zch_Get-ReportServer-Url-Fail=\u83B7\u53D6\u670D\u52A1\u5668\u5730\u5740\u5931\u8D25
FS-Zch_Tip-Get-ReportServer-Url-Fail=\u8BF7\u914D\u7F6E\u670D\u52A1\u5668\u5730\u5740
FS-Zch_Create-Agent-Menu-Fail=\u521B\u5EFA\u5E94\u7528\u83DC\u5355\u5931\u8D25
FS-Zch_Get-Agent-Menu-Fail=\u83B7\u53D6\u5E94\u7528\u83DC\u5355\u5931\u8D25
FS-Zch_Save-Proxy-Server-Url-Fail=\u5B58\u50A8\u4EE3\u7406\u670D\u52A1\u5668\u5730\u5740\u5931\u8D25
FS-Zch_Match-Way-Not-Null=\u5339\u914D\u8BBE\u7F6E\u4E0D\u80FD\u4E3A\u7A7A
FS-CH_title=\u534E\u53D1\u63D2\u4EF6

152
src/main/resources/com/fr/plugin/core/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

151
src/main/resources/com/fr/plugin/core/local/i18_zh_CN.properties

@ -0,0 +1,151 @@
FS-Module-Zch_Manager=\u534E\u53D1\u7BA1\u7406
FS-Zch_Basic=\u57FA\u672C\u4FE1\u606F
FS-Schedule-Notification_WeiXin=\u63A8\u9001\u534E\u53D1\u6D88\u606F
FS-Schedule-Notification_Zch_CorpID=\u4F01\u4E1A\u5E94\u7528ID\uFF1A
FS-Schedule-Notification_Zch_Users=\u534E\u53D1\u7528\u6237\uFF1A
FS-Schedule-Notification_Zch_DepID=\u90E8\u95E8ID\uFF1A
FS-Schedule-Notification_Zch_Content=\u6D88\u606F\u5185\u5BB9\uFF1A
FS-Schedule-Notification_Zch_WithLink=\u5B9A\u65F6\u7ED3\u679C\u8BBF\u95EE\u94FE\u63A5
FS-Schedule_Mobile-Push-WeiXinId-Not-Null=\u8BF7\u8BBE\u7F6E\u63A8\u9001\u7684\u534E\u53D1\u5E94\u7528
FS-Zch_Recive_Data_URL=\u63A5\u6536\u6570\u636EURL
FS-Zch_Corp_ID=\u534E\u53D1\u4F01\u4E1A\u53F7ID
FS-Zch_Secret=\u534E\u53D1\u5E94\u7528\u79D8\u94A5
FS-Zch_Member_Management=\u534E\u53D1\u6210\u5458\u7BA1\u7406
FS-Zch_User_Same_With_FS=\u534E\u53D1\u53F7\u5339\u914D
FS-Zch_Mobile_Same_With_FS=\u624B\u673A\u8D26\u53F7\u5339\u914D
FS-Zch_Manual_Matching_FS=\u624B\u52A8\u5339\u914D
FS-Zch_Custom_Matching_FS=\u81EA\u5B9A\u4E49\u5339\u914D
FS-Zch_UserID=\u534E\u53D1\u6210\u5458\u540D
FS-Zch_FSUserName=\u62A5\u8868\u7528\u6237\u540D
FS-Zch_Name=\u59D3\u540D
FS-Zch_Department=\u534E\u53D1\u90E8\u95E8
FS-Zch_UrlHint=\u670D\u52A1\u5668\u4FDD\u5B58\u7684Url:
FS-Zch_Refresh_User=\u66F4\u65B0\u901A\u8BAF\u5F55
FS-Zch_Mobile=\u534E\u53D1\u6210\u5458\u624B\u673A\u53F7
FS-Zch_Matching_Way=\u7528\u6237\u5339\u914D\u65B9\u5F0F
FS-Zch_Hint=\u63D0\u793A
FS-Zch_Loading=\u6B63\u5728\u52A0\u8F7D\u7528\u6237...
FS-Zch_Mobile_Not_Supported=\u5F53\u524DHTML5\u62A5\u8868\u4E0D\u652F\u6301\u6839\u636E\u624B\u673A\u53F7\u5339\u914D\uFF0C\u8BF7\u5347\u7EA7HTML5\u63D2\u4EF6
FS-Zch_Mobile-Push-Zch-Terminal=\u534E\u53D1\u901A\u77E5
FS-Zch_Mobile-Push-Zch-AgentID=\u5E94\u7528ID
FS-Zch_Expired_Error=\u9519\u8BEF\u4EE3\u7801:11100016 \u60A8\u4F7F\u7528\u4E86\u672A\u6CE8\u518C\u7684\u529F\u80FD\u2014\u2014\u534E\u53D1\u96C6\u6210
FS-Zch_Expired_Solution=\u534E\u53D1\u529F\u80FD\u672A\u6CE8\u518C\uFF0C\u5982\u9700\u4F7F\u7528\u8BF7\u8054\u7CFB\u9500\u552E
FS-Zch_Agent_Management=\u5E94\u7528\u7BA1\u7406
FS-Zch_Member_Manage=\u6210\u5458\u7BA1\u7406
FS-Zch_Agent_Config=\u5E94\u7528\u5FEB\u6377\u914D\u7F6E
FS-Zch_Enterprise_WeChat=\u4F01\u4E1A\u534E\u53D1
FS-Zch_New_Agent=\u65B0\u5EFA\u534E\u53D1\u5E94\u7528
FS-Zch_ReportServer=\u62A5\u8868\u670D\u52A1\u5668
FS-Zch_ReportServer_Url=\u62A5\u8868\u670D\u52A1\u5668\u5730\u5740
FS-Zch_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-Zch_Save=\u4FDD\u5B58
FS-Zch_DeleteAgent_Confirm_Popup=\u786E\u5B9A\u5220\u9664\u6B64\u4F01\u4E1A\u534E\u53D1\u5E94\u7528
FS-Zch_Confirm=\u786E\u5B9A
FS-Zch_Cancel=\u53D6\u6D88
FS-Zch_Create_Zch_Url=\u751F\u6210\u534E\u53D1\u94FE\u63A5
FS-Zch_Zch_Url=\u534E\u53D1\u94FE\u63A5
FS-Zch_Platform_Page=\u94FE\u63A5\u9875\u9762
FS-Zch_Platform=\u51B3\u7B56\u5E73\u53F0
FS-Zch_Platform_Report=\u5355\u4E2A\u6A21\u677F
FS-Zch_Create_Url=\u751F\u6210\u94FE\u63A5
FS-Zch_Copy_Url=\u590D\u5236
FS-Zch_Modify_Agent=\u4FEE\u6539\u8D44\u6599
FS-Zch_Attention=\u6CE8\u610F
FS-Zch_CreateAgent_Not_Null=\u534E\u53D1\u5E94\u7528\u540D\u79F0\uFF0CCorpID\uFF0C\u7BA1\u7406\u7EC4\u51ED\u8BC1\u79D8\u94A5\u4E0D\u53EF\u4E3A\u7A7A
BI-Basic_Search=\u641C\u7D22
FS-Zch_Default_Agent_Name=FineReport\u4F01\u4E1A\u5E94\u7528
FS-Zch_Default_Schedule_Agent_Name=\u5E94\u7528(\u5B9A\u65F6\u63A8\u9001)
FS-Zch_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-Zch_Management_Secret=\u60A8\u5F53\u524D\u5E94\u7528\u7684secret\u4E3A\u7BA1\u7406\u7EC4secret\uFF0C\u4E3A\u4E86\u60A8\u6B63\u5E38\u4F7F\u7528\u534E\u53D1\u96C6\u6210\u529F\u80FD\uFF0C\u8BF7\u66FF\u6362\u4E3A\u5E94\u7528secret
FS-Zch_Copy_Success=\u590D\u5236\u6210\u529F
FS-Zch_Match_Way=\u5339\u914D\u65B9\u5F0F
FS-Zch_Match_Setting=\u5339\u914D\u8BBE\u7F6E
FS-Zch_DataSet=\u6570\u636E\u96C6
FS-Zch_UserId=\u534E\u53D1\u7528\u6237\u540D
FS-Zch_FsUserName=\u62A5\u8868\u7528\u6237\u540D
FS-Zch_Address_Book=\u901A\u8BAF\u5F55
FS-Zch_Member_Update=\u7ACB\u5373\u66F4\u65B0
FS-Zch_Set_Update=\u8BBE\u7F6E\u81EA\u52A8\u66F4\u65B0
FS-Zch_Start_Update=\u542F\u7528\u81EA\u52A8\u66F4\u65B0
FS-Zch_Per=\u6BCF
FS-Zch_Day=\u5929
FS-Zch_Week=\u5468
FS-Zch_Hour=\u65F6
FS-Zch_Minute=\u5206
FS-Zch_Monday=\u5468\u4E00
FS-Zch_Tuesday=\u5468\u4E8C
FS-Zch_Wednesday=\u5468\u4E09
FS-Zch_Thursday=\u5468\u56DB
FS-Zch_Friday=\u5468\u4E94
FS-Zch_Saturday=\u5468\u516D
FS-Zch_Sunday=\u5468\u65E5
FS-Zch_Update_Once=\u5B9A\u65F6\u540C\u6B65\u4E00\u6B21
FS-Zch_Not_Null=\u4E0D\u5141\u8BB8\u4E3A\u7A7A
FS-Zch_Save_Agent_Fail=\u5B58\u50A8\u5E94\u7528\u4FE1\u606F\u5931\u8D25
FS-Zch_Agent_Name_Exist=\u5E94\u7528\u540D\u79F0\u5DF2\u5B58\u5728
FS-Zch_Secret_Exist=secret\u5DF2\u5B58\u5728
FS-Zch_Organizational_Structure=\u7EC4\u7EC7\u67B6\u6784
FS-Zch_Tag=\u6807\u7B7E
FS-Zch_Illegal=\u4E0D\u5408\u6CD5
FS-Zch_Proxy=\u534E\u53D1\u4EE3\u7406\u8DF3\u8F6C
FS-Zch_Proxy_Address=\u4EE3\u7406\u670D\u52A1\u5668\u5730\u5740
FS-Zch_Test_Proxy_Address=\u6D4B\u8BD5\u8FDE\u63A5
FS-Zch_Connection_Success=\u8FDE\u63A5\u6210\u529F
FS-Zch_Connection_Fail=\u8FDE\u63A5\u5931\u8D25
FS-Zch_Test_Connection=\u6D4B\u8BD5\u8FDE\u63A5\u4E2D...
FS-Zch_Agent_Quick_Config=\u4E3B\u9875\u578B\u5E94\u7528\u5FEB\u901F\u914D\u7F6E
FS-Zch_One_Key_Config=\u4E00\u952E\u914D\u7F6E
FS-Zch_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-Zch_Adress_Book_Secret=\u901A\u8BAF\u5F55\u7BA1\u7406secret
FS-Zch_Import_Adress_Book=\u5BFC\u5165\u534E\u53D1\u901A\u8BAF\u5F55
FS-Zch_Syn_Adress_Book=\u540C\u6B65\u62A5\u8868\u901A\u8BAF\u5F55\u5230\u534E\u53D1
FS-Zch_Env_Check=\u534E\u53D1\u96C6\u6210\u73AF\u5883\u914D\u7F6E\u68C0\u6D4B
FS-Zch_Check_Items=\u68C0\u6D4B\u9879\u76EE
FS-Zch_Check_Result=\u72B6\u6001
FS-Zch_Check_Proposal=\u5EFA\u8BAE
FS-Zch_Configuring=\u6B63\u5728\u914D\u7F6E\u4E2D...
FS-Zch_Configure_Success=\u914D\u7F6E\u6210\u529F
FS-Zch_Configure_Fail=\u4E00\u952E\u914D\u7F6E\u5931\u8D25
FS-Zch_Reconfigure=\u8BF7\u91CD\u65B0\u914D\u7F6E
FS-Zch_Start_With_Http=\u670D\u52A1\u5668\u5730\u5740\u5FC5\u987B\u4EE5http\u6216https\u5F00\u5934
FS-Zch_Get-Agent-Fail=\u83B7\u53D6\u5E94\u7528\u5931\u8D25
FS-Zch_Sync-Contacts-Tip=\u5F53\u524D\u534E\u53D1\u901A\u8BAF\u5F55\u4E0D\u4E3A\u7A7A\uFF0C\u7EE7\u7EED\u5BFC\u5165\u4F1A\u4E22\u5931\u539F\u59CB\u6210\u5458\u4FE1\u606F
FS-Zch_Sync-Contacts=\u6B63\u5728\u540C\u6B65\u4E2D...
FS-Zch_Sync-Contacts-Success=\u534E\u53D1\u901A\u8BAF\u5F55\u5BFC\u5165\u6210\u529F
FS-Zch_Sync-Contacts-Fail=\u534E\u53D1\u901A\u8BAF\u5F55\u5BFC\u5165\u5931\u8D25
FS-Zch_Import-Success=\u6210\u529F\u5BFC\u5165
FS-Zch_People=\u4EBA
FS-Zch_Fail=\u5931\u8D25
FS-Zch_Debugger-Content=\u8C03\u8BD5\u5185\u5BB9
FS-Zch_Debugger-Type-Basic-Property=\u57FA\u672C\u5C5E\u6027
FS-Zch_Debugger-Type-Login=\u5355\u70B9\u767B\u5F55
FS-Zch_Debugger-Type-Push-Message=\u63A8\u9001\u6D88\u606F
FS-Zch_Debugger-Zch-Agent=\u534E\u53D1\u5E94\u7528
FS-Zch_Debugger-Parameter-List=\u53C2\u6570\u5217\u8868
FS-Zch_Debugger-Input-Parameter=\u8F93\u5165\u53C2\u6570
FS-Zch_Debugger-Zch-User=\u534E\u53D1\u7528\u6237
FS-Zch_Debugger-Fs-User=\u62A5\u8868\u7528\u6237
FS-Zch_Debugger-Push-User=\u63A8\u9001\u7528\u6237
FS-Zch_Debugger-Start-Check=\u5F00\u59CB\u68C0\u6D4B
FS-Zch_Debugger-Show-Result=\u68C0\u6D4B\u7ED3\u679C
FS-Zch_Debugger-Get-Token=\u83B7\u53D6token
FS-Zch_Debugger-Get-Department=\u83B7\u53D6\u90E8\u95E8
FS-Zch_Debugger-Get-Domain=\u53EF\u4FE1\u57DF\u540D
FS-Zch_Debugger-Home-Url=\u4E3B\u9875/\u83DC\u5355\u94FE\u63A5
FS-Zch_ErrorCode=\u534E\u53D1\u8FD4\u56DE\u9519\u8BEF\u7801
FS-Zch_ErrorMsg=\u9519\u8BEF\u63CF\u8FF0
FS-Zch_Solution=\u51ED\u9519\u8BEF\u7801\u53EF\u4EE5\u81F3\u534E\u53D1\u67E5\u770B\u66F4\u591A\u4FE1\u606F
FS-Zch_Dep=\u90E8\u95E8
FS-Zch_Phone=\u624B\u673A\u53F7
FS-Zch_ErrorDetail=\u9519\u8BEF\u4FE1\u606F
FS-Zch_None-Synchronous-User=\u65E0\u53EF\u540C\u6B65\u7528\u6237
FS-Zch_NetWork-Anomaly=\u7F51\u7EDC\u5F02\u5E38\uFF0C\u8BF7\u68C0\u67E5\u7F51\u7EDC\u914D\u7F6E
FS-Zch_Delete-Agent-Fail=\u5220\u9664\u5E94\u7528\u5931\u8D25
FS-Zch_Save-ReportServer-Url-Fail=\u4FDD\u5B58\u670D\u52A1\u5668\u5730\u5740\u5931\u8D25
FS-Zch_Get-ReportServer-Url-Fail=\u83B7\u53D6\u670D\u52A1\u5668\u5730\u5740\u5931\u8D25
FS-Zch_Tip-Get-ReportServer-Url-Fail=\u8BF7\u914D\u7F6E\u670D\u52A1\u5668\u5730\u5740
FS-Zch_Create-Agent-Menu-Fail=\u521B\u5EFA\u5E94\u7528\u83DC\u5355\u5931\u8D25
FS-Zch_Get-Agent-Menu-Fail=\u83B7\u53D6\u5E94\u7528\u83DC\u5355\u5931\u8D25
FS-Zch_Save-Proxy-Server-Url-Fail=\u5B58\u50A8\u4EE3\u7406\u670D\u52A1\u5668\u5730\u5740\u5931\u8D25
FS-Zch_Match-Way-Not-Null=\u5339\u914D\u8BBE\u7F6E\u4E0D\u80FD\u4E3A\u7A7A
FS-CH_title=\u534E\u53D1\u63D2\u4EF6

32
src/main/resources/com/fr/plugin/web/LoginRequire.html

@ -0,0 +1,32 @@
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=${charset}">
<meta name="author" content="FineReport" />
<meta name="Copyright" content="FineReport" />
<meta name="description" content="FineReport--Web Reporting Tool" />
<meta name="keywords" content="FineReport,Web Reporting Tool" />
<title></title>
<style>
body{
margin: 0;
width: 100%;
height: 100%;
overflow-x: hidden;
overflow-y: hidden;
}
</style>
</head>
<body>
<form method="post" action="${loginURL}" id='sub'>
<input type="hidden" name="SAMLRequest" value="${samlRequest}" />
<input type="hidden" name="RelayState" value="${requestURI}" />
<input type="submit" value="如果没有自动跳转,点我" style="display: none" id="btnSubmit" />
<!-- <a href="/webroot/decision/login?isAdmin=1"></a> -->
</form>
</body>
<script>
setTimeout(function () {
document.getElementById("btnSubmit").click()
},0)
</script>
</html>

0
src/main/resources/com/fr/plugin/web/css/cloud_home.css

19
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;
}

BIN
src/main/resources/com/fr/plugin/web/images/1x/icon/debugger.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

BIN
src/main/resources/com/fr/plugin/web/images/1x/icon/icon_fail.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

BIN
src/main/resources/com/fr/plugin/web/images/1x/icon/icon_success.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

BIN
src/main/resources/com/fr/plugin/web/images/1x/icon/loading.gif

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

BIN
src/main/resources/com/fr/plugin/web/images/2x/icon/debugger.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 56 KiB

BIN
src/main/resources/com/fr/plugin/web/images/2x/icon/icon_fail.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.1 KiB

BIN
src/main/resources/com/fr/plugin/web/images/2x/icon/icon_success.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.8 KiB

BIN
src/main/resources/com/fr/plugin/web/images/2x/icon/loading.gif

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

3518
src/main/resources/com/fr/plugin/web/js/login.js

File diff suppressed because it is too large Load Diff

3632
src/main/resources/com/fr/plugin/web/js/meixin.js

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save