diff --git a/jsowell-pile/src/main/java/com/jsowell/pile/mapper/ClearingWithdrawInfoMapper.java b/jsowell-pile/src/main/java/com/jsowell/pile/mapper/ClearingWithdrawInfoMapper.java index f84659fc6..c033d868b 100644 --- a/jsowell-pile/src/main/java/com/jsowell/pile/mapper/ClearingWithdrawInfoMapper.java +++ b/jsowell-pile/src/main/java/com/jsowell/pile/mapper/ClearingWithdrawInfoMapper.java @@ -68,4 +68,6 @@ public interface ClearingWithdrawInfoMapper { ClearingBillVO selectWithdrawInfoByOrderCode(@Param("orderCode") String orderCode); List selectWithdrawInfoByOrderCodeList(@Param("orderCodeList") List orderCodeList); + + List selectByMerchantId(@Param("merchantId") String merchantId); } \ No newline at end of file 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 402a55d73..5cc3ec1a8 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 @@ -1,9 +1,19 @@ package com.jsowell.pile.service.impl; +import com.google.common.collect.Lists; +import com.huifu.adapay.core.exception.BaseAdaPayException; +import com.jsowell.adapay.service.AdapayService; +import com.jsowell.adapay.vo.DrawCashDetailVO; +import com.jsowell.common.util.DateUtils; +import com.jsowell.common.util.StringUtils; import com.jsowell.pile.domain.ClearingWithdrawInfo; import com.jsowell.pile.mapper.ClearingWithdrawInfoMapper; import com.jsowell.pile.service.ClearingWithdrawInfoService; +import com.jsowell.pile.service.IPileMerchantInfoService; import com.jsowell.pile.vo.web.ClearingBillVO; +import com.jsowell.pile.vo.web.WithdrawInfoVO; +import org.apache.commons.collections4.CollectionUtils; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import javax.annotation.Resource; @@ -11,6 +21,12 @@ import java.util.List; @Service public class ClearingWithdrawInfoServiceImpl implements ClearingWithdrawInfoService{ + @Autowired + private AdapayService adapayService; + + @Autowired + private IPileMerchantInfoService pileMerchantInfoService; + @Resource private ClearingWithdrawInfoMapper clearingWithdrawInfoMapper; @@ -82,4 +98,33 @@ public class ClearingWithdrawInfoServiceImpl implements ClearingWithdrawInfoServ return clearingWithdrawInfoMapper.selectWithdrawInfoByOrderCodeList(orderCodeList); } + /** + * 查询运营商提现记录 + */ + public List selectByMerchantId(String merchantId) throws BaseAdaPayException { + List resultList = Lists.newArrayList(); + List infoList = clearingWithdrawInfoMapper.selectByMerchantId(merchantId); + if (CollectionUtils.isEmpty(infoList)) { + return resultList; + } + String wechatAppId = pileMerchantInfoService.queryAppIdByMerchantId(merchantId); + if (StringUtils.isBlank(wechatAppId)) { + return resultList; + } + for (ClearingWithdrawInfo clearingWithdrawInfo : infoList) { + String withdrawCode = clearingWithdrawInfo.getWithdrawCode(); + DrawCashDetailVO drawCashDetailVO = adapayService.queryDrawCashDetail(withdrawCode, wechatAppId); + WithdrawInfoVO vo = new WithdrawInfoVO(); + vo.setMerchantId(merchantId); + vo.setWithdrawCode(withdrawCode); + vo.setApplicationTime(DateUtils.formatDateTime(clearingWithdrawInfo.getApplicationTime())); + if (drawCashDetailVO != null) { + vo.setStatusDesc(drawCashDetailVO.getStatusDesc()); + vo.setCashAmt(drawCashDetailVO.getCashAmt()); + } + 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 new file mode 100644 index 000000000..c98df3917 --- /dev/null +++ b/jsowell-pile/src/main/java/com/jsowell/pile/vo/web/WithdrawInfoVO.java @@ -0,0 +1,26 @@ +package com.jsowell.pile.vo.web; + +import lombok.Getter; +import lombok.Setter; + +/** + * 提现记录VO + */ +@Getter +@Setter +public class WithdrawInfoVO { + // 运营商id + private String merchantId; + + // 提现编号 + private String withdrawCode; + + // 提现状态描述 + private String statusDesc; + + // 申请时间 + private String applicationTime; + + // 提现金额 + private String cashAmt; +} diff --git a/jsowell-pile/src/main/resources/mapper/pile/ClearingWithdrawInfoMapper.xml b/jsowell-pile/src/main/resources/mapper/pile/ClearingWithdrawInfoMapper.xml index 4073807da..9cf850a03 100644 --- a/jsowell-pile/src/main/resources/mapper/pile/ClearingWithdrawInfoMapper.xml +++ b/jsowell-pile/src/main/resources/mapper/pile/ClearingWithdrawInfoMapper.xml @@ -468,4 +468,12 @@ #{orderCode,jdbcType=VARCHAR} + + \ No newline at end of file