From a7e635f2a073cf2c1395fc66592916d4e21c92b8 Mon Sep 17 00:00:00 2001 From: hurui <177768073@qq.com> Date: Tue, 15 Aug 2023 11:17:00 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/BsTradeOrderController.java | 163 +++++++++++++++--- .../com/hfkj/dao/BsTradeOrderMapperExt.java | 107 ------------ .../com/hfkj/dao/BsTradeSettleMapperExt.java | 96 ++++++++++- .../com/hfkj/model/TradeSettleBillsModel.java | 63 +++++++ .../model/TradeSettleDetailBillsModel.java | 106 ++++++++++++ .../com/hfkj/service/BsTradeOrderService.java | 8 - .../hfkj/service/BsTradeSettleService.java | 14 ++ .../service/impl/BsTradeOrderServiceImpl.java | 7 - .../impl/BsTradeSettleServiceImpl.java | 45 ++++- .../hfkj/sysenum/TradeSettleTradeType.java | 13 +- 10 files changed, 469 insertions(+), 153 deletions(-) create mode 100644 service/src/main/java/com/hfkj/model/TradeSettleBillsModel.java create mode 100644 service/src/main/java/com/hfkj/model/TradeSettleDetailBillsModel.java diff --git a/bweb/src/main/java/com/bweb/controller/BsTradeOrderController.java b/bweb/src/main/java/com/bweb/controller/BsTradeOrderController.java index 19149c1..b5d86a9 100644 --- a/bweb/src/main/java/com/bweb/controller/BsTradeOrderController.java +++ b/bweb/src/main/java/com/bweb/controller/BsTradeOrderController.java @@ -1,7 +1,6 @@ package com.bweb.controller; import com.alibaba.excel.EasyExcel; -import com.bweb.config.SysConst; import com.bweb.excel.model.ExportTradeOrderModel; import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageInfo; @@ -9,13 +8,15 @@ import com.hfkj.common.exception.ErrorCode; import com.hfkj.common.exception.ErrorHelp; import com.hfkj.common.exception.SysCode; import com.hfkj.common.security.UserCenter; -import com.hfkj.common.utils.EasyExcelUtil; +import com.hfkj.common.utils.DateUtil; import com.hfkj.common.utils.ResponseMsgUtil; import com.hfkj.config.CommonSysConst; import com.hfkj.entity.BsMer; -import com.hfkj.entity.BsPayQrCode; import com.hfkj.entity.BsTradeOrder; +import com.hfkj.entity.BsTradeSettle; import com.hfkj.model.ResponseData; +import com.hfkj.model.TradeSettleBillsModel; +import com.hfkj.model.TradeSettleDetailBillsModel; import com.hfkj.model.UserInfoModel; import com.hfkj.service.*; import com.hfkj.sysenum.*; @@ -28,7 +29,6 @@ import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; -import java.io.File; import java.math.BigDecimal; import java.util.ArrayList; import java.util.HashMap; @@ -48,6 +48,9 @@ public class BsTradeOrderController { @Resource private BsTradeOrderService tradeOrderService; + @Resource + private BsTradeSettleService tradeSettleService; + @Resource private BsTradeOrderRefundService tradeOrderRefundService; @@ -288,10 +291,14 @@ public class BsTradeOrderController { @RequestMapping(value="/queryCheckingDetail",method = RequestMethod.GET) @ResponseBody - @ApiOperation(value = "根据交易订单号 查询订单信息") + @ApiOperation(value = "查询交易对账详情") public ResponseData queryCheckingDetail(@RequestParam(value = "merNo" , required = true) String merNo, @RequestParam(value = "settleTimeS" , required = true) Long settleTimeS, - @RequestParam(value = "settleTimeE" , required = true) Long settleTimeE) { + @RequestParam(value = "settleTimeE" , required = true) Long settleTimeE, + @RequestParam(value = "outTradeNo" , required = false) String outTradeNo, + @RequestParam(value = "accTradeNo" , required = false) String accTradeNo, + @RequestParam(value = "pageNum" , required = true) Integer pageNum, + @RequestParam(value = "pageSize" , required = true) Integer pageSize) { try { // 查询商户 BsMer mer = merService.getMer(merNo); @@ -303,30 +310,81 @@ public class BsTradeOrderController { param.put("merNo", merNo); param.put("settleTimeS", settleTimeS); param.put("settleTimeE", settleTimeE); - // 查询交易详情 - List> mapList = tradeOrderService.getTradeOrderDetailCount(param); + param.put("outTradeNo", outTradeNo); + param.put("accTradeNo", accTradeNo); - int totalTradeNum = 0; - BigDecimal totalTradeAmount = new BigDecimal("0"); - BigDecimal totalSettleAmount = new BigDecimal("0"); - BigDecimal totalShdFeeAmount = new BigDecimal("0"); + Map returnParam = new HashMap<>(); + PageHelper.startPage(pageNum,pageSize); + // 交易结算 + returnParam.put("settleDetailList", new PageInfo<>(tradeSettleService.getTradeSettleList(param))); + // 汇总 + Map tradeSettleCount = tradeSettleService.getTradeSettleCount(param); + returnParam.put("totalTradeNum", tradeSettleCount.get("tradeNum")); + returnParam.put("totalTradeAmount", tradeSettleCount.get("tradeAmount")); + returnParam.put("totalSettleAmount", tradeSettleCount.get("settleAmount")); + returnParam.put("totalShdFeeAmount", tradeSettleCount.get("shdFeeAmount")); - for (Map map : mapList) { - map.put("merName", mer.getMerName()); - map.put("merAbbreviate", mer.getMerAbbreviate()); - totalTradeNum += MapUtils.getInteger(map, "tradeNum").intValue(); - totalTradeAmount = totalTradeAmount.add(new BigDecimal(MapUtils.getString(map, "tradeAmount"))); - totalSettleAmount = totalSettleAmount.add(new BigDecimal(MapUtils.getString(map, "settleAmount"))); - totalShdFeeAmount = totalShdFeeAmount.add(new BigDecimal(MapUtils.getString(map, "shdFeeAmount"))); + return ResponseMsgUtil.success(returnParam); + + } catch (Exception e) { + log.error(e.getMessage(), e); + return ResponseMsgUtil.exception(e); + } + } + + @RequestMapping(value="/exportCheckingDetail",method = RequestMethod.GET) + @ResponseBody + @ApiOperation(value = "导出查询交易对账详情") + public ResponseData exportCheckingDetail(@RequestParam(value = "merNo" , required = true) String merNo, + @RequestParam(value = "settleTimeS" , required = true) Long settleTimeS, + @RequestParam(value = "settleTimeE" , required = true) Long settleTimeE, + @RequestParam(value = "outTradeNo" , required = false) String outTradeNo, + @RequestParam(value = "accTradeNo" , required = false) String accTradeNo) { + try { + // 查询商户 + BsMer mer = merService.getMer(merNo); + if (mer == null) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未知的商户"); } - Map returnParam = new HashMap<>(); - returnParam.put("totalTradeNum", totalTradeNum); - returnParam.put("totalTradeAmount", totalTradeAmount); - returnParam.put("totalSettleAmount", totalSettleAmount); - returnParam.put("totalShdFeeAmount", totalShdFeeAmount); - returnParam.put("settleDetailList", mapList); - return ResponseMsgUtil.success(returnParam); + Map param = new HashMap<>(); + param.put("merNo", merNo); + param.put("settleTimeS", settleTimeS); + param.put("settleTimeE", settleTimeE); + param.put("outTradeNo", outTradeNo); + param.put("accTradeNo", accTradeNo); + + List list = tradeSettleService.getTradeSettleList(param); + + List billsModelList = new ArrayList<>(); + TradeSettleDetailBillsModel billsModel; + + Long serialNumber = 1L; + for (BsTradeSettle tradeSettle : list) { + billsModel = new TradeSettleDetailBillsModel(); + billsModel.setSerialNumber(serialNumber++); + billsModel.setMerchantNo(mer.getMerNo()); + billsModel.setMerchantName(mer.getMerName()); + billsModel.setTradeTime(tradeSettle.getTradeTime()); + billsModel.setTradeAmount(tradeSettle.getTradeType().equals(TradeSettleTradeType.type2.getNumber())?"-"+tradeSettle.getTradeAmount():tradeSettle.getTradeAmount().toString()); + billsModel.setShdFeeAmt(tradeSettle.getTradeType().equals(TradeSettleTradeType.type2.getNumber())?"-"+tradeSettle.getShdFeeAmt():tradeSettle.getShdFeeAmt().toString()); + billsModel.setSettleAmount(tradeSettle.getTradeType().equals(TradeSettleTradeType.type2.getNumber())?"-"+tradeSettle.getSettleAmount():tradeSettle.getSettleAmount().toString()); + billsModel.setTradeType(TradeSettleTradeType.getNameByCode(tradeSettle.getTradeType()).getName()); + billsModel.setPayMode(TradeOrderPayModeEnum.getNameByCode(tradeSettle.getPayMode()).getName()); + billsModel.setOutTradeNo(tradeSettle.getOutTradeNo()); + billsModel.setAccTradeNo(tradeSettle.getAccTradeNo()); + billsModel.setSettleDate(DateUtil.date2String(tradeSettle.getSettleDate(), DateUtil.Y_M_D)); + billsModel.setFeeRate(tradeSettle.getFeeRate() + "%"); + billsModel.setOrgOutTradeNo(tradeSettle.getOrgOutTradeNo()); + billsModelList.add(billsModel); + } + + String fileName = "/temporary/" + System.currentTimeMillis() + ".xlsx"; + EasyExcel.write(CommonSysConst.getSysConfig().getFilesystem() + fileName, TradeSettleDetailBillsModel.class) + .sheet("交易明细") + .doWrite(billsModelList); + + return ResponseMsgUtil.success(fileName); } catch (Exception e) { log.error(e.getMessage(), e); @@ -336,7 +394,7 @@ public class BsTradeOrderController { @RequestMapping(value="/queryChecking",method = RequestMethod.GET) @ResponseBody - @ApiOperation(value = "根据交易订单号 查询订单信息") + @ApiOperation(value = "查询交易结算汇总") public ResponseData queryChecking(@RequestParam(value = "merNo" , required = true) String merNo, @RequestParam(value = "settleTimeS" , required = true) Long settleTimeS, @RequestParam(value = "settleTimeE" , required = true) Long settleTimeE) { @@ -352,7 +410,7 @@ public class BsTradeOrderController { param.put("settleTimeS", settleTimeS); param.put("settleTimeE", settleTimeE); // 查询交易详情 - List> mapList = tradeOrderService.getTradeOrderDetailCount(param); + List> mapList = tradeSettleService.getTradeSettleDayCount(param); int totalTradeNum = 0; BigDecimal totalTradeAmount = new BigDecimal("0"); @@ -360,6 +418,8 @@ public class BsTradeOrderController { BigDecimal totalShdFeeAmount = new BigDecimal("0"); for (Map map : mapList) { + map.put("merName", mer.getMerName()); + map.put("merAbbreviate", mer.getMerAbbreviate()); totalTradeNum += MapUtils.getInteger(map, "tradeNum").intValue(); totalTradeAmount = totalTradeAmount.add(new BigDecimal(MapUtils.getString(map, "tradeAmount"))); totalSettleAmount = totalSettleAmount.add(new BigDecimal(MapUtils.getString(map, "settleAmount"))); @@ -373,6 +433,7 @@ public class BsTradeOrderController { returnParam.put("totalTradeAmount", totalTradeAmount); returnParam.put("totalSettleAmount", totalSettleAmount); returnParam.put("totalShdFeeAmount", totalShdFeeAmount); + returnParam.put("settleList", mapList); return ResponseMsgUtil.success(returnParam); } catch (Exception e) { @@ -381,4 +442,50 @@ public class BsTradeOrderController { } } + @RequestMapping(value="/exportChecking",method = RequestMethod.GET) + @ResponseBody + @ApiOperation(value = "导出交易结算汇总") + public ResponseData exportChecking(@RequestParam(value = "merNo" , required = true) String merNo, + @RequestParam(value = "settleTimeS" , required = true) Long settleTimeS, + @RequestParam(value = "settleTimeE" , required = true) Long settleTimeE) { + try { + // 查询商户 + BsMer mer = merService.getMer(merNo); + if (mer == null) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未知的商户"); + } + + Map param = new HashMap<>(); + param.put("merNo", merNo); + param.put("settleTimeS", settleTimeS); + param.put("settleTimeE", settleTimeE); + // 查询交易详情 + List> list = tradeSettleService.getTradeSettleDayCount(param); + + List settleBillsList = new ArrayList<>(); + TradeSettleBillsModel settleBills; + for (Map map : list) { + settleBills = new TradeSettleBillsModel(); + settleBills.setSettleDate(MapUtils.getString(map,"settleDay")); + settleBills.setMerchantNo(MapUtils.getString(map,"merNo")); + settleBills.setMerchantName(mer.getMerName()); + settleBills.setTradeNum(MapUtils.getLong(map,"tradeNum")); + settleBills.setTradeAmount(MapUtils.getString(map,"tradeAmount")); + settleBills.setShdFeeAmt(MapUtils.getString(map,"shdFeeAmount")); + settleBills.setSettleAmount(MapUtils.getString(map,"settleAmount")); + settleBillsList.add(settleBills); + } + String fileName = "/temporary/" + System.currentTimeMillis() + ".xlsx"; + EasyExcel.write(CommonSysConst.getSysConfig().getFilesystem() + fileName, TradeSettleBillsModel.class) + .sheet("交易汇总") + .doWrite(settleBillsList); + + return ResponseMsgUtil.success(fileName); + + } catch (Exception e) { + log.error(e.getMessage(), e); + return ResponseMsgUtil.exception(e); + } + } + } diff --git a/service/src/main/java/com/hfkj/dao/BsTradeOrderMapperExt.java b/service/src/main/java/com/hfkj/dao/BsTradeOrderMapperExt.java index de0b857..d6b58b0 100644 --- a/service/src/main/java/com/hfkj/dao/BsTradeOrderMapperExt.java +++ b/service/src/main/java/com/hfkj/dao/BsTradeOrderMapperExt.java @@ -32,111 +32,4 @@ public interface BsTradeOrderMapperExt { "") Map countTradeOrderPrice(@Param("param") Map param); - -/* @Select("") - */ - @Select("") - List> queryTradeOrderDetailCount(@Param("param") Map param); - } diff --git a/service/src/main/java/com/hfkj/dao/BsTradeSettleMapperExt.java b/service/src/main/java/com/hfkj/dao/BsTradeSettleMapperExt.java index 7a55ecc..a3078e7 100644 --- a/service/src/main/java/com/hfkj/dao/BsTradeSettleMapperExt.java +++ b/service/src/main/java/com/hfkj/dao/BsTradeSettleMapperExt.java @@ -1,7 +1,101 @@ 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扩展类 */ public interface BsTradeSettleMapperExt { -} \ No newline at end of file + + @Select("") + List> queryTradeSettleDayCount(@Param("param") Map param); + + @Select({""}) + Map queryTradeSettleCount(@Param("param") Map param); +} diff --git a/service/src/main/java/com/hfkj/model/TradeSettleBillsModel.java b/service/src/main/java/com/hfkj/model/TradeSettleBillsModel.java new file mode 100644 index 0000000..b0ea225 --- /dev/null +++ b/service/src/main/java/com/hfkj/model/TradeSettleBillsModel.java @@ -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; + +} diff --git a/service/src/main/java/com/hfkj/model/TradeSettleDetailBillsModel.java b/service/src/main/java/com/hfkj/model/TradeSettleDetailBillsModel.java new file mode 100644 index 0000000..ef5b304 --- /dev/null +++ b/service/src/main/java/com/hfkj/model/TradeSettleDetailBillsModel.java @@ -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; + + +} diff --git a/service/src/main/java/com/hfkj/service/BsTradeOrderService.java b/service/src/main/java/com/hfkj/service/BsTradeOrderService.java index 2d928d3..729547b 100644 --- a/service/src/main/java/com/hfkj/service/BsTradeOrderService.java +++ b/service/src/main/java/com/hfkj/service/BsTradeOrderService.java @@ -74,12 +74,4 @@ public interface BsTradeOrderService { */ Map countTradeOrderPrice(Map param); - /** - * 交易详情统计 - * @param param - * @return - */ - List> getTradeOrderDetailCount(Map param); - - } diff --git a/service/src/main/java/com/hfkj/service/BsTradeSettleService.java b/service/src/main/java/com/hfkj/service/BsTradeSettleService.java index 7da261c..7ccce77 100644 --- a/service/src/main/java/com/hfkj/service/BsTradeSettleService.java +++ b/service/src/main/java/com/hfkj/service/BsTradeSettleService.java @@ -32,4 +32,18 @@ public interface BsTradeSettleService { * @return */ List getTradeSettleList(Map param); + + /** + * 交易结算统计 + * @param param + * @return + */ + Map getTradeSettleCount(Map param); + + /** + * 交易清算统计【结算日】 + * @param param + * @return + */ + List> getTradeSettleDayCount(Map param); } diff --git a/service/src/main/java/com/hfkj/service/impl/BsTradeOrderServiceImpl.java b/service/src/main/java/com/hfkj/service/impl/BsTradeOrderServiceImpl.java index f89e4d6..aeb22f5 100644 --- a/service/src/main/java/com/hfkj/service/impl/BsTradeOrderServiceImpl.java +++ b/service/src/main/java/com/hfkj/service/impl/BsTradeOrderServiceImpl.java @@ -435,11 +435,4 @@ public class BsTradeOrderServiceImpl implements BsTradeOrderService { return tradeOrderMapper.countTradeOrderPrice(paramMap); } - @Override - public List> getTradeOrderDetailCount(Map param) { - param.put("settleTimeS", DateUtil.date2String(new Date(MapUtils.getLong(param, "settleTimeS")), DateUtil.Y_M_D)); - param.put("settleTimeE", DateUtil.date2String(new Date(MapUtils.getLong(param, "settleTimeE")), DateUtil.Y_M_D)); - return tradeOrderMapper.queryTradeOrderDetailCount(param); - } - } diff --git a/service/src/main/java/com/hfkj/service/impl/BsTradeSettleServiceImpl.java b/service/src/main/java/com/hfkj/service/impl/BsTradeSettleServiceImpl.java index 5c0218c..512f4dd 100644 --- a/service/src/main/java/com/hfkj/service/impl/BsTradeSettleServiceImpl.java +++ b/service/src/main/java/com/hfkj/service/impl/BsTradeSettleServiceImpl.java @@ -1,8 +1,12 @@ package com.hfkj.service.impl; +import com.hfkj.common.utils.DateUtil; import com.hfkj.dao.BsTradeSettleMapper; import com.hfkj.entity.BsTradeSettle; +import com.hfkj.entity.BsTradeSettleExample; import com.hfkj.service.BsTradeSettleService; +import org.apache.commons.collections4.MapUtils; +import org.apache.commons.lang3.StringUtils; import org.springframework.stereotype.Service; import javax.annotation.Resource; @@ -39,6 +43,45 @@ public class BsTradeSettleServiceImpl implements BsTradeSettleService { @Override public List getTradeSettleList(Map param) { - return null; + BsTradeSettleExample example = new BsTradeSettleExample(); + BsTradeSettleExample.Criteria criteria = example.createCriteria().andStatusNotEqualTo(0); + + if (StringUtils.isNotBlank(MapUtils.getString(param, "merNo"))) { + criteria.andMerNoEqualTo(MapUtils.getString(param, "merNo")); + } + + if (MapUtils.getLong(param, "settleTimeS") != null) { + criteria.andSettleDateGreaterThanOrEqualTo(new Date(MapUtils.getLong(param, "settleTimeS"))); + } + + if (MapUtils.getLong(param, "settleTimeE") != null) { + criteria.andSettleDateLessThanOrEqualTo(new Date(MapUtils.getLong(param, "settleTimeS"))); + } + + if (StringUtils.isNotBlank(MapUtils.getString(param, "outTradeNo"))) { + criteria.andOutTradeNoLike("%" + MapUtils.getString(param, "outTradeNo") + "%"); + } + + if (StringUtils.isNotBlank(MapUtils.getString(param, "accTradeNo"))) { + criteria.andAccTradeNoLike("%" + MapUtils.getString(param, "accTradeNo") + "%"); + } + + example.setOrderByClause("trade_time desc"); + return tradeSettleMapper.selectByExample(example); + } + + @Override + public Map getTradeSettleCount(Map param) { + param.put("settleTimeS", DateUtil.date2String(new Date(MapUtils.getLong(param, "settleTimeS")), DateUtil.Y_M_D)); + param.put("settleTimeE", DateUtil.date2String(new Date(MapUtils.getLong(param, "settleTimeE")), DateUtil.Y_M_D)); + return tradeSettleMapper.queryTradeSettleCount(param); + } + + + @Override + public List> getTradeSettleDayCount(Map param) { + param.put("settleTimeS", DateUtil.date2String(new Date(MapUtils.getLong(param, "settleTimeS")), DateUtil.Y_M_D)); + param.put("settleTimeE", DateUtil.date2String(new Date(MapUtils.getLong(param, "settleTimeE")), DateUtil.Y_M_D)); + return tradeSettleMapper.queryTradeSettleDayCount(param); } } diff --git a/service/src/main/java/com/hfkj/sysenum/TradeSettleTradeType.java b/service/src/main/java/com/hfkj/sysenum/TradeSettleTradeType.java index 4c34cf5..ee247dc 100644 --- a/service/src/main/java/com/hfkj/sysenum/TradeSettleTradeType.java +++ b/service/src/main/java/com/hfkj/sysenum/TradeSettleTradeType.java @@ -1,12 +1,14 @@ package com.hfkj.sysenum; +import java.util.Objects; + /** * @className: TradeSettleTradeType * @author: HuRui * @date: 2023/8/4 **/ public enum TradeSettleTradeType { - type1(1, "支付"), + type1(1, "交易支付"), type2(2, "交易退款"), ; @@ -19,6 +21,15 @@ public enum TradeSettleTradeType { this.name = name; } + public static TradeSettleTradeType getNameByCode(Integer code) { + for (TradeSettleTradeType ele : values()) { + if (Objects.equals(code,ele.getNumber())) { + return ele; + } + } + return null; + } + public Integer getNumber() { return number; }