增加pdf文书生成

This commit is contained in:
黎润豪 2026-02-04 17:40:36 +08:00
parent 7bc71b5abf
commit 54ac166cdc
4 changed files with 475 additions and 319 deletions

View File

@ -7,6 +7,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.chinaweal.aiccs.aiccs.abnormal.entity.EBaseinfo;
import com.chinaweal.aiccs.aiccs.abnormal.entity.TSWrit;
import com.chinaweal.aiccs.aiccs.abnormal.service.EBaseinfoService;
import com.chinaweal.aiccs.aiccs.abnormal.service.IGzaiccodeService;
import com.chinaweal.aiccs.aiccs.abnormal.service.TSWritService;
import com.chinaweal.aiccs.aiccs.business.entity.XrTaskList;
import com.chinaweal.aiccs.aiccs.business.entity.vo.XrTaskListVo;
@ -25,6 +26,7 @@ import com.chinaweal.aiccs.aiccs.force.service.IXrForceDeregisterService;
import com.chinaweal.aiccs.aiccs.force.service.IXrForceDeregisterSpeService;
import com.chinaweal.aiccs.aiccs.force.service.IXrForceNoticeService;
import com.chinaweal.aiccs.aiccs.inspect.service.TSWorkNoService;
import com.chinaweal.aiccs.aiccs.revoke.service.CreateFileService;
import com.chinaweal.aiccs.aiccs.seriousillegalPerson.common.emnu.AuthEnum;
import com.chinaweal.aiccs.aiccs.system.entity.TRBaseCode;
import com.chinaweal.aiccs.aiccs.system.service.TRBaseCodeService;
@ -43,6 +45,7 @@ import com.chinaweal.youfool.framework.springboot.exception.custom.BusinessExcep
import com.chinaweal.youfool.framework.springboot.util.ExpiryMap;
import com.google.common.collect.Lists;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
@ -80,6 +83,10 @@ public class XrForceDeregisterSpeServiceImpl extends ServiceImpl<XrForceDeregist
private TSWritService tsWritService;
@Resource
private TSWorkNoService tsWorkNoService;
@Autowired
private CreateFileService createFileService;
@Autowired
private IGzaiccodeService gzaiccodeService;
private static final ExpiryMap<String, Collection<?>> EXPIRY_MAP = new ExpiryMap<>(15 * 60);
@ -587,6 +594,18 @@ public class XrForceDeregisterSpeServiceImpl extends ServiceImpl<XrForceDeregist
tsWritService.save(tsWritModel);
iXrForceDeregisterResService.saveOrUpdate(xrForceDeregisterRes);
iXrForceNoticeService.saveOrUpdate(xrForceNotice);
Map<String, Object> data = new HashMap<>();
String nameByCode = gzaiccodeService.getNameByCode(gzaiccodeService.getNameByCode(StringUtils.clearRegionZero(xrForceSpe.getRegOrg())));
data.put("areaName", StringUtils.trimToEmpty(nameByCode));
data.put("writNo", StringUtils.trimToEmpty(tsWritModel.getWritsno()));
data.put("writContent", StringUtils.trimToEmpty(replaceContent));
LocalDate now = LocalDate.now();
data.put("year", String.valueOf(now.getYear()));
data.put("month", String.valueOf(now.getMonthValue() > 9 ? now.getMonthValue() : "0" + now.getMonthValue()));
data.put("day", String.valueOf(now.getDayOfMonth() > 9 ? now.getDayOfMonth() : "0" + now.getDayOfMonth()));
// 2026年2月4日 生成pdf文书
createFileService.createPdfCommon(xrForceSpe.getBizSeqNo(), "决定书送达公告", "强制注销决定送达公告",
"force", ".pdf", "/static/template/commonWritTemplate.docx", data);
return xrForceSpe;
}

View File

@ -3,12 +3,11 @@ package com.chinaweal.aiccs.aiccs.revoke.service;
import com.chinaweal.aiccs.aiccs.revoke.entity.BizRevEnt;
import javax.servlet.ServletOutputStream;
import java.io.ByteArrayOutputStream;
import java.util.List;
import java.util.Map;
/**
* 批吊审批流程生成文件创建
* 批吊审批流程生成文件创建
*
* @Author Lee
* @Since 2021/5/17 18:02
@ -18,118 +17,134 @@ public interface CreateFileService {
/**
* 生成立案/不予立案审批表
*
* @param bizseq 业务号
* @param pripid 主体id
* @param areaName 区名称
* @param workflowId 工作流id
* @param bizseq 业务号
* @param pripid 主体id
* @param areaName 区名称
* @param workflowId 工作流id
*/
void createCaseApprovalDocx(String bizseq,String areaName, String pripid,String workflowId) throws Exception;
void createCaseApprovalDocx(String bizseq, String areaName, String pripid, String workflowId) throws Exception;
/**
* 生成听证告知审批表
* 生成听证告知审批表
*
* @param bizseq 业务号
* @param workflowId 流程id
* @param bizseq 业务号
* @param workflowId 流程id
*/
void createHearingApprovalDocx(String bizseq,String entname,String workflowId);
void createHearingApprovalDocx(String bizseq, String entname, String workflowId);
/**
* 生成行政处罚建议审批表
* 生成行政处罚建议审批表
*
* @param bizseq 业务号
* @param workflowId 流程id
* @param bizseq 业务号
* @param workflowId 流程id
*/
void createPunishAdviceApprDocx(String bizseq, String areaName,String workflowId)throws Exception;
void createPunishAdviceApprDocx(String bizseq, String areaName, String workflowId) throws Exception;
/**
* 生成行政处罚决定审批表
* 生成行政处罚决定审批表
*
* @param bizseq 业务号
* @param workflowId 流程id
* @param bizseq 业务号
* @param workflowId 流程id
*/
void createPunishDecisionApprDocx(String bizseq, String areaName,String workflowId)throws Exception;
void createPunishDecisionApprDocx(String bizseq, String areaName, String workflowId) throws Exception;
/**
* 生成决定审批表
* 生成决定审批表
*
* @param bizseq 业务号
* @param workflowId 流程id
* @param bizseq 业务号
* @param workflowId 流程id
*/
void createDecisionApprovalDocx(String bizseq,String entname,String workflowId);
void createDecisionApprovalDocx(String bizseq, String entname, String workflowId);
/**
* 生成送达审批表
* 生成送达审批表
*
* @param bizseq 业务号
* @param workflowId 流程id
* @param bizseq 业务号
* @param workflowId 流程id
*/
void createSendApprovalDocx(String bizseq,String workflowId);
void createSendApprovalDocx(String bizseq, String workflowId);
/**
* 生成调查审批表
* 生成调查审批表
*
* @param bizseq 业务号
* @param workflowId 流程id
* @param areaName 区名称
* @param entname 主体名称
* @param bizseq 业务号
* @param workflowId 流程id
* @param areaName 区名称
* @param entname 主体名称
*/
void createInvestigateApprovalDocx(String bizseq,String areaName, String entname,String workflowId);
void createInvestigateApprovalDocx(String bizseq, String areaName, String entname, String workflowId);
/**
* 根据模板生成文件
* 根据模板生成文件
*
* @param bizseq 业务号-作文件夹
* @param fileName 文件名
* @param attachtype 文书类型
* @param path 模板文件路径
* @param map 模板参数
* @param bizseq 业务号-作文件夹
* @param fileName 文件名
* @param attachtype 文书类型
* @param path 模板文件路径
* @param map 模板参数
*/
String createDocx(String bizseq,String fileName,String attachtype, String path, Map<String,Object> map);
String createDocx(String bizseq, String fileName, String attachtype, String path, Map<String, Object> map);
/**
* 根据模板生成pdf文件
* 根据模板生成pdf文件
*
* @param bizseq 业务号-作文件夹
* @param fileName 文件名
* @param attachtype 文书类型
* @param path 模板文件路径
* @param map 模板参数
* @param bizseq 业务号-作文件夹
* @param fileName 文件名
* @param attachtype 文书类型
* @param path 模板文件路径
* @param map 模板参数
*/
String createPdf(String bizseq,String fileName,String attachtype, String path, Map<String,Object> map);
String createPdf(String bizseq, String fileName, String attachtype, String path, Map<String, Object> map);
;
/**
* 根据模板生成pdf文件
* @param bizseq 业务号-作文件夹
* @param fileName 文件名
* @param attachtype 文书类型
* @param path 模板文件路径
* @param map 模板参数
* 根据模板生成pdf文件
*
* @param bizseq 业务号-作文件夹
* @param title 标题
* @param fileName 文件名
* @param moduleType 业务模块类型
* @param attachtype 文书类型
* @param templatePath 模版路径
* @param data 渲染数据
*/
String createPdfCommon(String bizseq, String title, String fileName, String moduleType, String attachtype, String templatePath, Map<String, Object> data);
/**
* 根据模板生成pdf文件
*
* @param bizseq 业务号-作文件夹
* @param fileName 文件名
* @param attachtype 文书类型
* @param path 模板文件路径
* @param map 模板参数
* @param os
*/
ServletOutputStream createPdfStream(String bizseq, String fileName, String attachtype, String path, Map<String,Object> map, ServletOutputStream os);
ServletOutputStream createPdfStream(String bizseq, String fileName, String attachtype, String path, Map<String, Object> map, ServletOutputStream os);
/**
* 根据模板生成文件 对象参数
* 根据模板生成文件 对象参数
*
* @param bizseq 业务号-作文件夹
* @param fileName 文件名
* @param attachtype 文书类型
* @param path 模板文件路径
* @param map 模板数据集合
* @param bizseq 业务号-作文件夹
* @param fileName 文件名
* @param attachtype 文书类型
* @param path 模板文件路径
* @param map 模板数据集合
*/
void createDocxWithModel(String bizseq,String fileName,String attachtype, String path, Map<String,Object> map);
void createDocxWithModel(String bizseq, String fileName, String attachtype, String path, Map<String, Object> map);
/**
* 根据模板生成案件终结调查报告文件
* 根据模板生成案件终结调查报告文件
*
* @param bizseq 业务号-作文件夹
* @param fileName 文件名
* @param attachtype 文书类型
* @param path 模板文件路径
* @param map 模板数据集合
* @param bizseq 业务号-作文件夹
* @param fileName 文件名
* @param attachtype 文书类型
* @param path 模板文件路径
* @param map 模板数据集合
*/
void createCasePdfWithModel(String bizseq,String fileName,String attachtype, String path, Map<String,Object> map);
void createCasePdfWithModel(String bizseq, String fileName, String attachtype, String path, Map<String, Object> map);
// /**
// * 根据指定列生成主体Excel清单
@ -138,10 +153,11 @@ public interface CreateFileService {
// String createEntExcel(String bizseq,String attachtype,List<String> pripids);
/**
* 根据指定列生成主体Excel清单
* 根据指定列生成主体Excel清单
*
* @param bizRevEnts
*/
String createEntExcel(String bizseq,String attachtype,List<BizRevEnt> bizRevEnts);
String createEntExcel(String bizseq, String attachtype, List<BizRevEnt> bizRevEnts);
String createPdfZx(String bizseq, String fileName, String number, String path, Map<String, Object> map);
}

View File

@ -232,4 +232,54 @@ public abstract class StringUtils extends org.apache.commons.lang3.StringUtils {
public static String getUUID() {
return UUID.randomUUID().toString().replace("-", "");
}
/**
* 清除行政区划尾端的0
*
* @param regionCode 行政区划
* @return 清除后的0
* @author lroyia
* @since 2023年7月3日 14:02:52
*/
public static String clearRegionZero(String regionCode) {
if (isBlank(regionCode)) {
return EMPTY;
}
int maxLength = regionCode.length() / 2 > 3 ? 4 : (regionCode.length() / 2);
for (int i = maxLength; i > 0; i--) {
int startIndex = (i - 1) * 2;
int endIndex = i == 4 ? 9 : (i * 2);
if (clearSuffixZero(regionCode.substring(startIndex, endIndex)).isEmpty()) {
continue;
}
return regionCode.substring(0, endIndex);
}
return EMPTY;
}
/**
* 清除字符串尾部的0
*
* @param str 字符串
* @return 清除结果
* @author lroyia
* @since 2023年3月1日 09:22:43
*/
public static String clearSuffixZero(String str) {
if (isBlank(str)) {
return str;
}
int index = -1;
for (int i = str.length() - 1; i > -1; i--) {
if (str.charAt(i) != '0') {
break;
}
index = i;
}
if (index > -1) {
str = str.substring(0, index);
}
return str;
}
}