Authored by caoyan

Merge branch 'test6.8.9' of http://git.yoho.cn/ufo/yohoufo-fore into test6.8.9

... ... @@ -47,6 +47,10 @@
<groupId>com.yoho.service.model</groupId>
<artifactId>message-service-model</artifactId>
</dependency>
<dependency>
<groupId>com.yoho.ufo.model</groupId>
<artifactId>user-ufo-model</artifactId>
</dependency>
</dependencies>
</project>
\ No newline at end of file
... ...
... ... @@ -37,6 +37,8 @@ public class TradeBillsBo {
// 订单是否是正常订单
private boolean normalFlag;
private String productName;
private String sizeName;
}
... ...
... ... @@ -2,8 +2,12 @@ package com.yohoufo.order.service.impl;
import com.google.common.cache.Cache;
import com.google.common.cache.CacheBuilder;
import com.yohoufo.dal.order.BuyerOrderGoodsMapper;
import com.yohoufo.dal.order.EntrySellerRechargeOrderMapper;
import com.yohoufo.dal.order.SellerOrderGoodsMapper;
import com.yohoufo.dal.order.TradeBillsMapper;
import com.yohoufo.dal.order.model.BuyerOrderGoods;
import com.yohoufo.dal.order.model.SellerOrderGoods;
import com.yohoufo.dal.order.model.TradeBills;
import com.yohoufo.order.common.TradeType;
import com.yohoufo.order.model.bo.TradeBillsBo;
... ... @@ -22,6 +26,9 @@ import java.util.Map;
import java.util.concurrent.Callable;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.TimeUnit;
import java.util.function.Function;
import java.util.stream.Collector;
import java.util.stream.Collectors;
/**资产
* Created by chenchao on 2018/9/28.
... ... @@ -35,6 +42,12 @@ public class AssetsService {
@Autowired
private TradeBillsMapper tradeBillsMapper;
@Autowired
private BuyerOrderGoodsMapper buyerOrderGoodsMapper;
@Autowired
private SellerOrderGoodsMapper sellerOrderGoodsMapper;
@Autowired
private EntrySellerRechargeOrderMapper entrySellerRechargeOrderMapper;
... ... @@ -99,8 +112,16 @@ public class AssetsService {
private List<TradeBillsBo> loadTradeBillFromDb(int uid,int page, int pageSize){
List<TradeBills> detailList = tradeBillsMapper.selectGoodsIncomeOrCompensateIncomeTradeBillsWithPageByUid(uid,pageSize*(page-1),pageSize);
List<TradeBillsBo> rtnList=new ArrayList<>();
if(detailList.isEmpty()) {
return rtnList;
}
List<Long> orderCodeList = detailList.stream().map(TradeBills::getOrderCode).collect(Collectors.toList());
List<BuyerOrderGoods> buyerOrderGoodsList = orderCodeList.isEmpty()?new ArrayList<>(): buyerOrderGoodsMapper.selectByOrderCodeList(uid, orderCodeList);
List<Integer> skups = buyerOrderGoodsList.stream().map(BuyerOrderGoods::getSkup).collect(Collectors.toList());
List<SellerOrderGoods> sellerOrderGoodsList = skups.isEmpty()?new ArrayList<>(): sellerOrderGoodsMapper.selectBySkups(skups);
Map<Long, BuyerOrderGoods> orderSkupMap = buyerOrderGoodsList.stream().collect(Collectors.toMap(BuyerOrderGoods::getOrderCode, Function.identity()));
Map<Integer, SellerOrderGoods> skupOrderMap = sellerOrderGoodsList.stream().collect(Collectors.toMap(SellerOrderGoods::getId, Function.identity()));
for(TradeBills bills:detailList){
TradeBillsBo bo = new TradeBillsBo();
bo.setUid(uid);
... ... @@ -110,14 +131,21 @@ public class AssetsService {
bo.setTradeType(bills.getTradeType());
bo.setCreateTime(bills.getCreateTime());
bo.setTradeTypeDesc(TradeType.getTradeTypeByCode(bills.getTradeType()).getDesc());
bo.setTradeStatus(bills.getTradeStatus());
if(bills.getTradeStatus()!=null&&100==bills.getTradeStatus().intValue()){
bo.setNormalFlag(true);
}else{
bo.setNormalFlag(false);
}
BuyerOrderGoods bg = orderSkupMap.get(bills.getOrderCode());
if (bg != null) {
SellerOrderGoods sg = skupOrderMap.get(bg.getSkup());
if (sg != null) {
bo.setProductName(sg.getProductName());
bo.setSizeName(sg.getSizeName());
}
}
rtnList.add(bo);
}
return rtnList;
... ...