|
|
@ -18,8 +18,10 @@ import com.yxt.anrui.buscenter.api.bussalesorderborrower.BusSalesOrderBorrowerFe |
|
|
|
import com.yxt.anrui.buscenter.api.bussalesordervehicle.BusSalesOrderVehicle; |
|
|
|
import com.yxt.anrui.buscenter.api.bussalesordervehicle.BusSalesOrderVehicleFeign; |
|
|
|
import com.yxt.anrui.buscenter.api.bussalesordervehicle.BusVinStateSetQuery; |
|
|
|
import com.yxt.anrui.fin.api.finpaymentrecord.FinPaymentrecordSourceLCVo; |
|
|
|
import com.yxt.anrui.fin.api.kingdee.FinKingDeeFeign; |
|
|
|
import com.yxt.anrui.fin.api.kingdee.bdcustomer.BdCustomer; |
|
|
|
import com.yxt.anrui.fin.api.kingdee.stkmiscellaneous.StkMiscellaneous; |
|
|
|
import com.yxt.anrui.fin.api.kingdee.voucher.Voucher; |
|
|
|
import com.yxt.anrui.flowable.api.flow.FlowableFeign; |
|
|
|
import com.yxt.anrui.flowable.api.flow.UpdateFlowFieldVo; |
|
|
@ -30,6 +32,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; |
|
|
@ -44,19 +47,27 @@ import com.yxt.anrui.riskcenter.api.loanreturninboundapply.flowable.*; |
|
|
|
import com.yxt.anrui.riskcenter.api.loanreturninboundtrailer.LoanReturnInboundTrailer; |
|
|
|
import com.yxt.anrui.riskcenter.api.loanreturninboundtrailer.LoanReturnInboundTrailerDto; |
|
|
|
import com.yxt.anrui.riskcenter.api.loanreturnvehledger.LoanReturnVehLedger; |
|
|
|
import com.yxt.anrui.riskcenter.api.loansecondarysalesnotapply.LoanSecondarySalesNotApplyDetailsVo; |
|
|
|
import com.yxt.anrui.riskcenter.api.loansecondarysalesnotapply.LoanSecondarySalesNotApplyPdfVo; |
|
|
|
import com.yxt.anrui.riskcenter.api.loansecondarysalesnotveh.LoanSecondarySalesNotVehDetailsVo; |
|
|
|
import com.yxt.anrui.riskcenter.biz.loanrepaymentplandetails.LoanRepaymentPlanDetailsService; |
|
|
|
import com.yxt.anrui.riskcenter.biz.loanrestorereportapply.LoanRestoreReportApplyService; |
|
|
|
import com.yxt.anrui.riskcenter.biz.loanreturninboundtrailer.LoanReturnInboundTrailerService; |
|
|
|
import com.yxt.anrui.riskcenter.biz.loanreturnvehledger.LoanReturnVehLedgerService; |
|
|
|
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 org.apache.commons.lang3.StringUtils; |
|
|
|
import org.apache.tomcat.util.threads.ThreadPoolExecutor; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
@ -67,6 +78,8 @@ import java.util.*; |
|
|
|
import java.util.concurrent.*; |
|
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
|
import static java.util.Comparator.comparing; |
|
|
|
|
|
|
|
/** |
|
|
|
* @description: |
|
|
|
* @author: dimengzhe |
|
|
@ -109,7 +122,10 @@ public class LoanReturnInboundApplyService extends MybatisBaseService<LoanReturn |
|
|
|
private BusSalesOrderFeign busSalesOrderFeign; |
|
|
|
@Autowired |
|
|
|
private BasePurchaseSystemFeign basePurchaseSystemFeign; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private MessageListFeign messageListFeign; |
|
|
|
@Autowired |
|
|
|
private com.yxt.anrui.portal.api.flow.FlowableFeign flowableFeignSp; |
|
|
|
@Autowired |
|
|
|
private LoanRepaymentPlanDetailsService loanRepaymentPlanDetailsService; |
|
|
|
|
|
|
@ -610,6 +626,11 @@ public class LoanReturnInboundApplyService extends MybatisBaseService<LoanReturn |
|
|
|
//TOdO:
|
|
|
|
pushRiskToFin(finalLoanReturnInboundApply); |
|
|
|
}); |
|
|
|
Future future2 = pool.submit(() -> { |
|
|
|
//推送其他入库单
|
|
|
|
//TOdO:
|
|
|
|
pushStkIn(finalLoanReturnInboundApply); |
|
|
|
}); |
|
|
|
} catch (Exception e) { |
|
|
|
e.printStackTrace(); |
|
|
|
} |
|
|
@ -698,17 +719,15 @@ public class LoanReturnInboundApplyService extends MybatisBaseService<LoanReturn |
|
|
|
//应收贷款车欠款_到期欠款_本金
|
|
|
|
BigDecimal bjMoney = BigDecimal.ZERO; |
|
|
|
String lq = loanRepaymentPlanDetailsService.getYqLq(loanReturnInboundApply.getBusVinSid()); |
|
|
|
lqMoney = lqMoney.add(new BigDecimal(StringUtils.isBlank(lq)? "0" :lq)); |
|
|
|
lqMoney = lqMoney.add(new BigDecimal(StringUtils.isBlank(lq) ? "0" : lq)); |
|
|
|
//未到期欠款
|
|
|
|
String wdq = alrepaidAndArrVo.getUnexpiredMoney(); |
|
|
|
wdqMoney = wdqMoney.add(new BigDecimal(StringUtils.isBlank(wdq)?"0":wdq)); |
|
|
|
wdqMoney = wdqMoney.add(new BigDecimal(StringUtils.isBlank(wdq) ? "0" : wdq)); |
|
|
|
String bj = loanRepaymentPlanDetailsService.getBj(loanReturnInboundApply.getBusVinSid()); |
|
|
|
bjMoney = bjMoney.add(new BigDecimal(StringUtils.isBlank(bj)?"0":bj)); |
|
|
|
bjMoney = bjMoney.add(new BigDecimal(StringUtils.isBlank(bj) ? "0" : bj)); |
|
|
|
all = lqMoney.add(wdqMoney).add(bjMoney); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<Voucher.VoucherResultDetailDto> voucherResultDetailDtos = new ArrayList<>(); |
|
|
|
//借方
|
|
|
|
Voucher.VoucherResultDetailDto voucherResultDetailDtoJf = new Voucher.VoucherResultDetailDto(); |
|
|
@ -718,7 +737,7 @@ public class LoanReturnInboundApplyService extends MybatisBaseService<LoanReturn |
|
|
|
Voucher.VoucherResultDetailDto voucherResultDetailDtoDf3 = new Voucher.VoucherResultDetailDto(); |
|
|
|
|
|
|
|
//-------------------------------------------应收贷款车欠款_待处理欠款_扣回车辆
|
|
|
|
if(all.compareTo(BigDecimal.ZERO) != 0){ |
|
|
|
if (all.compareTo(BigDecimal.ZERO) != 0) { |
|
|
|
voucherResultDetailDtoJf.setSummary("扣回车辆入库"); |
|
|
|
voucherResultDetailDtoJf.setSubjectNo("1201.03.01"); |
|
|
|
//核算部门
|
|
|
@ -730,7 +749,7 @@ public class LoanReturnInboundApplyService extends MybatisBaseService<LoanReturn |
|
|
|
} |
|
|
|
|
|
|
|
//---------------------------------------------应收贷款车欠款_到期欠款_累欠
|
|
|
|
if(lqMoney.compareTo(BigDecimal.ZERO) != 0){ |
|
|
|
if (lqMoney.compareTo(BigDecimal.ZERO) != 0) { |
|
|
|
voucherResultDetailDtoDf1.setSummary("扣回车辆入库"); |
|
|
|
voucherResultDetailDtoDf1.setSubjectNo("1201.02.03"); |
|
|
|
//核算部门
|
|
|
@ -742,7 +761,7 @@ public class LoanReturnInboundApplyService extends MybatisBaseService<LoanReturn |
|
|
|
} |
|
|
|
|
|
|
|
//--------------------------------------------应收贷款车欠款_未到期欠款_未到期欠款
|
|
|
|
if(wdqMoney.compareTo(BigDecimal.ZERO) != 0){ |
|
|
|
if (wdqMoney.compareTo(BigDecimal.ZERO) != 0) { |
|
|
|
voucherResultDetailDtoDf2.setSummary("扣回车辆入库"); |
|
|
|
voucherResultDetailDtoDf2.setSubjectNo("1201.01.00"); |
|
|
|
//核算部门
|
|
|
@ -754,7 +773,7 @@ public class LoanReturnInboundApplyService extends MybatisBaseService<LoanReturn |
|
|
|
} |
|
|
|
|
|
|
|
//-------------------------------------------应收贷款车欠款_到期欠款_本金
|
|
|
|
if(bjMoney.compareTo(BigDecimal.ZERO) != 0){ |
|
|
|
if (bjMoney.compareTo(BigDecimal.ZERO) != 0) { |
|
|
|
voucherResultDetailDtoDf3.setSummary("扣回车辆入库"); |
|
|
|
voucherResultDetailDtoDf3.setSubjectNo("1201.02.01"); |
|
|
|
//核算部门
|
|
|
@ -764,13 +783,34 @@ public class LoanReturnInboundApplyService extends MybatisBaseService<LoanReturn |
|
|
|
voucherResultDetailDtoDf3.setCredit(bjMoney.toString()); |
|
|
|
voucherResultDetailDtos.add(voucherResultDetailDtoDf3); |
|
|
|
} |
|
|
|
if(!voucherResultDetailDtos.isEmpty()){ |
|
|
|
if (!voucherResultDetailDtos.isEmpty()) { |
|
|
|
voucher.setResultDetails(voucherResultDetailDtos); |
|
|
|
finKingDeeFeign.saveVoucher(voucher); |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
public void pushStkIn(LoanReturnInboundApply loanReturnInboundApply) { |
|
|
|
SysOrganizationVo sysOrg = sysOrganizationFeign.fetchBySid(loanReturnInboundApply.getUseOrgSid()).getData(); |
|
|
|
StkMiscellaneous stkMiscellaneous = new StkMiscellaneous(); |
|
|
|
List<StkMiscellaneous.StkMiscellaneousEntry> stkMiscellaneousEntryList = new ArrayList<>(); |
|
|
|
SysOrganizationVo sysOrgDept = sysOrganizationFeign.fetchBySid(loanReturnInboundApply.getCreateDeptSid()).getData(); |
|
|
|
stkMiscellaneous.setFStockOrgId(sysOrg.getOrgCode()); |
|
|
|
stkMiscellaneous.setFDEPTID(sysOrgDept.getOrgCode()); |
|
|
|
stkMiscellaneous.setFNOTE(""); |
|
|
|
stkMiscellaneous.setFDate(DateUtil.today()); |
|
|
|
stkMiscellaneous.setFOwnerIdHead(sysOrg.getOrgCode()); |
|
|
|
StkMiscellaneous.StkMiscellaneousEntry stkMiscellaneousEntry = new StkMiscellaneous.StkMiscellaneousEntry(); |
|
|
|
stkMiscellaneousEntry.setFMATERIALID(loanReturnInboundApply.getVinNo()); |
|
|
|
stkMiscellaneousEntry.setFUnitID("liang"); |
|
|
|
stkMiscellaneousEntry.setFSTOCKID("ARZSCK"); |
|
|
|
stkMiscellaneousEntry.setFOWNERID(sysOrg.getOrgCode()); |
|
|
|
stkMiscellaneousEntryList.add(stkMiscellaneousEntry); |
|
|
|
stkMiscellaneous.setStkMiscellaneousEntry(stkMiscellaneousEntryList); |
|
|
|
ResultBean resultBean = finKingDeeFeign.draftStkMiscellaneous(stkMiscellaneous); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
private int submitBusinessData(SubmitReturnInbondApplyDto dto, LoanReturnInboundApply loanReturnInboundApply) { |
|
|
|
int r = 0; |
|
|
|
if (StringUtils.isBlank(dto.getSid())) { |
|
|
@ -941,6 +981,116 @@ public class LoanReturnInboundApplyService extends MybatisBaseService<LoanReturn |
|
|
|
return rb.success().setData(returnAppVo); |
|
|
|
} |
|
|
|
|
|
|
|
public String createPdf(String sid, String userName) { |
|
|
|
LoanReturnInboundApplyDetailsQuery query = new LoanReturnInboundApplyDetailsQuery(); |
|
|
|
query.setSid(sid); |
|
|
|
LoanReturnInboundApplyDetailsVo data = details(query).getData(); |
|
|
|
Map<String, Object> dataMap = new HashMap<String, Object>(); |
|
|
|
//分公司
|
|
|
|
SysOrganizationVo sysOrganizationVo = sysOrganizationFeign.fetchBySid(data.getUseOrgSid()).getData(); |
|
|
|
dataMap.put("orgName", sysOrganizationVo.getName()); |
|
|
|
//创建部门
|
|
|
|
dataMap.put("deptName", data.getCreateDept()); |
|
|
|
//创建人
|
|
|
|
dataMap.put("createName", data.getCreateByName()); |
|
|
|
//创建日期
|
|
|
|
dataMap.put("createTime", data.getCreateDate()); |
|
|
|
//办结日期
|
|
|
|
LoanReturnInboundApply loanReturnInboundApply = fetchBySid(sid); |
|
|
|
dataMap.put("finishTime", loanReturnInboundApply.getCloseDate()); |
|
|
|
//审批编号
|
|
|
|
dataMap.put("billNo", data.getBillNo()); |
|
|
|
dataMap.put("zc", data.getVinNo()); |
|
|
|
dataMap.put("zch", data.getVehMark()); |
|
|
|
dataMap.put("djrq", data.getFirstDate()); |
|
|
|
dataMap.put("cx", data.getModelName()); |
|
|
|
dataMap.put("dgc", data.getTralier()); |
|
|
|
dataMap.put("name", data.getCustomerName()); |
|
|
|
dataMap.put("dkr", data.getLoanName()); |
|
|
|
dataMap.put("dkbh", data.getLoanContractNo()); |
|
|
|
dataMap.put("zf", data.getBankName()); |
|
|
|
dataMap.put("zfbh", data.getLocationName()); |
|
|
|
dataMap.put("sfbz", data.getParkFees()); |
|
|
|
//挂车
|
|
|
|
LoanReturnInboundTrailerDto loanReturnInboundTrailer = data.getLoanReturnInboundTrailer(); |
|
|
|
dataMap.put("gc", loanReturnInboundTrailer.getVinNo()); |
|
|
|
dataMap.put("gch", loanReturnInboundTrailer.getVehMark()); |
|
|
|
dataMap.put("gcj", loanReturnInboundTrailer.getInboundMoney()); |
|
|
|
dataMap.put("lx", loanReturnInboundTrailer.getTrailerType()); |
|
|
|
dataMap.put("bz", loanReturnInboundTrailer.getRemarks()); |
|
|
|
//已还与欠款情况
|
|
|
|
dataMap.put("yh", data.getAlRepaidMoney()); |
|
|
|
dataMap.put("yq", data.getCurrentBeMoney() + "/" + data.getWheFundOccMoney()); |
|
|
|
dataMap.put("wdq", data.getUnexpiredMoney()); |
|
|
|
dataMap.put("qs", data.getNper() + "/" + data.getCurrentPeriod()); |
|
|
|
dataMap.put("qhqs", data.getAlRepaidMoneyConPeriod()); |
|
|
|
dataMap.put("yqqs", data.getBeOverdueMoneyAndPeriod()); |
|
|
|
dataMap.put("remarks", data.getRemarks()); |
|
|
|
//获取审批记录
|
|
|
|
List<PCHistTaskListAndCommentList> flowRecordVo = flowableFeignSp.flowRecordAndComment(data.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, "jhclrk", sourcePath, targetPath, typeName); |
|
|
|
//新生成的word路径
|
|
|
|
String wordPath = targetPath + "\\" + typeName; |
|
|
|
//生成出门证文件名
|
|
|
|
String pdfName = "交回车辆入库审批_" + dateStr + seconds + ".pdf"; |
|
|
|
WordUtils.doc2pdf(wordPath, targetPath, pdfName, userName); |
|
|
|
return "/template/" + dateStr + "/" + pdfName; |
|
|
|
} |
|
|
|
|
|
|
|
/* public ResultBean<List<ReturnInboundVo>> getInboundList(String useOrgSid) { |
|
|
|
ResultBean<List<ReturnInboundVo>> rb = ResultBean.fireFail(); |
|
|
|
List<String> busVinSid = baseMapper.selectVehInbound(useOrgSid); |
|
|
|