|
|
@ -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) { |
|
|
@ -1676,22 +1680,54 @@ public class FinPaymentrecordService extends MybatisBaseService<FinPaymentrecord |
|
|
|
voucherResultDetailDto.setCredit(finPaymentrecord.getCost().toString()); |
|
|
|
voucherResultDetailDtos.add(voucherResultDetailDto); |
|
|
|
}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); |
|
|
|