From 16e2ead7e65a3a046da5918b15675cd6ec333a7e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=A2=A8=E5=A4=A7=E5=8F=94?= <494979559@qq.com>
Date: Sat, 28 Sep 2024 17:14:43 +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/IotConstants.java | 4 +++
.../common/core/domain/entity/SmUser.java | 5 ++++
.../com/ruoyi/iot/service/IotService.java | 9 ++++++
.../com/ruoyi/iot/service/IotServiceImpl.java | 28 +++++++++++++++++++
.../ss/device/domain/dto/DeviceWifiDTO.java | 16 +++++++++++
.../ss/device/service/DeviceService.java | 2 ++
.../service/impl/DeviceAssemblerImpl.java | 2 +-
.../service/impl/DeviceServiceImpl.java | 24 +++++++++++++---
.../com/ruoyi/ss/user/domain/SmUserVo.java | 3 ++
.../com/ruoyi/ss/user/mapper/SmUserMapper.xml | 4 +++
.../ruoyi/ss/user/service/ISmUserService.java | 3 +-
.../ruoyi/ss/user/service/UserAssembler.java | 5 ++++
.../user/service/impl/SmUserServiceImpl.java | 8 ++----
.../user/service/impl/UserAssemblerImpl.java | 22 +++++++++++++++
.../controller/app/AppDeviceController.java | 12 ++++++++
.../app/AppTransactionBillController.java | 14 ++++++++--
.../web/controller/app/AppUserController.java | 6 ----
.../web/controller/ss/SmDeviceController.java | 6 ++++
.../web/controller/ss/SmUserController.java | 2 ++
19 files changed, 156 insertions(+), 19 deletions(-)
create mode 100644 smart-switch-service/src/main/java/com/ruoyi/ss/device/domain/dto/DeviceWifiDTO.java
diff --git a/smart-switch-ruoyi/smart-switch-common/src/main/java/com/ruoyi/common/constant/IotConstants.java b/smart-switch-ruoyi/smart-switch-common/src/main/java/com/ruoyi/common/constant/IotConstants.java
index c498fe01..dbfd279f 100644
--- a/smart-switch-ruoyi/smart-switch-common/src/main/java/com/ruoyi/common/constant/IotConstants.java
+++ b/smart-switch-ruoyi/smart-switch-common/src/main/java/com/ruoyi/common/constant/IotConstants.java
@@ -82,6 +82,10 @@ public class IotConstants {
*/
public static final String COMMAND_SET_ELE = "mmney";
+ public static final String COMMAND_SET_SSID = "ssid";
+
+ public static final String COMMAND_SET_PASS = "pass";
+
/**----------------------------命令end----------------------------*/
}
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 48190074..8769ff9d 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
@@ -212,4 +212,9 @@ public class SmUser extends BaseEntity
@Excel(name = "到账延迟时间", readConverterExp = "小=时")
@ApiModelProperty("到账延迟时间")
private Integer arrivalDelay;
+
+ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+ @Excel(name = "限制退款时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
+ @ApiModelProperty("限制退款时间")
+ private LocalDateTime limitRefundTime;
}
diff --git a/smart-switch-service/src/main/java/com/ruoyi/iot/service/IotService.java b/smart-switch-service/src/main/java/com/ruoyi/iot/service/IotService.java
index 7ee6ae7c..ada0c84b 100644
--- a/smart-switch-service/src/main/java/com/ruoyi/iot/service/IotService.java
+++ b/smart-switch-service/src/main/java/com/ruoyi/iot/service/IotService.java
@@ -136,4 +136,13 @@ public interface IotService {
*/
CommandResponse trySetEle(String mac, BigDecimal ele, String productId, int tryCount);
+ /**
+ * 设置设备WIFI
+ * @param device 设备
+ * @param wifiName WIFI名称
+ * @param wifiPwd WIFI 密码
+ */
+ CommandResponse setWifi(IotDevice device, String wifiName, String wifiPwd);
+
+ CommandResponse setWifi(String mac, String productId, String wifiName, String wifiPwd);
}
diff --git a/smart-switch-service/src/main/java/com/ruoyi/iot/service/IotServiceImpl.java b/smart-switch-service/src/main/java/com/ruoyi/iot/service/IotServiceImpl.java
index e0f6493e..f9ff8102 100644
--- a/smart-switch-service/src/main/java/com/ruoyi/iot/service/IotServiceImpl.java
+++ b/smart-switch-service/src/main/java/com/ruoyi/iot/service/IotServiceImpl.java
@@ -28,6 +28,8 @@ import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;
+import static org.bouncycastle.oer.its.Duration.seconds;
+
/**
* @author wjh
* 2024/3/20
@@ -423,5 +425,31 @@ public class IotServiceImpl implements IotService {
return res;
}
+ @Override
+ public CommandResponse setWifi(IotDevice device, String wifiName, String wifiPwd) {
+
+ CommandResponse res = null;
+ if (StringUtils.hasText(device.iotMac1())) {
+ res = this.setWifi(device.iotMac1(), device.getProductId(), wifiName, wifiPwd);
+ }
+ if ((res == null || !res.isSuccess()) && StringUtils.hasText(device.iotMac2())) {
+ res = this.setWifi(device.iotMac2(), device.getProductId(), wifiName, wifiPwd);
+ }
+
+ return res;
+ }
+
+ @Override
+ public CommandResponse setWifi(String mac, String productId, String wifiName, String wifiPwd) {
+ if (StringUtils.hasBlank(mac, productId)) {
+ return null;
+ }
+ CommandResponse res1 = sendCommand(mac, IotConstants.COMMAND_SET_SSID + wifiName + IotConstants.COMMAND_SEPARATOR, productId);
+ if (res1.isSuccess()) {
+ return sendCommand(mac, IotConstants.COMMAND_SET_PASS + wifiPwd + IotConstants.COMMAND_SEPARATOR, productId);
+ }
+ return null;
+ }
+
}
diff --git a/smart-switch-service/src/main/java/com/ruoyi/ss/device/domain/dto/DeviceWifiDTO.java b/smart-switch-service/src/main/java/com/ruoyi/ss/device/domain/dto/DeviceWifiDTO.java
new file mode 100644
index 00000000..e331b2c6
--- /dev/null
+++ b/smart-switch-service/src/main/java/com/ruoyi/ss/device/domain/dto/DeviceWifiDTO.java
@@ -0,0 +1,16 @@
+package com.ruoyi.ss.device.domain.dto;
+
+import lombok.Data;
+
+/**
+ * @author wjh
+ * 2024/9/28
+ */
+@Data
+public class DeviceWifiDTO {
+ private Long deviceId;
+
+ private String wifiName;
+
+ private String wifiPwd;
+}
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 492ed4ac..1bd12834 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
@@ -6,6 +6,7 @@ import com.ruoyi.ss.device.domain.DeviceCountVO;
import com.ruoyi.ss.device.domain.DeviceQuery;
import com.ruoyi.ss.device.domain.dto.DeviceBatchUpdateModelDTO;
import com.ruoyi.ss.device.domain.dto.DeviceRegisterDTO;
+import com.ruoyi.ss.device.domain.dto.DeviceWifiDTO;
import com.ruoyi.ss.device.domain.enums.DevicePowerStatus;
import com.ruoyi.ss.device.domain.vo.DeviceMacSnVO;
import com.ruoyi.ss.device.domain.vo.DeviceVO;
@@ -348,4 +349,5 @@ public interface DeviceService
*/
int setTime(DeviceVO device, LocalDateTime expireTime, boolean withIot, int tryCount);
+ int setWifi(DeviceWifiDTO dto);
}
diff --git a/smart-switch-service/src/main/java/com/ruoyi/ss/device/service/impl/DeviceAssemblerImpl.java b/smart-switch-service/src/main/java/com/ruoyi/ss/device/service/impl/DeviceAssemblerImpl.java
index 2655c5ba..51558629 100644
--- a/smart-switch-service/src/main/java/com/ruoyi/ss/device/service/impl/DeviceAssemblerImpl.java
+++ b/smart-switch-service/src/main/java/com/ruoyi/ss/device/service/impl/DeviceAssemblerImpl.java
@@ -150,7 +150,7 @@ public class DeviceAssemblerImpl implements DeviceAssembler {
} else if (device.getUserServiceRate() != null) {
device.setRealServiceRate(device.getUserServiceRate());
} else {
- ServiceUtil.assertion(sysServiceRate != null, "系统服务费率未配置,请联系管理员");
+ ServiceUtil.assertion(sysServiceRate == null, "系统服务费率未配置,请联系管理员");
device.setRealServiceRate(sysServiceRate);
}
}
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 eded1fe3..4d150779 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
@@ -5,6 +5,7 @@ import com.ruoyi.common.core.domain.model.LoginUser;
import com.ruoyi.common.core.redis.RedisLock;
import com.ruoyi.common.core.redis.enums.RedisLockKey;
import com.ruoyi.common.enums.LoginType;
+import com.ruoyi.common.enums.UserType;
import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.common.utils.*;
import com.ruoyi.common.utils.collection.CollectionUtils;
@@ -18,6 +19,7 @@ import com.ruoyi.ss.device.domain.DeviceCountVO;
import com.ruoyi.ss.device.domain.DeviceQuery;
import com.ruoyi.ss.device.domain.dto.DeviceBatchUpdateModelDTO;
import com.ruoyi.ss.device.domain.dto.DeviceRegisterDTO;
+import com.ruoyi.ss.device.domain.dto.DeviceWifiDTO;
import com.ruoyi.ss.device.domain.enums.DeviceOnlineStatus;
import com.ruoyi.ss.device.domain.enums.DevicePowerStatus;
import com.ruoyi.ss.device.domain.enums.DeviceStatus;
@@ -346,8 +348,10 @@ public class DeviceServiceImpl implements DeviceService
if (ModelTag.isTwoMac(model.getTags())) {
if (device.getMac().endsWith(FOUR_G_MAC)) {
device.setMac2(StringUtils.replaceLast(device.getMac(), FOUR_G_MAC, WIFI_MAC));
- } else if (device.getMac().endsWith(WIFI_MAC)) {
- device.setMac2(StringUtils.replaceLast(device.getMac(), WIFI_MAC, FOUR_G_MAC));
+ } else {
+ // 替换最后两位为4G MAC
+ String substring = device.getMac().substring(0, device.getMac().length() - 2);
+ device.setMac2(substring + FOUR_G_MAC);
}
}
@@ -591,6 +595,18 @@ public class DeviceServiceImpl implements DeviceService
return 0;
}
+ @Override
+ public int setWifi(DeviceWifiDTO dto) {
+ DeviceVO device = selectSmDeviceByDeviceId(dto.getDeviceId());
+ if (device == null) {
+ return 0;
+ }
+ CommandResponse res = iotService.setWifi(device, dto.getWifiName(), dto.getWifiPwd());
+ ServiceUtil.assertion(!res.isSuccess(), "设置WIFI失败:" + res.getMsg());
+
+ return 1;
+ }
+
@Override
public boolean addTime(Long deviceId, long seconds, boolean withIot) {
@@ -928,8 +944,8 @@ public class DeviceServiceImpl implements DeviceService
ServiceUtil.assertion(record != 1, "添加绑定记录失败");
// 用户设置为商户
-// boolean changeType = userService.changeType(userId, UserType.MCH);
-// ServiceUtil.assertion(record != 1, "修改用户类型失败");
+ int changeType = userService.changeType(userId, UserType.MCH);
+ ServiceUtil.assertion(changeType != 1, "修改用户类型失败");
return updateCount;
});
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
index 950d3805..b3f35f8a 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
@@ -46,4 +46,7 @@ public class SmUserVo extends SmUser {
@ApiModelProperty("实际到账延迟")
private Integer realArrivalDelay;
+ @ApiModelProperty("实际服务费率")
+ private BigDecimal realServiceRate;
+
}
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 369668c6..2bcaa85d 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
@@ -55,6 +55,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
su.agent_service_rate,
su.arrival_delay,
su.type,
+ su.limit_refund_time,
if(su.is_real, su.real_name, su.user_name) as real_or_user_name,
(select sum(stb.money) from sm_transaction_bill stb where stb.user_id = su.user_id and stb.type = '1' and stb.status = '2') as recharge_amount,
(select sum(stb.arrival_amount) from sm_transaction_bill stb where stb.user_id = su.user_id and stb.type = '2' and stb.status = '14') as with_drawl_amount,
@@ -184,6 +185,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
arrival_delay,
agent_service_rate,
`type`,
+ limit_refund_time,
#{userName},
@@ -227,6 +229,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
arrival_delay,
#{agentServiceRate},
#{type},
+ #{limitRefundTime},
@@ -286,6 +289,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
arrival_delay = #{arrivalDelay},
agent_service_rate = #{agentServiceRate},
`type` = #{type},
+ limit_refund_time = #{limitRefundTime},
where user_id = #{userId}
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 deb1c806..258a0f98 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
@@ -97,10 +97,11 @@ public interface ISmUserService
/**
* 更换用户类型
+ *
* @param userType 类型
* @return
*/
- boolean changeType(Long userId, UserType userType);
+ int changeType(Long userId, UserType userType);
/**
* 增加余额
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 ca618db1..37c6251b 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
@@ -24,4 +24,9 @@ public interface UserAssembler {
* 拼接用户实际到账延迟
*/
void assembleRealArrivalDelay(List userList);
+
+ /**
+ * 拼接用户实际服务费率
+ */
+ void assembleRealServiceRate(List list);
}
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 769cf07f..e0a3b0c8 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
@@ -149,14 +149,12 @@ public class SmUserServiceImpl implements ISmUserService
}
@Override
- @Transactional
- public boolean changeType(Long userId, UserType userType) {
+ public int changeType(Long userId, UserType userType) {
// 修改数据库中的数据
SmUser smUser = new SmUser();
smUser.setUserId(userId);
- smUserMapper.updateSmUser(smUser);
-
- return true;
+ smUser.setType(userType.getType());
+ return smUserMapper.updateSmUser(smUser);
}
@Override
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 ffbc8248..45ee8026 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
@@ -1,5 +1,6 @@
package com.ruoyi.ss.user.service.impl;
+import com.ruoyi.common.utils.ServiceUtil;
import com.ruoyi.common.utils.collection.CollectionUtils;
import com.ruoyi.ss.device.domain.DeviceCountVO;
import com.ruoyi.ss.device.domain.DeviceQuery;
@@ -14,6 +15,7 @@ import com.ruoyi.system.service.ISysConfigService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
+import java.math.BigDecimal;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
@@ -98,4 +100,24 @@ public class UserAssemblerImpl implements UserAssembler {
}
}
+
+ @Override
+ public void assembleRealServiceRate(List list) {
+ if (CollectionUtils.isEmptyElement(list)) {
+ return;
+ }
+ BigDecimal sysServiceRate = sysConfigService.getBigDecimal(ConfigKey.SERVICE_FEE_RATE);
+
+ for (SmUserVo user : list) {
+ if (user == null) {
+ continue;
+ }
+ if (user.getServiceRate() != null) {
+ user.setRealServiceRate(user.getServiceRate());
+ } else {
+ ServiceUtil.assertion(sysServiceRate == null, "系统服务费率未配置,请联系管理员");
+ user.setRealServiceRate(sysServiceRate);
+ }
+ }
+ }
}
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 cf722778..7e599b4d 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
@@ -11,11 +11,13 @@ import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.enums.OperatorType;
import com.ruoyi.common.utils.ServiceUtil;
import com.ruoyi.common.utils.StringUtils;
+import com.ruoyi.iot.service.IotService;
import com.ruoyi.ss.device.domain.DeviceView;
import com.ruoyi.ss.device.domain.Device;
import com.ruoyi.ss.device.domain.DeviceBO;
import com.ruoyi.ss.device.domain.DeviceQuery;
import com.ruoyi.ss.device.domain.dto.DeviceRegisterDTO;
+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;
@@ -59,6 +61,9 @@ public class AppDeviceController extends BaseController {
@Autowired
private DeviceValidator deviceValidator;
+ @Autowired
+ private IotService iotService;
+
@Log(title = "商户修改设备信息", businessType = BusinessType.UPDATE, operatorType = OperatorType.MOBILE)
@ApiOperation("商户修改设备信息")
@PutMapping
@@ -245,4 +250,11 @@ public class AppDeviceController extends BaseController {
return success(smDeviceService.selectUsingDevice(getUserId()));
}
+ @ApiOperation("设置设备WIFI密码")
+ @PutMapping("/setWifi")
+ public AjaxResult setWifi(@RequestBody DeviceWifiDTO dto) {
+
+ return toAjax(smDeviceService.setWifi(dto));
+ }
+
}
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 20ea7626..3db8505a 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
@@ -7,6 +7,7 @@ import com.ruoyi.common.core.domain.JsonViewProfile;
import com.ruoyi.common.core.domain.ValidGroup;
import com.ruoyi.common.core.domain.model.LoginUser;
import com.ruoyi.common.core.page.TableDataInfo;
+import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.ServiceUtil;
import com.ruoyi.ss.dashboard.vo.BillCountVo;
@@ -245,10 +246,19 @@ public class AppTransactionBillController extends BaseController
if (!Objects.equals(bill.getMchId(), userId )) {
return error("您无权操作退款");
}
+
+ // 判断是否限制退款
SmUserVo user = userService.selectSmUserByUserId(userId);
- if (user.getLimitRefund() != null && user.getLimitRefund()) {
- return error("退款失败:" + user.getLimitRefundReason());
+ boolean limitRefund = user.getLimitRefund() != null && user.getLimitRefund();
+ if (limitRefund) {
+ LocalDateTime limitRefundTime = user.getLimitRefundTime();
+ if (limitRefundTime == null) {
+ throw new ServiceException("您被永久限制退款:" + user.getLimitRefundReason());
+ } else {
+ throw new ServiceException("您被限制退款至" + DateUtils.format(limitRefundTime, DateUtils.YYYY_MM_DD_HH_MM_SS) + ":" + user.getLimitRefundReason() );
+ }
}
+
LoginUser loginUser = getLoginUser();
dto.setUserName(loginUser.getUsername());
dto.setUserType(loginUser.getLoginType().getType());
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 07e24479..26e7d1f3 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
@@ -70,12 +70,6 @@ public class AppUserController extends BaseController {
return AjaxResult.success(user);
}
- @ApiOperation("修改用户类型")
- @PutMapping("/changeType")
- public AjaxResult changeRole(String userType) {
- return AjaxResult.success(userService.changeType(getUserId(), UserType.parse(userType)));
- }
-
@ApiOperation("使用旧密码修改密码")
@PutMapping("/updatePassword")
public AjaxResult updatePassword( @RequestBody @Validated UserUpdatePasswordDTO dto) {
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 13eb3eaa..96aaae75 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
@@ -10,6 +10,7 @@ import com.ruoyi.ss.device.domain.DeviceBO;
import com.ruoyi.ss.device.domain.dto.DeviceBatchUpdateModelDTO;
import com.ruoyi.ss.device.domain.DeviceQuery;
import com.ruoyi.ss.device.domain.vo.DeviceVO;
+import com.ruoyi.ss.device.service.DeviceAssembler;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.security.access.prepost.PreAuthorize;
@@ -35,6 +36,9 @@ public class SmDeviceController extends BaseController
@Autowired
private DeviceService deviceService;
+ @Autowired
+ private DeviceAssembler deviceAssembler;
+
/**
* 查询设备列表
*/
@@ -44,6 +48,7 @@ public class SmDeviceController extends BaseController
{
startPage();
List list = deviceService.selectSmDeviceList(smDevice);
+ deviceAssembler.assembleRealServiceRate(list);
return getDataTable(list);
}
@@ -79,6 +84,7 @@ public class SmDeviceController extends BaseController
@GetMapping(value = "/{deviceId}")
public AjaxResult getInfo(@PathVariable("deviceId") Long deviceId) {
DeviceVO device = deviceService.selectSmDeviceByDeviceId(deviceId);
+ deviceAssembler.assembleRealServiceRate(device);
return success(device);
}
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 39046d36..8e518b78 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
@@ -58,6 +58,7 @@ public class SmUserController extends BaseController
List list = smUserService.selectSmUserList(smUser);
userAssembler.assembleStoreCount(list);
userAssembler.assembleDeviceCount(list);
+ userAssembler.assembleRealServiceRate(list);
smUserService.desensitization(list);
return getDataTable(list);
}
@@ -97,6 +98,7 @@ public class SmUserController extends BaseController
List list = Collections.singletonList(user);
userAssembler.assembleStoreCount(list);
userAssembler.assembleDeviceCount(list);
+ userAssembler.assembleRealServiceRate(list);
smUserService.desensitization(list);
return success(user);
}