...
|
...
|
@@ -10,10 +10,10 @@ import com.yoho.ufo.order.response.TradeBillsVo; |
|
|
import com.yohobuy.ufo.model.order.common.AlipayBatchTransferErrorEnum;
|
|
|
import org.apache.commons.lang3.ObjectUtils;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import reactor.core.publisher.Mono;
|
|
|
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
import java.util.Optional;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
public class TradeBillsListBuilder {
|
...
|
...
|
@@ -61,14 +61,13 @@ public class TradeBillsListBuilder { |
|
|
|
|
|
|
|
|
private String buildPaidOrderCode(TradeBills item) {
|
|
|
return Mono.justOrEmpty(item.getPaidOrderCode())
|
|
|
return Optional.ofNullable(item.getPaidOrderCode())
|
|
|
.filter(e -> e > 0)
|
|
|
.map(Object::toString)
|
|
|
.switchIfEmpty(Mono.justOrEmpty(item.getId())
|
|
|
.map(transferMessageMap::get)
|
|
|
.map(TradeBillsTransferMessage::getOutTradeNo))
|
|
|
.defaultIfEmpty("-")
|
|
|
.block();
|
|
|
.orElseGet(() -> Optional.ofNullable(item.getId())
|
|
|
.map(id -> transferMessageMap.get(id))
|
|
|
.map(TradeBillsTransferMessage::getOutTradeNo)
|
|
|
.orElse("-"));
|
|
|
}
|
|
|
|
|
|
private String buildTimeStr(Integer time) {
|
...
|
...
|
@@ -85,14 +84,13 @@ public class TradeBillsListBuilder { |
|
|
.filter(e -> e.isFail())
|
|
|
.ifPresent(e -> {
|
|
|
//打款失败原因
|
|
|
String failReason = Mono.justOrEmpty(item.getId())
|
|
|
String failReason = Optional.ofNullable(item.getId())
|
|
|
.map(transferMessageMap::get)
|
|
|
.map(TradeBillsTransferMessage::tradeResultMessage)
|
|
|
.switchIfEmpty(Mono.justOrEmpty(item.getPayErrorCode())
|
|
|
.orElseGet(() -> Optional.ofNullable(item.getPayErrorCode())
|
|
|
.map(AlipayBatchTransferErrorEnum::getByCode)
|
|
|
.map(AlipayBatchTransferErrorEnum::getDesc))
|
|
|
.defaultIfEmpty("-")
|
|
|
.block();
|
|
|
.map(AlipayBatchTransferErrorEnum::getDesc)
|
|
|
.orElse(e.getDesc()));
|
|
|
desc.append(failReason);
|
|
|
});
|
|
|
return desc.toString();
|
...
|
...
|
|