后台-充值-成功订单包含已退款订单

This commit is contained in:
khalil
2023-10-12 14:40:50 +08:00
parent d69b1837de
commit 3ef422b6c5
16 changed files with 65 additions and 64 deletions

View File

@@ -50,8 +50,8 @@ public class AnalysisAdminServiceImpl implements AnalysisAdminService {
continue; continue;
} }
List<Long> fromUids = jdbcTemplate.query("select hrcr.from_uid as fromUid from hall_room_chat_record as hrcr where (hrcr.to_uid = " + uid + " or hrcr.from_uid = " + uid + ") and hrcr.conv_type = 'PERSON' order by hrcr.id limit 1", (rs, i) -> rs.getLong("fromUid")); List<Long> fromUids = jdbcTemplate.query("select hrcr.from_uid as fromUid from hall_room_chat_record as hrcr where (hrcr.to_uid = " + uid + " or hrcr.from_uid = " + uid + ") and hrcr.conv_type = 'PERSON' order by hrcr.id limit 1", (rs, i) -> rs.getLong("fromUid"));
List<String> createTimes = jdbcTemplate.query("select DATE_FORMAT(cr.create_time, '%Y-%m-%d %H:%i:%s') as createTime from charge_record as cr where cr.uid = " + uid + " and cr.charge_status = 2 order by cr.create_time limit 1", (rs, i) -> rs.getString("createTime")); List<String> createTimes = jdbcTemplate.query("select DATE_FORMAT(cr.create_time, '%Y-%m-%d %H:%i:%s') as createTime from charge_record as cr where cr.uid = " + uid + " and cr.charge_status in (2,6) order by cr.create_time limit 1", (rs, i) -> rs.getString("createTime"));
List<Double> amounts = jdbcTemplate.query("select (cr.amount / 100) as amount from charge_record as cr where cr.uid = " + uid + " and cr.charge_status = 2 order by cr.create_time limit 1", (rs, i) -> rs.getDouble("amount")); List<Double> amounts = jdbcTemplate.query("select (cr.amount / 100) as amount from charge_record as cr where cr.uid = " + uid + " and cr.charge_status in (2,6) order by cr.create_time limit 1", (rs, i) -> rs.getDouble("amount"));
List<String> msgTypes = jdbcTemplate.query("select (case hrcr.msg_type when 'TEXT' then '文字' when 'PICTURE' then '图片' else '无' end) as msgType from hall_room_chat_record as hrcr where (hrcr.to_uid = " + uid + " or hrcr.from_uid = " + uid + ") and hrcr.conv_type = 'PERSON' order by hrcr.id limit 1", (rs, i) -> rs.getString("msgType")); List<String> msgTypes = jdbcTemplate.query("select (case hrcr.msg_type when 'TEXT' then '文字' when 'PICTURE' then '图片' else '无' end) as msgType from hall_room_chat_record as hrcr where (hrcr.to_uid = " + uid + " or hrcr.from_uid = " + uid + ") and hrcr.conv_type = 'PERSON' order by hrcr.id limit 1", (rs, i) -> rs.getString("msgType"));
int isInitiative = 0; int isInitiative = 0;
if (CollectionUtil.isNotEmpty(fromUids)) { if (CollectionUtil.isNotEmpty(fromUids)) {

View File

@@ -40,7 +40,7 @@
<select id="listFisrChargeRecordByUids" resultType="com.accompany.payment.model.ChargeRecord"> <select id="listFisrChargeRecordByUids" resultType="com.accompany.payment.model.ChargeRecord">
select charge_record_id, cr.uid, cr.create_time from charge_record cr select charge_record_id, cr.uid, cr.create_time from charge_record cr
inner join (select uid, min(create_time) create_time from charge_record inner join (select uid, min(create_time) create_time from charge_record
where uid in <foreach collection="uids" item="uid" separator="," open="(" close=")">#{uid}</foreach> and charge_status = 2 group by uid) crg where uid in <foreach collection="uids" item="uid" separator="," open="(" close=")">#{uid}</foreach> and charge_status in (2,6) group by uid) crg
on cr.uid = crg.uid and cr.create_time = crg.create_time on cr.uid = crg.uid and cr.create_time = crg.create_time
</select> </select>
@@ -49,7 +49,7 @@
sum(case when channel = 'payermax' then total_gold else 0 end) payermaxGold, sum(case when channel = 'payermax' then total_gold else 0 end) payermaxGold,
sum(case when channel = 'ios_pay' then total_gold else 0 end) iosGold, sum(case when channel = 'ios_pay' then total_gold else 0 end) iosGold,
sum(total_gold) totalGold from charge_record sum(total_gold) totalGold from charge_record
where charge_status = 2 where charge_status in (2,6)
<if test="startTime != null"> <if test="startTime != null">
and create_time &gt;= #{startTime} and create_time &gt;= #{startTime}
</if> </if>

View File

@@ -49,7 +49,7 @@
select select
count(distinct cr.uid) count(distinct cr.uid)
from charge_record as cr from charge_record as cr
where cr.charge_status = 2 where cr.charge_status in (2,6)
and cr.uid in ( and cr.uid in (
select select
distinct u.uid distinct u.uid
@@ -84,7 +84,7 @@
select select
distinct cr.uid as uid distinct cr.uid as uid
from charge_record as cr from charge_record as cr
where cr.charge_status = 2 and cr.uid in ( where cr.charge_status in (2,6) and cr.uid in (
select select
distinct u.uid distinct u.uid
from users as u from users as u
@@ -113,7 +113,7 @@
select select
ifnull((sum(ifnull(cr.amount, 0)) / 100), 0) as chargeAmount ifnull((sum(ifnull(cr.amount, 0)) / 100), 0) as chargeAmount
from charge_record as cr from charge_record as cr
where cr.charge_status = 2 where cr.charge_status in (2,6)
and cr.uid in ( and cr.uid in (
select select
distinct u.uid distinct u.uid
@@ -237,7 +237,7 @@
(sum(cr.amount) / 100) as chargeAmount (sum(cr.amount) / 100) as chargeAmount
from charge_record as cr from charge_record as cr
left join users as u on u.uid = cr.uid left join users as u on u.uid = cr.uid
where cr.charge_status = 2 where cr.charge_status in (2,6)
and cr.create_time between #{startTime} and #{endTime} and cr.create_time between #{startTime} and #{endTime}
<if test="erBanNos != null and erBanNos.size > 0"> <if test="erBanNos != null and erBanNos.size > 0">
and u.erban_no in and u.erban_no in

View File

@@ -15,7 +15,7 @@
0 total_send_gift 0 total_send_gift
from account a, users u from account a, users u
left join charge_record cr left join charge_record cr
on cr.uid = u.uid and cr.charge_status = 2 and cr.charge_prod_id &lt;&gt; 'exchange' on cr.uid = u.uid and cr.charge_status in (2,6) and cr.charge_prod_id &lt;&gt; 'exchange'
<if test="params.groupApps != null and params.groupApps.size > 0" > <if test="params.groupApps != null and params.groupApps.size > 0" >
and cr.charge_app in and cr.charge_app in
<foreach collection="params.groupApps" item="signUpApp" open="(" separator="," close=")"> <foreach collection="params.groupApps" item="signUpApp" open="(" separator="," close=")">
@@ -132,7 +132,7 @@
user_invite_code uic, user_invite_code uic,
account a, users u account a, users u
left join charge_record cr left join charge_record cr
on cr.uid = u.uid and cr.charge_status = 2 and cr.charge_prod_id &lt;&gt; 'exchange' on cr.uid = u.uid and cr.charge_status in (2,6) and cr.charge_prod_id &lt;&gt; 'exchange'
<if test="groupApps != null and groupApps.size > 0" > <if test="groupApps != null and groupApps.size > 0" >
and cr.charge_app in and cr.charge_app in
<foreach collection="groupApps" item="signUpApp" open="(" separator="," close=")"> <foreach collection="groupApps" item="signUpApp" open="(" separator="," close=")">
@@ -230,7 +230,7 @@
user_invite_code uic, user_invite_code uic,
account a, users u account a, users u
left join charge_record cr left join charge_record cr
on cr.uid = u.uid and cr.charge_status = 2 and cr.charge_prod_id &lt;&gt; 'exchange' on cr.uid = u.uid and cr.charge_status in (2,6) and cr.charge_prod_id &lt;&gt; 'exchange'
<if test="groupApps != null and groupApps.size > 0" > <if test="groupApps != null and groupApps.size > 0" >
and cr.charge_app in and cr.charge_app in
<foreach collection="groupApps" item="signUpApp" open="(" separator="," close=")"> <foreach collection="groupApps" item="signUpApp" open="(" separator="," close=")">
@@ -337,7 +337,7 @@
from flow_team_member_invite_user ftmiu from flow_team_member_invite_user ftmiu
inner join users u on ftmiu.uid = u.uid inner join users u on ftmiu.uid = u.uid
left join charge_record cr left join charge_record cr
on cr.uid = u.uid and cr.charge_status = 2 on cr.uid = u.uid and cr.charge_status in (2,6)
and cr.charge_prod_id &lt;&gt; 'exchange' and cr.buss_type in (0,4) and cr.charge_prod_id &lt;&gt; 'exchange' and cr.buss_type in (0,4)
and cr.create_time >= u.create_time and cr.create_time >= u.create_time
<if test="params.groupApps != null and params.groupApps.size > 0" > <if test="params.groupApps != null and params.groupApps.size > 0" >
@@ -440,7 +440,7 @@
inner join users u on fu.uid = u.uid inner join users u on fu.uid = u.uid
left join flow_team_member tm on tm.member_id = fu.member_id left join flow_team_member tm on tm.member_id = fu.member_id
left join charge_record cr left join charge_record cr
on cr.uid = u.uid and cr.charge_status = 2 and cr.charge_prod_id &lt;&gt; 'exchange' and cr.buss_type in (0,4) on cr.uid = u.uid and cr.charge_status in (2,6) and cr.charge_prod_id &lt;&gt; 'exchange' and cr.buss_type in (0,4)
and cr.create_time >= u.create_time and cr.create_time >= u.create_time
<if test="groupApps != null and groupApps.size > 0" > <if test="groupApps != null and groupApps.size > 0" >
and cr.charge_app in and cr.charge_app in
@@ -524,7 +524,7 @@
</if> </if>
left join flow_team_member tm on u.member_id = tm.member_id left join flow_team_member tm on u.member_id = tm.member_id
left join charge_record cr left join charge_record cr
on cr.uid = u.uid and cr.charge_status = 2 and cr.charge_prod_id &lt;&gt; 'exchange' on cr.uid = u.uid and cr.charge_status in (2,6) and cr.charge_prod_id &lt;&gt; 'exchange'
and cr.buss_type in (0,4) and cr.buss_type in (0,4)
<if test="groupApps != null and groupApps.size > 0" > <if test="groupApps != null and groupApps.size > 0" >
and cr.charge_app in and cr.charge_app in

View File

@@ -20,14 +20,14 @@
WHERE a.create_time BETWEEN #{startTime} AND #{endTime} WHERE a.create_time BETWEEN #{startTime} AND #{endTime}
and b.create_time between #{startTime} and #{endTime} and b.create_time between #{startTime} and #{endTime}
and b.def_user = 1 and b.def_user = 1
and a.charge_status=2 and a.channel &lt;&gt; 'exchange' and a.charge_status in (2,6) and a.channel &lt;&gt; 'exchange'
</select> </select>
<select id="newUserPayNum" resultType="java.lang.Integer"> <select id="newUserPayNum" resultType="java.lang.Integer">
SELECT count(DISTINCT(a.uid)) FROM charge_record AS a SELECT count(DISTINCT(a.uid)) FROM charge_record AS a
JOIN users AS b ON a.uid=b.uid JOIN users AS b ON a.uid=b.uid
WHERE a.create_time BETWEEN #{startTime} AND #{endTime} WHERE a.create_time BETWEEN #{startTime} AND #{endTime}
and b.create_time between #{startTime} and #{endTime} and b.create_time between #{startTime} and #{endTime}
and a.charge_status=2 and a.channel &lt;&gt; 'exchange' and a.charge_status in (2,6) and a.channel &lt;&gt; 'exchange'
and b.def_user = 1 and b.def_user = 1
</select> </select>
<select id="newUserSendGiftAmount" resultType="java.lang.Integer"> <select id="newUserSendGiftAmount" resultType="java.lang.Integer">

View File

@@ -37,6 +37,7 @@
<option value="">全部</option> <option value="">全部</option>
<option value="1">发起充值</option> <option value="1">发起充值</option>
<option value="2">充值成功</option> <option value="2">充值成功</option>
<option value="6">已退款</option>
</select> </select>
</div> </div>
<div class="form-group"> <div class="form-group">
@@ -83,12 +84,13 @@
{field: 'pingxxChargeId', title: '第三方订单号', align: 'center', width: '5%'}, {field: 'pingxxChargeId', title: '第三方订单号', align: 'center', width: '5%'},
{field: 'status', title: '状态', align: 'center', width: '5%', {field: 'status', title: '状态', align: 'center', width: '5%',
formatter: function (val, row, index) { formatter: function (val, row, index) {
if (val == 2) { if (val == 1) {
return '充值成功';
} else {
return '发起充值'; return '发起充值';
} else if (val == 2) {
return '充值成功';
} else if (val == 6) {
return '已退款';
} }
}}, }},
{field: 'newUser', title: '是否新用户', align: 'center', width: '5%', {field: 'newUser', title: '是否新用户', align: 'center', width: '5%',
formatter: function (val, row, index) { formatter: function (val, row, index) {

View File

@@ -52,7 +52,7 @@
and u.invite_code = uic.invite_code and u.invite_code = uic.invite_code
and a.uid = u.uid and a.uid = u.uid
and cr.uid = u.uid and cr.uid = u.uid
and cr.charge_status = 2 and cr.charge_status in (2,6)
and cr.charge_prod_id &lt;&gt; 'exchange' and cr.charge_prod_id &lt;&gt; 'exchange'
<if test="startDate != null"> <if test="startDate != null">
and u.create_time &gt;= #{startDate} and u.create_time &gt;= #{startDate}
@@ -129,7 +129,7 @@
user_invite_code uic, user_invite_code uic,
account a, users u account a, users u
left join charge_record cr left join charge_record cr
on cr.uid = u.uid and cr.charge_status = 2 and cr.charge_prod_id &lt;&gt; 'exchange' on cr.uid = u.uid and cr.charge_status in (2,6) and cr.charge_prod_id &lt;&gt; 'exchange'
<if test="chargeStartTime != null and chargeStartTime != '' "> <if test="chargeStartTime != null and chargeStartTime != '' ">
and cr.create_time &gt;= #{chargeStartTime} and cr.create_time &gt;= #{chargeStartTime}
</if> </if>
@@ -234,7 +234,7 @@
<select id="listUserChargeDetails" resultType="com.accompany.flowteam.admin.vo.UserChargeDetailVO"> <select id="listUserChargeDetails" resultType="com.accompany.flowteam.admin.vo.UserChargeDetailVO">
select u.erban_no userErbanNo, u.nick userNick, cr.create_time chargeTime, cr.channel, cr.amount/100 amount, cr.total_gold totalGold from charge_record cr, users u select u.erban_no userErbanNo, u.nick userNick, cr.create_time chargeTime, cr.channel, cr.amount/100 amount, cr.total_gold totalGold from charge_record cr, users u
where u.uid = cr.uid where u.uid = cr.uid
and cr.charge_status = 2 and cr.charge_status in (2,6)
and cr.charge_prod_id &lt;&gt; 'exchange' and cr.charge_prod_id &lt;&gt; 'exchange'
and cr.buss_type in (0,4) and cr.buss_type in (0,4)
and cr.uid = #{uid} and cr.uid = #{uid}
@@ -258,7 +258,7 @@
select u.erban_no userErbanNo, u.nick userNick, cr.create_time chargeTime, cr.channel, select u.erban_no userErbanNo, u.nick userNick, cr.create_time chargeTime, cr.channel,
cr.amount/100 amount, cr.total_gold totalGold from charge_record cr, users u cr.amount/100 amount, cr.total_gold totalGold from charge_record cr, users u
where u.uid = cr.uid where u.uid = cr.uid
and cr.charge_status = 2 and cr.charge_status in (2,6)
and cr.charge_prod_id &lt;&gt; 'exchange' and cr.charge_prod_id &lt;&gt; 'exchange'
and cr.buss_type in (0,4) and cr.buss_type in (0,4)
and cr.uid = #{uid} and cr.uid = #{uid}
@@ -309,7 +309,7 @@
0 total_send_gift 0 total_send_gift
from flow_team_member_invite_user fu, users u, charge_record cr from flow_team_member_invite_user fu, users u, charge_record cr
where fu.uid = u.uid and cr.uid = u.uid and cr.create_time >= u.create_time where fu.uid = u.uid and cr.uid = u.uid and cr.create_time >= u.create_time
and cr.charge_status = 2 and cr.charge_status in (2,6)
and cr.charge_prod_id &lt;&gt; 'exchange' and cr.charge_prod_id &lt;&gt; 'exchange'
and cr.buss_type in (0,4) and cr.buss_type in (0,4)
<if test="startDate != null"> <if test="startDate != null">
@@ -388,7 +388,7 @@
left join users u on u.uid = fu.uid left join users u on u.uid = fu.uid
left join flow_team_member tm on fu.member_id = tm.member_id left join flow_team_member tm on fu.member_id = tm.member_id
left join charge_record cr left join charge_record cr
on cr.uid = fu.uid and cr.charge_status = 2 and cr.charge_prod_id &lt;&gt; 'exchange' on cr.uid = fu.uid and cr.charge_status in (2,6) and cr.charge_prod_id &lt;&gt; 'exchange'
and cr.buss_type in (0,4) and cr.buss_type in (0,4)
<if test="chargeStartTime != null and chargeStartTime != '' "> <if test="chargeStartTime != null and chargeStartTime != '' ">
and cr.create_time &gt;= #{chargeStartTime} and cr.create_time &gt;= #{chargeStartTime}
@@ -509,7 +509,7 @@
and u.erban_no = #{erbanNo,jdbcType=BIGINT}) a and u.erban_no = #{erbanNo,jdbcType=BIGINT}) a
left join charge_record cr left join charge_record cr
on a.uid = cr.uid on a.uid = cr.uid
and cr.charge_status = 2 and cr.charge_status in (2,6)
and cr.charge_prod_id &lt;&gt; 'exchange' and cr.charge_prod_id &lt;&gt; 'exchange'
and cr.buss_type in (0, 4) and cr.buss_type in (0, 4)
and cr.create_time > a.create_time and cr.create_time > a.create_time

View File

@@ -597,7 +597,7 @@
select users.erban_no, users.nick, sum(charge_record.amount) / 100 as amountSum from charge_record inner join select users.erban_no, users.nick, sum(charge_record.amount) / 100 as amountSum from charge_record inner join
users users
on charge_record.uid = users.uid on charge_record.uid = users.uid
where charge_status = 2 where charge_status in (2,6)
<if test="startDate != null and startDate != ''"> <if test="startDate != null and startDate != ''">
and charge_record.create_time &gt;= #{startDate} and charge_record.create_time &gt;= #{startDate}
</if> </if>

View File

@@ -73,11 +73,11 @@
</resultMap> </resultMap>
<select id="getHistoryRechargeAmount" resultType="java.lang.Long"> <select id="getHistoryRechargeAmount" resultType="java.lang.Long">
select sum(amount) from charge_record WHERE buss_type in (0,4) and charge_status = 2 and uid = #{userId} and channel &lt;&gt; 'exchange'; select sum(amount) from charge_record WHERE buss_type in (0,4) AND charge_status in (2,6) and uid = #{userId} and channel &lt;&gt; 'exchange';
</select> </select>
<select id="getHistoryRechargeCount" resultType="java.lang.Integer"> <select id="getHistoryRechargeCount" resultType="java.lang.Integer">
select count(1) from charge_record WHERE buss_type in (0,4) and charge_status = 2 and uid = #{userId} and channel &lt;&gt; 'exchange'; select count(1) from charge_record WHERE buss_type in (0,4) AND charge_status in (2,6) and uid = #{userId} and channel &lt;&gt; 'exchange';
</select> </select>
<select id="getUserChargeRecordFromSpecialChannel" resultMap="BaseResultMap"> <select id="getUserChargeRecordFromSpecialChannel" resultMap="BaseResultMap">
@@ -87,7 +87,7 @@
<if test="erbanNo != null"> <if test="erbanNo != null">
and u.erban_no= #{erbanNo,jdbcType=BIGINT} and u.erban_no= #{erbanNo,jdbcType=BIGINT}
</if> </if>
and cr.charge_status = 2 and cr.charge_status in (2,6)
and cr.channel NOT IN ('exchange', 'company') and cr.channel NOT IN ('exchange', 'company')
and u.channel = #{channel,jdbcType=VARCHAR} and u.channel = #{channel,jdbcType=VARCHAR}
-- and u.channel IN ('appstore_yy') -- and u.channel IN ('appstore_yy')
@@ -105,7 +105,7 @@
<if test="erbanNo != null"> <if test="erbanNo != null">
and u.erban_no= #{erbanNo,jdbcType=BIGINT} and u.erban_no= #{erbanNo,jdbcType=BIGINT}
</if> </if>
and cr.charge_status = 2 and cr.charge_status in (2,6)
and cr.channel NOT IN ('exchange', 'company') and cr.channel NOT IN ('exchange', 'company')
and u.channel = #{channel,jdbcType=VARCHAR} and u.channel = #{channel,jdbcType=VARCHAR}
-- and u.channel IN ('appstore_yy') -- and u.channel IN ('appstore_yy')
@@ -121,7 +121,7 @@
<if test="erbanNo != null"> <if test="erbanNo != null">
and u.erban_no= #{erbanNo,jdbcType=BIGINT} and u.erban_no= #{erbanNo,jdbcType=BIGINT}
</if> </if>
and cr.charge_status = 2 and cr.charge_status in (2,6)
and cr.channel NOT IN ('exchange', 'company') and cr.channel NOT IN ('exchange', 'company')
and u.channel IN ('appstore_yy') and u.channel IN ('appstore_yy')
<if test="startTime != null and endTime != null"> <if test="startTime != null and endTime != null">
@@ -137,7 +137,7 @@
#{item} #{item}
</foreach> </foreach>
AND channel != 'exchange' AND channel != 'exchange'
AND charge_status = 2 AND charge_status in (2,6)
AND create_time between #{startTime} and #{endTime}; AND create_time between #{startTime} and #{endTime};
</select> </select>
@@ -146,7 +146,7 @@
FROM FROM
charge_record charge_record
WHERE DATE_FORMAT(create_time, '%Y-%m-%d')=DATE_FORMAT(NOW(), '%Y-%m-%d') WHERE DATE_FORMAT(create_time, '%Y-%m-%d')=DATE_FORMAT(NOW(), '%Y-%m-%d')
AND charge_status=2 AND charge_status in (2,6)
AND (channel &lt;&gt; 'exchange' or channel is null) AND (channel &lt;&gt; 'exchange' or channel is null)
</sql> </sql>
@@ -219,8 +219,7 @@
SELECT 0 as time, DATE_FORMAT(create_time, '%Y-%m-%d') as timeStr ,count(1) as count,IFNULL(channel,'companyAccount') as SELECT 0 as time, DATE_FORMAT(create_time, '%Y-%m-%d') as timeStr ,count(1) as count,IFNULL(channel,'companyAccount') as
channel,convert(sum(amount)/100,decimal(10,2)) as amount channel,convert(sum(amount)/100,decimal(10,2)) as amount
from charge_record from charge_record
where where charge_status in (2,6)
charge_status=2
AND DATE_FORMAT(create_time, '%Y-%m-%d') between #{beginDate} and #{endDate} AND DATE_FORMAT(create_time, '%Y-%m-%d') between #{beginDate} and #{endDate}
AND (channel &lt;&gt; 'exchange' or channel is null) AND (channel &lt;&gt; 'exchange' or channel is null)
GROUP BY DATE_FORMAT(create_time, '%Y-%m-%d'),channel GROUP BY DATE_FORMAT(create_time, '%Y-%m-%d'),channel
@@ -238,7 +237,7 @@
IFNULL(channel,'companyAccount') as channel, IFNULL(channel,'companyAccount') as channel,
convert(sum(amount)/100,decimal(10,2)) as amount,count(1) as count convert(sum(amount)/100,decimal(10,2)) as amount,count(1) as count
from charge_record from charge_record
where charge_status=2 where charge_status in (2,6)
AND DATE_FORMAT(create_time, '%Y-%m-%d')=#{time} AND DATE_FORMAT(create_time, '%Y-%m-%d')=#{time}
AND (channel &lt;&gt; 'exchange' or channel is null) AND (channel &lt;&gt; 'exchange' or channel is null)
GROUP BY channel; GROUP BY channel;
@@ -254,7 +253,7 @@
<select id="getChargeUserCount" resultType="java.lang.Integer"> <select id="getChargeUserCount" resultType="java.lang.Integer">
select count(distinct uid) from charge_record select count(distinct uid) from charge_record
where charge_status = 2 and channel not in ('exchange') where charge_status in (2,6) and channel not in ('exchange')
and uid in and uid in
<foreach collection="list" item="uid" open="(" separator="," close=")"> <foreach collection="list" item="uid" open="(" separator="," close=")">
#{uid} #{uid}
@@ -269,7 +268,7 @@
<select id="getChargeUserAmount" resultType="java.lang.Long"> <select id="getChargeUserAmount" resultType="java.lang.Long">
select sum(amount) from charge_record select sum(amount) from charge_record
where charge_status = 2 and channel not in ('exchange') where charge_status in (2,6) and channel not in ('exchange')
and uid in and uid in
<foreach collection="list" item="uid" open="(" separator="," close=")"> <foreach collection="list" item="uid" open="(" separator="," close=")">
#{uid} #{uid}
@@ -283,7 +282,7 @@
</select> </select>
<select id="getHistoryRechargeAmountByChannel" resultType="java.lang.Long"> <select id="getHistoryRechargeAmountByChannel" resultType="java.lang.Long">
select IFNULL(sum(amount)/100,0) from charge_record WHERE buss_type in (0,4) and charge_status = 2 and uid = #{userId} and channel &lt;&gt; 'exchange' and channel = #{channel}; select IFNULL(sum(amount)/100,0) from charge_record WHERE buss_type in (0,4) AND charge_status in (2,6) and uid = #{userId} and channel &lt;&gt; 'exchange' and channel = #{channel};
</select> </select>
<select id="getTotalRechargeMoneyByChannel" resultType="java.lang.Double"> <select id="getTotalRechargeMoneyByChannel" resultType="java.lang.Double">
@@ -311,7 +310,7 @@
<select id="getRechargeTimesByChannel" resultType="java.lang.Long"> <select id="getRechargeTimesByChannel" resultType="java.lang.Long">
select count(*) from charge_record select count(*) from charge_record
where create_time &gt; #{startTime} and create_time &lt; #{endTime} where create_time &gt; #{startTime} and create_time &lt; #{endTime}
and uid = #{uid} and channel = #{channel} and charge_status = 2 and uid = #{uid} and channel = #{channel} AND charge_status in (2,6)
</select> </select>
<select id="getRechargeMoneyByUidBetweenTime" resultType="java.lang.Long"> <select id="getRechargeMoneyByUidBetweenTime" resultType="java.lang.Long">

View File

@@ -3,7 +3,7 @@
<mapper namespace="com.accompany.business.mybatismapper.ChargeNotifyMapper"> <mapper namespace="com.accompany.business.mybatismapper.ChargeNotifyMapper">
<select id="listChargeStat" resultType="com.accompany.business.vo.ChargeNotifyVO"> <select id="listChargeStat" resultType="com.accompany.business.vo.ChargeNotifyVO">
SELECT channel chargeChannel, IF(charge_app like '%yinyou%', 'yinyou', 'PlanetStar') as chargeApp, SELECT channel chargeChannel, IF(charge_app like '%yinyou%', 'yinyou', 'PlanetStar') as chargeApp,
COALESCE(SUM(CASE WHEN charge_status = 2 THEN 1 END),0) successNum, COALESCE(SUM(CASE WHEN charge_status in (2,6) THEN 1 END),0) successNum,
COALESCE(SUM(CASE WHEN charge_status != 2 THEN 1 END),0) failNum, COALESCE(SUM(CASE WHEN charge_status != 2 THEN 1 END),0) failNum,
count(1) totalNum count(1) totalNum
from charge_record where create_time >= SUBDATE(CURRENT_TIMESTAMP,INTERVAL #{minute} MINUTE) from charge_record where create_time >= SUBDATE(CURRENT_TIMESTAMP,INTERVAL #{minute} MINUTE)
@@ -13,7 +13,7 @@
<select id="listChargeStatByRecordIdList" resultType="com.accompany.business.vo.ChargeNotifyVO"> <select id="listChargeStatByRecordIdList" resultType="com.accompany.business.vo.ChargeNotifyVO">
SELECT channel chargeChannel, IF(charge_app like '%yinyou%', 'yinyou', 'PlanetStar') as chargeApp, SELECT channel chargeChannel, IF(charge_app like '%yinyou%', 'yinyou', 'PlanetStar') as chargeApp,
COALESCE(SUM(CASE WHEN charge_status = 2 THEN 1 END),0) successNum, COALESCE(SUM(CASE WHEN charge_status in (2,6) THEN 1 END),0) successNum,
COALESCE(SUM(CASE WHEN charge_status != 2 THEN 1 END),0) failNum, COALESCE(SUM(CASE WHEN charge_status != 2 THEN 1 END),0) failNum,
count(1) totalNum count(1) totalNum
from charge_record where from charge_record where
@@ -28,7 +28,7 @@
<select id="listChargeStatByUidAndChannel" resultType="com.accompany.business.vo.ChargeNotifyVO"> <select id="listChargeStatByUidAndChannel" resultType="com.accompany.business.vo.ChargeNotifyVO">
SELECT channel chargeChannel, IF(charge_app like '%yinyou%', 'yinyou', 'PlanetStar') as chargeApp, SELECT channel chargeChannel, IF(charge_app like '%yinyou%', 'yinyou', 'PlanetStar') as chargeApp,
COALESCE(SUM(CASE WHEN charge_status = 2 THEN 1 END),0) successNum, COALESCE(SUM(CASE WHEN charge_status in (2,6) THEN 1 END),0) successNum,
COALESCE(SUM(CASE WHEN charge_status != 2 THEN 1 END),0) failNum, COALESCE(SUM(CASE WHEN charge_status != 2 THEN 1 END),0) failNum,
count(1) totalNum count(1) totalNum
from (select * from charge_record where uid = #{uid} AND channel = #{channel} order by create_time desc limit #{limitCount}) a from (select * from charge_record where uid = #{uid} AND channel = #{channel} order by create_time desc limit #{limitCount}) a

View File

@@ -13,7 +13,7 @@
charge_record charge charge_record charge
WHERE WHERE
charge.buss_type = 0 charge.buss_type = 0
AND charge.charge_status = 2 AND charge.charge_status in (2,6)
and charge.uid in and charge.uid in
<foreach item="uid" collection="uids" open="(" separator="," close=")"> <foreach item="uid" collection="uids" open="(" separator="," close=")">
#{uid} #{uid}

View File

@@ -50,14 +50,14 @@
<select id="getNewUserCharge" resultMap="BaseResultMap"> <select id="getNewUserCharge" resultMap="BaseResultMap">
select count(distinct(uid)) as rechargePerson, count(1) as rechargeNum , sum(amount/100) as rechargeAmount from charge_record select count(distinct(uid)) as rechargePerson, count(1) as rechargeNum , sum(amount/100) as rechargeAmount from charge_record
where create_time between #{beginTime} and #{endTime} and charge_status = 2 and channel not in ('exchange') where create_time between #{beginTime} and #{endTime} AND charge_status in (2,6) and channel not in ('exchange')
and uid in (SELECT uid from users where create_time between #{beginTime} and #{endTime} and def_user = 1 and new_device = 1) and uid in (SELECT uid from users where create_time between #{beginTime} and #{endTime} and def_user = 1 and new_device = 1)
and uid in (select distinct(uid) from user_in_room_record where roomUid=#{roomUid} and create_time between #{beginTime} and #{endTime}) and uid in (select distinct(uid) from user_in_room_record where roomUid=#{roomUid} and create_time between #{beginTime} and #{endTime})
</select> </select>
<select id="getNewUserChargeAmount" resultType="java.lang.Long"> <select id="getNewUserChargeAmount" resultType="java.lang.Long">
select round(sum(amount/100)) as rechargeAmount from charge_record select round(sum(amount/100)) as rechargeAmount from charge_record
where create_time between #{beginTime} and #{chargeEndTime} and charge_status = 2 and channel not in ('exchange') where create_time between #{beginTime} and #{chargeEndTime} AND charge_status in (2,6) and channel not in ('exchange')
AND uid IN (SELECT uid from users where create_time between #{beginTime} and #{endTime} and def_user = 1 and new_device = 1 ) AND uid IN (SELECT uid from users where create_time between #{beginTime} and #{endTime} and def_user = 1 and new_device = 1 )
and uid in (select distinct(uid) from user_in_room_record where roomUid=#{roomUid} and create_time between #{beginTime} and #{endTime}) and uid in (select distinct(uid) from user_in_room_record where roomUid=#{roomUid} and create_time between #{beginTime} and #{endTime})
</select> </select>
@@ -83,7 +83,7 @@
u.create_time as createTime, count(cr.charge_record_id) as chargeCount, sum(cr.amount/100) as chargeAmount u.create_time as createTime, count(cr.charge_record_id) as chargeCount, sum(cr.amount/100) as chargeAmount
from charge_record cr from charge_record cr
left join users u on u.uid = cr.uid left join users u on u.uid = cr.uid
where cr.charge_status = 2 and cr.channel not in ('exchange') where cr.charge_status in (2,6) and cr.channel not in ('exchange')
and cr.create_time BETWEEN #{beginTime} and #{endTime} and cr.create_time BETWEEN #{beginTime} and #{endTime}
AND cr.uid IN (SELECT uid from users where create_time between #{beginTime} and #{endTime} and def_user = 1 and new_device = 1) AND cr.uid IN (SELECT uid from users where create_time between #{beginTime} and #{endTime} and def_user = 1 and new_device = 1)
and cr.uid in (select distinct(uid) from user_in_room_record where roomUid=#{roomUid} and create_time between #{beginTime} and #{endTime}) and cr.uid in (select distinct(uid) from user_in_room_record where roomUid=#{roomUid} and create_time between #{beginTime} and #{endTime})
@@ -139,14 +139,14 @@
</select> </select>
<select id="getNewUserChargeRemoveCover" resultMap="BaseResultMap"> <select id="getNewUserChargeRemoveCover" resultMap="BaseResultMap">
select count(distinct(uid)) as rechargePerson, count(1) as rechargeNum , sum(amount/100) as rechargeAmount from charge_record select count(distinct(uid)) as rechargePerson, count(1) as rechargeNum , sum(amount/100) as rechargeAmount from charge_record
where create_time between #{startTime} and #{endTime} and charge_status = 2 and channel not in ('exchange') where create_time between #{startTime} and #{endTime} AND charge_status in (2,6) and channel not in ('exchange')
and uid in <foreach collection="inRoomUids" item="uid" open="(" close=")" separator=","> and uid in <foreach collection="inRoomUids" item="uid" open="(" close=")" separator=",">
#{uid} #{uid}
</foreach> </foreach>
</select> </select>
<select id="getNewUserChargeAmountRemoveCover" resultType="java.lang.Long"> <select id="getNewUserChargeAmountRemoveCover" resultType="java.lang.Long">
select round(sum(amount/100)) as rechargeAmount from charge_record select round(sum(amount/100)) as rechargeAmount from charge_record
where create_time between #{startTime} and #{chargeEndTime} and charge_status = 2 and channel not in ('exchange') where create_time between #{startTime} and #{chargeEndTime} AND charge_status in (2,6) and channel not in ('exchange')
AND uid IN <foreach collection="inRoomUids" item="uid" open="(" close=")" separator=","> AND uid IN <foreach collection="inRoomUids" item="uid" open="(" close=")" separator=",">
#{uid} #{uid}
</foreach> </foreach>
@@ -165,7 +165,7 @@
u.create_time as createTime, count(cr.charge_record_id) as chargeCount, sum(cr.amount/100) as chargeAmount u.create_time as createTime, count(cr.charge_record_id) as chargeCount, sum(cr.amount/100) as chargeAmount
from charge_record cr from charge_record cr
left join users u on u.uid = cr.uid left join users u on u.uid = cr.uid
where cr.charge_status = 2 and cr.channel not in ('exchange') where cr.charge_status in (2,6) and cr.channel not in ('exchange')
and cr.create_time BETWEEN #{startTime} and #{endTime} and cr.create_time BETWEEN #{startTime} and #{endTime}
AND cr.uid IN (select distinct uid from user_in_room_record where id in ( AND cr.uid IN (select distinct uid from user_in_room_record where id in (
select min(r.id) select min(r.id)

View File

@@ -19,7 +19,7 @@
IFNULL(sum(charge.total_gold),0) chargeNum IFNULL(sum(charge.total_gold),0) chargeNum
FROM FROM
user_draw_statis statis user_draw_statis statis
LEFT JOIN charge_record charge ON statis.uid = charge.uid AND buss_type = 0 and charge_status = 2 LEFT JOIN charge_record charge ON statis.uid = charge.uid AND buss_type = 0 AND charge_status in (2,6)
LEFT JOIN users u ON statis.uid = u.uid LEFT JOIN users u ON statis.uid = u.uid
where 1=1 where 1=1
<if test="erbanNo != null" > <if test="erbanNo != null" >

View File

@@ -323,7 +323,7 @@
</foreach> </foreach>
</if> </if>
AND buss_type in (0,4) AND buss_type in (0,4)
AND charge_status = 2 AND charge_status in (2,6)
and charge_prod_id != 'exchange' and charge_prod_id != 'exchange'
<if test="groupApps != null and groupApps.size > 0" > <if test="groupApps != null and groupApps.size > 0" >
and charge_app in and charge_app in

View File

@@ -34,7 +34,7 @@
</if> </if>
group by fm.create_time, team_id, fi.invite_code) a, users u, charge_record r group by fm.create_time, team_id, fi.invite_code) a, users u, charge_record r
where a.invite_code = u.invite_code where a.invite_code = u.invite_code
and u.uid = r.uid and r.charge_status = 2 and u.uid = r.uid and r.charge_status in (2,6)
and r.charge_prod_id != 'exchange' and r.charge_prod_id != 'exchange'
<if test="onlyQueryOld != null and onlyQueryOld"> <if test="onlyQueryOld != null and onlyQueryOld">
and date_format(r.create_time, '%Y-%m') &lt; date_format(current_timestamp, '%Y-%m') and date_format(r.create_time, '%Y-%m') &lt; date_format(current_timestamp, '%Y-%m')
@@ -54,7 +54,7 @@
</if> </if>
group by fm.create_time, team_id, fi.invite_code) a, users u , charge_record r group by fm.create_time, team_id, fi.invite_code) a, users u , charge_record r
where a.invite_code = u.invite_code where a.invite_code = u.invite_code
and u.uid = r.uid and r.charge_status = 2 and r.charge_prod_id != 'exchange' and u.uid = r.uid and r.charge_status in (2,6) and r.charge_prod_id != 'exchange'
<if test="onlyQueryOld != null and onlyQueryOld"> <if test="onlyQueryOld != null and onlyQueryOld">
and date_format(r.create_time, '%Y-%m') &lt; date_format(current_timestamp, '%Y-%m') and date_format(r.create_time, '%Y-%m') &lt; date_format(current_timestamp, '%Y-%m')
</if> </if>
@@ -79,7 +79,7 @@
and team_id = #{teamId} and team_id = #{teamId}
group by fm.create_time, team_id, fi.invite_code) a, users u , charge_record r, users u2 group by fm.create_time, team_id, fi.invite_code) a, users u , charge_record r, users u2
where a.invite_code = u.invite_code where a.invite_code = u.invite_code
and u.uid = r.uid and r.charge_status = 2 and r.charge_prod_id != 'exchange' and u.uid = r.uid and r.charge_status in (2,6) and r.charge_prod_id != 'exchange'
and u2.uid = u.invite_uid and u2.uid = u.invite_uid
and date_format(r.create_time, '%Y-%m') = #{month} and date_format(r.create_time, '%Y-%m') = #{month}
<if test="erbanNo != null and erbanNo != ''"> <if test="erbanNo != null and erbanNo != ''">
@@ -116,7 +116,7 @@
flow_team_member_invite_user fi, users u, charge_record r flow_team_member_invite_user fi, users u, charge_record r
where fi.uid = r.uid where fi.uid = r.uid
and u.uid = r.uid and u.uid = r.uid
and r.charge_status = 2 and r.charge_status in (2,6)
and r.charge_prod_id != 'exchange' and r.charge_prod_id != 'exchange'
and r.buss_type in (0,4) and r.buss_type in (0,4)
and date_format(r.create_time, '%Y-%m') = date_format(u.create_time, '%Y-%m') and date_format(r.create_time, '%Y-%m') = date_format(u.create_time, '%Y-%m')
@@ -133,7 +133,7 @@
0 newUserChargeAmount, ifnull(sum(r.amount/100), 0) totalChargeAmount, 0 newUserChargeAmount, ifnull(sum(r.amount/100), 0) totalChargeAmount,
count(distinct r.uid) totalChargeUserNum, count(r.charge_record_id) totalChargeNum count(distinct r.uid) totalChargeUserNum, count(r.charge_record_id) totalChargeNum
from flow_team_member_invite_user fi , charge_record r from flow_team_member_invite_user fi , charge_record r
where fi.uid = r.uid and r.charge_status = 2 and r.charge_prod_id != 'exchange' where fi.uid = r.uid and r.charge_status in (2,6) and r.charge_prod_id != 'exchange'
and r.buss_type in (0,4) and r.buss_type in (0,4)
<if test="queryLimitTime != null"> <if test="queryLimitTime != null">
and r.create_time >= #{queryLimitTime} and r.create_time >= #{queryLimitTime}
@@ -161,7 +161,7 @@
from from
charge_record r, flow_team_member fm, flow_team_member_invite_user fu charge_record r, flow_team_member fm, flow_team_member_invite_user fu
left join users u on fu.uid = u.uid left join users u on fu.uid = u.uid
where fu.uid = r.uid and r.charge_status = 2 and r.charge_prod_id != 'exchange' where fu.uid = r.uid and r.charge_status in (2,6) and r.charge_prod_id != 'exchange'
and fm.member_id = fu.member_id and fm.member_id = fu.member_id
<if test="teamIds != null and teamIds.size > 0"> <if test="teamIds != null and teamIds.size > 0">
and fu.team_id in and fu.team_id in
@@ -190,7 +190,7 @@
#{teamId} #{teamId}
</foreach> </foreach>
</if> </if>
and r.charge_status = 2 and r.charge_prod_id != 'exchange' and r.buss_type in (0,4) and r.charge_status in (2,6) and r.charge_prod_id != 'exchange' and r.buss_type in (0,4)
and date_format(r.create_time, '%Y-%m') = #{month} and date_format(r.create_time, '%Y-%m') = #{month}
<if test="queryLimitTime != null and queryLimitTime != ''"> <if test="queryLimitTime != null and queryLimitTime != ''">
and u.create_time >= #{queryLimitTime} and u.create_time >= #{queryLimitTime}

View File

@@ -11,18 +11,18 @@
(cr2.amount / 100) as firstChargeAmount, (cr2.amount / 100) as firstChargeAmount,
dgh1.first_give_time as firstGiveTime, dgh1.first_give_time as firstGiveTime,
(dgh2.diamond_num / 1000) as diamondAmount, (dgh2.diamond_num / 1000) as diamondAmount,
((select sum(cr.amount) from charge_record as cr where cr.uid = u.uid and cr.charge_status = 2 and ((select sum(cr.amount) from charge_record as cr where cr.uid = u.uid and cr.charge_status in (2,6) and
cr.create_time between u.create_time and now()) / 100) as totalChargeAmount, cr.create_time between u.create_time and now()) / 100) as totalChargeAmount,
((select sum(dgh.diamond_num) from diamond_give_history as dgh where dgh.to_uid = u.uid and dgh.create_time ((select sum(dgh.diamond_num) from diamond_give_history as dgh where dgh.to_uid = u.uid and dgh.create_time
between u.create_time and now()) / 1000) as totalDiamondAmount between u.create_time and now()) / 1000) as totalDiamondAmount
from users as u from users as u
inner join account as a on a.uid = u.uid inner join account as a on a.uid = u.uid
left join ( left join (
select cr.uid, min(cr.create_time) as first_charge_time from charge_record as cr where cr.charge_status = 2 select cr.uid, min(cr.create_time) as first_charge_time from charge_record as cr where cr.charge_status in (2,6)
group by cr.uid group by cr.uid
) as cr1 on cr1.uid = u.uid ) as cr1 on cr1.uid = u.uid
left join charge_record as cr2 on cr2.uid = cr1.uid and cr2.create_time = cr1.first_charge_time and left join charge_record as cr2 on cr2.uid = cr1.uid and cr2.create_time = cr1.first_charge_time and
cr2.charge_status = 2 cr2.charge_status in (2,6)
left join ( left join (
select dgh.to_uid, min(dgh.create_time) as first_give_time from diamond_give_history as dgh group by dgh.to_uid select dgh.to_uid, min(dgh.create_time) as first_give_time from diamond_give_history as dgh group by dgh.to_uid
) as dgh1 on dgh1.to_uid = u.uid ) as dgh1 on dgh1.to_uid = u.uid