...
|
...
|
@@ -34,6 +34,8 @@ import org.springframework.stereotype.Service; |
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
import java.math.BigDecimal;
|
|
|
import java.text.DecimalFormat;
|
|
|
import java.text.SimpleDateFormat;
|
|
|
import java.util.*;
|
|
|
import java.util.concurrent.TimeUnit;
|
|
|
import java.util.concurrent.atomic.AtomicInteger;
|
...
|
...
|
@@ -245,19 +247,35 @@ public class UnionShareServiceImpl implements IUnionShareService,IBusinessExport |
|
|
* @return
|
|
|
*/
|
|
|
@Override
|
|
|
public UnionShareOrders queryRecentlyOrderLimitTen(int uid) {
|
|
|
public List<UnionShareOrders> queryRecentlyOrderLimitTen(int uid) {
|
|
|
//先从缓存获取
|
|
|
String key = "recentlyOrderLimitTen";
|
|
|
UnionShareOrders cacheResult = getFromRedis(ShareOrdersKeyEnum.RECENTLY_ORDER_LIMIT_TEN, uid, UnionShareOrders.class, key);
|
|
|
UnionShareOrdersListBO cacheResult = getFromRedis(ShareOrdersKeyEnum.RECENTLY_ORDER_LIMIT_TEN, uid, UnionShareOrdersListBO.class, key);
|
|
|
if (cacheResult != null) {
|
|
|
logger.info("UnionShareServiceImpl :: queryRecentlyOrderLimitTen get redis cache ,uid is {},cacheResult is {}",uid,cacheResult);
|
|
|
return cacheResult;
|
|
|
return cacheResult.getList();
|
|
|
}
|
|
|
//获取数据库
|
|
|
UnionShareOrders unionShareOrders = unionShareOrdersMapper.selectRecentlyOrderLimitTen(uid);
|
|
|
List<UnionShareOrders> unionShareOrdersList = unionShareOrdersMapper.selectRecentlyOrderLimitTen(uid);
|
|
|
//处理订单列表数据
|
|
|
dealShareOrderList(unionShareOrdersList);
|
|
|
UnionShareOrdersListBO unionShareOrdersListBO = new UnionShareOrdersListBO();
|
|
|
unionShareOrdersListBO.setList(unionShareOrdersList);
|
|
|
//设置缓存
|
|
|
addToRedis(ShareOrdersKeyEnum.RECENTLY_ORDER_LIMIT_TEN,uid,unionShareOrders,key);
|
|
|
return unionShareOrders;
|
|
|
addToRedis(ShareOrdersKeyEnum.RECENTLY_ORDER_LIMIT_TEN,uid,unionShareOrdersListBO,key);
|
|
|
return unionShareOrdersList;
|
|
|
}
|
|
|
|
|
|
private void dealShareOrderList(List<UnionShareOrders> unionShareOrdersList) {
|
|
|
if (CollectionUtils.isNotEmpty(unionShareOrdersList)){
|
|
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy.MM.dd HH:mm");
|
|
|
DecimalFormat df1 = new DecimalFormat("0.00");
|
|
|
for (UnionShareOrders unionShareOrders : unionShareOrdersList){
|
|
|
unionShareOrders.setOrderTimeStr(sdf.format(unionShareOrders.getOrderTime()));
|
|
|
unionShareOrders.setLastOrderAmountStr(df1.format(unionShareOrders.getLastOrderAmount()));
|
|
|
unionShareOrders.setAmountStr("+"+df1.format(unionShareOrders.getAmount()));
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@Override
|
...
|
...
|
@@ -276,12 +294,21 @@ public class UnionShareServiceImpl implements IUnionShareService,IBusinessExport |
|
|
}
|
|
|
List<UnionShareOrdersProduct> unionShareOrdersProductlist = unionShareOrdersProductMapper.selectOrdersProductByOrderCode(orderCode);
|
|
|
List<ShareOrdersProductBo> shareOrdersProductBoList = convert.convertFromList(unionShareOrdersProductlist, ShareOrdersProductBo.class);
|
|
|
//设置商品价格
|
|
|
DecimalFormat df1 = new DecimalFormat("0.00");
|
|
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
for (ShareOrdersProductBo shareOrdersProductBo : shareOrdersProductBoList){
|
|
|
shareOrdersProductBo.setPriceStr("¥"+df1.format(shareOrdersProductBo.getPrice()));
|
|
|
}
|
|
|
ShareOrderBo shareOrderBo = new ShareOrderBo();
|
|
|
shareOrderBo = convert.convertFrom(unionShareOrders,shareOrderBo,ShareOrderBo.class);
|
|
|
shareOrderBo.setIsNew(unionShareOrders.getIsNew().toString());
|
|
|
shareOrderBo.setProductList(shareOrdersProductBoList);
|
|
|
shareOrderBo.setOrderTimeStr(sdf.format(shareOrderBo.getOrderTime()));
|
|
|
shareOrderBo.setAmountStr("¥"+df1.format(shareOrderBo.getAmount()));
|
|
|
shareOrderBo.setLastOrderAmountStr("¥"+df1.format(shareOrderBo.getLastOrderAmount()));
|
|
|
//设置缓存
|
|
|
addToRedis(ShareOrdersKeyEnum.ORDER_INFO,uid,unionShareOrders,key, orderCode);
|
|
|
addToRedis(ShareOrdersKeyEnum.ORDER_INFO,uid,shareOrderBo,key, orderCode);
|
|
|
return shareOrderBo;
|
|
|
}
|
|
|
|
...
|
...
|
@@ -296,13 +323,21 @@ public class UnionShareServiceImpl implements IUnionShareService,IBusinessExport |
|
|
return cacheResult.getList();
|
|
|
}
|
|
|
//数据库获取
|
|
|
List<UnionShareSettlement> unionShareSettlement = unionShareSettlementMapper.selectSettlementRecordByUid(unionShareOrderReqBO.getUid(),
|
|
|
List<UnionShareSettlement> unionShareSettlementList = unionShareSettlementMapper.selectSettlementRecordByUid(unionShareOrderReqBO.getUid(),
|
|
|
unionShareOrderReqBO.getPage()*unionShareOrderReqBO.getSize(), unionShareOrderReqBO.getSize());
|
|
|
if (CollectionUtils.isNotEmpty(unionShareSettlementList)){
|
|
|
DecimalFormat df1 = new DecimalFormat("0.00");
|
|
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy.MM.dd HH:mm");
|
|
|
for (UnionShareSettlement unionShareSettlement : unionShareSettlementList){
|
|
|
unionShareSettlement.setSettlementAmountStr("+"+df1.format(unionShareSettlement.getSettlementAmount()));
|
|
|
unionShareSettlement.setSettlementTimeStr(sdf.format(unionShareSettlement.getSettlementTime()));
|
|
|
}
|
|
|
}
|
|
|
//设置缓存
|
|
|
UnionShareSettlementListBO unionShareSettlementListBO = new UnionShareSettlementListBO();
|
|
|
unionShareSettlementListBO.setList(unionShareSettlement);
|
|
|
unionShareSettlementListBO.setList(unionShareSettlementList);
|
|
|
addToRedis(ShareOrdersKeyEnum.SETTLEMENT_LIST,unionShareOrderReqBO.getUid(),unionShareSettlementListBO,key, String.valueOf(unionShareOrderReqBO.getPage()), String.valueOf(unionShareOrderReqBO.getSize()));
|
|
|
return unionShareSettlement;
|
|
|
return unionShareSettlementList;
|
|
|
}
|
|
|
|
|
|
@Override
|
...
|
...
|
@@ -317,6 +352,8 @@ public class UnionShareServiceImpl implements IUnionShareService,IBusinessExport |
|
|
//数据库获取
|
|
|
//tab1表示1、全部订单;2、有效订单;3、无效订单 tab2表示1、已付款;2、待结算;3、结算中
|
|
|
List<UnionShareOrders> unionShareOrdersList = unionShareOrdersMapper.selectOrderList(unionShareOrderReqBO);
|
|
|
//处理订单列表数据
|
|
|
dealShareOrderList(unionShareOrdersList);
|
|
|
//设置缓存
|
|
|
UnionShareOrdersListBO unionShareOrdersListBO = new UnionShareOrdersListBO();
|
|
|
unionShareOrdersListBO.setList(unionShareOrdersList);
|
...
|
...
|
|