debug:设备恢复总用电量

This commit is contained in:
墨大叔 2024-10-09 15:51:29 +08:00
parent d668228d25
commit 518a48ac97
4 changed files with 32 additions and 7 deletions

View File

@ -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);
}
}

View File

@ -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})

View File

@ -7,6 +7,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<resultMap type="SuitVO" id="SuitResult" autoMapping="true">
<result property="gearAmount" column="gear_amount" typeHandler="com.ruoyi.system.mapper.typehandler.DecimalSplitListTypeHandler"/>
<result property="gearTime" column="gear_time" typeHandler="com.ruoyi.system.mapper.typehandler.IntegerSplitListTypeHandler"/>
<result property="price" column="price" typeHandler="com.ruoyi.system.mapper.typehandler.NonNullDecimalTypeHandler"/>
<result property="deposit" column="deposit" typeHandler="com.ruoyi.system.mapper.typehandler.NonNullDecimalTypeHandler"/>
</resultMap>
<sql id="selectSuitVo">
@ -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"
<if test="name != null and name != ''">`name`,</if>
<if test="value != null">`value`,</if>
<if test="price != null">price,</if>
<if test="deposit != null">deposit,</if>
<if test="description != null">`description`,</if>
<if test="createTime != null">create_time,</if>
<if test="createBy != null">create_by,</if>
@ -138,6 +142,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="name != null and name != ''">#{name},</if>
<if test="value != null">#{value},</if>
<if test="price != null">#{price},</if>
<if test="deposit != null">#{deposit},</if>
<if test="description != null">#{description},</if>
<if test="createTime != null">#{createTime},</if>
<if test="createBy != null">#{createBy},</if>
@ -170,6 +175,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="name != null and name != ''">`name` = #{name},</if>
<if test="value != null">`value` = #{value},</if>
<if test="price != null">price = #{price},</if>
<if test="deposit != null">deposit = #{deposit},</if>
<if test="description != null">`description` = #{description},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>

View File

@ -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);
}