1.根据建模数据定时创建流程
每个月初触发客户回访记录流程
package weaver.formmode.apps;
import java.util.ArrayList;
import java.util.List;
import RecordSet;
importresized weaver.file.Prop;
import al.BaseBean;
import al.Util;
import source.ResourceComInfo;
import weaver.interfaces.schedule.BaseCronJob;
import weaver.quest.MainTableInfo;
import weaver.quest.Property;
import weaver.quest.RequestInfo;
import weaver.quest.RequestService;
import com.weaver.formmodel.util.DateHelper;
/**
* 每个月初定时创建客户回访信息
* @author mc
*/
public class CreateWorkflowJob extends BaseCronJob {
private BaseBean beseBean = new BaseBean();
public void execute() {
//chua
String workflowid = Prop.getPropValue("kh", "workflowid");
// 流程创建人
String createor = Prop.getPropValue("kh", "createid");
RecordSet rs = new RecordSet();
rs.executeQuery("select * from uf_khinfo ");
while(rs.next()){
String gsmc = Util.null2String(rs.getString("gsmc"));
String khmc = Util.null2String(rs.getString("khmc"));
String khjl = Util.null2String(rs.getString("khjl"));
ResourceComInfo rci = null;
try {
rci = new ResourceComInfo();
} catch (Exception e1) {
e1.printStackTrace();
}
String khmcName = Lastname(khmc);
String topTitle = gsmc+"-"+khmcName+"("+ DateHelper.getCurrentMonth() +")";
// 创建流程
RequestService requestService = new RequestService();
RequestInfo requestInfo = new RequestInfo();
requestInfo.setWorkflowid(workflowid);//流程类型id
requestInfo.setCreatorid(createor);//创建人
requestInfo.setDescription(topTitle);//设置流程标题
requestInfo.setRequestlevel("0");//0 正常,1重要,2紧急
requestInfo.setIsNextFlow("1");//流转到下一节点 0:不自动流程 其它:自动流程
MainTableInfo mainTableInfo = new MainTableInfo();
List<Property> fields = new ArrayList<Property>();
Property field = null;
/**
* 主表
* 格式:
* {
* rwmc: '任务名称-001',
* rwfzr: '杨文元',
* ksrq: '2019-08-08',
* }
*/
field = new Property();
field.setName("khjl");
field.setValue(khjl);
fields.add(field);
field = new Property();
field.setName("khmc");
field.setValue(gsmc);
fields.add(field);
field = new Property();
field.setName("khjl");
field.setValue(khjl);
fields.add(field);
field = new Property();
field.setName("fzr");
field.setValue(khmc);
fields.add(field);
Property[] fieldarray = (Property[]) Array(new Property[fields.size()]);
mainTableInfo.setProperty(fieldarray);
requestInfo.setMainTableInfo(mainTableInfo);
int newrequestid = 0;
try {
newrequestid = Util.getIntValue(ateRequest(requestInfo));
} catch (Exception e) {
e.printStackTrace();
}
beseBean.writeLog("创建成功的流程requestid:"+newrequestid);
}
}
}
配置文件
2.建模中代码创建附件
/**
* 从网络上抓取文件存入系统中
* @param modeid
* @param userid
* @param fileurl
* @param filename
* @return
*/
public int buildFile(int modeid,int userid,String fileurl,String filename) {
RecordSet rs = new RecordSet();
OutputStream os = null;
ZipOutputStream filezipOut = null;
InputStream source = null;
int retDocid = 0;
boolean needzip = false;
try {
SystemComInfo syscominfo = new SystemComInfo();
String createdir = FileUpload.getCreateDir(Filesystem());
if( (Needzip()).equals("1") ) needzip = true ;
FileManage.createDir(createdir) ;
DefaultFileRenamePolicy defpolicy = new DefaultFileRenamePolicy() ;
String refilename = al.Util.getRandom();
String filepath = createdir+refilename;
if(needzip) filepath+=".zip";
java.io.File outfile = new java.io.File(filepath);
outfile = ame(outfile);
String iszip = "1" ;
if(needzip){
filezipOut = new ZipOutputStream(new BufferedOutputStream(new FileOutputStream(outfile)));
filezipOut.setMethod(ZipOutputStream.DEFLATED); //设置压缩方法
filezipOut.putNextEntry(new ZipEntry(refilename)) ;//正文只能是WORD文档
os = filezipOut ;
}else{
os = new BufferedOutputStream(new FileOutputStream(outfile)) ;
iszip = "0";
}
//通过HTTP方式获取文件
URL url = new URL(fileurl);
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
BufferedInputStream input = new InputStream());
long filesize = 0;
byte[] buffer = new byte[1024];
int count = 0;
while ((count = ad(buffer)) > 0) {
os.write(buffer, 0, count);
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。
发表评论