定时任务推送信息公式支持和调整
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

183 lines
4.5 KiB

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