...
|
...
|
@@ -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;
|
...
|
...
|
|