From eb7e4d2b9796953e9802e186644afb7849a1f8dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A3=B7=E5=8F=B6?= <14103883+leaf-phos@user.noreply.gitee.com> Date: Mon, 4 Nov 2024 15:28:58 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=9E=E5=90=8D=E8=BA=AB=E4=BB=BD=E8=AF=81?= =?UTF-8?q?=E5=94=AF=E4=B8=80=E3=80=81=E8=AE=BE=E5=A4=87=E5=BD=95=E5=85=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/ruoyi/common/enums/ServiceCode.java | 4 +- .../filter/JwtAuthenticationTokenFilter.java | 4 +- .../ss/access/service/AccessService.java | 4 +- .../service/impl/AccessServiceImpl.java | 4 +- .../ss/bonus/service/BonusConverter.java | 5 +- .../service/impl/BonusConverterImpl.java | 7 +- .../bonus/service/impl/BonusServiceImpl.java | 7 +- .../ruoyi/ss/device/domain/DeviceQuery.java | 9 +++ .../ruoyi/ss/device/mapper/DeviceMapper.xml | 9 ++- .../ss/device/service/DeviceService.java | 3 +- .../ss/device/service/DeviceValidator.java | 15 ++++ .../service/impl/DeviceServiceImpl.java | 53 +++++--------- .../service/impl/DeviceValidatorImpl.java | 34 +++++---- .../service/DeviceSuitConverter.java | 6 ++ .../service/impl/DeviceSuitConverterImpl.java | 46 +++++++++++++ .../service/impl/PayBillConverterImpl.java | 8 +-- .../ss/realName/domain/RealNameQuery.java | 7 ++ .../ss/realName/mapper/RealNameMapper.java | 7 ++ .../ss/realName/mapper/RealNameMapper.xml | 10 +++ ...lNameService.java => RealNameService.java} | 5 +- .../realName/service/RealNameValidator.java | 11 +++ .../service/impl/RealNameServiceImpl.java | 9 ++- .../service/impl/RealNameValidatorImpl.java | 34 +++++++++ .../service/ReceiveBillService.java | 4 +- .../service/impl/ReceiveBillServiceImpl.java | 4 +- .../time/service/RecordTimeConverter.java | 4 +- .../service/impl/RecordTimeConverterImpl.java | 4 +- .../transactionBill/domain/bo/RechargeBO.java | 9 ++- .../domain/bo/RechargePayDepositBO.java | 4 +- .../transactionBill/domain/bo/WithdrawBO.java | 5 +- .../domain/dto/RechargePayBO.java | 8 +-- .../service/TransactionBillValidator.java | 4 +- .../service/WithdrawValidator.java | 4 +- .../impl/TransactionBillConverterImpl.java | 8 +-- .../impl/TransactionBillServiceImpl.java | 14 ++-- .../impl/TransactionBillValidatorImpl.java | 10 +-- .../service/impl/WithdrawValidatorImpl.java | 7 +- .../com/ruoyi/ss/user/domain/SmUserQuery.java | 2 + .../domain/{SmUserVo.java => SmUserVO.java} | 2 +- .../ruoyi/ss/user/mapper/SmUserMapper.java | 12 ++-- .../com/ruoyi/ss/user/mapper/SmUserMapper.xml | 3 +- .../ruoyi/ss/user/service/ISmUserService.java | 20 +++--- .../ruoyi/ss/user/service/UserAssembler.java | 12 ++-- .../ruoyi/ss/user/service/UserValidator.java | 4 +- .../user/service/impl/SmUserServiceImpl.java | 69 +++++++++++-------- .../user/service/impl/UserAssemblerImpl.java | 29 ++++---- .../user/service/impl/UserValidatorImpl.java | 8 +-- .../controller/app/AppDeviceController.java | 31 ++++++++- .../app/AppTransactionBillController.java | 4 +- .../web/controller/app/AppUserController.java | 10 +-- .../web/controller/ss/RealNameController.java | 4 +- .../web/controller/ss/SmUserController.java | 14 ++-- .../aspectj/DeviceAdminRequiredAspect.java | 9 +-- .../web/core/aspectj/MchRequiredAspect.java | 12 +--- .../src/main/resources/application-dev.yml | 2 +- 55 files changed, 404 insertions(+), 233 deletions(-) rename smart-switch-service/src/main/java/com/ruoyi/ss/realName/service/{IRealNameService.java => RealNameService.java} (94%) create mode 100644 smart-switch-service/src/main/java/com/ruoyi/ss/realName/service/RealNameValidator.java create mode 100644 smart-switch-service/src/main/java/com/ruoyi/ss/realName/service/impl/RealNameValidatorImpl.java rename smart-switch-service/src/main/java/com/ruoyi/ss/user/domain/{SmUserVo.java => SmUserVO.java} (97%) diff --git a/smart-switch-ruoyi/smart-switch-common/src/main/java/com/ruoyi/common/enums/ServiceCode.java b/smart-switch-ruoyi/smart-switch-common/src/main/java/com/ruoyi/common/enums/ServiceCode.java index 6f03f2e5..301f1773 100644 --- a/smart-switch-ruoyi/smart-switch-common/src/main/java/com/ruoyi/common/enums/ServiceCode.java +++ b/smart-switch-ruoyi/smart-switch-common/src/main/java/com/ruoyi/common/enums/ServiceCode.java @@ -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; diff --git a/smart-switch-ruoyi/smart-switch-framework/src/main/java/com/ruoyi/framework/security/filter/JwtAuthenticationTokenFilter.java b/smart-switch-ruoyi/smart-switch-framework/src/main/java/com/ruoyi/framework/security/filter/JwtAuthenticationTokenFilter.java index de82c651..8c508a00 100644 --- a/smart-switch-ruoyi/smart-switch-framework/src/main/java/com/ruoyi/framework/security/filter/JwtAuthenticationTokenFilter.java +++ b/smart-switch-ruoyi/smart-switch-framework/src/main/java/com/ruoyi/framework/security/filter/JwtAuthenticationTokenFilter.java @@ -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; } diff --git a/smart-switch-service/src/main/java/com/ruoyi/ss/access/service/AccessService.java b/smart-switch-service/src/main/java/com/ruoyi/ss/access/service/AccessService.java index 89bbb8e1..59096b11 100644 --- a/smart-switch-service/src/main/java/com/ruoyi/ss/access/service/AccessService.java +++ b/smart-switch-service/src/main/java/com/ruoyi/ss/access/service/AccessService.java @@ -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查询秘钥对 diff --git a/smart-switch-service/src/main/java/com/ruoyi/ss/access/service/impl/AccessServiceImpl.java b/smart-switch-service/src/main/java/com/ruoyi/ss/access/service/impl/AccessServiceImpl.java index 9cd5d0e5..3e681317 100644 --- a/smart-switch-service/src/main/java/com/ruoyi/ss/access/service/impl/AccessServiceImpl.java +++ b/smart-switch-service/src/main/java/com/ruoyi/ss/access/service/impl/AccessServiceImpl.java @@ -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; diff --git a/smart-switch-service/src/main/java/com/ruoyi/ss/bonus/service/BonusConverter.java b/smart-switch-service/src/main/java/com/ruoyi/ss/bonus/service/BonusConverter.java index 1e3dd005..659eaadb 100644 --- a/smart-switch-service/src/main/java/com/ruoyi/ss/bonus/service/BonusConverter.java +++ b/smart-switch-service/src/main/java/com/ruoyi/ss/bonus/service/BonusConverter.java @@ -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 genBonusList(SmUserVo mch, SmUserVo agent, SysDept platform, DeviceVO device); + List genBonusList(SmUserVO mch, SmUserVO agent, SysDept platform, DeviceVO device); /** * 旧订单转为分成明细 diff --git a/smart-switch-service/src/main/java/com/ruoyi/ss/bonus/service/impl/BonusConverterImpl.java b/smart-switch-service/src/main/java/com/ruoyi/ss/bonus/service/impl/BonusConverterImpl.java index 4e686b6a..b3924de9 100644 --- a/smart-switch-service/src/main/java/com/ruoyi/ss/bonus/service/impl/BonusConverterImpl.java +++ b/smart-switch-service/src/main/java/com/ruoyi/ss/bonus/service/impl/BonusConverterImpl.java @@ -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 genBonusList(SmUserVo mch, SmUserVo agent, SysDept platform, DeviceVO device) { + public List genBonusList(SmUserVO mch, SmUserVO agent, SysDept platform, DeviceVO device) { List 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; } diff --git a/smart-switch-service/src/main/java/com/ruoyi/ss/bonus/service/impl/BonusServiceImpl.java b/smart-switch-service/src/main/java/com/ruoyi/ss/bonus/service/impl/BonusServiceImpl.java index 46735780..249d5e23 100644 --- a/smart-switch-service/src/main/java/com/ruoyi/ss/bonus/service/impl/BonusServiceImpl.java +++ b/smart-switch-service/src/main/java/com/ruoyi/ss/bonus/service/impl/BonusServiceImpl.java @@ -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 userList = userService.selectByUserIds(bonusList.stream() + List 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; } diff --git a/smart-switch-service/src/main/java/com/ruoyi/ss/device/domain/DeviceQuery.java b/smart-switch-service/src/main/java/com/ruoyi/ss/device/domain/DeviceQuery.java index cb7ce843..2222e046 100644 --- a/smart-switch-service/src/main/java/com/ruoyi/ss/device/domain/DeviceQuery.java +++ b/smart-switch-service/src/main/java/com/ruoyi/ss/device/domain/DeviceQuery.java @@ -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; } diff --git a/smart-switch-service/src/main/java/com/ruoyi/ss/device/mapper/DeviceMapper.xml b/smart-switch-service/src/main/java/com/ruoyi/ss/device/mapper/DeviceMapper.xml index 72573f26..abbcb956 100644 --- a/smart-switch-service/src/main/java/com/ruoyi/ss/device/mapper/DeviceMapper.xml +++ b/smart-switch-service/src/main/java/com/ruoyi/ss/device/mapper/DeviceMapper.xml @@ -117,12 +117,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" and sd.device_id = #{deviceId} and sd.rent_time >= #{startRentTime} and sd.device_id <= #{endRentTime} - and sd.device_no like concat('%', #{deviceNo}, '%') + and sd.device_no like concat('%', #{deviceNo}, '%') + and sd.device_no = #{eqDeviceNo} and sd.lock_user_id = #{lockUserId} and agent_id = #{agentId} and sua.user_name like concat('%', #{agentName}, '%') and sd.service_mode = #{serviceMode} and sd.version like concat('%', #{version}, '%') + and find_in_set(#{modelTag}, sm.tags) + and sd.device_id != #{excludeDeviceId} and (sd.rent_time is null or sd.rent_time <= now()) @@ -424,8 +427,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" 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 diff --git a/smart-switch-service/src/main/java/com/ruoyi/ss/device/service/DeviceService.java b/smart-switch-service/src/main/java/com/ruoyi/ss/device/service/DeviceService.java index 84ce6c91..3703918e 100644 --- a/smart-switch-service/src/main/java/com/ruoyi/ss/device/service/DeviceService.java +++ b/smart-switch-service/src/main/java/com/ruoyi/ss/device/service/DeviceService.java @@ -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); + } diff --git a/smart-switch-service/src/main/java/com/ruoyi/ss/device/service/DeviceValidator.java b/smart-switch-service/src/main/java/com/ruoyi/ss/device/service/DeviceValidator.java index 8a1f9eec..5ae7c198 100644 --- a/smart-switch-service/src/main/java/com/ruoyi/ss/device/service/DeviceValidator.java +++ b/smart-switch-service/src/main/java/com/ruoyi/ss/device/service/DeviceValidator.java @@ -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); } diff --git a/smart-switch-service/src/main/java/com/ruoyi/ss/device/service/impl/DeviceServiceImpl.java b/smart-switch-service/src/main/java/com/ruoyi/ss/device/service/impl/DeviceServiceImpl.java index 3f91afdd..d367ac86 100644 --- a/smart-switch-service/src/main/java/com/ruoyi/ss/device/service/impl/DeviceServiceImpl.java +++ b/smart-switch-service/src/main/java/com/ruoyi/ss/device/service/impl/DeviceServiceImpl.java @@ -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); } } diff --git a/smart-switch-service/src/main/java/com/ruoyi/ss/device/service/impl/DeviceValidatorImpl.java b/smart-switch-service/src/main/java/com/ruoyi/ss/device/service/impl/DeviceValidatorImpl.java index 8ef08162..d19465a9 100644 --- a/smart-switch-service/src/main/java/com/ruoyi/ss/device/service/impl/DeviceValidatorImpl.java +++ b/smart-switch-service/src/main/java/com/ruoyi/ss/device/service/impl/DeviceValidatorImpl.java @@ -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()); + } } diff --git a/smart-switch-service/src/main/java/com/ruoyi/ss/deviceSuit/service/DeviceSuitConverter.java b/smart-switch-service/src/main/java/com/ruoyi/ss/deviceSuit/service/DeviceSuitConverter.java index a0ab064f..a4bf7b4b 100644 --- a/smart-switch-service/src/main/java/com/ruoyi/ss/deviceSuit/service/DeviceSuitConverter.java +++ b/smart-switch-service/src/main/java/com/ruoyi/ss/deviceSuit/service/DeviceSuitConverter.java @@ -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 toPo(DeviceBO device); + + /** + * 注册时,转为PO + */ + DeviceBO toBOByRegister(DeviceRegisterDTO dto); } diff --git a/smart-switch-service/src/main/java/com/ruoyi/ss/deviceSuit/service/impl/DeviceSuitConverterImpl.java b/smart-switch-service/src/main/java/com/ruoyi/ss/deviceSuit/service/impl/DeviceSuitConverterImpl.java index 06497ba3..047fdbe8 100644 --- a/smart-switch-service/src/main/java/com/ruoyi/ss/deviceSuit/service/impl/DeviceSuitConverterImpl.java +++ b/smart-switch-service/src/main/java/com/ruoyi/ss/deviceSuit/service/impl/DeviceSuitConverterImpl.java @@ -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; + } } diff --git a/smart-switch-service/src/main/java/com/ruoyi/ss/payBill/service/impl/PayBillConverterImpl.java b/smart-switch-service/src/main/java/com/ruoyi/ss/payBill/service/impl/PayBillConverterImpl.java index 25609c55..e84377e7 100644 --- a/smart-switch-service/src/main/java/com/ruoyi/ss/payBill/service/impl/PayBillConverterImpl.java +++ b/smart-switch-service/src/main/java/com/ruoyi/ss/payBill/service/impl/PayBillConverterImpl.java @@ -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; } diff --git a/smart-switch-service/src/main/java/com/ruoyi/ss/realName/domain/RealNameQuery.java b/smart-switch-service/src/main/java/com/ruoyi/ss/realName/domain/RealNameQuery.java index 028ea7b9..38293da8 100644 --- a/smart-switch-service/src/main/java/com/ruoyi/ss/realName/domain/RealNameQuery.java +++ b/smart-switch-service/src/main/java/com/ruoyi/ss/realName/domain/RealNameQuery.java @@ -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; } diff --git a/smart-switch-service/src/main/java/com/ruoyi/ss/realName/mapper/RealNameMapper.java b/smart-switch-service/src/main/java/com/ruoyi/ss/realName/mapper/RealNameMapper.java index 615fde69..a92d389e 100644 --- a/smart-switch-service/src/main/java/com/ruoyi/ss/realName/mapper/RealNameMapper.java +++ b/smart-switch-service/src/main/java/com/ruoyi/ss/realName/mapper/RealNameMapper.java @@ -62,4 +62,11 @@ public interface RealNameMapper * @return 结果 */ public int deleteRealNameByIds(Long[] ids); + + /** + * 查询数量 + * @param query + * @return + */ + int selectCount(@Param("query") RealNameQuery query); } diff --git a/smart-switch-service/src/main/java/com/ruoyi/ss/realName/mapper/RealNameMapper.xml b/smart-switch-service/src/main/java/com/ruoyi/ss/realName/mapper/RealNameMapper.xml index 5be83e1f..15e10382 100644 --- a/smart-switch-service/src/main/java/com/ruoyi/ss/realName/mapper/RealNameMapper.xml +++ b/smart-switch-service/src/main/java/com/ruoyi/ss/realName/mapper/RealNameMapper.xml @@ -25,8 +25,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" and srn.id = #{query.id} and srn.user_id = #{query.userId} + and srn.user_id != #{query.excludeUserId} and srn.name like concat('%', #{query.name}, '%') and srn.id_card like concat('%', #{query.idCard}, '%') + and srn.id_card = #{query.eqIdCard} and srn.mobile like concat('%', #{query.mobile}, '%') and su.user_name like concat('%', #{query.userName}, '%') and type = #{query.type} @@ -44,6 +46,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" where srn.id = #{id} + + SELECT LAST_INSERT_ID(); diff --git a/smart-switch-service/src/main/java/com/ruoyi/ss/realName/service/IRealNameService.java b/smart-switch-service/src/main/java/com/ruoyi/ss/realName/service/RealNameService.java similarity index 94% rename from smart-switch-service/src/main/java/com/ruoyi/ss/realName/service/IRealNameService.java rename to smart-switch-service/src/main/java/com/ruoyi/ss/realName/service/RealNameService.java index a7f71109..86acd687 100644 --- a/smart-switch-service/src/main/java/com/ruoyi/ss/realName/service/IRealNameService.java +++ b/smart-switch-service/src/main/java/com/ruoyi/ss/realName/service/RealNameService.java @@ -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); + } diff --git a/smart-switch-service/src/main/java/com/ruoyi/ss/realName/service/RealNameValidator.java b/smart-switch-service/src/main/java/com/ruoyi/ss/realName/service/RealNameValidator.java new file mode 100644 index 00000000..dab4a02b --- /dev/null +++ b/smart-switch-service/src/main/java/com/ruoyi/ss/realName/service/RealNameValidator.java @@ -0,0 +1,11 @@ +package com.ruoyi.ss.realName.service; + +/** + * @author wjh + * 2024/11/4 + */ +public interface RealNameValidator { + + void checkIdCard(Long userId, String idCard); + +} diff --git a/smart-switch-service/src/main/java/com/ruoyi/ss/realName/service/impl/RealNameServiceImpl.java b/smart-switch-service/src/main/java/com/ruoyi/ss/realName/service/impl/RealNameServiceImpl.java index f5057d97..dbe99157 100644 --- a/smart-switch-service/src/main/java/com/ruoyi/ss/realName/service/impl/RealNameServiceImpl.java +++ b/smart-switch-service/src/main/java/com/ruoyi/ss/realName/service/impl/RealNameServiceImpl.java @@ -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); + } } diff --git a/smart-switch-service/src/main/java/com/ruoyi/ss/realName/service/impl/RealNameValidatorImpl.java b/smart-switch-service/src/main/java/com/ruoyi/ss/realName/service/impl/RealNameValidatorImpl.java new file mode 100644 index 00000000..2ab39646 --- /dev/null +++ b/smart-switch-service/src/main/java/com/ruoyi/ss/realName/service/impl/RealNameValidatorImpl.java @@ -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, "身份证已被其他用户使用,无法重复实名"); + } +} diff --git a/smart-switch-service/src/main/java/com/ruoyi/ss/receiveBill/service/ReceiveBillService.java b/smart-switch-service/src/main/java/com/ruoyi/ss/receiveBill/service/ReceiveBillService.java index 67fcb82e..4277ec56 100644 --- a/smart-switch-service/src/main/java/com/ruoyi/ss/receiveBill/service/ReceiveBillService.java +++ b/smart-switch-service/src/main/java/com/ruoyi/ss/receiveBill/service/ReceiveBillService.java @@ -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); /** * 查询数量 diff --git a/smart-switch-service/src/main/java/com/ruoyi/ss/receiveBill/service/impl/ReceiveBillServiceImpl.java b/smart-switch-service/src/main/java/com/ruoyi/ss/receiveBill/service/impl/ReceiveBillServiceImpl.java index 5e4cfc7c..61c4a681 100644 --- a/smart-switch-service/src/main/java/com/ruoyi/ss/receiveBill/service/impl/ReceiveBillServiceImpl.java +++ b/smart-switch-service/src/main/java/com/ruoyi/ss/receiveBill/service/impl/ReceiveBillServiceImpl.java @@ -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, "设备不存在"); diff --git a/smart-switch-service/src/main/java/com/ruoyi/ss/record/time/service/RecordTimeConverter.java b/smart-switch-service/src/main/java/com/ruoyi/ss/record/time/service/RecordTimeConverter.java index 2663bae0..4ceddd08 100644 --- a/smart-switch-service/src/main/java/com/ruoyi/ss/record/time/service/RecordTimeConverter.java +++ b/smart-switch-service/src/main/java/com/ruoyi/ss/record/time/service/RecordTimeConverter.java @@ -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); } diff --git a/smart-switch-service/src/main/java/com/ruoyi/ss/record/time/service/impl/RecordTimeConverterImpl.java b/smart-switch-service/src/main/java/com/ruoyi/ss/record/time/service/impl/RecordTimeConverterImpl.java index 95b2337e..927bd4e4 100644 --- a/smart-switch-service/src/main/java/com/ruoyi/ss/record/time/service/impl/RecordTimeConverterImpl.java +++ b/smart-switch-service/src/main/java/com/ruoyi/ss/record/time/service/impl/RecordTimeConverterImpl.java @@ -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); diff --git a/smart-switch-service/src/main/java/com/ruoyi/ss/transactionBill/domain/bo/RechargeBO.java b/smart-switch-service/src/main/java/com/ruoyi/ss/transactionBill/domain/bo/RechargeBO.java index bf57745b..e1a7b0be 100644 --- a/smart-switch-service/src/main/java/com/ruoyi/ss/transactionBill/domain/bo/RechargeBO.java +++ b/smart-switch-service/src/main/java/com/ruoyi/ss/transactionBill/domain/bo/RechargeBO.java @@ -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; } diff --git a/smart-switch-service/src/main/java/com/ruoyi/ss/transactionBill/domain/bo/RechargePayDepositBO.java b/smart-switch-service/src/main/java/com/ruoyi/ss/transactionBill/domain/bo/RechargePayDepositBO.java index cf8b5394..17570bdf 100644 --- a/smart-switch-service/src/main/java/com/ruoyi/ss/transactionBill/domain/bo/RechargePayDepositBO.java +++ b/smart-switch-service/src/main/java/com/ruoyi/ss/transactionBill/domain/bo/RechargePayDepositBO.java @@ -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; } diff --git a/smart-switch-service/src/main/java/com/ruoyi/ss/transactionBill/domain/bo/WithdrawBO.java b/smart-switch-service/src/main/java/com/ruoyi/ss/transactionBill/domain/bo/WithdrawBO.java index c37faa5c..95298069 100644 --- a/smart-switch-service/src/main/java/com/ruoyi/ss/transactionBill/domain/bo/WithdrawBO.java +++ b/smart-switch-service/src/main/java/com/ruoyi/ss/transactionBill/domain/bo/WithdrawBO.java @@ -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; diff --git a/smart-switch-service/src/main/java/com/ruoyi/ss/transactionBill/domain/dto/RechargePayBO.java b/smart-switch-service/src/main/java/com/ruoyi/ss/transactionBill/domain/dto/RechargePayBO.java index 5222a48a..6965cb06 100644 --- a/smart-switch-service/src/main/java/com/ruoyi/ss/transactionBill/domain/dto/RechargePayBO.java +++ b/smart-switch-service/src/main/java/com/ruoyi/ss/transactionBill/domain/dto/RechargePayBO.java @@ -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; diff --git a/smart-switch-service/src/main/java/com/ruoyi/ss/transactionBill/service/TransactionBillValidator.java b/smart-switch-service/src/main/java/com/ruoyi/ss/transactionBill/service/TransactionBillValidator.java index 88c17ef9..3fa26267 100644 --- a/smart-switch-service/src/main/java/com/ruoyi/ss/transactionBill/service/TransactionBillValidator.java +++ b/smart-switch-service/src/main/java/com/ruoyi/ss/transactionBill/service/TransactionBillValidator.java @@ -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); } diff --git a/smart-switch-service/src/main/java/com/ruoyi/ss/transactionBill/service/WithdrawValidator.java b/smart-switch-service/src/main/java/com/ruoyi/ss/transactionBill/service/WithdrawValidator.java index 47dded7a..6eb7104a 100644 --- a/smart-switch-service/src/main/java/com/ruoyi/ss/transactionBill/service/WithdrawValidator.java +++ b/smart-switch-service/src/main/java/com/ruoyi/ss/transactionBill/service/WithdrawValidator.java @@ -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); } diff --git a/smart-switch-service/src/main/java/com/ruoyi/ss/transactionBill/service/impl/TransactionBillConverterImpl.java b/smart-switch-service/src/main/java/com/ruoyi/ss/transactionBill/service/impl/TransactionBillConverterImpl.java index 54dc6489..3ad46a8f 100644 --- a/smart-switch-service/src/main/java/com/ruoyi/ss/transactionBill/service/impl/TransactionBillConverterImpl.java +++ b/smart-switch-service/src/main/java/com/ruoyi/ss/transactionBill/service/impl/TransactionBillConverterImpl.java @@ -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, "用户不存在"); // 渠道 diff --git a/smart-switch-service/src/main/java/com/ruoyi/ss/transactionBill/service/impl/TransactionBillServiceImpl.java b/smart-switch-service/src/main/java/com/ruoyi/ss/transactionBill/service/impl/TransactionBillServiceImpl.java index 29c4593c..107a8dff 100644 --- a/smart-switch-service/src/main/java/com/ruoyi/ss/transactionBill/service/impl/TransactionBillServiceImpl.java +++ b/smart-switch-service/src/main/java/com/ruoyi/ss/transactionBill/service/impl/TransactionBillServiceImpl.java @@ -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); } diff --git a/smart-switch-service/src/main/java/com/ruoyi/ss/transactionBill/service/impl/TransactionBillValidatorImpl.java b/smart-switch-service/src/main/java/com/ruoyi/ss/transactionBill/service/impl/TransactionBillValidatorImpl.java index edac2b76..b92c45a9 100644 --- a/smart-switch-service/src/main/java/com/ruoyi/ss/transactionBill/service/impl/TransactionBillValidatorImpl.java +++ b/smart-switch-service/src/main/java/com/ruoyi/ss/transactionBill/service/impl/TransactionBillValidatorImpl.java @@ -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; } diff --git a/smart-switch-service/src/main/java/com/ruoyi/ss/transactionBill/service/impl/WithdrawValidatorImpl.java b/smart-switch-service/src/main/java/com/ruoyi/ss/transactionBill/service/impl/WithdrawValidatorImpl.java index 3989c987..bd1a3f7d 100644 --- a/smart-switch-service/src/main/java/com/ruoyi/ss/transactionBill/service/impl/WithdrawValidatorImpl.java +++ b/smart-switch-service/src/main/java/com/ruoyi/ss/transactionBill/service/impl/WithdrawValidatorImpl.java @@ -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; } diff --git a/smart-switch-service/src/main/java/com/ruoyi/ss/user/domain/SmUserQuery.java b/smart-switch-service/src/main/java/com/ruoyi/ss/user/domain/SmUserQuery.java index f983dee7..77066933 100644 --- a/smart-switch-service/src/main/java/com/ruoyi/ss/user/domain/SmUserQuery.java +++ b/smart-switch-service/src/main/java/com/ruoyi/ss/user/domain/SmUserQuery.java @@ -35,4 +35,6 @@ public class SmUserQuery extends SmUser { @ApiModelProperty("排除的用户ID") private Long excludeUserId; + @ApiModelProperty("实名或用户名") + private String realOrUserName; } diff --git a/smart-switch-service/src/main/java/com/ruoyi/ss/user/domain/SmUserVo.java b/smart-switch-service/src/main/java/com/ruoyi/ss/user/domain/SmUserVO.java similarity index 97% rename from smart-switch-service/src/main/java/com/ruoyi/ss/user/domain/SmUserVo.java rename to smart-switch-service/src/main/java/com/ruoyi/ss/user/domain/SmUserVO.java index dc1a1ecf..7a66d463 100644 --- a/smart-switch-service/src/main/java/com/ruoyi/ss/user/domain/SmUserVo.java +++ b/smart-switch-service/src/main/java/com/ruoyi/ss/user/domain/SmUserVO.java @@ -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) diff --git a/smart-switch-service/src/main/java/com/ruoyi/ss/user/mapper/SmUserMapper.java b/smart-switch-service/src/main/java/com/ruoyi/ss/user/mapper/SmUserMapper.java index 3bcfb892..c1b141d8 100644 --- a/smart-switch-service/src/main/java/com/ruoyi/ss/user/mapper/SmUserMapper.java +++ b/smart-switch-service/src/main/java/com/ruoyi/ss/user/mapper/SmUserMapper.java @@ -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 selectSmUserList(SmUserQuery smUser); + public List 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 selectDeviceTenant(@Param("deviceId") Long deviceId); + List selectDeviceTenant(@Param("deviceId") Long deviceId); /** * 逻辑删除 diff --git a/smart-switch-service/src/main/java/com/ruoyi/ss/user/mapper/SmUserMapper.xml b/smart-switch-service/src/main/java/com/ruoyi/ss/user/mapper/SmUserMapper.xml index 3b6037c2..26a17736 100644 --- a/smart-switch-service/src/main/java/com/ruoyi/ss/user/mapper/SmUserMapper.xml +++ b/smart-switch-service/src/main/java/com/ruoyi/ss/user/mapper/SmUserMapper.xml @@ -4,7 +4,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> - + @@ -89,6 +89,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" and read_mch_licence = #{readMchLicence} and show_bill_mobile = #{showBillMobile} and su.user_id != #{excludeUserId} + and if(su.is_real, su.real_name, su.user_name) like concat('%', #{realOrUserName}, '%') and su.user_id in ( select sdt.tenant_id diff --git a/smart-switch-service/src/main/java/com/ruoyi/ss/user/service/ISmUserService.java b/smart-switch-service/src/main/java/com/ruoyi/ss/user/service/ISmUserService.java index ab4f69ee..ef9b6bef 100644 --- a/smart-switch-service/src/main/java/com/ruoyi/ss/user/service/ISmUserService.java +++ b/smart-switch-service/src/main/java/com/ruoyi/ss/user/service/ISmUserService.java @@ -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 selectSmUserList(SmUserQuery smUser); + public List 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 list); + void desensitization(List 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 selectByIds(List ids); + List selectByIds(List ids); /** * 将用户设置为商家 @@ -232,7 +232,7 @@ public interface ISmUserService /** * 根据用户ID列表查询 */ - List selectByUserIds(List userIds); + List selectByUserIds(List userIds); /** * 获取用户修改手机号的旧手机短信验证码 diff --git a/smart-switch-service/src/main/java/com/ruoyi/ss/user/service/UserAssembler.java b/smart-switch-service/src/main/java/com/ruoyi/ss/user/service/UserAssembler.java index 22a389bc..9bdfcd67 100644 --- a/smart-switch-service/src/main/java/com/ruoyi/ss/user/service/UserAssembler.java +++ b/smart-switch-service/src/main/java/com/ruoyi/ss/user/service/UserAssembler.java @@ -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 list); + void assembleStoreCount(List list); /** * 拼接用户设备数量 */ - void assembleDeviceCount(List list); + void assembleDeviceCount(List list); /** * 拼接用户实际到账延迟 */ - void assembleRealArrivalDelay(List userList); + void assembleRealArrivalDelay(List userList); /** * 拼接用户实际服务费率 */ - void assembleRealServiceRate(List list); + void assembleRealServiceRate(List list); /** * 拼接未入账金额 * @param list */ - void assembleWaitBonusAmount(List list); + void assembleWaitBonusAmount(List list); } diff --git a/smart-switch-service/src/main/java/com/ruoyi/ss/user/service/UserValidator.java b/smart-switch-service/src/main/java/com/ruoyi/ss/user/service/UserValidator.java index 1c980e8f..130cf700 100644 --- a/smart-switch-service/src/main/java/com/ruoyi/ss/user/service/UserValidator.java +++ b/smart-switch-service/src/main/java/com/ruoyi/ss/user/service/UserValidator.java @@ -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); /** * 插入前校验 diff --git a/smart-switch-service/src/main/java/com/ruoyi/ss/user/service/impl/SmUserServiceImpl.java b/smart-switch-service/src/main/java/com/ruoyi/ss/user/service/impl/SmUserServiceImpl.java index e3cb8823..c1e3e03c 100644 --- a/smart-switch-service/src/main/java/com/ruoyi/ss/user/service/impl/SmUserServiceImpl.java +++ b/smart-switch-service/src/main/java/com/ruoyi/ss/user/service/impl/SmUserServiceImpl.java @@ -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 selectSmUserList(SmUserQuery dto) + public List selectSmUserList(SmUserQuery dto) { - List list = smUserMapper.selectSmUserList(dto); + List list = smUserMapper.selectSmUserList(dto); desensitization(list); return list; } @@ -146,7 +150,7 @@ public class SmUserServiceImpl implements ISmUserService * @param list */ @Override - public void desensitization(List list) { + public void desensitization(List 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 list = smUserMapper.selectSmUserList(dto); + List 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 userMap = this.selectMapByUserIds(userIds); + Map 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 selectByIds(List ids) { + public List selectByIds(List 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 selectByUserIds(List userIds) { + public List selectByUserIds(List 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 selectMapByUserIds(List userIds) { + private Map selectMapByUserIds(List userIds) { if (CollectionUtils.isEmpty(userIds)) { return Collections.emptyMap(); } SmUserQuery dto = new SmUserQuery(); dto.setUserIds(userIds); - List list = smUserMapper.selectSmUserList(dto); + List 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 list = smUserMapper.selectSmUserList(smUser); + List list = smUserMapper.selectSmUserList(smUser); if (CollectionUtils.isEmpty(list)) { return null; } diff --git a/smart-switch-service/src/main/java/com/ruoyi/ss/user/service/impl/UserAssemblerImpl.java b/smart-switch-service/src/main/java/com/ruoyi/ss/user/service/impl/UserAssemblerImpl.java index 0dddefb8..e4c7ab1e 100644 --- a/smart-switch-service/src/main/java/com/ruoyi/ss/user/service/impl/UserAssemblerImpl.java +++ b/smart-switch-service/src/main/java/com/ruoyi/ss/user/service/impl/UserAssemblerImpl.java @@ -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 list) { + public void assembleStoreCount(List list) { if (CollectionUtils.isEmptyElement(list)) { return; } - Map map = storeService.selectCountMapByUserIds(list.stream().map(SmUserVo::getUserId).collect(Collectors.toList())); + Map 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 list) { + public void assembleDeviceCount(List 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 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 list) { + public void assembleRealArrivalDelay(List 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 list) { + public void assembleRealServiceRate(List 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 list) { + public void assembleWaitBonusAmount(List 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 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); diff --git a/smart-switch-service/src/main/java/com/ruoyi/ss/user/service/impl/UserValidatorImpl.java b/smart-switch-service/src/main/java/com/ruoyi/ss/user/service/impl/UserValidatorImpl.java index 8a40bac3..aa1c26c4 100644 --- a/smart-switch-service/src/main/java/com/ruoyi/ss/user/service/impl/UserValidatorImpl.java +++ b/smart-switch-service/src/main/java/com/ruoyi/ss/user/service/impl/UserValidatorImpl.java @@ -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; } diff --git a/smart-switch-web/src/main/java/com/ruoyi/web/controller/app/AppDeviceController.java b/smart-switch-web/src/main/java/com/ruoyi/web/controller/app/AppDeviceController.java index 58d392a2..1fe0de8d 100644 --- a/smart-switch-web/src/main/java/com/ruoyi/web/controller/app/AppDeviceController.java +++ b/smart-switch-web/src/main/java/com/ruoyi/web/controller/app/AppDeviceController.java @@ -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 diff --git a/smart-switch-web/src/main/java/com/ruoyi/web/controller/app/AppTransactionBillController.java b/smart-switch-web/src/main/java/com/ruoyi/web/controller/app/AppTransactionBillController.java index 65a5f4a2..19f171f5 100644 --- a/smart-switch-web/src/main/java/com/ruoyi/web/controller/app/AppTransactionBillController.java +++ b/smart-switch-web/src/main/java/com/ruoyi/web/controller/app/AppTransactionBillController.java @@ -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(); diff --git a/smart-switch-web/src/main/java/com/ruoyi/web/controller/app/AppUserController.java b/smart-switch-web/src/main/java/com/ruoyi/web/controller/app/AppUserController.java index a10dfdd1..bdf181fe 100644 --- a/smart-switch-web/src/main/java/com/ruoyi/web/controller/app/AppUserController.java +++ b/smart-switch-web/src/main/java/com/ruoyi/web/controller/app/AppUserController.java @@ -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 list = Collections.singletonList(user); + List 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) { diff --git a/smart-switch-web/src/main/java/com/ruoyi/web/controller/ss/RealNameController.java b/smart-switch-web/src/main/java/com/ruoyi/web/controller/ss/RealNameController.java index f4cdcadf..31025c97 100644 --- a/smart-switch-web/src/main/java/com/ruoyi/web/controller/ss/RealNameController.java +++ b/smart-switch-web/src/main/java/com/ruoyi/web/controller/ss/RealNameController.java @@ -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; /** * 查询实名认证列表 diff --git a/smart-switch-web/src/main/java/com/ruoyi/web/controller/ss/SmUserController.java b/smart-switch-web/src/main/java/com/ruoyi/web/controller/ss/SmUserController.java index 48eaef60..1e73b42f 100644 --- a/smart-switch-web/src/main/java/com/ruoyi/web/controller/ss/SmUserController.java +++ b/smart-switch-web/src/main/java/com/ruoyi/web/controller/ss/SmUserController.java @@ -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 list = smUserService.selectSmUserList(smUser); + List 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 list = smUserService.selectByIds(Arrays.asList(ids)); + List 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 list = smUserService.selectSmUserList(smUser); - ExcelUtil util = new ExcelUtil(SmUserVo.class); + List list = smUserService.selectSmUserList(smUser); + ExcelUtil util = new ExcelUtil(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 list = Collections.singletonList(user); + SmUserVO user = smUserService.selectSmUserByUserId(userId); + List list = Collections.singletonList(user); userAssembler.assembleStoreCount(list); userAssembler.assembleDeviceCount(list); userAssembler.assembleRealServiceRate(list); diff --git a/smart-switch-web/src/main/java/com/ruoyi/web/core/aspectj/DeviceAdminRequiredAspect.java b/smart-switch-web/src/main/java/com/ruoyi/web/core/aspectj/DeviceAdminRequiredAspect.java index f292e7a0..99e7bf53 100644 --- a/smart-switch-web/src/main/java/com/ruoyi/web/core/aspectj/DeviceAdminRequiredAspect.java +++ b/smart-switch-web/src/main/java/com/ruoyi/web/core/aspectj/DeviceAdminRequiredAspect.java @@ -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(), "您无权操作" ); } diff --git a/smart-switch-web/src/main/java/com/ruoyi/web/core/aspectj/MchRequiredAspect.java b/smart-switch-web/src/main/java/com/ruoyi/web/core/aspectj/MchRequiredAspect.java index 20d752d4..a2d0b7de 100644 --- a/smart-switch-web/src/main/java/com/ruoyi/web/core/aspectj/MchRequiredAspect.java +++ b/smart-switch-web/src/main/java/com/ruoyi/web/core/aspectj/MchRequiredAspect.java @@ -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); diff --git a/smart-switch-web/src/main/resources/application-dev.yml b/smart-switch-web/src/main/resources/application-dev.yml index f66d8eca..5c75d858 100644 --- a/smart-switch-web/src/main/resources/application-dev.yml +++ b/smart-switch-web/src/main/resources/application-dev.yml @@ -134,4 +134,4 @@ tm: # 活体检测跳转地址 liveness: - returnUrl: http://192.168.2.15:3001/liveness + returnUrl: http://192.168.2.12:3001/liveness