Просмотр исходного кода

项目顶部首页承运接单/调度派车/待核运单数量统计dubbo接口提供

lengfaqiang 2 лет назад
Родитель
Сommit
006aca2178

+ 36 - 0
sckw-modules-api/sckw-transport-api/src/main/java/com/sckw/transport/api/dubbo/TransportStatisticsService.java

@@ -0,0 +1,36 @@
+package com.sckw.transport.api.dubbo;
+
+/**
+ * @author lfdc
+ * @version 1.0
+ * @className TransportStatisticsService
+ * @description 物流订单dubbo
+ * @company sckw
+ * @date 2023-09-08 10:06:27
+ */
+public interface TransportStatisticsService {
+    /**
+     * 统计承运接单
+     *
+     * @param topEntId
+     * @return
+     */
+    Integer statisticsLogistics(Long topEntId);
+
+    /**
+     * 统计调度派车
+     *
+     * @param topEntId
+     * @return
+     */
+    Integer statisticsWaybillSendCar(Long topEntId);
+
+    /**
+     * 统计待核运单
+     *
+     * @param topEntId
+     * @return
+     */
+    Integer statisticsPendingVerificationWaybill(Long topEntId);
+
+}

+ 4 - 0
sckw-modules/sckw-example/pom.xml

@@ -96,6 +96,10 @@
             <groupId>com.sckw</groupId>
             <artifactId>sckw-payment-api</artifactId>
         </dependency>
+        <dependency>
+            <groupId>com.sckw</groupId>
+            <artifactId>sckw-transport-api</artifactId>
+        </dependency>
         <!--junit-->
         <dependency>
             <groupId>junit</groupId>

+ 75 - 0
sckw-modules/sckw-example/src/main/java/com/sckw/example/controller/TransportController.java

@@ -0,0 +1,75 @@
+package com.sckw.example.controller;
+
+import com.sckw.core.web.context.LoginUserHolder;
+import com.sckw.example.service.TransportService;
+import com.sckw.system.api.RemoteSystemService;
+import com.sckw.system.api.model.dto.res.EntCacheResDto;
+import lombok.AllArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.dubbo.config.annotation.DubboReference;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * @desc: 测试
+ * @author: lfdc
+ * @date: 2023-09-08 14:20
+ */
+@Slf4j
+@AllArgsConstructor
+@RestController
+@RequestMapping("/transportTest")
+public class TransportController {
+
+    @Autowired
+    private TransportService transportService;
+
+    @DubboReference(version = "1.0.0", group = "design", check = false)
+    private RemoteSystemService systemService;
+
+    /**
+     * 统计承运接单
+     *
+     * @param
+     * @return
+     */
+    @RequestMapping(value = "/statisticsLogistics", method = RequestMethod.GET)
+    public Integer statisticsLogistics() {
+        EntCacheResDto entCacheResDto = systemService.queryEntTreeById(LoginUserHolder.getEntId());
+        Long topEntId = entCacheResDto.getId();
+        Integer integer = transportService.statisticsLogistics(topEntId);
+        return integer;
+    }
+
+    /**
+     * 统计调度派车
+     *
+     * @param
+     * @return
+     */
+    @RequestMapping(value = "/statisticsWaybillSendCar", method = RequestMethod.GET)
+    public Integer statisticsWaybillSendCar() {
+        EntCacheResDto entCacheResDto = systemService.queryEntTreeById(LoginUserHolder.getEntId());
+        Long topEntId = entCacheResDto.getId();
+        Integer integer = transportService.statisticsWaybillSendCar(topEntId);
+        return integer;
+    }
+
+    /**
+     * 统计待核运单
+     *
+     * @param
+     * @return
+     */
+    @RequestMapping(value = "/statisticsPendingVerificationWaybill", method = RequestMethod.GET)
+    public Integer statisticsPendingVerificationWaybill(){
+        EntCacheResDto entCacheResDto = systemService.queryEntTreeById(LoginUserHolder.getEntId());
+        Long topEntId = entCacheResDto.getId();
+        Integer integer = transportService.statisticsPendingVerificationWaybill(topEntId);
+        return integer;
+    }
+
+
+}

+ 31 - 0
sckw-modules/sckw-example/src/main/java/com/sckw/example/service/TransportService.java

@@ -0,0 +1,31 @@
+package com.sckw.example.service;
+
+import com.sckw.transport.api.dubbo.TransportStatisticsService;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.dubbo.config.annotation.DubboReference;
+import org.springframework.stereotype.Service;
+
+/**
+ * @author lfdc
+ * @description 运输服务service
+ * @date 2023-09-08 14:09:23
+ */
+@Slf4j
+@Service
+public class TransportService {
+
+    @DubboReference(version = "1.0.0", group = "design", check = false)
+    private TransportStatisticsService statisticsService;
+
+    public Integer statisticsLogistics(Long topEntId) {
+        return statisticsService.statisticsLogistics(topEntId);
+    }
+
+    public Integer statisticsWaybillSendCar(Long topEntId) {
+        return statisticsService.statisticsWaybillSendCar(topEntId);
+    }
+
+    public Integer statisticsPendingVerificationWaybill(Long topEntId) {
+        return statisticsService.statisticsPendingVerificationWaybill(topEntId);
+    }
+}

+ 24 - 0
sckw-modules/sckw-example/src/main/resources/bootstrap-lfdc.yml

@@ -0,0 +1,24 @@
+spring:
+  cloud:
+    nacos:
+      discovery:
+        # 服务注册地址
+        server-addr: 10.10.10.230:8848
+        # 命名空间
+        namespace: sckw_lfdc
+        # 共享配置
+        group: sckw-service-platform
+      config:
+        # 配置中心地址
+        server-addr: 10.10.10.230:8848
+        # 配置文件格式
+        file-extension: yaml
+        # 命名空间
+        namespace: sckw_lfdc
+        # 共享配置
+        group: sckw-service-platform
+        #可以读多个配置文件  需要在同一个命名空间下面可以是不同的组
+        extension-configs:
+          - dataId: sckw-common.yml
+            group: sckw-service-platform
+            refresh: true

+ 1 - 1
sckw-modules/sckw-example/src/main/resources/bootstrap.yml

@@ -6,7 +6,7 @@ spring:
     name: sckw-example
   profiles:
 #    active: @profiles.active@
-    active: ${DEPLOY_MODE:dev}
+    active: ${DEPLOY_MODE:lfdc}
   main:
     allow-bean-definition-overriding: true
     allow-circular-references: true

+ 6 - 0
sckw-modules/sckw-transport/src/main/java/com/sckw/transport/dao/KwtLogisticsOrderMapper.java

@@ -270,6 +270,12 @@ public interface KwtLogisticsOrderMapper extends BaseMapper<KwtLogisticsOrder> {
 
     List<String> checkLogisticsOrderIsFinishByEntId(@Param("consignEntId") Long consignEntId, @Param("acceptCarriageEntId") Long acceptCarriageEntId, @Param("orderStatus") List<Integer> orderStatus);
 
+    Integer statisticsWaybillSendCar(@Param("ids")  List<Long> ids, @Param("orderList") List<Integer> orderList);
+
+    List<Long> statisticsLogistics(@Param("topEntId") Long topEntId);
+
+    Integer statisticsLogisticsByTopEntIdAndOrderStatus(@Param("topEntId") Long topEntId, @Param("orderList") List<Integer> orderList);
+
 //    List<TableTops> countAppLogisticsOrderListByStatus(@Param("type") String type,@Param("entId") Long entId
 //    );
 }

+ 1 - 2
sckw-modules/sckw-transport/src/main/java/com/sckw/transport/service/dubbo/TransportDubboServiceImpl.java

@@ -46,7 +46,6 @@ import org.apache.dubbo.config.annotation.DubboService;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.cloud.stream.function.StreamBridge;
-import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
 import java.math.BigDecimal;
@@ -59,7 +58,7 @@ import java.util.stream.Collectors;
  * @date 2023-07-11 14:07:28
  */
 @Slf4j
-@Service
+//@Service
 @DubboService(group = "design", version = "1.0.0", timeout = 50000)
 public class TransportDubboServiceImpl implements TransportDubboService {
 

+ 105 - 0
sckw-modules/sckw-transport/src/main/java/com/sckw/transport/service/dubbo/TransportStatisticsServiceImpl.java

@@ -0,0 +1,105 @@
+package com.sckw.transport.service.dubbo;
+
+import com.sckw.core.common.enums.NumberConstant;
+import com.sckw.core.exception.BusinessException;
+import com.sckw.core.model.enums.CarWaybillEnum;
+import com.sckw.core.model.enums.LogisticsOrderEnum;
+import com.sckw.transport.api.dubbo.TransportStatisticsService;
+import com.sckw.transport.dao.KwtLogisticsOrderMapper;
+import com.sckw.transport.dao.KwtWaybillOrderMapper;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.dubbo.config.annotation.DubboService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.util.CollectionUtils;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Objects;
+
+/**
+ * @author lfdc
+ * @description 运输服务统计dubbo Service
+ * @date 2023-09-08 11:09:34
+ */
+@Slf4j
+@DubboService(group = "design", version = "1.0.0")
+public class TransportStatisticsServiceImpl implements TransportStatisticsService {
+
+    @Autowired
+    KwtWaybillOrderMapper waybillOrderMapper;
+
+    @Autowired
+    KwtLogisticsOrderMapper logisticsOrderMapper;
+
+    /**
+     * 统计调度派车次数
+     *
+     * @param topEntId 集团企业id
+     * @return
+     */
+    @Override
+    public Integer statisticsWaybillSendCar(Long topEntId) {
+        Integer returnCount = 0;
+        if (Objects.isNull(topEntId)) {
+            throw new BusinessException("请求参数不能为空");
+        }
+        List<Long> ids = logisticsOrderMapper.statisticsLogistics(topEntId);
+        if (CollectionUtils.isEmpty(ids)) {
+            return returnCount;
+        }
+        List<Integer> orderList = new ArrayList<>(NumberConstant.TWELVE);
+        orderList.add(CarWaybillEnum.PENDING_ORDER.getCode());
+        orderList.add(CarWaybillEnum.PENDING_VEHICLE.getCode());
+        orderList.add(CarWaybillEnum.EXIT_COMPLETED.getCode());
+        orderList.add(CarWaybillEnum.WAIT_LOADING.getCode());
+        orderList.add(CarWaybillEnum.COMPLETION_LOADING.getCode());
+        orderList.add(CarWaybillEnum.WAIT_UNLOADING.getCode());
+        orderList.add(CarWaybillEnum.COMPLETION_UNLOADING.getCode());
+        orderList.add(CarWaybillEnum.APPROVAL_PASS.getCode());
+        orderList.add(CarWaybillEnum.APPROVAL_IN.getCode());
+        returnCount = logisticsOrderMapper.statisticsWaybillSendCar(ids, orderList);
+        return returnCount;
+    }
+
+    /**
+     * 统计待核运单
+     *
+     * @param topEntId 集团企业id
+     * @return
+     */
+    @Override
+    public Integer statisticsPendingVerificationWaybill(Long topEntId) {
+        Integer returnCount = 0;
+        if (Objects.isNull(topEntId)) {
+            throw new BusinessException("请求参数不能为空");
+        }
+        List<Long> ids = logisticsOrderMapper.statisticsLogistics(topEntId);
+        if (CollectionUtils.isEmpty(ids)) {
+            return returnCount;
+        }
+        List<Integer> orderList = new ArrayList<>(NumberConstant.TWELVE);
+        orderList.add(CarWaybillEnum.COMPLETION_UNLOADING.getCode());
+        orderList.add(CarWaybillEnum.APPROVAL_IN.getCode());
+        returnCount = logisticsOrderMapper.statisticsWaybillSendCar(ids, orderList);
+        return returnCount;
+    }
+
+    /**
+     * 统计承运接单数量
+     *
+     * @param topEntId 集团企业id
+     * @return
+     */
+    @Override
+    public Integer statisticsLogistics(Long topEntId) {
+        //统计维度
+        List<Integer> orderList = new ArrayList<>();
+        orderList.add(LogisticsOrderEnum.WAIT_DELIVERY.getCode());
+        orderList.add(LogisticsOrderEnum.IN_TRANSIT.getCode());
+        orderList.add(LogisticsOrderEnum.HAVE_FINISHED.getCode());
+        orderList.add(LogisticsOrderEnum.HAVE_RECONCILED.getCode());
+        orderList.add(LogisticsOrderEnum.HAVE_ALREADY_SETTLED.getCode());
+        Integer count = logisticsOrderMapper.statisticsLogisticsByTopEntIdAndOrderStatus(topEntId, orderList);
+        return count;
+    }
+}

+ 51 - 0
sckw-modules/sckw-transport/src/main/resources/mapper/KwtLogisticsOrderMapper.xml

@@ -1285,4 +1285,55 @@
         ORDER BY a.id DESC
         <!--               ,a.create_time-->
     </select>
+
+    <select id="statisticsWaybillSendCar" resultType="java.lang.Integer">
+        SELECT
+        COUNT(b.id)
+        FROM
+        kwt_waybill_order b
+        LEFT JOIN kwt_logistics_order a ON a.id = b.l_order_id
+        WHERE
+        a.del_flag = 0
+        AND b.del_flag = 0
+        <if test="ids != null and ids.size()>0">
+            and a.id in
+            <foreach collection="ids" open="(" close=")" separator="," item="item">
+                #{item}
+            </foreach>
+        </if>
+        <if test="orderList != null and orderList.size()>0">
+            and b.status in
+            <foreach collection="orderList" item="item" separator="," close=")" open="(">
+                #{item}
+            </foreach>
+        </if>
+    </select>
+
+    <select id="statisticsLogistics" resultType="java.lang.Long">
+        SELECT
+            DISTINCT a.id
+        FROM
+            kwt_logistics_order a
+                LEFT JOIN kwt_logistics_order_unit b ON b.l_order_id = a.id
+        WHERE
+            a.del_flag = 0
+          AND b.del_flag = 0
+          AND ( b.ent_id = #{topEntId} OR b.top_ent_id = #{topEntId} )
+    </select>
+
+    <select id="statisticsLogisticsByTopEntIdAndOrderStatus" resultType="java.lang.Integer">
+        SELECT
+            count(DISTINCT a.id)
+        FROM
+            kwt_logistics_order a
+                LEFT JOIN kwt_logistics_order_unit b ON b.l_order_id = a.id
+        WHERE
+            a.del_flag = 0
+          AND b.del_flag = 0
+          AND ( b.ent_id = #{topEntId} OR b.top_ent_id = #{topEntId} )
+        And a.status in
+            <foreach collection="orderList" open="(" close=")" separator="," item="item">
+                #{item}
+            </foreach>
+    </select>
 </mapper>