You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

557 lines
30 KiB
Java

1 year ago
package com.engine.custom.archives.service;
import cn.hutool.core.util.ZipUtil;
1 year ago
import com.alibaba.fastjson.JSONObject;
1 year ago
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;
1 year ago
import weaver.file.ImageFileManager;
1 year ago
import weaver.general.StringUtil;
1 year ago
import weaver.general.Util;
1 year ago
import weaver.hrm.User;
import weaver.hrm.company.DepartmentComInfo;
import weaver.soa.workflow.request.RequestInfo;
import weaver.soa.workflow.request.RequestService;
1 year ago
1 year ago
import java.io.*;
1 year ago
import java.text.SimpleDateFormat;
1 year ago
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.util.*;
1 year ago
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 = "文件流转信息";
1 year ago
private int endTime= 7;
1 year ago
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"));
1 year ago
endTime = Util.getIntValue(param.get("endTime"),7);
1 year ago
}
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();
1 year ago
//签报 type = 2
List<PushArchivesBean> result = ArchivesUtil.getResultList(recordSet, firstSecond, lastSecond, 2);
1 year ago
log.error("推送发文的数量:{}", result.size());
File file = ArchivesUtil.crFile(filePath + "/togd_" + new SimpleDateFormat("yyyyMMdd000000").format(date));
log.error("textfile:{}", file.getAbsolutePath());
for (PushArchivesBean pushArchivesBean : result) {
1 year ago
if (ArchivesUtil.isAfterSevenAM(endTime)){
log.info("超过执行时间:{}点暂停计划任务",endTime);
break;
}
1 year ago
int id = pushArchivesBean.getId();
int request = pushArchivesBean.getRequest();
log.error("推送的requestId:{}", request);
try {
1 year ago
String context = generateFile(request);
1 year ago
if ("-1".equals(context)){
continue;
}
1 year ago
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());
12 months ago
if(outputStream != null){
try {
outputStream.close();
} catch (IOException e) {
e.printStackTrace();
}
}
1 year ago
String s = HgUtils.putFile(txtzip.getAbsolutePath(), txtzip.getName());
// updateRecord(request, s);
1 year ago
updateRecord(request,"esbtxtml",s);
updateRecord(request,"zt","0");
1 year ago
log.error("textZip:{}", s);
} catch (FtpException e) {
1 year ago
log.error("推送档案requestid:{}异常,异常原因为:{}",request,e.getMessage());
1 year ago
e.printStackTrace();
} catch (IOException e) {
1 year ago
log.error("推送档案requestid:{}异常,异常原因为:{}",request,e.getMessage());
e.printStackTrace();
} catch (Exception e) {
log.error("推送档案requestid:{}异常,异常原因为:{}",request,e.getMessage());
1 year ago
e.printStackTrace();
}
}
}
1 year ago
private String generateFile(int requestid) throws FtpException, IOException {
Map<String, String> requesData = getRequestByid(requestid);
1 year ago
String newRequestid = "togd"+requestid;
1 year ago
log.info("requesData:{}", requesData);
1 year ago
String bhnew = requesData.get("bhnew");
log.info("流程id:{}:文号为空不推送", requestid);
if (StringUtil.isEmpty(bhnew)){
return "-1";
}
1 year ago
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"));
1 year ago
//可能有多个,获取id最大的一个
qgqhj = Util.null2String(ArchivesUtil.findMaxValue(qgqhj));
1 year ago
//增加签字意见中的附件到附件文件夹中
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> zwMap = ArchivesUtil.getFileIdByDocId(zw);
Map<String, String> qgqhjMap = ArchivesUtil.getFileIdByDocId(qgqhj);
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();
//中文路径/中文文件名
1 year ago
String imageFileName = filePath + File.separator + newRequestid + File.separator + fjdir + File.separator + lcfjWord + "-" +imageFileManager.getImageFileName();
1 year ago
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");
1 year ago
ArchivesUtil.downloadFile(viewUrl, filePath + File.separator + newRequestid + File.separator + fjdir + File.separator + lcfjWord + "-" + imageFileManager.getImageFileName() + ".pdf");
1 year ago
}
} catch (IOException e) {
e.printStackTrace();
1 year ago
} finally {
if(inputStream!=null) {
try {
inputStream.close();
} catch (IOException e) {
e.printStackTrace();
}
}
1 year ago
}
});
//签字意见附件
signFiles.forEach((docid, imageid) -> {
ImageFileManager imageFileManager = new ImageFileManager();
imageFileManager.getImageFileInfoById(Util.getIntValue(imageid));
InputStream inputStream = imageFileManager.getInputStream();
//中文路径/中文文件名
1 year ago
String imageFileName = filePath + File.separator + newRequestid + File.separator + fjdir + File.separator + qzyjfjWord+ "-" +imageFileManager.getImageFileName();
1 year ago
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");
1 year ago
ArchivesUtil.downloadFile(viewUrl, filePath + File.separator + newRequestid + File.separator + fjdir + File.separator + qzyjfjWord+ "-" + imageFileManager.getImageFileName() + ".pdf");
1 year ago
}
} catch (IOException e) {
e.printStackTrace();
1 year ago
} finally {
if(inputStream!=null) {
try {
inputStream.close();
} catch (IOException e) {
e.printStackTrace();
}
}
1 year ago
}
});
//正文
zwMap.forEach((docid, imageid) -> {
ImageFileManager imageFileManager = new ImageFileManager();
imageFileManager.getImageFileInfoById(Util.getIntValue(imageid));
InputStream inputStream = imageFileManager.getInputStream();
1 year ago
String newFile = fjWord + i[0] + "_" + zwWord + "-" + (imageFileManager.getImageFileName().replaceAll("/","-"));
1 year ago
//中文路径/中文文件名
1 year ago
String imageFileName = filePath + File.separator + newRequestid + File.separator + zwdir + File.separator + newFile;
1 year ago
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");
1 year ago
ArchivesUtil.downloadFile(viewUrl, filePath + File.separator + newRequestid + File.separator + zwdir + File.separator + newFile + ".pdf");
1 year ago
}
} catch (IOException e) {
e.printStackTrace();
1 year ago
} finally {
if(inputStream!=null) {
try {
inputStream.close();
} catch (IOException e) {
e.printStackTrace();
}
}
1 year ago
}
i[0]++;
});
//清稿前痕迹
qgqhjMap.forEach((docid, imageid) -> {
ImageFileManager imageFileManager = new ImageFileManager();
imageFileManager.getImageFileInfoById(Util.getIntValue(imageid));
InputStream inputStream = imageFileManager.getInputStream();
1 year ago
String newFile = fjWord + i[0] + "_" + lhgWord + "-" + (imageFileManager.getImageFileName().replaceAll("/","-"));
1 year ago
zwFileName.add(newFile);
//中文路径/中文文件名
1 year ago
String imageFileName = filePath + File.separator + newRequestid + File.separator + zwdir + File.separator + newFile;
1 year ago
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");
1 year ago
ArchivesUtil.downloadFile(viewUrl, filePath + File.separator + newRequestid + File.separator + zwdir + File.separator + newFile + ".pdf");
1 year ago
}
} catch (IOException e) {
e.printStackTrace();
1 year ago
} finally {
if(inputStream!=null) {
try {
inputStream.close();
} catch (IOException e) {
e.printStackTrace();
}
}
1 year ago
}
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, 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);
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();
1 year ago
// String imageFileName = filePath + File.separator + newRequestid + File.separator + cbddir + File.separator + fjFile + i[0] + "_" + wjcldWord+".pdf";
String imageFileName = filePath + File.separator + newRequestid + File.separator + cbddir + File.separator + wjcldWord+".pdf";
1 year ago
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");
1 year ago
// ArchivesUtil.downloadFile(viewUrl, filePath + File.separator + newRequestid + File.separator + cbddir + File.separator + fjFile + i[0] + "_" + wjcldWord + ".pdf" + ".pdf");
ArchivesUtil.downloadFile(viewUrl, filePath + File.separator + newRequestid + File.separator + cbddir + File.separator + wjcldWord + ".pdf" + ".pdf");
1 year ago
}
i[0]++;
} catch (IOException e) {
e.printStackTrace();
1 year ago
}finally {
if(inputStream!=null) {
try {
inputStream.close();
} catch (IOException e) {
e.printStackTrace();
}
}
1 year ago
}
});
//正文
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 workflowid = requestInfo.getWorkflowid();
String logFile = ArchivesUtil.getSignLog(requestid, cbddir + File.separator + lzxxdir, requestInfo.getCreatorid() + requestInfo.getDescription(), templatePath, filePath,true,workflowid);
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");
}
1 year ago
String zipName = filePath + File.separator + newRequestid + ".zip";
ZipUtil.zip(filePath + File.separator + newRequestid, zipName);
1 year ago
log.error("zipName:{}", zipName);
1 year ago
String ftpFilePath = HgUtils.putFile(zipName, newRequestid + ".zip");
1 year ago
log.error("ftpFilePath:{}", ftpFilePath);
1 year ago
updateRecord(requestid,"esbwjml",ftpFilePath);
ArchivesUtil.deleteDirectory(filePath + File.separator + newRequestid);
1 year ago
// String ftpFilePathNew = HgUtils.putFile(zipName, "test" + File.separator + requestid + ".zip");
// log.error("ftpFilePathNew:{}", ftpFilePathNew);
1 year ago
String context = getContext(requestid, requesData, newRequestid + ".zip", zwFileName, fjFileName);
1 year ago
// insertRecord(requestid, context, ftpFilePath);
1 year ago
updateRecord(requestid,"content",context);
1 year ago
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_20 where requestid = ?";
String reqsql = "select REQUESTNAME from WORKFLOW_REQUESTBASE where REQUESTID = ?";
RecordSet rs = new RecordSet();
rs.executeQuery(sql, requestid);
if (rs.next()) {
record.put("bh", Util.null2String(rs.getString("bh")));
1 year ago
record.put("bhnew", Util.null2String(rs.getString("bhnew")));
record.put("ngbm", Util.null2String(rs.getString("ngbm")));
1 year ago
record.put("ngr", Util.null2String(rs.getString("ngr")));
record.put("ngrq", Util.null2String(rs.getString("ngrq")));
record.put("lxfs", Util.null2String(rs.getString("lxfs")));
record.put("bt", Util.null2String(rs.getString("bt")));
record.put("zw", Util.null2String(rs.getString("zw")));
record.put("fj", Util.null2String(rs.getString("fj")));
record.put("hqbm", Util.null2String(rs.getString("hqbm")));
record.put("hqbmzhwy", Util.null2String(rs.getString("hqbmzhwy")));
record.put("hqdqbm", Util.null2String(rs.getString("hqdqbm")));
record.put("ffbm", Util.null2String(rs.getString("ffbm")));
record.put("hqbmzjhqbmzj", Util.null2String(rs.getString("hqbmzj")));
record.put("dwd", Util.null2String(rs.getString("dwd")));
record.put("bmffzj", Util.null2String(rs.getString("bmffzj")));
record.put("dqnf", Util.null2String(rs.getString("dqnf")));
record.put("qgqhj", Util.null2String(rs.getString("qgqhj")));
}
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("|");
1 year ago
String bh = Util.null2String(requesData.get("bhnew"));// 3.文号 -> 编号
1 year ago
context.append(bh).append("|");
String requestname = Util.null2String(requesData.get("REQUESTNAME")); // 4.文件题名 -> 流程名称
context.append(requestname).append("|");
12 months ago
String ngbmName = Util.null2String(departmentComInfo.getDepartmentmark(requesData.get("ngbm"))); //5 责任者 -> 拟稿部门
1 year ago
context.append(ngbmName).append("|");
String bgqx = Util.null2String(requesData.get("bgqx")); //6 保管期限 -> 保管期限
context.append(bgqx).append("|");
1 year ago
// String cwrq = Util.null2String(requesData.get("cwrq")); //7 日期 -> 成文日期
context.append(ngrq).append("|");
1 year ago
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);
1 year ago
String[] subData = ArchivesUtil.getSubCom(ngbm);
context.append("D10001").append("|"); //10 行编号 -> 拟稿部门
context.append("总行机关").append("|"); //11 行名称
1 year ago
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"));
1 year ago
context.append("总行签报").append("|"); // 23 发文类型 -> 空
1 year ago
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 拟稿部门 -> 拟稿部门名称
1 year ago
context.append("签报").append("|"); // 27 公文类型 -> "收文"
1 year ago
//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 附件名称
1 year ago
context.append("togd"+requestid).append("|"); // 33 主键
1 year ago
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("hqbm")).split(","))); // 拟稿部门
records.addAll(Arrays.asList(Util.null2String(requesData.get("ffbm")).split(","))); // 部门阅办
records.addAll(Arrays.asList(Util.null2String(requesData.get("hqbmzj")).split(","))); // 抄送
records.addAll(Arrays.asList(Util.null2String(requesData.get("bmffzj")).split(","))); // 本行发送
ArrayList<String> deptName = new ArrayList<>();
DepartmentComInfo departmentComInfo = new DepartmentComInfo();
for (String record : records) {
try {
1 year ago
if (StringUtil.isEmpty(record)){
continue;
}
String departmentName = departmentComInfo.getDepartmentmark(record);
1 year ago
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);
}
1 year ago
private void updateRecord(int requestid, String field , String fieldvalue) {
String sql = "update uf_pushArchivesLog set "+field+" = ? where request = ?";
RecordSet recordSet = new RecordSet();
recordSet.executeUpdate(sql, fieldvalue, requestid);
}
1 year ago
}