商户查看用户手机号

This commit is contained in:
墨大叔 2024-10-15 09:29:42 +08:00
parent beaa110dad
commit 710a05b677
6 changed files with 37 additions and 4 deletions

View File

@ -17,6 +17,7 @@ import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
import org.springframework.format.annotation.DateTimeFormat;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
@ -225,6 +226,7 @@ public class SmUser extends BaseEntity
@Excel(name = "订单查看用户手机号所需的金额", readConverterExp = "元=/单")
@ApiModelProperty("订单查看用户手机号所需的金额")
@Min(value = 0, message = "订单显示用户手机号单价不允许小于0元/单")
private BigDecimal showBillMobilePrice;
}

View File

@ -44,7 +44,12 @@ public enum DesensitizedType
/**
* 车牌号码包含普通车辆新能源车辆
*/
CAR_LICENSE(DesensitizedUtil::carLicense);
CAR_LICENSE(DesensitizedUtil::carLicense),
/**
* 通用保留前后各一位中间所有用星号替换
*/
COMMON(s -> s.replaceAll("(?<=\\w{1})\\w(?=\\w{1})", "*"));
private final Function<String, String> desensitizer;

View File

@ -28,4 +28,7 @@ public class ServiceIncomeVO {
@ApiModelProperty("渠道成本")
private BigDecimal channelCost;
@ApiModelProperty("订单手机号收入")
private BigDecimal billMobileAmount;
}

View File

@ -136,11 +136,15 @@ public class DashboardService {
// 查询月费收入
ReceiveBillQuery receiveQuery = new ReceiveBillQuery();
receiveQuery.setType(ReceiveBillType.MONTH.getType());
receiveQuery.setStartDate(query.getStartDate());
receiveQuery.setEndDate(query.getEndDate());
receiveQuery.setType(ReceiveBillType.MONTH.getType());
List<ReceiveAmountVO<Date>> receiveList = receiveBillService.selectCommonSumOfAmount(receiveQuery, ReceiveBillGroupBy.create_date.name());
// 查询订单手机号收入
receiveQuery.setType(ReceiveBillType.MOBILE.getType());
List<ReceiveAmountVO<Date>> mobileList = receiveBillService.selectCommonSumOfAmount(receiveQuery, ReceiveBillGroupBy.create_date.name());
// 拼接结果集
List<ServiceIncomeVO> result = new ArrayList<>();
if (query.getStartDate() != null && query.getEndDate() != null) {
@ -190,6 +194,17 @@ public class DashboardService {
vo.setMonthAmount(BigDecimal.ZERO);
}
// 订单手机号收入
ReceiveAmountVO<Date> mobile = mobileList.stream()
.filter(item -> item.getKey().compareTo(DateUtils.toDate(date)) == 0)
.findFirst()
.orElse(null);
if (mobile != null) {
vo.setBillMobileAmount(mobile.getReceivedAmount());
} else {
vo.setBillMobileAmount(BigDecimal.ZERO);
}
return vo;
}, query.getStartDate(), query.getEndDate());
}

View File

@ -1,7 +1,9 @@
package com.ruoyi.ss.transactionBill.domain.vo;
import com.fasterxml.jackson.annotation.JsonView;
import com.ruoyi.common.annotation.Sensitive;
import com.ruoyi.common.core.domain.JsonViewProfile;
import com.ruoyi.common.enums.DesensitizedType;
import com.ruoyi.ss.bonus.domain.Bonus;
import com.ruoyi.ss.bonus.domain.BonusVO;
import com.ruoyi.iot.interfaces.IotDevice;
@ -26,6 +28,7 @@ import java.util.List;
public class TransactionBillVO extends TransactionBill implements IotDevice {
@ApiModelProperty("用户名称")
@JsonView(JsonViewProfile.App.class)
@Sensitive(desensitizedType = DesensitizedType.COMMON)
private String userName;
@ApiModelProperty("商户(到账用户)名称")

View File

@ -1,6 +1,8 @@
package com.ruoyi.ss.transactionBill.service.impl;
import com.github.pagehelper.PageHelper;
import com.ruoyi.common.enums.DesensitizedType;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.collection.CollectionUtils;
import com.ruoyi.ss.bonus.domain.BonusQuery;
import com.ruoyi.ss.bonus.domain.BonusVO;
@ -144,7 +146,7 @@ public class TransactionAssemblerImpl implements TransactionAssembler {
@Override
public void handleMchUserMobile(List<TransactionBillVO> list) {
if (CollectionUtils.isNotEmptyElement(list)) {
if (CollectionUtils.isEmptyElement(list)) {
return;
}
@ -153,8 +155,11 @@ public class TransactionAssemblerImpl implements TransactionAssembler {
continue;
}
boolean payed = RechargeBillShowMobileStatus.PAID.getStatus().equals(bill.getMchShowMobileStatus()); // 是否已经缴费
// 若商户不需要显示手机号 或者 未缴费则手机号脱敏
if (bill.getMchShowMobile() == null || !bill.getMchShowMobile() || !payed) {
bill.setUserMobile(null);
if (StringUtils.hasText(bill.getUserMobile())) {
bill.setUserMobile(DesensitizedType.PHONE.desensitizer().apply(bill.getUserMobile()));
}
}
}
}