diff --git a/README.md b/README.md
index a9eaa43..550b482 100644
--- a/README.md
+++ b/README.md
@@ -1,3 +1,6 @@
# open-JSD-8690
-JSD-8690 开源任务材料
\ No newline at end of file
+JSD-8690 云之家推送示例 开源任务材料\
+免责说明:该源码为第三方爱好者提供,不保证源码和方案的可靠性,也不提供任何形式的源码教学指导和协助!\
+仅作为开发者学习参考使用!禁止用于任何商业用途!\
+为保护开发者隐私,开发者信息已隐去!若原开发者希望公开自己的信息,可联系hugh处理。
\ No newline at end of file
diff --git a/jsd 8690问题定位文档.docx b/jsd 8690问题定位文档.docx
new file mode 100644
index 0000000..84c39f7
Binary files /dev/null and b/jsd 8690问题定位文档.docx differ
diff --git a/plugin.xml b/plugin.xml
new file mode 100644
index 0000000..353cd62
--- /dev/null
+++ b/plugin.xml
@@ -0,0 +1,52 @@
+
+
+ com.fr.plugin.xxxx.10
+
+ yes
+ 2.0.7.2
+ 10.0
+ 2019-03-10
+ fr.open
+
+
+
+ [2019-11-6]项目启动
+ [2020-01-14]修复推送问题
+ ]]>
+
+ com.fr.plugin.core
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/main/java/com/fr/plugin/beans/MyAgentBean.java b/src/main/java/com/fr/plugin/beans/MyAgentBean.java
new file mode 100644
index 0000000..e92c9ce
--- /dev/null
+++ b/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;
+ }
+}
diff --git a/src/main/java/com/fr/plugin/beans/MyDepBean.java b/src/main/java/com/fr/plugin/beans/MyDepBean.java
new file mode 100644
index 0000000..7f8c172
--- /dev/null
+++ b/src/main/java/com/fr/plugin/beans/MyDepBean.java
@@ -0,0 +1,90 @@
+package com.fr.plugin.beans;
+
+import com.fr.json.JSONArray;
+import com.fr.json.JSONException;
+import com.fr.json.JSONObject;
+import com.fr.plugin.entitys.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;
+ }
+
+}
diff --git a/src/main/java/com/fr/plugin/beans/MyOutputBean.java b/src/main/java/com/fr/plugin/beans/MyOutputBean.java
new file mode 100644
index 0000000..db722e1
--- /dev/null
+++ b/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;
+ }
+}
diff --git a/src/main/java/com/fr/plugin/beans/MyUserBean.java b/src/main/java/com/fr/plugin/beans/MyUserBean.java
new file mode 100644
index 0000000..63e3afc
--- /dev/null
+++ b/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"
+}
diff --git a/src/main/java/com/fr/plugin/beans/msg/MyMessageType.java b/src/main/java/com/fr/plugin/beans/msg/MyMessageType.java
new file mode 100644
index 0000000..75f7c88
--- /dev/null
+++ b/src/main/java/com/fr/plugin/beans/msg/MyMessageType.java
@@ -0,0 +1,14 @@
+package com.fr.plugin.beans.msg;
+
+import com.fr.decision.system.message.type.MessageType;
+
+public class MyMessageType extends MessageType {
+ public static final MyMessageType KEY = new MyMessageType();
+ public static final String TEXT = "text";
+ public static final String FILE = "file";
+ public static final String NEWS = "news";
+ @Override
+ public int toInteger() {
+ return 518;
+ }
+}
diff --git a/src/main/java/com/fr/plugin/config/MyConfig.java b/src/main/java/com/fr/plugin/config/MyConfig.java
new file mode 100644
index 0000000..3605529
--- /dev/null
+++ b/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 appId = Holders.simple(StringUtils.EMPTY);
+ private Conf eid = Holders.simple(StringUtils.EMPTY);
+ private Conf secret = Holders.simple(StringUtils.EMPTY);
+ private Conf url = Holders.simple(StringUtils.EMPTY);
+ private Conf readKey = Holders.simple(StringUtils.EMPTY);
+ private Conf match = Holders.simple(StringUtils.EMPTY);
+ private Conf scanId = Holders.simple(StringUtils.EMPTY);
+ private Conf scanSecret = Holders.simple(StringUtils.EMPTY);
+
+ private Conf pushUrl = Holders.simple(StringUtils.EMPTY);
+
+ private Conf authUrl = Holders.simple(StringUtils.EMPTY);
+
+ private Conf accessToken = Holders.simple(StringUtils.EMPTY);
+ private Conf appKey = Holders.simple(StringUtils.EMPTY);
+ private volatile boolean isAuthorityInited = false;
+ private volatile boolean isDBAccessAvailable = false;
+ private volatile boolean isThreadAlreadyStart = false;
+ private Conf lastSyncUserTime = Holders.simple(StringUtils.EMPTY);
+ private Conf lastSyncDepTime = Holders.simple(StringUtils.EMPTY);
+ private Conf synToken = Holders.simple(StringUtils.EMPTY);
+
+ public static 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) secret.clone();
+ clone.appId = (Conf) appId.clone();
+ clone.eid = (Conf) eid.clone();
+ clone.url = (Conf) url.clone();
+ clone.readKey = (Conf) readKey.clone();
+ clone.match = (Conf) match.clone();
+
+ clone.scanId = (Conf) scanId.clone();
+ clone.lastSyncUserTime = (Conf) lastSyncUserTime.clone();
+ clone.lastSyncDepTime = (Conf) lastSyncDepTime.clone();
+ clone.synToken = (Conf) synToken.clone();
+ clone.scanSecret = (Conf) scanSecret.clone();
+ return clone;
+ }
+}
diff --git a/src/main/java/com/fr/plugin/config/MyTimingTaskConfig.java b/src/main/java/com/fr/plugin/config/MyTimingTaskConfig.java
new file mode 100644
index 0000000..25de419
--- /dev/null
+++ b/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 executeTimingTask;
+ private Conf timingTaskFrequencyType;
+ private Conf timingTaskStartDay;
+ private Conf timingTaskStartHour;
+ private Conf 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);
+ }
+}
diff --git a/src/main/java/com/fr/plugin/constant/Week.java b/src/main/java/com/fr/plugin/constant/Week.java
new file mode 100644
index 0000000..dee9559
--- /dev/null
+++ b/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;
+ }
+ }
+}
diff --git a/src/main/java/com/fr/plugin/core/LoginFilter.java b/src/main/java/com/fr/plugin/core/LoginFilter.java
new file mode 100644
index 0000000..4bf8d8d
--- /dev/null
+++ b/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("").toString();
+ samlRequest = encoding(samlRequestString);
+ String idm = instance.getAuthUrl();
+ if (StringUtils.isBlank(idm)) {
+ idm = "https://testlogin.idm.huafagroup.com:25443/siam/login";
+ }
+ Map map = new HashMap();
+ 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;
+
+ }
+}
diff --git a/src/main/java/com/fr/plugin/core/LoginsComponent.java b/src/main/java/com/fr/plugin/core/LoginsComponent.java
new file mode 100644
index 0000000..d98b68d
--- /dev/null
+++ b/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);
+ }
+}
diff --git a/src/main/java/com/fr/plugin/core/MeixinMessageObject.java b/src/main/java/com/fr/plugin/core/MeixinMessageObject.java
new file mode 100644
index 0000000..1e62eb8
--- /dev/null
+++ b/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[] 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);
+ }
+}
diff --git a/src/main/java/com/fr/plugin/core/MyComponent.java b/src/main/java/com/fr/plugin/core/MyComponent.java
new file mode 100644
index 0000000..44176ff
--- /dev/null
+++ b/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");
+ }
+}
diff --git a/src/main/java/com/fr/plugin/core/MyCoreDBAccess.java b/src/main/java/com/fr/plugin/core/MyCoreDBAccess.java
new file mode 100644
index 0000000..fc76305
--- /dev/null
+++ b/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);
+ }
+}
diff --git a/src/main/java/com/fr/plugin/core/MyCorpManager.java b/src/main/java/com/fr/plugin/core/MyCorpManager.java
new file mode 100644
index 0000000..35765c6
--- /dev/null
+++ b/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 corpList;
+ private List depList = new ArrayList<>();
+
+ private MyCorpManager() {
+
+ }
+
+ public static MyCorpManager getInstance() {
+ return MyCorpManager.HOLDER.INSTANCE;
+ }
+
+
+ public JSONArray generateDepartmentTree() {
+ JSONArray var1 = new JSONArray();
+ try {
+ this.depList = this.getDepFormDB();
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ if (this.depList.isEmpty()) {
+ return new JSONArray();
+ }
+// Map parentTree = new HashMap<>();
+ for (MyDepBean depBean : this.depList) {
+ var1.add(depBean.createJSONConfig());
+ }
+ return var1;
+ }
+
+ private List getDepFormDB() throws Exception {
+ List entities = MyCoreDBAccess.getAccessor().runQueryAction(new DBAction>() {
+ @Override
+ public List run(DAOContext daoContext) throws Exception {
+ return daoContext.getDAO(MyDepDao.class).find(QueryFactory.create());
+ }
+ });
+ return entities.stream().map(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 allDep = WebUtils.getAllDep(eid, readKey);
+ Logger logger = LoggerFactory.getLogger("部门同步");
+ List idsFromService = new ArrayList<>(allDep.size());
+ if (allDep.isEmpty()) {
+ return;
+ }
+ int count=0;
+ for (MyDepBean depBean : allDep) {
+ String id = depBean.getId();
+ idsFromService.add(id);
+ if (depNotExist(id)) {
+ logger.error("同步一个新的部门:{}", depBean.getName());
+ save(depBean.createEntity());
+ logger.error("同步一个新的部门:{} 完成", depBean.getName());
+ } else {
+ logger.error("同步更新部门:{}", depBean.getName());
+ update(depBean.createEntity());
+ logger.error("同步更新部门完成:{}", depBean.getName());
+ }
+ count++;
+ }
+ logger.error("共处理更新{}个部门",count);
+ int delCount=0;
+ List allDepId = findAllDepId();
+ if (allDepId.removeAll(idsFromService)) {
+ for (String id : allDepId) {
+ logger.error("删除了一个部门:{}",id);
+ delCount++;
+ remove(id);
+ }
+ }
+ logger.error("共处理删除{}个部门",delCount);
+ }
+ }
+
+ private List findAllDepId() throws Exception {
+ List entityList = MyCoreDBAccess.getAccessor().runQueryAction(new DBAction>() {
+ public List run(DAOContext content) throws Exception {
+ QueryCondition queryCondition = QueryFactory.create();
+ return content.getDAO(MyDepDao.class).find(queryCondition);
+ }
+ });
+ List ids = new ArrayList<>(entityList.size());
+ for (MyDepEntity entity : entityList) {
+ ids.add(entity.getId());
+ }
+ return ids;
+ }
+
+ private boolean depNotExist(final String id) throws Exception {
+ return MyCoreDBAccess.getAccessor().runQueryAction(new DBAction>() {
+ @Override
+ public List run(DAOContext daoContext) throws Exception {
+ return daoContext.getDAO(MyDepDao.class).find(QueryFactory.create().addRestriction(RestrictionFactory.eq("id", id)));
+ }
+ }).isEmpty();
+ }
+
+ public void saveOrUpdateDep(MyDepBean depBean) throws Exception {
+ String id = depBean.getId();
+ if (depNotExist(id)) {
+ save(depBean.createEntity());
+ } else {
+ update(depBean.createEntity());
+ }
+ }
+
+ private boolean save(final MyDepEntity entity) throws Exception {
+ return MyCoreDBAccess.getAccessor().runDMLAction(new DBAction() {
+ @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() {
+ @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() {
+ @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() {
+ @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() {
+ }
+ }
+}
diff --git a/src/main/java/com/fr/plugin/core/MyDecisionDBAccess.java b/src/main/java/com/fr/plugin/core/MyDecisionDBAccess.java
new file mode 100644
index 0000000..86e4d9f
--- /dev/null
+++ b/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;
+ }
+}
diff --git a/src/main/java/com/fr/plugin/core/MyFormulaProvider.java b/src/main/java/com/fr/plugin/core/MyFormulaProvider.java
new file mode 100644
index 0000000..c4538c3
--- /dev/null
+++ b/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 {
+ @Override
+ public void dealWithFormulaParam(MyOutputBean myOutputBean, ResultWorkBook resultWorkBook, List