From 150a19b58d53ecc56fda26cb6568bc2d8bfc6be6 Mon Sep 17 00:00:00 2001 From: jiangping <jp@doumee.com> Date: 星期日, 08 十月 2023 09:59:04 +0800 Subject: [PATCH] UUID --- server/services/src/main/java/com/doumee/service/business/impl/WxBillServiceImpl.java | 31 ++++++++++++++++++++++++++++--- 1 files changed, 28 insertions(+), 3 deletions(-) diff --git a/server/services/src/main/java/com/doumee/service/business/impl/WxBillServiceImpl.java b/server/services/src/main/java/com/doumee/service/business/impl/WxBillServiceImpl.java index d38bd2d..429e6eb 100644 --- a/server/services/src/main/java/com/doumee/service/business/impl/WxBillServiceImpl.java +++ b/server/services/src/main/java/com/doumee/service/business/impl/WxBillServiceImpl.java @@ -8,8 +8,10 @@ import com.doumee.core.utils.DateUtil; import com.doumee.core.utils.Utils; import com.doumee.core.wx.WxMiniConfig; +import com.doumee.core.wx.WxPayProperties; import com.doumee.dao.business.WxBillDetailMapper; import com.doumee.dao.business.WxBillMapper; +import com.doumee.dao.business.model.Goodsorder; import com.doumee.dao.business.model.WxBill; import com.doumee.dao.business.model.WxBillDetail; import com.doumee.service.business.WxBillService; @@ -22,6 +24,7 @@ import com.github.binarywang.wxpay.bean.result.WxPayBillResult; import com.github.binarywang.wxpay.exception.WxPayException; import org.apache.commons.lang3.StringUtils; +import org.checkerframework.checker.units.qual.C; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -157,10 +160,11 @@ } @Override @Transactional(rollbackFor = {BusinessException.class,Exception.class}) - public void getWxBill() { + public void getWxBill(String billDate) { // 鑾峰彇浜ゆ槗璐﹀崟鏁版嵁 WxPayDownloadBillRequest request = new WxPayDownloadBillRequest(); - String billDate = DateUtil.beforeDateToStr(1); +// String billDate = DateUtil.beforeDateToStr(1); + Date ydate = DateUtil.addDaysToDate(new Date(), -1); request.setBillDate(billDate); request.setBillType("SUCCESS"); WxPayBillResult response = null; @@ -217,10 +221,23 @@ } wxBillMapper.delete(new UpdateWrapper<WxBill>().lambda().eq( WxBill::getId, bill.getId())); wxBillDetailMapper.delete(new UpdateWrapper<WxBillDetail>().lambda().eq( WxBillDetail::getPid, bill.getId())); + +// getTotalAndIncome(bill,ydate);//缁熻缁撶畻閲戦鍜岃嚜琛岃溅鏀跺叆 + //鎬荤粨绠楅噾棰濓紙鏀舵閲戦-鏀舵鎵嬬画璐�-閫�娆鹃噾棰�-閫�娆炬墜缁垂锛堣礋鏁帮級锛� + bill.setTotal(bill.getSumSuccessFee().subtract(bill.getSumCmmsAmt()).subtract(bill.getSumRefundFee()).subtract(bill.getSumRefundCmmsAmt())); +// //鑷杞︽敹鍏ワ紙鏀舵閲戦-鏀舵鎵嬬画璐�-閫�娆鹃噾棰�-閫�娆炬墜缁垂锛堣礋鏁帮級锛� +// bill.setBikeFee(bill.getSumSuccessFee().subtract(bill.getSumRefundFee())); wxBillMapper.insert(bill); if(detailList.size()>0){ wxBillDetailMapper.insertBatch(detailList); } + } + private void getTotalAndIncome(WxBill bill,Date date) { + QueryWrapper<Goodsorder> queryWrapper = new QueryWrapper<>(); + queryWrapper.apply("to_char(create_date, 'yyyy-MM-dd') = {0}", date); + queryWrapper.lambda().eq(Goodsorder::getIsdeleted, Constants.ZERO); + queryWrapper.lambda().eq(Goodsorder::getStatus, Constants.goodsorderStatus.over);//宸茬祼绠� + queryWrapper.select("sum(money) as totalMoney","sum(close_money) as totalCloseMoney"); } private List<WxBillDetail> getDetialModelByInfo(WxBill bill, List<WxPayBillInfo> billInfoList) { @@ -261,7 +278,15 @@ detail.setRateRemark(info.getFeeRemark());//璐圭巼澶囨敞 detail.setRefundSuccessDate(DateUtil.getDateFromString2(info.getRefundSuccessTime()));//鎴愬姛閫�娆炬椂闂� detail.setRefundApplyDate(DateUtil.getDateFromString2(info.getRefundTime())); //鐢宠閫�娆炬椂闂� - + //璁$畻鑷杞︽敹鍏ワ紝鍖归厤鏉ヨ嚜鑷杞﹀皬绋嬪簭鐨勬墍鏈夋敮浠樻垚鍔熷拰閫�娆炬垚鍔熺殑閲戦锛屼綔涓鸿嚜琛岃溅鏀跺叆锛堢疮璁℃敹娆鹃噾棰�-绱閫�娆炬垚鍔熼噾棰濓級 + if(StringUtils.equals(detail.getAppid(), WxMiniConfig.wxPayService.getConfig().getAppId())){ + //鑷杞︽敹鍏ョ疮璁℃敹娆鹃噾棰� + bill.setBikeFee(bill.getBikeFee().add(detail.getSettlementTotalFee())); + if(StringUtils.equals(detail.getRefundSuccessStatus(),"SUCCESS")){ + //濡傛灉閫�娆炬垚鍔燂紝鎵i櫎閫�娆鹃噾棰� + bill.setBikeFee(bill.getBikeFee().subtract(detail.getApplyRefundFee())); + } + } detailList.add(detail); } } -- Gitblit v1.9.3