👎 增加后台商品列表的数据统计字段
This commit is contained in:
@@ -84,18 +84,19 @@ public class StoreOrderController {
|
||||
this.yxStoreOrderStatusService = yxStoreOrderStatusService;
|
||||
}
|
||||
|
||||
/**@Valid
|
||||
* 根据商品分类统计订单占比
|
||||
/**
|
||||
* @Valid 根据商品分类统计订单占比
|
||||
*/
|
||||
@GetMapping("/yxStoreOrder/orderCount")
|
||||
@ApiOperation(value = "根据商品分类统计订单占比",notes = "根据商品分类统计订单占比",response = ExpressParam.class)
|
||||
public ResponseEntity orderCount(){
|
||||
OrderCountDto orderCountDto = yxStoreOrderService.getOrderCount();
|
||||
@ApiOperation(value = "根据商品分类统计订单占比", notes = "根据商品分类统计订单占比", response = ExpressParam.class)
|
||||
public ResponseEntity orderCount() {
|
||||
OrderCountDto orderCountDto = yxStoreOrderService.getOrderCount();
|
||||
return new ResponseEntity<>(orderCountDto, HttpStatus.OK);
|
||||
}
|
||||
|
||||
/**
|
||||
* 首页订单/用户等统计
|
||||
*
|
||||
* @return OrderTimeDataDto
|
||||
*/
|
||||
@GetMapping(value = "/data/count")
|
||||
@@ -106,6 +107,7 @@ public class StoreOrderController {
|
||||
|
||||
/**
|
||||
* 返回本月订单金额与数量chart
|
||||
*
|
||||
* @return map
|
||||
*/
|
||||
@GetMapping(value = "/data/chart")
|
||||
@@ -118,21 +120,21 @@ public class StoreOrderController {
|
||||
@ApiOperation(value = "查询订单")
|
||||
@GetMapping(value = "/yxStoreOrder")
|
||||
@PreAuthorize("@ss.hasAnyPermissions('admin','YXSTOREORDER_ALL','YXSTOREORDER_SELECT','YXEXPRESS_SELECT')")
|
||||
public ResponseEntity getYxStoreOrders(YxStoreOrderQueryCriteria criteria,
|
||||
Pageable pageable,
|
||||
@RequestParam(name = "orderStatus") String orderStatus,
|
||||
@RequestParam(name = "orderType") String orderType) {
|
||||
public ResponseEntity<AdminOrderDto> getYxStoreOrders(YxStoreOrderQueryCriteria criteria,
|
||||
Pageable pageable,
|
||||
@RequestParam(name = "orderStatus") String orderStatus,
|
||||
@RequestParam(name = "orderType") String orderType) {
|
||||
//增加支持多选类型搜索
|
||||
Map<String,Object> map;
|
||||
String[] orderTypeList=orderType.split(",");
|
||||
if(orderTypeList.length>1){//多选方法
|
||||
map=yxStoreOrderService.queryManyType(orderTypeList, pageable,criteria,orderStatus);
|
||||
}else {
|
||||
YxStoreOrderQueryCriteria newCriteria = this.handleQuery(criteria,orderStatus,orderType);
|
||||
map=yxStoreOrderService.queryAll(newCriteria, pageable);
|
||||
AdminOrderDto dto;
|
||||
String[] orderTypeList = orderType.split(",");
|
||||
if (orderTypeList.length > 1) {//多选方法
|
||||
dto = yxStoreOrderService.queryManyType(orderTypeList, pageable, criteria, orderStatus);
|
||||
} else {
|
||||
YxStoreOrderQueryCriteria newCriteria = this.handleQuery(criteria, orderStatus, orderType);
|
||||
dto = yxStoreOrderService.queryAll(newCriteria, pageable);
|
||||
}
|
||||
return new ResponseEntity<>(map, HttpStatus.OK);
|
||||
}
|
||||
return new ResponseEntity<>(dto, HttpStatus.OK);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "根据订单id获取订单详情")
|
||||
@GetMapping(value = "/getStoreOrderDetail/{id}")
|
||||
@@ -140,6 +142,7 @@ public class StoreOrderController {
|
||||
public ResponseEntity getYxStoreOrders(@PathVariable Long id) {
|
||||
return new ResponseEntity<>(yxStoreOrderService.getOrderDetail(id), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "查询订单当前状态流程")
|
||||
@GetMapping(value = "/getNowOrderStatus/{id}")
|
||||
public ResponseEntity getNowOrderStatus(@PathVariable Long id) {
|
||||
@@ -173,7 +176,7 @@ public class StoreOrderController {
|
||||
});
|
||||
|
||||
|
||||
statusList = new ArrayList<>();
|
||||
statusList = new ArrayList<>();
|
||||
statusList.add(OrderLogEnum.REFUND_ORDER_APPLY.getValue());
|
||||
statusList.add(OrderLogEnum.REFUND_ORDER_SUCCESS.getValue());
|
||||
orderStatusLogList = yxStoreOrderStatusService.list(new LambdaQueryWrapper<YxStoreOrderStatus>().eq(YxStoreOrderStatus::getOid, id).in(YxStoreOrderStatus::getChangeType, statusList).orderByDesc(YxStoreOrderStatus::getChangeTime));
|
||||
@@ -190,6 +193,7 @@ public class StoreOrderController {
|
||||
|
||||
return new ResponseEntity(yxOrderNowOrderStatusDto, HttpStatus.OK);
|
||||
}
|
||||
|
||||
public List<YxStoreOrderStatusDto> getOrderStatusDto(List<YxStoreOrderStatus> orderStatusLogList) {
|
||||
List<YxStoreOrderStatusDto> dtoList = orderStatusLogList.stream().map(log -> {
|
||||
YxStoreOrderStatusDto dto = generator.convert(log, YxStoreOrderStatusDto.class);
|
||||
@@ -199,6 +203,7 @@ public class StoreOrderController {
|
||||
}).collect(Collectors.toList());
|
||||
return dtoList;
|
||||
}
|
||||
|
||||
@ApiOperation(value = "发货")
|
||||
@PutMapping(value = "/yxStoreOrder")
|
||||
@PreAuthorize("@ss.hasAnyPermissions('admin','YXSTOREORDER_ALL','YXSTOREORDER_EDIT')")
|
||||
@@ -210,8 +215,8 @@ public class StoreOrderController {
|
||||
throw new BadRequestException("快递单号不能为空");
|
||||
}
|
||||
|
||||
yxStoreOrderService.orderDelivery(resources.getOrderId(),resources.getDeliveryId(),
|
||||
resources.getDeliveryName(),resources.getDeliveryType());
|
||||
yxStoreOrderService.orderDelivery(resources.getOrderId(), resources.getDeliveryId(),
|
||||
resources.getDeliveryName(), resources.getDeliveryType());
|
||||
return new ResponseEntity(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
|
||||
@@ -232,7 +237,6 @@ public class StoreOrderController {
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ApiOperation(value = "修改快递单号")
|
||||
@PutMapping(value = "/yxStoreOrder/updateDelivery")
|
||||
@PreAuthorize("hasAnyAuthority('admin','YXSTOREORDER_ALL','YXSTOREORDER_EDIT')")
|
||||
@@ -244,13 +248,12 @@ public class StoreOrderController {
|
||||
throw new BadRequestException("快递单号不能为空");
|
||||
}
|
||||
|
||||
yxStoreOrderService.updateDelivery(resources.getOrderId(),resources.getDeliveryId(),
|
||||
resources.getDeliveryName(),resources.getDeliveryType());
|
||||
yxStoreOrderService.updateDelivery(resources.getOrderId(), resources.getDeliveryId(),
|
||||
resources.getDeliveryName(), resources.getDeliveryType());
|
||||
return new ResponseEntity(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ApiOperation(value = "订单核销")
|
||||
@PutMapping(value = "/yxStoreOrder/check")
|
||||
@PreAuthorize("@ss.hasAnyPermissions('admin','YXSTOREORDER_ALL','YXSTOREORDER_EDIT')")
|
||||
@@ -258,16 +261,16 @@ public class StoreOrderController {
|
||||
if (StrUtil.isBlank(resources.getVerifyCode())) {
|
||||
throw new BadRequestException("核销码不能为空");
|
||||
}
|
||||
YxStoreOrderDto storeOrderDTO = generator.convert(yxStoreOrderService.getById(resources.getId()),YxStoreOrderDto.class);
|
||||
if(!resources.getVerifyCode().equals(storeOrderDTO.getVerifyCode())){
|
||||
YxStoreOrderDto storeOrderDTO = generator.convert(yxStoreOrderService.getById(resources.getId()), YxStoreOrderDto.class);
|
||||
if (!resources.getVerifyCode().equals(storeOrderDTO.getVerifyCode())) {
|
||||
throw new BadRequestException("核销码不对");
|
||||
}
|
||||
if(OrderInfoEnum.PAY_STATUS_0.getValue().equals(storeOrderDTO.getPaid())){
|
||||
if (OrderInfoEnum.PAY_STATUS_0.getValue().equals(storeOrderDTO.getPaid())) {
|
||||
throw new BadRequestException("订单未支付");
|
||||
}
|
||||
|
||||
yxStoreOrderService.verifyOrder(resources.getVerifyCode(),
|
||||
OrderInfoEnum.CONFIRM_STATUS_1.getValue(),null);
|
||||
OrderInfoEnum.CONFIRM_STATUS_1.getValue(), null);
|
||||
|
||||
return new ResponseEntity(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
@@ -277,7 +280,7 @@ public class StoreOrderController {
|
||||
@PostMapping(value = "/yxStoreOrder/refund")
|
||||
@PreAuthorize("@ss.hasAnyPermissions('admin','YXSTOREORDER_ALL','YXSTOREORDER_EDIT')")
|
||||
public ResponseEntity refund(@Validated @RequestBody YxStoreOrder resources) {
|
||||
yxStoreOrderService.orderRefund(resources.getOrderId(),resources.getPayPrice(),
|
||||
yxStoreOrderService.orderRefund(resources.getOrderId(), resources.getPayPrice(),
|
||||
ShopCommonEnum.AGREE_1.getValue());
|
||||
return new ResponseEntity(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
@@ -305,7 +308,7 @@ public class StoreOrderController {
|
||||
if (resources.getPayPrice().doubleValue() < 0) {
|
||||
throw new BadRequestException("金额不能低于0");
|
||||
}
|
||||
YxStoreOrderDto storeOrder = generator.convert(yxStoreOrderService.getById(resources.getId()),YxStoreOrderDto.class);
|
||||
YxStoreOrderDto storeOrder = generator.convert(yxStoreOrderService.getById(resources.getId()), YxStoreOrderDto.class);
|
||||
//判断金额是否有变动,生成一个额外订单号去支付
|
||||
int res = NumberUtil.compare(storeOrder.getPayPrice().doubleValue(), resources.getPayPrice().doubleValue());
|
||||
if (res != 0) {
|
||||
@@ -315,7 +318,7 @@ public class StoreOrderController {
|
||||
|
||||
yxStoreOrderService.saveOrUpdate(resources);
|
||||
|
||||
yxStoreOrderStatusService.create(resources.getId(),OrderLogEnum.ORDER_EDIT.getValue(),
|
||||
yxStoreOrderStatusService.create(resources.getId(), OrderLogEnum.ORDER_EDIT.getValue(),
|
||||
"修改订单价格为:" + resources.getPayPrice());
|
||||
return new ResponseEntity(HttpStatus.OK);
|
||||
}
|
||||
@@ -338,8 +341,8 @@ public class StoreOrderController {
|
||||
* 快递查询
|
||||
*/
|
||||
@PostMapping("/yxStoreOrder/express")
|
||||
@ApiOperation(value = "获取物流信息",notes = "获取物流信息",response = ExpressParam.class)
|
||||
public ResponseEntity express( @RequestBody ExpressParam expressInfoDo){
|
||||
@ApiOperation(value = "获取物流信息", notes = "获取物流信息", response = ExpressParam.class)
|
||||
public ResponseEntity express(@RequestBody ExpressParam expressInfoDo) {
|
||||
|
||||
ExpressInfo expressInfo = expressService.getExpressInfo(expressInfoDo.getOrderCode(),
|
||||
expressInfoDo.getShipperCode(), expressInfoDo.getLogisticCode());
|
||||
@@ -361,43 +364,44 @@ public class StoreOrderController {
|
||||
@RequestParam(name = "orderType") String orderType,
|
||||
@RequestParam(name = "listContent") String listContent) throws IOException, ParseException {
|
||||
List<YxStoreOrderDto> list;
|
||||
if(StringUtils.isEmpty(listContent)){
|
||||
list = (List)getYxStoreList(criteria, pageable, orderStatus, orderType).get("content");
|
||||
}else {
|
||||
if (StringUtils.isEmpty(listContent)) {
|
||||
list = getYxStoreList(criteria, pageable, orderStatus, orderType).getContent();
|
||||
} else {
|
||||
List<String> idList = JSONArray.parseArray(listContent).toJavaList(String.class);
|
||||
list = (List)yxStoreOrderService.queryAll(idList).get("content");
|
||||
list = yxStoreOrderService.queryAll(idList).getContent();
|
||||
}
|
||||
yxStoreOrderService.download(list, response);
|
||||
}
|
||||
|
||||
/**
|
||||
* 下载数据
|
||||
* @param criteria criteria
|
||||
* @param pageable pageable
|
||||
*
|
||||
* @param criteria criteria
|
||||
* @param pageable pageable
|
||||
* @param orderStatus orderStatus
|
||||
* @param orderType orderType
|
||||
* @param orderType orderType
|
||||
* @return Map
|
||||
*/
|
||||
private Map<String,Object> getYxStoreList(YxStoreOrderQueryCriteria criteria,
|
||||
Pageable pageable,
|
||||
String orderStatus,
|
||||
String orderType){
|
||||
private AdminOrderDto getYxStoreList(YxStoreOrderQueryCriteria criteria,
|
||||
Pageable pageable,
|
||||
String orderStatus,
|
||||
String orderType) {
|
||||
|
||||
YxStoreOrderQueryCriteria newCriteria = this.handleQuery(criteria,orderStatus,orderType);
|
||||
YxStoreOrderQueryCriteria newCriteria = this.handleQuery(criteria, orderStatus, orderType);
|
||||
return yxStoreOrderService.queryAll(newCriteria, pageable);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 处理订单查询
|
||||
* @param criteria YxStoreOrderQueryCriteria
|
||||
*
|
||||
* @param criteria YxStoreOrderQueryCriteria
|
||||
* @param orderStatus 订单状态
|
||||
* @param orderType 订单类型
|
||||
* @param orderType 订单类型
|
||||
* @return YxStoreOrderQueryCriteria
|
||||
*/
|
||||
private YxStoreOrderQueryCriteria handleQuery(YxStoreOrderQueryCriteria criteria,String orderStatus,
|
||||
String orderType){
|
||||
private YxStoreOrderQueryCriteria handleQuery(YxStoreOrderQueryCriteria criteria, String orderStatus,
|
||||
String orderType) {
|
||||
|
||||
//默认查询所有快递订单
|
||||
// criteria.setShippingType(OrderInfoEnum.SHIPPIING_TYPE_1.getValue());
|
||||
@@ -450,29 +454,29 @@ public class StoreOrderController {
|
||||
}
|
||||
//订单类型查询
|
||||
if (StrUtil.isNotEmpty(orderType)) {
|
||||
switch (orderType) {
|
||||
case "1": //普通
|
||||
criteria.setBargainId(0);
|
||||
criteria.setCombinationId(0);
|
||||
criteria.setSeckillId(0);
|
||||
break;
|
||||
case "2": //拼团
|
||||
criteria.setNewCombinationId(0);
|
||||
break;
|
||||
case "3": //秒杀
|
||||
criteria.setNewSeckillId(0);
|
||||
break;
|
||||
case "4": //砍价
|
||||
criteria.setNewBargainId(0);
|
||||
break;
|
||||
case "5": //核销
|
||||
criteria.setShippingType(2);
|
||||
break;
|
||||
case "6": //积分
|
||||
criteria.setPayIntegral(new BigDecimal("0.00"));
|
||||
break;
|
||||
default:
|
||||
}
|
||||
switch (orderType) {
|
||||
case "1": //普通
|
||||
criteria.setBargainId(0);
|
||||
criteria.setCombinationId(0);
|
||||
criteria.setSeckillId(0);
|
||||
break;
|
||||
case "2": //拼团
|
||||
criteria.setNewCombinationId(0);
|
||||
break;
|
||||
case "3": //秒杀
|
||||
criteria.setNewSeckillId(0);
|
||||
break;
|
||||
case "4": //砍价
|
||||
criteria.setNewBargainId(0);
|
||||
break;
|
||||
case "5": //核销
|
||||
criteria.setShippingType(2);
|
||||
break;
|
||||
case "6": //积分
|
||||
criteria.setPayIntegral(new BigDecimal("0.00"));
|
||||
break;
|
||||
default:
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -480,5 +484,4 @@ public class StoreOrderController {
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -12,10 +12,7 @@ import co.yixiang.common.service.BaseService;
|
||||
import co.yixiang.modules.order.domain.YxStoreOrder;
|
||||
import co.yixiang.modules.order.domain.YxStoreOrderCartInfo;
|
||||
import co.yixiang.modules.order.param.OrderParam;
|
||||
import co.yixiang.modules.order.service.dto.OrderCountDto;
|
||||
import co.yixiang.modules.order.service.dto.OrderTimeDataDto;
|
||||
import co.yixiang.modules.order.service.dto.YxStoreOrderDto;
|
||||
import co.yixiang.modules.order.service.dto.YxStoreOrderQueryCriteria;
|
||||
import co.yixiang.modules.order.service.dto.*;
|
||||
import co.yixiang.modules.order.vo.ComputeVo;
|
||||
import co.yixiang.modules.order.vo.ConfirmOrderVo;
|
||||
import co.yixiang.modules.order.vo.OrderDataVo;
|
||||
@@ -257,7 +254,7 @@ public interface YxStoreOrderService extends BaseService<YxStoreOrder>{
|
||||
* @param pageable 分页参数
|
||||
* @return Map<String,Object>
|
||||
*/
|
||||
Map<String,Object> queryManyType(String[] typeList, Pageable pageable,YxStoreOrderQueryCriteria criteria,String orderStatus);
|
||||
AdminOrderDto queryManyType(String[] typeList, Pageable pageable, YxStoreOrderQueryCriteria criteria, String orderStatus);
|
||||
|
||||
/**
|
||||
* 查询数据分页
|
||||
@@ -265,7 +262,7 @@ public interface YxStoreOrderService extends BaseService<YxStoreOrder>{
|
||||
* @param pageable 分页参数
|
||||
* @return Map<String,Object>
|
||||
*/
|
||||
Map<String,Object> queryAll(YxStoreOrderQueryCriteria criteria, Pageable pageable);
|
||||
AdminOrderDto queryAll(YxStoreOrderQueryCriteria criteria, Pageable pageable);
|
||||
|
||||
/**
|
||||
* 查询所有数据不分页
|
||||
@@ -293,7 +290,7 @@ public interface YxStoreOrderService extends BaseService<YxStoreOrder>{
|
||||
*/
|
||||
YxStoreOrderDto getOrderDetail(Long orderId);
|
||||
|
||||
Map<String,Object> queryAll(List<String> ids);
|
||||
AdminOrderDto queryAll(List<String> ids);
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
package co.yixiang.modules.order.service.dto;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class AdminOrderDto {
|
||||
|
||||
@ApiModelProperty("订单列表")
|
||||
private List<YxStoreOrderDto> content;
|
||||
|
||||
@ApiModelProperty("订单总数量")
|
||||
private Long totalElements;
|
||||
|
||||
@ApiModelProperty("商品总数量")
|
||||
private Integer productCount = 0;
|
||||
|
||||
@ApiModelProperty("订单金额")
|
||||
private BigDecimal orderAmount = BigDecimal.ZERO;
|
||||
|
||||
@ApiModelProperty("客户数量")
|
||||
private Long customerCount = 0L;
|
||||
}
|
||||
+53
-12
@@ -93,6 +93,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.google.common.collect.Lists;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.cache.annotation.CacheEvict;
|
||||
@@ -109,6 +110,7 @@ import java.math.BigDecimal;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
||||
@@ -2408,7 +2410,8 @@ public class YxStoreOrderServiceImpl extends BaseServiceImpl<StoreOrderMapper, Y
|
||||
|
||||
|
||||
@Override
|
||||
public Map<String, Object> queryManyType(String[] typeList, Pageable pageable,YxStoreOrderQueryCriteria criteria,String orderStatus) {
|
||||
public AdminOrderDto queryManyType(String[] typeList, Pageable pageable,YxStoreOrderQueryCriteria criteria,String orderStatus) {
|
||||
|
||||
LambdaQueryWrapper<YxStoreOrder> queryWrapper =new LambdaQueryWrapper<>();
|
||||
if(StringUtils.isNotBlank(criteria.getOrderId())){
|
||||
queryWrapper.like(YxStoreOrder::getOrderId,criteria.getOrderId());
|
||||
@@ -2532,6 +2535,10 @@ public class YxStoreOrderServiceImpl extends BaseServiceImpl<StoreOrderMapper, Y
|
||||
}
|
||||
});
|
||||
|
||||
// 分页前查询数据 这可能出问题
|
||||
List<YxStoreOrder> beforePageList = this.list(queryWrapper);
|
||||
|
||||
|
||||
getPage(pageable);
|
||||
PageInfo<YxStoreOrder> page = new PageInfo<>(storeOrderMapper.selectList(queryWrapper));
|
||||
// List<YxStoreOrderDto> storeOrderDTOS = new ArrayList<>();
|
||||
@@ -2541,9 +2548,25 @@ public class YxStoreOrderServiceImpl extends BaseServiceImpl<StoreOrderMapper, Y
|
||||
List<YxStoreOrderDto> list=this.newAssemble(page.getList());
|
||||
Map<String, Object> map = new LinkedHashMap<>(2);
|
||||
// map.put("content", storeOrderDTOS);
|
||||
map.put("content", list);
|
||||
map.put("totalElements", page.getTotal());
|
||||
return map;
|
||||
AdminOrderDto dto = new AdminOrderDto();
|
||||
dto.setContent(list);
|
||||
dto.setTotalElements(page.getTotal());
|
||||
// 商品数量
|
||||
dto.setProductCount(beforePageList.stream().map(YxStoreOrder::getTotalNum).reduce(Integer::sum).orElse(0));
|
||||
//
|
||||
dto.setOrderAmount(beforePageList.stream().map(YxStoreOrder::getTotalPrice).reduce(BigDecimal::add).orElse(BigDecimal.ZERO));
|
||||
//
|
||||
List<Long> uidList = Lists.newArrayList();
|
||||
|
||||
long customerCount = beforePageList.stream().filter(yxStoreOrder -> {
|
||||
boolean flag = !uidList.contains(yxStoreOrder.getUid());
|
||||
uidList.add(yxStoreOrder.getUid());
|
||||
return flag;
|
||||
}).count();
|
||||
|
||||
dto.setCustomerCount(customerCount);
|
||||
|
||||
return dto;
|
||||
}
|
||||
|
||||
|
||||
@@ -2684,7 +2707,9 @@ public class YxStoreOrderServiceImpl extends BaseServiceImpl<StoreOrderMapper, Y
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> queryAll(YxStoreOrderQueryCriteria criteria, Pageable pageable) {
|
||||
public AdminOrderDto queryAll(YxStoreOrderQueryCriteria criteria, Pageable pageable) {
|
||||
List<YxStoreOrder> beforePageList = queryAll(criteria);
|
||||
|
||||
getPage(pageable);
|
||||
PageInfo<YxStoreOrder> page = new PageInfo<>(queryAll(criteria));
|
||||
// List<YxStoreOrderDto> storeOrderDTOS = new ArrayList<>();
|
||||
@@ -2695,9 +2720,25 @@ public class YxStoreOrderServiceImpl extends BaseServiceImpl<StoreOrderMapper, Y
|
||||
List<YxStoreOrderDto> list=this.newAssemble(page.getList());
|
||||
Map<String, Object> map = new LinkedHashMap<>(2);
|
||||
// map.put("content", storeOrderDTOS);
|
||||
map.put("content",list);
|
||||
map.put("totalElements", page.getTotal());
|
||||
return map;
|
||||
AdminOrderDto dto = new AdminOrderDto();
|
||||
dto.setContent(list);
|
||||
dto.setTotalElements(page.getTotal());
|
||||
|
||||
// 商品数量
|
||||
dto.setProductCount(beforePageList.stream().map(YxStoreOrder::getTotalNum).reduce(Integer::sum).orElse(0));
|
||||
//
|
||||
dto.setOrderAmount(beforePageList.stream().map(YxStoreOrder::getTotalPrice).reduce(BigDecimal::add).orElse(BigDecimal.ZERO));
|
||||
//
|
||||
List<Long> uidList = Lists.newArrayList();
|
||||
|
||||
long customerCount = beforePageList.stream().filter(yxStoreOrder -> {
|
||||
boolean flag = !uidList.contains(yxStoreOrder.getUid());
|
||||
uidList.add(yxStoreOrder.getUid());
|
||||
return flag;
|
||||
}).count();
|
||||
|
||||
dto.setCustomerCount(customerCount);
|
||||
return dto;
|
||||
}
|
||||
|
||||
|
||||
@@ -2902,7 +2943,7 @@ public class YxStoreOrderServiceImpl extends BaseServiceImpl<StoreOrderMapper, Y
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> queryAll(List<String> ids) {
|
||||
public AdminOrderDto queryAll(List<String> ids) {
|
||||
List<YxStoreOrder> yxStoreOrders = this.list(new LambdaQueryWrapper<YxStoreOrder>().in(YxStoreOrder::getOrderId, ids));
|
||||
List<YxStoreOrderDto> storeOrderDTOS = new ArrayList<>();
|
||||
for (YxStoreOrder yxStoreOrder : yxStoreOrders) {
|
||||
@@ -2910,9 +2951,9 @@ public class YxStoreOrderServiceImpl extends BaseServiceImpl<StoreOrderMapper, Y
|
||||
}
|
||||
|
||||
Map<String, Object> map = new LinkedHashMap<>(2);
|
||||
map.put("content", storeOrderDTOS);
|
||||
|
||||
return map;
|
||||
AdminOrderDto dto = new AdminOrderDto();
|
||||
dto.setContent(storeOrderDTOS);
|
||||
return dto;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user