|
|
@ -52,6 +52,7 @@ import com.yxt.anrui.base.common.enums.DictCommonEnum; |
|
|
|
import com.yxt.anrui.fin.api.finmanufacturerbank.FinManufacturerBank; |
|
|
|
import com.yxt.anrui.fin.api.finpaymentapply.FinPaymentapply; |
|
|
|
import com.yxt.anrui.fin.api.finpaymentapplydetails.FinPaymentapplyDetails; |
|
|
|
import com.yxt.anrui.fin.api.finpaymentapplydetailsbelow.FinPaymentapplyDetailsBelow; |
|
|
|
import com.yxt.anrui.fin.api.finpaymentapplydetailsbeloweve.FinPaymentapplyDetailsBelowEve; |
|
|
|
import com.yxt.anrui.fin.api.finpaymentapplyvehicle.FinPaymentapplyVehicleVo; |
|
|
|
import com.yxt.anrui.fin.api.finpaymentrecord.*; |
|
|
@ -62,6 +63,7 @@ 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.finpaymentapplydetailsbelow.FinPaymentapplyDetailsBelowService; |
|
|
|
import com.yxt.anrui.fin.biz.finpaymentapplydetailsbeloweve.FinPaymentapplyDetailsBelowEveService; |
|
|
|
import com.yxt.anrui.fin.biz.finpaymentapplyvehicle.FinPaymentapplyVehicleService; |
|
|
|
import com.yxt.anrui.fin.biz.finuncollectedreceivablesdetailedjr.FinUncollectedReceivablesDetailedJRService; |
|
|
@ -189,6 +191,8 @@ public class FinPaymentrecordService extends MybatisBaseService<FinPaymentrecord |
|
|
|
@Autowired |
|
|
|
private DictCommonFeign dictCommonFeign; |
|
|
|
@Autowired |
|
|
|
private FinPaymentapplyDetailsBelowService finPaymentapplyDetailsBelowService; |
|
|
|
@Autowired |
|
|
|
private FinPaymentapplyDetailsBelowEveService finPaymentapplyDetailsBelowEveService; |
|
|
|
|
|
|
|
public PagerVo<FinPaymentrecordVo> listPageVo(PagerQuery<FinPaymentrecordQuery> pq) { |
|
|
@ -614,6 +618,9 @@ public class FinPaymentrecordService extends MybatisBaseService<FinPaymentrecord |
|
|
|
} |
|
|
|
loanSettleApplyFeign.pushBankVoucher(finPaymentrecord.getBusSid(), accountNumber, payTypeCode, shouxufei); |
|
|
|
} |
|
|
|
} else if (StringUtils.isBlank(costTypeKey) || "015".equals(costTypeKey) || "016".equals(costTypeKey) || "017".equals(costTypeKey)) { |
|
|
|
Voucher voucher = pushVoucher(finPaymentrecord.getSid()); |
|
|
|
voucherService.saveVoucher(voucher); |
|
|
|
} |
|
|
|
} catch (Exception e) { |
|
|
|
e.printStackTrace(); |
|
|
@ -983,6 +990,11 @@ public class FinPaymentrecordService extends MybatisBaseService<FinPaymentrecord |
|
|
|
vouchers.add(v); |
|
|
|
} |
|
|
|
} |
|
|
|
} else if (StringUtils.isBlank(costTypeKey) || "015".equals(costTypeKey) || "016".equals(costTypeKey) || "017".equals(costTypeKey)) { |
|
|
|
Voucher voucher = pushVoucher(finPaymentrecord.getSid()); |
|
|
|
if (null != voucher) { |
|
|
|
vouchers.add(voucher); |
|
|
|
} |
|
|
|
} |
|
|
|
} catch (Exception e) { |
|
|
|
e.printStackTrace(); |
|
|
@ -1625,7 +1637,7 @@ public class FinPaymentrecordService extends MybatisBaseService<FinPaymentrecord |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void pushVoucher(String sid) { |
|
|
|
public Voucher pushVoucher(String sid) { |
|
|
|
Voucher voucher = new Voucher(); |
|
|
|
FinPaymentrecord finPaymentrecord = fetchBySid(sid); |
|
|
|
SysOrganizationVo organizationVo = sysOrganizationFeign.fetchBySid(finPaymentrecord.getUseOrgSid()).getData(); |
|
|
@ -1675,25 +1687,57 @@ public class FinPaymentrecordService extends MybatisBaseService<FinPaymentrecord |
|
|
|
voucherResultDetailDto.setBankAccount(finPaymentrecord.getPayBankAccount()); |
|
|
|
voucherResultDetailDto.setCredit(finPaymentrecord.getCost().toString()); |
|
|
|
voucherResultDetailDtos.add(voucherResultDetailDto); |
|
|
|
}else if (StringUtils.isBlank(finPaymentrecord.getCostTitleKey())){//平仓款
|
|
|
|
//借方
|
|
|
|
} else if (StringUtils.isBlank(finPaymentrecord.getCostTitleKey())) {//平仓款
|
|
|
|
//查询平仓总付款金额
|
|
|
|
FinPaymentapplyDetailsBelowEve finPaymentapplyDetailsBelowEve = finPaymentapplyDetailsBelowEveService.fetchBySid(finPaymentrecord.getBusSid()); |
|
|
|
voucherResultDetailDto.setSummary("还" + finPaymentrecord.getCostTitleValue() + finPaymentapplyDetailsBelowEve.getExePayDate()); |
|
|
|
voucherResultDetailDto.setSubjectNo("1009.03"); |
|
|
|
SysOrganizationVo deptVo = sysOrganizationFeign.fetchBySid(finPaymentrecord.getPurchaseSystemSid()).getData(); |
|
|
|
voucherResultDetailDto.setDimensionDept(deptVo.getOrgCode()); |
|
|
|
String key = dictCommonFeign.selectByValue(finPaymentrecord.getReceiveBank()).getData(); |
|
|
|
voucherResultDetailDto.setBank(key); |
|
|
|
voucherResultDetailDto.setDebit(finPaymentrecord.getCost().toString()); |
|
|
|
voucherResultDetailDtos.add(voucherResultDetailDto); |
|
|
|
//贷方
|
|
|
|
voucherResultDetailDto.setSummary("还" + finPaymentrecord.getCostTitleValue() + finPaymentapplyDetailsBelowEve.getExePayDate()); |
|
|
|
voucherResultDetailDto.setSubjectNo("1002.01.00"); |
|
|
|
voucherResultDetailDto.setBankAccount(finPaymentrecord.getPayBankAccount()); |
|
|
|
voucherResultDetailDto.setCredit(finPaymentrecord.getCost().toString()); |
|
|
|
voucherResultDetailDtos.add(voucherResultDetailDto); |
|
|
|
BigDecimal exePayPriceTotal = finPaymentapplyDetailsBelowEveService.selExePayByMainSid(finPaymentapplyDetailsBelowEve.getDetailSid()); |
|
|
|
//查询保证金
|
|
|
|
FinPaymentapplyDetailsBelow finPaymentapplyDetailsBelow = finPaymentapplyDetailsBelowService.fetchBySid(finPaymentapplyDetailsBelowEve.getDetailSid()); |
|
|
|
BigDecimal payAccount = finPaymentapplyDetailsBelow.getPayAccount(); |
|
|
|
//查询已付款平仓款金额
|
|
|
|
BigDecimal payPriceTotal = baseMapper.selPayPrice(finPaymentrecord.getApplySid()); |
|
|
|
if (payPriceTotal.add(finPaymentrecord.getCost()).compareTo(exePayPriceTotal) == -1) { |
|
|
|
//借方
|
|
|
|
voucherResultDetailDto.setSummary("还" + finPaymentrecord.getCostTitleValue() + finPaymentapplyDetailsBelowEve.getExePayDate()); |
|
|
|
voucherResultDetailDto.setSubjectNo("1009.03"); |
|
|
|
SysOrganizationVo deptVo = sysOrganizationFeign.fetchBySid(finPaymentrecord.getPurchaseSystemSid()).getData(); |
|
|
|
voucherResultDetailDto.setDimensionDept(deptVo.getOrgCode()); |
|
|
|
String key = dictCommonFeign.selectByValue(finPaymentrecord.getReceiveBank()).getData(); |
|
|
|
voucherResultDetailDto.setBank(key); |
|
|
|
voucherResultDetailDto.setDebit(finPaymentrecord.getCost().toString()); |
|
|
|
voucherResultDetailDtos.add(voucherResultDetailDto); |
|
|
|
//贷方
|
|
|
|
voucherResultDetailDto.setSummary("还" + finPaymentrecord.getCostTitleValue() + finPaymentapplyDetailsBelowEve.getExePayDate()); |
|
|
|
voucherResultDetailDto.setSubjectNo("1002.01.00"); |
|
|
|
voucherResultDetailDto.setBankAccount(finPaymentrecord.getPayBankAccount()); |
|
|
|
voucherResultDetailDto.setCredit(finPaymentrecord.getCost().toString()); |
|
|
|
voucherResultDetailDtos.add(voucherResultDetailDto); |
|
|
|
} else { |
|
|
|
//借方
|
|
|
|
voucherResultDetailDto.setSummary("还" + finPaymentrecord.getCostTitleValue() + finPaymentapplyDetailsBelowEve.getExePayDate()); |
|
|
|
voucherResultDetailDto.setSubjectNo("2111"); |
|
|
|
SysOrganizationVo deptVo = sysOrganizationFeign.fetchBySid(finPaymentrecord.getPurchaseSystemSid()).getData(); |
|
|
|
voucherResultDetailDto.setDimensionDept(deptVo.getOrgCode()); |
|
|
|
String key = dictCommonFeign.selectByValue(finPaymentrecord.getReceiveBank()).getData(); |
|
|
|
voucherResultDetailDto.setBank(key); |
|
|
|
voucherResultDetailDto.setDebit(exePayPriceTotal.add(payAccount).toString()); |
|
|
|
voucherResultDetailDtos.add(voucherResultDetailDto); |
|
|
|
//贷方1
|
|
|
|
voucherResultDetailDto.setSummary("还" + finPaymentrecord.getCostTitleValue() + finPaymentapplyDetailsBelowEve.getExePayDate()); |
|
|
|
voucherResultDetailDto.setSubjectNo("1009.03"); |
|
|
|
voucherResultDetailDto.setDimensionDept(deptVo.getOrgCode()); |
|
|
|
voucherResultDetailDto.setBank(key); |
|
|
|
voucherResultDetailDto.setCredit(payPriceTotal.add(payAccount).subtract(finPaymentrecord.getCost()).toString()); |
|
|
|
voucherResultDetailDtos.add(voucherResultDetailDto); |
|
|
|
//贷方2
|
|
|
|
voucherResultDetailDto.setSummary("还" + finPaymentrecord.getCostTitleValue() + finPaymentapplyDetailsBelowEve.getExePayDate()); |
|
|
|
voucherResultDetailDto.setSubjectNo("1002.01.00"); |
|
|
|
voucherResultDetailDto.setBankAccount(finPaymentrecord.getPayBankAccount()); |
|
|
|
voucherResultDetailDto.setCredit(finPaymentrecord.getCost().toString()); |
|
|
|
voucherResultDetailDtos.add(voucherResultDetailDto); |
|
|
|
} |
|
|
|
} |
|
|
|
voucher.setResultDetails(voucherResultDetailDtos); |
|
|
|
finKingDeeFeign.saveVoucher(voucher); |
|
|
|
return voucher; |
|
|
|
} |
|
|
|
} |
|
|
|