|
@@ -0,0 +1,1292 @@
|
|
|
|
+package com.nokia.finance.tasks.dao.car;
|
|
|
|
+
|
|
|
|
+import com.nokia.finance.tasks.pojo.po.car_report.CarBglryQsPo;
|
|
|
|
+import com.nokia.finance.tasks.pojo.po.car_report.CarBglryUnitPo;
|
|
|
|
+import com.nokia.finance.tasks.pojo.po.car_report.CarBszsbPo;
|
|
|
|
+import com.nokia.finance.tasks.pojo.po.car_report.CarClgkPo;
|
|
|
|
+import com.nokia.finance.tasks.pojo.po.car_report.CarCqclqkPo;
|
|
|
|
+import com.nokia.finance.tasks.pojo.po.car_report.CarDxPo;
|
|
|
|
+import com.nokia.finance.tasks.pojo.po.car_report.CarDxUnitPo;
|
|
|
|
+import com.nokia.finance.tasks.pojo.po.car_report.CarJygxPo;
|
|
|
|
+import com.nokia.finance.tasks.pojo.po.car_report.CarJygxUnitPo;
|
|
|
|
+import com.nokia.finance.tasks.pojo.po.car_report.CarNoticesPo;
|
|
|
|
+import com.nokia.finance.tasks.pojo.po.car_report.CarReportsPo;
|
|
|
|
+import com.nokia.finance.tasks.pojo.po.car_report.CarRyycPo;
|
|
|
|
+import com.nokia.finance.tasks.pojo.po.car_report.CarRyycUnitPo;
|
|
|
|
+import com.nokia.finance.tasks.pojo.po.car_report.CarSnfyPo;
|
|
|
|
+import com.nokia.finance.tasks.pojo.po.car_report.CarWgPo;
|
|
|
|
+import com.nokia.finance.tasks.pojo.po.car_report.CarWxQsPo;
|
|
|
|
+import com.nokia.finance.tasks.pojo.po.car_report.CarWxUnitPo;
|
|
|
|
+import com.nokia.finance.tasks.pojo.po.car_report.CarWzPo;
|
|
|
|
+import com.nokia.finance.tasks.pojo.po.car_report.CarWzUnitPo;
|
|
|
|
+import com.nokia.finance.tasks.pojo.po.car_report.CarZlwxycPo;
|
|
|
|
+import com.nokia.finance.tasks.pojo.po.car_report.CarZywxycPo;
|
|
|
|
+import com.nokia.finance.tasks.pojo.po.car_report.CarZywxycUnitPo;
|
|
|
|
+import com.nokia.finance.tasks.pojo.vo.car_report.CarWgUnitVo;
|
|
|
|
+import org.apache.ibatis.annotations.Mapper;
|
|
|
|
+import org.apache.ibatis.annotations.Param;
|
|
|
|
+import org.apache.ibatis.annotations.Select;
|
|
|
|
+import org.apache.ibatis.annotations.Update;
|
|
|
|
+
|
|
|
|
+import java.util.List;
|
|
|
|
+
|
|
|
|
+@Mapper
|
|
|
|
+public interface CarReportDao {
|
|
|
|
+ /**
|
|
|
|
+ * 查询车辆概况
|
|
|
|
+ * @param endYearMonth 账期
|
|
|
|
+ */
|
|
|
|
+ @Select("""
|
|
|
|
+select
|
|
|
|
+ count(che_liang_lai_yuan = '自有车辆' or null) as zi_you_count,
|
|
|
|
+ count(che_liang_lai_yuan = '租赁车辆' or null) as zu_lin_count,
|
|
|
|
+ count(che_liang_shi_yong_xing_zhi = '一般公务用车' or null) as gong_wu_count,
|
|
|
|
+ count(1) - count(che_liang_shi_yong_xing_zhi = '一般公务用车' or null) as sheng_chan_count,
|
|
|
|
+ count(che_liang_lei_xing = '皮卡车' or null) as pi_ka_count,
|
|
|
|
+ count(che_liang_lei_xing = '微型面包车' or null) as wei_xing_mian_bao_count,
|
|
|
|
+ count(che_liang_lei_xing = '越野车' or null) as yue_ye_count,
|
|
|
|
+ count(che_liang_lei_xing = '轿车' or null) as jiao_che_count,
|
|
|
|
+ count(1) as total
|
|
|
|
+from
|
|
|
|
+ car.car_base_data_month
|
|
|
|
+where
|
|
|
|
+ year_month = #{endYearMonth}
|
|
|
|
+""")
|
|
|
|
+ CarClgkPo clgk(@Param("endYearMonth") Integer endYearMonth);
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 查询产权车龄情况
|
|
|
|
+ * @param endYearMonth 账期
|
|
|
|
+ */
|
|
|
|
+ @Select("""
|
|
|
|
+with
|
|
|
|
+t101 as (
|
|
|
|
+select
|
|
|
|
+ first_unit,
|
|
|
|
+ count(che_liang_lai_yuan = '自有车辆' or null) as zi_you,
|
|
|
|
+ count((che_liang_lai_yuan = '自有车辆' and che_ling < 6) or null) as lte6,
|
|
|
|
+ count((che_liang_lai_yuan = '自有车辆' and che_ling >= 6 and che_ling <= 10) or null) as gte6lte10,
|
|
|
|
+ count((che_liang_lai_yuan = '自有车辆' and che_ling > 10) or null) as gt10,
|
|
|
|
+ count(che_liang_lai_yuan = '租赁车辆' or null) as zu_lin,
|
|
|
|
+ count(1) as total
|
|
|
|
+from
|
|
|
|
+ car.car_base_data_month
|
|
|
|
+where
|
|
|
|
+ year_month = #{endYearMonth}
|
|
|
|
+group by
|
|
|
|
+ first_unit
|
|
|
|
+order by
|
|
|
|
+ first_unit
|
|
|
|
+),
|
|
|
|
+t102 as (
|
|
|
|
+select
|
|
|
|
+ '合计' as first_unit,
|
|
|
|
+ sum(zi_you) as zi_you_total,
|
|
|
|
+ sum(lte6) as lte6,
|
|
|
|
+ sum(gte6lte10) as gte6lte10,
|
|
|
|
+ sum(gt10) as gt10,
|
|
|
|
+ sum(zu_lin) as zu_lin_total,
|
|
|
|
+ sum(total) as total
|
|
|
|
+from
|
|
|
|
+ t101
|
|
|
|
+),
|
|
|
|
+t103 as (
|
|
|
|
+select
|
|
|
|
+ *
|
|
|
|
+from
|
|
|
|
+ t101
|
|
|
|
+union all
|
|
|
|
+select
|
|
|
|
+ *
|
|
|
|
+from
|
|
|
|
+ t102
|
|
|
|
+),
|
|
|
|
+t104 as (
|
|
|
|
+select
|
|
|
|
+ *,
|
|
|
|
+ round((lte6 + zu_lin) / total::numeric,
|
|
|
|
+ 4) as cheng_xin_lv
|
|
|
|
+from
|
|
|
|
+ t103
|
|
|
|
+)
|
|
|
|
+select
|
|
|
|
+ *
|
|
|
|
+from
|
|
|
|
+ t104
|
|
|
|
+""")
|
|
|
|
+ List<CarCqclqkPo> cqclqk(@Param("endYearMonth") Integer endYearMonth);
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 建议更新车辆一级单位统计
|
|
|
|
+ * @param startYearMonth 开始年月
|
|
|
|
+ * @param endYearMonth 结束年月
|
|
|
|
+ */
|
|
|
|
+ @Select("""
|
|
|
|
+with
|
|
|
|
+t101 as (
|
|
|
|
+select
|
|
|
|
+ *
|
|
|
|
+from
|
|
|
|
+ car.car_base_data_month
|
|
|
|
+where
|
|
|
|
+ che_liang_lai_yuan = '自有车辆'
|
|
|
|
+ and year_month = #{endYearMonth}
|
|
|
|
+),
|
|
|
|
+t102 as (
|
|
|
|
+select
|
|
|
|
+ che_pai_hao,
|
|
|
|
+ sum(wei_xiu) as wei_xiu_sum
|
|
|
|
+from
|
|
|
|
+ car.car_fei_yong_month
|
|
|
|
+where
|
|
|
|
+ year_month >= #{startYearMonth}
|
|
|
|
+ and year_month <= #{endYearMonth}
|
|
|
|
+group by
|
|
|
|
+ che_pai_hao
|
|
|
|
+),
|
|
|
|
+t103 as (
|
|
|
|
+select
|
|
|
|
+ t101.*,
|
|
|
|
+ t102.wei_xiu_sum
|
|
|
|
+from
|
|
|
|
+ t102
|
|
|
|
+join t101 on
|
|
|
|
+ t102.che_pai_hao = t101.che_pai_hao
|
|
|
|
+),
|
|
|
|
+t104 as (
|
|
|
|
+select
|
|
|
|
+ *
|
|
|
|
+from
|
|
|
|
+ t103
|
|
|
|
+where
|
|
|
|
+ che_ling > 10
|
|
|
|
+ and wei_xiu_sum > 5000
|
|
|
|
+),
|
|
|
|
+t105 as (
|
|
|
|
+select
|
|
|
|
+ first_unit,
|
|
|
|
+ count(che_liang_lei_xing = '轿车' or null) as jc,
|
|
|
|
+ count(che_liang_lei_xing = '皮卡车' or null) as pkc,
|
|
|
|
+ count(che_liang_lei_xing = '商务车' or null) as swc,
|
|
|
|
+ count(che_liang_lei_xing = '特种车' or null) as tzc,
|
|
|
|
+ count(che_liang_lei_xing = '越野车' or null) as yyc,
|
|
|
|
+ count(che_liang_lei_xing = '中型面包车(8-20座的面包车)' or null) as zxmbc,
|
|
|
|
+ count(1) as total
|
|
|
|
+from
|
|
|
|
+ t104
|
|
|
|
+group by
|
|
|
|
+ first_unit
|
|
|
|
+order by
|
|
|
|
+ count(1) desc
|
|
|
|
+),
|
|
|
|
+t106 as (
|
|
|
|
+select
|
|
|
|
+ '总计' as first_unit,
|
|
|
|
+ coalesce(sum(jc), 0) as jc,
|
|
|
|
+ coalesce(sum(pkc), 0) as pkc,
|
|
|
|
+ coalesce(sum(swc), 0) as swc,
|
|
|
|
+ coalesce(sum(tzc), 0) as tzc,
|
|
|
|
+ coalesce(sum(yyc), 0) as yyc,
|
|
|
|
+ coalesce(sum(zxmbc), 0) as zxmbc,
|
|
|
|
+ coalesce(sum(total), 0) as total
|
|
|
|
+from
|
|
|
|
+ t105
|
|
|
|
+),
|
|
|
|
+t107 as (
|
|
|
|
+select
|
|
|
|
+ *
|
|
|
|
+from
|
|
|
|
+ t105
|
|
|
|
+union all
|
|
|
|
+select
|
|
|
|
+ *
|
|
|
|
+from
|
|
|
|
+ t106
|
|
|
|
+)
|
|
|
|
+select
|
|
|
|
+ *
|
|
|
|
+from
|
|
|
|
+ t107
|
|
|
|
+""")
|
|
|
|
+ List<CarJygxUnitPo> jygxUnit(@Param("startYearMonth") Integer startYearMonth,
|
|
|
|
+ @Param("endYearMonth") Integer endYearMonth);
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 建议更新车辆
|
|
|
|
+ * @param startYearMonth 开始年月
|
|
|
|
+ * @param endYearMonth 结束年月
|
|
|
|
+ */
|
|
|
|
+ @Select("""
|
|
|
|
+with
|
|
|
|
+t101 as (
|
|
|
|
+select
|
|
|
|
+ *
|
|
|
|
+from
|
|
|
|
+ car.car_base_data_month
|
|
|
|
+where
|
|
|
|
+ che_liang_lai_yuan = '自有车辆'
|
|
|
|
+ and year_month = #{endYearMonth}
|
|
|
|
+),
|
|
|
|
+t102 as (
|
|
|
|
+select
|
|
|
|
+ che_pai_hao,
|
|
|
|
+ sum(wei_xiu) as wei_xiu_sum
|
|
|
|
+from
|
|
|
|
+ car.car_fei_yong_month
|
|
|
|
+where
|
|
|
|
+ year_month >= #{startYearMonth}
|
|
|
|
+ and year_month <= #{endYearMonth}
|
|
|
|
+group by
|
|
|
|
+ che_pai_hao
|
|
|
|
+),
|
|
|
|
+t103 as (
|
|
|
|
+select
|
|
|
|
+ t101.*,
|
|
|
|
+ t102.wei_xiu_sum
|
|
|
|
+from
|
|
|
|
+ t102
|
|
|
|
+join t101 on
|
|
|
|
+ t102.che_pai_hao = t101.che_pai_hao
|
|
|
|
+),
|
|
|
|
+t104 as (
|
|
|
|
+select
|
|
|
|
+ *
|
|
|
|
+from
|
|
|
|
+ t103
|
|
|
|
+where
|
|
|
|
+ che_ling > 10
|
|
|
|
+ and wei_xiu_sum > 5000
|
|
|
|
+)
|
|
|
|
+select
|
|
|
|
+ che_pai_hao,
|
|
|
|
+ che_liang_pin_pai,
|
|
|
|
+ deng_ji_ri_qi,
|
|
|
|
+ che_liang_lai_yuan,
|
|
|
|
+ che_liang_lei_xing,
|
|
|
|
+ che_liang_shi_yong_xing_zhi,
|
|
|
|
+ che_liang_suo_shu_dan_wei,
|
|
|
|
+ first_unit,
|
|
|
|
+ second_unit,
|
|
|
|
+ third_unit,
|
|
|
|
+ ceil(che_ling) as che_ling,
|
|
|
|
+ round(wei_xiu_sum,
|
|
|
|
+ 2) as wei_xiu_sum
|
|
|
|
+from
|
|
|
|
+ t104
|
|
|
|
+order by
|
|
|
|
+ wei_xiu_sum desc
|
|
|
|
+""")
|
|
|
|
+ List<CarJygxPo> jygx(@Param("startYearMonth") Integer startYearMonth,
|
|
|
|
+ @Param("endYearMonth") Integer endYearMonth);
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 查询省内费用
|
|
|
|
+ * @param endYearMonth 账期
|
|
|
|
+ */
|
|
|
|
+ @Select("""
|
|
|
|
+with
|
|
|
|
+t101 as (
|
|
|
|
+select
|
|
|
|
+ year_no,
|
|
|
|
+ month_no,
|
|
|
|
+ second_org_no,
|
|
|
|
+ case
|
|
|
|
+ when second_org_name = '省机动局' then '传输局'
|
|
|
|
+ else second_org_name
|
|
|
|
+ end,
|
|
|
|
+ round(sum(case when kpi_id in ('KPI_001', 'KPI_002', 'KPI_004', 'KPI_005', 'KPI_006', 'KPI_007', 'KPI_008', 'KPI_009', 'KPI_010', 'KPI_011', 'KPI_013', 'KPI_014', 'KPI_015', 'KPI_016', 'KPI_017', 'KPI_018', 'KPI_019', 'KPI_020', 'KPI_021', 'KPI_022', 'KPI_023') then ty_value else 0 end) / 10000,
|
|
|
|
+ 2) as ty_fy,
|
|
|
|
+ round(sum(case when kpi_id in ('KPI_001', 'KPI_002', 'KPI_004', 'KPI_005', 'KPI_006', 'KPI_007', 'KPI_008', 'KPI_009', 'KPI_010', 'KPI_011', 'KPI_013', 'KPI_014', 'KPI_015', 'KPI_016', 'KPI_017', 'KPI_018', 'KPI_019', 'KPI_020', 'KPI_021', 'KPI_022', 'KPI_023') then ly_value else 0 end) / 10000,
|
|
|
|
+ 2) as ly_fy,
|
|
|
|
+ round(sum(case when kpi_id = 'KPI_024' then ty_value else 0 end) / 10000,
|
|
|
|
+ 2) as ty_sr
|
|
|
|
+from
|
|
|
|
+ car.car_fee_hb
|
|
|
|
+where
|
|
|
|
+ month_id = #{endYearMonth}
|
|
|
|
+ and second_org_no in ('-11', '-12', '180', '181', '182', '183', '184', '185', '186', '187', '188', '189', '720', '782')
|
|
|
|
+group by
|
|
|
|
+ year_no,
|
|
|
|
+ month_no,
|
|
|
|
+ second_org_no,
|
|
|
|
+ second_org_name
|
|
|
|
+),
|
|
|
|
+t102 as (
|
|
|
|
+select
|
|
|
|
+ t101.*,
|
|
|
|
+ b.budget
|
|
|
|
+from
|
|
|
|
+ t101
|
|
|
|
+join car.car_yu_suan b on
|
|
|
|
+ t101.second_org_no = b.area_no
|
|
|
|
+ and t101.year_no = b.year_no
|
|
|
|
+),
|
|
|
|
+t103 as (
|
|
|
|
+select
|
|
|
|
+ *,
|
|
|
|
+ round(budget / 12 * month_no,
|
|
|
|
+ 2) as budget_lj,
|
|
|
|
+ ty_fy - ly_fy as tbzj,
|
|
|
|
+ case
|
|
|
|
+ when ly_fy = 0 then null
|
|
|
|
+ else round((ty_fy - ly_fy) / ly_fy,
|
|
|
|
+ 4)
|
|
|
|
+ end as tbbfb,
|
|
|
|
+ ty_fy - round(budget / 12 * month_no,
|
|
|
|
+ 2) as yspc,
|
|
|
|
+ case
|
|
|
|
+ when budget = 0 then null
|
|
|
|
+ else round((ty_fy - round(budget / 12 * month_no,
|
|
|
|
+ 2)) / (round(budget / 12 * month_no,
|
|
|
|
+ 2)),
|
|
|
|
+ 5)
|
|
|
|
+ end as yspcbfb,
|
|
|
|
+ case
|
|
|
|
+ when ty_sr = 0 then null
|
|
|
|
+ else round(ty_fy / ty_sr,
|
|
|
|
+ 5)
|
|
|
|
+ end as ty_zsb
|
|
|
|
+from
|
|
|
|
+ t102
|
|
|
|
+),
|
|
|
|
+t104 as (
|
|
|
|
+select
|
|
|
|
+ max(year_no) as year_no,
|
|
|
|
+ max(month_no) as month_no,
|
|
|
|
+ '018' as second_org_no,
|
|
|
|
+ '合计' as second_org_name,
|
|
|
|
+ sum(ty_fy) as ty_fy,
|
|
|
|
+ sum(ly_fy) as ly_fy,
|
|
|
|
+ sum(ty_sr) as ty_sr,
|
|
|
|
+ sum(budget) as budget,
|
|
|
|
+ sum(budget_lj) as budget_lj,
|
|
|
|
+ sum(ty_fy) - sum(ly_fy) as tbzj,
|
|
|
|
+ case
|
|
|
|
+ when sum(ly_fy) = 0 then null
|
|
|
|
+ else round((sum(ty_fy) - sum(ly_fy)) / sum(ly_fy),
|
|
|
|
+ 4)
|
|
|
|
+ end as tbbfb,
|
|
|
|
+ sum(ty_fy) - sum(budget_lj) as yspc,
|
|
|
|
+ case
|
|
|
|
+ when sum(budget_lj) = 0 then null
|
|
|
|
+ else round((sum(ty_fy) - sum(budget_lj)) / (sum(budget_lj)),
|
|
|
|
+ 4)
|
|
|
|
+ end as yspcbfb,
|
|
|
|
+ case
|
|
|
|
+ when sum(ty_sr) = 0 then null
|
|
|
|
+ else round(sum(ty_fy) / sum(ty_sr),
|
|
|
|
+ 5)
|
|
|
|
+ end as ty_zsb
|
|
|
|
+from
|
|
|
|
+ t103
|
|
|
|
+),
|
|
|
|
+t105 as (
|
|
|
|
+select
|
|
|
|
+ *
|
|
|
|
+from
|
|
|
|
+ t103
|
|
|
|
+union all
|
|
|
|
+select
|
|
|
|
+ *
|
|
|
|
+from
|
|
|
|
+ t104
|
|
|
|
+)
|
|
|
|
+select
|
|
|
|
+ *
|
|
|
|
+from
|
|
|
|
+ t105
|
|
|
|
+""")
|
|
|
|
+ List<CarSnfyPo> snfy(@Param("endYearMonth") Integer endYearMonth);
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 查询北十占收比
|
|
|
|
+ * @param endYearMonth 账期
|
|
|
|
+ */
|
|
|
|
+ @Select("""
|
|
|
|
+with
|
|
|
|
+t101 as (
|
|
|
|
+select
|
|
|
|
+ area_name,
|
|
|
|
+ round(sum(case when kpi_id in ('KPI_001', 'KPI_002', 'KPI_004', 'KPI_005', 'KPI_006', 'KPI_007', 'KPI_008', 'KPI_009', 'KPI_010', 'KPI_011', 'KPI_013', 'KPI_014', 'KPI_015', 'KPI_016', 'KPI_017', 'KPI_018', 'KPI_019', 'KPI_020', 'KPI_021', 'KPI_022', 'KPI_023') then ty_value else 0 end) / 10000,
|
|
|
|
+ 2) as ty_fy,
|
|
|
|
+ round(sum(case when kpi_id = 'KPI_024' then ty_value else 0 end) / 10000,
|
|
|
|
+ 2) as ty_sr
|
|
|
|
+from
|
|
|
|
+ car.car_fee_bs
|
|
|
|
+where
|
|
|
|
+ month_id = #{endYearMonth}
|
|
|
|
+group by
|
|
|
|
+ area_name
|
|
|
|
+),
|
|
|
|
+t102 as (
|
|
|
|
+select
|
|
|
|
+ *,
|
|
|
|
+ case
|
|
|
|
+ when ty_sr = 0 then null
|
|
|
|
+ else round(ty_fy / ty_sr,
|
|
|
|
+ 5)
|
|
|
|
+ end as ty_zsb
|
|
|
|
+from
|
|
|
|
+ t101
|
|
|
|
+),
|
|
|
|
+t103 as (
|
|
|
|
+select
|
|
|
|
+ *,
|
|
|
|
+ row_number() over (
|
|
|
|
+ order by ty_zsb desc) as ty_zsb_rank
|
|
|
|
+from
|
|
|
|
+ t102
|
|
|
|
+)
|
|
|
|
+select
|
|
|
|
+ *
|
|
|
|
+from
|
|
|
|
+ t103
|
|
|
|
+order by
|
|
|
|
+ ty_zsb
|
|
|
|
+""")
|
|
|
|
+ List<CarBszsbPo> bszsb(@Param("endYearMonth") Integer endYearMonth);
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 1-12月百公里燃油费变化情况
|
|
|
|
+ * @param startYearMonth 开始年月
|
|
|
|
+ * @param endYearMonth 结束年月
|
|
|
|
+ */
|
|
|
|
+ @Select("""
|
|
|
|
+with
|
|
|
|
+t101 as (
|
|
|
|
+select
|
|
|
|
+ month_no,
|
|
|
|
+ sum(case when kpi_id in ('KPI_004', 'KPI_013') then tm_value else 0 end) as tm_ry
|
|
|
|
+from
|
|
|
|
+ car.car_fee_hb
|
|
|
|
+where
|
|
|
|
+ month_id >= #{startYearMonth}
|
|
|
|
+ and month_id <= #{endYearMonth}
|
|
|
|
+group by
|
|
|
|
+ month_no
|
|
|
|
+),
|
|
|
|
+t102 as (
|
|
|
|
+select
|
|
|
|
+ month_no,
|
|
|
|
+ sum(zong_li_cheng) as tm_lc
|
|
|
|
+from
|
|
|
|
+ car.car_li_cheng_month
|
|
|
|
+where
|
|
|
|
+ year_month >= #{startYearMonth}
|
|
|
|
+ and year_month <= #{endYearMonth}
|
|
|
|
+group by
|
|
|
|
+ month_no
|
|
|
|
+),
|
|
|
|
+t103 as (
|
|
|
|
+select
|
|
|
|
+ t101.month_no,
|
|
|
|
+ t101.tm_ry,
|
|
|
|
+ t102.tm_lc
|
|
|
|
+from
|
|
|
|
+ t101
|
|
|
|
+join t102 on
|
|
|
|
+ t101.month_no = t102.month_no
|
|
|
|
+),
|
|
|
|
+t104 as (
|
|
|
|
+select
|
|
|
|
+ *,
|
|
|
|
+ round(tm_ry / tm_lc * 100,
|
|
|
|
+ 2) as bglry
|
|
|
|
+from
|
|
|
|
+ t103
|
|
|
|
+)
|
|
|
|
+select
|
|
|
|
+ *
|
|
|
|
+from
|
|
|
|
+ t104
|
|
|
|
+order by
|
|
|
|
+ month_no
|
|
|
|
+""")
|
|
|
|
+ List<CarBglryQsPo> bglryQs(@Param("startYearMonth") Integer startYearMonth,
|
|
|
|
+ @Param("endYearMonth") Integer endYearMonth);
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 二级组织机构百公里燃油费
|
|
|
|
+ * @param startYearMonth 开始年月
|
|
|
|
+ * @param endYearMonth 结束年月
|
|
|
|
+ */
|
|
|
|
+ @Select("""
|
|
|
|
+with
|
|
|
|
+t100 as (
|
|
|
|
+select
|
|
|
|
+ id as area_no,
|
|
|
|
+ case
|
|
|
|
+ when name = '省机动局' then '机动局'
|
|
|
|
+ else name
|
|
|
|
+ end as area_name
|
|
|
|
+from
|
|
|
|
+ common.organization
|
|
|
|
+where
|
|
|
|
+ id in ('-11', '180', '181', '182', '183', '184', '185', '186', '187', '188', '189', '720', '782')
|
|
|
|
+),
|
|
|
|
+t101 as (
|
|
|
|
+select
|
|
|
|
+ second_org_no as area_no,
|
|
|
|
+ sum(case when kpi_id in ('KPI_004', 'KPI_013') then ty_value else 0 end) as ty_ry
|
|
|
|
+from
|
|
|
|
+ car.car_fee_hb
|
|
|
|
+where
|
|
|
|
+ month_id = #{endYearMonth}
|
|
|
|
+group by
|
|
|
|
+ second_org_no
|
|
|
|
+),
|
|
|
|
+t102 as (
|
|
|
|
+select
|
|
|
|
+ area_no,
|
|
|
|
+ sum(zong_li_cheng) as ty_lc
|
|
|
|
+from
|
|
|
|
+ car.car_li_cheng_month
|
|
|
|
+where
|
|
|
|
+ year_month >= #{startYearMonth}
|
|
|
|
+ and year_month <= #{endYearMonth}
|
|
|
|
+group by
|
|
|
|
+ area_no
|
|
|
|
+),
|
|
|
|
+t103 as (
|
|
|
|
+select
|
|
|
|
+ t100.area_no,
|
|
|
|
+ t100.area_name,
|
|
|
|
+ t101.ty_ry,
|
|
|
|
+ t102.ty_lc
|
|
|
|
+from
|
|
|
|
+ t100
|
|
|
|
+left join t101 on
|
|
|
|
+ t100.area_no = t101.area_no
|
|
|
|
+left join t102 on
|
|
|
|
+ t100.area_no = t102.area_no
|
|
|
|
+),
|
|
|
|
+t104 as (
|
|
|
|
+select
|
|
|
|
+ *,
|
|
|
|
+ case
|
|
|
|
+ when ty_lc = 0 then 0
|
|
|
|
+ else coalesce(round(ty_ry / ty_lc * 100,
|
|
|
|
+ 2),
|
|
|
|
+ 0)
|
|
|
|
+ end as bglry
|
|
|
|
+from
|
|
|
|
+ t103
|
|
|
|
+),
|
|
|
|
+t105 as (
|
|
|
|
+select
|
|
|
|
+ '平均' as area_no,
|
|
|
|
+ '平均' as area_name,
|
|
|
|
+ coalesce(sum(ty_ry),
|
|
|
|
+ 0) as ty_ry,
|
|
|
|
+ coalesce(sum(ty_lc),
|
|
|
|
+ 0) as ty_lc,
|
|
|
|
+ coalesce(round(avg(bglry),
|
|
|
|
+ 2),
|
|
|
|
+ 0) as bglry
|
|
|
|
+from
|
|
|
|
+ t104
|
|
|
|
+),
|
|
|
|
+t106 as (
|
|
|
|
+select
|
|
|
|
+ *
|
|
|
|
+from
|
|
|
|
+ t104
|
|
|
|
+union all
|
|
|
|
+select
|
|
|
|
+ *
|
|
|
|
+from
|
|
|
|
+ t105
|
|
|
|
+)
|
|
|
|
+select
|
|
|
|
+ *
|
|
|
|
+from
|
|
|
|
+ t106
|
|
|
|
+order by
|
|
|
|
+ bglry
|
|
|
|
+""")
|
|
|
|
+ List<CarBglryUnitPo> bglryUnit(@Param("startYearMonth") Integer startYearMonth,
|
|
|
|
+ @Param("endYearMonth") Integer endYearMonth);
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 1-12月维修费变化情况
|
|
|
|
+ * @param startYearMonth 开始年月
|
|
|
|
+ * @param endYearMonth 结束年月
|
|
|
|
+ */
|
|
|
|
+ @Select("""
|
|
|
|
+select
|
|
|
|
+ month_no,
|
|
|
|
+ round(sum(case when kpi_id in ('KPI_008', 'KPI_016') then tm_value else 0 end) / 10000,
|
|
|
|
+ 2) as tm_wx
|
|
|
|
+from
|
|
|
|
+ car.car_fee_hb
|
|
|
|
+where
|
|
|
|
+ month_id >= #{startYearMonth}
|
|
|
|
+ and month_id <= #{endYearMonth}
|
|
|
|
+group by
|
|
|
|
+ month_no
|
|
|
|
+order by
|
|
|
|
+ month_no
|
|
|
|
+""")
|
|
|
|
+ List<CarWxQsPo> wxQs(@Param("startYearMonth") Integer startYearMonth,
|
|
|
|
+ @Param("endYearMonth") Integer endYearMonth);
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 二级组织机构自有车辆单车维修费
|
|
|
|
+ * @param endYearMonth 账期
|
|
|
|
+ */
|
|
|
|
+ @Select("""
|
|
|
|
+with
|
|
|
|
+t100 as (
|
|
|
|
+select
|
|
|
|
+ id as area_no,
|
|
|
|
+ case
|
|
|
|
+ when name = '省机动局' then '机动局'
|
|
|
|
+ else name
|
|
|
|
+ end as area_name
|
|
|
|
+from
|
|
|
|
+ common.organization
|
|
|
|
+where
|
|
|
|
+ id in ('-11', '180', '181', '182', '183', '184', '185', '186', '187', '188', '189', '720', '782')
|
|
|
|
+),
|
|
|
|
+t101 as (
|
|
|
|
+select
|
|
|
|
+ second_org_no as area_no,
|
|
|
|
+ sum(case when kpi_id in ('KPI_008', 'KPI_016') then ty_value else 0 end) as ty_wx
|
|
|
|
+from
|
|
|
|
+ car.car_fee_hb
|
|
|
|
+where
|
|
|
|
+ month_id = #{endYearMonth}
|
|
|
|
+group by
|
|
|
|
+ second_org_no
|
|
|
|
+),
|
|
|
|
+t102 as (
|
|
|
|
+select
|
|
|
|
+ area_no,
|
|
|
|
+ count(1) as total
|
|
|
|
+from
|
|
|
|
+ car.car_base_data_month
|
|
|
|
+where
|
|
|
|
+ year_month = #{endYearMonth}
|
|
|
|
+group by
|
|
|
|
+ area_no
|
|
|
|
+),
|
|
|
|
+t103 as (
|
|
|
|
+select
|
|
|
|
+ t100.area_no,
|
|
|
|
+ t100.area_name,
|
|
|
|
+ t101.ty_wx,
|
|
|
|
+ t102.total
|
|
|
|
+from
|
|
|
|
+ t100
|
|
|
|
+left join t101 on
|
|
|
|
+ t100.area_no = t101.area_no
|
|
|
|
+left join t102 on
|
|
|
|
+ t100.area_no = t102.area_no
|
|
|
|
+),
|
|
|
|
+t104 as (
|
|
|
|
+select
|
|
|
|
+ *,
|
|
|
|
+ case
|
|
|
|
+ when total = 0 then 0
|
|
|
|
+ else coalesce(round(ty_wx / total),
|
|
|
|
+ 0)
|
|
|
|
+ end as ty_wx_avg
|
|
|
|
+from
|
|
|
|
+ t103
|
|
|
|
+),
|
|
|
|
+t105 as (
|
|
|
|
+select
|
|
|
|
+ '平均' as area_no,
|
|
|
|
+ '平均' as area_name,
|
|
|
|
+ coalesce(sum(ty_wx),
|
|
|
|
+ 0) as ty_wx,
|
|
|
|
+ coalesce(sum(total),
|
|
|
|
+ 0) as total,
|
|
|
|
+ coalesce(round(avg(ty_wx_avg)),
|
|
|
|
+ 0) as ty_wx_avg
|
|
|
|
+from
|
|
|
|
+ t104
|
|
|
|
+),
|
|
|
|
+t106 as (
|
|
|
|
+select
|
|
|
|
+ *
|
|
|
|
+from
|
|
|
|
+ t104
|
|
|
|
+union all
|
|
|
|
+select
|
|
|
|
+ *
|
|
|
|
+from
|
|
|
|
+ t105
|
|
|
|
+)
|
|
|
|
+select
|
|
|
|
+ *
|
|
|
|
+from
|
|
|
|
+ t106
|
|
|
|
+order by
|
|
|
|
+ ty_wx_avg
|
|
|
|
+""")
|
|
|
|
+ List<CarWxUnitPo> wxUnit(@Param("endYearMonth") Integer endYearMonth);
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 查询异常燃油费
|
|
|
|
+ * @param endYearMonth 账期
|
|
|
|
+ */
|
|
|
|
+ @Select("""
|
|
|
|
+select
|
|
|
|
+ *
|
|
|
|
+from
|
|
|
|
+ car.car_ran_you_yi_chang
|
|
|
|
+where
|
|
|
|
+ year_month = #{endYearMonth}
|
|
|
|
+order by
|
|
|
|
+ bai_gong_li_you_fei_rank
|
|
|
|
+""")
|
|
|
|
+ List<CarRyycPo> ryyc(@Param("endYearMonth") Integer endYearMonth);
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 查询异常燃油费一级单位统计
|
|
|
|
+ * @param endYearMonth 账期
|
|
|
|
+ */
|
|
|
|
+ @Select("""
|
|
|
|
+with
|
|
|
|
+t101 as (
|
|
|
|
+select
|
|
|
|
+ first_unit,
|
|
|
|
+ count(1) as total
|
|
|
|
+from
|
|
|
|
+ car.car_ran_you_yi_chang
|
|
|
|
+where
|
|
|
|
+ year_month = #{endYearMonth}
|
|
|
|
+group by
|
|
|
|
+ first_unit
|
|
|
|
+order by
|
|
|
|
+ count(1) desc
|
|
|
|
+),
|
|
|
|
+t102 as (
|
|
|
|
+select
|
|
|
|
+ '总计' as first_unit,
|
|
|
|
+ coalesce(sum(total),
|
|
|
|
+ 0) as total
|
|
|
|
+from
|
|
|
|
+ t101
|
|
|
|
+),
|
|
|
|
+t103 as (
|
|
|
|
+select
|
|
|
|
+ *
|
|
|
|
+from
|
|
|
|
+ t101
|
|
|
|
+union all
|
|
|
|
+select
|
|
|
|
+ *
|
|
|
|
+from
|
|
|
|
+ t102
|
|
|
|
+)
|
|
|
|
+select
|
|
|
|
+ *
|
|
|
|
+from
|
|
|
|
+ t103
|
|
|
|
+""")
|
|
|
|
+ List<CarRyycUnitPo> ryycUnit(@Param("endYearMonth") Integer endYearMonth);
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 自有车辆维修费异常
|
|
|
|
+ * @param endYearMonth 账期
|
|
|
|
+ */
|
|
|
|
+ @Select("""
|
|
|
|
+select
|
|
|
|
+ *
|
|
|
|
+from
|
|
|
|
+ car.car_zi_you_wei_xiu_yi_chang
|
|
|
|
+where
|
|
|
|
+ year_month = #{endYearMonth}
|
|
|
|
+order by
|
|
|
|
+ wei_xiu_rank
|
|
|
|
+""")
|
|
|
|
+ List<CarZywxycPo> zywxyc(@Param("endYearMonth") Integer endYearMonth);
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 查询自有车辆维修费异常一级单位统计
|
|
|
|
+ * @param endYearMonth 账期
|
|
|
|
+ */
|
|
|
|
+ @Select("""
|
|
|
|
+with
|
|
|
|
+t101 as (
|
|
|
|
+select
|
|
|
|
+ first_unit,
|
|
|
|
+ count(1) as total
|
|
|
|
+from
|
|
|
|
+ car.car_zi_you_wei_xiu_yi_chang
|
|
|
|
+where
|
|
|
|
+ year_month = #{endYearMonth}
|
|
|
|
+group by
|
|
|
|
+ first_unit
|
|
|
|
+order by
|
|
|
|
+ count(1) desc
|
|
|
|
+),
|
|
|
|
+t102 as (
|
|
|
|
+select
|
|
|
|
+ '总计' as first_unit,
|
|
|
|
+ coalesce(sum(total),
|
|
|
|
+ 0) as total
|
|
|
|
+from
|
|
|
|
+ t101
|
|
|
|
+),
|
|
|
|
+t103 as (
|
|
|
|
+select
|
|
|
|
+ *
|
|
|
|
+from
|
|
|
|
+ t101
|
|
|
|
+union all
|
|
|
|
+select
|
|
|
|
+ *
|
|
|
|
+from
|
|
|
|
+ t102
|
|
|
|
+)
|
|
|
|
+select
|
|
|
|
+ *
|
|
|
|
+from
|
|
|
|
+ t103
|
|
|
|
+""")
|
|
|
|
+ List<CarZywxycUnitPo> zywxycUnit(@Param("endYearMonth") Integer endYearMonth);
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 租赁车辆维修费异常
|
|
|
|
+ * @param endYearMonth 账期
|
|
|
|
+ */
|
|
|
|
+ @Select("""
|
|
|
|
+select
|
|
|
|
+ *
|
|
|
|
+from
|
|
|
|
+ car.car_zu_lin_wei_xiu_yi_chang
|
|
|
|
+where
|
|
|
|
+ year_month = #{endYearMonth}
|
|
|
|
+order by
|
|
|
|
+ wei_xiu_rank
|
|
|
|
+""")
|
|
|
|
+ List<CarZlwxycPo> zlwxyc(@Param("endYearMonth") Integer endYearMonth);
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 低效车辆一级单位统计
|
|
|
|
+ * @param ty 今年账期
|
|
|
|
+ * @param ly 去年同期
|
|
|
|
+ */
|
|
|
|
+ @Select("""
|
|
|
|
+with
|
|
|
|
+t101 as (
|
|
|
|
+select
|
|
|
|
+ first_unit,
|
|
|
|
+ count(1) as total
|
|
|
|
+from
|
|
|
|
+ car.car_base_data_month
|
|
|
|
+where
|
|
|
|
+ year_month = #{ly}
|
|
|
|
+ and first_unit != '省公司本部'
|
|
|
|
+ and position('建设部' in che_liang_suo_shu_dan_wei) = 0
|
|
|
|
+group by
|
|
|
|
+ first_unit
|
|
|
|
+),
|
|
|
|
+t102 as (
|
|
|
|
+select
|
|
|
|
+ first_unit,
|
|
|
|
+ count(1) as di_xiao_count
|
|
|
|
+from
|
|
|
|
+ car.car_di_xiao_month
|
|
|
|
+where
|
|
|
|
+ year_month = #{ly}
|
|
|
|
+group by
|
|
|
|
+ first_unit
|
|
|
|
+),
|
|
|
|
+t103 as (
|
|
|
|
+select
|
|
|
|
+ t101.first_unit,
|
|
|
|
+ t101.total,
|
|
|
|
+ case
|
|
|
|
+ when t102.di_xiao_count is null then 0
|
|
|
|
+ else t102.di_xiao_count
|
|
|
|
+ end,
|
|
|
|
+ case
|
|
|
|
+ when t102.di_xiao_count is null then 0
|
|
|
|
+ else t102.di_xiao_count / t101.total::numeric
|
|
|
|
+ end as di_xiao_percent
|
|
|
|
+from
|
|
|
|
+ t101
|
|
|
|
+left join t102 on
|
|
|
|
+ t101.first_unit = t102.first_unit
|
|
|
|
+),
|
|
|
|
+t201 as (
|
|
|
|
+select
|
|
|
|
+ first_unit,
|
|
|
|
+ count(1) as total
|
|
|
|
+from
|
|
|
|
+ car.car_base_data_month
|
|
|
|
+where
|
|
|
|
+ year_month = #{ty}
|
|
|
|
+ and first_unit != '省公司本部'
|
|
|
|
+ and position('建设部' in che_liang_suo_shu_dan_wei) = 0
|
|
|
|
+group by
|
|
|
|
+ first_unit
|
|
|
|
+),
|
|
|
|
+t202 as (
|
|
|
|
+select
|
|
|
|
+ first_unit,
|
|
|
|
+ count(1) as di_xiao_count
|
|
|
|
+from
|
|
|
|
+ car.car_di_xiao_month
|
|
|
|
+where
|
|
|
|
+ year_month = #{ty}
|
|
|
|
+group by
|
|
|
|
+ first_unit
|
|
|
|
+),
|
|
|
|
+t203 as (
|
|
|
|
+select
|
|
|
|
+ t201.first_unit,
|
|
|
|
+ t201.total,
|
|
|
|
+ case
|
|
|
|
+ when t202.di_xiao_count is null then 0
|
|
|
|
+ else t202.di_xiao_count
|
|
|
|
+ end,
|
|
|
|
+ case
|
|
|
|
+ when t202.di_xiao_count is null then 0
|
|
|
|
+ else t202.di_xiao_count / t201.total::numeric
|
|
|
|
+ end as di_xiao_percent
|
|
|
|
+from
|
|
|
|
+ t201
|
|
|
|
+left join t202 on
|
|
|
|
+ t201.first_unit = t202.first_unit
|
|
|
|
+),
|
|
|
|
+t301 as (
|
|
|
|
+select
|
|
|
|
+ t203.first_unit,
|
|
|
|
+ t103.total as total_ly,
|
|
|
|
+ t103.di_xiao_count as di_xiao_count_ly,
|
|
|
|
+ t103.di_xiao_percent as di_xiao_percent_ly,
|
|
|
|
+ t203.total as total_ty,
|
|
|
|
+ t203.di_xiao_count as di_xiao_count_ty,
|
|
|
|
+ t203.di_xiao_percent as di_xiao_percent_ty,
|
|
|
|
+ t203.di_xiao_percent - t103.di_xiao_percent as di_xiao_change
|
|
|
|
+from
|
|
|
|
+ t103
|
|
|
|
+join t203 on
|
|
|
|
+ t103.first_unit = t203.first_unit
|
|
|
|
+),
|
|
|
|
+t302 as (
|
|
|
|
+select
|
|
|
|
+ '合计' as first_unit,
|
|
|
|
+ sum(total_ly) as total_ly,
|
|
|
|
+ sum(di_xiao_count_ly) as di_xiao_count_ly,
|
|
|
|
+ sum(di_xiao_count_ly) / sum(total_ly)::numeric as di_xiao_percent_ly,
|
|
|
|
+ sum(total_ty) as total_ty,
|
|
|
|
+ sum(di_xiao_count_ty) as di_xiao_count_ty,
|
|
|
|
+ sum(di_xiao_count_ty) / sum(total_ty)::numeric as di_xiao_percent_ty,
|
|
|
|
+ sum(di_xiao_count_ty) / sum(total_ty)::numeric - sum(di_xiao_count_ly) / sum(total_ly)::numeric as di_xiao_change
|
|
|
|
+from
|
|
|
|
+ t301
|
|
|
|
+),
|
|
|
|
+t401 as (
|
|
|
|
+select
|
|
|
|
+ *
|
|
|
|
+from
|
|
|
|
+ t301
|
|
|
|
+union all
|
|
|
|
+select
|
|
|
|
+ *
|
|
|
|
+from
|
|
|
|
+ t302
|
|
|
|
+)
|
|
|
|
+select
|
|
|
|
+ first_unit,
|
|
|
|
+ coalesce(total_ly, 0) as total_ly,
|
|
|
|
+ coalesce(di_xiao_count_ly, 0) as di_xiao_count_ly,
|
|
|
|
+ coalesce(round(di_xiao_percent_ly, 4), 0) as di_xiao_percent_ly,
|
|
|
|
+ coalesce(total_ty, 0) as total_ty,
|
|
|
|
+ coalesce(di_xiao_count_ty, 0) as di_xiao_count_ty,
|
|
|
|
+ coalesce(round(di_xiao_percent_ty, 4), 0) as di_xiao_percent_ty,
|
|
|
|
+ coalesce(round(di_xiao_change, 4), 0) as di_xiao_change
|
|
|
|
+from
|
|
|
|
+ t401
|
|
|
|
+""")
|
|
|
|
+ List<CarDxUnitPo> dxUnit(@Param("ty") Integer ty, @Param("ly") Integer ly);
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 低效车辆明细
|
|
|
|
+ * @param endYearMonth 账期
|
|
|
|
+ */
|
|
|
|
+ @Select("""
|
|
|
|
+select
|
|
|
|
+ *
|
|
|
|
+from
|
|
|
|
+ car.car_di_xiao_month
|
|
|
|
+where
|
|
|
|
+ year_month = #{endYearMonth}
|
|
|
|
+order by
|
|
|
|
+ first_unit,
|
|
|
|
+ second_unit,
|
|
|
|
+ third_unit,
|
|
|
|
+ che_pai_hao
|
|
|
|
+""")
|
|
|
|
+ List<CarDxPo> dx(@Param("endYearMonth") Integer endYearMonth);
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 违规用车一级单位统计
|
|
|
|
+ * @param startYearMonth 开始年月
|
|
|
|
+ * @param endYearMonth 结束年月
|
|
|
|
+ * @param endMonth 结束月
|
|
|
|
+ */
|
|
|
|
+ @Select("""
|
|
|
|
+with
|
|
|
|
+t100
|
|
|
|
+as (
|
|
|
|
+select
|
|
|
|
+ '石家庄' as first_unit
|
|
|
|
+union all
|
|
|
|
+select
|
|
|
|
+ '唐山'
|
|
|
|
+union all
|
|
|
|
+select
|
|
|
|
+ '秦皇岛'
|
|
|
|
+union all
|
|
|
|
+select
|
|
|
|
+ '邯郸'
|
|
|
|
+union all
|
|
|
|
+select
|
|
|
|
+ '邢台'
|
|
|
|
+union all
|
|
|
|
+select
|
|
|
|
+ '保定'
|
|
|
|
+union all
|
|
|
|
+select
|
|
|
|
+ '张家口'
|
|
|
|
+union all
|
|
|
|
+select
|
|
|
|
+ '承德'
|
|
|
|
+union all
|
|
|
|
+select
|
|
|
|
+ '廊坊'
|
|
|
|
+union all
|
|
|
|
+select
|
|
|
|
+ '沧州'
|
|
|
|
+union all
|
|
|
|
+select
|
|
|
|
+ '衡水'
|
|
|
|
+union all
|
|
|
|
+select
|
|
|
|
+ '雄安'
|
|
|
|
+union all
|
|
|
|
+select
|
|
|
|
+ '机动局'
|
|
|
|
+),
|
|
|
|
+t101 as (
|
|
|
|
+select
|
|
|
|
+ first_unit,
|
|
|
|
+ count(month_no = 1 or null) as m1,
|
|
|
|
+ count(month_no = 2 or null) as m2,
|
|
|
|
+ count(month_no = 3 or null) as m3,
|
|
|
|
+ count(month_no = 4 or null) as m4,
|
|
|
|
+ count(month_no = 5 or null) as m5,
|
|
|
|
+ count(month_no = 6 or null) as m6,
|
|
|
|
+ count(month_no = 7 or null) as m7,
|
|
|
|
+ count(month_no = 8 or null) as m8,
|
|
|
|
+ count(month_no = 9 or null) as m9,
|
|
|
|
+ count(month_no = 10 or null) as m10,
|
|
|
|
+ count(month_no = 11 or null) as m11,
|
|
|
|
+ count(month_no = 12 or null) as m12,
|
|
|
|
+ count(1) as total
|
|
|
|
+from
|
|
|
|
+ car.car_wei_gui
|
|
|
|
+where
|
|
|
|
+ year_month >= #{startYearMonth}
|
|
|
|
+ and year_month <= #{endYearMonth}
|
|
|
|
+group by
|
|
|
|
+ first_unit
|
|
|
|
+),
|
|
|
|
+t102 as (
|
|
|
|
+select
|
|
|
|
+ t100.first_unit,
|
|
|
|
+ t101.m1,
|
|
|
|
+ t101.m2,
|
|
|
|
+ t101.m3,
|
|
|
|
+ t101.m4,
|
|
|
|
+ t101.m5,
|
|
|
|
+ t101.m6,
|
|
|
|
+ t101.m7,
|
|
|
|
+ t101.m8,
|
|
|
|
+ t101.m9,
|
|
|
|
+ t101.m10,
|
|
|
|
+ t101.m11,
|
|
|
|
+ t101.m12,
|
|
|
|
+ t101.total
|
|
|
|
+from
|
|
|
|
+ t100
|
|
|
|
+left join t101 on
|
|
|
|
+ t100.first_unit = t101.first_unit
|
|
|
|
+),
|
|
|
|
+t103 as (
|
|
|
|
+select
|
|
|
|
+ '合计' as first_unit,
|
|
|
|
+ sum(m1) as m1,
|
|
|
|
+ sum(m2) as m2,
|
|
|
|
+ sum(m3) as m3,
|
|
|
|
+ sum(m4) as m4,
|
|
|
|
+ sum(m5) as m5,
|
|
|
|
+ sum(m6) as m6,
|
|
|
|
+ sum(m7) as m7,
|
|
|
|
+ sum(m8) as m8,
|
|
|
|
+ sum(m9) as m9,
|
|
|
|
+ sum(m10) as m10,
|
|
|
|
+ sum(m11) as m11,
|
|
|
|
+ sum(m12) as m12,
|
|
|
|
+ sum(total) as total
|
|
|
|
+from
|
|
|
|
+ t102
|
|
|
|
+),
|
|
|
|
+t104 as (
|
|
|
|
+select * from t102
|
|
|
|
+union all
|
|
|
|
+select * from t103
|
|
|
|
+)
|
|
|
|
+select
|
|
|
|
+first_unit,
|
|
|
|
+case when 1 <= #{endMonth} then coalesce(m1, 0)::varchar else '' end as m1,
|
|
|
|
+case when 2 <= #{endMonth} then coalesce(m2, 0)::varchar else '' end as m2,
|
|
|
|
+case when 3 <= #{endMonth} then coalesce(m3, 0)::varchar else '' end as m3,
|
|
|
|
+case when 4 <= #{endMonth} then coalesce(m4, 0)::varchar else '' end as m4,
|
|
|
|
+case when 5 <= #{endMonth} then coalesce(m5, 0)::varchar else '' end as m5,
|
|
|
|
+case when 6 <= #{endMonth} then coalesce(m6, 0)::varchar else '' end as m6,
|
|
|
|
+case when 7 <= #{endMonth} then coalesce(m7, 0)::varchar else '' end as m7,
|
|
|
|
+case when 8 <= #{endMonth} then coalesce(m8, 0)::varchar else '' end as m8,
|
|
|
|
+case when 9 <= #{endMonth} then coalesce(m9, 0)::varchar else '' end as m9,
|
|
|
|
+case when 10 <= #{endMonth} then coalesce(m10, 0)::varchar else '' end as m10,
|
|
|
|
+case when 11 <= #{endMonth} then coalesce(m11, 0)::varchar else '' end as m11,
|
|
|
|
+case when 12 <= #{endMonth} then coalesce(m12, 0)::varchar else '' end as m12,
|
|
|
|
+coalesce(total, 0)::varchar as total
|
|
|
|
+from t104
|
|
|
|
+""")
|
|
|
|
+ List<CarWgUnitVo> wgUnit(@Param("startYearMonth") Integer startYearMonth,
|
|
|
|
+ @Param("endYearMonth") Integer endYearMonth, @Param("endMonth") Integer endMonth);
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 违规用车明细
|
|
|
|
+ * @param endYearMonth 账期
|
|
|
|
+ */
|
|
|
|
+ @Select("""
|
|
|
|
+select
|
|
|
|
+ *
|
|
|
|
+from
|
|
|
|
+ car.car_wei_gui
|
|
|
|
+where
|
|
|
|
+ year_month = #{endYearMonth}
|
|
|
|
+order by
|
|
|
|
+ yue_jie_shi_jian
|
|
|
|
+""")
|
|
|
|
+ List<CarWgPo> wg(@Param("endYearMonth") Integer endYearMonth);
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 违章长期未处理一级单位统计
|
|
|
|
+ * @param endYearMonth 账期
|
|
|
|
+ */
|
|
|
|
+ @Select("""
|
|
|
|
+with
|
|
|
|
+t101 as (
|
|
|
|
+select
|
|
|
|
+ first_unit,
|
|
|
|
+ count(1) as total
|
|
|
|
+from
|
|
|
|
+ car.car_wei_zhang_chang_qi
|
|
|
|
+where
|
|
|
|
+ year_month = #{endYearMonth}
|
|
|
|
+group by
|
|
|
|
+ first_unit
|
|
|
|
+order by
|
|
|
|
+ count(1) desc
|
|
|
|
+),
|
|
|
|
+t102 as (
|
|
|
|
+select
|
|
|
|
+ '总计' as first_unit,
|
|
|
|
+ coalesce(sum(total),
|
|
|
|
+ 0) as total
|
|
|
|
+from
|
|
|
|
+ t101
|
|
|
|
+),
|
|
|
|
+t103 as (
|
|
|
|
+select
|
|
|
|
+ *
|
|
|
|
+from
|
|
|
|
+ t101
|
|
|
|
+union all
|
|
|
|
+select
|
|
|
|
+ *
|
|
|
|
+from
|
|
|
|
+ t102
|
|
|
|
+)
|
|
|
|
+select
|
|
|
|
+ *
|
|
|
|
+from
|
|
|
|
+ t103
|
|
|
|
+""")
|
|
|
|
+ List<CarWzUnitPo> wzUnit(@Param("endYearMonth") Integer endYearMonth);
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 违章长期未处理明细
|
|
|
|
+ * @param endYearMonth 账期
|
|
|
|
+ */
|
|
|
|
+ @Select("""
|
|
|
|
+select
|
|
|
|
+ *
|
|
|
|
+from
|
|
|
|
+ car.car_wei_zhang_chang_qi
|
|
|
|
+where
|
|
|
|
+ year_month = #{endYearMonth}
|
|
|
|
+order by
|
|
|
|
+ wei_zhang_shi_jian
|
|
|
|
+""")
|
|
|
|
+ List<CarWzPo> wz(@Param("endYearMonth") Integer endYearMonth);
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 批量插入报告url
|
|
|
|
+ */
|
|
|
|
+ @Update("""
|
|
|
|
+<script>
|
|
|
|
+insert into car.car_reports
|
|
|
|
+(
|
|
|
|
+year_month,
|
|
|
|
+file_type,
|
|
|
|
+url
|
|
|
|
+)
|
|
|
|
+values
|
|
|
|
+<foreach collection="list" item="item" index="index" separator=",">
|
|
|
|
+(
|
|
|
|
+#{item.yearMonth},
|
|
|
|
+#{item.fileType},
|
|
|
|
+#{item.url}
|
|
|
|
+)
|
|
|
|
+</foreach>
|
|
|
|
+</script>
|
|
|
|
+""")
|
|
|
|
+ int insertBatchCarReports(List<CarReportsPo> list);
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 批量插入公告
|
|
|
|
+ */
|
|
|
|
+ @Update("""
|
|
|
|
+<script>
|
|
|
|
+insert into car.notices
|
|
|
|
+(
|
|
|
|
+year_month,
|
|
|
|
+city,
|
|
|
|
+content,
|
|
|
|
+create_time
|
|
|
|
+)
|
|
|
|
+values
|
|
|
|
+<foreach collection="list" item="item" index="index" separator=",">
|
|
|
|
+(
|
|
|
|
+#{item.yearMonth},
|
|
|
|
+#{item.city},
|
|
|
|
+#{item.content},
|
|
|
|
+#{item.createTime}
|
|
|
|
+)
|
|
|
|
+</foreach>
|
|
|
|
+</script>
|
|
|
|
+""")
|
|
|
|
+ int insertBatchCarNotices(List<CarNoticesPo> list);
|
|
|
|
+}
|