Browse Source

优化资金占用费计提查询

master
fanzongzhe 8 months ago
parent
commit
a27be7ac49
  1. 1
      anrui-fin/anrui-fin-api/src/main/java/com/yxt/anrui/fin/api/kingdee/voucher/SceneCodeEnum.java
  2. 8
      anrui-fin/anrui-fin-biz/src/main/java/com/yxt/anrui/fin/biz/kingdee/FinKingDeeFeignRest.java
  3. 105
      anrui-riskcenter/anrui-riskcenter-biz/src/main/java/com/yxt/anrui/riskcenter/biz/loanbuckleapply/LoanBuckleApplyService.java
  4. 15
      anrui-riskcenter/anrui-riskcenter-biz/src/main/java/com/yxt/anrui/riskcenter/biz/loanpushfundhistory/LoanPushFundHistoryMapper.xml
  5. 26
      anrui-riskcenter/anrui-riskcenter-biz/src/main/java/com/yxt/anrui/riskcenter/biz/loanpushfundhistory/LoanPushFundHistoryService.java

1
anrui-fin/anrui-fin-api/src/main/java/com/yxt/anrui/fin/api/kingdee/voucher/SceneCodeEnum.java

@ -11,6 +11,7 @@ public enum SceneCodeEnum {
BUCKLE_VOUCHER1("月还划扣凭证", "划扣申请通过-正常月还", "01"),
BUCKLE_VOUCHER2("月还划扣凭证", "划扣申请通过-逾期未垫款", "02"),
BUCKLE_VOUCHER3("月还划扣凭证", "划扣申请通过-逾期已垫款(中车类)", "03"),
BUCKLE_VOUCHER4("月还划扣凭证", "出纳收款确认后-未到期的月还", "15"),
INDIRECT_VOUCHER1("间还月还收款凭证", "间还出纳确认后-未逾期", "04"),
INDIRECT_VOUCHER3("间还月还收款凭证", "出纳收款确认后-未到期的月还", "14"),
INDIRECT_VOUCHER2("间还月还收款凭证", "间还出纳确认后-已逾期/资方逾期利息", "05"),

8
anrui-fin/anrui-fin-biz/src/main/java/com/yxt/anrui/fin/biz/kingdee/FinKingDeeFeignRest.java

@ -481,6 +481,14 @@ public class FinKingDeeFeignRest implements FinKingDeeFeign {
dto1.setSubjectNo("1133.10.20");
dto2.setSubjectNo("1201.02.03");
}
if (voucherDetail.getSceneCode().equals(SceneCodeEnum.BUCKLE_VOUCHER4.getCode())) {
//未到期月还
DictCommonVo dictCommonVo = dictCommonFeign.selectBykey(voucherDetail.getBankName(), "investorsCode").getData();
if (null != dictCommonVo) {
dto1.setSubjectNo(dictCommonVo.getDictValue());
}
dto2.setSubjectNo("1201.01.00");
}
dto1.setDimensionDept(voucherDetail.getDeptCode());
dto1.setDimensionCustom(voucherDetail.getCustomerCode());
dto2.setDimensionDept(voucherDetail.getDeptCode());

105
anrui-riskcenter/anrui-riskcenter-biz/src/main/java/com/yxt/anrui/riskcenter/biz/loanbuckleapply/LoanBuckleApplyService.java

@ -21,6 +21,7 @@ import com.yxt.anrui.buscenter.api.bussalesordervehicle.BusSalesOrderVehicleFeig
import com.yxt.anrui.fin.api.kingdee.FinKingDeeFeign;
import com.yxt.anrui.fin.api.kingdee.bdcustomer.BdCustomer;
import com.yxt.anrui.fin.api.kingdee.voucher.GeneralVoucher;
import com.yxt.anrui.fin.api.kingdee.voucher.SceneCodeEnum;
import com.yxt.anrui.flowable.api.flow.FlowableFeign;
import com.yxt.anrui.flowable.api.flow.UpdateFlowFieldVo;
import com.yxt.anrui.flowable.api.flow2.FlowDelegateQuery;
@ -81,6 +82,9 @@ import java.io.File;
import java.io.InputStream;
import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.time.LocalDate;
import java.time.ZoneId;
import java.time.format.DateTimeFormatter;
import java.util.*;
import java.util.concurrent.*;
import java.util.stream.Collectors;
@ -768,93 +772,6 @@ public class LoanBuckleApplyService extends MybatisBaseService<LoanBuckleApplyMa
int i = loanRepaymentPlanDetailsService.updateOweState(planSids);
}
}
// List<LoanBuckleApplyRecord> records = loanBuckleApplyRecordService.selByMainSid(businessSid);
// if (!records.isEmpty()) {
// List<String> planSids = new ArrayList<>();
// List<String> finalPlanSids = new ArrayList<>();
// records.stream().forEach(r -> {
// planSids.add(r.getRepaymentHistorySid());
// });
// if (!planSids.isEmpty()) {
// List<LoanPlanDetailsVoForLateVoucher> vouchers = loanRepaymentPlanDetailsService.selPushLaterVoucherOnBuckle(planSids);
// if (!vouchers.isEmpty()) {
// GeneralVoucher generalVoucher = new GeneralVoucher();
// List<GeneralVoucher.GeneralVoucherDetail> voucherDetails = new ArrayList<>();
// for (LoanPlanDetailsVoForLateVoucher planDetails : vouchers) {
// finalPlanSids.add(planDetails.getPlanSid());
// GeneralVoucher.GeneralVoucherDetail voucherDetail = new GeneralVoucher.GeneralVoucherDetail();
// if (StringUtils.isNotBlank(planDetails.getUseOrgSid())) {
// String useOrgSid = planDetails.getUseOrgSid();
// SysOrganizationVo organizationVo = sysOrganizationFeign.fetchBySid(useOrgSid).getData();
// if (null != organizationVo) {
// generalVoucher.setUseOrgCode(organizationVo.getOrgCode());
// }
// }
// if (StringUtils.isNotBlank(planDetails.getScheduleSid())) {
// LoanRepaymentSchedule repaymentSchedule = loanRepaymentScheduleService.fetchBySid(planDetails.getScheduleSid());
// if (null != repaymentSchedule) {
// if (StringUtils.isNotBlank(repaymentSchedule.getCwDeptNo())) {
// voucherDetail.setDeptCode(repaymentSchedule.getCwDeptNo());
// }
// }
// }
// BusSalesOrderVehicle busSalesOrderVehicle = busSalesOrderVehicleFeign.details(planDetails.getBusVinSid()).getData();
// BusSalesOrder salesOrder = busSalesOrderFeign.fetchBySid(planDetails.getSalesOrderSid()).getData();
// if (null != salesOrder) {
// if (null != busSalesOrderVehicle) {
// String customerNumber = "";
// //判断财务系统是否有客户
// Boolean aBoolean = finKingDeeFeign.customerExistState(busSalesOrderVehicle.getTemporaryNo()).getData();
// String linkNo = "";
// BusSalesOrderBorrowerDetailsVo borrowerDetailsVo = busSalesOrderBorrowerFeign.fetchDetailsBySid(busSalesOrderVehicle.getBorrowerSid()).getData();
// if (!aBoolean) {
// // List<BdCustomer> bdCustomers = new ArrayList<>();
// BdCustomer bdCustomer = new BdCustomer();
// bdCustomer.setFNumber(busSalesOrderVehicle.getTemporaryNo());
// bdCustomer.setFShortName(salesOrder.getContractNo());
// BasePurchaseSystemDetailsVo data = basePurchaseSystemFeign.fetchDetailsByDeptSid(salesOrder.getPurchaseSystemSid()).getData();
// bdCustomer.setTOrgIds(data.getOrgCode());
// if (org.apache.commons.lang3.StringUtils.isNotBlank(busSalesOrderVehicle.getLinkNo())) {
// String vinNo = busSalesOrderVehicle.getLinkNo();
// if (vinNo.length() > 8) {
// linkNo = vinNo.substring(vinNo.length() - 8);
// } else {
// linkNo = busSalesOrderVehicle.getLinkNo();
// }
// if (null != borrowerDetailsVo) {
// bdCustomer.setFName(borrowerDetailsVo.getBorrowerName() + linkNo);
// }
// } else {
// if (null != borrowerDetailsVo) {
// bdCustomer.setFName(borrowerDetailsVo.getBorrowerName() + busSalesOrderVehicle.getTemporaryNo());
// }
// }
// // bdCustomers.add(bdCustomer);
// ResultBean<String> resultBean = finKingDeeFeign.draftBdCustomer(bdCustomer);
// if (resultBean.getSuccess()) {
// customerNumber = bdCustomer.getFNumber();
// }
// } else {
// customerNumber = busSalesOrderVehicle.getTemporaryNo();
// }
// voucherDetail.setCustomerCode(customerNumber);
// }
// }
// if (StringUtils.isNotBlank(planDetails.getOutstandingMoney())) {
// voucherDetail.setAmount(new BigDecimal(planDetails.getOutstandingMoney()));
// }
// voucherDetails.add(voucherDetail);
//
// }
// generalVoucher.setVoucherDetails(voucherDetails);
// finKingDeeFeign.saveLateVoucher(generalVoucher);
// }
// }
// if (!finalPlanSids.isEmpty()) {
// int i = loanRepaymentPlanDetailsService.updateOweState(finalPlanSids);
// }
// }
}
private void pushBuckleVoucher(String businessSid) {
@ -869,7 +786,19 @@ public class LoanBuckleApplyService extends MybatisBaseService<LoanBuckleApplyMa
// oweState 是否转累欠状态(0是,1否)
Integer oweState = planDetails.getOweState();
if (oweState == 1) {
voucherDetail.setSceneCode("01");
//获取收款日期的当月最后一天
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
LocalDate localDate = LocalDate.parse(DateUtil.formatDate(new Date()), formatter);
LocalDate date = localDate.withDayOfMonth(localDate.lengthOfMonth());
Date dueDate = planDetails.getDueDate(); //应还日期
// Date -> LocalDate
LocalDate localDueDate = dueDate.toInstant().atZone(ZoneId.systemDefault()).toLocalDate();
boolean after = localDueDate.isAfter(date);
if (after) {
voucherDetail.setSceneCode("15");
} else {
voucherDetail.setSceneCode("01");
}
} else if (oweState == 0) {
BigDecimal paymentMoney = planDetails.getPaymentMoney();
if (null != paymentMoney) {

15
anrui-riskcenter/anrui-riskcenter-biz/src/main/java/com/yxt/anrui/riskcenter/biz/loanpushfundhistory/LoanPushFundHistoryMapper.xml

@ -29,11 +29,18 @@
LIMIT 1
</select>
<select id="listPage" resultType="com.yxt.anrui.riskcenter.api.loanpushfundhistory.LoanPushFundHistoryVo">
SELECT SUM(fund) as money,
times,
(SELECT `name` FROM anrui_portal.sys_organization as s WHERE s.sid = a.useOrgSid) as useOrgName
SELECT * FROM
(SELECT
SUM( fund ) AS money,
times,
( SELECT `name` FROM anrui_portal.sys_organization AS s WHERE s.sid = b.useOrgSid ) AS useOrgName,
( SELECT orgSidPath FROM anrui_portal.sys_organization AS s WHERE s.sid = b.useOrgSid ) AS orgSidPath
FROM
(SELECT LEFT(createTime,16) as times,h.* FROM loan_push_fund_history as h) a
( SELECT LEFT ( createTime, 16 ) AS times, h.* FROM loan_push_fund_history AS h ) b
GROUP BY
b.useOrgSid,
b.times
) a
<where>
${ew.sqlSegment}
</where>

26
anrui-riskcenter/anrui-riskcenter-biz/src/main/java/com/yxt/anrui/riskcenter/biz/loanpushfundhistory/LoanPushFundHistoryService.java

@ -73,26 +73,23 @@ public class LoanPushFundHistoryService extends MybatisBaseService<LoanPushFundH
int i1 = orgSidPath.indexOf("/");
int i2 = orgSidPath.indexOf("/", i1 + 1);
int i3 = orgSidPath.indexOf("/", i2 + 1);
int i4 = orgSidPath.indexOf("/", i3 + 1);
// int i4 = orgSidPath.indexOf("/", i3 + 1);
String orgLevelKey = defaultIdReltBean.getData();
if ("1".equals(orgLevelKey)) {
// orgSidPath = orgSidPath.substring(0, i1);
// qw.like("lrd.orgSidPath", orgSidPath);
orgSidPath = orgSidPath.substring(0, i1);
qw.like("a.orgSidPath", orgSidPath);
} else if ("2".equals(orgLevelKey)) {
// orgSidPath = orgSidPath.substring(0, i2);
// qw.like("lrd.orgSidPath", orgSidPath);
orgSidPath = orgSidPath.substring(0, i2);
qw.like("a.orgSidPath", orgSidPath);
} else if ("3".equals(orgLevelKey)) {
ResultBean<String> orgSidByPath = sysStaffOrgFeign.getOrgSidByPath(pagerQuery.getOrgPath());
if (orgSidByPath.getSuccess()) {
qw.eq("a.useOrgSid", orgSidByPath.getData());
}
// orgSidPath = orgSidPath.substring(0, i3);
// qw.like("lrd.orgSidPath", orgSidPath);
orgSidPath = orgSidPath.substring(0, i3);
qw.like("a.orgSidPath", orgSidPath);
} else if ("4".equals(orgLevelKey)) {
orgSidPath = orgSidPath.substring(0, i4);
// qw.like("lrd.orgSidPath", orgSidPath);
orgSidPath = orgSidPath.substring(0, i3);
qw.like("a.orgSidPath", orgSidPath);
} else if ("5".equals(orgLevelKey)) {
// qw.eq("lrd.createBySid", pagerQuery.getUserSid());
orgSidPath = orgSidPath.substring(0, i3);
qw.like("a.orgSidPath", orgSidPath);
} else {
PagerVo<LoanPushFundHistoryVo> p = new PagerVo<>();
return p;
@ -107,7 +104,6 @@ public class LoanPushFundHistoryService extends MybatisBaseService<LoanPushFundH
qw.apply(StringUtils.isNotEmpty(startDate), "date_format(a.times,'%Y-%m-%d %H:%I') >= date_format('" + startDate + "','%Y-%m-%d %H:%I')").
apply(StringUtils.isNotEmpty(endDate), "date_format(a.times,'%Y-%m-%d %H:%I') <= date_format('" + endDate + "','%Y-%m-%d %H:%I')"
);
qw.groupBy("a.times", "a.useOrgSid");
qw.orderByDesc("a.times");
IPage<LoanPushFundHistory> page = PagerUtil.queryToPage(pq);
IPage<LoanPushFundHistoryVo> pagging = baseMapper.listPage(page, qw);

Loading…
Cancel
Save