Ver Fonte

app运力看板统计数量bug

czh há 1 ano atrás
pai
commit
92192ff92c

+ 2 - 1
sckw-modules/sckw-transport/src/main/java/com/sckw/transport/dao/KwtWaybillOrderSubtaskMapper.java

@@ -3,6 +3,7 @@ package com.sckw.transport.dao;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.sckw.transport.model.KwtWaybillOrderSubtask;
 import com.sckw.transport.model.dto.WaybillListAppDTO;
+import com.sckw.transport.model.dto.WaybillOrderQueryDto;
 import com.sckw.transport.model.dto.WaybillSubtaskOrderQueryDto;
 import com.sckw.transport.model.param.DriverParam;
 import com.sckw.transport.model.vo.DriverListVo;
@@ -30,5 +31,5 @@ public interface KwtWaybillOrderSubtaskMapper extends BaseMapper<KwtWaybillOrder
 
     List<DriverListVo> selectLoopOrderAndDriverListByOrderId(@Param("driverParam") DriverParam driverParam, @Param("type") Integer type, @Param("orderStatus") List<Integer> orderStatus);
 
-    Map<String, Object> findWaybillOrderCount(WaybillListAppDTO params);
+    Map<String, Object> findWaybillOrderCount(WaybillOrderQueryDto params);
 }

+ 8 - 1
sckw-modules/sckw-transport/src/main/java/com/sckw/transport/service/KwtWaybillManagementV1Service.java

@@ -95,7 +95,14 @@ public class KwtWaybillManagementV1Service {
      * @date 2024/4/3
      **/
     public HttpResult logisticOrderWaybillStatistic(WaybillListAppDTO query) {
-        Map<String, Object> statistic = waybillOrderSubtaskMapper.findWaybillOrderCount(query);
+        // 运单创建人或有关授权用户
+        List<Long> userIds = LoginUserHolder.getAuthUserIdList();
+        WaybillOrderQueryDto queryDto = new WaybillOrderQueryDto();
+        query.setStatus(null);
+        BeanUtil.copyProperties(query, queryDto);
+        queryDto.setEntId(LoginUserHolder.getEntId());
+        queryDto.setUserIds(userIds);
+        Map<String, Object> statistic = waybillOrderSubtaskMapper.findWaybillOrderCount(queryDto);
         return HttpResult.ok(statistic);
     }
 

+ 3 - 3
sckw-modules/sckw-transport/src/main/java/com/sckw/transport/service/KwtWaybillOrderV1Service.java

@@ -548,11 +548,11 @@ public class KwtWaybillOrderV1Service {
             //派单量
             String entrustAmount = subtask.getEntrustAmount() + unitMap.get(subtask.getUnit());
             //实装量
-            String loadAmount = subtask.getLoadAmount() != null ? subtask.getLoadAmount() + unitMap.get(subtask.getUnit()) : null;
+            String loadAmount = subtask.getLoadAmount() != null ? subtask.getLoadAmount() + unitMap.get(subtask.getUnit()) : Global.NUMERICAL_ZERO + unitMap.get(subtask.getUnit());
             //实卸量
-            String unloadAmount = subtask.getUnloadAmount() != null ? subtask.getUnloadAmount() + unitMap.get(subtask.getUnit()) : null;
+            String unloadAmount = subtask.getUnloadAmount() != null ? subtask.getUnloadAmount() + unitMap.get(subtask.getUnit()) : Global.NUMERICAL_ZERO + unitMap.get(subtask.getUnit());
             //实卸量
-            String deficitAmount = subtask.getDeficitAmount() != null ? subtask.getDeficitAmount() + unitMap.get(subtask.getUnit()) : null;
+            String deficitAmount = subtask.getDeficitAmount() != null ? subtask.getDeficitAmount() + unitMap.get(subtask.getUnit()) : Global.NUMERICAL_ZERO + unitMap.get(subtask.getUnit());
             //亏吨重量
             String deficitRealAmount = deficitPrice(BigDecimal.valueOf(NumberUtils.parseDouble(subtask.getLoadAmount())),
                     BigDecimal.valueOf(NumberUtils.parseDouble(subtask.getDeficitAmount())), logisticsOrder.getLoss(),

+ 71 - 9
sckw-modules/sckw-transport/src/main/resources/mapper/KwtWaybillOrderSubtaskMapper.xml

@@ -142,15 +142,77 @@
     <select id="findWaybillOrderCount" parameterType="com.sckw.transport.model.dto.WaybillListAppDTO" resultType="java.util.Map">
         SELECT
         count(1) total,
-        count(case when wos.status in (101, 201, 203, 301, 302, 401, 402, 501, 503, 504) then 1 end) proceed,
-        count(case when wos.status = 502 then 1 end) finish,
-        count(case when wos.status in (102, 103, 202) then 1 end) cancel,
-        count(case when wos.status in (101, 201, 203, 301, 302, 401, 402, 501, 503, 504) then 1 end) ndexProceed,
-        count(case when wos.status in (102, 103, 202, 502) then 1 end) ndexFinish
-        from kwt_waybill_order_subtask wos
-        where wos.del_flag = 0
-        <if test="lOrderId != null and lOrderId != ''">
-            and wos.l_order_id = #{lOrderId, jdbcType=BIGINT}
+        count(case when wo.status in (101, 201, 203, 301, 302, 401, 402, 501, 503, 504) then 1 end) proceed,
+        count(case when wo.status = 502 then 1 end) finish,
+        count(case when wo.status in (102, 103, 202) then 1 end) cancel,
+        count(case when wo.status in (101, 201, 203, 301, 302, 401, 402, 501, 503, 504) then 1 end) ndexProceed,
+        count(case when wo.status in (102, 103, 202, 502) then 1 end) ndexFinish
+        from kwt_waybill_order wo
+        where wo.del_flag = 0
+        <if test="entId != null and entId != ''">
+            and wo.ent_id = #{entId, jdbcType=VARCHAR}
+        </if>
+        <if test="userIds != null and userIds.size() > 0">
+            and wo.create_by IN
+            <foreach collection="userIds" open="(" close=")" item="item" separator=",">
+                #{item}
+            </foreach>
+        </if>
+        <if test="entIds != null and entIds.size() > 0">
+            and wo.ent_id IN
+            <foreach collection="entIds" open="(" close=")" item="item" separator=",">
+                #{item}
+            </foreach>
+        </if>
+        <if test="queryWstatus != null and queryWstatus != ''">
+            AND wo.status in
+            <foreach collection="queryWstatus.split(',')" item="item" open="(" close=")" separator=",">
+                #{item}
+            </foreach>
+        </if>
+        <if test="(loadCityCode != null and loadCityCode != '') or (unloadCityCode != null and unloadCityCode != '')">
+            and wo.id in (
+            SELECT DISTINCT w_order_id from kwt_waybill_order_address where del_flag = 0
+            <if test="loadCityCode != null and loadCityCode != ''">
+                and address_type = 1
+                and left(city_code, #{loadCityCodeLevel, jdbcType=INTEGER}) = left( #{loadCityCode, jdbcType=INTEGER}, #{loadCityCodeLevel, jdbcType=INTEGER} )
+            </if>
+            <if test="unloadCityCode != null and unloadCityCode != ''">
+                and address_type = 2
+                and left(city_code, #{unloadCityCodeLevel, jdbcType=INTEGER}) = left( #{unloadCityCode, jdbcType=INTEGER}, #{unloadCityCodeLevel, jdbcType=INTEGER} )
+            </if>
+            )
+        </if>
+        <if test="(startLoadTime != null and startLoadTime != '') or (endLoadTime != null and endLoadTime != '')
+               or (startUnloadTime != null and startUnloadTime != '') or (endUnloadTime != null and endUnloadTime != '')">
+            and wo.id in (
+            SELECT DISTINCT w_order_id from kwt_waybill_order_subtask where del_flag = 0
+            <if test="startLoadTime != null and startLoadTime != ''">
+                and DATE(load_time) <![CDATA[ >= ]]> #{startLoadTime,jdbcType=TIMESTAMP}
+            </if>
+            <if test="endLoadTime != null and endLoadTime != ''">
+                and DATE(load_time) <![CDATA[ >= ]]> #{startLoadTime,jdbcType=TIMESTAMP}
+            </if>
+            <if test="startUnloadTime != null and startUnloadTime != ''">
+                and DATE(load_time) <![CDATA[ >= ]]> #{startLoadTime,jdbcType=TIMESTAMP}
+            </if>
+            <if test="endUnloadTime != null and endUnloadTime != ''">
+                and DATE(load_time) <![CDATA[ >= ]]> #{startLoadTime,jdbcType=TIMESTAMP}
+            </if>
+            )
+        </if>
+        <if test="startSendCarTime != null and startSendCarTime != '' " >
+            and DATE( wo.create_time) <![CDATA[ >= ]]> #{startSendCarTime,jdbcType=TIMESTAMP}
+        </if>
+        <if test="endSendCarTime != null and endSendCarTime != '' " >
+            and DATE( wo.create_time ) <![CDATA[ <= ]]> #{endSendCarTime,jdbcType=TIMESTAMP}
+        </if>
+        <if test="keywords != null and keywords != ''">
+            and (
+            wo.w_order_no like concat('%',#{keywords},'%')
+            or wo.truck_no like concat('%',#{keywords},'%')
+            or wo.driver_name like concat('%',#{keywords},'%')
+            )
         </if>
     </select>
 </mapper>