From 518a48ac97db4c516343b2041152c46dd5e41b5d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A2=A8=E5=A4=A7=E5=8F=94?= <494979559@qq.com> Date: Wed, 9 Oct 2024 15:51:29 +0800 Subject: [PATCH] =?UTF-8?q?debug:=E8=AE=BE=E5=A4=87=E6=81=A2=E5=A4=8D?= =?UTF-8?q?=E6=80=BB=E7=94=A8=E7=94=B5=E9=87=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ss/device/service/impl/DeviceServiceImpl.java | 8 ++++---- .../main/java/com/ruoyi/ss/suit/domain/Suit.java | 11 ++++++++--- .../java/com/ruoyi/ss/suit/mapper/SuitMapper.xml | 6 ++++++ .../ss/user/service/impl/SmUserServiceImpl.java | 14 ++++++++++++++ 4 files changed, 32 insertions(+), 7 deletions(-) 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 091b709f..b6b443e5 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 @@ -889,11 +889,11 @@ public class DeviceServiceImpl implements DeviceService if (deviceInfo.getW().compareTo(device.getTotalElectriQuantity()) >= 0) { device.setTotalElectriQuantity(deviceInfo.getW()); } - // TODO 若数据点小于数据库中的值,则发命令恢复物联网设备的总用电量 + // 若数据点小于数据库中的值,则发命令恢复物联网设备的总用电量 else { -// scheduledExecutorService.schedule(() -> { -// iotService.setTotalEle(device, device.getTotalElectriQuantity()); -// }, 0, TimeUnit.SECONDS); + scheduledExecutorService.schedule(() -> { + iotService.setTotalEle(device, device.getTotalElectriQuantity().multiply(new BigDecimal(1000))); + }, 0, TimeUnit.SECONDS); } } diff --git a/smart-switch-service/src/main/java/com/ruoyi/ss/suit/domain/Suit.java b/smart-switch-service/src/main/java/com/ruoyi/ss/suit/domain/Suit.java index 7c696c82..b03eef4a 100644 --- a/smart-switch-service/src/main/java/com/ruoyi/ss/suit/domain/Suit.java +++ b/smart-switch-service/src/main/java/com/ruoyi/ss/suit/domain/Suit.java @@ -52,12 +52,17 @@ public class Suit extends BaseEntity private Integer value; /** 价格(元) */ - @Excel(name = "价格/押金") + @Excel(name = "价格") @JsonView({DeviceView.SuitList.class, JsonViewProfile.AppMch.class}) - @NotNull(message = "价格/押金不允许为空", groups = {ValidGroup.Create.class, ValidGroup.FrontCreate.class}) - @Min(value = 0, message = "价格/押金不允许小于0") + @NotNull(message = "价格不允许为空", groups = {ValidGroup.Create.class, ValidGroup.FrontCreate.class}) + @Min(value = 0, message = "价格不允许小于0元") private BigDecimal price; + @Excel(name = "押金", readConverterExp = "元=") + @ApiModelProperty("押金") + @Min(value = 0, message = "押金不允许小于0元") + private BigDecimal deposit; + /** 详细说明 */ @Excel(name = "详细说明") @JsonView({DeviceView.SuitList.class, JsonViewProfile.AppMch.class}) diff --git a/smart-switch-service/src/main/java/com/ruoyi/ss/suit/mapper/SuitMapper.xml b/smart-switch-service/src/main/java/com/ruoyi/ss/suit/mapper/SuitMapper.xml index bc18c59f..45307278 100644 --- a/smart-switch-service/src/main/java/com/ruoyi/ss/suit/mapper/SuitMapper.xml +++ b/smart-switch-service/src/main/java/com/ruoyi/ss/suit/mapper/SuitMapper.xml @@ -7,6 +7,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + + @@ -15,6 +17,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ss.`name`, ss.`value`, ss.price, + ss.deposit, ss.`description`, ss.create_time, ss.create_by, @@ -116,6 +119,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" `name`, `value`, price, + deposit, `description`, create_time, create_by, @@ -138,6 +142,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #{name}, #{value}, #{price}, + #{deposit}, #{description}, #{createTime}, #{createBy}, @@ -170,6 +175,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" `name` = #{name}, `value` = #{value}, price = #{price}, + deposit = #{deposit}, `description` = #{description}, update_time = #{updateTime}, update_by = #{updateBy}, 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 e0a3b0c8..99b5739b 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 @@ -38,6 +38,9 @@ import com.ruoyi.ss.user.domain.dto.UserRealNameDTO; import com.ruoyi.ss.user.domain.vo.UserRealNameVO; import com.ruoyi.ss.user.mapper.SmUserMapper; import com.ruoyi.ss.user.service.ISmUserService; +import com.ruoyi.system.domain.SysConfig; +import com.ruoyi.system.domain.enums.config.ConfigKey; +import com.ruoyi.system.service.ISysConfigService; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -84,6 +87,9 @@ public class SmUserServiceImpl implements ISmUserService @Autowired private IRealNameService realNameService; + @Autowired + private ISysConfigService sysConfigService; + // 活体检测返回地址 public static final String LIVENESS_RETURN_URL = SpringUtils.getRequiredProperty("liveness.returnUrl"); @@ -506,10 +512,18 @@ public class SmUserServiceImpl implements ISmUserService public int insertSmUser(SmUser smUser) { this.validate(smUser, false); + + // 设置用户默认信息 if (StringUtils.hasText(smUser.getPassword())) { smUser.setPassword(SecurityUtils.encryptPassword(smUser.getPassword())); } smUser.setCreateTime(DateUtils.getNowDate()); + // 若用户没有单独设置服务费,则使用系统默认服务费 + if (smUser.getServiceRate() == null) { + BigDecimal serviceRate = sysConfigService.getBigDecimal(ConfigKey.SERVICE_FEE_RATE); + smUser.setServiceRate(serviceRate); + } + return smUserMapper.insertSmUser(smUser); }