Showing
1 changed file
with
25 additions
and
13 deletions
@@ -26,6 +26,7 @@ import com.yohobuy.ufo.model.order.resp.TradeBillsResp; | @@ -26,6 +26,7 @@ import com.yohobuy.ufo.model.order.resp.TradeBillsResp; | ||
26 | import com.yohobuy.ufo.model.user.req.AuthorizeInfoReq; | 26 | import com.yohobuy.ufo.model.user.req.AuthorizeInfoReq; |
27 | import com.yohobuy.ufo.model.user.resp.AuthorizeResultRespVO; | 27 | import com.yohobuy.ufo.model.user.resp.AuthorizeResultRespVO; |
28 | import org.apache.commons.collections.CollectionUtils; | 28 | import org.apache.commons.collections.CollectionUtils; |
29 | +import org.apache.commons.lang3.ObjectUtils; | ||
29 | import org.apache.commons.lang3.StringUtils; | 30 | import org.apache.commons.lang3.StringUtils; |
30 | import org.elasticsearch.common.collect.Lists; | 31 | import org.elasticsearch.common.collect.Lists; |
31 | import org.elasticsearch.common.collect.Maps; | 32 | import org.elasticsearch.common.collect.Maps; |
@@ -325,21 +326,10 @@ public class TradeBillsServiceImpl implements ITradeBillsService { | @@ -325,21 +326,10 @@ public class TradeBillsServiceImpl implements ITradeBillsService { | ||
325 | resp.setMobile(StringUtils.EMPTY); | 326 | resp.setMobile(StringUtils.EMPTY); |
326 | resp.setAlipayAccount(StringUtils.EMPTY); | 327 | resp.setAlipayAccount(StringUtils.EMPTY); |
327 | resp.setOrderCode(item.getOrderCode()); | 328 | resp.setOrderCode(item.getOrderCode()); |
328 | - resp.setPaidOrderCode(Optional.ofNullable(item.getPaidOrderCode()) | ||
329 | - .filter(e -> e > 0) | ||
330 | - .map(Object::toString) | ||
331 | - .orElseGet(() -> { | ||
332 | - String defaultValue = "-"; | ||
333 | - if (isTransferTrade(item)) { | ||
334 | - return outTradeNoMap.getOrDefault(item.getId(), outTradeNoMap.getOrDefault(item.getDealRelateId(), defaultValue)); | ||
335 | - } else { | ||
336 | - return defaultValue; | ||
337 | - } | ||
338 | - })); | 329 | + resp.setPaidOrderCode(buildPaidOrderCode(item, outTradeNoMap)); |
339 | resp.setAmount(item.getAmount()); | 330 | resp.setAmount(item.getAmount()); |
340 | resp.setIncomeOutcome(item.getIncomeOutcome()); | 331 | resp.setIncomeOutcome(item.getIncomeOutcome()); |
341 | - resp.setCreateTimeStr(null == item.getCreateTime() ? StringUtils.EMPTY | ||
342 | - : DateUtil.long2DateStr(item.getCreateTime().longValue() * 1000, "yyyy-MM-dd HH:mm:ss")); | 332 | + resp.setCreateTimeStr(buildPaidTime(item)); |
343 | resp.setOperatorUid(item.getDealUid()); | 333 | resp.setOperatorUid(item.getDealUid()); |
344 | resp.setOperatorName((item.getDealUid() == null || item.getDealUid() == 0) ? "系统" : item.getDealUserName()); | 334 | resp.setOperatorName((item.getDealUid() == null || item.getDealUid() == 0) ? "系统" : item.getDealUserName()); |
345 | resp.setTradeStatus(item.getTradeStatus()); | 335 | resp.setTradeStatus(item.getTradeStatus()); |
@@ -370,6 +360,28 @@ public class TradeBillsServiceImpl implements ITradeBillsService { | @@ -370,6 +360,28 @@ public class TradeBillsServiceImpl implements ITradeBillsService { | ||
370 | .collect(Collectors.toList()); | 360 | .collect(Collectors.toList()); |
371 | } | 361 | } |
372 | 362 | ||
363 | + private String buildPaidOrderCode(TradeBills item, Map<Integer, String> outTradeNoMap) { | ||
364 | + return Optional.ofNullable(item.getPaidOrderCode()) | ||
365 | + .filter(e -> e > 0) | ||
366 | + .map(Object::toString) | ||
367 | + .orElseGet(() -> { | ||
368 | + String defaultValue = "-"; | ||
369 | + if (isTransferTrade(item)) { | ||
370 | + return outTradeNoMap.getOrDefault(item.getId(), outTradeNoMap.getOrDefault(item.getDealRelateId(), defaultValue)); | ||
371 | + } else { | ||
372 | + return defaultValue; | ||
373 | + } | ||
374 | + }); | ||
375 | + } | ||
376 | + | ||
377 | + private String buildPaidTime(TradeBills item) { | ||
378 | + long dealTime = ObjectUtils.defaultIfNull(item.getDealTime(), 0); | ||
379 | + if (dealTime == 0) { | ||
380 | + dealTime = item.getCreateTime(); | ||
381 | + } | ||
382 | + return DateUtil.long2DateStr(dealTime * 1000, "yyyy-MM-dd HH:mm:ss"); | ||
383 | + } | ||
384 | + | ||
373 | private JSONObject asyncCallQueryAliAccountJsonObject(Integer uid) { | 385 | private JSONObject asyncCallQueryAliAccountJsonObject(Integer uid) { |
374 | AuthorizeInfoReq req = new AuthorizeInfoReq(); | 386 | AuthorizeInfoReq req = new AuthorizeInfoReq(); |
375 | req.setUid(uid); | 387 | req.setUid(uid); |
-
Please register or login to post a comment