18 changed files with 871 additions and 1 deletions
@ -1,3 +1,12 @@ |
|||||||
# demo-output-formula-provider |
# demo-output-formula-provider |
||||||
|
|
||||||
定时任务推送信息公式支持和调整 |
定时任务推送信息公式支持和调整\ |
||||||
|
demo生效后,定时任务推送邮件会输出\ |
||||||
|
可以在邮件信息OutputEmail生成之前,对结果报表进行预处理\ |
||||||
|
可以在邮件信息OutputEmail生成之后,对邮件信息进行校正\ |
||||||
|
这样的日志信息\ |
||||||
|
同时定时调度的客户端推送中会新增一个Print Log的客户端,可以输入一个随机配置,默认是123456\ |
||||||
|
该客户端推送生效后,定时任务执行时会输出\ |
||||||
|
LogFormula Print:xxxxxxx\ |
||||||
|
LogHandler Print:xxxxxxx\ |
||||||
|
这样的日志信息 |
@ -0,0 +1,124 @@ |
|||||||
|
|
||||||
|
apply plugin: 'java' |
||||||
|
|
||||||
|
[compileJava,compileTestJava]*.options*.encoding = 'UTF-8' |
||||||
|
|
||||||
|
ext { |
||||||
|
/** |
||||||
|
* 项目中依赖的jar的路径 |
||||||
|
* 1.如果依赖的jar需要打包到zip中,放置在lib根目录下 |
||||||
|
* 2.如果依赖的jar仅仅是编译时需要,防止在lib下子目录下即可 |
||||||
|
*/ |
||||||
|
libPath = "$projectDir/../webroot/WEB-INF/lib" |
||||||
|
|
||||||
|
/** |
||||||
|
* 是否对插件的class进行加密保护,防止反编译 |
||||||
|
*/ |
||||||
|
guard = false |
||||||
|
|
||||||
|
def pluginInfo = getPluginInfo() |
||||||
|
pluginPre = "fine-plugin" |
||||||
|
pluginName = pluginInfo.id |
||||||
|
pluginVersion = pluginInfo.version |
||||||
|
|
||||||
|
outputPath = "$projectDir/../webroot/WEB-INF/plugins/plugin-" + pluginName + "-1.0/classes" |
||||||
|
} |
||||||
|
|
||||||
|
group = 'com.fr.plugin' |
||||||
|
version = '10.0' |
||||||
|
sourceCompatibility = '8' |
||||||
|
|
||||||
|
sourceSets { |
||||||
|
main { |
||||||
|
java.outputDir = file(outputPath) |
||||||
|
output.resourcesDir = file(outputPath) |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
ant.importBuild("encrypt.xml") |
||||||
|
//定义ant变量 |
||||||
|
ant.projectDir = projectDir |
||||||
|
ant.references["compile.classpath"] = ant.path { |
||||||
|
fileset(dir: libPath, includes: '**/*.jar') |
||||||
|
fileset(dir: ".",includes:"**/*.jar" ) |
||||||
|
} |
||||||
|
|
||||||
|
classes.dependsOn('clean') |
||||||
|
|
||||||
|
task copyFiles(type: Copy,dependsOn: 'classes'){ |
||||||
|
from outputPath |
||||||
|
into "$projectDir/classes" |
||||||
|
} |
||||||
|
|
||||||
|
task preJar(type:Copy,dependsOn: guard ? 'compile_encrypt_javas' : 'compile_plain_javas'){ |
||||||
|
from "$projectDir/classes" |
||||||
|
into "$projectDir/transform-classes" |
||||||
|
include "**/*.*" |
||||||
|
} |
||||||
|
jar.dependsOn("preJar") |
||||||
|
|
||||||
|
task makeJar(type: Jar,dependsOn: preJar){ |
||||||
|
from fileTree(dir: "$projectDir/transform-classes") |
||||||
|
baseName pluginPre |
||||||
|
appendix pluginName |
||||||
|
version pluginVersion |
||||||
|
destinationDir = file("$buildDir/libs") |
||||||
|
|
||||||
|
doLast(){ |
||||||
|
delete file("$projectDir/classes") |
||||||
|
delete file("$projectDir/transform-classes") |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
task copyFile(type: Copy,dependsOn: ["makeJar"]){ |
||||||
|
from "$buildDir/libs" |
||||||
|
from("$projectDir/lib") { |
||||||
|
include "*.jar" |
||||||
|
} |
||||||
|
from "$projectDir/plugin.xml" |
||||||
|
into file("$buildDir/temp/plugin") |
||||||
|
} |
||||||
|
|
||||||
|
task zip(type:Zip,dependsOn:["copyFile"]){ |
||||||
|
from "$buildDir/temp/plugin" |
||||||
|
destinationDir file("$buildDir/install") |
||||||
|
baseName pluginPre |
||||||
|
appendix pluginName |
||||||
|
version pluginVersion |
||||||
|
} |
||||||
|
|
||||||
|
//控制build时包含哪些文件,排除哪些文件 |
||||||
|
processResources { |
||||||
|
// exclude everything |
||||||
|
// 用*.css没效果 |
||||||
|
// exclude '**/*.css' |
||||||
|
// except this file |
||||||
|
// include 'xx.xml' |
||||||
|
} |
||||||
|
|
||||||
|
/*读取plugin.xml中的version*/ |
||||||
|
def getPluginInfo(){ |
||||||
|
def xmlFile = file("plugin.xml") |
||||||
|
if (!xmlFile.exists()) { |
||||||
|
return ["id":"none", "version":"1.0.0"] |
||||||
|
} |
||||||
|
def plugin = new XmlParser().parse(xmlFile) |
||||||
|
def version = plugin.version[0].text() |
||||||
|
def id = plugin.id[0].text() |
||||||
|
return ["id":id,"version":version] |
||||||
|
} |
||||||
|
|
||||||
|
repositories { |
||||||
|
mavenLocal() |
||||||
|
maven { |
||||||
|
url = uri('http://mvn.finedevelop.com/repository/maven-public/') |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
dependencies { |
||||||
|
//使用本地jar |
||||||
|
implementation fileTree(dir: 'lib', include: ['**/*.jar']) |
||||||
|
implementation fileTree(dir: libPath, include: ['**/*.jar']) |
||||||
|
} |
||||||
|
|
||||||
|
|
@ -0,0 +1,13 @@ |
|||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?> |
||||||
|
<project> |
||||||
|
<target name="compile_encrypt_javas" depends="copyFiles"> |
||||||
|
<echo message="加密文件"/> |
||||||
|
<echo message="${projectDir}"/> |
||||||
|
<taskdef name="pretreatment" classname="com.fr.plugin.pack.PluginPretreatmentTask"> |
||||||
|
<classpath refid="compile.classpath"/> |
||||||
|
</taskdef> |
||||||
|
<pretreatment baseDir="${projectDir}"/> |
||||||
|
</target> |
||||||
|
<target name="compile_plain_javas" depends="copyFiles"> |
||||||
|
</target> |
||||||
|
</project> |
Binary file not shown.
Binary file not shown.
@ -0,0 +1,20 @@ |
|||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?><plugin> |
||||||
|
<id>com.tptj.demo.hg.output.formula.provider.v10</id> |
||||||
|
<name><![CDATA[ OutputFormulaProvider ]]></name> |
||||||
|
<active>yes</active> |
||||||
|
<version>1.0</version> |
||||||
|
<env-version>10.0</env-version> |
||||||
|
<vendor>tptj</vendor> |
||||||
|
<jartime>2019-07-18</jartime> |
||||||
|
<description><![CDATA[ ]]></description> |
||||||
|
<change-notes><![CDATA[]]></change-notes> |
||||||
|
<main-package>com.tptj.demo.hg.output.formula.provider</main-package> |
||||||
|
<function-recorder class="com.tptj.demo.hg.output.formula.provider.Demo"/> |
||||||
|
<extra-decision> |
||||||
|
<OutputFormulaProvider class="com.tptj.demo.hg.output.formula.provider.Demo"/> |
||||||
|
<DecisionDBAccessProvider class="com.tptj.demo.hg.output.formula.provider.OutputLogDbAccess"/> |
||||||
|
<OutputFormulaProvider class="com.tptj.demo.hg.output.formula.provider.LogFormula"/> |
||||||
|
<WebResourceProvider class="com.tptj.demo.hg.output.formula.provider.WebResource"/> |
||||||
|
</extra-decision> |
||||||
|
<lifecycle-monitor class="com.tptj.demo.hg.output.formula.provider.OutputHandlerRegister"/> |
||||||
|
</plugin> |
@ -0,0 +1,33 @@ |
|||||||
|
package com.tptj.demo.hg.output.formula.provider; |
||||||
|
|
||||||
|
import com.fanruan.api.log.LogKit; |
||||||
|
import com.fr.intelli.record.Focus; |
||||||
|
import com.fr.main.workbook.ResultWorkBook; |
||||||
|
import com.fr.record.analyzer.EnableMetrics; |
||||||
|
import com.fr.schedule.base.bean.output.OutputEmail; |
||||||
|
import com.fr.schedule.extension.report.job.output.formula.EmailFormula; |
||||||
|
import java.util.List; |
||||||
|
import java.util.Map; |
||||||
|
|
||||||
|
/** |
||||||
|
* @author 秃破天际 |
||||||
|
* @version 10.0 |
||||||
|
* Created by 秃破天际 on 2021-04-20 |
||||||
|
* AbstractOutputFormulaProvider |
||||||
|
* --> AbstractReportOutputFormulaProvider |
||||||
|
* -->EmailFormula |
||||||
|
**/ |
||||||
|
@EnableMetrics |
||||||
|
public class Demo extends EmailFormula { |
||||||
|
|
||||||
|
@Override |
||||||
|
@Focus(id="com.tptj.demo.hg.output.formula.provider.v10",text = "OutputFormulaProvider") |
||||||
|
public void dealWithFormulaParam(OutputEmail action, ResultWorkBook result, List<Map<String, Object>> mapList) throws Exception { |
||||||
|
//hugh:10.0版本定时附件处理过程中,只有在OutputFormulaProvider#dealWithFormulaParam接口中才能获取到结果报表,
|
||||||
|
// 对要发送的信息进行处理,主要是处理公式和参数支持。将要发送的消息中需要的结果报表信息提前取出来生成好
|
||||||
|
LogKit.info("可以在邮件信息OutputEmail生成之前,对结果报表进行预处理"); |
||||||
|
super.dealWithFormulaParam(action, result, mapList); |
||||||
|
LogKit.info("可以在邮件信息OutputEmail生成之后,对邮件信息进行校正"); |
||||||
|
} |
||||||
|
|
||||||
|
} |
@ -0,0 +1,176 @@ |
|||||||
|
package com.tptj.demo.hg.output.formula.provider; |
||||||
|
|
||||||
|
import com.fanruan.api.util.StringKit; |
||||||
|
import com.fr.schedule.base.entity.AbstractScheduleEntity; |
||||||
|
import com.fr.stable.db.constant.EntityConstant; |
||||||
|
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; |
||||||
|
|
||||||
|
/** |
||||||
|
* @author 秃破天际 |
||||||
|
* @version 10.0 |
||||||
|
* Created by 秃破天际 on 2021-04-20 |
||||||
|
* 插件中的表名必须以plugin开头 |
||||||
|
**/ |
||||||
|
@Entity |
||||||
|
@Table(name = "plugin_output_log") |
||||||
|
@TableAssociation(associated = true) |
||||||
|
public class LogEntity extends AbstractScheduleEntity { |
||||||
|
|
||||||
|
public static final String COLUMN_TERMINAL_TYPE = "terminal"; |
||||||
|
public static final String COLUMN_SUBJECT = "subject"; |
||||||
|
public static final String COLUMN_CONTENT = "content"; |
||||||
|
public static final String COLUMN_LINK_OPEN_TYPE = "linkOpenType"; |
||||||
|
public static final String COLUMN_CUSTOMIZE_LINK = "customizeLink"; |
||||||
|
public static final String COLUMN_TYPE = "type"; |
||||||
|
public static final String COLUMN_MEDIA_ID = "mediaId"; |
||||||
|
public static final String COLUMN_PRE = "pre"; |
||||||
|
|
||||||
|
@Column(name = COLUMN_PRE) |
||||||
|
private String pre = StringKit.EMPTY; |
||||||
|
|
||||||
|
@Column(name = COLUMN_TERMINAL_TYPE) |
||||||
|
private int terminal = 1; |
||||||
|
|
||||||
|
@Column(name = COLUMN_SUBJECT, length = EntityConstant.STRING_LONG_SIZE) |
||||||
|
private String subject; |
||||||
|
|
||||||
|
@Column(name = COLUMN_CONTENT, length = EntityConstant.STRING_LONG_SIZE) |
||||||
|
private String content; |
||||||
|
|
||||||
|
@Column(name = COLUMN_LINK_OPEN_TYPE) |
||||||
|
private int linkOpenType = -1; |
||||||
|
|
||||||
|
@Column(name = COLUMN_CUSTOMIZE_LINK, length = EntityConstant.STRING_LONG_SIZE) |
||||||
|
private String customizeLink; |
||||||
|
|
||||||
|
@Column(name = COLUMN_TYPE) |
||||||
|
private int type; |
||||||
|
|
||||||
|
@Column(name = COLUMN_MEDIA_ID) |
||||||
|
private String mediaId; |
||||||
|
|
||||||
|
@Override |
||||||
|
public OutputLog createBean() { |
||||||
|
return new OutputLog() |
||||||
|
.id(getId()) |
||||||
|
.terminal(getTerminal()) |
||||||
|
.subject(getSubject()) |
||||||
|
.content(getContent()) |
||||||
|
.customizeLink(getCustomizeLink()) |
||||||
|
.linkOpenType(getLinkOpenType()) |
||||||
|
.type(getType()) |
||||||
|
.mediaId(getMediaId()); |
||||||
|
} |
||||||
|
|
||||||
|
public String getPre() { |
||||||
|
return pre; |
||||||
|
} |
||||||
|
|
||||||
|
public void setPre(String pre) { |
||||||
|
this.pre = pre; |
||||||
|
} |
||||||
|
|
||||||
|
public int getTerminal() { |
||||||
|
return terminal; |
||||||
|
} |
||||||
|
|
||||||
|
public void setTerminal(int terminal) { |
||||||
|
this.terminal = terminal; |
||||||
|
} |
||||||
|
|
||||||
|
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 LogEntity id(String id) { |
||||||
|
setId(id); |
||||||
|
return this; |
||||||
|
} |
||||||
|
|
||||||
|
public LogEntity terminal(int terminal) { |
||||||
|
setTerminal(terminal); |
||||||
|
return this; |
||||||
|
} |
||||||
|
|
||||||
|
public LogEntity subject(String subject) { |
||||||
|
setSubject(subject); |
||||||
|
return this; |
||||||
|
} |
||||||
|
|
||||||
|
public LogEntity content(String content) { |
||||||
|
setContent(content); |
||||||
|
return this; |
||||||
|
} |
||||||
|
|
||||||
|
public LogEntity linkOpenType(int linkOpenType) { |
||||||
|
setLinkOpenType(linkOpenType); |
||||||
|
return this; |
||||||
|
} |
||||||
|
|
||||||
|
public LogEntity customizeLink(String customizeLink) { |
||||||
|
setCustomizeLink(customizeLink); |
||||||
|
return this; |
||||||
|
} |
||||||
|
|
||||||
|
public LogEntity type(int type) { |
||||||
|
setType(type); |
||||||
|
return this; |
||||||
|
} |
||||||
|
|
||||||
|
public LogEntity mediaId(String mediaId) { |
||||||
|
setMediaId(mediaId); |
||||||
|
return this; |
||||||
|
} |
||||||
|
|
||||||
|
public LogEntity pre(String pre) { |
||||||
|
setPre(pre); |
||||||
|
return this; |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,27 @@ |
|||||||
|
package com.tptj.demo.hg.output.formula.provider; |
||||||
|
|
||||||
|
import com.fanruan.api.log.LogKit; |
||||||
|
import com.fr.json.JSONObject; |
||||||
|
import com.fr.main.workbook.ResultWorkBook; |
||||||
|
import com.fr.schedule.extension.report.provider.impl.AbstractReportOutputFormulaProvider; |
||||||
|
|
||||||
|
import java.util.List; |
||||||
|
import java.util.Map; |
||||||
|
|
||||||
|
/** |
||||||
|
* @author 秃破天际 |
||||||
|
* @version 10.0 |
||||||
|
* Created by 秃破天际 on 2021-04-20 |
||||||
|
**/ |
||||||
|
public class LogFormula extends AbstractReportOutputFormulaProvider<OutputLog, ResultWorkBook> { |
||||||
|
@Override |
||||||
|
public void dealWithFormulaParam(OutputLog action, ResultWorkBook result, |
||||||
|
List<Map<String, Object>> mapList) throws Exception { |
||||||
|
LogKit.info("LogFormula Print:{}", JSONObject.mapFrom(action).toString()); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public String getActionClassName() { |
||||||
|
return OutputLog.class.getName(); |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,20 @@ |
|||||||
|
package com.tptj.demo.hg.output.formula.provider; |
||||||
|
|
||||||
|
import com.fanruan.api.log.LogKit; |
||||||
|
import com.fr.json.JSONObject; |
||||||
|
import com.fr.schedule.feature.output.OutputActionHandler; |
||||||
|
|
||||||
|
import java.util.Map; |
||||||
|
|
||||||
|
/** |
||||||
|
* @author 秃破天际 |
||||||
|
* @version 10.0 |
||||||
|
* Created by 秃破天际 on 2021-04-20 |
||||||
|
**/ |
||||||
|
public class LogHandler extends OutputActionHandler<OutputLog> { |
||||||
|
|
||||||
|
@Override |
||||||
|
public void doAction( OutputLog action, Map<String, Object> map ) throws Exception { |
||||||
|
LogKit.info("LogHandler Print:{}", JSONObject.mapFrom(action).toString()); |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,9 @@ |
|||||||
|
package com.tptj.demo.hg.output.formula.provider; |
||||||
|
|
||||||
|
/** |
||||||
|
* @author 秃破天际 |
||||||
|
* @version 10.0 |
||||||
|
* Created by 秃破天际 on 2021-04-20 |
||||||
|
**/ |
||||||
|
public class NewTypeDemo { |
||||||
|
} |
@ -0,0 +1,25 @@ |
|||||||
|
package com.tptj.demo.hg.output.formula.provider; |
||||||
|
|
||||||
|
import com.fr.plugin.context.PluginContext; |
||||||
|
import com.fr.plugin.observer.inner.AbstractPluginLifecycleMonitor; |
||||||
|
import com.fr.schedule.feature.ScheduleOutputActionEntityRegister; |
||||||
|
import com.fr.schedule.feature.output.OutputActionHandler; |
||||||
|
|
||||||
|
/** |
||||||
|
* @author 秃破天际 |
||||||
|
* @version 10.0 |
||||||
|
* Created by 秃破天际 on 2021-04-20 |
||||||
|
**/ |
||||||
|
public class OutputHandlerRegister extends AbstractPluginLifecycleMonitor { |
||||||
|
@Override |
||||||
|
public void afterRun(PluginContext context) { |
||||||
|
ScheduleOutputActionEntityRegister.getInstance().addClass(LogEntity.class); |
||||||
|
OutputActionHandler.registerHandler( new LogHandler(), OutputLog.class.getName() ); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public void beforeStop(PluginContext context) { |
||||||
|
ScheduleOutputActionEntityRegister.getInstance().removeClass(LogEntity.class); |
||||||
|
OutputActionHandler.removeOutputHandler( OutputLog.class.getName() ); |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,183 @@ |
|||||||
|
package com.tptj.demo.hg.output.formula.provider; |
||||||
|
|
||||||
|
import com.fanruan.api.util.StringKit; |
||||||
|
import com.fr.decision.base.util.AttachUtil; |
||||||
|
import com.fr.decision.mobile.MobileConstant; |
||||||
|
import com.fr.decision.mobile.MobileUtil; |
||||||
|
import com.fr.decision.system.bean.message.MessageUrlType; |
||||||
|
import com.fr.decision.system.bean.message.MobileMessageType; |
||||||
|
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.stable.StableUtils; |
||||||
|
import com.fr.third.fasterxml.jackson.annotation.JsonSubTypes; |
||||||
|
|
||||||
|
/** |
||||||
|
* @author 秃破天际 |
||||||
|
* @version 10.0 |
||||||
|
* Created by 秃破天际 on 2021-04-20 |
||||||
|
**/ |
||||||
|
@JsonSubTypes.Type(value = OutputLog.class, name = "OutputLog") |
||||||
|
public class OutputLog extends BaseOutputAction { |
||||||
|
|
||||||
|
private String pre = StringKit.EMPTY; |
||||||
|
private int terminal; |
||||||
|
private String subject; |
||||||
|
private String content; |
||||||
|
private int linkOpenType = MessageUrlType.INNER.toInt(); |
||||||
|
private String customizeLink; |
||||||
|
private int type = MobileMessageType.TEXT.toInt(); |
||||||
|
private String mediaId; |
||||||
|
private int runType = RunType.PUSH_MESSAGE.getValue(); |
||||||
|
|
||||||
|
@Override |
||||||
|
public boolean willExecuteByUser() { |
||||||
|
//hugh:如果你的附件处理是以用户为目标的某种推送形式,那么这里就返回true
|
||||||
|
//从而实现每个用户收到的结果都是根据用户自身的权限进行计算的。
|
||||||
|
return false; |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public RunType runType() { |
||||||
|
//这里返回的是附件处理的日志记录类型
|
||||||
|
return RunType.PUSH_MESSAGE; |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public Class<? extends AbstractScheduleEntity> outputActionEntityClass() { |
||||||
|
return LogEntity.class; |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public LogEntity createOutputActionEntity() { |
||||||
|
return new LogEntity() |
||||||
|
.id(getId()) |
||||||
|
.terminal(getTerminal()) |
||||||
|
.subject(getSubject()) |
||||||
|
.content(getContent()) |
||||||
|
.linkOpenType(getLinkOpenType()) |
||||||
|
.customizeLink(getCustomizeLink()) |
||||||
|
.type(getType()) |
||||||
|
.mediaId(getMediaId()).pre(getPre()); |
||||||
|
} |
||||||
|
|
||||||
|
public int getTerminal() { |
||||||
|
return terminal; |
||||||
|
} |
||||||
|
|
||||||
|
public void setTerminal(int terminal) { |
||||||
|
this.terminal = terminal; |
||||||
|
} |
||||||
|
|
||||||
|
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() { |
||||||
|
String path = StableUtils.pathJoin(MobileConstant.SCHEDULE, MobileConstant.CLIENTNOTIFICATION); |
||||||
|
AttachUtil.checkImage(mediaId, MobileUtil.getFileDir(path), mediaId); |
||||||
|
return mediaId; |
||||||
|
} |
||||||
|
|
||||||
|
public String getPre() { |
||||||
|
return pre; |
||||||
|
} |
||||||
|
|
||||||
|
public void setPre(String pre) { |
||||||
|
this.pre = pre; |
||||||
|
} |
||||||
|
|
||||||
|
public void setMediaId(String mediaId) { |
||||||
|
this.mediaId = mediaId; |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public OutputLog id(String id) { |
||||||
|
setId(id); |
||||||
|
return this; |
||||||
|
} |
||||||
|
|
||||||
|
public OutputLog terminal(int terminal) { |
||||||
|
setTerminal(terminal); |
||||||
|
return this; |
||||||
|
} |
||||||
|
|
||||||
|
public OutputLog subject(String subject) { |
||||||
|
setSubject(subject); |
||||||
|
return this; |
||||||
|
} |
||||||
|
|
||||||
|
public OutputLog content(String content) { |
||||||
|
setContent(content); |
||||||
|
return this; |
||||||
|
} |
||||||
|
|
||||||
|
public OutputLog linkOpenType(int linkOpenType) { |
||||||
|
setLinkOpenType(linkOpenType); |
||||||
|
return this; |
||||||
|
} |
||||||
|
|
||||||
|
public OutputLog customizeLink(String customizeLink) { |
||||||
|
setCustomizeLink(customizeLink); |
||||||
|
return this; |
||||||
|
} |
||||||
|
|
||||||
|
public OutputLog type(int type) { |
||||||
|
setType(type); |
||||||
|
return this; |
||||||
|
} |
||||||
|
|
||||||
|
public OutputLog mediaId(String mediaId) { |
||||||
|
setMediaId(mediaId); |
||||||
|
return this; |
||||||
|
} |
||||||
|
|
||||||
|
public OutputLog pre(String pre){ |
||||||
|
setPre(pre); |
||||||
|
return this; |
||||||
|
} |
||||||
|
|
||||||
|
public int getRunType() { |
||||||
|
return runType; |
||||||
|
} |
||||||
|
|
||||||
|
public void setRunType(int runType) { |
||||||
|
this.runType = runType; |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,20 @@ |
|||||||
|
package com.tptj.demo.hg.output.formula.provider; |
||||||
|
|
||||||
|
import com.fr.stable.db.dao.BaseDAO; |
||||||
|
import com.fr.stable.db.session.DAOSession; |
||||||
|
|
||||||
|
/** |
||||||
|
* @author 秃破天际 |
||||||
|
* @version 10.0 |
||||||
|
* Created by 秃破天际 on 2021-04-20 |
||||||
|
**/ |
||||||
|
public class OutputLogDao extends BaseDAO<LogEntity> { |
||||||
|
public OutputLogDao(DAOSession daoSession) { |
||||||
|
super(daoSession); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
protected Class<LogEntity> getEntityClass() { |
||||||
|
return LogEntity.class; |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,41 @@ |
|||||||
|
package com.tptj.demo.hg.output.formula.provider; |
||||||
|
|
||||||
|
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; |
||||||
|
|
||||||
|
/** |
||||||
|
* @author 秃破天际 |
||||||
|
* @version 10.0 |
||||||
|
* Created by 秃破天际 on 2021-04-20 |
||||||
|
**/ |
||||||
|
public class OutputLogDbAccess extends AbstractDecisionDBAccessProvider { |
||||||
|
private static DBAccessor accessor; |
||||||
|
|
||||||
|
public static DBAccessor getAccessor() { |
||||||
|
return accessor; |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public DAOProvider[] registerDAO() { |
||||||
|
return new DAOProvider[] { |
||||||
|
new DAOProvider() { |
||||||
|
@Override |
||||||
|
public Class getEntityClass() { |
||||||
|
return LogEntity.class; |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public Class<? extends BaseDAO> getDAOClass() { |
||||||
|
return OutputLogDao.class; |
||||||
|
} |
||||||
|
} |
||||||
|
}; |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public void onDBAvailable(DBAccessor accessor) { |
||||||
|
OutputLogDbAccess.accessor = accessor; |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,39 @@ |
|||||||
|
package com.tptj.demo.hg.output.formula.provider; |
||||||
|
|
||||||
|
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; |
||||||
|
|
||||||
|
/** |
||||||
|
* @author 秃破天际 |
||||||
|
* @version 10.0 |
||||||
|
* Created by 秃破天际 on 2021-04-20 |
||||||
|
**/ |
||||||
|
public class WebResource extends AbstractWebResourceProvider { |
||||||
|
@Override |
||||||
|
public Atom attach() { |
||||||
|
return MainComponent.KEY; |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public Atom[] clients() { |
||||||
|
return new Atom[]{ |
||||||
|
new Component() { |
||||||
|
@Override |
||||||
|
public ScriptPath script(RequestClient client) { |
||||||
|
return ScriptPath.build( "com/tptj/demo/hg/output/formula/provider/log.schedule.terminal.js"); |
||||||
|
} |
||||||
|
}, |
||||||
|
new Component() { |
||||||
|
@Override |
||||||
|
public ScriptPath script(RequestClient client) { |
||||||
|
return ScriptPath.build( "com/tptj/demo/hg/output/formula/provider/main.js"); |
||||||
|
} |
||||||
|
} |
||||||
|
}; |
||||||
|
|
||||||
|
} |
||||||
|
} |
@ -0,0 +1,31 @@ |
|||||||
|
/** |
||||||
|
* @author 秃破天际 |
||||||
|
* @version 10.0 |
||||||
|
* Created by 秃破天际 on 2021-04-20 |
||||||
|
**/ |
||||||
|
!(function () { |
||||||
|
var Terminal = BI.inherit(BI.Widget, { |
||||||
|
render: function () { |
||||||
|
var self = this; |
||||||
|
return { |
||||||
|
type: "bi.text_editor", |
||||||
|
height: 24, |
||||||
|
allowBlank: true, |
||||||
|
value: self.options.selectedId || "123456", |
||||||
|
ref: function (_ref) { |
||||||
|
self.w_pre = _ref; |
||||||
|
} |
||||||
|
}; |
||||||
|
}, |
||||||
|
getValue: function () { |
||||||
|
return this.w_pre.getValue(); |
||||||
|
}, |
||||||
|
setValue: function (v) { |
||||||
|
this.w_pre.setValue(v); |
||||||
|
}, |
||||||
|
checkValid: function () { |
||||||
|
return true; |
||||||
|
} |
||||||
|
}); |
||||||
|
BI.shortcut("log.schedule.terminal", Terminal); |
||||||
|
})(); |
@ -0,0 +1,100 @@ |
|||||||
|
/** |
||||||
|
* @author 秃破天际 |
||||||
|
* @version 10.0 |
||||||
|
* Created by 秃破天际 on 2021-04-20 |
||||||
|
**/ |
||||||
|
!(function () { |
||||||
|
//hugh这里很容易发生冲突,如果同时装了两个不是同一个开发者开发的不同插件甚至是商城插件~
|
||||||
|
//两个插件的type值如果一样,就完蛋
|
||||||
|
var TERMINAL_TYPE = 4; |
||||||
|
var ADDRESSEE_CHAT_GROUP = 1; |
||||||
|
|
||||||
|
BI.config("dec.provider.client.notification", function (provider) { |
||||||
|
provider.registerHandler({ |
||||||
|
getTerminalType: function () { |
||||||
|
return TERMINAL_TYPE; |
||||||
|
}, |
||||||
|
|
||||||
|
getTerminalText: function () { |
||||||
|
return "Print Log"; |
||||||
|
}, |
||||||
|
|
||||||
|
getTerminalComponent: function () { |
||||||
|
var self = this; |
||||||
|
return { |
||||||
|
type: "log.schedule.terminal", |
||||||
|
ref: function (_ref) { |
||||||
|
self.terminalComponent = _ref; |
||||||
|
}, |
||||||
|
checkValid: function () { |
||||||
|
return self.terminalComponent.checkValid() |
||||||
|
} |
||||||
|
} |
||||||
|
}, |
||||||
|
getExtraAddressees: function () { |
||||||
|
//因为demo示例仅仅只是在后台打印配置信息,所以不需要根据用户处理不同的计算
|
||||||
|
return {}; |
||||||
|
}, |
||||||
|
|
||||||
|
getValue: function () { |
||||||
|
debugger; |
||||||
|
var self = this; |
||||||
|
return { |
||||||
|
log: BI.extend(self.value, { |
||||||
|
"@class": "com.tptj.demo.hg.output.formula.provider.OutputLog", |
||||||
|
actionName: "com.tptj.demo.hg.output.formula.provider.OutputLog", |
||||||
|
terminal: TERMINAL_TYPE, |
||||||
|
pre: self.terminalComponent.getValue() |
||||||
|
}) |
||||||
|
} |
||||||
|
}, |
||||||
|
|
||||||
|
setValue: function (v) { |
||||||
|
if (v.terminal && v.terminal === TERMINAL_TYPE) { |
||||||
|
this.value = v; |
||||||
|
//hugh:自定义的值设置的入口
|
||||||
|
this.terminalComponent.setValue(v.pre); |
||||||
|
} |
||||||
|
}, |
||||||
|
|
||||||
|
checkValid: function (validJo) { |
||||||
|
var valid = true; |
||||||
|
// 判断拓展组件是否为空的前提是该组件对应的复选框已经选中
|
||||||
|
var selectedTerminal = validJo.selectedTerminal; |
||||||
|
if (this._isTerminalSelected(selectedTerminal)) { |
||||||
|
valid = this.terminalComponent.checkValid(); |
||||||
|
} |
||||||
|
return valid; |
||||||
|
}, |
||||||
|
|
||||||
|
_isTerminalSelected: function (terminals) { |
||||||
|
debugger; |
||||||
|
var totalTerminal = 0; |
||||||
|
BI.each(terminals, function (i, terminal) { |
||||||
|
totalTerminal += terminal; |
||||||
|
}); |
||||||
|
return (TERMINAL_TYPE & totalTerminal) === TERMINAL_TYPE; |
||||||
|
}, |
||||||
|
|
||||||
|
_isChatGroupSelected: function (addressees) { |
||||||
|
debugger; |
||||||
|
return true; |
||||||
|
}, |
||||||
|
|
||||||
|
_transformOutputChatToComboValue: function (outputChat) { |
||||||
|
debugger; |
||||||
|
if (!BI.isEmpty(outputChat)) { |
||||||
|
return { |
||||||
|
type: outputChat.type, |
||||||
|
value: outputChat.chatGroups |
||||||
|
} |
||||||
|
} else { |
||||||
|
return { |
||||||
|
type: BI.Selection.None, |
||||||
|
value: [] |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
}); |
||||||
|
}); |
||||||
|
})(); |
Loading…
Reference in new issue