优化及添加首页相关接口

This commit is contained in:
zzc 2024-07-19 01:06:21 +08:00
parent 73387d7ac2
commit 256f035dc5
9 changed files with 161 additions and 7 deletions

View File

@ -178,7 +178,7 @@ public class AuthController {
/**
* 用户注册
*/
@ApiEncrypt
//@ApiEncrypt
@PostMapping("/register")
public R<Void> register(@Validated @RequestBody RegisterBody user) {
if (!configService.selectRegisterEnabled(user.getTenantId())) {

View File

@ -8,7 +8,7 @@ ruoyi:
copyrightYear: 2024
captcha:
enable: true
enable: false
# 页面 <参数设置> 可开启关闭 验证码校验
# 验证码类型 math 数组计算 char 字符验证
type: MATH
@ -174,7 +174,7 @@ mybatis-encryptor:
# api接口加密
api-decrypt:
# 是否开启全局接口加密
enabled: true
enabled: false
# AES 加密头标识
headerFlag: encrypt-key
# 响应加密公钥 非对称算法的公私钥 如SM2RSA 使用者请自行更换
@ -188,6 +188,7 @@ springdoc:
api-docs:
# 是否开启接口文档
enabled: true
# swagger-ui:
# # 持久化认证数据
# persistAuthorization: true

View File

@ -24,6 +24,8 @@ import org.dromara.system.service.*;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
/**
@ -82,7 +84,10 @@ public class EqHomeController extends BaseController {
public TableDataInfo<EqEquipmentVo> list(EqAppHomeBo bo, PageQuery pageQuery){
if (bo.getUserId() == null) throw new ServiceException("用户ID不能为空");
//TODO 下面返回的状态可能会修改成实时状态
if (bo.getAreaId() == null){ //无设备分布
EqEquipmentBo eqEquipmentBo = new EqEquipmentBo();
eqEquipmentBo.setCreateBy(bo.getUserId());
return eqEquipmentService.queryPageList(eqEquipmentBo, pageQuery); //在设备表中增加了分布id
/*if (bo.getAreaId() == null){ //无设备分布
EqEquipmentBo eqEquipmentBo = new EqEquipmentBo();
eqEquipmentBo.setCreateBy(bo.getUserId());
return eqEquipmentService.queryPageList(eqEquipmentBo, pageQuery);
@ -90,8 +95,104 @@ public class EqHomeController extends BaseController {
EqAreaEquipmentBo eqAreaEquipmentBo = new EqAreaEquipmentBo();
eqAreaEquipmentBo.setAreaId(bo.getAreaId());
return eqAreaEquipmentService.selectPageEquipmentList(bo, pageQuery);
}*/
}
/**
* 控制设备 0关 1停 2开
* 传参设备编码
*/
@GetMapping("/operate")
public R<String> operate(EqAppHomeBo bo){
// if (bo.getEquipmentId() == null) throw new ServiceException("设备ID不能为空");
if (bo.getEquipmentCode() == null) throw new ServiceException("设备编码不能为空");
return R.ok(eqEquipmentService.operate(bo));
}
/**
* 设备详情
* 传参 设备id
*/
@GetMapping("/info")
public R<EqEquipmentVo> info(EqAppHomeBo bo){
if (bo.getEquipmentId() == null) throw new ServiceException("设备ID不能为空");
return R.ok(eqEquipmentService.queryById(bo.getEquipmentId()));
}
/**
* 添加设备
* @param bo 传参用户id 分布id 设备编码
* @return
*/
@GetMapping("/add")
public R<Boolean> add(EqAppHomeBo bo){
if (bo.getEquipmentCode() == null) throw new ServiceException("设备编码不能为空");
if (bo.getUserId() == null) throw new ServiceException("用户ID不能为空");
if (bo.getAreaId() == null) throw new ServiceException("分布ID不能为空");
//从iot平台设置用户绑定 并获取设备信息
EqEquipmentBo eqEquipmentBo = new EqEquipmentBo();
eqEquipmentBo.setEquipmentCode(bo.getEquipmentCode());
// eqEquipmentBo.setUserId(bo.getUserId());
// eqEquipmentBo.setAreaId(bo.getAreaId());
//TODO 未完
return R.ok(eqEquipmentService.insertByBo(eqEquipmentBo));
}
/**
*
* 删除设备
* 传参设备id
*/
@GetMapping("/delete")
public R<Boolean> delete(EqAppHomeBo bo){
if (bo.getEquipmentId() == null) throw new ServiceException("设备ID不能为空");
Long userId = LoginHelper.getUserId();
if (!userId.equals(bo.getUserId())){
return R.fail("删除失败,设备不属于当前用户");
}
return R.ok(eqEquipmentService.deleteWithValidByIds(Collections.singletonList(bo.getEquipmentId()),Boolean.FALSE));
}
/**
* 密码已验证
* @param password
* @return
*/
@GetMapping("/checkPassword")
public R<Boolean> checkPassword(String password){
//密码验证
return R.ok(true);
}
/**
* 未设置设备详情页
*/
@GetMapping("/noInitDevicePage")
public R<List<String>> noInitDevicePage(){
List<String> list = Arrays.asList(
"详情",
"行程未校准",
"设备未校准行程,将不能进行设备控制",
"行程校准教程",
"请在设备上操作",
"设置开门位置:",
"1.请长按“SET”键",
"观察:显示器显示”1”闪烁",
"2.再次按下\"SET\"",
"观察:显示器显示为”1”常亮",
"3.长按\"UP\"键,使门至最大开门位置后松手停止",
"观察:门向开门方向运行,当门达到最大开门位置后",
"设置关门位置:",
"4.再次按下\"SET\"",
"观察:显示器显示为”2”常亮",
"5.长按“向下”键至关闭位置后松手",
"观察:门向关门方向运行,当门达到关闭位置后停止",
"自动校验:",
"6.再次按下\"SET\""
);
return R.ok(list);
}
}

View File

@ -84,7 +84,7 @@ public class SysProfileController extends BaseController {
* @param bo 新旧密码
*/
@RepeatSubmit
@ApiEncrypt
//@ApiEncrypt
@Log(title = "个人信息", businessType = BusinessType.UPDATE)
@PutMapping("/updatePwd")
public R<Void> updatePwd(@Validated @RequestBody SysUserPasswordBo bo) {

View File

@ -80,7 +80,7 @@ public class SysTenantController extends BaseController {
/**
* 新增租户
*/
@ApiEncrypt
//@ApiEncrypt
@SaCheckRole(TenantConstants.SUPER_ADMIN_ROLE_KEY)
@SaCheckPermission("system:tenant:add")
@Log(title = "租户", businessType = BusinessType.INSERT)

View File

@ -224,7 +224,7 @@ public class SysUserController extends BaseController {
/**
* 重置密码
*/
@ApiEncrypt
//@ApiEncrypt
@SaCheckPermission("system:user:resetPwd")
@Log(title = "用户管理", businessType = BusinessType.UPDATE)
@PutMapping("/resetPwd")

View File

@ -16,7 +16,33 @@ import java.io.Serializable;
**/
@Data
public class EqAppHomeBo extends BaseEntity{
/**
* 选取用户ID家庭主体ID
*/
private Long userId;
/**
* 分布ID
*/
private Long areaId;
/**
* 设备ID
*/
private Long equipmentId;
/**
* 设备编码
*/
private String equipmentCode;
/**
* 设备名称
*/
private String equipmentName;
/**
* 1.关门 2.停止 3.开门 4.半开门 5.灯光倒计时设置 6.开灯 7 关灯 8.灯光倒计时重置 9对码 10.清码
*/
private int operateType;
/**
* 半开门百分比 插入int类型值
*/
private int openPercent;
}

View File

@ -1,5 +1,6 @@
package org.dromara.system.service;
import org.dromara.system.domain.bo.EqAppHomeBo;
import org.dromara.system.domain.vo.EqEquipmentVo;
import org.dromara.system.domain.bo.EqEquipmentBo;
import org.dromara.common.mybatis.core.page.TableDataInfo;
@ -65,4 +66,6 @@ public interface IEqEquipmentService {
* @return 是否删除成功
*/
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
String operate(EqAppHomeBo bo);
}

View File

@ -8,6 +8,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import lombok.RequiredArgsConstructor;
import org.dromara.system.domain.bo.EqAppHomeBo;
import org.springframework.stereotype.Service;
import org.dromara.system.domain.bo.EqEquipmentBo;
import org.dromara.system.domain.vo.EqEquipmentVo;
@ -74,6 +75,7 @@ public class EqEquipmentServiceImpl implements IEqEquipmentService {
lqw.eq(bo.getType() != null, EqEquipment::getType, bo.getType());
lqw.like(StringUtils.isNotBlank(bo.getUserName()), EqEquipment::getUserName, bo.getUserName());
lqw.like(StringUtils.isNotBlank(bo.getNickName()), EqEquipment::getNickName, bo.getNickName());
lqw.like(StringUtils.isNotBlank(bo.getSearchValue()), EqEquipment::getEquipmentCode, bo.getSearchValue());
lqw.like(StringUtils.isNotBlank(bo.getEquipmentCode()), EqEquipment::getEquipmentCode, bo.getEquipmentCode());
lqw.eq(bo.getStatus() != null, EqEquipment::getStatus, bo.getStatus());
lqw.eq(bo.getLineStatus() != null, EqEquipment::getLineStatus, bo.getLineStatus());
@ -132,4 +134,25 @@ public class EqEquipmentServiceImpl implements IEqEquipmentService {
}
return baseMapper.deleteByIds(ids) > 0;
}
@Override
public String operate(EqAppHomeBo bo) {
//todo 调用iot平台 进行指令发送
int operateType = bo.getOperateType();
switch (operateType){
case 1:
// todo 调用iot平台进行控制
break;
case 2:
break;
case 3:
break;
default:
return "指令类型错误";
}
//增加操作次数 更新到设备表中
return null;
}
}