重置实名认证、设备读数等
This commit is contained in:
parent
0561bbe4db
commit
29ca4d69cb
|
@ -251,4 +251,9 @@ public class Device extends BaseEntity
|
|||
@Excel(name = "结束使用的电量")
|
||||
@ApiModelProperty("结束使用的电量")
|
||||
private BigDecimal expireEle;
|
||||
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@Excel(name = "最后一次设置总电量初始读数的时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
|
||||
@ApiModelProperty("最后一次设置总电量初始读数的时间")
|
||||
private LocalDateTime lastInitReading;
|
||||
}
|
||||
|
|
|
@ -9,6 +9,7 @@ import com.ruoyi.ss.device.domain.vo.DeviceVO;
|
|||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
|
@ -217,4 +218,10 @@ public interface DeviceMapper
|
|||
* @return
|
||||
*/
|
||||
int addEle(@Param("deviceId") Long deviceId, @Param("amount") BigDecimal amount);
|
||||
|
||||
/**
|
||||
* 记录读数
|
||||
*/
|
||||
int initTotalEle(@Param("deviceId") Long deviceId);
|
||||
|
||||
}
|
||||
|
|
|
@ -67,6 +67,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
sd.last_recover_time,
|
||||
sd.version,
|
||||
sd.expire_ele,
|
||||
sd.last_init_reading,
|
||||
sm.model_name as model,
|
||||
sm.picture as picture,
|
||||
sm.tags as model_tags,
|
||||
|
@ -392,6 +393,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="onlineStatus2 != null">online_status2,</if>
|
||||
<if test="version != null">version,</if>
|
||||
<if test="expireEle != null">expire_ele,</if>
|
||||
<if test="lastInitReading != null">last_init_reading,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="storeId != null">#{storeId},</if>
|
||||
|
@ -445,6 +447,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="onlineStatus2 != null">#{onlineStatus2},</if>
|
||||
<if test="version != null">#{version},</if>
|
||||
<if test="expireEle != null">#{expireEle},</if>
|
||||
<if test="lastInitReading != null">#{lastInitReading},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
|
@ -529,6 +532,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="onlineStatus2 != null">online_status2 = #{onlineStatus2},</if>
|
||||
<if test="version != null">version = #{version},</if>
|
||||
<if test="expireEle != null">expire_ele = #{expireEle},</if>
|
||||
<if test="lastInitReading != null">last_init_reading = #{lastInitReading},</if>
|
||||
</trim>
|
||||
where device_id = #{deviceId}
|
||||
</update>
|
||||
|
@ -668,6 +672,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
where device_id = #{deviceId} and agent_id is null
|
||||
</update>
|
||||
|
||||
<update id="initTotalEle">
|
||||
update sm_device
|
||||
set init_reading = total_electri_quantity,
|
||||
last_init_reading = now()
|
||||
where device_id = #{deviceId}
|
||||
</update>
|
||||
|
||||
<delete id="deleteSmDeviceByDeviceId" parameterType="Long">
|
||||
delete from sm_device where device_id = #{deviceId}
|
||||
</delete>
|
||||
|
|
|
@ -383,4 +383,10 @@ public interface DeviceService
|
|||
* @param totalEle 总用电量
|
||||
*/
|
||||
int closeNotFinishedBill(DeviceVO device, BigDecimal totalEle);
|
||||
|
||||
/**
|
||||
* 记录初始化读数
|
||||
*/
|
||||
int initTotalEle(Long deviceId);
|
||||
|
||||
}
|
||||
|
|
|
@ -1230,6 +1230,16 @@ public class DeviceServiceImpl implements DeviceService
|
|||
return closeCount;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int initTotalEle(Long deviceId) {
|
||||
if (deviceId == null) {
|
||||
return 0;
|
||||
}
|
||||
// 拉取设备信息
|
||||
this.pullDeviceInfo(deviceId);
|
||||
return deviceMapper.initTotalEle(deviceId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 设备是否已经被绑定
|
||||
*
|
||||
|
|
|
@ -5,6 +5,8 @@ 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 com.ruoyi.ss.user.domain.SmUserQuery;
|
||||
import com.ruoyi.ss.user.service.ISmUserService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
|
@ -18,6 +20,9 @@ public class RealNameValidatorImpl implements RealNameValidator {
|
|||
@Autowired
|
||||
private RealNameService realNameService;
|
||||
|
||||
@Autowired
|
||||
private ISmUserService userService;
|
||||
|
||||
/**
|
||||
* 判断身份证是否已经实名
|
||||
*/
|
||||
|
@ -26,9 +31,10 @@ public class RealNameValidatorImpl implements RealNameValidator {
|
|||
if (StringUtils.isBlank(idCard)) {
|
||||
return;
|
||||
}
|
||||
RealNameQuery query = new RealNameQuery();
|
||||
query.setEqIdCard(idCard);
|
||||
SmUserQuery query = new SmUserQuery();
|
||||
query.setIsReal(true);
|
||||
query.setEqRealIdCard(idCard);
|
||||
query.setExcludeUserId(userId);
|
||||
ServiceUtil.assertion(realNameService.selectCount(query) > 0, "身份证已被其他用户使用,无法重复实名");
|
||||
ServiceUtil.assertion(userService.selectCount(query) > 0, "当前身份证已被其他用户使用,无法重复实名");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -40,4 +40,7 @@ public class SmUserQuery extends SmUser {
|
|||
|
||||
@ApiModelProperty("精准支付宝OpenId")
|
||||
private String eqAliOpenId;
|
||||
|
||||
@ApiModelProperty("精准身份证号")
|
||||
private String eqRealIdCard;
|
||||
}
|
||||
|
|
|
@ -141,4 +141,9 @@ public interface SmUserMapper
|
|||
* 绑定手机号
|
||||
*/
|
||||
int bindMobile(@Param("userId") Long userId, @Param("mobile") String mobile);
|
||||
|
||||
/**
|
||||
* 解除实名认证
|
||||
*/
|
||||
int resetRealName(Long userId);
|
||||
}
|
||||
|
|
|
@ -96,6 +96,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="eqAliOpenId != null and eqAliOpenId != ''">and su.ali_open_id = #{eqAliOpenId}</if>
|
||||
<if test="agentAllowMchSwitch != null">and su.agent_allow_mch_switch != #{agentAllowMchSwitch}</if>
|
||||
<if test="realOrUserName != null and realOrUserName != ''">and if(su.is_real, su.real_name, su.user_name) like concat('%', #{realOrUserName}, '%')</if>
|
||||
<if test="eqRealIdCard != null and eqRealIdCard != ''">and su.real_id_card = #{eqRealIdCard}</if>
|
||||
<if test="tenantDeviceId != null">
|
||||
and su.user_id in (
|
||||
select sdt.tenant_id
|
||||
|
@ -359,6 +360,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
where user_id = #{userId} and (phonenumber is null or phonenumber = '')
|
||||
</update>
|
||||
|
||||
<update id="resetRealName">
|
||||
update sm_user
|
||||
set is_real = false,
|
||||
real_name = null,
|
||||
real_id_card = null,
|
||||
real_phone = null
|
||||
where user_id = #{userId}
|
||||
</update>
|
||||
|
||||
<delete id="deleteSmUserByUserId" parameterType="Long">
|
||||
delete from sm_user where user_id = #{userId}
|
||||
</delete>
|
||||
|
|
|
@ -288,4 +288,9 @@ public interface ISmUserService
|
|||
* @param ciphertext 支付宝手机号密文
|
||||
*/
|
||||
int bindAliMobile(Long userId, String ciphertext);
|
||||
|
||||
/**
|
||||
* 重置实名认证
|
||||
*/
|
||||
int resetRealName(Long userId);
|
||||
}
|
||||
|
|
|
@ -704,6 +704,11 @@ public class SmUserServiceImpl implements ISmUserService
|
|||
return this.bindMobile(userId, mobile);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int resetRealName(Long userId) {
|
||||
return smUserMapper.resetRealName(userId);
|
||||
}
|
||||
|
||||
private SmUserVO selectOne(SmUserQuery query) {
|
||||
PageHelper.startPage(1, 1);
|
||||
List<SmUserVO> list = this.selectSmUserList(query);
|
||||
|
|
|
@ -218,15 +218,17 @@ public class AppDeviceController extends BaseController {
|
|||
@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必须传入其中一个");
|
||||
}
|
||||
@RequestParam(required = false) String deviceNo,
|
||||
@RequestParam(required = false) String mac) {
|
||||
DeviceVO device = null;
|
||||
if (deviceId != null) {
|
||||
device = smDeviceService.selectById(deviceId);
|
||||
} else if (StringUtils.hasText(deviceNo)) {
|
||||
device = smDeviceService.selectByDeviceNo(deviceNo);
|
||||
} else if (StringUtils.hasText(mac)) {
|
||||
device = smDeviceService.selectByAnyMac(mac);
|
||||
} else {
|
||||
return error("设备ID、SN、MAC必须传入其中一个");
|
||||
}
|
||||
smDeviceService.pullDeviceInfo(device);
|
||||
return success();
|
||||
|
|
|
@ -249,4 +249,11 @@ public class SmDeviceController extends BaseController
|
|||
return toAjax(deviceService.setWifi(dto));
|
||||
}
|
||||
|
||||
@ApiOperation("初始化设备总用电量读数")
|
||||
@PreAuthorize("@ss.hasPermi('system:device:initTotalEle')")
|
||||
@PutMapping("/{deviceId}/initTotalEle")
|
||||
public AjaxResult initTotalEle(@PathVariable Long deviceId ) {
|
||||
return toAjax(deviceService.initTotalEle(deviceId));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -146,4 +146,14 @@ public class SmUserController extends BaseController
|
|||
return toAjax(smUserService.logicDel(userIds));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除普通用户信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:smUser:unbindRealName')")
|
||||
@Log(title = "解除实名认证", businessType = BusinessType.OTHER)
|
||||
@PutMapping("/{userId}/resetRealName")
|
||||
public AjaxResult resetRealName(@PathVariable Long userId) {
|
||||
return toAjax(smUserService.resetRealName(userId));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user