实名身份证唯一、设备录入

This commit is contained in:
磷叶 2024-11-04 15:28:58 +08:00
parent d1a35a248b
commit eb7e4d2b97
55 changed files with 404 additions and 233 deletions

View File

@ -16,7 +16,9 @@ public enum ServiceCode {
DEVICE_RECHARGE_IOT_ERROR(101001, "物联网设备充值失败"),
DEVICE_RECHARGE_ERROR(101002, "设备充值失败"),
RISK_WITHDRAW(102001, "提现风险"),
RISK_REFUND(102002, "退款风险");
RISK_REFUND(102002, "退款风险"),
DEVICE_MAC_REPEAT(103001, "设备mac重复"),
DEVICE_SN_REPEAT(103002, "设备sn重复");
private final Integer code;
private final String msg;

View File

@ -14,7 +14,7 @@ import com.ruoyi.framework.security.domain.AccessLoginUser;
import com.ruoyi.framework.web.service.SysPermissionService;
import com.ruoyi.ss.access.domain.AccessVO;
import com.ruoyi.ss.access.service.AccessService;
import com.ruoyi.ss.user.domain.SmUserVo;
import com.ruoyi.ss.user.domain.SmUserVO;
import com.ruoyi.ss.user.service.ISmUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
@ -99,7 +99,7 @@ public class JwtAuthenticationTokenFilter extends OncePerRequestFilter
accessLoginUser.setAccess(access);
// 获取用户信息
SmUserVo user = userService.selectSmUserByUserId(accessLoginUser.getAccess().getUserId());
SmUserVO user = userService.selectSmUserByUserId(accessLoginUser.getAccess().getUserId());
if (user == null) {
return null;
}

View File

@ -4,7 +4,7 @@ import com.ruoyi.ss.access.domain.Access;
import com.ruoyi.ss.access.domain.AccessQuery;
import com.ruoyi.ss.access.domain.AccessVO;
import com.ruoyi.ss.access.domain.vo.AccessApplyVO;
import com.ruoyi.ss.user.domain.SmUserVo;
import com.ruoyi.ss.user.domain.SmUserVO;
import java.util.List;
@ -76,7 +76,7 @@ public interface AccessService
*/
int selectCountByUserId(Long userId);
SmUserVo selectUserByAccess(String accessKey);
SmUserVO selectUserByAccess(String accessKey);
/**
* 根据accessKey查询秘钥对

View File

@ -12,7 +12,7 @@ import com.ruoyi.ss.access.domain.AccessVO;
import com.ruoyi.ss.access.domain.vo.AccessApplyVO;
import com.ruoyi.ss.access.mapper.AccessMapper;
import com.ruoyi.ss.access.service.AccessService;
import com.ruoyi.ss.user.domain.SmUserVo;
import com.ruoyi.ss.user.domain.SmUserVO;
import com.ruoyi.ss.user.service.ISmUserService;
import org.eclipse.jetty.util.StringUtil;
import org.springframework.beans.factory.annotation.Autowired;
@ -185,7 +185,7 @@ public class AccessServiceImpl implements AccessService
}
@Override
public SmUserVo selectUserByAccess(String accessKey) {
public SmUserVO selectUserByAccess(String accessKey) {
AccessVO access = this.selectByAccessKey(accessKey);
if (access == null) {
return null;

View File

@ -2,12 +2,11 @@ package com.ruoyi.ss.bonus.service;
import com.ruoyi.common.core.domain.entity.SysDept;
import com.ruoyi.ss.bonus.domain.Bonus;
import com.ruoyi.ss.channel.domain.ChannelVO;
import com.ruoyi.ss.device.domain.vo.DeviceVO;
import com.ruoyi.ss.transactionBill.domain.bo.RechargeBO;
import com.ruoyi.ss.transactionBill.domain.dto.RechargePayBO;
import com.ruoyi.ss.transactionBill.domain.vo.TransactionBillVO;
import com.ruoyi.ss.user.domain.SmUserVo;
import com.ruoyi.ss.user.domain.SmUserVO;
import java.util.List;
@ -36,7 +35,7 @@ public interface BonusConverter {
* @param device
* @return
*/
List<Bonus> genBonusList(SmUserVo mch, SmUserVo agent, SysDept platform, DeviceVO device);
List<Bonus> genBonusList(SmUserVO mch, SmUserVO agent, SysDept platform, DeviceVO device);
/**
* 旧订单转为分成明细

View File

@ -16,9 +16,8 @@ import com.ruoyi.ss.transactionBill.domain.TransactionBill;
import com.ruoyi.ss.transactionBill.domain.bo.RechargeBO;
import com.ruoyi.ss.transactionBill.domain.dto.RechargePayBO;
import com.ruoyi.ss.transactionBill.domain.vo.TransactionBillVO;
import com.ruoyi.ss.transactionBill.domain.vo.UserRechargeServiceVO;
import com.ruoyi.ss.transactionBill.service.TransactionBillService;
import com.ruoyi.ss.user.domain.SmUserVo;
import com.ruoyi.ss.user.domain.SmUserVO;
import com.ruoyi.ss.user.service.ISmUserService;
import com.ruoyi.system.service.ISysConfigService;
import com.ruoyi.system.service.ISysDeptService;
@ -101,7 +100,7 @@ public class BonusConverterImpl implements BonusConverter {
}
@Override
public List<Bonus> genBonusList(SmUserVo mch, SmUserVo agent, SysDept platform, DeviceVO device) {
public List<Bonus> genBonusList(SmUserVO mch, SmUserVO agent, SysDept platform, DeviceVO device) {
List<Bonus> result = new ArrayList<>();
if (mch == null || platform == null || device == null) {
return result;
@ -224,7 +223,7 @@ public class BonusConverterImpl implements BonusConverter {
return po;
}
private Bonus toPo(SmUserVo user, BigDecimal point, String ancestors, BonusArrivalType arrivalType) {
private Bonus toPo(SmUserVO user, BigDecimal point, String ancestors, BonusArrivalType arrivalType) {
if (user == null || point == null) {
return null;
}

View File

@ -22,7 +22,7 @@ import com.ruoyi.ss.bonus.mapper.BonusMapper;
import com.ruoyi.ss.bonus.service.BonusService;
import com.ruoyi.ss.recordBalance.domain.enums.RecordBalanceBstType;
import com.ruoyi.ss.store.service.StoreService;
import com.ruoyi.ss.user.domain.SmUserVo;
import com.ruoyi.ss.user.domain.SmUserVO;
import com.ruoyi.ss.user.service.ISmUserService;
import com.ruoyi.ss.user.service.UserAssembler;
import com.ruoyi.system.domain.enums.config.ConfigKey;
@ -37,7 +37,6 @@ import java.math.BigDecimal;
import java.math.RoundingMode;
import java.time.LocalDateTime;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
@ -215,7 +214,7 @@ public class BonusServiceImpl implements BonusService
BigDecimal dividedAmount = BigDecimal.ZERO; // 已分配金额
// 获取用户列表
List<SmUserVo> userList = userService.selectByUserIds(bonusList.stream()
List<SmUserVO> userList = userService.selectByUserIds(bonusList.stream()
.filter(item -> BonusArrivalType.userList().contains(item.getArrivalType()))
.map(BonusVO::getArrivalId)
.collect(Collectors.toList())
@ -281,7 +280,7 @@ public class BonusServiceImpl implements BonusService
bonus.setWaitAmount(bonus.getAmount());
// 设置预计分成时间
if (BonusArrivalType.userList().contains(bonus.getArrivalType())) {
SmUserVo user = userList.stream().filter(item -> item.getUserId().equals(bonus.getArrivalId())).findFirst().orElse(null);
SmUserVO user = userList.stream().filter(item -> item.getUserId().equals(bonus.getArrivalId())).findFirst().orElse(null);
if (user == null) {
continue;
}

View File

@ -85,4 +85,13 @@ public class DeviceQuery extends Device {
@ApiModelProperty("设备版本号")
private String version;
@ApiModelProperty("型号功能")
private String modelTag;
@ApiModelProperty("精准匹配SN")
private String eqDeviceNo;
@ApiModelProperty("排除ID")
private Long excludeDeviceId;
}

View File

@ -117,12 +117,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="deviceId != null"> and sd.device_id = #{deviceId}</if>
<if test="startRentTime != null"> and sd.rent_time >= #{startRentTime}</if>
<if test="endRentTime != null"> and sd.device_id &lt;= #{endRentTime}</if>
<if test="deviceNo != null"> and sd.device_no like concat('%', #{deviceNo}, '%')</if>
<if test="deviceNo != null and deviceNo != ''"> and sd.device_no like concat('%', #{deviceNo}, '%')</if>
<if test="eqDeviceNo != null and eqDeviceNo != ''"> and sd.device_no = #{eqDeviceNo}</if>
<if test="lockUserId != null"> and sd.lock_user_id = #{lockUserId}</if>
<if test="agentId != null "> and agent_id = #{agentId}</if>
<if test="agentName != null and agentName != ''"> and sua.user_name like concat('%', #{agentName}, '%')</if>
<if test="serviceMode != null and serviceMode != ''"> and sd.service_mode = #{serviceMode}</if>
<if test="version != null and version != ''"> and sd.version like concat('%', #{version}, '%')</if>
<if test="modelTag != null and modelTag != ''"> and find_in_set(#{modelTag}, sm.tags)</if>
<if test="excludeDeviceId != null"> and sd.device_id != #{excludeDeviceId}</if>
<if test="isArrears != null">
<if test="isArrears">
and (sd.rent_time is null or sd.rent_time &lt;= now())
@ -424,8 +427,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<update id="bindSn">
update sm_device
set device_no = #{sn}
where device_id = #{deviceId} and deleted = false and device_no is null
set device_no = if(device_id = #{deviceId}, #{sn}, null)
where device_no = #{sn} and deleted = false
</update>
<update id="updateSmDevice" parameterType="Device">

View File

@ -233,7 +233,7 @@ public interface DeviceService
boolean addTimeByUser(Long deviceId, long seconds, boolean withIot, String reason);
/**
* 设备注册
* 设备录入
*/
int register(DeviceRegisterDTO dto);
@ -378,4 +378,5 @@ public interface DeviceService
* 设置剩余时间
*/
int setTime(DeviceVO device, long seconds, int tryCount);
}

View File

@ -73,4 +73,19 @@ public interface DeviceValidator {
* 判断判断设备是否有正在使用中的订单
*/
boolean hasUsingBill(Long deviceId);
/**
* 校验MAC
* @param deviceId
* @param mac
* @param mac2
*/
void checkMac(Long deviceId, String mac, String mac2);
/**
* 校验SN
* @param deviceId
* @param deviceNo
*/
void checkSn(Long deviceId, String deviceNo);
}

View File

@ -53,7 +53,7 @@ import com.ruoyi.ss.transactionBill.domain.enums.TransactionBillStatus;
import com.ruoyi.ss.transactionBill.domain.enums.TransactionBillType;
import com.ruoyi.ss.transactionBill.domain.vo.TransactionBillVO;
import com.ruoyi.ss.transactionBill.service.TransactionBillService;
import com.ruoyi.ss.user.domain.SmUserVo;
import com.ruoyi.ss.user.domain.SmUserVO;
import com.ruoyi.ss.user.service.ISmUserService;
import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
@ -132,8 +132,8 @@ public class DeviceServiceImpl implements DeviceService
@Autowired
private DeviceSuitService deviceSuitService;
private final String WIFI_MAC = "D8";
private final String FOUR_G_MAC = "4C";
@Autowired
private DeviceSuitConverter deviceConverter;
/**
* 查询设备
@ -214,7 +214,6 @@ public class DeviceServiceImpl implements DeviceService
* @return 结果
*/
@Override
@Transactional
public int updateSmDevice(DeviceBO data) {
data.setUpdateTime(DateUtils.getNowDate());
@ -339,30 +338,18 @@ public class DeviceServiceImpl implements DeviceService
if (dto == null) {
return 0;
}
SmModelVO model = modelService.selectSmModelByModelId(dto.getModelId());
ServiceUtil.assertion(model == null, "型号不存在");
// 添加
Device device = new Device();
device.setDeviceName("未命名");
device.setMac(dto.getMac());
device.setDeviceNo(dto.getSn());
device.setModelId(dto.getModelId());
device.setServiceType(model.getServiceType());
device.setServiceRate(model.getServiceRate());
DeviceBO device = deviceConverter.toBOByRegister(dto);
DeviceVO old = selectByAnyMac(dto.getMac());
// 若为双模版本的型号则注册4G或WIFI版本MAC
if (ModelTag.isTwoMac(model.getTags())) {
if (device.getMac().endsWith(FOUR_G_MAC)) {
device.setMac2(StringUtils.replaceLast(device.getMac(), FOUR_G_MAC, WIFI_MAC));
} else {
// 替换最后两位为4G MAC
String substring = device.getMac().substring(0, device.getMac().length() - 2);
device.setMac2(substring + FOUR_G_MAC);
}
if (old == null) {
// 若设备MAC不存在则新增
return this.insertSmDevice(device);
} else {
// 若设备MAC存在则修改
device.setDeviceId(old.getDeviceId());
return this.updateSmDevice(device);
}
return this.insertSmDevice(device);
}
@Override
@ -1191,7 +1178,7 @@ public class DeviceServiceImpl implements DeviceService
);
// 查询用户
SmUserVo user = userService.selectSimpleById(userId);
SmUserVO user = userService.selectSimpleById(userId);
ServiceUtil.assertion(user == null, "用户不存在");
// 查询店铺
@ -1462,20 +1449,16 @@ public class DeviceServiceImpl implements DeviceService
}
/**
* 设备绑定SN码
* 设备绑定SN码若其他设备已有该SN则直接替换
*
* @param deviceId 设备ID
* @param sn SN
*/
@Override
public int bindSn(Long deviceId, String sn) {
Integer result = transactionTemplate.execute(status -> {
ServiceUtil.assertion(deviceValidator.isRepeatSn(deviceId, sn), "SN重复");
int i = deviceMapper.bindSn(deviceId, sn);
ServiceUtil.assertion(i != 1, "设备SN已发生变化请刷新后重试");
return i;
});
return result == null ? 0 : result;
if (deviceId == null || StringUtils.isBlank(sn)) {
return 0;
}
return deviceMapper.bindSn(deviceId, sn);
}
}

View File

@ -2,6 +2,7 @@ package com.ruoyi.ss.device.service.impl;
import com.ruoyi.common.core.domain.BaseValidator;
import com.ruoyi.common.core.domain.ValidateResult;
import com.ruoyi.common.enums.ServiceCode;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.ServiceUtil;
import com.ruoyi.common.utils.StringUtils;
@ -143,11 +144,13 @@ public class DeviceValidatorImpl extends BaseValidator implements DeviceValidato
@Override
public boolean isRepeatSn(Long deviceId, String sn) {
if (StringUtil.isBlank(sn)) {
if (StringUtils.isBlank(sn)) {
return false;
}
DeviceVO device = deviceService.selectByDeviceNo(sn);
return device != null && !Objects.equals(deviceId, device.getDeviceId());
DeviceQuery query = new DeviceQuery();
query.setEqDeviceNo(sn);
query.setExcludeDeviceId(deviceId);
return deviceService.selectCount(query) > 0;
}
@Override
@ -174,15 +177,8 @@ public class DeviceValidatorImpl extends BaseValidator implements DeviceValidato
if (vo == null) {
return;
}
if (StringUtils.hasText(vo.getMac()) || StringUtils.hasText(vo.getMac2())) {
ServiceUtil.assertion(Objects.equals(vo.getMac(), vo.getMac2()), "MAC-1和MAC-2不允许相同");
}
// if (vo.getUserId() != null || vo.getAgentId() != null) {
// ServiceUtil.assertion(Objects.equals(vo.getUserId(), vo.getAgentId()), "代理商和商户不允许是同一个用户");
// }
ServiceUtil.assertion(this.isRepeatMac(vo.getDeviceId(), vo.getMac()), "MAC-1重复:" + vo.getMac());
ServiceUtil.assertion(this.isRepeatMac(vo.getDeviceId(), vo.getMac2()), "MAC-2重复:" + vo.getMac2());
ServiceUtil.assertion(this.isRepeatSn(vo.getDeviceId(), vo.getDeviceNo()), "SN重复");
this.checkMac(vo.getDeviceId(), vo.getMac(), vo.getMac2());
this.checkSn(vo.getDeviceId(), vo.getDeviceNo());
// 校验代理商
this.checkAgent(vo);
@ -223,4 +219,18 @@ public class DeviceValidatorImpl extends BaseValidator implements DeviceValidato
int count = transactionBillService.selectSimpleCount(query);
return count > 0;
}
@Override
public void checkMac(Long deviceId, String mac, String mac2) {
if (StringUtils.hasText(mac) && StringUtils.hasText(mac2)) {
ServiceUtil.assertion(Objects.equals(mac, mac2), "MAC-1和MAC-2不允许相同");
}
ServiceUtil.assertion(this.isRepeatMac(deviceId, mac), "MAC-1重复:" + mac, ServiceCode.DEVICE_MAC_REPEAT.getCode());
ServiceUtil.assertion(this.isRepeatMac(deviceId, mac2), "MAC-2重复:" + mac2, ServiceCode.DEVICE_MAC_REPEAT.getCode());
}
@Override
public void checkSn(Long deviceId, String deviceNo) {
ServiceUtil.assertion(isRepeatSn(deviceId, deviceNo), "SN重复", ServiceCode.DEVICE_SN_REPEAT.getCode());
}
}

View File

@ -1,6 +1,7 @@
package com.ruoyi.ss.deviceSuit.service;
import com.ruoyi.ss.device.domain.DeviceBO;
import com.ruoyi.ss.device.domain.dto.DeviceRegisterDTO;
import com.ruoyi.ss.deviceSuit.domain.DeviceSuit;
import com.ruoyi.ss.suit.domain.SuitBO;
@ -22,4 +23,9 @@ public interface DeviceSuitConverter {
* 设备转为设备套餐关联PO
*/
List<DeviceSuit> toPo(DeviceBO device);
/**
* 注册时转为PO
*/
DeviceBO toBOByRegister(DeviceRegisterDTO dto);
}

View File

@ -1,9 +1,17 @@
package com.ruoyi.ss.deviceSuit.service.impl;
import com.ruoyi.common.utils.ServiceUtil;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.ss.device.domain.Device;
import com.ruoyi.ss.device.domain.DeviceBO;
import com.ruoyi.ss.device.domain.dto.DeviceRegisterDTO;
import com.ruoyi.ss.deviceSuit.domain.DeviceSuit;
import com.ruoyi.ss.deviceSuit.service.DeviceSuitConverter;
import com.ruoyi.ss.model.domain.SmModelVO;
import com.ruoyi.ss.model.domain.enums.ModelTag;
import com.ruoyi.ss.model.service.ModelService;
import com.ruoyi.ss.suit.domain.SuitBO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
@ -16,6 +24,15 @@ import java.util.List;
*/
@Service
public class DeviceSuitConverterImpl implements DeviceSuitConverter {
@Autowired
private ModelService modelService;
private final String WIFI_MAC = "D8";
private final String FOUR_G_MAC = "4C";
/**
* 套餐转为设备套餐关联PO
*
@ -58,4 +75,33 @@ public class DeviceSuitConverterImpl implements DeviceSuitConverter {
return result;
}
@Override
public DeviceBO toBOByRegister(DeviceRegisterDTO dto) {
SmModelVO model = modelService.selectSmModelByModelId(dto.getModelId());
ServiceUtil.assertion(model == null, "型号不存在");
// 添加
DeviceBO device = new DeviceBO();
device.setDeviceName("未命名");
device.setMac(dto.getMac());
device.setDeviceNo(dto.getSn());
device.setModelId(dto.getModelId());
device.setServiceType(model.getServiceType());
device.setServiceRate(model.getServiceRate());
// 若为双模版本的型号则注册4G或WIFI版本MAC
if (ModelTag.isTwoMac(model.getTags())) {
if (device.getMac().endsWith(FOUR_G_MAC)) {
device.setMac2(StringUtils.replaceLast(device.getMac(), FOUR_G_MAC, WIFI_MAC));
} else {
// 替换最后两位为4G MAC
String substring = device.getMac().substring(0, device.getMac().length() - 2);
device.setMac2(substring + FOUR_G_MAC);
}
}
return device;
}
}

View File

@ -12,7 +12,7 @@ import com.ruoyi.ss.transactionBill.domain.bo.RechargePayDepositBO;
import com.ruoyi.ss.transactionBill.domain.dto.RechargePayBO;
import com.ruoyi.ss.transactionBill.domain.enums.TransactionBillPayType;
import com.ruoyi.ss.transactionBill.domain.vo.TransactionBillVO;
import com.ruoyi.ss.user.domain.SmUserVo;
import com.ruoyi.ss.user.domain.SmUserVO;
import com.ruoyi.ss.user.service.ISmUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -42,7 +42,7 @@ public class PayBillConverterImpl implements PayBillConverter {
PayBill po = new PayBill();
// 查询用户
SmUserVo user = userService.selectSmUserByUserId(bill.getUserId());
SmUserVO user = userService.selectSmUserByUserId(bill.getUserId());
if (user == null) {
return null;
}
@ -95,7 +95,7 @@ public class PayBillConverterImpl implements PayBillConverter {
return null;
}
SmUserVo user = bo.getUser();
SmUserVO user = bo.getUser();
if (user == null) {
return null;
}
@ -134,7 +134,7 @@ public class PayBillConverterImpl implements PayBillConverter {
return null;
}
SmUserVo user = bo.getUser();
SmUserVO user = bo.getUser();
if (user == null) {
return null;
}

View File

@ -1,5 +1,6 @@
package com.ruoyi.ss.realName.domain;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
@ -8,4 +9,10 @@ import lombok.Data;
*/
@Data
public class RealNameQuery extends RealNameVO {
@ApiModelProperty("精确匹配身份证")
private String eqIdCard;
@ApiModelProperty("排除用户ID")
private Long excludeUserId;
}

View File

@ -62,4 +62,11 @@ public interface RealNameMapper
* @return 结果
*/
public int deleteRealNameByIds(Long[] ids);
/**
* 查询数量
* @param query
* @return
*/
int selectCount(@Param("query") RealNameQuery query);
}

View File

@ -25,8 +25,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<sql id="searchCondition">
<if test="query.id != null "> and srn.id = #{query.id}</if>
<if test="query.userId != null "> and srn.user_id = #{query.userId}</if>
<if test="query.excludeUserId != null "> and srn.user_id != #{query.excludeUserId}</if>
<if test="query.name != null and query.name != ''"> and srn.name like concat('%', #{query.name}, '%')</if>
<if test="query.idCard != null and query.idCard != ''"> and srn.id_card like concat('%', #{query.idCard}, '%')</if>
<if test="query.eqIdCard != null and query.eqIdCard != ''"> and srn.id_card = #{query.eqIdCard}</if>
<if test="query.mobile != null and query.mobile != ''"> and srn.mobile like concat('%', #{query.mobile}, '%')</if>
<if test="query.userName != null and query.userName != ''"> and su.user_name like concat('%', #{query.userName}, '%')</if>
<if test="query.type != null and query.type != ''"> and type = #{query.type}</if>
@ -44,6 +46,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where srn.id = #{id}
</select>
<select id="selectCount" resultType="java.lang.Integer">
select count(srn.id)
from ss_real_name srn
<where>
<include refid="searchCondition"/>
</where>
</select>
<insert id="insertRealName" parameterType="RealName" useGeneratedKeys="true" keyProperty="id">
<selectKey keyProperty="id" order="AFTER" resultType="Long">
SELECT LAST_INSERT_ID();

View File

@ -12,7 +12,7 @@ import java.util.List;
* @author ruoyi
* @date 2024-09-23
*/
public interface IRealNameService
public interface RealNameService
{
/**
* 查询实名认证
@ -61,4 +61,7 @@ public interface IRealNameService
* @return 结果
*/
public int deleteRealNameById(Long id);
int selectCount(RealNameQuery query);
}

View File

@ -0,0 +1,11 @@
package com.ruoyi.ss.realName.service;
/**
* @author wjh
* 2024/11/4
*/
public interface RealNameValidator {
void checkIdCard(Long userId, String idCard);
}

View File

@ -5,7 +5,7 @@ import com.ruoyi.ss.realName.domain.RealName;
import com.ruoyi.ss.realName.domain.RealNameQuery;
import com.ruoyi.ss.realName.domain.RealNameVO;
import com.ruoyi.ss.realName.mapper.RealNameMapper;
import com.ruoyi.ss.realName.service.IRealNameService;
import com.ruoyi.ss.realName.service.RealNameService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -18,7 +18,7 @@ import java.util.List;
* @date 2024-09-23
*/
@Service
public class RealNameServiceImpl implements IRealNameService
public class RealNameServiceImpl implements RealNameService
{
@Autowired
private RealNameMapper realNameMapper;
@ -95,4 +95,9 @@ public class RealNameServiceImpl implements IRealNameService
{
return realNameMapper.deleteRealNameById(id);
}
@Override
public int selectCount(RealNameQuery query) {
return realNameMapper.selectCount(query);
}
}

View File

@ -0,0 +1,34 @@
package com.ruoyi.ss.realName.service.impl;
import com.ruoyi.common.utils.ServiceUtil;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.ss.realName.domain.RealNameQuery;
import com.ruoyi.ss.realName.service.RealNameService;
import com.ruoyi.ss.realName.service.RealNameValidator;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
* @author wjh
* 2024/11/4
*/
@Service
public class RealNameValidatorImpl implements RealNameValidator {
@Autowired
private RealNameService realNameService;
/**
* 判断身份证是否已经实名
*/
@Override
public void checkIdCard(Long userId, String idCard) {
if (StringUtils.isBlank(idCard)) {
return;
}
RealNameQuery query = new RealNameQuery();
query.setEqIdCard(idCard);
query.setExcludeUserId(userId);
ServiceUtil.assertion(realNameService.selectCount(query) > 0, "身份证已被其他用户使用,无法重复实名");
}
}

View File

@ -5,7 +5,7 @@ import com.ruoyi.ss.receiveBill.domain.ReceiveBill;
import com.ruoyi.ss.receiveBill.domain.ReceiveBillQuery;
import com.ruoyi.ss.receiveBill.domain.ReceiveBillVO;
import com.ruoyi.ss.receiveBill.domain.vo.ReceiveAmountVO;
import com.ruoyi.ss.user.domain.SmUserVo;
import com.ruoyi.ss.user.domain.SmUserVO;
import java.math.BigDecimal;
import java.util.List;
@ -72,7 +72,7 @@ public interface ReceiveBillService
* @param mch 商户信息
* @param device 设备信息
*/
int genBillByMonthAndPay(SmUserVo mch, DeviceVO device);
int genBillByMonthAndPay(SmUserVO mch, DeviceVO device);
/**
* 查询数量

View File

@ -14,7 +14,7 @@ import com.ruoyi.ss.receiveBill.mapper.ReceiveBillMapper;
import com.ruoyi.ss.receiveBill.service.ReceiveBillService;
import com.ruoyi.ss.recordBalance.domain.enums.RecordBalanceBstType;
import com.ruoyi.ss.transactionBill.service.impl.TransactionBillServiceImpl;
import com.ruoyi.ss.user.domain.SmUserVo;
import com.ruoyi.ss.user.domain.SmUserVO;
import com.ruoyi.ss.user.service.ISmUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -122,7 +122,7 @@ public class ReceiveBillServiceImpl implements ReceiveBillService
}
@Override
public int genBillByMonthAndPay(SmUserVo mch, DeviceVO device) {
public int genBillByMonthAndPay(SmUserVO mch, DeviceVO device) {
ServiceUtil.assertion(mch == null || mch.getUserId() == null, "商户不存在");
ServiceUtil.assertion(device == null || device.getDeviceId() == null, "设备不存在");

View File

@ -4,7 +4,7 @@ import com.ruoyi.common.core.domain.model.LoginUser;
import com.ruoyi.ss.device.domain.Device;
import com.ruoyi.ss.device.domain.vo.DeviceVO;
import com.ruoyi.ss.record.time.domain.RecordTime;
import com.ruoyi.ss.user.domain.SmUserVo;
import com.ruoyi.ss.user.domain.SmUserVO;
/**
* @author wjh
@ -14,5 +14,5 @@ public interface RecordTimeConverter {
RecordTime toRecordTime(Device device, long amount, String reason, LoginUser loginUser, String type);
RecordTime toRecordTime(DeviceVO device, long secondSuitTime, String reason, SmUserVo user, String type);
RecordTime toRecordTime(DeviceVO device, long secondSuitTime, String reason, SmUserVO user, String type);
}

View File

@ -7,7 +7,7 @@ import com.ruoyi.ss.device.domain.vo.DeviceVO;
import com.ruoyi.ss.record.time.domain.RecordTime;
import com.ruoyi.ss.record.time.domain.enums.OperatorType;
import com.ruoyi.ss.record.time.service.RecordTimeConverter;
import com.ruoyi.ss.user.domain.SmUserVo;
import com.ruoyi.ss.user.domain.SmUserVO;
import org.springframework.stereotype.Service;
import java.time.LocalDateTime;
@ -36,7 +36,7 @@ public class RecordTimeConverterImpl implements RecordTimeConverter {
}
@Override
public RecordTime toRecordTime(DeviceVO device, long seconds, String reason, SmUserVo user, String type) {
public RecordTime toRecordTime(DeviceVO device, long seconds, String reason, SmUserVO user, String type) {
RecordTime record = new RecordTime();
record.setDeviceId(device == null ? null : device.getDeviceId());
record.setAmount(seconds);

View File

@ -2,13 +2,12 @@ package com.ruoyi.ss.transactionBill.domain.bo;
import com.ruoyi.common.core.domain.entity.SysDept;
import com.ruoyi.ss.bonus.domain.Bonus;
import com.ruoyi.ss.channel.domain.ChannelVO;
import com.ruoyi.ss.device.domain.vo.DeviceVO;
import com.ruoyi.ss.store.domain.StoreVo;
import com.ruoyi.ss.suit.domain.SuitVO;
import com.ruoyi.ss.transactionBill.domain.TransactionBill;
import com.ruoyi.ss.transactionBill.domain.dto.RechargeDTO;
import com.ruoyi.ss.user.domain.SmUserVo;
import com.ruoyi.ss.user.domain.SmUserVO;
import lombok.Data;
import java.util.List;
@ -25,10 +24,10 @@ public class RechargeBO {
private DeviceVO device;
// 充值用户
private SmUserVo user;
private SmUserVO user;
// 商户
private SmUserVo mch;
private SmUserVO mch;
// 套餐
private SuitVO suit;
@ -49,5 +48,5 @@ public class RechargeBO {
private SysDept platform;
// 代理商
private SmUserVo agent;
private SmUserVO agent;
}

View File

@ -3,7 +3,7 @@ package com.ruoyi.ss.transactionBill.domain.bo;
import com.ruoyi.ss.channel.domain.ChannelVO;
import com.ruoyi.ss.transactionBill.domain.dto.PayDepositDTO;
import com.ruoyi.ss.transactionBill.domain.vo.TransactionBillVO;
import com.ruoyi.ss.user.domain.SmUserVo;
import com.ruoyi.ss.user.domain.SmUserVO;
import lombok.Data;
/**
@ -24,6 +24,6 @@ public class RechargePayDepositBO {
private ChannelVO channel;
// 用户
private SmUserVo user;
private SmUserVO user;
}

View File

@ -1,10 +1,9 @@
package com.ruoyi.ss.transactionBill.domain.bo;
import com.ruoyi.ss.account.domain.AccountVO;
import com.ruoyi.ss.channel.domain.ChannelVO;
import com.ruoyi.ss.channelWithdraw.domain.ChannelWithdrawVO;
import com.ruoyi.ss.transactionBill.domain.dto.WithdrawDTO;
import com.ruoyi.ss.user.domain.SmUserVo;
import com.ruoyi.ss.user.domain.SmUserVO;
import lombok.Data;
/**
@ -16,7 +15,7 @@ import lombok.Data;
public class WithdrawBO {
// 用户信息
private SmUserVo user;
private SmUserVO user;
// 原始参数
private WithdrawDTO dto;

View File

@ -4,10 +4,8 @@ import com.ruoyi.common.core.domain.entity.SysDept;
import com.ruoyi.ss.bonus.domain.Bonus;
import com.ruoyi.ss.channel.domain.ChannelVO;
import com.ruoyi.ss.device.domain.vo.DeviceVO;
import com.ruoyi.ss.transactionBill.domain.TransactionBill;
import com.ruoyi.ss.transactionBill.domain.vo.TransactionBillVO;
import com.ruoyi.ss.user.domain.SmUserVo;
import io.swagger.annotations.ApiModelProperty;
import com.ruoyi.ss.user.domain.SmUserVO;
import lombok.Data;
import java.util.List;
@ -26,10 +24,10 @@ public class RechargePayBO {
private ChannelVO channel;
// 用户
private SmUserVo user;
private SmUserVO user;
// 商户
private SmUserVo mch;
private SmUserVO mch;
// 设备
private DeviceVO device;

View File

@ -5,7 +5,7 @@ import com.ruoyi.ss.transactionBill.domain.bo.RechargeBO;
import com.ruoyi.ss.transactionBill.domain.bo.RechargePayDepositBO;
import com.ruoyi.ss.transactionBill.domain.dto.RechargePayBO;
import com.ruoyi.ss.transactionBill.domain.vo.TransactionBillVO;
import com.ruoyi.ss.user.domain.SmUserVo;
import com.ruoyi.ss.user.domain.SmUserVO;
/**
* 2024/4/22
@ -65,5 +65,5 @@ public interface TransactionBillValidator {
* 校验退款风控
* @param user 用户
*/
void checkRefundRisk(SmUserVo user);
void checkRefundRisk(SmUserVO user);
}

View File

@ -1,7 +1,7 @@
package com.ruoyi.ss.transactionBill.service;
import com.ruoyi.ss.transactionBill.domain.bo.WithdrawBO;
import com.ruoyi.ss.user.domain.SmUserVo;
import com.ruoyi.ss.user.domain.SmUserVO;
/**
* @author wjh
@ -18,5 +18,5 @@ public interface WithdrawValidator {
* 校验实名认证风控
* @param user 用户
*/
void checkWithdrawRisk(SmUserVo user);
void checkWithdrawRisk(SmUserVO user);
}

View File

@ -23,7 +23,7 @@ import com.ruoyi.ss.transactionBill.domain.bo.*;
import com.ruoyi.ss.transactionBill.domain.dto.*;
import com.ruoyi.ss.transactionBill.domain.vo.TransactionBillVO;
import com.ruoyi.ss.transactionBill.service.TransactionBillConverter;
import com.ruoyi.ss.user.domain.SmUserVo;
import com.ruoyi.ss.user.domain.SmUserVO;
import com.ruoyi.ss.user.service.ISmUserService;
import com.ruoyi.system.service.ISysDeptService;
import org.springframework.beans.factory.annotation.Autowired;
@ -86,14 +86,14 @@ public class TransactionBillConverterImpl implements TransactionBillConverter {
StoreVo store = storeService.selectSmStoreById(device.getStoreId());
SmUserVo mch = userService.selectSmUserByUserId(device.getUserId());
SmUserVO mch = userService.selectSmUserByUserId(device.getUserId());
ServiceUtil.assertion(mch == null, "商户不存在");
SuitVO suit = suitService.selectSuitBySuitId(dto.getSuitId());
ServiceUtil.assertion(suit == null, "套餐不存在");
suitAssembler.assembleDeviceList(Collections.singletonList(suit));
SmUserVo user = userService.selectSmUserByUserId(SecurityUtils.getUserId());
SmUserVO user = userService.selectSmUserByUserId(SecurityUtils.getUserId());
ServiceUtil.assertion(user == null, "用户不存在");
ServiceUtil.assertion(user.getWxOpenId() == null, "用户微信openId为空");
@ -121,7 +121,7 @@ public class TransactionBillConverterImpl implements TransactionBillConverter {
}
// 用户
SmUserVo user = userService.selectSmUserByUserId(dto.getUserId());
SmUserVO user = userService.selectSmUserByUserId(dto.getUserId());
ServiceUtil.assertion(user == null, "用户不存在");
// 渠道

View File

@ -58,7 +58,7 @@ import com.ruoyi.ss.transfer.domain.TransferVO;
import com.ruoyi.ss.transfer.interfaces.AfterTransfer;
import com.ruoyi.ss.transfer.service.TransferConverter;
import com.ruoyi.ss.transfer.service.TransferService;
import com.ruoyi.ss.user.domain.SmUserVo;
import com.ruoyi.ss.user.domain.SmUserVO;
import com.ruoyi.ss.user.service.ISmUserService;
import com.ruoyi.common.pay.wx.service.WxPayService;
import com.ruoyi.system.domain.enums.config.ConfigKey;
@ -469,9 +469,9 @@ public class TransactionBillServiceImpl implements TransactionBillService, After
ServiceUtil.assertion(transactionBillValidator.preAddOrder(bo));
RechargeDTO dto = bo.getParams();
DeviceVO device = bo.getDevice();
SmUserVo mch = bo.getMch();
SmUserVO mch = bo.getMch();
SuitVO suit = bo.getSuit();
SmUserVo user = bo.getUser();
SmUserVO user = bo.getUser();
StoreVo store = bo.getStore();
// 创建订单
@ -563,7 +563,7 @@ public class TransactionBillServiceImpl implements TransactionBillService, After
try {
WithdrawDTO dto = bo.getDto();
ChannelWithdrawVO channel = bo.getChannel();
SmUserVo user = bo.getUser();
SmUserVO user = bo.getUser();
AccountVO account = bo.getAccount();
ServiceUtil.assertion(user == null, "用户不存在");
@ -705,7 +705,7 @@ public class TransactionBillServiceImpl implements TransactionBillService, After
* 获取用户提现服务费
* 用户 > 渠道
*/
private UserWithdrawServiceVO getUserWithdrawService(SmUserVo user, ChannelWithdrawVO channel) {
private UserWithdrawServiceVO getUserWithdrawService(SmUserVO user, ChannelWithdrawVO channel) {
if (user != null && StringUtils.hasText(user.getWithdrawServiceType()) && user.getWithdrawServiceRate() != null ) {
return new UserWithdrawServiceVO(user.getWithdrawServiceType(), user.getWithdrawServiceRate());
} else if (channel != null && StringUtils.hasText(channel.getServiceType()) && channel.getServiceRate() != null) {
@ -1726,7 +1726,7 @@ public class TransactionBillServiceImpl implements TransactionBillService, After
if (device == null) {
return;
}
SmUserVo user = userService.selectSmUserByUserId(bill.getUserId());
SmUserVO user = userService.selectSmUserByUserId(bill.getUserId());
// 根据订单套餐类型记录
if (SuitFeeType.TIME.getType().equals(bill.getSuitFeeType())) {
recordTimeService.insertRecordTime(recordTimeConverter.toRecordTime(device, transactionBillConverter.toRechargeSeconds(bill), reason, user, RecordTimeType.TIME.getType()));
@ -2031,7 +2031,7 @@ public class TransactionBillServiceImpl implements TransactionBillService, After
@Override
public UserWithdrawServiceVO getUserWithdrawService(Long userId, Long channelId) {
SmUserVo user = userService.selectSmUserByUserId(userId);
SmUserVO user = userService.selectSmUserByUserId(userId);
ChannelWithdrawVO channel = channelWithdrawService.selectChannelWithdrawByChannelId(channelId);
return this.getUserWithdrawService(user, channel);
}

View File

@ -32,7 +32,7 @@ import com.ruoyi.ss.transactionBill.domain.enums.TransactionBillType;
import com.ruoyi.ss.transactionBill.domain.vo.TransactionBillVO;
import com.ruoyi.ss.transactionBill.service.TransactionBillService;
import com.ruoyi.ss.transactionBill.service.TransactionBillValidator;
import com.ruoyi.ss.user.domain.SmUserVo;
import com.ruoyi.ss.user.domain.SmUserVO;
import com.ruoyi.ss.user.service.UserValidator;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -86,7 +86,7 @@ public class TransactionBillValidatorImpl extends BaseValidator implements Trans
}
// 用户
SmUserVo user = bo.getUser();
SmUserVO user = bo.getUser();
// 检查用户是否有未支付的智能分时段订单
if (this.hasUnpaidSmartTimingOrder(user.getUserId())) {
return error("您有未支付的订单,请先支付后继续");
@ -117,7 +117,7 @@ public class TransactionBillValidatorImpl extends BaseValidator implements Trans
}
// 商户检查
SmUserVo mch = bo.getMch();
SmUserVO mch = bo.getMch();
if (!userValidator.isUsage(device.getUserId())) {
return error("当前设备商户不存在或不可用,无法充值,请确认商户账号是否正常");
}
@ -319,7 +319,7 @@ public class TransactionBillValidatorImpl extends BaseValidator implements Trans
return error("支付渠道不可用");
}
SmUserVo user = bo.getUser();
SmUserVO user = bo.getUser();
if (user == null) {
return error("用户不存在");
}
@ -333,7 +333,7 @@ public class TransactionBillValidatorImpl extends BaseValidator implements Trans
}
@Override
public void checkRefundRisk(SmUserVo user) {
public void checkRefundRisk(SmUserVO user) {
if (user == null || user.getUserId() == null) {
return;
}

View File

@ -19,14 +19,13 @@ import com.ruoyi.ss.transactionBill.domain.enums.TransactionBillType;
import com.ruoyi.ss.transactionBill.domain.vo.TransactionBillVO;
import com.ruoyi.ss.transactionBill.service.TransactionBillService;
import com.ruoyi.ss.transactionBill.service.WithdrawValidator;
import com.ruoyi.ss.user.domain.SmUserVo;
import com.ruoyi.ss.user.domain.SmUserVO;
import com.ruoyi.system.domain.enums.config.ConfigKey;
import com.ruoyi.system.service.ISysConfigService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.math.BigDecimal;
import java.time.Duration;
import java.time.LocalDateTime;
import java.util.List;
@ -59,7 +58,7 @@ public class WithdrawValidatorImpl extends BaseValidator implements WithdrawVali
if (bo == null || bo.getUser() == null || bo.getDto() == null) {
return false;
}
SmUserVo user = bo.getUser();
SmUserVO user = bo.getUser();
WithdrawDTO dto = bo.getDto();
// 查询时间相近的充值订单
@ -83,7 +82,7 @@ public class WithdrawValidatorImpl extends BaseValidator implements WithdrawVali
}
@Override
public void checkWithdrawRisk(SmUserVo user) {
public void checkWithdrawRisk(SmUserVO user) {
if (user == null || user.getUserId() == null) {
return;
}

View File

@ -35,4 +35,6 @@ public class SmUserQuery extends SmUser {
@ApiModelProperty("排除的用户ID")
private Long excludeUserId;
@ApiModelProperty("实名或用户名")
private String realOrUserName;
}

View File

@ -16,7 +16,7 @@ import java.math.BigDecimal;
* 2024/3/2
*/
@Data
public class SmUserVo extends SmUser {
public class SmUserVO extends SmUser {
@Excel(name = "绑定设备数量")
@ApiModelProperty("绑定设备数量")
@JsonView(JsonViewProfile.App.class)

View File

@ -2,7 +2,7 @@ package com.ruoyi.ss.user.mapper;
import com.ruoyi.common.core.domain.entity.SmUser;
import com.ruoyi.ss.user.domain.SmUserQuery;
import com.ruoyi.ss.user.domain.SmUserVo;
import com.ruoyi.ss.user.domain.SmUserVO;
import org.apache.ibatis.annotations.Param;
import java.math.BigDecimal;
@ -22,7 +22,7 @@ public interface SmUserMapper
* @param userId 普通用户信息主键
* @return 普通用户信息
*/
public SmUserVo selectSmUserByUserId(Long userId);
public SmUserVO selectSmUserByUserId(Long userId);
/**
* 查询普通用户信息列表
@ -30,7 +30,7 @@ public interface SmUserMapper
* @param smUser 普通用户信息
* @return 普通用户信息集合
*/
public List<SmUserVo> selectSmUserList(SmUserQuery smUser);
public List<SmUserVO> selectSmUserList(SmUserQuery smUser);
/**
* 新增普通用户信息
@ -68,9 +68,9 @@ public interface SmUserMapper
int addBalance(@Param("userId") Long userId, @Param("amount") BigDecimal amount);
SmUserVo selectSmUserByWxOpenId(String openId);
SmUserVO selectSmUserByWxOpenId(String openId);
SmUserVo selectSimpleById(Long userId);
SmUserVO selectSimpleById(Long userId);
/**
* 查询用户余额统计
@ -83,7 +83,7 @@ public interface SmUserMapper
* @param deviceId 设备列表
* @return 租户列表
*/
List<SmUserVo> selectDeviceTenant(@Param("deviceId") Long deviceId);
List<SmUserVO> selectDeviceTenant(@Param("deviceId") Long deviceId);
/**
* 逻辑删除

View File

@ -4,7 +4,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.ss.user.mapper.SmUserMapper">
<resultMap type="SmUserVo" id="SmUserResult" autoMapping="true">
<resultMap type="SmUserVO" id="SmUserResult" autoMapping="true">
<result property="balance" column="balance" typeHandler="com.ruoyi.system.mapper.typehandler.NonNullDecimalTypeHandler" />
<result property="rechargeAmount" column="recharge_amount" typeHandler="com.ruoyi.system.mapper.typehandler.NonNullDecimalTypeHandler" />
<result property="withDrawlAmount" column="with_drawl_amount" typeHandler="com.ruoyi.system.mapper.typehandler.NonNullDecimalTypeHandler" />
@ -89,6 +89,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="readMchLicence != null "> and read_mch_licence = #{readMchLicence}</if>
<if test="showBillMobile != null "> and show_bill_mobile = #{showBillMobile}</if>
<if test="excludeUserId != null">and su.user_id != #{excludeUserId}</if>
<if test="realOrUserName != null and realOrUserName != ''">and if(su.is_real, su.real_name, su.user_name) like concat('%', #{realOrUserName}, '%')</if>
<if test="tenantDeviceId != null">
and su.user_id in (
select sdt.tenant_id

View File

@ -4,7 +4,7 @@ import com.ruoyi.common.core.domain.entity.SmUser;
import com.ruoyi.common.enums.UserType;
import com.ruoyi.ss.recordBalance.domain.enums.RecordBalanceBstType;
import com.ruoyi.ss.user.domain.SmUserQuery;
import com.ruoyi.ss.user.domain.SmUserVo;
import com.ruoyi.ss.user.domain.SmUserVO;
import com.ruoyi.ss.user.domain.dto.UserRealNameDTO;
import com.ruoyi.ss.user.domain.vo.UserRealNameVO;
@ -25,7 +25,7 @@ public interface ISmUserService
* @param userId 普通用户信息主键
* @return 普通用户信息
*/
public SmUserVo selectSmUserByUserId(Long userId);
public SmUserVO selectSmUserByUserId(Long userId);
/**
* 查询普通用户信息列表
@ -33,7 +33,7 @@ public interface ISmUserService
* @param smUser 普通用户信息
* @return 普通用户信息集合
*/
public List<SmUserVo> selectSmUserList(SmUserQuery smUser);
public List<SmUserVO> selectSmUserList(SmUserQuery smUser);
/**
* 新增普通用户信息
@ -72,13 +72,13 @@ public interface ISmUserService
* @param username
* @return
*/
SmUserVo selectUserByUserName(String username);
SmUserVO selectUserByUserName(String username);
/**
* 数据脱敏
* @param list 用户列表
*/
void desensitization(List<SmUserVo> list);
void desensitization(List<SmUserVO> list);
/**
* 查询用户总数
@ -92,7 +92,7 @@ public interface ISmUserService
* @param phoneNumber
* @return
*/
SmUserVo selectUserByPhone(String phoneNumber);
SmUserVO selectUserByPhone(String phoneNumber);
/**
* 更换用户类型
@ -151,7 +151,7 @@ public interface ISmUserService
* @param userId 用户id
* @return 用户信息
*/
SmUserVo selectSimpleById(Long userId);
SmUserVO selectSimpleById(Long userId);
/**
* 逻辑删除
@ -171,7 +171,7 @@ public interface ISmUserService
* 通过用户微信openId查询列表
* @param openid 微信openId
*/
SmUserVo selectSmUserByWxOpenId(String openid);
SmUserVO selectSmUserByWxOpenId(String openid);
/**
* 修改密码
@ -183,7 +183,7 @@ public interface ISmUserService
/**
* ids查询列表
*/
List<SmUserVo> selectByIds(List<Long> ids);
List<SmUserVO> selectByIds(List<Long> ids);
/**
* 将用户设置为商家
@ -232,7 +232,7 @@ public interface ISmUserService
/**
* 根据用户ID列表查询
*/
List<SmUserVo> selectByUserIds(List<Long> userIds);
List<SmUserVO> selectByUserIds(List<Long> userIds);
/**
* 获取用户修改手机号的旧手机短信验证码

View File

@ -1,6 +1,6 @@
package com.ruoyi.ss.user.service;
import com.ruoyi.ss.user.domain.SmUserVo;
import com.ruoyi.ss.user.domain.SmUserVO;
import java.util.List;
@ -13,26 +13,26 @@ public interface UserAssembler {
/**
* 拼接用户店铺数量
*/
void assembleStoreCount(List<SmUserVo> list);
void assembleStoreCount(List<SmUserVO> list);
/**
* 拼接用户设备数量
*/
void assembleDeviceCount(List<SmUserVo> list);
void assembleDeviceCount(List<SmUserVO> list);
/**
* 拼接用户实际到账延迟
*/
void assembleRealArrivalDelay(List<SmUserVo> userList);
void assembleRealArrivalDelay(List<SmUserVO> userList);
/**
* 拼接用户实际服务费率
*/
void assembleRealServiceRate(List<SmUserVo> list);
void assembleRealServiceRate(List<SmUserVO> list);
/**
* 拼接未入账金额
* @param list
*/
void assembleWaitBonusAmount(List<SmUserVo> list);
void assembleWaitBonusAmount(List<SmUserVO> list);
}

View File

@ -2,7 +2,7 @@ package com.ruoyi.ss.user.service;
import com.ruoyi.common.core.domain.ValidateResult;
import com.ruoyi.common.core.domain.entity.SmUser;
import com.ruoyi.ss.user.domain.SmUserVo;
import com.ruoyi.ss.user.domain.SmUserVO;
import java.util.List;
@ -46,7 +46,7 @@ public interface UserValidator {
/**
* 后校验
*/
void afterCheck(SmUserVo vo);
void afterCheck(SmUserVO vo);
/**
* 插入前校验

View File

@ -28,7 +28,8 @@ import com.ruoyi.ss.device.domain.vo.DeviceVO;
import com.ruoyi.ss.device.service.DeviceService;
import com.ruoyi.ss.realName.domain.RealName;
import com.ruoyi.ss.realName.domain.enums.RealNameType;
import com.ruoyi.ss.realName.service.IRealNameService;
import com.ruoyi.ss.realName.service.RealNameService;
import com.ruoyi.ss.realName.service.RealNameValidator;
import com.ruoyi.ss.recordBalance.domain.enums.RecordBalanceBstType;
import com.ruoyi.ss.recordBalance.service.RecordBalanceService;
import com.ruoyi.ss.risk.domain.Risk;
@ -39,7 +40,7 @@ import com.ruoyi.ss.store.domain.StoreQuery;
import com.ruoyi.ss.store.domain.StoreVo;
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.domain.SmUserVO;
import com.ruoyi.ss.user.domain.dto.UserFaceDTO;
import com.ruoyi.ss.user.domain.dto.UserRealNameDTO;
import com.ruoyi.ss.user.domain.vo.UserRealNameVO;
@ -93,7 +94,7 @@ public class SmUserServiceImpl implements ISmUserService
private RedisCache redisCache;
@Autowired
private IRealNameService realNameService;
private RealNameService realNameService;
@Autowired
private ISysConfigService sysConfigService;
@ -116,6 +117,9 @@ public class SmUserServiceImpl implements ISmUserService
@Autowired
private RedisLock redisLock;
@Autowired
private RealNameValidator realNameValidator;
/**
* 查询普通用户信息
*
@ -123,7 +127,7 @@ public class SmUserServiceImpl implements ISmUserService
* @return 普通用户信息
*/
@Override
public SmUserVo selectSmUserByUserId(Long userId) {
public SmUserVO selectSmUserByUserId(Long userId) {
return smUserMapper.selectSmUserByUserId(userId);
}
@ -134,9 +138,9 @@ public class SmUserServiceImpl implements ISmUserService
* @return 普通用户信息
*/
@Override
public List<SmUserVo> selectSmUserList(SmUserQuery dto)
public List<SmUserVO> selectSmUserList(SmUserQuery dto)
{
List<SmUserVo> list = smUserMapper.selectSmUserList(dto);
List<SmUserVO> list = smUserMapper.selectSmUserList(dto);
desensitization(list);
return list;
}
@ -146,7 +150,7 @@ public class SmUserServiceImpl implements ISmUserService
* @param list
*/
@Override
public void desensitization(List<SmUserVo> list) {
public void desensitization(List<SmUserVO> list) {
if (CollectionUtils.isEmpty(list)) {
return;
}
@ -164,13 +168,13 @@ public class SmUserServiceImpl implements ISmUserService
}
@Override
public SmUserVo selectUserByPhone(String phoneNumber) {
public SmUserVO selectUserByPhone(String phoneNumber) {
if (phoneNumber == null) {
return null;
}
SmUserQuery dto = new SmUserQuery();
dto.setPhonenumber(phoneNumber);
List<SmUserVo> list = smUserMapper.selectSmUserList(dto);
List<SmUserVO> list = smUserMapper.selectSmUserList(dto);
if (CollectionUtils.isEmpty(list)) {
return null;
}
@ -200,7 +204,7 @@ public class SmUserServiceImpl implements ISmUserService
}
// 查询用户
SmUserVo user = selectSmUserByUserId(userId);
SmUserVO user = selectSmUserByUserId(userId);
// 修改余额
int updateCount = smUserMapper.addBalance(userId, amount);
@ -227,7 +231,7 @@ public class SmUserServiceImpl implements ISmUserService
}
// 查询用户
SmUserVo user = selectSmUserByUserId(userId);
SmUserVO user = selectSmUserByUserId(userId);
// 更新用户余额
int updateCount = smUserMapper.subtractBalance(userId, amount, check);
@ -245,7 +249,7 @@ public class SmUserServiceImpl implements ISmUserService
@Transactional
public void updateWxOpenId(Long userId, String openId) {
// 判断该openId是否已经被绑定
SmUserVo repeatUser = smUserMapper.selectSmUserByWxOpenId(openId);
SmUserVO repeatUser = smUserMapper.selectSmUserByWxOpenId(openId);
ServiceUtil.assertion(repeatUser != null && !Objects.equals(repeatUser.getUserId(), userId), "该微信已被绑定");
// 修改openId
@ -256,7 +260,7 @@ public class SmUserServiceImpl implements ISmUserService
}
@Override
public SmUserVo selectSimpleById(Long userId) {
public SmUserVO selectSimpleById(Long userId) {
return smUserMapper.selectSimpleById(userId);
}
@ -271,9 +275,9 @@ public class SmUserServiceImpl implements ISmUserService
if (CollectionUtils.isEmpty(userIds)) {
return true;
}
Map<Long, SmUserVo> userMap = this.selectMapByUserIds(userIds);
Map<Long, SmUserVO> userMap = this.selectMapByUserIds(userIds);
for (Long userId : userIds) {
SmUserVo user = userMap.get(userId);
SmUserVO user = userMap.get(userId);
if (user == null) {
return false;
}
@ -282,7 +286,7 @@ public class SmUserServiceImpl implements ISmUserService
}
@Override
public SmUserVo selectSmUserByWxOpenId(String openid) {
public SmUserVO selectSmUserByWxOpenId(String openid) {
return smUserMapper.selectSmUserByWxOpenId(openid);
}
@ -304,7 +308,7 @@ public class SmUserServiceImpl implements ISmUserService
* @param ids
*/
@Override
public List<SmUserVo> selectByIds(List<Long> ids) {
public List<SmUserVO> selectByIds(List<Long> ids) {
if (CollectionUtils.isEmpty(ids)) {
return Collections.emptyList();
}
@ -357,11 +361,16 @@ public class SmUserServiceImpl implements ISmUserService
@Override
public UserRealNameVO realName(UserRealNameDTO dto) {
SmUserVo user = selectSmUserByUserId(dto.getUserId());
SmUserVO user = selectSmUserByUserId(dto.getUserId());
ServiceUtil.assertion(user == null, "用户信息不存在");
ServiceUtil.assertion(StringUtils.isBlank(dto.getRealName()), "用户姓名不允许为空");
ServiceUtil.assertion(StringUtils.isBlank(dto.getRealIdCard()), "用户身份证不允许为空");
// 普通实名判断身份证是否重复
if (RealNameType.NORMAL.getType().equals(dto.getType())) {
realNameValidator.checkIdCard(user.getUserId(), dto.getRealIdCard());
}
// 获取活体检测token
LivenessResponseTokenData tokenData = LivenessUtils.getToken(LIVENESS_RETURN_URL, null, null);
ServiceUtil.assertion(tokenData == null || StringUtils.isBlank(tokenData.getToken()), "获取活体检测token失败");
@ -514,7 +523,7 @@ public class SmUserServiceImpl implements ISmUserService
}
@Override
public List<SmUserVo> selectByUserIds(List<Long> userIds) {
public List<SmUserVO> selectByUserIds(List<Long> userIds) {
SmUserQuery query = new SmUserQuery();
query.setUserIds(userIds);
return smUserMapper.selectSmUserList(query);
@ -522,7 +531,7 @@ public class SmUserServiceImpl implements ISmUserService
@Override
public boolean getChangeMobileCodeOld(Long userId) {
SmUserVo user = selectSmUserByUserId(userId);
SmUserVO user = selectSmUserByUserId(userId);
ServiceUtil.assertion(user == null, "用户不存在");
ServiceUtil.assertion(StringUtils.isBlank(user.getPhonenumber()), "用户没有手机号,无法获取验证码");
@ -566,7 +575,7 @@ public class SmUserServiceImpl implements ISmUserService
ServiceUtil.assertion(update != 1, "绑定手机号失败,请刷新后重试");
// 后校验
SmUserVo vo = this.selectSmUserByUserId(userId);
SmUserVO vo = this.selectSmUserByUserId(userId);
userValidator.checkMobile(vo.getUserId(), vo.getPhonenumber());
return update;
@ -581,7 +590,7 @@ public class SmUserServiceImpl implements ISmUserService
dto.setType(RealNameType.RISK.getType());
dto.setUserId(userId);
SmUserVo user = this.selectSmUserByUserId(dto.getUserId());
SmUserVO user = this.selectSmUserByUserId(dto.getUserId());
if (user.getIsReal()) {
if (user.getRealName() != null) {
dto.setRealName(user.getRealName());
@ -624,17 +633,17 @@ public class SmUserServiceImpl implements ISmUserService
* 查询用户映射表
* @param userIds
*/
private Map<Long, SmUserVo> selectMapByUserIds(List<Long> userIds) {
private Map<Long, SmUserVO> selectMapByUserIds(List<Long> userIds) {
if (CollectionUtils.isEmpty(userIds)) {
return Collections.emptyMap();
}
SmUserQuery dto = new SmUserQuery();
dto.setUserIds(userIds);
List<SmUserVo> list = smUserMapper.selectSmUserList(dto);
List<SmUserVO> list = smUserMapper.selectSmUserList(dto);
if (CollectionUtils.isEmpty(list)) {
return Collections.emptyMap();
}
return list.stream().collect(Collectors.toMap(SmUserVo::getUserId, item -> item));
return list.stream().collect(Collectors.toMap(SmUserVO::getUserId, item -> item));
}
/**
@ -676,7 +685,7 @@ public class SmUserServiceImpl implements ISmUserService
ServiceUtil.assertion(insert != 1, "新增用户失败,请刷新后重试");
// 后校验
SmUserVo vo = this.selectSmUserByUserId(smUser.getUserId());
SmUserVO vo = this.selectSmUserByUserId(smUser.getUserId());
userValidator.afterCheck(vo);
return insert;
@ -692,7 +701,7 @@ public class SmUserServiceImpl implements ISmUserService
}
// 根据微信openId查询信息
private SmUserVo selectUserByWxOpenId(String wxOpenId) {
private SmUserVO selectUserByWxOpenId(String wxOpenId) {
if (wxOpenId == null) {
return null;
}
@ -717,7 +726,7 @@ public class SmUserServiceImpl implements ISmUserService
int update = smUserMapper.updateSmUser(smUser);
ServiceUtil.assertion(update != 1, "更新用户失败");
SmUserVo vo = this.selectSmUserByUserId(smUser.getUserId());
SmUserVO vo = this.selectSmUserByUserId(smUser.getUserId());
userValidator.afterCheck(vo);
return update;
@ -756,13 +765,13 @@ public class SmUserServiceImpl implements ISmUserService
* @return
*/
@Override
public SmUserVo selectUserByUserName(String username) {
public SmUserVO selectUserByUserName(String username) {
if (username == null) {
return null;
}
SmUserQuery smUser = new SmUserQuery();
smUser.setUserName(username);
List<SmUserVo> list = smUserMapper.selectSmUserList(smUser);
List<SmUserVO> list = smUserMapper.selectSmUserList(smUser);
if (CollectionUtils.isEmpty(list)) {
return null;
}

View File

@ -3,7 +3,6 @@ package com.ruoyi.ss.user.service.impl;
import com.ruoyi.common.domain.vo.LongDecimalVO;
import com.ruoyi.common.utils.ServiceUtil;
import com.ruoyi.common.utils.collection.CollectionUtils;
import com.ruoyi.ss.bonus.domain.Bonus;
import com.ruoyi.ss.bonus.domain.BonusQuery;
import com.ruoyi.ss.bonus.domain.enums.BonusArrivalType;
import com.ruoyi.ss.bonus.domain.enums.BonusStatus;
@ -14,7 +13,7 @@ import com.ruoyi.ss.device.domain.enums.DeviceGroupBy;
import com.ruoyi.ss.device.domain.enums.DeviceGroupByTable;
import com.ruoyi.ss.device.service.DeviceService;
import com.ruoyi.ss.store.service.StoreService;
import com.ruoyi.ss.user.domain.SmUserVo;
import com.ruoyi.ss.user.domain.SmUserVO;
import com.ruoyi.ss.user.service.UserAssembler;
import com.ruoyi.system.domain.enums.config.ConfigKey;
import com.ruoyi.system.service.ISysConfigService;
@ -52,14 +51,14 @@ public class UserAssemblerImpl implements UserAssembler {
* @param list
*/
@Override
public void assembleStoreCount(List<SmUserVo> list) {
public void assembleStoreCount(List<SmUserVO> list) {
if (CollectionUtils.isEmptyElement(list)) {
return;
}
Map<Long, Integer> map = storeService.selectCountMapByUserIds(list.stream().map(SmUserVo::getUserId).collect(Collectors.toList()));
Map<Long, Integer> map = storeService.selectCountMapByUserIds(list.stream().map(SmUserVO::getUserId).collect(Collectors.toList()));
for (SmUserVo user : list) {
for (SmUserVO user : list) {
Integer count = map.get(user.getUserId());
user.setStoreCount(count == null ? 0 : count);
}
@ -71,25 +70,25 @@ public class UserAssemblerImpl implements UserAssembler {
* @param list
*/
@Override
public void assembleDeviceCount(List<SmUserVo> list) {
public void assembleDeviceCount(List<SmUserVO> list) {
if (CollectionUtils.isEmptyElement(list)) {
return;
}
DeviceQuery query = new DeviceQuery();
query.setUserIds(list.stream().map(SmUserVo::getUserId).collect(Collectors.toList()));
query.setUserIds(list.stream().map(SmUserVO::getUserId).collect(Collectors.toList()));
query.setGroupBy(DeviceGroupBy.user_id.name());
query.setGroupByTable(DeviceGroupByTable.su.name());
Map<Long, Integer> map = deviceService.selectCommonCountMap(query, DeviceCountVO::getUserId);
for (SmUserVo user : list) {
for (SmUserVO user : list) {
Integer count = map.get(user.getUserId());
user.setDeviceCount(count == null ? 0 : count);
}
}
@Override
public void assembleRealArrivalDelay(List<SmUserVo> list) {
public void assembleRealArrivalDelay(List<SmUserVO> list) {
if (CollectionUtils.isEmptyElement(list)) {
return;
}
@ -97,7 +96,7 @@ public class UserAssemblerImpl implements UserAssembler {
// 获取全局配置默认延迟到账时间
int defaultDelay = sysConfigService.getInt(ConfigKey.ARRIVAL_DELAY);
for (SmUserVo user : list) {
for (SmUserVO user : list) {
if (user == null) {
continue;
}
@ -112,13 +111,13 @@ public class UserAssemblerImpl implements UserAssembler {
}
@Override
public void assembleRealServiceRate(List<SmUserVo> list) {
public void assembleRealServiceRate(List<SmUserVO> list) {
if (CollectionUtils.isEmptyElement(list)) {
return;
}
BigDecimal sysServiceRate = sysConfigService.getBigDecimal(ConfigKey.SERVICE_FEE_RATE);
for (SmUserVo user : list) {
for (SmUserVO user : list) {
if (user == null) {
continue;
}
@ -132,18 +131,18 @@ public class UserAssemblerImpl implements UserAssembler {
}
@Override
public void assembleWaitBonusAmount(List<SmUserVo> list) {
public void assembleWaitBonusAmount(List<SmUserVO> list) {
if (CollectionUtils.isEmptyElement(list)) {
return ;
}
BonusQuery query = new BonusQuery();
query.setArrivalIds(CollectionUtils.map(list, SmUserVo::getUserId));
query.setArrivalIds(CollectionUtils.map(list, SmUserVO::getUserId));
query.setArrivalTypes(BonusArrivalType.userList());
query.setStatus(BonusStatus.WAIT_DIVIDE.getStatus());
List<LongDecimalVO> amountList = bonusService.selectWaitAmountGroupByArrival(query);
for (SmUserVo user : list) {
for (SmUserVO user : list) {
LongDecimalVO sum = amountList.stream()
.filter(item -> Objects.equals(item.getKey(), user.getUserId()))
.findFirst().orElse(null);

View File

@ -9,7 +9,7 @@ import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.ss.device.domain.DeviceQuery;
import com.ruoyi.ss.device.service.DeviceService;
import com.ruoyi.ss.user.domain.SmUserQuery;
import com.ruoyi.ss.user.domain.SmUserVo;
import com.ruoyi.ss.user.domain.SmUserVO;
import com.ruoyi.ss.user.service.ISmUserService;
import com.ruoyi.ss.user.service.UserValidator;
import org.springframework.beans.factory.annotation.Autowired;
@ -76,7 +76,7 @@ public class UserValidatorImpl extends BaseValidator implements UserValidator {
if (userId == null) {
return false;
}
SmUserVo user = userService.selectSmUserByUserId(userId);
SmUserVO user = userService.selectSmUserByUserId(userId);
if (user == null || UserStatus.DELETED.getCode().equals(user.getDelFlag()) || UserStatus.DISABLE.getCode().equals(user.getStatus())) {
return false;
}
@ -110,7 +110,7 @@ public class UserValidatorImpl extends BaseValidator implements UserValidator {
}
@Override
public void afterCheck(SmUserVo vo) {
public void afterCheck(SmUserVO vo) {
if (vo == null) {
return;
}
@ -135,7 +135,7 @@ public class UserValidatorImpl extends BaseValidator implements UserValidator {
this.checkOpenId(data.getUserId(), data.getWxOpenId());
}
private void checkAgentServiceRate(SmUserVo vo) {
private void checkAgentServiceRate(SmUserVO vo) {
if (vo == null) {
return;
}

View File

@ -22,6 +22,7 @@ import com.ruoyi.ss.device.domain.dto.DeviceWifiDTO;
import com.ruoyi.ss.device.domain.enums.DevicePowerStatus;
import com.ruoyi.ss.device.domain.vo.DeviceVO;
import com.ruoyi.ss.device.service.DeviceAssembler;
import com.ruoyi.ss.device.service.DeviceConverter;
import com.ruoyi.ss.device.service.DeviceValidator;
import com.ruoyi.ss.device.service.DeviceService;
import com.ruoyi.ss.meterReadingRecord.domain.SmMeterReadingRecordQuery;
@ -69,6 +70,10 @@ public class AppDeviceController extends BaseController {
@Autowired
private ScheduledExecutorService scheduledExecutorService;
@Autowired
private DeviceConverter deviceConverter;
@Log(title = "商户修改设备信息", businessType = BusinessType.UPDATE, operatorType = OperatorType.MOBILE)
@ApiOperation("商户修改设备信息")
@PutMapping
@ -190,6 +195,23 @@ public class AppDeviceController extends BaseController {
return success();
}
@ApiOperation("刷新数据信息v2")
@GetMapping("/v2/refreshIot")
public AjaxResult syncIotBySn(@RequestParam(required = false) Long deviceId,
@RequestParam(required = false) String deviceNo) {
if (deviceId == null && StringUtils.isBlank(deviceNo)) {
return error("设备ID和SN必须传入其中一个");
}
DeviceVO device = null;
if (deviceId != null) {
device = smDeviceService.selectById(deviceId);
} else if (StringUtils.hasText(deviceNo)) {
device = smDeviceService.selectByDeviceNo(deviceNo);
}
smDeviceService.pullDeviceInfo(device);
return success();
}
@ApiOperation("判断设备是否已经被绑定")
@GetMapping("/isBind")
public AjaxResult isBind(@RequestParam(required = false) @ApiParam("设备mac") String mac,
@ -221,10 +243,17 @@ public class AppDeviceController extends BaseController {
@ApiOperation("管理员设备录入")
@PostMapping
@DeviceAdminRequired
public AjaxResult add(@RequestBody @Validated DeviceRegisterDTO dto) {
public AjaxResult register(@RequestBody @Validated DeviceRegisterDTO dto) {
return toAjax(smDeviceService.register(dto));
}
@ApiOperation("管理员通过MAC获取设备信息")
@GetMapping("/admin/byMac")
@DeviceAdminRequired
public AjaxResult getByMac(String mac) {
return success(smDeviceService.selectByAnyMac(mac));
}
@ApiOperation("管理员获取已录入的设备Mac列表")
@GetMapping("/listAllMac")
@DeviceAdminRequired

View File

@ -25,7 +25,7 @@ import com.ruoyi.ss.transactionBill.service.TransactionAssembler;
import com.ruoyi.ss.transactionBill.service.TransactionBillConverter;
import com.ruoyi.ss.transactionBill.service.TransactionBillService;
import com.ruoyi.ss.transactionBill.service.TransactionBillValidator;
import com.ruoyi.ss.user.domain.SmUserVo;
import com.ruoyi.ss.user.domain.SmUserVO;
import com.ruoyi.ss.user.service.ISmUserService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@ -256,7 +256,7 @@ public class AppTransactionBillController extends BaseController
}
// 判断是否限制退款
SmUserVo user = userService.selectSmUserByUserId(userId);
SmUserVO user = userService.selectSmUserByUserId(userId);
transactionBillValidator.checkRefundRisk(user);
LoginUser loginUser = getLoginUser();

View File

@ -13,7 +13,7 @@ import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.framework.web.service.SysPasswordService;
import com.ruoyi.framework.web.service.TokenService;
import com.ruoyi.ss.realName.domain.enums.RealNameType;
import com.ruoyi.ss.user.domain.SmUserVo;
import com.ruoyi.ss.user.domain.SmUserVO;
import com.ruoyi.ss.user.domain.dto.UserChangeMobileDTO;
import com.ruoyi.ss.user.domain.dto.UserRealNameDTO;
import com.ruoyi.ss.user.domain.dto.UserUpdatePasswordDTO;
@ -65,10 +65,10 @@ public class AppUserController extends BaseController {
@JsonView(JsonViewProfile.AppMch.class)
public AjaxResult userInfo() {
// 查询
SmUserVo user = userService.selectSmUserByUserId(getUserId());
SmUserVO user = userService.selectSmUserByUserId(getUserId());
ServiceUtil.assertion(user == null, "用户不存在", HttpStatus.UNAUTHORIZED);
List<SmUserVo> list = Collections.singletonList(user);
List<SmUserVO> list = Collections.singletonList(user);
userService.desensitization(list);
userAssembler.assembleStoreCount(list);
userAssembler.assembleDeviceCount(list);
@ -79,7 +79,7 @@ public class AppUserController extends BaseController {
@ApiOperation("使用旧密码修改密码")
@PutMapping("/updatePassword")
public AjaxResult updatePassword( @RequestBody @Validated UserUpdatePasswordDTO dto) {
SmUserVo user = userService.selectSmUserByUserId(getUserId());
SmUserVO user = userService.selectSmUserByUserId(getUserId());
if (user == null) {
return error("用户不存在");
}
@ -141,7 +141,7 @@ public class AppUserController extends BaseController {
@ApiOperation("通过验证码修改手机号")
@PutMapping("/changeMobile")
public AjaxResult changeMobile(@RequestBody UserChangeMobileDTO dto) {
SmUserVo user = userService.selectSmUserByUserId(getUserId());
SmUserVO user = userService.selectSmUserByUserId(getUserId());
ServiceUtil.assertion(user == null, "用户不存在");
// 若有旧手机则验证旧手机验证码
if (user.getPhonenumber() != null) {

View File

@ -19,7 +19,7 @@ import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.ss.realName.domain.RealName;
import com.ruoyi.ss.realName.domain.RealNameVO;
import com.ruoyi.ss.realName.domain.RealNameQuery;
import com.ruoyi.ss.realName.service.IRealNameService;
import com.ruoyi.ss.realName.service.RealNameService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;
@ -34,7 +34,7 @@ import com.ruoyi.common.core.page.TableDataInfo;
public class RealNameController extends BaseController
{
@Autowired
private IRealNameService realNameService;
private RealNameService realNameService;
/**
* 查询实名认证列表

View File

@ -7,7 +7,7 @@ import javax.servlet.http.HttpServletResponse;
import com.ruoyi.common.core.domain.ValidGroup;
import com.ruoyi.ss.user.domain.SmUserQuery;
import com.ruoyi.ss.user.domain.SmUserVo;
import com.ruoyi.ss.user.domain.SmUserVO;
import com.ruoyi.ss.user.service.UserAssembler;
import io.swagger.annotations.ApiOperation;
import org.springframework.security.access.prepost.PreAuthorize;
@ -55,7 +55,7 @@ public class SmUserController extends BaseController
{
startPage();
startOrderBy();
List<SmUserVo> list = smUserService.selectSmUserList(smUser);
List<SmUserVO> list = smUserService.selectSmUserList(smUser);
userAssembler.assembleStoreCount(list);
userAssembler.assembleDeviceCount(list);
userAssembler.assembleRealServiceRate(list);
@ -71,7 +71,7 @@ public class SmUserController extends BaseController
@GetMapping("/listByIds/{ids}")
public AjaxResult listByIds(@PathVariable Long[] ids)
{
List<SmUserVo> list = smUserService.selectByIds(Arrays.asList(ids));
List<SmUserVO> list = smUserService.selectByIds(Arrays.asList(ids));
return success(list);
}
@ -83,8 +83,8 @@ public class SmUserController extends BaseController
@PostMapping("/export")
public void export(HttpServletResponse response, SmUserQuery smUser)
{
List<SmUserVo> list = smUserService.selectSmUserList(smUser);
ExcelUtil<SmUserVo> util = new ExcelUtil<SmUserVo>(SmUserVo.class);
List<SmUserVO> list = smUserService.selectSmUserList(smUser);
ExcelUtil<SmUserVO> util = new ExcelUtil<SmUserVO>(SmUserVO.class);
util.exportExcel(response, list, "普通用户信息数据");
}
@ -95,8 +95,8 @@ public class SmUserController extends BaseController
@GetMapping(value = "/{userId}")
public AjaxResult getInfo(@PathVariable("userId") Long userId)
{
SmUserVo user = smUserService.selectSmUserByUserId(userId);
List<SmUserVo> list = Collections.singletonList(user);
SmUserVO user = smUserService.selectSmUserByUserId(userId);
List<SmUserVO> list = Collections.singletonList(user);
userAssembler.assembleStoreCount(list);
userAssembler.assembleDeviceCount(list);
userAssembler.assembleRealServiceRate(list);

View File

@ -1,16 +1,11 @@
package com.ruoyi.web.core.aspectj;
import com.ruoyi.common.constant.HttpStatus;
import com.ruoyi.common.core.domain.entity.SmUser;
import com.ruoyi.common.core.domain.model.LoginUser;
import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.ServiceUtil;
import com.ruoyi.framework.web.service.TokenService;
import com.ruoyi.ss.user.domain.SmUserVo;
import com.ruoyi.ss.user.domain.SmUserVO;
import com.ruoyi.ss.user.service.ISmUserService;
import com.ruoyi.web.core.annotation.DeviceAdminRequired;
import com.ruoyi.web.core.annotation.MchRequired;
import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
@ -35,7 +30,7 @@ public class DeviceAdminRequiredAspect {
// 判断当前用户是否有权限访问
@Before("@annotation(required)")
public void doBefore(JoinPoint point, DeviceAdminRequired required) {
SmUserVo user = smUserService.selectSmUserByUserId(SecurityUtils.getUserId());
SmUserVO user = smUserService.selectSmUserByUserId(SecurityUtils.getUserId());
ServiceUtil.assertion(user == null || user.getDeviceAdmin() == null || !user.getDeviceAdmin(), "您无权操作" );
}

View File

@ -3,27 +3,19 @@ package com.ruoyi.web.core.aspectj;
import com.ruoyi.common.constant.HttpStatus;
import com.ruoyi.common.core.domain.entity.SmUser;
import com.ruoyi.common.core.domain.model.LoginUser;
import com.ruoyi.common.enums.UserType;
import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.ServiceUtil;
import com.ruoyi.framework.web.service.TokenService;
import com.ruoyi.ss.user.domain.SmUserVo;
import com.ruoyi.ss.user.domain.SmUserVO;
import com.ruoyi.ss.user.service.ISmUserService;
import com.ruoyi.web.core.annotation.MchRequired;
import com.ruoyi.web.core.annotation.UserTypePermission;
import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.security.core.parameters.P;
import org.springframework.stereotype.Component;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
/**
* 用户类型权限切面
* @author
@ -48,7 +40,7 @@ public class MchRequiredAspect {
// 如果登录用户不是商家那么查询数据库当数据库是商家时将商家的账户退出登录随后前端可进行重新登录
if (!user.getIsMch()) {
SmUserVo dbUser = smUserService.selectSmUserByUserId(user.getUserId());
SmUserVO dbUser = smUserService.selectSmUserByUserId(user.getUserId());
if (dbUser.getIsMch()) {
tokenService.delLoginUser(loginUser.getToken());
throw new ServiceException("用户信息已变更,请重新登录", HttpStatus.UNAUTHORIZED);

View File

@ -134,4 +134,4 @@ tm:
# 活体检测跳转地址
liveness:
returnUrl: http://192.168.2.15:3001/liveness
returnUrl: http://192.168.2.12:3001/liveness