parent
7843654179
commit
a7e635f2a0
@ -1,7 +1,101 @@ |
|||||||
package com.hfkj.dao; |
package com.hfkj.dao; |
||||||
|
|
||||||
|
import org.apache.ibatis.annotations.Param; |
||||||
|
import org.apache.ibatis.annotations.Select; |
||||||
|
|
||||||
|
import java.util.List; |
||||||
|
import java.util.Map; |
||||||
|
|
||||||
/** |
/** |
||||||
* mapper扩展类 |
* mapper扩展类 |
||||||
*/ |
*/ |
||||||
public interface BsTradeSettleMapperExt { |
public interface BsTradeSettleMapperExt { |
||||||
|
|
||||||
|
@Select("<script>" + |
||||||
|
" select " + |
||||||
|
" a.settleDay, " + |
||||||
|
" #{param.merNo} merNo, " + |
||||||
|
" (a.tradeNum + b.tradeNum) tradeNum, " + |
||||||
|
" (a.tradeAmount - b.tradeAmount) tradeAmount, " + |
||||||
|
" (a.settleAmount - b.settleAmount) settleAmount, " + |
||||||
|
" (a.shdFeeAmount - b.shdFeeAmount) shdFeeAmount " + |
||||||
|
" from " + |
||||||
|
" (select " + |
||||||
|
" a.days settleDay, " + |
||||||
|
" case when b.tradeNum is null then 0 else b.tradeNum end tradeNum, " + |
||||||
|
" case when b.tradeAmount is null then 0 else b.tradeAmount end tradeAmount, " + |
||||||
|
" case when b.settleAmount is null then 0 else b.settleAmount end settleAmount, " + |
||||||
|
" case when b.shdFeeAmount is null then 0 else b.shdFeeAmount end shdFeeAmount " + |
||||||
|
" from ( " + |
||||||
|
" SELECT date_add(date_sub(#{param.settleTimeS},interval 1 day), INTERVAL ( cast( help_topic_id AS signed INTEGER ) + 1 ) day) days " + |
||||||
|
" FROM mysql.help_topic " + |
||||||
|
" WHERE help_topic_id <![CDATA[ < ]]> DATEDIFF(#{param.settleTimeE},date_sub(#{param.settleTimeS},interval 1 day)) ORDER BY help_topic_id) a " + |
||||||
|
" LEFT JOIN (select " + |
||||||
|
" settle_date, " + |
||||||
|
" count(1) tradeNum, " + |
||||||
|
" sum(trade_amount) tradeAmount, " + |
||||||
|
" sum(settle_amount) settleAmount, " + |
||||||
|
" sum(shd_fee_amt) shdFeeAmount " + |
||||||
|
" from bs_trade_settle " + |
||||||
|
" where settle_date between #{param.settleTimeS} and #{param.settleTimeE} " + |
||||||
|
" and mer_no = #{param.merNo} " + |
||||||
|
" and trade_type = 1 " + |
||||||
|
" and `status` = 1 " + |
||||||
|
" GROUP BY settle_date " + |
||||||
|
" ) b on b.settle_date = a.days) a, " + |
||||||
|
" (select " + |
||||||
|
" a.days settleDay, " + |
||||||
|
" case when b.tradeNum is null then 0 else b.tradeNum end tradeNum, " + |
||||||
|
" case when b.tradeAmount is null then 0 else b.tradeAmount end tradeAmount, " + |
||||||
|
" case when b.settleAmount is null then 0 else b.settleAmount end settleAmount, " + |
||||||
|
" case when b.shdFeeAmount is null then 0 else b.shdFeeAmount end shdFeeAmount " + |
||||||
|
" from ( " + |
||||||
|
" SELECT date_add(date_sub(#{param.settleTimeS},interval 1 day), INTERVAL ( cast( help_topic_id AS signed INTEGER ) + 1 ) day) days " + |
||||||
|
" FROM mysql.help_topic " + |
||||||
|
" WHERE help_topic_id <![CDATA[ < ]]> DATEDIFF(#{param.settleTimeE},date_sub(#{param.settleTimeS},interval 1 day)) ORDER BY help_topic_id) a " + |
||||||
|
" LEFT JOIN (select " + |
||||||
|
" settle_date, " + |
||||||
|
" count(1) tradeNum, " + |
||||||
|
" sum(trade_amount) tradeAmount, " + |
||||||
|
" sum(settle_amount) settleAmount, " + |
||||||
|
" sum(shd_fee_amt) shdFeeAmount " + |
||||||
|
" from bs_trade_settle " + |
||||||
|
" where settle_date between #{param.settleTimeS} and #{param.settleTimeE} " + |
||||||
|
" and mer_no = #{param.merNo} " + |
||||||
|
" and trade_type = 2 " + |
||||||
|
" and `status` = 1 " + |
||||||
|
" GROUP BY settle_date " + |
||||||
|
" ) b on b.settle_date = a.days) b where b.settleDay = a.settleDay " + |
||||||
|
" ORDER BY a.settleDay desc" + |
||||||
|
"</script>") |
||||||
|
List<Map<String,Object>> queryTradeSettleDayCount(@Param("param") Map<String, Object> param); |
||||||
|
|
||||||
|
@Select({"<script>" + |
||||||
|
" select " + |
||||||
|
" sum(a.tradeNum) tradeNum," + |
||||||
|
" sum(CAST(a.tradeAmount as decimal(10,2))) tradeAmount, " + |
||||||
|
" sum(CAST(a.settleAmount as decimal(10,2))) settleAmount, " + |
||||||
|
" sum(CAST(a.shdFeeAmount as decimal(10,2))) shdFeeAmount " + |
||||||
|
" from (select " + |
||||||
|
" count(1) tradeNum," + |
||||||
|
" case when sum(trade_amount) is null then 0 else sum(trade_amount) end tradeAmount," + |
||||||
|
" case when sum(settle_amount) is null then 0 else sum(settle_amount) end settleAmount," + |
||||||
|
" case when sum(shd_fee_amt) is null then 0 else sum(shd_fee_amt) end shdFeeAmount" + |
||||||
|
" from bs_trade_settle " + |
||||||
|
" where mer_no = #{param.merNo} and settle_date between #{param.settleTimeS} and #{param.settleTimeE} and trade_type = 1 and status = 1" + |
||||||
|
" <if test='param.outTradeNo != null'> and out_trade_no = #{param.outTradeNo} </if>" + |
||||||
|
" <if test='param.accTradeNo != null'> and acc_trade_no = #{param.accTradeNo} </if>" + |
||||||
|
" UNION" + |
||||||
|
" select " + |
||||||
|
" count(1) tradeNum," + |
||||||
|
" CONCAT('-', case when sum(trade_amount) is null then 0 else sum(trade_amount) end) tradeAmount," + |
||||||
|
" CONCAT('-', case when sum(settle_amount) is null then 0 else sum(settle_amount) end) settleAmount," + |
||||||
|
" CONCAT('-', case when sum(shd_fee_amt) is null then 0 else sum(shd_fee_amt) end) shdFeeAmount" + |
||||||
|
" from bs_trade_settle " + |
||||||
|
" where mer_no = #{param.merNo} and settle_date between #{param.settleTimeS} and #{param.settleTimeE} and trade_type = 2 and status = 1" + |
||||||
|
" <if test='param.outTradeNo != null'> and out_trade_no = #{param.outTradeNo} </if>" + |
||||||
|
" <if test='param.accTradeNo != null'> and acc_trade_no = #{param.accTradeNo} </if>" + |
||||||
|
") a" + |
||||||
|
" </script>"}) |
||||||
|
Map<String,Object> queryTradeSettleCount(@Param("param") Map<String, Object> param); |
||||||
} |
} |
@ -0,0 +1,63 @@ |
|||||||
|
package com.hfkj.model; |
||||||
|
|
||||||
|
import com.alibaba.excel.annotation.ExcelProperty; |
||||||
|
import com.alibaba.excel.annotation.write.style.ColumnWidth; |
||||||
|
import com.alibaba.excel.annotation.write.style.ContentStyle; |
||||||
|
import com.alibaba.excel.annotation.write.style.HeadFontStyle; |
||||||
|
import lombok.Data; |
||||||
|
import org.apache.poi.ss.usermodel.HorizontalAlignment; |
||||||
|
|
||||||
|
import java.util.Date; |
||||||
|
|
||||||
|
/** |
||||||
|
* 交易账单模型 |
||||||
|
* @className: TradeBillsModel |
||||||
|
* @author: HuRui |
||||||
|
* @date: 2023/5/25 |
||||||
|
**/ |
||||||
|
@Data |
||||||
|
public class TradeSettleBillsModel { |
||||||
|
|
||||||
|
@ColumnWidth(15) |
||||||
|
@ExcelProperty("清算日期") |
||||||
|
@HeadFontStyle(bold = true) |
||||||
|
@ContentStyle(horizontalAlignment = HorizontalAlignment.CENTER) |
||||||
|
private String settleDate; |
||||||
|
|
||||||
|
@ColumnWidth(25) |
||||||
|
@ExcelProperty("商户号") |
||||||
|
@HeadFontStyle(bold = true) |
||||||
|
@ContentStyle(horizontalAlignment = HorizontalAlignment.CENTER) |
||||||
|
private String merchantNo; |
||||||
|
|
||||||
|
@ColumnWidth(30) |
||||||
|
@ExcelProperty("商户名称") |
||||||
|
@HeadFontStyle(bold = true) |
||||||
|
@ContentStyle(horizontalAlignment = HorizontalAlignment.CENTER) |
||||||
|
private String merchantName; |
||||||
|
|
||||||
|
@ColumnWidth(15) |
||||||
|
@ExcelProperty("交易笔数") |
||||||
|
@HeadFontStyle(bold = true) |
||||||
|
@ContentStyle(horizontalAlignment = HorizontalAlignment.CENTER) |
||||||
|
private Long tradeNum; |
||||||
|
|
||||||
|
@ColumnWidth(15) |
||||||
|
@ExcelProperty("交易金额") |
||||||
|
@HeadFontStyle(bold = true) |
||||||
|
@ContentStyle(horizontalAlignment = HorizontalAlignment.CENTER) |
||||||
|
private String tradeAmount; |
||||||
|
|
||||||
|
@ColumnWidth(15) |
||||||
|
@ExcelProperty("手续费") |
||||||
|
@HeadFontStyle(bold = true) |
||||||
|
@ContentStyle(horizontalAlignment = HorizontalAlignment.CENTER) |
||||||
|
private String shdFeeAmt; |
||||||
|
|
||||||
|
@ColumnWidth(15) |
||||||
|
@ExcelProperty("应结算金额") |
||||||
|
@HeadFontStyle(bold = true) |
||||||
|
@ContentStyle(horizontalAlignment = HorizontalAlignment.CENTER) |
||||||
|
private String settleAmount; |
||||||
|
|
||||||
|
} |
@ -0,0 +1,106 @@ |
|||||||
|
package com.hfkj.model; |
||||||
|
|
||||||
|
import com.alibaba.excel.annotation.ExcelProperty; |
||||||
|
import com.alibaba.excel.annotation.write.style.ColumnWidth; |
||||||
|
import com.alibaba.excel.annotation.write.style.ContentStyle; |
||||||
|
import com.alibaba.excel.annotation.write.style.HeadFontStyle; |
||||||
|
import lombok.Data; |
||||||
|
import org.apache.poi.ss.usermodel.HorizontalAlignment; |
||||||
|
|
||||||
|
import java.util.Date; |
||||||
|
|
||||||
|
/** |
||||||
|
* 交易账单模型 |
||||||
|
* @className: TradeBillsModel |
||||||
|
* @author: HuRui |
||||||
|
* @date: 2023/5/25 |
||||||
|
**/ |
||||||
|
@Data |
||||||
|
public class TradeSettleDetailBillsModel { |
||||||
|
|
||||||
|
@ColumnWidth(10) |
||||||
|
@ExcelProperty("序号") |
||||||
|
@HeadFontStyle(bold = true) |
||||||
|
@ContentStyle(horizontalAlignment = HorizontalAlignment.CENTER) |
||||||
|
private Long serialNumber; |
||||||
|
|
||||||
|
@ColumnWidth(25) |
||||||
|
@ExcelProperty("商户号") |
||||||
|
@HeadFontStyle(bold = true) |
||||||
|
@ContentStyle(horizontalAlignment = HorizontalAlignment.CENTER) |
||||||
|
private String merchantNo; |
||||||
|
|
||||||
|
@ColumnWidth(30) |
||||||
|
@ExcelProperty("商户名称") |
||||||
|
@HeadFontStyle(bold = true) |
||||||
|
@ContentStyle(horizontalAlignment = HorizontalAlignment.CENTER) |
||||||
|
private String merchantName; |
||||||
|
|
||||||
|
@ColumnWidth(25) |
||||||
|
@ExcelProperty("交易日期") |
||||||
|
@HeadFontStyle(bold = true) |
||||||
|
@ContentStyle(horizontalAlignment = HorizontalAlignment.CENTER) |
||||||
|
private Date tradeTime; |
||||||
|
|
||||||
|
@ColumnWidth(15) |
||||||
|
@ExcelProperty("交易金额") |
||||||
|
@HeadFontStyle(bold = true) |
||||||
|
@ContentStyle(horizontalAlignment = HorizontalAlignment.CENTER) |
||||||
|
private String tradeAmount; |
||||||
|
|
||||||
|
@ColumnWidth(15) |
||||||
|
@ExcelProperty("交易手续费") |
||||||
|
@HeadFontStyle(bold = true) |
||||||
|
@ContentStyle(horizontalAlignment = HorizontalAlignment.CENTER) |
||||||
|
private String shdFeeAmt; |
||||||
|
|
||||||
|
@ColumnWidth(15) |
||||||
|
@ExcelProperty("结算金额") |
||||||
|
@HeadFontStyle(bold = true) |
||||||
|
@ContentStyle(horizontalAlignment = HorizontalAlignment.CENTER) |
||||||
|
private String settleAmount; |
||||||
|
|
||||||
|
@ColumnWidth(15) |
||||||
|
@ExcelProperty("交易类型") |
||||||
|
@HeadFontStyle(bold = true) |
||||||
|
@ContentStyle(horizontalAlignment = HorizontalAlignment.CENTER) |
||||||
|
private String tradeType; |
||||||
|
|
||||||
|
@ColumnWidth(15) |
||||||
|
@ExcelProperty("支付渠道") |
||||||
|
@HeadFontStyle(bold = true) |
||||||
|
@ContentStyle(horizontalAlignment = HorizontalAlignment.CENTER) |
||||||
|
private String payMode; |
||||||
|
|
||||||
|
@ColumnWidth(35) |
||||||
|
@ExcelProperty("商户订单号") |
||||||
|
@HeadFontStyle(bold = true) |
||||||
|
@ContentStyle(horizontalAlignment = HorizontalAlignment.CENTER) |
||||||
|
private String outTradeNo; |
||||||
|
|
||||||
|
@ColumnWidth(35) |
||||||
|
@ExcelProperty("渠道订单号") |
||||||
|
@HeadFontStyle(bold = true) |
||||||
|
@ContentStyle(horizontalAlignment = HorizontalAlignment.CENTER) |
||||||
|
private String accTradeNo; |
||||||
|
|
||||||
|
@ColumnWidth(15) |
||||||
|
@ExcelProperty("清算日期") |
||||||
|
@HeadFontStyle(bold = true) |
||||||
|
@ContentStyle(horizontalAlignment = HorizontalAlignment.CENTER) |
||||||
|
private String settleDate; |
||||||
|
|
||||||
|
@ColumnWidth(15) |
||||||
|
@ExcelProperty("手续费率") |
||||||
|
@HeadFontStyle(bold = true) |
||||||
|
@ContentStyle(horizontalAlignment = HorizontalAlignment.CENTER) |
||||||
|
private String feeRate; |
||||||
|
|
||||||
|
@ColumnWidth(35) |
||||||
|
@ExcelProperty("原商户订单号") |
||||||
|
@HeadFontStyle(bold = true) |
||||||
|
@ContentStyle(horizontalAlignment = HorizontalAlignment.CENTER) |
||||||
|
private String orgOutTradeNo; |
||||||
|
|
||||||
|
|
||||||
|
} |
Loading…
Reference in new issue