IncomeOnlineBillSmapper.xml
11.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.zteits.order.mapper.smapper.IncomeOnlineBillSmapper">
<resultMap id="BaseResultMap" type="com.zteits.order.domain.IncomeOnlineBill">
<id column="id" jdbcType="BIGINT" property="id" />
<result column="check_date" jdbcType="DATE" property="checkDate" />
<result column="org_id" jdbcType="BIGINT" property="orgId" />
<result column="org_name" jdbcType="BIGINT" property="orgName" />
<result column="order_act_fee_total" jdbcType="BIGINT" property="orderActFeeTotal" />
<result column="park_act_fee" jdbcType="BIGINT" property="parkActFee" />
<result column="park_ali_fee" jdbcType="BIGINT" property="parkAliFee" />
<result column="park_ali_charge_num" jdbcType="INTEGER" property="parkAliChargeNum" />
<result column="park_wx_fee" jdbcType="BIGINT" property="parkWxFee" />
<result column="park_wx_charge_num" jdbcType="INTEGER" property="parkWxChargeNum" />
<result column="vip_act_fee" jdbcType="BIGINT" property="vipActFee" />
<result column="vip_ali_fee" jdbcType="BIGINT" property="vipAliFee" />
<result column="vip_ali_charge_num" jdbcType="INTEGER" property="vipAliChargeNum" />
<result column="vip_wx_fee" jdbcType="BIGINT" property="vipWxFee" />
<result column="vip_wx_charge_num" jdbcType="INTEGER" property="vipWxChargeNum" />
<result column="back_act_fee" jdbcType="BIGINT" property="backActFee" />
<result column="back_ali_fee" jdbcType="BIGINT" property="backAliFee" />
<result column="back_ali_charge_num" jdbcType="INTEGER" property="backAliChargeNum" />
<result column="back_wx_fee" jdbcType="BIGINT" property="backWxFee" />
<result column="back_wx_charge_num" jdbcType="INTEGER" property="backWxChargeNum" />
<result column="app_act_fee" jdbcType="BIGINT" property="appActFee" />
<result column="app_ali_fee" jdbcType="BIGINT" property="appAliFee" />
<result column="app_ali_charge_num" jdbcType="INTEGER" property="appAliChargeNum" />
<result column="app_wx_fee" jdbcType="BIGINT" property="appWxFee" />
<result column="app_wx_charge_num" jdbcType="INTEGER" property="appWxChargeNum" />
<result column="pda_act_fee" jdbcType="BIGINT" property="pdaActFee" />
<result column="pda_ali_fee" jdbcType="BIGINT" property="pdaAliFee" />
<result column="pda_ali_charge_num" jdbcType="INTEGER" property="pdaAliChargeNum" />
<result column="pda_wx_fee" jdbcType="BIGINT" property="pdaWxFee" />
<result column="pda_wx_charge_num" jdbcType="INTEGER" property="pdaWxChargeNum" />
<result column="refund_act_fee" jdbcType="BIGINT" property="refundActFee" />
<result column="refund_ali_fee" jdbcType="BIGINT" property="refundAliFee" />
<result column="refund_ali_charge_num" jdbcType="INTEGER" property="refundAliChargeNum" />
<result column="refund_wx_fee" jdbcType="BIGINT" property="refundWxFee" />
<result column="refund_wx_charge_num" jdbcType="INTEGER" property="refundWxChargeNum" />
<result column="data_state" jdbcType="INTEGER" property="dataState" />
<result column="create_emp_id" jdbcType="VARCHAR" property="createEmpId" />
<result column="create_emp_name" jdbcType="VARCHAR" property="createEmpName" />
<result column="create_date" jdbcType="TIMESTAMP" property="createDate" />
<result column="modfiy_emp_id" jdbcType="VARCHAR" property="modfiyEmpId" />
<result column="modfiy_emp_name" jdbcType="VARCHAR" property="modfiyEmpName" />
<result column="modfiy_date" jdbcType="TIMESTAMP" property="modfiyDate" />
<result column="remark" jdbcType="VARCHAR" property="remark" />
</resultMap>
<sql id="Base_Column_List">
id, check_date, org_id, org_name, order_act_fee_total, park_act_fee, park_ali_fee,
park_ali_charge_num, park_wx_fee, park_wx_charge_num, vip_act_fee, vip_ali_fee, vip_ali_charge_num,
vip_wx_fee, vip_wx_charge_num, back_act_fee, back_ali_fee, back_ali_charge_num, back_wx_fee,
back_wx_charge_num, app_act_fee, app_ali_fee, app_ali_charge_num, app_wx_fee, app_wx_charge_num,
pda_act_fee, pda_ali_fee, pda_ali_charge_num, pda_wx_fee, pda_wx_charge_num, refund_act_fee,
refund_ali_fee, refund_ali_charge_num, refund_wx_fee, refund_wx_charge_num, data_state,
create_emp_id, create_emp_name, create_date, modfiy_emp_id, modfiy_emp_name, modfiy_date,
remark
</sql>
<select id="queryIncomeOnlineBillByTime" resultType="com.zteits.order.domain.IncomeOnlineBill">
SELECT
DATE_FORMAT(a.pay_finish_time, '%Y-%m-%d') AS checkDate,
a.org_id as orgId,
/********************临时停车收入*********************/
IFNULL(sum(case when a.pay_order_type in(101,102) then IFNULL(a.order_act_fee, 0) end),0) as parkActFee,
IFNULL(sum(case when a.pay_order_type in(101,102) and a.pay_type=1 then IFNULL(a.order_act_fee, 0) end),0) as parkAliFee,
sum(CASE WHEN a.pay_order_type in(101, 102) and a.pay_type = 1 THEN 1 ELSE 0 END) parkAliChargeNum,
IFNULL(sum(case when a.pay_order_type in(101,102) and a.pay_type in(2,4) then IFNULL(a.order_act_fee, 0) end),0) as parkWxFee,
sum(CASE WHEN a.pay_order_type in(101, 102) and a.pay_type IN (2, 4) THEN 1 ELSE 0 END) parkWxChargeNum,
/**********************补缴*********************/
/**总补缴实收 单位:分1*/
IFNULL(sum(case when a.pay_order_type =103 then IFNULL(a.order_act_fee, 0) end),0) as backActFee,
/**补缴支付宝实收*/
IFNULL(sum(CASE WHEN a.pay_order_type =103 and a.pay_type = 1 THEN IFNULL(a.order_act_fee, 0)ELSE 0 END),0) as backAliFee,
/**补缴支付宝次数*/
sum(CASE WHEN a.pay_order_type =103 and a.pay_type = 1 THEN 1 ELSE 0 END) backAliChargeNum,
/**补缴微信收入*/
IFNULL(sum(CASE WHEN a.pay_order_type =103 and a.pay_type IN (2, 4) THEN IFNULL(a.order_act_fee, 0) ELSE 0 END),0) backWxFee,
/**补缴微信次数*/
sum(CASE WHEN a.pay_order_type =103 and a.pay_type IN (2, 4) THEN 1 ELSE 0 END) backWxChargeNum,
/**********************会员卡*********************/
IFNULL(sum(case when a.pay_order_type in(301,302) then IFNULL(a.order_act_fee, 0) end),0) as vipActFee,
/**会员卡支付宝实收*/
IFNULL(sum(CASE WHEN a.pay_order_type in(301,302) and a.pay_type = 1 THEN IFNULL(a.order_act_fee, 0) ELSE 0 END),0) vipAliFee,
/**会员卡支付宝次数*/
sum(CASE WHEN a.pay_order_type in(301,302) and a.pay_type = 1 THEN 1 ELSE 0 END) vipAliChargeNum,
/**会员卡微信收入*/
IFNULL(sum(CASE WHEN a.pay_order_type in(301,302) and a.pay_type IN (2, 4) THEN IFNULL(a.order_act_fee, 0) ELSE 0 END),0) vipWxFee,
/**会员卡微信次数*/
sum(CASE WHEN a.pay_order_type in(301,302) and a.pay_type IN (2, 4) THEN 1 ELSE 0 END) vipWxChargeNum,
/**********************APP充值*********************/
IFNULL(sum(case when a.pay_order_type in(201,202) and a.terminal_source=1 then IFNULL(a.order_act_fee, 0) end),0) as appActFee,
IFNULL(sum(case when a.pay_order_type in(201,202) and a.pay_type=1 and a.terminal_source=1 then IFNULL(a.order_act_fee, 0) end),0) as appAliFee,
sum(CASE WHEN a.pay_order_type in(201, 202) and a.pay_type = 1 and a.terminal_source=1 THEN 1 ELSE 0 END) appAliChargeNum,
IFNULL(sum(case when a.pay_order_type in(201,202) and a.pay_type in(2,4) and a.terminal_source=1 then IFNULL(a.order_act_fee, 0) end),0) as appWxFee,
sum(CASE WHEN a.pay_order_type in(201, 202) and a.pay_type IN (2, 4) and a.terminal_source=1 THEN 1 ELSE 0 END) appWxChargeNum,
/**********************PDA充值*********************/
IFNULL(sum(case when a.pay_order_type in(201,202) and a.terminal_source=2 then IFNULL(a.order_act_fee, 0) end),0) as pdaActFee,
IFNULL(sum(case when a.pay_order_type in(201,202) and a.pay_type=1 and a.terminal_source=2 then IFNULL(a.order_act_fee, 0) end),0) as pdaAliFee,
sum(CASE WHEN a.pay_order_type in(201, 202) and a.pay_type = 1 and a.terminal_source=2 THEN 1 ELSE 0 END) pdaAliChargeNum,
IFNULL(sum(case when a.pay_order_type in(201,202) and a.pay_type in(2,4) and a.terminal_source=2 then IFNULL(a.order_act_fee, 0) end),0) as pdaWxFee,
sum(CASE WHEN a.pay_order_type in(201, 202) and a.pay_type IN (2, 4) and a.terminal_source=2 THEN 1 ELSE 0 END) parkWxChargeNum
FROM
pay_order_success a
WHERE
1 = 1
AND a.data_state = 1
AND a.pay_type in(1,2,4)
AND a.pay_finish_time between #{startDate} and #{endDate}
group by DATE_FORMAT(a.pay_finish_time, '%Y-%m-%d'),a.org_id
</select>
<select id="queryIncomeOnlineBillSummary" parameterType="com.zteits.clouds.api.dto.clouds.param.IncomeOnlineBillRequest"
resultType="com.zteits.clouds.api.dto.clouds.dto.IncomeOnlineBillSummaryDTO">
select
DATE_FORMAT(check_date,'%Y-%m-%d') as checkDate,
IFNULL(SUM(order_act_fee_total),0) AS summaryTotalFee,
IFNULL(SUM(park_ali_fee + vip_ali_fee + back_ali_fee + app_ali_fee + pda_ali_fee),0) AS aliTotalFee,
IFNULL(SUM(park_wx_fee + vip_wx_fee + back_wx_fee + app_wx_fee + pda_wx_fee),0) AS wxTotalFee,
IFNULL(SUM(refund_act_fee),0) AS backTotalFee
FROM
income_online_bill
WHERE
1 = 1
AND data_state = 1
AND check_date between #{beginTime} and #{endTime}
AND org_id = #{orgId}
</select>
<select id="queryIncomeOnlineBillForPage" parameterType="com.zteits.clouds.api.dto.clouds.param.IncomeOnlineBillRequest"
resultType="com.zteits.clouds.api.dto.clouds.dto.IncomeOnlineBillDTO">
select
DATE_FORMAT(check_date,'%Y-%m-%d') as checkDate,
IFNULL(SUM(order_act_fee_total),0) orderActFeeTotal,
IFNULL(SUM(park_act_fee),0) parkActFee,
IFNULL(SUM(park_ali_fee),0) parkAliFee,
IFNULL(SUM(park_ali_charge_num),0) parkAliChargeNum,
IFNULL(SUM(park_wx_fee),0) parkWxFee,
IFNULL(SUM(park_wx_charge_num),0) parkWxChargeNum,
IFNULL(SUM(vip_act_fee),0) vipActFee,
IFNULL(SUM(vip_ali_fee),0) vipAliFee,
IFNULL(SUM(vip_ali_charge_num),0) vipAliChargeNum,
IFNULL(SUM(vip_wx_fee),0) vipWxFee,
IFNULL(SUM(vip_wx_charge_num),0) vipWxChargeNum,
IFNULL(SUM(back_act_fee),0) backActFee,
IFNULL(SUM(back_ali_fee),0) backAliFee,
IFNULL(SUM(back_ali_charge_num),0) backAliChargeNum,
IFNULL(SUM(back_wx_fee),0) backWxFee,
IFNULL(SUM(back_wx_charge_num),0) backWxChargeNum,
IFNULL(SUM(app_act_fee),0) appActFee,
IFNULL(SUM(app_ali_fee),0) appAliFee,
IFNULL(SUM(app_ali_charge_num),0) appAliChargeNum,
IFNULL(SUM(app_wx_fee),0) appWxFee,
IFNULL(SUM(app_wx_charge_num),0) appWxChargeNum,
IFNULL(SUM(pda_act_fee),0) pdaActFee,
IFNULL(SUM(pda_ali_fee),0) pdaAliFee,
IFNULL(SUM(pda_ali_charge_num),0) pdaAliChargeNum,
IFNULL(SUM(pda_wx_fee),0) pdaWxFee,
IFNULL(SUM(pda_wx_charge_num),0) pdaWxChargeNum,
IFNULL(SUM(refund_act_fee),0) refundActFee,
IFNULL(SUM(refund_ali_fee),0) refundAliFee,
IFNULL(SUM(refund_ali_charge_num),0) refundAliChargeNum,
IFNULL(SUM(refund_wx_fee),0) refundWxFee,
IFNULL(SUM(refund_wx_charge_num),0) refundWxChargeNum,
IFNULL(SUM(park_ali_fee + vip_ali_fee + back_ali_fee + app_ali_fee + pda_ali_fee),0) AS aliTotalFee,
IFNULL(SUM(park_wx_fee + vip_wx_fee + back_wx_fee + app_wx_fee + pda_wx_fee),0) AS wxTotalFee
FROM
income_online_bill
WHERE
1 = 1
AND data_state = 1
AND check_date between #{beginTime} and #{endTime}
AND org_id = #{orgId}
GROUP BY check_date,org_id
ORDER BY checkDate
</select>
</mapper>