|
|
@ -1,23 +1,83 @@
|
|
|
|
package cn.iocoder.yudao.module.archives.service.turnover;
|
|
|
|
package cn.iocoder.yudao.module.archives.service.turnover;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import cn.hutool.core.io.FileUtil;
|
|
|
|
|
|
|
|
import cn.hutool.core.io.IoUtil;
|
|
|
|
|
|
|
|
import cn.hutool.core.util.CharsetUtil;
|
|
|
|
|
|
|
|
import cn.hutool.core.util.ZipUtil;
|
|
|
|
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
|
|
|
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
|
|
|
import cn.iocoder.yudao.framework.security.core.LoginUser;
|
|
|
|
import cn.iocoder.yudao.framework.security.core.LoginUser;
|
|
|
|
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
|
|
|
|
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
|
|
|
|
|
|
|
|
import cn.iocoder.yudao.module.accounting.controller.admin.accountingbook.vo.AccountingBookExportReqVO;
|
|
|
|
|
|
|
|
import cn.iocoder.yudao.module.accounting.controller.admin.accountingreport.vo.AccountingReportExportReqVO;
|
|
|
|
|
|
|
|
import cn.iocoder.yudao.module.accounting.controller.admin.attachment.vo.AttachmentExportReqVO;
|
|
|
|
|
|
|
|
import cn.iocoder.yudao.module.accounting.controller.admin.bankslip.vo.BankSlipExportReqVO;
|
|
|
|
|
|
|
|
import cn.iocoder.yudao.module.accounting.controller.admin.flow.vo.FlowExportReqVO;
|
|
|
|
|
|
|
|
import cn.iocoder.yudao.module.accounting.controller.admin.invoices.vo.InvoicesExportReqVO;
|
|
|
|
|
|
|
|
import cn.iocoder.yudao.module.accounting.controller.admin.other.vo.OtherExportReqVO;
|
|
|
|
|
|
|
|
import cn.iocoder.yudao.module.accounting.controller.admin.voucher.vo.VoucherExportReqVO;
|
|
|
|
|
|
|
|
import cn.iocoder.yudao.module.accounting.dal.dataobject.accountingbook.AccountingBookDO;
|
|
|
|
|
|
|
|
import cn.iocoder.yudao.module.accounting.dal.dataobject.accountingreport.AccountingReportDO;
|
|
|
|
|
|
|
|
import cn.iocoder.yudao.module.accounting.dal.dataobject.attachment.AttachmentDO;
|
|
|
|
|
|
|
|
import cn.iocoder.yudao.module.accounting.dal.dataobject.bankslip.BankSlipDO;
|
|
|
|
|
|
|
|
import cn.iocoder.yudao.module.accounting.dal.dataobject.flow.FlowDO;
|
|
|
|
|
|
|
|
import cn.iocoder.yudao.module.accounting.dal.dataobject.invoices.InvoicesDO;
|
|
|
|
|
|
|
|
import cn.iocoder.yudao.module.accounting.dal.dataobject.other.OtherDO;
|
|
|
|
|
|
|
|
import cn.iocoder.yudao.module.accounting.dal.dataobject.voucher.VoucherDO;
|
|
|
|
|
|
|
|
import cn.iocoder.yudao.module.accounting.dal.mysql.accountingbook.AccountingBookMapper;
|
|
|
|
|
|
|
|
import cn.iocoder.yudao.module.accounting.dal.mysql.accountingreport.AccountingReportMapper;
|
|
|
|
|
|
|
|
import cn.iocoder.yudao.module.accounting.dal.mysql.other.OtherMapper;
|
|
|
|
|
|
|
|
import cn.iocoder.yudao.module.accounting.dal.mysql.voucher.VoucherMapper;
|
|
|
|
|
|
|
|
import cn.iocoder.yudao.module.accounting.service.attachment.AttachmentService;
|
|
|
|
|
|
|
|
import cn.iocoder.yudao.module.accounting.service.bankslip.BankSlipService;
|
|
|
|
|
|
|
|
import cn.iocoder.yudao.module.accounting.service.flow.FlowService;
|
|
|
|
|
|
|
|
import cn.iocoder.yudao.module.accounting.service.invoices.InvoicesService;
|
|
|
|
|
|
|
|
import cn.iocoder.yudao.module.archives.dal.dataobject.authenticate.AuthenticateDO;
|
|
|
|
|
|
|
|
import cn.iocoder.yudao.module.archives.dal.dataobject.record.RecordDO;
|
|
|
|
|
|
|
|
import cn.iocoder.yudao.module.archives.dal.mysql.authenticate.AuthenticateMapper;
|
|
|
|
|
|
|
|
import cn.iocoder.yudao.module.archives.dal.mysql.record.RecordMapper;
|
|
|
|
import cn.iocoder.yudao.module.archives.enums.ArchivesStatusEnum;
|
|
|
|
import cn.iocoder.yudao.module.archives.enums.ArchivesStatusEnum;
|
|
|
|
|
|
|
|
import cn.iocoder.yudao.module.archives.enums.ArchivesTypeEnum;
|
|
|
|
import cn.iocoder.yudao.module.archives.enums.BillTypeEnum;
|
|
|
|
import cn.iocoder.yudao.module.archives.enums.BillTypeEnum;
|
|
|
|
import cn.iocoder.yudao.module.bpm.api.task.BpmProcessInstanceApi;
|
|
|
|
import cn.iocoder.yudao.module.bpm.api.task.BpmProcessInstanceApi;
|
|
|
|
import cn.iocoder.yudao.module.bpm.api.task.dto.BpmProcessInstanceCreateReqDTO;
|
|
|
|
import cn.iocoder.yudao.module.bpm.api.task.dto.BpmProcessInstanceCreateReqDTO;
|
|
|
|
import cn.iocoder.yudao.module.bpm.enums.task.BpmProcessInstanceResultEnum;
|
|
|
|
import cn.iocoder.yudao.module.bpm.enums.task.BpmProcessInstanceResultEnum;
|
|
|
|
|
|
|
|
import cn.iocoder.yudao.module.ea.controller.admin.electronicassets.vo.ElectronicAssetsExportReqVO;
|
|
|
|
|
|
|
|
import cn.iocoder.yudao.module.ea.controller.admin.electronicconsultation.vo.ElectronicConsultationExportReqVO;
|
|
|
|
|
|
|
|
import cn.iocoder.yudao.module.ea.controller.admin.electroniccontracts.vo.ElectronicContractsExportReqVO;
|
|
|
|
|
|
|
|
import cn.iocoder.yudao.module.ea.controller.admin.electroniccustomercomplaint.vo.ElectronicCustomerComplaintExportReqVO;
|
|
|
|
|
|
|
|
import cn.iocoder.yudao.module.ea.controller.admin.electronicemployee.vo.ElectronicEmployeeExportReqVO;
|
|
|
|
|
|
|
|
import cn.iocoder.yudao.module.ea.dal.dataobject.electronicassets.ElectronicAssetsDO;
|
|
|
|
|
|
|
|
import cn.iocoder.yudao.module.ea.dal.dataobject.electronicconsultation.ElectronicConsultationDO;
|
|
|
|
|
|
|
|
import cn.iocoder.yudao.module.ea.dal.dataobject.electroniccontracts.ElectronicContractsDO;
|
|
|
|
|
|
|
|
import cn.iocoder.yudao.module.ea.dal.dataobject.electroniccustomercomplaint.ElectronicCustomerComplaintDO;
|
|
|
|
|
|
|
|
import cn.iocoder.yudao.module.ea.dal.dataobject.electronicemployee.ElectronicEmployeeDO;
|
|
|
|
|
|
|
|
import cn.iocoder.yudao.module.ea.dal.mysql.electronicassets.ElectronicAssetsMapper;
|
|
|
|
|
|
|
|
import cn.iocoder.yudao.module.ea.dal.mysql.electronicconsultation.ElectronicConsultationMapper;
|
|
|
|
|
|
|
|
import cn.iocoder.yudao.module.ea.dal.mysql.electroniccontracts.ElectronicContractsMapper;
|
|
|
|
|
|
|
|
import cn.iocoder.yudao.module.ea.dal.mysql.electroniccustomercomplaint.ElectronicCustomerComplaintMapper;
|
|
|
|
|
|
|
|
import cn.iocoder.yudao.module.ea.dal.mysql.electronicemployee.ElectronicEmployeeMapper;
|
|
|
|
|
|
|
|
import cn.iocoder.yudao.module.infra.controller.admin.file.vo.file.FilePageReqVO;
|
|
|
|
|
|
|
|
import cn.iocoder.yudao.module.infra.dal.dataobject.file.FileDO;
|
|
|
|
|
|
|
|
import cn.iocoder.yudao.module.infra.service.file.FileService;
|
|
|
|
|
|
|
|
import cn.iocoder.yudao.module.setting.tools.JsonToXml;
|
|
|
|
import cn.iocoder.yudao.module.system.api.dept.DeptApi;
|
|
|
|
import cn.iocoder.yudao.module.system.api.dept.DeptApi;
|
|
|
|
import cn.iocoder.yudao.module.system.api.user.AdminUserApi;
|
|
|
|
import cn.iocoder.yudao.module.system.api.user.AdminUserApi;
|
|
|
|
|
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
|
import com.github.yulichang.base.MPJBaseServiceImpl;
|
|
|
|
import com.github.yulichang.base.MPJBaseServiceImpl;
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
import javax.validation.Validator;
|
|
|
|
import javax.validation.Validator;
|
|
|
|
|
|
|
|
|
|
|
|
import org.springframework.validation.annotation.Validated;
|
|
|
|
import org.springframework.validation.annotation.Validated;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import java.io.*;
|
|
|
|
|
|
|
|
import java.net.URL;
|
|
|
|
|
|
|
|
import java.net.URLConnection;
|
|
|
|
|
|
|
|
import java.nio.charset.StandardCharsets;
|
|
|
|
|
|
|
|
import java.nio.file.Files;
|
|
|
|
import java.util.*;
|
|
|
|
import java.util.*;
|
|
|
|
|
|
|
|
|
|
|
|
import cn.iocoder.yudao.module.archives.controller.admin.turnover.vo.*;
|
|
|
|
import cn.iocoder.yudao.module.archives.controller.admin.turnover.vo.*;
|
|
|
|
import cn.iocoder.yudao.module.archives.dal.dataobject.turnover.TurnOverDO;
|
|
|
|
import cn.iocoder.yudao.module.archives.dal.dataobject.turnover.TurnOverDO;
|
|
|
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
|
|
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
|
|
@ -41,27 +101,331 @@ public class TurnOverServiceImpl extends MPJBaseServiceImpl<TurnOverMapper, Turn
|
|
|
|
@Resource
|
|
|
|
@Resource
|
|
|
|
private TurnOverMapper turnOverMapper;
|
|
|
|
private TurnOverMapper turnOverMapper;
|
|
|
|
@Resource
|
|
|
|
@Resource
|
|
|
|
private Validator validator;
|
|
|
|
private AuthenticateMapper authenticateMapper;
|
|
|
|
@Resource
|
|
|
|
|
|
|
|
private AdminUserApi adminUserApi;
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
@Resource
|
|
|
|
private DeptApi deptApi;
|
|
|
|
private RecordMapper recordMapper;
|
|
|
|
@Resource
|
|
|
|
@Resource
|
|
|
|
private BpmProcessInstanceApi processInstanceApi;
|
|
|
|
private BpmProcessInstanceApi processInstanceApi;
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
|
|
|
private FileService fileService;
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
|
|
|
private VoucherMapper voucherMapper;
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
|
|
|
private AccountingBookMapper accountingBookMapper;
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
|
|
|
private OtherMapper otherMapper;
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
|
|
|
private AccountingReportMapper accountingReportMapper;
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
|
|
|
private ElectronicAssetsMapper electronicAssetsMapper;
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
|
|
|
private ElectronicContractsMapper electronicContractsMapper;
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
|
|
|
private ElectronicConsultationMapper electronicConsultationMapper;
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
|
|
|
private ElectronicEmployeeMapper electronicEmployeeMapper;
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
|
|
|
private ElectronicCustomerComplaintMapper electronicCustomerComplaintMapper;
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
|
|
|
private AttachmentService attachmentService;
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
|
|
|
private BankSlipService bankSlipService;
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
|
|
|
private InvoicesService invoicesService;
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
|
|
|
private FlowService flowService;
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public CommonResult createTurnOver(TurnOverCreateReqVO createReqVO) {
|
|
|
|
public CommonResult createTurnOver(TurnOverCreateReqVO createReqVO) throws IOException {
|
|
|
|
|
|
|
|
//查找档案相关文件记录
|
|
|
|
|
|
|
|
AuthenticateDO authenticateDO = authenticateMapper.selectById(createReqVO.getAuthRecordId());
|
|
|
|
// 插入
|
|
|
|
// 插入
|
|
|
|
TurnOverDO turnOver = TurnOverConvert.INSTANCE.convert(createReqVO);
|
|
|
|
TurnOverDO turnOver = TurnOverConvert.INSTANCE.convert(createReqVO);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (authenticateDO != null) {
|
|
|
|
|
|
|
|
Long recordId = Long.valueOf(authenticateDO.getRecordId());
|
|
|
|
|
|
|
|
RecordDO recordDO = recordMapper.selectById(recordId);
|
|
|
|
|
|
|
|
turnOver.setCompany(recordDO.getCompany());
|
|
|
|
|
|
|
|
turnOver.setCompanyId(recordDO.getCompanyId());
|
|
|
|
|
|
|
|
// 创建存放文件夹
|
|
|
|
|
|
|
|
String folderPath = "/temp" + UUID.randomUUID();
|
|
|
|
|
|
|
|
//最后打包文件夹
|
|
|
|
|
|
|
|
String zipFolderStr = "/zip";
|
|
|
|
|
|
|
|
//全宗文件夹
|
|
|
|
|
|
|
|
String folderCaseNum = folderPath + "/" + recordDO.getCaseNum();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
FileUtil.mkdir(new File(folderPath));
|
|
|
|
|
|
|
|
FileUtil.mkdir(new File(zipFolderStr));
|
|
|
|
|
|
|
|
FileUtil.mkdir(new File(folderCaseNum));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//获取档案类型
|
|
|
|
|
|
|
|
String fileType = recordDO.getFileType();
|
|
|
|
|
|
|
|
//会计档案归档
|
|
|
|
|
|
|
|
if (fileType.equals(ArchivesTypeEnum.ACCOUNTING_VOUCHER.getValue())) {
|
|
|
|
|
|
|
|
VoucherExportReqVO voucherExportReqVO = new VoucherExportReqVO();
|
|
|
|
|
|
|
|
voucherExportReqVO.setRecordId(Long.valueOf(recordId));
|
|
|
|
|
|
|
|
List<VoucherDO> voucherDOS = voucherMapper.selectList(voucherExportReqVO);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (VoucherDO voucher : voucherDOS
|
|
|
|
|
|
|
|
) {
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
Long id = voucher.getId();
|
|
|
|
|
|
|
|
//凭证文件夹
|
|
|
|
|
|
|
|
String voucherPath = folderCaseNum + "/" + voucher.getVoucherNum();
|
|
|
|
|
|
|
|
FileUtil.mkdir(voucherPath);
|
|
|
|
|
|
|
|
//凭证xml
|
|
|
|
|
|
|
|
String voucherXmlPath = voucherPath + "/" + voucher.getVoucherNum() + ".xml";
|
|
|
|
|
|
|
|
String voucherStr = JsonToXml.jsonToXml(JSON.toJSONString(voucher));
|
|
|
|
|
|
|
|
FileUtil.writeString(voucherStr, voucherXmlPath, CharsetUtil.CHARSET_UTF_8);
|
|
|
|
|
|
|
|
//凭证附件
|
|
|
|
|
|
|
|
AttachmentExportReqVO attachmentExportReqVO = new AttachmentExportReqVO();
|
|
|
|
|
|
|
|
attachmentExportReqVO.setVoucherId(id);
|
|
|
|
|
|
|
|
List<AttachmentDO> attachmentList = attachmentService.getAttachmentList(attachmentExportReqVO);
|
|
|
|
|
|
|
|
if (attachmentList.size() > 0) {
|
|
|
|
|
|
|
|
for (AttachmentDO at : attachmentList
|
|
|
|
|
|
|
|
) {
|
|
|
|
|
|
|
|
String fileUrl = at.getFileUrl();
|
|
|
|
|
|
|
|
downloadFile(voucherPath, fileUrl);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
//审批流程
|
|
|
|
|
|
|
|
FlowExportReqVO flowExportReqVO = new FlowExportReqVO();
|
|
|
|
|
|
|
|
flowExportReqVO.setVoucherId(id);
|
|
|
|
|
|
|
|
List<FlowDO> flowList = flowService.getFlowList(flowExportReqVO);
|
|
|
|
|
|
|
|
if (flowList.size() > 0) {
|
|
|
|
|
|
|
|
for (FlowDO fl : flowList
|
|
|
|
|
|
|
|
) {
|
|
|
|
|
|
|
|
String fileUrl = fl.getFileUrl();
|
|
|
|
|
|
|
|
downloadFile(voucherPath, fileUrl);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
//电子发票
|
|
|
|
|
|
|
|
InvoicesExportReqVO invoicesExportReqVO = new InvoicesExportReqVO().setVoucherId(id);
|
|
|
|
|
|
|
|
List<InvoicesDO> invoicesList = invoicesService.getInvoicesList(invoicesExportReqVO);
|
|
|
|
|
|
|
|
if (invoicesList.size() > 1) {
|
|
|
|
|
|
|
|
for (InvoicesDO iv : invoicesList
|
|
|
|
|
|
|
|
) {
|
|
|
|
|
|
|
|
String fileUrl = iv.getFileUrl();
|
|
|
|
|
|
|
|
downloadFile(voucherPath, fileUrl);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
//银行回单
|
|
|
|
|
|
|
|
BankSlipExportReqVO bankSlipExportReqVO = new BankSlipExportReqVO();
|
|
|
|
|
|
|
|
bankSlipExportReqVO.setVoucherId(id);
|
|
|
|
|
|
|
|
List<BankSlipDO> bankSlipList = bankSlipService.getBankSlipList(bankSlipExportReqVO);
|
|
|
|
|
|
|
|
if (bankSlipList.size() > 0) {
|
|
|
|
|
|
|
|
for (BankSlipDO bs : bankSlipList
|
|
|
|
|
|
|
|
) {
|
|
|
|
|
|
|
|
String fileUrl = bs.getFileUrl();
|
|
|
|
|
|
|
|
downloadFile(voucherPath, fileUrl);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
|
|
|
log.error(e.getMessage());
|
|
|
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
//会计账簿
|
|
|
|
|
|
|
|
if (fileType.equals(ArchivesTypeEnum.ACCOUNTING_BOOK.getValue())) {
|
|
|
|
|
|
|
|
AccountingBookExportReqVO accountingBookExportReqVO = new AccountingBookExportReqVO();
|
|
|
|
|
|
|
|
accountingBookExportReqVO.setRecordId(recordDO.getId());
|
|
|
|
|
|
|
|
List<AccountingBookDO> accountingBookDOS = accountingBookMapper.selectList(accountingBookExportReqVO);
|
|
|
|
|
|
|
|
for (AccountingBookDO a : accountingBookDOS
|
|
|
|
|
|
|
|
) {
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
//账簿文件夹
|
|
|
|
|
|
|
|
String bookPath = folderCaseNum + "/" + a.getId();
|
|
|
|
|
|
|
|
FileUtil.mkdir(bookPath);
|
|
|
|
|
|
|
|
//账簿xml
|
|
|
|
|
|
|
|
String bookXmlPath = bookPath + "/" + a.getName() + ".xml";
|
|
|
|
|
|
|
|
String aStr = JsonToXml.jsonToXml(JSON.toJSONString(a));
|
|
|
|
|
|
|
|
FileUtil.writeString(aStr, bookXmlPath, CharsetUtil.CHARSET_UTF_8);
|
|
|
|
|
|
|
|
//账簿文件
|
|
|
|
|
|
|
|
downloadFile(bookPath, a.getUri());
|
|
|
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
|
|
|
log.error(e.getMessage());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
//会计报表
|
|
|
|
|
|
|
|
if (fileType.equals(ArchivesTypeEnum.ACCOUNTING_REPORT.getValue())) {
|
|
|
|
|
|
|
|
AccountingReportExportReqVO accountingReportExportReqVO = new AccountingReportExportReqVO();
|
|
|
|
|
|
|
|
accountingReportExportReqVO.setRecordId(Long.valueOf(recordId));
|
|
|
|
|
|
|
|
List<AccountingReportDO> accountingReportDOS = accountingReportMapper.selectList(accountingReportExportReqVO);
|
|
|
|
|
|
|
|
for (AccountingReportDO report:accountingReportDOS
|
|
|
|
|
|
|
|
) {
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
//会计报表文件夹
|
|
|
|
|
|
|
|
String reportPath = folderCaseNum + "/" + report.getId();
|
|
|
|
|
|
|
|
FileUtil.mkdir(reportPath);
|
|
|
|
|
|
|
|
//会计报表xml
|
|
|
|
|
|
|
|
String reportXmlPath = reportPath + "/" + report.getName() + ".xml";
|
|
|
|
|
|
|
|
String reportStr = JsonToXml.jsonToXml(JSON.toJSONString(report));
|
|
|
|
|
|
|
|
FileUtil.writeString(reportStr, reportXmlPath, CharsetUtil.CHARSET_UTF_8);
|
|
|
|
|
|
|
|
//账簿文件
|
|
|
|
|
|
|
|
downloadFile(reportPath, report.getUrl());
|
|
|
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
|
|
|
log.error(e.getMessage());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
//会计其他资料
|
|
|
|
|
|
|
|
if (fileType.equals(ArchivesTypeEnum.ACCOUNTING_OTHER.getValue())) {
|
|
|
|
|
|
|
|
OtherExportReqVO otherExportReqVO = new OtherExportReqVO();
|
|
|
|
|
|
|
|
otherExportReqVO.setRecordId(Long.valueOf(recordId));
|
|
|
|
|
|
|
|
List<OtherDO> otherDOS = otherMapper.selectList(otherExportReqVO);
|
|
|
|
|
|
|
|
for (OtherDO otherDO:otherDOS
|
|
|
|
|
|
|
|
) {
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
//会计其他资料文件夹
|
|
|
|
|
|
|
|
String otherDOPath = folderCaseNum + "/" + otherDO.getId();
|
|
|
|
|
|
|
|
FileUtil.mkdir(otherDOPath);
|
|
|
|
|
|
|
|
//会计其他资料xml
|
|
|
|
|
|
|
|
String reportXmlPath = otherDOPath + "/" + otherDO.getName() + ".xml";
|
|
|
|
|
|
|
|
String reportStr = JsonToXml.jsonToXml(JSON.toJSONString(otherDO));
|
|
|
|
|
|
|
|
FileUtil.writeString(reportStr, reportXmlPath, CharsetUtil.CHARSET_UTF_8);
|
|
|
|
|
|
|
|
//会计其他资料文件
|
|
|
|
|
|
|
|
downloadFile(otherDOPath, otherDO.getFileUrl());
|
|
|
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
|
|
|
log.error(e.getMessage());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
//资产档案
|
|
|
|
|
|
|
|
if (fileType.equals(ArchivesTypeEnum.ELECTRONI_ASSETS.getValue())) {
|
|
|
|
|
|
|
|
ElectronicAssetsExportReqVO electronicAssetsExportReqVO = new ElectronicAssetsExportReqVO();
|
|
|
|
|
|
|
|
electronicAssetsExportReqVO.setRecordId(recordId);
|
|
|
|
|
|
|
|
List<ElectronicAssetsDO> electronicAssetsDOS = electronicAssetsMapper.selectList(electronicAssetsExportReqVO);
|
|
|
|
|
|
|
|
for (ElectronicAssetsDO assets:electronicAssetsDOS
|
|
|
|
|
|
|
|
) {
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
//资产档案文件夹
|
|
|
|
|
|
|
|
String assetsPath = folderCaseNum + "/" + assets.getId();
|
|
|
|
|
|
|
|
FileUtil.mkdir(assetsPath);
|
|
|
|
|
|
|
|
//资产档案xml
|
|
|
|
|
|
|
|
String reportXmlPath = assetsPath + "/" + assets.getAssetCode() + ".xml";
|
|
|
|
|
|
|
|
String reportStr = JsonToXml.jsonToXml(JSON.toJSONString(assets));
|
|
|
|
|
|
|
|
FileUtil.writeString(reportStr, reportXmlPath, CharsetUtil.CHARSET_UTF_8);
|
|
|
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
|
|
|
log.error(e.getMessage());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
//合同档案
|
|
|
|
|
|
|
|
if (fileType.equals(ArchivesTypeEnum.ELECTRONI_CONTRACTS.getValue())) {
|
|
|
|
|
|
|
|
ElectronicContractsExportReqVO electronicContractsExportReqVO = new ElectronicContractsExportReqVO();
|
|
|
|
|
|
|
|
electronicContractsExportReqVO.setRecordId(recordId);
|
|
|
|
|
|
|
|
List<ElectronicContractsDO> electronicContractsDOS = electronicContractsMapper.selectList(electronicContractsExportReqVO);
|
|
|
|
|
|
|
|
for (ElectronicContractsDO assets:electronicContractsDOS
|
|
|
|
|
|
|
|
) {
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
//合同档案文件夹
|
|
|
|
|
|
|
|
String contractPath = folderCaseNum + "/" + assets.getId();
|
|
|
|
|
|
|
|
FileUtil.mkdir(contractPath);
|
|
|
|
|
|
|
|
//合同档案xml
|
|
|
|
|
|
|
|
String contractXmlPath = contractPath + "/" + assets.getContractCode() + ".xml";
|
|
|
|
|
|
|
|
String contractPathStr = JsonToXml.jsonToXml(JSON.toJSONString(assets));
|
|
|
|
|
|
|
|
FileUtil.writeString(contractPathStr, contractXmlPath, CharsetUtil.CHARSET_UTF_8);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
downloadFile(contractPath, assets.getContractAttachment());
|
|
|
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
|
|
|
log.error(e.getMessage());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
//咨询档案
|
|
|
|
|
|
|
|
if (fileType.equals(ArchivesTypeEnum.ELECTRONI_CONSULTATION.getValue())) {
|
|
|
|
|
|
|
|
ElectronicConsultationExportReqVO electronicConsultationExportReqVO = new ElectronicConsultationExportReqVO();
|
|
|
|
|
|
|
|
electronicConsultationExportReqVO.setRecordId(recordId);
|
|
|
|
|
|
|
|
List<ElectronicConsultationDO> electronicConsultationDOS = electronicConsultationMapper.selectList(electronicConsultationExportReqVO);
|
|
|
|
|
|
|
|
for (ElectronicConsultationDO ec:electronicConsultationDOS
|
|
|
|
|
|
|
|
) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
//咨询档案文件夹
|
|
|
|
|
|
|
|
String contractPath = folderCaseNum + "/" + ec.getConsultationId();
|
|
|
|
|
|
|
|
FileUtil.mkdir(contractPath);
|
|
|
|
|
|
|
|
//咨询档案xml
|
|
|
|
|
|
|
|
String contractXmlPath = contractPath + "/" + ec.getConsultationId() + ".xml";
|
|
|
|
|
|
|
|
String contractPathStr = JsonToXml.jsonToXml(JSON.toJSONString(ec));
|
|
|
|
|
|
|
|
FileUtil.writeString(contractPathStr, contractXmlPath, CharsetUtil.CHARSET_UTF_8);
|
|
|
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
|
|
|
log.error(e.getMessage());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
//员工档案
|
|
|
|
|
|
|
|
if (fileType.equals(ArchivesTypeEnum.ELECTRONI_EMPLOYEE.getValue())) {
|
|
|
|
|
|
|
|
ElectronicEmployeeExportReqVO electronicEmployeeExportReqVO = new ElectronicEmployeeExportReqVO();
|
|
|
|
|
|
|
|
electronicEmployeeExportReqVO.setRecordId(recordId);
|
|
|
|
|
|
|
|
List<ElectronicEmployeeDO> electronicEmployeeDOS = electronicEmployeeMapper.selectList(electronicEmployeeExportReqVO);
|
|
|
|
|
|
|
|
for (ElectronicEmployeeDO ec:electronicEmployeeDOS
|
|
|
|
|
|
|
|
) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
//员工档案文件夹
|
|
|
|
|
|
|
|
String contractPath = folderCaseNum + "/" + ec.getIdCardNumber();
|
|
|
|
|
|
|
|
FileUtil.mkdir(contractPath);
|
|
|
|
|
|
|
|
//员工档案xml
|
|
|
|
|
|
|
|
String contractXmlPath = contractPath + "/" + ec.getIdCardNumber() + ".xml";
|
|
|
|
|
|
|
|
String contractPathStr = JsonToXml.jsonToXml(JSON.toJSONString(ec));
|
|
|
|
|
|
|
|
FileUtil.writeString(contractPathStr, contractXmlPath, CharsetUtil.CHARSET_UTF_8);
|
|
|
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
|
|
|
log.error(e.getMessage());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
//客诉档案
|
|
|
|
|
|
|
|
if (fileType.equals(ArchivesTypeEnum.ELECTRONI_CUSTOMER_COMPLAINT.getValue())) {
|
|
|
|
|
|
|
|
ElectronicCustomerComplaintExportReqVO electronicCustomerComplaintExportReqVO = new ElectronicCustomerComplaintExportReqVO();
|
|
|
|
|
|
|
|
electronicCustomerComplaintExportReqVO.setRecordId(recordId);
|
|
|
|
|
|
|
|
List<ElectronicCustomerComplaintDO> electronicCustomerComplaintDOS = electronicCustomerComplaintMapper.selectList(electronicCustomerComplaintExportReqVO);
|
|
|
|
|
|
|
|
for (ElectronicCustomerComplaintDO ec:electronicCustomerComplaintDOS
|
|
|
|
|
|
|
|
) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
//客诉档案文件夹
|
|
|
|
|
|
|
|
String contractPath = folderCaseNum + "/" + ec.getComplaintCode();
|
|
|
|
|
|
|
|
FileUtil.mkdir(contractPath);
|
|
|
|
|
|
|
|
//客诉档案xml
|
|
|
|
|
|
|
|
String contractXmlPath = contractPath + "/" + ec.getComplaintCode() + ".xml";
|
|
|
|
|
|
|
|
String contractPathStr = JsonToXml.jsonToXml(JSON.toJSONString(ec));
|
|
|
|
|
|
|
|
FileUtil.writeString(contractPathStr, contractXmlPath, CharsetUtil.CHARSET_UTF_8);
|
|
|
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
|
|
|
log.error(e.getMessage());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//打包zip
|
|
|
|
|
|
|
|
String zipFilePath = zipFolderStr + "/" + UUID.randomUUID() + ".zip";
|
|
|
|
|
|
|
|
File zip = ZipUtil.zip(folderPath, zipFilePath);
|
|
|
|
|
|
|
|
if (!zip.exists()) {
|
|
|
|
|
|
|
|
log.error(zipFilePath + " Failed to create zip file!");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
//上传minio
|
|
|
|
|
|
|
|
byte[] zipBytes = Files.readAllBytes(zip.toPath());
|
|
|
|
|
|
|
|
String fileUrl = fileService.createFile(zip.getName(), null, zipBytes);
|
|
|
|
|
|
|
|
FileDO fileDO = getFileDO(fileUrl);
|
|
|
|
|
|
|
|
turnOver.setFileSize(fileDO.getSize().toString());
|
|
|
|
|
|
|
|
turnOver.setFileUrl(fileUrl);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//添加数据userid
|
|
|
|
LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
|
|
|
|
LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
|
|
|
|
turnOver.setDeleted(false);
|
|
|
|
turnOver.setDeleted(false);
|
|
|
|
turnOver.setBillType("DAYJ");
|
|
|
|
turnOver.setBillType("DAYJ");
|
|
|
|
//添加数据userid
|
|
|
|
|
|
|
|
turnOver.setUserId(loginUser.getId());
|
|
|
|
turnOver.setUserId(loginUser.getId());
|
|
|
|
turnOver.setStatus(BpmProcessInstanceResultEnum.PROCESS.getResult().toString());
|
|
|
|
turnOver.setStatus(BpmProcessInstanceResultEnum.PROCESS.getResult().toString());
|
|
|
|
turnOver.setCreateById(loginUser.getId());
|
|
|
|
turnOver.setCreateById(loginUser.getId());
|
|
|
|
turnOverMapper.insert(turnOver);
|
|
|
|
turnOverMapper.insert(turnOver);
|
|
|
|
|
|
|
|
//开启审批
|
|
|
|
if (turnOver.getStatus().equals(ArchivesStatusEnum.PROCESS.getValue())) {
|
|
|
|
if (turnOver.getStatus().equals(ArchivesStatusEnum.PROCESS.getValue())) {
|
|
|
|
Map<String, Object> variables = new HashMap<>();
|
|
|
|
Map<String, Object> variables = new HashMap<>();
|
|
|
|
variables.put("billType", turnOver.getBillType());
|
|
|
|
variables.put("billType", turnOver.getBillType());
|
|
|
@ -79,6 +443,48 @@ public class TurnOverServiceImpl extends MPJBaseServiceImpl<TurnOverMapper, Turn
|
|
|
|
return CommonResult.success();
|
|
|
|
return CommonResult.success();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* 下载文件到指定文件夹
|
|
|
|
|
|
|
|
*
|
|
|
|
|
|
|
|
* @param foldPath
|
|
|
|
|
|
|
|
* @param fileUrl
|
|
|
|
|
|
|
|
* @throws IOException
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
private void downloadFile(String foldPath, String fileUrl) throws Exception {
|
|
|
|
|
|
|
|
String fileName = fileUrl.substring(fileUrl.lastIndexOf("/") + 1);
|
|
|
|
|
|
|
|
System.out.println("文件名: " + fileName);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 下载保存文件的路径和文件名
|
|
|
|
|
|
|
|
String saveFilePath = foldPath + "/" + fileName;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
URL url = new URL(fileUrl);
|
|
|
|
|
|
|
|
URLConnection connection = url.openConnection();
|
|
|
|
|
|
|
|
InputStream inputStream = connection.getInputStream();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
FileOutputStream fileOutputStream = new FileOutputStream(saveFilePath);
|
|
|
|
|
|
|
|
BufferedOutputStream outputStream = new BufferedOutputStream(fileOutputStream, 1024);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
byte[] buffer = new byte[1024];
|
|
|
|
|
|
|
|
int bytesRead = 0;
|
|
|
|
|
|
|
|
while ((bytesRead = inputStream.read(buffer)) != -1) {
|
|
|
|
|
|
|
|
outputStream.write(buffer, 0, bytesRead);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
outputStream.close();
|
|
|
|
|
|
|
|
inputStream.close();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
System.out.println("文件已下载到 " + saveFilePath);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private FileDO getFileDO(String fileUrl) {
|
|
|
|
|
|
|
|
FilePageReqVO pageReqVO = new FilePageReqVO();
|
|
|
|
|
|
|
|
String lastSegment = fileUrl.substring(fileUrl.lastIndexOf("/") + 1);
|
|
|
|
|
|
|
|
pageReqVO.setPath(lastSegment);
|
|
|
|
|
|
|
|
PageResult<FileDO> filePage = fileService.getFilePage(pageReqVO);
|
|
|
|
|
|
|
|
FileDO fileDO = filePage.getList().get(0);
|
|
|
|
|
|
|
|
return fileDO;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public void updateTurnOver(TurnOverUpdateReqVO updateReqVO) {
|
|
|
|
public void updateTurnOver(TurnOverUpdateReqVO updateReqVO) {
|
|
|
|
// 校验存在
|
|
|
|
// 校验存在
|
|
|
|