|
@@ -2,8 +2,12 @@ package com.yohoufo.order.service.impl; |
|
@@ -2,8 +2,12 @@ package com.yohoufo.order.service.impl; |
2
|
|
2
|
|
3
|
import com.google.common.cache.Cache;
|
3
|
import com.google.common.cache.Cache;
|
4
|
import com.google.common.cache.CacheBuilder;
|
4
|
import com.google.common.cache.CacheBuilder;
|
|
|
5
|
+import com.yohoufo.dal.order.BuyerOrderGoodsMapper;
|
5
|
import com.yohoufo.dal.order.EntrySellerRechargeOrderMapper;
|
6
|
import com.yohoufo.dal.order.EntrySellerRechargeOrderMapper;
|
|
|
7
|
+import com.yohoufo.dal.order.SellerOrderGoodsMapper;
|
6
|
import com.yohoufo.dal.order.TradeBillsMapper;
|
8
|
import com.yohoufo.dal.order.TradeBillsMapper;
|
|
|
9
|
+import com.yohoufo.dal.order.model.BuyerOrderGoods;
|
|
|
10
|
+import com.yohoufo.dal.order.model.SellerOrderGoods;
|
7
|
import com.yohoufo.dal.order.model.TradeBills;
|
11
|
import com.yohoufo.dal.order.model.TradeBills;
|
8
|
import com.yohoufo.order.common.TradeType;
|
12
|
import com.yohoufo.order.common.TradeType;
|
9
|
import com.yohoufo.order.model.bo.TradeBillsBo;
|
13
|
import com.yohoufo.order.model.bo.TradeBillsBo;
|
|
@@ -22,6 +26,9 @@ import java.util.Map; |
|
@@ -22,6 +26,9 @@ import java.util.Map; |
22
|
import java.util.concurrent.Callable;
|
26
|
import java.util.concurrent.Callable;
|
23
|
import java.util.concurrent.ExecutionException;
|
27
|
import java.util.concurrent.ExecutionException;
|
24
|
import java.util.concurrent.TimeUnit;
|
28
|
import java.util.concurrent.TimeUnit;
|
|
|
29
|
+import java.util.function.Function;
|
|
|
30
|
+import java.util.stream.Collector;
|
|
|
31
|
+import java.util.stream.Collectors;
|
25
|
|
32
|
|
26
|
/**资产
|
33
|
/**资产
|
27
|
* Created by chenchao on 2018/9/28.
|
34
|
* Created by chenchao on 2018/9/28.
|
|
@@ -35,6 +42,12 @@ public class AssetsService { |
|
@@ -35,6 +42,12 @@ public class AssetsService { |
35
|
|
42
|
|
36
|
@Autowired
|
43
|
@Autowired
|
37
|
private TradeBillsMapper tradeBillsMapper;
|
44
|
private TradeBillsMapper tradeBillsMapper;
|
|
|
45
|
+
|
|
|
46
|
+ @Autowired
|
|
|
47
|
+ private BuyerOrderGoodsMapper buyerOrderGoodsMapper;
|
|
|
48
|
+
|
|
|
49
|
+ @Autowired
|
|
|
50
|
+ private SellerOrderGoodsMapper sellerOrderGoodsMapper;
|
38
|
|
51
|
|
39
|
@Autowired
|
52
|
@Autowired
|
40
|
private EntrySellerRechargeOrderMapper entrySellerRechargeOrderMapper;
|
53
|
private EntrySellerRechargeOrderMapper entrySellerRechargeOrderMapper;
|
|
@@ -99,8 +112,16 @@ public class AssetsService { |
|
@@ -99,8 +112,16 @@ public class AssetsService { |
99
|
private List<TradeBillsBo> loadTradeBillFromDb(int uid,int page, int pageSize){
|
112
|
private List<TradeBillsBo> loadTradeBillFromDb(int uid,int page, int pageSize){
|
100
|
|
113
|
|
101
|
List<TradeBills> detailList = tradeBillsMapper.selectGoodsIncomeOrCompensateIncomeTradeBillsWithPageByUid(uid,pageSize*(page-1),pageSize);
|
114
|
List<TradeBills> detailList = tradeBillsMapper.selectGoodsIncomeOrCompensateIncomeTradeBillsWithPageByUid(uid,pageSize*(page-1),pageSize);
|
102
|
-
|
|
|
103
|
List<TradeBillsBo> rtnList=new ArrayList<>();
|
115
|
List<TradeBillsBo> rtnList=new ArrayList<>();
|
|
|
116
|
+ if(detailList.isEmpty()) {
|
|
|
117
|
+ return rtnList;
|
|
|
118
|
+ }
|
|
|
119
|
+ List<Long> orderCodeList = detailList.stream().map(TradeBills::getOrderCode).collect(Collectors.toList());
|
|
|
120
|
+ List<BuyerOrderGoods> buyerOrderGoodsList = orderCodeList.isEmpty()?new ArrayList<>(): buyerOrderGoodsMapper.selectByOrderCodeList(uid, orderCodeList);
|
|
|
121
|
+ List<Integer> skups = buyerOrderGoodsList.stream().map(BuyerOrderGoods::getSkup).collect(Collectors.toList());
|
|
|
122
|
+ List<SellerOrderGoods> sellerOrderGoodsList = skups.isEmpty()?new ArrayList<>(): sellerOrderGoodsMapper.selectBySkups(skups);
|
|
|
123
|
+ Map<Long, BuyerOrderGoods> orderSkupMap = buyerOrderGoodsList.stream().collect(Collectors.toMap(BuyerOrderGoods::getOrderCode, Function.identity()));
|
|
|
124
|
+ Map<Integer, SellerOrderGoods> skupOrderMap = sellerOrderGoodsList.stream().collect(Collectors.toMap(SellerOrderGoods::getId, Function.identity()));
|
104
|
for(TradeBills bills:detailList){
|
125
|
for(TradeBills bills:detailList){
|
105
|
TradeBillsBo bo = new TradeBillsBo();
|
126
|
TradeBillsBo bo = new TradeBillsBo();
|
106
|
bo.setUid(uid);
|
127
|
bo.setUid(uid);
|
|
@@ -110,14 +131,21 @@ public class AssetsService { |
|
@@ -110,14 +131,21 @@ public class AssetsService { |
110
|
bo.setTradeType(bills.getTradeType());
|
131
|
bo.setTradeType(bills.getTradeType());
|
111
|
bo.setCreateTime(bills.getCreateTime());
|
132
|
bo.setCreateTime(bills.getCreateTime());
|
112
|
bo.setTradeTypeDesc(TradeType.getTradeTypeByCode(bills.getTradeType()).getDesc());
|
133
|
bo.setTradeTypeDesc(TradeType.getTradeTypeByCode(bills.getTradeType()).getDesc());
|
113
|
-
|
134
|
+
|
114
|
bo.setTradeStatus(bills.getTradeStatus());
|
135
|
bo.setTradeStatus(bills.getTradeStatus());
|
115
|
if(bills.getTradeStatus()!=null&&100==bills.getTradeStatus().intValue()){
|
136
|
if(bills.getTradeStatus()!=null&&100==bills.getTradeStatus().intValue()){
|
116
|
bo.setNormalFlag(true);
|
137
|
bo.setNormalFlag(true);
|
117
|
}else{
|
138
|
}else{
|
118
|
bo.setNormalFlag(false);
|
139
|
bo.setNormalFlag(false);
|
119
|
}
|
140
|
}
|
120
|
-
|
141
|
+ BuyerOrderGoods bg = orderSkupMap.get(bills.getOrderCode());
|
|
|
142
|
+ if (bg != null) {
|
|
|
143
|
+ SellerOrderGoods sg = skupOrderMap.get(bg.getSkup());
|
|
|
144
|
+ if (sg != null) {
|
|
|
145
|
+ bo.setProductName(sg.getProductName());
|
|
|
146
|
+ bo.setSizeName(sg.getSizeName());
|
|
|
147
|
+ }
|
|
|
148
|
+ }
|
121
|
rtnList.add(bo);
|
149
|
rtnList.add(bo);
|
122
|
}
|
150
|
}
|
123
|
return rtnList;
|
151
|
return rtnList;
|