...
|
...
|
@@ -30,6 +30,7 @@ import com.yohobuy.ufo.model.user.resp.AuthorizeResultRespVO; |
|
|
import org.apache.commons.collections.CollectionUtils;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.elasticsearch.common.collect.Lists;
|
|
|
import org.elasticsearch.common.collect.Maps;
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
...
|
...
|
@@ -241,9 +242,8 @@ public class TradeBillsServiceImpl implements ITradeBillsService { |
|
|
req.setOrderCode2(Optional.of(req.getOrderCode())
|
|
|
.map(e->buyerOrderGoodsMapper.selectByOrderCodeOne(e.toString()))
|
|
|
.map(e->e.getSkup())
|
|
|
.map(e->sellerOrderMapper.selectBySkups(Lists.newArrayList(e)))
|
|
|
.filter(CollectionUtils::isNotEmpty)
|
|
|
.map(e->e.get(0).getOrderCode())
|
|
|
.map(skup->sellerOrderMapper.selectBySkup(skup))
|
|
|
.map(sellerOrder->sellerOrder.getOrderCode())
|
|
|
.map(Long::valueOf)
|
|
|
.orElse(null));
|
|
|
}
|
...
|
...
|
@@ -258,9 +258,10 @@ public class TradeBillsServiceImpl implements ITradeBillsService { |
|
|
if (CollectionUtils.isEmpty(tradeBillsList)) {
|
|
|
return null;
|
|
|
}
|
|
|
Map<Integer, String> outTradeNoMap = getTransferOutTradeNoMap(tradeBillsList);
|
|
|
|
|
|
PageResponseBO<TradeBillsResp> result = new PageResponseBO<>();
|
|
|
result.setList(convertToResp(tradeBillsList));
|
|
|
result.setList(convertToResp(tradeBillsList,outTradeNoMap));
|
|
|
result.setPage(req.getPage());
|
|
|
result.setSize(req.getSize());
|
|
|
result.setTotal(total);
|
...
|
...
|
@@ -268,6 +269,25 @@ public class TradeBillsServiceImpl implements ITradeBillsService { |
|
|
return result;
|
|
|
}
|
|
|
|
|
|
private Map<Integer, String> getTransferOutTradeNoMap(List<TradeBills> tradeBillsList) {
|
|
|
List<Long> orderCodes = tradeBillsList.stream()
|
|
|
.filter(item-> {
|
|
|
MoneyTypeEnum moneyTypeEnum = MoneyTypeEnum.getMoneyTypeByUserTypeAndTradeType(item.getUserType(), item.getTradeType());
|
|
|
return moneyTypeEnum == MoneyTypeEnum.deposit_rebate
|
|
|
|| moneyTypeEnum == MoneyTypeEnum.buyer_compensatoryPayment
|
|
|
|| moneyTypeEnum == MoneyTypeEnum.seller_goodsPayment
|
|
|
|| moneyTypeEnum == MoneyTypeEnum.seller_compensatoryPayment ;
|
|
|
})
|
|
|
.map(TradeBills::getOrderCode)
|
|
|
.collect(Collectors.toList());
|
|
|
if(CollectionUtils.isEmpty(orderCodes)){
|
|
|
return Maps.newHashMap();
|
|
|
}
|
|
|
return tradeBillsMapper.selectTransferOutTradeNoByOrderCodes(orderCodes)
|
|
|
.stream()
|
|
|
.collect(Collectors.toMap(TradeBillsTransferOutTradeNo::getId,TradeBillsTransferOutTradeNo::getOutTradeNo));
|
|
|
}
|
|
|
|
|
|
public AuthorizeResultRespVO queryAuthorizeInfoByUid(Integer uid){
|
|
|
if(uid==null||uid<=0){
|
|
|
return null;
|
...
|
...
|
@@ -328,7 +348,8 @@ public class TradeBillsServiceImpl implements ITradeBillsService { |
|
|
}
|
|
|
|
|
|
|
|
|
private List<TradeBillsResp> convertToResp(List<TradeBills> tradeBillsList) {
|
|
|
private List<TradeBillsResp> convertToResp(List<TradeBills> tradeBillsList,Map<Integer,String> outTradeNoMap) {
|
|
|
|
|
|
return tradeBillsList.stream()
|
|
|
.map(item -> {
|
|
|
TradeBillsResp resp = new TradeBillsResp();
|
...
|
...
|
@@ -340,7 +361,7 @@ public class TradeBillsServiceImpl implements ITradeBillsService { |
|
|
resp.setPaidOrderCode(Optional.ofNullable(item.getPaidOrderCode())
|
|
|
.filter(e -> e > 0)
|
|
|
.map(Object::toString)
|
|
|
.orElse("-"));
|
|
|
.orElseGet(() -> outTradeNoMap.getOrDefault(item.getId(), outTradeNoMap.getOrDefault(item.getDealRelateId(), "-"))));
|
|
|
resp.setAmount(item.getAmount());
|
|
|
resp.setIncomeOutcome(item.getIncomeOutcome());
|
|
|
resp.setCreateTimeStr(null == item.getCreateTime() ? StringUtils.EMPTY
|
...
|
...
|
|