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 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 getDAOClass() { + return MyAgentDao.class; + } + }, + new DAOProvider() { + public Class getEntityClass() { + return MyUserEntity.class; + } + + public Class getDAOClass() { + return MyUserDao.class; + } + }, + new DAOProvider() { + public Class getEntityClass() { + return MyDepEntity.class; + } + + public Class getDAOClass() { + return MyDepDao.class; + } + }, + new DAOProvider() { + public Class getEntityClass() { + return PushEntity.class; + } + + public Class 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 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> 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(); + } +} diff --git a/src/main/java/com/fr/plugin/core/MyHttpHander.java b/src/main/java/com/fr/plugin/core/MyHttpHander.java new file mode 100644 index 0000000..1592529 --- /dev/null +++ b/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; + } +} diff --git a/src/main/java/com/fr/plugin/core/MyLifeCycleMonitor.java b/src/main/java/com/fr/plugin/core/MyLifeCycleMonitor.java new file mode 100644 index 0000000..5f85ec5 --- /dev/null +++ b/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(); + } +} diff --git a/src/main/java/com/fr/plugin/core/MyLocalFinder.java b/src/main/java/com/fr/plugin/core/MyLocalFinder.java new file mode 100644 index 0000000..0f227c9 --- /dev/null +++ b/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"; + } +} diff --git a/src/main/java/com/fr/plugin/core/MyOutputActionHandler.java b/src/main/java/com/fr/plugin/core/MyOutputActionHandler.java new file mode 100644 index 0000000..fe51c3d --- /dev/null +++ b/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 { + + 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 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 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 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 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("¤tRes=").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 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() { + @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 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() { + @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; + } +} diff --git a/src/main/java/com/fr/plugin/core/MyRequest.java b/src/main/java/com/fr/plugin/core/MyRequest.java new file mode 100644 index 0000000..c8b40bb --- /dev/null +++ b/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 { +} diff --git a/src/main/java/com/fr/plugin/core/MySingleLoginAccessProvider.java b/src/main/java/com/fr/plugin/core/MySingleLoginAccessProvider.java new file mode 100644 index 0000000..fda183f --- /dev/null +++ b/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; + } +} diff --git a/src/main/java/com/fr/plugin/core/MyStartupThred.java b/src/main/java/com/fr/plugin/core/MyStartupThred.java new file mode 100644 index 0000000..f2d9b93 --- /dev/null +++ b/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); + } + } + +} diff --git a/src/main/java/com/fr/plugin/core/MySystemOption.java b/src/main/java/com/fr/plugin/core/MySystemOption.java new file mode 100644 index 0000000..735c241 --- /dev/null +++ b/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; + } +} diff --git a/src/main/java/com/fr/plugin/core/MyUrlAliasProvider.java b/src/main/java/com/fr/plugin/core/MyUrlAliasProvider.java new file mode 100644 index 0000000..ee21a75 --- /dev/null +++ b/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) + }; + } +} diff --git a/src/main/java/com/fr/plugin/core/MyUserSyncManager.java b/src/main/java/com/fr/plugin/core/MyUserSyncManager.java new file mode 100644 index 0000000..4974cb8 --- /dev/null +++ b/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 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 allIdsFormService=new ArrayList<>(); + while (true) { + List userByPage = WebUtils.getUserByPage(eid, readKey, page); + if (userByPage.isEmpty()) { + break; + } + for (MyUserBean myUserBean : userByPage) { + String openId = myUserBean.getOpenId(); + allIdsFormService.add(openId); + if (userNotExist(openId)) { + MyUserEntity entity = myUserBean.createEntity(); + save(entity); + } else { + MyUserEntity entity = myUserBean.createEntity(); + update(entity); + } + } + logger.error("同步用户第:{}页", page); + page++; + } + List allUserId = findAllUserId(); + allUserId.removeAll(allIdsFormService);//减去服务端的ids,得到一个 + if (!allUserId.isEmpty()) { + for (String s : allUserId) { + logger.error("删除了一个用户:{}",s); + remove(s); + } + } + } + } + + private List findAllUserId() throws Exception { + List entityList = MyCoreDBAccess.getAccessor().runQueryAction(new DBAction>() { + public List run(DAOContext content) throws Exception { + QueryCondition queryCondition = QueryFactory.create(); + return content.getDAO(MyUserDao.class).find(queryCondition); + } + }); + Listids=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>() { + public List run(DAOContext content) throws Exception { + QueryCondition queryCondition = QueryFactory.create(); + queryCondition.addRestriction(RestrictionFactory.eq("openId", openid)); + return content.getDAO(MyUserDao.class).find(queryCondition); + } + }).isEmpty(); + } + private void remove(final String openId) throws Exception { + MyCoreDBAccess.getAccessor().runDMLAction(new DBAction() { + public 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() { + 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() { + public MyUserEntity run(DAOContext content) throws Exception { + content.getDAO(MyUserDao.class).update(entity); + return null; + } + }); + } + + /** + * 通过部门长名取用户 + * + * @param depName + * @return + */ + public List getDepartmentUserList(final String depName, final int start, final int size) throws Exception { + if (StringUtils.isNotBlank(depName)) { + List entityList = MyCoreDBAccess.getAccessor().runQueryAction(new DBAction>() { + public List 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 entityList = MyCoreDBAccess.getAccessor().runQueryAction(new DBAction>() { + public List 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 getUserList(final String key, final int start, final int count) throws Exception { + List entityList = MyCoreDBAccess.getAccessor().runQueryAction(new DBAction>() { + public List run(DAOContext content) throws Exception { + QueryCondition queryCondition = QueryFactory.create(); + queryCondition.addRestriction(RestrictionFactory.or(RestrictionFactory.like("name", "%" + key + "%"), RestrictionFactory.like("phone", "%" + key + "%"))); + queryCondition.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() { + 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() { + 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() { + 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() { + 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() { + 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() { + 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() { + } + } +} diff --git a/src/main/java/com/fr/plugin/dao/MyAgentDao.java b/src/main/java/com/fr/plugin/dao/MyAgentDao.java new file mode 100644 index 0000000..0ae365a --- /dev/null +++ b/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 { + public MyAgentDao(DAOSession daoSession) { + super(daoSession); + } + + protected Class getEntityClass() { + return MyAgentEntity.class; + } +} diff --git a/src/main/java/com/fr/plugin/dao/MyDepDao.java b/src/main/java/com/fr/plugin/dao/MyDepDao.java new file mode 100644 index 0000000..c12d687 --- /dev/null +++ b/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 { + public MyDepDao(DAOSession daoSession) { + super(daoSession); + } + protected Class getEntityClass() { + return MyDepEntity.class; + } +} diff --git a/src/main/java/com/fr/plugin/dao/MyEntityDao.java b/src/main/java/com/fr/plugin/dao/MyEntityDao.java new file mode 100644 index 0000000..3d140a6 --- /dev/null +++ b/src/main/java/com/fr/plugin/dao/MyEntityDao.java @@ -0,0 +1,14 @@ +package com.fr.plugin.dao; + +import com.fr.plugin.entitys.OutputMyEntity; +import com.fr.stable.db.dao.BaseDAO; +import com.fr.stable.db.session.DAOSession; + +public class MyEntityDao extends BaseDAO { + public MyEntityDao(DAOSession daoSession) { + super(daoSession); + } + protected Class getEntityClass() { + return OutputMyEntity.class; + } +} diff --git a/src/main/java/com/fr/plugin/dao/MyUserDao.java b/src/main/java/com/fr/plugin/dao/MyUserDao.java new file mode 100644 index 0000000..22b44dc --- /dev/null +++ b/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 { + public MyUserDao(DAOSession daoSession) { + super(daoSession); + } + protected Class getEntityClass() { + return MyUserEntity.class; + } + +} diff --git a/src/main/java/com/fr/plugin/dao/PushDao.java b/src/main/java/com/fr/plugin/dao/PushDao.java new file mode 100644 index 0000000..35d57e1 --- /dev/null +++ b/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 { + public PushDao(DAOSession daoSession) { + super(daoSession); + } + + protected Class getEntityClass() { + return PushEntity.class; + } +} diff --git a/src/main/java/com/fr/plugin/entitys/MyAgentEntity.java b/src/main/java/com/fr/plugin/entitys/MyAgentEntity.java new file mode 100644 index 0000000..72b1a85 --- /dev/null +++ b/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; + } + + +} diff --git a/src/main/java/com/fr/plugin/entitys/MyDepEntity.java b/src/main/java/com/fr/plugin/entitys/MyDepEntity.java new file mode 100644 index 0000000..2ce3902 --- /dev/null +++ b/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; + } +} diff --git a/src/main/java/com/fr/plugin/entitys/MyUserEntity.java b/src/main/java/com/fr/plugin/entitys/MyUserEntity.java new file mode 100644 index 0000000..58288b1 --- /dev/null +++ b/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" +} diff --git a/src/main/java/com/fr/plugin/entitys/OutputMyEntity.java b/src/main/java/com/fr/plugin/entitys/OutputMyEntity.java new file mode 100644 index 0000000..49cd863 --- /dev/null +++ b/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; + } +} diff --git a/src/main/java/com/fr/plugin/entitys/PushEntity.java b/src/main/java/com/fr/plugin/entitys/PushEntity.java new file mode 100644 index 0000000..0bf22fb --- /dev/null +++ b/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; + } +} diff --git a/src/main/java/com/fr/plugin/utils/Filter.java b/src/main/java/com/fr/plugin/utils/Filter.java new file mode 100644 index 0000000..4588233 --- /dev/null +++ b/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; + } +} diff --git a/src/main/java/com/fr/plugin/utils/JsonUtils.java b/src/main/java/com/fr/plugin/utils/JsonUtils.java new file mode 100644 index 0000000..2586ec0 --- /dev/null +++ b/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(); + } + +} \ No newline at end of file diff --git a/src/main/java/com/fr/plugin/utils/MyAgentUtils.java b/src/main/java/com/fr/plugin/utils/MyAgentUtils.java new file mode 100644 index 0000000..aa9e900 --- /dev/null +++ b/src/main/java/com/fr/plugin/utils/MyAgentUtils.java @@ -0,0 +1,34 @@ +package com.fr.plugin.utils; + +import com.fr.plugin.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 getAgentsSortedByTimeStamp() throws Exception { + return (List) MyCoreDBAccess.getAccessor().runQueryAction(new DBAction>() { + public List run(DAOContext var1) throws Exception { + return ((MyAgentDao)var1.getDAO(MyAgentDao.class)).find(QueryFactory.create().addSort("timeStamp", true)); + } + }); + } + + + public static MyAgentEntity getAgentById(String agentId) throws Exception { + return MyCoreDBAccess.getAccessor().runQueryAction(new DBAction() { + public MyAgentEntity run(DAOContext var1) throws Exception { + return var1.getDAO(MyAgentDao.class).findOne(QueryFactory.create().addRestriction(RestrictionFactory.eq("id",agentId))); + } + }); + } +} diff --git a/src/main/java/com/fr/plugin/utils/MyUtils.java b/src/main/java/com/fr/plugin/utils/MyUtils.java new file mode 100644 index 0000000..481ed04 --- /dev/null +++ b/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>() { + public List 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() { + 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(); + } + +} diff --git a/src/main/java/com/fr/plugin/utils/PushImageBean.java b/src/main/java/com/fr/plugin/utils/PushImageBean.java new file mode 100644 index 0000000..f68846b --- /dev/null +++ b/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; + } +} + diff --git a/src/main/java/com/fr/plugin/utils/PushObject.java b/src/main/java/com/fr/plugin/utils/PushObject.java new file mode 100644 index 0000000..e27ff38 --- /dev/null +++ b/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; + } +} diff --git a/src/main/java/com/fr/plugin/utils/PushTextBean.java b/src/main/java/com/fr/plugin/utils/PushTextBean.java new file mode 100644 index 0000000..aafbdca --- /dev/null +++ b/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; + } +} \ No newline at end of file diff --git a/src/main/java/com/fr/plugin/utils/PushUtils.java b/src/main/java/com/fr/plugin/utils/PushUtils.java new file mode 100644 index 0000000..56ab3f2 --- /dev/null +++ b/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 params = new HashMap(); + 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 params = new HashMap(); + 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 params = new HashMap(); + 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(); + 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; + } + + +} diff --git a/src/main/java/com/fr/plugin/utils/SertUtils.java b/src/main/java/com/fr/plugin/utils/SertUtils.java new file mode 100644 index 0000000..a5ef039 --- /dev/null +++ b/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; + } +} diff --git a/src/main/java/com/fr/plugin/utils/SignUtils.java b/src/main/java/com/fr/plugin/utils/SignUtils.java new file mode 100644 index 0000000..9c33877 --- /dev/null +++ b/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 map, String secret) { +// TreeMap map = new TreeMap(parms); +// StringBuilder query = new StringBuilder(); +// Set 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 parms) { + StringBuilder query = new StringBuilder(); + Set 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); + } +} diff --git a/src/main/java/com/fr/plugin/utils/SyncThread.java b/src/main/java/com/fr/plugin/utils/SyncThread.java new file mode 100644 index 0000000..de20b71 --- /dev/null +++ b/src/main/java/com/fr/plugin/utils/SyncThread.java @@ -0,0 +1,108 @@ +package com.fr.plugin.utils; + +import com.fr.general.ComparatorUtils; +import com.fr.json.JSONArray; +import com.fr.json.JSONObject; +import com.fr.log.FineLoggerFactory; +import com.fr.plugin.beans.MyDepBean; +import com.fr.plugin.beans.MyUserBean; +import com.fr.plugin.config.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); + } + } + + +} diff --git a/src/main/java/com/fr/plugin/utils/WebHookUtil.java b/src/main/java/com/fr/plugin/utils/WebHookUtil.java new file mode 100644 index 0000000..6eda587 --- /dev/null +++ b/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 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 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 getHeaders(String appid,String appkey,String content,String contentType){ + Map headers = new HashMap(); + 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 getCommonParams(String appid, String access_token){ + Map params=new HashMap(); + params.put("appid", appid); + params.put("access_token", access_token); + return params; + } + +} \ No newline at end of file diff --git a/src/main/java/com/fr/plugin/utils/WebUtils.java b/src/main/java/com/fr/plugin/utils/WebUtils.java new file mode 100644 index 0000000..7ecb877 --- /dev/null +++ b/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 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 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 parms = new HashMap(); + parms.put("eid", eid); + parms.put("secret", secret); + parms.put("scope", "resGroupSecret"); + + return getAccessToken(parms); + } + + public static LoginUserModel getUserInfo(String appid, String acc, String tick) throws Exception { + String 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 parms = new HashMap(); + parms.put("appId", appId); + parms.put("secret", secret); + parms.put("scope", "app"); + + return getAccessToken(parms); + } + + public static String getAccessToken(Map parms) { + String 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 getUserByPage(String eid, String sect, int page) { + String url = "https://www.yunzhijia.com/gateway/openimport/open/person/getall?accessToken=" + getSyncDepOrUserAccessToken(eid, sect); + Map params = new HashMap<>(); + params.put("nonce", RandomStringUtils.randomAlphabetic(8)); + params.put("eid", eid); + JSONObject object = new JSONObject(); + object.put("begin", page * 1000); + object.put("count", 1000); + params.put("data", object.toString()); + String post = post(url, params); + JSONObject json = new JSONObject(post); + List list = new ArrayList<>(); + if (json.getBoolean("success")) { + JSONArray deps = json.getJSONArray("data"); + for (int i = 0; i < deps.size(); i++) { + JSONObject userJson = deps.getJSONObject(i); + /* + * 人员 + "openId":String, //人员的openid + "name":String, //姓名 + "photoUrl":String, //头像URL + "phone":String, //手机号码 + "isHidePhone":String, //是否在通讯录中隐藏手机号码,0: 不隐藏; 1: 隐藏,默认为0 + "email":String, //邮箱 + "department":String, //组织长名称 + "jobNo":String, //企业工号 + "jobTitle":String, //职位 + "gender":int, //性别,0: 不确定; 1: 男; 2: 女 + "status":int, //状态 0: 注销,1: 正常,2: 禁用 + "orgUserType":int //是否部门负责人 0:否, 1:是 + */ + String id = userJson.getString("openId"); + String photoUrl = userJson.getString("photoUrl"); + String name = userJson.getString("name"); + String jobNo = userJson.getString("jobNo"); + String phone = userJson.getString("phone"); + String depName = userJson.getString("department"); + int status = userJson.getInt("status"); + MyUserBean entity = new MyUserBean(); + entity.setPhone(phone); + entity.setPhotoUrl(photoUrl); + entity.setStatus(status); + entity.setOpenId(id); + entity.setName(name); + entity.setDepartment(depName); + entity.setJobNo(jobNo); + list.add(entity); + } + } else { + FRContext.getLogger().info("同步用户失败,响应:" + post); + } + return list; + } + + /** + * sect 组织人员通讯录读取密钥 + * + * @param eid + * @param sect + */ + public static List getAllDep(String eid, String sect) { + String url = "https://www.yunzhijia.com/gateway/openimport/open/dept/getall?accessToken=" + getSyncDepOrUserAccessToken(eid, sect); + Map params = new HashMap<>(); + params.put("nonce", RandomStringUtils.randomAlphabetic(8)); + params.put("eid", eid); + String post = post(url, params); + JSONObject json = new JSONObject(post); + List list = new ArrayList<>(); + if (json.getBoolean("success")) { + JSONArray deps = json.getJSONArray("data"); + for (int i = 0; i < deps.size(); i++) { + JSONObject depJson = deps.getJSONObject(i); + /** + * { //组织列表 + * "id":String, //组织的id + * "parentId":String, //组织父Id + * "name":String, //组织名称 + * "department":String, //组织长名称 + * "weights":int //排序码 + * } + */ + String id = depJson.getString("id"); + String pid = depJson.getString("parentId"); + String name = depJson.getString("name"); + String depName = depJson.getString("department"); + int order = depJson.getInt("weights"); + MyDepBean depBean = new MyDepBean(); + depBean.setDepName(depName); + depBean.setId(id); + depBean.setOrder(order); + depBean.setParentId(pid); + depBean.setName(name); + list.add(depBean); + } + } else { + FRContext.getLogger().info("同步部门失败,响应:" + post); + } + return list; + } + + public static JSONArray getUserLastSyn(int begin ,String lastSyncUserTime) { + 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 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 params = new HashMap<>(); + params.put("eid", eid); + params.put("time", lastSyncUserTime); + String post = post(url, params); + FineLoggerFactory.getLogger().info("同步的部门数据:{}",post); + JSONObject json = new JSONObject(post); + if (json.getBoolean("success")) { + JSONArray users = json.getJSONArray("data"); + return users; + } + return JSONArray.create(); + } + +} diff --git a/src/main/java/com/fr/plugin/web/hander/DelAgentHander.java b/src/main/java/com/fr/plugin/web/hander/DelAgentHander.java new file mode 100644 index 0000000..b4b3876 --- /dev/null +++ b/src/main/java/com/fr/plugin/web/hander/DelAgentHander.java @@ -0,0 +1,46 @@ +package com.fr.plugin.web.hander; + +import com.fr.decision.fun.impl.BaseHttpHandler; +import com.fr.json.JSONObject; +import com.fr.plugin.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>() { + public List run(DAOContext var1) throws Exception { + var1.getDAO(MyAgentDao.class).remove(var3); + return null; + } + }); + JSONObject var4 = MyUtils.createSuccessResponseJSONObject(); + WebUtils.flushSuccessMessageAutoClose(httpServletRequest, httpServletResponse, var4); + } +} diff --git a/src/main/java/com/fr/plugin/web/hander/GetAgentHandler.java b/src/main/java/com/fr/plugin/web/hander/GetAgentHandler.java new file mode 100644 index 0000000..e102f14 --- /dev/null +++ b/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); + } +} diff --git a/src/main/java/com/fr/plugin/web/hander/GetConfigHandler.java b/src/main/java/com/fr/plugin/web/hander/GetConfigHandler.java new file mode 100644 index 0000000..111e5b5 --- /dev/null +++ b/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); + } +} diff --git a/src/main/java/com/fr/plugin/web/hander/LoginUserModel.java b/src/main/java/com/fr/plugin/web/hander/LoginUserModel.java new file mode 100644 index 0000000..b8dcbf2 --- /dev/null +++ b/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; + } +} diff --git a/src/main/java/com/fr/plugin/web/hander/MyCheckLicenseHandler.java b/src/main/java/com/fr/plugin/web/hander/MyCheckLicenseHandler.java new file mode 100644 index 0000000..9c66e86 --- /dev/null +++ b/src/main/java/com/fr/plugin/web/hander/MyCheckLicenseHandler.java @@ -0,0 +1,38 @@ +package com.fr.plugin.web.hander; + +import com.fr.decision.fun.impl.BaseHttpHandler; +import com.fr.json.JSONObject; +import com.fr.plugin.PluginLicense; +import com.fr.plugin.PluginLicenseManager; +import com.fr.plugin.utils.MyUtils; +import com.fr.third.springframework.web.bind.annotation.RequestMethod; +import com.fr.web.utils.WebUtils; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +public class MyCheckLicenseHandler extends BaseHttpHandler { + @Override + public RequestMethod getMethod() { + return null; + } + + @Override + public String getPath() { + return "/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); + } +} diff --git a/src/main/java/com/fr/plugin/web/hander/PCLoginHandler.java b/src/main/java/com/fr/plugin/web/hander/PCLoginHandler.java new file mode 100644 index 0000000..2c09972 --- /dev/null +++ b/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); + } +} diff --git a/src/main/java/com/fr/plugin/web/hander/SaveAgentHandler.java b/src/main/java/com/fr/plugin/web/hander/SaveAgentHandler.java new file mode 100644 index 0000000..fc18e05 --- /dev/null +++ b/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 agent_lists = MyCoreDBAccess.getAccessor().runQueryAction(new DBAction>() { + public List run(DAOContext content) throws Exception { + return content.getDAO(MyAgentDao.class) .find(QueryFactory.create()); + } + }); + Iterator var13 = agent_lists.iterator(); + 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() { + 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); + } +} diff --git a/src/main/java/com/fr/plugin/web/hander/SaveConfigHandler.java b/src/main/java/com/fr/plugin/web/hander/SaveConfigHandler.java new file mode 100644 index 0000000..6491b6c --- /dev/null +++ b/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); + } +} diff --git a/src/main/java/com/fr/plugin/web/hander/ScanLoginHandler.java b/src/main/java/com/fr/plugin/web/hander/ScanLoginHandler.java new file mode 100644 index 0000000..3175fbb --- /dev/null +++ b/src/main/java/com/fr/plugin/web/hander/ScanLoginHandler.java @@ -0,0 +1,100 @@ +package com.fr.plugin.web.hander; + +import com.fr.base.ServerConfig; +import com.fr.decision.authority.data.User; +import com.fr.decision.fun.impl.BaseHttpHandler; +import com.fr.decision.webservice.v10.login.LoginService; +import com.fr.json.JSONObject; +import com.fr.plugin.beans.MyUserBean; +import com.fr.plugin.config.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); + } +} diff --git a/src/main/java/com/fr/plugin/web/hander/SingleLoginHandler.java b/src/main/java/com/fr/plugin/web/hander/SingleLoginHandler.java new file mode 100644 index 0000000..06ce743 --- /dev/null +++ b/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; + } +} diff --git a/src/main/java/com/fr/plugin/web/hander/member/GetDepTree.java b/src/main/java/com/fr/plugin/web/hander/member/GetDepTree.java new file mode 100644 index 0000000..848ef35 --- /dev/null +++ b/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); + } +} + diff --git a/src/main/java/com/fr/plugin/web/hander/member/GetImageHandler.java b/src/main/java/com/fr/plugin/web/hander/member/GetImageHandler.java new file mode 100644 index 0000000..963ffb6 --- /dev/null +++ b/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, "文件未找到"); + } + +} diff --git a/src/main/java/com/fr/plugin/web/hander/member/GetMatch.java b/src/main/java/com/fr/plugin/web/hander/member/GetMatch.java new file mode 100644 index 0000000..650853b --- /dev/null +++ b/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); + } +} + diff --git a/src/main/java/com/fr/plugin/web/hander/member/GetMemberHandler.java b/src/main/java/com/fr/plugin/web/hander/member/GetMemberHandler.java new file mode 100644 index 0000000..d5e4663 --- /dev/null +++ b/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 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 getSelectedDepartmentUser(MyDepBean bean, int start, int count) throws Exception { + return MyUserSyncManager.getInstance().getDepartmentUserList(bean.getDepName(), start, count); + + } + + private List getSelectedUser(String key, int start, int count) throws Exception { + return MyUserSyncManager.getInstance().getUserList(key, start, count); + } + + private Long countSelectedUser(String key) throws Exception { + return MyUserSyncManager.getInstance().countUserList(key); + } + + public static JSONObject toUserResultJo(List users, Long var1) throws Exception { + JSONObject var2 = JSONObject.create(); + JSONArray var3 = JSONArray.create(); + + JSONObject var6; + for (Iterator var4 = users.iterator(); var4.hasNext(); var3.put(var6)) { + MyUserBean var5 = (MyUserBean) var4.next(); + var6 = var5.createJSONConfig(); + } + + var2.put("total", var1); + var2.put("users", var3); + return var2; + } +} diff --git a/src/main/java/com/fr/plugin/web/hander/member/LanlingLogin.java b/src/main/java/com/fr/plugin/web/hander/member/LanlingLogin.java new file mode 100644 index 0000000..e34f41b --- /dev/null +++ b/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); + } + } +} + diff --git a/src/main/java/com/fr/plugin/web/hander/member/SaveMatch.java b/src/main/java/com/fr/plugin/web/hander/member/SaveMatch.java new file mode 100644 index 0000000..71f0b8b --- /dev/null +++ b/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); + } +} + diff --git a/src/main/java/com/fr/plugin/web/hander/member/SaveRelation.java b/src/main/java/com/fr/plugin/web/hander/member/SaveRelation.java new file mode 100644 index 0000000..ed7c817 --- /dev/null +++ b/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() { + 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() { + 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); + } +} + diff --git a/src/main/java/com/fr/plugin/web/hander/member/SycHookHander.java b/src/main/java/com/fr/plugin/web/hander/member/SycHookHander.java new file mode 100644 index 0000000..737961f --- /dev/null +++ b/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 names = httpServletRequest.getHeaderNames(); + Map 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 paramsMap = new TreeMap(); + 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 map) { + StringBuilder sb = new StringBuilder(); + Set 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(); + } + } +} diff --git a/src/main/java/com/fr/plugin/web/hander/member/SynUserHander.java b/src/main/java/com/fr/plugin/web/hander/member/SynUserHander.java new file mode 100644 index 0000000..6bbebe0 --- /dev/null +++ b/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); + } +} \ No newline at end of file diff --git a/src/main/java/com/fr/plugin/web/hander/pushBeanHandler.java b/src/main/java/com/fr/plugin/web/hander/pushBeanHandler.java new file mode 100644 index 0000000..c944073 --- /dev/null +++ b/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() { + @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, "未找到这个推送"); + } +} diff --git a/src/main/resources/com/fr/plugin/core/local/i18.properties b/src/main/resources/com/fr/plugin/core/local/i18.properties new file mode 100644 index 0000000..1c75541 --- /dev/null +++ b/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 diff --git a/src/main/resources/com/fr/plugin/core/local/i18_en_US.properties b/src/main/resources/com/fr/plugin/core/local/i18_en_US.properties new file mode 100644 index 0000000..da43c89 --- /dev/null +++ b/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 diff --git a/src/main/resources/com/fr/plugin/core/local/i18_zh_CN.properties b/src/main/resources/com/fr/plugin/core/local/i18_zh_CN.properties new file mode 100644 index 0000000..7b3802a --- /dev/null +++ b/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 diff --git a/src/main/resources/com/fr/plugin/web/LoginRequire.html b/src/main/resources/com/fr/plugin/web/LoginRequire.html new file mode 100644 index 0000000..317912e --- /dev/null +++ b/src/main/resources/com/fr/plugin/web/LoginRequire.html @@ -0,0 +1,32 @@ + + + + + + + + + + + +
+ + + + +
+ + + \ No newline at end of file diff --git a/src/main/resources/com/fr/plugin/web/css/cloud_home.css b/src/main/resources/com/fr/plugin/web/css/cloud_home.css new file mode 100644 index 0000000..e69de29 diff --git a/src/main/resources/com/fr/plugin/web/css/login.css b/src/main/resources/com/fr/plugin/web/css/login.css new file mode 100644 index 0000000..3437c09 --- /dev/null +++ b/src/main/resources/com/fr/plugin/web/css/login.css @@ -0,0 +1,19 @@ +/* 二维码外框大小 */ +.wrp_code{ + width: 100px; + height: 100px; +} +/*二维码图片大小*/ +.impowerBox .qrcode{ + width: 100px; +} +/*背景颜色*/ +body{ + background-color: white !important; +} +.title{ + display: none; +} +.info{ + display: none; +} \ No newline at end of file diff --git a/src/main/resources/com/fr/plugin/web/images/1x/icon/debugger.png b/src/main/resources/com/fr/plugin/web/images/1x/icon/debugger.png new file mode 100644 index 0000000..054e32b Binary files /dev/null and b/src/main/resources/com/fr/plugin/web/images/1x/icon/debugger.png differ diff --git a/src/main/resources/com/fr/plugin/web/images/1x/icon/icon_fail.png b/src/main/resources/com/fr/plugin/web/images/1x/icon/icon_fail.png new file mode 100644 index 0000000..69699d9 Binary files /dev/null and b/src/main/resources/com/fr/plugin/web/images/1x/icon/icon_fail.png differ diff --git a/src/main/resources/com/fr/plugin/web/images/1x/icon/icon_success.png b/src/main/resources/com/fr/plugin/web/images/1x/icon/icon_success.png new file mode 100644 index 0000000..3a92586 Binary files /dev/null and b/src/main/resources/com/fr/plugin/web/images/1x/icon/icon_success.png differ diff --git a/src/main/resources/com/fr/plugin/web/images/1x/icon/loading.gif b/src/main/resources/com/fr/plugin/web/images/1x/icon/loading.gif new file mode 100644 index 0000000..8b9c4f1 Binary files /dev/null and b/src/main/resources/com/fr/plugin/web/images/1x/icon/loading.gif differ diff --git a/src/main/resources/com/fr/plugin/web/images/2x/icon/debugger.png b/src/main/resources/com/fr/plugin/web/images/2x/icon/debugger.png new file mode 100644 index 0000000..b299862 Binary files /dev/null and b/src/main/resources/com/fr/plugin/web/images/2x/icon/debugger.png differ diff --git a/src/main/resources/com/fr/plugin/web/images/2x/icon/icon_fail.png b/src/main/resources/com/fr/plugin/web/images/2x/icon/icon_fail.png new file mode 100644 index 0000000..7309922 Binary files /dev/null and b/src/main/resources/com/fr/plugin/web/images/2x/icon/icon_fail.png differ diff --git a/src/main/resources/com/fr/plugin/web/images/2x/icon/icon_success.png b/src/main/resources/com/fr/plugin/web/images/2x/icon/icon_success.png new file mode 100644 index 0000000..96d5485 Binary files /dev/null and b/src/main/resources/com/fr/plugin/web/images/2x/icon/icon_success.png differ diff --git a/src/main/resources/com/fr/plugin/web/images/2x/icon/loading.gif b/src/main/resources/com/fr/plugin/web/images/2x/icon/loading.gif new file mode 100644 index 0000000..5d81040 Binary files /dev/null and b/src/main/resources/com/fr/plugin/web/images/2x/icon/loading.gif differ diff --git a/src/main/resources/com/fr/plugin/web/js/login.js b/src/main/resources/com/fr/plugin/web/js/login.js new file mode 100644 index 0000000..a7a08e1 --- /dev/null +++ b/src/main/resources/com/fr/plugin/web/js/login.js @@ -0,0 +1,3518 @@ +/** fine-decision-webui 19-04-10 02:20:33 */ +window.Dec || (window.Dec = {}, Dec.injection = {}), window.DecCst || (window.DecCst = {}), Dec.resourceURL = Dec.fineServletURL + "/resources?path=/com/fr/web/resources/dist/", Dec.system = Dec.system || {}, Dec.personal = Dec.personal || {}, Dec.personal.homepage = Dec.personal.homepage || {}, BI.StartOfWeek = Dec.system.weekBegins, BI.specialCharsMap = DecCst.EncodeSpecialChar ? DecCst.EncodeSpecialChar.CHARSET : {}, Dec.Utils = Dec.Utils || {}, BI.extend(Dec.Utils, { + transformObject2URLParam: function (e, t, i) { + if (null == e) return ""; + var o = "", + n = typeof e; + if ("string" == n || "number" == n || "boolean" == n) o += "&" + t + "=" + encodeURIComponent(e); + else + for (var s in e) { + var r = null == t ? s : t + (e instanceof Array ? "[" + s + "]" : "." + s); + o += "&" + this.transformObject2URLParam(e[s], r, !0) + } + return o.substr(1) + }, + buildTokenStr: function (e) { + return -1 < BI.indexOf(e, "?") ? e + "&" + DecCst.Cookie.URL_TOKEN + "=" + BI.Cache.getCookie(DecCst.Cookie.TOKEN) : e + "?" + DecCst.Cookie.URL_TOKEN + "=" + BI.Cache.getCookie(DecCst.Cookie.TOKEN) + }, + getEncodeURL: function (e, i) { + return e.replaceAll("\\{(.*?)\\}", function (e, t) { + return BI.encodeURIComponent(BI.isObject(i) ? i[t] : i) + }) + }, + getUrlQuery: function (e) { + var t = new RegExp("(^|&)" + e + "=([^&]*)(&|$)"), + i = window.location.search.substr(1).match(t); + return null !== i ? i[2] : "" + }, + isPhoneNumber: function (e) { + return /^1\d{10}$/.test(e) + }, + isMailAddress: function (e) { + return /^([a-zA-Z0-9._-])+@([a-zA-Z0-9_-])+(\.[a-zA-Z0-9_-])+/.test(e) + }, + addAuthParam: function (e) { + var t = e.split("?"); + return t[0] + "?" + (t[1] || "") + }, + checkHashAuthority: function (e) { + var i = e.split("/"), + o = BI.find(BI.Constants.getConstant("dec.constant.management.navigation"), function (e, t) { + return t.value === i[1] + }); + return !!o && !!BI.some(Dec.decisionModules, function (e, t) { + return t.id === o.id + }) + }, + buildResourceURI: function (e) { + return Dec.fineServletURL + "/resources?path=" + e + }, + appendQuery: function (e, t) { + var i = e.split("?"), + o = i[0], + n = i[1] || ""; + return "" !== n && (n.endWith("&") || (n += "&")), "string" == typeof t ? (t.startWith("&") && (n = t.substr(1)), n += t) : (BI.each(t, function (e, t) { + "string" == typeof e && (n += e + "=" + t + "&") + }), n = n.substr(0, n.length - 1)), o + "?" + n + }, + getDynamicDateValue: function (e) { + if (e.type === BI.DynamicDateCombo.Dynamic) return BI.DynamicDateHelper.getCalculation(e.value).print("%Y-%X-%d"); + var t = e.type === BI.DynamicDateCombo.Static ? e.value : e; + return BI.getDate(t.year, t.month - 1, t.day).print("%Y-%X-%d") + }, + strLength: function (e) { + return BI.isNull(e) ? 0 : (BI.isString(e) || (e += ""), e.replace(/[^-ÿ]/g, "01").length) + }, + parseVals2Array: function (e) { + var i = this, + o = []; + return BI.each(e, function (e, t) { + BI.isEmpty(t) ? o.push(e) : o = o.concat(i.parseVals2Array(t)) + }), o + }, + encodeParam: function (e) { + for (var t in e) _.isObject(e[t]) ? e[t] = window.encodeURIComponent(BI.jsonEncode(e[t])) : e[t] = window.encodeURIComponent(e[t]); + return e + }, + exportFileByForm: function (e, t, i) { + i = i || {}, e = Dec.fineServletURL + e; + var o = { + method: i.method || "POST", + url: e, + data: t, + target: i.target + }, + n = $('
'); + for (var s in n.attr("action", o.url), n.attr("method", o.method || "post"), n.attr("target", o.target || "_self"), !0 === i.notEncode || (o.data = this.encodeParam(o.data)), o.data) n.append(''); + $(document.body).append(n), n[0].submit(), n.destroy() + }, + randomStr: function (e) { + for (var t = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"], i = "", o = 0; o < e; o++) i += t[parseInt(t.length * Math.random(), 10)]; + return i + }, + checkValidName: function (e) { + return /^[A-Za-z0-9_\.⺀-⿟぀-㆏ㆠ-ㆿㇰ-ㇿ㐀-䶵一-鿿ꥠ-꥿가-퟿]+$/.test(e) + }, + checkValidURL: function (e) { + return /^((?!@).)*$/.test(e) + }, + checkValidCharacter: function (e) { + return /^[A-Za-z0-9_\.\(\)\[\]\{\}\()⺀-⿟぀-㆏ㆠ-ㆿㇰ-ㇿ㐀-䶵一-鿿ꥠ-꥿가-퟿]+$/.test(e) + }, + checkValidPort: function (e) { + return /^([0-9]|[1-9]\d|[1-9]\d{2}|[1-9]\d{3}|[1-5]\d{4}|6[0-4]\d{3}|65[0-4]\d{2}|655[0-2]\d|6553[0-5])$/.test(e) + }, + checkValidMacAddress: function (e) { + return /^[A-F0-9]{2}(-[A-F0-9]{2}){5}$|^[A-F0-9]{2}(:[A-F0-9]{2}){5}$/.test(e) + }, + distinguishTemplateType: function (i) { + var o = ""; + return BI.each(["cpt", "frm"], function (e, t) { + new RegExp("\\." + t).test(i) && (o = t) + }), o + }, + isFullScreen: function () { + return document.fullscreen || document.webkitIsFullScreen || document.mozFullScreen || !1 + }, + buildImgUrlByAttachId: function (e) { + return Dec.fineServletURL + "/v10/attach/image/" + e + }, + checkDirectoryEditAuth: function (e) { + return !!BI.isNull(e) || BI.some(e, function (e, t) { + return 3 === t.privilegeType && 2 === t.privilegeValue + }) + }, + initSinglePage: function (e) { + var t = 0, + i = function () { + 0 === t && e() + }; + BI.isUndefined(Dec.decisionModules) && (t++, Dec.Utils.getDecisionModules(function (e) { + Dec.decisionModules = e.data, t--, i() + })), i() + }, + recursionHtmlDecode: function (e) { + !function o(i) { + BI.each(i, function (e, t) { + BI.isString(t) ? i[e] = BI.htmlDecode(t) : o(t) + }) + }(e) + } +}), BI.extend(Dec.Utils, { + getIconByTableType: function (e) { + switch (e) { + case DecCst.Table.ANALYSIS: + return "analysis-table-font"; + case DecCst.Table.DATABASE: + return "database-table-font"; + case DecCst.Table.EXCEL: + return "excel-table-font"; + case DecCst.Table.SQL: + return "sql-table-font"; + default: + return "database-table-font" + } + }, + getTextByFieldType: function (e) { + switch (e) { + case BICst.COLUMN.STRING: + return BI.i18nText("Dec-Basic_Text"); + case BICst.COLUMN.NUMBER: + return BI.i18nText("Dec-Basic_Number"); + case BICst.COLUMN.DATE: + return BI.i18nText("Dec-Basic_Date"); + default: + return "" + } + } +}), DecCst = DecCst || {}, DecCst.Login = DecCst.Login || {}, DecCst.Login.Tabs = {}, DecCst.Login.Tabs.LOGIN = "login", DecCst.Login.Tabs.FORGET_PASSWORD = "forget", DecCst.Login.Tabs.AUTHENTICATION = "authentication", + DecCst.Login.Tabs.PASSWORD_TOKEN = "password", + DecCst.Login.Tabs.QR_LOGIN = "qr_login", + DecCst.Login.Tabs.PASSWORD_OLD = "single", DecCst.Login.Tabs.SUCCESS_PWD = "password.success", DecCst.Login.Tabs.SUCCESS_TOKEN = "password.token", DecCst.Login.Tabs.VERIFY_BING = "verify", DecCst.Login.Tabs.LOCKED = "locked", DecCst.Login.AuthenticationWay = {}, DecCst.Login.AuthenticationWay.PHOME = "mobile", DecCst.Login.AuthenticationWay.EMAIL = "email", DecCst.Login.AuthenticationModule = {}, DecCst.Login.AuthenticationModule.PWD_UPDATE = "update", DecCst.Login.AuthenticationModule.PWD_STRENGTH = "strength", DecCst.Login.AuthenticationModule.LOGIN = "login", DecCst.Login.AuthenticationModule.SINGLE = "single", + function () { + var e = BI.inherit(BI.Widget, { + props: { + baseCls: "dec-login" + }, + _store: function () { + return BI.Models.getModel("dec.model.login") + }, + watch: {}, + render: function () { + var t = this, + e = this.model.loginConfig; + return { + type: "bi.center_adapt", + cls: "dec-login-background", + items: [{ + type: "bi.htape", + cls: "login-card", + width: 720, + height: 380, + items: [{ + type: "bi.absolute", + $testId: "dec-login-img-background", + cls: "dec-login-img-background", + items: [{ + el: { + type: "bi.horizontal_auto", + cls: "dec-login-left-color", + items: [{ + el: { + type: "bi.center_adapt", + items: [{ + type: "bi.img", + src: BI.isEmpty(e.loginLogoImgId) ? Dec.resourceURL + "resources/logo.png" : Dec.fineServletURL + "/login/image/" + e.loginLogoImgId, + height: 50, + width: "auto" + }] + }, + tgap: 140, + bgap: 30 + }, { + type: "bi.label", + text: e.loginTitle || BI.i18nText("Dec-Decision") + }] + }, + top: 0, + right: 0, + bottom: 0, + left: 0 + }], + ref: function (e) { + t.loginLeft = e + } + }, { + type: "dec.login.index", + width: 290 + }] + }] + } + }, + mounted: function () { + var e = this.model.loginConfig; + e.loginImg && this.loginLeft.element.css("backgroundImage", "url(" + Dec.fineServletURL + "/login/image/" + e.loginImgId + ")") + } + }); + BI.shortcut("dec.login", e) + }(), + function () { + var e = BI.inherit(Fix.Model, { + _init: function () { + this.loginConfigInfo = Dec.loginConfig || {} + }, + state: function () { + return {} + }, + computed: { + loginConfig: function () { + return this.loginConfigInfo + } + }, + actions: {} + }); + BI.model("dec.model.login", e) + }(); +var Service = BI.inherit(BI.OB, { + addLoginInfo: function (e, t) { + Dec.Utils.addLastLoginInfo({ + time: BI.print(BI.getDate(), "%Y-%X-%d %H:%M:%S"), + ip: e.ip || "", + city: e.provincecity || "" + }, t) + }, + useTokenLoginValue: function (e, t, i) { + Dec.Utils.loginTokenLogin({ + token: e, + origin: Dec.Utils.getUrlQuery("origin"), + validity: t + }, i) + } +}); +BI.service("dec.service.login", Service), Dec.start = function () { + BI.createWidget({ + type: "dec.login", + element: "#wrapper" + }) +}, BI.constant("dec.constant.login.authentication.way", [{ + value: DecCst.Login.AuthenticationWay.PHOME, + text: BI.i18nText("Dec-User_Mobile"), + iconCls: "login-mobile-font" +}, { + value: DecCst.Login.AuthenticationWay.EMAIL, + text: BI.i18nText("Dec-User_Email"), + iconCls: "login-email-font" +}]), + function () { + var e = BI.inherit(BI.Widget, { + props: { + baseCls: "dec-login-item", + iconCls: "", + watermark: "", + inputType: "text", + value: "" + }, + render: function () { + var t = this, + e = this.options; + return { + type: "bi.vertical", + items: [{ + type: "bi.htape", + height: 36, + items: [{ + type: "bi.vertical_adapt", + cls: "item-icon " + e.iconCls, + invisible: "" === e.iconCls, + width: "" === e.iconCls ? 0 : 26, + items: [{ + type: "bi.center_adapt", + items: [{ + type: "bi.icon" + }] + }] + }, { + type: "bi.absolute", + items: [{ + el: { + type: "bi.input", + element: "", + allowBlank: !0, + value: e.value, + ref: function (e) { + t.editor = e + }, + listeners: [{ + eventName: BI.Input.EVENT_FOCUS, + action: function () { + t.hideError() + } + }, { + eventName: BI.Input.EVENT_BLUR, + action: function () { + t.fireEvent("EVENT_BLUR") + } + }] + }, + top: 0, + right: 0, + bottom: 0, + left: 0 + }] + }] + }, { + type: "bi.label", + cls: "bi-border-top", + text: "", + height: 24, + ref: function (e) { + t.lineRow = e + } + }, { + type: "bi.label", + invisible: !0, + height: 24, + textAlign: "left", + cls: "bi-border-top error", + ref: function (e) { + t.errorRow = e + } + }] + } + }, + showError: function (e) { + this.errorRow.visible(), this.errorRow.setText(e), this.lineRow.invisible() + }, + hideError: function () { + this.errorRow.invisible(), this.errorRow.setText(""), this.lineRow.visible() + }, + getValue: function () { + return this.editor.getValue() + } + }); + BI.shortcut("dec.login.input.item", e) + }(), + function () { + var e = BI.inherit(BI.Widget, { + props: { + baseCls: "dec-login-item", + errorText: "", + iconCls: "", + watermark: "", + inputType: "text", + value: "", + allowBlank: !0, + validationChecker: BI.emptyFn + }, + render: function () { + var t = this, + e = this.options; + return { + type: "bi.vertical", + items: [{ + type: "bi.htape", + height: 36, + items: [{ + type: "bi.center_adapt", + cls: "item-icon " + e.iconCls, + invisible: "" === e.iconCls, + width: "" === e.iconCls ? 0 : 16, + items: [{ + type: "bi.icon" + }] + }, { + el: { + type: "bi.editor", + $value: ("" === e.iconCls ? "dec-login-item" : e.iconCls) + "-editor", + inputType: e.inputType, + watermark: e.watermark, + validationChecker: e.validationChecker, + allowBlank: e.allowBlank, + value: e.value, + ref: function (e) { + t.editor = e + }, + listeners: [{ + eventName: BI.Editor.EVENT_FOCUS, + action: function () { + t.hideError(), t.fireEvent("EVENT_FOCUS") + } + }, { + eventName: BI.Editor.EVENT_CHANGE, + action: function () { + t.hideError(), t.fireEvent("EVENT_CHANGE") + } + }, { + eventName: BI.Editor.EVENT_BLUR, + action: function () { + t.fireEvent("EVENT_BLUR") + } + }] + }, + lgap: 8 + }] + }, { + type: "bi.label", + cls: "bi-border-top", + text: "", + height: 24, + ref: function (e) { + t.lineRow = e + } + }, { + type: "bi.label", + $testId: ("" === e.iconCls ? "dec-login-item" : e.iconCls) + "-error", + invisible: !0, + text: e.errorText, + height: 24, + textAlign: "left", + cls: "bi-border-top error", + ref: function (e) { + t.errorRow = e + } + }] + } + }, + showError: function (e) { + this.showErrorText(e) + }, + showErrorText: function (e) { + this.errorRow.visible(), this.errorRow.setText(e), this.lineRow.invisible() + }, + hideError: function () { + this.errorRow.invisible(), this.errorRow.setText(""), this.lineRow.visible() + }, + getValue: function () { + return this.editor.getValue() + } + }); + BI.shortcut("dec.login.item", e) + }(), + function () { + var e = BI.inherit(BI.Widget, { + props: { + baseCls: "dec-login-index" + }, + _store: function () { + return BI.Models.getModel("dec.model.login.index") + }, + watch: { + selectedTab: function (e) { + this.tab.setSelect(e) + } + }, + render: function () { + var t = this; + return { + type: "bi.tab", + cls: "bi-card", + single: !0, + cardCreator: BI.bind(this._createCard, this), + showIndex: this.model.selectedTab, + ref: function (e) { + t.tab = e + } + } + }, + mounted: function () { + this.store.initData() + }, + _createCard: function (e) { + var t = this; + switch (e) { + case DecCst.Login.Tabs.LOGIN: + return { + type: "dec.login.login", + listeners: [{ + eventName: "EVENT_LOGIN", + action: function (e) { + t.store.login(e) + } + }] + }; + case DecCst.Login.Tabs.FORGET_PASSWORD: + return { + type: "dec.login.forget" + }; + case DecCst.Login.Tabs.AUTHENTICATION: + return { + type: "dec.login.authentication", + listeners: [{ + eventName: "EVENT_LOGIN", + action: function (e) { + t.store.login(e) + } + }] + }; + case DecCst.Login.Tabs.PASSWORD_TOKEN: + return { + type: "dec.login.password", + listeners: [{ + eventName: "EVENT_SAVE", + action: function (e) { + t.store.toSuccess(e) + } + }] + }; + case DecCst.Login.Tabs.QR_LOGIN: + return { + type: "dec.login.QR" + }; + case DecCst.Login.Tabs.SUCCESS_PWD: + return { + type: "dec.login.password.success", + username: this.model.loginInfo.username, + pwd: this.model.userInfo.pwd, + loginValidity: this.model.loginInfo.validity, + listeners: [{ + eventName: "EVENT_LOGIN", + action: function (e) { + t.store.login(e) + } + }] + }; + case DecCst.Login.Tabs.SUCCESS_TOKEN: + return { + type: "dec.login.password.token", + listeners: [{ + eventName: "EVENT_LOGIN", + action: function (e) { + t.store.login(e) + } + }] + }; + case DecCst.Login.Tabs.PASSWORD_OLD: + return { + type: "dec.login.single", + username: this.model.loginInfo.username, + listeners: [{ + eventName: "EVENT_BACK", + action: function () { + t.store.setTab(DecCst.Login.Tabs.LOGIN) + } + }, { + eventName: "EVENT_SURE", + action: function (e) { + t.store.toSuccess(e) + } + }] + }; + case DecCst.Login.Tabs.VERIFY_BING: + return { + type: "dec.login.verify" + }; + case DecCst.Login.Tabs.LOCKED: + return { + type: "dec.login.locked" + }; + default: + return { + type: "bi.layout" + } + } + } + }); + BI.shortcut("dec.login.index", e) + }(), + function () { + var e = BI.inherit(Fix.Model, { + childContext: ["selectedTab", "verifyConfig", "loginInfo", "propsInfo", "sliderToken"], + state: function () { + return { + token: "", + selectedTab: DecCst.Login.Tabs.LOGIN, + loginInfo: {}, + verifyConfig: {}, + propsInfo: {}, + userInfo: {}, + ipInfo: {}, + sliderToken: "" + } + }, + computed: {}, + actions: { + initData: function () { + var t = this; + BI.Cache.deleteCookie(DecCst.Cookie.LAST_LOGIN_INFO, DecCst.Cookie.PATH), Dec.Utils.getIPInfo(function (e) { + t.model.ipInfo = e + }) + }, + setTab: function (e) { + this.model.selectedTab = e + }, + setUserInfo: function (e) { + this.model.userInfo = e + }, + toSuccess: function (e) { + this.setUserInfo({ + pwd: e + }), this.setTab(DecCst.Login.Tabs.SUCCESS_PWD) + }, + login: function (e) { + this.setUserInfo({}); + var t = -2 === e.validity ? 24 * DecCst.Cookie.REMEMBER_DAY : -1; + BI.Cache.addCookie(DecCst.Cookie.TOKEN, e.accessToken, DecCst.Cookie.PATH, t), BI.Services.getService("dec.service.login").addLoginInfo(this.model.ipInfo, function () { + window.location.href = e.url + }) + } + } + }); + BI.model("dec.model.login.index", e) + }(), + function () { + var i = 0, + o = 1, + n = 2, + e = BI.inherit(BI.Widget, { + props: { + baseCls: "dec-login-slider" + }, + _store: function () { + return BI.Models.getModel("dec.model.login.slider") + }, + watch: { + checkResult: function (e) { + var t = this; + this.model.ableSlider || e === i || (this.element.removeClass("slider-moving"), this.element.toggleClass("slider-fail", e === n), this.element.toggleClass("slider-success", e === o), this.sliderTrigger.setIcon(e === o ? "login-slider-success-font" : "login-slider-fail-font"), e === n ? (t.fireEvent("EVENT_FAIL"), this.failTimeout = window.setTimeout(function () { + t.resetAll() + }, 500)) : (t.sliderImg.changeState(!1), t.fireEvent("EVENT_SUCCESS"))) + } + }, + render: function () { + var t = this; + this.options; + return { + type: "bi.absolute", + width: 190, + height: 26, + items: [{ + el: { + type: "bi.vertical", + cls: "bi-card", + width: 190, + items: [{ + type: "dec.login.slider.image", + cls: "slider-img", + invisible: !(this.moving = !1), + ref: function (e) { + t.sliderImg = e + }, + listeners: [{ + eventName: "EVENT_REFRESH", + action: function () { + t.resetAll() + } + }] + }, { + type: "bi.absolute", + width: 190, + height: 26, + items: [{ + el: { + type: "bi.label", + cls: "bi-border slider-track", + textHeight: 24, + text: BI.i18nText("Dec-Login_To_Slider"), + ref: function (e) { + t.track = e + } + }, + top: 0, + bottom: 0, + left: 0, + right: 0 + }, { + el: { + type: "bi.default", + cls: "track-moved", + width: 0, + ref: function (e) { + t.movedTrack = e + } + }, + top: 0, + bottom: 0, + left: 0 + }, { + el: { + type: "bi.icon_change_button", + cls: "bi-border slider-trigger", + iconCls: "login-slider-trigger-font", + width: 30, + height: 24, + ref: function (e) { + t.sliderTrigger = e + } + }, + left: 0, + top: 0 + }] + }] + }, + bottom: 0, + left: 0, + right: 0 + }] + } + }, + mounted: function () { + var e, t, i = this; + this._slider(), this.element.hover(function () { + window.clearTimeout(t), e = window.setTimeout(function () { + i.element.focus(), i.model.ableSlider && i.sliderImg.changeState(!0) + }, 300) + }, function () { + window.clearTimeout(e), t = window.setTimeout(function () { + i.model.ableSlider && !i.moving && i.sliderImg.changeState(!1) + }, 300) + }) + }, + resetAll: function () { + this.sliderImg.refresh(), this.sliderTrigger.element.css({ + left: 0 + }), this.element.removeClass("slider-fail"), this.element.removeClass("slider-success"), this.sliderTrigger.setIcon("login-slider-trigger-font"), this.movedTrack.element.css({ + width: 0 + }), window.clearTimeout(this.failTimeout), this.store.reset(), this.track.setText(BI.i18nText("Dec-Login_To_Slider")) + }, + getStatus: function () { + return { + show: this.isVisible(), + status: this.model.checkResult === o + } + }, + _slider: function () { + var i = this, + o = { + x: 0, + y: 0 + }, + n = !1, + s = this.sliderTrigger.element, + r = this.movedTrack.element; + s.mousedown(function (e) { + i.model.startSlider && (n = !0, o = { + x: e.pageX, + y: e.pageY + }) + }), $(document).mousemove(function (e) { + var t = e.pageX - o.x; + n && 0 < t && t <= 160 && (i.moving = !0, i.element.addClass("slider-moving"), s.css({ + left: t + }), r.css({ + width: t + }), i.track.setText(""), i.sliderImg.move(t)) + }).mouseup(function (e) { + if (n) { + n = !1; + var t = e.pageX - o.x; + 0 < t && i.store.checkPosition(t) + } + i.moving = !1 + }) + } + }); + BI.shortcut("dec.login.slider", e) + }(), + function () { + var e = 0, + i = 1, + o = 2, + t = BI.inherit(Fix.Model, { + context: ["sliderToken"], + childContext: ["loading"], + state: function () { + return { + checkResult: e, + ableSlider: !0, + loading: !1 + } + }, + computed: { + startSlider: function () { + return !this.model.loading && this.model.ableSlider + } + }, + actions: { + checkPosition: function (e) { + var t = this; + t.model.ableSlider = !1, Dec.Utils.checkSliderPosition({ + sliderToken: this.model.sliderToken, + sliderLength: BI.parseInt(e) + }, function (e) { + t.model.checkResult = e.data ? i : o + }) + }, + setAbleSlider: function (e) { + this.model.ableSlider = e + }, + setStatus: function (e) { + this.model.checkResult = e + }, + reset: function () { + this.setAbleSlider(!0), this.setStatus(e) + } + } + }); + BI.model("dec.model.login.slider", t) + }(), BI.extend(Dec, { + asyncAjax: function (o) { + o = o || {}; + var e = Dec.fineServletURL + o.url; + $.support.cors = !0, $.ajax({ + url: e, + type: o.type, + headers: o.headers, + contentType: "application/json", + data: "GET" === o.type ? null : JSON.stringify(o.data), + dataType: "json", + cache: !1, + async: !0, + error: function () { + BI.Msg.toast("ajax error !", { + level: "warning" + }) + }, + complete: function (e, t) { + var i = BI.jsonDecode(e.responseText); + "success" === t && BI.isFunction(o.success) && o.success(i), BI.isFunction(o.complete) && o.complete(i, t) + } + }) + }, + jsonpAjax: function (e, t) { + $.ajax({ + url: e, + async: !0, + dataType: "JSONP" + }).done(function (e) { + BI.isFunction(t) && t(e) + }) + }, + reqGet: function (e, t, i, o) { + Dec.asyncAjax({ + url: e, + type: "GET", + data: t, + success: i, + complete: o + }) + }, + reqPost: function (e, t, i, o) { + Dec.asyncAjax({ + url: e, + type: "POST", + data: t, + success: i, + complete: o + }) + }, + reqPut: function (e, t, i, o) { + Dec.asyncAjax({ + url: e, + type: "PUT", + data: t, + success: i, + complete: o + }) + }, + reqGetHandle: function (e, t, i, o) { + Dec.asyncAjax({ + url: e, + type: "GET", + data: t, + success: function (e) { + e.data !== undefined && BI.isFunction(i) ? i(e.data) : BI.Msg.toast("请求服务器数据失败", { + level: "error" + }) + }, + complete: o + }) + } +}), Dec.Utils = Dec.Utils || {}, BI.extend(Dec.Utils, {}), BI.extend(Dec.Utils, { + loginConfig: function (e) { + Dec.reqGetHandle("/login/config", {}, e) + }, + getSystemInfo: function (e) { + Dec.reqGetHandle("/system/info", {}, e) + }, + login: function (e, t) { + Dec.reqPost("/login", e, t) + }, + loginTokenLogin: function (e, t) { + Dec.reqPost("/login/captcha", e, t) + }, + loginChangePwd: function (e, t) { + Dec.reqPost("/login/pwd/change", e, t) + }, + updateLoginPassword: function (e, t) { + Dec.reqPut("/login/pwd/resetting", e, t) + }, + getUserNamesByPhone: function (e, t) { + Dec.reqGet("/login/usernames?" + Dec.Utils.transformObject2URLParam(e, null, !1), "", t) + }, + loginCaptcha: function (e, t) { + Dec.reqGet("/login/captcha?" + Dec.Utils.transformObject2URLParam(e, null, !0), "", t) + }, + loginGetValidationTool: function (e, t) { + Dec.reqGetHandle("/login/validation/tool?fine_auth_token=" + window.encodeURIComponent(e), "", t) + }, + loginAuthentication: function (e, t) { + Dec.reqPut("/login/captcha", e, t) + }, + getIPInfo: function (e) { + Dec.jsonpAjax("https://cloud.fanruan.com/api/query/ip?timeout=10000", e) + }, + addLastLoginInfo: function (e, t) { + Dec.reqPost("/login/info?fine_auth_token=" + window.encodeURIComponent(BI.Cache.getCookie(DecCst.Cookie.TOKEN)), e, "", t) + }, + getUsernameErrorTimes: function (e, t) { + Dec.reqGetHandle("/login/slider?username=" + window.encodeURIComponent(e), {}, t) + }, + getLoginSliderInfo: function (e) { + Dec.reqGetHandle("/login/slider/info", {}, e) + }, + checkSliderPosition: function (e, t) { + Dec.reqPost("/login/slider/verification", e, t) + }, + getLoginPasswordStrategy: function (e) { + Dec.reqGetHandle("/login/password/strategy", {}, e) + } +}), + function () { + var e = BI.inherit(BI.Widget, { + props: { + baseCls: "dec-login-authentication" + }, + _store: function () { + return BI.Models.getModel("dec.model.login.forget") + }, + watch: { + userNames: function (e) { + this.usernameRow.populate(e), this.usernameRow.setValue(), this.usernameRow.setVisible(1 < BI.size(e)), this.captchaRow.setButtonEnable(1 === BI.size(e)) + }, + errorMsg: function (e) { + this.mailRow.showError(e) + }, + isPhone: function () { + this.mobile = "" + } + }, + render: function () { + var i = this; + this.options; + return this.mobile = "", { + type: "bi.absolute", + items: [{ + el: { + type: "bi.vertical", + items: [{ + el: { + type: "bi.absolute", + height: 24, + items: [{ + el: { + type: "bi.label", + height: 24, + text: BI.i18nText("Dec-Login_Authentication") + }, + top: 0, + left: 0, + right: 0, + bottom: 0 + }, { + el: { + type: "bi.icon_button", + height: 24, + cls: "login-back-font", + handler: function () { + i.store.setSelectedTab(DecCst.Login.Tabs.LOGIN) + } + }, + top: 0, + left: 0 + }] + }, + vgap: 28 + }, { + type: "dec.login.icon.item", + bgap: 10, + ref: function (e) { + i.mailRow = e + }, + listeners: [{ + eventName: BI.Editor.EVENT_BLUR, + action: function () { + i._validationChecker(this.getValue().receiver, !0) + } + }, { + eventName: e.EVENT_INPUT_TYPE, + action: function (e) { + i._hideAllError(), i.store.setIsPhone(e) + } + }] + }, { + type: "dec.login.text_value_combo", + width: 190, + bgap: 30, + height: 24, + invisible: !0, + watermark: BI.i18nText("Dec-Login_Authentication_Choose_Username"), + items: [], + ref: function (e) { + i.usernameRow = e + }, + listeners: [{ + eventName: BI.TextValueCombo.EVENT_CHANGE, + action: function () { + i.captchaRow.clearTime() + } + }] + }, { + type: "dec.login.captcha.item", + bgap: 10, + ref: function (e) { + i.captchaRow = e + }, + getCaptcha: function (t) { + i.store.captcha(BI.extend(i.mailRow.getValue(), { + username: i._getUsername() + }), function (e) { + e.data ? (i.store.setCaptchaSendToken(e.data), t()) : e.errorCode === DecCst.ErrorCode.SMS_UNUSABLE ? (i.warningText.setText(BI.i18nText("Dec-Error_Login_SMS_Unable")), t(!0)) : e.errorCode === DecCst.ErrorCode.MAIL_UNUSABLE ? (i.warningText.setText(BI.i18nText("Dec-Error_Login_Email_Unable")), t(!0)) : (BI.Msg.toast(BI.i18nText("Dec-Error_Get_Captcha"), { + level: "error" + }), t()) + }) + } + }, { + type: "bi.horizontal_auto", + items: [{ + type: "bi.button", + $testId: "dec-login-forget-btn", + cls: "login-button", + text: BI.i18nText("BI-Basic_Sure"), + width: 190, + height: 40, + handler: function () { + i._start() + } + }] + }, { + type: "bi.label", + textAlign: "left", + whiteSpace: "normal", + text: "", + cls: "warning-text", + tgap: 5, + ref: function (e) { + i.warningText = e + } + }] + }, + top: 0, + right: 40, + bottom: 0, + left: 40 + }] + } + }, + _start: function () { + var t = this, + e = this.mailRow.getValue().receiver, + i = this.captchaRow.getValue(); + t._validationChecker(e) && (BI.isEmpty(this._getUsername()) ? BI.Msg.toast(BI.i18nText("Dec-Error_Login_Choose_Username"), { + level: "error" + }) : "" !== i ? this.store.startAuthentication({ + token: this.model.captchaSendToken, + captcha: i + }, function (e) { + e.data ? (t.store.setPropsInfo({ + token: t.model.captchaSendToken + }), t.store.setSelectedTab(DecCst.Login.Tabs.PASSWORD_TOKEN)) : e.errorCode === DecCst.ErrorCode.CAPTCHA_ERROR ? t.captchaRow.showError(BI.i18nText("Dec-Error_Captcha_Error")) : e.errorCode === DecCst.ErrorCode.CAPTCHA_TIMEOUT ? t.captchaRow.showError(BI.i18nText("Dec-Error_Captcha_Timeout")) : BI.Msg.toast(BI.i18nText("Dec-Error_Check_Captcha_Error"), { + level: "error" + }) + }) : this.captchaRow.showError(BI.i18nText("Dec-Error_Captcha_Null"))) + }, + _validationChecker: function (e, t) { + var i = this, + o = this.model.isPhone ? this._validationCheckerPhone(e, t) : this._validationCheckerMail(e, t); + return o && this.mobile !== e && (this.mobile = e, this.store.getUserNames({ + type: this.model.isPhone ? DecCst.Login.AuthenticationWay.PHOME : DecCst.Login.AuthenticationWay.EMAIL, + receiver: e + }, function (e) { + e.data ? i.captchaRow.clearTime() : e.errorCode === DecCst.ErrorCode.PHONE_EMAIL_NOT_EXIST ? (i.mailRow.showErrorText(BI.i18nText("Dec-Error_Login_Unbind_" + (i.model.isPhone ? "Phone" : "Mail"))), i.captchaRow.setButtonEnable(!1)) : e.errorCode && BI.Msg.toast(BI.i18nText("Dec-Error_Get_Users"), { + level: "error" + }) + })), o + }, + _validationCheckerPhone: function (e, t) { + if ("" === e) return this.mailRow.showErrorText(BI.i18nText("Dec-Error_Phone_Not_Null")), !1; + if (/^1[0-9]{10}$/.test(e)) return this.mailRow.hideError(), BI.isEmpty(this._getUsername()) || this.captchaRow.setButtonEnable(!0), !0; + var i = BI.i18nText("Dec-Error_Phone_Format"); + return t ? this.mailRow.showErrorText(i) : this.mailRow.showError(i), !1 + }, + _validationCheckerMail: function (e, t) { + if ("" === e) return this.mailRow.showErrorText(BI.i18nText("Dec-Error_Email_Not_Null")), !1; + if (/^[a-zA-Z0-9_\.-]+@[a-zA-Z0-9_-]+(\.[a-zA-Z0-9_-]+)+$/.test(e)) return this.mailRow.hideError(), BI.isEmpty(this._getUsername()) || this.captchaRow.setButtonEnable(!0), !0; + var i = BI.i18nText("Dec-Error_Email_Format"); + return t ? this.mailRow.showErrorText(i) : this.mailRow.showError(i), !1 + }, + _getUsername: function () { + if (this.usernameRow.isVisible()) return this.usernameRow.getValue()[0]; + var e = this.model.userNames; + return 0 < BI.size(e) ? e[0].value : "" + }, + _hideAllError: function () { + this.mailRow.hideError(), this.captchaRow.hideError(), this.warningText.setText("") + } + }); + e.EVENT_INPUT_TYPE = "EVENT_INPUT_TYPE", BI.shortcut("dec.login.forget", e) + }(), + function () { + var e = BI.inherit(Fix.Model, { + _init: function () { + this.loginConfigInfo = Dec.loginConfig || {} + }, + context: ["selectedTab", "loginInfo", "propsInfo"], + state: function () { + return { + isPhone: !0, + userNames: [], + captchaSendToken: "" + } + }, + watch: { + isPhone: function () { + this.setUserNames([]) + } + }, + computed: { + platformTitle: function () { + return this.loginConfigInfo.loginTitle || BI.i18nText("Dec-Decision") + } + }, + actions: { + setSelectedTab: function (e) { + this.model.selectedTab = e + }, + getUserNames: function (e, t) { + var i = this; + Dec.Utils.getUserNamesByPhone(e, function (e) { + e.data ? i.model.userNames = BI.map(e.data, function (e, t) { + return { + text: t, + value: t + } + }) : i.model.userNames = [], t(e) + }) + }, + setUserNames: function (e) { + this.model.userNames = e + }, + captcha: function (e, t) { + Dec.Utils.loginCaptcha(e, t) + }, + setCaptchaSendToken: function (e) { + this.model.captchaSendToken = e + }, + setPropsInfo: function (e) { + this.model.propsInfo = e + }, + startAuthentication: function (e, t) { + Dec.Utils.loginAuthentication(e, function (e) { + t(e) + }) + }, + tokenLogin: function (e, t) { + BI.Services.getService("dec.service.login").useTokenLoginValue(e, this.model.loginInfo.validity, t) + }, + setIsPhone: function (e) { + this.model.isPhone = e + } + } + }); + BI.model("dec.model.login.forget", e) + }(), + function () { + var e = BI.inherit(BI.Widget, { + props: { + baseCls: "dec-login-authentication" + }, + _store: function () { + return BI.Models.getModel("dec.model.login.authentication") + }, + watch: { + showReceiver: function (e) { + this.receiverRow.setText(e), this.captchaRow.clearTime() + } + }, + render: function () { + var i = this; + this.options; + return { + type: "bi.absolute", + items: [{ + el: { + type: "bi.vertical", + items: [{ + el: { + type: "bi.absolute", + height: 24, + items: [{ + el: { + type: "bi.label", + height: 24, + text: BI.i18nText("Dec-Login_Authentication") + }, + top: 0, + left: 0, + right: 0, + bottom: 0 + }, { + el: { + type: "bi.icon_button", + height: 24, + cls: "login-back-font", + handler: function () { + i.store.setSelectedTab(DecCst.Login.Tabs.LOGIN) + } + }, + top: 0, + left: 0 + }] + }, + vgap: 28 + }, { + type: "bi.label", + invisible: !this.model.showDesc, + text: this.model.showDesc, + whiteSpace: "normal", + bgap: 15 + }, { + el: { + type: "bi.absolute", + cls: "bi-border-bottom dec-login-item", + height: 36, + items: [{ + el: { + type: "bi.htape", + invisible: 1 === BI.size(this.model.supportType), + items: [{ + type: "bi.center_adapt", + width: 24, + items: [{ + type: "dec.icon_combo", + $value: "authentication", + value: DecCst.Login.AuthenticationWay.PHOME, + height: 24, + width: 24, + items: BI.Constants.getConstant("dec.constant.login.authentication.way"), + listeners: [{ + eventName: BI.IconCombo.EVENT_CHANGE, + action: function () { + i.store.setReceiverType(this.getValue()[0]) + } + }] + }] + }, { + el: { + type: "bi.label", + $testId: "dec-login-authentication-receiver", + height: 36, + textAlign: "left", + text: this.model.showReceiver, + disabled: !0, + ref: function (e) { + i.receiverRow = e + } + }, + lgap: 10 + }] + }, + top: 0, + left: 0, + bottom: 0, + right: 0 + }, { + el: { + type: "bi.vertical_adapt", + invisible: 1 < BI.size(this.model.supportType), + height: 36, + items: [{ + type: "bi.center_adapt", + cls: "item-icon " + (this.model.selectedType === DecCst.Login.AuthenticationWay.PHOME ? "login-username-font" : "login-email-font"), + width: 16, + items: [{ + type: "bi.icon" + }] + }, { + el: { + type: "bi.label", + $testId: "dec-login-authentication-change-receiver", + textAlign: "left", + disabled: !0, + text: this.model.showReceiver + }, + lgap: 10 + }] + }, + top: 0, + left: 0, + bottom: 0, + right: 0 + }] + }, + bgap: 35 + }, { + type: "dec.login.captcha.item", + bgap: 10, + btnDisabled: !1, + ref: function (e) { + i.captchaRow = e + }, + getCaptcha: function (t) { + i.store.captcha({ + type: i.model.selectedType, + receiver: i.model.receiver, + username: i.model.loginInfo.username, + token: i.model.propsInfo.token + }, function (e) { + e.data ? i.store.setCaptchaSendToken(e.data) : BI.Msg.toast(BI.i18nText("Dec-Error_Get_Captcha"), { + level: "error" + }), t() + }) + } + }, { + type: "bi.horizontal_auto", + items: [{ + type: "bi.button", + $testId: "dec-login-authentication-btn", + cls: "login-button", + text: BI.i18nText("BI-Basic_Sure"), + width: 190, + height: 40, + handler: function () { + i._start() + } + }] + }] + }, + top: 0, + right: 40, + bottom: 0, + left: 40 + }] + } + }, + _start: function () { + var t = this, + e = this.captchaRow.getValue(); + "" !== e ? this.store.startAuthentication({ + token: this.model.captchaSendToken, + captcha: e + }, function (e) { + e.data ? t.model.propsInfo.isChangePwd ? (t.store.setPropsInfo({ + token: t.model.captchaSendToken + }), t.store.setSelectedTab(DecCst.Login.Tabs.PASSWORD_TOKEN)) : t.store.tokenLogin(t.model.captchaSendToken, function (e) { + t.fireEvent("EVENT_LOGIN", e.data) + }) : e.errorCode === DecCst.ErrorCode.CAPTCHA_ERROR ? t.captchaRow.showError(BI.i18nText("Dec-Error_Captcha_Error")) : e.errorCode === DecCst.ErrorCode.CAPTCHA_TIMEOUT ? t.captchaRow.showError(BI.i18nText("Dec-Error_Captcha_Timeout")) : BI.Msg.toast(BI.i18nText("Dec-Error_Check_Captcha_Error"), { + level: "error" + }) + }) : this.captchaRow.showError(BI.i18nText("Dec-Error_Captcha_Null")) + } + }); + e.EVENT_INPUT_TYPE = "EVENT_INPUT_TYPE", BI.shortcut("dec.login.authentication", e) + }(), + function () { + var e = BI.inherit(Fix.Model, { + _init: function () { + this.loginConfigInfo = Dec.loginConfig || {} + }, + context: ["selectedTab", "loginInfo", "propsInfo", "verifyConfig"], + state: function () { + return { + receiverType: "", + userNames: [], + captchaSendToken: "" + } + }, + computed: { + platformTitle: function () { + return this.loginConfigInfo.loginTitle || BI.i18nText("Dec-Decision") + }, + showPhone: function () { + return this.model.propsInfo.phone.replace(/^(\d{3})\d{4}(\d{4})$/, "$1****$2") + }, + showEmail: function () { + var e = this.model.propsInfo.email.split("@")[0], + t = 1 < (e && e.length) ? /^([a-zA-Z0-9._-]{2})[a-zA-Z0-9._-]*(@.+)/ : /^([a-zA-Z0-9._-])[a-zA-Z0-9._-]*(@.+)/; + return this.model.propsInfo.email.replace(t, "$1****$2") + }, + supportType: function () { + var e = [], + t = this.model.verifyConfig; + return this.model.propsInfo.isChangePwd ? (t.smsVerificationAfterChangePassword && this.model.propsInfo.phone && e.push(DecCst.Login.AuthenticationWay.PHOME), t.emailVerificationAfterChangePassword && this.model.propsInfo.email && e.push(DecCst.Login.AuthenticationWay.EMAIL)) : (t.smsRemind && this.model.propsInfo.phone && e.push(DecCst.Login.AuthenticationWay.PHOME), t.emailRemind && this.model.propsInfo.email && e.push(DecCst.Login.AuthenticationWay.EMAIL)), e + }, + selectedType: function () { + return this.model.receiverType || this.model.supportType[0] + }, + receiver: function () { + return this.model.selectedType === DecCst.Login.AuthenticationWay.PHOME ? this.model.propsInfo.phone : this.model.propsInfo.email + }, + showReceiver: function () { + return this.model.selectedType === DecCst.Login.AuthenticationWay.PHOME ? this.model.showPhone : this.model.showEmail + }, + showDesc: function () { + switch (this.model.propsInfo.from) { + case DecCst.Login.AuthenticationModule.LOGIN: + return BI.i18nText("Dec-Login_Authentication_Tip", BI.i18nText("Dec-Login_Authentication_Open")); + case DecCst.Login.AuthenticationModule.PWD_STRENGTH: + return BI.i18nText("Dec-Login_Authentication_Password_Strength_Tip"); + case DecCst.Login.AuthenticationModule.PWD_UPDATE: + return BI.i18nText("Dec-Login_Authentication_Password_Update_Tip"); + case DecCst.Login.AuthenticationModule.SINGLE: + default: + return "" + } + } + }, + actions: { + setSelectedTab: function (e) { + this.model.selectedTab = e + }, + captcha: function (e, t) { + Dec.Utils.loginCaptcha(e, t) + }, + setCaptchaSendToken: function (e) { + this.model.captchaSendToken = e + }, + setPropsInfo: function (e) { + this.model.propsInfo = e + }, + startAuthentication: function (e, t) { + Dec.Utils.loginAuthentication(e, function (e) { + t(e) + }) + }, + tokenLogin: function (e, t) { + BI.Services.getService("dec.service.login").useTokenLoginValue(e, this.model.loginInfo.validity, t) + }, + setReceiverType: function (e) { + this.model.receiverType = e + } + } + }); + BI.model("dec.model.login.authentication", e) + }(), + function () { + var e = BI.inherit(BI.Widget, { + props: { + baseCls: "dec-login-item dec-login-captcha-item", + errorText: "", + btnDisabled: !0, + getCaptcha: BI.emptyFn + }, + render: function () { + var t = this, + e = this.options; + return { + type: "bi.vertical", + items: [{ + type: "bi.htape", + height: 36, + items: [{ + type: "bi.center_adapt", + cls: "item-icon login-password-font", + width: 16, + items: [{ + type: "bi.icon" + }] + }, { + el: { + type: "bi.editor", + $value: "dec-login-captcha-item-editor", + watermark: BI.i18nText("Dec-Login_Input_Captcha"), + allowBlank: !0, + ref: function (e) { + t.editor = e + }, + listeners: [{ + eventName: BI.Editor.EVENT_FOCUS, + action: function () { + t.hideError() + } + }] + }, + lgap: 8 + }, { + type: "bi.right", + width: 80, + items: [{ + type: "bi.button", + $testId: "dec-login-get-captcha-btn", + clear: !0, + height: 36, + block: !0, + disabled: e.btnDisabled, + text: BI.i18nText("Dec-Login_Get_Captcha"), + ref: function (e) { + t.getButton = e + }, + handler: function () { + t.setButtonEnable(!1), e.getCaptcha(function (e) { + e || t.regainCaptcha() + }) + } + }] + }] + }, { + type: "bi.label", + cls: "bi-border-top", + text: "", + height: 24, + ref: function (e) { + t.lineRow = e + } + }, { + type: "bi.label", + invisible: !0, + text: e.errorText, + height: 24, + textAlign: "left", + cls: "bi-border-top error", + ref: function (e) { + t.errorRow = e + } + }] + } + }, + setButtonEnable: function (e) { + this.captchaTime && (e = !1), this.getButton.setEnable(e) + }, + regainCaptcha: function () { + var e = this, + t = 0; + window.clearInterval(e.captchaTime), this.captchaTime = window.setInterval(function () { + if (60 === t) return window.clearInterval(e.captchaTime), e.captchaTime = null, e.getButton.setText(BI.i18nText("Dec-Login_Get_Captcha")), void e.setButtonEnable(!0); + e.getButton.setText(BI.i18nText("Dec-Login_Regain_Captcha") + "(" + (60 - t) + ")"), t++ + }, 1e3), this.setButtonEnable(!1) + }, + clearTime: function () { + window.clearInterval(this.captchaTime), this.captchaTime = null, this.getButton.setText(BI.i18nText("Dec-Login_Get_Captcha")), this.setButtonEnable(!0) + }, + showError: function (e) { + this.errorRow.visible(), this.errorRow.setText(e), this.lineRow.invisible() + }, + hideError: function () { + this.errorRow.invisible(), this.errorRow.setText(""), this.lineRow.visible() + }, + getValue: function () { + return this.editor.getValue() + } + }); + BI.shortcut("dec.login.captcha.item", e) + }(), + function () { + var t = BI.inherit(BI.Widget, { + props: { + baseCls: "dec-login-item", + errorText: "", + watermark: "", + value: "", + validationChecker: BI.emptyFn + }, + render: function () { + var t = this, + e = this.options; + return this.captchaType = DecCst.Login.AuthenticationWay.PHOME, { + type: "bi.vertical", + items: [{ + type: "bi.htape", + height: 36, + items: [{ + type: "bi.center_adapt", + width: 24, + items: [{ + type: "dec.icon_combo", + $value: "login-item", + value: DecCst.Login.AuthenticationWay.PHOME, + height: 24, + width: 24, + items: BI.Constants.getConstant("dec.constant.login.authentication.way"), + listeners: [{ + eventName: BI.IconCombo.EVENT_CHANGE, + action: function () { + t._changeInput(this.getValue()[0]) + } + }] + }] + }, { + el: { + type: "bi.vertical", + items: [{ + type: "bi.editor", + $value: "dec-login-password-authentication-phone-editor", + height: 36, + watermark: BI.i18nText("Dec-Login_Phone_Watermark"), + validationChecker: e.validationChecker, + value: e.value, + allowBlank: !0, + ref: function (e) { + t.editor = e + }, + listeners: [{ + eventName: BI.Editor.EVENT_FOCUS, + action: function () { + t.hideError() + } + }, { + eventName: BI.Editor.EVENT_BLUR, + action: function () { + t.fireEvent(BI.Editor.EVENT_BLUR, arguments) + } + }, { + eventName: BI.Editor.EVENT_CHANGE, + action: function () { + t.fireEvent(BI.Editor.EVENT_CHANGE, arguments), t.hideError() + } + }] + }, { + type: "bi.editor", + $value: "dec-login-password-authentication-email-editor", + height: 36, + watermark: BI.i18nText("Dec-Login_Email_Watermark"), + value: e.value, + invisible: !0, + ref: function (e) { + t.emailRow = e + }, + listeners: [{ + eventName: BI.Editor.EVENT_FOCUS, + action: function () { + t.hideError() + } + }, { + eventName: BI.Editor.EVENT_BLUR, + action: function () { + t.fireEvent(BI.Editor.EVENT_BLUR, arguments) + } + }, { + eventName: BI.Editor.EVENT_CHANGE, + action: function () { + t.fireEvent(BI.Editor.EVENT_CHANGE, arguments), t.hideError() + } + }] + }] + } + }] + }, { + type: "bi.label", + cls: "bi-border-top", + text: "", + height: 24, + ref: function (e) { + t.lineRow = e + } + }, { + type: "bi.label", + invisible: !0, + text: e.errorText, + height: 24, + textAlign: "left", + cls: "bi-border-top error", + ref: function (e) { + t.errorRow = e + } + }] + } + }, + showError: function (e) { + this.captchaType === DecCst.Login.AuthenticationWay.PHOME ? this.editor.focus() : this.emailRow.focus(), this.showErrorText(e) + }, + showErrorText: function (e) { + this.errorRow.visible(), this.errorRow.setText(e), this.lineRow.invisible() + }, + hideError: function () { + this.errorRow.invisible(), this.errorRow.setText(""), this.lineRow.visible() + }, + getValue: function () { + return { + receiver: this.captchaType === DecCst.Login.AuthenticationWay.PHOME ? this.editor.getValue() : this.emailRow.getValue(), + type: this.captchaType + } + }, + _changeInput: function (e) { + this.captchaType = e, this.editor.setVisible(e === DecCst.Login.AuthenticationWay.PHOME), this.emailRow.setVisible(e === DecCst.Login.AuthenticationWay.EMAIL), this.fireEvent(t.EVENT_INPUT_TYPE, e === DecCst.Login.AuthenticationWay.PHOME) + } + }); + t.EVENT_INPUT_TYPE = "EVENT_INPUT_TYPE", BI.shortcut("dec.login.icon.item", t) + }(), + function () { + var e = BI.inherit(BI.Widget, { + props: { + baseCls: "" + }, + _store: function () { + return BI.Models.getModel("dec.model.login.locked") + }, + watch: {}, + render: function () { + var e = this; + this.options; + return { + type: "bi.absolute", + items: [{ + el: { + type: "bi.horizontal_auto", + items: [{ + el: { + type: "bi.absolute", + height: 24, + items: [{ + el: { + type: "bi.label", + height: 24, + text: BI.i18nText("Dec-Login_Authentication") + }, + top: 0, + left: 0, + right: 0, + bottom: 0 + }, { + el: { + type: "bi.icon_button", + height: 24, + cls: "login-back-font", + handler: function () { + e.store.setSelectedTab(DecCst.Login.Tabs.LOGIN) + } + }, + top: 0, + left: 0 + }] + }, + vgap: 28 + }, { + type: "bi.label", + text: BI.i18nText(this.model.propsInfo.errorMsg), + textAlign: "left", + whiteSpace: "normal", + tgap: 40, + bgap: 30 + }, { + type: "bi.horizontal_auto", + items: [{ + type: "bi.button", + $testId: "dec-login-locked-btn", + cls: "login-button", + text: BI.i18nText("BI-Basic_Sure"), + width: 190, + height: 40, + handler: function () { + e.store.setSelectedTab(DecCst.Login.Tabs.LOGIN) + } + }] + }] + }, + top: 0, + right: 40, + bottom: 0, + left: 40 + }] + } + } + }); + BI.shortcut("dec.login.locked", e) + }(), + function () { + var e = BI.inherit(Fix.Model, { + context: ["propsInfo", "selectedTab"], + state: function () { + return {} + }, + computed: {}, + actions: { + setSelectedTab: function (e) { + this.model.selectedTab = e + } + } + }); + BI.model("dec.model.login.locked", e) + }(), + function () { + var e = BI.inherit(BI.Widget, { + props: { + baseCls: "dec-login-password" + }, + _store: function () { + return BI.Models.getModel("dec.model.login.password") + }, + watch: { + password: function (e) { + this.passwordCombo.setPassword(e) + } + }, + render: function () { + var t = this; + this.options; + return { + type: "bi.absolute", + items: [{ + el: { + type: "bi.horizontal_auto", + items: [{ + el: { + type: "bi.absolute", + height: 24, + items: [{ + el: { + type: "bi.label", + height: 24, + text: BI.i18nText("Dec-Login_Change_Password") + }, + top: 0, + left: 0, + right: 0, + bottom: 0 + }, { + el: { + type: "bi.icon_button", + height: 24, + cls: "login-back-font", + handler: function () { + t.store.setSelectedTab(DecCst.Login.Tabs.LOGIN) + } + }, + top: 0, + left: 0 + }] + }, + vgap: 28 + }, { + type: "bi.absolute", + height: 60, + items: [{ + el: { + type: "dec.login.item", + iconCls: "login-new-password-font", + watermark: BI.i18nText("Dec-Login_New_Password"), + inputType: "password", + ref: function (e) { + t.passwordRow = e + }, + listeners: [{ + eventName: "EVENT_CHANGE", + action: function () { + t.store.setPassword(this.getValue()) + } + }, { + eventName: "EVENT_FOCUS", + action: function () { + t.passwordCombo.setVisible(!0) + } + }, { + eventName: "EVENT_BLUR", + action: function () { + t.passwordCombo.setVisible(!1), t.passwordCombo.isValid() || t.passwordRow.showErrorText(BI.i18nText("Dec-Error_Password_Strength_Not")) + } + }] + }, + top: 0, + left: 0, + right: 0, + bottom: 0 + }, { + el: { + type: "dec.password.strength", + invisible: !0, + adjustHeight: 36, + ref: function (e) { + t.passwordCombo = e + } + }, + top: 0, + left: 190 + }] + }, { + type: "dec.login.item", + bgap: 10, + iconCls: "login-confirm-password-font", + watermark: BI.i18nText("Dec-Login_Re_New_Password"), + inputType: "password", + ref: function (e) { + t.rePassswordRow = e + } + }, { + type: "bi.horizontal_auto", + items: [{ + type: "bi.button", + $testId: "dec-login-password-btn", + cls: "login-button", + text: BI.i18nText("BI-Basic_Save"), + width: 190, + height: 40, + handler: function () { + t._start() + } + }] + }] + }, + top: 0, + right: 40, + bottom: 0, + left: 40 + }] + } + }, + _start: function () { + var t = this, + e = this.passwordRow.getValue(), + i = this.rePassswordRow.getValue(); + "" !== e ? this.passwordCombo.isValid() ? "" !== i ? e === i ? this.store.save({ + captchaToken: this.model.propsInfo.token, + newPassword: e + }, function (e) { + e.data ? t.store.setSelectedTab(DecCst.Login.Tabs.SUCCESS_TOKEN) : e.errorCode === DecCst.ErrorCode.CAPTCHA_TIMEOUT ? (BI.Msg.toast(BI.i18nText("Dec-Error_Captcha_Timeout"), { + level: "error" + }), t.store.setSelectedTab(DecCst.Login.Tabs.LOGIN)) : e.errorCode === DecCst.ErrorCode.PASSWORD_STRENGTH ? t.passwordRow.showError(BI.i18nText("Dec-Error_Password_Strength_Not")) : e.errorCode === DecCst.ErrorCode.PASSWORD_SAME_ERROR ? t.passwordRow.showError(BI.i18nText("Dec-Error_Password_Equal_Old")) : BI.Msg.toast(BI.i18nText("Dec-Login_Change_Password_Fail"), { + level: "error" + }) + }) : this.rePassswordRow.showError(BI.i18nText("Dec-Error_Password_Be_Equal")) : this.rePassswordRow.showError(BI.i18nText("Dec-Error_New_Password_Null")) : this.passwordRow.showErrorText(BI.i18nText("Dec-Error_Password_Strength_Not")) : this.passwordRow.showError(BI.i18nText("Dec-Error_New_Password_Null")) + } + }); + BI.shortcut("dec.login.password", e) + }(), + (function () { + var e = BI.inherit(BI.Widget, { + props: { + baseCls: "", + }, + _store: function () { + return BI.Models.getModel("dec.model.login.login") + }, + render: function () { + var t=this; + return { + type: "bi.absolute", + items: [{ + el: { + type: "bi.default", + element: "" + }, + top: 0, + height:"100%", + right: 0, + bottom: 0, + left: -4 + },{ + el: { + type: "bi.icon_button", + cls: "toast-error-font", + handler:function () { + t.store.setSelectedTab(DecCst.Login.Tabs.LOGIN) + } + }, + top: 10, + right: 20, + }] + } + } + }); + BI.shortcut("dec.login.QR", e) + })(), + function () { + var e = BI.inherit(Fix.Model, { + context: ["selectedTab", "propsInfo"], + state: function () { + return { + password: "" + } + }, + computed: {}, + actions: { + save: function (e, t) { + Dec.Utils.updateLoginPassword(e, t) + }, + setSelectedTab: function (e) { + this.model.selectedTab = e + }, + setPropsInfo: function (e) { + this.model.propsInfo = e + }, + setPassword: function (e) { + this.model.password = e + } + } + }); + BI.model("dec.model.login.password", e) + }(), BI.constant("dec.constant.login.way.extend", []), + function () { + var e = BI.inherit(BI.Widget, { + props: { + baseCls: "", + inputType: "text" + }, + render: function () { + var t = this, + e = this.options; + return { + type: "bi.vertical", + items: [{ + type: "dec.login.input.item", + iconCls: e.iconCls, + invisible: BI.isIE(), + bgap: 10, + watermark: e.watermark, + inputType: e.inputType, + ref: function (e) { + t.usernameNotIERow = e + }, + listeners: [{ + eventName: "EVENT_BLUR", + action: function () { + t.fireEvent("EVENT_BLUR") + } + }] + }, { + type: "dec.login.item", + iconCls: e.iconCls, + invisible: !BI.isIE(), + bgap: 10, + watermark: e.watermark, + inputType: e.inputType, + ref: function (e) { + t.usernameIERow = e + }, + listeners: [{ + eventName: "EVENT_BLUR", + action: function () { + t.fireEvent("EVENT_BLUR") + } + }] + }] + } + }, + showError: function (e) { + BI.isIE() ? this.usernameIERow.showErrorText(e) : this.usernameNotIERow.showError(e) + }, + getValue: function () { + return BI.isIE() ? this.usernameIERow.getValue() : this.usernameNotIERow.getValue() + } + }); + BI.shortcut("dec.login.login.item", e) + }(), + function () { + var e = BI.inherit(BI.Widget, { + props: { + baseCls: "dec-login-login" + }, + _store: function () { + return BI.Models.getModel("dec.model.login.login") + }, + watch: { + supportForgetPwd: function (e) { + this.forgetPasswordRow.setVisible(e) + }, + needSlider: function (e) { + this.sliderBar.setVisible(e), this.sliderError.setVisible(e) + } + }, + render: function () { + var t = this; + this.options; + return { + type: "bi.absolute", + items: [{ + el: { + type: "bi.vertical", + items: [{ + type: "dec.login.login.item", + $testId: "dec-login-username", + iconCls: "login-username-font", + tgap: 50, + watermark: BI.i18nText("Dec-User_Name"), + ref: function (e) { + t.usernameRow = e + }, + listeners: [{ + eventName: "EVENT_BLUR", + action: function () { + t.store.checkUsername(this.getValue()) + } + }] + }, { + type: "dec.login.login.item", + $testId: "dec-login-password", + iconCls: "login-password-font", + watermark: BI.i18nText("Dec-Password"), + inputType: "password", + ref: function (e) { + t.passwordRow = e + } + }, { + type: "dec.login.slider", + invisible: !0, + ref: function (e) { + t.sliderBar = e + }, + listeners: [{ + eventName: "EVENT_SUCCESS", + action: function () { + t.sliderError.setText("") + } + }, { + eventName: "EVENT_FAIL", + action: function () { + t.sliderError.setText(BI.i18nText("Dec-Login_Need_Slider")) + } + }] + }, { + type: "bi.label", + $testId: "dec-login-slider-error-text", + invisible: !0, + textAlign: "left", + height: 20, + cls: "login-error", + ref: function (e) { + t.sliderError = e + } + }, { + type: "bi.left_right_vertical_adapt", + bgap: 30, + items: { + left: [{ + type: "bi.multi_select_item", + $testId: "dec-login-remember", + lgap: -5, + height: 16, + text: BI.i18nText("Dec-Login_Remember"), + logic: { + dynamic: !0 + }, + ref: function (e) { + t.rememberRow = e + } + }], + right: [{ + type: "bi.button", + $testId: "dec-login-forget-password", + clear: !0, + height: 16, + invisible: !this.model.supportForgetPwd, + text: BI.i18nText("Dec-Basic_Forget_Password"), + ref: function (e) { + t.forgetPasswordRow = e + }, + handler: function () { + t.store.setSelectedTab(DecCst.Login.Tabs.FORGET_PASSWORD) + } + }].concat(this._createItems()) + } + }, { + type: "bi.left_right_vertical_adapt", + bgap: 30, + items: { + right: [{ + type: "bi.icon_button", + cls: "dir-font-14", + title: "扫码登陆", + handler: function () { + t.store.setSelectedTab(DecCst.Login.Tabs.QR_LOGIN) + } + }] + } + }, { + type: "bi.horizontal_auto", + items: [{ + type: "bi.button", + cls: "login-button", + text: BI.i18nText("Dec-Basic_Login"), + width: 190, + height: 40, + handler: function () { + t._start() + } + }] + }, { + el: { + type: "bi.vertical", + cls: "login-error", + invisible: !0, + scrolly: !1, + items: [{ + type: "bi.text", + tagName: "span", + whiteSpace: "normal", + text: BI.i18nText("Dec-Login_Other_Logged_Tip") + }, { + type: "bi.text", + $testId: "dec-login-logged-chang-password", + tagName: "span", + cls: "password-btn", + text: BI.i18nText("Dec-Login_Change_Password"), + handler: function () { + t.model.isNeedVerify ? t.store.setSelectedTab(DecCst.Login.Tabs.VERIFY_BING) : t.store.setSelectedTab(DecCst.Login.Tabs.PASSWORD_OLD) + } + }], + ref: function (e) { + t.loginErrorRow = e + } + }, + tgap: 20 + }, { + el: { + type: "bi.text", + $testId: "dec-login-logged-text", + cls: "login-error", + invisible: !0, + whiteSpace: "normal", + text: BI.i18nText("Dec-Login_Normal_Other_Logged_Tip"), + ref: function (e) { + t.loginNormalErrorRow = e + } + }, + tgap: 20 + }] + }, + top: 0, + right: 40, + bottom: 0, + left: 40 + }] + } + }, + mounted: function () { + var t = this; + this.store.initData(), this.element.keyup(function (e) { + 13 === e.keyCode && t._start() + }) + }, + _createItems: function () { + return BI.map(BI.Constants.getConstant("dec.constant.login.way.extend"), function (e, t) { + return { + type: t.cardType + } + }) + }, + _start: function () { + var t = this, + e = this.usernameRow.getValue(), + i = this.passwordRow.getValue(), + o = this.rememberRow.isSelected() ? -2 : -1, + n = this.sliderBar.getStatus(); + t.loginErrorRow.invisible(), t.loginNormalErrorRow.invisible(), "" !== e ? "" !== i ? !n.show || n.status ? (this.store.setLoginInfo({ + username: e, + validity: o, + phone: "", + captcha: "" + }), this.store.login({ + username: e, + password: i, + validity: o, + sliderToken: this.model.sliderToken, + origin: Dec.Utils.getUrlQuery("origin") + }, function (e) { + e.data && e.data.accessToken ? t.fireEvent("EVENT_LOGIN", e.data) : e.errorCode === DecCst.ErrorCode.USER_LOGGED ? (t.store.setPropsInfo({ + token: e.errorMsg, + isChangePwd: !0, + from: DecCst.Login.AuthenticationModule.SINGLE + }), t.store.setNeedSlider(!1), t.loginErrorRow.visible()) : e.errorCode === DecCst.ErrorCode.USER_LOGGED_CAN_NOT_CHANGE_PASSWORD ? (t.store.setNeedSlider(!1), t.loginNormalErrorRow.visible()) : e.errorCode === DecCst.ErrorCode.USERNAME_UNAVAILABLE ? t.usernameRow.showError(BI.i18nText("Dec-Error_Login_Username_Unable")) : e.errorCode === DecCst.ErrorCode.USERNAME_PASSWORD_ERROR ? t.passwordRow.showError(BI.i18nText("Dec-Error_Password_Username_Error")) : e.errorCode === DecCst.ErrorCode.PASSWORD_ERROR_NEED_SPLIDER ? (t.passwordRow.showError(BI.i18nText("Dec-Error_Password_Username_Error")), t.store.setNeedSlider(!0), t.sliderBar && t.sliderBar.resetAll()) : e.errorCode === DecCst.ErrorCode.USERNAME_NOT_EXITS ? t.usernameRow.showError(BI.i18nText("Dec-Error_Login_Username_Not_Exits")) : e.errorCode === DecCst.ErrorCode.SMS_CAPTCHA_UNCHECK ? (t.store.setPropsInfo({ + token: e.errorMsg, + isChangePwd: !1, + from: DecCst.Login.AuthenticationModule.LOGIN + }), t.store.setSelectedTab(DecCst.Login.Tabs.VERIFY_BING)) : e.errorCode === DecCst.ErrorCode.PASSWORD_NEED_SPLIDER ? (t.store.setNeedSlider(!0), t.sliderBar.resetAll()) : e.errorCode === DecCst.ErrorCode.PASSWORD_LOCKED ? (t.store.setPropsInfo({ + errorMsg: e.errorMsg + }), t.store.setSelectedTab(DecCst.Login.Tabs.LOCKED)) : e.errorCode === DecCst.ErrorCode.PASSWORD_NEED_UPDATE ? (t.store.setPropsInfo({ + token: e.errorMsg, + isChangePwd: !0, + from: DecCst.Login.AuthenticationModule.PWD_UPDATE + }), t.model.isNeedVerify ? t.store.setSelectedTab(DecCst.Login.Tabs.VERIFY_BING) : t.store.setSelectedTab(DecCst.Login.Tabs.PASSWORD_OLD)) : e.errorCode === DecCst.ErrorCode.PASSWORD_STRENGTH ? (t.store.setPropsInfo({ + token: e.errorMsg, + isChangePwd: !0, + from: DecCst.Login.AuthenticationModule.PWD_STRENGTH + }), t.model.isNeedVerify ? t.store.setSelectedTab(DecCst.Login.Tabs.VERIFY_BING) : t.store.setSelectedTab(DecCst.Login.Tabs.PASSWORD_OLD)) : e.errorCode === DecCst.ErrorCode.CAPTCHA_TIMEOUT ? (t.sliderError.setText(BI.i18nText("Dec-Basic_Captcha_Timeout")), t.sliderBar.resetAll()) : t.passwordRow.showError(BI.i18nText("Dec-Login_Fail")) + })) : this.sliderError.setText(BI.i18nText("Dec-Login_Need_Slider")) : this.passwordRow.showError(BI.i18nText("Dec-Error_Password_Not_Null")) : this.usernameRow.showError(BI.i18nText("Dec-Error_Username_Not_Null")) + } + }); + BI.shortcut("dec.login.login", e) + }(), + function () { + var e = BI.inherit(Fix.Model, { + context: ["selectedTab", "verifyConfig", "loginInfo", "propsInfo", "sliderToken"], + state: function () { + return { + forgetPwd: !1, + systemInfo: {}, + needSlider: !1 + } + }, + computed: { + supportForgetPwd: function () { + return !this.model.systemInfo.syncUserOpen && "default" === this.model.systemInfo.loginAuthenticType && this.model.forgetPwd + }, + isNeedVerify: function () { + return this.model.verifyConfig.smsVerificationAfterChangePassword || this.model.verifyConfig.emailVerificationAfterChangePassword + } + }, + actions: { + initData: function () { + var i = this; + Dec.Utils.loginConfig(function (t) { + i.model.verifyConfig = t, Dec.Utils.getSystemInfo(function (e) { + i.model.forgetPwd = t.supportForgetPwd, i.model.systemInfo = e + }) + }) + }, + checkUsername: function (e) { + var t = this; + this.model.sliderToken = "", BI.isEmptyString(e) || Dec.Utils.getUsernameErrorTimes(e, function (e) { + t.model.needSlider = e + }) + }, + setSelectedTab: function (e) { + this.model.selectedTab = e + }, + setLoginInfo: function (e) { + this.model.loginInfo = e + }, + setPropsInfo: function (e) { + this.model.propsInfo = e + }, + login: function (e, t) { + Dec.Utils.login(e, t) + }, + setNeedSlider: function (e) { + this.model.needSlider = e + } + } + }); + BI.model("dec.model.login.login", e) + }(), + function () { + var e = BI.inherit(BI.Widget, { + props: { + baseCls: "dec-login-single", + username: "" + }, + _store: function () { + return BI.Models.getModel("dec.model.login.single") + }, + watch: { + password: function (e) { + this.passwordCombo.setPassword(e) + } + }, + render: function () { + var t = this; + this.options; + return { + type: "bi.absolute", + items: [{ + el: { + type: "bi.horizontal_auto", + items: [{ + el: { + type: "bi.absolute", + height: 24, + items: [{ + el: { + type: "bi.label", + height: 24, + text: BI.i18nText("Dec-Login_Change_Password") + }, + top: 0, + left: 0, + right: 0, + bottom: 0 + }, { + el: { + type: "bi.icon_button", + height: 24, + cls: "login-back-font", + handler: function () { + t.fireEvent("EVENT_BACK") + } + }, + top: 0, + left: 0 + }] + }, + vgap: 28 + }, { + type: "bi.label", + text: this.model.showDesc, + whiteSpace: "normal", + invisible: !this.model.showDesc, + bgap: 15 + }, { + type: "dec.login.item", + iconCls: "login-password-font", + bgap: 10, + watermark: BI.i18nText("Dec-Login_Old_Password"), + inputType: "password", + ref: function (e) { + t.oldPasswordRow = e + } + }, { + type: "bi.absolute", + height: 60, + items: [{ + el: { + type: "dec.login.item", + iconCls: "login-new-password-font", + watermark: BI.i18nText("Dec-Login_New_Password"), + inputType: "password", + ref: function (e) { + t.passwordRow = e + }, + listeners: [{ + eventName: "EVENT_CHANGE", + action: function () { + t.store.setPassword(this.getValue()) + } + }, { + eventName: "EVENT_FOCUS", + action: function () { + t.passwordCombo.setVisible(!0) + } + }, { + eventName: "EVENT_BLUR", + action: function () { + t.passwordCombo.setVisible(!1), t.passwordCombo.isValid() || t.passwordRow.showErrorText(BI.i18nText("Dec-Error_Password_Strength_Not")) + } + }] + }, + top: 0, + left: 0, + right: 0, + bottom: 0 + }, { + el: { + type: "dec.password.strength", + invisible: !0, + adjustHeight: 36, + ref: function (e) { + t.passwordCombo = e + } + }, + top: 0, + left: 190 + }] + }, { + type: "dec.login.item", + iconCls: "login-confirm-password-font", + watermark: BI.i18nText("Dec-Login_Re_New_Password"), + inputType: "password", + ref: function (e) { + t.rePassswordRow = e + } + }, { + type: "bi.horizontal_auto", + items: [{ + type: "bi.button", + $testId: "dec-login-single-btn", + cls: "login-button", + text: BI.i18nText("BI-Basic_Sure"), + width: 190, + height: 40, + handler: function () { + t._start() + } + }] + }] + }, + top: 0, + right: 40, + bottom: 0, + left: 40 + }] + } + }, + _start: function () { + var t = this, + e = this.oldPasswordRow.getValue(), + i = this.passwordRow.getValue(), + o = this.rePassswordRow.getValue(); + "" !== e ? "" !== i ? this.passwordCombo.isValid() ? "" !== o ? i === o ? i !== e ? this.store.changePwd({ + username: this.options.username, + oldPassword: BI.encode(e), + newPassword: BI.encode(i) + }, function (e) { + e.data && !t.model.isNeedVerify ? t.fireEvent("EVENT_SURE", i) : e.data && t.model.isNeedVerify ? (t.store.setPropsInfo({ + token: e.data, + isChangePwd: !1, + from: DecCst.Login.AuthenticationModule.LOGIN + }), t.store.setSelectedTab(DecCst.Login.Tabs.VERIFY_BING)) : e.errorCode === DecCst.ErrorCode.OLD_PASSWORD_ERROR ? t.oldPasswordRow.showError(BI.i18nText("Dec-Error_Old_Password_Error")) : e.errorCode === DecCst.ErrorCode.PASSWORD_SAME_ERROR ? t.oldPasswordRow.showError(BI.i18nText("Dec-Error_Password_Equal_Old")) : BI.Msg.toast(BI.i18nText("Dec-Login_Change_Password_Fail")) + }) : this.passwordRow.showError(BI.i18nText("Dec-Error_Password_Equal_Old")) : this.rePassswordRow.showError(BI.i18nText("Dec-Error_Password_Be_Equal")) : this.rePassswordRow.showError(BI.i18nText("Dec-Error_New_Password_Null")) : this.passwordRow.showErrorText(BI.i18nText("Dec-Error_Password_Strength_Not")) : this.passwordRow.showError(BI.i18nText("Dec-Error_New_Password_Null")) : this.oldPasswordRow.showError(BI.i18nText("Dec-Error_Old_Password_Null")) + } + }); + BI.shortcut("dec.login.single", e) + }(), + function () { + var e = BI.inherit(Fix.Model, { + context: ["selectedTab", "verifyConfig", "propsInfo"], + state: function () { + return { + password: "" + } + }, + computed: { + isNeedVerify: function () { + return this.model.verifyConfig.smsRemind || this.model.verifyConfig.emailRemind + }, + showDesc: function () { + switch (this.model.propsInfo.from) { + case DecCst.Login.AuthenticationModule.LOGIN: + return BI.i18nText("Dec-Login_Change_Password_Tip", BI.i18nText("Dec-Login_Authentication_Open")); + case DecCst.Login.AuthenticationModule.PWD_STRENGTH: + return BI.i18nText("Dec-Login_Change_Password_Strength_Tip"); + case DecCst.Login.AuthenticationModule.PWD_UPDATE: + return BI.i18nText("Dec-Login_Change_Password_Update_Tip"); + case DecCst.Login.AuthenticationModule.SINGLE: + default: + return "" + } + } + }, + actions: { + changePwd: function (e, t) { + Dec.Utils.loginChangePwd(e, t) + }, + setSelectedTab: function (e) { + this.model.selectedTab = e + }, + setPropsInfo: function (e) { + this.model.propsInfo = e + }, + setPassword: function (e) { + this.model.password = e + } + } + }); + BI.model("dec.model.login.single", e) + }(), + function () { + var e = BI.inherit(BI.Widget, { + props: { + baseCls: "", + username: "", + pwd: "", + loginValidity: "" + }, + _store: function () { + return BI.Models.getModel("dec.model.login.password.success") + }, + watch: {}, + render: function () { + var t = this; + this.options; + return { + type: "bi.absolute", + items: [{ + el: { + type: "bi.vertical", + items: [{ + type: "bi.vertical", + cls: "password-success-icon", + items: [{ + type: "bi.icon", + height: 96, + width: 96 + }, { + type: "bi.label", + tgap: 5, + text: BI.i18nText("Dec-Login_Change_Password_Success") + }] + }, { + el: { + type: "bi.button", + $testId: "dec-login-btn", + cls: "login-button", + text: BI.i18nText("Dec-Login_Now"), + width: 190, + height: 40, + handler: function () { + t._login() + } + }, + tgap: 60 + }, { + type: "bi.label", + text: "", + tgap: 15, + disabled: !0, + textAlign: "left", + ref: function (e) { + t.autoLogin = e + } + }] + }, + top: 40, + right: 40, + bottom: 0, + left: 40 + }] + } + }, + mounted: function () { + this._autoLogin() + }, + _autoLogin: function () { + var e = this, + t = 0, + i = window.setInterval(function () { + if (3 === t) return window.clearInterval(i), void e._login(); + e.autoLogin.setText(3 - t + "s" + BI.i18nText("Dec-Login_Auto_Time")), t++ + }, 1e3) + }, + _login: function () { + var t = this, + e = this.options; + this.store.login({ + username: e.username, + password: e.pwd, + validity: e.loginValidity, + origin: Dec.Utils.getUrlQuery("origin") + }, function (e) { + e.data ? t.fireEvent("EVENT_LOGIN", e.data) : BI.Msg.toast(BI.i18nText("Dec-Login_Fail"), { + level: "error" + }) + }) + } + }); + BI.shortcut("dec.login.password.success", e) + }(), + function () { + var e = BI.inherit(Fix.Model, { + context: ["propsInfo", "loginInfo"], + state: function () { + return {} + }, + computed: {}, + actions: { + login: function (e, t) { + Dec.Utils.login(e, t) + }, + tokenLogin: function (e, t) { + BI.Services.getService("dec.service.login").useTokenLoginValue(e, this.model.loginInfo.validity, t) + } + } + }); + BI.model("dec.model.login.password.success", e) + }(), + function () { + var e = BI.inherit(BI.Widget, { + props: { + baseCls: "" + }, + _store: function () { + return BI.Models.getModel("dec.model.login.password.success") + }, + watch: {}, + render: function () { + var t = this; + this.options; + return { + type: "bi.absolute", + items: [{ + el: { + type: "bi.vertical", + items: [{ + type: "bi.vertical", + cls: "password-success-icon", + items: [{ + type: "bi.icon", + height: 96, + width: 96 + }, { + type: "bi.label", + text: BI.i18nText("Dec-Login_Change_Password_Success") + }] + }, { + el: { + type: "bi.button", + $testId: "dec-login-btn", + cls: "login-button", + text: BI.i18nText("Dec-Login_Now"), + width: 190, + height: 40, + handler: function () { + t._login() + } + }, + tgap: 60 + }, { + type: "bi.label", + text: "", + tgap: 15, + disabled: !0, + textAlign: "left", + ref: function (e) { + t.autoLogin = e + } + }] + }, + top: 40, + right: 40, + bottom: 0, + left: 40 + }] + } + }, + mounted: function () { + this._autoLogin() + }, + _autoLogin: function () { + var e = this, + t = 0, + i = window.setInterval(function () { + if (3 === t) return window.clearInterval(i), void e._login(); + e.autoLogin.setText(3 - t + "s" + BI.i18nText("Dec-Login_Auto_Time")), t++ + }, 1e3) + }, + _login: function () { + var t = this; + this.store.tokenLogin(this.model.propsInfo.token, function (e) { + e.data ? t.fireEvent("EVENT_LOGIN", e.data) : BI.Msg.toast(BI.i18nText("Dec-Login_Fail"), { + level: "error" + }) + }) + } + }); + BI.shortcut("dec.login.password.token", e) + }(), + function () { + var e = BI.inherit(BI.Widget, { + props: { + baseCls: "" + }, + _store: function () { + return BI.Models.getModel("dec.model.login.verify") + }, + watch: {}, + beforeInit: function (e) { + this.store.initPage(e) + }, + render: function () { + var e = this; + this.options; + return { + type: "bi.absolute", + items: [{ + el: { + type: "bi.horizontal_auto", + items: [{ + el: { + type: "bi.absolute", + height: 24, + items: [{ + el: { + type: "bi.label", + height: 24, + text: BI.i18nText("Dec-Login_Authentication") + }, + top: 0, + left: 0, + right: 0, + bottom: 0 + }, { + el: { + type: "bi.icon_button", + height: 24, + cls: "login-back-font", + handler: function () { + e.store.setSelectedTab(DecCst.Login.Tabs.LOGIN) + } + }, + top: 0, + left: 0 + }] + }, + vgap: 28 + }, { + type: "bi.label", + text: this.model.showDesc, + textAlign: "left", + whiteSpace: "normal", + tgap: 40, + bgap: 30 + }, { + type: "bi.horizontal_auto", + items: [{ + type: "bi.button", + $testId: "dec-login-verify-btn", + cls: "login-button", + text: BI.i18nText("BI-Basic_Sure"), + width: 190, + height: 40, + handler: function () { + e.store.setSelectedTab(DecCst.Login.Tabs.LOGIN) + } + }] + }] + }, + top: 0, + right: 40, + bottom: 0, + left: 40 + }] + } + } + }); + BI.shortcut("dec.login.verify", e) + }(), + function () { + var e = BI.inherit(Fix.Model, { + _init: function () { + this.loginConfigInfo = Dec.loginConfig || {} + }, + context: ["loginInfo", "propsInfo", "selectedTab", "verifyConfig"], + state: function () { + return {} + }, + computed: { + platformTitle: function () { + return this.loginConfigInfo.loginTitle || BI.i18nText("Dec-Decision") + }, + supportType: function () { + var e = [], + t = this.model.verifyConfig; + return this.model.propsInfo.isChangePwd ? (t.smsVerificationAfterChangePassword && e.push(DecCst.Login.AuthenticationWay.PHOME), t.emailVerificationAfterChangePassword && e.push(DecCst.Login.AuthenticationWay.EMAIL)) : (t.smsRemind && e.push(DecCst.Login.AuthenticationWay.PHOME), t.emailRemind && e.push(DecCst.Login.AuthenticationWay.EMAIL)), e + }, + openService: function () { + return BI.map(this.model.supportType, function (e, t) { + return BI.i18nText(t === DecCst.Login.AuthenticationWay.PHOME ? "Dec-User_Mobile" : "Dec-User_Email") + }).join(BI.i18nText("BI-Basic_Or")) + }, + showDesc: function () { + switch (this.model.propsInfo.from) { + case DecCst.Login.AuthenticationModule.SINGLE: + return BI.i18nText("Dec-Login_Verify_Password_Single_Tip", this.model.openService); + case DecCst.Login.AuthenticationModule.LOGIN: + return BI.i18nText("Dec-Login_Verify_Tip", this.model.openService); + case DecCst.Login.AuthenticationModule.PWD_STRENGTH: + return BI.i18nText("Dec-Login_Verify_Password_Strength_Tip", this.model.openService); + case DecCst.Login.AuthenticationModule.PWD_UPDATE: + return BI.i18nText("Dec-Login_Verify_Password_Update_Tip", this.model.openService); + default: + return "" + } + } + }, + actions: { + initPage: function (t) { + var i = this; + Dec.Utils.loginGetValidationTool(this.model.propsInfo.token, function (e) { + i._isBind(e, i.model.supportType) ? (i.setPropsInfo({ + phone: e.mobile, + email: e.email, + isChangePwd: i.model.propsInfo.isChangePwd, + token: i.model.propsInfo.token, + from: i.model.propsInfo.from + }), i.setSelectedTab(DecCst.Login.Tabs.AUTHENTICATION)) : t() + }) + }, + setSelectedTab: function (e) { + this.model.selectedTab = e + }, + setPropsInfo: function (e) { + this.model.propsInfo = e + } + }, + _isBind: function (e, t) { + return !!e.mobile && BI.contains(t, DecCst.Login.AuthenticationWay.PHOME) || !!e.email && BI.contains(t, DecCst.Login.AuthenticationWay.EMAIL) + } + }); + BI.model("dec.model.login.verify", e) + }(), + function () { + var e = BI.inherit(BI.Widget, { + props: { + baseCls: "" + }, + _store: function () { + return BI.Models.getModel("dec.model.login.slider.image") + }, + watch: { + imageObj: function (e) { + this.bgImg.setSrc(Dec.fineServletURL + "/login/image/" + e.imageId), this.moveBlock.setSrc(Dec.fineServletURL + "/login/image/" + e.moduleId), this.moveBlock.element.css({ + left: e.modelX, + top: e.modelY + }) + }, + loading: function (e) { + this.loadingBar.setVisible(e) + } + }, + render: function () { + var t = this; + this.options; + return { + type: "bi.absolute", + cls: "bi-card", + width: 190, + items: [{ + el: { + type: "bi.img", + height: 117, + ref: function (e) { + t.bgImg = e + } + }, + top: 0, + bottom: 0, + left: 0, + right: 0 + }, { + el: { + type: "bi.img", + width: 30, + height: 30, + ref: function (e) { + t.moveBlock = e + } + }, + top: 0, + left: 0 + }, { + el: { + type: "bi.icon_button", + cls: "rollback-font", + width: 16, + height: 16, + handler: function () { + t.fireEvent("EVENT_REFRESH"), t.refresh() + } + }, + top: 10, + right: 10 + }, { + el: { + type: "bi.center_adapt", + invisible: this.model.loadingBar, + height: 117, + cls: "bi-card bi-border upload-loading-icon", + items: [{ + type: "bi.vertical", + items: [{ + type: "bi.icon", + width: 46, + height: 46 + }, { + type: "bi.label", + tgap: 5, + text: BI.i18nText("Dec-Basic_Loading") + }] + }], + ref: function (e) { + t.loadingBar = e + } + }, + top: 0, + bottom: 0, + left: 0, + right: 0 + }] + } + }, + mounted: function () { + BI.isEmptyObject(this.model.imageObj) && this.refresh() + }, + move: function (e) { + this.moveBlock.element.css({ + left: e + }) + }, + refresh: function () { + this.store.getImage() + }, + changeState: function (e) { + e && this.setVisible(e); + var t = this; + t.element.stop().animate({ + height: e ? 140 : 0 + }, "800", function () { + !e && t.setVisible(!1) + }) + } + }); + BI.shortcut("dec.login.slider.image", e) + }(), + function () { + var e = BI.inherit(Fix.Model, { + context: ["sliderToken", "loading"], + state: function () { + return { + imageObj: {} + } + }, + watch: { + imageObj: function () { + var e = this; + BI.delay(function () { + e.setLoading(!1) + }, 300) + } + }, + actions: { + getImage: function () { + var t = this; + this.model.loading || (this.model.loading = !0, Dec.Utils.getLoginSliderInfo(function (e) { + t.model.imageObj = e, t.model.sliderToken = e.sliderToken + })) + }, + setLoading: function (e) { + this.model.loading = e + } + } + }); + BI.model("dec.model.login.slider.image", e) + }(), + function () { + var i = BI.inherit(BI.Widget, { + props: { + baseCls: "bi-icon-combo", + $testId: "bi-icon-combo", + width: 28, + height: 24, + el: {}, + popup: {}, + minWidth: 100, + maxWidth: "auto", + maxHeight: 300, + direction: "bottom", + adjustLength: 3, + adjustXOffset: 0, + adjustYOffset: 0, + offsetStyle: "left", + chooseType: BI.ButtonGroup.CHOOSE_TYPE_SINGLE + }, + render: function () { + var t = this, + e = this.options; + return this.trigger = BI.createWidget(e.el, { + type: "dec.icon_combo_trigger", + iconCls: e.iconCls, + title: e.title, + items: e.items, + width: e.width, + height: e.height, + iconWidth: e.iconWidth, + iconHeight: e.iconHeight, + value: e.value + }), this.popup = BI.createWidget(e.popup, { + type: "bi.icon_combo_popup", + chooseType: e.chooseType, + items: e.items, + value: e.value, + listeners: [{ + eventName: BI.IconComboPopup.EVENT_CHANGE, + action: function () { + t.setValue(t.popup.getValue()), t.iconCombo.hideView(), t.fireEvent(i.EVENT_CHANGE) + } + }] + }), { + type: "bi.combo", + direction: e.direction, + trigger: e.trigger, + container: e.container, + adjustLength: e.adjustLength, + adjustXOffset: e.adjustXOffset, + adjustYOffset: e.adjustYOffset, + offsetStyle: e.offsetStyle, + el: this.trigger, + popup: { + el: this.popup, + maxWidth: e.maxWidth, + maxHeight: e.maxHeight, + minWidth: e.minWidth + }, + ref: function (e) { + t.iconCombo = e + } + } + }, + showView: function () { + this.iconCombo.showView() + }, + hideView: function () { + this.iconCombo.hideView() + }, + setValue: function (e) { + this.trigger.setValue(e), this.popup.setValue(e) + }, + getValue: function () { + var e = this.popup.getValue(); + return BI.isNull(e) ? [] : BI.isArray(e) ? e : [e] + }, + populate: function (e) { + this.options.items = e, this.iconCombo.populate(e) + } + }); + i.EVENT_CHANGE = "EVENT_CHANGE", BI.shortcut("dec.icon_combo", i) + }(), + function () { + var e = BI.inherit(BI.Trigger, { + props: { + extraCls: "bi-icon-combo-trigger", + el: {}, + items: [], + iconCls: "", + width: 28, + height: 24, + isShowDown: !0, + value: "" + }, + render: function () { + var e = this.options, + t = this, + i = ""; + return BI.isKey(e.value) && (i = this._digest(e.value, e.items)), { + type: "bi.absolute", + items: [{ + el: { + type: "bi.icon_change_button", + cls: "icon-combo-trigger-icon", + iconCls: i, + disableSelected: !0, + width: e.width - 10, + height: e.height, + iconWidth: e.iconWidth, + iconHeight: e.iconHeight, + selected: BI.isNotEmptyString(i), + ref: function (e) { + t.button = e + } + }, + left: 0, + right: 0, + top: 0, + bottom: 0 + }, { + el: { + type: "bi.icon_button", + disableSelected: !0, + cls: "icon-combo-down-icon login-trigger-font", + width: 10, + height: 10, + invisible: !e.isShowDown, + selected: BI.isNotEmptyString(i), + ref: function (e) { + t.down = e + } + }, + right: 0, + bottom: 0 + }] + } + }, + _digest: function (i, e) { + var o = ""; + return i = BI.isArray(i) ? i[0] : i, BI.any(e, function (e, t) { + if (i === t.value) return o = t.iconCls, !0 + }), o + }, + populate: function (e) { + var t = this.options; + this.options.items = e || [], this.button.setIcon(t.iconCls), this.button.setSelected(!1), this.down.setSelected(!1) + }, + setValue: function (e) { + var t = this.options; + e = BI.isArray(e) ? e[0] : e; + var i = this._digest(e, this.options.items); + BI.isNotEmptyString(i) ? (this.button.setIcon(i), this.button.setSelected(!0), this.down.setSelected(!0)) : (this.button.setIcon(t.iconCls), this.button.setSelected(!1), this.down.setSelected(!1)) + } + }); + BI.shortcut("dec.icon_combo_trigger", e) + }(), + function () { + var i = BI.inherit(BI.Widget, { + props: { + baseClass: "bi-text-value-combo", + $testId: "bi-text-value-combo", + height: 30, + chooseType: BI.ButtonGroup.CHOOSE_TYPE_SINGLE, + text: "", + value: "" + }, + render: function () { + var t = this, + e = this.options; + return { + type: "bi.combo", + adjustLength: 0, + el: { + type: "dec.login.icon_select_text_trigger", + items: e.items, + height: e.height, + text: e.text, + value: e.value, + ref: function (e) { + t.trigger = e + } + }, + popup: { + el: { + type: "bi.text_value_combo_popup", + chooseType: e.chooseType, + value: e.value, + items: e.items, + listeners: [{ + eventName: "EVENT_CHANGE", + action: function () { + t.setValue(t.popup.getValue()), t.textIconCombo.hideView(), t.fireEvent(i.EVENT_CHANGE, arguments) + } + }], + ref: function (e) { + t.popup = e + } + }, + maxHeight: 300 + }, + ref: function (e) { + t.textIconCombo = e + }, + listeners: [{ + eventName: BI.Combo.EVENT_BEFORE_POPUPVIEW, + action: function () { + t.trigger.setIsPopup(!0) + } + }, { + eventName: BI.Combo.EVENT_AFTER_HIDEVIEW, + action: function () { + t.trigger.setIsPopup(!1) + } + }] + } + }, + setValue: function (e) { + this.trigger.setValue(e), this.popup.setValue(e) + }, + getValue: function () { + var e = this.popup.getValue(); + return BI.isNull(e) ? [] : BI.isArray(e) ? e : [e] + }, + populate: function (e) { + this.options.items = e, this.textIconCombo.populate(e) + } + }); + i.EVENT_CHANGE = "EVENT_CHANGE", BI.shortcut("dec.login.text_value_combo", i) + }(), + function () { + var e = BI.inherit(BI.Trigger, { + props: { + baseCls: "bi-select-text-trigger dec-icon-select-text-trigger", + height: 24 + }, + render: function () { + this.options.height -= 2; + var t = this, + e = this.options; + return { + type: "bi.htape", + cls: "bi-border-bottom", + items: [{ + type: "bi.center_adapt", + width: 16, + cls: "item-icon login-username-font", + items: [{ + type: "bi.icon" + }] + }, { + type: "bi.label", + textAlign: "left", + height: e.height, + text: e.text, + title: function () { + return t.text.getText() + }, + rgap: 4, + lgap: 6, + readonly: e.readonly, + ref: function (e) { + t.text = e + } + }, { + type: "bi.center_adapt", + width: 16, + cls: "trigger", + items: [{ + type: "bi.icon_change_button", + iconCls: "pull-down-font", + forceNotSelected: !0, + ref: function (e) { + t.iconChangeButton = e + } + }] + }] + } + }, + _digest: function (i, e) { + var t = this.options; + i = BI.isArray(i) ? i : [i]; + var o = [], + n = BI.Tree.transformToArrayFormat(e); + return BI.each(n, function (e, t) { + BI.deepContains(i, t.value) && !BI.contains(o, t.text || t.value) && o.push(t.text || t.value) + }), 0 < o.length ? o.join(",") : t.text + }, + setValue: function (e) { + this.text.setText(this._digest(e, this.options.items)) + }, + setIsPopup: function (e) { + var t = e ? "pull-up-font" : "pull-down-font"; + this.iconChangeButton.setIcon(t) + }, + populate: function (e) { + this.options.items = e + } + }); + BI.shortcut("dec.login.icon_select_text_trigger", e) + }(), BI.constant("dec.constant.password.strength", [{ + id: "passwordLengthLimit", + text: BI.i18nText("Dec-System_Password_Strength_Length_More"), + check: function (e, t) { + return BI.size(e) >= t + } +}, { + id: "includeNumbers", + text: BI.i18nText("BI-Basic_Contain") + BI.i18nText("Dec-Basic_Digit"), + check: function (e) { + return /\d+/.test(e) + } +}, { + id: "includeLowercaseLetters", + text: BI.i18nText("BI-Basic_Contain") + BI.i18nText("Dec-Basic_Lowercase"), + check: function (e) { + return /[a-z]+/.test(e) + } +}, { + id: "includeCapitalLetters", + text: BI.i18nText("BI-Basic_Contain") + BI.i18nText("Dec-Basic_Capital"), + check: function (e) { + return /[A-Z]+/.test(e) + } +}, { + id: "includeSymbol", + text: BI.i18nText("BI-Basic_Contain") + BI.i18nText("Dec-Basic_Symbol"), + check: function (e) { + return /[^a-zA-Z0-9]+/.test(e) + } +}]), + function () { + var e = BI.inherit(BI.Widget, { + props: { + baseCls: "", + text: "" + }, + render: function () { + var t = this; + return { + type: "bi.vertical_adapt", + items: [{ + type: "bi.icon_change_button", + iconCls: "password-check-font", + iconHeight: 16, + ref: function (e) { + t.icon = e + } + }, { + type: "bi.label", + height: 16, + lgap: 5, + text: this.options.text + }] + } + }, + changeIcon: function (e) { + this.icon.setIcon(e ? "password-check-success-font" : "password-check-font") + } + }); + BI.shortcut("dec.password.strength.item", e) + }(), + function () { + var e = BI.inherit(BI.Widget, { + props: { + baseCls: "dec-password-strength", + $testId: "dec-password-strength", + adjustHeight: 0 + }, + _store: function () { + return BI.Models.getModel("dec.model.password.strength") + }, + watch: { + password: function (i) { + var o = this; + BI.each(this.model.needCheckItems, function (e, t) { + o[t.id].changeIcon(t.check(i, o.model.passwordStrength.passwordLength)) + }) + } + }, + beforeInit: function (e) { + this.store.initPage(e) + }, + render: function () { + var i = this, + e = this.options, + t = (26 * this.model.checkItemsLength + 12 - e.adjustHeight) / 2; + return { + type: "bi.absolute", + items: [{ + el: { + type: "bi.vertical", + cls: "list-view-shadow bi-card", + vgap: 10, + hgap: 15, + items: BI.map(this.model.needCheckItems, function (e, t) { + return { + type: "dec.password.strength.item", + height: 16, + text: "passwordLengthLimit" === t.id ? BI.i18nText("Dec-System_Password_Strength_Length_More", i.model.passwordStrength.passwordLength) : t.text, + ref: function (e) { + i[t.id] = e + } + } + }) + }, + top: -t + }, { + el: { + type: "bi.center_adapt", + invisible: 0 === this.model.checkItemsLength, + cls: "triangle-wrapper", + items: [{ + type: "bi.layout", + cls: "bubble-combo-triangle-left" + }] + }, + top: e.adjustHeight / 2 - 3, + left: -5 + }] + } + }, + setPassword: function (e) { + this.store.setPassword(e) + }, + isValid: function () { + return this.model.isValid + } + }); + BI.shortcut("dec.password.strength", e) + }(), + function () { + var e = BI.inherit(Fix.Model, { + state: function () { + return { + passwordStrength: {}, + password: "" + } + }, + computed: { + needCheckItems: function () { + var i = this; + return this.model.passwordStrength.passwordStrengthLimit ? BI.filter(BI.Constants.getConstant("dec.constant.password.strength"), function (e, t) { + return i.model.passwordStrength[t.id] + }) : [] + }, + checkItemsLength: function () { + return BI.size(this.model.needCheckItems) + }, + isValid: function () { + var i = this.model.password, + o = this.model.passwordStrength.passwordLength; + return !BI.some(this.model.needCheckItems, function (e, t) { + return !t.check(i, o) + }) + } + }, + actions: { + initPage: function (t) { + var i = this; + Dec.Utils.getLoginPasswordStrategy(function (e) { + i.model.passwordStrength = e, t() + }) + }, + setPassword: function (e) { + this.model.password = e + } + } + }); + BI.model("dec.model.password.strength", e) + }(); diff --git a/src/main/resources/com/fr/plugin/web/js/meixin.js b/src/main/resources/com/fr/plugin/web/js/meixin.js new file mode 100644 index 0000000..0acded4 --- /dev/null +++ b/src/main/resources/com/fr/plugin/web/js/meixin.js @@ -0,0 +1,3632 @@ + +console.info("xxxx启动"); +( + function () { + !function () { + Dec.Zch || (Dec.Zch = {}), Dec.Zch.Util = Dec.Zch.Util || {}; + var i = "com.fr.plugin.xxxx.10", s = s || function (e, t) { + return e && "/" === e[0] || (e = "/" + e), !0 === t ? Dec.fineServletURL + "/plugin/public/" + i + e : Dec.fineServletURL + "/plugin/private/" + i + e + }; + BI.extend(Dec.Zch.Util, { + ajax: function (e) { + if (e instanceof Object) { + var n = void 0 !== e.isPublic && e.isPublic; + if (!n) { + var t = BI.Cache.getCookie(DecCst.Cookie.TOKEN); + t && (e.headers = e.headers || {}, e.headers.Authorization = "Bearer " + t) + } + var i = s(e.url, n) || "", a = e.type || "POST", r = e.data || {}, + o = BI.isFunction(e.complete) ? e.complete : BI.emptyFn; + $.ajax({ + url: i, headers: e.headers, data: BI.cjkEncodeDO(r), type: a, complete: function (e, t) { + if ("success" === t) { + var i = BI.jsonDecode(e.responseText); + if (!n && BI.contains([DecCst.ErrorCode.LOGIN_INFO_NOT_AVAILABLE, DecCst.ErrorCode.LOGIN_INFO_ERROR], i.errorCode)) return void BI.Services.getService("dec.service.main").loginKick(i.errorCode); + o.apply(this, [e, t]) + } else Dec.Msg.alert({message: BI.i18nText("FS-Zch_NetWork-Anomaly")}), o.apply(this, [e, t]) + } + }) + } + }, reqWithLoading: function (e) { + var i, n = BI.Constants.getConstant("zch.constants").popup_loading_syn_users, + a = Dec.Zch.Util.showLoading(".weixin-member-management-container", BI.i18nText("FS-Zch_Loading"), n), + t = (i = e && e.complete, function (e, t) { + a.remove(n), BI.isFunction(i) && i(e, t) + }); + e && (e.complete = t), this.ajax(e) + }, handleCommonErr: function (e) { + return BI.i18nText(Dec.Zch.ERRORCODE[e.errorCode]) + }, _generateWeiXinApiErrorLabel: function (e, t) { + return e + "," + BI.i18nText("FS-Zch_ErrorCode") + "-" + t.errcode + "," + BI.i18nText("FS-Zch_ErrorMsg") + "-" + t.errmsg + "," + BI.i18nText("FS-Zch_Solution") + "-https://open.work.weixin.qq.com/devtool/query" + } + }) + }(), Dec.Zch || (Dec.Zch = {}), BI.extend(Dec.Zch.Util, { + replaceDepartmentArrToString: function (e) { + // for (var t = "", i = 0; i < e.departmentName.length; i++) t += e.departmentName[i], i !== e.departmentName.length - 1 && (t += ","); + return e.departmentName + }, formatTableStyle: function () { + $(".weixin-table").find("table").css("border", "0"), $(".weixin-table").find("td").css("border", "0"), $(".weixin-table").find("td").css("border-bottom", "1px solid #EAF2FD") + }, alert: function (e) { + var t = BI.Constants.getConstant("zch.constants").popup_alert, i = BI.extend(e, { + type: "zch.alert.popover", listeners: [{ + eventName: "EVENT_CLOSE", action: function () { + BI.Popovers.remove(t) + } + }] + }); + BI.Popovers.create(t, { + cls: "weixin-container", + header: { + type: "bi.left_vertical_adapt", + hgap: 5, + items: [{type: "bi.label", forceCenter: !0, text: BI.i18nText("FS-Zch_Hint")}] + }, + body: i, + width: 455, + height: 245 + }).open(t) + }, synMemberData: function (n) { + var a = this; + n = n || null; + var r = BI.Constants.getConstant("zch.constants").popup_loading_syn_users, + o = a.showLoading(".weixin-member-management-container", BI.i18nText("FS-Zch_Loading"), r); + Dec.Zch.Util.ajax({ + url: "/zch/syn/member", type: "POST", complete: function (e, t) { + if (o.remove(r), "success" === t) { + var i = BI.jsonDecode(e.responseText); + a.handleCommonErr(i) ? a.alert({label: a.handleCommonErr(i)}) : BI.isFunction(n) && n.call(a) + } + } + }) + }, showLoading: function (e, t, i) { + var n = new Dec.Zch.LoadingPopupController({render: e}); + return n.create(i, { + body: { + type: "bi.center_adapt", + items: [{ + width: 96, + type: "bi.vertical", + vgap: 20, + items: [{ + type: "bi.img", + width: 96, + height: 96, + src: Dec.fineServletURL + "/resources?path=/com/fr/plugin/web/images/2x/icon/loading.gif" + }, {type: "bi.label", width: 96, height: 12, text: t}] + }] + } + }).open(i), n + }, showResultAlert: function (e, t, i, n) { + Dec.Zch.ResultAlert = new Dec.Zch.LoadingPopupController({render: e}); + var a = Dec.fineServletURL + (i ? "/resources?path=/com/fr/plugin/web/images/2x/icon/icon_success.png" : "/resources?path=/com/fr/plugin/web/images/2x/icon/icon_fail.png"), + r = i ? {} : { + type: "bi.center_adapt", + items: [{ + type: "bi.button", + width: 80, + height: 24, + text: BI.i18nText("FS-Zch_Confirm"), + handler: function () { + Dec.Zch.Util.hideResultAlert(n) + } + }] + }; + Dec.Zch.ResultAlert.create(n, { + body: { + type: "bi.center_adapt", + items: [{ + type: "bi.vertical", + vgap: 20, + items: [{ + type: "bi.center_adapt", + items: [{type: "bi.img", width: 96, height: 96, src: a}] + }, { + type: "bi.center_adapt", + items: [{type: "bi.label", width: 200, height: 12, title: t, text: t}] + }, r] + }] + } + }).open(n) + }, hideResultAlert: function (e) { + Dec.Zch.ResultAlert && Dec.Zch.ResultAlert.remove(e) + }, checkUrlValid: function (e) { + return BI.startWith(e.toLowerCase(), "http") || BI.startWith(e.toLowerCase(), "https") + }, isEmpty: function (e) { + return "" === e || null == e + } + }), function () { + var e = BI.inherit(BI.Widget, { + props: { + width: 80, height: 24, text: "", copy: function () { + }, afterCopy: function () { + } + }, render: function () { + var e = this.options, t = BI.createWidget({ + type: "bi.clipboard", + width: e.width, + height: e.height, + element: this, + copy: function () { + return e.copy() + }, + afterCopy: function () { + e.afterCopy() + } + }); + BI.createWidget({type: "bi.button", width: e.width, height: e.height, text: e.text, element: t}) + } + }); + BI.shortcut("zch.clipboard.button", e) + }(), function () { + var i = BI.inherit(BI.Widget, { + _defaultConfig: function () { + return BI.extend(i.superclass._defaultConfig.apply(this, arguments), { + baseClass: "", + width: 100, + height: 24, + allowBlank: !0, + watermark: "", + editable: !1, + errorText: "" + }) + }, _init: function () { + i.superclass._init.apply(this, arguments); + var e = this, t = this.options; + this.trigger = BI.createWidget({ + type: "zch.editor_trigger", + items: t.items, + height: t.height, + allowBlank: t.allowBlank, + watermark: t.watermark, + editable: t.editable, + errorText: t.errorText, + value: t.value + }), this.trigger.on(BI.EditorTrigger.EVENT_CHANGE, function () { + e.popup.setValue(this.getValue()), e.fireEvent(i.EVENT_CHANGE, arguments) + }), this.popup = BI.createWidget({ + type: "bi.text_value_combo_popup", + value: t.value, + items: t.items + }), this.popup.on(i.EVENT_CHANGE, function () { + e.setValue(e.popup.getValue()), e.editorTextCombo.hideView(), e.fireEvent(i.EVENT_CHANGE, arguments) + }), this.popup.on(BI.Controller.EVENT_CHANGE, function () { + e.fireEvent(BI.Controller.EVENT_CHANGE, arguments) + }), this.editorTextCombo = BI.createWidget({ + type: "bi.combo", + element: this, + adjustLength: 2, + el: this.trigger, + popup: {el: this.popup, maxHeight: 300} + }) + }, setValue: function (e) { + this.editorTextCombo.setValue(e) + }, setText: function (e) { + this.trigger.setText(e) + }, getValue: function () { + return this.trigger.getValue() + }, populate: function (e) { + this.options.items = e, this.trigger.populate(e), this.editorTextCombo.populate(e) + } + }); + i.EVENT_CHANGE = "EVENT_CHANGE", BI.shortcut("zch.editor_text_value_combo", i) + }(), function () { + var i = BI.inherit(BI.Widget, { + props: {baseCls: "bi-search-text-value-combo", height: 30, text: "", items: []}, + render: function () { + var e = this, t = this.options; + return { + type: "bi.absolute", + cls: "weixin-search-combo-container", + items: [{ + el: { + type: "bi.combo", + adjustLength: 2, + toggle: !1, + ref: function () { + e.combo = this + }, + el: { + type: "zch.search_text_value_trigger", + ref: function () { + e.trigger = this + }, + items: t.items, + height: t.height - 2, + text: t.text, + value: t.value, + listeners: [{ + eventName: "EVENT_CHANGE", action: function () { + e.setValue(this.getValue()), e.combo.hideView(), e.fireEvent(i.EVENT_CHANGE) + } + }] + }, + popup: { + el: { + type: "bi.text_value_combo_popup", + chooseType: BI.ButtonGroup.CHOOSE_TYPE_SINGLE, + value: t.value, + items: t.items, + ref: function () { + e.popup = this, e.trigger.getSearcher().setAdapter(e.popup) + }, + listeners: [{ + eventName: BI.TextValueComboPopup.EVENT_CHANGE, action: function () { + e.setValue(this.getValue()), e.combo.hideView(), e.fireEvent(i.EVENT_CHANGE) + } + }] + }, maxHeight: 300 + }, + listeners: [{ + eventName: BI.Combo.EVENT_AFTER_HIDEVIEW, action: function () { + e.trigger.stopEditing() + } + }] + }, left: 0, right: 0, bottom: 0, top: 0 + }, { + el: { + type: "bi.trigger_icon_button", + cls: "weixin-search-combo-button", + width: t.height, + handler: function () { + e.combo.isViewVisible() ? e.combo.hideView() : e.combo.showView() + } + }, right: 0, bottom: 0, top: 0 + }] + } + }, + populate: function (e) { + this.options.items = e, this.combo.populate(e) + }, + setValue: function (e) { + this.combo.setValue(e) + }, + getValue: function () { + var e = this.popup.getValue(); + return BI.isNull(e) ? [] : BI.isArray(e) ? e : [e] + } + }); + i.EVENT_CHANGE = "EVENT_CHANGE", BI.shortcut("zch.search_text_value_combo", i) + }(), function () { + var e = BI.inherit(BI.Widget, { + props: {text: ""}, _store: function () { + return BI.Models.getModel("dec.model.mobile.combo.user") + }, render: function () { + var t = this, e = this.options; + return { + type: "bi.single_select_combo", + allowNoSelect: !0, + value: e.value, + text: e.text, + itemsCreator: BI.bind(this._itemsCreator, this), + width: e.width, + height: e.height, + ref: function (e) { + t.userCombo = e + }, + listeners: [{ + eventName: "EVENT_CONFIRM", action: function () { + var e = this.getValue(); + t.fireEvent("EVENT_CONFIRM", e) + } + }] + } + }, _itemsCreator: function (n, a) { + var r = this, e = this.options, t = n.keywords && n.keywords[0]; + n.type !== BI.SingleSelectCombo.REQ_GET_DATA_LENGTH ? n.times && this.store.getUsers(n.times, e.count, t, function (e, t) { + if (n.selectedValues) { + var i = BI.makeObject(n.selectedValues, !0); + e = BI.filter(e, function (e, t) { + return !i[t.username] + }) + } + a({items: r._processUserItems(e), hasNext: t}) + }) : a({}) + }, _processUserItems: function (e) { + return BI.map(e, function (e, t) { + return {type: "bi.text_item", textLgap: 10, value: t.username, cls: "bi-list-item"} + }) + }, getValue: function () { + return this.userCombo.getValue() + } + }); + BI.shortcut("zch.user.combo", e) + }(), BI.constant("zch.constants", { + department_tab_value: "departments", + tag_tab_value: "tags", + popup_create_agent: "create_agent", + popup_not_null: "popup_not_null", + popup_auto_update_member: "popup_auto_update_member", + popup_alert: "popup_alert", + popup_loading_syn_users: "popup_loading_syn_users", + popup_loading_configuration: "popup_loading_configuration", + popup_result_tip_popup: "popup_result_tip_popup", + weixin_agent_type_uneffected: -999, + weixin_agent_type_unknown: -998, + weixin_agent_type_corp: 2, + weixin_agent_type_management_group: 1, + job_start: 1, + job_process: 2, + job_finish: 3, + basic_property: 1, + single_login: 2, + push_message: 3, + matching_fs_way_user_id: 0, + matching_fs_way_mobile: 1, + matching_fs_way_custom: 2, + matching_fs_way_dataSet: 3 + }), BI.constant("zch.constants.management.tabs", [{ + text: BI.i18nText("FS-Zch_Agent_Management"), + value: "agent", + width: 78, + selected: !0 + } + + // , { + // text: BI.i18nText("FS-Zch_Member_Manage"), + // value: "member", + // width: 78 + // }, +// { +// text: BI.i18nText("FS-Zch_Agent_Config"), +// value: "config", +// width: 102 +// } + ]), BI.constant("zch.constants.agentmanagement.table.header", [[{ + text: "服务号名称", + baseCls: "", + cls: "weixin-table-header", + height: 33 + }, { + text: "服务号SysKey", + baseCls: "", + cls: "weixin-table-header", + height: 33 + }, { + text: "服务号秘钥", + baseCls: "", + cls: "weixin-table-header", + height: 33 + }, { + text: "操作", + baseCls: "", + cls: "weixin-table-header", + height: 33 + }]]), BI.constant("zch.constants.member.management.tabs", [{ + text: BI.i18nText("FS-Zch_Organizational_Structure"), + value: BI.Constants.getConstant("zch.constants").department_tab_value, + width: 100, + selected: !0 + } ]), BI.constant("zch.constants.member.management.table.header.fsusername", [[{ + text: "华发ID", + baseCls: "", + cls: "weixin-table-header", + height: 33 + }, { + text: BI.i18nText("FS-Zch_FSUserName"), + baseCls: "", + cls: "weixin-table-header", + height: 33 + }, { + text: BI.i18nText("FS-Zch_Name"), + baseCls: "", + cls: "weixin-table-header", + height: 33 + }, { + text: "华发部门", + baseCls: "", + cls: "weixin-table-header", + height: 33 + }, { + text: "手机号", + baseCls: "", + cls: "weixin-table-header", + height: 33 + }]]), BI.constant("zch.constants.member.management.table.header.nonfsusername", [[{ + text: BI.i18nText("FS-Zch_UserID"), + baseCls: "", + cls: "weixin-table-header", + height: 33 + }, { + text: BI.i18nText("FS-Zch_Name"), + baseCls: "", + cls: "weixin-table-header", + height: 33 + }, { + text: BI.i18nText("FS-Zch_Department"), + baseCls: "", + cls: "weixin-table-header", + height: 33 + }, { + text: BI.i18nText("FS-Zch_Mobile"), + baseCls: "", + cls: "weixin-table-header", + height: 33 + }]]), Dec.Zch || (Dec.Zch = {}), Dec.Zch.ERROR_CODE_OK = 0, Dec.Zch.ERROR_CODE_WEIXIN_API_ERR = 11205030, Dec.Zch.ERRORCODE = { + 11205011: "FS-Zch_Delete-Agent-Fail", + 11205012: "FS-Zch_Save-ReportServer-Url-Fail", + 11205013: "FS-Zch_Save_Agent_Fail", + 11205016: "FS-Zch_Management_Secret", + 11205018: "FS-Zch_Agent_Name_Exist", + 11205022: "FS-Zch_Unknown_Agent", + 11205023: "FS-Zch_Save-Proxy-Server-Url-Fail", + 11205024: "FS-Zch_NetWork-Anomaly", + 11205031: "FS-Zch_NetWork-Anomaly", + 11205032: "FS-Zch_Get-Agent-Fail", + 11205033: "FS-Zch_Get-Agent-Menu-Fail", + 11205034: "FS-Zch_Create-Agent-Menu-Fail", + 11205035: "FS-Zch_Tip-Get-ReportServer-Url-Fail" + }, function () { + var a = BI.inherit(BI.Widget, { + _defaultConfig: function () { + var e = a.superclass._defaultConfig.apply(this, arguments); + return BI.extend(e, { + baseCls: (e.baseCls || "") + " bi-sign-editor", + hgap: 4, + vgap: 2, + lgap: 0, + rgap: 0, + tgap: 0, + bgap: 0, + allowBlank: !0, + watermark: "", + errorText: "", + editable: !1, + height: 24, + items: [] + }) + }, _init: function () { + a.superclass._init.apply(this, arguments); + var t = this, e = this.options, i = "", n = BI.isArray(e.value) ? e.value[0] : e.value; + BI.each(e.items, function (e, t) { + t.value === n && (i = t.text) + }), this.editor = BI.createWidget({ + type: "bi.editor", + height: e.height, + hgap: e.hgap, + vgap: e.vgap, + lgap: e.lgap, + rgap: e.rgap, + tgap: e.tgap, + bgap: e.bgap, + value: i, + allowBlank: e.allowBlank, + watermark: e.watermark, + disabled: !e.editable, + errorText: e.errorText + }), this.text = BI.createWidget({ + type: "bi.text_button", + cls: "sign-editor-text", + title: e.title, + warningTitle: e.warningTitle, + tipType: e.tipType, + textAlign: "left", + height: e.height, + value: i, + hgap: 4, + handler: function () { + t.options.editable && (t._showInput(), t.editor.focus(), t.editor.selectAll()) + } + }), this.text.on(BI.TextButton.EVENT_CHANGE, function () { + BI.nextTick(function () { + t.fireEvent(a.EVENT_CLICK_LABEL) + }) + }), BI.createWidget({ + type: "bi.absolute", + element: this, + items: [{el: this.text, left: 0, right: 0, top: 0, bottom: 0}] + }), this.editor.on(BI.Controller.EVENT_CHANGE, function () { + t.fireEvent(BI.Controller.EVENT_CHANGE, arguments) + }), this.editor.on(BI.Editor.EVENT_FOCUS, function () { + t.fireEvent(a.EVENT_FOCUS, arguments) + }), this.editor.on(BI.Editor.EVENT_BLUR, function () { + t.fireEvent(a.EVENT_BLUR, arguments) + }), this.editor.on(BI.Editor.EVENT_CLICK, function () { + t.fireEvent(a.EVENT_CLICK, arguments) + }), this.editor.on(BI.Editor.EVENT_CHANGE, function () { + t.fireEvent(a.EVENT_CHANGE, arguments) + }), this.editor.on(BI.Editor.EVENT_KEY_DOWN, function (e) { + t.fireEvent(a.EVENT_KEY_DOWN, arguments) + }), this.editor.on(BI.Editor.EVENT_VALID, function () { + t.fireEvent(a.EVENT_VALID, arguments) + }), this.editor.on(BI.Editor.EVENT_CONFIRM, function () { + t._showHint(), t._checkText(), t.fireEvent(a.EVENT_CONFIRM, arguments) + }), this.editor.on(BI.Editor.EVENT_START, function () { + t.fireEvent(a.EVENT_START, arguments) + }), this.editor.on(BI.Editor.EVENT_PAUSE, function () { + t.fireEvent(a.EVENT_PAUSE, arguments) + }), this.editor.on(BI.Editor.EVENT_STOP, function () { + t.fireEvent(a.EVENT_STOP, arguments) + }), this.editor.on(BI.Editor.EVENT_SPACE, function () { + t.fireEvent(a.EVENT_SPACE, arguments) + }), this.editor.on(BI.Editor.EVENT_ERROR, function () { + t._checkText(), t.fireEvent(a.EVENT_ERROR, arguments) + }), this.editor.on(BI.Editor.EVENT_ENTER, function () { + t.fireEvent(a.EVENT_ENTER, arguments) + }), this.editor.on(BI.Editor.EVENT_RESTRICT, function () { + t.fireEvent(a.EVENT_RESTRICT, arguments) + }), this.editor.on(BI.Editor.EVENT_EMPTY, function () { + t.fireEvent(a.EVENT_EMPTY, arguments) + }), BI.createWidget({ + type: "bi.vertical", + scrolly: !1, + element: this, + items: [this.editor] + }), this._showHint(), t._checkText() + }, _checkText: function () { + var e = this.options; + BI.nextTick(BI.bind(function () { + "" === this.editor.getValue() ? (this.text.setValue(e.watermark || ""), this.text.element.addClass("bi-water-mark")) : (this.text.setValue(this.editor.getValue()), this.text.element.removeClass("bi-water-mark")) + }, this)) + }, _showInput: function () { + this.editor.visible(), this.text.invisible() + }, _showHint: function () { + this.editor.invisible(), this.text.visible() + }, setTitle: function (e) { + this.text.setTitle(e) + }, setWarningTitle: function (e) { + this.text.setWarningTitle(e) + }, focus: function () { + this._showInput(), this.editor.focus() + }, blur: function () { + this.editor.blur(), this._showHint(), this._checkText() + }, doRedMark: function () { + "" === this.editor.getValue() && BI.isKey(this.options.watermark) || this.text.doRedMark.apply(this.text, arguments) + }, unRedMark: function () { + this.text.unRedMark.apply(this.text, arguments) + }, doHighLight: function () { + "" === this.editor.getValue() && BI.isKey(this.options.watermark) || this.text.doHighLight.apply(this.text, arguments) + }, unHighLight: function () { + this.text.unHighLight.apply(this.text, arguments) + }, isValid: function () { + return this.editor.isValid() + }, setErrorText: function (e) { + this.editor.setErrorText(e) + }, getErrorText: function () { + return this.editor.getErrorText() + }, isEditing: function () { + return this.editor.isEditing() + }, getLastValidValue: function () { + return this.editor.getLastValidValue() + }, setValue: function (i) { + var n = this; + if (i = BI.isArray(i) ? i[0] : i, 0 === n.options.items.length) return n.editor.setValue(""), void n._checkText(); + BI.each(n.options.items, function (e, t) { + t.value === i && (n.editor.setValue(t.text), n._checkText()) + }) + }, getValue: function () { + for (var e = 0; e < this.options.items.length; e++) if (this.options.items[e].text === this.editor.getValue()) return this.options.items[e].value + }, setEditable: function (e) { + this.options.editable = e, this.editor.setEnable(e) + }, getEditable: function () { + return this.editor.isEnabled() + }, getState: function () { + return this.text.getValue() + }, setState: function (e) { + this._showHint(), this.text.setValue(e) + } + }); + a.EVENT_CHANGE = "EVENT_CHANGE", a.EVENT_FOCUS = "EVENT_FOCUS", a.EVENT_BLUR = "EVENT_BLUR", a.EVENT_CLICK = "EVENT_CLICK", a.EVENT_KEY_DOWN = "EVENT_KEY_DOWN", a.EVENT_CLICK_LABEL = "EVENT_CLICK_LABEL", a.EVENT_START = "EVENT_START", a.EVENT_PAUSE = "EVENT_PAUSE", a.EVENT_STOP = "EVENT_STOP", a.EVENT_CONFIRM = "EVENT_CONFIRM", a.EVENT_VALID = "EVENT_VALID", a.EVENT_ERROR = "EVENT_ERROR", a.EVENT_ENTER = "EVENT_ENTER", a.EVENT_RESTRICT = "EVENT_RESTRICT", a.EVENT_SPACE = "EVENT_SPACE", a.EVENT_EMPTY = "EVENT_EMPTY", BI.shortcut("zch.sign_editor", a) + }(), function () { + var i = BI.inherit(BI.Widget, { + _defaultConfig: function () { + var e = i.superclass._defaultConfig.apply(this, arguments); + return BI.extend(e, { + baseCls: (e.baseCls || "") + " bi-state-editor", + hgap: 4, + vgap: 2, + lgap: 0, + rgap: 0, + tgap: 0, + bgap: 0, + validationChecker: BI.emptyFn, + quitChecker: BI.emptyFn, + allowBlank: !0, + watermark: "", + errorText: "", + height: 24 + }) + }, _init: function () { + i.superclass._init.apply(this, arguments); + var t = this, e = this.options; + this.editor = BI.createWidget({ + type: "bi.editor", + height: e.height, + hgap: e.hgap, + vgap: e.vgap, + lgap: e.lgap, + rgap: e.rgap, + tgap: e.tgap, + bgap: e.bgap, + value: e.value, + validationChecker: e.validationChecker, + quitChecker: e.quitChecker, + allowBlank: e.allowBlank, + watermark: e.watermark, + errorText: e.errorText + }), this.text = BI.createWidget({ + type: "bi.text_button", + cls: "state-editor-infinite-text", + textAlign: "left", + height: e.height, + text: BI.i18nText("BI-Basic_Unrestricted"), + hgap: 4, + handler: function () { + t._showInput(), t.editor.focus(), t.editor.setValue("") + } + }), this.text.on(BI.TextButton.EVENT_CHANGE, function () { + BI.nextTick(function () { + t.fireEvent("EVENT_CLICK_LABEL") + }) + }), BI.createWidget({ + type: "bi.absolute", + element: this, + items: [{el: this.text, left: 0, right: 0, top: 0, bottom: 0}] + }), this.editor.on(BI.Controller.EVENT_CHANGE, function () { + t.fireEvent(BI.Controller.EVENT_CHANGE, arguments) + }), this.editor.on(BI.Editor.EVENT_FOCUS, function () { + t.fireEvent("EVENT_FOCUS", arguments) + }), this.editor.on(BI.Editor.EVENT_BLUR, function () { + t.fireEvent("EVENT_BLUR", arguments) + }), this.editor.on(BI.Editor.EVENT_CLICK, function () { + t.fireEvent("EVENT_CLICK", arguments) + }), this.editor.on(BI.Editor.EVENT_CHANGE, function () { + t.fireEvent("EVENT_CHANGE", arguments) + }), this.editor.on(BI.Editor.EVENT_KEY_DOWN, function (e) { + t.fireEvent("EVENT_KEY_DOWN", arguments) + }), this.editor.on(BI.Editor.EVENT_VALID, function () { + t.fireEvent("EVENT_VALID", arguments) + }), this.editor.on(BI.Editor.EVENT_CONFIRM, function () { + t._showHint(), t.fireEvent("EVENT_CONFIRM", arguments) + }), this.editor.on(BI.Editor.EVENT_START, function () { + t.fireEvent("EVENT_START", arguments) + }), this.editor.on(BI.Editor.EVENT_PAUSE, function () { + t.fireEvent("EVENT_PAUSE", arguments) + }), this.editor.on(BI.Editor.EVENT_STOP, function () { + t.fireEvent("EVENT_STOP", arguments) + }), this.editor.on(BI.Editor.EVENT_SPACE, function () { + t.fireEvent("EVENT_SPACE", arguments) + }), this.editor.on(BI.Editor.EVENT_ERROR, function () { + t.fireEvent("EVENT_ERROR", arguments) + }), this.editor.on(BI.Editor.EVENT_ENTER, function () { + t.fireEvent("EVENT_ENTER", arguments) + }), this.editor.on(BI.Editor.EVENT_RESTRICT, function () { + t.fireEvent("EVENT_RESTRICT", arguments) + }), this.editor.on(BI.Editor.EVENT_EMPTY, function () { + t.fireEvent("EVENT_EMPTY", arguments) + }), BI.createWidget({ + type: "bi.vertical", + scrolly: !1, + element: this, + items: [this.editor] + }), this._showHint(), BI.isNotNull(e.text) && this.setState(e.text) + }, doRedMark: function () { + "" === this.editor.getValue() && BI.isKey(this.options.watermark) || this.text.doRedMark.apply(this.text, arguments) + }, unRedMark: function () { + this.text.unRedMark.apply(this.text, arguments) + }, doHighLight: function () { + "" === this.editor.getValue() && BI.isKey(this.options.watermark) || this.text.doHighLight.apply(this.text, arguments) + }, unHighLight: function () { + this.text.unHighLight.apply(this.text, arguments) + }, focus: function () { + !1 === this.options.disabled && (this._showInput(), this.editor.focus()) + }, blur: function () { + this.editor.blur(), this._showHint() + }, _showInput: function () { + this.editor.visible(), this.text.invisible() + }, _showHint: function () { + this.editor.invisible(), this.text.visible() + }, isValid: function () { + return this.editor.isValid() + }, setErrorText: function (e) { + this.editor.setErrorText(e) + }, getErrorText: function () { + return this.editor.getErrorText() + }, isEditing: function () { + return this.editor.isEditing() + }, getLastValidValue: function () { + return this.editor.getLastValidValue() + }, setValue: function (e) { + this.editor.setValue(e) + }, getValue: function () { + return this.editor.getValue() + }, getState: function () { + return this.editor.getValue().match(/[^\s]+/g) + }, setState: function (e) { + if (i.superclass.setValue.apply(this, arguments), !BI.isNumber(e)) return BI.isString(e) ? (this.text.setText(e), this.text.setTitle(e), void this.text.element.removeClass("state-editor-infinite-text")) : void(BI.isArray(e) && (BI.isEmpty(e) ? (this.text.setText(BI.i18nText("BI-Basic_Unrestricted")), this.text.element.addClass("state-editor-infinite-text")) : (1 === e.length ? (this.text.setText(e[0]), this.text.setTitle(e[0])) : (this.text.setText(BI.i18nText("BI-Select_Part")), this.text.setTitle("")), this.text.element.removeClass("state-editor-infinite-text")))); + e === BI.Selection.All ? (this.text.setText(BI.i18nText("BI-Select_All")), this.text.setTitle(""), this.text.element.removeClass("state-editor-infinite-text")) : e === BI.Selection.Multi ? (this.text.setText(BI.i18nText("BI-Select_Part")), this.text.setTitle(""), this.text.element.removeClass("state-editor-infinite-text")) : (this.text.setText(BI.i18nText("BI-Basic_Unrestricted")), this.text.setTitle(""), this.text.element.addClass("state-editor-infinite-text")) + } + }); + BI.shortcut("zch.state_editor", i) + }(), Dec.Zch || (Dec.Zch = {}), Dec.Zch.LoadingPopupController = BI.inherit(BI.Controller, { + _defaultConfig: function () { + return BI.extend(Dec.Zch.LoadingPopupController.superclass._defaultConfig.apply(this, arguments), {render: "body"}) + }, _init: function () { + Dec.Zch.LoadingPopupController.superclass._init.apply(this, arguments), this.floatManager = {}, this.floatLayer = {}, this.floatContainer = {}, this.floatOpened = {}, this.zindex = BI.zIndex_popover, this.zindexMap = {} + }, _check: function (e) { + return BI.isNotNull(this.floatManager[e]) + }, create: function (e, t) { + if (this._check(e)) return this; + var i = BI.createWidget(t || {}, {type: "zch.loading.popup"}); + return this.add(e, i, t), this + }, add: function (e, t, i) { + return i || (i = {}), this._check(e) || (this.floatContainer[e] = BI.createWidget({ + type: "bi.absolute", + items: [{ + el: this.floatLayer[e] = BI.createWidget({type: "bi.absolute", items: [t]}), + left: 0, + right: 0, + top: 0, + bottom: 0 + }] + }), this.floatManager[e] = t, BI.createWidget({ + type: "bi.absolute", + element: i.container || this.options.render, + items: [{el: this.floatContainer[e], left: 0, right: 0, top: 0, bottom: 0}] + })), this + }, open: function (e) { + if (!this._check(e)) return this; + if (!this.floatOpened[e]) { + this.floatOpened[e] = !0; + var t = this.floatContainer[e]; + t.element.css("zIndex", this.zindex++), t.element.__hasZIndexMask__(this.zindexMap[e]) && t.element.__releaseZIndexMask__(this.zindexMap[e]), this.zindexMap[e] = this.zindex, t.element.__buildZIndexMask__(this.zindex++), this.get(e).setZindex(this.zindex++), this.floatContainer[e].visible(); + var i = this.get(e); + i.show && i.show(); + var n = $(this.options.render).width(), a = $(this.options.render).height(), + r = (n - i.element.width()) / 2, o = (a - i.element.height()) / 2; + r < 0 && (r = 0), o < 0 && (o = 0), i.element.css({left: r + "px", top: o + "px"}) + } + return this + }, close: function (e) { + return this._check(e) && this.floatOpened[e] && (delete this.floatOpened[e], this.floatContainer[e].invisible(), this.floatContainer[e].element.__releaseZIndexMask__(this.zindexMap[e])), this + }, get: function (e) { + return this.floatManager[e] + }, remove: function (e) { + return this._check(e) && (this.floatContainer[e].destroy(), this.floatContainer[e].element.__releaseZIndexMask__(this.zindexMap[e]), delete this.floatManager[e], delete this.floatLayer[e], delete this.zindexMap[e], delete this.floatContainer[e], delete this.floatOpened[e]), this + } + }), function () { + var e = BI.inherit(BI.Widget, { + _defaultConfig: function () { + return BI.extend(e.superclass._defaultConfig.apply(this, arguments), { + baseCls: "bi-popover bi-card weixin-container", + noClose: !1, + header: null, + body: null, + footer: null + }) + }, render: function () { + var r = this, e = this.options; + this.startX = 0, this.startY = 0, this.tracker = new BI.MouseMoveTracker(function (e, t) { + var i = r._calculateSize(), n = $("body").width(), a = $("body").height(); + r.startX += e, r.startY += t, r.element.css({ + left: BI.clamp(r.startX, 0, n - i.width) + "px", + top: BI.clamp(r.startY, 0, a - i.height) + "px" + }), BI.Resizers._resize() + }, function () { + r.tracker.releaseMouseMoves() + }, window); + var t = e.noClose ? {} : { + el: { + type: "bi.icon_button", + cls: "bi-message-close close-font", + height: 36, + handler: function () { + r.close() + } + }, width: 60 + }, i = { + north: { + el: { + type: "bi.border", + cls: "bi-message-title bi-background", + ref: function (e) { + r.dragger = e + }, + items: { + center: { + el: { + type: "bi.absolute", + items: [{ + el: BI.isPlainObject(e.header) ? BI.createWidget(e.header) : { + type: "bi.label", + height: 36, + text: e.header, + textAlign: "left" + }, left: 10, top: 0, right: 0, bottom: 0 + }] + } + }, east: t + } + }, height: 36 + }, + center: { + el: { + type: "bi.absolute", + items: [{el: BI.createWidget(e.body), left: 20, top: 0, right: 0, bottom: 0}] + } + } + }; + e.footer && (i.south = { + el: { + type: "bi.absolute", + items: [{el: BI.createWidget(e.footer), left: 20, top: 0, right: 20, bottom: 0}] + }, height: 44 + }); + var n = this._calculateSize(); + return {type: "bi.border", items: i, width: n.width, height: n.height} + }, mounted: function () { + var i = this; + this.dragger.element.mousedown(function (e) { + var t = i.element.offset(); + i.startX = t.left, i.startY = t.top, i.tracker.captureMouseMoves(e) + }) + }, _calculateSize: function () { + var e = this.options; + return {width: e.width, height: e.height} + }, hide: function () { + }, open: function () { + this.show(), this.fireEvent("EVENT_OPEN", arguments) + }, close: function () { + this.hide(), this.fireEvent("EVENT_CLOSE", arguments) + }, onConfirm: function () { + this.fireEvent("EVENT_CONFIRM", arguments) + }, setZindex: function (e) { + this.element.css({"z-index": e}) + }, destroyed: function () { + } + }); + BI.shortcut("zch.popover", e) + }(), function () { + var e = BI.inherit(BI.Widget, { + props: {label: "", end: null}, render: function () { + return { + type: "bi.vtape", + items: [{el: this._rebuildCenter()}, {el: this._rebuildSouth(), height: 44}] + } + }, _rebuildCenter: function () { + return { + type: "bi.vertical", + items: [{type: "bi.label", textAlign: "left", whiteSpace: "normal", text: this.options.label}] + } + }, _rebuildSouth: function () { + var t = this, i = this.options; + return { + type: "bi.right_vertical_adapt", + cls: "weixin-popup-south-container", + lgap: 10, + items: [{ + type: "bi.button", + cls: "weixin-popup-confirm-button", + text: BI.i18nText("FS-Zch_Confirm"), + width: 80, + height: 25, + value: 0, + handler: function (e) { + BI.isFunction(i.end) && i.end(), t.close(e) + } + }] + } + }, close: function () { + this.fireEvent("EVENT_CLOSE") + } + }); + BI.shortcut("zch.alert.popover", e) + }(), function () { + var e = BI.inherit(BI.Widget, { + props: { + executeTimingTask: !1, + timingTaskFrequencyType: 0, + timingTaskStartDay: 1, + timingTaskStartHour: "12", + timingTaskStartMinute: "00" + }, render: function () { + return { + type: "bi.vtape", + items: [{el: this._rebuildCenter()}, {el: this._rebuildSouth(), height: 44}] + } + }, _rebuildCenter: function () { + var t = this; + return { + type: "bi.vertical", + items: [{ + type: "bi.vertical_adapt", + items: [{ + type: "bi.checkbox", + width: 16, + height: 16, + selected: t.options.executeTimingTask, + ref: function (e) { + t.executeTimingTaskCheckBox = e + } + }, {type: "bi.label", lgap: 2, text: BI.i18nText("FS-Zch_Start_Update")}] + }, { + el: { + type: "bi.vertical_adapt", + items: [{ + type: "bi.label", + text: BI.i18nText("FS-Zch_Per"), + width: 12 + }, { + type: "zch.editor_text_value_combo", + lgap: 7, + width: 60, + height: 24, + value: t.options.timingTaskFrequencyType, + items: [{ + text: BI.i18nText("FS-Zch_Day"), + value: 0 + }, {text: BI.i18nText("FS-Zch_Week"), value: 1}], + ref: function (e) { + t.timingTaskFrequencyTypeCombo = e + }, + listeners: [{ + eventName: BI.TextValueCombo.EVENT_CHANGE, action: function () { + var e = this.getValue(); + 0 === e ? t.timingTaskStartDayCombo.setVisible(!1) : 1 === e && t.timingTaskStartDayCombo.setVisible(!0) + } + }] + }, { + type: "zch.editor_text_value_combo", + lgap: 7, + width: 60, + height: 24, + value: t.options.timingTaskStartDay, + items: [{ + text: BI.i18nText("FS-Zch_Monday"), + value: 1 + }, { + text: BI.i18nText("FS-Zch_Tuesday"), + value: 2 + }, { + text: BI.i18nText("FS-Zch_Wednesday"), + value: 3 + }, { + text: BI.i18nText("FS-Zch_Thursday"), + value: 4 + }, { + text: BI.i18nText("FS-Zch_Friday"), + value: 5 + }, { + text: BI.i18nText("FS-Zch_Saturday"), + value: 6 + }, {text: BI.i18nText("FS-Zch_Sunday"), value: 0}], + invisible: !t.options.timingTaskFrequencyType, + ref: function (e) { + t.timingTaskStartDayCombo = e + } + }, { + type: "dec.error_label", + width: 60, + lgap: 7, + el: { + type: "bi.editor", + cls: "bi-border weixin-border-box", + allowBlank: !0, + width: 60, + height: 24, + value: t.options.timingTaskStartHour, + ref: function (e) { + t.timingTaskStartHourEditor = e + }, + listeners: [{ + eventName: BI.Editor.EVENT_CHANGE, action: function () { + t.hourErrorPane.hideError() + } + }] + }, + ref: function (e) { + t.hourErrorPane = e + } + }, { + type: "bi.label", + lgap: 7, + text: BI.i18nText("FS-Zch_Hour"), + width: 12 + }, { + type: "dec.error_label", + width: 60, + lgap: 7, + el: { + type: "bi.editor", + cls: "bi-border weixin-border-box", + allowBlank: !0, + height: 24, + value: t.options.timingTaskStartMinute, + ref: function (e) { + t.timingTaskStartMinuteEditor = e + }, + listeners: [{ + eventName: BI.Editor.EVENT_CHANGE, action: function () { + t.minuteErrorPane.hideError() + } + }] + }, + ref: function (e) { + t.minuteErrorPane = e + } + }, { + type: "bi.label", + text: BI.i18nText("FS-Zch_Minute") + BI.i18nText("FS-Zch_Update_Once"), + lgap: 4 + }] + }, tgap: 10 + }] + } + }, _rebuildSouth: function () { + var t = this, e = (this.options, BI.createWidget({ + type: "bi.button", + cls: "weixin-popup-confirm-button", + text: BI.i18nText("FS-Zch_Confirm"), + width: 80, + height: 25, + value: 0, + handler: function (e) { + t._checkValid() && (t.end(), t.close(e)) + } + })); + return { + type: "bi.right_vertical_adapt", + cls: "weixin-popup-south-container", + lgap: 10, + items: [BI.createWidget({ + type: "bi.button", + cls: "weixin-popup-cancel-button", + text: BI.i18nText("FS-Zch_Cancel"), + width: 80, + height: 25, + value: 1, + level: "ignore", + handler: function (e) { + t.close(e) + } + }), e] + } + }, end: function () { + this._saveTimingTaskData() + }, _checkValid: function () { + var e = this, t = !0; + return BI.isKey(e.timingTaskStartHourEditor.getValue()) ? e._isHourValid() || (t = !1, e.hourErrorPane.showError(BI.i18nText("FS-Zch_Illegal"))) : (t = !1, e.hourErrorPane.showError(BI.i18nText("FS-Zch_Not_Null"))), BI.isKey(e.timingTaskStartMinuteEditor.getValue()) ? e._isMinuteValid() || (t = !1, e.minuteErrorPane.showError(BI.i18nText("FS-Zch_Illegal"))) : (t = !1, e.minuteErrorPane.showError(BI.i18nText("FS-Zch_Not_Null"))), t + }, _saveTimingTaskData: function () { + Dec.Zch.Util.ajax({ + url: "/weixin/timing/task", + type: "POST", + data: { + executeTimingTask: this.executeTimingTaskCheckBox.isSelected(), + timingTaskFrequencyType: this.timingTaskFrequencyTypeCombo.getValue(), + timingTaskStartDay: this.timingTaskStartDayCombo.getValue(), + timingTaskStartHour: parseInt(this.timingTaskStartHourEditor.getValue()), + timingTaskStartMinute: parseInt(this.timingTaskStartMinuteEditor.getValue()) + }, + complete: function (e, t) { + if ("success" === t) { + var i = BI.jsonDecode(e.responseText); + i.errorCode === Dec.Zch.ERROR_CODE_OK ? BI.Msg.toast(BI.i18nText("Dec-Basic_Success")) : Dec.Msg.alert({message: Dec.Zch.Util.handleCommonErr(i)}) + } + } + }) + }, close: function () { + this.fireEvent("EVENT_CLOSE") + }, _isHourValid: function () { + return this._isNumber(this.timingTaskStartHourEditor.getValue()) && parseInt(this.timingTaskStartHourEditor.getValue()) < 24 && 0 <= parseInt(this.timingTaskStartHourEditor.getValue()) + }, _isMinuteValid: function () { + return this._isNumber(this.timingTaskStartMinuteEditor.getValue()) && parseInt(this.timingTaskStartMinuteEditor.getValue()) < 60 && 0 <= parseInt(this.timingTaskStartMinuteEditor.getValue()) + }, _isNumber: function (e) { + return /^\d{1,2}$/.test(e) + } + }); + BI.shortcut("zch.schedule.task.popover", e) + }(), function () { + var e = BI.inherit(BI.Widget, { + props: { + id: [], + agentName: [], + sysKey: [], + secret: [], + tipLabel: "", + refreshAgentList: null, + noClose: !1 + }, render: function () { + return this.secArr = [], { + type: "bi.vtape", + items: [{el: this._rebuildCenter()}, {el: this._rebuildSouth(), height: 44}] + } + }, getValue: function () { + for (var e = [], t = 0; t < this.secArr.length; t++) { + var i = {}; + this.secArr[t].id && (i.id = this.secArr[t].id), i.agentName = this.secArr[t].agentName.getValue(), i.sysKey = this.secArr[t].sysKey.getValue(), i.secret = this.secArr[t].secret.getValue(), e.push(i) + } + return {agents: e, compatible: this.options.noClose} + }, _rebuildCenter: function () { + var e = this, t = this.options, i = {}; + e.options.tipLabel && (i = { + type: "bi.label", + cls: "weixin-gray-color", + text: e.options.tipLabel, + textAlign: "left", + whiteSpace: "normal" + }); + var n, a, r = []; + if (r.push(i), 0 < t.agentName.length) for (var o = 0; o < t.agentName.length; o++) n = o, void 0, a = e._createAgentSection({ + id: t.id[n], + agentName: t.agentName[n], + sysKey: t.sysKey[n], + secret: t.secret[n] + }), r.push(a); else { + var s = e._createAgentSection({}); + r.push(s) + } + return {type: "bi.vertical", cls: "weixin-create-agent-popup-content", items: r} + }, _rebuildSouth: function () { + var t = this, e = this.options, i = { + type: "bi.button", + cls: "weixin-popup-confirm-button", + text: BI.i18nText("FS-Zch_Confirm"), + width: 80, + height: 25, + value: 0, + handler: function (e) { + + t._checkValid() && t.end() + } + }; + return { + type: "bi.right_vertical_adapt", + cls: "weixin-popup-south-container", + rgap: 10, + items: [e.noClose ? {} : { + type: "bi.button", + cls: "weixin-popup-cancel-button", + text: BI.i18nText("FS-Zch_Cancel"), + width: 80, + height: 25, + value: 1, + level: "ignore", + handler: function (e) { + t.close(e) + } + }, i] + } + }, end: function () { + this.fireEvent("EVENT_CONFIRM") + }, _checkValid: function () { + for (var e = this, t = !0, i = 0; i < e.secArr.length; i++) { + var n = e.secArr[i].agentName, a = e.secArr[i].sysKey, r = e.secArr[i].secret; + BI.isKey(n.getValue()) || (t = !1, e.secArr[i].agentNameErrorPane.showError(BI.i18nText("FS-Zch_Not_Null"))), BI.isKey(a.getValue()) || (t = !1, e.secArr[i].corpIdErrorPane.showError(BI.i18nText("FS-Zch_Not_Null"))), BI.isKey(r.getValue()) || (t = !1, e.secArr[i].secretErrorPane.showError(BI.i18nText("FS-Zch_Not_Null"))) + } + return t + }, close: function () { + this.fireEvent("EVENT_CLOSE") + }, _createAgentSection: function (e) { + var t = {}; + e instanceof Object && (e.agentName = e.agentName || "", e.sysKey = e.sysKey || "", e.secret = e.secret || ""); + var i = { + type: "bi.vertical", + height: 200, + items: [{ + el: { + type: "bi.vertical_adapt", + items: [{ + type: "bi.label", + text: "服务号名称", + textAlign: "left", + width: 80, + height: 17 + }, { + type: "dec.error_label", + width: 330, + el: { + type: "bi.editor", + cls: "bi-border weixin-border-box", + height: 24, + errorTextHeight: 18, + allowBlank: !0, + value: e.agentName, + ref: function (e) { + t.agentName = e + }, + listeners: [{ + eventName: BI.Editor.EVENT_FOCUS, action: function () { + t.agentNameErrorPane.hideError() + } + }] + }, + ref: function (e) { + t.agentNameErrorPane = e + } + }] + }, tgap: 17 + }, { + el: { + type: "bi.vertical_adapt", + items: [{ + type: "bi.label", + text: "服务号sysKey", + textAlign: "left", + width: 80, + height: 17 + }, { + type: "dec.error_label", + width: 330, + el: { + type: "bi.editor", + cls: "bi-border weixin-border-box", + value: e.sysKey, + height: 24, + errorTextHeight: 18, + allowBlank: !0, + ref: function (e) { + t.sysKey = e + }, + listeners: [{ + eventName: BI.Editor.EVENT_FOCUS, action: function () { + t.corpIdErrorPane.hideError() + } + }] + }, + ref: function (e) { + t.corpIdErrorPane = e + } + }] + }, tgap: 10, + height: 26, + }, + { + el: { + type: "bi.vertical_adapt", + items: [{ + type: "bi.label", + text: "服务号秘钥", + textAlign: "left", + width: 80, + height: 17 + }, { + type: "dec.error_label", + width: 330, + el: { + type: "bi.editor", + cls: "bi-border weixin-border-box", + value: e.secret, + height: 24, + errorTextHeight: 18, + allowBlank: !0, + ref: function (e) { + t.secret = e + }, + listeners: [{ + eventName: BI.Editor.EVENT_FOCUS, + action: function () { + t.secretErrorPane.hideError() + } + }] + }, + ref: function (e) { + t.secretErrorPane = e + } + }] + }, tgap: 10, + height: 26, + }, + ] + }; + return t.id = e.id, this.secArr.push(t), i + } + }); + BI.shortcut("zch.create.agent.popover", e) + }(), function () { + var e = BI.inherit(BI.Widget, { + _defaultConfig: function () { + return BI.extend(e.superclass._defaultConfig.apply(this, arguments), { + baseCls: "weixin-loading-popup bi-card", + width: 450, + height: 250, + body: null + }) + }, render: function () { + return { + type: "bi.border", + items: { + center: { + el: { + type: "bi.absolute", + width: this.options.width, + height: this.options.height, + items: [{ + el: BI.createWidget(this.options.body), + left: 0, + top: 0, + right: 0, + bottom: 0 + }] + } + } + }, + width: this.options.width, + height: this.options.height + } + }, open: function () { + this.show(), this.fireEvent("EVENT_OPEN", arguments) + }, close: function () { + this.hide(), this.fireEvent("EVENT_CLOSE", arguments) + }, setZindex: function (e) { + this.element.css({"z-index": e}) + } + }); + BI.shortcut("zch.loading.popup", e) + }(), function () { + var e = BI.inherit(BI.Widget, { + _store: function () { + return BI.Models.getModel("zch.model.tab.member.management") + }, + watch: { + selectedIndex: function () { + this.tab.setSelect(this.model.selectedIndex) + } + }, + props: {refreshDepartmentData: null, refreshTagData: null, clearPageEditor: null}, + render: function () { + var e = this; + return this.navTabs = BI.Constants.getConstant("zch.constants.member.management.tabs"), this.nav = this._createNavTab(), { + type: "bi.vtape", + element: this, + items: [{ + type: "bi.absolute", + height: 40, + cls: "bi-border-bottom", + items: [{el: this.nav, top: 0, left: 0, bottom: 0, right: 0}] + }, { + type: "bi.absolute", items: [{ + el: { + type: "bi.tab", + ref: function () { + e.tab = this + }, + single: !1, + showIndex: this.model.selectedIndex, + defaultShowIndex: this.model.selectedIndex, + cardCreator: BI.bind(this._createTabPane, this) + }, top: 0, right: 0, bottom: 0, left: 0 + }] + }], + bgap: 3 + } + }, + _createNavTab: function () { + var t = this; + return BI.createWidget({ + type: "zch.line_segment", + items: t.navTabs, + height: 40, + listeners: [{ + eventName: "EVENT_CHANGE", action: function (e) { + t.store.setSelectedIndex(e) + } + }], + width: 200 + }) + }, + _createTabPane: function (e) { + var t = this; + switch (e) { + case"departments": + return { + type: "zch.member.department.tab", + refreshDepartmentData: t.options.refreshDepartmentData, + clearPageEditor: t.options.clearPageEditor, + ref: function (e) { + t.weixinDepartmentTreeTab = e + } + }; + + default: + return { + type: "zch.member.department.tab", + refreshDepartmentData: t.options.refreshDepartmentData, + clearPageEditor: t.options.clearPageEditor, + ref: function (e) { + t.weixinDepartmentTreeTab = e + } + } + } + }, + caculateTree: function () { + this.weixinDepartmentTreeTab && this.weixinDepartmentTreeTab.store.getDepTreeData(), this.weixinTagTreeTab && this.weixinTagTreeTab.store.getTagTreeData() + }, + _getDepTree: function () { + return this.weixinDepartmentTreeTab._getDepTree() + }, + _getTagTree: function () { + return this.weixinTagTreeTab._getTagTree() + }, + _getTab: function () { + return this.tab + } + }); + BI.shortcut("zch.member.management.tab", e) + }(), function () { + var e = BI.inherit(Fix.Model, { + state: function () { + return {selectedIndex: BI.Constants.getConstant("zch.constants.member.management.tabs")[0].value} + }, childContext: ["selectedIndex"], actions: { + setSelectedIndex: function (e) { + this.model.selectedIndex = e + } + } + }); + BI.model("zch.model.tab.member.management", e) + }(), function () { + var e = BI.Constants.getConstant("zch.constants").department_tab_value, t = BI.inherit(BI.Widget, { + _store: function () { + return BI.Models.getModel("zch.model.member.department") + }, watch: { + depTree: function () { + var e = this.model.depTree; + e && 0 < e.length && (e[0].selected = !0, e[0].open = !0), this.weixinDepartmentTree.populate(e), this.options.clearPageEditor(), this.options.refreshDepartmentData() + }, selectedIndex: function () { + this.model.selectedIndex === e && (this.options.clearPageEditor(), this.options.refreshDepartmentData()) + } + }, props: {refreshDepartmentData: BI.emptyFn, clearPageEditor: BI.emptyFn}, render: function () { + var t = this; + return { + type: "bi.multilayer_select_level_tree", ref: function (e) { + t.weixinDepartmentTree = e + }, listeners: [{ + eventName: BI.MultiLayerSelectLevelTree.EVENT_CHANGE, action: function (e) { + t.options.refreshDepartmentData(), t.options.clearPageEditor() + } + }] + } + }, mounted: function () { + this.store.getDepTreeData() + }, _getDepTree: function () { + window.ntree = this.weixinDepartmentTree; + return this.weixinDepartmentTree + } + }); + BI.shortcut("zch.member.department.tab", t) + }(), function () { + var e = BI.inherit(Fix.Model, { + context: ["selectedIndex"], state: function () { + return {depTree: {}} + }, actions: { + getDepTreeData: function () { + var n = this; + Dec.Zch.Util.reqWithLoading({ + url: "/zch/dep/tree", type: "GET", complete: function (e, t) { + if ("success" === t) { + var i = BI.jsonDecode(e.responseText); + i.errorCode === Dec.Zch.ERROR_CODE_OK ? n.model.depTree = BI.jsonDecode(e.responseText).depTree : Dec.Msg.alert({message: Dec.Zch.Util.handleCommonErr(i)}) + } + } + }) + } + } + }); + BI.model("zch.model.member.department", e) + }(), function () { + var e = BI.Constants.getConstant("zch.constants").tag_tab_value, t = BI.inherit(BI.Widget, { + _store: function () { + return BI.Models.getModel("zch.model.member.tag") + }, watch: { + tagTree: function () { + var e = this.model.tagTree; + e && 0 < e.length && (e[0].selected = !0, e[0].open = !0), this.weixinTagTree.populate(e), this.options.clearPageEditor(), this.options.refreshTagData() + }, selectedIndex: function () { + this.model.selectedIndex === e && (this.options.clearPageEditor(), this.options.refreshTagData()) + } + }, props: {clearPageEditor: BI.emptyFn, refreshTagData: BI.emptyFn}, render: function () { + var t = this; + return { + type: "bi.multilayer_select_level_tree", ref: function (e) { + t.weixinTagTree = e + }, listeners: [{ + eventName: BI.MultiLayerSelectLevelTree.EVENT_CHANGE, action: function () { + t.options.refreshTagData(), t.options.clearPageEditor() + } + }] + } + }, mounted: function () { + this.store.getTagTreeData() + }, _getTagTree: function () { + return this.weixinTagTree + } + }); + BI.shortcut("zch.member.tag.tab", t) + }(), function () { + var e = BI.inherit(Fix.Model, { + context: ["selectedIndex"], state: function () { + return {tagTree: {}} + }, actions: { + getTagTreeData: function () { + var n = this; + Dec.Zch.Util.reqWithLoading({ + url: "/weixin/tag/tree", type: "GET", complete: function (e, t) { + if ("success" === t) { + var i = BI.jsonDecode(e.responseText); + i.errorCode === Dec.Zch.ERROR_CODE_OK ? n.model.tagTree = BI.jsonDecode(e.responseText).tagTree : Dec.Msg.alert({message: Dec.Zch.Util.handleCommonErr(i)}) + } + } + }) + } + } + }); + BI.model("zch.model.member.tag", e) + }(), function () { + var e = BI.inherit(BI.Widget, { + _store: function () { + return BI.Models.getModel("zch.model.management") + }, watch: { + selectedTab: function (e) { + this.tab.setSelect(e) + } + }, render: function () { + var e = this; + return this.navTabs = BI.Constants.getConstant("zch.constants.management.tabs"), this.nav = this._createNavTab(), { + type: "bi.vtape", + element: this, + items: [{ + type: "bi.absolute", + cls: "weixin-tab-title", + height: 40, + items: [{el: this.nav, top: 0, left: 0, bottom: 0, right: 0}] + }, { + type: "bi.absolute", cls: "weixin-tab-content", items: [{ + el: { + type: "bi.tab", + ref: function () { + e.tab = this + }, + single: !1, + showIndex: this.model.selectedTab, + defaultShowIndex: this.model.selectedTab, + cardCreator: BI.bind(this._createTabPane, this) + }, top: 0, right: 0, bottom: 0, left: 0 + }] + }], + bgap: 1 + } + }, _createNavTab: function () { + var t = this; + return { + type: "zch.line_segment", + items: t.navTabs, + listeners: [{ + eventName: "EVENT_CHANGE", action: function (e) { + t.store.setSelectedTab(e), "member" === e && t.memberManagementTab && (t.memberManagementTab.treeManagementPane.caculateTree(), t.memberManagementTab._clearPageEditor()) + } + }], + width: 270, + height: 40 + } + }, _createTabPane: function (e) { + var t = this; + switch (e) { + case"agent": + return { + type: "zch.agentmanagement", ref: function (e) { + t.agentManagementTab = e + } + }; + case"member": + return { + type: "bi.vertical", + cls: "weixin-member-management-container", + items: [{ + height: "100%", type: "zch.membermanagement", ref: function (e) { + t.memberManagementTab = e + } + }] + }; + case"config": + return { + type: "bi.vertical", + cls: "weixin-quick-config-container", + items: [{ + height: "100%", type: "zch.agentquickconfig", ref: function (e) { + t.quickConfigTab = e + } + }] + }; + default: + return {type: "zch.agentmanagement"} + } + } + }); + BI.shortcut("zch.Tab", e) + }(), function () { + var e = BI.inherit(Fix.Model, { + state: function () { + return { + selectedTab: BI.Constants.getConstant("zch.constants.management.tabs")[0].value, + agentList: [], + total: 0 + } + }, actions: { + setSelectedTab: function (e) { + this.model.selectedTab = e + } + }, childContext: ["selectedTab", "agentList"] + }); + BI.model("zch.model.management", e) + }(), function () { + var e = BI.inherit(BI.Widget, { + render: function () { + return this.agentUrlPane = this._createAgentUrlPane(), this.proxyPane = this._createProxyPane(), this.agentConfigPane = this._createAgentConfigPane(), { + type: "bi.vertical", + vgap: 14, + hgap: 14, + items: [{el: this.proxyPane}, {el: this.agentConfigPane}, {el: this.agentUrlPane}] + } + }, mounted: function () { + this._initData() + }, _store: function () { + return BI.Models.getModel("zch.model.quick.config") + }, watch: { + agentList: function () { + this._populateAgentListCombo() + }, weiXinUrl: function () { + this.createUrlPane.setValue(this.model.weiXinUrl) + }, proxyServer: function () { + this.proxyUrlPane.setValue(this.model.proxyServer) + } + }, _initData: function () { + this.store.getProxyServer(), this._populateAgentListCombo() + }, _populateAgentListCombo: function () { + var e = this, t = e.model.agentListComboItems; + e.agentListCUCombo.populate(t), e.agentListCUCombo.setValue(t[0] && t[0].value), e.agentListQCCombo.populate(t), e.agentListQCCombo.setValue(t[0] && t[0].value) + }, _createAgentUrlPane: function () { + var n = this; + return { + type: "bi.vertical", + cls: "weixin-section-container", + items: [{ + el: { + type: "bi.left_right_vertical_adapt", + cls: "bi-border-bottom", + height: 40, + items: { + left: [{ + type: "bi.label", + text: BI.i18nText("FS-Zch_Create_WeiXin_Url"), + cls: "weixin-title" + }] + } + }, lgap: 14 + }, { + el: { + type: "bi.vertical_adapt", + height: 25, + items: [{ + type: "bi.label", + text: BI.i18nText("FS-Zch_Agent_Name"), + textAlign: "left", + width: 116 + }, { + type: "zch.editor_text_value_combo", width: 150, height: 24, ref: function (e) { + n.agentListCUCombo = e + }, items: [] + }] + }, lgap: 14, tgap: 10 + }, { + el: { + type: "bi.vertical_adapt", + height: 25, + items: [{ + type: "bi.label", + text: BI.i18nText("FS-Zch_Platform_Page"), + textAlign: "left", + width: 116 + }, { + type: "zch.editor_text_value_combo", + width: 150, + height: 24, + value: 1, + items: [{ + text: BI.i18nText("FS-Zch_Platform"), + value: 1 + }, {text: BI.i18nText("FS-Zch_Platform_Report"), value: 2}], + ref: function (e) { + n.platform = e + }, + listeners: [{ + eventName: BI.TextValueCombo.EVENT_CHANGE, action: function () { + var e = this.getValue(); + 1 === e ? n.reportFileTree.setVisible(!1) : 2 === e && n.reportFileTree.setVisible(!0) + } + }] + }, { + type: "dec.schedule.template.search", + invisible: !0, + width: 150, + height: 24, + lgap: 10, + ref: function (e) { + n.reportFileTree = e + } + }] + }, lgap: 14, tgap: 10 + }, { + el: { + type: "bi.vertical_adapt", + height: 25, + items: [{ + type: "bi.label", + text: BI.i18nText("FS-Zch_WeiXin_Url"), + textAlign: "left", + width: 116 + }, { + el: { + type: "bi.editor", + cls: "bi-border", + width: 300, + height: 24, + allowBlank: !0, + ref: function (e) { + n.createUrlPane = e + } + }, rgap: 10 + }, { + el: { + width: 80, + height: 24, + type: "bi.button", + text: BI.i18nText("FS-Zch_Create_Url"), + handler: function () { + var e = n.agentListCUCombo.getValue(), t = n.platform.getValue(), + i = n.reportFileTree.getValue()[0]; + n.store.createWeiXinUrl(e, t, i) + } + }, rgap: 10 + }, { + width: 80, + height: 24, + type: "zch.clipboard.button", + text: BI.i18nText("FS-Zch_Copy_Url"), + copy: function () { + return n.createUrlPane.getValue() + }, + afterCopy: function () { + BI.Msg.toast(BI.i18nText("FS-Zch_Copy_Success")) + } + }] + }, lgap: 14, tgap: 10, bgap: 10 + }] + } + }, _createProxyPane: function () { + var t = this; + return { + type: "bi.vertical", + cls: "weixin-section-container", + items: [{ + el: { + type: "bi.left_right_vertical_adapt", + cls: "bi-border-bottom", + height: 40, + items: { + left: [{ + type: "bi.label", + text: BI.i18nText("FS-Zch_Proxy"), + cls: "weixin-title" + }], + right: [{ + width: 80, + height: 24, + type: "bi.button", + text: BI.i18nText("FS-Zch_Save"), + handler: function () { + var e = t.proxyUrlPane.getValue().trim(); + t._checkReportServerUrlValid(e, function () { + this.store.saveProxyServer(e) + }) + } + }] + } + }, lgap: 14, rgap: 14 + }, { + el: { + type: "bi.vertical_adapt", + height: 25, + items: [{ + type: "bi.label", + text: BI.i18nText("FS-Zch_Proxy_Address"), + textAlign: "left", + width: 116 + }, { + el: { + type: "bi.editor", + cls: "bi-border", + width: 300, + height: 24, + allowBlank: !0, + ref: function (e) { + t.proxyUrlPane = e + } + }, rgap: 10 + }, { + width: 80, + height: 24, + type: "bi.button", + text: BI.i18nText("FS-Zch_Test_Proxy_Address"), + handler: function () { + var e = t.proxyUrlPane.getValue().trim(); + t._checkReportServerUrlValid(e, function () { + this.store.testProxyServer(e) + }) + } + }] + }, lgap: 14, tgap: 10, bgap: 10 + }] + } + }, _checkReportServerUrlValid: function (e, t) { + Dec.Zch.Util.checkUrlValid(e) || "" === e ? BI.isFunction(t) && t.call(this) : Dec.Msg.alert({message: BI.i18nText("FS-Zch_Start_With_Http")}) + }, _createAgentConfigPane: function () { + var t = this; + return { + type: "bi.vertical", + cls: "weixin-section-container", + items: [{ + el: { + type: "bi.left_right_vertical_adapt", + cls: "bi-border-bottom", + height: 40, + items: { + left: [{ + type: "bi.label", + text: BI.i18nText("FS-Zch_Agent_Quick_Config"), + cls: "weixin-title" + }] + } + }, lgap: 14 + }, { + el: { + type: "bi.vertical_adapt", + height: 25, + items: [{ + type: "bi.label", + text: BI.i18nText("FS-Zch_Agent_Name"), + textAlign: "left", + width: 116 + }, { + el: { + type: "zch.editor_text_value_combo", + width: 150, + height: 24, + ref: function (e) { + t.agentListQCCombo = e + }, + items: [] + }, rgap: 10 + }, { + width: 80, + height: 24, + type: "bi.button", + text: BI.i18nText("FS-Zch_One_Key_Config"), + handler: function () { + var e = t.agentListQCCombo.getValue(); + t.store.oneKeyConfigPreCheck(e, function (e) { + t.store.oneKeyConfig(e) + }) + } + }] + }, lgap: 14, tgap: 10, bgap: 10 + }] + } + } + }); + BI.shortcut("zch.agentquickconfig", e) + }(), function () { + var e = BI.inherit(Fix.Model, { + context: ["agentList"], state: function () { + return {weiXinUrl: "", proxyServer: ""} + }, computed: { + agentListComboItems: function () { + for (var e = [], t = this.model.agentList, i = this.model.agentList.length, n = 0; n < i; n++) { + var a = t[n], r = {}; + r.text = a.agentName, r.value = n, e.push(r) + } + return e + } + }, actions: { + createWeiXinUrl: function (e, t, i) { + var n = this; + if (BI.isKey(e)) { + var a = n.model.agentList[e]; + a && Dec.Zch.Util.ajax({ + url: "/weixin/entry/url", + type: "POST", + data: {sysKey: a.sysKey, id: a.id, platform: t, fileName: i}, + complete: function (e, t) { + if ("success" === t) { + var i = BI.jsonDecode(e.responseText); + i.errorCode === Dec.Zch.ERROR_CODE_OK ? n.model.weiXinUrl = i.oauthUrl : Dec.Msg.alert({message: Dec.Zch.Util.handleCommonErr(i)}) + } + } + }) + } + }, getProxyServer: function () { + var n = this; + Dec.Zch.Util.ajax({ + url: "/weixin/proxy/server/url", type: "GET", complete: function (e, t) { + if ("success" === t) { + var i = BI.jsonDecode(e.responseText); + i.errorCode === Dec.Zch.ERROR_CODE_OK ? n.model.proxyServer = i.proxyServer : Dec.Msg.alert({message: Dec.Zch.Util.handleCommonErr(i)}) + } + } + }) + }, saveProxyServer: function (e) { + Dec.Zch.Util.ajax({ + url: "/weixin/proxy/server/url", + type: "POST", + data: {proxyServer: e}, + complete: function (e, t) { + if ("success" === t) { + var i = BI.jsonDecode(e.responseText); + i.errorCode === Dec.Zch.ERROR_CODE_OK ? BI.Msg.toast(BI.i18nText("Dec-Basic_Success")) : Dec.Msg.alert({message: Dec.Zch.Util.handleCommonErr(i)}) + } + } + }) + }, testProxyServer: function (e) { + var n = this, a = BI.Constants.getConstant("zch.constants").popup_loading_configuration, + r = Dec.Zch.Util.showLoading(".weixin-quick-config-container", BI.i18nText("FS-Zch_Test_Connection"), a); + Dec.Zch.Util.ajax({ + url: "/weixin/test/proxy/connection", + type: "POST", + data: {proxyServer: e}, + complete: function (e, t) { + if (r.remove(a), "success" === t) { + var i = BI.jsonDecode(e.responseText); + i.errorCode === Dec.Zch.ERROR_CODE_OK ? (n._showResultAlert(BI.i18nText("FS-Zch_Connection_Success"), !0), n._hideResultAlert()) : n._showResultAlert(Dec.Zch.Util.handleCommonErr(i), !1) + } + } + }) + }, oneKeyConfigPreCheck: function (e, a) { + var r = this; + if (BI.isKey(e)) { + var o = r.model.agentList[e]; + if (o) { + var s = BI.Constants.getConstant("zch.constants").popup_loading_configuration, + l = Dec.Zch.Util.showLoading(".weixin-quick-config-container", BI.i18nText("FS-Zch_Configuring"), s); + Dec.Zch.Util.ajax({ + url: "/weixin/one/key/pre/check/config", + type: "POST", + data: {secret: o.secret}, + complete: function (e, t) { + if (l.remove(s), "success" === t) { + var i = BI.jsonDecode(e.responseText); + if (i.errorCode === Dec.Zch.ERROR_CODE_OK) i.exists ? Dec.Msg.alert({ + message: BI.i18nText("FS-Zch_One_Key_Config_Tip"), + callback: function () { + BI.isFunction(a) && a.call(r, o.secret) + } + }) : BI.isFunction(a) && a.call(r, o.secret); else if (i.errorCode === Dec.Zch.ERROR_CODE_WEIXIN_API_ERR) { + var n = Dec.Zch.Util._generateWeiXinApiErrorLabel(BI.i18nText("FS-Zch_Configure_Fail"), i.weixinApiError); + Dec.Msg.alert({message: n}) + } else Dec.Msg.alert({message: Dec.Zch.Util.handleCommonErr(i)}) + } + } + }) + } + } + }, oneKeyConfig: function (e) { + var a = this, r = BI.Constants.getConstant("zch.constants").popup_loading_configuration, + o = Dec.Zch.Util.showLoading(".weixin-quick-config-container", BI.i18nText("FS-Zch_Configuring"), r); + Dec.Zch.Util.ajax({ + url: "/weixin/one/key/config", + type: "POST", + data: {secret: e}, + complete: function (e, t) { + if ("success" === t) { + o.remove(r); + var i = BI.jsonDecode(e.responseText); + if (i.errorCode === Dec.Zch.ERROR_CODE_OK) a._showResultAlert(BI.i18nText("FS-Zch_Configure_Success"), !0), a._hideResultAlert(); else if (i.errorCode === Dec.Zch.ERROR_CODE_WEIXIN_API_ERR) { + var n = Dec.Zch.Util._generateWeiXinApiErrorLabel(BI.i18nText("FS-Zch_Configure_Fail"), i.weixinApiError); + Dec.Msg.alert({message: n}) + } else Dec.Msg.alert({message: Dec.Zch.Util.handleCommonErr(i)}) + } + } + }) + }, _showResultAlert: function (e, t) { + var i = BI.Constants.getConstant("zch.constants").popup_result_tip_popup; + Dec.Zch.Util.showResultAlert(".weixin-quick-config-container", e, t, i) + }, _hideResultAlert: function () { + var e = BI.Constants.getConstant("zch.constants").popup_result_tip_popup; + setTimeout(function () { + Dec.Zch.Util.hideResultAlert(e) + }, 1500) + } + } + }); + BI.model("zch.model.quick.config", e) + }(), function () { + var e = BI.inherit(BI.Widget, { + render: function () { + return this.currentPage = 1, this.totalPage = 1, + this.agent_management_table_header = BI.Constants.getConstant("zch.constants.agentmanagement.table.header"), + this._reportServerPane = this._createReportServerPane(), this._agentListPane = this._createAgentListPane(), { + type: "bi.vertical", + vgap: 14, + hgap: 14, + items: [{el: this._reportServerPane}, {el: this._agentListPane}] + } + }, _store: function () { + return BI.Models.getModel("zch.model.agent.management") + }, watch: { + agentList: function (e) { + this._populateWeiXinAgentTable(e, this.currentPage - 1); + this._populateWeiXinPageNumberButtons(e) + }, addResult: function () { + this.model.addResult.errorText ? Dec.Msg.alert({message: this.model.addResult.errorText}) : (BI.Msg.toast(BI.i18nText("Dec-Basic_Success")), this.store.initAgentList(), BI.Popovers.remove(BI.Constants.getConstant("zch.constants").popup_create_agent)) + }, reportServerUrl: function () { + this.reportServerEditor.setValue(this.model.reportServerUrl) + this.authUrlEditer.setValue(this.model.authUrl) + this.pushUrlEditer.setValue(this.model.pushUrl) + this.accessTokenEditer.setValue(this.model.accessToken) + this.appKeyEditer.setValue(this.model.appKey) + // this.scanId.setValue(this.model.scanId) + // this.scanSecret.setValue(this.model.scanSecret) + } + }, mounted: function () { + Dec.Zch.Util.formatTableStyle(), this.store.getReportServerUrl(), this.store.initAgentList() + }, _createReportServerPane: function () { + var t = this; + return { + type: "bi.vertical", + cls: "weixin-section-container", + lgap: 14, + rgap: 14, + items: [{ + type: "bi.left_right_vertical_adapt", + cls: "bi-border-bottom", + height: 40, + items: { + left: [{ + type: "bi.label", + cls: "weixin-title", + text: BI.i18nText("FS-Zch_ReportServer"), + height: 40 + }], + right: [{ + width: 80, + height: 24, + type: "bi.button", + text: BI.i18nText("FS-Zch_Save"), + handler: function () { + var e = t.reportServerEditor.getValue().trim(); + if (Dec.Zch.Util.checkUrlValid(e)) { + var p = {}; + p.authUrl = t.authUrlEditer.getValue().trim(); + p.pushUrl = t.pushUrlEditer.getValue().trim(); + p.appKey = t.appKeyEditer.getValue().trim(); + p.accessToken = t.accessTokenEditer.getValue().trim(); + p.reportServerUrl = e; + t.store.saveReportServerUrl(p) + } else { + Dec.Msg.alert({message: BI.i18nText("FS-Zch_Start_With_Http")}) + } + } + }] + } + }, { + type: "bi.vertical", + items: [{ + el: { + type: "bi.vertical_adapt", + cls: "weixin-reportServer-container", + height: 40, + items: [{ + type: "bi.label", + textAlign: "left", + text: "报表服务器地址", + width: 126, + height: 24 + }, { + type: "bi.editor", + cls: "bi-border", + width: 390, + height: 24, + watermark: "http://www.fanruan.com:80/webroot/decision", + allowBlank: !1, + value: t.model.reportServerUrl, + ref: function (e) { + t.reportServerEditor = e + } + }, { + el: { + type: "bi.label", + cls: "weixin-gray-color", + text: BI.i18nText("FS-Zch_ReportServer_Tip"), + textAlign: "left", + height: 40 + }, lgap: 10 + }] + }, vgap: 10 + }, + { + el: { + type: "bi.vertical_adapt", + cls: "weixin-reportServer-container", + height: 40, + items: [{ + type: "bi.label", + textAlign: "left", + text: "认证服务器地址", + width: 126, + height: 24 + }, { + type: "bi.editor", + cls: "bi-border", + width: 390, + height: 24, + watermark: "https://testlogin.idm.huafagroup.com:25443/siam/login", + allowBlank: !1, + value: t.model.authUrl, + ref: function (e) { + t.authUrlEditer = e + } + }] + }, vgap: 10 + }, + { + el: { + type: "bi.vertical_adapt", + cls: "weixin-reportServer-container", + height: 40, + items: [{ + type: "bi.label", + textAlign: "left", + text: "推送接口地址", + width: 126, + height: 24 + }, { + type: "bi.editor", + cls: "bi-border", + width: 390, + height: 24, + watermark: "https://testconsole.mp.huafagroup.com:6443", + allowBlank: !1, + value: t.model.pushUrl, + ref: function (e) { + t.pushUrlEditer = e + } + }] + }, vgap: 10 + }, + { + el: { + type: "bi.vertical_adapt", + cls: "weixin-reportServer-container", + height: 40, + items: [{ + type: "bi.label", + textAlign: "left", + text: "推送AccessToken", + width: 126, + height: 24 + }, { + type: "bi.editor", + cls: "bi-border", + width: 390, + height: 24, + watermark: "69851079-88c4-4bc9-84cb-344f98c90076", + allowBlank: !1, + value: t.model.accessToken, + ref: function (e) { + t.accessTokenEditer = e + } + }] + }, vgap: 10 + }, + { + el: { + type: "bi.vertical_adapt", + cls: "weixin-reportServer-container", + height: 40, + items: [{ + type: "bi.label", + textAlign: "left", + text: "推送AppKey", + width: 126, + height: 24 + }, { + type: "bi.editor", + cls: "bi-border", + width: 390, + height: 24, + watermark: "9B5oh2rnpPByhxPcwU9M", + allowBlank: !1, + value: t.model.appKey, + ref: function (e) { + t.appKeyEditer = e + } + }] + }, vgap: 10 + }, + // { + // el: { + // type: "bi.vertical_adapt", + // cls: "weixin-reportServer-container", + // height: 40, + // items: [{ + // type: "bi.label", + // textAlign: "left", + // text: "扫码登陆应用id", + // width: 126, + // height: 24 + // }, { + // type: "bi.editor", + // cls: "bi-border", + // width: 390, + // height: 24, + // watermark: "500216254", + // allowBlank: !1, + // value: t.model.scanId, + // ref: function (e) { + // t.scanId = e + // } + // }] + // }, vgap: 10 + // }, + // { + // el: { + // type: "bi.vertical_adapt", + // cls: "weixin-reportServer-container", + // height: 40, + // items: [{ + // type: "bi.label", + // textAlign: "left", + // text: "扫码登陆应用Secret", + // width: 126, + // height: 24 + // }, { + // type: "bi.editor", + // cls: "bi-border", + // width: 390, + // height: 24, + // watermark: "9B5oh2rnpPByhxPcwU9M", + // allowBlank: !1, + // value: t.model.scanSecret, + // ref: function (e) { + // t.scanSecret = e + // } + // }] + // }, vgap: 10 + // } + ] + }] + } + }, _createAgentListPane: function () { + var t = this; + return { + type: "bi.vertical", + height: 566, + cls: "weixin-section-container", + lgap: 14, + rgap: 14, + items: [{ + type: "bi.left_right_vertical_adapt", + height: 40, + cls: "bi-border-bottom", + items: { + left: [{ + type: "bi.label", + text: "华发服务号", + cls: "weixin-title", + height: 40 + }] + } + }, { + type: "bi.vertical_adapt", + height: 46, + items: [{ + type: "bi.icon_text_item", + text: "新建服务号", + cls: "plus-font", + width: 100, + height: 17, + handler: function () { + t._createAgentPopupPane({ + refreshAgentList: BI.bind(t.store.initAgentList, t.store), + title: "新建服务号" + }, !1) + } + }] + }, { + type: "bi.table_view", + cls: "weixin-table", + isNeedMerge: !1, + isNeedFreeze: !1, + columnSize: [234, 234, 234, "fill"], + items: [], + header: t.agent_management_table_header, + ref: function (e) { + t.agentTable = e + } + }, { + type: "bi.left_right_vertical_adapt", + height: 26, + tgap: 10, + items: { + right: [{ + type: "bi.horizontal", + items: [{ + type: "bi.icon_button", + width: 24, + height: 24, + cls: "page-button dec-pager-first-font", + handler: function () { + 1 < t.currentPage && (t.currentPage = 1, t.agentPageEditor.setValue(t.currentPage.toString()), t._populateWeiXinAgentTable(t.model.agentList, t.currentPage - 1), t._populateWeiXinPageNumberButtons(t.model.agentList)) + } + }, { + type: "bi.icon_button", + lgap: 5, + width: 24, + height: 24, + cls: "page-button dec-pager-prev-font", + disabled: !0, + ref: function (e) { + t.previousPageButton = e + }, + handler: function () { + 1 < t.currentPage && (t.currentPage -= 1, t.agentPageEditor.setValue(t.currentPage.toString()), t._populateWeiXinAgentTable(t.model.agentList, t.currentPage - 1), t._populateWeiXinPageNumberButtons(t.model.agentList)) + } + }, { + type: "bi.editor", + cls: "bi-border", + allowBlank: !0, + lgap: 5, + rgap: 5, + width: 40, + height: 24, + value: t.currentPage.toString(), + ref: function (e) { + t.agentPageEditor = e + }, + listeners: [{ + eventName: BI.Editor.EVENT_CONFIRM, action: function () { + this.getValue() > t.totalPage ? this.setValue(t.totalPage) : this.getValue() < 1 && this.setValue(1), t.currentPage = parseInt(this.getValue()), t._populateWeiXinAgentTable(t.model.agentList, t.currentPage - 1), t._populateWeiXinPageNumberButtons(t.model.agentList) + } + }] + }, {type: "bi.label", width: 5, height: 24, text: "/ "}, { + type: "bi.label", + height: 24, + lgap: 5, + text: "1", + ref: function (e) { + t.agentPageLabel = e + } + }, { + type: "bi.icon_button", + width: 24, + height: 24, + lgap: 5, + cls: "page-button dec-pager-next-font", + ref: function (e) { + t.nextPageButton = e + }, + handler: function () { + t.currentPage < t.totalPage && (t.currentPage += 1, t.agentPageEditor.setValue(t.currentPage.toString()), t._populateWeiXinAgentTable(t.model.agentList, t.currentPage - 1), t._populateWeiXinPageNumberButtons(t.model.agentList)) + } + }, { + type: "bi.icon_button", + width: 24, + height: 24, + lgap: 5, + cls: "page-button dec-pager-last-font", + handler: function () { + t.currentPage < t.totalPage && (t.currentPage = t.totalPage, t.agentPageEditor.setValue(t.currentPage.toString()), t._populateWeiXinAgentTable(t.model.agentList, t.currentPage - 1), t._populateWeiXinPageNumberButtons(t.model.agentList)) + } + }] + }] + } + }] + } + }, _checkAgentListType: function (e) { + + }, _populateWeiXinAgentTable: function (e, t) { + for (var i = this, n = [], a = [], r = e, o = 10 * (t = t || 0), s = Math.min(o + 10, r.length), l = o; l < s; l++) n.push(function (t) { + return [{ + type: "bi.label", + height: 32, + lgap: 5, + title: r[t].agentName, + text: r[t].agentName + }, + { + type: "bi.label", + height: 32, + lgap: 5, + title: r[t].agentId, + text: r[t].sysKey + }, + { + type: "bi.label", + height: 32, + lgap: 5, + title: r[t].secret, + text: r[t].secret + }, + { + type: "bi.left_right_vertical_adapt", + height: 32, + items: { + // left: [{type: "bi.label", lgap: 2.5, title: r[t].secret, text: r[t].secret, height: 32}], + left: [{ + type: "bi.icon_button", + cls: "edit-font", + rgap: 10, + height: 32, + handler: function () { + i._createAgentPopupPane({ + id: [r[t].id], + agentName: [r[t].agentName], + sysKey: [r[t].sysKey], + secret: [r[t].secret], + refreshAgentList: BI.bind(i.store.initAgentList, i.store), + title: BI.i18nText("FS-Zch_Modify_Agent") + }, !1) + } + }, { + type: "bi.bubble_combo", + rgap: 10, + ref: function (e) { + a[t] = e + }, + el: {type: "bi.icon_button", cls: "delete-node-font", height: 32}, + stopPropagation: !0, + popup: { + type: "bi.bubble_bar_popup_view", + el: { + type: "bi.absolute", + height: 100, + items: [{ + el: { + type: "bi.label", + text: "确定删除该服务号吗?", + textAlign: "left" + }, top: 25, right: 0, bottom: 0, left: 25 + }] + }, + maxHeight: 100, + minWidth: 250, + buttons: [{ + text: BI.i18nText("FS-Zch_Confirm"), + value: l, + width: 80, + height: 24, + handler: function (e) { + i.store.deleteAgent(r[t].id), a[t].hideView() + } + }, { + text: BI.i18nText("FS-Zch_Cancel"), + level: "ignore", + value: l, + width: 80, + height: 24, + handler: function (e) { + a[t].hideView() + } + }] + } + }] + } + }] + }(l)); + i.agentTable.populate(n), Dec.Zch.Util.formatTableStyle() + }, _populateWeiXinPageNumberButtons: function (e) { + var t = e.length; + this.totalPage = Math.ceil(t / 10), 0 === this.totalPage && (this.totalPage = 1), this.agentPageLabel.setValue(this.totalPage), 1 === this.totalPage && 1 === this.currentPage ? (this.nextPageButton.setEnable(!1), this.previousPageButton.setEnable(!1)) : 1 === this.currentPage ? (this.nextPageButton.setEnable(!0), this.previousPageButton.setEnable(!1)) : (this.currentPage === this.totalPage ? this.nextPageButton.setEnable(!1) : this.nextPageButton.setEnable(!0), this.previousPageButton.setEnable(!0)) + }, _createAgentPopupPane: function (e, t) { + var i = this, n = BI.Constants.getConstant("zch.constants").popup_create_agent, + a = BI.extend(e, { + type: "zch.create.agent.popover", + noClose: t, + listeners: [{ + eventName: "EVENT_CLOSE", action: function () { + BI.Popovers.remove(n) + } + }, { + eventName: "EVENT_CONFIRM", action: function () { + var e = i.createAgentPopover.getValue(); + i.store.createAgent(e.agents, e.compatible) + } + }], + ref: function (e) { + i.createAgentPopover = e + } + }); + BI.Popovers.create(n, { + type: "zch.popover", + noClose: t, + header: { + type: "bi.left_vertical_adapt", + hgap: 5, + items: [{type: "bi.label", forceCenter: !0, text: e.title}] + }, + body: a, + width: 455, + height: 245, + listeners: [{ + eventName: "EVENT_CLOSE", action: function () { + BI.Popovers.remove(n) + } + }] + }).open(n), $(".weixin-popup-cancel-button").css("border", "1px solid #3685F2").css("border-radius", "2px").css("color", "#3685F2"), $(".weixin-popup-confirm-button").css("border-radius", "2px") + } + }); + BI.shortcut("zch.agentmanagement", e) + }(), function () { + var e = BI.inherit(Fix.Model, { + context: ["agentList"], state: function () { + return { + addResult: {}, + reportServerUrl: "", + authUrl: "", + pushUrl: "", + accessToken: "", + appKey: "", + } + }, actions: { + saveReportServerUrl: function (e) { + Dec.Zch.Util.ajax({ + url: "/zch/report/server/url", + type: "POST", + data: e, + complete: function (e, t) { + if ("success" === t) { + var i = BI.jsonDecode(e.responseText); + i.errorCode === Dec.Zch.ERROR_CODE_OK ? BI.Msg.toast(BI.i18nText("Dec-Basic_Success")) : Dec.Msg.alert({message: Dec.Zch.Util.handleCommonErr(i)}) + } + } + }) + }, getReportServerUrl: function () { + var n = this; + Dec.Zch.Util.ajax({ + url: "/zch/report/server/url", type: "GET", complete: function (e, t) { + if ("success" === t) { + var i = BI.jsonDecode(e.responseText); + if (i.errorCode === Dec.Zch.ERROR_CODE_OK) { + n.model.reportServerUrl = i.reportServerUrl + n.model.appKey = i.appKey + n.model.accessToken = i.accessToken + n.model.pushUrl = i.pushUrl + n.model.authUrl = i.authUrl + } else { + Dec.Msg.alert({message: Dec.Zch.Util.handleCommonErr(i)}) + } + } + } + }) + }, initAgentList: function () { + var n = this; + Dec.Zch.Util.ajax({ + url: "/zch/agent", type: "GET", complete: function (e, t) { + if ("success" === t) { + var i = BI.jsonDecode(e.responseText); + i.errorCode === Dec.Zch.ERROR_CODE_OK ? n.model.agentList = i.agentList : Dec.Msg.alert({message: Dec.Zch.Util.handleCommonErr(i)}) + } + } + }) + }, createAgent: function (e, n) { + var a = this; + Dec.Zch.Util.ajax({ + url: "/zch/agent", + type: "POST", + data: {agentArr: e}, + complete: function (e, t) { + if ("success" === t) { + var i = BI.jsonDecode(e.responseText); + i.errorCode === Dec.Zch.ERROR_CODE_OK ? a.model.addResult = { + success: !0, + compatible: n + } : a.model.addResult = {errorText: Dec.Zch.Util.handleCommonErr(i)} + } + } + }) + }, deleteAgent: function (e) { + var n = this; + Dec.Zch.Util.ajax({ + url: "/zch/agent?id=" + e, type: "DELETE", complete: function (e, t) { + if ("success" === t) { + var i = BI.jsonDecode(e.responseText); + i.errorCode === Dec.Zch.ERROR_CODE_OK ? n.initAgentList() : Dec.Msg.alert({message: Dec.Zch.Util.handleCommonErr(i)}) + } + } + }) + } + } + }); + BI.model("zch.model.agent.management", e) + }(), function () { + var e = BI.Constants.getConstant("zch.constants").department_tab_value, + i = BI.Constants.getConstant("zch.constants").tag_tab_value, t = BI.inherit(BI.Widget, { + _store: function () { + return BI.Models.getModel("zch.model.member.management") + }, watch: { + agentList: function () { + this._clearPageEditor() + }, depMember: function () { + this._getWeiXinMemberTab().getSelect() === e && (this._populateWeiXinMemberTable(this.model.depMember), this._populateWeiXinPageNumberButtons(this.model.depMember)) + }, tagMember: function () { + this._getWeiXinMemberTab().getSelect() === i && (this._populateWeiXinMemberTable(this.model.tagMember), this._populateWeiXinPageNumberButtons(this.model.tagMember)) + }, matchConfig: function () { + switch (this.model.matchConfig.matchingFsWay ? this.matchingFSWayCombo.setValue(this.model.matchConfig.matchingFsWay) : this.matchingFSWayCombo.setValue(0), this.model.matchConfig.matchingFsWay) { + case 0: + case 1: + this.dataSetContainer.setVisible(!1), this.memberTableNonFsUserName.setVisible(!0), this.memberTableWithFsUserName.setVisible(!1); + break; + case 2: + this.dataSetContainer.setVisible(!1), this.memberTableNonFsUserName.setVisible(!1), this.memberTableWithFsUserName.setVisible(!0); + break; + case 3: + this.dataSetContainer.setVisible(!0), this.memberTableNonFsUserName.setVisible(!0), this.memberTableWithFsUserName.setVisible(!1) + } + }, serverTableData: function () { + this.dataSetCombo.populate(this.model.serverTableData), this.dataSetCombo.setValue(this.model.matchConfig.dataSet), this.store.getDataSetColumn(this.dataSetCombo.getValue()) + }, tableDataColName: function () { + this.userIdCombo.populate(this.model.tableDataColName), this.userIdCombo.setValue(this.model.matchConfig.dataSetUserId), this.fsUserNameCombo.populate(this.model.tableDataColName), this.fsUserNameCombo.setValue(this.model.matchConfig.dataSetFsName) + } + }, render: function () { + var e = this; + return e.currentPage = 1, e.totalPage = 1, e.matchConfig = {}, e.fsUserNameComboGroup = [], e.member_management_table_header_non_fsusername = BI.Constants.getConstant("zch.constants.member.management.table.header.nonfsusername"), e.member_management_table_header_fsusername = BI.Constants.getConstant("zch.constants.member.management.table.header.fsusername"), e.matchingFsWayPane = e._createMatchingFsWayPane(), e.synMemberPane = e._createSynMemberPane(), { + type: "bi.vertical", + vgap: 14, + hgap: 14, + items: [{el: e.matchingFsWayPane}, {el: e.synMemberPane}] + } + }, mounted: function () { + Dec.Zch.Util.formatTableStyle(), this.store.initData(), this._clearPageEditor() + }, _createMatchingFsWayPane: function () { + var t = this; + return { + type: "bi.vertical", + cls: "weixin-section-container", + lgap: 14, + rgap: 14, + items: [{ + type: "bi.left_right_vertical_adapt", + height: 40, + cls: "bi-border-bottom", + items: { + left: [{ + type: "bi.label", + text: BI.i18nText("FS-Zch_Matching_Way"), + cls: "weixin-title" + }], + right: [{ + width: 80, + height: 24, + type: "bi.button", + text: BI.i18nText("FS-Zch_Save"), + handler: function () { + t._checkValid() ? t.store._saveMatchingFSWayData({ + matchingFsWay: t.matchingFSWayCombo.getValue(), + dataSet: t.dataSetCombo.getValue(), + dataSetFsName: t.fsUserNameCombo.getValue(), + dataSetUserId: t.userIdCombo.getValue() + }) : Dec.Msg.alert({message: BI.i18nText("FS-Zch_Match-Way-Not-Null")}) + } + }] + } + }, { + el: { + type: "bi.vertical_adapt", + items: [{ + type: "bi.label", + text: BI.i18nText("FS-Zch_Match_Way"), + width: 116, + textAlign: "left" + }, { + type: "zch.editor_text_value_combo", + width: 150, + height: 24, + items: [ + { + text: "手工匹配", + value: 2 + },{ + text: "手机号匹配", + value: 1 + },{ + text: "员工编号", + value: 3 + } + + ], + ref: function (e) { + t.matchingFSWayCombo = e + }, + listeners: [{ + eventName: "EVENT_CHANGE", action: function () { + switch (this.getValue()) { + case 0: + case 1: + t.dataSetContainer.setVisible(false), t.memberTableNonFsUserName.setVisible(!0), t.memberTableWithFsUserName.setVisible(!1); + break; + case 2: + t.dataSetContainer.setVisible(false), t.memberTableNonFsUserName.setVisible(!1), t.memberTableWithFsUserName.setVisible(!0); + break; + case 3: + t.dataSetContainer.setVisible(true), t.memberTableNonFsUserName.setVisible(!0), t.memberTableWithFsUserName.setVisible(!1) + } + t._getWeiXinMemberTab().getSelect() === e ? t._refreshDepartmentData() : t._getWeiXinMemberTab().getSelect() === i && t._refreshTagData() + } + }] + }] + }, vgap: 10 + }, { + el: { + type: "bi.vertical_adapt", + cls: "weixin-matching-fs-way-pane-row-gap", + invisible: !0, + items: [{ + type: "bi.label", + text: BI.i18nText("FS-Zch_Match_Setting"), + width: 116, + textAlign: "left" + }, { + type: "zch.editor_text_value_combo", + width: 150, + height: 24, + rgap: 10, + watermark: BI.i18nText("FS-Zch_DataSet"), + items: [], + ref: function (e) { + t.dataSetCombo = e + }, + listeners: [{ + eventName: BI.TextValueCombo.EVENT_CHANGE, action: function () { + t.store.getDataSetColumn(this.getValue()) + } + }] + }, { + type: "zch.editor_text_value_combo", + width: 150, + height: 24, + rgap: 10, + watermark: BI.i18nText("FS-Zch_UserId"), + items: t.model.tableDataColName, + ref: function (e) { + t.userIdCombo = e + } + }, { + type: "zch.editor_text_value_combo", + width: 150, + height: 24, + rgap: 10, + watermark: BI.i18nText("FS-Zch_FsUserName"), + items: t.model.tableDataColName, + ref: function (e) { + t.fsUserNameCombo = e + } + }], + ref: function (e) { + t.dataSetContainer = e + } + }, vgap: 10 + }] + } + }, _createSynMemberPane: function () { + var t = this; + return { + type: "bi.vertical", + cls: "weixin-section-container", + lgap: 14, + rgap: 14, + items: [{ + type: "bi.left_right_vertical_adapt", + cls: "bi-border-bottom", + height: 40, + items: { + left: [{ + type: "bi.label", + text: BI.i18nText("FS-Zch_Address_Book"), + cls: "weixin-title" + }] + } + }, { + type: "bi.left_right_vertical_adapt", + height: 54, + items: { + left: [{ + type: "bi.icon_text_item", + text: BI.i18nText("FS-Zch_Member_Update"), + cls: "weixin-refresh-font", + width: 90, + height: 20, + handler: function () { + t.synMember() + } + } + // , { + // type: "bi.text_button", + // cls: "weixin-member-auto-update-button", + // text: BI.i18nText("FS-Zch_Set_Update"), + // handler: function () { + // t.store._getScheduleTaskConfig(function (e) { + // t._createAutoUpdateMemberPopupPane({ + // executeTimingTask: e.executeTimingTask, + // timingTaskFrequencyType: e.timingTaskFrequencyType, + // timingTaskStartDay: e.timingTaskStartDay, + // timingTaskStartHour: e.timingTaskStartHour, + // timingTaskStartMinute: e.timingTaskStartMinute + // }) + // }) + // } + // } + ], right: [{ + type: "bi.search_editor", width: 150, height: 24, ref: function (e) { + t.weixinMemberSearchEditor = e + }, listeners: [{ + eventName: BI.SearchEditor.EVENT_CLEAR, action: function () { + t._clearPageEditor(), t._getWeiXinMemberTab().getSelect() === e ? t._refreshDepartmentData() : t._getWeiXinMemberTab().getSelect() === i && t._refreshTagData() + } + }, { + eventName: BI.Editor.EVENT_CONFIRM, action: function () { + t._clearPageEditor(), t._getWeiXinMemberTab().getSelect() === e ? t._refreshDepartmentData() : t._getWeiXinMemberTab().getSelect() === i && t._refreshTagData() + } + }] + }] + } + }, { + type: "bi.htape", + height: 456, + cls: "bi-border-top", + items: [{ + type: "zch.member.management.tab", + cls: "bi-border-right", + width: 200, + ref: function (e) { + t.treeManagementPane = e + }, + refreshDepartmentData: BI.bind(t._refreshDepartmentData, t), + refreshTagData: BI.bind(t._refreshTagData, t), + clearPageEditor: BI.bind(t._clearPageEditor, t) + }, { + type: "bi.vertical", + items: [{ + type: "bi.preview_table", + lgap: 10, + tgap: 10, + cls: "weixin-table", + isNeedMerge: !1, + isNeedFreeze: !1, + columnSize: [.264, .264, .264, .208], + header: t.member_management_table_header_non_fsusername, + items: [], + ref: function (e) { + t.memberTableNonFsUserName = e + } + }, { + type: "bi.preview_table", + lgap: 10, + tgap: 10, + cls: "weixin-table", + isNeedMerge: !1, + isNeedFreeze: !1, + columnSize: [.212, .212, .212, .212, .153], + header: t.member_management_table_header_fsusername, + invisible: !0, + items: [], + ref: function (e) { + t.memberTableWithFsUserName = e + } + }, { + type: "bi.left_right_vertical_adapt", + tgap: 10, + height: 26, + items: { + right: [{ + type: "bi.horizontal", + items: [{ + type: "bi.icon_button", + width: 24, + height: 24, + cls: "page-button dec-pager-first-font", + handler: function () { + 1 < t.currentPage && (t.currentPage = 1, t.memberPageEditor.setValue(t.currentPage.toString()), t._getWeiXinMemberTab().getSelect() === e ? t._refreshDepartmentData() : t._getWeiXinMemberTab().getSelect() === i && t._refreshTagData()) + } + }, { + type: "bi.icon_button", + width: 24, + height: 24, + lgap: 5, + cls: "page-button dec-pager-prev-font", + disabled: !0, + ref: function (e) { + t.previousPageButton = e + }, + handler: function () { + 1 < t.currentPage && (t.currentPage -= 1, t.memberPageEditor.setValue(t.currentPage.toString()), t._getWeiXinMemberTab().getSelect() === e ? t._refreshDepartmentData() : t._getWeiXinMemberTab().getSelect() === i && t._refreshTagData()) + } + }, { + type: "bi.editor", + cls: "bi-border", + allowBlank: !0, + width: 40, + height: 24, + lgap: 5, + rgap: 5, + value: t.currentPage.toString(), + ref: function (e) { + t.memberPageEditor = e + }, + listeners: [{ + eventName: BI.Editor.EVENT_CONFIRM, action: function () { + this.getValue() > t.totalPage ? this.setValue(t.totalPage) : this.getValue() < 1 && this.setValue(1), t.currentPage = parseInt(this.getValue()), t._getWeiXinMemberTab().getSelect() === e ? t._refreshDepartmentData() : t._getWeiXinMemberTab().getSelect() === i && t._refreshTagData() + } + }] + }, {type: "bi.label", width: 5, height: 24, text: "/ "}, { + type: "bi.label", + height: 24, + lgap: 5, + text: "1", + ref: function (e) { + t.memberPageLabel = e + } + }, { + type: "bi.icon_button", + width: 24, + height: 24, + lgap: 5, + cls: "page-button dec-pager-next-font", + ref: function (e) { + t.nextPageButton = e + }, + handler: function () { + t.currentPage < t.totalPage && (t.currentPage += 1, t.memberPageEditor.setValue(t.currentPage.toString()), t._getWeiXinMemberTab().getSelect() === e ? t._refreshDepartmentData() : t._getWeiXinMemberTab().getSelect() === i && t._refreshTagData()) + } + }, { + type: "bi.icon_button", + width: 24, + height: 24, + lgap: 5, + cls: "page-button dec-pager-last-font", + handler: function () { + t.currentPage < t.totalPage && (t.currentPage = t.totalPage, t.memberPageEditor.setValue(t.currentPage.toString()), t._getWeiXinMemberTab().getSelect() === e ? t._refreshDepartmentData() : t._getWeiXinMemberTab().getSelect() === i && t._refreshTagData()) + } + }] + }] + } + }] + }] + }] + } + }, _refreshDepartmentData: function () { + this.store.getDepMemberData({ + depId: this._getDepTree().getValue()[0] ? this._getDepTree().getValue()[0] : "", + keyword: this.weixinMemberSearchEditor.getValue(), + startIdx: 10 * (this.currentPage - 1) + }) + }, _refreshTagData: function () { + this.store.getTagMemberData({ + sysKey: this._getTagTree().getValue()[0] ? this._getTagTree().getValue()[0].sysKey : "", + tagId: this._getTagTree().getValue()[0] ? this._getTagTree().getValue()[0].tagId : "", + keyword: this.weixinMemberSearchEditor.getValue(), + startIdx: 10 * (this.currentPage - 1) + }) + }, _populateWeiXinPageNumberButtons: function (e) { + var t = e.userList.total; + this.totalPage = t ? Math.ceil(t / 10) : 1, this.memberPageLabel.setValue(this.totalPage), 1 === this.totalPage && 1 === this.currentPage ? (this.nextPageButton.setEnable(!1), this.previousPageButton.setEnable(!1)) : 1 === this.currentPage ? (this.nextPageButton.setEnable(!0), this.previousPageButton.setEnable(!1)) : (this.currentPage === this.totalPage ? this.nextPageButton.setEnable(!1) : this.nextPageButton.setEnable(!0), this.previousPageButton.setEnable(!0)) + }, _populateWeiXinMemberTable: function (e) { + var t, i = this, n = [], a = [], r = e.userList.users ? e.userList.users : []; + if (2 === i.matchingFSWayCombo.getValue()) { + for (var o = 0; o < r.length; o++) { + var s = Dec.Zch.Util.replaceDepartmentArrToString(r[o]); + n.push(function (t) { + return [{type: "bi.label", text: r[t].userid, lgap: 5, height: 32}, { + type: "zch.user.combo", + value: BI.isEmpty(r[t].fsUserName) ? null : r[t].fsUserName, + count: 10, + height: 24, + ref: function (e) { + i.fsUserNameComboGroup[t] = e + }, + listeners: [{ + eventName: "EVENT_CONFIRM", action: function (e) { + i.store._saveFsUserRelationData(r[t], e) + } + }] + }, {type: "bi.label", text: r[t].name, lgap: 5, height: 32}, { + type: "bi.label", + text: s, + lgap: 5, + height: 32 + }, {type: "bi.label", text: r[t].mobile, lgap: 5, height: 32}] + }(o)) + } + i.memberTableWithFsUserName.populate(n) + } else { + for (o = 0; o < r.length; o++) { + s = Dec.Zch.Util.replaceDepartmentArrToString(r[o]); + a.push([{type: "bi.label", text: r[t = o].userid, lgap: 5, height: 32}, { + type: "bi.label", + text: r[t].name, + lgap: 5, + height: 32 + }, {type: "bi.label", text: s, lgap: 5, height: 32}, { + type: "bi.label", + text: r[t].mobile, + lgap: 5, + height: 32 + }]) + } + i.memberTableNonFsUserName.populate(a) + } + Dec.Zch.Util.formatTableStyle() + }, _createAutoUpdateMemberPopupPane: function (e) { + var t = BI.Constants.getConstant("zch.constants").popup_auto_update_member, i = BI.extend(e, { + type: "zch.schedule.task.popover", + listeners: [{ + eventName: "EVENT_CLOSE", action: function () { + BI.Popovers.remove(t) + } + }] + }); + BI.Popovers.create(t, { + cls: "weixin-container", + header: { + type: "bi.left_vertical_adapt", + hgap: 5, + items: [{type: "bi.label", forceCenter: !0, text: BI.i18nText("FS-Zch_Set_Update")}] + }, + body: i, + width: 455, + height: 245, + listeners: [{ + eventName: "EVENT_CLOSE", action: function () { + BI.Popovers.remove(t) + } + }] + }).open(t), $(".weixin-popup-cancel-button").css("border", "1px solid #3685F2").css("border-radius", "2px").css("color", "#3685F2"), $(".weixin-popup-confirm-button").css("border-radius", "2px"), $(".weixin-auto-update-popup-content").css("top", "10px"), $(".weixin-popup-south-container").css("right", "0px").css("left", "0px") + }, _getDepTree: function () { + return this.treeManagementPane._getDepTree() + }, _getTagTree: function () { + return this.treeManagementPane._getTagTree() + }, _getWeiXinMemberTab: function () { + return this.treeManagementPane._getTab() + }, _clearPageEditor: function () { + this.memberPageEditor.setValue(1), this.currentPage = 1, this.nextPageButton.setEnable(!0), this.previousPageButton.setEnable(!1) + }, synMember: function () { + var e = this; + e.store.synMemberData(function () { + e.treeManagementPane.caculateTree() + }) + }, _checkValid: function () { + return this.matchingFSWayCombo.getValue() !== BI.Constants.getConstant("zch.constants").matching_fs_way_dataSet || !(Dec.Zch.Util.isEmpty(this.dataSetCombo.getValue()) || Dec.Zch.Util.isEmpty(this.fsUserNameCombo.getValue()) || Dec.Zch.Util.isEmpty(this.userIdCombo.getValue())) + } + }); + BI.shortcut("zch.membermanagement", t) + }(), function () { + var e = BI.inherit(Fix.Model, { + childContext: ["depMember", "tagMember"], state: function () { + return {depMember: [], tagMember: [], matchConfig: {}, serverTables: [], tableColNames: []} + }, computed: { + serverTableData: function () { + return BI.map(this.model.serverTables, function (e, t) { + return {text: t.dataSetName, value: t.dataSetValue} + }) + }, tableDataColName: function () { + return BI.map(this.model.tableColNames, function (e, t) { + return {text: t.columnName, value: t.columnValue} + }) + } + }, actions: { + initData: function () { + var n = this; + Dec.Zch.Util.ajax({ + url: "/zch/match/method", type: "GET", complete: function (e, t) { + if ("success" === t) { + var i = BI.jsonDecode(e.responseText); + i.errorCode === Dec.Zch.ERROR_CODE_OK ? (n.model.matchConfig = i, Dec.reqGet("/v10/serverdatasets", {}, function (e) { + n.model.serverTables = e.data + })) : Dec.Msg.alert({message: Dec.Zch.Util.handleCommonErr(i)}) + } + } + }) + }, _saveMatchingFSWayData: function (e) { + Dec.Zch.Util.ajax({ + url: "/zch/match/method", type: "POST", data: e, complete: function (e, t) { + if ("success" === t) { + var i = BI.jsonDecode(e.responseText); + i.errorCode === Dec.Zch.ERROR_CODE_OK ? BI.Msg.toast(BI.i18nText("Dec-Basic_Success")) : Dec.Msg.alert({message: Dec.Zch.Util.handleCommonErr(i)}) + } + } + }) + }, _getScheduleTaskConfig: function (n) { + var a = this; + Dec.Zch.Util.ajax({ + url: "/weixin/timing/task", type: "GET", data: {}, complete: function (e, t) { + if ("success" === t) { + var i = BI.jsonDecode(e.responseText); + i.errorCode === Dec.Zch.ERROR_CODE_OK ? BI.isFunction(n) && n.call(a, i) : Dec.Msg.alert({message: Dec.Zch.Util.handleCommonErr(i)}) + } + } + }) + }, _saveFsUserRelationData: function (n, e) { + var t = n.userid, i = n.id, a = {weiXinUser: t, fsUser: BI.isEmpty(e) ? "" : e}; + BI.isEmpty(i) || (a.id = i), Dec.Zch.Util.ajax({ + url: "/zch/user/relation", + type: "POST", + data: a, + complete: function (e, t) { + if ("success" === t) { + var i = BI.jsonDecode(e.responseText); + i.errorCode === Dec.Zch.ERROR_CODE_OK ? (n.id = i.id, BI.Msg.toast(BI.i18nText("Dec-Basic_Success"))) : Dec.Msg.alert({message: Dec.Zch.Util.handleCommonErr(i)}) + } + } + }) + }, getDataSetColumn: function (e) { + var i = this; + Dec.reqGet("/v10/" + e + "/datasetcolumns", {}, function (e) { + var t = e.data; + t && (i.model.tableColNames = t) + }) + }, getDepMemberData: function (e) { + var n = this, t = "", i = "", a = "", r = "", o = 0, s = 10, l = e; + l instanceof Object && (t = l.keyword || "", i = l.corpId || "", a = l.secret || "", r = l.depId || "", o = l.startIdx || 0, s = l.count || 10); + var c = BI.Constants.getConstant("zch.constants").popup_loading_syn_users, + u = Dec.Zch.Util.showLoading(".weixin-member-management-container", BI.i18nText("FS-Zch_Loading"), c); + Dec.Zch.Util.ajax({ + url: "/zch/dep/member", + type: "POST", + data: {keyword: t, corpId: i, secret: a, depId: r, startIdx: o, count: s}, + complete: function (e, t) { + if (u.remove(c), "success" === t) { + var i = BI.jsonDecode(e.responseText); + i.errorCode === Dec.Zch.ERROR_CODE_OK ? n.model.depMember = i : Dec.Msg.alert({message: Dec.Zch.Util.handleCommonErr(i)}) + } + } + }) + }, getTagMemberData: function (e) { + var n = this, t = "", i = "", a = "", r = 0, o = 10, s = e; + s instanceof Object && (t = s.keyword || "", i = s.corpId || "", a = s.tagId || "", r = s.startIdx || 0, o = s.count || 10); + var l = BI.Constants.getConstant("zch.constants").popup_loading_syn_users, + c = Dec.Zch.Util.showLoading(".weixin-member-management-container", BI.i18nText("FS-Zch_Loading"), l); + Dec.Zch.Util.ajax({ + url: "/weixin/tag/member", + type: "POST", + data: {keyword: t, corpId: i, tagId: a, startIdx: r, count: o}, + complete: function (e, t) { + if (c.remove(l), "success" === t) { + var i = BI.jsonDecode(e.responseText); + i.errorCode === Dec.Zch.ERROR_CODE_OK ? n.model.tagMember = i : Dec.Msg.alert({message: Dec.Zch.Util.handleCommonErr(i)}) + } + } + }) + }, synMemberData: function (e) { + Dec.Zch.Util.synMemberData(function () { + BI.isFunction(e) && e() + }) + } + } + }); + BI.model("zch.model.member.management", e) + }(), function () { + var i = BI.inherit(BI.Trigger, { + _const: {hgap: 4}, _defaultConfig: function () { + var e = i.superclass._defaultConfig.apply(this, arguments); + return BI.extend(e, { + baseCls: (e.baseCls || "") + " bi-editor-trigger bi-border", + height: 24, + allowBlank: !1, + watermark: "", + errorText: "", + editable: !1, + items: [] + }) + }, _init: function () { + this.options.height -= 2, i.superclass._init.apply(this, arguments); + var e = this, t = this.options; + this._const; + this.editor = BI.createWidget({ + type: "zch.sign_editor", + height: t.height, + value: t.value, + allowBlank: t.allowBlank, + watermark: t.watermark, + errorText: t.errorText, + editable: t.editable, + items: t.items + }), this.editor.on(BI.Controller.EVENT_CHANGE, function () { + e.fireEvent(BI.Controller.EVENT_CHANGE, arguments) + }), this.editor.on(BI.SignEditor.EVENT_CHANGE, function () { + e.fireEvent(i.EVENT_CHANGE, arguments) + }), BI.createWidget({ + element: this, + type: "bi.htape", + items: [{el: this.editor}, { + el: {type: "bi.trigger_icon_button", width: t.triggerWidth || t.height}, + width: t.triggerWidth || t.height + }] + }) + }, populate: function (e) { + this.editor.options.items = e + }, getValue: function () { + return this.editor.getValue() + }, setValue: function (e) { + this.editor.setValue(e) + }, setText: function (e) { + this.editor.setState(e) + } + }); + i.EVENT_CHANGE = "EVENT_CHANGE", BI.shortcut("zch.editor_trigger", i) + }(), function () { + var t = BI.inherit(BI.Trigger, { + props: {baseCls: "bi-search-text-value-trigger", height: 30}, render: function () { + var e = this, r = this.options; + return { + type: "bi.htape", items: [{ + el: { + type: "bi.searcher", + ref: function () { + e.searcher = this + }, + isAutoSearch: !1, + el: { + type: "zch.state_editor", ref: function () { + e.editor = this + }, text: this._digest(r.value, r.items), value: r.value, height: r.height + }, + popup: { + type: "bi.search_text_value_combo_popup", + cls: "bi-card", + chooseType: BI.ButtonGroup.CHOOSE_TYPE_SINGLE + }, + onSearch: function (e, t) { + var i = e.keyword, n = BI.Func.getSearchResult(r.items, i), a = n.matched; + t(n.finded, a) + }, + listeners: [{ + eventName: BI.Searcher.EVENT_CHANGE, action: function () { + e.fireEvent(t.EVENT_CHANGE) + } + }] + } + }, {el: {type: "bi.layout", width: 30}, width: 30}] + } + }, _setState: function (e) { + this.editor.setState(e) + }, _digest: function (i, e) { + var t = this.options; + i = BI.isArray(i) ? i : [i]; + var n = [], a = BI.Tree.transformToArrayFormat(e); + return BI.each(a, function (e, t) { + BI.deepContains(i, t.value) && !n.contains(t.text || t.value) && n.push(t.text || t.value) + }), 0 < n.length ? n.join(",") : t.text + }, stopEditing: function () { + this.searcher.stopSearch() + }, getSearcher: function () { + return this.searcher + }, populate: function (e) { + this.options.items = e + }, setValue: function (e) { + this._setState(this._digest(e, this.options.items)) + }, getValue: function () { + return this.searcher.getValue() + } + }); + t.EVENT_SEARCHING = "EVENT_SEARCHING", t.EVENT_STOP = "EVENT_STOP", t.EVENT_START = "EVENT_START", t.EVENT_CHANGE = "EVENT_CHANGE", BI.shortcut("zch.search_text_value_trigger", t) + }(), function () { + var t = BI.inherit(BI.BasicButton, { + props: { + baseCls: "bi-line-segment-button bi-list-item-effect cursor-pointer", + once: !0, + readonly: !0, + hgap: 10, + height: 25 + }, render: function () { + var e = this.options; + this.text = BI.createWidget({ + type: "bi.label", + element: this, + text: e.text, + width: e.width, + height: e.height, + value: e.value, + hgap: e.hgap + }), this.line = BI.createWidget({ + type: "bi.layout", + cls: "line-segment-button-line", + height: 2 + }), BI.createWidget({ + type: "bi.absolute", + element: this, + items: [{el: this.line, left: e.hgap - 1, right: e.hgap - 1, bottom: 0}] + }) + }, setSelected: function (e) { + t.superclass.setSelected.apply(this, arguments), e ? this.line.element.addClass("bi-high-light-background") : this.line.element.removeClass("bi-high-light-background") + }, setText: function (e) { + t.superclass.setText.apply(this, arguments), this.text.setText(e) + }, destroy: function () { + t.superclass.destroy.apply(this, arguments) + } + }); + BI.shortcut("zch.line_segment_button", t) + }(), function () { + var n = BI.inherit(BI.Widget, { + props: { + baseCls: "decision-line-segment", + items: [], + height: 30, + layouts: [{type: "bi.horizontal"}], + defaultValue: null + }, render: function () { + var i = this, e = this.options; + BI.isNumber(e.height) && this.element.css({ + height: e.height, + lineHeight: e.height + "px" + }), this.buttonGroup = BI.createWidget({ + element: this, + type: "bi.button_group", + items: BI.createItems(e.items, {type: "zch.line_segment_button", height: e.height}), + layouts: e.layouts + }), this.buttonGroup.on(BI.Controller.EVENT_CHANGE, function () { + i.fireEvent(BI.Controller.EVENT_CHANGE, arguments) + }), this.buttonGroup.on(BI.ButtonGroup.EVENT_CHANGE, function (e, t) { + i.fireEvent(n.EVENT_CHANGE, e, t) + }), BI.isNull(e.defaultValue) || this.setValue(e.defaultValue) + }, setValue: function (e) { + this.buttonGroup.setValue(e) + }, setEnabledValue: function (e) { + this.buttonGroup.setEnabledValue(e) + }, getValue: function () { + return this.buttonGroup.getValue() + }, populate: function (e) { + var t = this.options; + this.buttonGroup.populate(BI.createItems(e, {type: "zch.line_segment_button", height: t.height})) + } + }); + n.EVENT_CHANGE = "EVENT_CHANGE", BI.shortcut("zch.line_segment", n) + }(), (function () { + //MySystemOption 的id + Dec.Plugin.Management.addItem({ + id: "MeixinSystemOption", + value: "MySystemOption", + displayName: "华发+管理", + cls: "setting-font", + cardType: "dec.plugin.zch" + }) + })() + , function () { + var e = BI.inherit(BI.Widget, { + _store: function () { + return BI.Models.getModel("zch.model.entry") + }, beforeInit: function (e) { + this.store.checkLisence(e) + }, render: function () { + return this.model.authorized ? {type: "zch.Tab", cls: "weixin-container"} : { + type: "bi.adaptive", + items: [{type: "bi.iframe", cls: "bi-card", src: resolvePath("/weixin/expired", !1)}] + } + } + }); + BI.shortcut("dec.plugin.zch", e) + }(), function () { + var e = BI.inherit(Fix.Model, { + state: function () { + return {authorized: !0} + }, actions: { + checkLisence: function (n) { + var a = this; + Dec.Zch.Util.ajax({ + url: "/zch/check/license", type: "GET", complete: function (e, t) { + if ("success" === t) { + var i = BI.jsonDecode(e.responseText); + i.errorCode === Dec.Zch.ERROR_CODE_OK ? (a.model.authorized = i.authorized, n()) : Dec.Msg.alert({message: Dec.Zch.Util.handleCommonErr(i)}) + } + } + }) + } + } + }); + BI.model("zch.model.entry", e) + }(), (function () { + debugger + //注入定时调度 + Dec.Plugin.OutPutActionProvider.items.push({ + version: 1, + terminalType: 64, + terminalText: "华发+", + getItem: function () { + var t = this; + return { + type: "zch.schedule", invisible: !0, + ref: function (e) { + t.weChatItem = e + } + } + }, + setValue: function (e) { + e.terminal && 64 === e.terminal && (this.value = e, this.weChatItem.setValue(e)) + }, + getValue: function () { + var v= this.weChatItem.getValue(); + return { + OutputMeixin: BI.extend(this.value, { + // "@class": "com.fr.plugin.weixin.server.bean.OutputWeiXin", + // actionName: "com.fr.plugin.weixin.server.bean.OutputWeiXin", + "@class": "com.fr.plugin.beans.MyOutputBean", + actionName: "com.fr.plugin.beans.MyOutputBean", + terminal: 64, + agentId: v.agentId, + messageType:v.messageType, + platform:v.platform + }) + } + }, + checkValid: function () { + return this.weChatItem.checkValid() + }, + fireEvent: function (e) { + this.weChatItem.setVisible(e) + } + }) + })(), function () { + var e = BI.inherit(BI.Widget, { + _store: function () { + return BI.Models.getModel("zch.model.schedule") + }, watch: { + agentIds: function (e) { + this.combo.populate(e), this.combo.setValue(this.model.selectedId) + }, + selectedId: function (e) { + this.combo.setValue(e) + }, + selectedPlatform: function (e) { + this.platformCombo.setValue(e) + }, + selectedMessageType: function (e) { + this.messageTypeCombo.setValue(e) + } + }, render: function () { + var t = this; + debugger + return { + type:"bi.vertical", + items:[ + { + type: "bi.text_value_combo", + width: 281, + height: 24, + value: t.model.selectedId, + ref: function (e) { + t.combo = e + }, + listeners: [{ + eventName: BI.TextValueCombo.EVENT_CHANGE, action: function () { + t.store.setSelectedId(this.getValue()[0]) + } + }], + items: t.model.agentIds + }, + { + type: "bi.text_value_combo", + width: 281, + height: 24, + value: t.model.selectedMessageType, + ref: function (e) { + t.messageTypeCombo = e + }, + listeners: [{ + eventName: BI.TextValueCombo.EVENT_CHANGE, action: function () { + t.store.setMessageType(this.getValue()[0]) + } + }], + items: [ + { + text:"图文", + value:"1" + }, + { + text:"纯图", + value:"2" + }, + { + text:"纯文字", + value:"3" + } + ] + }, + { + type: "bi.text_value_combo", + width: 281, + height: 24, + value: t.model.selectedPlatform, + ref: function (e) { + t.platformCombo = e + }, + listeners: [{ + eventName: BI.TextValueCombo.EVENT_CHANGE, action: function () { + t.store.setPlatform(this.getValue()[0]) + } + }], + items: [ + { + text:"PC和移动端", + value:"0" + }, + { + text:"PC", + value:"1" + }, + { + text:"移动端", + value:"2" + } + + ] + }, + ] + }; + + }, mounted: function () { + this.store.getAgents() + }, getValue: function () { + return { + agentId:this.store.getSelectedId(), + platform:this.store.getPlatform(), + messageType:this.store.getMessageType() + } + }, setValue: function (e) { + if (e) { + this.store.setSelectedId(e.agentId) + this.store.setPlatform(e.platform+"") + this.store.setMessageType(e.messageType+"") + } + }, checkValid: function () { + return !BI.isEmpty(this.combo.getValue()[0]) + } + }); + BI.shortcut("zch.schedule", e) + }(), + function () { + var e = BI.inherit(Fix.Model, { + state: function () { + return {agents: [], + selectedId: "", + selectedPlatform:"1", + selectedMessageType:"1" + } + }, computed: { + agentIds: function () { + return BI.map(this.model.agents, function (e, t) { + return {text: t.agentName + "-" + t.sysKey, value: t.id} + }) + } + }, actions: { + setAgents: function (e) { + this.model.agents = e + }, + getAgents: function () { + var n = this; + Dec.Zch.Util.ajax({ + url: "/zch/agent", type: "GET", complete: function (e, t) { + if ("success" === t) { + var i = BI.jsonDecode(e.responseText); + i.errorCode === Dec.Zch.ERROR_CODE_OK ? n.model.agents = i.agentList : Dec.Msg.alert({message: Dec.Zch.Util.handleCommonErr(i)}) + } + } + }) + }, + getSelectedId: function () { + return this.model.selectedId + }, + setSelectedId: function (e) { + this.model.selectedId = e + }, + getPlatform: function () { + return this.model.selectedPlatform + }, + setPlatform: function (e) { + this.model.selectedPlatform = e + }, + getMessageType: function () { + return this.model.selectedMessageType + }, + setMessageType: function (e) { + this.model.selectedMessageType = e + }, + } + }); + BI.model("zch.model.schedule", e) + }(); + }) +();