|
|
@ -7,8 +7,12 @@ import com.alibaba.fastjson.JSON; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
|
|
import com.google.common.util.concurrent.ThreadFactoryBuilder; |
|
|
|
import com.yxt.anrui.buscenter.api.bussalesorderreturnveh.BusSalesOrderReturnVehDetailsVo; |
|
|
|
import com.yxt.anrui.buscenter.api.bussalesorderreturnvehapply.BusSalesOrderReturnVehApplyDetailsVo; |
|
|
|
import com.yxt.anrui.buscenter.api.bussalesorderreturnvehapply.BusSalesOrderReturnVehPdfVo; |
|
|
|
import com.yxt.anrui.buscenter.api.bussalesordervehicle.BusSalesOrderVehicle; |
|
|
|
import com.yxt.anrui.buscenter.api.bussalesordervehicle.BusSalesOrderVehicleFeign; |
|
|
|
import com.yxt.anrui.fin.api.finpaymentrecord.FinPaymentrecordSourceLCVo; |
|
|
|
import com.yxt.anrui.flowable.api.flow.FlowableFeign; |
|
|
|
import com.yxt.anrui.flowable.api.flow.UpdateFlowFieldVo; |
|
|
|
import com.yxt.anrui.flowable.api.flow2.FlowDelegateQuery; |
|
|
@ -18,6 +22,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.SysStaffOrg; |
|
|
@ -45,13 +50,18 @@ import com.yxt.anrui.riskcenter.biz.loansettleapply.LoanSettleApplyService; |
|
|
|
import com.yxt.anrui.riskcenter.biz.loansolutions.LoanSolutionsService; |
|
|
|
import com.yxt.common.base.config.component.FileUploadComponent; |
|
|
|
import com.yxt.common.base.service.MybatisBaseService; |
|
|
|
import com.yxt.common.base.utils.ConstantUtils; |
|
|
|
import com.yxt.common.base.utils.PagerUtil; |
|
|
|
import com.yxt.common.base.utils.WordUtils; |
|
|
|
import com.yxt.common.core.query.PagerQuery; |
|
|
|
import com.yxt.common.core.result.ResultBean; |
|
|
|
import com.yxt.common.core.vo.PagerVo; |
|
|
|
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 feign.FeignException; |
|
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
@ -64,6 +74,8 @@ import java.util.*; |
|
|
|
import java.util.concurrent.*; |
|
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
|
import static java.util.Comparator.comparing; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
* @description: |
|
|
@ -84,8 +96,6 @@ public class LoanRepurchaseApplyService extends MybatisBaseService<LoanRepurchas |
|
|
|
@Autowired |
|
|
|
private FileUploadComponent fileUploadComponent; |
|
|
|
@Autowired |
|
|
|
private LoanSolutionsService loanSolutionsService; |
|
|
|
@Autowired |
|
|
|
private LoanRepurchaseCompanyCostService loanRepurchaseCompanyCostService; |
|
|
|
@Autowired |
|
|
|
private LoanRepurchaseCostService loanRepurchaseCostService; |
|
|
@ -101,6 +111,10 @@ public class LoanRepurchaseApplyService extends MybatisBaseService<LoanRepurchas |
|
|
|
private FlowableFeign flowableFeign; |
|
|
|
@Autowired |
|
|
|
private MessageFeign messageFeign; |
|
|
|
@Autowired |
|
|
|
private com.yxt.anrui.portal.api.flow.FlowableFeign flowableFeignSp; |
|
|
|
@Autowired |
|
|
|
private MessageListFeign messageListFeign; |
|
|
|
|
|
|
|
public PagerVo<LoanRepurchaseApplyVo> listPage(PagerQuery<LoanRepurchaseApplyQuery> pq) { |
|
|
|
IPage<LoanRepurchaseApply> page = PagerUtil.queryToPage(pq); |
|
|
@ -1095,4 +1109,131 @@ public class LoanRepurchaseApplyService extends MybatisBaseService<LoanRepurchas |
|
|
|
} |
|
|
|
return rb.success().setData(loanSettleApplyDetailsVo); |
|
|
|
} |
|
|
|
|
|
|
|
public String createPdf(String sid, String userName) { |
|
|
|
LoanRepurchaseApplyDetailsVo data = fetchDetailsBySid(sid).getData(); |
|
|
|
LoanRepurchaseApply loanRepurchaseApply = fetchBySid(sid); |
|
|
|
Map<String, Object> dataMap = new HashMap<String, Object>(); |
|
|
|
//分公司
|
|
|
|
String useOrgSid = sysStaffOrgFeign.getOrgSidByPath(data.getOrgPath()).getData(); |
|
|
|
SysOrganizationVo sysOrganizationVo = sysOrganizationFeign.fetchBySid(useOrgSid).getData(); |
|
|
|
dataMap.put("orgName", sysOrganizationVo.getName()); |
|
|
|
//创建部门
|
|
|
|
dataMap.put("deptName", data.getCreateDept()); |
|
|
|
//创建人
|
|
|
|
dataMap.put("createName", data.getCreateByName()); |
|
|
|
//创建日期
|
|
|
|
dataMap.put("createTime", data.getApplyDate()); |
|
|
|
//办结日期
|
|
|
|
dataMap.put("finishTime", DateUtil.formatDate(loanRepurchaseApply.getCloseDate())); |
|
|
|
//审批编号
|
|
|
|
dataMap.put("billNo", loanRepurchaseApply.getBillNo()); |
|
|
|
dataMap.put("vinNo", data.getVinNo()); |
|
|
|
dataMap.put("cph", data.getVehMark()); |
|
|
|
dataMap.put("kh", data.getCustomerName()); |
|
|
|
dataMap.put("dkr", data.getLoanName()); |
|
|
|
dataMap.put("dkh", data.getLoanContractNo()); |
|
|
|
dataMap.put("zf", data.getBankName()); |
|
|
|
dataMap.put("zfh", data.getBankContractNo()); |
|
|
|
dataMap.put("jqr", data.getPrepareDate()); |
|
|
|
dataMap.put("yq", data.getOverdueMonthPrice()); |
|
|
|
dataMap.put("dq", data.getCurrentNotDuePrice()); |
|
|
|
dataMap.put("wdq", data.getNotDuePrice()); |
|
|
|
dataMap.put("bz", loanRepurchaseApply.getRemarks()); |
|
|
|
LoanRepurchaseBankCostVo bankCostVo = data.getBankCostVo(); |
|
|
|
dataMap.put("zbzj", bankCostVo.getLoanDeposit()); |
|
|
|
dataMap.put("dd", bankCostVo.isTopping() ? "是" : "否"); |
|
|
|
dataMap.put("zyh", bankCostVo.getPrice()); |
|
|
|
dataMap.put("zdq", bankCostVo.getCurrentNotDuePrice()); |
|
|
|
dataMap.put("zwdq", bankCostVo.getNotDuePrice()); |
|
|
|
dataMap.put("zlx", bankCostVo.getBankInterest()); |
|
|
|
dataMap.put("zmy", bankCostVo.getBankNominalPrice()); |
|
|
|
dataMap.put("zwy", bankCostVo.getBankContractLiquidated()); |
|
|
|
dataMap.put("zys", bankCostVo.getBankOtherReceivable()); |
|
|
|
dataMap.put("zsm", bankCostVo.getOtherReceivableRemarks()); |
|
|
|
dataMap.put("zjq", bankCostVo.getBankSettlePrice()); |
|
|
|
dataMap.put("zzo", bankCostVo.getBankAccount()); |
|
|
|
dataMap.put("zzh", bankCostVo.getAccountName()); |
|
|
|
LoanRepurchaseCompanyCostVo companyCostVo = data.getCompanyCostVo(); |
|
|
|
dataMap.put("gbzj", companyCostVo.getLoanDeposit()); |
|
|
|
dataMap.put("gyh", companyCostVo.getOverduePrice()); |
|
|
|
dataMap.put("glx", companyCostVo.getPutBankInterest()); |
|
|
|
dataMap.put("gzf", companyCostVo.getFunfCost()); |
|
|
|
dataMap.put("gzlx", companyCostVo.getBankOverInterest()); |
|
|
|
dataMap.put("gdq", companyCostVo.getCompanyCurrentNotPrice()); |
|
|
|
dataMap.put("gwdq", companyCostVo.getBankNotPrice()); |
|
|
|
dataMap.put("gfk", companyCostVo.getDeductionAmount()); |
|
|
|
dataMap.put("gmy", companyCostVo.getCompanyNominalPrice()); |
|
|
|
dataMap.put("gwy", companyCostVo.getContractLiquidated()); |
|
|
|
dataMap.put("gfy", companyCostVo.getCompanyOtherPrice()); |
|
|
|
dataMap.put("gsm", companyCostVo.getOtherCostRemarks()); |
|
|
|
dataMap.put("ghj", companyCostVo.getSettleAll()); |
|
|
|
dataMap.put("gjq", companyCostVo.getProfit()); |
|
|
|
dataMap.put("hg", data.getAmount()); |
|
|
|
dataMap.put("hgsm", data.getBuybacksReason()); |
|
|
|
dataMap.put("hgbz", data.getPayRemarks()); |
|
|
|
//获取审批记录
|
|
|
|
List<PCHistTaskListAndCommentList> flowRecordVo = flowableFeignSp.flowRecordAndComment(loanRepurchaseApply.getProcInstId(), "1").getData(); |
|
|
|
List<FinPaymentrecordSourceLCVo> finPaymentrecordSourceLCVos = new ArrayList<>(); |
|
|
|
for (PCHistTaskListAndCommentList flowTask : flowRecordVo) { |
|
|
|
if (flowTask.getFlowableRecordVo() != null) { |
|
|
|
Map<String, Object> flowableRecordVo = flowTask.getFlowableRecordVo(); |
|
|
|
FinPaymentrecordSourceLCVo finPaymentrecordSourceLCVo = new FinPaymentrecordSourceLCVo(); |
|
|
|
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"); |
|
|
|
finPaymentrecordSourceLCVo.setName(assigneeName); |
|
|
|
finPaymentrecordSourceLCVo.setComment(comment1); |
|
|
|
finPaymentrecordSourceLCVo.setSpsj(flowableRecordVo.get("finishTime").toString()); |
|
|
|
finPaymentrecordSourceLCVos.add(finPaymentrecordSourceLCVo); |
|
|
|
} else { |
|
|
|
Map<String, Object> processCommentVo = flowTask.getProcessCommentVo(); |
|
|
|
FinPaymentrecordSourceLCVo finPaymentrecordSourceLCVo = new FinPaymentrecordSourceLCVo(); |
|
|
|
finPaymentrecordSourceLCVo.setName(processCommentVo.get("title").toString()); |
|
|
|
finPaymentrecordSourceLCVo.setComment(processCommentVo.get("content").toString()); |
|
|
|
finPaymentrecordSourceLCVo.setSpsj(processCommentVo.get("time").toString()); |
|
|
|
finPaymentrecordSourceLCVos.add(finPaymentrecordSourceLCVo); |
|
|
|
} |
|
|
|
} |
|
|
|
List<Message> messages = messageFeign.selectByBusinessSid(data.getSid()).getData(); |
|
|
|
if (messages.size() > 0) { |
|
|
|
for (Message message : messages) { |
|
|
|
FinPaymentrecordSourceLCVo finPaymentrecordSourceLCVo = new FinPaymentrecordSourceLCVo(); |
|
|
|
String receiverNames = ""; |
|
|
|
List<MessageList> messageLists = messageListFeign.fetchByMainSid(message.getSid()).getData(); |
|
|
|
if (messageLists.size() > 0) { |
|
|
|
for (MessageList messageList : messageLists) { |
|
|
|
receiverNames = receiverNames + messageList.getReceiverName() + ","; |
|
|
|
} |
|
|
|
} |
|
|
|
finPaymentrecordSourceLCVo.setName("系统"); |
|
|
|
finPaymentrecordSourceLCVo.setComment("抄送 " + receiverNames.substring(0, receiverNames.lastIndexOf(","))); |
|
|
|
finPaymentrecordSourceLCVo.setSpsj(DateUtil.format(message.getCreateTime(), "yyyy-MM-dd HH:mm:ss")); |
|
|
|
finPaymentrecordSourceLCVos.add(finPaymentrecordSourceLCVo); |
|
|
|
} |
|
|
|
} |
|
|
|
finPaymentrecordSourceLCVos.sort(comparing(FinPaymentrecordSourceLCVo::getSpsj)); |
|
|
|
dataMap.put("lcList", finPaymentrecordSourceLCVos); |
|
|
|
//下载人
|
|
|
|
dataMap.put("downName", userName); |
|
|
|
//下载时间
|
|
|
|
dataMap.put("downTime", DateUtil.format(new Date(), "yyyy-MM-dd HH:mm:ss")); |
|
|
|
//获取模板
|
|
|
|
//模板路径
|
|
|
|
String sourcePath = "D:\\anrui\\upload\\template\\"; |
|
|
|
//生成word文件名
|
|
|
|
String dateStr = DateUtil.format(new Date(), "yyyyMMdd"); |
|
|
|
long seconds = System.currentTimeMillis(); |
|
|
|
String typeName = dateStr + seconds + ".doc"; |
|
|
|
// 生成文件路径
|
|
|
|
String targetPath = sourcePath + dateStr; |
|
|
|
WordUtils.creatWord(dataMap, "hgsp", sourcePath, targetPath, typeName); |
|
|
|
//新生成的word路径
|
|
|
|
String wordPath = targetPath + "\\" + typeName; |
|
|
|
//生成出门证文件名
|
|
|
|
String pdfName = "回购_" + dateStr + seconds + ".pdf"; |
|
|
|
WordUtils.doc2pdf(wordPath, targetPath, pdfName, userName); |
|
|
|
return "/template/" + dateStr + "/" + pdfName; |
|
|
|
} |
|
|
|
} |
|
|
|