👎 增加后台商品列表的数据统计字段
This commit is contained in:
@@ -84,18 +84,19 @@ public class StoreOrderController {
|
|||||||
this.yxStoreOrderStatusService = yxStoreOrderStatusService;
|
this.yxStoreOrderStatusService = yxStoreOrderStatusService;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**@Valid
|
/**
|
||||||
* 根据商品分类统计订单占比
|
* @Valid 根据商品分类统计订单占比
|
||||||
*/
|
*/
|
||||||
@GetMapping("/yxStoreOrder/orderCount")
|
@GetMapping("/yxStoreOrder/orderCount")
|
||||||
@ApiOperation(value = "根据商品分类统计订单占比",notes = "根据商品分类统计订单占比",response = ExpressParam.class)
|
@ApiOperation(value = "根据商品分类统计订单占比", notes = "根据商品分类统计订单占比", response = ExpressParam.class)
|
||||||
public ResponseEntity orderCount(){
|
public ResponseEntity orderCount() {
|
||||||
OrderCountDto orderCountDto = yxStoreOrderService.getOrderCount();
|
OrderCountDto orderCountDto = yxStoreOrderService.getOrderCount();
|
||||||
return new ResponseEntity<>(orderCountDto, HttpStatus.OK);
|
return new ResponseEntity<>(orderCountDto, HttpStatus.OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 首页订单/用户等统计
|
* 首页订单/用户等统计
|
||||||
|
*
|
||||||
* @return OrderTimeDataDto
|
* @return OrderTimeDataDto
|
||||||
*/
|
*/
|
||||||
@GetMapping(value = "/data/count")
|
@GetMapping(value = "/data/count")
|
||||||
@@ -106,6 +107,7 @@ public class StoreOrderController {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 返回本月订单金额与数量chart
|
* 返回本月订单金额与数量chart
|
||||||
|
*
|
||||||
* @return map
|
* @return map
|
||||||
*/
|
*/
|
||||||
@GetMapping(value = "/data/chart")
|
@GetMapping(value = "/data/chart")
|
||||||
@@ -118,20 +120,20 @@ public class StoreOrderController {
|
|||||||
@ApiOperation(value = "查询订单")
|
@ApiOperation(value = "查询订单")
|
||||||
@GetMapping(value = "/yxStoreOrder")
|
@GetMapping(value = "/yxStoreOrder")
|
||||||
@PreAuthorize("@ss.hasAnyPermissions('admin','YXSTOREORDER_ALL','YXSTOREORDER_SELECT','YXEXPRESS_SELECT')")
|
@PreAuthorize("@ss.hasAnyPermissions('admin','YXSTOREORDER_ALL','YXSTOREORDER_SELECT','YXEXPRESS_SELECT')")
|
||||||
public ResponseEntity getYxStoreOrders(YxStoreOrderQueryCriteria criteria,
|
public ResponseEntity<AdminOrderDto> getYxStoreOrders(YxStoreOrderQueryCriteria criteria,
|
||||||
Pageable pageable,
|
Pageable pageable,
|
||||||
@RequestParam(name = "orderStatus") String orderStatus,
|
@RequestParam(name = "orderStatus") String orderStatus,
|
||||||
@RequestParam(name = "orderType") String orderType) {
|
@RequestParam(name = "orderType") String orderType) {
|
||||||
//增加支持多选类型搜索
|
//增加支持多选类型搜索
|
||||||
Map<String,Object> map;
|
AdminOrderDto dto;
|
||||||
String[] orderTypeList=orderType.split(",");
|
String[] orderTypeList = orderType.split(",");
|
||||||
if(orderTypeList.length>1){//多选方法
|
if (orderTypeList.length > 1) {//多选方法
|
||||||
map=yxStoreOrderService.queryManyType(orderTypeList, pageable,criteria,orderStatus);
|
dto = yxStoreOrderService.queryManyType(orderTypeList, pageable, criteria, orderStatus);
|
||||||
}else {
|
} else {
|
||||||
YxStoreOrderQueryCriteria newCriteria = this.handleQuery(criteria,orderStatus,orderType);
|
YxStoreOrderQueryCriteria newCriteria = this.handleQuery(criteria, orderStatus, orderType);
|
||||||
map=yxStoreOrderService.queryAll(newCriteria, pageable);
|
dto = yxStoreOrderService.queryAll(newCriteria, pageable);
|
||||||
}
|
}
|
||||||
return new ResponseEntity<>(map, HttpStatus.OK);
|
return new ResponseEntity<>(dto, HttpStatus.OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiOperation(value = "根据订单id获取订单详情")
|
@ApiOperation(value = "根据订单id获取订单详情")
|
||||||
@@ -140,6 +142,7 @@ public class StoreOrderController {
|
|||||||
public ResponseEntity getYxStoreOrders(@PathVariable Long id) {
|
public ResponseEntity getYxStoreOrders(@PathVariable Long id) {
|
||||||
return new ResponseEntity<>(yxStoreOrderService.getOrderDetail(id), HttpStatus.OK);
|
return new ResponseEntity<>(yxStoreOrderService.getOrderDetail(id), HttpStatus.OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiOperation(value = "查询订单当前状态流程")
|
@ApiOperation(value = "查询订单当前状态流程")
|
||||||
@GetMapping(value = "/getNowOrderStatus/{id}")
|
@GetMapping(value = "/getNowOrderStatus/{id}")
|
||||||
public ResponseEntity getNowOrderStatus(@PathVariable Long id) {
|
public ResponseEntity getNowOrderStatus(@PathVariable Long id) {
|
||||||
@@ -190,6 +193,7 @@ public class StoreOrderController {
|
|||||||
|
|
||||||
return new ResponseEntity(yxOrderNowOrderStatusDto, HttpStatus.OK);
|
return new ResponseEntity(yxOrderNowOrderStatusDto, HttpStatus.OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<YxStoreOrderStatusDto> getOrderStatusDto(List<YxStoreOrderStatus> orderStatusLogList) {
|
public List<YxStoreOrderStatusDto> getOrderStatusDto(List<YxStoreOrderStatus> orderStatusLogList) {
|
||||||
List<YxStoreOrderStatusDto> dtoList = orderStatusLogList.stream().map(log -> {
|
List<YxStoreOrderStatusDto> dtoList = orderStatusLogList.stream().map(log -> {
|
||||||
YxStoreOrderStatusDto dto = generator.convert(log, YxStoreOrderStatusDto.class);
|
YxStoreOrderStatusDto dto = generator.convert(log, YxStoreOrderStatusDto.class);
|
||||||
@@ -199,6 +203,7 @@ public class StoreOrderController {
|
|||||||
}).collect(Collectors.toList());
|
}).collect(Collectors.toList());
|
||||||
return dtoList;
|
return dtoList;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiOperation(value = "发货")
|
@ApiOperation(value = "发货")
|
||||||
@PutMapping(value = "/yxStoreOrder")
|
@PutMapping(value = "/yxStoreOrder")
|
||||||
@PreAuthorize("@ss.hasAnyPermissions('admin','YXSTOREORDER_ALL','YXSTOREORDER_EDIT')")
|
@PreAuthorize("@ss.hasAnyPermissions('admin','YXSTOREORDER_ALL','YXSTOREORDER_EDIT')")
|
||||||
@@ -210,8 +215,8 @@ public class StoreOrderController {
|
|||||||
throw new BadRequestException("快递单号不能为空");
|
throw new BadRequestException("快递单号不能为空");
|
||||||
}
|
}
|
||||||
|
|
||||||
yxStoreOrderService.orderDelivery(resources.getOrderId(),resources.getDeliveryId(),
|
yxStoreOrderService.orderDelivery(resources.getOrderId(), resources.getDeliveryId(),
|
||||||
resources.getDeliveryName(),resources.getDeliveryType());
|
resources.getDeliveryName(), resources.getDeliveryType());
|
||||||
return new ResponseEntity(HttpStatus.NO_CONTENT);
|
return new ResponseEntity(HttpStatus.NO_CONTENT);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -232,7 +237,6 @@ public class StoreOrderController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ApiOperation(value = "修改快递单号")
|
@ApiOperation(value = "修改快递单号")
|
||||||
@PutMapping(value = "/yxStoreOrder/updateDelivery")
|
@PutMapping(value = "/yxStoreOrder/updateDelivery")
|
||||||
@PreAuthorize("hasAnyAuthority('admin','YXSTOREORDER_ALL','YXSTOREORDER_EDIT')")
|
@PreAuthorize("hasAnyAuthority('admin','YXSTOREORDER_ALL','YXSTOREORDER_EDIT')")
|
||||||
@@ -244,13 +248,12 @@ public class StoreOrderController {
|
|||||||
throw new BadRequestException("快递单号不能为空");
|
throw new BadRequestException("快递单号不能为空");
|
||||||
}
|
}
|
||||||
|
|
||||||
yxStoreOrderService.updateDelivery(resources.getOrderId(),resources.getDeliveryId(),
|
yxStoreOrderService.updateDelivery(resources.getOrderId(), resources.getDeliveryId(),
|
||||||
resources.getDeliveryName(),resources.getDeliveryType());
|
resources.getDeliveryName(), resources.getDeliveryType());
|
||||||
return new ResponseEntity(HttpStatus.NO_CONTENT);
|
return new ResponseEntity(HttpStatus.NO_CONTENT);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ApiOperation(value = "订单核销")
|
@ApiOperation(value = "订单核销")
|
||||||
@PutMapping(value = "/yxStoreOrder/check")
|
@PutMapping(value = "/yxStoreOrder/check")
|
||||||
@PreAuthorize("@ss.hasAnyPermissions('admin','YXSTOREORDER_ALL','YXSTOREORDER_EDIT')")
|
@PreAuthorize("@ss.hasAnyPermissions('admin','YXSTOREORDER_ALL','YXSTOREORDER_EDIT')")
|
||||||
@@ -258,16 +261,16 @@ public class StoreOrderController {
|
|||||||
if (StrUtil.isBlank(resources.getVerifyCode())) {
|
if (StrUtil.isBlank(resources.getVerifyCode())) {
|
||||||
throw new BadRequestException("核销码不能为空");
|
throw new BadRequestException("核销码不能为空");
|
||||||
}
|
}
|
||||||
YxStoreOrderDto storeOrderDTO = generator.convert(yxStoreOrderService.getById(resources.getId()),YxStoreOrderDto.class);
|
YxStoreOrderDto storeOrderDTO = generator.convert(yxStoreOrderService.getById(resources.getId()), YxStoreOrderDto.class);
|
||||||
if(!resources.getVerifyCode().equals(storeOrderDTO.getVerifyCode())){
|
if (!resources.getVerifyCode().equals(storeOrderDTO.getVerifyCode())) {
|
||||||
throw new BadRequestException("核销码不对");
|
throw new BadRequestException("核销码不对");
|
||||||
}
|
}
|
||||||
if(OrderInfoEnum.PAY_STATUS_0.getValue().equals(storeOrderDTO.getPaid())){
|
if (OrderInfoEnum.PAY_STATUS_0.getValue().equals(storeOrderDTO.getPaid())) {
|
||||||
throw new BadRequestException("订单未支付");
|
throw new BadRequestException("订单未支付");
|
||||||
}
|
}
|
||||||
|
|
||||||
yxStoreOrderService.verifyOrder(resources.getVerifyCode(),
|
yxStoreOrderService.verifyOrder(resources.getVerifyCode(),
|
||||||
OrderInfoEnum.CONFIRM_STATUS_1.getValue(),null);
|
OrderInfoEnum.CONFIRM_STATUS_1.getValue(), null);
|
||||||
|
|
||||||
return new ResponseEntity(HttpStatus.NO_CONTENT);
|
return new ResponseEntity(HttpStatus.NO_CONTENT);
|
||||||
}
|
}
|
||||||
@@ -277,7 +280,7 @@ public class StoreOrderController {
|
|||||||
@PostMapping(value = "/yxStoreOrder/refund")
|
@PostMapping(value = "/yxStoreOrder/refund")
|
||||||
@PreAuthorize("@ss.hasAnyPermissions('admin','YXSTOREORDER_ALL','YXSTOREORDER_EDIT')")
|
@PreAuthorize("@ss.hasAnyPermissions('admin','YXSTOREORDER_ALL','YXSTOREORDER_EDIT')")
|
||||||
public ResponseEntity refund(@Validated @RequestBody YxStoreOrder resources) {
|
public ResponseEntity refund(@Validated @RequestBody YxStoreOrder resources) {
|
||||||
yxStoreOrderService.orderRefund(resources.getOrderId(),resources.getPayPrice(),
|
yxStoreOrderService.orderRefund(resources.getOrderId(), resources.getPayPrice(),
|
||||||
ShopCommonEnum.AGREE_1.getValue());
|
ShopCommonEnum.AGREE_1.getValue());
|
||||||
return new ResponseEntity(HttpStatus.NO_CONTENT);
|
return new ResponseEntity(HttpStatus.NO_CONTENT);
|
||||||
}
|
}
|
||||||
@@ -305,7 +308,7 @@ public class StoreOrderController {
|
|||||||
if (resources.getPayPrice().doubleValue() < 0) {
|
if (resources.getPayPrice().doubleValue() < 0) {
|
||||||
throw new BadRequestException("金额不能低于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());
|
int res = NumberUtil.compare(storeOrder.getPayPrice().doubleValue(), resources.getPayPrice().doubleValue());
|
||||||
if (res != 0) {
|
if (res != 0) {
|
||||||
@@ -315,7 +318,7 @@ public class StoreOrderController {
|
|||||||
|
|
||||||
yxStoreOrderService.saveOrUpdate(resources);
|
yxStoreOrderService.saveOrUpdate(resources);
|
||||||
|
|
||||||
yxStoreOrderStatusService.create(resources.getId(),OrderLogEnum.ORDER_EDIT.getValue(),
|
yxStoreOrderStatusService.create(resources.getId(), OrderLogEnum.ORDER_EDIT.getValue(),
|
||||||
"修改订单价格为:" + resources.getPayPrice());
|
"修改订单价格为:" + resources.getPayPrice());
|
||||||
return new ResponseEntity(HttpStatus.OK);
|
return new ResponseEntity(HttpStatus.OK);
|
||||||
}
|
}
|
||||||
@@ -338,8 +341,8 @@ public class StoreOrderController {
|
|||||||
* 快递查询
|
* 快递查询
|
||||||
*/
|
*/
|
||||||
@PostMapping("/yxStoreOrder/express")
|
@PostMapping("/yxStoreOrder/express")
|
||||||
@ApiOperation(value = "获取物流信息",notes = "获取物流信息",response = ExpressParam.class)
|
@ApiOperation(value = "获取物流信息", notes = "获取物流信息", response = ExpressParam.class)
|
||||||
public ResponseEntity express( @RequestBody ExpressParam expressInfoDo){
|
public ResponseEntity express(@RequestBody ExpressParam expressInfoDo) {
|
||||||
|
|
||||||
ExpressInfo expressInfo = expressService.getExpressInfo(expressInfoDo.getOrderCode(),
|
ExpressInfo expressInfo = expressService.getExpressInfo(expressInfoDo.getOrderCode(),
|
||||||
expressInfoDo.getShipperCode(), expressInfoDo.getLogisticCode());
|
expressInfoDo.getShipperCode(), expressInfoDo.getLogisticCode());
|
||||||
@@ -361,43 +364,44 @@ public class StoreOrderController {
|
|||||||
@RequestParam(name = "orderType") String orderType,
|
@RequestParam(name = "orderType") String orderType,
|
||||||
@RequestParam(name = "listContent") String listContent) throws IOException, ParseException {
|
@RequestParam(name = "listContent") String listContent) throws IOException, ParseException {
|
||||||
List<YxStoreOrderDto> list;
|
List<YxStoreOrderDto> list;
|
||||||
if(StringUtils.isEmpty(listContent)){
|
if (StringUtils.isEmpty(listContent)) {
|
||||||
list = (List)getYxStoreList(criteria, pageable, orderStatus, orderType).get("content");
|
list = getYxStoreList(criteria, pageable, orderStatus, orderType).getContent();
|
||||||
}else {
|
} else {
|
||||||
List<String> idList = JSONArray.parseArray(listContent).toJavaList(String.class);
|
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);
|
yxStoreOrderService.download(list, response);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 下载数据
|
* 下载数据
|
||||||
|
*
|
||||||
* @param criteria criteria
|
* @param criteria criteria
|
||||||
* @param pageable pageable
|
* @param pageable pageable
|
||||||
* @param orderStatus orderStatus
|
* @param orderStatus orderStatus
|
||||||
* @param orderType orderType
|
* @param orderType orderType
|
||||||
* @return Map
|
* @return Map
|
||||||
*/
|
*/
|
||||||
private Map<String,Object> getYxStoreList(YxStoreOrderQueryCriteria criteria,
|
private AdminOrderDto getYxStoreList(YxStoreOrderQueryCriteria criteria,
|
||||||
Pageable pageable,
|
Pageable pageable,
|
||||||
String orderStatus,
|
String orderStatus,
|
||||||
String orderType){
|
String orderType) {
|
||||||
|
|
||||||
YxStoreOrderQueryCriteria newCriteria = this.handleQuery(criteria,orderStatus,orderType);
|
YxStoreOrderQueryCriteria newCriteria = this.handleQuery(criteria, orderStatus, orderType);
|
||||||
return yxStoreOrderService.queryAll(newCriteria, pageable);
|
return yxStoreOrderService.queryAll(newCriteria, pageable);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 处理订单查询
|
* 处理订单查询
|
||||||
|
*
|
||||||
* @param criteria YxStoreOrderQueryCriteria
|
* @param criteria YxStoreOrderQueryCriteria
|
||||||
* @param orderStatus 订单状态
|
* @param orderStatus 订单状态
|
||||||
* @param orderType 订单类型
|
* @param orderType 订单类型
|
||||||
* @return YxStoreOrderQueryCriteria
|
* @return YxStoreOrderQueryCriteria
|
||||||
*/
|
*/
|
||||||
private YxStoreOrderQueryCriteria handleQuery(YxStoreOrderQueryCriteria criteria,String orderStatus,
|
private YxStoreOrderQueryCriteria handleQuery(YxStoreOrderQueryCriteria criteria, String orderStatus,
|
||||||
String orderType){
|
String orderType) {
|
||||||
|
|
||||||
//默认查询所有快递订单
|
//默认查询所有快递订单
|
||||||
// criteria.setShippingType(OrderInfoEnum.SHIPPIING_TYPE_1.getValue());
|
// criteria.setShippingType(OrderInfoEnum.SHIPPIING_TYPE_1.getValue());
|
||||||
@@ -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.YxStoreOrder;
|
||||||
import co.yixiang.modules.order.domain.YxStoreOrderCartInfo;
|
import co.yixiang.modules.order.domain.YxStoreOrderCartInfo;
|
||||||
import co.yixiang.modules.order.param.OrderParam;
|
import co.yixiang.modules.order.param.OrderParam;
|
||||||
import co.yixiang.modules.order.service.dto.OrderCountDto;
|
import co.yixiang.modules.order.service.dto.*;
|
||||||
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.vo.ComputeVo;
|
import co.yixiang.modules.order.vo.ComputeVo;
|
||||||
import co.yixiang.modules.order.vo.ConfirmOrderVo;
|
import co.yixiang.modules.order.vo.ConfirmOrderVo;
|
||||||
import co.yixiang.modules.order.vo.OrderDataVo;
|
import co.yixiang.modules.order.vo.OrderDataVo;
|
||||||
@@ -257,7 +254,7 @@ public interface YxStoreOrderService extends BaseService<YxStoreOrder>{
|
|||||||
* @param pageable 分页参数
|
* @param pageable 分页参数
|
||||||
* @return Map<String,Object>
|
* @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 分页参数
|
* @param pageable 分页参数
|
||||||
* @return Map<String,Object>
|
* @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);
|
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.core.toolkit.Wrappers;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.github.pagehelper.PageInfo;
|
import com.github.pagehelper.PageInfo;
|
||||||
|
import com.google.common.collect.Lists;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.cache.annotation.CacheEvict;
|
import org.springframework.cache.annotation.CacheEvict;
|
||||||
@@ -109,6 +110,7 @@ import java.math.BigDecimal;
|
|||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
import java.util.concurrent.atomic.AtomicInteger;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
|
||||||
@@ -2408,7 +2410,8 @@ public class YxStoreOrderServiceImpl extends BaseServiceImpl<StoreOrderMapper, Y
|
|||||||
|
|
||||||
|
|
||||||
@Override
|
@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<>();
|
LambdaQueryWrapper<YxStoreOrder> queryWrapper =new LambdaQueryWrapper<>();
|
||||||
if(StringUtils.isNotBlank(criteria.getOrderId())){
|
if(StringUtils.isNotBlank(criteria.getOrderId())){
|
||||||
queryWrapper.like(YxStoreOrder::getOrderId,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);
|
getPage(pageable);
|
||||||
PageInfo<YxStoreOrder> page = new PageInfo<>(storeOrderMapper.selectList(queryWrapper));
|
PageInfo<YxStoreOrder> page = new PageInfo<>(storeOrderMapper.selectList(queryWrapper));
|
||||||
// List<YxStoreOrderDto> storeOrderDTOS = new ArrayList<>();
|
// List<YxStoreOrderDto> storeOrderDTOS = new ArrayList<>();
|
||||||
@@ -2541,9 +2548,25 @@ public class YxStoreOrderServiceImpl extends BaseServiceImpl<StoreOrderMapper, Y
|
|||||||
List<YxStoreOrderDto> list=this.newAssemble(page.getList());
|
List<YxStoreOrderDto> list=this.newAssemble(page.getList());
|
||||||
Map<String, Object> map = new LinkedHashMap<>(2);
|
Map<String, Object> map = new LinkedHashMap<>(2);
|
||||||
// map.put("content", storeOrderDTOS);
|
// map.put("content", storeOrderDTOS);
|
||||||
map.put("content", list);
|
AdminOrderDto dto = new AdminOrderDto();
|
||||||
map.put("totalElements", page.getTotal());
|
dto.setContent(list);
|
||||||
return map;
|
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
|
@Override
|
||||||
public Map<String, Object> queryAll(YxStoreOrderQueryCriteria criteria, Pageable pageable) {
|
public AdminOrderDto queryAll(YxStoreOrderQueryCriteria criteria, Pageable pageable) {
|
||||||
|
List<YxStoreOrder> beforePageList = queryAll(criteria);
|
||||||
|
|
||||||
getPage(pageable);
|
getPage(pageable);
|
||||||
PageInfo<YxStoreOrder> page = new PageInfo<>(queryAll(criteria));
|
PageInfo<YxStoreOrder> page = new PageInfo<>(queryAll(criteria));
|
||||||
// List<YxStoreOrderDto> storeOrderDTOS = new ArrayList<>();
|
// List<YxStoreOrderDto> storeOrderDTOS = new ArrayList<>();
|
||||||
@@ -2695,9 +2720,25 @@ public class YxStoreOrderServiceImpl extends BaseServiceImpl<StoreOrderMapper, Y
|
|||||||
List<YxStoreOrderDto> list=this.newAssemble(page.getList());
|
List<YxStoreOrderDto> list=this.newAssemble(page.getList());
|
||||||
Map<String, Object> map = new LinkedHashMap<>(2);
|
Map<String, Object> map = new LinkedHashMap<>(2);
|
||||||
// map.put("content", storeOrderDTOS);
|
// map.put("content", storeOrderDTOS);
|
||||||
map.put("content",list);
|
AdminOrderDto dto = new AdminOrderDto();
|
||||||
map.put("totalElements", page.getTotal());
|
dto.setContent(list);
|
||||||
return map;
|
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
|
@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<YxStoreOrder> yxStoreOrders = this.list(new LambdaQueryWrapper<YxStoreOrder>().in(YxStoreOrder::getOrderId, ids));
|
||||||
List<YxStoreOrderDto> storeOrderDTOS = new ArrayList<>();
|
List<YxStoreOrderDto> storeOrderDTOS = new ArrayList<>();
|
||||||
for (YxStoreOrder yxStoreOrder : yxStoreOrders) {
|
for (YxStoreOrder yxStoreOrder : yxStoreOrders) {
|
||||||
@@ -2910,9 +2951,9 @@ public class YxStoreOrderServiceImpl extends BaseServiceImpl<StoreOrderMapper, Y
|
|||||||
}
|
}
|
||||||
|
|
||||||
Map<String, Object> map = new LinkedHashMap<>(2);
|
Map<String, Object> map = new LinkedHashMap<>(2);
|
||||||
map.put("content", storeOrderDTOS);
|
AdminOrderDto dto = new AdminOrderDto();
|
||||||
|
dto.setContent(storeOrderDTOS);
|
||||||
return map;
|
return dto;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user