FengChaoYu 3 minggu lalu
induk
melakukan
3b713f5e71

+ 9 - 0
mall-miniapp-service/src/main/java/com/gree/mall/miniapp/bean/order/OrderDeliverBean.java

@@ -0,0 +1,9 @@
+package com.gree.mall.miniapp.bean.order;
+
+import io.swagger.annotations.ApiModel;
+import lombok.Data;
+
+@Data
+@ApiModel
+public class OrderDeliverBean {
+}

+ 9 - 0
mall-miniapp-service/src/main/java/com/gree/mall/miniapp/bean/workorder/CountOrderStatusBean.java

@@ -28,6 +28,15 @@ public class CountOrderStatusBean {
     private Integer ping = 0;
     @ApiModelProperty("配件已到货")
     private Integer pend = 0;
+
+    @ApiModelProperty("待配送")
+    private Integer dps = 0;
+    @ApiModelProperty("配送中")
+    private Integer psz = 0;
+    @ApiModelProperty("已配送")
+    private Integer over = 0;
+
     @ApiModelProperty("全部数量")
     private Integer all = 0;
+
 }

+ 2 - 0
mall-miniapp-service/src/main/java/com/gree/mall/miniapp/commonmapper/workorder/OrderBaseCMapper.java

@@ -22,4 +22,6 @@ public interface OrderBaseCMapper {
     );
 
     CountOrderStatusBean countPartsApply(@Param("userId") String userId);
+
+    CountOrderStatusBean countDeliverOrder(@Param("userId") String userId);
 }

+ 44 - 0
mall-miniapp-service/src/main/java/com/gree/mall/miniapp/controller/order/OrderDeliverController.java

@@ -0,0 +1,44 @@
+package com.gree.mall.miniapp.controller.order;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.gree.mall.miniapp.bean.order.OrderDeliverBean;
+import com.gree.mall.miniapp.bean.order.OrderDetailBean;
+import com.gree.mall.miniapp.bean.workorder.CountOrderStatusBean;
+import com.gree.mall.miniapp.helper.ResponseHelper;
+import com.gree.mall.miniapp.logic.order.OrderDeliverLogic;
+import com.gree.mall.miniapp.plus.entity.OrderInfo;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiParam;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.web.bind.annotation.*;
+
+import javax.annotation.Resource;
+
+@Slf4j
+@RestController
+@Api(value = "配送订单", tags ={"配送订单"} )
+@RequestMapping(value = "/order/deliver", produces = "application/json; charset=utf-8")
+public class OrderDeliverController {
+
+    @Resource
+    OrderDeliverLogic orderDeliverLogic;
+
+    @PostMapping("/list")
+    @ApiOperation("配送订单")
+    public ResponseHelper<IPage<OrderInfo>> orderList(
+            @ApiParam(value = "订单状态(DPS:待付款 PSZ:待发货 OVER:已完成)") @RequestParam(required = false) String orderStatus,
+            @ApiParam(value = "pageNo",required = true) @RequestParam Integer pageNum,
+            @ApiParam(value = "pageSize",required = true) @RequestParam Integer pageSize
+    ){
+        IPage<OrderInfo> list = orderDeliverLogic.orderList(orderStatus, pageNum, pageSize);
+        return ResponseHelper.success(list);
+    }
+
+    @PostMapping("/status/count")
+    @ApiOperation(value = "工单状态统计")
+    public ResponseHelper<CountOrderStatusBean> countStatus() throws Exception{
+        CountOrderStatusBean countOrderStatusBean = orderDeliverLogic.countOrderStatus();
+        return ResponseHelper.success(countOrderStatusBean);
+    }
+}

+ 43 - 0
mall-miniapp-service/src/main/java/com/gree/mall/miniapp/logic/order/OrderDeliverLogic.java

@@ -0,0 +1,43 @@
+package com.gree.mall.miniapp.logic.order;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.gree.mall.miniapp.bean.order.OrderDeliverBean;
+import com.gree.mall.miniapp.bean.user.CurrentCompanyWechat;
+import com.gree.mall.miniapp.bean.workorder.CountOrderStatusBean;
+import com.gree.mall.miniapp.commonmapper.CommonMapper;
+import com.gree.mall.miniapp.commonmapper.workorder.OrderBaseCMapper;
+import com.gree.mall.miniapp.logic.common.CommonLogic;
+import com.gree.mall.miniapp.plus.entity.OrderInfo;
+import com.gree.mall.miniapp.plus.service.OrderInfoService;
+import lombok.RequiredArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.stereotype.Service;
+
+import java.util.Objects;
+
+@Service
+@Slf4j
+@RequiredArgsConstructor
+public class OrderDeliverLogic {
+
+    private final CommonLogic commonLogic;
+    private final OrderInfoService orderInfoService;
+    private final OrderBaseCMapper orderBaseCMapper;
+
+    public IPage<OrderInfo> orderList(String orderStatus, Integer pageNum, Integer pageSize) {
+        CurrentCompanyWechat currentCompanyWechat = commonLogic.getCurrentCompanyWechat();
+        return orderInfoService.lambdaQuery()
+                .eq(OrderInfo::getDeliveryUserId, currentCompanyWechat.getUserId())
+                .eq(StringUtils.isNotBlank(orderStatus), OrderInfo::getOrderStatus, orderStatus)
+                .page(new Page<>(pageNum, pageSize));
+    }
+
+    public CountOrderStatusBean countOrderStatus() {
+        CurrentCompanyWechat currentCompanyWechat = commonLogic.getCurrentCompanyWechat();
+        CountOrderStatusBean countOrderStatusBean3 = orderBaseCMapper.countDeliverOrder(currentCompanyWechat.getUserId());
+
+        return countOrderStatusBean3;
+    }
+}

+ 2 - 1
mall-miniapp-service/src/main/java/com/gree/mall/miniapp/logic/workorder/OrderBaseLogic.java

@@ -54,10 +54,11 @@ public class OrderBaseLogic {
         CurrentCompanyWechat currentCompanyWechat = commonLogic.getCurrentCompanyWechat();
         CountOrderStatusBean countOrderStatusBean = orderBaseCMapper.countOrderStatus(currentCompanyWechat.getUserId(),pgIncreOrderId,isYb,isWb,currentCompanyWechat.getCompanyWechatId());
         CountOrderStatusBean countOrderStatusBean2 = orderBaseCMapper.countPartsApply(currentCompanyWechat.getUserId());
-        if(countOrderStatusBean2 != null) {
+        if(Objects.nonNull(countOrderStatusBean2)) {
             countOrderStatusBean.setPing(countOrderStatusBean2.getPing());
             countOrderStatusBean.setPend(countOrderStatusBean2.getPend());
         }
+
         return countOrderStatusBean;
     }
 

+ 11 - 0
mall-miniapp-service/src/main/resources/mapper/workorder/OrderBaseCMapper.xml

@@ -38,5 +38,16 @@
             a.create_by_id = #{userId}
             AND a.status IN ('ING', 'END')
     </select>
+    <select id="countDeliverOrder" resultType="com.gree.mall.miniapp.bean.workorder.CountOrderStatusBean">
+        SELECT
+            SUM(IF(a.order_status = 'DPS', 1, 0)) AS 'dps',
+            SUM(IF(a.order_status = 'PSZ', 1, 0)) AS 'psz',
+            SUM(IF(a.order_status = 'OVER', 1, 0)) AS 'over'
+        FROM
+            order_info a
+        WHERE
+            a.delivery_user_id = #{userId}
+          AND a.order_status IN ('DPS', 'PSZ', 'OVER')
+    </select>
 
 </mapper>