diff --git a/jsowell-common/src/main/java/com/jsowell/common/util/DateUtils.java b/jsowell-common/src/main/java/com/jsowell/common/util/DateUtils.java index 7466b849f..34c7878fe 100644 --- a/jsowell-common/src/main/java/com/jsowell/common/util/DateUtils.java +++ b/jsowell-common/src/main/java/com/jsowell/common/util/DateUtils.java @@ -65,6 +65,23 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils { return dateTimeNow(YYYY_MM_DD); } + /** + * 获取昨天日期LocalDate + * @return + */ + public static LocalDate getYesterday() { + return LocalDate.now().plusDays(-1); + } + + /** + * 获取昨天日期String + * @return + */ + public static String getYesterdayStr() { + LocalDate yesterday = getYesterday(); + return yesterday.toString(); + } + /** * 获取当前日期, 默认格式为yyyy-MM-dd HH:mm:ss * diff --git a/jsowell-pile/src/main/java/com/jsowell/adapay/service/AdapayService.java b/jsowell-pile/src/main/java/com/jsowell/adapay/service/AdapayService.java index 035f5b7e0..910db69d4 100644 --- a/jsowell-pile/src/main/java/com/jsowell/adapay/service/AdapayService.java +++ b/jsowell-pile/src/main/java/com/jsowell/adapay/service/AdapayService.java @@ -25,6 +25,7 @@ import com.jsowell.common.enums.adapay.MerchantDelayModeEnum; import com.jsowell.common.enums.ykc.ReturnCodeEnum; import com.jsowell.common.exception.BusinessException; import com.jsowell.common.util.AdapayUtil; +import com.jsowell.common.util.DateUtils; import com.jsowell.common.util.StringUtils; import com.jsowell.common.util.ZipUtil; import com.jsowell.common.util.id.IdUtils; @@ -34,6 +35,7 @@ import com.jsowell.pile.domain.ClearingWithdrawInfo; import com.jsowell.pile.domain.MemberBasicInfo; import com.jsowell.pile.dto.PayOrderDTO; import com.jsowell.pile.service.*; +import com.jsowell.pile.vo.web.WithdrawInfoVO; import lombok.extern.slf4j.Slf4j; import org.apache.commons.collections4.CollectionUtils; import org.springframework.beans.factory.annotation.Autowired; @@ -524,10 +526,20 @@ public class AdapayService { vo.setSettleAccountId(adapayMemberAccount.getSettleAccountId()); // 昨日收入 - vo.setYesterdayRevenue(BigDecimal.ZERO); + BigDecimal yesterdayRevenue = BigDecimal.ZERO; + ClearingBillInfo clearingBillInfo = clearingBillInfoService.selectByMerchantIdAndTradeDate(merchantId, DateUtils.getYesterdayStr()); + if (clearingBillInfo != null) { + yesterdayRevenue = clearingBillInfo.getActualClearingAmount(); + } + vo.setYesterdayRevenue(yesterdayRevenue); // 累计提现金额 - vo.setTotalWithdraw(BigDecimal.ZERO); + BigDecimal totalWithdraw = BigDecimal.ZERO; + List withdrawInfoVOS = clearingWithdrawInfoService.selectByMerchantId(merchantId); + if (CollectionUtils.isNotEmpty(withdrawInfoVOS)) { + totalWithdraw = withdrawInfoVOS.stream().map(WithdrawInfoVO::getCashAmt).reduce(BigDecimal.ZERO, BigDecimal::add); + } + vo.setTotalWithdraw(totalWithdraw); return vo; } diff --git a/jsowell-pile/src/main/java/com/jsowell/pile/service/ClearingWithdrawInfoService.java b/jsowell-pile/src/main/java/com/jsowell/pile/service/ClearingWithdrawInfoService.java index 3351cf599..86bb7d4ec 100644 --- a/jsowell-pile/src/main/java/com/jsowell/pile/service/ClearingWithdrawInfoService.java +++ b/jsowell-pile/src/main/java/com/jsowell/pile/service/ClearingWithdrawInfoService.java @@ -8,7 +8,6 @@ import com.jsowell.pile.vo.web.WithdrawInfoVO; import java.util.List; public interface ClearingWithdrawInfoService{ - int deleteByPrimaryKey(Integer id); int insert(ClearingWithdrawInfo record); diff --git a/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/ClearingWithdrawInfoServiceImpl.java b/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/ClearingWithdrawInfoServiceImpl.java index 0ded732d5..15743cecd 100644 --- a/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/ClearingWithdrawInfoServiceImpl.java +++ b/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/ClearingWithdrawInfoServiceImpl.java @@ -118,7 +118,7 @@ public class ClearingWithdrawInfoServiceImpl implements ClearingWithdrawInfoServ vo.setWithdrawCode(withdrawCode); vo.setApplicationTime(DateUtils.formatDateTime(clearingWithdrawInfo.getApplicationTime())); vo.setStatusDesc(clearingWithdrawInfo.getWithdrawStatus()); - vo.setCashAmt(String.valueOf(clearingWithdrawInfo.getCreditedAmt())); + vo.setCashAmt(clearingWithdrawInfo.getCreditedAmt()); resultList.add(vo); } return resultList; diff --git a/jsowell-pile/src/main/java/com/jsowell/pile/vo/web/WithdrawInfoVO.java b/jsowell-pile/src/main/java/com/jsowell/pile/vo/web/WithdrawInfoVO.java index c98df3917..c7a60f150 100644 --- a/jsowell-pile/src/main/java/com/jsowell/pile/vo/web/WithdrawInfoVO.java +++ b/jsowell-pile/src/main/java/com/jsowell/pile/vo/web/WithdrawInfoVO.java @@ -3,6 +3,8 @@ package com.jsowell.pile.vo.web; import lombok.Getter; import lombok.Setter; +import java.math.BigDecimal; + /** * 提现记录VO */ @@ -22,5 +24,5 @@ public class WithdrawInfoVO { private String applicationTime; // 提现金额 - private String cashAmt; + private BigDecimal cashAmt; }