...
|
...
|
@@ -3,7 +3,6 @@ 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;
|
...
|
...
|
@@ -27,7 +26,6 @@ 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;
|
|
|
|
|
|
/**资产
|
...
|
...
|
@@ -37,8 +35,7 @@ import java.util.stream.Collectors; |
|
|
public class AssetsService {
|
|
|
final Logger logger = LoggerFactory.getLogger(getClass());
|
|
|
|
|
|
private Cache<String,List<TradeBillsBo>> localContentCache = CacheBuilder.newBuilder().maximumSize(1000).expireAfterAccess(5, TimeUnit.MINUTES).build();
|
|
|
private Cache<Integer,TradeBillsSummaryBo> localTradeBillsSummaryBoCache = CacheBuilder.newBuilder().maximumSize(1000).expireAfterAccess(1, TimeUnit.MINUTES).build();
|
|
|
private Cache<Integer,TradeBillsSummaryBo> localTradeBillsSummaryBoCache = CacheBuilder.newBuilder().maximumSize(2000).expireAfterWrite(1, TimeUnit.MINUTES).build();
|
|
|
|
|
|
@Autowired
|
|
|
private TradeBillsMapper tradeBillsMapper;
|
...
|
...
|
@@ -49,9 +46,6 @@ public class AssetsService { |
|
|
@Autowired
|
|
|
private SellerOrderGoodsMapper sellerOrderGoodsMapper;
|
|
|
|
|
|
@Autowired
|
|
|
private EntrySellerRechargeOrderMapper entrySellerRechargeOrderMapper;
|
|
|
|
|
|
public AssetsResp getAssetsDetails(int uid, int page, int pageSize){
|
|
|
|
|
|
//TODO get count
|
...
|
...
|
@@ -89,24 +83,6 @@ public class AssetsService { |
|
|
List<TradeBillsBo> buildTradeBills(int uid,int page, int pageSize){
|
|
|
//现在是降序排列,不再缓存第一页
|
|
|
return loadTradeBillFromDb(uid,page,pageSize);
|
|
|
|
|
|
//把第一页缓存
|
|
|
/*String key=uid+"-"+page+"-"+pageSize;
|
|
|
if(page==1){
|
|
|
try{
|
|
|
return localContentCache.get(key, new Callable<List<TradeBillsBo>>() {
|
|
|
@Override
|
|
|
public List<TradeBillsBo> call() throws Exception {
|
|
|
|
|
|
return loadTradeBillFromDb(uid,page,pageSize);
|
|
|
}
|
|
|
});
|
|
|
}catch (ExecutionException e){
|
|
|
throw new RuntimeException(e);
|
|
|
}
|
|
|
}else{
|
|
|
return loadTradeBillFromDb(uid,page,pageSize);
|
|
|
}*/
|
|
|
}
|
|
|
|
|
|
private List<TradeBillsBo> loadTradeBillFromDb(int uid,int page, int pageSize){
|
...
|
...
|
@@ -186,25 +162,6 @@ public class AssetsService { |
|
|
}
|
|
|
}
|
|
|
|
|
|
//计算支出
|
|
|
/*List<Map<String, Object>> spendList=tradeBillsMapper.selectSpendAmountByUid(uid);
|
|
|
if(CollectionUtils.isNotEmpty(spendList)){
|
|
|
for(Map<String, Object> tmpMap:spendList){
|
|
|
if(tmpMap.get("tradeType")==null||tmpMap.get("allAmount")==null){
|
|
|
continue;
|
|
|
}
|
|
|
Integer key = (Integer)tmpMap.get("tradeType");
|
|
|
if(TradeType.goods_income.getCode()==key.intValue()){
|
|
|
goods_income = goods_income.subtract((BigDecimal)tmpMap.get("allAmount"));
|
|
|
}
|
|
|
|
|
|
if(TradeType.compensateIncome.getCode()==key.intValue()){
|
|
|
compensate_income = compensate_income.subtract((BigDecimal)tmpMap.get("allAmount"));
|
|
|
}
|
|
|
|
|
|
}
|
|
|
}*/
|
|
|
|
|
|
summary.setGoods_income(goods_income);
|
|
|
summary.setGoodsIncome(goods_income.setScale(2,BigDecimal.ROUND_HALF_UP).toPlainString());
|
|
|
summary.setCompensate_income(compensate_income);
|
...
|
...
|
|