Browse Source

客户账单汇总导出接口

master
fanzongzhe 5 months ago
parent
commit
9917a12335
  1. 18
      anrui-fin/anrui-fin-api/src/main/java/com/yxt/anrui/fin/api/finuncollectedreceivablesdetailed/CustomerBillSummaryExportVo.java
  2. 4
      anrui-fin/anrui-fin-biz/src/main/java/com/yxt/anrui/fin/biz/finuncollectedreceivablesdetailed/FinUncollectedReceivablesDetailedMapper.java
  3. 69
      anrui-fin/anrui-fin-biz/src/main/java/com/yxt/anrui/fin/biz/finuncollectedreceivablesdetailed/FinUncollectedReceivablesDetailedMapper.xml
  4. 26
      anrui-fin/anrui-fin-biz/src/main/java/com/yxt/anrui/fin/biz/finuncollectedreceivablesdetailed/FinUncollectedReceivablesDetailedService.java

18
anrui-fin/anrui-fin-api/src/main/java/com/yxt/anrui/fin/api/finuncollectedreceivablesdetailed/CustomerBillSummaryExportVo.java

@ -20,13 +20,21 @@ public class CustomerBillSummaryExportVo {
@ApiModelProperty("合同编号") @ApiModelProperty("合同编号")
@ExportEntityMap(CnName = "合同编号", EnName = "contractNo") @ExportEntityMap(CnName = "合同编号", EnName = "contractNo")
private String contractNo; // 合同编号 private String contractNo; // 合同编号
@ExportEntityMap(CnName = "车架号", EnName = "vinNo")
private String vinNo; // 车架号
@ExportEntityMap(CnName = "款项名称", EnName = "receivablesName")
private String receivablesName; // 款项名称
@ExportEntityMap(CnName = "应收款项状态", EnName = "kxState")
private String kxState; // 应收款项状态 01正常,02作废
@ApiModelProperty("应收金额") @ApiModelProperty("应收金额")
@ExportEntityMap(CnName = "应收金额", EnName = "reveivableMoney") @ExportEntityMap(CnName = "应收金额", EnName = "reveivableMoney")
private String reveivableMoney; // 当前应收金额 private String reveivableMoney; // 当前应收金额
@ApiModelProperty("实收金额") @ExportEntityMap(CnName = "收款日期", EnName = "collectionDate")
@ExportEntityMap(CnName = "实收金额", EnName = "subscriptionMoney") private String collectionDate;
@ExportEntityMap(CnName = "收款金额", EnName = "subscriptionMoney")
private String subscriptionMoney; // 认款金额 private String subscriptionMoney; // 认款金额
@ApiModelProperty("未认款金额") @ExportEntityMap(CnName = "付款方式", EnName = "collectionTypeValue")
@ExportEntityMap(CnName = "未认款金额", EnName = "noSubscriptionMoney") private String collectionTypeValue;
private String noSubscriptionMoney; // 未认款金额 @ExportEntityMap(CnName = "单据编号", EnName = "billNo")
private String billNo; // 单据编号
} }

4
anrui-fin/anrui-fin-biz/src/main/java/com/yxt/anrui/fin/biz/finuncollectedreceivablesdetailed/FinUncollectedReceivablesDetailedMapper.java

@ -139,5 +139,7 @@ public interface FinUncollectedReceivablesDetailedMapper extends BaseMapper<FinU
List<CustomerThreeListVo> selCustomerThreeListDetails(@Param("receivablesSid") String receivablesSid); List<CustomerThreeListVo> selCustomerThreeListDetails(@Param("receivablesSid") String receivablesSid);
List<CustomerBillSummaryExportVo> exportCustomerBillExcel( @Param(Constants.WRAPPER) QueryWrapper<FinUncollectedReceivablesDetailed> qw); List<CustomerBillSummaryVo> exportCustomerBillExcel( @Param(Constants.WRAPPER) QueryWrapper<FinUncollectedReceivablesDetailed> qw);
List<CustomerBillSummaryExportVo> selexportCustomerBillExcelDetails(@Param("contractSid") String contractSid);
} }

69
anrui-fin/anrui-fin-biz/src/main/java/com/yxt/anrui/fin/biz/finuncollectedreceivablesdetailed/FinUncollectedReceivablesDetailedMapper.xml

@ -881,9 +881,8 @@
m.collectionMoney != 0 m.collectionMoney != 0
</select> </select>
<select id="exportCustomerBillExcel" <select id="exportCustomerBillExcel"
resultType="com.yxt.anrui.fin.api.finuncollectedreceivablesdetailed.CustomerBillSummaryExportVo"> resultType="com.yxt.anrui.fin.api.finuncollectedreceivablesdetailed.CustomerBillSummaryVo">
SELECT SELECT
@row_number := @row_number + 1 AS rankNo,
b.*, b.*,
( b.reveivableMoney - b.subscriptionMoney ) noSubscriptionMoney ( b.reveivableMoney - b.subscriptionMoney ) noSubscriptionMoney
FROM FROM
@ -935,12 +934,70 @@
GROUP BY GROUP BY
f.contractSid f.contractSid
) AS a ) AS a
) b,( ) b
SELECT
@row_number := 0
) AS t
<where> <where>
${ew.sqlSegment} ${ew.sqlSegment}
</where> </where>
</select> </select>
<select id="selexportCustomerBillExcelDetails"
resultType="com.yxt.anrui.fin.api.finuncollectedreceivablesdetailed.CustomerBillSummaryExportVo">
SELECT
fd.customerName,
fd.contractNo,
c.collectionDate,
fd.receivablesName,
IF(fd.kxState = '01','正常', '作废') kxState,
d.`subscriptionMoney`,
c.collectionTypeValue,
c.billNo,
v.linkNo vinNo,
fd.reveivableMoney
FROM
fin_selected_receivables_detailed AS d
LEFT JOIN fin_collection_confirmation AS c ON c.sid = d.collSid
LEFT JOIN fin_uncollected_receivables_detailed as fd ON d.receivablesSid = fd.sid
LEFT JOIN anrui_buscenter.bus_sales_order_vehicle as v ON fd.busVinSid = v.sid
WHERE
d.contractSid = #{contractSid}
AND d.auditState = 3
UNION ALL
SELECT
*
FROM
(
SELECT
fd.customerName,
fd.contractNo,
f.collectionDate,
fd.receivablesName,
IF(fd.kxState = '01','正常', '作废') kxState,
- abs(IFNULL( f.`thisUseMoney`, 0 )) collectionMoney,
'结转' collectionTypeValue,
f.billNo,
v.linkNo vinNo,
fd.reveivableMoney
FROM
fin_selected_receivables_detailed d
LEFT JOIN (
SELECT
fa.sid,
f.busSid,
f.thisUseMoney,
date_format ( fa.createTime, '%Y-%m-%d' ) AS collectionDate,
fa.billNo
FROM
fin_funds_carried_forward_veh f
LEFT JOIN `fin_funds_carried_forward_apply` fa ON f.mainSid = fa.sid
WHERE
fa.`nodeState` = '已办结'
) f ON f.`busSid` = d.`sid`
LEFT JOIN fin_uncollected_receivables_detailed as fd ON d.receivablesSid = fd.sid
LEFT JOIN anrui_buscenter.bus_sales_order_vehicle as v ON fd.busVinSid = v.sid
WHERE
d.auditState = 3
AND d.contractSid = #{contractSid}
) AS m
WHERE
m.collectionMoney != 0
</select>
</mapper> </mapper>

26
anrui-fin/anrui-fin-biz/src/main/java/com/yxt/anrui/fin/biz/finuncollectedreceivablesdetailed/FinUncollectedReceivablesDetailedService.java

@ -1284,10 +1284,10 @@ public class FinUncollectedReceivablesDetailedService extends MybatisBaseService
qw.apply("( b.reveivableMoney - b.subscriptionMoney ) <=" + query.getNoSubscriptionMoneyEnd()); qw.apply("( b.reveivableMoney - b.subscriptionMoney ) <=" + query.getNoSubscriptionMoneyEnd());
} }
if (StringUtils.isNotBlank(query.getContractNo())) { if (StringUtils.isNotBlank(query.getContractNo())) {
qw.like("b.contractNo",query.getContractNo()); qw.like("b.contractNo", query.getContractNo());
} }
if (StringUtils.isNotBlank(query.getCustomerName())) { if (StringUtils.isNotBlank(query.getCustomerName())) {
qw.like("b.customerName",query.getCustomerName()); qw.like("b.customerName", query.getCustomerName());
} }
IPage<FinUncollectedReceivablesDetailed> page = PagerUtil.queryToPage(pq); IPage<FinUncollectedReceivablesDetailed> page = PagerUtil.queryToPage(pq);
IPage<CustomerBillSummaryVo> pagging = baseMapper.getCustomerSummaryList(page, qw); IPage<CustomerBillSummaryVo> pagging = baseMapper.getCustomerSummaryList(page, qw);
@ -1316,6 +1316,7 @@ public class FinUncollectedReceivablesDetailedService extends MybatisBaseService
public List<CustomerBillSummaryExportVo> exportCustomerBillExcel(CustomerBillSummaryQuery query) { public List<CustomerBillSummaryExportVo> exportCustomerBillExcel(CustomerBillSummaryQuery query) {
QueryWrapper<FinUncollectedReceivablesDetailed> qw = new QueryWrapper<>(); QueryWrapper<FinUncollectedReceivablesDetailed> qw = new QueryWrapper<>();
String orgPath = query.getOrgPath(); String orgPath = query.getOrgPath();
List<CustomerBillSummaryExportVo> list = new ArrayList<>();
//授权 //授权
if (StringUtils.isNotBlank(query.getMenuUrl())) { if (StringUtils.isNotBlank(query.getMenuUrl())) {
PrivilegeQuery privilegeQuery = new PrivilegeQuery(); PrivilegeQuery privilegeQuery = new PrivilegeQuery();
@ -1361,12 +1362,27 @@ public class FinUncollectedReceivablesDetailedService extends MybatisBaseService
qw.apply("( b.reveivableMoney - b.subscriptionMoney ) <=" + query.getNoSubscriptionMoneyEnd()); qw.apply("( b.reveivableMoney - b.subscriptionMoney ) <=" + query.getNoSubscriptionMoneyEnd());
} }
if (StringUtils.isNotBlank(query.getContractNo())) { if (StringUtils.isNotBlank(query.getContractNo())) {
qw.like("b.contractNo",query.getContractNo()); qw.like("b.contractNo", query.getContractNo());
} }
if (StringUtils.isNotBlank(query.getCustomerName())) { if (StringUtils.isNotBlank(query.getCustomerName())) {
qw.like("b.customerName",query.getCustomerName()); qw.like("b.customerName", query.getCustomerName());
}
List<CustomerBillSummaryVo> summaryVos = baseMapper.exportCustomerBillExcel(qw);
if (!summaryVos.isEmpty()) {
for (CustomerBillSummaryVo summaryVo : summaryVos) {
String contractSid = summaryVo.getContractSid();
List<CustomerBillSummaryExportVo> details = baseMapper.selexportCustomerBillExcelDetails(contractSid);
if (!details.isEmpty()) {
list.addAll(details);
}
}
}
if (!list.isEmpty()) {
for (int i = 0; i < list.size(); i++) {
CustomerBillSummaryExportVo exportVo = list.get(i);
exportVo.setRankNo(i + 1);
}
} }
List<CustomerBillSummaryExportVo> list = baseMapper.exportCustomerBillExcel(qw);
return list; return list;
} }
} }

Loading…
Cancel
Save