数据大屏
This commit is contained in:
parent
4d5151f4bc
commit
7d73423199
@ -1,10 +1,13 @@
|
||||
package com.red.circle.console.adapter.app.user;
|
||||
|
||||
import com.red.circle.common.business.core.enums.SysOriginPlatformEnum;
|
||||
import com.red.circle.common.business.core.enums.SysOriginPlatformEnum;
|
||||
import com.red.circle.console.app.dto.clientobject.datav.CountryDashboardCO;
|
||||
import com.red.circle.console.app.dto.clientobject.datav.CountryDashboardRechargeDetailCO;
|
||||
import com.red.circle.console.app.dto.cmd.datav.CountryDashboardQryCmd;
|
||||
import com.red.circle.console.app.dto.cmd.datav.CountryDashboardRechargeDetailQryCmd;
|
||||
import com.red.circle.console.app.service.app.datav.CountryDashboardService;
|
||||
import com.red.circle.console.app.service.app.user.DatavService;
|
||||
import com.red.circle.framework.dto.PageResult;
|
||||
import com.red.circle.framework.web.controller.BaseController;
|
||||
import com.red.circle.other.inner.model.cmd.user.OnlineCountQryCmd;
|
||||
import com.red.circle.other.inner.model.dto.user.ActiveUserCountryCodeDTO;
|
||||
@ -50,4 +53,10 @@ public class DatavRestController extends BaseController {
|
||||
return countryDashboardService.query(cmd);
|
||||
}
|
||||
|
||||
@GetMapping("/country-dashboard/recharge-details")
|
||||
public PageResult<CountryDashboardRechargeDetailCO> countryDashboardRechargeDetails(
|
||||
CountryDashboardRechargeDetailQryCmd cmd) {
|
||||
return countryDashboardService.pageRechargeDetails(cmd);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -2,11 +2,15 @@ package com.red.circle.console.app.service.app.datav;
|
||||
|
||||
import com.red.circle.console.app.dto.clientobject.datav.CountryDashboardCO;
|
||||
import com.red.circle.console.app.dto.clientobject.datav.CountryDashboardMetricCO;
|
||||
import com.red.circle.console.app.dto.clientobject.datav.CountryDashboardRechargeDetailCO;
|
||||
import com.red.circle.console.app.dto.cmd.datav.CountryDashboardQryCmd;
|
||||
import com.red.circle.console.app.dto.cmd.datav.CountryDashboardRechargeDetailQryCmd;
|
||||
import com.red.circle.console.infra.database.rds.dao.datav.CountryDashboardDAO;
|
||||
import com.red.circle.console.infra.database.rds.dto.datav.CountryDashboardMetricDTO;
|
||||
import com.red.circle.console.infra.database.rds.dto.datav.CountryDashboardRechargeDetailDTO;
|
||||
import com.red.circle.console.infra.database.rds.dto.datav.CountryDashboardRetentionUserDTO;
|
||||
import com.red.circle.console.infra.database.rds.dto.datav.CountryDashboardUserCountryDTO;
|
||||
import com.red.circle.framework.dto.PageResult;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.sql.Timestamp;
|
||||
@ -69,6 +73,12 @@ public class CountryDashboardServiceImpl implements CountryDashboardService {
|
||||
mergeSql(rows, countryDashboardDAO.listOfficialRecharge(
|
||||
condition.periodType, condition.startTime, condition.endTime,
|
||||
condition.countryKeyword, condition.sysOrigin));
|
||||
mergeSql(rows, countryDashboardDAO.listMifapayRecharge(
|
||||
condition.periodType, condition.startTime, condition.endTime,
|
||||
condition.countryKeyword, condition.sysOrigin));
|
||||
mergeSql(rows, countryDashboardDAO.listGoogleRecharge(
|
||||
condition.periodType, condition.startTime, condition.endTime,
|
||||
condition.countryKeyword, condition.sysOrigin));
|
||||
mergeSql(rows, countryDashboardDAO.listDealerRecharge(
|
||||
condition.periodType, condition.startTime, condition.endTime,
|
||||
condition.countryKeyword, condition.sysOrigin));
|
||||
@ -114,6 +124,51 @@ public class CountryDashboardServiceImpl implements CountryDashboardService {
|
||||
.setRecords(records);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResult<CountryDashboardRechargeDetailCO> pageRechargeDetails(
|
||||
CountryDashboardRechargeDetailQryCmd cmd) {
|
||||
QueryCondition condition = QueryCondition.of(cmd);
|
||||
int cursor = Math.max(1, cmd == null || cmd.getCursor() == null ? 1 : cmd.getCursor());
|
||||
int limit = Math.max(1, cmd == null || cmd.getLimit() == null ? 100 : cmd.getLimit());
|
||||
limit = Math.min(100, limit);
|
||||
int offset = (cursor - 1) * limit;
|
||||
String countryCodes = normalizeCountryCodes(cmd == null ? null : cmd.getCountryCodes());
|
||||
|
||||
Long total = countryDashboardDAO.countRechargeDetails(
|
||||
condition.startTime, condition.endTime, condition.countryKeyword, countryCodes,
|
||||
condition.sysOrigin);
|
||||
List<CountryDashboardRechargeDetailCO> records = countryDashboardDAO.listRechargeDetails(
|
||||
condition.startTime, condition.endTime, condition.countryKeyword, countryCodes,
|
||||
condition.sysOrigin, offset, limit)
|
||||
.stream()
|
||||
.map(this::toRechargeDetailCO)
|
||||
.toList();
|
||||
|
||||
PageResult<CountryDashboardRechargeDetailCO> result = new PageResult<>();
|
||||
result.setCurrent(cursor);
|
||||
result.setSize(limit);
|
||||
result.setTotal(total == null ? 0L : total);
|
||||
result.setRecords(records);
|
||||
return result;
|
||||
}
|
||||
|
||||
private CountryDashboardRechargeDetailCO toRechargeDetailCO(
|
||||
CountryDashboardRechargeDetailDTO dto) {
|
||||
return new CountryDashboardRechargeDetailCO()
|
||||
.setRecordId(dto.getRecordId())
|
||||
.setSourceType(dto.getSourceType())
|
||||
.setSourceChannel(dto.getSourceChannel())
|
||||
.setUserId(dto.getUserId())
|
||||
.setUserAccount(dto.getUserAccount())
|
||||
.setUserNickname(dto.getUserNickname())
|
||||
.setCountryCode(dto.getCountryCode())
|
||||
.setCountryName(dto.getCountryName())
|
||||
.setAmount(safe(dto.getAmount()))
|
||||
.setCoinQuantity(safe(dto.getCoinQuantity()))
|
||||
.setRemark(dto.getRemark())
|
||||
.setCreateTime(dto.getCreateTime());
|
||||
}
|
||||
|
||||
private void mergeSql(Map<String, CountryDashboardMetricCO> rows,
|
||||
List<CountryDashboardMetricDTO> metrics) {
|
||||
if (metrics == null || metrics.isEmpty()) {
|
||||
@ -125,6 +180,8 @@ public class CountryDashboardServiceImpl implements CountryDashboardService {
|
||||
row.setCountryNewUser(row.getCountryNewUser() + safeLong(metric.getCountryNewUser()));
|
||||
row.setNewUserRecharge(add(row.getNewUserRecharge(), metric.getNewUserRecharge()));
|
||||
row.setOfficialRecharge(add(row.getOfficialRecharge(), metric.getOfficialRecharge()));
|
||||
row.setMifapayRecharge(add(row.getMifapayRecharge(), metric.getMifapayRecharge()));
|
||||
row.setGoogleRecharge(add(row.getGoogleRecharge(), metric.getGoogleRecharge()));
|
||||
row.setDealerRecharge(add(row.getDealerRecharge(), metric.getDealerRecharge()));
|
||||
row.setSalaryExchange(add(row.getSalaryExchange(), metric.getSalaryExchange()));
|
||||
row.setLuckyGiftTotalFlow(add(row.getLuckyGiftTotalFlow(), metric.getLuckyGiftTotalFlow()));
|
||||
@ -447,7 +504,8 @@ public class CountryDashboardServiceImpl implements CountryDashboardService {
|
||||
}
|
||||
|
||||
private void calculateFormulaFields(CountryDashboardMetricCO row) {
|
||||
row.setTotalRecharge(add(row.getOfficialRecharge(), row.getDealerRecharge()));
|
||||
row.setTotalRecharge(add(add(row.getOfficialRecharge(), row.getMifapayRecharge()),
|
||||
row.getDealerRecharge()));
|
||||
row.setLuckyGiftProfit(safe(row.getLuckyGiftTotalFlow())
|
||||
.subtract(safe(row.getLuckyGiftPayout()))
|
||||
.subtract(safe(row.getLuckyGiftAnchorShare())));
|
||||
@ -474,6 +532,8 @@ public class CountryDashboardServiceImpl implements CountryDashboardService {
|
||||
total.setDailyActiveUser(total.getDailyActiveUser() + safeLong(row.getDailyActiveUser()));
|
||||
total.setNewUserRecharge(add(total.getNewUserRecharge(), row.getNewUserRecharge()));
|
||||
total.setOfficialRecharge(add(total.getOfficialRecharge(), row.getOfficialRecharge()));
|
||||
total.setMifapayRecharge(add(total.getMifapayRecharge(), row.getMifapayRecharge()));
|
||||
total.setGoogleRecharge(add(total.getGoogleRecharge(), row.getGoogleRecharge()));
|
||||
total.setDealerRecharge(add(total.getDealerRecharge(), row.getDealerRecharge()));
|
||||
total.setSalaryExchange(add(total.getSalaryExchange(), row.getSalaryExchange()));
|
||||
total.setGiftConsume(add(total.getGiftConsume(), row.getGiftConsume()));
|
||||
@ -551,6 +611,18 @@ public class CountryDashboardServiceImpl implements CountryDashboardService {
|
||||
return value != null && !value.trim().isEmpty();
|
||||
}
|
||||
|
||||
private static String normalizeCountryCodes(String value) {
|
||||
if (!hasText(value)) {
|
||||
return null;
|
||||
}
|
||||
String normalized = java.util.Arrays.stream(value.split(","))
|
||||
.map(String::trim)
|
||||
.filter(CountryDashboardServiceImpl::hasText)
|
||||
.distinct()
|
||||
.collect(java.util.stream.Collectors.joining(","));
|
||||
return hasText(normalized) ? normalized : null;
|
||||
}
|
||||
|
||||
private record MongoMetric(Long userId, String day, BigDecimal amount) {
|
||||
}
|
||||
|
||||
|
||||
@ -32,6 +32,10 @@ public class CountryDashboardMetricCO implements Serializable {
|
||||
|
||||
private BigDecimal dealerRecharge = BigDecimal.ZERO;
|
||||
|
||||
private BigDecimal mifapayRecharge = BigDecimal.ZERO;
|
||||
|
||||
private BigDecimal googleRecharge = BigDecimal.ZERO;
|
||||
|
||||
private BigDecimal salaryExchange = BigDecimal.ZERO;
|
||||
|
||||
private BigDecimal totalRecharge = BigDecimal.ZERO;
|
||||
|
||||
@ -0,0 +1,42 @@
|
||||
package com.red.circle.console.app.dto.clientobject.datav;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* 国家数据大屏充值明细.
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class CountryDashboardRechargeDetailCO implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private String recordId;
|
||||
|
||||
private String sourceType;
|
||||
|
||||
private String sourceChannel;
|
||||
|
||||
private Long userId;
|
||||
|
||||
private String userAccount;
|
||||
|
||||
private String userNickname;
|
||||
|
||||
private String countryCode;
|
||||
|
||||
private String countryName;
|
||||
|
||||
private BigDecimal amount = BigDecimal.ZERO;
|
||||
|
||||
private BigDecimal coinQuantity = BigDecimal.ZERO;
|
||||
|
||||
private String remark;
|
||||
|
||||
private String createTime;
|
||||
}
|
||||
@ -0,0 +1,33 @@
|
||||
package com.red.circle.console.app.dto.cmd.datav;
|
||||
|
||||
import java.io.Serial;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* 国家数据大屏充值明细查询.
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class CountryDashboardRechargeDetailQryCmd extends CountryDashboardQryCmd {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 页码,从 1 开始.
|
||||
*/
|
||||
private Integer cursor;
|
||||
|
||||
/**
|
||||
* 每页条数.
|
||||
*/
|
||||
private Integer limit;
|
||||
|
||||
/**
|
||||
* 多个国家编码,逗号分隔.
|
||||
*/
|
||||
private String countryCodes;
|
||||
}
|
||||
@ -1,7 +1,10 @@
|
||||
package com.red.circle.console.app.service.app.datav;
|
||||
|
||||
import com.red.circle.console.app.dto.clientobject.datav.CountryDashboardCO;
|
||||
import com.red.circle.console.app.dto.clientobject.datav.CountryDashboardRechargeDetailCO;
|
||||
import com.red.circle.console.app.dto.cmd.datav.CountryDashboardQryCmd;
|
||||
import com.red.circle.console.app.dto.cmd.datav.CountryDashboardRechargeDetailQryCmd;
|
||||
import com.red.circle.framework.dto.PageResult;
|
||||
|
||||
/**
|
||||
* 国家数据大屏.
|
||||
@ -9,4 +12,7 @@ import com.red.circle.console.app.dto.cmd.datav.CountryDashboardQryCmd;
|
||||
public interface CountryDashboardService {
|
||||
|
||||
CountryDashboardCO query(CountryDashboardQryCmd cmd);
|
||||
|
||||
PageResult<CountryDashboardRechargeDetailCO> pageRechargeDetails(
|
||||
CountryDashboardRechargeDetailQryCmd cmd);
|
||||
}
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
package com.red.circle.console.infra.database.rds.dao.datav;
|
||||
|
||||
import com.red.circle.console.infra.database.rds.dto.datav.CountryDashboardMetricDTO;
|
||||
import com.red.circle.console.infra.database.rds.dto.datav.CountryDashboardRechargeDetailDTO;
|
||||
import com.red.circle.console.infra.database.rds.dto.datav.CountryDashboardRetentionUserDTO;
|
||||
import com.red.circle.console.infra.database.rds.dto.datav.CountryDashboardUserCountryDTO;
|
||||
import com.red.circle.console.infra.database.rds.entity.app.IUserBaseInfo;
|
||||
@ -36,6 +37,20 @@ public interface CountryDashboardDAO extends BaseDAO<IUserBaseInfo> {
|
||||
@Param("countryKeyword") String countryKeyword,
|
||||
@Param("sysOrigin") String sysOrigin);
|
||||
|
||||
List<CountryDashboardMetricDTO> listMifapayRecharge(
|
||||
@Param("periodType") String periodType,
|
||||
@Param("startTime") LocalDateTime startTime,
|
||||
@Param("endTime") LocalDateTime endTime,
|
||||
@Param("countryKeyword") String countryKeyword,
|
||||
@Param("sysOrigin") String sysOrigin);
|
||||
|
||||
List<CountryDashboardMetricDTO> listGoogleRecharge(
|
||||
@Param("periodType") String periodType,
|
||||
@Param("startTime") LocalDateTime startTime,
|
||||
@Param("endTime") LocalDateTime endTime,
|
||||
@Param("countryKeyword") String countryKeyword,
|
||||
@Param("sysOrigin") String sysOrigin);
|
||||
|
||||
List<CountryDashboardMetricDTO> listDealerRecharge(
|
||||
@Param("periodType") String periodType,
|
||||
@Param("startTime") LocalDateTime startTime,
|
||||
@ -86,4 +101,20 @@ public interface CountryDashboardDAO extends BaseDAO<IUserBaseInfo> {
|
||||
@Param("sysOrigin") String sysOrigin);
|
||||
|
||||
List<CountryDashboardUserCountryDTO> listUserCountryByIds(@Param("userIds") Collection<Long> userIds);
|
||||
|
||||
Long countRechargeDetails(
|
||||
@Param("startTime") LocalDateTime startTime,
|
||||
@Param("endTime") LocalDateTime endTime,
|
||||
@Param("countryKeyword") String countryKeyword,
|
||||
@Param("countryCodes") String countryCodes,
|
||||
@Param("sysOrigin") String sysOrigin);
|
||||
|
||||
List<CountryDashboardRechargeDetailDTO> listRechargeDetails(
|
||||
@Param("startTime") LocalDateTime startTime,
|
||||
@Param("endTime") LocalDateTime endTime,
|
||||
@Param("countryKeyword") String countryKeyword,
|
||||
@Param("countryCodes") String countryCodes,
|
||||
@Param("sysOrigin") String sysOrigin,
|
||||
@Param("offset") int offset,
|
||||
@Param("limit") int limit);
|
||||
}
|
||||
|
||||
@ -25,6 +25,10 @@ public class CountryDashboardMetricDTO {
|
||||
|
||||
private BigDecimal officialRecharge;
|
||||
|
||||
private BigDecimal mifapayRecharge;
|
||||
|
||||
private BigDecimal googleRecharge;
|
||||
|
||||
private BigDecimal dealerRecharge;
|
||||
|
||||
private BigDecimal salaryExchange;
|
||||
|
||||
@ -0,0 +1,37 @@
|
||||
package com.red.circle.console.infra.database.rds.dto.datav;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* 国家数据大屏充值明细 SQL 结果.
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class CountryDashboardRechargeDetailDTO {
|
||||
|
||||
private String recordId;
|
||||
|
||||
private String sourceType;
|
||||
|
||||
private String sourceChannel;
|
||||
|
||||
private Long userId;
|
||||
|
||||
private String userAccount;
|
||||
|
||||
private String userNickname;
|
||||
|
||||
private String countryCode;
|
||||
|
||||
private String countryName;
|
||||
|
||||
private BigDecimal amount;
|
||||
|
||||
private BigDecimal coinQuantity;
|
||||
|
||||
private String remark;
|
||||
|
||||
private String createTime;
|
||||
}
|
||||
@ -79,6 +79,65 @@
|
||||
</if>
|
||||
</sql>
|
||||
|
||||
<sql id="CountryCodesWhere">
|
||||
<if test="countryCodes != null and countryCodes != ''">
|
||||
AND FIND_IN_SET(u.country_code, #{countryCodes})
|
||||
</if>
|
||||
</sql>
|
||||
|
||||
<sql id="RechargeDetailSource">
|
||||
SELECT
|
||||
CONVERT(CAST(t.id AS CHAR) USING utf8mb4) COLLATE utf8mb4_unicode_ci AS recordId,
|
||||
CONVERT('OFFICIAL' USING utf8mb4) COLLATE utf8mb4_unicode_ci AS sourceType,
|
||||
CONVERT(IFNULL(t.pay_platform, '') USING utf8mb4) COLLATE utf8mb4_unicode_ci AS sourceChannel,
|
||||
t.user_id AS userId,
|
||||
IFNULL(t.unit_price, 0) AS amount,
|
||||
CAST(NULL AS DECIMAL(20, 2)) AS coinQuantity,
|
||||
CONVERT('' USING utf8mb4) COLLATE utf8mb4_unicode_ci AS remark,
|
||||
t.create_time AS createTime
|
||||
FROM order_purchase_history t
|
||||
WHERE t.evn = 'PROD'
|
||||
AND t.is_trial_period = 0
|
||||
AND t.status = 'COMPLETE'
|
||||
AND t.pay_platform != 'MIFA_PAY'
|
||||
<include refid="SourceTimeWhere"/>
|
||||
<include refid="SourceSysOriginWhere"/>
|
||||
UNION ALL
|
||||
SELECT
|
||||
CONVERT(CAST(t.id AS CHAR) USING utf8mb4) COLLATE utf8mb4_unicode_ci AS recordId,
|
||||
CONVERT('MIFAPAY' USING utf8mb4) COLLATE utf8mb4_unicode_ci AS sourceType,
|
||||
CONVERT(IFNULL(t.factory_code, '') USING utf8mb4) COLLATE utf8mb4_unicode_ci AS sourceChannel,
|
||||
t.user_id AS userId,
|
||||
IFNULL(t.compute_usd_amount, 0) AS amount,
|
||||
CAST(NULL AS DECIMAL(20, 2)) AS coinQuantity,
|
||||
CONVERT('' USING utf8mb4) COLLATE utf8mb4_unicode_ci AS remark,
|
||||
t.create_time AS createTime
|
||||
FROM order_user_purchase_pay t
|
||||
WHERE t.evn = 'PROD'
|
||||
AND t.factory_code = 'MIFA_PAY'
|
||||
AND t.pay_status = 'SUCCESSFUL'
|
||||
AND t.receipt_type = 'PAYMENT'
|
||||
AND t.refund_status = 'NONE'
|
||||
<include refid="SourceTimeWhere"/>
|
||||
<include refid="SourceSysOriginWhere"/>
|
||||
UNION ALL
|
||||
SELECT
|
||||
CONVERT(CAST(t.id AS CHAR) USING utf8mb4) COLLATE utf8mb4_unicode_ci AS recordId,
|
||||
CONVERT('DEALER' USING utf8mb4) COLLATE utf8mb4_unicode_ci AS sourceType,
|
||||
CONVERT(IFNULL(t.recharge_type, '') USING utf8mb4) COLLATE utf8mb4_unicode_ci AS sourceChannel,
|
||||
t.user_id AS userId,
|
||||
IFNULL(t.amount, 0) AS amount,
|
||||
IFNULL(t.quantity, 0) AS coinQuantity,
|
||||
CONVERT(IFNULL(t.remark, '') USING utf8mb4) COLLATE utf8mb4_unicode_ci AS remark,
|
||||
t.create_time AS createTime
|
||||
FROM likei_wallet.user_freight_balance_running_water t
|
||||
WHERE t.origin = 'PURCHASE'
|
||||
AND t.type = 0
|
||||
AND IFNULL(t.amount, 0) > 0
|
||||
<include refid="SourceTimeWhere"/>
|
||||
<include refid="SourceSysOriginWhere"/>
|
||||
</sql>
|
||||
|
||||
<sql id="WalletGoldAssetRecordSource">
|
||||
SELECT user_id, sys_origin, type, penny_amount, event_type, FROM_UNIXTIME(create_time / 1000) AS create_time
|
||||
FROM likei_wallet.wallet_gold_asset_record_1
|
||||
@ -201,6 +260,44 @@
|
||||
WHERE t.evn = 'PROD'
|
||||
AND t.is_trial_period = 0
|
||||
AND t.status = 'COMPLETE'
|
||||
AND t.pay_platform != 'MIFA_PAY'
|
||||
<include refid="UserWhere"/>
|
||||
<include refid="SourceTimeWhere"/>
|
||||
<include refid="SourceSysOriginWhere"/>
|
||||
GROUP BY countryCode, countryName, periodKey, periodName
|
||||
</select>
|
||||
|
||||
<select id="listMifapayRecharge"
|
||||
resultType="com.red.circle.console.infra.database.rds.dto.datav.CountryDashboardMetricDTO">
|
||||
SELECT
|
||||
<include refid="CountryColumns"/>,
|
||||
<include refid="PeriodColumnsT"/>,
|
||||
IFNULL(SUM(t.compute_usd_amount), 0) AS mifapayRecharge
|
||||
FROM order_user_purchase_pay t
|
||||
INNER JOIN user_base_info u ON u.id = t.user_id
|
||||
WHERE t.evn = 'PROD'
|
||||
AND t.factory_code = 'MIFA_PAY'
|
||||
AND t.pay_status = 'SUCCESSFUL'
|
||||
AND t.receipt_type = 'PAYMENT'
|
||||
AND t.refund_status = 'NONE'
|
||||
<include refid="UserWhere"/>
|
||||
<include refid="SourceTimeWhere"/>
|
||||
<include refid="SourceSysOriginWhere"/>
|
||||
GROUP BY countryCode, countryName, periodKey, periodName
|
||||
</select>
|
||||
|
||||
<select id="listGoogleRecharge"
|
||||
resultType="com.red.circle.console.infra.database.rds.dto.datav.CountryDashboardMetricDTO">
|
||||
SELECT
|
||||
<include refid="CountryColumns"/>,
|
||||
<include refid="PeriodColumnsT"/>,
|
||||
IFNULL(SUM(t.unit_price), 0) AS googleRecharge
|
||||
FROM order_purchase_history t
|
||||
INNER JOIN user_base_info u ON u.id = t.user_id
|
||||
WHERE t.evn = 'PROD'
|
||||
AND t.is_trial_period = 0
|
||||
AND t.status = 'COMPLETE'
|
||||
AND t.pay_platform = 'GOOGLE'
|
||||
<include refid="UserWhere"/>
|
||||
<include refid="SourceTimeWhere"/>
|
||||
<include refid="SourceSysOriginWhere"/>
|
||||
@ -212,16 +309,55 @@
|
||||
SELECT
|
||||
<include refid="CountryColumns"/>,
|
||||
<include refid="PeriodColumnsT"/>,
|
||||
IFNULL(SUM(t.recharge_amount), 0) AS dealerRecharge
|
||||
FROM user_gold_coin_recharge t
|
||||
IFNULL(SUM(t.amount), 0) AS dealerRecharge
|
||||
FROM likei_wallet.user_freight_balance_running_water t
|
||||
INNER JOIN user_base_info u ON u.id = t.user_id
|
||||
WHERE t.gold_coin_source IN (2, 3)
|
||||
WHERE t.origin = 'PURCHASE'
|
||||
AND t.type = 0
|
||||
AND IFNULL(t.amount, 0) > 0
|
||||
<include refid="UserWhere"/>
|
||||
<include refid="SourceTimeWhere"/>
|
||||
<include refid="SourceSysOriginWhere"/>
|
||||
GROUP BY countryCode, countryName, periodKey, periodName
|
||||
</select>
|
||||
|
||||
<select id="countRechargeDetails" resultType="java.lang.Long">
|
||||
SELECT COUNT(1)
|
||||
FROM (
|
||||
<include refid="RechargeDetailSource"/>
|
||||
) t
|
||||
INNER JOIN user_base_info u ON u.id = t.userId
|
||||
WHERE 1 = 1
|
||||
<include refid="UserWhere"/>
|
||||
<include refid="CountryCodesWhere"/>
|
||||
</select>
|
||||
|
||||
<select id="listRechargeDetails"
|
||||
resultType="com.red.circle.console.infra.database.rds.dto.datav.CountryDashboardRechargeDetailDTO">
|
||||
SELECT
|
||||
t.recordId,
|
||||
t.sourceType,
|
||||
t.sourceChannel,
|
||||
t.userId,
|
||||
u.account AS userAccount,
|
||||
u.user_nickname AS userNickname,
|
||||
NULLIF(u.country_code, '') AS countryCode,
|
||||
NULLIF(u.country_name, '') AS countryName,
|
||||
t.amount,
|
||||
t.coinQuantity,
|
||||
t.remark,
|
||||
DATE_FORMAT(t.createTime, '%Y-%m-%d %H:%i:%s') AS createTime
|
||||
FROM (
|
||||
<include refid="RechargeDetailSource"/>
|
||||
) t
|
||||
INNER JOIN user_base_info u ON u.id = t.userId
|
||||
WHERE 1 = 1
|
||||
<include refid="UserWhere"/>
|
||||
<include refid="CountryCodesWhere"/>
|
||||
ORDER BY t.createTime DESC, t.recordId DESC
|
||||
LIMIT #{limit} OFFSET #{offset}
|
||||
</select>
|
||||
|
||||
<select id="listSalaryExchange"
|
||||
resultType="com.red.circle.console.infra.database.rds.dto.datav.CountryDashboardMetricDTO">
|
||||
SELECT
|
||||
|
||||
@ -73,4 +73,5 @@ red-circle:
|
||||
- /console/datav/online/user/count
|
||||
- /console/datav/online/room/count
|
||||
- /console/datav/country-dashboard
|
||||
- /console/datav/country-dashboard/recharge-details
|
||||
- /console/user/base/info/im/sig
|
||||
|
||||
111
sql/20260506_team_manager_menu.sql
Normal file
111
sql/20260506_team_manager_menu.sql
Normal file
@ -0,0 +1,111 @@
|
||||
SET NAMES utf8mb4;
|
||||
|
||||
SET @team_parent_menu_id := (
|
||||
SELECT `id` FROM `sys_menu` WHERE `alias` = 'TeamManager' LIMIT 1
|
||||
);
|
||||
|
||||
INSERT INTO `sys_menu` (
|
||||
`id`, `parent_id`, `menu_name`, `path`, `menu_type`, `icon`, `create_user`, `update_user`,
|
||||
`sort`, `status`, `router`, `alias`
|
||||
)
|
||||
SELECT
|
||||
1700000500, @team_parent_menu_id, '经理列表', 'team/manager/index', 2, 'form',
|
||||
'0', '0', 245, 0, 'team/manager', 'TeamManagerList'
|
||||
WHERE @team_parent_menu_id IS NOT NULL
|
||||
AND NOT EXISTS (
|
||||
SELECT 1 FROM `sys_menu` WHERE `alias` = 'TeamManagerList'
|
||||
);
|
||||
|
||||
UPDATE `sys_menu`
|
||||
SET
|
||||
`parent_id` = @team_parent_menu_id,
|
||||
`menu_name` = '经理列表',
|
||||
`path` = 'team/manager/index',
|
||||
`menu_type` = 2,
|
||||
`icon` = 'form',
|
||||
`create_user` = '0',
|
||||
`update_user` = '0',
|
||||
`sort` = 245,
|
||||
`status` = 0,
|
||||
`router` = 'team/manager'
|
||||
WHERE `alias` = 'TeamManagerList'
|
||||
AND @team_parent_menu_id IS NOT NULL;
|
||||
|
||||
INSERT INTO `sys_menu` (
|
||||
`id`, `parent_id`, `menu_name`, `path`, `menu_type`, `icon`, `create_user`, `update_user`,
|
||||
`sort`, `status`, `router`, `alias`
|
||||
)
|
||||
SELECT *
|
||||
FROM (
|
||||
SELECT 1700000501 AS `id`, 0 AS `parent_id`, 'team:manager:list:query:all' AS `menu_name`,
|
||||
NULL AS `path`, 3 AS `menu_type`, NULL AS `icon`, '0' AS `create_user`, '0' AS `update_user`,
|
||||
39 AS `sort`, 0 AS `status`, NULL AS `router`, 'team:manager:list:query:all' AS `alias`
|
||||
UNION ALL
|
||||
SELECT 1700000502, 0, 'team:manager:list:add', NULL, 3, NULL, '0', '0', 38, 0, NULL, 'team:manager:list:add'
|
||||
UNION ALL
|
||||
SELECT 1700000503, 0, 'team:manager:list:edit', NULL, 3, NULL, '0', '0', 37, 0, NULL, 'team:manager:list:edit'
|
||||
UNION ALL
|
||||
SELECT 1700000504, 0, 'team:manager:list:del', NULL, 3, NULL, '0', '0', 36, 0, NULL, 'team:manager:list:del'
|
||||
) seed
|
||||
WHERE NOT EXISTS (
|
||||
SELECT 1 FROM `sys_menu` existing WHERE existing.`alias` = seed.`alias`
|
||||
);
|
||||
|
||||
UPDATE `sys_menu`
|
||||
SET
|
||||
`parent_id` = 0,
|
||||
`path` = NULL,
|
||||
`menu_type` = 3,
|
||||
`icon` = NULL,
|
||||
`create_user` = '0',
|
||||
`update_user` = '0',
|
||||
`status` = 0,
|
||||
`router` = NULL,
|
||||
`menu_name` = `alias`,
|
||||
`sort` = CASE `alias`
|
||||
WHEN 'team:manager:list:query:all' THEN 39
|
||||
WHEN 'team:manager:list:add' THEN 38
|
||||
WHEN 'team:manager:list:edit' THEN 37
|
||||
WHEN 'team:manager:list:del' THEN 36
|
||||
ELSE `sort`
|
||||
END
|
||||
WHERE `alias` IN (
|
||||
'team:manager:list:query:all',
|
||||
'team:manager:list:add',
|
||||
'team:manager:list:edit',
|
||||
'team:manager:list:del'
|
||||
);
|
||||
|
||||
INSERT INTO `sys_role_menu` (`role_id`, `menu_id`)
|
||||
SELECT DISTINCT source.`role_id`, target_menu.`id`
|
||||
FROM `sys_role_menu` source
|
||||
JOIN `sys_menu` source_menu ON source_menu.`id` = source.`menu_id`
|
||||
JOIN `sys_menu` target_menu ON target_menu.`alias` = 'TeamManagerList'
|
||||
WHERE source_menu.`alias` = 'TeamMember'
|
||||
AND NOT EXISTS (
|
||||
SELECT 1 FROM `sys_role_menu` target
|
||||
WHERE target.`role_id` = source.`role_id`
|
||||
AND target.`menu_id` = target_menu.`id`
|
||||
);
|
||||
|
||||
INSERT INTO `sys_role_menu` (`role_id`, `menu_id`)
|
||||
SELECT DISTINCT source.`role_id`, target_menu.`id`
|
||||
FROM `sys_role_menu` source
|
||||
JOIN `sys_menu` source_menu ON source_menu.`id` = source.`menu_id`
|
||||
JOIN `sys_menu` target_menu ON target_menu.`alias` = CASE source_menu.`alias`
|
||||
WHEN 'team:list:query:all' THEN 'team:manager:list:query:all'
|
||||
WHEN 'team:list:add' THEN 'team:manager:list:add'
|
||||
WHEN 'team:list:edit' THEN 'team:manager:list:edit'
|
||||
WHEN 'team:list:del' THEN 'team:manager:list:del'
|
||||
END
|
||||
WHERE source_menu.`alias` IN (
|
||||
'team:list:query:all',
|
||||
'team:list:add',
|
||||
'team:list:edit',
|
||||
'team:list:del'
|
||||
)
|
||||
AND NOT EXISTS (
|
||||
SELECT 1 FROM `sys_role_menu` target
|
||||
WHERE target.`role_id` = source.`role_id`
|
||||
AND target.`menu_id` = target_menu.`id`
|
||||
);
|
||||
Loading…
x
Reference in New Issue
Block a user