1.市场主体除名修复、行政复议、撤销等业务增加审批表文书

This commit is contained in:
cc_caijp 2026-01-14 19:00:26 +08:00
parent 034bcafa30
commit a215d601e3
8 changed files with 162 additions and 3 deletions

View File

@ -80,4 +80,12 @@ public interface TSAttachmentService extends BaseService<TSAttachment> {
IPage<AttachmentWritDto> selectWritsListzx(Page<AttachmentWritDto> page, AttachmentWritDto dto);
void getMaterial(HttpServletResponse response, String id, String bizSeqNo, String attachType) throws IOException;
/**
* 通过bizseq和attachtype获取文件信息
* @param bizseq
* @param attachtype
* @return
*/
TSAttachment getByBizseqAndType(String bizseq, String attachtype);
}

View File

@ -38,13 +38,14 @@ import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.*;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.Base64;
import java.util.List;
import java.util.Map;
import java.util.UUID;
@ -374,4 +375,9 @@ public class TSAttachmentServiceImpl extends BaseServiceImpl<TSAttachmentMapper,
throw new RuntimeException("无此上传材料");
}
}
@Override
public TSAttachment getByBizseqAndType(String bizseq, String attachtype) {
return getOne(new LambdaQueryWrapper<TSAttachment>().eq(TSAttachment::getBizseq, bizseq).eq(TSAttachment::getAttachtype, attachtype));
}
}

View File

@ -212,4 +212,11 @@ public class EntBaseExpelledInfoController extends BaseController {
IPage<ExpelledApplyInfo> data = expelledApplyInfoService.listRevokeAnnouncement(query);
return RestResult.ok(data);
}
@ApiOperation(value = "23.下载文书", position = 23)
@GetMapping("/downloadDoc")
@ResponseBody
public void downloadDoc(HttpServletResponse response, String bizId, String attachType) {
expelledApplyInfoService.downloadDoc(response, bizId, attachType);
}
}

View File

@ -12,6 +12,7 @@ import com.chinaweal.youfool.framework.springboot.base.query.BaseQuery;
import com.chinaweal.youfool.framework.springboot.rest.RestResult;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/**
* @Description: 市场主体除名申请业务表接口类
@ -79,4 +80,14 @@ public interface IExpelledApplyInfoService extends IService<ExpelledApplyInfo> {
* 分页查询撤销除名公告管理
*/
IPage<ExpelledApplyInfo> listRevokeAnnouncement(BaseQuery<ExpelledApplyInfo> query);
/**
* 生成审批表
*/
void createDoc(ExpelledApplyInfo applyInfo, TSTaskList tsTaskList);
/**
* 下载审批表
*/
void downloadDoc(HttpServletResponse response, String bizId, String attachType);
}

View File

@ -5,6 +5,8 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.chinaweal.aiccs.aiccs.abnormal.entity.TSAttachment;
import com.chinaweal.aiccs.aiccs.abnormal.service.TSAttachmentService;
import com.chinaweal.aiccs.aiccs.auditing.entity.TSOpinion;
import com.chinaweal.aiccs.aiccs.auditing.service.TSOpinionService;
import com.chinaweal.aiccs.aiccs.business.entity.TSTaskList;
@ -13,9 +15,11 @@ import com.chinaweal.aiccs.aiccs.business.rules.model.SequenceFlowModel;
import com.chinaweal.aiccs.aiccs.business.service.TSTaskListService;
import com.chinaweal.aiccs.aiccs.business.service.WorkFlowService;
import com.chinaweal.aiccs.aiccs.expelled.entity.ExpelledApplyInfo;
import com.chinaweal.aiccs.aiccs.expelled.entity.ExpelledAuditInfo;
import com.chinaweal.aiccs.aiccs.expelled.entity.ExpelledResultInfo;
import com.chinaweal.aiccs.aiccs.expelled.mapper.ExpelledApplyInfoMapper;
import com.chinaweal.aiccs.aiccs.expelled.service.IExpelledApplyInfoService;
import com.chinaweal.aiccs.aiccs.expelled.service.IExpelledAuditInfoService;
import com.chinaweal.aiccs.aiccs.expelled.service.IExpelledResultInfoService;
import com.chinaweal.aiccs.aiccs.expelled.vo.AuditInfoVo;
import com.chinaweal.aiccs.aiccs.expelled.vo.RemoveApproveInfo;
@ -25,18 +29,27 @@ import com.chinaweal.aiccs.common.constant.Constant;
import com.chinaweal.aiccs.common.util.FlowUtil;
import com.chinaweal.aiccs.common.util.HandleWorkFlowUtil;
import com.chinaweal.aiccs.common.util.WorkFlowUtil;
import com.chinaweal.aiccs.config.CommonConfig;
import com.chinaweal.aiccs.utils.BeanUtil;
import com.chinaweal.aicorg.model.AICUser;
import com.chinaweal.youfool.framework.springboot.base.query.BaseQuery;
import com.chinaweal.youfool.framework.springboot.exception.custom.BusinessException;
import com.chinaweal.youfool.framework.springboot.rest.RestResult;
import com.chinaweal.youfool.framework.springboot.rest.ResultCode;
import com.deepoove.poi.XWPFTemplate;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.File;
import java.io.FileInputStream;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.URLDecoder;
import java.nio.charset.StandardCharsets;
import java.time.LocalDate;
import java.util.HashMap;
import java.util.List;
@ -60,6 +73,10 @@ public class ExpelledApplyInfoServiceImpl extends ServiceImpl<ExpelledApplyInfoM
private TSOpinionService opinionService;
@Resource
private IExpelledResultInfoService expelledResultInfoService;
@Resource
private IExpelledAuditInfoService expelledAuditInfoService;
@Resource
private TSAttachmentService attachmentService;
@Override
public RestResult<?> startRepairBiz(AuditInfoVo query, HttpServletRequest request) {
@ -662,6 +679,8 @@ public class ExpelledApplyInfoServiceImpl extends ServiceImpl<ExpelledApplyInfoM
applyInfo.setState("93"); // 主动撤销完成
resultInfo.setState("93"); // 主动撤销完成
}
// 生成文书
createDoc(applyInfo, tsTaskList);
}
if (FlowUtil.EXPTLISTWORKFLOW_OVEREXPTLIST.equals(nextNodeId)) {
applyInfo.setApproveDate(now); // 核准时间
@ -694,4 +713,104 @@ public class ExpelledApplyInfoServiceImpl extends ServiceImpl<ExpelledApplyInfoM
.in(ExpelledApplyInfo::getState, "92", "93");
return page(page, wrapper);
}
@Override
public void createDoc(ExpelledApplyInfo applyInfo, TSTaskList tsTaskList) {
Map<String, Object> map = new HashMap<>();
map.put("orgName", applyInfo.getRemoveOrgName());
map.put("entName", applyInfo.getEntName());
map.put("uscc", applyInfo.getUscc());
map.put("lerepName", applyInfo.getLerepName());
map.put("address", applyInfo.getAddress());
ExpelledAuditInfo auditInfo = expelledAuditInfoService.getById(applyInfo.getAuditId());
if (auditInfo != null) {
map.put("docNo", auditInfo.getAuditNo());
}
map.put("approveDate", applyInfo.getApproveDate());
map.put("applyReason", applyInfo.getApplyReason());
// 获取历史审批意见
LambdaQueryWrapper<TSOpinion> opinionWrapper = new LambdaQueryWrapper<>();
opinionWrapper.eq(TSOpinion::getBizseq, applyInfo.getBizId())
.in(TSOpinion::getOpiniontype,"0", "1", "2")
.orderByAsc(TSOpinion::getHandledate);
List<TSOpinion> tsOpinions = opinionService.list(opinionWrapper);
for (TSOpinion item : tsOpinions) {
int index = Integer.parseInt(item.getOpiniontype()) + 1;
map.put("opinion" + index, item.getOpinioncontent());
map.put("handler" + index, item.getHandler());
map.put("year" + index, item.getHandledate().getYear());
map.put("month" + index, item.getHandledate().getMonthValue());
map.put("day" + index, item.getHandledate().getDayOfMonth());
}
try {
// 文书模板路径
String wordTemplatePath = "static" + File.separator + "template" + File.separator + "expelled" + File.separator + "repairDoc.docx";
if (StringUtils.equals("92", applyInfo.getState()) || StringUtils.equals("93", applyInfo.getState())) {
wordTemplatePath = "static" + File.separator + "template" + File.separator + "expelled" + File.separator + "revokeDoc.docx";
}
String resource = ExpelledApplyInfoServiceImpl.class.getClassLoader().getResource(wordTemplatePath).getPath();
// URL解码
resource = URLDecoder.decode(resource, "UTF-8");
String realPath = CommonConfig.getUploadPath();
realPath += File.separator + applyInfo.getBizId();
File dir = new File(realPath);
if (!dir.exists()) {
dir.mkdirs();
}
// 生成
String docName = UUID.randomUUID().toString();
XWPFTemplate.compile(resource).render(map).writeToFile(realPath + File.separator + docName + ".docx");
// 保存记录
String ext = ".docx";
String fileName = docName + ext;
String tempPath = applyInfo.getBizId() + File.separator + fileName;
TSAttachment tsAttachment = new TSAttachment();
tsAttachment.setCreatetype("1"); // 文件为系统生成
tsAttachment.setBizseq(applyInfo.getBizId());
tsAttachment.setFileext(ext);
tsAttachment.setFilename(fileName);
tsAttachment.setTemppath(tempPath);
tsAttachment.setAttachtype("1"); // 审批表
tsAttachment.setUploaddate(LocalDate.now());
attachmentService.save(tsAttachment);
} catch (Exception e) {
e.printStackTrace();
}
}
@Override
public void downloadDoc(HttpServletResponse response, String bizId, String attachType) {
TSAttachment tsAttachment = attachmentService.getByBizseqAndType(bizId, attachType);
if (tsAttachment == null) {
return;
}
// 获取流
InputStream is = null;
OutputStream os = null;
try {
// 获取文件
String realPath = CommonConfig.getUploadPathByDate(tsAttachment.getUploaddate()) + File.separator + tsAttachment.getTemppath();
is = new FileInputStream(realPath);
os = response.getOutputStream();
String fileName = new String(tsAttachment.getFilename().getBytes(StandardCharsets.UTF_8), StandardCharsets.ISO_8859_1);
// 设置:当浏览器收到这份资源的时候,以下载的方式提醒用户,而不是直接显示
response.setHeader("Content-Disposition", "attachment; filename=\"" + fileName + "\"");
byte[] buffer = new byte[4096];
int len;
while ((len = is.read(buffer)) != -1) {
os.write(buffer, 0, len);
}
} catch (Exception e) {
e.printStackTrace();
log.error("下载文书时发生异常:{}=", e);
return;
} finally {
try {
os.close();
is.close();
} catch (Exception e) {
e.printStackTrace();
}
}
}
}

View File

@ -65,6 +65,14 @@ public class CommonConfig {
return uploadDrive + uploadPath + datePath;
}
public static String getUploadPathByDate(LocalDate now) {
String dateStr = now.format(DateTimeFormatter.ofPattern("dd"));
String monthStr = now.format(DateTimeFormatter.ofPattern("MM"));
String yearStr = now.format(DateTimeFormatter.ofPattern("yyyy"));
String datePath = File.separator + yearStr + File.separator + monthStr + File.separator + dateStr;
return uploadDrive + uploadPath + datePath;
}
/**
* 获取涉嫌冒用上传目录
*

View File

@ -0,0 +1,38 @@
{{orgName}}除名修复审批表
市场主体名称
{{entName}}
统一社会信用代码
{{uscc}}
法定代表人(负责人、经营者)
{{lerepName}}
登记场所
或经营场所
{{address}}
除名决定书文号
{{docNo}}
除名决定日期
{{approveDate}}
除名修复理由
{{applyReason}}
经办人意见
{{opinion1}}
签名: {{handler1}}
{{year1}}年 {{month1}}月 {{day1}}日
经办机构
负责人意见
{{opinion2}}
签名: {{handler2}}
{{year2}}年 {{month2}}月 {{day2}}日
分管负责人意见
{{opinion3}}
签名:{{handler3}}
{{year3}}年 {{month3}}月 {{day3}}日

View File

@ -0,0 +1,38 @@
{{orgName}}除名撤销审批表
市场主体名称
{{entName}}
统一社会信用代码
{{uscc}}
法定代表人(负责人、经营者)
{{lerepName}}
登记场所
或经营场所
{{address}}
除名决定书文号
{{docNo}}
除名决定日期
{{approveDate}}
除名撤销理由
{{applyReason}}
经办人意见
{{opinion1}}
签名: {{handler1}}
{{year1}}年 {{month1}}月 {{day1}}日
经办机构
负责人意见
{{opinion2}}
签名: {{handler2}}
{{year2}}年 {{month2}}月 {{day2}}日
分管负责人意见
{{opinion3}}
签名:{{handler3}}
{{year3}}年 {{month3}}月 {{day3}}日