Authored by LUOXC

fixbug

... ... @@ -26,6 +26,7 @@ import com.yohobuy.ufo.model.order.resp.TradeBillsResp;
import com.yohobuy.ufo.model.user.req.AuthorizeInfoReq;
import com.yohobuy.ufo.model.user.resp.AuthorizeResultRespVO;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
import org.elasticsearch.common.collect.Lists;
import org.elasticsearch.common.collect.Maps;
... ... @@ -325,21 +326,10 @@ public class TradeBillsServiceImpl implements ITradeBillsService {
resp.setMobile(StringUtils.EMPTY);
resp.setAlipayAccount(StringUtils.EMPTY);
resp.setOrderCode(item.getOrderCode());
resp.setPaidOrderCode(Optional.ofNullable(item.getPaidOrderCode())
.filter(e -> e > 0)
.map(Object::toString)
.orElseGet(() -> {
String defaultValue = "-";
if (isTransferTrade(item)) {
return outTradeNoMap.getOrDefault(item.getId(), outTradeNoMap.getOrDefault(item.getDealRelateId(), defaultValue));
} else {
return defaultValue;
}
}));
resp.setPaidOrderCode(buildPaidOrderCode(item, outTradeNoMap));
resp.setAmount(item.getAmount());
resp.setIncomeOutcome(item.getIncomeOutcome());
resp.setCreateTimeStr(null == item.getCreateTime() ? StringUtils.EMPTY
: DateUtil.long2DateStr(item.getCreateTime().longValue() * 1000, "yyyy-MM-dd HH:mm:ss"));
resp.setCreateTimeStr(buildPaidTime(item));
resp.setOperatorUid(item.getDealUid());
resp.setOperatorName((item.getDealUid() == null || item.getDealUid() == 0) ? "系统" : item.getDealUserName());
resp.setTradeStatus(item.getTradeStatus());
... ... @@ -370,6 +360,28 @@ public class TradeBillsServiceImpl implements ITradeBillsService {
.collect(Collectors.toList());
}
private String buildPaidOrderCode(TradeBills item, Map<Integer, String> outTradeNoMap) {
return Optional.ofNullable(item.getPaidOrderCode())
.filter(e -> e > 0)
.map(Object::toString)
.orElseGet(() -> {
String defaultValue = "-";
if (isTransferTrade(item)) {
return outTradeNoMap.getOrDefault(item.getId(), outTradeNoMap.getOrDefault(item.getDealRelateId(), defaultValue));
} else {
return defaultValue;
}
});
}
private String buildPaidTime(TradeBills item) {
long dealTime = ObjectUtils.defaultIfNull(item.getDealTime(), 0);
if (dealTime == 0) {
dealTime = item.getCreateTime();
}
return DateUtil.long2DateStr(dealTime * 1000, "yyyy-MM-dd HH:mm:ss");
}
private JSONObject asyncCallQueryAliAccountJsonObject(Integer uid) {
AuthorizeInfoReq req = new AuthorizeInfoReq();
req.setUid(uid);
... ...