瀏覽代碼

:sparkles: 新增查询积分订单统计接口

Twelve615 1 年之前
父節點
當前提交
b0eea7a23b

+ 7 - 0
crmeb-admin/src/main/java/com/zbkj/admin/controller/merchant/MerchantOrderController.java

@@ -54,6 +54,13 @@ public class MerchantOrderController {
         return CommonResult.success(orderService.getMerchantOrderStatusNum(dateLimit));
     }
 
+    @PreAuthorize("hasAuthority('merchant:order:status:num')")
+    @ApiOperation(value = "获取订单各状态数量")
+    @RequestMapping(value = "/status/numIntegral", method = RequestMethod.GET)
+    public CommonResult<OrderCountItemResponse> getOrderStatusNumIntegral(@RequestParam(value = "dateLimit", defaultValue = "") String dateLimit) {
+        return CommonResult.success(orderService.getMerchantOrderStatusNumIntegral(dateLimit));
+    }
+
     @LogControllerAnnotation(intoDB = true, methodType = MethodType.DELETE, description = "商户删除订单")
     @PreAuthorize("hasAuthority('merchant:order:delete')")
     @ApiOperation(value = "订单删除")

+ 2 - 1
crmeb-front/src/main/java/com/zbkj/front/controller/NewFrontApi.java

@@ -11,6 +11,7 @@ import com.baomidou.mybatisplus.core.toolkit.StringUtils;
 import com.fasterxml.jackson.databind.ObjectMapper;
 import com.github.pagehelper.PageInfo;
 
+import com.google.common.base.Strings;
 import com.zbkj.common.model.cat.CartShare;
 import com.zbkj.common.model.merchant.MerchantSms;
 import com.zbkj.common.model.organization.Organization;
@@ -563,7 +564,7 @@ public class NewFrontApi {
     public CommonResult<?> specialReminder() {
         HashMap<String, String> info = systemConfigService.info(58);
         String specialReminder = info.get("specialReminder");
-        if (StringUtils.isNotBlank(specialReminder)){
+        if (Strings.isNullOrEmpty(specialReminder)){
             return CommonResult.success("");
         }
         return CommonResult.success(specialReminder);

+ 7 - 0
crmeb-service/src/main/java/com/zbkj/service/service/OrderService.java

@@ -11,6 +11,7 @@ import com.zbkj.common.request.OrderSendRequest;
 import com.zbkj.common.request.PageParamRequest;
 import com.zbkj.common.response.*;
 import com.zbkj.common.vo.LogisticsResultVo;
+import com.zbkj.common.vo.MyRecord;
 
 import java.math.BigDecimal;
 import java.util.List;
@@ -278,4 +279,10 @@ public interface OrderService extends IService<Order> {
     List<Integer> getOrderUid();
 
     PageInfo<User> getPhoneList(Integer merId,PageParamRequest pageParamRequest,String id);
+
+    /**
+     * 获取商户端订单各状态数量
+     * @param dateLimit 时间参数
+     */
+    OrderCountItemResponse getMerchantOrderStatusNumIntegral(String dateLimit);
 }

+ 48 - 0
crmeb-service/src/main/java/com/zbkj/service/service/impl/OrderServiceImpl.java

@@ -1252,6 +1252,54 @@ public class OrderServiceImpl extends ServiceImpl<OrderDao, Order> implements Or
     }
 
     @Override
+    public OrderCountItemResponse getMerchantOrderStatusNumIntegral(String dateLimit) {
+        SystemAdmin systemAdmin = SecurityUtil.getLoginUserVo().getUser();
+        OrderCountItemResponse response = new OrderCountItemResponse();
+        // 全部订单
+        response.setAll(getIntegralCount(dateLimit, OrderConstants.MERCHANT_ORDER_STATUS_ALL, systemAdmin.getMerId()));
+        // 未支付订单
+        response.setUnPaid(getIntegralCount(dateLimit, OrderConstants.MERCHANT_ORDER_STATUS_UNPAID, systemAdmin.getMerId()));
+        // 未发货订单
+        response.setNotShipped(getIntegralCount(dateLimit, OrderConstants.MERCHANT_ORDER_STATUS_NOT_SHIPPED, systemAdmin.getMerId()));
+        // 待收货订单
+        response.setSpike(getIntegralCount(dateLimit, OrderConstants.MERCHANT_ORDER_STATUS_SPIKE, systemAdmin.getMerId()));
+        // 已收货订单
+        response.setReceiving(getIntegralCount(dateLimit, OrderConstants.MERCHANT_ORDER_STATUS_RECEIVING, systemAdmin.getMerId()));
+        // 交易完成订单
+        response.setComplete(getIntegralCount(dateLimit, OrderConstants.MERCHANT_ORDER_STATUS_COMPLETE, systemAdmin.getMerId()));
+        // 已退款订单
+        response.setRefunded(getIntegralCount(dateLimit, OrderConstants.MERCHANT_ORDER_STATUS_REFUNDED, systemAdmin.getMerId()));
+        // 已删除订单
+        response.setDeleted(getIntegralCount(dateLimit, OrderConstants.MERCHANT_ORDER_STATUS_DELETED, systemAdmin.getMerId()));
+        // 待核销订单
+        response.setVerification(getIntegralCount(dateLimit, OrderConstants.MERCHANT_ORDER_STATUS_AWAIT_VERIFICATION, systemAdmin.getMerId()));
+        return response;
+    }
+
+    /**
+     * 获取积分订单总数
+     *
+     * @param dateLimit 时间端
+     * @param status    String 状态
+     * @return Integer
+     */
+    private Integer getIntegralCount(String dateLimit, String status, Integer merId) {
+        //总数只计算时间
+        LambdaQueryWrapper<Order> lqw = Wrappers.lambdaQuery();
+        if (merId > 0) {
+            lqw.eq(Order::getMerId, merId);
+            lqw.eq(Order::getIsMerchantDel, false);
+            lqw.eq(Order::getLevel, OrderConstants.ORDER_LEVEL_MERCHANT);
+            lqw.eq(Order::getIsIntegral, 1);
+        }
+        if (StrUtil.isNotBlank(dateLimit)) {
+            getRequestTimeWhere(lqw, dateLimit);
+        }
+        getMerchantStatusWhere(lqw, status);
+        return dao.selectCount(lqw);
+    }
+
+    @Override
     public List<Integer> getOrderUid() {
         return dao.getOrderUid();
     }