修复空值
parent
f568e7551a
commit
d69593a949
|
|
@ -1,5 +1,6 @@
|
|||
package com.njzscloud.supervisory.statistics.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
||||
import com.njzscloud.supervisory.statistics.pojo.*;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
|
@ -16,6 +17,8 @@ public interface ShouJuStatisticsMapper {
|
|||
|
||||
List<GarbageDisposeSummary> getCurrentMonthGarbageDisposeSummary();
|
||||
|
||||
List<String> getGoodsNames(@Param("ew") Wrapper<Object> ew, @Param("count") int count);
|
||||
|
||||
List<OrderSummary> getOrderSummary();
|
||||
|
||||
TodayOrderSummary getTodayOrderSummary();
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ import cn.hutool.core.date.DateTime;
|
|||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.date.Week;
|
||||
import cn.hutool.core.map.MapUtil;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.njzscloud.common.core.tuple.Tuple2;
|
||||
import com.njzscloud.common.core.tuple.Tuple3;
|
||||
import com.njzscloud.common.core.utils.GroupUtil;
|
||||
|
|
@ -69,6 +70,17 @@ public class ShouJuStatisticsService implements StatisticsService {
|
|||
|
||||
CompletableFuture<List<GarbageDisposeSummary>> currentMonthGarbageDisposeSummary = CompletableFuture.supplyAsync(statisticsMapper::getCurrentMonthGarbageDisposeSummary)
|
||||
.thenApply(list -> {
|
||||
if (list.size() < 6) {
|
||||
List<String> goodsNames = statisticsMapper.getGoodsNames(Wrappers.query().eq("depot_type", 2)
|
||||
.notLike("name", "青石")
|
||||
.notLike("name", "矿石")
|
||||
, 6 - list.size());
|
||||
for (String goodsName : goodsNames) {
|
||||
list.add(new GarbageDisposeSummary()
|
||||
.setGarbageName(goodsName)
|
||||
.setWeight(0D));
|
||||
}
|
||||
}
|
||||
Double currentMonthGarbageDisposeSummary_totalWeight = list.stream()
|
||||
.map(GarbageDisposeSummary::getWeight)
|
||||
.reduce(Double::sum).orElse(0D);
|
||||
|
|
|
|||
|
|
@ -15,6 +15,8 @@
|
|||
WHERE a.station_id = 1
|
||||
AND a.status IN (0, 1, 2, 3)
|
||||
AND a.type != 4
|
||||
AND b.name NOT LIKE '%青石%'
|
||||
AND b.name NOT LIKE '%矿石%'
|
||||
ORDER BY a.create_time DESC
|
||||
LIMIT 5) t1
|
||||
UNION ALL
|
||||
|
|
@ -27,6 +29,8 @@
|
|||
INNER JOIN ba_goods b ON b.id = a.goods_id AND b.id NOT IN (287, 286, 279, 278, 293, 273, 271, 270, 262, 2)
|
||||
WHERE a.station_id = 2
|
||||
AND a.type != 4
|
||||
AND b.name NOT LIKE '%青石%'
|
||||
AND b.name NOT LIKE '%矿石%'
|
||||
AND a.status IN (0, 1, 2, 3)
|
||||
ORDER BY a.create_time DESC
|
||||
LIMIT 5) t2) a
|
||||
|
|
@ -45,7 +49,7 @@
|
|||
resultType="com.njzscloud.supervisory.statistics.pojo.GarbageDisposeSummary">
|
||||
SELECT garbage_name, weight, 1 depot_type, '入库' depot_name
|
||||
FROM (SELECT garbage_name, weight
|
||||
FROM (SELECT b.name garbage_name, SUM(a.weight) weight
|
||||
FROM (SELECT b.name garbage_name, IFNULL(SUM(a.weight), 0) weight
|
||||
FROM ba_order a
|
||||
INNER JOIN ba_goods b ON b.id = a.goods_id AND b.depot_type = 1 AND b.id NOT IN (287, 286, 279, 278, 293, 273, 271, 270, 262, 2)
|
||||
INNER JOIN ba_goods_category c ON c.id = b.category_id
|
||||
|
|
@ -60,7 +64,7 @@
|
|||
UNION ALL
|
||||
SELECT garbage_name, weight, 2 depot_type, '出库' depot_name
|
||||
FROM (SELECT garbage_name, weight
|
||||
FROM (SELECT b.name garbage_name, SUM(a.weight) weight
|
||||
FROM (SELECT b.name garbage_name, IFNULL(SUM(a.weight), 0) weight
|
||||
FROM ba_order a
|
||||
INNER JOIN ba_goods b ON b.id = a.goods_id AND b.depot_type = 2 AND b.id NOT IN (287, 286, 279, 278, 293, 273, 271, 270, 262, 2)
|
||||
INNER JOIN ba_goods_category c ON c.id = b.category_id
|
||||
|
|
@ -76,11 +80,13 @@
|
|||
<select id="getCurrentMonthGarbageDisposeSummary"
|
||||
resultType="com.njzscloud.supervisory.statistics.pojo.GarbageDisposeSummary">
|
||||
SELECT goods_name garbage_name, weight
|
||||
FROM (SELECT a.goods_name, SUM(a.weight) weight
|
||||
FROM (SELECT a.goods_name, IFNULL(SUM(a.weight), 0) weight
|
||||
FROM ba_order a
|
||||
INNER JOIN ba_goods b ON b.id = a.goods_id AND b.depot_type = 2 AND b.id NOT IN (287, 286, 279, 278, 293, 273, 271, 270, 262, 2)
|
||||
WHERE a.out_time >= UNIX_TIMESTAMP(DATE_FORMAT(CURDATE(), '%Y-%m-01 00:00:00'))
|
||||
AND a.type != 4
|
||||
AND b.name NOT LIKE '%青石%'
|
||||
AND b.name NOT LIKE '%矿石%'
|
||||
AND a.out_time <![CDATA[ < ]]> UNIX_TIMESTAMP(DATE_ADD(DATE_FORMAT(CURDATE(), '%Y-%m-01'), INTERVAL 1 MONTH))
|
||||
GROUP BY a.goods_name) t
|
||||
ORDER BY weight DESC
|
||||
|
|
@ -97,6 +103,8 @@
|
|||
INNER JOIN ba_goods c ON c.id = a.goods_id AND c.id NOT IN (287, 286, 279, 278, 293, 273, 271, 270, 262, 2)
|
||||
WHERE a.status IN (0, 1, 2, 3)
|
||||
AND a.type != 4
|
||||
AND c.name NOT LIKE '%青石%'
|
||||
AND c.name NOT LIKE '%矿石%'
|
||||
GROUP BY b.id, IF(a.status = 1, 1, 0)) t1
|
||||
INNER JOIN ba_user t2 ON t2.id = t1.id
|
||||
ORDER BY c DESC
|
||||
|
|
@ -112,6 +120,8 @@
|
|||
INNER JOIN ba_goods c ON c.id = a.goods_id AND c.id NOT IN (287, 286, 279, 278, 293, 273, 271, 270, 262, 2)
|
||||
WHERE a.status IN (0, 1, 2, 3)
|
||||
AND a.type != 4
|
||||
AND c.name NOT LIKE '%青石%'
|
||||
AND c.name NOT LIKE '%矿石%'
|
||||
GROUP BY b.id, IF(a.status = 1, 1, 0)) t1
|
||||
INNER JOIN ba_user t2 ON t2.id = t1.id
|
||||
ORDER BY c DESC)tt2
|
||||
|
|
@ -127,15 +137,19 @@
|
|||
INNER JOIN ba_goods b ON b.id = a.goods_id AND b.id NOT IN (287, 286, 279, 278, 293, 273, 271, 270, 262, 2)
|
||||
WHERE a.vip_user = #{userId}
|
||||
AND a.type != 4
|
||||
AND b.name NOT LIKE '%青石%'
|
||||
AND b.name NOT LIKE '%矿石%'
|
||||
ORDER BY a.create_time DESC
|
||||
LIMIT 10
|
||||
</select>
|
||||
<select id="disposeWeight" resultType="java.lang.Double">
|
||||
SELECT SUM(a.weight) weight
|
||||
SELECT IFNULL(SUM(a.weight), 0) weight
|
||||
FROM ba_order a
|
||||
INNER JOIN ba_goods b ON b.id = a.goods_id AND b.depot_type = 1 AND b.id NOT IN (287, 286, 279, 278, 293, 273, 271, 270, 262, 2)
|
||||
WHERE a.out_time >= #{startTime}
|
||||
AND a.out_time <![CDATA[ <= ]]> #{endTime}
|
||||
AND b.name NOT LIKE '%青石%'
|
||||
AND b.name NOT LIKE '%矿石%'
|
||||
AND a.type != 4
|
||||
</select>
|
||||
<select id="getTodayOrderSummary" resultType="com.njzscloud.supervisory.statistics.pojo.TodayOrderSummary">
|
||||
|
|
@ -149,6 +163,8 @@
|
|||
INNER JOIN ba_goods b ON b.id = a.goods_id AND b.id NOT IN (287, 286, 279, 278, 293, 273, 271, 270, 262, 2)
|
||||
WHERE a.create_time >= UNIX_TIMESTAMP(CURDATE())
|
||||
AND a.type != 4
|
||||
AND b.name NOT LIKE '%青石%'
|
||||
AND b.name NOT LIKE '%矿石%'
|
||||
AND a.create_time <![CDATA[ < ]]> UNIX_TIMESTAMP(DATE_ADD(CURDATE(), INTERVAL 24 HOUR))) t
|
||||
GROUP BY order_status) tt
|
||||
</select>
|
||||
|
|
@ -161,5 +177,16 @@
|
|||
AND a.out_time >= #{startTime}
|
||||
AND a.out_time <![CDATA[ <= ]]> #{endTime}
|
||||
AND a.type != 4
|
||||
AND b.name NOT LIKE '%青石%'
|
||||
AND b.name NOT LIKE '%矿石%'
|
||||
</select>
|
||||
|
||||
<select id="getGoodsNames" resultType="java.lang.String">
|
||||
SELECT name
|
||||
FROM ba_goods
|
||||
<if test="ew.customSqlSegment != null and ew.customSqlSegment != ''">
|
||||
${ew.customSqlSegment}
|
||||
</if>
|
||||
LIMIT #{count}
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
|
|||
|
|
@ -75,7 +75,7 @@
|
|||
|
||||
<select id="getRegionSummary" resultType="com.njzscloud.supervisory.statistics.pojo.RegionSummary">
|
||||
SELECT a.address,
|
||||
SUM(a.weight) total_weight
|
||||
IFNULL(SUM(a.weight), 0) total_weight
|
||||
FROM ba_order a
|
||||
INNER JOIN ba_order_dispatch b ON b.order_no = a.order_no
|
||||
WHERE a.status = 1
|
||||
|
|
@ -84,7 +84,7 @@
|
|||
|
||||
<select id="getCompanySummary" resultType="com.njzscloud.supervisory.statistics.pojo.CompanySummary">
|
||||
SELECT t1.total_weight, t2.company
|
||||
FROM (SELECT SUM(a.weight) total_weight, b.transport_uid
|
||||
FROM (SELECT IFNULL(SUM(a.weight), 0) total_weight, b.transport_uid
|
||||
FROM ba_order a
|
||||
INNER JOIN ba_order_dispatch b ON b.order_no = a.order_no
|
||||
WHERE a.status = 1
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@
|
|||
resultType="com.njzscloud.supervisory.statistics.pojo.GarbageDisposeSummary">
|
||||
SELECT garbage_name, weight, icon, 1 depot_type, '入库' depot_name
|
||||
FROM (SELECT d.name garbage_name, t.weight, d.icon
|
||||
FROM (SELECT b.id, SUM(a.weight) weight
|
||||
FROM (SELECT b.id, IFNULL(SUM(a.weight), 0) weight
|
||||
FROM ba_order a
|
||||
INNER JOIN ba_goods b ON b.id = a.goods_id AND b.depot_type = 1
|
||||
INNER JOIN ba_goods_category c ON c.id = b.category_id
|
||||
|
|
@ -40,7 +40,7 @@
|
|||
UNION ALL
|
||||
SELECT garbage_name, weight, icon, 2 depot_type, '出库' depot_name
|
||||
FROM (SELECT d.name garbage_name, t.weight, d.icon
|
||||
FROM (SELECT b.id, SUM(a.weight) weight
|
||||
FROM (SELECT b.id, IFNULL(SUM(a.weight), 0) weight
|
||||
FROM ba_order a
|
||||
INNER JOIN ba_goods b ON b.id = a.goods_id AND b.depot_type = 2
|
||||
INNER JOIN ba_goods_category c ON c.id = b.category_id
|
||||
|
|
@ -53,7 +53,7 @@
|
|||
<select id="getCurrentMonthGarbageDisposeSummary"
|
||||
resultType="com.njzscloud.supervisory.statistics.pojo.GarbageDisposeSummary">
|
||||
SELECT goods_name garbage_name, weight
|
||||
FROM (SELECT a.goods_name, SUM(a.weight) weight
|
||||
FROM (SELECT a.goods_name, IFNULL(SUM(a.weight), 0) weight
|
||||
FROM ba_order a
|
||||
INNER JOIN ba_goods b ON b.id = a.goods_id AND b.depot_type = 2
|
||||
WHERE a.out_time >= UNIX_TIMESTAMP(DATE_FORMAT(CURDATE(), '%Y-%m-01 00:00:00'))
|
||||
|
|
@ -91,7 +91,7 @@
|
|||
LIMIT 10
|
||||
</select>
|
||||
<select id="disposeWeight" resultType="java.lang.Double">
|
||||
SELECT SUM(a.weight) weight
|
||||
SELECT IFNULL(SUM(a.weight), 0) weight
|
||||
FROM ba_order a
|
||||
INNER JOIN ba_goods b ON b.id = a.goods_id AND b.depot_type = 1
|
||||
WHERE a.out_time >= #{startTime}
|
||||
|
|
|
|||
Loading…
Reference in New Issue