From 3f08b1f54a58da9c4facfee251a4850d1e1c0a85 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: Thu, 6 Feb 2025 16:32:57 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BB=86=E8=8A=82=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ruoyi/common/constant/CacheConstants.java | 5 ++ .../common/core/domain/entity/SmUser.java | 4 + .../java/com/ruoyi/ss/app/domain/App.java | 10 ++- .../com/ruoyi/ss/app/domain/vo/AppAllVO.java | 23 ++++++ .../com/ruoyi/ss/app/mapper/AppMapper.java | 14 +++- .../com/ruoyi/ss/app/mapper/AppMapper.xml | 23 +++++- .../com/ruoyi/ss/app/service/AppService.java | 11 ++- .../ss/app/service/impl/AppServiceImpl.java | 78 ++++++++++++++++--- .../com/ruoyi/ss/device/domain/DeviceBO.java | 6 +- .../ruoyi/ss/device/domain/vo/DeviceVO.java | 16 ++-- .../ruoyi/ss/device/mapper/DeviceMapper.xml | 2 + .../service/impl/DeviceServiceImpl.java | 31 +++++--- .../service/impl/DeviceValidatorImpl.java | 16 ++-- .../com/ruoyi/ss/model/domain/SmModel.java | 2 +- .../com/ruoyi/ss/model/domain/SmModelBO.java | 4 +- .../ruoyi/ss/model/mapper/SmModelMapper.xml | 10 +-- .../java/com/ruoyi/ss/risk/domain/RiskVO.java | 2 + .../com/ruoyi/ss/risk/mapper/RiskMapper.xml | 3 +- .../ruoyi/ss/riskInfo/domain/RiskInfoVO.java | 8 +- .../ss/riskInfo/mapper/RiskInfoMapper.xml | 4 +- .../domain/vo/TransactionBillVO.java | 18 ++++- .../mapper/TransactionBillMapper.xml | 8 +- .../com/ruoyi/ss/user/mapper/SmUserMapper.xml | 5 ++ .../user/service/impl/UserConverterImpl.java | 1 + .../web/controller/ss/AppController.java | 36 +++++++-- .../web/controller/ss/SmDeviceController.java | 29 ++++--- 26 files changed, 293 insertions(+), 76 deletions(-) create mode 100644 smart-switch-service/src/main/java/com/ruoyi/ss/app/domain/vo/AppAllVO.java diff --git a/smart-switch-ruoyi/smart-switch-common/src/main/java/com/ruoyi/common/constant/CacheConstants.java b/smart-switch-ruoyi/smart-switch-common/src/main/java/com/ruoyi/common/constant/CacheConstants.java index 2d7c7202..72e445b2 100644 --- a/smart-switch-ruoyi/smart-switch-common/src/main/java/com/ruoyi/common/constant/CacheConstants.java +++ b/smart-switch-ruoyi/smart-switch-common/src/main/java/com/ruoyi/common/constant/CacheConstants.java @@ -90,4 +90,9 @@ public class CacheConstants * 提现渠道名称列表 */ public static final String CHANNEL_WITHDRAW_NAME_LIST = "channel_withdraw_name_list"; + + /** + * 所有APP信息 + */ + public static final String ALL_APP_LIST = "all_app_list"; } diff --git a/smart-switch-ruoyi/smart-switch-common/src/main/java/com/ruoyi/common/core/domain/entity/SmUser.java b/smart-switch-ruoyi/smart-switch-common/src/main/java/com/ruoyi/common/core/domain/entity/SmUser.java index 1d0f4576..de7cc244 100644 --- a/smart-switch-ruoyi/smart-switch-common/src/main/java/com/ruoyi/common/core/domain/entity/SmUser.java +++ b/smart-switch-ruoyi/smart-switch-common/src/main/java/com/ruoyi/common/core/domain/entity/SmUser.java @@ -272,4 +272,8 @@ public class SmUser extends BaseEntity @ApiModelProperty("是否开启续单") private Boolean enabledRenew; + + @ApiModelProperty("风控标签") + private String riskTag; + } diff --git a/smart-switch-service/src/main/java/com/ruoyi/ss/app/domain/App.java b/smart-switch-service/src/main/java/com/ruoyi/ss/app/domain/App.java index 166d54b2..ab090526 100644 --- a/smart-switch-service/src/main/java/com/ruoyi/ss/app/domain/App.java +++ b/smart-switch-service/src/main/java/com/ruoyi/ss/app/domain/App.java @@ -1,13 +1,14 @@ package com.ruoyi.ss.app.domain; +import javax.validation.constraints.NotBlank; + import com.ruoyi.common.annotation.Excel; import com.ruoyi.common.core.domain.BaseEntity; import com.ruoyi.common.core.domain.ValidGroup; + import io.swagger.annotations.ApiModelProperty; import lombok.Data; -import javax.validation.constraints.NotBlank; - /** * APP信息对象 ss_app * @@ -35,4 +36,9 @@ public class App extends BaseEntity @ApiModelProperty("应用配置") private AppConfig config; + @ApiModelProperty("SN码前缀") + private String snPrefix; + + @ApiModelProperty("合伙人前缀") + private String staffPrefix; } diff --git a/smart-switch-service/src/main/java/com/ruoyi/ss/app/domain/vo/AppAllVO.java b/smart-switch-service/src/main/java/com/ruoyi/ss/app/domain/vo/AppAllVO.java new file mode 100644 index 00000000..b5742e20 --- /dev/null +++ b/smart-switch-service/src/main/java/com/ruoyi/ss/app/domain/vo/AppAllVO.java @@ -0,0 +1,23 @@ +package com.ruoyi.ss.app.domain.vo; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +public class AppAllVO { + + @ApiModelProperty("应用ID") + private Long id; + + @ApiModelProperty("应用名称") + private String name; + + @ApiModelProperty("应用类型") + private String type; + + @ApiModelProperty("SN码前缀") + private String snPrefix; + + @ApiModelProperty("合伙人前缀") + private String staffPrefix; +} diff --git a/smart-switch-service/src/main/java/com/ruoyi/ss/app/mapper/AppMapper.java b/smart-switch-service/src/main/java/com/ruoyi/ss/app/mapper/AppMapper.java index 59c2a970..4e8428a7 100644 --- a/smart-switch-service/src/main/java/com/ruoyi/ss/app/mapper/AppMapper.java +++ b/smart-switch-service/src/main/java/com/ruoyi/ss/app/mapper/AppMapper.java @@ -1,11 +1,13 @@ package com.ruoyi.ss.app.mapper; +import java.util.List; + +import org.apache.ibatis.annotations.Param; + import com.ruoyi.ss.app.domain.App; import com.ruoyi.ss.app.domain.AppQuery; import com.ruoyi.ss.app.domain.AppVO; -import org.apache.ibatis.annotations.Param; - -import java.util.List; +import com.ruoyi.ss.app.domain.vo.AppAllVO; /** * APP信息Mapper接口 @@ -62,4 +64,10 @@ public interface AppMapper * @return 结果 */ public int deleteAppByIds(Long[] ids); + + /** + * 查询所有APP信息 + * @return + */ + List selectAllList(); } diff --git a/smart-switch-service/src/main/java/com/ruoyi/ss/app/mapper/AppMapper.xml b/smart-switch-service/src/main/java/com/ruoyi/ss/app/mapper/AppMapper.xml index f880e14c..5efa3e33 100644 --- a/smart-switch-service/src/main/java/com/ruoyi/ss/app/mapper/AppMapper.xml +++ b/smart-switch-service/src/main/java/com/ruoyi/ss/app/mapper/AppMapper.xml @@ -14,7 +14,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" sa.name, sa.type, sa.config, - sa.create_time + sa.create_time, + sa.sn_prefix, + sa.staff_prefix from ss_app sa @@ -22,6 +24,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" and sa.id = #{query.id} and sa.name like concat('%', #{query.name}, '%') and sa.type = #{query.type} + and sa.sn_prefix like concat('%', #{query.snPrefix}, '%') + and sa.staff_prefix like concat('%', #{query.staffPrefix}, '%') and sa.id in @@ -50,12 +54,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" type, create_time, config, + sn_prefix, + staff_prefix, #{name}, #{type}, #{createTime}, #{config,typeHandler=com.ruoyi.ss.app.mapper.typehandler.AppConfigJsonTypeHandler}, + #{snPrefix}, + #{staffPrefix}, @@ -72,6 +80,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" type = #{data.type}, config = #{data.config,typeHandler=com.ruoyi.ss.app.mapper.typehandler.AppConfigJsonTypeHandler}, create_time = #{data.createTime}, + sn_prefix = #{data.snPrefix}, + staff_prefix = #{data.staffPrefix}, @@ -84,4 +94,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #{id} + + + diff --git a/smart-switch-service/src/main/java/com/ruoyi/ss/app/service/AppService.java b/smart-switch-service/src/main/java/com/ruoyi/ss/app/service/AppService.java index 044abd9e..531d0470 100644 --- a/smart-switch-service/src/main/java/com/ruoyi/ss/app/service/AppService.java +++ b/smart-switch-service/src/main/java/com/ruoyi/ss/app/service/AppService.java @@ -1,10 +1,11 @@ package com.ruoyi.ss.app.service; +import java.util.List; + import com.ruoyi.ss.app.domain.App; import com.ruoyi.ss.app.domain.AppQuery; import com.ruoyi.ss.app.domain.AppVO; - -import java.util.List; +import com.ruoyi.ss.app.domain.vo.AppAllVO; /** * APP信息Service接口 @@ -68,4 +69,10 @@ public interface AppService * @return */ List selectByIds(List ids); + + /** + * 查询所有APP信息 + * @return + */ + List selectAll(); } diff --git a/smart-switch-service/src/main/java/com/ruoyi/ss/app/service/impl/AppServiceImpl.java b/smart-switch-service/src/main/java/com/ruoyi/ss/app/service/impl/AppServiceImpl.java index 6e524eba..740bdf9e 100644 --- a/smart-switch-service/src/main/java/com/ruoyi/ss/app/service/impl/AppServiceImpl.java +++ b/smart-switch-service/src/main/java/com/ruoyi/ss/app/service/impl/AppServiceImpl.java @@ -1,17 +1,22 @@ package com.ruoyi.ss.app.service.impl; +import java.util.Collections; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.support.TransactionTemplate; + +import com.ruoyi.common.constant.CacheConstants; +import com.ruoyi.common.core.redis.RedisCache; import com.ruoyi.common.utils.DateUtils; import com.ruoyi.common.utils.collection.CollectionUtils; import com.ruoyi.ss.app.domain.App; import com.ruoyi.ss.app.domain.AppQuery; import com.ruoyi.ss.app.domain.AppVO; +import com.ruoyi.ss.app.domain.vo.AppAllVO; import com.ruoyi.ss.app.mapper.AppMapper; import com.ruoyi.ss.app.service.AppService; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import java.util.Collections; -import java.util.List; /** * APP信息Service业务层处理 @@ -25,6 +30,12 @@ public class AppServiceImpl implements AppService @Autowired private AppMapper appMapper; + @Autowired + private RedisCache redisCache; + + @Autowired + private TransactionTemplate transactionTemplate; + /** * 查询APP信息 * @@ -58,8 +69,15 @@ public class AppServiceImpl implements AppService @Override public int insertApp(App app) { - app.setCreateTime(DateUtils.getNowDate()); - return appMapper.insertApp(app); + Integer result = transactionTemplate.execute(status -> { + app.setCreateTime(DateUtils.getNowDate()); + int insert = appMapper.insertApp(app); + if (insert > 0) { + clearCache(); + } + return insert; + }); + return result; } /** @@ -71,7 +89,14 @@ public class AppServiceImpl implements AppService @Override public int updateApp(App app) { - return appMapper.updateApp(app); + Integer result = transactionTemplate.execute(status -> { + int update = appMapper.updateApp(app); + if (update > 0) { + clearCache(); + } + return update; + }); + return result; } /** @@ -83,7 +108,14 @@ public class AppServiceImpl implements AppService @Override public int deleteAppByIds(Long[] ids) { - return appMapper.deleteAppByIds(ids); + Integer result = transactionTemplate.execute(status -> { + int delete = appMapper.deleteAppByIds(ids); + if (delete > 0) { + clearCache(); + } + return delete; + }); + return result; } /** @@ -95,7 +127,14 @@ public class AppServiceImpl implements AppService @Override public int deleteAppById(Long id) { - return appMapper.deleteAppById(id); + Integer result = transactionTemplate.execute(status -> { + int delete = appMapper.deleteAppById(id); + if (delete > 0) { + clearCache(); + } + return delete; + }); + return result; } @Override @@ -107,4 +146,23 @@ public class AppServiceImpl implements AppService query.setIds(ids); return appMapper.selectAppList(query); } + + @Override + public List selectAll() { + List list = redisCache.getCacheList(CacheConstants.ALL_APP_LIST); + if (CollectionUtils.isEmptyElement(list)) { + list = appMapper.selectAllList(); + if (CollectionUtils.isNotEmptyElement(list)) { + redisCache.setCacheList(CacheConstants.ALL_APP_LIST, list); + } + } + return list; + } + + /** + * 清除缓存 + */ + private void clearCache() { + redisCache.deleteObject(CacheConstants.ALL_APP_LIST); + } } diff --git a/smart-switch-service/src/main/java/com/ruoyi/ss/device/domain/DeviceBO.java b/smart-switch-service/src/main/java/com/ruoyi/ss/device/domain/DeviceBO.java index 8fb83b0a..aeb9fae8 100644 --- a/smart-switch-service/src/main/java/com/ruoyi/ss/device/domain/DeviceBO.java +++ b/smart-switch-service/src/main/java/com/ruoyi/ss/device/domain/DeviceBO.java @@ -1,10 +1,10 @@ package com.ruoyi.ss.device.domain; +import java.util.Set; + import io.swagger.annotations.ApiModelProperty; import lombok.Data; -import java.util.Set; - /** * @author wjh * 2024/5/10 @@ -53,6 +53,8 @@ public class DeviceBO extends Device { bo.setDeviceId(getDeviceId()); bo.setCustomPicture(getCustomPicture()); bo.setModelId(getModelId()); + bo.setMac(getMac()); + bo.setMac2(getMac2()); bo.setDeviceNo(getDeviceNo()); bo.setDeviceName(getDeviceName()); bo.setServiceRate(getServiceRate()); diff --git a/smart-switch-service/src/main/java/com/ruoyi/ss/device/domain/vo/DeviceVO.java b/smart-switch-service/src/main/java/com/ruoyi/ss/device/domain/vo/DeviceVO.java index e41387c9..83ec7174 100644 --- a/smart-switch-service/src/main/java/com/ruoyi/ss/device/domain/vo/DeviceVO.java +++ b/smart-switch-service/src/main/java/com/ruoyi/ss/device/domain/vo/DeviceVO.java @@ -1,5 +1,11 @@ package com.ruoyi.ss.device.domain.vo; +import java.math.BigDecimal; +import java.time.Duration; +import java.time.LocalDateTime; +import java.time.LocalTime; +import java.util.List; + import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonView; import com.ruoyi.common.core.domain.JsonViewProfile; @@ -9,15 +15,10 @@ import com.ruoyi.ss.device.domain.Device; import com.ruoyi.ss.device.domain.DeviceView; import com.ruoyi.ss.device.utils.DeviceUtils; import com.ruoyi.ss.suit.domain.SuitVO; + import io.swagger.annotations.ApiModelProperty; import lombok.Data; -import java.math.BigDecimal; -import java.time.Duration; -import java.time.LocalDateTime; -import java.time.LocalTime; -import java.util.List; - /** * @author wjh * 2024/3/15 @@ -111,6 +112,9 @@ public class DeviceVO extends Device implements IotDevice { @ApiModelProperty("分成比例列表") private List bonusList; + @ApiModelProperty("型号APP ID列表") + private List modelAppIds; + @Override public String iotMac1() { return getMac(); 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 0f7736dd..1d0697fe 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 @@ -10,6 +10,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + @@ -76,6 +77,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" sm.picture as picture, sm.tags as model_tags, sm.product_id as model_product_id, + sm.app_ids as model_app_ids, ss.name as store_name, ss.contact_name as store_contact_name, ss.contact_mobile as store_contact_mobile, 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 27480b2a..63da9279 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 @@ -204,16 +204,7 @@ public class DeviceServiceImpl implements DeviceService deviceValidator.afterCheck(vo); // 注册到OneNet - if (StringUtils.hasText(vo.getModelProductId())) { - // 创建OneNet设备1 - int code = iotService.create(data.getMac(), vo.getModelProductId()); - ServiceUtil.assertion(!IotHttpStatus.SUCCESS.equalCode(code) && !IotHttpStatus.DEVICE_EXIST.equalCode(code), "MAC-1注册失败"); - // 创建OneNet设备2 - if (StringUtils.hasText(data.getMac2())) { - code = iotService.create(data.getMac2(), vo.getModelProductId()); - ServiceUtil.assertion(!IotHttpStatus.SUCCESS.equalCode(code) && !IotHttpStatus.DEVICE_EXIST.equalCode(code), "MAC-2注册失败"); - } - } + this.registerToOneNet(vo); return insert; }); @@ -223,6 +214,19 @@ public class DeviceServiceImpl implements DeviceService } } + private void registerToOneNet(DeviceVO vo) { + if (StringUtils.hasText(vo.getModelProductId())) { + // 创建OneNet设备1 + int code = iotService.create(vo.getMac(), vo.getModelProductId()); + ServiceUtil.assertion(!IotHttpStatus.SUCCESS.equalCode(code) && !IotHttpStatus.DEVICE_EXIST.equalCode(code), "MAC-1注册失败"); + // 创建OneNet设备2 + if (StringUtils.hasText(vo.getMac2())) { + code = iotService.create(vo.getMac2(), vo.getModelProductId()); + ServiceUtil.assertion(!IotHttpStatus.SUCCESS.equalCode(code) && !IotHttpStatus.DEVICE_EXIST.equalCode(code), "MAC-2注册失败"); + } + } + } + /** * 修改设备 * @@ -234,8 +238,8 @@ public class DeviceServiceImpl implements DeviceService data.setUpdateTime(DateUtils.getNowDate()); - // 修改数据库 Integer result = transactionTemplate.execute(status -> { + // 更新主表 int update = deviceMapper.updateSmDevice(data); ServiceUtil.assertion(update != 1, "更新设备失败"); @@ -243,6 +247,11 @@ public class DeviceServiceImpl implements DeviceService DeviceVO vo = this.selectById(data.getDeviceId()); deviceAssembler.assembleBonusList(vo); deviceValidator.afterCheck(vo); + + // 若修改了MAC或者型号,则需要重新注册到OneNet + if (data.getMac() != null || data.getMac2() != null || data.getModelId() != null) { + this.registerToOneNet(vo); + } // 更新套餐关联 if (data.getSuitIds() != null) { 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 2c3bf4ce..91eaa85a 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 @@ -1,5 +1,16 @@ package com.ruoyi.ss.device.service.impl; +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.HashSet; +import java.util.List; +import java.util.Objects; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + import com.ruoyi.common.core.domain.BaseValidator; import com.ruoyi.common.core.domain.ValidateResult; import com.ruoyi.common.enums.ServiceCode; @@ -23,11 +34,6 @@ import com.ruoyi.ss.transactionBill.domain.enums.TransactionBillType; import com.ruoyi.ss.transactionBill.service.TransactionBillService; import com.ruoyi.ss.user.domain.SmUserVO; import com.ruoyi.ss.user.service.UserService; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import java.math.BigDecimal; -import java.util.*; /** * @author wjh diff --git a/smart-switch-service/src/main/java/com/ruoyi/ss/model/domain/SmModel.java b/smart-switch-service/src/main/java/com/ruoyi/ss/model/domain/SmModel.java index aab06d76..c30527b6 100644 --- a/smart-switch-service/src/main/java/com/ruoyi/ss/model/domain/SmModel.java +++ b/smart-switch-service/src/main/java/com/ruoyi/ss/model/domain/SmModel.java @@ -79,5 +79,5 @@ public class SmModel extends BaseEntity private Integer sort; @ApiModelProperty("应用ID") - private Long appId; + private List appIds; } diff --git a/smart-switch-service/src/main/java/com/ruoyi/ss/model/domain/SmModelBO.java b/smart-switch-service/src/main/java/com/ruoyi/ss/model/domain/SmModelBO.java index f37b800d..039012ad 100644 --- a/smart-switch-service/src/main/java/com/ruoyi/ss/model/domain/SmModelBO.java +++ b/smart-switch-service/src/main/java/com/ruoyi/ss/model/domain/SmModelBO.java @@ -22,7 +22,7 @@ public class SmModelBO extends SmModel { bo.setProductId(getProductId()); bo.setSnPrefix(getSnPrefix()); bo.setSort(getSort()); - bo.setAppId(getAppId()); + bo.setAppIds(getAppIds()); return bo; } @@ -41,7 +41,7 @@ public class SmModelBO extends SmModel { bo.setProductId(getProductId()); bo.setSnPrefix(getSnPrefix()); bo.setSort(getSort()); - bo.setAppId(getAppId()); + bo.setAppIds(getAppIds()); return bo; } } diff --git a/smart-switch-service/src/main/java/com/ruoyi/ss/model/mapper/SmModelMapper.xml b/smart-switch-service/src/main/java/com/ruoyi/ss/model/mapper/SmModelMapper.xml index e4fc9f79..4e5afcf7 100644 --- a/smart-switch-service/src/main/java/com/ruoyi/ss/model/mapper/SmModelMapper.xml +++ b/smart-switch-service/src/main/java/com/ruoyi/ss/model/mapper/SmModelMapper.xml @@ -6,6 +6,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + @@ -26,7 +27,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" sm.product_id, sm.sn_prefix, sm.sort, - sm.app_id + sm.app_ids from sm_model sm @@ -36,7 +37,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" and sm.model = #{model} and sm.service_type = #{serviceType} and sm.product_id = #{productId} - and sm.app_id = #{appId} and sm.deleted = false and sm.deleted = #{deleted} @@ -94,7 +94,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" product_id, sn_prefix, sort, - app_id, + app_ids, #{modelName}, @@ -113,7 +113,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #{productId}, #{snPrefix}, #{sort}, - #{appId}, + #{appIds,typeHandler=com.ruoyi.system.mapper.typehandler.LongSplitListTypeHandler}, @@ -136,7 +136,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" product_id = #{productId}, sn_prefix = #{snPrefix}, sort = #{sort}, - app_id = #{appId}, + app_ids = #{appIds,typeHandler=com.ruoyi.system.mapper.typehandler.LongSplitListTypeHandler}, where model_id = #{modelId} diff --git a/smart-switch-service/src/main/java/com/ruoyi/ss/risk/domain/RiskVO.java b/smart-switch-service/src/main/java/com/ruoyi/ss/risk/domain/RiskVO.java index 6ab0acfa..b8376294 100644 --- a/smart-switch-service/src/main/java/com/ruoyi/ss/risk/domain/RiskVO.java +++ b/smart-switch-service/src/main/java/com/ruoyi/ss/risk/domain/RiskVO.java @@ -16,4 +16,6 @@ public class RiskVO extends Risk{ @ApiModelProperty("用户名") private String userName; + @ApiModelProperty("用户风控标签") + private String userRiskTag; } diff --git a/smart-switch-service/src/main/java/com/ruoyi/ss/risk/mapper/RiskMapper.xml b/smart-switch-service/src/main/java/com/ruoyi/ss/risk/mapper/RiskMapper.xml index 417e1291..e6fe85ff 100644 --- a/smart-switch-service/src/main/java/com/ruoyi/ss/risk/mapper/RiskMapper.xml +++ b/smart-switch-service/src/main/java/com/ruoyi/ss/risk/mapper/RiskMapper.xml @@ -25,7 +25,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" sr.submit_type, sr.video_words, as is_finished, - if(su.is_real, su.real_name, su.user_name) as user_name + if(su.is_real, su.real_name, su.user_name) as user_name, + su.risk_tag as user_risk_tag from ss_risk sr left join sm_user su on su.user_id = sr.user_id diff --git a/smart-switch-service/src/main/java/com/ruoyi/ss/riskInfo/domain/RiskInfoVO.java b/smart-switch-service/src/main/java/com/ruoyi/ss/riskInfo/domain/RiskInfoVO.java index 5bc1fba9..99380b9e 100644 --- a/smart-switch-service/src/main/java/com/ruoyi/ss/riskInfo/domain/RiskInfoVO.java +++ b/smart-switch-service/src/main/java/com/ruoyi/ss/riskInfo/domain/RiskInfoVO.java @@ -1,12 +1,13 @@ package com.ruoyi.ss.riskInfo.domain; +import java.util.List; + import com.ruoyi.common.annotation.Sensitive; import com.ruoyi.common.enums.DesensitizedType; + import io.swagger.annotations.ApiModelProperty; import lombok.Data; -import java.util.List; - /** * @author wjh * 2024/11/25 @@ -49,4 +50,7 @@ public class RiskInfoVO extends RiskInfo { @ApiModelProperty("人脸图片") @Sensitive(desensitizedType = DesensitizedType.COMMON) private String realFace; + + @ApiModelProperty("用户风控标签") + private String userRiskTag; } diff --git a/smart-switch-service/src/main/java/com/ruoyi/ss/riskInfo/mapper/RiskInfoMapper.xml b/smart-switch-service/src/main/java/com/ruoyi/ss/riskInfo/mapper/RiskInfoMapper.xml index 0331d44d..c789f975 100644 --- a/smart-switch-service/src/main/java/com/ruoyi/ss/riskInfo/mapper/RiskInfoMapper.xml +++ b/smart-switch-service/src/main/java/com/ruoyi/ss/riskInfo/mapper/RiskInfoMapper.xml @@ -37,7 +37,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" if(su.is_real, su.real_name, su.user_name) as user_name, srn.name as real_name, srn.id_card as real_id_card, - srn.face_image as real_face + srn.face_image as real_face, + su.risk_tag as user_risk_tag from ss_risk_info sri left join ss_risk sr on sr.risk_id = sri.risk_id left join sm_user su on su.user_id = sr.user_id @@ -54,6 +55,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" and sri.verify_remark like concat('%', #{query.verifyRemark}, '%') and sr.user_id = #{query.userId} and if(su.is_real, su.real_name, su.user_name) like concat('%', #{query.userName}, '%') + and su.risk_tag = #{query.userRiskTag} and sri.info_id != #{query.excludeInfoId} diff --git a/smart-switch-service/src/main/java/com/ruoyi/ss/transactionBill/domain/vo/TransactionBillVO.java b/smart-switch-service/src/main/java/com/ruoyi/ss/transactionBill/domain/vo/TransactionBillVO.java index aad0bb77..c7335a37 100644 --- a/smart-switch-service/src/main/java/com/ruoyi/ss/transactionBill/domain/vo/TransactionBillVO.java +++ b/smart-switch-service/src/main/java/com/ruoyi/ss/transactionBill/domain/vo/TransactionBillVO.java @@ -1,5 +1,9 @@ package com.ruoyi.ss.transactionBill.domain.vo; +import java.math.BigDecimal; +import java.time.LocalDateTime; +import java.util.List; + import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonView; import com.ruoyi.common.annotation.Sensitive; @@ -10,14 +14,11 @@ import com.ruoyi.ss.bonus.domain.BonusVO; import com.ruoyi.ss.device.utils.DeviceUtils; import com.ruoyi.ss.transactionBill.domain.TransactionBill; import com.ruoyi.ss.transactionBill.utils.RechargeUtils; + import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; -import java.math.BigDecimal; -import java.time.LocalDateTime; -import java.util.List; - /** * @author 辉 * 2024/3/4 @@ -83,6 +84,15 @@ public class TransactionBillVO extends TransactionBill implements IotDevice { private Long suitSeconds; + @ApiModelProperty("用户风控标签") + private String userRiskTag; + + @ApiModelProperty("商户风控标签") + private String mchRiskTag; + + @ApiModelProperty("代理商风控标签") + private String agentRiskTag; + @Override public String iotMac1() { return getDeviceMac(); diff --git a/smart-switch-service/src/main/java/com/ruoyi/ss/transactionBill/mapper/TransactionBillMapper.xml b/smart-switch-service/src/main/java/com/ruoyi/ss/transactionBill/mapper/TransactionBillMapper.xml index cc7d0742..4aa8678c 100644 --- a/smart-switch-service/src/main/java/com/ruoyi/ss/transactionBill/mapper/TransactionBillMapper.xml +++ b/smart-switch-service/src/main/java/com/ruoyi/ss/transactionBill/mapper/TransactionBillMapper.xml @@ -103,7 +103,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" sd.expire_time as device_expire_time, sd.expire_ele as device_expire_ele, su.phonenumber as user_mobile, - sc.name as channel_name + sc.name as channel_name, + su.risk_tag as user_risk_tag, + su1.risk_tag as mch_risk_tag, + sua.risk_tag as agent_risk_tag from @@ -111,6 +114,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" sm_transaction_bill stb left join sm_user su on su.user_id = stb.user_id left join sm_user su1 on su1.user_id = stb.mch_id + left join sm_user sua on sua.user_id = stb.agent_id left join sm_device sd on sd.device_id = stb.device_id left join sm_suit ss on ss.suit_id = stb.suit_id left join sm_channel sc on sc.channel_id = stb.channel_id @@ -124,6 +128,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" if(su1.is_real, su1.real_name, su1.user_name) as mch_name, su1.phonenumber as mch_mobile, su.phonenumber as user_mobile, + su.risk_tag as user_risk_tag, + su1.risk_tag as mch_risk_tag, sc.name as channel_name from sm_transaction_bill stb left join sm_user su on su.user_id = stb.user_id 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 eba26fdf..bbd6e7e9 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 @@ -66,6 +66,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" su.app_id, su.vip_service_rate, su.enabled_renew, + su.risk_tag, if(su.is_real, su.real_name, su.user_name) as real_or_user_name, sa.name as app_name from sm_user su @@ -105,6 +106,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" and su.app_id = #{appId} and su.is_real = #{isReal} and su.enabled_renew = #{enabledRenew} + and su.risk_tag = #{riskTag} and su.user_id in ( select sdt.tenant_id @@ -224,6 +226,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" app_id, vip_service_rate, enabled_renew, + risk_tag, #{userName}, @@ -277,6 +280,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #{appId}, #{vipServiceRate}, #{enabledRenew}, + #{riskTag}, @@ -346,6 +350,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" app_id = #{appId}, vip_service_rate = #{vipServiceRate}, enabled_renew = #{enabledRenew}, + risk_tag = #{riskTag}, where user_id = #{userId} diff --git a/smart-switch-service/src/main/java/com/ruoyi/ss/user/service/impl/UserConverterImpl.java b/smart-switch-service/src/main/java/com/ruoyi/ss/user/service/impl/UserConverterImpl.java index bd6f6f06..022233b8 100644 --- a/smart-switch-service/src/main/java/com/ruoyi/ss/user/service/impl/UserConverterImpl.java +++ b/smart-switch-service/src/main/java/com/ruoyi/ss/user/service/impl/UserConverterImpl.java @@ -58,6 +58,7 @@ public class UserConverterImpl implements UserConverter { po.setRemark(data.getRemark()); po.setVipServiceRate(data.getVipServiceRate()); po.setEnabledRenew(data.getEnabledRenew()); + po.setRiskTag(data.getRiskTag()); return po; } diff --git a/smart-switch-web/src/main/java/com/ruoyi/web/controller/ss/AppController.java b/smart-switch-web/src/main/java/com/ruoyi/web/controller/ss/AppController.java index fca63ae5..97cb43ec 100644 --- a/smart-switch-web/src/main/java/com/ruoyi/web/controller/ss/AppController.java +++ b/smart-switch-web/src/main/java/com/ruoyi/web/controller/ss/AppController.java @@ -1,5 +1,21 @@ package com.ruoyi.web.controller.ss; +import java.util.List; + +import javax.servlet.http.HttpServletResponse; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + import com.ruoyi.common.annotation.Log; import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.domain.AjaxResult; @@ -10,14 +26,8 @@ import com.ruoyi.common.utils.poi.ExcelUtil; import com.ruoyi.ss.app.domain.App; import com.ruoyi.ss.app.domain.AppQuery; import com.ruoyi.ss.app.domain.AppVO; +import com.ruoyi.ss.app.domain.vo.AppAllVO; import com.ruoyi.ss.app.service.AppService; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.security.access.prepost.PreAuthorize; -import org.springframework.validation.annotation.Validated; -import org.springframework.web.bind.annotation.*; - -import javax.servlet.http.HttpServletResponse; -import java.util.List; /** * APP信息Controller @@ -46,7 +56,17 @@ public class AppController extends BaseController } /** - * 查询APP信息列表 + * 查询所有APP信息 + * @return + */ + @GetMapping("/all") + public AjaxResult all() { + List list = appService.selectAll(); + return success(list); + } + + /** + * 根据id集合查询APP信息列表 */ @PreAuthorize("@ss.hasPermi('ss:app:list')") @PostMapping("/listByIds") diff --git a/smart-switch-web/src/main/java/com/ruoyi/web/controller/ss/SmDeviceController.java b/smart-switch-web/src/main/java/com/ruoyi/web/controller/ss/SmDeviceController.java index a250f4d8..6d0d39d3 100644 --- a/smart-switch-web/src/main/java/com/ruoyi/web/controller/ss/SmDeviceController.java +++ b/smart-switch-web/src/main/java/com/ruoyi/web/controller/ss/SmDeviceController.java @@ -1,5 +1,24 @@ package com.ruoyi.web.controller.ss; +import java.math.BigDecimal; +import java.util.Arrays; +import java.util.List; + +import javax.servlet.http.HttpServletResponse; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; + import com.ruoyi.common.annotation.Log; import com.ruoyi.common.constant.IotConstants; import com.ruoyi.common.core.controller.BaseController; @@ -16,17 +35,9 @@ import com.ruoyi.ss.device.domain.vo.DeviceVO; import com.ruoyi.ss.device.service.DeviceAssembler; import com.ruoyi.ss.device.service.DeviceService; import com.ruoyi.ss.suit.domain.enums.SuitTimeUnit; + import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiParam; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.security.access.prepost.PreAuthorize; -import org.springframework.validation.annotation.Validated; -import org.springframework.web.bind.annotation.*; - -import javax.servlet.http.HttpServletResponse; -import java.math.BigDecimal; -import java.util.Arrays; -import java.util.List; /** * 设备Controller