## Opt - 奖金活动
This commit is contained in:
parent
1420dbc729
commit
0c0eeab847
|
@ -74,9 +74,9 @@ public class MemberStatisticsServiceImpl implements IMemberStatisticsService {
|
|||
for (DirectStatisticsTop30VO directStatisticsTop30VO : result) {
|
||||
if(param.getFaker()){
|
||||
directStatisticsTop30VO.setMemberCode(DataMaskingUtil.mask(directStatisticsTop30VO.getMemberCode(), 2, 2));
|
||||
directStatisticsTop30VO.setMemberName(DataMaskingUtil.mask(directStatisticsTop30VO.getMemberName(), 1, 0, 6));
|
||||
directStatisticsTop30VO.setMemberName(DataMaskingUtil.maskFirstLast(directStatisticsTop30VO.getMemberName()));
|
||||
}
|
||||
directStatisticsTop30VO.setNumberOfAmount(directStatisticsTop30VO.getNumberOfAmount().divide(new BigDecimal(10000)));
|
||||
// directStatisticsTop30VO.setNumberOfAmount(directStatisticsTop30VO.getNumberOfAmount().divide(new BigDecimal(10000)));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
|
|
@ -4,54 +4,78 @@
|
|||
|
||||
<select id="getDirectStatisticsNumberOfPeople"
|
||||
resultType="com.hzs.common.domain.member.statis.DirectStatisticsTop30VO">
|
||||
select
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
(
|
||||
SELECT
|
||||
PK_ID memberId,
|
||||
MEMBER_CODE memberCode,
|
||||
member_name memberName,
|
||||
numberOfPeople,
|
||||
numberOfAmount
|
||||
from (
|
||||
select
|
||||
FROM
|
||||
(
|
||||
SELECT
|
||||
o.PK_REFERENCE,
|
||||
count(DISTINCT o.PK_MEMBER) numberOfPeople,
|
||||
sum(order_amount) numberOfAmount
|
||||
from sa_order o
|
||||
right join cu_member m on m.PK_ID = o.pk_member and m.DEL_FLAG = 0 and m.CATEGORY = 0
|
||||
where
|
||||
count( DISTINCT o.PK_MEMBER ) numberOfPeople,
|
||||
sum( order_amount ) numberOfAmount
|
||||
FROM
|
||||
sa_order o
|
||||
RIGHT JOIN cu_member m ON m.PK_ID = o.pk_member
|
||||
AND m.DEL_FLAG = 0
|
||||
AND m.CATEGORY = 0
|
||||
WHERE
|
||||
o.del_flag = 0
|
||||
and order_status = 1
|
||||
AND (order_type in (1,2) or (order_Type = 3 and ORDER_TYPE_EXTEND = 1))
|
||||
AND order_status = 1
|
||||
AND ( order_type IN ( 1, 2 ) OR ( order_Type = 3 AND ORDER_TYPE_EXTEND = 1 ) )
|
||||
and o.pay_time between #{param.startDate} and #{param.endDate}
|
||||
group by PK_REFERENCE
|
||||
|
||||
GROUP BY PK_REFERENCE
|
||||
ORDER BY numberOfAmount DESC
|
||||
) r
|
||||
left join cu_member cm on r.PK_REFERENCE = cm.pk_id
|
||||
LEFT JOIN cu_member cm ON r.PK_REFERENCE = cm.pk_id
|
||||
WHERE cm.PK_SETTLE_GRADE IN ( SELECT pk_id FROM BD_GRADE WHERE ( grade_value >= 30 ) )
|
||||
ORDER BY numberOfPeople DESC
|
||||
)
|
||||
WHERE ROWNUM <![CDATA[ <=]]> 30
|
||||
order by numberOfPeople desc
|
||||
</select>
|
||||
<select id="getDirectStatisticsNumberOfAmount"
|
||||
resultType="com.hzs.common.domain.member.statis.DirectStatisticsTop30VO">
|
||||
select
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
(
|
||||
SELECT
|
||||
PK_ID memberId,
|
||||
MEMBER_CODE memberCode,
|
||||
member_name memberName,
|
||||
numberOfPeople,
|
||||
numberOfAmount
|
||||
from (
|
||||
select
|
||||
FROM
|
||||
(
|
||||
SELECT
|
||||
o.PK_REFERENCE,
|
||||
count(DISTINCT o.PK_MEMBER) numberOfPeople,
|
||||
sum(order_amount) numberOfAmount
|
||||
from sa_order o
|
||||
right join cu_member m on m.PK_ID = o.pk_member and m.DEL_FLAG = 0 and m.CATEGORY = 0
|
||||
where
|
||||
count( DISTINCT o.PK_MEMBER ) numberOfPeople,
|
||||
sum( order_amount ) numberOfAmount
|
||||
FROM
|
||||
sa_order o
|
||||
RIGHT JOIN cu_member m ON m.PK_ID = o.pk_member
|
||||
AND m.DEL_FLAG = 0
|
||||
AND m.CATEGORY = 0
|
||||
WHERE
|
||||
o.del_flag = 0
|
||||
and order_status = 1
|
||||
AND (order_type in (1,2) or (order_Type = 3 and ORDER_TYPE_EXTEND = 1))
|
||||
AND order_status = 1
|
||||
AND ( order_type IN ( 1, 2 ) OR ( order_Type = 3 AND ORDER_TYPE_EXTEND = 1 ) )
|
||||
and o.pay_time between #{param.startDate} and #{param.endDate}
|
||||
group by PK_REFERENCE
|
||||
|
||||
GROUP BY PK_REFERENCE
|
||||
ORDER BY numberOfAmount DESC
|
||||
) r
|
||||
left join cu_member cm on r.PK_REFERENCE = cm.pk_id
|
||||
LEFT JOIN cu_member cm ON r.PK_REFERENCE = cm.pk_id
|
||||
WHERE cm.PK_SETTLE_GRADE IN ( SELECT pk_id FROM BD_GRADE WHERE ( grade_value >= 30 ) )
|
||||
ORDER BY numberOfAmount DESC
|
||||
)
|
||||
WHERE ROWNUM <![CDATA[ <=]]> 30
|
||||
order by numberOfAmount desc
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
|
@ -46,7 +46,7 @@ class RedisComponent {
|
|||
|
||||
public void initConfig() {
|
||||
// 商品信息
|
||||
initWaresConfig();
|
||||
// initWaresConfig();
|
||||
// 邮费
|
||||
initPostageTemp();
|
||||
}
|
||||
|
|
|
@ -5,101 +5,90 @@ package com.hzs.common.core.utils;
|
|||
* 提供字符串脱敏功能,可指定保留前几位和后几位字符
|
||||
*/
|
||||
public class DataMaskingUtil {
|
||||
|
||||
// 默认脱敏字符
|
||||
private static final char DEFAULT_MASK_CHAR = '*';
|
||||
|
||||
/**
|
||||
* 对字符串进行脱敏处理
|
||||
* @param input 原始字符串
|
||||
* @param keepPrefix 保留的前缀位数
|
||||
* @param keepSuffix 保留的后缀位数
|
||||
* 数据脱敏方法 - 前一后一格式
|
||||
* @param input 输入字符串
|
||||
* @param keepPrefix 保留前缀长度
|
||||
* @param keepSuffix 保留后缀长度
|
||||
* @return 脱敏后的字符串
|
||||
*/
|
||||
public static String mask(String input, int keepPrefix, int keepSuffix) {
|
||||
// 参数验证
|
||||
if (input == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// 处理边界情况
|
||||
if (keepPrefix < 0 || keepSuffix < 0) {
|
||||
throw new IllegalArgumentException("保留位数不能为负数");
|
||||
// 处理空值或null情况
|
||||
if (input == null || input.isEmpty()) {
|
||||
return input;
|
||||
}
|
||||
|
||||
int length = input.length();
|
||||
|
||||
// 如果字符串长度小于等于需要保留的位数之和,直接返回原字符串
|
||||
if (length <= keepPrefix + keepSuffix) {
|
||||
// 特殊情况:长度为2时,只保留第一位
|
||||
if (length == 2) {
|
||||
return input.substring(0, 1) + "*";
|
||||
}
|
||||
|
||||
// 特殊情况:长度小于等于1时,直接返回
|
||||
if (length <= 1) {
|
||||
return input;
|
||||
}
|
||||
|
||||
// 构建StringBuilder用于高效拼接字符串
|
||||
StringBuilder result = new StringBuilder(length);
|
||||
// 调整保留长度,确保合理
|
||||
keepPrefix = Math.min(keepPrefix, length);
|
||||
keepSuffix = Math.min(keepSuffix, length - keepPrefix);
|
||||
|
||||
// 添加前缀保留字符
|
||||
result.append(input, 0, keepPrefix);
|
||||
StringBuilder result = new StringBuilder();
|
||||
|
||||
// 添加脱敏字符
|
||||
int maskCount = length - keepPrefix - keepSuffix;
|
||||
for (int i = 0; i < maskCount; i++) {
|
||||
result.append(DEFAULT_MASK_CHAR);
|
||||
// 添加前缀
|
||||
result.append(input.substring(0, keepPrefix));
|
||||
|
||||
// 添加脱敏部分(使用*代替)
|
||||
int maskLength = length - keepPrefix - keepSuffix;
|
||||
for (int i = 0; i < maskLength; i++) {
|
||||
result.append('*');
|
||||
}
|
||||
|
||||
// 添加后缀保留字符
|
||||
result.append(input, length - keepSuffix, length);
|
||||
// 添加后缀
|
||||
if (keepSuffix > 0) {
|
||||
result.append(input.substring(length - keepSuffix));
|
||||
}
|
||||
|
||||
return result.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* 带最大长度限制的数据脱敏方法
|
||||
* @param input 输入字符串
|
||||
* @param keepPrefix 保留前缀长度
|
||||
* @param keepSuffix 保留后缀长度
|
||||
* @param maxLength 最大输出长度
|
||||
* @return 脱敏后的字符串
|
||||
*/
|
||||
public static String mask(String input, int keepPrefix, int keepSuffix, int maxLength) {
|
||||
// 调用基础脱敏方法
|
||||
String str = mask(input, keepPrefix, keepSuffix);
|
||||
if(str.length() > maxLength) {
|
||||
|
||||
// 限制最大长度
|
||||
if (str.length() > maxLength) {
|
||||
str = str.substring(0, maxLength);
|
||||
}
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
/**
|
||||
* 对字符串进行脱敏处理,可自定义脱敏字符
|
||||
* @param input 原始字符串
|
||||
* @param keepPrefix 保留的前缀位数
|
||||
* @param keepSuffix 保留的后缀位数
|
||||
* @param maskChar 自定义脱敏字符
|
||||
* 前一后一格式的快捷脱敏方法
|
||||
* @param input 输入字符串
|
||||
* @return 脱敏后的字符串
|
||||
*/
|
||||
public static String mask(String input, int keepPrefix, int keepSuffix, char maskChar) {
|
||||
// 参数验证
|
||||
if (input == null) {
|
||||
return null;
|
||||
public static String maskFirstLast(String input) {
|
||||
return mask(input, 1, 1);
|
||||
}
|
||||
|
||||
// 处理边界情况
|
||||
if (keepPrefix < 0 || keepSuffix < 0) {
|
||||
throw new IllegalArgumentException("保留位数不能为负数");
|
||||
}
|
||||
|
||||
int length = input.length();
|
||||
|
||||
// 如果字符串长度小于等于需要保留的位数之和,直接返回原字符串
|
||||
if (length <= keepPrefix + keepSuffix) {
|
||||
return input;
|
||||
}
|
||||
|
||||
// 构建StringBuilder用于高效拼接字符串
|
||||
StringBuilder result = new StringBuilder(length);
|
||||
|
||||
// 添加前缀保留字符
|
||||
result.append(input, 0, keepPrefix);
|
||||
|
||||
// 添加脱敏字符
|
||||
int maskCount = length - keepPrefix - keepSuffix;
|
||||
for (int i = 0; i < maskCount; i++) {
|
||||
result.append(maskChar);
|
||||
}
|
||||
|
||||
// 添加后缀保留字符
|
||||
result.append(input, length - keepSuffix, length);
|
||||
|
||||
return result.toString();
|
||||
/**
|
||||
* 带最大长度限制的前一后一格式脱敏方法
|
||||
* @param input 输入字符串
|
||||
* @param maxLength 最大输出长度
|
||||
* @return 脱敏后的字符串
|
||||
*/
|
||||
public static String maskFirstLast(String input, int maxLength) {
|
||||
return mask(input, 1, 1, maxLength);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -37,6 +37,6 @@ public class DirectStatisticsTop30VO implements Serializable {
|
|||
/**
|
||||
* 直推金额
|
||||
*/
|
||||
@BigDecimalFormat(value = "#0.0000")
|
||||
@BigDecimalFormat(value = "#0.00")
|
||||
private BigDecimal numberOfAmount;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue