|
|
@ -27,6 +27,7 @@ package com.yxt.anrui.fin.biz.finpaymentrecord; |
|
|
|
|
|
|
|
import cn.hutool.core.bean.BeanUtil; |
|
|
|
import cn.hutool.core.date.DateUtil; |
|
|
|
import com.alibaba.fastjson.JSONObject; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
|
|
import com.google.common.util.concurrent.ThreadFactoryBuilder; |
|
|
@ -55,12 +56,14 @@ import com.yxt.anrui.fin.api.finpaymentapplyvehicle.FinPaymentapplyVehicleVo; |
|
|
|
import com.yxt.anrui.fin.api.finpaymentrecord.*; |
|
|
|
import com.yxt.anrui.fin.api.finuncollectedreceivablesdetailedjr.FinUncollectedReceivablesDetailedJR; |
|
|
|
import com.yxt.anrui.fin.api.kingdee.appaybill.ApPayBill; |
|
|
|
import com.yxt.anrui.fin.api.kingdee.voucher.Voucher; |
|
|
|
import com.yxt.anrui.fin.biz.finmanufacturerbank.FinManufacturerBankService; |
|
|
|
import com.yxt.anrui.fin.biz.finpaymentapply.FinPaymentapplyService; |
|
|
|
import com.yxt.anrui.fin.biz.finpaymentapplydetails.FinPaymentapplyDetailsService; |
|
|
|
import com.yxt.anrui.fin.biz.finpaymentapplyvehicle.FinPaymentapplyVehicleService; |
|
|
|
import com.yxt.anrui.fin.biz.finuncollectedreceivablesdetailedjr.FinUncollectedReceivablesDetailedJRService; |
|
|
|
import com.yxt.anrui.fin.biz.kingdee.appaybill.ApPayBillService; |
|
|
|
import com.yxt.anrui.fin.biz.kingdee.voucher.VoucherService; |
|
|
|
import com.yxt.anrui.portal.api.flow.FlowableFeign; |
|
|
|
import com.yxt.anrui.portal.api.flow.PCHistTaskListAndCommentList; |
|
|
|
import com.yxt.anrui.portal.api.sysorganization.SysOrganization; |
|
|
@ -79,6 +82,7 @@ import com.yxt.anrui.riskcenter.api.loanrepaymentplandetails.LoanRepaymentPlanDe |
|
|
|
import com.yxt.anrui.riskcenter.api.loanrepaymentplandetails.LoanRepaymentPlanMoneyVo; |
|
|
|
import com.yxt.anrui.riskcenter.api.loansettleapply.LoanSettleApplyFeign; |
|
|
|
import com.yxt.anrui.riskcenter.api.loantransferpaymentapply.LoanTransferPaymentApplyFeign; |
|
|
|
import com.yxt.anrui.riskcenter.api.loanvoucher.RskVoucher; |
|
|
|
import com.yxt.anrui.scm.api.scmcollectionrebate.ScmCollectionRebateDto; |
|
|
|
import com.yxt.anrui.scm.api.scmcollectionrebate.ScmCollectionRebateFeign; |
|
|
|
import com.yxt.anrui.scm.api.scmcollectionrebateveh.ScmCollectionRebateVehDto; |
|
|
@ -106,6 +110,7 @@ import java.io.IOException; |
|
|
|
import java.io.InputStream; |
|
|
|
import java.math.BigDecimal; |
|
|
|
import java.text.NumberFormat; |
|
|
|
import java.text.SimpleDateFormat; |
|
|
|
import java.util.*; |
|
|
|
import java.util.concurrent.*; |
|
|
|
import java.util.stream.Collectors; |
|
|
@ -185,6 +190,8 @@ public class FinPaymentrecordService extends MybatisBaseService<FinPaymentrecord |
|
|
|
private FinManufacturerBankService finManufacturerBankService; |
|
|
|
@Autowired |
|
|
|
private LoanSettleApplyFeign loanSettleApplyFeign; |
|
|
|
@Autowired |
|
|
|
private VoucherService voucherService; |
|
|
|
|
|
|
|
public PagerVo<FinPaymentrecordVo> listPageVo(PagerQuery<FinPaymentrecordQuery> pq) { |
|
|
|
FinPaymentrecordQuery query = pq.getParams(); |
|
|
@ -203,6 +210,9 @@ public class FinPaymentrecordService extends MybatisBaseService<FinPaymentrecord |
|
|
|
if (StringUtils.isNotBlank(pageQuery.getCostTitleKey())) { |
|
|
|
qw.eq("fp.costTitleKey", pageQuery.getCostTitleKey()); |
|
|
|
} |
|
|
|
if (StringUtils.isNotBlank(pageQuery.getBatchNumber())) { |
|
|
|
qw.like("fp.batchNumber", pageQuery.getBatchNumber()); |
|
|
|
} |
|
|
|
//申请日期
|
|
|
|
qw.apply(StringUtils.isNotBlank(pageQuery.getCreateStartDate()), "date_format (fp.createTime,'%Y-%m-%d') >= date_format('" + pageQuery.getCreateStartDate() + "','%Y-%m-%d')"). |
|
|
|
apply(StringUtils.isNotBlank(pageQuery.getCreateEndDate()), "date_format (fp.createTime,'%Y-%m-%d') <= date_format('" + pageQuery.getCreateEndDate() + "','%Y-%m-%d')" |
|
|
@ -657,17 +667,26 @@ public class FinPaymentrecordService extends MybatisBaseService<FinPaymentrecord |
|
|
|
厂家采购订金:005定金;厂家采购车款:车辆功能(厂家销售/回款通路)。 |
|
|
|
"外采订金:005定金 |
|
|
|
外采车款:002外采"*/ |
|
|
|
if (!"厂家采购".equals(finPaymentrecord.getCostTypeValue()) && !"厂家车款".equals(finPaymentrecord.getCostTypeValue())) { |
|
|
|
apPayBill.setF_PAEZ_AssistantKey(finPaymentrecord.getCostTypeKey()); |
|
|
|
// if (!"厂家采购".equals(finPaymentrecord.getCostTypeValue()) && !"厂家车款".equals(finPaymentrecord.getCostTypeValue())) {
|
|
|
|
// apPayBill.setF_PAEZ_AssistantKey(finPaymentrecord.getCostTypeKey());
|
|
|
|
// apPayBill.setF_PAEZ_AssistantType("payCostType");
|
|
|
|
// } else {
|
|
|
|
// if ("009".equals(finPaymentrecord.getCostTypeKey())){
|
|
|
|
// apPayBill.setF_PAEZ_AssistantKey("001");
|
|
|
|
// }else {
|
|
|
|
// apPayBill.setF_PAEZ_AssistantKey(finPaymentrecord.getCostTypeKey());
|
|
|
|
// }
|
|
|
|
// apPayBill.setF_PAEZ_AssistantType("payChannel");
|
|
|
|
// }
|
|
|
|
if (StringUtils.isNotBlank(finPaymentrecord.getPayCostType())) { |
|
|
|
apPayBill.setF_PAEZ_AssistantKey(finPaymentrecord.getPayCostType()); |
|
|
|
apPayBill.setF_PAEZ_AssistantType("payCostType"); |
|
|
|
} else { |
|
|
|
if ("009".equals(finPaymentrecord.getCostTypeKey())){ |
|
|
|
apPayBill.setF_PAEZ_AssistantKey("001"); |
|
|
|
}else { |
|
|
|
apPayBill.setF_PAEZ_AssistantKey(finPaymentrecord.getCostTypeKey()); |
|
|
|
} |
|
|
|
} |
|
|
|
if (StringUtils.isNotBlank(finPaymentrecord.getPayChannel())) { |
|
|
|
apPayBill.setF_PAEZ_AssistantKey(finPaymentrecord.getPayChannel()); |
|
|
|
apPayBill.setF_PAEZ_AssistantType("payChannel"); |
|
|
|
} |
|
|
|
|
|
|
|
List<ApPayBill.FPAYBILLENTRY> FPAYBILLENTRYs = new ArrayList<>(); |
|
|
|
if (finPaymentrecord.getCost() != null |
|
|
|
&& finPaymentrecord.getCost().compareTo(BigDecimal.ZERO) > 0) { |
|
|
@ -719,6 +738,325 @@ public class FinPaymentrecordService extends MybatisBaseService<FinPaymentrecord |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
public String selectBatchNum(String s) { |
|
|
|
return baseMapper.selectBatchNum(s); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public ResultBean batchUpdate(FinPaymentrecordUpdateDto dto) { |
|
|
|
ResultBean rb = ResultBean.fireFail(); |
|
|
|
List<String> sids = dto.getSids(); |
|
|
|
//判断选择的sids的付款申请的收款单位是否一致
|
|
|
|
List<String> applySids = baseMapper.selectApplySids(sids); |
|
|
|
if (applySids.size() > 1) { |
|
|
|
applySids = applySids.stream().distinct().collect(Collectors.toList()); |
|
|
|
if (applySids.size() > 1) { |
|
|
|
return rb.setMsg("批量处理的数据中存在收款账号不一致"); |
|
|
|
} |
|
|
|
} |
|
|
|
if (applySids.contains("")) { |
|
|
|
return rb.setMsg("处理的数据包含收款账号不存在的数据"); |
|
|
|
} |
|
|
|
//判断是否包含已作废的
|
|
|
|
List<String> sidState = baseMapper.selectApplySidBySid(sids); |
|
|
|
if (sidState.size() > 1) { |
|
|
|
if (sidState.contains(3)) { |
|
|
|
return rb.setMsg("处理的数据包含已作废的记录"); |
|
|
|
} |
|
|
|
if (sidState.contains(2)) { |
|
|
|
return rb.setMsg("处理的数据中包含已通过的记录"); |
|
|
|
} |
|
|
|
} |
|
|
|
//生成批量处理编号
|
|
|
|
String batchNumTemp = selectBatchNum(new SimpleDateFormat("yyMMdd").format(new Date())); |
|
|
|
if (StringUtils.isBlank(batchNumTemp)) { |
|
|
|
batchNumTemp = "0"; |
|
|
|
} |
|
|
|
int intValue = Integer.valueOf(batchNumTemp).intValue(); |
|
|
|
String batchNum = GetSerialNum.getNum(intValue); |
|
|
|
List<ApPayBill> apPayBills = new ArrayList<>(); |
|
|
|
List<Voucher> vouchers = new ArrayList<>(); |
|
|
|
for (int i = 0; i < sids.size(); i++) { |
|
|
|
FinPaymentrecord finPaymentrecord = fetchBySid(sids.get(i)); |
|
|
|
int finDataType = 0; //(0付款单,1凭证)
|
|
|
|
if (null != finPaymentrecord.getFinDataType()) { |
|
|
|
if (finPaymentrecord.getFinDataType().intValue() == 1) { |
|
|
|
finDataType = 1; |
|
|
|
} |
|
|
|
} else { |
|
|
|
finDataType = 1; |
|
|
|
} |
|
|
|
finPaymentrecord.setBatchNumber(batchNum); |
|
|
|
//到回款返利申请
|
|
|
|
if (finPaymentrecord.getIsPushHkfl() == 1) { |
|
|
|
ScmCollectionRebateDto scmCollectionRebateDto = new ScmCollectionRebateDto(); |
|
|
|
List<ScmCollectionRebateVehDto> scmCollectionRebateVehDtos = new ArrayList<>(); |
|
|
|
FinPaymentapply finPaymentapply = finPaymentapplyService.fetchBySid(finPaymentrecord.getApplySid()); |
|
|
|
FinPaymentapplyDetails finPaymentapplyDetails = finPaymentapplyDetailsService.fetchBySid(finPaymentrecord.getBusSid()); |
|
|
|
List<FinPaymentapplyVehicleVo> vehicleList = finPaymentapplyVehicleService.getVehicleList(finPaymentapply.getSid()); |
|
|
|
scmCollectionRebateDto.setPurchaseSystemSid(finPaymentrecord.getPurchaseSystemSid()); |
|
|
|
scmCollectionRebateDto.setPurchaseSystemName(finPaymentrecord.getPurchaseSystemName()); |
|
|
|
scmCollectionRebateDto.setCostTitleKey(finPaymentrecord.getCostTitleKey()); |
|
|
|
scmCollectionRebateDto.setCostTitleValue(finPaymentrecord.getCostTitleValue()); |
|
|
|
scmCollectionRebateDto.setBrandSid(finPaymentapply.getCarBrandSid()); |
|
|
|
scmCollectionRebateDto.setBrandName(finPaymentapply.getCarBrandName()); |
|
|
|
scmCollectionRebateDto.setCollectionTypeKey(dto.getPayWayKey()); |
|
|
|
scmCollectionRebateDto.setCollectionTypeValue(dto.getPayWayValue()); |
|
|
|
scmCollectionRebateDto.setManufaSaleChannel(""); |
|
|
|
scmCollectionRebateDto.setManufaSaleChannelValue(finPaymentapplyDetails.getActualPay()); |
|
|
|
scmCollectionRebateDto.setCollectionMoney(new BigDecimal(dto.getCost())); |
|
|
|
scmCollectionRebateDto.setCollectionDate(DateUtil.formatDate(dto.getPayDate())); |
|
|
|
SysOrganizationVo sysOrganizationVo = sysOrganizationFeign.fetchBySid(finPaymentrecord.getCreateOrgSid()).getData(); |
|
|
|
scmCollectionRebateDto.setCreateOrgSid(finPaymentrecord.getCreateOrgSid()); |
|
|
|
scmCollectionRebateDto.setCreateOrgName(sysOrganizationVo.getName()); |
|
|
|
scmCollectionRebateDto.setUseOrgSid(finPaymentrecord.getUseOrgSid()); |
|
|
|
scmCollectionRebateDto.setUseOrgName(sysOrganizationVo.getName()); |
|
|
|
scmCollectionRebateDto.setOrgPath(finPaymentapply.getOrgSidPath()); |
|
|
|
scmCollectionRebateDto.setCreateBySid(finPaymentrecord.getCreateBySid()); |
|
|
|
if (vehicleList != null && vehicleList.size() > 0) { |
|
|
|
for (FinPaymentapplyVehicleVo finPaymentapplyVehicleVo : vehicleList) { |
|
|
|
ScmCollectionRebateVehDto scmCollectionRebateVehDto = new ScmCollectionRebateVehDto(); |
|
|
|
BaseVehicleSelectVo baseVehicleSelectVo = baseVehicleFeign.details(finPaymentapplyVehicleVo.getVehiSid()).getData(); |
|
|
|
scmCollectionRebateVehDto.setCarModelSid(finPaymentapplyVehicleVo.getModelSid()); |
|
|
|
scmCollectionRebateVehDto.setCarModelName(finPaymentapplyVehicleVo.getModelName()); |
|
|
|
scmCollectionRebateVehDto.setPriceDate(DateUtil.format(baseVehicleSelectVo.getPriceDate(), "yyyy-MM-dd")); |
|
|
|
if (baseVehicleSelectVo.getSalesDate() != null) { |
|
|
|
scmCollectionRebateVehDto.setSalesDate(DateUtil.format(baseVehicleSelectVo.getSalesDate(), "yyyy-MM-dd")); |
|
|
|
} |
|
|
|
scmCollectionRebateVehDto.setVehSid(finPaymentapplyVehicleVo.getVehiSid()); |
|
|
|
scmCollectionRebateVehDto.setVinNo(finPaymentapplyVehicleVo.getVinNo()); |
|
|
|
scmCollectionRebateVehDto.setCostPrice(finPaymentapplyVehicleVo.getMoney()); |
|
|
|
scmCollectionRebateVehDtos.add(scmCollectionRebateVehDto); |
|
|
|
} |
|
|
|
} |
|
|
|
scmCollectionRebateDto.setScmCollectionRebateVehs(scmCollectionRebateVehDtos); |
|
|
|
scmCollectionRebateDto.setIsEnable(1); |
|
|
|
scmCollectionRebateFeign.save(scmCollectionRebateDto); |
|
|
|
} |
|
|
|
//更新还款计划表垫款金额和逾期利息
|
|
|
|
if ("007".equals(finPaymentrecord.getCostTypeKey())) { |
|
|
|
List<LoanBePadsincereVehDetailsVo> loanBePadsincereVehDetailsVos = loanBePadsincereVehFeign.selByBankCont(finPaymentrecord.getApplySid(), finPaymentrecord.getBusSid()).getData(); |
|
|
|
for (LoanBePadsincereVehDetailsVo loanBePadsincereVehDetailsVo : loanBePadsincereVehDetailsVos) { |
|
|
|
LoanRepaymentPlanMoneyVo loanRepaymentPlanMoneyVo = loanRepaymentPlanDetailsFeign.selVehSidAndPeriod(loanBePadsincereVehDetailsVo.getBusVinSid(), loanBePadsincereVehDetailsVo.getPeriod(), loanBePadsincereVehDetailsVo.getBankContractNo()).getData(); |
|
|
|
LoanRepaymentPlanDetails planDetails = loanRepaymentPlanDetailsFeign.fetchDetails(loanRepaymentPlanMoneyVo.getSid()).getData(); |
|
|
|
String paymentMoney = loanRepaymentPlanMoneyVo.getPaymentMoney().add(new BigDecimal(loanBePadsincereVehDetailsVo.getPadMoney())).toString(); |
|
|
|
String paymentInterest = loanRepaymentPlanMoneyVo.getPaymentInterest().add(new BigDecimal(loanBePadsincereVehDetailsVo.getBankBeInter())).toString(); |
|
|
|
loanRepaymentPlanDetailsFeign.updateSidAndPeriod(loanRepaymentPlanMoneyVo.getSid(), loanBePadsincereVehDetailsVo.getPeriod(), paymentMoney, paymentInterest); |
|
|
|
//推送金融应收
|
|
|
|
FinUncollectedReceivablesDetailedJR jr = new FinUncollectedReceivablesDetailedJR(); |
|
|
|
jr.setCreateBySid(finPaymentrecord.getCreateBySid()); |
|
|
|
SysUserVo userVo = sysUserFeign.fetchBySid(finPaymentrecord.getCreateBySid()).getData(); |
|
|
|
jr.setCreateByName(userVo.getName()); |
|
|
|
jr.setBusSid(planDetails.getSid()); |
|
|
|
jr.setApplySid(finPaymentrecord.getApplySid()); |
|
|
|
jr.setCurrentReceivableMoney(new BigDecimal(paymentInterest)); |
|
|
|
jr.setReveivableMoney(new BigDecimal(paymentInterest)); |
|
|
|
jr.setPayCostTitleKey("005"); |
|
|
|
jr.setPayCostTitleValue("资方逾期利息"); |
|
|
|
jr.setOrgSidPath(planDetails.getOrgSidPath()); |
|
|
|
jr.setUseOrgName(planDetails.getUseOrgName()); |
|
|
|
jr.setUseOrgSid(planDetails.getUseOrgSid()); |
|
|
|
jr.setStaffDeptName(planDetails.getDept()); |
|
|
|
jr.setStaffName(planDetails.getStaffName()); |
|
|
|
jr.setStaffDeptSid(planDetails.getDeptSid()); |
|
|
|
jr.setStaffUserSid(planDetails.getSalesUserSid()); |
|
|
|
finUncollectedReceivablesDetailedJRService.insert(jr); |
|
|
|
} |
|
|
|
} |
|
|
|
FinPaymentrecord finPaymentrecordOne = null; |
|
|
|
if (new BigDecimal(dto.getCost()).compareTo(finPaymentrecord.getAccountsReceive()) < 0) {//实收金额小于应收金额
|
|
|
|
finPaymentrecordOne = new FinPaymentrecord(); |
|
|
|
BeanUtil.copyProperties(finPaymentrecord, finPaymentrecordOne, "sid"); |
|
|
|
finPaymentrecordOne.setAccountsReceive(finPaymentrecord.getAccountsReceive().subtract(new BigDecimal(dto.getCost()))); |
|
|
|
finPaymentrecordOne.setCost(finPaymentrecordOne.getAccountsReceive()); |
|
|
|
} |
|
|
|
BeanUtil.copyProperties(dto, finPaymentrecord, "sid"); |
|
|
|
List<String> payFiles = dto.getPayFiles(); |
|
|
|
if (payFiles.size() > 0) { |
|
|
|
String payFile = payFiles.stream().map(v -> v.replace(fileUploadComponent.getUrlPrefix(), "")).collect(Collectors.joining(",")); |
|
|
|
finPaymentrecord.setPayFile(payFile); |
|
|
|
} |
|
|
|
baseMapper.updateById(finPaymentrecord); |
|
|
|
//更新付款申请中的状态
|
|
|
|
FinPaymentapply finPaymentapply = finPaymentapplyService.fetchBySid(finPaymentrecord.getApplySid()); |
|
|
|
if (finPaymentapply != null) { |
|
|
|
finPaymentapplyService.updateStateBySid(finPaymentrecord.getApplySid(), 2); |
|
|
|
baseMapper.updateStateBySid(finPaymentrecord.getSid(), 2); |
|
|
|
} else { |
|
|
|
baseMapper.updateStateBySid(finPaymentrecord.getSid(), 2); |
|
|
|
//更新厂家认款状态
|
|
|
|
BaseManufUpdateDto baseManufUpdateDto = new BaseManufUpdateDto(); |
|
|
|
baseManufUpdateDto.setSid(finPaymentrecord.getBusSid()); |
|
|
|
baseManufUpdateDto.setState("1"); |
|
|
|
ResultBean resultBean = baseManufactorSubscriptionFeign.updatePaymentState(baseManufUpdateDto); |
|
|
|
} |
|
|
|
if (finPaymentrecordOne != null) { |
|
|
|
baseMapper.insert(finPaymentrecordOne); |
|
|
|
} |
|
|
|
//推送金蝶付款单
|
|
|
|
if (finDataType == 0) { |
|
|
|
try { |
|
|
|
ApPayBill apb = createApPayBill(finPaymentrecord); |
|
|
|
apPayBills.add(apb); |
|
|
|
} catch (Exception e) { |
|
|
|
log.error(e.getMessage()); |
|
|
|
} |
|
|
|
} |
|
|
|
String costTypeKey = finPaymentrecord.getCostTypeKey(); |
|
|
|
try { |
|
|
|
ThreadFactory namedThreadFactory = new ThreadFactoryBuilder() |
|
|
|
.setNameFormat("demo-pool-%d").build(); |
|
|
|
ExecutorService pool = new ThreadPoolExecutor(1, 10, |
|
|
|
1000, TimeUnit.MILLISECONDS, |
|
|
|
new LinkedBlockingQueue<Runnable>(1024), namedThreadFactory, new ThreadPoolExecutor.AbortPolicy()); |
|
|
|
int finalI = i; |
|
|
|
if ("005".equals(costTypeKey)) { |
|
|
|
Future future6 = pool.submit(() -> { |
|
|
|
List<String> recipientSidList = new ArrayList<>(); |
|
|
|
BusVehicleApplyDetailsVo busVehicleApplyDetailsVo = busVehicleApplyFeign.fetchSid(finPaymentrecord.getApplySid()).getData(); |
|
|
|
String createBySid = busVehicleApplyDetailsVo.getCreateBySid(); |
|
|
|
recipientSidList.add(createBySid); |
|
|
|
PushMessageQuery pushMessageQuery = new PushMessageQuery(); |
|
|
|
pushMessageQuery.setReceivedSids(recipientSidList); |
|
|
|
pushMessageQuery.setModuleName("财务管理"); |
|
|
|
pushMessageQuery.setMsgContent("您的付款申请已确认通过"); |
|
|
|
pushMessageQuery.setApp_type("2"); |
|
|
|
pushMessageQuery.setModuleSid("98ff0724-5df4-4fc7-ab6d-3996e7706acd"); |
|
|
|
pushMessageQuery.setMsgTitle("付款确认通知"); |
|
|
|
pushMessageQuery.setBusinessSid(sids.get(finalI)); |
|
|
|
// 消息推送
|
|
|
|
messageFeign.pushNoUriMessage(pushMessageQuery); |
|
|
|
}); |
|
|
|
} else if ("002".equals(costTypeKey)) { |
|
|
|
Future future6 = pool.submit(() -> { |
|
|
|
List<String> recipientSidList = new ArrayList<>(); |
|
|
|
BaseOutsourcingApplicationDetailsVo baseOutsourcingApplicationDetailsVo = baseOutsourcingApplicationFeign.fetchBySid(finPaymentrecord.getApplySid()).getData(); |
|
|
|
String createBySid = baseOutsourcingApplicationDetailsVo.getCreateBySid(); |
|
|
|
recipientSidList.add(createBySid); |
|
|
|
PushMessageQuery pushMessageQuery = new PushMessageQuery(); |
|
|
|
pushMessageQuery.setReceivedSids(recipientSidList); |
|
|
|
pushMessageQuery.setModuleName("财务管理"); |
|
|
|
pushMessageQuery.setMsgContent("您的付款申请已确认通过"); |
|
|
|
pushMessageQuery.setApp_type("2"); |
|
|
|
pushMessageQuery.setModuleSid("98ff0724-5df4-4fc7-ab6d-3996e7706acd"); |
|
|
|
pushMessageQuery.setMsgTitle("付款确认通知"); |
|
|
|
pushMessageQuery.setBusinessSid(sids.get(finalI)); |
|
|
|
// 消息推送
|
|
|
|
messageFeign.pushNoUriMessage(pushMessageQuery); |
|
|
|
}); |
|
|
|
} else if ("006".equals(costTypeKey)) { |
|
|
|
//推送转付记录
|
|
|
|
Future future1 = pool.submit(() -> { |
|
|
|
loanTransferPaymentApplyFeign.pushPaymentRecord(finPaymentrecord.getBusSid(), finPaymentrecord.getSid()); |
|
|
|
}); |
|
|
|
Future future2 = pool.submit(() -> { |
|
|
|
RskVoucher voucher = loanTransferPaymentApplyFeign.pushPaymentVoucherReturnVoucher(finPaymentrecord.getBusSid(), finPaymentrecord.getSid()).getData(); |
|
|
|
if (null != voucher) { |
|
|
|
Voucher v = new Voucher(); |
|
|
|
BeanUtil.copyProperties(voucher, v); |
|
|
|
vouchers.add(v); |
|
|
|
} |
|
|
|
}); |
|
|
|
} else if ("007".equals(costTypeKey)) { |
|
|
|
Future future1 = pool.submit(() -> { |
|
|
|
RskVoucher voucher = loanBePadsincereApplyFeign.pushAdvancesReturnVoucher(finPaymentrecord.getApplySid(), finPaymentrecord.getSid()).getData(); |
|
|
|
if (null != voucher) { |
|
|
|
Voucher v = new Voucher(); |
|
|
|
BeanUtil.copyProperties(voucher, v); |
|
|
|
vouchers.add(v); |
|
|
|
} |
|
|
|
}); |
|
|
|
} else if ("008".equals(costTypeKey) || "资方结清款".equals(finPaymentrecord.getCostTypeValue())) { |
|
|
|
if (StringUtils.isNotBlank(finPaymentrecord.getPayBankAccount())) { |
|
|
|
String shouxufei = "0"; |
|
|
|
if (null != finPaymentrecord.getPaymentCharges()) { |
|
|
|
shouxufei = finPaymentrecord.getPaymentCharges().toString(); |
|
|
|
} |
|
|
|
String accountNumber = finPaymentrecord.getPayBankAccount(); |
|
|
|
String payTypeCode = ""; |
|
|
|
FinManufacturerBank manufacturerBank = finManufacturerBankService.selOneByBankNo(accountNumber, finPaymentrecord.getUseOrgSid()).getData(); |
|
|
|
if (null != manufacturerBank) { |
|
|
|
payTypeCode = manufacturerBank.getDueBankKey(); |
|
|
|
} |
|
|
|
RskVoucher voucher = loanSettleApplyFeign.pushBankReturnVoucher(finPaymentrecord.getBusSid(), accountNumber, payTypeCode, shouxufei).getData(); |
|
|
|
if (null != voucher) { |
|
|
|
Voucher v = new Voucher(); |
|
|
|
BeanUtil.copyProperties(voucher, v); |
|
|
|
vouchers.add(v); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} catch (Exception e) { |
|
|
|
e.printStackTrace(); |
|
|
|
log.error("推送数据失败=========================" + e.getMessage()); |
|
|
|
return rb.setMsg("推送数据失败"); |
|
|
|
} |
|
|
|
} |
|
|
|
try { |
|
|
|
ThreadFactory namedThreadFactory = new ThreadFactoryBuilder() |
|
|
|
.setNameFormat("demo-pool-%d").build(); |
|
|
|
ExecutorService pool = new ThreadPoolExecutor(1, 10, |
|
|
|
1000, TimeUnit.MILLISECONDS, |
|
|
|
new LinkedBlockingQueue<Runnable>(1024), namedThreadFactory, new ThreadPoolExecutor.AbortPolicy()); |
|
|
|
Future future = pool.submit(() -> { |
|
|
|
if (!apPayBills.isEmpty()) { |
|
|
|
ApPayBill apPayBill = buildBatchApPayBill(apPayBills); |
|
|
|
ResultBean resultBean1 = apPayBillService.draftApPayBill(apPayBill); |
|
|
|
} |
|
|
|
if (!vouchers.isEmpty()) { |
|
|
|
Voucher voucher = buildBatchVoucher(vouchers); |
|
|
|
log.info("FinKingDeeFeignRest-saveVoucher:{}", JSONObject.toJSONString(voucher)); |
|
|
|
voucherService.saveVoucher(voucher); |
|
|
|
} |
|
|
|
}); |
|
|
|
} catch (Exception e) { |
|
|
|
e.printStackTrace(); |
|
|
|
log.error("推送数据失败=========================" + e.getMessage()); |
|
|
|
return rb.setMsg("推送数据失败"); |
|
|
|
} |
|
|
|
return rb.success(); |
|
|
|
} |
|
|
|
|
|
|
|
private Voucher pushPaymentVoucherReturnVoucher(String busSid, String sid) { |
|
|
|
|
|
|
|
return null; |
|
|
|
} |
|
|
|
|
|
|
|
public ApPayBill buildBatchApPayBill(List<ApPayBill> list) { |
|
|
|
ApPayBill apPayBill = new ApPayBill(); |
|
|
|
List<ApPayBill.FPAYBILLENTRY> FPAYBILLENTRY = new ArrayList<>(); |
|
|
|
ApPayBill payBill = list.get(0); |
|
|
|
BeanUtil.copyProperties(payBill, apPayBill); |
|
|
|
for (ApPayBill bill : list) { |
|
|
|
List<ApPayBill.FPAYBILLENTRY> fpaybillentry = bill.getFPAYBILLENTRY(); |
|
|
|
if (!fpaybillentry.isEmpty()) { |
|
|
|
for (ApPayBill.FPAYBILLENTRY f : fpaybillentry) { |
|
|
|
FPAYBILLENTRY.add(f); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
apPayBill.setFPAYBILLENTRY(FPAYBILLENTRY); |
|
|
|
return apPayBill; |
|
|
|
} |
|
|
|
|
|
|
|
public Voucher buildBatchVoucher(List<Voucher> list) { |
|
|
|
Voucher newVoucher = new Voucher(); |
|
|
|
List<Voucher.VoucherResultDetailDto> resultDetails = new ArrayList<>(); |
|
|
|
Voucher voucher = list.get(0); |
|
|
|
BeanUtil.copyProperties(voucher, newVoucher); |
|
|
|
for (Voucher v : list) { |
|
|
|
List<Voucher.VoucherResultDetailDto> result = v.getResultDetails(); |
|
|
|
if (!result.isEmpty()) { |
|
|
|
for (Voucher.VoucherResultDetailDto r : result) { |
|
|
|
resultDetails.add(r); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
newVoucher.setResultDetails(resultDetails); |
|
|
|
return newVoucher; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
* 作废 |
|
|
|
* |
|
|
@ -990,7 +1328,7 @@ public class FinPaymentrecordService extends MybatisBaseService<FinPaymentrecord |
|
|
|
finPaymentrecordSourceLCVos.sort(comparing(FinPaymentrecordSourceLCVo::getSpsj)); |
|
|
|
dataMap.put("lcList", finPaymentrecordSourceLCVos); |
|
|
|
} |
|
|
|
dataMap.put("payCode", String.valueOf (finPaymentrecord.getId())); |
|
|
|
dataMap.put("payCode", String.valueOf(finPaymentrecord.getId())); |
|
|
|
dataMap.put("createTime", DateUtil.format(finPaymentrecord.getCreateTime(), "yyyy-MM-dd")); |
|
|
|
dataMap.put("createByName", createByName); |
|
|
|
dataMap.put("createByDeptName", deptName); |
|
|
@ -1022,7 +1360,7 @@ public class FinPaymentrecordService extends MybatisBaseService<FinPaymentrecord |
|
|
|
} else if (finPaymentapply != null) { |
|
|
|
dataMap.put("remarks", finPaymentapply.getCostTypeValue() + "," + finPaymentrecord.getCostTitleValue() + "," + finPaymentapply.getRemarks()); |
|
|
|
FinPaymentapplyDetails finPaymentapplyDetails = finPaymentapplyDetailsService.fetchBySid(finPaymentrecord.getBusSid()); |
|
|
|
if ("1".equals(finPaymentapply.getIsVeh())){ |
|
|
|
if ("1".equals(finPaymentapply.getIsVeh())) { |
|
|
|
List<FinPaymentapplyVehicleVo> vehicleList = finPaymentapplyVehicleService.getVehicleList(finPaymentapply.getSid()); |
|
|
|
String payRemark = ""; |
|
|
|
for (FinPaymentapplyVehicleVo finPaymentapplyVehicleVo : vehicleList) { |
|
|
|