master
parent
0f6db1bc67
commit
c6ea9ed4ee
|
|
@ -65,6 +65,12 @@ public interface SupervisionStatisticsMapper {
|
||||||
@SuppressWarnings("MybatisXMapperMethodInspection")
|
@SuppressWarnings("MybatisXMapperMethodInspection")
|
||||||
List<Map<String, Object>> dataTable();
|
List<Map<String, Object>> dataTable();
|
||||||
|
|
||||||
|
@SuppressWarnings("MybatisXMapperMethodInspection")
|
||||||
|
Map<String, Object> todayAuditPassStatistics();
|
||||||
|
|
||||||
|
@SuppressWarnings("MybatisXMapperMethodInspection")
|
||||||
|
List<Map<String, Object>> stationStatistics();
|
||||||
|
|
||||||
Integer getTotalCarCount();
|
Integer getTotalCarCount();
|
||||||
|
|
||||||
@SuppressWarnings("MybatisXMapperMethodInspection")
|
@SuppressWarnings("MybatisXMapperMethodInspection")
|
||||||
|
|
|
||||||
|
|
@ -254,6 +254,16 @@ public class SupervisionStatisticsService {
|
||||||
log.error("数据获取失败", ex);
|
log.error("数据获取失败", ex);
|
||||||
return Collections.emptyList();
|
return Collections.emptyList();
|
||||||
});
|
});
|
||||||
|
CompletableFuture<Map<String, Object>> todayAuditPassStatisticsFuture = CompletableFuture.supplyAsync(supervisionStatisticsMapper::todayAuditPassStatistics, threadPoolExecutor)
|
||||||
|
.exceptionally(ex -> {
|
||||||
|
log.error("数据获取失败", ex);
|
||||||
|
return Collections.emptyMap();
|
||||||
|
});
|
||||||
|
CompletableFuture<List<Map<String, Object>>> stationStatisticsFuture = CompletableFuture.supplyAsync(supervisionStatisticsMapper::stationStatistics, threadPoolExecutor)
|
||||||
|
.exceptionally(ex -> {
|
||||||
|
log.error("数据获取失败", ex);
|
||||||
|
return Collections.emptyList();
|
||||||
|
});
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Map<String, Object> dataStatistics = dataStatisticsFuture.get();
|
Map<String, Object> dataStatistics = dataStatisticsFuture.get();
|
||||||
|
|
@ -268,6 +278,8 @@ public class SupervisionStatisticsService {
|
||||||
Map<String, Object> transStatistics = transStatisticsFuture.get();
|
Map<String, Object> transStatistics = transStatisticsFuture.get();
|
||||||
Map<String, Object> weightStatistics = weightStatisticsFuture.get();
|
Map<String, Object> weightStatistics = weightStatisticsFuture.get();
|
||||||
List<Map<String, Object>> dataTable = dataTableFuture.get();
|
List<Map<String, Object>> dataTable = dataTableFuture.get();
|
||||||
|
Map<String, Object> todayAuditPassStatistics = todayAuditPassStatisticsFuture.get();
|
||||||
|
List<Map<String, Object>> stationStatistics = stationStatisticsFuture.get();
|
||||||
return MapUtil.<String, Object>builder()
|
return MapUtil.<String, Object>builder()
|
||||||
.put("dataStatistics", dataStatistics)
|
.put("dataStatistics", dataStatistics)
|
||||||
.put("warnTruck", warnTruck)
|
.put("warnTruck", warnTruck)
|
||||||
|
|
@ -281,6 +293,8 @@ public class SupervisionStatisticsService {
|
||||||
.put("userStatistics", userStatistics)
|
.put("userStatistics", userStatistics)
|
||||||
.put("weightStatistics", weightStatistics)
|
.put("weightStatistics", weightStatistics)
|
||||||
.put("dataTable", dataTable)
|
.put("dataTable", dataTable)
|
||||||
|
.put("todayAuditPassStatistics", todayAuditPassStatistics)
|
||||||
|
.put("stationStatistics", stationStatistics)
|
||||||
.build();
|
.build();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw Exceptions.exception(e, "数据获取失败");
|
throw Exceptions.exception(e, "数据获取失败");
|
||||||
|
|
|
||||||
|
|
@ -469,4 +469,85 @@
|
||||||
WHERE a.biz_obj IN ('WuYe', 'ShiGongDanWei', 'ChaiQian', 'SheQu')
|
WHERE a.biz_obj IN ('WuYe', 'ShiGongDanWei', 'ChaiQian', 'SheQu')
|
||||||
AND a.deleted = 0
|
AND a.deleted = 0
|
||||||
</select>
|
</select>
|
||||||
|
<select id="todayAuditPassStatistics" resultType="java.util.Map">
|
||||||
|
SELECT MAX(IF(t_ = 1, c_, 0)) todayCfPassCount,
|
||||||
|
MAX(IF(t_ = 2, c_, 0)) todayTransPassCount,
|
||||||
|
MAX(IF(t_ = 3, c_, 0)) todayDriverPassCount,
|
||||||
|
MAX(IF(t_ = 4, c_, 0)) todayTruckPassCount
|
||||||
|
FROM (SELECT COUNT(*) c_, 1 t_
|
||||||
|
FROM biz_company bc
|
||||||
|
LEFT JOIN sys_user su ON su.id = bc.user_id
|
||||||
|
WHERE bc.deleted = 0
|
||||||
|
AND bc.audit_status = 'TongGuo'
|
||||||
|
AND su.biz_obj IN ('GeRen', 'WuYe', 'ShiGongDanWei', 'ChaiQian', 'SheQu')
|
||||||
|
AND bc.create_time >= CURDATE()
|
||||||
|
AND bc.create_time < DATE_ADD(CURDATE(), INTERVAL 1 DAY)
|
||||||
|
UNION ALL
|
||||||
|
SELECT COUNT(*) c_, 2 t_
|
||||||
|
FROM biz_company bc
|
||||||
|
LEFT JOIN sys_user su ON su.id = bc.user_id
|
||||||
|
WHERE bc.deleted = 0
|
||||||
|
AND bc.audit_status = 'TongGuo'
|
||||||
|
AND su.biz_obj IN ('QiYe', 'GeTi')
|
||||||
|
AND bc.create_time >= CURDATE()
|
||||||
|
AND bc.create_time < DATE_ADD(CURDATE(), INTERVAL 1 DAY)
|
||||||
|
UNION ALL
|
||||||
|
SELECT COUNT(*) c_, 3 t_
|
||||||
|
FROM biz_driver bd
|
||||||
|
WHERE bd.deleted = 0
|
||||||
|
AND bd.audit_status = 'TongGuo'
|
||||||
|
AND bd.create_time >= CURDATE()
|
||||||
|
AND bd.create_time < DATE_ADD(CURDATE(), INTERVAL 1 DAY)
|
||||||
|
UNION ALL
|
||||||
|
SELECT COUNT(*) c_, 4 t_
|
||||||
|
FROM biz_truck bt
|
||||||
|
WHERE bt.deleted = 0
|
||||||
|
AND bt.audit_status = 'TongGuo'
|
||||||
|
AND bt.create_time >= CURDATE()
|
||||||
|
AND bt.create_time < DATE_ADD(CURDATE(), INTERVAL 1 DAY)) t
|
||||||
|
</select>
|
||||||
|
<select id="stationStatistics" resultType="java.util.Map">
|
||||||
|
SELECT bc.id stationId,
|
||||||
|
IFNULL(bc.station_name, bc.company_name) stationName,
|
||||||
|
IFNULL(t1.todayCarCount, 0) todayCarCount,
|
||||||
|
IFNULL(t2.monthCarCount, 0) monthCarCount,
|
||||||
|
IFNULL(t1.todayWeight, 0) todayWeight,
|
||||||
|
IFNULL(t2.monthWeight, 0) monthWeight,
|
||||||
|
IFNULL(t1.todayMonthIncome, 0) todayMonthIncome,
|
||||||
|
IFNULL( t1.todayBalanceIncome, 0) todayBalanceIncome,
|
||||||
|
IFNULL(t1.todayCashIncome, 0) todayCashIncome
|
||||||
|
FROM biz_company bc
|
||||||
|
LEFT JOIN (SELECT station_id,
|
||||||
|
COUNT(*) todayCarCount,
|
||||||
|
ROUND(IFNULL(SUM(oci.settle_weight) / 1000, 0), 2) todayWeight,
|
||||||
|
IFNULL(SUM(CASE
|
||||||
|
WHEN settlement_way = 'month' THEN IFNULL(oi.settle_money, 0)
|
||||||
|
ELSE 0 END), 0) todayMonthIncome,
|
||||||
|
IFNULL( SUM( CASE WHEN settlement_way = 'balance' THEN IFNULL( oi.settle_money, 0)
|
||||||
|
ELSE 0 END), 0) todayBalanceIncome,
|
||||||
|
IFNULL(SUM(CASE
|
||||||
|
WHEN settlement_way = 'cash' THEN IFNULL(oi.settle_money, 0)
|
||||||
|
ELSE 0 END), 0) todayCashIncome
|
||||||
|
FROM order_info oi
|
||||||
|
INNER JOIN order_car_in_out oci ON oci.id = oi.car_in_out_id
|
||||||
|
WHERE oi.deleted = 0
|
||||||
|
AND oi.order_status = 'YiWanCheng'
|
||||||
|
AND oi.station_id IS NOT NULL
|
||||||
|
AND oci.out_time >= CURDATE()
|
||||||
|
AND oci.out_time < DATE_ADD(CURDATE(), INTERVAL 1 DAY)
|
||||||
|
GROUP BY station_id) t1 ON t1.station_id = bc.id
|
||||||
|
LEFT JOIN (SELECT station_id,
|
||||||
|
COUNT(*) monthCarCount,
|
||||||
|
ROUND(IFNULL(SUM(oci.settle_weight) / 1000, 0), 2) monthWeight
|
||||||
|
FROM order_info oi
|
||||||
|
INNER JOIN order_car_in_out oci ON oci.id = oi.car_in_out_id
|
||||||
|
WHERE oi.deleted = 0
|
||||||
|
AND oi.order_status = 'YiWanCheng'
|
||||||
|
AND oi.station_id IS NOT NULL
|
||||||
|
AND oci.out_time >= DATE_FORMAT(NOW(), '%Y-%m-01 00:00:00')
|
||||||
|
AND oci.out_time < DATE_ADD(DATE_FORMAT(NOW(), '%Y-%m-01'), INTERVAL 1 MONTH)
|
||||||
|
GROUP BY station_id) t2 ON t2.station_id = bc.id
|
||||||
|
WHERE bc.station = 1
|
||||||
|
AND bc.deleted = 0
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue