LAPTOP-SB56SG4Q\86185
3 years ago
30 changed files with 2497 additions and 1 deletions
Binary file not shown.
@ -1,3 +1,6 @@
|
||||
# open-JSD-9435 |
||||
|
||||
JSD-9435 OA推送 |
||||
JSD-9435 OA推送\ |
||||
免责说明:该源码为第三方爱好者提供,不保证源码和方案的可靠性,也不提供任何形式的源码教学指导和协助!\ |
||||
仅作为开发者学习参考使用!禁止用于任何商业用途!\ |
||||
为保护开发者隐私,开发者信息已隐去!若原开发者希望公开自己的信息,可联系hugh处理。 |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -0,0 +1,24 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?><plugin> |
||||
<id>com.eco.plugin.xxxx.webservicets</id> |
||||
<name><![CDATA[代办推送]]></name> |
||||
<active>yes</active> |
||||
<version>1.0.14</version> |
||||
<env-version>10.0</env-version> |
||||
<jartime>2018-07-31</jartime> |
||||
<vendor>fr.open</vendor> |
||||
<description><![CDATA[代办推送]]></description> |
||||
<change-notes><![CDATA[ |
||||
]]></change-notes> |
||||
<main-package>com.eco.plugin.xxxx.webservicets</main-package> |
||||
<lifecycle-monitor class="com.eco.plugin.xxxx.webservicets.config.InitializeMonitor"/> |
||||
|
||||
<extra-decision> |
||||
<OutputFormulaProvider class="com.eco.plugin.xxxx.webservicets.dsdd.dsdd.DSDDMsgFormula" /> |
||||
<WebResourceProvider class="com.eco.plugin.xxxx.webservicets.dsdd.webresource.DsddWebResourceProvider"/> |
||||
<DecisionDBAccessProvider class="com.eco.plugin.xxxx.webservicets.dsdd.db.DBAccessProvider"/> |
||||
<HttpHandlerProvider class="com.eco.plugin.xxxx.webservicets.handler.ExtendAttrHandlerProvider"/> |
||||
<URLAliasProvider class="com.eco.plugin.xxxx.webservicets.handler.URLAliasProvide"/> |
||||
</extra-decision> |
||||
|
||||
<function-recorder class="com.eco.plugin.xxxx.webservicets.config.WinkSimpleConfig"/> |
||||
</plugin> |
@ -0,0 +1,184 @@
|
||||
package com.eco.plugin.xxxx.webservicets.bean; |
||||
|
||||
public class EmployFLOW { |
||||
private String FlowId; |
||||
private String FlowType; |
||||
private String Submitdate; |
||||
private String SubmitUser; |
||||
private String FlowNode1; |
||||
private String FlowNode2; |
||||
private String CompanyId; |
||||
private String BYZD2; |
||||
private String FlowName; |
||||
private String Type; |
||||
private String Grade; |
||||
private String FlowNode3; |
||||
private String DATATYPE; //报表类型
|
||||
private String SBNF; //上报年份
|
||||
private String SBLX; //上报类型
|
||||
private String bt; |
||||
private String nd ; |
||||
private String year ; |
||||
private String nf; |
||||
private String role; |
||||
|
||||
public String getRole() { |
||||
return role; |
||||
} |
||||
|
||||
public void setRole(String role) { |
||||
this.role = role; |
||||
} |
||||
|
||||
public String getBt() { |
||||
return bt; |
||||
} |
||||
|
||||
public void setBt(String bt) { |
||||
this.bt = bt; |
||||
} |
||||
|
||||
public String getNd() { |
||||
return nd; |
||||
} |
||||
|
||||
public void setNd(String nd) { |
||||
this.nd = nd; |
||||
} |
||||
|
||||
public String getYear() { |
||||
return year; |
||||
} |
||||
|
||||
public void setYear(String year) { |
||||
this.year = year; |
||||
} |
||||
|
||||
public String getNf() { |
||||
return nf; |
||||
} |
||||
|
||||
public void setNf(String nf) { |
||||
this.nf = nf; |
||||
} |
||||
|
||||
public String getSBNF() { |
||||
return SBNF; |
||||
} |
||||
|
||||
public void setSBNF(String SBNF) { |
||||
this.SBNF = SBNF; |
||||
} |
||||
|
||||
public String getSBLX() { |
||||
return SBLX; |
||||
} |
||||
|
||||
public void setSBLX(String SBLX) { |
||||
this.SBLX = SBLX; |
||||
} |
||||
|
||||
public String getFlowId() { |
||||
return FlowId; |
||||
} |
||||
|
||||
public void setFlowId(String flowId) { |
||||
FlowId = flowId; |
||||
} |
||||
|
||||
public String getFlowType() { |
||||
return FlowType; |
||||
} |
||||
|
||||
public void setFlowType(String flowType) { |
||||
FlowType = flowType; |
||||
} |
||||
|
||||
public String getSubmitdate() { |
||||
return Submitdate; |
||||
} |
||||
|
||||
public void setSubmitdate(String submitdate) { |
||||
Submitdate = submitdate; |
||||
} |
||||
|
||||
public String getSubmitUser() { |
||||
return SubmitUser; |
||||
} |
||||
|
||||
public void setSubmitUser(String submitUser) { |
||||
SubmitUser = submitUser; |
||||
} |
||||
|
||||
public String getFlowNode1() { |
||||
return FlowNode1; |
||||
} |
||||
|
||||
public void setFlowNode1(String flowNode1) { |
||||
FlowNode1 = flowNode1; |
||||
} |
||||
|
||||
public String getFlowNode2() { |
||||
return FlowNode2; |
||||
} |
||||
|
||||
public void setFlowNode2(String flowNode2) { |
||||
FlowNode2 = flowNode2; |
||||
} |
||||
|
||||
public String getCompanyId() { |
||||
return CompanyId; |
||||
} |
||||
|
||||
public void setCompanyId(String companyId) { |
||||
CompanyId = companyId; |
||||
} |
||||
|
||||
public String getBYZD2() { |
||||
return BYZD2; |
||||
} |
||||
|
||||
public void setBYZD2(String BYZD2) { |
||||
this.BYZD2 = BYZD2; |
||||
} |
||||
|
||||
public String getFlowName() { |
||||
return FlowName; |
||||
} |
||||
|
||||
public void setFlowName(String flowName) { |
||||
FlowName = flowName; |
||||
} |
||||
|
||||
public String getType() { |
||||
return Type; |
||||
} |
||||
|
||||
public void setType(String type) { |
||||
Type = type; |
||||
} |
||||
|
||||
public String getGrade() { |
||||
return Grade; |
||||
} |
||||
|
||||
public void setGrade(String grade) { |
||||
Grade = grade; |
||||
} |
||||
|
||||
public String getFlowNode3() { |
||||
return FlowNode3; |
||||
} |
||||
|
||||
public void setFlowNode3(String flowNode3) { |
||||
FlowNode3 = flowNode3; |
||||
} |
||||
|
||||
public String getDATATYPE() { |
||||
return DATATYPE; |
||||
} |
||||
|
||||
public void setDATATYPE(String DATATYPE) { |
||||
this.DATATYPE = DATATYPE; |
||||
} |
||||
} |
@ -0,0 +1,33 @@
|
||||
package com.eco.plugin.xxxx.webservicets.config; |
||||
|
||||
import com.eco.plugin.xxxx.webservicets.dsdd.dsdd.DSDDMsgFormula; |
||||
import com.eco.plugin.xxxx.webservicets.dsdd.dsdd.TsBean; |
||||
import com.eco.plugin.xxxx.webservicets.dsdd.dsdd.TsEntity; |
||||
import com.eco.plugin.xxxx.webservicets.dsdd.dsdd.TsHandler; |
||||
import com.fr.plugin.context.PluginContext; |
||||
import com.fr.plugin.observer.inner.AbstractPluginLifecycleMonitor; |
||||
import com.fr.schedule.extension.report.job.output.formula.FormulaBox; |
||||
import com.fr.schedule.feature.ScheduleOutputActionEntityRegister; |
||||
import com.fr.schedule.feature.output.OutputActionHandler; |
||||
|
||||
/** |
||||
* @author fr.open |
||||
* @version 10.0 |
||||
* Created by fr.open on 2021-12-03 |
||||
*/ |
||||
public class InitializeMonitor extends AbstractPluginLifecycleMonitor { |
||||
@Override |
||||
public void afterRun(PluginContext pluginContext) { |
||||
OutputActionHandler.registerHandler(new TsHandler(), TsBean.class.getName()); |
||||
ScheduleOutputActionEntityRegister.getInstance().addClass(TsEntity.class); |
||||
FormulaBox.KEY.register(new DSDDMsgFormula()); |
||||
|
||||
WinkSimpleConfig.getInstance(); |
||||
} |
||||
|
||||
@Override |
||||
public void beforeStop(PluginContext pluginContext) { |
||||
OutputActionHandler.removeOutputHandler(TsBean.class.getName()); |
||||
ScheduleOutputActionEntityRegister.getInstance().removeClass(TsEntity.class); |
||||
} |
||||
} |
@ -0,0 +1,178 @@
|
||||
package com.eco.plugin.xxxx.webservicets.config; |
||||
|
||||
import com.fr.config.*; |
||||
import com.fr.config.holder.Conf; |
||||
import com.fr.config.holder.factory.Holders; |
||||
import com.fr.intelli.record.Focus; |
||||
import com.fr.intelli.record.Original; |
||||
import com.fr.record.analyzer.EnableMetrics; |
||||
|
||||
@Visualization(category = "代办配置") |
||||
@EnableMetrics |
||||
public class WinkSimpleConfig extends DefaultConfiguration { |
||||
|
||||
private static volatile WinkSimpleConfig config = null; |
||||
|
||||
@Focus(id="com.eco.plugin.xxxx.webservicets.config", text = "单点登录配置", source = Original.PLUGIN) |
||||
public static WinkSimpleConfig getInstance() { |
||||
if (config == null) { |
||||
config = ConfigContext.getConfigInstance(WinkSimpleConfig.class); |
||||
} |
||||
return config; |
||||
} |
||||
|
||||
@Identifier(value = "tempname", name = "模板名称", description = "模板名称", status = Status.SHOW) |
||||
private Conf<String> tempname = Holders.simple(""); |
||||
|
||||
@Identifier(value = "tburl", name = "填报地址", description = "填报地址", status = Status.SHOW) |
||||
private Conf<String> tburl = Holders.simple(""); |
||||
|
||||
@Identifier(value = "shurl", name = "审核地址", description = "审核地址", status = Status.SHOW) |
||||
private Conf<String> shurl = Holders.simple(""); |
||||
|
||||
@Identifier(value = "userWsdlUrl", name = "userWsdlUrl", description = "userWsdlUrl", status = Status.SHOW) |
||||
private Conf<String> userWsdlUrl = Holders.simple(""); |
||||
|
||||
@Identifier(value = "userNamespace", name = "userNamespace", description = "userNamespace", status = Status.SHOW) |
||||
private Conf<String> userNamespace = Holders.simple(""); |
||||
|
||||
@Identifier(value = "userMethod", name = "userMethod", description = "userMethod", status = Status.SHOW) |
||||
private Conf<String> userMethod = Holders.simple(""); |
||||
|
||||
@Identifier(value = "userKey", name = "userKey", description = "userKey", status = Status.SHOW) |
||||
private Conf<String> userKey = Holders.simple(""); |
||||
|
||||
@Identifier(value = "loginWsdlUrl", name = "loginWsdlUrl", description = "loginWsdlUrl", status = Status.SHOW) |
||||
private Conf<String> loginWsdlUrl = Holders.simple(""); |
||||
|
||||
@Identifier(value = "loginNamespace", name = "loginNamespace", description = "loginNamespace", status = Status.SHOW) |
||||
private Conf<String> loginNamespace = Holders.simple(""); |
||||
|
||||
@Identifier(value = "loginMethod", name = "loginMethod", description = "loginMethod", status = Status.SHOW) |
||||
private Conf<String> loginMethod = Holders.simple(""); |
||||
|
||||
@Identifier(value = "OAWsdlUrl", name = "OAWsdlUrl", description = "OAWsdlUrl", status = Status.SHOW) |
||||
private Conf<String> OAWsdlUrl = Holders.simple(""); |
||||
|
||||
@Identifier(value = "OANamespace", name = "OANamespace", description = "OANamespace", status = Status.SHOW) |
||||
private Conf<String> OANamespace = Holders.simple(""); |
||||
|
||||
@Identifier(value = "OAMethod", name = "OAMethod", description = "OAMethod", status = Status.SHOW) |
||||
private Conf<String> OAMethod = Holders.simple(""); |
||||
|
||||
public String getTempname() { |
||||
return tempname.get(); |
||||
} |
||||
|
||||
public void setTempname(String url) { |
||||
this.tempname.set(url); |
||||
} |
||||
|
||||
public String getTburl() { |
||||
return tburl.get(); |
||||
} |
||||
|
||||
public void setTburl(String url) { |
||||
this.tburl.set(url); |
||||
} |
||||
|
||||
public String getShurl() { |
||||
return shurl.get(); |
||||
} |
||||
|
||||
public void setShurl(String url) { |
||||
this.shurl.set(url); |
||||
} |
||||
|
||||
public String getUserWsdlUrl() { |
||||
return userWsdlUrl.get(); |
||||
} |
||||
|
||||
public void setUserWsdlUrl(String url) { |
||||
this.userWsdlUrl.set(url); |
||||
} |
||||
|
||||
public String getUserNamespace() { |
||||
return userNamespace.get(); |
||||
} |
||||
|
||||
public void setUserNamespace(String url) { |
||||
this.userNamespace.set(url); |
||||
} |
||||
|
||||
public String getUserMethod() { |
||||
return userMethod.get(); |
||||
} |
||||
|
||||
public void setUserMethod(String url) { |
||||
this.userMethod.set(url); |
||||
} |
||||
|
||||
public String getUserKey() { |
||||
return userKey.get(); |
||||
} |
||||
|
||||
public void setUserKey(String url) { |
||||
this.userKey.set(url); |
||||
} |
||||
|
||||
public String getLoginWsdlUrl() { |
||||
return loginWsdlUrl.get(); |
||||
} |
||||
|
||||
public void setLoginWsdlUrl(String url) { |
||||
this.loginWsdlUrl.set(url); |
||||
} |
||||
|
||||
public String getLoginNamespace() { |
||||
return loginNamespace.get(); |
||||
} |
||||
|
||||
public void setLoginNamespace(String url) { |
||||
this.loginNamespace.set(url); |
||||
} |
||||
|
||||
public String getLoginMethod() { |
||||
return loginMethod.get(); |
||||
} |
||||
|
||||
public void setLoginMethod(String url) { |
||||
this.loginMethod.set(url); |
||||
} |
||||
|
||||
public String getOAWsdlUrl() { |
||||
return OAWsdlUrl.get(); |
||||
} |
||||
|
||||
public void setOAWsdlUrl(String url) { |
||||
this.OAWsdlUrl.set(url); |
||||
} |
||||
|
||||
public String getOANamespace() { |
||||
return OANamespace.get(); |
||||
} |
||||
|
||||
public void setOANamespace(String url) { |
||||
this.OANamespace.set(url); |
||||
} |
||||
|
||||
public String getOAMethod() { |
||||
return OAMethod.get(); |
||||
} |
||||
|
||||
public void setOAMethod(String url) { |
||||
this.OAMethod.set(url); |
||||
} |
||||
|
||||
@Override |
||||
public Object clone() throws CloneNotSupportedException { |
||||
WinkSimpleConfig cloned = (WinkSimpleConfig) super.clone(); |
||||
// cloned.text = (Conf<String>) text.clone();
|
||||
// cloned.count = (Conf<Integer>) count.clone();
|
||||
// cloned.price = (Conf<Double>) price.clone();
|
||||
// cloned.time = (Conf<Long>) time.clone();
|
||||
// cloned.student = (Conf<Boolean>) student.clone();
|
||||
return cloned; |
||||
} |
||||
|
||||
} |
@ -0,0 +1,38 @@
|
||||
package com.eco.plugin.xxxx.webservicets.dsdd.db; |
||||
|
||||
import com.eco.plugin.xxxx.webservicets.dsdd.dsdd.TsEntity; |
||||
import com.fr.decision.plugin.db.AbstractDecisionDBAccessProvider; |
||||
import com.fr.stable.db.accessor.DBAccessor; |
||||
import com.fr.stable.db.dao.BaseDAO; |
||||
import com.fr.stable.db.dao.DAOProvider; |
||||
|
||||
public class DBAccessProvider extends AbstractDecisionDBAccessProvider { |
||||
private static DBAccessor dbAccessor = null; |
||||
|
||||
public static DBAccessor getDbAccessor(){ |
||||
return dbAccessor; |
||||
} |
||||
|
||||
|
||||
@Override |
||||
public DAOProvider[] registerDAO() { |
||||
return new DAOProvider[]{ |
||||
new DAOProvider() { |
||||
@Override |
||||
public Class getEntityClass() { |
||||
return TsEntity.class; |
||||
} |
||||
|
||||
@Override |
||||
public Class<? extends BaseDAO> getDAOClass() { |
||||
return Dao.class; |
||||
} |
||||
} |
||||
}; |
||||
} |
||||
|
||||
@Override |
||||
public void onDBAvailable(DBAccessor dbAccessor) { |
||||
this.dbAccessor = dbAccessor; |
||||
} |
||||
} |
@ -0,0 +1,14 @@
|
||||
package com.eco.plugin.xxxx.webservicets.dsdd.db; |
||||
|
||||
import com.eco.plugin.xxxx.webservicets.dsdd.dsdd.TsEntity; |
||||
import com.fr.stable.db.dao.BaseDAO; |
||||
import com.fr.stable.db.session.DAOSession; |
||||
|
||||
/** |
||||
* Created by fr.open on 2021-12-03. |
||||
*/ |
||||
public class Dao extends BaseDAO<TsEntity> { |
||||
public Dao(DAOSession daoSession) { |
||||
super(daoSession); |
||||
} |
||||
} |
@ -0,0 +1,21 @@
|
||||
package com.eco.plugin.xxxx.webservicets.dsdd.dsdd; |
||||
|
||||
import com.fr.main.workbook.ResultWorkBook; |
||||
import com.fr.schedule.extension.report.provider.impl.AbstractReportOutputFormulaProvider; |
||||
|
||||
import java.util.List; |
||||
import java.util.Map; |
||||
|
||||
public class DSDDMsgFormula extends AbstractReportOutputFormulaProvider<TsBean, ResultWorkBook> { |
||||
public DSDDMsgFormula() { |
||||
} |
||||
|
||||
public void dealWithFormulaParam(TsBean syncBean, ResultWorkBook resultWorkBook, List<Map<String, Object>> param) throws Exception { |
||||
// syncBean.setTitle(ScheduleParameterUtils.dealWithParameter(syncBean.getTitle(), (Map)param.get(0), resultWorkBook));
|
||||
} |
||||
|
||||
public String getActionClassName() { |
||||
return TsBean.class.getName(); |
||||
} |
||||
} |
||||
|
@ -0,0 +1,93 @@
|
||||
package com.eco.plugin.xxxx.webservicets.dsdd.dsdd; |
||||
|
||||
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 = TsBean.class, name = "TsBean") |
||||
public class TsBean extends BaseOutputAction { |
||||
private static final long serialVersionUID = 8245931480823179622L; |
||||
// private String content = null;
|
||||
|
||||
//报表类型
|
||||
private String type = null; |
||||
//数据集名称
|
||||
private String serverdata = null; |
||||
|
||||
public TsBean(){ |
||||
super(); |
||||
} |
||||
|
||||
//是否受不同用户生成不同附件影响
|
||||
@Override |
||||
public boolean willExecuteByUser() { |
||||
return false; |
||||
} |
||||
|
||||
@Override |
||||
public RunType runType() { |
||||
return RunType.SEND_EMAIL; |
||||
} |
||||
|
||||
//这里直接关联第一步的entity类
|
||||
@Override |
||||
public Class<? extends AbstractScheduleEntity> outputActionEntityClass() { |
||||
return TsEntity.class; |
||||
} |
||||
|
||||
public TsBean id(String id){ |
||||
setId(id); |
||||
return this; |
||||
} |
||||
|
||||
// public String getContent() {
|
||||
// return content;
|
||||
// }
|
||||
//
|
||||
// public void setContent(String content) {
|
||||
// this.content = content;
|
||||
// }
|
||||
//
|
||||
// public TsBean content(String content){
|
||||
// setContent(content);
|
||||
// return this;
|
||||
// }
|
||||
|
||||
public String getType() { |
||||
return type; |
||||
} |
||||
|
||||
public void setType(String title) { |
||||
this.type = title; |
||||
} |
||||
|
||||
public TsBean type(String title){ |
||||
setType(title); |
||||
return this; |
||||
} |
||||
|
||||
public String getServerdata() { |
||||
return serverdata; |
||||
} |
||||
|
||||
public void setServerdata(String type) { |
||||
this.serverdata = type; |
||||
} |
||||
|
||||
public TsBean serverdata(String type){ |
||||
setServerdata(type); |
||||
return this; |
||||
} |
||||
|
||||
//转换成entity对象,用于数据库存储,注意属性不要漏了
|
||||
@Override |
||||
public TsEntity createOutputActionEntity() { |
||||
return new TsEntity() |
||||
.id(this.getId()) |
||||
// .content(this.getContent())
|
||||
.serverdata(this.getServerdata()) |
||||
.type(this.getType()) |
||||
; |
||||
} |
||||
} |
@ -0,0 +1,82 @@
|
||||
package com.eco.plugin.xxxx.webservicets.dsdd.dsdd; |
||||
|
||||
import com.fr.schedule.base.entity.AbstractScheduleEntity; |
||||
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_output_wink_message") //表名
|
||||
@TableAssociation(associated = true) |
||||
public class TsEntity extends AbstractScheduleEntity{ |
||||
public TsEntity(){} |
||||
|
||||
@Column(name = "type") |
||||
private String type = null; |
||||
|
||||
@Column(name = "content") |
||||
private String serverdata = null; |
||||
//
|
||||
// @Column(name = "msgtype")
|
||||
// private String msgtype = null;
|
||||
|
||||
public TsEntity id(String id) { |
||||
setId(id); |
||||
return this; |
||||
} |
||||
|
||||
// public String getContent() {
|
||||
// return content;
|
||||
// }
|
||||
//
|
||||
// public void setContent(String content) {
|
||||
// this.content = content;
|
||||
// }
|
||||
//
|
||||
// public TsEntity content(String content){
|
||||
// setContent(content);
|
||||
// return this;
|
||||
// }
|
||||
|
||||
public String getType() { |
||||
return type; |
||||
} |
||||
|
||||
public void setType(String title) { |
||||
this.type = title; |
||||
} |
||||
|
||||
public TsEntity type(String title){ |
||||
setType(title); |
||||
return this; |
||||
} |
||||
|
||||
public String getServerdata() { |
||||
return serverdata; |
||||
} |
||||
|
||||
public void setServerdata(String type) { |
||||
this.serverdata = type; |
||||
} |
||||
|
||||
public TsEntity serverdata(String content){ |
||||
setServerdata(content); |
||||
return this; |
||||
} |
||||
|
||||
|
||||
|
||||
//转换成bean对象
|
||||
@Override |
||||
public TsBean createBean() { |
||||
return new TsBean() |
||||
.id(this.getId()) |
||||
.serverdata(this.getServerdata()) |
||||
.type(this.getType()) |
||||
// .content(this.getContent())
|
||||
// .msgtype(this.getMsgtype())
|
||||
// .title(this.getTitle())
|
||||
; |
||||
} |
||||
} |
@ -0,0 +1,140 @@
|
||||
package com.eco.plugin.xxxx.webservicets.dsdd.dsdd; |
||||
|
||||
import com.eco.plugin.xxxx.webservicets.utils.FRUtils; |
||||
import com.eco.plugin.xxxx.webservicets.utils.WebServiceUtil; |
||||
import com.fr.base.TableData; |
||||
import com.fr.general.data.DataModel; |
||||
import com.fr.general.data.TableDataException; |
||||
import com.fr.schedule.base.bean.ScheduleTask; |
||||
import com.fr.schedule.base.controller.ScheduleTaskController; |
||||
import com.fr.schedule.feature.ScheduleContext; |
||||
import com.fr.schedule.feature.output.OutputActionHandler; |
||||
import com.fr.script.Calculator; |
||||
import com.fr.stable.query.QueryFactory; |
||||
import java.io.UnsupportedEncodingException; |
||||
import java.net.URLEncoder; |
||||
import java.util.Map; |
||||
|
||||
public class TsHandler extends OutputActionHandler<TsBean>{ |
||||
@Override |
||||
public void doAction(TsBean tsBean, Map<String, Object> map) throws TableDataException { |
||||
String type = tsBean.getType(); |
||||
String servername = tsBean.getServerdata(); |
||||
|
||||
FRUtils.FRLogInfo("type:"+type+";servername:"+servername); |
||||
|
||||
Map<String,String> config = WebServiceUtil.getConfig(type); |
||||
|
||||
FRUtils.FRLogInfo("config:"+config.toString()); |
||||
|
||||
TableData userInfo = FRUtils.getTableData(servername); |
||||
DataModel userInfoDM = userInfo.createDataModel(Calculator.createCalculator()); |
||||
|
||||
int fridindex = userInfoDM.getColumnIndex("FlowId"); |
||||
int receiverindex = userInfoDM.getColumnIndex("FlowNode1"); |
||||
int flowNode2Index = userInfoDM.getColumnIndex("FlowNode2"); |
||||
int FlowNameindex = userInfoDM.getColumnIndex("FlowName"); |
||||
|
||||
int btindex = userInfoDM.getColumnIndex("bt"); |
||||
int ndindex = userInfoDM.getColumnIndex("nd"); |
||||
int yearindex = userInfoDM.getColumnIndex("year"); |
||||
int nfindex = userInfoDM.getColumnIndex("nf"); |
||||
int usernameindex = userInfoDM.getColumnIndex("fine_username"); |
||||
|
||||
|
||||
String name = config.get("name"); |
||||
String tburl = config.get("tburl"); |
||||
|
||||
int rowcount = userInfoDM.getRowCount(); |
||||
|
||||
for(int i=0;i<rowcount;i++){ |
||||
String receiver = String.valueOf(userInfoDM.getValueAt(i,receiverindex)); |
||||
String flownode2 = String.valueOf(userInfoDM.getValueAt(i,flowNode2Index)); |
||||
String flowid = String.valueOf(userInfoDM.getValueAt(i,fridindex)); |
||||
String flowName = String.valueOf(userInfoDM.getValueAt(i,FlowNameindex)); |
||||
|
||||
String bt = URLEncoder.encode(String.valueOf(userInfoDM.getValueAt(i,btindex))); |
||||
String nd = String.valueOf(userInfoDM.getValueAt(i,ndindex)); |
||||
String year = String.valueOf(userInfoDM.getValueAt(i,yearindex)); |
||||
String nf = String.valueOf(userInfoDM.getValueAt(i,nfindex)); |
||||
String username = String.valueOf(userInfoDM.getValueAt(i,usernameindex)); |
||||
|
||||
|
||||
String sysId = flowid+type; |
||||
//流程id
|
||||
|
||||
//发起待办
|
||||
String operater = "0"; |
||||
String publicParam = "&bt="+bt+"&nd="+nd+"&year="+year+"&nf="+nf+"&flowId="+flowid+"&node1="+receiver+"&node2="+flownode2+"&sysId="+sysId+"&projectid="+flowid+"&fine_username="+username; |
||||
|
||||
|
||||
String tburl2 = tburl + publicParam ; |
||||
|
||||
WebServiceUtil.flowOperater(operater,sysId,tburl2,flowName+name,"节点1",receiver); |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* 获取定时调度 |
||||
* @param taskName |
||||
* @return |
||||
*/ |
||||
private static ScheduleTask getTask(String taskName){ |
||||
ScheduleTask scheduleTask = null; |
||||
try { |
||||
ScheduleTaskController scheduleTaskController = ScheduleContext.getInstance().getScheduleTaskController(); |
||||
scheduleTask = scheduleTaskController.getByTaskName(taskName,QueryFactory.create()); |
||||
} catch (Exception e) { |
||||
FRUtils.FRLogInfo("任务异常:"+e.getMessage()); |
||||
return null; |
||||
} |
||||
|
||||
return scheduleTask; |
||||
} |
||||
|
||||
/** |
||||
* 获取模板链接 |
||||
* @param map |
||||
* @return |
||||
*/ |
||||
private static String getTempUrl(TsBean tsBean,Map<String, Object> map){ |
||||
|
||||
String taskName = String.valueOf(map.get("taskName")); |
||||
|
||||
ScheduleTask scheduleTask = getTask(taskName); |
||||
|
||||
int showType = scheduleTask.getShowType(); |
||||
String templateName = scheduleTask.getTemplatePath(); |
||||
try { |
||||
templateName = URLEncoder.encode(templateName,"utf-8"); |
||||
} catch (UnsupportedEncodingException e) { |
||||
FRUtils.FRLogInfo("编码模板名称异常:"+e.getMessage()); |
||||
return ""; |
||||
} |
||||
|
||||
if(1 == showType){ |
||||
templateName+="&op=write"; |
||||
} |
||||
else if(2 == showType){ |
||||
templateName += "&op=view"; |
||||
} |
||||
else if(3 == showType){ |
||||
templateName += "&op=write_plus"; |
||||
} |
||||
|
||||
return tsBean.getResultURL()+"/view/report?viewlet="+templateName; |
||||
} |
||||
|
||||
/** |
||||
* 获取用户组信息 |
||||
* @param map |
||||
* @return |
||||
*/ |
||||
private static String[] getUserGroup(Map<String, Object> map){ |
||||
String taskName = String.valueOf(map.get("taskName")); |
||||
ScheduleTask scheduleTask = getTask(taskName); |
||||
|
||||
return scheduleTask.getUserGroup().createUserNameArray(); |
||||
} |
||||
|
||||
} |
@ -0,0 +1,35 @@
|
||||
package com.eco.plugin.xxxx.webservicets.dsdd.webresource; |
||||
|
||||
import com.fr.decision.fun.impl.AbstractWebResourceProvider; |
||||
import com.fr.decision.web.MainComponent; |
||||
import com.fr.web.struct.Atom; |
||||
import com.fr.web.struct.Component; |
||||
import com.fr.web.struct.browser.RequestClient; |
||||
import com.fr.web.struct.category.ScriptPath; |
||||
import com.fr.web.struct.category.StylePath; |
||||
|
||||
/** |
||||
* |
||||
*/ |
||||
public class DsddWebResourceProvider extends AbstractWebResourceProvider { |
||||
@Override |
||||
public Atom attach() { |
||||
return MainComponent.KEY; |
||||
} |
||||
|
||||
@Override |
||||
public Atom client() { |
||||
return new Component() { |
||||
@Override |
||||
public ScriptPath script(RequestClient requestClient) { |
||||
return ScriptPath.build("/com/eco/plugin/xxxx/webservicets/js/dsdd.js"); |
||||
} |
||||
|
||||
@Override |
||||
public StylePath style(RequestClient requestClient) { |
||||
return StylePath.EMPTY; |
||||
// return StylePath.build("/com/fr/plugin/jdfSSO/css/icon.css");
|
||||
} |
||||
}; |
||||
} |
||||
} |
@ -0,0 +1,13 @@
|
||||
package com.eco.plugin.xxxx.webservicets.handler; |
||||
|
||||
import com.fr.decision.fun.HttpHandler; |
||||
import com.fr.decision.fun.impl.AbstractHttpHandlerProvider; |
||||
|
||||
public class ExtendAttrHandlerProvider extends AbstractHttpHandlerProvider { |
||||
@Override |
||||
public HttpHandler[] registerHandlers() { |
||||
return new HttpHandler[]{ |
||||
new FlowHandler(), |
||||
}; |
||||
} |
||||
} |
@ -0,0 +1,166 @@
|
||||
package com.eco.plugin.xxxx.webservicets.handler; |
||||
|
||||
import com.eco.plugin.xxxx.webservicets.bean.EmployFLOW; |
||||
import com.eco.plugin.xxxx.webservicets.utils.FRUtils; |
||||
import com.eco.plugin.xxxx.webservicets.utils.ResponseUtils; |
||||
import com.eco.plugin.xxxx.webservicets.utils.WebServiceUtil; |
||||
import com.fr.base.TableData; |
||||
import com.fr.decision.fun.impl.BaseHttpHandler; |
||||
import com.fr.general.data.DataModel; |
||||
import com.fr.general.data.TableDataException; |
||||
import com.fr.script.Calculator; |
||||
import com.fr.third.springframework.web.bind.annotation.RequestMethod; |
||||
import javax.servlet.http.HttpServletRequest; |
||||
import javax.servlet.http.HttpServletResponse; |
||||
import java.net.URLEncoder; |
||||
import java.util.HashMap; |
||||
import java.util.Map; |
||||
|
||||
public class FlowHandler extends BaseHttpHandler { |
||||
public FlowHandler() { |
||||
} |
||||
|
||||
@Override |
||||
public RequestMethod getMethod() { |
||||
return RequestMethod.GET; |
||||
} |
||||
|
||||
@Override |
||||
public String getPath() { |
||||
return "/operateFlow"; |
||||
} |
||||
|
||||
@Override |
||||
public boolean isPublic() { |
||||
return true; |
||||
} |
||||
|
||||
@Override |
||||
public void handle(HttpServletRequest req, HttpServletResponse res) throws Exception { |
||||
|
||||
String operation = req.getParameter("operation"); |
||||
String url = req.getParameter("url"); |
||||
String type = req.getParameter("type"); |
||||
String servername = req.getParameter("serverdataname"); |
||||
|
||||
Map<String,String> paramMap = this.getParamMap(url); |
||||
String flowId = paramMap.get("flowId"); |
||||
String sysId = flowId+type; |
||||
String approveId = flowId+type+"sh"; |
||||
|
||||
EmployFLOW ef = getEmployFlowByFlowId(flowId,servername); |
||||
|
||||
String node1 = ef.getFlowNode1(); |
||||
String node2 = ef.getFlowNode2(); |
||||
|
||||
String publicParam = "&flowId="+flowId+"&node1="+node1+"&node2="+node2; |
||||
|
||||
Map<String,String> config = WebServiceUtil.getConfig(type); |
||||
|
||||
String workFlowName = config.get("name"); |
||||
String pcUrl = config.get("tburl") +publicParam;; |
||||
String shUrl = config.get("shurl") +publicParam;; |
||||
|
||||
workFlowName = ef.getFlowName() + workFlowName; |
||||
|
||||
|
||||
if(operation==null || operation.isEmpty()){ |
||||
ResponseUtils.failedResponse(res,"operation不能为空"); |
||||
return ; |
||||
} |
||||
|
||||
|
||||
if(sysId == null || sysId.isEmpty() || node1==null || node1.isEmpty()|| flowId==null || flowId.isEmpty()){ |
||||
ResponseUtils.failedResponse(res,"sysId,node1,flowId不能为空"); |
||||
return ; |
||||
} |
||||
|
||||
if("1".equals(operation)){ |
||||
endFlow(sysId,node1,workFlowName); |
||||
|
||||
shUrl+="&SBNF="+ef.getSBNF()+"&SBLX="+ef.getSBLX()+"&bt="+ URLEncoder.encode(ef.getBt())+"&nd="+ef.getNd()+"&year="+ef.getYear()+"&nf="+ef.getNf()+"&projectid="+flowId+"&fine_role="+ef.getRole(); |
||||
startFlow(approveId,node2,workFlowName+"审核",shUrl); |
||||
|
||||
FRUtils.FRLogInfo("完成填报,sysId:"+sysId+";approveId="+approveId); |
||||
}else if("2".equals(operation)){ |
||||
endFlow(approveId,node2,workFlowName+"退回"); |
||||
|
||||
startFlow(sysId,node1,workFlowName+"被退回",pcUrl+"&sysId="+sysId); |
||||
|
||||
FRUtils.FRLogInfo("退回:sysId->"+sysId+";approveId->"+approveId); |
||||
|
||||
}else{ |
||||
endFlow(approveId,node2,workFlowName+"结束"); |
||||
} |
||||
} |
||||
|
||||
private void startFlow(String approvId,String aprrovName,String workFlowName,String redirectUrl){ |
||||
WebServiceUtil.flowOperater("0",approvId,redirectUrl,workFlowName,"待办",aprrovName); |
||||
} |
||||
|
||||
private void endFlow(String sysId,String userName,String workFLowName){ |
||||
WebServiceUtil.flowOperater("2",sysId,"",workFLowName,"完成",userName); |
||||
} |
||||
|
||||
private Map<String,String> getParamMap(String url){ |
||||
Map<String,String> resultMap = new HashMap<String,String>(); |
||||
String[] urls = url.split("\\?"); |
||||
String[] param = urls[1].split("&"); |
||||
|
||||
for(String item : param){ |
||||
String[] paramItem = item.split("="); |
||||
resultMap.put(paramItem[0],paramItem[1]); |
||||
} |
||||
|
||||
return resultMap; |
||||
} |
||||
|
||||
private EmployFLOW getEmployFlowByFlowId(String flowId, String servername) throws TableDataException { |
||||
TableData tableData = FRUtils.getTableData(servername); |
||||
DataModel userInfoDM = tableData.createDataModel(Calculator.createCalculator()); |
||||
|
||||
int flowIdindex = userInfoDM.getColumnIndex("FlowId"); |
||||
int flowNode1index = userInfoDM.getColumnIndex("FlowNode1"); |
||||
int flowNode2index = userInfoDM.getColumnIndex("FlowNode2"); |
||||
int flowNameindex = userInfoDM.getColumnIndex("FlowName"); |
||||
int SBLXindex = userInfoDM.getColumnIndex("SBLX"); |
||||
int SBNFindex = userInfoDM.getColumnIndex("SBNF"); |
||||
|
||||
int btindex = userInfoDM.getColumnIndex("bt"); |
||||
int ndindex = userInfoDM.getColumnIndex("nd"); |
||||
int yearindex = userInfoDM.getColumnIndex("year"); |
||||
int nfindex = userInfoDM.getColumnIndex("nf"); |
||||
int roleIndex = userInfoDM.getColumnIndex("fine_role"); |
||||
|
||||
EmployFLOW ef = new EmployFLOW(); |
||||
|
||||
for(int i =0;i<userInfoDM.getRowCount();i++){ |
||||
String flowid = String.valueOf(userInfoDM.getValueAt(i,flowIdindex)); |
||||
if(flowid.equals(flowId)){ |
||||
String bt = String.valueOf(userInfoDM.getValueAt(i,btindex)); |
||||
String nd = String.valueOf(userInfoDM.getValueAt(i,ndindex)); |
||||
String year = String.valueOf(userInfoDM.getValueAt(i,yearindex)); |
||||
String nf = String.valueOf(userInfoDM.getValueAt(i,nfindex)); |
||||
String role = String.valueOf(userInfoDM.getValueAt(i,roleIndex)); |
||||
|
||||
ef.setFlowNode1(String.valueOf(userInfoDM.getValueAt(i,flowNode1index))); |
||||
ef.setFlowNode2(String.valueOf(userInfoDM.getValueAt(i,flowNode2index))); |
||||
ef.setFlowName(String.valueOf(userInfoDM.getValueAt(i,flowNameindex))); |
||||
ef.setSBLX(String.valueOf(userInfoDM.getValueAt(i,SBLXindex))); |
||||
ef.setSBNF(String.valueOf(userInfoDM.getValueAt(i,SBNFindex))); |
||||
ef.setBt(bt); |
||||
ef.setNd(nd); |
||||
ef.setYear(year); |
||||
ef.setNf(nf); |
||||
ef.setRole(role); |
||||
break; |
||||
} |
||||
|
||||
} |
||||
|
||||
return ef; |
||||
} |
||||
|
||||
|
||||
} |
||||
|
@ -0,0 +1,14 @@
|
||||
package com.eco.plugin.xxxx.webservicets.handler; |
||||
|
||||
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 URLAliasProvide extends AbstractURLAliasProvider { |
||||
@Override |
||||
public URLAlias[] registerAlias() { |
||||
return new URLAlias[]{ |
||||
URLAliasFactory.createPluginAlias("/operateFlow","/operateFlow",true), |
||||
}; |
||||
} |
||||
} |
@ -0,0 +1,227 @@
|
||||
package com.eco.plugin.xxxx.webservicets.utils; |
||||
|
||||
import java.sql.Timestamp; |
||||
import java.text.SimpleDateFormat; |
||||
import java.util.ArrayList; |
||||
import java.util.Calendar; |
||||
import java.util.Date; |
||||
import java.util.List; |
||||
|
||||
public class DateUtilSelf { |
||||
|
||||
/** |
||||
* 日期转换为日期字符串 |
||||
* @param date |
||||
* @param formatStr |
||||
* @return String |
||||
*/ |
||||
public static String DateToString(Date date,String formatStr) { |
||||
SimpleDateFormat sdf = new SimpleDateFormat(formatStr); |
||||
String dateStr = sdf.format(date).toString(); |
||||
|
||||
return dateStr; |
||||
} |
||||
|
||||
/** |
||||
* 日期字符串转换日期 |
||||
* @param dateStr |
||||
* @param formatStr |
||||
* @return Date |
||||
*/ |
||||
public static Date strToDate(String dateStr,String formatStr){ |
||||
SimpleDateFormat sdf = new SimpleDateFormat(formatStr); |
||||
Date date = null; |
||||
|
||||
try { |
||||
date = sdf.parse(dateStr); |
||||
} |
||||
catch(Exception e) { |
||||
} |
||||
|
||||
return date; |
||||
} |
||||
|
||||
/** |
||||
* Date转Timestamp |
||||
* @param date |
||||
* @return |
||||
*/ |
||||
public static Timestamp dateToTimestamp(Date date) { |
||||
Date transDate = DateUtilSelf.strToDate(DateUtilSelf.DateToString(date, "yyyy-MM-dd hh:mm:ss"),"yyyy-MM-dd hh:mm:ss"); |
||||
|
||||
Timestamp timestamp = new Timestamp(transDate.getTime()); |
||||
return timestamp; |
||||
} |
||||
|
||||
/** |
||||
* Date字符串转Timestamp |
||||
* @param dateStr |
||||
* @param format |
||||
* @return |
||||
*/ |
||||
public static Timestamp strToTimestamp(String dateStr,String format) { |
||||
Date date = strToDate(dateStr,format); |
||||
Timestamp timestamp = new Timestamp(date.getTime()); |
||||
return timestamp; |
||||
} |
||||
|
||||
/** |
||||
* 获取两个日期字符串之间的天数 |
||||
* @param startDateStr |
||||
* @param endDateStr |
||||
* @param formatStr |
||||
* @return |
||||
*/ |
||||
public static int getDays(String startDateStr,String endDateStr,String formatStr) { |
||||
|
||||
Date startDate = strToDate(startDateStr,formatStr); |
||||
Date endDate = strToDate(endDateStr,formatStr); |
||||
|
||||
long startTime = startDate.getTime(); |
||||
long endTime = endDate.getTime(); |
||||
|
||||
int days = (int) ((endTime - startTime)/(60*60*24*1000)); |
||||
|
||||
return days; |
||||
} |
||||
|
||||
/** |
||||
* 获取给定时间之前之后的时间 |
||||
* @param type |
||||
* @param dateStr |
||||
* @param count |
||||
* @param formatStr |
||||
* @return |
||||
*/ |
||||
public static String getAfterDateStr(int type,String dateStr,int count,String formatStr) { |
||||
Date startDate = strToDate(dateStr,formatStr); |
||||
|
||||
Calendar calendar = Calendar.getInstance(); |
||||
calendar.setTime(startDate); |
||||
|
||||
calendar.add(type, count); |
||||
|
||||
String endDateStr = DateToString(calendar.getTime(),formatStr); |
||||
|
||||
return endDateStr; |
||||
} |
||||
|
||||
/** |
||||
* 获取给定时间之前之后的时间 |
||||
* @param type |
||||
* @param date |
||||
* @param count |
||||
* @param formatStr |
||||
* @return |
||||
*/ |
||||
public static String getAfterDateStr(int type,Date date,int count,String formatStr) { |
||||
|
||||
Calendar calendar = Calendar.getInstance(); |
||||
calendar.setTime(date); |
||||
|
||||
calendar.add(type, count); |
||||
|
||||
String endDateStr = DateToString(calendar.getTime(),formatStr); |
||||
|
||||
return endDateStr; |
||||
} |
||||
|
||||
/** |
||||
* 获取给定时间之前之后的时间 |
||||
* @param type |
||||
* @param date |
||||
* @param count |
||||
* @return |
||||
*/ |
||||
public static Date getAfterDateStr(int type,Date date,int count) { |
||||
Calendar dateResult = Calendar.getInstance(); |
||||
dateResult.setTime(date); |
||||
dateResult.add(type, count); |
||||
return dateResult.getTime(); |
||||
} |
||||
|
||||
/** |
||||
* 时间戳转日期 |
||||
* @param timestamp |
||||
* @return |
||||
*/ |
||||
public static Date timestampToDate(Timestamp timestamp) { |
||||
Date date = new Date(timestamp.getTime()); |
||||
|
||||
return date; |
||||
} |
||||
|
||||
/** |
||||
* 时间戳转时间字符串 |
||||
* @param timestamp |
||||
* @param format 日期格式 |
||||
* @return |
||||
*/ |
||||
public static String timestampToStr(Timestamp timestamp,String format) { |
||||
Date date = timestampToDate(timestamp); |
||||
|
||||
String timeStr = DateToString(date, format); |
||||
|
||||
return timeStr; |
||||
} |
||||
|
||||
/** |
||||
* 获取所给日期length天内每s一天的日期 |
||||
* @param date 所给日期(yyyy-MM-dd) |
||||
* @param length 长度 |
||||
* @return |
||||
*/ |
||||
public static List<String> getDateList(String date,int length){ |
||||
List<String> dateList = new ArrayList<String>(); |
||||
String format = "yyyy-MM-dd"; |
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); |
||||
//获取length天后的日期
|
||||
|
||||
String targetDate = getAfterDateStr(Calendar.DATE,date,length,format); |
||||
|
||||
Date start = null; |
||||
Date end = null; |
||||
|
||||
if(length >= 0) { |
||||
start = strToDate(date,format); |
||||
end = strToDate(targetDate,format); |
||||
}else { |
||||
start = strToDate(targetDate,format); |
||||
end = strToDate(date,format); |
||||
} |
||||
|
||||
Calendar calBegin = Calendar.getInstance(); |
||||
calBegin.setTime(start); |
||||
Calendar calEnd = Calendar.getInstance(); |
||||
calEnd.setTime(end); |
||||
|
||||
while (end.after(calBegin.getTime())) { |
||||
calBegin.add(Calendar.DATE, 1); |
||||
String dayStr = sdf.format(calBegin.getTime()); |
||||
dateList.add(dayStr); |
||||
} |
||||
|
||||
return dateList; |
||||
} |
||||
|
||||
/** |
||||
* 比较startDate是否在endDate之前 |
||||
* @param startDate |
||||
* @param endDate |
||||
* @param format |
||||
* @return 0 两个日期相等 <0 开始日期在结束日期之前 >0 开始日期在结束日期之后 |
||||
*/ |
||||
public static int comparisonDate(String startDate,String endDate,String format) { |
||||
Date start = strToDate(startDate,format); |
||||
Date end = strToDate(endDate,format); |
||||
|
||||
return start.compareTo(end); |
||||
} |
||||
|
||||
//获取当前日期年、月、日、时、分、秒
|
||||
public static int getCount(int type){ |
||||
Calendar calendar = Calendar.getInstance(); |
||||
|
||||
return calendar.get(type); |
||||
} |
||||
} |
@ -0,0 +1,256 @@
|
||||
package com.eco.plugin.xxxx.webservicets.utils; |
||||
|
||||
import com.fr.base.ServerConfig; |
||||
import com.fr.base.TableData; |
||||
import com.fr.decision.authority.AuthorityContext; |
||||
import com.fr.decision.authority.data.User; |
||||
import com.fr.decision.webservice.login.LogInOutResultInfo; |
||||
import com.fr.decision.webservice.utils.DecisionServiceConstants; |
||||
import com.fr.decision.webservice.v10.login.LoginService; |
||||
import com.fr.decision.webservice.v10.login.event.LogInOutEvent; |
||||
import com.fr.decision.webservice.v10.user.UserService; |
||||
import com.fr.event.EventDispatcher; |
||||
import com.fr.file.TableDataConfig; |
||||
import com.fr.log.FineLoggerFactory; |
||||
import com.fr.stable.StringUtils; |
||||
import com.fr.stable.query.QueryFactory; |
||||
import com.fr.stable.query.restriction.RestrictionFactory; |
||||
import com.fr.web.utils.WebUtils; |
||||
|
||||
import javax.servlet.http.Cookie; |
||||
import javax.servlet.http.HttpServletRequest; |
||||
import javax.servlet.http.HttpServletResponse; |
||||
import javax.servlet.http.HttpSession; |
||||
import java.io.IOException; |
||||
import java.util.List; |
||||
|
||||
public class FRUtils { |
||||
/** |
||||
* 判断用户是否存在 |
||||
* @param userName |
||||
* @return |
||||
*/ |
||||
public static boolean isUserExist(String userName){ |
||||
if (StringUtils.isEmpty(userName)) { |
||||
return false; |
||||
} else { |
||||
try { |
||||
List var1 = AuthorityContext.getInstance().getUserController().find(QueryFactory.create().addRestriction(RestrictionFactory.eq("userName", userName))); |
||||
return var1 != null && !var1.isEmpty(); |
||||
} catch (Exception var2) { |
||||
FineLoggerFactory.getLogger().error(var2.getMessage()); |
||||
return false; |
||||
} |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* 判断是否登录FR |
||||
* @param req |
||||
* @return |
||||
*/ |
||||
public static boolean isLogin(HttpServletRequest req){ |
||||
return LoginService.getInstance().isLogged(req); |
||||
} |
||||
|
||||
/** |
||||
* 帆软登录 |
||||
* @param httpServletRequest |
||||
* @param httpServletResponse |
||||
* @param userName |
||||
* @param url |
||||
*/ |
||||
public static void login(HttpServletRequest httpServletRequest,HttpServletResponse httpServletResponse,String userName,String url){ |
||||
|
||||
FineLoggerFactory.getLogger().info("FRLOG:用户名:"+userName); |
||||
FineLoggerFactory.getLogger().info("FRLOG:跳转链接:"+url); |
||||
|
||||
|
||||
//判断用户名是否为空
|
||||
if(!Utils.isNullStr(userName)){ |
||||
if(isUserExist(userName)){ |
||||
String FRToken = ""; |
||||
|
||||
try { |
||||
//HttpSession session = httpServletRequest.getSession(true);
|
||||
|
||||
FRToken = LoginService.getInstance().login(httpServletRequest, httpServletResponse, userName); |
||||
|
||||
//httpServletRequest.setAttribute(DecisionServiceConstants.FINE_AUTH_TOKEN_NAME,FRToken);
|
||||
|
||||
//session.setAttribute(DecisionServiceConstants.FINE_AUTH_TOKEN_NAME, FRToken);
|
||||
EventDispatcher.fire(LogInOutEvent.LOGIN,new LogInOutResultInfo(httpServletRequest,httpServletResponse,userName,true)); |
||||
FineLoggerFactory.getLogger().info("FRLOG:登陆成功!"); |
||||
|
||||
if(!Utils.isNullStr(url)){ |
||||
httpServletResponse.sendRedirect(url); |
||||
} |
||||
} catch (Exception e) { |
||||
ResponseUtils.failedResponse(httpServletResponse,"登录异常,请联系管理员!"); |
||||
FineLoggerFactory.getLogger().info("FRLOG:登录异常,请联系管理员!"); |
||||
FineLoggerFactory.getLogger().info("FRLOGException:"+e.getMessage()); |
||||
} |
||||
}else{ |
||||
ResponseUtils.failedResponse(httpServletResponse,"用户在报表系统中不存在!"); |
||||
FineLoggerFactory.getLogger().info("FRLOG:用户在报表系统中不存在!"); |
||||
} |
||||
}else{ |
||||
ResponseUtils.failedResponse(httpServletResponse,"用户名不能为空!"); |
||||
FineLoggerFactory.getLogger().info("FRLOG:用户名不能为空!"); |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* 帆软登录 |
||||
* @param httpServletRequest |
||||
* @param httpServletResponse |
||||
* @param token |
||||
* @param url |
||||
*/ |
||||
public static void loginByToken(HttpServletRequest httpServletRequest,HttpServletResponse httpServletResponse,String token,String url){ |
||||
|
||||
FineLoggerFactory.getLogger().info("FRLOG:token:"+token); |
||||
FineLoggerFactory.getLogger().info("FRLOG:跳转链接:"+url); |
||||
|
||||
|
||||
//判断用户名是否为空
|
||||
if(!Utils.isNullStr(token)){ |
||||
writeToken2Cookie(httpServletResponse,token,-1); |
||||
|
||||
HttpSession session = httpServletRequest.getSession(true); |
||||
|
||||
httpServletRequest.setAttribute(DecisionServiceConstants.FINE_AUTH_TOKEN_NAME,token); |
||||
|
||||
session.setAttribute(DecisionServiceConstants.FINE_AUTH_TOKEN_NAME, token); |
||||
|
||||
if(!Utils.isNullStr(url)){ |
||||
try { |
||||
httpServletResponse.sendRedirect(url); |
||||
} catch (IOException e) { |
||||
ResponseUtils.failedResponse(httpServletResponse,"跳转异常!"); |
||||
FineLoggerFactory.getLogger().info("FRLOG:跳转异常!"); |
||||
} |
||||
} |
||||
}else{ |
||||
ResponseUtils.failedResponse(httpServletResponse,"token不能为空!"); |
||||
FineLoggerFactory.getLogger().info("FRLOG:token不能为空!"); |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* 获取token |
||||
* @param httpServletRequest |
||||
* @param httpServletResponse |
||||
* @param username |
||||
* @return |
||||
*/ |
||||
public static String getToken(HttpServletRequest httpServletRequest,HttpServletResponse httpServletResponse,String username){ |
||||
String token = ""; |
||||
try { |
||||
token = LoginService.getInstance().login(httpServletRequest, httpServletResponse, username); |
||||
} catch (Exception e) { |
||||
FineLoggerFactory.getLogger().info("FRLOG:获取token失败"+e.getMessage()); |
||||
} |
||||
|
||||
return token; |
||||
} |
||||
|
||||
private static void writeToken2Cookie(HttpServletResponse var1, String var2, int var3) { |
||||
try { |
||||
if (StringUtils.isNotEmpty(var2)) { |
||||
Cookie var4 = new Cookie("fine_auth_token", var2); |
||||
long var5 = var3 == -2 ? 1209600000L : (long)var3; |
||||
var4.setMaxAge((int)var5); |
||||
var4.setPath(ServerConfig.getInstance().getCookiePath()); |
||||
var1.addCookie(var4); |
||||
Cookie var7 = new Cookie("fine_remember_login", String.valueOf(var3 == -2 ? -2 : -1)); |
||||
var7.setMaxAge((int)var5); |
||||
var7.setPath(ServerConfig.getInstance().getCookiePath()); |
||||
var1.addCookie(var7); |
||||
} else { |
||||
FineLoggerFactory.getLogger().error("empty token cannot save."); |
||||
} |
||||
} catch (Exception var8) { |
||||
FineLoggerFactory.getLogger().error(var8.getMessage(), var8); |
||||
} |
||||
|
||||
} |
||||
|
||||
/** |
||||
* |
||||
* @param httpServletRequest |
||||
* @param httpServletResponse |
||||
*/ |
||||
public static void logout(HttpServletRequest httpServletRequest,HttpServletResponse httpServletResponse) |
||||
{ |
||||
if(!isLogin(httpServletRequest)){ |
||||
return ; |
||||
} |
||||
|
||||
try { |
||||
LoginService.getInstance().logout(httpServletRequest,httpServletResponse); |
||||
} catch (Exception e) { |
||||
ResponseUtils.failedResponse(httpServletResponse,"登出异常,请联系管理员!"); |
||||
FineLoggerFactory.getLogger().info("FRLOG:登出异常,请联系管理员!"); |
||||
FineLoggerFactory.getLogger().info("FRLOGException:"+e.getMessage()); |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* 打印FR日志 |
||||
* @param message |
||||
*/ |
||||
public static void FRLogInfo(String message){ |
||||
FineLoggerFactory.getLogger().info("FRLOG:"+message); |
||||
} |
||||
|
||||
/** |
||||
* 打印FR日志-error |
||||
* @param message |
||||
*/ |
||||
public static void FRLogError(String message){ |
||||
FineLoggerFactory.getLogger().error("FRLOG:"+message); |
||||
} |
||||
|
||||
|
||||
/** |
||||
* 根据用户名获取用户信息 |
||||
* @param userName |
||||
* @return |
||||
*/ |
||||
public static User getFRUserByUserName(String userName){ |
||||
try { |
||||
return UserService.getInstance().getUserByUserName(userName); |
||||
} catch (Exception e) { |
||||
FRLogInfo("获取用户信息异常:"+e.getMessage()); |
||||
} |
||||
|
||||
return null; |
||||
} |
||||
|
||||
/** |
||||
* 解密FR密码 |
||||
* @param password |
||||
* @return |
||||
*/ |
||||
// public static String decryptFRPsd(String password){
|
||||
// FRLogInfo("解密密码:"+password);
|
||||
// return TransmissionTool.decrypt(password);
|
||||
// }
|
||||
|
||||
/** |
||||
* 获取带参数的访问链接 |
||||
* @return |
||||
*/ |
||||
public static String getAllUrl(HttpServletRequest httpServletRequest){ |
||||
return WebUtils.getOriginalURL(httpServletRequest); |
||||
} |
||||
|
||||
public static TableData getTableData(String serverDataSetName){ |
||||
TableData userInfo = TableDataConfig.getInstance().getTableData(serverDataSetName); |
||||
|
||||
// DataModel userInfoDM = userInfo.createDataModel(Calculator.createCalculator());
|
||||
// userInfoDM.get
|
||||
return userInfo; |
||||
} |
||||
} |
@ -0,0 +1,94 @@
|
||||
package com.eco.plugin.xxxx.webservicets.utils; |
||||
|
||||
import com.fr.json.JSONObject; |
||||
import com.fr.log.FineLoggerFactory; |
||||
import com.fr.web.utils.WebUtils; |
||||
|
||||
import javax.servlet.http.HttpServletRequest; |
||||
import javax.servlet.http.HttpServletResponse; |
||||
import java.io.PrintWriter; |
||||
|
||||
public class ResponseUtils { |
||||
private static final int SUCCESS = 200; |
||||
private static final int FAILED = -1; |
||||
|
||||
public static void successResponse(HttpServletResponse res, String body) { |
||||
response(res, body, SUCCESS); |
||||
} |
||||
|
||||
public static void failedResponse(HttpServletResponse res, String body) { |
||||
response(res, body, FAILED); |
||||
} |
||||
|
||||
private static void response(HttpServletResponse res, String body, int code) { |
||||
JSONObject object = new JSONObject(); |
||||
PrintWriter pw; |
||||
try { |
||||
object.put("code", code); |
||||
object.put("data", body); |
||||
pw = WebUtils.createPrintWriter(res); |
||||
} catch (Exception e) { |
||||
FineLoggerFactory.getLogger().info(e.getMessage()); |
||||
return; |
||||
} |
||||
res.setContentType("application/json;charset=utf-8"); |
||||
String result = object.toString(); |
||||
pw.println(result); |
||||
pw.flush(); |
||||
pw.close(); |
||||
} |
||||
|
||||
public static void response(HttpServletResponse res,JSONObject json){ |
||||
PrintWriter pw; |
||||
try { |
||||
pw = WebUtils.createPrintWriter(res); |
||||
} catch (Exception e) { |
||||
FineLoggerFactory.getLogger().info(e.getMessage()); |
||||
return; |
||||
} |
||||
res.setContentType("application/json;charset=utf-8"); |
||||
String result = json.toString(); |
||||
pw.println(result); |
||||
pw.flush(); |
||||
pw.close(); |
||||
} |
||||
|
||||
public static void responseXml(HttpServletResponse res,String xml){ |
||||
PrintWriter pw; |
||||
try { |
||||
pw = WebUtils.createPrintWriter(res); |
||||
} catch (Exception e) { |
||||
FineLoggerFactory.getLogger().info(e.getMessage()); |
||||
return; |
||||
} |
||||
res.setContentType("text/xml;charset=utf-8"); |
||||
pw.println(xml); |
||||
pw.flush(); |
||||
pw.close(); |
||||
} |
||||
|
||||
public static void setCSRFHeader(HttpServletResponse httpServletResponse){ |
||||
httpServletResponse.setHeader("Access-Control-Allow-Origin", "*"); |
||||
httpServletResponse.setHeader("Access-Control-Allow-Methods", "POST,GET,OPTIONS,DELETE,HEAD,PUT,PATCH"); |
||||
httpServletResponse.setHeader("Access-Control-Max-Age", "36000"); |
||||
httpServletResponse.setHeader("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept,Authorization,authorization"); |
||||
} |
||||
|
||||
public static void responseJsonp(HttpServletRequest req, HttpServletResponse res, JSONObject json){ |
||||
PrintWriter pw; |
||||
try { |
||||
pw = WebUtils.createPrintWriter(res); |
||||
} catch (Exception e) { |
||||
FineLoggerFactory.getLogger().info(e.getMessage()); |
||||
return; |
||||
} |
||||
res.setContentType("text/javascript;charset=utf-8;charset=utf-8"); |
||||
String result = json.toString(); |
||||
|
||||
String jsonp=req.getParameter("callback"); |
||||
|
||||
pw.println(jsonp+"("+result+")"); |
||||
pw.flush(); |
||||
pw.close(); |
||||
} |
||||
} |
@ -0,0 +1,226 @@
|
||||
package com.eco.plugin.xxxx.webservicets.utils; |
||||
|
||||
import com.fr.base.TemplateUtils; |
||||
import com.fr.data.NetworkHelper; |
||||
import com.fr.io.utils.ResourceIOUtils; |
||||
import com.fr.json.JSONObject; |
||||
import com.fr.stable.CodeUtils; |
||||
import com.fr.stable.StringUtils; |
||||
import com.fr.third.org.apache.commons.codec.digest.DigestUtils; |
||||
import com.fr.web.utils.WebUtils; |
||||
|
||||
import javax.servlet.http.Cookie; |
||||
import javax.servlet.http.HttpServletRequest; |
||||
import javax.servlet.http.HttpServletResponse; |
||||
import java.io.BufferedReader; |
||||
import java.io.InputStream; |
||||
import java.net.URLEncoder; |
||||
import java.util.HashMap; |
||||
import java.util.Map; |
||||
import java.util.UUID; |
||||
import java.util.regex.Matcher; |
||||
import java.util.regex.Pattern; |
||||
|
||||
public class Utils { |
||||
|
||||
/** |
||||
* 判断字符串是否为空 |
||||
* @param str |
||||
* @return true 空字符串 false 非空字符串 |
||||
*/ |
||||
public static boolean isNullStr(String str){ |
||||
return !(str != null && !str.isEmpty() && !"null".equals(str)); |
||||
} |
||||
|
||||
/** |
||||
* 判断字符串是否非空 |
||||
* @param str |
||||
* @return |
||||
*/ |
||||
public static boolean isNotNullStr(String str){ |
||||
return !isNullStr(str); |
||||
} |
||||
|
||||
/** |
||||
* MD5加密 |
||||
* @param str |
||||
* @return |
||||
*/ |
||||
public static String getMd5Str(String str) |
||||
{ |
||||
return DigestUtils.md5Hex(str); |
||||
} |
||||
|
||||
/** |
||||
* 帆软shaEncode加密 |
||||
*/ |
||||
|
||||
public static String shaEncode(String str){ |
||||
return CodeUtils.sha256Encode(str); |
||||
} |
||||
|
||||
/** |
||||
* 获取uuid |
||||
*/ |
||||
public static String uuid(){ |
||||
return UUID.randomUUID().toString(); |
||||
} |
||||
|
||||
/** |
||||
* 替换空字符串 |
||||
* @param str |
||||
* @param replace |
||||
* @return |
||||
*/ |
||||
public static String replaceNullStr(String str,String replace){ |
||||
if(isNullStr(str)){ |
||||
return replace; |
||||
} |
||||
|
||||
return str; |
||||
} |
||||
|
||||
/** |
||||
* 获取请求体 |
||||
* @param req |
||||
* @return |
||||
*/ |
||||
public static JSONObject getRequestBody(HttpServletRequest req){ |
||||
StringBuffer sb = new StringBuffer(); |
||||
String line = null; |
||||
try { |
||||
BufferedReader reader = req.getReader(); |
||||
while ((line = reader.readLine()) != null) |
||||
sb.append(line); |
||||
} catch (Exception e) { |
||||
FRUtils.FRLogInfo("getRequestBody:exception:"+e.getMessage()); |
||||
} |
||||
//将空格和换行符替换掉避免使用反序列化工具解析对象时失败
|
||||
String jsonString = sb.toString().replaceAll("\\s","").replaceAll("\n",""); |
||||
|
||||
JSONObject json = new JSONObject(jsonString); |
||||
|
||||
return json; |
||||
} |
||||
|
||||
/** |
||||
* 获取ip |
||||
* @return |
||||
*/ |
||||
public static String getIp(HttpServletRequest req){ |
||||
String realIp = req.getHeader("X-Real-IP"); |
||||
String fw = req.getHeader("X-Forwarded-For"); |
||||
if (StringUtils.isNotEmpty(fw) && !"unKnown".equalsIgnoreCase(fw)) { |
||||
int var3 = fw.indexOf(","); |
||||
return var3 != -1 ? fw.substring(0, var3) : fw; |
||||
} else { |
||||
fw = realIp; |
||||
if (StringUtils.isNotEmpty(realIp) && !"unKnown".equalsIgnoreCase(realIp)) { |
||||
return realIp; |
||||
} else { |
||||
if (StringUtils.isBlank(realIp) || "unknown".equalsIgnoreCase(realIp)) { |
||||
fw = req.getHeader("Proxy-Client-IP"); |
||||
} |
||||
|
||||
if (StringUtils.isBlank(fw) || "unknown".equalsIgnoreCase(fw)) { |
||||
fw = req.getHeader("WL-Proxy-Client-IP"); |
||||
} |
||||
|
||||
if (StringUtils.isBlank(fw) || "unknown".equalsIgnoreCase(fw)) { |
||||
fw = req.getHeader("HTTP_CLIENT_IP"); |
||||
} |
||||
|
||||
if (StringUtils.isBlank(fw) || "unknown".equalsIgnoreCase(fw)) { |
||||
fw = req.getHeader("HTTP_X_FORWARDED_FOR"); |
||||
} |
||||
|
||||
if (StringUtils.isBlank(fw) || "unknown".equalsIgnoreCase(fw)) { |
||||
fw = req.getRemoteAddr(); |
||||
} |
||||
|
||||
return fw; |
||||
} |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* 根据key获取cookie |
||||
* @param req |
||||
* @return |
||||
*/ |
||||
public static String getCookieByKey(HttpServletRequest req,String key){ |
||||
Cookie[] cookies = req.getCookies(); |
||||
String cookie = ""; |
||||
|
||||
if(cookies == null || cookies.length <=0){ |
||||
return ""; |
||||
} |
||||
|
||||
for(int i = 0; i < cookies.length; i++) { |
||||
Cookie item = cookies[i]; |
||||
if (item.getName().equalsIgnoreCase(key)) { |
||||
cookie = item.getValue(); |
||||
} |
||||
} |
||||
|
||||
FRUtils.FRLogInfo("cookie:"+cookie); |
||||
|
||||
return cookie; |
||||
} |
||||
|
||||
/** |
||||
* 判断是否是手机端的链接 |
||||
* @param req |
||||
* @return |
||||
*/ |
||||
public static boolean isMobile(HttpServletRequest req) { |
||||
String[] mobileArray = {"iPhone", "iPad", "android", "windows phone", "xiaomi"}; |
||||
String userAgent = req.getHeader("user-agent"); |
||||
if (userAgent != null && userAgent.toUpperCase().contains("MOBILE")) { |
||||
for(String mobile : mobileArray) { |
||||
if(userAgent.toUpperCase().contains(mobile.toUpperCase())) { |
||||
return true; |
||||
} |
||||
} |
||||
} |
||||
return NetworkHelper.getDevice(req).isMobile(); |
||||
} |
||||
|
||||
/** |
||||
* 只编码中文 |
||||
* @param url |
||||
* @return |
||||
*/ |
||||
public static String encodeCH(String url ){ |
||||
Matcher matcher = Pattern.compile("[\\u4e00-\\u9fa5]").matcher(url); |
||||
|
||||
while(matcher.find()){ |
||||
String chn = matcher.group(); |
||||
url = url.replaceAll(chn, URLEncoder.encode(chn)); |
||||
} |
||||
|
||||
return url; |
||||
} |
||||
|
||||
/** |
||||
* 获取web-inf文件夹下的文件 |
||||
* filename /resources/ip4enc.properties |
||||
*/ |
||||
public static InputStream getResourcesFile(String filename){ |
||||
return ResourceIOUtils.read(filename); |
||||
} |
||||
|
||||
public static void toErrorPage(HttpServletResponse res,String path,Map<String, String> parameterMap){ |
||||
if(parameterMap == null){ |
||||
parameterMap = new HashMap<String, String>(); |
||||
} |
||||
|
||||
try { |
||||
String macPage = TemplateUtils.renderTemplate(path, parameterMap); |
||||
WebUtils.printAsString(res, macPage); |
||||
}catch (Exception e){ |
||||
FRUtils.FRLogError("跳转页面异常"); |
||||
} |
||||
|
||||
} |
||||
} |
@ -0,0 +1,206 @@
|
||||
package com.eco.plugin.xxxx.webservicets.utils; |
||||
|
||||
import com.eco.plugin.xxxx.webservicets.config.WinkSimpleConfig; |
||||
import org.apache.axis.client.Call; |
||||
import org.apache.axis.client.Service; |
||||
import org.w3c.dom.NodeList; |
||||
import javax.xml.namespace.QName; |
||||
import javax.xml.rpc.ParameterMode; |
||||
import javax.xml.rpc.encoding.XMLType; |
||||
import java.util.Date; |
||||
import java.util.HashMap; |
||||
import java.util.Map; |
||||
|
||||
|
||||
public class WebServiceUtil { |
||||
|
||||
/** |
||||
* 根据用户名获取用户Id |
||||
* |
||||
* @param userName |
||||
* @return |
||||
*/ |
||||
public static String getUserId(String userName) { |
||||
WinkSimpleConfig psc =WinkSimpleConfig.getInstance(); |
||||
|
||||
String userKey = psc.getUserKey(); |
||||
String userNamespace = psc.getUserNamespace(); |
||||
String userMethod = psc.getUserMethod(); |
||||
String userWsdlUrl = psc.getUserWsdlUrl(); |
||||
|
||||
String userId = ""; |
||||
|
||||
Service service = new Service(); |
||||
Call call; |
||||
try { |
||||
Object[] object = new Object[2]; |
||||
|
||||
object[0] = userName; |
||||
object[1] = userKey; |
||||
call = (Call) service.createCall(); |
||||
QName opAddEntry = new QName(userNamespace, userMethod); //设置命名空间和需要调用的方法名
|
||||
call.setTargetEndpointAddress(userWsdlUrl); //设置请求路径
|
||||
call.setOperationName(userMethod); //调用的方法名
|
||||
call.setTimeout(Integer.valueOf(2000)); //设置请求超时
|
||||
call.setReturnType(org.apache.axis.encoding.XMLType.XSD_STRING);//设置返回类型
|
||||
call.addParameter("Uid", XMLType.XSD_STRING, ParameterMode.IN); |
||||
call.addParameter("key", XMLType.XSD_STRING, ParameterMode.IN); |
||||
|
||||
userId = (String) call.invoke(opAddEntry, object); |
||||
|
||||
if("-1".equals(userId)){ |
||||
userId=""; |
||||
} |
||||
} catch (Exception e) { |
||||
FRUtils.FRLogError("getUserId exception->"+e.getMessage()); |
||||
} |
||||
|
||||
return userId; |
||||
} |
||||
|
||||
//验证token
|
||||
public static boolean validate(String token, String userId) { |
||||
WinkSimpleConfig psc =WinkSimpleConfig.getInstance(); |
||||
|
||||
boolean flag = false; |
||||
String loginWsdlUrl=psc.getLoginWsdlUrl(); |
||||
String loginNamespace=psc.getLoginNamespace(); |
||||
String loginMethod=psc.getLoginMethod(); |
||||
|
||||
Service service = new Service(); |
||||
Call call; |
||||
try { |
||||
Object[] object = new Object[2]; |
||||
|
||||
object[0] = token; |
||||
object[1] = userId; |
||||
call = (Call) service.createCall(); |
||||
QName opAddEntry = new QName(loginNamespace, loginMethod); //设置命名空间和需要调用的方法名
|
||||
call.setTargetEndpointAddress(loginWsdlUrl); //设置请求路径
|
||||
call.setOperationName(loginMethod); //调用的方法名
|
||||
call.setTimeout(Integer.valueOf(2000)); //设置请求超时
|
||||
call.setReturnType(org.apache.axis.encoding.XMLType.XSD_STRING);//设置返回类型
|
||||
call.addParameter("Token", XMLType.XSD_STRING, ParameterMode.IN); |
||||
call.addParameter("User", XMLType.XSD_STRING, ParameterMode.IN); |
||||
|
||||
String result = (String) call.invoke(opAddEntry, object); |
||||
|
||||
NodeList nodeList = XMLUtils.xmlTONodeList(result); |
||||
String returnCode = XMLUtils.getValueByNodeName(nodeList,"returnCode"); |
||||
|
||||
if("0".equals(returnCode)){ |
||||
flag=true; |
||||
} |
||||
} catch (Exception e) { |
||||
FRUtils.FRLogError("validate exception ->"+e.getMessage()); |
||||
} |
||||
|
||||
return flag; |
||||
} |
||||
|
||||
/** |
||||
* 流程操作 |
||||
* |
||||
* @param operater 1、发起填报待办 2、完成填报待办 3、发起审核待办 4、完结审核待办 |
||||
* @param flowid 流程id |
||||
* @param pcUrl 审核url |
||||
* @param workFLowName 流程名称 |
||||
* @param nodeName 节点名称 |
||||
* @param receiver 流程接收人 |
||||
* @return |
||||
*/ |
||||
public static void flowOperater(String operater,String flowid,String pcUrl,String workFLowName,String nodeName,String receiver) { |
||||
WinkSimpleConfig psc =WinkSimpleConfig.getInstance(); |
||||
|
||||
String OANamespace =psc.getOANamespace(); |
||||
String OAMethod = psc.getOAMethod(); |
||||
String OAWsdlUrl = psc.getOAWsdlUrl(); |
||||
|
||||
String receivedatetime = DateUtilSelf.DateToString(new Date(),"yyyy-MM-dd HH:mm:ss"); |
||||
|
||||
Service service = new Service(); |
||||
Call call; |
||||
String result = ""; |
||||
|
||||
try { |
||||
Object[] object = new Object[1]; |
||||
object[0] = "{\n" + |
||||
"\t\"syscode\":\"BI\",\n" + |
||||
"\t\"flowid\":\""+ flowid +"\",\n" + |
||||
"\t\"requestname\":\"" + workFLowName + "\",\n" + |
||||
"\t\"workflowname\":\"" + workFLowName + "\",\n" + |
||||
"\t\"nodename\":\"" + nodeName + "\",\n" + |
||||
"\t\"pcurl\":\""+ pcUrl +"\",\n" + |
||||
"\t\"appurl\":\"\",\n" + |
||||
"\t\"creator\":\"admin\",\n" + |
||||
"\t\"createdatetime\":\"" + receivedatetime + "\",\n" + |
||||
"\t\"receiver\":\""+ receiver +"\",\n" + |
||||
"\t\"receivedatetime\":\""+ receivedatetime +"\",\n" + |
||||
"\t\"isremark\":\""+ operater +"\",\n" + |
||||
"\t\"viewtype\":\"0\",\n" + |
||||
"\t\"receivets\":\"\"\n" + |
||||
"}";//Object是用来存储方法的参数
|
||||
//{"errCode":0,"data":"{\"message\":\"流程数据【测试流程001】自动更新办结成功\",\"dataType\":\"WfData\",\"operResult\":\"1\",\"syscode\":\"BI\",\"operType\":\"AutoEdit\"}"}
|
||||
|
||||
call = (Call) service.createCall(); |
||||
QName opAddEntry = new QName(OANamespace, OAMethod); //设置命名空间和需要调用的方法名
|
||||
call.setTargetEndpointAddress(OAWsdlUrl); //设置请求路径
|
||||
call.setOperationName(OAMethod); //调用的方法名
|
||||
call.setTimeout(Integer.valueOf(2000)); //设置请求超时
|
||||
call.setReturnType(org.apache.axis.encoding.XMLType.XSD_STRING);//设置返回类型
|
||||
call.addParameter("dataMap", XMLType.SOAP_ARRAY, ParameterMode.IN); |
||||
|
||||
result = (String) call.invoke(opAddEntry, object); |
||||
FRUtils.FRLogInfo("flowOperater result ->"+result); |
||||
} catch (Exception e) { |
||||
FRUtils.FRLogError("flowOperater exception ->"+e.getMessage()); |
||||
} |
||||
} |
||||
|
||||
public static Map<String,String> getConfig(String type){ |
||||
WinkSimpleConfig psc = WinkSimpleConfig.getInstance(); |
||||
String tburl = psc.getTburl(); |
||||
String shurl = psc.getShurl(); |
||||
String tempname = psc.getTempname(); |
||||
|
||||
Map<String,String> map = new HashMap<String,String>(); |
||||
map.put("name",getValue(tempname,type)); |
||||
map.put("tburl",getValue(tburl,type)); |
||||
map.put("shurl",getValue(shurl,type)); |
||||
|
||||
return map; |
||||
} |
||||
|
||||
public static void main(String[] args) { |
||||
String tburl = "pttx,http://bi.ibtcloud.cn/decision/view/report?viewlet=Buletown_INFO%252F%25E5%25B9%25B3%25E5%258F%25B0%25E4%25BF%25A1%25E6%2581%25AF_%25E7%25A1%25AE%25E8%25AE%25A4.cpt&ref_t=design&op=write&ref_c=ecc6e216-cf3f-4421-bad5-b652cc8f781b"; |
||||
String type = "pttx"; |
||||
System.out.println(getValue(tburl,type)); |
||||
|
||||
} |
||||
|
||||
|
||||
/** |
||||
* 根据key获取值 |
||||
* @param url |
||||
* @param type |
||||
* @return |
||||
*/ |
||||
private static String getValue(String url,String type){ |
||||
String result = ""; |
||||
String[] keyvalue = url.split(";"); |
||||
|
||||
for(int i=0;i<keyvalue.length;i++){ |
||||
String kv = keyvalue[i]; |
||||
String[] kvs = kv.split(","); |
||||
String key = kvs[0]; |
||||
String value = kvs[1]; |
||||
|
||||
if(key.equals(type)){ |
||||
result = value; |
||||
break; |
||||
} |
||||
} |
||||
|
||||
return result; |
||||
} |
||||
} |
@ -0,0 +1,51 @@
|
||||
package com.eco.plugin.xxxx.webservicets.utils; |
||||
|
||||
import org.w3c.dom.Document; |
||||
import org.w3c.dom.NodeList; |
||||
import org.xml.sax.InputSource; |
||||
|
||||
import javax.xml.parsers.DocumentBuilder; |
||||
import javax.xml.parsers.DocumentBuilderFactory; |
||||
import javax.xml.xpath.XPath; |
||||
import javax.xml.xpath.XPathConstants; |
||||
import javax.xml.xpath.XPathExpression; |
||||
import javax.xml.xpath.XPathFactory; |
||||
import java.io.StringReader; |
||||
|
||||
|
||||
public class XMLUtils { |
||||
public static NodeList xmlTONodeList(String xml){ |
||||
NodeList nodes = null ; |
||||
|
||||
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); |
||||
|
||||
try { |
||||
DocumentBuilder builder = dbf.newDocumentBuilder(); |
||||
StringReader sr = new StringReader(xml); |
||||
InputSource is = new InputSource(sr); |
||||
Document doc = builder.parse(is); |
||||
XPathFactory factory = XPathFactory.newInstance(); |
||||
XPath xPath = factory.newXPath(); |
||||
XPathExpression expr = xPath.compile("/root/*"); |
||||
nodes = (NodeList) expr.evaluate(doc, XPathConstants.NODESET); |
||||
if (null == nodes) { |
||||
return null; |
||||
} |
||||
}catch (Exception e){ |
||||
e.printStackTrace(); |
||||
} |
||||
|
||||
return nodes; |
||||
} |
||||
|
||||
public static String getValueByNodeName(NodeList nodes, String nodeName){ |
||||
for (int i = 0; i < nodes.getLength(); i++) { |
||||
String nodes1 = nodes.item(i).getNodeName(); |
||||
if (nodes.item(i).getNodeName().equals(nodeName)) { |
||||
return nodes.item(i).getTextContent(); |
||||
} |
||||
} |
||||
|
||||
return ""; |
||||
} |
||||
} |
@ -0,0 +1,398 @@
|
||||
|
||||
BI.config("dec.provider.schedule", function (provider) { |
||||
provider.registerHandingWay({ |
||||
text: "代办发起", |
||||
value:"com.eco.plugin.xxxx.webservicets.dsdd.dsdd.TsBean", |
||||
cardType: "dec.schedule.task.file.handling.oa", |
||||
actions: [] // action
|
||||
}, [DecCst.Schedule.TaskType.DEFAULT, DecCst.Schedule.TaskType.REPORT, DecCst.Schedule.TaskType.BI]); |
||||
}); |
||||
|
||||
var Plugin = BI.inherit(BI.Widget, { |
||||
props: { |
||||
baseCls: "" |
||||
}, |
||||
_store: function () { |
||||
return BI.Models.getModel("dec.model.schedule.task.file.handling.oa") |
||||
}, |
||||
watch: { |
||||
linkType: function (e) { |
||||
this.linkGroup.setValue(e), |
||||
this.customizeLinkText.setVisible(e === DecCst.Schedule.MessageUrl.Type.OUT) |
||||
}, |
||||
type:function(e){ |
||||
this.title.setVisible(e*1 !== 1) |
||||
}, |
||||
linkGroupItems: function (e) { |
||||
this.linkGroup.populate(BI.createItems(e, { |
||||
type: "bi.single_select_radio_item", |
||||
logic: { |
||||
dynamic: !0 |
||||
} |
||||
})), |
||||
this.model.isNotReportTask && this.store.setLinkType(DecCst.Schedule.MessageUrl.Type.OUT) |
||||
} |
||||
}, |
||||
render: function () { |
||||
var t = this, |
||||
e = this.options.value[0], |
||||
n = this; |
||||
|
||||
if(e == undefined){ |
||||
e = {}; |
||||
} |
||||
// this.store.setLinkType(e.linkOpenType*1);
|
||||
// this.store.setType(e.type*1);
|
||||
|
||||
return { |
||||
type: "bi.vertical", |
||||
tgap: 15, |
||||
items: [ |
||||
{ |
||||
type: "bi.horizontal_adapt", |
||||
columnSize: [115, "fill"], |
||||
items: [{ |
||||
type: "bi.label", |
||||
cls: "dec-font-weight-bold", |
||||
width: 115, |
||||
height: 24, |
||||
textAlign: "left", |
||||
text: "报表标志" |
||||
}, { |
||||
type: "dec.label.editor.item", |
||||
textCls: "dec-font-weight-bold", |
||||
height: 24, |
||||
invisible: 0, |
||||
textWidth: "", |
||||
watermark: "报表标志", |
||||
editorWidth: 300, |
||||
value: e.type, |
||||
ref: function (e) { |
||||
n.type = e |
||||
} |
||||
} |
||||
] |
||||
}, |
||||
{ |
||||
type: "bi.horizontal_adapt", |
||||
columnSize: [115, "fill"], |
||||
items: [{ |
||||
type: "bi.label", |
||||
cls: "dec-font-weight-bold", |
||||
width: 115, |
||||
height: 24, |
||||
textAlign: "left", |
||||
text: "数据集名称" |
||||
}, { |
||||
type: "dec.label.editor.item", |
||||
textCls: "dec-font-weight-bold", |
||||
height: 24, |
||||
// lgap: 20,
|
||||
invisible: 0, |
||||
textWidth: "", |
||||
watermark: "数据集名称", |
||||
editorWidth: 300, |
||||
value: e.serverdata, |
||||
ref: function (e) { |
||||
n.serverdata = e |
||||
} |
||||
} |
||||
] |
||||
} |
||||
] |
||||
} |
||||
}, |
||||
/** |
||||
* |
||||
* |
||||
* @returns {boolean} |
||||
*/ |
||||
validation: function () { |
||||
return true; |
||||
}, |
||||
setValue: function (e) { |
||||
var t = this; |
||||
BI.map(e, function (e, i) { |
||||
if (i.runType === DecCst.Schedule.RunType.CLIENT_NOTIFICATION) |
||||
{ |
||||
t.contentText.setValue(i.content), t.title.setValue(i.title), t.msgtype.setValue(i.msgtype) |
||||
} |
||||
}) |
||||
}, |
||||
|
||||
/** |
||||
* |
||||
* outputActionList |
||||
* @returns {{}} |
||||
*/ |
||||
getValue: function () { |
||||
return { |
||||
"@class": "com.eco.plugin.xxxx.webservicets.dsdd.dsdd.TsBean", |
||||
actionName: "com.eco.plugin.xxxx.webservicets.dsdd.dsdd.TsBean", |
||||
type: this.type.getValue(), |
||||
serverdata:this.serverdata.getValue() |
||||
} |
||||
} |
||||
}); |
||||
BI.shortcut("dec.schedule.task.file.handling.oa", Plugin); |
||||
|
||||
//数据
|
||||
var e = BI.inherit(Fix.Model, { |
||||
context: ["currTask"], |
||||
state: function () { |
||||
return { |
||||
linkType: DecCst.Schedule.MessageUrl.Type.INNER, |
||||
type:1 |
||||
} |
||||
}, |
||||
computed: { |
||||
isBITask: function () { |
||||
return this.model.currTask.taskType === DecCst.Schedule.TaskType.BI |
||||
}, |
||||
isNotReportTask: function () { |
||||
return this.model.currTask.taskType !== DecCst.Schedule.TaskType.REPORT |
||||
}, |
||||
linkGroupItems: function () { |
||||
var e = BI.deepClone(BI.Constants.getConstant("dec.constant.schedule.task.handing.client.link")); |
||||
return this.model.isNotReportTask ? (e[0].disabled = !0, e[0].selected = !1, e[1].selected = !0, this.setLinkType(DecCst.Schedule.MessageUrl.Type.OUT)) : (e[0].disabled = !1, e[0].selected = this.model.linkType === DecCst.Schedule.MessageUrl.Type.INNER, e[1].selected = this.model.linkType === DecCst.Schedule.MessageUrl.Type.OUT), |
||||
e |
||||
}, |
||||
typeGroupItems: function () { |
||||
return [{disabled:false,selected:true,text:'消息推送',value:'1'},{disabled:false,selected:false,text:'代办推送',value:'2'}] |
||||
} |
||||
}, |
||||
actions: { |
||||
setLinkType: function (e) { |
||||
this.model.linkType = e |
||||
}, |
||||
setType: function(e){ |
||||
this.model.type = e; |
||||
} |
||||
} |
||||
}); |
||||
BI.model("dec.model.schedule.task.file.handling.oa", e) |
||||
|
||||
|
||||
//处理空数组问题
|
||||
var e = BI.inherit(BI.Widget, { |
||||
props: { |
||||
baseCls: "dec-schedule-task-handling", |
||||
$testId: "dec-schedule-task-handling", |
||||
value: { |
||||
scheduleOutput: { |
||||
outputActionList: [] |
||||
} |
||||
} |
||||
}, |
||||
_store: function () { |
||||
return BI.Models.getModel("dec.model.schedule.task.handling", { |
||||
value: this.options.value |
||||
}) |
||||
}, |
||||
watch: { |
||||
selectedWay: function (e) { |
||||
this.leftGroup.populate(this._createLeftItems(e)), |
||||
this.leftGroup.setValue(this.model.leftTab), |
||||
this.handlingWayGroup.setValue(e) |
||||
}, |
||||
leftTab: function (e) { |
||||
this.centerTab.setSelect(e) |
||||
}, |
||||
topItems: function (e) { |
||||
this.handlingWayGroup.populate(e), |
||||
this.handlingWayGroup.setValue(this.model.selectedWay) |
||||
}, |
||||
taskType: function () { |
||||
this.centerTab.empty() |
||||
} |
||||
}, |
||||
render: function () { |
||||
var i = this; |
||||
return { |
||||
type: "bi.vertical", |
||||
items: [{ |
||||
el: { |
||||
type: "bi.vertical", |
||||
bgap: 5, |
||||
items: [{ |
||||
type: "bi.absolute", |
||||
items: [{ |
||||
el: { |
||||
type: "bi.horizontal", |
||||
tgap: 5, |
||||
items: [{ |
||||
type: "bi.label", |
||||
height: 24, |
||||
cls: "dec-font-weight-bold", |
||||
text: BI.i18nText("Dec-Task_Handling"), |
||||
textAlign: "left" |
||||
} |
||||
] |
||||
}, |
||||
left: 0, |
||||
top: 0 |
||||
} |
||||
] |
||||
}, { |
||||
el: { |
||||
type: "bi.button_group", |
||||
layouts: [{ |
||||
type: "bi.left", |
||||
lgap: 40, |
||||
bgap: 15 |
||||
} |
||||
], |
||||
chooseType: BI.ButtonGroup.CHOOSE_TYPE_MULTI, |
||||
items: this.model.topItems, |
||||
value: this.model.selectedWay, |
||||
ref: function (e) { |
||||
i.handlingWayGroup = e |
||||
}, |
||||
listeners: [{ |
||||
eventName: BI.ButtonGroup.EVENT_CHANGE, |
||||
action: function (e, t) { |
||||
i.store.setHandlingWay(e, t.isSelected()) |
||||
} |
||||
} |
||||
] |
||||
}, |
||||
lgap: 50 |
||||
} |
||||
] |
||||
}, |
||||
tgap: 10 |
||||
}, { |
||||
type: "bi.htape", |
||||
cls: "handling-body bi-border-top", |
||||
items: [{ |
||||
type: "bi.button_group", |
||||
cls: "bi-border-right", |
||||
width: 200, |
||||
layouts: [{ |
||||
type: "bi.vertical" |
||||
} |
||||
], |
||||
items: this._createLeftItems(this.model.selectedWay), |
||||
value: this.model.leftTab, |
||||
ref: function (e) { |
||||
i.leftGroup = e |
||||
}, |
||||
listeners: [{ |
||||
eventName: BI.ButtonGroup.EVENT_CHANGE, |
||||
action: function (e) { |
||||
i.store.setLeftTab(e) |
||||
} |
||||
} |
||||
] |
||||
}, { |
||||
type: "bi.absolute", |
||||
items: [{ |
||||
el: { |
||||
type: "bi.tab", |
||||
showIndex: this.model.leftTab, |
||||
cardCreator: BI.bind(i._cardCreator, this), |
||||
ref: function (e) { |
||||
i.centerTab = e |
||||
} |
||||
}, |
||||
top: 0, |
||||
left: 15, |
||||
bottom: 0, |
||||
right: 0 |
||||
} |
||||
] |
||||
} |
||||
] |
||||
} |
||||
] |
||||
} |
||||
}, |
||||
validation: function (e) { |
||||
var n = this, |
||||
o = [], |
||||
r = n.model.handlingItems; |
||||
BI.each(this.model.editingWay, function (e, t) { |
||||
var i = n[t + "Pane"]; |
||||
if (!BI.isFunction(i.validation) || i.validation()) { |
||||
if (!BI.isNull(i.getValue())) |
||||
return !0; |
||||
o.push(r[t].text) |
||||
} else |
||||
o.push(r[t].text) |
||||
}), |
||||
0 < BI.size(o) && BI.Msg.alert(BI.i18nText("Dec-Basic_Tips"), BI.i18nText("Dec-Error_Task_File_Handling_Value", o.join(","))), |
||||
e(0 === BI.size(o)) |
||||
}, |
||||
getValue: function () { |
||||
var i = {}; |
||||
BI.each(this.model.outputActionList, function (e, t) { |
||||
i[t.actionName] = t |
||||
}); |
||||
var o = {}, |
||||
r = [], |
||||
s = [], |
||||
a = [], |
||||
e = this.model.editingWay, |
||||
c = this, |
||||
l = c.model.handlingItems; |
||||
BI.each(e, function (e, t) { |
||||
var i, |
||||
n = c[t + "Pane"]; |
||||
n && BI.isNotEmptyObject(n.getValue()) && ((i = n.getValue(), BI.isNotNull(l[t].actions) && l[t].actions.length > 0) ? (r.push(t), BI.each(i, function (e, t) { |
||||
var i = t.actionName; |
||||
r.push(i), |
||||
o[i] = t |
||||
}), s = BI.concat(s, BI.difference(l[t].actions, r))) : (r.push(t), o[t] = i), a.push(l[t].runType)) |
||||
}); |
||||
var t = BI.filter(i, function (e, t) { |
||||
return c.store.isDefaultByRunType(t, a) || c.store.isDefaultValueItem(t, r, s) |
||||
}); |
||||
return { |
||||
scheduleOutput: BI.extend({}, this.model.currTask.scheduleOutput, { |
||||
outputActionList: BI.map(o, function (e, t) { |
||||
return delete t.runType, |
||||
BI.extend({ |
||||
resultURL: window.location.protocol + "//" + window.location.host + Dec.fineServletURL |
||||
}, t) |
||||
}).concat(t) |
||||
}) |
||||
} |
||||
}, |
||||
_cardCreator: function (i) { |
||||
var t = this, |
||||
e = BI.find(this.model.handlingItems, function (e, t) { |
||||
return t.value === i |
||||
}); |
||||
return e && BI.isKey(e.cardType) ? { |
||||
type: e.cardType, |
||||
value: this.store.findActionValue(e, BI.deepClone(this.model.outputActionList)), |
||||
ref: function (e) { |
||||
t[i + "Pane"] = e |
||||
} |
||||
} |
||||
: { |
||||
type: "bi.label", |
||||
text: i |
||||
} |
||||
}, |
||||
_createLeftItems: function (e) { |
||||
var n = this; |
||||
return BI.map(e, function (e, t) { |
||||
var i = n.model.handlingItems[t].text; |
||||
return { |
||||
type: "dec.schedule.task.file.handling.item", |
||||
text: i, |
||||
value: t, |
||||
listeners: [{ |
||||
eventName: "EVENT_DELETE", |
||||
action: function () { |
||||
n.store.deleteAction(t, i) |
||||
} |
||||
} |
||||
] |
||||
} |
||||
}) |
||||
} |
||||
}); |
||||
|
||||
BI.shortcut("dec.schedule.task.handling", e) |
Loading…
Reference in new issue