提交更新会员校验

This commit is contained in:
磷叶 2025-01-23 15:50:13 +08:00
parent 499597d357
commit 047b9709e7
33 changed files with 607 additions and 234 deletions

View File

@ -80,4 +80,9 @@ public class CacheConstants
* 待插入的命令日志
*/
public static final String INSERT_COMMAND_LOG = "insert_command_log";
/**
* 充值渠道名称列表
*/
public static final String CHANNEL_NAME_LIST = "channel_name_list";
}

View File

@ -1,5 +1,16 @@
package com.ruoyi.common.core.domain.entity;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.Date;
import java.util.List;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import org.springframework.format.annotation.DateTimeFormat;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonView;
import com.ruoyi.common.annotation.Excel;
@ -8,17 +19,9 @@ import com.ruoyi.common.core.domain.BaseEntity;
import com.ruoyi.common.core.domain.JsonViewProfile;
import com.ruoyi.common.core.domain.ValidGroup;
import com.ruoyi.common.enums.DesensitizedType;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.Date;
import java.util.List;
/**
* 普通用户信息对象 sm_user
@ -131,6 +134,8 @@ public class SmUser extends BaseEntity
@ApiModelProperty("服务费费率")
@JsonView(JsonViewProfile.App.class)
@NotNull(message = "服务费费率不允许为空", groups = {ValidGroup.Create.class})
@Min(value = 0, message = "服务费费率不能小于0")
private BigDecimal serviceRate;
@ApiModelProperty("是否设备管理员")
@ -144,11 +149,14 @@ public class SmUser extends BaseEntity
@Excel(name = "提现服务费收取类型1-百分比抽成2-每笔提现收取")
@ApiModelProperty("提现服务费收取类型1-百分比抽成2-每笔提现收取")
@JsonView(JsonViewProfile.App.class)
@NotNull(message = "提现服务费收取类型不允许为空", groups = {ValidGroup.Create.class})
private String withdrawServiceType;
@Excel(name = "提现服务费费")
@ApiModelProperty("提现服务费费")
@JsonView(JsonViewProfile.App.class)
@NotNull(message = "提现服务费费不允许为空", groups = {ValidGroup.Create.class})
@Min(value = 0, message = "提现服务费费不能小于0")
private BigDecimal withdrawServiceRate;
@Excel(name = "真实姓名")
@ -214,6 +222,8 @@ public class SmUser extends BaseEntity
@Excel(name = "代理商服务费比例")
@ApiModelProperty("代理商服务费比例")
@JsonView(JsonViewProfile.AppMch.class)
@NotNull(message = "代理商服务费比例不允许为空", groups = {ValidGroup.Create.class})
@Min(value = 0, message = "代理商服务费比例不能小于0")
private BigDecimal agentServiceRate;
@Excel(name = "到账延迟时间", readConverterExp = "小=时")
@ -253,4 +263,10 @@ public class SmUser extends BaseEntity
@Excel(name = "所属应用ID")
@ApiModelProperty("所属应用ID")
private Long appId;
@Excel(name = "VIP服务费")
@ApiModelProperty("VIP服务费")
@NotNull(message = "VIP服务费不允许为空", groups = {ValidGroup.Create.class})
@Min(value = 0, message = "VIP服务费不能小于0")
private BigDecimal vipServiceRate;
}

View File

@ -1,10 +1,10 @@
package com.ruoyi.system.domain.enums.config;
import java.util.Objects;
import lombok.AllArgsConstructor;
import lombok.Getter;
import java.util.Objects;
/**
* 配置项枚举
* @author wjh
@ -27,7 +27,8 @@ public enum ConfigKey {
RISK_WITHDRAW_COUNT("risk.withdraw.count", "累计风险次数"),
RISK_WITHDRAW_ENABLED("risk.withdraw.enabled", "是否开启提现风控"),
LOGIN_WITH_PHONE("login.with.phone", "登录是否需要手机号"),
MCH_HELP_CLASSIFY("mch.help.classify", "商户帮助分类");
MCH_HELP_CLASSIFY("mch.help.classify", "商户帮助分类"),
VIP_SERVICE_FEE_RATE("vip.service.fee.rate", "VIP服务费费率");
private final String key;
private final String msg;

View File

@ -1,14 +1,15 @@
package com.ruoyi.ss.bonus.service;
import java.util.List;
import com.ruoyi.common.core.domain.entity.SysDept;
import com.ruoyi.ss.bonus.domain.Bonus;
import com.ruoyi.ss.device.domain.vo.DeviceVO;
import com.ruoyi.ss.store.domain.StoreVo;
import com.ruoyi.ss.storeStaff.domain.StoreStaffVO;
import com.ruoyi.ss.transactionBill.domain.vo.TransactionBillVO;
import com.ruoyi.ss.vipOrder.domain.VipOrderVO;
import java.util.List;
/**
* @author wjh
* 2024/8/20
@ -24,6 +25,11 @@ public interface BonusConverter {
*/
List<Bonus> toPoList(VipOrderVO order);
/**
* 转为分成数据
*/
List<Bonus> toPoListByVip(StoreVo store, List<StoreStaffVO> staffList, boolean isPlatform);
/**
* 转为分成数据
* @param device 设备

View File

@ -1,5 +1,17 @@
package com.ruoyi.ss.bonus.service.impl;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.common.constant.Constants;
import com.ruoyi.common.core.domain.entity.SysDept;
import com.ruoyi.common.utils.collection.CollectionUtils;
@ -14,25 +26,15 @@ import com.ruoyi.ss.channel.domain.enums.ChannelType;
import com.ruoyi.ss.device.domain.enums.DeviceServiceMode;
import com.ruoyi.ss.device.domain.vo.DeviceVO;
import com.ruoyi.ss.device.service.DeviceAssembler;
import com.ruoyi.ss.store.domain.StoreVo;
import com.ruoyi.ss.store.service.StoreService;
import com.ruoyi.ss.storeStaff.domain.StoreStaffVO;
import com.ruoyi.ss.storeStaff.service.StoreStaffService;
import com.ruoyi.ss.transactionBill.domain.vo.TransactionBillVO;
import com.ruoyi.ss.user.domain.SmUserVO;
import com.ruoyi.ss.user.service.UserAssembler;
import com.ruoyi.ss.user.service.UserService;
import com.ruoyi.ss.vipOrder.domain.VipOrderVO;
import com.ruoyi.system.service.ISysDeptService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;
import java.util.stream.Stream;
/**
* @author wjh
@ -59,6 +61,9 @@ public class BonusConverterImpl implements BonusConverter {
@Autowired
private UserAssembler userAssembler;
@Autowired
private StoreService storeService;
@Override
public List<Bonus> toPoList(SysDept platform, DeviceVO device, List<StoreStaffVO> staffList) {
@ -111,7 +116,7 @@ public class BonusConverterImpl implements BonusConverter {
continue;
}
Bonus staffBonus = this.toPo(staff);
Bonus staffBonus = this.toPo(staff, staff.getPoint());
if (staffBonus != null) {
result.add(staffBonus);
point = point.subtract(staffBonus.getPoint());
@ -130,12 +135,12 @@ public class BonusConverterImpl implements BonusConverter {
return result;
}
private Bonus toPo(StoreStaffVO staff) {
private Bonus toPo(StoreStaffVO staff, BigDecimal point) {
String staffAncestors = Stream.of(staff.getMchId(), staff.getUserId())
.filter(Objects::nonNull)
.map(Object::toString)
.collect(Collectors.joining(","));
return this.toPo(staff.getUserId(), staff.getUserName(), staff.getPoint(), staffAncestors, BonusArrivalType.STAFF);
return this.toPo(staff.getUserId(), staff.getUserName(), point, staffAncestors, BonusArrivalType.STAFF);
}
@Override
@ -143,38 +148,12 @@ public class BonusConverterImpl implements BonusConverter {
if (order == null) {
return Collections.emptyList();
}
SmUserVO mch = userService.selectSmUserByUserId(order.getMchId());
userAssembler.assembleRealServiceRate(Collections.singletonList(mch));
SysDept platform = deptService.selectDeptById(Constants.ROOT_DEPT);
if (mch == null || platform == null) {
return Collections.emptyList();
}
// 渠道类型
String channelType = order.getChannelType();
StoreVo store = storeService.selectSmStoreById(order.getLevelStoreId());
List<StoreStaffVO> staffList = store.getStaffList();
List<Bonus> result = new ArrayList<>();
// 是否平台收取
boolean isPlatform = ChannelType.PLATFORM.getType().equals(channelType);
// 平台收取
if (isPlatform) {
BigDecimal serviceRate = mch.getRealServiceRate() == null ? BigDecimal.ZERO : mch.getRealServiceRate();
result.add(toPo(platform, serviceRate));
}
// 员工收取
List<StoreStaffVO> staffList = storeStaffService.selectByStoreId(order.getLevelStoreId());
if (CollectionUtils.isNotEmptyElement(staffList)) {
for (StoreStaffVO staff : staffList) {
this.addBonus(result, toPo(staff));
}
}
// 最后商户收取
BigDecimal totalPoint = CollectionUtils.sumDecimal(result, Bonus::getPoint);
BigDecimal mchPoint = new BigDecimal("100").subtract(totalPoint);
Bonus mchBonus = toPo(mch.getUserId(), mch.getRealOrUserName(), mchPoint, "", BonusArrivalType.MCH);
this.addBonus(result, mchBonus);
// 构造基础的分成数据
boolean isPlatform = ChannelType.PLATFORM.getType().equals(order.getChannelType());
List<Bonus> result = this.toPoListByVip(store, staffList, isPlatform);
// 带上业务数据
for (Bonus bonus : result) {
@ -190,6 +169,37 @@ public class BonusConverterImpl implements BonusConverter {
return result;
}
@Override
public List<Bonus> toPoListByVip(StoreVo store, List<StoreStaffVO> staffList, boolean isPlatform) {
SysDept platform = deptService.selectDeptById(Constants.ROOT_DEPT);
if (store == null || platform == null) {
return Collections.emptyList();
}
List<Bonus> result = new ArrayList<>();
// 平台收取
if (isPlatform) {
BigDecimal serviceRate = store.getMchVipServiceRate() == null ? BigDecimal.ZERO : store.getMchVipServiceRate();
result.add(toPo(platform, serviceRate));
}
// 员工收取
if (CollectionUtils.isNotEmptyElement(staffList)) {
for (StoreStaffVO staff : staffList) {
this.addBonus(result, toPo(staff, staff.getVipPoint()));
}
}
// 最后商户收取
BigDecimal totalPoint = CollectionUtils.sumDecimal(result, Bonus::getPoint);
BigDecimal mchPoint = new BigDecimal("100").subtract(totalPoint);
Bonus mchBonus = toPo(store.getUserId(), store.getUserName(), mchPoint, "", BonusArrivalType.MCH);
this.addBonus(result, mchBonus);
return result;
}
@Override
public List<Bonus> toPoList(DeviceVO device, TransactionBillVO bill, String channelType) {
// 只有通过平台渠道支付的才需要分成给余额

View File

@ -0,0 +1,12 @@
package com.ruoyi.ss.channel.domain.vo;
import lombok.Data;
@Data
public class ChannelNameVO {
private Long channelId;
private String name;
}

View File

@ -1,11 +1,13 @@
package com.ruoyi.ss.channel.mapper;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import com.ruoyi.ss.channel.domain.Channel;
import com.ruoyi.ss.channel.domain.ChannelQuery;
import com.ruoyi.ss.channel.domain.ChannelVO;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import com.ruoyi.ss.channel.domain.vo.ChannelNameVO;
/**
* 充值渠道Mapper接口
@ -69,4 +71,9 @@ public interface ChannelMapper
* @return
*/
int logicDel(@Param("ids") List<Long> ids);
/**
* 查询全部充值渠道名称列表
*/
List<ChannelNameVO> selectNameList(@Param("query") ChannelQuery query);
}

View File

@ -133,4 +133,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
#{channelId}
</foreach>
</delete>
<!-- selectNameList -->
<select id="selectNameList">
select
sc.channel_id,
sc.name
from sm_channel sc
<where>
<include refid="searchCondition"/>
</where>
</select>
</mapper>

View File

@ -1,13 +1,14 @@
package com.ruoyi.ss.channel.service;
import com.ruoyi.ss.channel.domain.Channel;
import com.ruoyi.ss.channel.domain.ChannelQuery;
import com.ruoyi.ss.channel.domain.ChannelVO;
import java.util.List;
import java.util.Map;
import java.util.function.Function;
import com.ruoyi.ss.channel.domain.Channel;
import com.ruoyi.ss.channel.domain.ChannelQuery;
import com.ruoyi.ss.channel.domain.ChannelVO;
import com.ruoyi.ss.channel.domain.vo.ChannelNameVO;
/**
* 充值渠道Service接口
*
@ -48,22 +49,6 @@ public interface ChannelService
*/
public int updateSmChannel(Channel channel);
/**
* 批量删除充值渠道
*
* @param channelIds 需要删除的充值渠道主键集合
* @return 结果
*/
public int deleteSmChannelByChannelIds(Long[] channelIds);
/**
* 删除充值渠道信息
*
* @param channelId 充值渠道主键
* @return 结果
*/
public int deleteSmChannelByChannelId(Long channelId);
/**
* 查询启用的充值渠道列表
*
@ -88,4 +73,9 @@ public interface ChannelService
* 根据id查询
*/
List<ChannelVO> selectByIds(List<Long> ids);
/**
* 查询全部充值渠道名称列表
*/
List<ChannelNameVO> selectAllChannelNameList();
}

View File

@ -1,5 +1,17 @@
package com.ruoyi.ss.channel.service.impl;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.function.Function;
import java.util.stream.Collectors;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.support.TransactionTemplate;
import com.ruoyi.common.constant.CacheConstants;
import com.ruoyi.common.core.redis.RedisCache;
import com.ruoyi.common.pay.xy.config.XyPayConfig;
import com.ruoyi.common.pay.xy.service.XyWxPayService;
import com.ruoyi.common.utils.DateUtils;
@ -9,18 +21,10 @@ import com.ruoyi.ss.channel.domain.Channel;
import com.ruoyi.ss.channel.domain.ChannelQuery;
import com.ruoyi.ss.channel.domain.ChannelVO;
import com.ruoyi.ss.channel.domain.enums.ChannelApiType;
import com.ruoyi.ss.channel.domain.vo.ChannelNameVO;
import com.ruoyi.ss.channel.mapper.ChannelMapper;
import com.ruoyi.ss.channel.service.ChannelConverter;
import com.ruoyi.ss.channel.service.ChannelService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.support.TransactionTemplate;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.function.Function;
import java.util.stream.Collectors;
/**
* 充值渠道Service业务层处理
@ -43,6 +47,9 @@ public class ChannelServiceImpl implements ChannelService
@Autowired
private TransactionTemplate transactionTemplate;
@Autowired
private RedisCache redisCache;
/**
* 查询充值渠道
*
@ -86,6 +93,8 @@ public class ChannelServiceImpl implements ChannelService
if (insert == 1) {
ChannelVO vo = selectSmChannelByChannelId(channel.getChannelId());
this.connectCust(vo);
clearCache();
}
return insert;
@ -109,6 +118,8 @@ public class ChannelServiceImpl implements ChannelService
if (update == 1) {
ChannelVO vo = selectSmChannelByChannelId(channel.getChannelId());
this.connectCust(vo);
clearCache();
}
return update;
@ -128,30 +139,6 @@ public class ChannelServiceImpl implements ChannelService
return true;
}
/**
* 批量删除充值渠道
*
* @param channelIds 需要删除的充值渠道主键
* @return 结果
*/
@Override
public int deleteSmChannelByChannelIds(Long[] channelIds)
{
return channelMapper.deleteSmChannelByChannelIds(channelIds);
}
/**
* 删除充值渠道信息
*
* @param channelId 充值渠道主键
* @return 结果
*/
@Override
public int deleteSmChannelByChannelId(Long channelId)
{
return channelMapper.deleteSmChannelByChannelId(channelId);
}
@Override
public List<ChannelVO> selectEnabledRechargeList(ChannelQuery query) {
query.setEnabled(true);
@ -189,7 +176,11 @@ public class ChannelServiceImpl implements ChannelService
// ServiceUtil.assertion(ChannelType.SYSTEM.getType().equals(channel.getType()), "不允许删除系统预设渠道 \"%s\"}", channel.getName());
// }
return channelMapper.logicDel(ids);
int del = channelMapper.logicDel(ids);
if (del > 0) {
clearCache();
}
return del;
}
@Override
@ -201,4 +192,23 @@ public class ChannelServiceImpl implements ChannelService
query.setChannelIds(ids);
return this.selectSmChannelList(query);
}
@Override
public List<ChannelNameVO> selectAllChannelNameList() {
List<ChannelNameVO> list = redisCache.getCacheList(CacheConstants.CHANNEL_NAME_LIST);
if (CollectionUtils.isEmpty(list)) {
list = channelMapper.selectNameList(new ChannelQuery());
if (CollectionUtils.isNotEmpty(list)) {
redisCache.setCacheList(CacheConstants.CHANNEL_NAME_LIST, list);
}
}
return list;
}
/**
* 清除缓存
*/
private void clearCache() {
redisCache.deleteObject(CacheConstants.CHANNEL_NAME_LIST);
}
}

View File

@ -1,5 +1,12 @@
package com.ruoyi.ss.device.service;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.List;
import java.util.Map;
import java.util.concurrent.TimeUnit;
import java.util.function.Function;
import com.ruoyi.iot.domain.IotDeviceInfo;
import com.ruoyi.iot.domain.response.CommandResponse;
import com.ruoyi.ss.device.domain.Device;
@ -13,13 +20,6 @@ import com.ruoyi.ss.device.domain.enums.DevicePowerStatus;
import com.ruoyi.ss.device.domain.vo.DeviceMacSnVO;
import com.ruoyi.ss.device.domain.vo.DeviceVO;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.List;
import java.util.Map;
import java.util.concurrent.TimeUnit;
import java.util.function.Function;
/**
* 设备Service接口
*
@ -431,4 +431,9 @@ public interface DeviceService
* 蓝牙同步设备信息
*/
int bltSyncIot(IotDeviceInfo info);
/**
* 查询商户设备列表
*/
List<DeviceVO> selectByMchId(Long userId);
}

View File

@ -1,5 +1,23 @@
package com.ruoyi.ss.device.service.impl;
import java.math.BigDecimal;
import java.time.Duration;
import java.time.LocalDateTime;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
import java.util.function.Function;
import java.util.stream.Collectors;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.transaction.support.TransactionTemplate;
import com.ruoyi.common.constant.Constants;
import com.ruoyi.common.constant.IotConstants;
import com.ruoyi.common.core.redis.RedisLock;
@ -24,7 +42,11 @@ import com.ruoyi.ss.device.domain.DeviceQuery;
import com.ruoyi.ss.device.domain.dto.DeviceBatchUpdateModelDTO;
import com.ruoyi.ss.device.domain.dto.DeviceRegisterDTO;
import com.ruoyi.ss.device.domain.dto.DeviceWifiDTO;
import com.ruoyi.ss.device.domain.enums.*;
import com.ruoyi.ss.device.domain.enums.DeviceOnlineStatus;
import com.ruoyi.ss.device.domain.enums.DevicePowerStatus;
import com.ruoyi.ss.device.domain.enums.DeviceServiceMode;
import com.ruoyi.ss.device.domain.enums.DeviceStatus;
import com.ruoyi.ss.device.domain.enums.DeviceUserOperaType;
import com.ruoyi.ss.device.domain.vo.DeviceMacSnVO;
import com.ruoyi.ss.device.domain.vo.DeviceVO;
import com.ruoyi.ss.device.mapper.DeviceMapper;
@ -53,20 +75,8 @@ import com.ruoyi.ss.transactionBill.service.TransactionBillService;
import com.ruoyi.ss.user.domain.SmUserVO;
import com.ruoyi.ss.user.service.UserService;
import com.ruoyi.ss.user.service.UserValidator;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.transaction.support.TransactionTemplate;
import java.math.BigDecimal;
import java.time.Duration;
import java.time.LocalDateTime;
import java.util.*;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
import java.util.function.Function;
import java.util.stream.Collectors;
import lombok.extern.slf4j.Slf4j;
/**
* 设备Service业务层处理
@ -1422,6 +1432,16 @@ public class DeviceServiceImpl implements DeviceService
return this.updateIotInfo(device);
}
@Override
public List<DeviceVO> selectByMchId(Long userId) {
if (userId == null) {
return Collections.emptyList();
}
DeviceQuery query = new DeviceQuery();
query.setUserId(userId);
return selectSmDeviceList(query);
}
private List<Long> selectIds(DeviceQuery query) {
return deviceMapper.selectIds(query);
}

View File

@ -13,4 +13,7 @@ public class PayBillVO extends PayBill{
@ApiModelProperty("渠道类型")
private String channelType;
@ApiModelProperty("渠道名称")
private String channelName;
}

View File

@ -27,7 +27,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
spb.refunding_amount,
spb.ip,
spb.app_id,
sc.type as channel_type
sc.type as channel_type,
sc.name as channel_name
from ss_pay_bill spb
left join sm_channel sc on sc.channel_id = spb.channel_id
</sql>

View File

@ -1,14 +1,18 @@
package com.ruoyi.ss.store.domain;
import java.math.BigDecimal;
import java.util.List;
import com.fasterxml.jackson.annotation.JsonView;
import com.ruoyi.common.core.domain.JsonViewProfile;
import com.ruoyi.ss.bonus.domain.Bonus;
import com.ruoyi.ss.store.domain.vo.StoreOperatorVO;
import com.ruoyi.ss.storeStaff.domain.StoreStaffVO;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.math.BigDecimal;
/**
* @author
* 2024/3/5
@ -48,4 +52,13 @@ public class StoreVo extends Store {
@ApiModelProperty("操作")
private StoreOperatorVO operator;
@ApiModelProperty("商户VIP服务费")
private BigDecimal mchVipServiceRate;
@ApiModelProperty("店铺分成")
private List<Bonus> bonusList;
@ApiModelProperty("店铺员工")
private List<StoreStaffVO> staffList;
}

View File

@ -34,7 +34,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
ss.status,
ss.enabled,
ss.use_out_time,
if(su.is_real, su.real_name, su.user_name) as user_name
if(su.is_real, su.real_name, su.user_name) as user_name,
su.vip_service_rate as mch_vip_service_rate
from sm_store ss
left join sm_user su on su.user_id = ss.user_id
</sql>

View File

@ -1,9 +1,9 @@
package com.ruoyi.ss.store.service;
import com.ruoyi.ss.store.domain.StoreVo;
import java.util.List;
import com.ruoyi.ss.store.domain.StoreVo;
/**
* @author wjh
* 2024/4/29
@ -61,4 +61,14 @@ public interface StoreAssembler {
* 拼接操作
*/
void assembleOperator(List<StoreVo> list, Long userId);
/**
* 拼接店铺分成
*/
void assembleBonusList(List<StoreVo> list);
/**
* 拼接店铺员工列表
*/
void assembleStaffList(List<StoreVo> list);
}

View File

@ -1,7 +1,18 @@
package com.ruoyi.ss.store.service.impl;
import java.math.BigDecimal;
import java.time.LocalDate;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.stream.Collectors;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.common.utils.collection.CollectionUtils;
import com.ruoyi.dashboard.domain.vo.BillCountVo;
import com.ruoyi.ss.bonus.service.BonusConverter;
import com.ruoyi.ss.device.domain.DeviceCountVO;
import com.ruoyi.ss.device.domain.DeviceQuery;
import com.ruoyi.ss.device.domain.enums.DeviceGroupBy;
@ -12,20 +23,13 @@ import com.ruoyi.ss.store.domain.StoreVo;
import com.ruoyi.ss.store.domain.vo.StoreOperatorVO;
import com.ruoyi.ss.store.service.StoreAssembler;
import com.ruoyi.ss.store.service.StoreValidator;
import com.ruoyi.ss.storeStaff.domain.StoreStaffVO;
import com.ruoyi.ss.storeStaff.service.StoreStaffService;
import com.ruoyi.ss.transactionBill.domain.TransactionBillQuery;
import com.ruoyi.ss.transactionBill.domain.enums.TransactionBillGroupBy;
import com.ruoyi.ss.transactionBill.domain.enums.TransactionBillStatus;
import com.ruoyi.ss.transactionBill.domain.enums.TransactionBillType;
import com.ruoyi.ss.transactionBill.service.TransactionBillService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.math.BigDecimal;
import java.time.LocalDate;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.stream.Collectors;
/**
* @author wjh
@ -43,6 +47,12 @@ public class StoreAssemblerImpl implements StoreAssembler {
@Autowired
private StoreValidator storeValidator;
@Autowired
private StoreStaffService storeStaffService;
@Autowired
private BonusConverter bonusConverter;
/**
* 拼接设备数量
*
@ -264,4 +274,34 @@ public class StoreAssemblerImpl implements StoreAssembler {
store.setOperator(vo);
}
}
@Override
public void assembleBonusList(List<StoreVo> list) {
if (CollectionUtils.isEmptyElement(list)) {
return;
}
// 查询店铺员工列表
this.assembleStaffList(list);
for (StoreVo store : list) {
bonusConverter.toPoListByVip(store, store.getStaffList(), true);
}
}
@Override
public void assembleStaffList(List<StoreVo> list) {
if (CollectionUtils.isEmptyElement(list)) {
return;
}
List<StoreStaffVO> staffList = storeStaffService.selectListByStoreIds(CollectionUtils.map(list, StoreVo::getStoreId));
for (StoreVo store : list) {
List<StoreStaffVO> storeStaffList = staffList.stream()
.filter(staff -> Objects.equals(staff.getStoreId(), store.getStoreId()))
.collect(Collectors.toList());
store.setStaffList(storeStaffList);
}
}
}

View File

@ -1,5 +1,17 @@
package com.ruoyi.ss.store.service.impl;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.function.Function;
import java.util.stream.Collectors;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.transaction.support.TransactionTemplate;
import com.github.pagehelper.PageHelper;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.SecurityUtils;
@ -7,7 +19,12 @@ import com.ruoyi.common.utils.ServiceUtil;
import com.ruoyi.common.utils.collection.CollectionUtils;
import com.ruoyi.ss.device.domain.DeviceQuery;
import com.ruoyi.ss.device.service.DeviceService;
import com.ruoyi.ss.store.domain.*;
import com.ruoyi.ss.store.domain.Store;
import com.ruoyi.ss.store.domain.StoreBO;
import com.ruoyi.ss.store.domain.StoreCountVO;
import com.ruoyi.ss.store.domain.StoreNameVO;
import com.ruoyi.ss.store.domain.StoreQuery;
import com.ruoyi.ss.store.domain.StoreVo;
import com.ruoyi.ss.store.domain.enums.StoreGroupBy;
import com.ruoyi.ss.store.domain.enums.StoreStatus;
import com.ruoyi.ss.store.mapper.StoreMapper;
@ -17,18 +34,8 @@ import com.ruoyi.ss.store.service.StoreValidator;
import com.ruoyi.ss.storeApply.domain.enums.StoreApplyType;
import com.ruoyi.ss.storeApply.service.StoreApplyConverter;
import com.ruoyi.ss.storeApply.service.StoreApplyService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.transaction.support.TransactionTemplate;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.function.Function;
import java.util.stream.Collectors;
import lombok.extern.slf4j.Slf4j;
/**
* 店铺Service业务层处理
@ -70,6 +77,9 @@ public class StoreServiceImpl implements StoreService
@Override
public StoreVo selectSmStoreById(Long storeId)
{
if (storeId == null) {
return null;
}
return storeMapper.selectSmStoreById(storeId);
}

View File

@ -3,18 +3,17 @@ package com.ruoyi.ss.storeStaff.domain;
import java.math.BigDecimal;
import java.util.List;
import com.ruoyi.common.core.domain.ValidGroup;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
import javax.validation.constraints.Max;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
import com.ruoyi.common.core.domain.ValidGroup;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* 店铺员工对象 ss_store_staff
*
@ -49,6 +48,12 @@ public class StoreStaff extends BaseEntity
@Max(value = 100, message = "分成比例不允许大于100")
private BigDecimal point;
@Excel(name = "VIP分成比例")
@ApiModelProperty("VIP分成比例")
@Min(value = 0, message = "VIP分成比例不允许小于0")
@Max(value = 100, message = "VIP分成比例不允许大于100")
private BigDecimal vipPoint;
@Excel(name = "是否启用")
@ApiModelProperty("是否启用")
@NotNull(message = "是否启用不能为空", groups = {ValidGroup.Create.class, ValidGroup.FrontCreate.class})

View File

@ -1,10 +1,10 @@
package com.ruoyi.ss.storeStaff.domain;
import java.util.List;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
/**
* @author wjh
* 2024/11/13

View File

@ -3,11 +3,12 @@ package com.ruoyi.ss.storeStaff.mapper;
import java.math.BigDecimal;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import com.ruoyi.common.core.domain.vo.LongCountVO;
import com.ruoyi.ss.storeStaff.domain.StoreStaff;
import com.ruoyi.ss.storeStaff.domain.StoreStaffVO;
import com.ruoyi.ss.storeStaff.domain.StoreStaffQuery;
import org.apache.ibatis.annotations.Param;
import com.ruoyi.ss.storeStaff.domain.StoreStaffVO;
/**
* 店铺员工Mapper接口
@ -81,4 +82,9 @@ public interface StoreStaffMapper
* 根据用户统计店员数量
*/
List<LongCountVO> selectCountGroupByUserId(@Param("query") StoreStaffQuery query);
/**
* 查询VIP分成比例总和
*/
BigDecimal selectSumOfVipPoint(@Param("query") StoreStaffQuery query);
}

View File

@ -21,6 +21,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
sss.create_time,
sss.create_by,
sss.create_id,
sss.vip_point,
ss.name as store_name,
ss.user_id as mch_id,
if(su.is_real, su.real_name, su.user_name) as user_name
@ -105,6 +106,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="createTime != null">create_time,</if>
<if test="createBy != null">create_by,</if>
<if test="createId != null">create_id,</if>
<if test="vipPoint != null">vip_point,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="storeId != null">#{storeId},</if>
@ -117,6 +119,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="createTime != null">#{createTime},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createId != null">#{createId},</if>
<if test="vipPoint != null">#{vipPoint},</if>
</trim>
</insert>
@ -145,6 +148,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="data.createTime != null">create_time = #{data.createTime},</if>
<if test="data.createBy != null">create_by = #{data.createBy},</if>
<if test="data.createId != null">create_id = #{data.createId},</if>
<if test="data.vipPoint != null">vip_point = #{data.vipPoint},</if>
</sql>
<delete id="deleteStoreStaffByEmployId" parameterType="Long">
@ -157,4 +161,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
#{employId}
</foreach>
</delete>
<!-- selectSumOfVipPoint -->
<select id="selectSumOfVipPoint" resultType="java.math.BigDecimal">
select sum(sss.vip_point)
from ss_store_staff sss
<where>
<include refid="searchCondition"/>
</where>
</select>
</mapper>

View File

@ -1,13 +1,13 @@
package com.ruoyi.ss.storeStaff.service;
import java.math.BigDecimal;
import java.util.List;
import com.ruoyi.common.core.domain.vo.LongCountVO;
import com.ruoyi.ss.storeStaff.domain.StoreStaff;
import com.ruoyi.ss.storeStaff.domain.StoreStaffQuery;
import com.ruoyi.ss.storeStaff.domain.StoreStaffVO;
import java.math.BigDecimal;
import java.util.List;
/**
* 店铺员工Service接口
*
@ -93,4 +93,19 @@ public interface StoreStaffService
* 根据店铺查询店铺员工
*/
List<StoreStaffVO> selectByStoreId(Long storeId);
/**
* 查询VIP分成比例总和
*/
BigDecimal selectSumOfVipPointByStoreId(Long storeId);
/**
* 查询VIP分成比例总和
*/
BigDecimal selectSumOfVipPoint(StoreStaffQuery query);
/**
* 根据店铺id查询店铺员工列表
*/
List<StoreStaffVO> selectListByStoreIds(List<Long> storeIds);
}

View File

@ -1,5 +1,13 @@
package com.ruoyi.ss.storeStaff.service.impl;
import java.math.BigDecimal;
import java.util.Collections;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.support.TransactionTemplate;
import com.ruoyi.common.core.domain.vo.LongCountVO;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.ServiceUtil;
@ -12,13 +20,6 @@ import com.ruoyi.ss.storeStaff.service.StoreStaffService;
import com.ruoyi.ss.storeStaff.service.StoreStaffValidator;
import com.ruoyi.ss.user.domain.SmUserVO;
import com.ruoyi.ss.user.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.support.TransactionTemplate;
import java.math.BigDecimal;
import java.util.Collections;
import java.util.List;
/**
* 店铺员工Service业务层处理
@ -193,4 +194,31 @@ public class StoreStaffServiceImpl implements StoreStaffService
query.setStoreId(storeId);
return storeStaffMapper.selectStoreStaffList(query);
}
@Override
public BigDecimal selectSumOfVipPointByStoreId(Long storeId) {
if (storeId == null) {
return BigDecimal.ZERO;
}
StoreStaffQuery query = new StoreStaffQuery();
query.setStoreId(storeId);
return this.selectSumOfVipPoint(query);
}
@Override
public BigDecimal selectSumOfVipPoint(StoreStaffQuery query) {
BigDecimal result = storeStaffMapper.selectSumOfVipPoint(query);
return result == null ? BigDecimal.ZERO : result;
}
@Override
public List<StoreStaffVO> selectListByStoreIds(List<Long> storeIds) {
if (CollectionUtils.isEmptyElement(storeIds)) {
return Collections.emptyList();
}
StoreStaffQuery query = new StoreStaffQuery();
query.setStoreIds(storeIds);
return storeStaffMapper.selectStoreStaffList(query);
}
}

View File

@ -1,5 +1,12 @@
package com.ruoyi.ss.storeStaff.service.impl;
import java.math.BigDecimal;
import java.util.List;
import java.util.Objects;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.common.utils.ServiceUtil;
import com.ruoyi.common.utils.collection.CollectionUtils;
@ -16,12 +23,6 @@ import com.ruoyi.ss.storeStaff.service.StoreStaffValidator;
import com.ruoyi.ss.user.domain.SmUserVO;
import com.ruoyi.ss.user.service.UserAssembler;
import com.ruoyi.ss.user.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.math.BigDecimal;
import java.util.List;
import java.util.Objects;
/**
* @author wjh
@ -81,6 +82,27 @@ public class StoreStaffValidatorImpl implements StoreStaffValidator {
this.checkStorePoint(vo);
// 校验设备分成
this.checkDevicePoint(vo);
// 校验VIP分成
this.checkVipPoint(vo);
}
// 校验VIP分成
private void checkVipPoint(StoreStaffVO vo) {
// 查询店铺员工总比例
BigDecimal totalPoint = storeStaffService.selectSumOfVipPointByStoreId(vo.getStoreId());
// 查询店铺商户比例
SmUserVO mch = userService.selectSimpleById(vo.getMchId());
BigDecimal mchPoint = mch == null || mch.getVipServiceRate() == null ? BigDecimal.ZERO : mch.getVipServiceRate();
// 计算总比例
totalPoint = totalPoint.add(mchPoint);
if (totalPoint.compareTo(BigDecimal.valueOf(100)) > 0) {
throw new ServiceException(String.format("店铺成员的总分成比例不能超过100%%,当前:%s%%", totalPoint));
}
if (totalPoint.compareTo(BigDecimal.ZERO) < 0) {
throw new ServiceException("店铺成员的总分成比例不能为负数");
}
}
private void checkStorePoint(StoreStaffVO vo) {

View File

@ -64,6 +64,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
su.ali_open_id,
su.channel_ids,
su.app_id,
su.vip_service_rate,
if(su.is_real, su.real_name, su.user_name) as real_or_user_name,
sa.name as app_name
from sm_user su
@ -100,7 +101,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="agentAllowMchSwitch != null">and su.agent_allow_mch_switch != #{agentAllowMchSwitch}</if>
<if test="realOrUserName != null and realOrUserName != ''">and if(su.is_real, su.real_name, su.user_name) like concat('%', #{realOrUserName}, '%')</if>
<if test="eqRealIdCard != null and eqRealIdCard != ''">and su.real_id_card = #{eqRealIdCard}</if>
<if test="appId != null "> and app_id = #{appId}</if>
<if test="appId != null "> and su.app_id = #{appId}</if>
<if test="isReal != null "> and su.is_real = #{isReal}</if>
<if test="tenantDeviceId != null">
and su.user_id in (
select sdt.tenant_id
@ -218,6 +220,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="aliOpenId != null">ali_open_id,</if>
<if test="channelIds != null">channel_ids,</if>
<if test="appId != null">app_id,</if>
<if test="vipServiceRate != null">vip_service_rate,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="userName != null and userName != ''">#{userName},</if>
@ -269,6 +272,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="aliOpenId != null">#{aliOpenId},</if>
<if test="channelIds != null">#{channelIds,typeHandler=com.ruoyi.system.mapper.typehandler.StringSplitListTypeHandler},</if>
<if test="appId != null">#{appId},</if>
<if test="vipServiceRate != null">#{vipServiceRate},</if>
</trim>
</insert>
@ -336,6 +340,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="aliOpenId != null">ali_open_id = #{aliOpenId},</if>
<if test="channelIds != null">channel_ids = #{channelIds,typeHandler=com.ruoyi.system.mapper.typehandler.StringSplitListTypeHandler},</if>
<if test="appId != null">app_id = #{appId},</if>
<if test="vipServiceRate != null">vip_service_rate = #{vipServiceRate},</if>
</trim>
where user_id = #{userId}
</update>

View File

@ -1,8 +1,9 @@
package com.ruoyi.ss.user.service.impl;
import org.springframework.stereotype.Service;
import com.ruoyi.common.core.domain.entity.SmUser;
import com.ruoyi.ss.user.service.UserConverter;
import org.springframework.stereotype.Service;
/**
* @author wjh
@ -55,6 +56,7 @@ public class UserConverterImpl implements UserConverter {
po.setAgentAllowMchSwitch(data.getAgentAllowMchSwitch());
po.setChannelIds(data.getChannelIds());
po.setRemark(data.getRemark());
po.setVipServiceRate(data.getVipServiceRate());
return po;
}

View File

@ -1,5 +1,18 @@
package com.ruoyi.ss.user.service.impl;
import java.math.BigDecimal;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.transaction.support.TransactionTemplate;
import com.github.pagehelper.PageHelper;
import com.ruoyi.common.auth.ali.AliAuthService;
import com.ruoyi.common.auth.ali.AliConfig;
@ -60,19 +73,8 @@ import com.ruoyi.system.domain.enums.config.ConfigKey;
import com.ruoyi.system.domain.enums.verificationCode.CodeBusinessType;
import com.ruoyi.system.service.ISysConfigService;
import com.ruoyi.system.service.IVerificationCodeService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.transaction.support.TransactionTemplate;
import java.math.BigDecimal;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
import lombok.extern.slf4j.Slf4j;
/**
* 普通用户信息Service业务层处理
@ -850,6 +852,11 @@ public class UserServiceImpl implements UserService
BigDecimal serviceRate = sysConfigService.getBigDecimal(ConfigKey.SERVICE_FEE_RATE);
smUser.setServiceRate(serviceRate);
}
// 若用户没有单独设置VIP服务费则使用系统默认VIP服务费
if (smUser.getVipServiceRate() == null) {
BigDecimal vipServiceRate = sysConfigService.getBigDecimal(ConfigKey.VIP_SERVICE_FEE_RATE);
smUser.setVipServiceRate(vipServiceRate);
}
// 若有wxOpenId则加锁
if (StringUtils.hasText(smUser.getWxOpenId())) {

View File

@ -1,5 +1,12 @@
package com.ruoyi.ss.user.service.impl;
import java.math.BigDecimal;
import java.util.HashSet;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.common.core.domain.BaseValidator;
import com.ruoyi.common.core.domain.ValidateResult;
import com.ruoyi.common.core.domain.entity.SmUser;
@ -7,19 +14,20 @@ import com.ruoyi.common.enums.UserStatus;
import com.ruoyi.common.enums.UserType;
import com.ruoyi.common.utils.ServiceUtil;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.collection.CollectionUtils;
import com.ruoyi.ss.bonus.domain.Bonus;
import com.ruoyi.ss.bonus.service.BonusConverter;
import com.ruoyi.ss.device.domain.DeviceQuery;
import com.ruoyi.ss.device.domain.vo.DeviceVO;
import com.ruoyi.ss.device.service.DeviceAssembler;
import com.ruoyi.ss.device.service.DeviceService;
import com.ruoyi.ss.store.domain.StoreVo;
import com.ruoyi.ss.store.service.StoreAssembler;
import com.ruoyi.ss.store.service.StoreService;
import com.ruoyi.ss.user.domain.SmUserQuery;
import com.ruoyi.ss.user.domain.SmUserVO;
import com.ruoyi.ss.user.service.UserService;
import com.ruoyi.ss.user.service.UserValidator;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import java.math.BigDecimal;
import java.util.HashSet;
import java.util.List;
/**
* @author wjh
@ -34,6 +42,18 @@ public class UserValidatorImpl extends BaseValidator implements UserValidator {
@Autowired
private DeviceService deviceService;
@Autowired
private BonusConverter bonusConverter;
@Autowired
private DeviceAssembler deviceAssembler;
@Autowired
private StoreService storeService;
@Autowired
private StoreAssembler storeAssembler;
/**
* 判断用户是否存在
*
@ -125,6 +145,50 @@ public class UserValidatorImpl extends BaseValidator implements UserValidator {
// 校验代理商服务费
this.checkAgentServiceRate(vo);
// 校验服务费
this.checkServiceRate(vo);
// 校验VIP服务费
this.checkVipServiceRate(vo);
}
// 校验VIP服务费
private void checkVipServiceRate(SmUserVO vo) {
if (vo == null) {
return;
}
// 查询店铺列表
List<StoreVo> storeList = storeService.selectByUserId(vo.getUserId());
if (CollectionUtils.isEmpty(storeList)) {
return;
}
// 拼接店铺分成
storeAssembler.assembleBonusList(storeList);
// 拼接商户VIP服务费
for (StoreVo store : storeList) {
BigDecimal totalPoint = CollectionUtils.sumDecimal(store.getBonusList(), Bonus::getPoint);
ServiceUtil.assertion(totalPoint.compareTo(BigDecimal.valueOf(100)) > 0, "校验商户VIP服务费失败店铺【%s】的分成总和大于100%,当前值:%s%%", store.getName(), totalPoint);
}
}
// 校验服务费
private void checkServiceRate(SmUserVO vo) {
if (vo == null) {
return;
}
// 查询设备列表
List<DeviceVO> deviceList = deviceService.selectByMchId(vo.getUserId());
if (CollectionUtils.isEmpty(deviceList)) {
return;
}
// 拼接设备分成
deviceAssembler.assembleBonusList(deviceList);
// 校验设备分成
for (DeviceVO device : deviceList) {
BigDecimal totalPoint = CollectionUtils.sumDecimal(device.getBonusList(), Bonus::getPoint);
ServiceUtil.assertion(totalPoint.compareTo(BigDecimal.valueOf(100)) > 0, "校验商户服务费失败,设备【%s】的分成总和大于100%,当前值:%s%%", device.getDeviceNo(), totalPoint);
}
}
@Override

View File

@ -1,13 +1,13 @@
package com.ruoyi.ss.vipOrder.service;
import java.util.List;
import com.ruoyi.ss.vipOrder.domain.VipOrder;
import com.ruoyi.ss.vipOrder.domain.VipOrderQuery;
import com.ruoyi.ss.vipOrder.domain.VipOrderVO;
import com.ruoyi.ss.vipOrder.domain.bo.AddPayVipOrderBO;
import com.ruoyi.ss.vipOrder.domain.vo.AddAndPayVO;
import java.util.List;
/**
* 会员订单Service接口
*

View File

@ -1,5 +1,21 @@
package com.ruoyi.web.controller.ss;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
@ -10,14 +26,8 @@ import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.ss.channel.domain.Channel;
import com.ruoyi.ss.channel.domain.ChannelQuery;
import com.ruoyi.ss.channel.domain.ChannelVO;
import com.ruoyi.ss.channel.domain.vo.ChannelNameVO;
import com.ruoyi.ss.channel.service.ChannelService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
/**
* 充值渠道Controller
@ -44,6 +54,17 @@ public class SmChannelController extends BaseController
return getDataTable(list);
}
/**
* 查询全部充值渠道列表
*/
@PreAuthorize("@ss.hasPermi('system:channel:list')")
@GetMapping("/listAll")
public AjaxResult listAll()
{
List<ChannelNameVO> list = smChannelService.selectAllChannelNameList();
return success(list);
}
/**
* 查询充值渠道列表
*/
@ -124,7 +145,7 @@ public class SmChannelController extends BaseController
}
/**
* 新增充值渠道
* 删除充值渠道
*/
@PreAuthorize("@ss.hasPermi('system:channel:delete')")
@Log(title = "充值渠道", businessType = BusinessType.DELETE)

View File

@ -1,5 +1,23 @@
package com.ruoyi.web.controller.ss;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
@ -13,16 +31,8 @@ import com.ruoyi.ss.user.domain.SmUserVO;
import com.ruoyi.ss.user.service.UserAssembler;
import com.ruoyi.ss.user.service.UserConverter;
import com.ruoyi.ss.user.service.UserService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import io.swagger.annotations.ApiOperation;
/**
* 普通用户信息Controller
@ -149,7 +159,7 @@ public class SmUserController extends BaseController
}
/**
* 删除普通用户信息
* 解除实名认证
*/
@PreAuthorize("@ss.hasPermi('system:smUser:unbindRealName')")
@Log(title = "解除实名认证", businessType = BusinessType.OTHER)