|
@@ -34,6 +34,8 @@ import org.springframework.stereotype.Service; |
|
@@ -34,6 +34,8 @@ import org.springframework.stereotype.Service; |
34
|
|
34
|
|
35
|
import javax.annotation.Resource;
|
35
|
import javax.annotation.Resource;
|
36
|
import java.math.BigDecimal;
|
36
|
import java.math.BigDecimal;
|
|
|
37
|
+import java.text.DecimalFormat;
|
|
|
38
|
+import java.text.SimpleDateFormat;
|
37
|
import java.util.*;
|
39
|
import java.util.*;
|
38
|
import java.util.concurrent.TimeUnit;
|
40
|
import java.util.concurrent.TimeUnit;
|
39
|
import java.util.concurrent.atomic.AtomicInteger;
|
41
|
import java.util.concurrent.atomic.AtomicInteger;
|
|
@@ -245,19 +247,35 @@ public class UnionShareServiceImpl implements IUnionShareService,IBusinessExport |
|
@@ -245,19 +247,35 @@ public class UnionShareServiceImpl implements IUnionShareService,IBusinessExport |
245
|
* @return
|
247
|
* @return
|
246
|
*/
|
248
|
*/
|
247
|
@Override
|
249
|
@Override
|
248
|
- public UnionShareOrders queryRecentlyOrderLimitTen(int uid) {
|
250
|
+ public List<UnionShareOrders> queryRecentlyOrderLimitTen(int uid) {
|
249
|
//先从缓存获取
|
251
|
//先从缓存获取
|
250
|
String key = "recentlyOrderLimitTen";
|
252
|
String key = "recentlyOrderLimitTen";
|
251
|
- UnionShareOrders cacheResult = getFromRedis(ShareOrdersKeyEnum.RECENTLY_ORDER_LIMIT_TEN, uid, UnionShareOrders.class, key);
|
253
|
+ UnionShareOrdersListBO cacheResult = getFromRedis(ShareOrdersKeyEnum.RECENTLY_ORDER_LIMIT_TEN, uid, UnionShareOrdersListBO.class, key);
|
252
|
if (cacheResult != null) {
|
254
|
if (cacheResult != null) {
|
253
|
logger.info("UnionShareServiceImpl :: queryRecentlyOrderLimitTen get redis cache ,uid is {},cacheResult is {}",uid,cacheResult);
|
255
|
logger.info("UnionShareServiceImpl :: queryRecentlyOrderLimitTen get redis cache ,uid is {},cacheResult is {}",uid,cacheResult);
|
254
|
- return cacheResult;
|
256
|
+ return cacheResult.getList();
|
255
|
}
|
257
|
}
|
256
|
//获取数据库
|
258
|
//获取数据库
|
257
|
- UnionShareOrders unionShareOrders = unionShareOrdersMapper.selectRecentlyOrderLimitTen(uid);
|
259
|
+ List<UnionShareOrders> unionShareOrdersList = unionShareOrdersMapper.selectRecentlyOrderLimitTen(uid);
|
|
|
260
|
+ //处理订单列表数据
|
|
|
261
|
+ dealShareOrderList(unionShareOrdersList);
|
|
|
262
|
+ UnionShareOrdersListBO unionShareOrdersListBO = new UnionShareOrdersListBO();
|
|
|
263
|
+ unionShareOrdersListBO.setList(unionShareOrdersList);
|
258
|
//设置缓存
|
264
|
//设置缓存
|
259
|
- addToRedis(ShareOrdersKeyEnum.RECENTLY_ORDER_LIMIT_TEN,uid,unionShareOrders,key);
|
|
|
260
|
- return unionShareOrders;
|
265
|
+ addToRedis(ShareOrdersKeyEnum.RECENTLY_ORDER_LIMIT_TEN,uid,unionShareOrdersListBO,key);
|
|
|
266
|
+ return unionShareOrdersList;
|
|
|
267
|
+ }
|
|
|
268
|
+
|
|
|
269
|
+ private void dealShareOrderList(List<UnionShareOrders> unionShareOrdersList) {
|
|
|
270
|
+ if (CollectionUtils.isNotEmpty(unionShareOrdersList)){
|
|
|
271
|
+ SimpleDateFormat sdf = new SimpleDateFormat("yyyy.MM.dd HH:mm");
|
|
|
272
|
+ DecimalFormat df1 = new DecimalFormat("0.00");
|
|
|
273
|
+ for (UnionShareOrders unionShareOrders : unionShareOrdersList){
|
|
|
274
|
+ unionShareOrders.setOrderTimeStr(sdf.format(unionShareOrders.getOrderTime()));
|
|
|
275
|
+ unionShareOrders.setLastOrderAmountStr(df1.format(unionShareOrders.getLastOrderAmount()));
|
|
|
276
|
+ unionShareOrders.setAmountStr("+"+df1.format(unionShareOrders.getAmount()));
|
|
|
277
|
+ }
|
|
|
278
|
+ }
|
261
|
}
|
279
|
}
|
262
|
|
280
|
|
263
|
@Override
|
281
|
@Override
|
|
@@ -276,12 +294,21 @@ public class UnionShareServiceImpl implements IUnionShareService,IBusinessExport |
|
@@ -276,12 +294,21 @@ public class UnionShareServiceImpl implements IUnionShareService,IBusinessExport |
276
|
}
|
294
|
}
|
277
|
List<UnionShareOrdersProduct> unionShareOrdersProductlist = unionShareOrdersProductMapper.selectOrdersProductByOrderCode(orderCode);
|
295
|
List<UnionShareOrdersProduct> unionShareOrdersProductlist = unionShareOrdersProductMapper.selectOrdersProductByOrderCode(orderCode);
|
278
|
List<ShareOrdersProductBo> shareOrdersProductBoList = convert.convertFromList(unionShareOrdersProductlist, ShareOrdersProductBo.class);
|
296
|
List<ShareOrdersProductBo> shareOrdersProductBoList = convert.convertFromList(unionShareOrdersProductlist, ShareOrdersProductBo.class);
|
|
|
297
|
+ //设置商品价格
|
|
|
298
|
+ DecimalFormat df1 = new DecimalFormat("0.00");
|
|
|
299
|
+ SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
300
|
+ for (ShareOrdersProductBo shareOrdersProductBo : shareOrdersProductBoList){
|
|
|
301
|
+ shareOrdersProductBo.setPriceStr("¥"+df1.format(shareOrdersProductBo.getPrice()));
|
|
|
302
|
+ }
|
279
|
ShareOrderBo shareOrderBo = new ShareOrderBo();
|
303
|
ShareOrderBo shareOrderBo = new ShareOrderBo();
|
280
|
shareOrderBo = convert.convertFrom(unionShareOrders,shareOrderBo,ShareOrderBo.class);
|
304
|
shareOrderBo = convert.convertFrom(unionShareOrders,shareOrderBo,ShareOrderBo.class);
|
281
|
shareOrderBo.setIsNew(unionShareOrders.getIsNew().toString());
|
305
|
shareOrderBo.setIsNew(unionShareOrders.getIsNew().toString());
|
282
|
shareOrderBo.setProductList(shareOrdersProductBoList);
|
306
|
shareOrderBo.setProductList(shareOrdersProductBoList);
|
|
|
307
|
+ shareOrderBo.setOrderTimeStr(sdf.format(shareOrderBo.getOrderTime()));
|
|
|
308
|
+ shareOrderBo.setAmountStr("¥"+df1.format(shareOrderBo.getAmount()));
|
|
|
309
|
+ shareOrderBo.setLastOrderAmountStr("¥"+df1.format(shareOrderBo.getLastOrderAmount()));
|
283
|
//设置缓存
|
310
|
//设置缓存
|
284
|
- addToRedis(ShareOrdersKeyEnum.ORDER_INFO,uid,unionShareOrders,key, orderCode);
|
311
|
+ addToRedis(ShareOrdersKeyEnum.ORDER_INFO,uid,shareOrderBo,key, orderCode);
|
285
|
return shareOrderBo;
|
312
|
return shareOrderBo;
|
286
|
}
|
313
|
}
|
287
|
|
314
|
|
|
@@ -296,13 +323,21 @@ public class UnionShareServiceImpl implements IUnionShareService,IBusinessExport |
|
@@ -296,13 +323,21 @@ public class UnionShareServiceImpl implements IUnionShareService,IBusinessExport |
296
|
return cacheResult.getList();
|
323
|
return cacheResult.getList();
|
297
|
}
|
324
|
}
|
298
|
//数据库获取
|
325
|
//数据库获取
|
299
|
- List<UnionShareSettlement> unionShareSettlement = unionShareSettlementMapper.selectSettlementRecordByUid(unionShareOrderReqBO.getUid(),
|
326
|
+ List<UnionShareSettlement> unionShareSettlementList = unionShareSettlementMapper.selectSettlementRecordByUid(unionShareOrderReqBO.getUid(),
|
300
|
unionShareOrderReqBO.getPage()*unionShareOrderReqBO.getSize(), unionShareOrderReqBO.getSize());
|
327
|
unionShareOrderReqBO.getPage()*unionShareOrderReqBO.getSize(), unionShareOrderReqBO.getSize());
|
|
|
328
|
+ if (CollectionUtils.isNotEmpty(unionShareSettlementList)){
|
|
|
329
|
+ DecimalFormat df1 = new DecimalFormat("0.00");
|
|
|
330
|
+ SimpleDateFormat sdf = new SimpleDateFormat("yyyy.MM.dd HH:mm");
|
|
|
331
|
+ for (UnionShareSettlement unionShareSettlement : unionShareSettlementList){
|
|
|
332
|
+ unionShareSettlement.setSettlementAmountStr("+"+df1.format(unionShareSettlement.getSettlementAmount()));
|
|
|
333
|
+ unionShareSettlement.setSettlementTimeStr(sdf.format(unionShareSettlement.getSettlementTime()));
|
|
|
334
|
+ }
|
|
|
335
|
+ }
|
301
|
//设置缓存
|
336
|
//设置缓存
|
302
|
UnionShareSettlementListBO unionShareSettlementListBO = new UnionShareSettlementListBO();
|
337
|
UnionShareSettlementListBO unionShareSettlementListBO = new UnionShareSettlementListBO();
|
303
|
- unionShareSettlementListBO.setList(unionShareSettlement);
|
338
|
+ unionShareSettlementListBO.setList(unionShareSettlementList);
|
304
|
addToRedis(ShareOrdersKeyEnum.SETTLEMENT_LIST,unionShareOrderReqBO.getUid(),unionShareSettlementListBO,key, String.valueOf(unionShareOrderReqBO.getPage()), String.valueOf(unionShareOrderReqBO.getSize()));
|
339
|
addToRedis(ShareOrdersKeyEnum.SETTLEMENT_LIST,unionShareOrderReqBO.getUid(),unionShareSettlementListBO,key, String.valueOf(unionShareOrderReqBO.getPage()), String.valueOf(unionShareOrderReqBO.getSize()));
|
305
|
- return unionShareSettlement;
|
340
|
+ return unionShareSettlementList;
|
306
|
}
|
341
|
}
|
307
|
|
342
|
|
308
|
@Override
|
343
|
@Override
|
|
@@ -317,6 +352,8 @@ public class UnionShareServiceImpl implements IUnionShareService,IBusinessExport |
|
@@ -317,6 +352,8 @@ public class UnionShareServiceImpl implements IUnionShareService,IBusinessExport |
317
|
//数据库获取
|
352
|
//数据库获取
|
318
|
//tab1表示1、全部订单;2、有效订单;3、无效订单 tab2表示1、已付款;2、待结算;3、结算中
|
353
|
//tab1表示1、全部订单;2、有效订单;3、无效订单 tab2表示1、已付款;2、待结算;3、结算中
|
319
|
List<UnionShareOrders> unionShareOrdersList = unionShareOrdersMapper.selectOrderList(unionShareOrderReqBO);
|
354
|
List<UnionShareOrders> unionShareOrdersList = unionShareOrdersMapper.selectOrderList(unionShareOrderReqBO);
|
|
|
355
|
+ //处理订单列表数据
|
|
|
356
|
+ dealShareOrderList(unionShareOrdersList);
|
320
|
//设置缓存
|
357
|
//设置缓存
|
321
|
UnionShareOrdersListBO unionShareOrdersListBO = new UnionShareOrdersListBO();
|
358
|
UnionShareOrdersListBO unionShareOrdersListBO = new UnionShareOrdersListBO();
|
322
|
unionShareOrdersListBO.setList(unionShareOrdersList);
|
359
|
unionShareOrdersListBO.setList(unionShareOrdersList);
|