no message
parent
4f6effbf9c
commit
82de9480fd
@ -0,0 +1,60 @@
|
||||
package com.engine.custom.archives.action;
|
||||
|
||||
import weaver.conn.RecordSet;
|
||||
import weaver.file.Prop;
|
||||
import weaver.general.BaseBean;
|
||||
import weaver.general.Util;
|
||||
import weaver.interfaces.workflow.action.Action;
|
||||
import weaver.soa.workflow.request.RequestInfo;
|
||||
|
||||
import java.text.DateFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Arrays;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 添加流程到推送记录
|
||||
*/
|
||||
public class AddArchivesRecordAction extends BaseBean implements Action {
|
||||
String SQL = "insert into uf_pushArchivesLog (request,type,ddsj) values (?,?,?) ";
|
||||
|
||||
@Override
|
||||
public String execute(RequestInfo requestInfo) {
|
||||
String requestid = requestInfo.getRequestid();
|
||||
String workflowid = requestInfo.getWorkflowid();
|
||||
String reveive = Util.null2String(Prop.getPropValue("archives", "reveive"));
|
||||
String send = Util.null2String(Prop.getPropValue("archives", "send"));
|
||||
String SignOff = Util.null2String(Prop.getPropValue("archives", "SignOff"));
|
||||
//痩文
|
||||
List<String> reveiveArr = Arrays.asList( reveive.split(","));
|
||||
//发文
|
||||
List<String> sendArr = Arrays.asList(send.split(","));
|
||||
//签报
|
||||
List<String> SignOffArr = Arrays.asList(SignOff.split(","));
|
||||
String type = "";
|
||||
if (sendArr.contains(workflowid)){
|
||||
type = "0";
|
||||
}else if(reveiveArr.contains(workflowid)){
|
||||
type = "1";
|
||||
}else if(SignOffArr.contains(workflowid)){
|
||||
type = "2";
|
||||
}else {
|
||||
//不匹配跳过insert
|
||||
return Action.SUCCESS;
|
||||
}
|
||||
RecordSet recordSet = new RecordSet();
|
||||
Date date = new Date();
|
||||
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm");
|
||||
String dateStr = format.format(date);
|
||||
recordSet.executeUpdate(SQL,requestid,type,dateStr);
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,217 @@
|
||||
package com.engine.custom.archives.entity;
|
||||
|
||||
public class PushArchivesBean {
|
||||
|
||||
|
||||
private int id;
|
||||
private String requestId;
|
||||
private int request;
|
||||
private String content;
|
||||
private String zt;
|
||||
private String ddsj;
|
||||
private String tssj;
|
||||
private String zw;
|
||||
private String fj;
|
||||
private String cbd;
|
||||
private String lzxx;
|
||||
private String zlc;
|
||||
private String esbtxtml;
|
||||
private String esbwjml;
|
||||
private String formModeId;
|
||||
private String modeDataCreater;
|
||||
private String modeDataCreatertype;
|
||||
private String modeDataCreatedate;
|
||||
private String modeDataCreatetime;
|
||||
private String modeDataModifier;
|
||||
private String modeDataModifydatetime;
|
||||
private String formBizId;
|
||||
private String type;
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getRequestId() {
|
||||
return requestId;
|
||||
}
|
||||
|
||||
public void setRequestId(String requestId) {
|
||||
this.requestId = requestId;
|
||||
}
|
||||
|
||||
public int getRequest() {
|
||||
return request;
|
||||
}
|
||||
|
||||
public void setRequest(int request) {
|
||||
this.request = request;
|
||||
}
|
||||
|
||||
public String getContent() {
|
||||
return content;
|
||||
}
|
||||
|
||||
public void setContent(String content) {
|
||||
this.content = content;
|
||||
}
|
||||
|
||||
public String getZt() {
|
||||
return zt;
|
||||
}
|
||||
|
||||
public void setZt(String zt) {
|
||||
this.zt = zt;
|
||||
}
|
||||
|
||||
public String getDdsj() {
|
||||
return ddsj;
|
||||
}
|
||||
|
||||
public void setDdsj(String ddsj) {
|
||||
this.ddsj = ddsj;
|
||||
}
|
||||
|
||||
public String getTssj() {
|
||||
return tssj;
|
||||
}
|
||||
|
||||
public void setTssj(String tssj) {
|
||||
this.tssj = tssj;
|
||||
}
|
||||
|
||||
public String getZw() {
|
||||
return zw;
|
||||
}
|
||||
|
||||
public void setZw(String zw) {
|
||||
this.zw = zw;
|
||||
}
|
||||
|
||||
public String getFj() {
|
||||
return fj;
|
||||
}
|
||||
|
||||
public void setFj(String fj) {
|
||||
this.fj = fj;
|
||||
}
|
||||
|
||||
public String getCbd() {
|
||||
return cbd;
|
||||
}
|
||||
|
||||
public void setCbd(String cbd) {
|
||||
this.cbd = cbd;
|
||||
}
|
||||
|
||||
public String getLzxx() {
|
||||
return lzxx;
|
||||
}
|
||||
|
||||
public void setLzxx(String lzxx) {
|
||||
this.lzxx = lzxx;
|
||||
}
|
||||
|
||||
public String getZlc() {
|
||||
return zlc;
|
||||
}
|
||||
|
||||
public void setZlc(String zlc) {
|
||||
this.zlc = zlc;
|
||||
}
|
||||
|
||||
public String getEsbtxtml() {
|
||||
return esbtxtml;
|
||||
}
|
||||
|
||||
public void setEsbtxtml(String esbtxtml) {
|
||||
this.esbtxtml = esbtxtml;
|
||||
}
|
||||
|
||||
public String getEsbwjml() {
|
||||
return esbwjml;
|
||||
}
|
||||
|
||||
public void setEsbwjml(String esbwjml) {
|
||||
this.esbwjml = esbwjml;
|
||||
}
|
||||
|
||||
public String getFormModeId() {
|
||||
return formModeId;
|
||||
}
|
||||
|
||||
public void setFormModeId(String formModeId) {
|
||||
this.formModeId = formModeId;
|
||||
}
|
||||
|
||||
public String getModeDataCreater() {
|
||||
return modeDataCreater;
|
||||
}
|
||||
|
||||
public void setModeDataCreater(String modeDataCreater) {
|
||||
this.modeDataCreater = modeDataCreater;
|
||||
}
|
||||
|
||||
public String getModeDataCreatertype() {
|
||||
return modeDataCreatertype;
|
||||
}
|
||||
|
||||
public void setModeDataCreatertype(String modeDataCreatertype) {
|
||||
this.modeDataCreatertype = modeDataCreatertype;
|
||||
}
|
||||
|
||||
public String getModeDataCreatedate() {
|
||||
return modeDataCreatedate;
|
||||
}
|
||||
|
||||
public void setModeDataCreatedate(String modeDataCreatedate) {
|
||||
this.modeDataCreatedate = modeDataCreatedate;
|
||||
}
|
||||
|
||||
public String getModeDataCreatetime() {
|
||||
return modeDataCreatetime;
|
||||
}
|
||||
|
||||
public void setModeDataCreatetime(String modeDataCreatetime) {
|
||||
this.modeDataCreatetime = modeDataCreatetime;
|
||||
}
|
||||
|
||||
public String getModeDataModifier() {
|
||||
return modeDataModifier;
|
||||
}
|
||||
|
||||
public void setModeDataModifier(String modeDataModifier) {
|
||||
this.modeDataModifier = modeDataModifier;
|
||||
}
|
||||
|
||||
public String getModeDataModifydatetime() {
|
||||
return modeDataModifydatetime;
|
||||
}
|
||||
|
||||
public void setModeDataModifydatetime(String modeDataModifydatetime) {
|
||||
this.modeDataModifydatetime = modeDataModifydatetime;
|
||||
}
|
||||
|
||||
public String getFormBizId() {
|
||||
return formBizId;
|
||||
}
|
||||
|
||||
public void setFormBizId(String formBizId) {
|
||||
this.formBizId = formBizId;
|
||||
}
|
||||
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,488 @@
|
||||
package com.engine.custom.archives.service;
|
||||
|
||||
|
||||
import com.dcfs.fts.common.error.FtpException;
|
||||
import com.engine.custom.archives.util.ArchivesUtil;
|
||||
import com.engine.custom.hg.util.HgUtils;
|
||||
import com.icbc.api.internal.apache.http.impl.cookie.S;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.LocalDate;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.io.*;
|
||||
import java.util.*;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import weaver.conn.RecordSet;
|
||||
import weaver.general.StringUtil;
|
||||
import weaver.general.Util;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import weaver.file.ImageFileManager;
|
||||
|
||||
import java.net.URL;
|
||||
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import okhttp3.*;
|
||||
|
||||
import java.net.URLEncoder;
|
||||
|
||||
import weaver.soa.workflow.request.RequestService;
|
||||
import weaver.soa.workflow.request.RequestInfo;
|
||||
import com.engine.custom.archives.action.WorkflowToDocCus;
|
||||
import weaver.docs.docs.DocRecycleManager;
|
||||
import weaver.hrm.User;
|
||||
import com.api.workflow.service.RequestAuthenticationService;
|
||||
import weaver.workflow.workflow.WorkflowConfigComInfo;
|
||||
import weaver.hrm.resource.ResourceComInfo;
|
||||
import weaver.crm.Maint.CustomerInfoComInfo;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import weaver.workflow.monitor.Monitor;
|
||||
import com.engine.workflow.biz.RobotNode.RobotNodeServiceBiz;
|
||||
import com.api.workflow.util.ServiceUtil;
|
||||
import com.engine.workflow.biz.RobotNode.RobotNodeBiz;
|
||||
import weaver.general.TimeUtil;
|
||||
import org.apache.poi.xwpf.usermodel.XWPFDocument;
|
||||
import cn.afterturn.easypoi.word.WordExportUtil;
|
||||
import cn.hutool.core.util.ZipUtil;
|
||||
import freemarker.template.Configuration;
|
||||
import freemarker.template.TemplateExceptionHandler;
|
||||
import freemarker.template.Template;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
||||
|
||||
|
||||
public class ReceivingPushArchivesService {
|
||||
private static String filePath;
|
||||
private static String Url;
|
||||
private static String templatePath; // 模板文件路径
|
||||
private static final String zwdir = "正文";
|
||||
private static final String fjdir = "附件";
|
||||
private static final String cbddir = "承办单";
|
||||
private static final String zlcdir = "承办单" + File.separator + "子流程";
|
||||
private static final String lzxxdir = "流转信息";
|
||||
private static final String fjFile = "附件";
|
||||
public static Logger log = LoggerFactory.getLogger("Archives");
|
||||
|
||||
|
||||
public void setProp(Map<String, String> param) {
|
||||
filePath = Util.null2String(param.get("filePath"));
|
||||
Url = Util.null2String(param.get("Url"));
|
||||
templatePath = Util.null2String(param.get("templatePath"));
|
||||
}
|
||||
|
||||
|
||||
public void pushArchives(Map<String, String> param) {
|
||||
log.info("PushArchivesCorn====Begin========{}", param);
|
||||
try {
|
||||
|
||||
ZipUtil zipUtil = new ZipUtil();
|
||||
Date date = ArchivesUtil.getDate();
|
||||
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMdd");
|
||||
String format = dateFormat.format(date);
|
||||
SimpleDateFormat yyyyMMddHHmmss = new SimpleDateFormat("yyyy-MM-dd HH:mm");
|
||||
// 获取当前时间的第一秒
|
||||
String firstSecond = yyyyMMddHHmmss.format(getFirstSecondOfDate(date));
|
||||
// 获取当前时间的最后一秒
|
||||
String lastSecond = yyyyMMddHHmmss.format(getLastSecondOfDate(date));
|
||||
|
||||
Integer requestid = Util.getIntValue(param.get("requestid"));
|
||||
|
||||
log.error("requestid:{}", requestid);
|
||||
String context = extracted(requestid);
|
||||
log.error("context:{}", context);
|
||||
File file = ArchivesUtil.crFile(filePath + "/togd_" + new SimpleDateFormat("yyyyMMdd000000").format(date));
|
||||
log.error("textfile:{}", file.getAbsolutePath());
|
||||
ArchivesUtil.writeToTxt(file.getPath(), file.getName(), context, true);
|
||||
File txtzip = new File(filePath + File.separator + "togd_" + new SimpleDateFormat("yyyyMMdd000000").format(date) + ".zip");
|
||||
log.error("textZipFile:{}", txtzip.getAbsolutePath());
|
||||
OutputStream outputStream = new FileOutputStream(txtzip);
|
||||
File writename = new File(file.getPath() + "/" + file.getName() + ".txt");
|
||||
com.engine.custom.hg.util.ZipUtil.filesToZip(writename, outputStream, writename.getName());
|
||||
log.error("writename:{}",writename.getName());
|
||||
String s = HgUtils.putFile(txtzip.getAbsolutePath(), txtzip.getName());
|
||||
updateRecord(requestid, s);
|
||||
log.error("textZip:{}", s);
|
||||
} catch (Exception e) {
|
||||
log.info("PushArchivesCorn====Exception========{}", e.getMessage());
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void updateRecord(int requestids, String s) {
|
||||
String sql = "update uf_pushArchivesLog set esbtxtml = ? where request in ( " + requestids + " )";
|
||||
RecordSet recordSet = new RecordSet();
|
||||
recordSet.executeUpdate(sql, s);
|
||||
}
|
||||
|
||||
private String extracted(int requestid) throws FtpException, IOException {
|
||||
Map<String, String> requesData = getRequestByid(requestid);
|
||||
log.info("requesData:{}", requesData);
|
||||
String fj = Util.null2String(requesData.get("fj"));
|
||||
String zwkbj = Util.null2String(requesData.get("zwkbj"));
|
||||
//增加签字意见中的附件到附件文件夹中
|
||||
Map<String, String> signFiles = ArchivesUtil.getSignFiles(requestid,true);
|
||||
List<String> docids = new ArrayList<>();
|
||||
// docids.addAll(Arrays.asList(fj.split(",")));
|
||||
// docids.addAll(Arrays.asList(zwkbj.split(",")));
|
||||
Map<String, String> fjMap = ArchivesUtil.getFileIdByDocId(fj);
|
||||
Map<String, String> zwkbjMap = ArchivesUtil.getFileIdByDocId(zwkbj);
|
||||
List<String> zwFileName = new ArrayList<>();
|
||||
List<String> fjFileName = new ArrayList<>();
|
||||
final int[] i = {1};
|
||||
//附件
|
||||
fjMap.forEach((docid, imageid) -> {
|
||||
ImageFileManager imageFileManager = new ImageFileManager();
|
||||
imageFileManager.getImageFileInfoById(Util.getIntValue(imageid));
|
||||
InputStream inputStream = imageFileManager.getInputStream();
|
||||
//中文路径/中文文件名
|
||||
String imageFileName = filePath + File.separator + requestid + File.separator + fjdir + File.separator + imageFileManager.getImageFileName();
|
||||
fjFileName.add(imageFileManager.getImageFileName());
|
||||
log.info("生成附件路径:{}", imageFileName);
|
||||
imageFileName = ArchivesUtil.codeUtf8(imageFileName);
|
||||
try {
|
||||
File file = ArchivesUtil.saveInputStreamToFile(inputStream, imageFileName);
|
||||
String jsonStr = ArchivesUtil.callApi(Url, file);
|
||||
log.error("永中接口返回数据:{}", jsonStr);
|
||||
JSONObject result = JSONObject.parseObject(jsonStr);
|
||||
String errorcode = result.getString("errorcode");
|
||||
if ("0".equals(errorcode)) {
|
||||
JSONObject data = result.getJSONObject("data");
|
||||
String destFileName = data.getString("destFileName");
|
||||
String viewUrl = data.getString("viewUrl");
|
||||
ArchivesUtil.downloadFile(viewUrl, filePath + File.separator + requestid + File.separator + fjdir + File.separator + imageFileManager.getImageFileName() + ".pdf");
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
});
|
||||
|
||||
//签字意见附件
|
||||
signFiles.forEach((docid, imageid) -> {
|
||||
ImageFileManager imageFileManager = new ImageFileManager();
|
||||
imageFileManager.getImageFileInfoById(Util.getIntValue(imageid));
|
||||
InputStream inputStream = imageFileManager.getInputStream();
|
||||
//中文路径/中文文件名
|
||||
String imageFileName = filePath + File.separator + requestid + File.separator + fjdir + File.separator + imageFileManager.getImageFileName();
|
||||
fjFileName.add(imageFileManager.getImageFileName());
|
||||
log.info("生成签字意见附件路径:{}", imageFileName);
|
||||
imageFileName = ArchivesUtil.codeUtf8(imageFileName);
|
||||
try {
|
||||
File file = ArchivesUtil.saveInputStreamToFile(inputStream, imageFileName);
|
||||
String jsonStr = ArchivesUtil.callApi(Url, file);
|
||||
log.error("永中接口返回数据:{}", jsonStr);
|
||||
JSONObject result = JSONObject.parseObject(jsonStr);
|
||||
String errorcode = result.getString("errorcode");
|
||||
if ("0".equals(errorcode)) {
|
||||
JSONObject data = result.getJSONObject("data");
|
||||
String destFileName = data.getString("destFileName");
|
||||
String viewUrl = data.getString("viewUrl");
|
||||
ArchivesUtil.downloadFile(viewUrl, filePath + File.separator + requestid + File.separator + fjdir + File.separator + imageFileManager.getImageFileName() + ".pdf");
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
});
|
||||
|
||||
//正文
|
||||
zwkbjMap.forEach((docid, imageid) -> {
|
||||
ImageFileManager imageFileManager = new ImageFileManager();
|
||||
imageFileManager.getImageFileInfoById(Util.getIntValue(imageid));
|
||||
InputStream inputStream = imageFileManager.getInputStream();
|
||||
zwFileName.add(imageFileManager.getImageFileName());
|
||||
//中文路径/中文文件名
|
||||
String imageFileName = filePath + File.separator + requestid + File.separator + zwdir + File.separator + imageFileManager.getImageFileName();
|
||||
log.info("生成正文路径:{}", imageFileName);
|
||||
imageFileName = ArchivesUtil.codeUtf8(imageFileName);
|
||||
try {
|
||||
File file = ArchivesUtil.saveInputStreamToFile(inputStream, imageFileName);
|
||||
String jsonStr = ArchivesUtil.callApi(Url, file);
|
||||
log.error("永中接口返回:{}", jsonStr);
|
||||
JSONObject result = JSONObject.parseObject(jsonStr);
|
||||
String errorcode = result.getString("errorcode");
|
||||
if ("0".equals(errorcode)) {
|
||||
JSONObject data = result.getJSONObject("data");
|
||||
String destFileName = data.getString("destFileName");
|
||||
String viewUrl = data.getString("viewUrl");
|
||||
ArchivesUtil.downloadFile(viewUrl, filePath + File.separator + requestid + File.separator + zwdir + File.separator + imageFileManager.getImageFileName() + ".pdf");
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
});
|
||||
//开始承办单 先获取主流程的承办单
|
||||
List<String> requestDocid = ArchivesUtil.generaRequestFormPdf(requestid,1);
|
||||
// 1.去掉生成子流程承办单
|
||||
// List<String> subRequestDocid = generaSubRequestFormPdf(requestid);
|
||||
Map<String, String> reqDocMap = ArchivesUtil.getFileIdByDocId(String.join(",", requestDocid));
|
||||
// 2.去掉生成子流程承办单
|
||||
// Map<String, String> subReqDocMap = getFileIdByDocId(String.join(",", subRequestDocid));
|
||||
log.error("reqDocMap:{}", JSONObject.toJSONString(reqDocMap));
|
||||
//log.error("subReqDocMap:{}", JSONObject.toJSONString(subReqDocMap));
|
||||
docids.addAll(requestDocid);
|
||||
// 3.去掉生成子流程承办单
|
||||
// docids.addAll(subRequestDocid);
|
||||
//附件
|
||||
reqDocMap.forEach((docid, imageid) -> {
|
||||
ImageFileManager imageFileManager = new ImageFileManager();
|
||||
imageFileManager.getImageFileInfoById(Util.getIntValue(imageid));
|
||||
InputStream inputStream = imageFileManager.getInputStream();
|
||||
//中文路径/中文文件名
|
||||
String imageFileName = filePath + File.separator + requestid + File.separator + cbddir + File.separator + fjFile + i[0] + "_" + imageFileManager.getImageFileName();
|
||||
log.info("主流程承办单路径:{}", imageFileName);
|
||||
imageFileName = ArchivesUtil.codeUtf8(imageFileName);
|
||||
try {
|
||||
File file = ArchivesUtil.saveInputStreamToFile(inputStream, imageFileName);
|
||||
String jsonStr = ArchivesUtil.callApi(Url, file);
|
||||
log.error("永中接口返回:{}", jsonStr);
|
||||
JSONObject result = JSONObject.parseObject(jsonStr);
|
||||
String errorcode = result.getString("errorcode");
|
||||
if ("0".equals(errorcode)) {
|
||||
JSONObject data = result.getJSONObject("data");
|
||||
String destFileName = data.getString("destFileName");
|
||||
String viewUrl = data.getString("viewUrl");
|
||||
ArchivesUtil.downloadFile(viewUrl, filePath + File.separator + requestid + File.separator + cbddir + File.separator + fjFile + i[0] + "_" + imageFileManager.getImageFileName() + ".pdf");
|
||||
}
|
||||
i[0]++;
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
});
|
||||
//正文
|
||||
|
||||
i[0] = 1;
|
||||
// 4.去掉生成子流程承办单
|
||||
// subReqDocMap.forEach((docid, imageid) -> {
|
||||
// ImageFileManager imageFileManager = new ImageFileManager();
|
||||
// imageFileManager.getImageFileInfoById(Util.getIntValue(imageid));
|
||||
// InputStream inputStream = imageFileManager.getInputStream();
|
||||
// //中文路径/中文文件名
|
||||
// String imageFileName = filePath + File.separator + requestid + File.separator + zlcdir + File.separator + fjFile + i[0] + "_" + (imageFileManager.getImageFileName().contains("-")?imageFileManager.getImageFileName().split("\\-")[1]:imageFileManager.getImageFileName());
|
||||
// imageFileName = codeUtf8(imageFileName);
|
||||
// log.info("子流程承办单路径:{}", imageFileName);
|
||||
// try {
|
||||
// File file = saveInputStreamToFile(inputStream, imageFileName);
|
||||
// String jsonStr = callApi(Url, file);
|
||||
// log.error("永中接口返回:{}", jsonStr);
|
||||
// JSONObject result = JSONObject.parseObject(jsonStr);
|
||||
// String errorcode = result.getString("errorcode");
|
||||
// if ("0".equals(errorcode)) {
|
||||
// JSONObject data = result.getJSONObject("data");
|
||||
// String destFileName = data.getString("destFileName");
|
||||
// String viewUrl = data.getString("viewUrl");
|
||||
// downloadFile(viewUrl, filePath + File.separator + requestid + File.separator + zlcdir + File.separator + fjFile + i[0] + "_" + (imageFileManager.getImageFileName().contains("-")?imageFileManager.getImageFileName().split("\\-")[1]:imageFileManager.getImageFileName() )+ ".pdf");
|
||||
// }
|
||||
// i[0]++;
|
||||
// } catch (IOException e) {
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
// });
|
||||
log.error(JSONObject.toJSONString(requestDocid));
|
||||
// log.error(JSONObject.toJSONString(subRequestDocid));
|
||||
for (String docid : docids) {
|
||||
log.error("删除了" + docid);
|
||||
ArchivesUtil.deleteDocByid(docid);
|
||||
}
|
||||
//--------------------------------------------------------------------
|
||||
RequestService requestService = new RequestService();
|
||||
RequestInfo requestInfo = requestService.getRequest(Util.getIntValue(requestid), 100);
|
||||
|
||||
String logFile = ArchivesUtil.getSignLog(requestid, cbddir+File.separator+lzxxdir, requestInfo.getCreatorid() + requestInfo.getDescription(),templatePath,filePath,true);
|
||||
String s = ArchivesUtil.callApi(Url, new File(logFile));
|
||||
log.error(s);
|
||||
JSONObject result = JSONObject.parseObject(s);
|
||||
String errorcode = result.getString("errorcode");
|
||||
if ("0".equals(errorcode)) {
|
||||
JSONObject data = result.getJSONObject("data");
|
||||
String destFileName = data.getString("destFileName");
|
||||
String viewUrl = data.getString("viewUrl");
|
||||
ArchivesUtil.downloadFile(viewUrl, logFile + ".pdf");
|
||||
}
|
||||
String zipName = filePath + File.separator + requestid + ".zip";
|
||||
ZipUtil.zip(filePath + File.separator + requestid, zipName);
|
||||
log.error("zipName:{}", zipName);
|
||||
String ftpFilePath = HgUtils.putFile(zipName, requestid + ".zip");
|
||||
log.error("ftpFilePath:{}", ftpFilePath);
|
||||
String ftpFilePathNew = HgUtils.putFile(zipName, "test" + File.separator + requestid + ".zip");
|
||||
log.error("ftpFilePathNew:{}", ftpFilePathNew);
|
||||
String context = getContext(requestid, requesData, requestid + ".zip", zwFileName, fjFileName);
|
||||
insertRecord(requestid, context, ftpFilePath);
|
||||
log.error("context:{}", context);
|
||||
return context;
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void insertRecord(int requestid, String context, String ftpFilePath) {
|
||||
String sql = "insert into uf_pushArchivesLog (request ,content,esbwjml) VALUES (?,?,?)";
|
||||
RecordSet recordSet = new RecordSet();
|
||||
recordSet.executeUpdate(sql, requestid, context, ftpFilePath);
|
||||
}
|
||||
|
||||
|
||||
// 获取指定日期的第一秒
|
||||
public static Date getFirstSecondOfDate(Date date) {
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.setTime(date);
|
||||
calendar.set(Calendar.HOUR_OF_DAY, 0);
|
||||
calendar.set(Calendar.MINUTE, 0);
|
||||
calendar.set(Calendar.SECOND, 0);
|
||||
calendar.set(Calendar.MILLISECOND, 0);
|
||||
return calendar.getTime();
|
||||
}
|
||||
|
||||
// 获取指定日期的最后一秒
|
||||
public static Date getLastSecondOfDate(Date date) {
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.setTime(date);
|
||||
calendar.set(Calendar.HOUR_OF_DAY, 23);
|
||||
calendar.set(Calendar.MINUTE, 59);
|
||||
calendar.set(Calendar.SECOND, 59);
|
||||
calendar.set(Calendar.MILLISECOND, 999);
|
||||
return calendar.getTime();
|
||||
}
|
||||
|
||||
|
||||
|
||||
/***
|
||||
* 封装数据
|
||||
* @param requestid
|
||||
* @return
|
||||
*/
|
||||
public Map<String, String> getRequestByid(int requestid) {
|
||||
HashMap<String, String> record = new HashMap<>();
|
||||
String sql = "select * from formtable_main_30 where requestid = ?";
|
||||
String reqsql = "select REQUESTNAME from WORKFLOW_REQUESTBASE where REQUESTID = ?";
|
||||
RecordSet rs = new RecordSet();
|
||||
rs.executeQuery(sql, requestid);
|
||||
if (rs.next()) {
|
||||
String fj = Util.null2String(rs.getString("fj"));
|
||||
String zwkbj = Util.null2String(rs.getString("zwkbj")); // 正文可编辑字段
|
||||
record.put("fj", fj);
|
||||
record.put("zwkbj", zwkbj);
|
||||
record.put("zwyyglgwmk", Util.null2String(rs.getString("zwyyglgwmk")));
|
||||
record.put("lwh", Util.null2String(rs.getString("lwh")));
|
||||
record.put("mj", Util.null2String(rs.getString("mj")));
|
||||
record.put("lwrq", Util.null2String(rs.getString("lwrq")));
|
||||
record.put("swrq", Util.null2String(rs.getString("swrq")));
|
||||
record.put("blqx", Util.null2String(rs.getString("blqx")));
|
||||
record.put("sfdb", Util.null2String(rs.getString("sfdb")));
|
||||
record.put("wjlx", Util.null2String(rs.getString("wjlx")));
|
||||
record.put("fssj", Util.null2String(rs.getString("fssj")));
|
||||
record.put("gdh", Util.null2String(rs.getString("gdh")));
|
||||
record.put("swh", Util.null2String(rs.getString("swh")));
|
||||
record.put("ngbm", Util.null2String(rs.getString("ngbm")));
|
||||
record.put("ngr", Util.null2String(rs.getString("ngr")));
|
||||
record.put("ngrq", Util.null2String(rs.getString("ngrq")));
|
||||
record.put("swlx", Util.null2String(rs.getString("swlx")));
|
||||
record.put("jghwt", Util.null2String(rs.getString("jghwt")));
|
||||
record.put("lwdwmc", Util.null2String(rs.getString("lwdwmc")));
|
||||
record.put("bgqx", Util.null2String(rs.getString("bgqx")));
|
||||
record.put("ys", Util.null2String(rs.getString("ys")));
|
||||
record.put("wz", Util.null2String(rs.getString("wz")));
|
||||
record.put("lb", Util.null2String(rs.getString("lb")));
|
||||
record.put("bz", Util.null2String(rs.getString("bz")));
|
||||
record.put("yffbm", Util.null2String(rs.getString("yffbm")));
|
||||
record.put("ffbmb", Util.null2String(rs.getString("ffbmb")));
|
||||
record.put("yffbm", Util.null2String(rs.getString("yffbm")));
|
||||
}
|
||||
rs.executeQuery(reqsql, requestid);
|
||||
if (rs.next()) {
|
||||
record.put("REQUESTNAME", Util.null2String(rs.getString("REQUESTNAME")));
|
||||
}
|
||||
return record;
|
||||
}
|
||||
|
||||
|
||||
private String getContext(int requestid, Map<String, String> requesData, String zipName, List<String> zwFileName, List<String> fjFileName) {
|
||||
StringBuilder context = new StringBuilder();
|
||||
try {
|
||||
|
||||
String swrq = Util.null2String(requesData.get("swrq"));
|
||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
|
||||
LocalDate date = LocalDate.parse(swrq, formatter);
|
||||
int year = date.getYear();
|
||||
context.append(year).append("|");
|
||||
String jghwt = Util.null2String(requesData.get("jghwt"));
|
||||
context.append(jghwt).append("|");
|
||||
String swh = Util.null2String(requesData.get("swh"));
|
||||
context.append(swh).append("|");
|
||||
String requestname = Util.null2String(requesData.get("REQUESTNAME"));
|
||||
context.append(requestname).append("|");
|
||||
String lwdwmc = Util.null2String(requesData.get("lwdwmc")); //5 责任者 -> 来文单位
|
||||
context.append(lwdwmc).append("|");
|
||||
String bgqx = Util.null2String(requesData.get("bgqx")); //6 保管期限 -> 保管期限
|
||||
context.append(bgqx).append("|");
|
||||
String lwrq = Util.null2String(requesData.get("lwrq")); //7 日期 -> 原发文日期
|
||||
context.append(lwrq).append("|");
|
||||
String ys = Util.null2String(requesData.get("ys")); //8 页数 -> 页数
|
||||
context.append(ys).append("|");
|
||||
String wz = Util.null2String(requesData.get("wz")); //9 文种 -> 文种
|
||||
context.append(wz).append("|");
|
||||
String ngbm = Util.null2String(requesData.get("ngbm"));
|
||||
String[] deptData = ArchivesUtil.getDeptNameAndCode(ngbm);
|
||||
context.append(deptData[0]).append("|"); //10 行编号 -> 拟稿部门
|
||||
context.append(deptData[1]).append("|"); //11 行名称
|
||||
context.append("").append("|"); // 12 保管期限编号
|
||||
context.append("").append("|"); // 13 保管期限及编号
|
||||
context.append("").append("|"); // 14 是否开放
|
||||
context.append("").append("|"); // 15 互见号
|
||||
String lb = Util.null2String(requesData.get("lb"));
|
||||
context.append(lb).append("|"); //16 类别 -> 类别
|
||||
//TODO
|
||||
String xgbm = Util.null2String(getAssociatedDepts(requesData));
|
||||
context.append(xgbm).append("|"); //17 相关部门 -> 流经部门
|
||||
String lwh = Util.null2String(requesData.get("lwh"));// 18 收文号 -> 来文文号
|
||||
context.append(lwh).append("|");
|
||||
String fs = "";
|
||||
context.append(fs).append("|"); // 19 份数 -> 份数
|
||||
String bz = Util.null2String(requesData.get("bz"));
|
||||
context.append(bz).append("|"); // 20 备注 -> 备注
|
||||
String yywh = Util.null2String(requesData.get("yywh"));
|
||||
context.append(yywh).append("|"); // 21 引用文号 -> 引用文号
|
||||
String wjlx = Util.null2String(requesData.get("wjlx"));
|
||||
context.append(wjlx).append("|"); // 22 文件类型 -> 空
|
||||
String fwlx = Util.null2String(requesData.get("fwlx"));
|
||||
context.append(fwlx).append("|"); // 23 文件类型 -> 空
|
||||
String f = Util.null2String(requesData.get("f"));
|
||||
context.append(f).append("|"); // 24 发 -> 空
|
||||
String ngr = Util.null2String(requesData.get("ngr"));
|
||||
context.append(new User(Util.getIntValue(ngr)).getLoginid()).append("|"); // 25 拟稿人 -> 拟稿人
|
||||
context.append(deptData[1]).append("|"); // 26 拟稿部门 -> 拟稿部门名称
|
||||
context.append("收文").append("|"); // 27 公文类型 -> "收文"
|
||||
//TODO
|
||||
context.append(ArchivesUtil.getAssociatedPersons(requestid,true)).append("|"); // 28 相关人员 -> 参与人员
|
||||
context.append("智慧OA").append("|"); // 29 数据来源 -> 数据来源
|
||||
context.append(year).append("|"); // 30 形成年度 -> 年份
|
||||
context.append(String.join("&&", zwFileName)).append("|"); // 31 正文名称
|
||||
context.append(String.join("&&", fjFileName)).append("|"); // 32 附件名称
|
||||
context.append(requestid).append("|"); // 33 主键
|
||||
context.append("").append("|"); // 34 关联主键
|
||||
context.append("").append("|"); // 35 被关联主键
|
||||
context.append(zipName);// 36 压缩包名称
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
log.error("getContextError:{}", e.getMessage());
|
||||
}
|
||||
|
||||
return context.toString();
|
||||
}
|
||||
|
||||
private String getAssociatedDepts(Map<String, String> requesData) {
|
||||
HashSet<String> records = new HashSet<>();
|
||||
records.addAll(Arrays.asList(Util.null2String(requesData.get("ngbm")).split(",")));
|
||||
records.addAll(Arrays.asList(Util.null2String(requesData.get("ffbm")).split(",")));
|
||||
records.addAll(Arrays.asList(Util.null2String(requesData.get("yffbm")).split(",")));
|
||||
records.addAll(Arrays.asList(Util.null2String(requesData.get("ffbmb")).split(",")));
|
||||
records.addAll(Arrays.asList(Util.null2String(requesData.get("zfbm")).split(",")));
|
||||
return String.join("&&", records);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,514 @@
|
||||
package com.engine.custom.archives.service;
|
||||
|
||||
import cn.hutool.core.util.ZipUtil;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.dcfs.fts.common.error.FtpException;
|
||||
import com.engine.custom.archives.entity.PushArchivesBean;
|
||||
import com.engine.custom.archives.util.ArchivesUtil;
|
||||
import com.engine.custom.hg.util.HgUtils;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import weaver.conn.RecordSet;
|
||||
import weaver.file.ImageFileManager;
|
||||
import weaver.general.StringUtil;
|
||||
import weaver.general.Util;
|
||||
import weaver.hrm.User;
|
||||
import weaver.hrm.authority.manager.HrmDepartmentManager;
|
||||
import weaver.hrm.company.DepartmentComInfo;
|
||||
import weaver.soa.hrm.Department;
|
||||
import weaver.soa.workflow.request.RequestInfo;
|
||||
import weaver.soa.workflow.request.RequestService;
|
||||
|
||||
import java.io.*;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.LocalDate;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.*;
|
||||
|
||||
|
||||
public class SendingPushArchivesService {
|
||||
public static Logger log = LoggerFactory.getLogger("Archives");
|
||||
private static String filePath;
|
||||
private static String Url;
|
||||
private static String templatePath; // 模板文件路径
|
||||
private static final String zwdir = "正文";
|
||||
private static final String fjdir = "附件";
|
||||
private static final String cbddir = "承办单";
|
||||
private static final String zlcdir = "承办单" + File.separator + "子流程";
|
||||
private static final String lzxxdir = "流转信息";
|
||||
private static final String fjFile = "附件";
|
||||
private static final String fjWord = "附件";
|
||||
private static final String zwWord = "正文";
|
||||
private static final String lhgWord = "留痕稿";
|
||||
private static final String lcfjWord = "流程附件";
|
||||
private static final String qzyjfjWord = "签字意见附件";
|
||||
private static final String wjcldWord = "文件处理单";
|
||||
private static final String wjlzxxWord = "文件流转信息";
|
||||
|
||||
public void setProp(Map<String, String> param) {
|
||||
filePath = Util.null2String(param.get("filePath"));
|
||||
Url = Util.null2String(param.get("Url"));
|
||||
templatePath = Util.null2String(param.get("templatePath"));
|
||||
}
|
||||
|
||||
public void pushArchives(Map<String, String> param) {
|
||||
log.info("PushArchivesCorn====Begin========{}", param);
|
||||
Date date = ArchivesUtil.getDate();
|
||||
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMdd");
|
||||
String format = dateFormat.format(date);
|
||||
SimpleDateFormat yyyyMMddHHmmss = new SimpleDateFormat("yyyy-MM-dd HH:mm");
|
||||
// 获取当前时间的第一秒
|
||||
String firstSecond = yyyyMMddHHmmss.format(ArchivesUtil.getFirstSecondOfDate(date));
|
||||
// 获取当前时间的最后一秒
|
||||
String lastSecond = yyyyMMddHHmmss.format(ArchivesUtil.getLastSecondOfDate(date));
|
||||
RecordSet recordSet = new RecordSet();
|
||||
List<PushArchivesBean> result = ArchivesUtil.getResultList(recordSet, firstSecond, lastSecond, 0);
|
||||
log.error("推送发文的数量:{}", result.size());
|
||||
File file = ArchivesUtil.crFile(filePath + "/togd_" + new SimpleDateFormat("yyyyMMdd000000").format(date));
|
||||
log.error("textfile:{}", file.getAbsolutePath());
|
||||
for (PushArchivesBean pushArchivesBean : result) {
|
||||
int id = pushArchivesBean.getId();
|
||||
int request = pushArchivesBean.getRequest();
|
||||
log.error("推送的requestId:{}", request);
|
||||
try {
|
||||
String context = generateFile(request);
|
||||
ArchivesUtil.writeToTxt(file.getPath(), file.getName(), context, true);
|
||||
File txtzip = new File(filePath + File.separator + "togd_" + new SimpleDateFormat("yyyyMMdd000000").format(date) + ".zip");
|
||||
log.error("textZipFile:{}", txtzip.getAbsolutePath());
|
||||
OutputStream outputStream = new FileOutputStream(txtzip);
|
||||
File writename = new File(file.getPath() + "/" + file.getName() + ".txt");
|
||||
com.engine.custom.hg.util.ZipUtil.filesToZip(writename, outputStream, writename.getName());
|
||||
log.error("writename:{}", writename.getName());
|
||||
String s = HgUtils.putFile(txtzip.getAbsolutePath(), txtzip.getName());
|
||||
updateRecord(request, s);
|
||||
log.error("textZip:{}", s);
|
||||
} catch (FtpException e) {
|
||||
e.printStackTrace();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
private String generateFile(int requestid) throws FtpException, IOException {
|
||||
Map<String, String> requesData = getRequestByid(requestid);
|
||||
log.info("requesData:{}", requesData);
|
||||
String fj = Util.null2String(requesData.get("fj"));
|
||||
String dwd = Util.null2String(requesData.get("dwd"));
|
||||
String zw = Util.null2String(requesData.get("zw"));
|
||||
String qgqhj = Util.null2String(requesData.get("qgqhj"));
|
||||
String thhlh = Util.null2String(requesData.get("thhlh"));
|
||||
|
||||
|
||||
//增加签字意见中的附件到附件文件夹中
|
||||
Map<String, String> signFiles = ArchivesUtil.getSignFiles(requestid,false);
|
||||
List<String> docids = new ArrayList<>();
|
||||
// docids.addAll(Arrays.asList(fj.split(",")));
|
||||
// docids.addAll(Arrays.asList(zwkbj.split(",")));
|
||||
Map<String, String> fjMap = ArchivesUtil.getFileIdByDocId(fj);
|
||||
Map<String, String> dwdMap = ArchivesUtil.getFileIdByDocId(dwd);
|
||||
Map<String, String> zwMap = ArchivesUtil.getFileIdByDocId(zw);
|
||||
Map<String, String> qgqhjMap = ArchivesUtil.getFileIdByDocId(qgqhj);
|
||||
Map<String, String> thhlhMap = ArchivesUtil.getFileIdByDocId(thhlh);
|
||||
List<String> zwFileName = new ArrayList<>();
|
||||
List<String> fjFileName = new ArrayList<>();
|
||||
final int[] i = {1};
|
||||
//附件
|
||||
fjMap.forEach((docid, imageid) -> {
|
||||
ImageFileManager imageFileManager = new ImageFileManager();
|
||||
imageFileManager.getImageFileInfoById(Util.getIntValue(imageid));
|
||||
InputStream inputStream = imageFileManager.getInputStream();
|
||||
//中文路径/中文文件名
|
||||
String imageFileName = filePath + File.separator + requestid + File.separator + fjdir + File.separator + lcfjWord + "-" +imageFileManager.getImageFileName();
|
||||
fjFileName.add(imageFileManager.getImageFileName());
|
||||
log.info("生成附件路径:{}", imageFileName);
|
||||
imageFileName = ArchivesUtil.codeUtf8(imageFileName);
|
||||
try {
|
||||
File file = ArchivesUtil.saveInputStreamToFile(inputStream, imageFileName);
|
||||
String jsonStr = ArchivesUtil.callApi(Url, file);
|
||||
log.error("永中接口返回数据:{}", jsonStr);
|
||||
JSONObject result = JSONObject.parseObject(jsonStr);
|
||||
String errorcode = result.getString("errorcode");
|
||||
if ("0".equals(errorcode)) {
|
||||
JSONObject data = result.getJSONObject("data");
|
||||
String destFileName = data.getString("destFileName");
|
||||
String viewUrl = data.getString("viewUrl");
|
||||
ArchivesUtil.downloadFile(viewUrl, filePath + File.separator + requestid + File.separator + fjdir + File.separator + lcfjWord + "-" + imageFileManager.getImageFileName() + ".pdf");
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
});
|
||||
|
||||
//签字意见附件
|
||||
signFiles.forEach((docid, imageid) -> {
|
||||
ImageFileManager imageFileManager = new ImageFileManager();
|
||||
imageFileManager.getImageFileInfoById(Util.getIntValue(imageid));
|
||||
InputStream inputStream = imageFileManager.getInputStream();
|
||||
//中文路径/中文文件名
|
||||
String imageFileName = filePath + File.separator + requestid + File.separator + fjdir + File.separator + qzyjfjWord+ "-" +imageFileManager.getImageFileName();
|
||||
fjFileName.add(imageFileManager.getImageFileName());
|
||||
log.info("生成签字意见附件路径:{}", imageFileName);
|
||||
imageFileName = ArchivesUtil.codeUtf8(imageFileName);
|
||||
try {
|
||||
File file = ArchivesUtil.saveInputStreamToFile(inputStream, imageFileName);
|
||||
String jsonStr = ArchivesUtil.callApi(Url, file);
|
||||
log.error("永中接口返回数据:{}", jsonStr);
|
||||
JSONObject result = JSONObject.parseObject(jsonStr);
|
||||
String errorcode = result.getString("errorcode");
|
||||
if ("0".equals(errorcode)) {
|
||||
JSONObject data = result.getJSONObject("data");
|
||||
String destFileName = data.getString("destFileName");
|
||||
String viewUrl = data.getString("viewUrl");
|
||||
ArchivesUtil.downloadFile(viewUrl, filePath + File.separator + requestid + File.separator + fjdir + File.separator + qzyjfjWord+ "-" + imageFileManager.getImageFileName() + ".pdf");
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
});
|
||||
|
||||
//多文档
|
||||
// dwdMap.forEach((docid, imageid) -> {
|
||||
// ImageFileManager imageFileManager = new ImageFileManager();
|
||||
// imageFileManager.getImageFileInfoById(Util.getIntValue(imageid));
|
||||
// InputStream inputStream = imageFileManager.getInputStream();
|
||||
// zwFileName.add(imageFileManager.getImageFileName());
|
||||
// //中文路径/中文文件名
|
||||
// String imageFileName = filePath + File.separator + requestid + File.separator + zwdir + File.separator + fjWord + i[0] + "_" + zwWord + "_" + imageFileManager.getImageFileName();
|
||||
// log.info("生成多文档路径:{}", imageFileName);
|
||||
// imageFileName = ArchivesUtil.codeUtf8(imageFileName);
|
||||
// try {
|
||||
// File file = ArchivesUtil.saveInputStreamToFile(inputStream, imageFileName);
|
||||
// String jsonStr = ArchivesUtil.callApi(Url, file);
|
||||
// log.error("永中接口返回:{}", jsonStr);
|
||||
// JSONObject result = JSONObject.parseObject(jsonStr);
|
||||
// String errorcode = result.getString("errorcode");
|
||||
// if ("0".equals(errorcode)) {
|
||||
// JSONObject data = result.getJSONObject("data");
|
||||
// String destFileName = data.getString("destFileName");
|
||||
// String viewUrl = data.getString("viewUrl");
|
||||
// ArchivesUtil.downloadFile(viewUrl, filePath + File.separator + requestid + File.separator + zwdir + File.separator + fjWord + i[0] + "_" + zwWord + "_" + imageFileManager.getImageFileName() + ".pdf");
|
||||
// }
|
||||
// } catch (IOException e) {
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
// i[0]++;
|
||||
// });
|
||||
//正文
|
||||
zwMap.forEach((docid, imageid) -> {
|
||||
ImageFileManager imageFileManager = new ImageFileManager();
|
||||
imageFileManager.getImageFileInfoById(Util.getIntValue(imageid));
|
||||
InputStream inputStream = imageFileManager.getInputStream();
|
||||
|
||||
String newFile = fjWord + i[0] + "_" + zwWord + "-" + imageFileManager.getImageFileName();
|
||||
//中文路径/中文文件名
|
||||
String imageFileName = filePath + File.separator + requestid + File.separator + zwdir + File.separator + newFile;
|
||||
zwFileName.add(newFile);
|
||||
log.info("生成正文路径:{}", imageFileName);
|
||||
imageFileName = ArchivesUtil.codeUtf8(imageFileName);
|
||||
try {
|
||||
File file = ArchivesUtil.saveInputStreamToFile(inputStream, imageFileName);
|
||||
String jsonStr = ArchivesUtil.callApi(Url, file);
|
||||
log.error("永中接口返回:{}", jsonStr);
|
||||
JSONObject result = JSONObject.parseObject(jsonStr);
|
||||
String errorcode = result.getString("errorcode");
|
||||
if ("0".equals(errorcode)) {
|
||||
JSONObject data = result.getJSONObject("data");
|
||||
String destFileName = data.getString("destFileName");
|
||||
String viewUrl = data.getString("viewUrl");
|
||||
ArchivesUtil.downloadFile(viewUrl, filePath + File.separator + requestid + File.separator + zwdir + File.separator + newFile + ".pdf");
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
i[0]++;
|
||||
});
|
||||
//清稿前痕迹
|
||||
qgqhjMap.forEach((docid, imageid) -> {
|
||||
ImageFileManager imageFileManager = new ImageFileManager();
|
||||
imageFileManager.getImageFileInfoById(Util.getIntValue(imageid));
|
||||
InputStream inputStream = imageFileManager.getInputStream();
|
||||
|
||||
String newFile = fjWord + i[0] + "_" + lhgWord + "-" + imageFileManager.getImageFileName();
|
||||
zwFileName.add(newFile);
|
||||
//中文路径/中文文件名
|
||||
String imageFileName = filePath + File.separator + requestid + File.separator + zwdir + File.separator + newFile;
|
||||
log.info("生成清稿前痕迹路径:{}", imageFileName);
|
||||
imageFileName = ArchivesUtil.codeUtf8(imageFileName);
|
||||
try {
|
||||
File file = ArchivesUtil.saveInputStreamToFile(inputStream, imageFileName);
|
||||
String jsonStr = ArchivesUtil.callApi(Url, file);
|
||||
log.error("永中接口返回:{}", jsonStr);
|
||||
JSONObject result = JSONObject.parseObject(jsonStr);
|
||||
String errorcode = result.getString("errorcode");
|
||||
if ("0".equals(errorcode)) {
|
||||
JSONObject data = result.getJSONObject("data");
|
||||
String destFileName = data.getString("destFileName");
|
||||
String viewUrl = data.getString("viewUrl");
|
||||
ArchivesUtil.downloadFile(viewUrl, filePath + File.separator + requestid + File.separator + zwdir + File.separator + newFile + ".pdf");
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
i[0]++;
|
||||
});
|
||||
//套红后留痕
|
||||
// thhlhMap.forEach((docid, imageid) -> {
|
||||
// ImageFileManager imageFileManager = new ImageFileManager();
|
||||
// imageFileManager.getImageFileInfoById(Util.getIntValue(imageid));
|
||||
// InputStream inputStream = imageFileManager.getInputStream();
|
||||
// zwFileName.add(imageFileManager.getImageFileName());
|
||||
// //中文路径/中文文件名
|
||||
// String imageFileName = filePath + File.separator + requestid + File.separator + zwdir + File.separator + fjWord + i[0] + "_" + lhgWord + "_" + imageFileManager.getImageFileName();
|
||||
// log.info("生成套红后留痕路径:{}", imageFileName);
|
||||
// imageFileName = ArchivesUtil.codeUtf8(imageFileName);
|
||||
// try {
|
||||
// File file = ArchivesUtil.saveInputStreamToFile(inputStream, imageFileName);
|
||||
// String jsonStr = ArchivesUtil.callApi(Url, file);
|
||||
// log.error("永中接口返回:{}", jsonStr);
|
||||
// JSONObject result = JSONObject.parseObject(jsonStr);
|
||||
// String errorcode = result.getString("errorcode");
|
||||
// if ("0".equals(errorcode)) {
|
||||
// JSONObject data = result.getJSONObject("data");
|
||||
// String destFileName = data.getString("destFileName");
|
||||
// String viewUrl = data.getString("viewUrl");
|
||||
// ArchivesUtil.downloadFile(viewUrl, filePath + File.separator + requestid + File.separator + zwdir + File.separator + fjWord + i[0] + "_" + lhgWord + "_" + imageFileManager.getImageFileName() + ".pdf");
|
||||
// }
|
||||
// } catch (IOException e) {
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
// i[0]++;
|
||||
// });
|
||||
|
||||
//开始承办单 先获取主流程的承办单
|
||||
List<String> requestDocid = ArchivesUtil.generaRequestFormPdf(requestid, 0);
|
||||
// 1.去掉生成子流程承办单
|
||||
// List<String> subRequestDocid = generaSubRequestFormPdf(requestid);
|
||||
Map<String, String> reqDocMap = ArchivesUtil.getFileIdByDocId(String.join(",", requestDocid));
|
||||
// 2.去掉生成子流程承办单
|
||||
// Map<String, String> subReqDocMap = getFileIdByDocId(String.join(",", subRequestDocid));
|
||||
log.error("reqDocMap:{}", JSONObject.toJSONString(reqDocMap));
|
||||
//log.error("subReqDocMap:{}", JSONObject.toJSONString(subReqDocMap));
|
||||
docids.addAll(requestDocid);
|
||||
// 3.去掉生成子流程承办单
|
||||
// docids.addAll(subRequestDocid);
|
||||
i[0] = 1;
|
||||
//主流程承办单
|
||||
reqDocMap.forEach((docid, imageid) -> {
|
||||
ImageFileManager imageFileManager = new ImageFileManager();
|
||||
imageFileManager.getImageFileInfoById(Util.getIntValue(imageid));
|
||||
InputStream inputStream = imageFileManager.getInputStream();
|
||||
//中文路径/中文文件名
|
||||
// String imageFileName = filePath + File.separator + requestid + File.separator + cbddir + File.separator + fjFile + i[0] + "_" + imageFileManager.getImageFileName();
|
||||
String imageFileName = filePath + File.separator + requestid + File.separator + cbddir + File.separator + fjFile + i[0] + "_" + wjcldWord+".pdf";
|
||||
log.info("主流程承办单路径:{}", imageFileName);
|
||||
imageFileName = ArchivesUtil.codeUtf8(imageFileName);
|
||||
try {
|
||||
File file = ArchivesUtil.saveInputStreamToFile(inputStream, imageFileName);
|
||||
String jsonStr = ArchivesUtil.callApi(Url, file);
|
||||
log.error("永中接口返回:{}", jsonStr);
|
||||
JSONObject result = JSONObject.parseObject(jsonStr);
|
||||
String errorcode = result.getString("errorcode");
|
||||
if ("0".equals(errorcode)) {
|
||||
JSONObject data = result.getJSONObject("data");
|
||||
String destFileName = data.getString("destFileName");
|
||||
String viewUrl = data.getString("viewUrl");
|
||||
ArchivesUtil.downloadFile(viewUrl, filePath + File.separator + requestid + File.separator + cbddir + File.separator + fjFile + i[0] + "_" + wjcldWord + ".pdf" + ".pdf");
|
||||
}
|
||||
i[0]++;
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
});
|
||||
//正文
|
||||
|
||||
|
||||
log.error(JSONObject.toJSONString(requestDocid));
|
||||
for (String docid : docids) {
|
||||
log.error("删除了" + docid);
|
||||
ArchivesUtil.deleteDocByid(docid);
|
||||
}
|
||||
//--------------------------------------------------------------------
|
||||
RequestService requestService = new RequestService();
|
||||
RequestInfo requestInfo = requestService.getRequest(Util.getIntValue(requestid), 100);
|
||||
|
||||
String logFile = ArchivesUtil.getSignLog(requestid, cbddir + File.separator + lzxxdir, requestInfo.getCreatorid() + requestInfo.getDescription(), templatePath, filePath,false);
|
||||
String s = ArchivesUtil.callApi(Url, new File(logFile));
|
||||
log.error(s);
|
||||
JSONObject result = JSONObject.parseObject(s);
|
||||
String errorcode = result.getString("errorcode");
|
||||
if ("0".equals(errorcode)) {
|
||||
JSONObject data = result.getJSONObject("data");
|
||||
String destFileName = data.getString("destFileName");
|
||||
String viewUrl = data.getString("viewUrl");
|
||||
ArchivesUtil.downloadFile(viewUrl, logFile + ".pdf");
|
||||
}
|
||||
String zipName = filePath + File.separator + requestid + ".zip";
|
||||
ZipUtil.zip(filePath + File.separator + requestid, zipName);
|
||||
log.error("zipName:{}", zipName);
|
||||
String ftpFilePath = HgUtils.putFile(zipName, requestid + ".zip");
|
||||
log.error("ftpFilePath:{}", ftpFilePath);
|
||||
// String ftpFilePathNew = HgUtils.putFile(zipName, "test" + File.separator + requestid + ".zip");
|
||||
// log.error("ftpFilePathNew:{}", ftpFilePathNew);
|
||||
String context = getContext(requestid, requesData, requestid + ".zip", zwFileName, fjFileName);
|
||||
// insertRecord(requestid, context, ftpFilePath);
|
||||
log.error("context:{}", context);
|
||||
return context;
|
||||
}
|
||||
|
||||
|
||||
/***
|
||||
* 封装数据
|
||||
* @param requestid
|
||||
* @return
|
||||
*/
|
||||
public Map<String, String> getRequestByid(int requestid) {
|
||||
HashMap<String, String> record = new HashMap<>();
|
||||
String sql = "select * from formtable_main_11 where requestid = ?";
|
||||
String reqsql = "select REQUESTNAME from WORKFLOW_REQUESTBASE where REQUESTID = ?";
|
||||
RecordSet rs = new RecordSet();
|
||||
rs.executeQuery(sql, requestid);
|
||||
if (rs.next()) {
|
||||
record.put("fj", Util.null2String(rs.getString("fj")));
|
||||
record.put("dwd", Util.null2String(rs.getString("dwd")));
|
||||
record.put("zw", Util.null2String(rs.getString("zw")));
|
||||
record.put("ngrq", Util.null2String(rs.getString("ngrq")));
|
||||
record.put("jghwt", Util.null2String(rs.getString("jghwt")));
|
||||
record.put("bh", Util.null2String(rs.getString("bh")));
|
||||
record.put("ngbm", Util.null2String(rs.getString("ngbm")));
|
||||
record.put("bgqx", Util.null2String(rs.getString("bgqx")));
|
||||
record.put("cwrq", Util.null2String(rs.getString("cwrq")));
|
||||
record.put("ys", Util.null2String(rs.getString("ys")));
|
||||
record.put("wz", Util.null2String(rs.getString("wz")));
|
||||
record.put("ngbm", Util.null2String(rs.getString("ngbm")));
|
||||
record.put("lb", Util.null2String(rs.getString("lb")));
|
||||
record.put("bz", Util.null2String(rs.getString("bz")));
|
||||
record.put("yywh", Util.null2String(rs.getString("yywh")));
|
||||
record.put("wjlx", Util.null2String(rs.getString("wjlx")));
|
||||
record.put("fwlx", Util.null2String(rs.getString("fwlx")));
|
||||
record.put("f", Util.null2String(rs.getString("f")));
|
||||
record.put("ngr", Util.null2String(rs.getString("ngr")));
|
||||
record.put("qgqhj", Util.null2String(rs.getString("qgqhj")));
|
||||
record.put("thhlh", Util.null2String(rs.getString("thhlh")));
|
||||
|
||||
}
|
||||
rs.executeQuery(reqsql, requestid);
|
||||
if (rs.next()) {
|
||||
record.put("REQUESTNAME", Util.null2String(rs.getString("REQUESTNAME")));
|
||||
}
|
||||
return record;
|
||||
}
|
||||
|
||||
private String getContext(int requestid, Map<String, String> requesData, String zipName, List<String> zwFileName, List<String> fjFileName) {
|
||||
StringBuilder context = new StringBuilder();
|
||||
try {
|
||||
DepartmentComInfo departmentComInfo = new DepartmentComInfo();
|
||||
String ngrq = Util.null2String(requesData.get("ngrq")); //拟稿日期
|
||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
|
||||
LocalDate date = LocalDate.parse(ngrq, formatter);
|
||||
int year = date.getYear();
|
||||
context.append(year).append("|"); //1.年度 -> 拟稿日期
|
||||
String jghwt = Util.null2String(requesData.get("jghwt"));//2.机构或问题 -> 机构或问题
|
||||
context.append(jghwt).append("|");
|
||||
String bh = Util.null2String(requesData.get("bh"));// 3.文号 -> 编号
|
||||
context.append(bh).append("|");
|
||||
String requestname = Util.null2String(requesData.get("REQUESTNAME")); // 4.文件题名 -> 流程名称
|
||||
context.append(requestname).append("|");
|
||||
String ngbmName = Util.null2String(departmentComInfo.getDepartmentname(requesData.get("ngbm"))); //5 责任者 -> 拟稿部门
|
||||
context.append(ngbmName).append("|");
|
||||
String bgqx = Util.null2String(requesData.get("bgqx")); //6 保管期限 -> 保管期限
|
||||
context.append(bgqx).append("|");
|
||||
String cwrq = Util.null2String(requesData.get("cwrq")); //7 日期 -> 成文日期
|
||||
context.append(cwrq).append("|");
|
||||
String ys = Util.null2String(requesData.get("ys")); //8 页数 -> 页数
|
||||
context.append(ys).append("|");
|
||||
String wz = Util.null2String(requesData.get("wz")); //9 文种 -> 文种
|
||||
context.append(wz).append("|");
|
||||
String ngbm = Util.null2String(requesData.get("ngbm"));
|
||||
String[] deptData = ArchivesUtil.getDeptNameAndCode(ngbm);
|
||||
context.append(deptData[0]).append("|"); //10 行编号 -> 拟稿部门
|
||||
context.append(deptData[1]).append("|"); //11 行名称
|
||||
context.append("").append("|"); // 12 保管期限编号
|
||||
context.append("").append("|"); // 13 保管期限及编号
|
||||
context.append("").append("|"); // 14 是否开放
|
||||
context.append("").append("|"); // 15 互见号
|
||||
String lb = Util.null2String(requesData.get("lb"));
|
||||
context.append(lb).append("|"); //16 类别 -> 类别
|
||||
//TODO
|
||||
String xgbm = Util.null2String(getAssociatedDepts(requesData));
|
||||
context.append(xgbm).append("|"); //17 相关部门 -> 流经部门
|
||||
// String lwh = Util.null2String(requesData.get("lwh"));
|
||||
context.append("").append("|");// 18 收文号 -> 空
|
||||
String fs = "";
|
||||
context.append(fs).append("|"); // 19 份数 -> 份数
|
||||
String bz = Util.null2String(requesData.get("bz"));
|
||||
context.append("").append("|"); // 20 备注 -> 备注
|
||||
String yywh = Util.null2String(requesData.get("yywh"));
|
||||
context.append("").append("|"); // 21 引用文号 -> 引用文号
|
||||
String wjlx = Util.null2String(requesData.get("wjlx"));
|
||||
context.append("").append("|"); // 22 文件类型 -> 空
|
||||
String fwlx = Util.null2String(requesData.get("fwlx"));
|
||||
context.append("总行发文").append("|"); // 23 发文类型 -> 空
|
||||
String f = Util.null2String(requesData.get("f"));
|
||||
context.append(f).append("|"); // 24 发 -> 空
|
||||
String ngr = Util.null2String(requesData.get("ngr"));
|
||||
context.append(new User(Util.getIntValue(ngr)).getLoginid()).append("|"); // 25 拟稿人 -> 拟稿人
|
||||
context.append(ngbmName).append("|"); // 26 拟稿部门 -> 拟稿部门名称
|
||||
context.append("发文").append("|"); // 27 公文类型 -> "收文"
|
||||
//TODO
|
||||
context.append(ArchivesUtil.getAssociatedPersons(requestid,false)).append("|"); // 28 相关人员 -> 参与人员
|
||||
context.append("智慧OA").append("|"); // 29 数据来源 -> 数据来源
|
||||
context.append(year).append("|"); // 30 形成年度 -> 年份
|
||||
context.append(String.join("&&", zwFileName)).append("|"); // 31 正文名称
|
||||
context.append(String.join("&&", fjFileName)).append("|"); // 32 附件名称
|
||||
context.append(requestid).append("|"); // 33 主键
|
||||
context.append("").append("|"); // 34 关联主键
|
||||
context.append("").append("|"); // 35 被关联主键
|
||||
context.append(zipName);// 36 压缩包名称
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
log.error("getContextError:{}", e.getMessage());
|
||||
}
|
||||
|
||||
return context.toString();
|
||||
}
|
||||
|
||||
|
||||
private String getAssociatedDepts(Map<String, String> requesData) {
|
||||
HashSet<String> records = new HashSet<>();
|
||||
records.addAll(Arrays.asList(Util.null2String(requesData.get("hqbm")).split(","))); // 会签部门
|
||||
records.addAll(Arrays.asList(Util.null2String(requesData.get("ngbm")).split(","))); // 拟稿部门
|
||||
records.addAll(Arrays.asList(Util.null2String(requesData.get("bmyb")).split(","))); // 部门阅办
|
||||
records.addAll(Arrays.asList(Util.null2String(requesData.get("cs")).split(","))); // 抄送
|
||||
records.addAll(Arrays.asList(Util.null2String(requesData.get("nbfs")).split(","))); // 本行发送
|
||||
records.addAll(Arrays.asList(Util.null2String(requesData.get("zs")).split(","))); // 主送
|
||||
records.addAll(Arrays.asList(Util.null2String(requesData.get("dqbm")).split(","))); // 当前部门
|
||||
records.addAll(Arrays.asList(Util.null2String(requesData.get("cb")).split(","))); // 抄报
|
||||
records.addAll(Arrays.asList(Util.null2String(requesData.get("bmhqzj")).split(","))); // 部门会签(追加)
|
||||
records.addAll(Arrays.asList(Util.null2String(requesData.get("bmybzj")).split(","))); // 部门阅办(追加)
|
||||
ArrayList<String> deptName = new ArrayList<>();
|
||||
DepartmentComInfo departmentComInfo = new DepartmentComInfo();
|
||||
for (String record : records) {
|
||||
try {
|
||||
String departmentName = departmentComInfo.getDepartmentName(record);
|
||||
deptName.add(departmentName);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
return String.join("&&", deptName);
|
||||
}
|
||||
|
||||
private void updateRecord(int requestid, String s) {
|
||||
String sql = "update uf_pushArchivesLog set esbtxtml = ? where request = ?";
|
||||
RecordSet recordSet = new RecordSet();
|
||||
recordSet.executeUpdate(sql, s, requestid);
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,84 @@
|
||||
package com.engine.custom.archives.service;
|
||||
|
||||
import cn.hutool.core.util.ZipUtil;
|
||||
import com.dcfs.fts.common.error.FtpException;
|
||||
import com.engine.custom.archives.entity.PushArchivesBean;
|
||||
import com.engine.custom.archives.util.ArchivesUtil;
|
||||
import com.engine.custom.hg.util.HgUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import weaver.conn.RecordSet;
|
||||
import weaver.general.Util;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class SignReportPushArchivesService {
|
||||
public static Logger log = LoggerFactory.getLogger("Archives");
|
||||
private static String filePath;
|
||||
private static String Url;
|
||||
private static String templatePath; // 模板文件路径
|
||||
private static final String zwdir = "正文";
|
||||
private static final String fjdir = "附件";
|
||||
private static final String cbddir = "承办单";
|
||||
private static final String zlcdir = "承办单" + File.separator + "子流程";
|
||||
private static final String lzxxdir = "流转信息";
|
||||
private static final String fjFile = "附件";
|
||||
private static final String fjWord = "附件";
|
||||
private static final String zwWord = "正文";
|
||||
private static final String lhgWord = "留痕稿";
|
||||
private static final String lcfjWord = "流程附件";
|
||||
private static final String qzyjfjWord = "签字意见附件";
|
||||
private static final String wjcldWord = "文件处理单";
|
||||
private static final String wjlzxxWord = "文件流转信息";
|
||||
|
||||
public void setProp(Map<String, String> param) {
|
||||
filePath = Util.null2String(param.get("filePath"));
|
||||
Url = Util.null2String(param.get("Url"));
|
||||
templatePath = Util.null2String(param.get("templatePath"));
|
||||
}
|
||||
|
||||
public void pushArchives(Map<String, String> param) {
|
||||
Date date = ArchivesUtil.getDate();
|
||||
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMdd");
|
||||
String format = dateFormat.format(date);
|
||||
SimpleDateFormat yyyyMMddHHmmss = new SimpleDateFormat("yyyy-MM-dd HH:mm");
|
||||
// 获取当前时间的第一秒
|
||||
String firstSecond = yyyyMMddHHmmss.format(ArchivesUtil.getFirstSecondOfDate(date));
|
||||
// 获取当前时间的最后一秒
|
||||
String lastSecond = yyyyMMddHHmmss.format(ArchivesUtil.getLastSecondOfDate(date));
|
||||
RecordSet recordSet = new RecordSet();
|
||||
List<PushArchivesBean> result = ArchivesUtil.getResultList(recordSet, firstSecond, lastSecond, 0);
|
||||
log.error("推送发文的数量:{}", result.size());
|
||||
File file = ArchivesUtil.crFile(filePath + "/togd_" + new SimpleDateFormat("yyyyMMdd000000").format(date));
|
||||
log.error("textfile:{}", file.getAbsolutePath());
|
||||
for (PushArchivesBean pushArchivesBean : result) {
|
||||
int id = pushArchivesBean.getId();
|
||||
int request = pushArchivesBean.getRequest();
|
||||
log.error("推送的requestId:{}", request);
|
||||
try {
|
||||
// String context = generateFile(request);
|
||||
ArchivesUtil.writeToTxt(file.getPath(), file.getName(), context, true);
|
||||
File txtzip = new File(filePath + File.separator + "togd_" + new SimpleDateFormat("yyyyMMdd000000").format(date) + ".zip");
|
||||
log.error("textZipFile:{}", txtzip.getAbsolutePath());
|
||||
OutputStream outputStream = new FileOutputStream(txtzip);
|
||||
File writename = new File(file.getPath() + "/" + file.getName() + ".txt");
|
||||
com.engine.custom.hg.util.ZipUtil.filesToZip(writename, outputStream, writename.getName());
|
||||
log.error("writename:{}", writename.getName());
|
||||
String s = HgUtils.putFile(txtzip.getAbsolutePath(), txtzip.getName());
|
||||
// updateRecord(request, s);
|
||||
log.error("textZip:{}", s);
|
||||
} catch (FtpException e) {
|
||||
e.printStackTrace();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,47 @@
|
||||
<%@ page import="java.util.List" %>
|
||||
<%@ page import="java.util.ArrayList" %>
|
||||
<%@ page import="java.io.FileInputStream" %>
|
||||
<%@ page import="java.io.File" %>
|
||||
<%@ page import="org.apache.poi.ss.usermodel.Workbook" %>
|
||||
<%@ page import="org.apache.poi.xssf.usermodel.XSSFWorkbook" %>
|
||||
<%@ page import="org.apache.poi.ss.usermodel.Sheet" %>
|
||||
<%@ page import="org.apache.poi.ss.usermodel.Row" %>
|
||||
<%@ page import="java.util.Iterator" %>
|
||||
<%@ page import="weaver.conn.RecordSet" %>
|
||||
<%@ page import="com.engine.custom.archives.entity.Dept" %>
|
||||
<%@ page import="com.alibaba.fastjson.JSONObject" %>
|
||||
<%@ page import="weaver.soa.workflow.request.RequestService" %>
|
||||
<%@ page import="weaver.soa.workflow.request.RequestInfo" %>
|
||||
<%@ page import="weaver.general.Util" %>
|
||||
<%@ page import="com.engine.custom.archives.action.WorkflowToDocCus" %>
|
||||
<%@ page import="com.engine.custom.archives.util.ArchivesUtil" %>
|
||||
<%@ page import="com.alibaba.fastjson.JSON" %>
|
||||
|
||||
|
||||
<%
|
||||
|
||||
generaRequestFormPdf(895895,0);
|
||||
|
||||
%>
|
||||
|
||||
<%!
|
||||
/**
|
||||
* 生成主流程承办单
|
||||
*
|
||||
* @param requestid
|
||||
* 生成表单时的签字意见是否需要子流程的签字意见
|
||||
*
|
||||
*/
|
||||
public static List<String> generaRequestFormPdf(int requestid ,int reqType) {
|
||||
// log.error("generaRequestFormPdf,requestid:{}",requestid);
|
||||
RequestService requestService = new RequestService();
|
||||
RequestInfo requestInfo = requestService.getRequest(Util.getIntValue(requestid), 100);
|
||||
WorkflowToDocCus workflowToDoc = new WorkflowToDocCus();
|
||||
requestInfo.setLastoperator("1");
|
||||
requestInfo.setDescription(ArchivesUtil.getWfNameByid(requestInfo.getWorkflowid()) + "-" + requestInfo.getDescription());
|
||||
// log.error("generaRequestFormPdf,requestInfo:{}", JSON.toJSONString(requestInfo));
|
||||
return workflowToDoc.execute(requestInfo, reqType);
|
||||
}
|
||||
%>
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,25 @@
|
||||
<%@ page import="weaver.conn.RecordSet" %>
|
||||
<%@ page import="weaver.general.BaseBean" %>
|
||||
|
||||
<%@ page import="com.alibaba.fastjson.JSONObject" %>
|
||||
<%@ page import="com.alibaba.fastjson.JSONArray" %>
|
||||
<%@ page import="com.engine.common.util.ParamUtil" %>
|
||||
<%@ page import="java.util.Map" %>
|
||||
<%@ page import="com.weaverboot.weaComponent.impl.weaTable.table.impl.DefaultWeaTable" %>
|
||||
<%@ page import="com.weaverboot.tools.componentTools.table.WeaTableTools" %>
|
||||
<%@ page language="java" contentType="text/html; charset=UTF-8" %>
|
||||
|
||||
|
||||
<%!
|
||||
|
||||
%>
|
||||
<%
|
||||
|
||||
|
||||
Map<String, Object> param = ParamUtil.request2Map(request);
|
||||
String dataKey = (String) param.get("dataKey");
|
||||
DefaultWeaTable defaultWeaTable = WeaTableTools.checkTableStringConfig(dataKey, DefaultWeaTable.class);
|
||||
|
||||
|
||||
%>
|
||||
|
Loading…
Reference in New Issue