|
|
@ -62,6 +62,7 @@ import com.yxt.anrui.flowable.api.flowtask.FlowTaskVo; |
|
|
|
import com.yxt.anrui.flowable.api.flowtask.LatestTaskVo; |
|
|
|
import com.yxt.anrui.flowable.api.utils.ProcDefEnum; |
|
|
|
import com.yxt.anrui.flowable.sqloperationsymbol.BusinessVariables; |
|
|
|
import com.yxt.anrui.portal.api.flow.PCHistTaskListAndCommentList; |
|
|
|
import com.yxt.anrui.portal.api.sysorganization.SysOrganizationFeign; |
|
|
|
import com.yxt.anrui.portal.api.sysorganization.SysOrganizationVo; |
|
|
|
import com.yxt.anrui.portal.api.sysstafforg.SysStaffOrgFeign; |
|
|
@ -75,21 +76,30 @@ import com.yxt.anrui.riskcenter.api.loanbepadsincereveh.LoanBePadsincereVehDetai |
|
|
|
import com.yxt.anrui.riskcenter.api.loanbepadsincereveh.LoanBePadsincereVehDto; |
|
|
|
import com.yxt.anrui.riskcenter.api.loanfile.LoanFile; |
|
|
|
import com.yxt.anrui.riskcenter.api.loanfile.LoanFileEnum; |
|
|
|
import com.yxt.anrui.riskcenter.api.loanmonthlyaccrualapply.MonthlyAccrualSourceLCVo; |
|
|
|
import com.yxt.anrui.riskcenter.api.loanrepaymenthistory.LoanRepaymentHistory; |
|
|
|
import com.yxt.anrui.riskcenter.api.loanrepaymentplandetails.LoanPlanDetailsVoForFundVoucher; |
|
|
|
import com.yxt.anrui.riskcenter.api.loanrepaymentplandetails.LoanRepaymentPlanDetails; |
|
|
|
import com.yxt.anrui.riskcenter.api.loanrepaymentplandetails.LoanRepaymentPlanMoneyVo; |
|
|
|
import com.yxt.anrui.riskcenter.api.loanrepaymentschedule.LoanRepaymentScheduleDetailsVo; |
|
|
|
import com.yxt.anrui.riskcenter.api.loantransferpaymentapply.LoanTransferPaymentApply; |
|
|
|
import com.yxt.anrui.riskcenter.api.loantransferpaymentapply.LoanTransferPaymentRecordVo; |
|
|
|
import com.yxt.anrui.riskcenter.api.loantransferpaymentrecord.LoanTransferPaymentRecord; |
|
|
|
import com.yxt.anrui.riskcenter.biz.loanbepadsincereveh.LoanBePadsincereVehService; |
|
|
|
import com.yxt.anrui.riskcenter.biz.loanfile.LoanFileService; |
|
|
|
import com.yxt.anrui.riskcenter.biz.loanrepaymentplandetails.LoanRepaymentPlanDetailsService; |
|
|
|
import com.yxt.anrui.riskcenter.biz.loanrepaymentschedule.LoanRepaymentScheduleService; |
|
|
|
import com.yxt.common.base.config.component.DocPdfComponent; |
|
|
|
import com.yxt.common.base.config.component.FileUploadComponent; |
|
|
|
import com.yxt.common.base.utils.ConstantUtils; |
|
|
|
import com.yxt.common.base.utils.DateUtils; |
|
|
|
import com.yxt.common.base.utils.WordConvertUtils; |
|
|
|
import com.yxt.messagecenter.api.message.Message; |
|
|
|
import com.yxt.messagecenter.api.message.MessageFeign; |
|
|
|
import com.yxt.messagecenter.api.message.MessageFlowVo; |
|
|
|
import com.yxt.messagecenter.api.message.MessageFlowableQuery; |
|
|
|
import com.yxt.messagecenter.api.messagelist.MessageList; |
|
|
|
import com.yxt.messagecenter.api.messagelist.MessageListFeign; |
|
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
|
import com.yxt.common.base.service.MybatisBaseService; |
|
|
|
import com.yxt.common.base.utils.PagerUtil; |
|
|
@ -119,6 +129,8 @@ import java.util.regex.Matcher; |
|
|
|
import java.util.regex.Pattern; |
|
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
|
import static java.util.Comparator.comparing; |
|
|
|
|
|
|
|
/** |
|
|
|
* Project: anrui-riskcenter(垫款申请) <br/> |
|
|
|
* File: LoanBePadsincereApplyService.java <br/> |
|
|
@ -134,7 +146,12 @@ import java.util.stream.Collectors; |
|
|
|
*/ |
|
|
|
@Service |
|
|
|
public class LoanBePadsincereApplyService extends MybatisBaseService<LoanBePadsincereApplyMapper, LoanBePadsincereApply> { |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private DocPdfComponent docPdfComponent; |
|
|
|
@Autowired |
|
|
|
private MessageListFeign messageListFeign; |
|
|
|
@Autowired |
|
|
|
private com.yxt.anrui.portal.api.flow.FlowableFeign flowableFeignPro; |
|
|
|
@Autowired |
|
|
|
private SysUserFeign sysUserFeign; |
|
|
|
@Autowired |
|
|
@ -1228,4 +1245,172 @@ public class LoanBePadsincereApplyService extends MybatisBaseService<LoanBePadsi |
|
|
|
} |
|
|
|
return rb.success(); |
|
|
|
} |
|
|
|
|
|
|
|
public ResultBean<String> bepadsincereCreatePdf(String sid) { |
|
|
|
ResultBean rb = ResultBean.fireFail(); |
|
|
|
String finalPath = ""; |
|
|
|
String filePath = ""; |
|
|
|
Map<String, Object> dataMap = new HashMap(); |
|
|
|
List<Map<String, Object>> newList = new ArrayList<>(); |
|
|
|
LoanBePadsincereApply data = fetchBySid(sid); |
|
|
|
if (null != data) { |
|
|
|
if (!data.getNodeState().equals("已办结")) { |
|
|
|
return rb.setMsg("无法下载没有办结的审批记录。"); |
|
|
|
} |
|
|
|
List<LoanFile> files = loanFileService.selectByLinkSid(data.getSid(), LoanFileEnum.BEPADSINCERE.getAttachType()); |
|
|
|
if (!files.isEmpty()) { |
|
|
|
List<String> stringList = new ArrayList<>(); |
|
|
|
for (LoanFile file : files) { |
|
|
|
if (StringUtils.isNotBlank(file.getFileName()) && StringUtils.isNotBlank(file.getFileType())) { |
|
|
|
stringList.add(file.getFileName() + "." + file.getFileType()); |
|
|
|
} |
|
|
|
} |
|
|
|
if (!stringList.isEmpty()) { |
|
|
|
filePath = String.join(",", stringList); |
|
|
|
} |
|
|
|
} |
|
|
|
dataMap.put("createTime", DateUtil.formatDate(data.getCreateTime())); |
|
|
|
if (StringUtils.isNotBlank(data.getUseOrgName())) { |
|
|
|
dataMap.put("company", data.getUseOrgName()); |
|
|
|
} |
|
|
|
if (StringUtils.isNotBlank(data.getCreateByName())) { |
|
|
|
dataMap.put("applyName", data.getCreateByName()); |
|
|
|
} |
|
|
|
if (StringUtils.isNotBlank(data.getDeptName())) { |
|
|
|
dataMap.put("dept", data.getDeptName()); |
|
|
|
} |
|
|
|
if (StringUtils.isNotBlank(data.getBillNo())) { |
|
|
|
dataMap.put("billNo", data.getBillNo()); |
|
|
|
} |
|
|
|
if (StringUtils.isNotBlank(data.getFinPaymentFormValue())) { |
|
|
|
dataMap.put("payWay", data.getFinPaymentFormValue()); |
|
|
|
} |
|
|
|
if (StringUtils.isNotBlank(data.getPaymentRemarks())) { |
|
|
|
dataMap.put("payRemarks", data.getPaymentRemarks()); |
|
|
|
} |
|
|
|
if (StringUtils.isNotBlank(data.getRemarks())) { |
|
|
|
dataMap.put("otherShow", data.getRemarks()); |
|
|
|
} |
|
|
|
if (StringUtils.isNotBlank(filePath)) { |
|
|
|
dataMap.put("filePath", filePath); |
|
|
|
} |
|
|
|
BigDecimal sumMoney = new BigDecimal(0); |
|
|
|
//获取审批记录
|
|
|
|
if (StringUtils.isNotBlank(data.getProcInstSid())) { |
|
|
|
List<PCHistTaskListAndCommentList> flowRecordVo = flowableFeignPro.flowRecordAndComment(data.getProcInstSid(), "1").getData(); |
|
|
|
List<MonthlyAccrualSourceLCVo> sourceLCVos = new ArrayList<>(); |
|
|
|
for (PCHistTaskListAndCommentList flowTask : flowRecordVo) { |
|
|
|
if (flowTask.getFlowableRecordVo() != null) { |
|
|
|
Map<String, Object> flowableRecordVo = flowTask.getFlowableRecordVo(); |
|
|
|
MonthlyAccrualSourceLCVo sourceLCVo = new MonthlyAccrualSourceLCVo(); |
|
|
|
List<Map<String, Object>> taskUserInfos = ConstantUtils.getListData(flowableRecordVo, "taskUserInfos"); |
|
|
|
Map<String, Object> comment = ConstantUtils.getMap(flowableRecordVo, "comment"); |
|
|
|
String assigneeName = (String) taskUserInfos.get(0).get("assigneeName"); |
|
|
|
String comment1 = (String) comment.get("comment"); |
|
|
|
sourceLCVo.setName(assigneeName); |
|
|
|
sourceLCVo.setComment(comment1); |
|
|
|
sourceLCVo.setSpsj(flowableRecordVo.get("finishTime").toString()); |
|
|
|
sourceLCVos.add(sourceLCVo); |
|
|
|
} else { |
|
|
|
Map<String, Object> processCommentVo = flowTask.getProcessCommentVo(); |
|
|
|
MonthlyAccrualSourceLCVo sourceLCVo = new MonthlyAccrualSourceLCVo(); |
|
|
|
sourceLCVo.setName(processCommentVo.get("title").toString()); |
|
|
|
sourceLCVo.setComment(processCommentVo.get("content").toString()); |
|
|
|
sourceLCVo.setSpsj(processCommentVo.get("time").toString()); |
|
|
|
sourceLCVos.add(sourceLCVo); |
|
|
|
} |
|
|
|
} |
|
|
|
List<Message> messages = messageFeign.selectByBusinessSid(data.getSid()).getData(); |
|
|
|
if (messages.size() > 0) { |
|
|
|
for (Message message : messages) { |
|
|
|
MonthlyAccrualSourceLCVo sourceLCVo = new MonthlyAccrualSourceLCVo(); |
|
|
|
String receiverNames = ""; |
|
|
|
List<MessageList> messageLists = messageListFeign.fetchByMainSid(message.getSid()).getData(); |
|
|
|
if (messageLists.size() > 0) { |
|
|
|
for (MessageList messageList : messageLists) { |
|
|
|
receiverNames = receiverNames + messageList.getReceiverName() + ","; |
|
|
|
} |
|
|
|
} |
|
|
|
sourceLCVo.setName("系统"); |
|
|
|
sourceLCVo.setComment("抄送 " + receiverNames.substring(0, receiverNames.lastIndexOf(","))); |
|
|
|
sourceLCVo.setSpsj(DateUtil.format(message.getCreateTime(), "yyyy-MM-dd HH:mm:ss")); |
|
|
|
sourceLCVos.add(sourceLCVo); |
|
|
|
} |
|
|
|
} |
|
|
|
sourceLCVos.sort(comparing(MonthlyAccrualSourceLCVo::getSpsj)); |
|
|
|
dataMap.put("lcList", sourceLCVos); |
|
|
|
} |
|
|
|
List<LoanBePadsincereVehDetailsVo> records = loanBePadsincereVehService.selByMainSid(sid); |
|
|
|
if (!records.isEmpty()) { |
|
|
|
int sortNo = 1; |
|
|
|
for (LoanBePadsincereVehDetailsVo record : records) { |
|
|
|
Map<String, Object> map = new HashMap<>(); |
|
|
|
LoanRepaymentPlanDetails details = loanRepaymentPlanDetailsService.fetchMainBankByBusVinSid(record.getBusVinSid()); |
|
|
|
if (null != details) { |
|
|
|
map.put("sortNo", String.valueOf(sortNo++)); |
|
|
|
if (StringUtils.isNotBlank(record.getLoanContractNo())) { |
|
|
|
map.put("loanNo", record.getLoanContractNo()); |
|
|
|
} |
|
|
|
if (StringUtils.isNotBlank(details.getDept())) { |
|
|
|
map.put("saleDept", details.getDept()); |
|
|
|
} |
|
|
|
if (StringUtils.isNotBlank(record.getVinNo())) { |
|
|
|
map.put("vinNo", record.getVinNo()); |
|
|
|
} |
|
|
|
if (StringUtils.isNotBlank(record.getBankName())) { |
|
|
|
map.put("bankName", record.getBankName()); |
|
|
|
} |
|
|
|
if (StringUtils.isNotBlank(record.getBankContractNo())) { |
|
|
|
map.put("bankNo", record.getBankContractNo()); |
|
|
|
} |
|
|
|
if (StringUtils.isNotBlank(record.getBorrowerName())) { |
|
|
|
map.put("borrowerName", record.getBorrowerName()); |
|
|
|
} |
|
|
|
if (StringUtils.isNotBlank(record.getPeriod())) { |
|
|
|
map.put("period", record.getPeriod()); |
|
|
|
} |
|
|
|
if (StringUtils.isNotBlank(record.getSysBeMoney())) { |
|
|
|
map.put("overDueMoney", record.getSysBeMoney()); |
|
|
|
} |
|
|
|
if (StringUtils.isNotBlank(record.getBankBeMoney())) { |
|
|
|
map.put("bankOverMoney", record.getBankBeMoney()); |
|
|
|
} |
|
|
|
if (StringUtils.isNotBlank(record.getBankBeInter())) { |
|
|
|
map.put("beInter", record.getBankBeInter()); |
|
|
|
} |
|
|
|
if (StringUtils.isNotBlank(record.getPadMoney())) { |
|
|
|
map.put("padMoney", record.getPadMoney()); |
|
|
|
sumMoney = sumMoney.add(new BigDecimal(record.getPadMoney())); |
|
|
|
} |
|
|
|
} |
|
|
|
newList.add(map); |
|
|
|
} |
|
|
|
dataMap.put("amount", sumMoney.toString()); |
|
|
|
} |
|
|
|
dataMap.put("newList", newList); |
|
|
|
String temp = "/template/"; |
|
|
|
String targetPath = docPdfComponent.getUploadTemplateUrl(); |
|
|
|
try { |
|
|
|
//获取模板
|
|
|
|
InputStream inputStream = this.getClass().getClassLoader().getResourceAsStream("ftl/vouchers/padsincere.ftl"); |
|
|
|
//生成word文件名
|
|
|
|
String dateStr = DateUtil.format(new Date(), "yyyyMMdd"); |
|
|
|
long seconds = System.currentTimeMillis(); |
|
|
|
String typeName = dateStr + seconds + ".doc"; |
|
|
|
File file = new File(targetPath + "templateVouchers" + seconds + ".ftl"); |
|
|
|
File dir = new File(targetPath); |
|
|
|
WordConvertUtils.inputStreamToFile(inputStream, file); |
|
|
|
WordConvertUtils.creatWord1(dataMap, file, targetPath, typeName, dir); |
|
|
|
//新生成的word路径
|
|
|
|
String wordPath = targetPath + typeName; |
|
|
|
String pdfName = "垫还审批" + dateStr + seconds + ".pdf"; |
|
|
|
WordConvertUtils.doc2pdf(wordPath, targetPath, pdfName); |
|
|
|
finalPath = temp + pdfName; |
|
|
|
} catch (NoClassDefFoundError e) { |
|
|
|
e.printStackTrace(); |
|
|
|
finalPath = targetPath; |
|
|
|
} |
|
|
|
} |
|
|
|
return rb.success().setData(finalPath); |
|
|
|
} |
|
|
|
} |