mirror of
https://gitee.com/dromara/RuoYi-Vue-Plus.git
synced 2026-09-18 17:38:48 +08:00
Merge remote-tracking branch 'origin/5.X' into 5.X
This commit is contained in:
commit
9e7f6b4736
@ -190,7 +190,7 @@ public class AuthController {
|
||||
SysUserVo sysUserVo = userService.selectUserByUserName(user.getUsername());
|
||||
EqUserConfigBo bo = new EqUserConfigBo();
|
||||
bo.setUserId(sysUserVo.getUserId());
|
||||
bo.setLanguageType("zh-CN");
|
||||
bo.setLanguageType("zh_CN");
|
||||
bo.setTimezoneType("1");//默认 UTC+08:00
|
||||
bo.setTimeFormat("YYYY-MM-DD");
|
||||
bo.setCreateBy(sysUserVo.getUserId());
|
||||
|
||||
@ -6,6 +6,7 @@ import lombok.RequiredArgsConstructor;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import jakarta.validation.constraints.*;
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import org.dromara.common.satoken.utils.LoginHelper;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.dromara.common.idempotent.annotation.RepeatSubmit;
|
||||
@ -76,6 +77,10 @@ public class EqShareController extends BaseController {
|
||||
@RepeatSubmit()
|
||||
@PostMapping()
|
||||
public R<Void> add(@Validated(AddGroup.class) @RequestBody EqShareBo bo) {
|
||||
if (bo.getShareUserId() == null){
|
||||
bo.setShareUserId(LoginHelper.getUserId());
|
||||
bo.setShareUserName(LoginHelper.getUsername());
|
||||
}
|
||||
return toAjax(eqShareService.insertByBo(bo));
|
||||
}
|
||||
|
||||
|
||||
@ -17,7 +17,9 @@ import org.dromara.web.device.iot.DeviceDto;
|
||||
import org.dromara.web.domain.bo.*;
|
||||
import org.dromara.web.domain.vo.*;
|
||||
import org.dromara.web.service.*;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
@ -57,7 +59,7 @@ public class EqDeviceController extends BaseController {
|
||||
|
||||
|
||||
|
||||
/** todo
|
||||
/**
|
||||
* 添加设备
|
||||
* @param bo 传参用户id 分布id 设备编码
|
||||
* @return
|
||||
@ -66,12 +68,25 @@ public class EqDeviceController extends BaseController {
|
||||
public R<Boolean> bindDevice(EqAppHomeBo bo){
|
||||
String equipmentCode = bo.getEquipmentCode();
|
||||
if (equipmentCode == null) throw new ServiceException("设备编码不能为空");
|
||||
if (bo.getUserId() == null) throw new ServiceException("用户ID不能为空");
|
||||
if (bo.getAreaId() == null) throw new ServiceException("分布ID不能为空");
|
||||
|
||||
if (bo.getUserId() == null) throw new ServiceException("用户ID不能为空");//分享用户要使用家庭主体的用户id
|
||||
return R.ok(eqEquipmentService.bindDevice(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* 删除设备
|
||||
* 传参设备id
|
||||
*/
|
||||
@DeleteMapping("/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));
|
||||
}
|
||||
|
||||
/**
|
||||
* 控制设备 门 灯光 控制
|
||||
* 传参设备编码
|
||||
@ -131,7 +146,7 @@ public class EqDeviceController extends BaseController {
|
||||
List<EqEquipmentLogVo> rowsData = rows.stream().peek(x -> {
|
||||
Integer status = x.getStatus();
|
||||
x.setLogStatus(MessageUtils.message("logStatus.name" + status));
|
||||
if(defaultZone.equals(targetZone)){
|
||||
if(!defaultZone.equals(targetZone)){
|
||||
String dateTimeStr = simpleDateFormat.format(x.getCreateTime());
|
||||
LocalDateTime localDateTime = LocalDateTime.parse(dateTimeStr, formatter);
|
||||
ZoneId utc08 = ZoneId.of(defaultZone);// 默认指定原始时区UTC+08:00
|
||||
@ -148,11 +163,21 @@ public class EqDeviceController extends BaseController {
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存日志
|
||||
* 保存日志(iot使用 设备状态变动时会触发该状态)
|
||||
* @param eqEquipmentLogBo
|
||||
*/
|
||||
@GetMapping("/saveDeviceLogs")
|
||||
public void saveDeviceLogs(EqEquipmentLogBo eqEquipmentLogBo){
|
||||
|
||||
EqEquipmentBo eqEquipmentBo = new EqEquipmentBo();
|
||||
eqEquipmentBo.setEquipmentCode(eqEquipmentLogBo.getEquipmentCode());
|
||||
List<EqEquipmentVo> eqEquipmentVos = eqEquipmentService.queryList(eqEquipmentBo);
|
||||
if (CollectionUtils.isEmpty(eqEquipmentVos)) return;
|
||||
EqEquipmentVo eqEquipmentVo = eqEquipmentVos.get(0);
|
||||
eqEquipmentBo.setEquipmentId(eqEquipmentVo.getEquipmentId());
|
||||
eqEquipmentLogBo.setUserId(eqEquipmentVo.getUserId());
|
||||
eqEquipmentLogBo.setUserName(eqEquipmentVo.getUserName());
|
||||
eqEquipmentLogBo.setNickName(eqEquipmentVo.getNickName());
|
||||
Date createTime = eqEquipmentLogBo.getCreateTime();
|
||||
if (createTime == null) {
|
||||
createTime = new Date();
|
||||
@ -170,7 +195,14 @@ public class EqDeviceController extends BaseController {
|
||||
int dayOfWeek = calendar.get(Calendar.DAY_OF_WEEK);
|
||||
eqEquipmentLogBo.setDayOfWeek(dayOfWeek - 1);// Calendar类中星期日为1,星期一为2,依此类推
|
||||
|
||||
//更新状态
|
||||
logService.insertByBo(eqEquipmentLogBo);
|
||||
|
||||
//更新开合度状态到设备
|
||||
eqEquipmentBo.setStatus(eqEquipmentLogBo.getOpenStatus());
|
||||
eqEquipmentBo.setFaultStatus(eqEquipmentBo.getFaultStatus());
|
||||
eqEquipmentBo.setLineStatus(eqEquipmentBo.getLineStatus());
|
||||
eqEquipmentService.updateByBo(eqEquipmentBo);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -1,9 +1,16 @@
|
||||
package org.dromara.web.controller.app;
|
||||
|
||||
import cn.dev33.satoken.secure.BCrypt;
|
||||
import jakarta.validation.constraints.NotEmpty;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.dromara.common.core.domain.R;
|
||||
import org.dromara.common.core.domain.model.LoginUser;
|
||||
import org.dromara.common.core.exception.ServiceException;
|
||||
import org.dromara.common.core.validate.AddGroup;
|
||||
import org.dromara.common.core.validate.EditGroup;
|
||||
import org.dromara.common.idempotent.annotation.RepeatSubmit;
|
||||
import org.dromara.common.log.annotation.Log;
|
||||
import org.dromara.common.log.enums.BusinessType;
|
||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
import org.dromara.common.satoken.utils.LoginHelper;
|
||||
@ -17,6 +24,7 @@ import org.dromara.web.domain.bo.EqAppHomeBo;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
@ -33,7 +41,7 @@ import java.util.List;
|
||||
public class EqHomeController extends BaseController {
|
||||
|
||||
private final IEqAreaService eqAreaService;
|
||||
|
||||
private final IEqFamilyService eqFamilyService;
|
||||
private final IEqEquipmentService eqEquipmentService;
|
||||
|
||||
private final IEqShareService shareService;
|
||||
@ -49,7 +57,18 @@ public class EqHomeController extends BaseController {
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询家庭主体
|
||||
* 修改用户配置
|
||||
* @param bo
|
||||
* @return
|
||||
*/
|
||||
@Log(title = "用户配置", businessType = BusinessType.UPDATE)
|
||||
@RepeatSubmit()
|
||||
@PutMapping("/editUserConfig")
|
||||
public R<Void> editUserConfig(@Validated(EditGroup.class) @RequestBody EqUserConfigBo bo) {
|
||||
return toAjax(eqUserConfigService.updateByBo(bo));
|
||||
}
|
||||
/**
|
||||
* 首页切换 查询家庭主体
|
||||
*/
|
||||
@GetMapping("/familyList")
|
||||
public R<List<EqShareVo>> familyList(){
|
||||
@ -67,54 +86,194 @@ public class EqHomeController extends BaseController {
|
||||
return R.ok(eqShareVos);
|
||||
}
|
||||
|
||||
/**
|
||||
* 我的家庭 查询家庭列表详细
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/familyListDetail")
|
||||
public R<List<EqShareDetailVo>> familyListDetail(){
|
||||
List<EqShareDetailVo> result = new ArrayList<>();
|
||||
LoginUser loginUser = LoginHelper.getLoginUser();
|
||||
Long userId = loginUser.getUserId();
|
||||
String username = loginUser.getUsername();
|
||||
List<EqFamilyVo> eqFamilyVos = eqFamilyService.queryList(new EqFamilyBo(userId));
|
||||
|
||||
|
||||
EqShareVo firstVo = new EqShareVo();
|
||||
firstVo.setShareUserId(userId);
|
||||
firstVo.setShareUserName(username);
|
||||
firstVo.setSharedUserId(userId);//为了方便前端操作 统一放在被分享者字段中
|
||||
firstVo.setSharedUserName(username);
|
||||
|
||||
EqShareBo bo = new EqShareBo();
|
||||
bo.setSharedUserId(userId);
|
||||
List<EqShareVo> eqShareVos = shareService.queryList(bo);
|
||||
eqShareVos.add(0,firstVo);
|
||||
|
||||
for (EqShareVo eqShareVo : eqShareVos) {
|
||||
Long shareUserId = eqShareVo.getShareUserId();
|
||||
EqShareDetailVo eqShareDetailVo = new EqShareDetailVo();
|
||||
|
||||
eqShareDetailVo.setShareId(eqShareVo.getShareId());
|
||||
eqShareDetailVo.setShareUserId(eqShareVo.getShareUserId());
|
||||
eqShareDetailVo.setShareUserName(eqShareVo.getShareUserName());
|
||||
eqShareDetailVo.setSharedUserId(eqShareVo.getSharedUserId());
|
||||
eqShareDetailVo.setSharedUserName(eqShareVo.getSharedUserName());
|
||||
|
||||
List<EqAreaVo> eqAreaVos = eqAreaService.queryList(new EqAreaBo(shareUserId));
|
||||
List<EqEquipmentVo> eqEquipmentVos = eqEquipmentService.queryList(new EqEquipmentBo(shareUserId));
|
||||
eqShareDetailVo.setEqAreaVos(eqAreaVos);
|
||||
eqShareDetailVo.setEqEquipmentVos(eqEquipmentVos);
|
||||
eqShareDetailVo.setAreaNum(eqAreaVos.size());
|
||||
eqShareDetailVo.setEqNum(eqEquipmentVos.size());
|
||||
|
||||
List<EqFamilyVo> familyVos = eqFamilyService.queryList(new EqFamilyBo(shareUserId));
|
||||
String familyName = "";
|
||||
if (!familyVos.isEmpty()) {
|
||||
familyName = familyVos.get(0).getFamilyName()+"的家";
|
||||
}else{
|
||||
familyName = userId.equals(shareUserId)?"我的家":eqShareVo.getShareUserName()+"的家";
|
||||
}
|
||||
eqShareDetailVo.setFamilyName(familyName);
|
||||
|
||||
result.add(eqShareDetailVo);
|
||||
}
|
||||
return R.ok(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改家庭名称
|
||||
*/
|
||||
@PostMapping("/updateFamilyName")
|
||||
public R<Void> updateFamilyName(@RequestBody EqFamilyBo bo) {
|
||||
if (bo.getFamilyName() == null) return R.fail("家庭名称不能为空");
|
||||
if (bo.getUserId() == null) return R.fail("用户id不能为空");
|
||||
if (!LoginHelper.getUserId().equals(bo.getUserId())) throw new RuntimeException("不能操作其他家庭主体名称");
|
||||
List<EqFamilyVo> eqFamilyVos = eqFamilyService.queryList(new EqFamilyBo(bo.getUserId()));
|
||||
if (eqFamilyVos.isEmpty()) {
|
||||
EqFamilyBo eqFamilyBo = new EqFamilyBo();
|
||||
eqFamilyBo.setUserId(bo.getUserId());
|
||||
eqFamilyBo.setFamilyName(bo.getFamilyName());
|
||||
eqFamilyService.insertByBo(eqFamilyBo);
|
||||
}else{
|
||||
EqFamilyVo eqFamilyVo = eqFamilyVos.get(0);
|
||||
eqFamilyVo.setFamilyName(bo.getFamilyName());
|
||||
eqFamilyService.updateByBo(bo);
|
||||
}
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 成员管理 查询家庭成员
|
||||
*/
|
||||
@GetMapping("/familyMemberList")
|
||||
public R<List<EqShareVo>> familyMemberList(){
|
||||
Long userId = LoginHelper.getUserId();
|
||||
SysUserVo sysUserVo = userService.selectUserById(userId);
|
||||
EqShareVo firstVo = new EqShareVo();
|
||||
firstVo.setSharedUserId(sysUserVo.getUserId());//为了方便前端操作 统一放在被分享者字段中
|
||||
firstVo.setSharedUserName(sysUserVo.getNickName());
|
||||
|
||||
EqShareBo bo = new EqShareBo();
|
||||
bo.setShareUserId(userId);
|
||||
List<EqShareVo> eqShareVos = shareService.queryList(bo);
|
||||
eqShareVos.add(0,firstVo);
|
||||
|
||||
return R.ok(eqShareVos);
|
||||
}
|
||||
|
||||
/**
|
||||
* 分享(添加家庭成员)
|
||||
* @param bo
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/share")
|
||||
public R<Void> share( @RequestBody EqShareBo bo) {
|
||||
if (bo.getSharedUserName() == null){
|
||||
return R.fail("被分享者用户名不能为空");
|
||||
}
|
||||
SysUserVo sysUserVo = userService.selectUserByUserName(bo.getSharedUserName());
|
||||
if (sysUserVo==null) throw new RuntimeException("被分享者用户名不存在");
|
||||
|
||||
if (bo.getShareUserId() == null){
|
||||
bo.setShareUserId(LoginHelper.getUserId());
|
||||
String currentUserName = LoginHelper.getUsername();
|
||||
if (currentUserName.equals(bo.getSharedUserName())) throw new RuntimeException("不能分享给自己");
|
||||
bo.setShareUserName(currentUserName);
|
||||
}
|
||||
bo.setSharedUserId(sysUserVo.getUserId());
|
||||
bo.setSharedUserName(sysUserVo.getUserName());
|
||||
List<EqShareVo> eqShareVos = eqShareService.queryList(bo);
|
||||
if (!eqShareVos.isEmpty()) throw new RuntimeException("该成员已被分享");
|
||||
return toAjax(eqShareService.insertByBo(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除被分享的成员
|
||||
* @param sharedId 被分享者用户id
|
||||
* @return
|
||||
*/
|
||||
@DeleteMapping("/{sharedId}")
|
||||
public R<Void> remove(@NotEmpty(message = "主键不能为空")
|
||||
@PathVariable String sharedId) {
|
||||
return toAjax(eqShareService.deleteByShareId(sharedId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询指定用户下分布列表
|
||||
*/
|
||||
@GetMapping("/areaList")
|
||||
public R<List<EqAreaVo>> areaList(EqAreaBo bo){
|
||||
if (bo.getUserId() == null) throw new ServiceException("用户ID不能为空");
|
||||
if (bo.getUserId() == null) bo.setUserId(LoginHelper.getUserId());
|
||||
return R.ok(eqAreaService.queryList(bo));
|
||||
}
|
||||
|
||||
/** todo
|
||||
/**
|
||||
* 新增分布
|
||||
* @param bo
|
||||
* @return
|
||||
*/
|
||||
@Log(title = "分布管理", businessType = BusinessType.INSERT)
|
||||
@RepeatSubmit()
|
||||
@PostMapping("areaAdd")
|
||||
public R<Void> areaAdd(@Validated(AddGroup.class) @RequestBody EqAreaBo bo) {
|
||||
return toAjax(eqAreaService.insertByBo(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 首页查看设备列表
|
||||
*/
|
||||
@GetMapping("/list")
|
||||
@PostMapping("/list")
|
||||
public TableDataInfo<EqEquipmentVo> list(EqAppHomeBo bo, PageQuery pageQuery){
|
||||
if (bo.getUserId() == null) throw new ServiceException("用户ID不能为空");
|
||||
//TODO 下面返回的状态可能会修改成实时状态
|
||||
//当前用户为家庭主体 切换用户后需要传输用户id
|
||||
if (bo.getUserId() == null) bo.setUserId(LoginHelper.getUserId());
|
||||
// 下面返回的状态 会在设备状态变化时更新设备状态 状态更新由iot触发
|
||||
EqEquipmentBo eqEquipmentBo = new EqEquipmentBo();
|
||||
eqEquipmentBo.setCreateBy(bo.getUserId());
|
||||
eqEquipmentBo.setUserId(bo.getUserId());
|
||||
return eqEquipmentService.queryPageList(eqEquipmentBo, pageQuery); //在设备表中增加了分布id
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 设备重排
|
||||
* @param bos
|
||||
* @return
|
||||
*/
|
||||
@PutMapping("/orderList")
|
||||
public R<Void> list(@RequestBody List<EqAppHomeBo> bos){
|
||||
return toAjax(eqEquipmentService.updateByBos(bos));
|
||||
}
|
||||
|
||||
/**
|
||||
* 设备详情 (暂时无用)
|
||||
* 传参 设备id
|
||||
*/
|
||||
@GetMapping("/info")
|
||||
/*@GetMapping("/info")
|
||||
public R<EqEquipmentVo> info(EqAppHomeBo bo){
|
||||
if (bo.getEquipmentId() == null) throw new ServiceException("设备ID不能为空");
|
||||
return R.ok(eqEquipmentService.queryById(bo.getEquipmentId()));
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* 删除设备
|
||||
* 传参设备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));
|
||||
}
|
||||
|
||||
}*/
|
||||
|
||||
/**
|
||||
* 密码验证
|
||||
@ -131,6 +290,8 @@ public class EqHomeController extends BaseController {
|
||||
}
|
||||
|
||||
|
||||
private final IEqShareService eqShareService;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -0,0 +1,228 @@
|
||||
package org.dromara.web.controller.app;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import cn.dev33.satoken.secure.BCrypt;
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.io.FileUtil;
|
||||
import cn.hutool.core.util.ArrayUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import jakarta.validation.constraints.NotEmpty;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.dromara.common.core.domain.R;
|
||||
import org.dromara.common.core.domain.model.LoginUser;
|
||||
import org.dromara.common.core.exception.ServiceException;
|
||||
import org.dromara.common.core.utils.StringUtils;
|
||||
import org.dromara.common.core.utils.file.MimeTypeUtils;
|
||||
import org.dromara.common.idempotent.annotation.RepeatSubmit;
|
||||
import org.dromara.common.log.annotation.Log;
|
||||
import org.dromara.common.log.enums.BusinessType;
|
||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
import org.dromara.common.satoken.utils.LoginHelper;
|
||||
import org.dromara.common.tenant.helper.TenantHelper;
|
||||
import org.dromara.common.web.core.BaseController;
|
||||
import org.dromara.system.domain.bo.SysUserBo;
|
||||
import org.dromara.system.domain.bo.SysUserPasswordBo;
|
||||
import org.dromara.system.domain.bo.SysUserProfileBo;
|
||||
import org.dromara.system.domain.vo.AvatarVo;
|
||||
import org.dromara.system.domain.vo.SysOssVo;
|
||||
import org.dromara.system.domain.vo.SysUserVo;
|
||||
import org.dromara.system.domain.vo.UserInfoVo;
|
||||
import org.dromara.system.service.*;
|
||||
import org.dromara.web.domain.bo.EqAppHomeBo;
|
||||
import org.dromara.web.domain.bo.EqAreaBo;
|
||||
import org.dromara.web.domain.bo.EqEquipmentBo;
|
||||
import org.dromara.web.domain.bo.EqShareBo;
|
||||
import org.dromara.web.domain.vo.EqAreaVo;
|
||||
import org.dromara.web.domain.vo.EqEquipmentVo;
|
||||
import org.dromara.web.domain.vo.EqShareVo;
|
||||
import org.dromara.web.domain.vo.EqUserConfigVo;
|
||||
import org.dromara.web.service.IEqAreaService;
|
||||
import org.dromara.web.service.IEqEquipmentService;
|
||||
import org.dromara.web.service.IEqShareService;
|
||||
import org.dromara.web.service.IEqUserConfigService;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* app用户相关
|
||||
*
|
||||
* @author zzc
|
||||
* @date 2024-07-14
|
||||
*/
|
||||
@Validated
|
||||
@RequiredArgsConstructor
|
||||
@RestController
|
||||
@RequestMapping("/app/user")
|
||||
public class EqUserController extends BaseController {
|
||||
|
||||
private final ISysUserService userService;
|
||||
private final ISysRoleService roleService;
|
||||
private final ISysPostService postService;
|
||||
private final ISysDeptService deptService;
|
||||
private final ISysTenantService tenantService;
|
||||
private final ISysOssService ossService;
|
||||
|
||||
/**
|
||||
* 获取用户信息
|
||||
*
|
||||
* @return 用户信息
|
||||
*/
|
||||
@GetMapping("/getInfo")
|
||||
public R<UserInfoVo> getInfo() {
|
||||
UserInfoVo userInfoVo = new UserInfoVo();
|
||||
LoginUser loginUser = LoginHelper.getLoginUser();
|
||||
if (TenantHelper.isEnable() && LoginHelper.isSuperAdmin()) {
|
||||
// 超级管理员 如果重新加载用户信息需清除动态租户
|
||||
TenantHelper.clearDynamic();
|
||||
}
|
||||
SysUserVo user = userService.selectUserById(loginUser.getUserId());
|
||||
if (ObjectUtil.isNull(user)) {
|
||||
return R.fail("没有权限访问用户数据!");
|
||||
}
|
||||
userInfoVo.setUser(user);
|
||||
userInfoVo.setPermissions(loginUser.getMenuPermission());
|
||||
userInfoVo.setRoles(loginUser.getRolePermission());
|
||||
return R.ok(userInfoVo);
|
||||
}
|
||||
|
||||
|
||||
/* *//**
|
||||
* 修改用户
|
||||
*//*
|
||||
@Log(title = "用户管理", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public R<Void> edit(@Validated @RequestBody SysUserBo user) {
|
||||
userService.checkUserAllowed(user.getUserId());
|
||||
userService.checkUserDataScope(user.getUserId());
|
||||
deptService.checkDeptDataScope(user.getDeptId());
|
||||
if (!userService.checkUserNameUnique(user)) {
|
||||
return R.fail("修改用户'" + user.getUserName() + "'失败,登录账号已存在");
|
||||
} else if (StringUtils.isNotEmpty(user.getPhonenumber()) && !userService.checkPhoneUnique(user)) {
|
||||
return R.fail("修改用户'" + user.getUserName() + "'失败,手机号码已存在");
|
||||
} else if (StringUtils.isNotEmpty(user.getEmail()) && !userService.checkEmailUnique(user)) {
|
||||
return R.fail("修改用户'" + user.getUserName() + "'失败,邮箱账号已存在");
|
||||
}
|
||||
return toAjax(userService.updateUser(user));
|
||||
}*/
|
||||
|
||||
|
||||
/**
|
||||
* 删除用户
|
||||
* 删除当前登录用户
|
||||
* @param
|
||||
*/
|
||||
@Log(title = "用户管理", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("")
|
||||
public R<Void> remove() {
|
||||
Long[] userIds = {LoginHelper.getUserId()};
|
||||
return toAjax(userService.deleteUserByIds(userIds));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 修改用户信息
|
||||
*/
|
||||
@RepeatSubmit
|
||||
@Log(title = "个人信息", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public R<Void> updateProfile(@Validated @RequestBody SysUserProfileBo profile) {
|
||||
SysUserBo user = BeanUtil.toBean(profile, SysUserBo.class);
|
||||
user.setUserId(LoginHelper.getUserId());
|
||||
String username = LoginHelper.getUsername();
|
||||
if (StringUtils.isNotEmpty(user.getPhonenumber()) && !userService.checkPhoneUnique(user)) {
|
||||
return R.fail("修改用户'" + username + "'失败,手机号码已存在");
|
||||
}
|
||||
if (StringUtils.isNotEmpty(user.getEmail()) && !userService.checkEmailUnique(user)) {
|
||||
return R.fail("修改用户'" + username + "'失败,邮箱账号已存在");
|
||||
}
|
||||
if (userService.updateUserProfile(user) > 0) {
|
||||
return R.ok();
|
||||
}
|
||||
return R.fail("修改个人信息异常,请联系管理员");
|
||||
}
|
||||
|
||||
/**
|
||||
* 重置密码
|
||||
*
|
||||
* @param bo 新旧密码
|
||||
*/
|
||||
@RepeatSubmit
|
||||
//@ApiEncrypt
|
||||
@Log(title = "个人信息", businessType = BusinessType.UPDATE)
|
||||
@PutMapping("/updatePwd")
|
||||
public R<Void> updatePwd(@Validated @RequestBody SysUserPasswordBo bo) {
|
||||
SysUserVo user = userService.selectUserById(LoginHelper.getUserId());
|
||||
String password = user.getPassword();
|
||||
if (!BCrypt.checkpw(bo.getOldPassword(), password)) {
|
||||
return R.fail("修改密码失败,旧密码错误");
|
||||
}
|
||||
if (BCrypt.checkpw(bo.getNewPassword(), password)) {
|
||||
return R.fail("新密码不能与旧密码相同");
|
||||
}
|
||||
|
||||
if (userService.resetUserPwd(user.getUserId(), BCrypt.hashpw(bo.getNewPassword())) > 0) {
|
||||
return R.ok();
|
||||
}
|
||||
return R.fail("修改密码异常,请联系管理员");
|
||||
}
|
||||
|
||||
/**
|
||||
* 头像上传
|
||||
*
|
||||
* @param avatarfile 用户头像
|
||||
*/
|
||||
@RepeatSubmit
|
||||
@Log(title = "用户头像", businessType = BusinessType.UPDATE)
|
||||
@PostMapping(value = "/avatar", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
|
||||
public R<AvatarVo> avatar(@RequestPart("avatarfile") MultipartFile avatarfile) {
|
||||
if (!avatarfile.isEmpty()) {
|
||||
String extension = FileUtil.extName(avatarfile.getOriginalFilename());
|
||||
if (!StringUtils.equalsAnyIgnoreCase(extension, MimeTypeUtils.IMAGE_EXTENSION)) {
|
||||
return R.fail("文件格式不正确,请上传" + Arrays.toString(MimeTypeUtils.IMAGE_EXTENSION) + "格式");
|
||||
}
|
||||
SysOssVo oss = ossService.upload(avatarfile);
|
||||
String avatar = oss.getUrl();
|
||||
if (userService.updateUserAvatar(LoginHelper.getUserId(), oss.getOssId())) {
|
||||
AvatarVo avatarVo = new AvatarVo();
|
||||
avatarVo.setImgUrl(avatar);
|
||||
return R.ok(avatarVo);
|
||||
}
|
||||
}
|
||||
return R.fail("上传图片异常,请联系管理员");
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 密码验证
|
||||
* @param bo
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/checkPassword")
|
||||
public R<Boolean> checkPassword(EqAppHomeBo bo){
|
||||
//密码验证
|
||||
if (bo.getUserId()==null||bo.getPassword()== null) throw new ServiceException("用户ID或密码不能为空");
|
||||
SysUserVo sysUserVo = userService.selectUserById(bo.getUserId());
|
||||
if (sysUserVo == null) throw new ServiceException("用户不存在");
|
||||
return R.ok(BCrypt.checkpw(bo.getPassword(), sysUserVo.getPassword()));
|
||||
}
|
||||
|
||||
|
||||
private final IEqShareService eqShareService;
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -0,0 +1,105 @@
|
||||
package org.dromara.web.controller.show;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import jakarta.validation.constraints.*;
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.dromara.common.idempotent.annotation.RepeatSubmit;
|
||||
import org.dromara.common.log.annotation.Log;
|
||||
import org.dromara.common.web.core.BaseController;
|
||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||
import org.dromara.common.core.domain.R;
|
||||
import org.dromara.common.core.validate.AddGroup;
|
||||
import org.dromara.common.core.validate.EditGroup;
|
||||
import org.dromara.common.log.enums.BusinessType;
|
||||
import org.dromara.common.excel.utils.ExcelUtil;
|
||||
import org.dromara.web.domain.vo.EqEquipmentVo;
|
||||
import org.dromara.web.domain.bo.EqEquipmentBo;
|
||||
import org.dromara.web.service.IEqEquipmentService;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 设备信息
|
||||
*
|
||||
* @author zzc
|
||||
* @date 2024-08-08
|
||||
*/
|
||||
@Validated
|
||||
@RequiredArgsConstructor
|
||||
@RestController
|
||||
@RequestMapping("/device/showEquipment")
|
||||
public class EqShowEquipmentController extends BaseController {
|
||||
|
||||
private final IEqEquipmentService eqEquipmentService;
|
||||
|
||||
/**
|
||||
* 查询设备信息列表
|
||||
*/
|
||||
@SaCheckPermission("device:showEquipment:list")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo<EqEquipmentVo> list(EqEquipmentBo bo, PageQuery pageQuery) {
|
||||
return eqEquipmentService.queryPageList(bo, pageQuery);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出设备信息列表
|
||||
*/
|
||||
@SaCheckPermission("device:showEquipment:export")
|
||||
@Log(title = "设备信息", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(EqEquipmentBo bo, HttpServletResponse response) {
|
||||
List<EqEquipmentVo> list = eqEquipmentService.queryList(bo);
|
||||
ExcelUtil.exportExcel(list, "设备信息", EqEquipmentVo.class, response);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取设备信息详细信息
|
||||
*
|
||||
* @param equipmentId 主键
|
||||
*/
|
||||
@SaCheckPermission("device:showEquipment:query")
|
||||
@GetMapping("/{equipmentId}")
|
||||
public R<EqEquipmentVo> getInfo(@NotNull(message = "主键不能为空")
|
||||
@PathVariable Long equipmentId) {
|
||||
return R.ok(eqEquipmentService.queryById(equipmentId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增设备信息
|
||||
*/
|
||||
@SaCheckPermission("device:showEquipment:add")
|
||||
@Log(title = "设备信息", businessType = BusinessType.INSERT)
|
||||
@RepeatSubmit()
|
||||
@PostMapping()
|
||||
public R<Void> add(@Validated(AddGroup.class) @RequestBody EqEquipmentBo bo) {
|
||||
return toAjax(eqEquipmentService.insertByBo(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改设备信息
|
||||
*/
|
||||
@SaCheckPermission("device:showEquipment:edit")
|
||||
@Log(title = "设备信息", businessType = BusinessType.UPDATE)
|
||||
@RepeatSubmit()
|
||||
@PutMapping()
|
||||
public R<Void> edit(@Validated(EditGroup.class) @RequestBody EqEquipmentBo bo) {
|
||||
return toAjax(eqEquipmentService.updateByBo(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除设备信息
|
||||
*
|
||||
* @param equipmentIds 主键串
|
||||
*/
|
||||
@SaCheckPermission("device:showEquipment:remove")
|
||||
@Log(title = "设备信息", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{equipmentIds}")
|
||||
public R<Void> remove(@NotEmpty(message = "主键不能为空")
|
||||
@PathVariable Long[] equipmentIds) {
|
||||
return toAjax(eqEquipmentService.deleteWithValidByIds(List.of(equipmentIds), true));
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,105 @@
|
||||
package org.dromara.web.controller.show;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import jakarta.validation.constraints.*;
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.dromara.common.idempotent.annotation.RepeatSubmit;
|
||||
import org.dromara.common.log.annotation.Log;
|
||||
import org.dromara.common.web.core.BaseController;
|
||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||
import org.dromara.common.core.domain.R;
|
||||
import org.dromara.common.core.validate.AddGroup;
|
||||
import org.dromara.common.core.validate.EditGroup;
|
||||
import org.dromara.common.log.enums.BusinessType;
|
||||
import org.dromara.common.excel.utils.ExcelUtil;
|
||||
import org.dromara.web.domain.vo.EqEquipmentLogVo;
|
||||
import org.dromara.web.domain.bo.EqEquipmentLogBo;
|
||||
import org.dromara.web.service.IEqEquipmentLogService;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 设备状态日志
|
||||
*
|
||||
* @author zzc
|
||||
* @date 2024-08-14
|
||||
*/
|
||||
@Validated
|
||||
@RequiredArgsConstructor
|
||||
@RestController
|
||||
@RequestMapping("/device/showEquipmentLog")
|
||||
public class EqShowEquipmentLogController extends BaseController {
|
||||
|
||||
private final IEqEquipmentLogService eqEquipmentLogService;
|
||||
|
||||
/**
|
||||
* 查询设备状态日志列表
|
||||
*/
|
||||
@SaCheckPermission("device:showEquipmentLog:list")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo<EqEquipmentLogVo> list(EqEquipmentLogBo bo, PageQuery pageQuery) {
|
||||
return eqEquipmentLogService.queryPageList(bo, pageQuery);
|
||||
}
|
||||
|
||||
/* *//**
|
||||
* 导出设备状态日志列表
|
||||
*//*
|
||||
@SaCheckPermission("device:showEquipmentLog:export")
|
||||
@Log(title = "设备状态日志", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(EqEquipmentLogBo bo, HttpServletResponse response) {
|
||||
List<EqEquipmentLogVo> list = eqEquipmentLogService.queryList(bo);
|
||||
ExcelUtil.exportExcel(list, "设备状态日志", EqEquipmentLogVo.class, response);
|
||||
}
|
||||
|
||||
*//**
|
||||
* 获取设备状态日志详细信息
|
||||
*
|
||||
* @param logId 主键
|
||||
*//*
|
||||
@SaCheckPermission("device:showEquipmentLog:query")
|
||||
@GetMapping("/{logId}")
|
||||
public R<EqEquipmentLogVo> getInfo(@NotNull(message = "主键不能为空")
|
||||
@PathVariable Long logId) {
|
||||
return R.ok(eqEquipmentLogService.queryById(logId));
|
||||
}
|
||||
|
||||
*//**
|
||||
* 新增设备状态日志
|
||||
*//*
|
||||
@SaCheckPermission("device:showEquipmentLog:add")
|
||||
@Log(title = "设备状态日志", businessType = BusinessType.INSERT)
|
||||
@RepeatSubmit()
|
||||
@PostMapping()
|
||||
public R<Void> add(@Validated(AddGroup.class) @RequestBody EqEquipmentLogBo bo) {
|
||||
return toAjax(eqEquipmentLogService.insertByBo(bo));
|
||||
}
|
||||
|
||||
*//**
|
||||
* 修改设备状态日志
|
||||
*//*
|
||||
@SaCheckPermission("device:showEquipmentLog:edit")
|
||||
@Log(title = "设备状态日志", businessType = BusinessType.UPDATE)
|
||||
@RepeatSubmit()
|
||||
@PutMapping()
|
||||
public R<Void> edit(@Validated(EditGroup.class) @RequestBody EqEquipmentLogBo bo) {
|
||||
return toAjax(eqEquipmentLogService.updateByBo(bo));
|
||||
}
|
||||
|
||||
*//**
|
||||
* 删除设备状态日志
|
||||
*
|
||||
* @param logIds 主键串
|
||||
*//*
|
||||
@SaCheckPermission("device:showEquipmentLog:remove")
|
||||
@Log(title = "设备状态日志", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{logIds}")
|
||||
public R<Void> remove(@NotEmpty(message = "主键不能为空")
|
||||
@PathVariable Long[] logIds) {
|
||||
return toAjax(eqEquipmentLogService.deleteWithValidByIds(List.of(logIds), true));
|
||||
}*/
|
||||
}
|
||||
@ -0,0 +1,58 @@
|
||||
package org.dromara.web.controller.show;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.dromara.common.core.domain.R;
|
||||
import org.dromara.common.core.exception.ServiceException;
|
||||
import org.dromara.web.domain.bo.EqAppHomeBo;
|
||||
import org.dromara.web.service.IEqEquipmentService;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.dromara.common.web.core.BaseController;
|
||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||
import org.dromara.web.domain.vo.EqUserEquipmentVo;
|
||||
import org.dromara.web.domain.bo.EqUserEquipmentBo;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 设备信息
|
||||
*
|
||||
* @author zzc
|
||||
* @date 2024-08-13
|
||||
*/
|
||||
@Validated
|
||||
@RequiredArgsConstructor
|
||||
@RestController
|
||||
@RequestMapping("/device/showUser")
|
||||
public class EqShowUserEquipmentController extends BaseController {
|
||||
|
||||
private final IEqEquipmentService eqEquipmentService;
|
||||
|
||||
/**
|
||||
* 查询设备信息列表
|
||||
*/
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo<EqUserEquipmentVo> list(EqUserEquipmentBo bo, PageQuery pageQuery) {
|
||||
IPage<EqUserEquipmentVo> page = eqEquipmentService.queryEqUserEquipment(bo, pageQuery);
|
||||
TableDataInfo<EqUserEquipmentVo> result = new TableDataInfo<>();
|
||||
result.setTotal(page.getTotal());
|
||||
result.setRows(page.getRecords());
|
||||
result.setCode(200);
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加设备
|
||||
* @param bo 传参用户id 分布id 设备编码
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/bindDevice")
|
||||
public R<Boolean> bindDevice(@RequestBody EqAppHomeBo bo){
|
||||
String equipmentCode = bo.getEquipmentCode();
|
||||
if (equipmentCode == null) throw new ServiceException("设备编码不能为空");
|
||||
if (bo.getUserId() == null) throw new ServiceException("用户ID不能为空");//分享用户要使用家庭主体的用户id
|
||||
return R.ok(eqEquipmentService.bindDevice(bo));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -92,5 +92,9 @@ public class EqEquipment extends BaseEntity {
|
||||
*/
|
||||
private Long operationCount;
|
||||
|
||||
/**
|
||||
* 排序
|
||||
*/
|
||||
private Integer orderNum;
|
||||
|
||||
}
|
||||
|
||||
@ -34,6 +34,16 @@ public class EqEquipmentLog extends BaseEntity {
|
||||
*/
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
* 用户名称
|
||||
*/
|
||||
private String userName;
|
||||
|
||||
/**
|
||||
* 用户昵称
|
||||
*/
|
||||
private String nickName;
|
||||
|
||||
/**
|
||||
* 设备ID
|
||||
*/
|
||||
|
||||
@ -0,0 +1,55 @@
|
||||
package org.dromara.web.domain;
|
||||
|
||||
import org.dromara.common.mybatis.core.domain.BaseEntity;
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 设备信息对象 eq_user_equipment
|
||||
*
|
||||
* @author zzc
|
||||
* @date 2024-08-13
|
||||
*/
|
||||
@Data
|
||||
public class EqUserEquipment implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 用户id
|
||||
*/
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
* 客户名称
|
||||
*/
|
||||
private String nickName;
|
||||
|
||||
/**
|
||||
* 绑定账号
|
||||
*/
|
||||
private String userName;
|
||||
|
||||
/**
|
||||
* 绑定设备(个)
|
||||
*/
|
||||
@TableId(value = "bind_num")
|
||||
private Integer bindNum;
|
||||
|
||||
/**
|
||||
* 在线设备(个)
|
||||
*/
|
||||
private Integer onlineNum;
|
||||
|
||||
/**
|
||||
* 离线设备(个)
|
||||
*/
|
||||
private Integer offlineNum;
|
||||
|
||||
|
||||
}
|
||||
@ -12,7 +12,7 @@ import org.dromara.common.mybatis.core.domain.BaseEntity;
|
||||
@Data
|
||||
public class EqAppHomeBo extends BaseEntity{
|
||||
/**
|
||||
* 选取用户ID(家庭主体ID)
|
||||
* 选取用户ID(家庭主体ID) 当前登录用户非家庭主体用户时,该字段必传
|
||||
*/
|
||||
private Long userId;
|
||||
/**
|
||||
@ -41,5 +41,10 @@ public class EqAppHomeBo extends BaseEntity{
|
||||
* 时区zoneId 用于日志 (传入字典eq_timezone_type 中的remark值 如:UTC+08:00)
|
||||
*/
|
||||
private String zoneId;
|
||||
|
||||
/**
|
||||
* 排序
|
||||
*/
|
||||
private Integer orderNum;
|
||||
}
|
||||
|
||||
|
||||
@ -1,5 +1,7 @@
|
||||
package org.dromara.web.domain.bo;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.dromara.web.domain.EqArea;
|
||||
import org.dromara.common.mybatis.core.domain.BaseEntity;
|
||||
import org.dromara.common.core.validate.AddGroup;
|
||||
@ -16,6 +18,8 @@ import jakarta.validation.constraints.*;
|
||||
* @date 2024-07-19
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@AutoMapper(target = EqArea.class, reverseConvertGenerate = false)
|
||||
public class EqAreaBo extends BaseEntity {
|
||||
@ -44,5 +48,7 @@ public class EqAreaBo extends BaseEntity {
|
||||
@NotBlank(message = "位置描述不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private String description;
|
||||
|
||||
|
||||
public EqAreaBo(Long userId) {
|
||||
this.userId = userId;
|
||||
}
|
||||
}
|
||||
|
||||
@ -29,13 +29,13 @@ public class EqDeviceSetBo implements Serializable {
|
||||
*/
|
||||
private String equipmentCode;
|
||||
/**
|
||||
* 1. 自动关门功能开关
|
||||
* 2. 自动关门功能开关
|
||||
* 3. 延时自动关门的延时时长 value
|
||||
* 4. 运行次数开关
|
||||
* 5. 运行次数开关
|
||||
* 6. 倒计时设置时间 value
|
||||
* 7. 提醒关门时间设置 value
|
||||
* 1.自动关门功能开关
|
||||
* 2.自动关门功能开关
|
||||
* 3.延时自动关门的延时时长 value
|
||||
* 4.运行次数开关
|
||||
* 5.运行次数开关
|
||||
* 6.倒计时设置时间 value
|
||||
* 7.提醒关门时间设置 value
|
||||
* 8.提醒关门功能开关
|
||||
* 9.提醒关门功能开关
|
||||
* 10.半开门高度设置 value
|
||||
@ -44,7 +44,6 @@ public class EqDeviceSetBo implements Serializable {
|
||||
* 13.遇阻回弹的阻力设置 value
|
||||
* 14.红外感应开关开启
|
||||
* 15.红外感应开关关闭
|
||||
*
|
||||
*/
|
||||
private int operateType;
|
||||
|
||||
|
||||
@ -1,5 +1,7 @@
|
||||
package org.dromara.web.domain.bo;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.dromara.web.domain.EqEquipment;
|
||||
import org.dromara.common.mybatis.core.domain.BaseEntity;
|
||||
import org.dromara.common.core.validate.AddGroup;
|
||||
@ -18,6 +20,8 @@ import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
* @date 2024-07-19
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@AutoMapper(target = EqEquipment.class, reverseConvertGenerate = false)
|
||||
public class EqEquipmentBo extends BaseEntity {
|
||||
@ -97,5 +101,14 @@ public class EqEquipmentBo extends BaseEntity {
|
||||
@NotNull(message = "操作次数不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private Long operationCount;
|
||||
|
||||
/**
|
||||
* 排序
|
||||
*/
|
||||
@NotNull(message = "排序", groups = { AddGroup.class, EditGroup.class })
|
||||
private Integer orderNum;
|
||||
|
||||
|
||||
public EqEquipmentBo(Long userId) {
|
||||
this.userId = userId;
|
||||
}
|
||||
}
|
||||
|
||||
@ -34,6 +34,16 @@ public class EqEquipmentLogBo extends BaseEntity {
|
||||
@NotNull(message = "用户id不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
* 用户名称
|
||||
*/
|
||||
private String userName;
|
||||
|
||||
/**
|
||||
* 用户昵称
|
||||
*/
|
||||
private String nickName;
|
||||
|
||||
/**
|
||||
* 设备ID
|
||||
*/
|
||||
@ -76,6 +86,11 @@ public class EqEquipmentLogBo extends BaseEntity {
|
||||
@NotNull(message = "状态不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private Integer status;
|
||||
|
||||
/**
|
||||
* 开合度状态 0% 10% 。。。 100%
|
||||
*/
|
||||
private Integer openStatus;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@ -1,5 +1,7 @@
|
||||
package org.dromara.web.domain.bo;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.dromara.web.domain.EqFamily;
|
||||
import org.dromara.common.mybatis.core.domain.BaseEntity;
|
||||
import org.dromara.common.core.validate.AddGroup;
|
||||
@ -16,6 +18,8 @@ import jakarta.validation.constraints.*;
|
||||
* @date 2024-07-19
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@AutoMapper(target = EqFamily.class, reverseConvertGenerate = false)
|
||||
public class EqFamilyBo extends BaseEntity {
|
||||
@ -38,5 +42,7 @@ public class EqFamilyBo extends BaseEntity {
|
||||
@NotBlank(message = "家庭名称不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private String familyName;
|
||||
|
||||
|
||||
public EqFamilyBo(Long userId) {
|
||||
this.userId = userId;
|
||||
}
|
||||
}
|
||||
|
||||
@ -29,13 +29,13 @@ public class EqShareBo extends BaseEntity {
|
||||
/**
|
||||
* 分享者ID
|
||||
*/
|
||||
@NotNull(message = "分享者ID不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
@NotNull(message = "分享者ID不能为空", groups = { EditGroup.class })
|
||||
private Long shareUserId;
|
||||
|
||||
/**
|
||||
* 分享者名称
|
||||
*/
|
||||
@NotBlank(message = "分享者名称不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
@NotBlank(message = "分享者名称不能为空", groups = { EditGroup.class })
|
||||
private String shareUserName;
|
||||
|
||||
/**
|
||||
|
||||
@ -41,7 +41,7 @@ public class EqUserConfigBo extends BaseEntity {
|
||||
/**
|
||||
* 时间格式
|
||||
*/
|
||||
@NotNull(message = "时间格式不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
// @NotNull(message = "时间格式不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private String timeFormat;
|
||||
|
||||
/**
|
||||
|
||||
@ -0,0 +1,23 @@
|
||||
package org.dromara.web.domain.bo;
|
||||
|
||||
import org.dromara.common.mybatis.core.domain.BaseEntity;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
/**
|
||||
* 设备信息业务对象 eq_user_equipment
|
||||
*
|
||||
* @author zzc
|
||||
* @date 2024-08-13
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class EqUserEquipmentBo extends BaseEntity {
|
||||
|
||||
/**
|
||||
* 客户名称
|
||||
*/
|
||||
private String nickName;
|
||||
|
||||
|
||||
}
|
||||
@ -42,6 +42,16 @@ public class EqEquipmentLogVo implements Serializable {
|
||||
@ExcelProperty(value = "用户id")
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
* 用户名称
|
||||
*/
|
||||
private String userName;
|
||||
|
||||
/**
|
||||
* 用户昵称
|
||||
*/
|
||||
private String nickName;
|
||||
|
||||
/**
|
||||
* 设备ID
|
||||
*/
|
||||
|
||||
@ -53,7 +53,7 @@ public class EqEquipmentVo implements Serializable {
|
||||
* 登录账号
|
||||
*/
|
||||
@ExcelProperty(value = "登录账号ID")
|
||||
private String userId;
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
* 登录账号
|
||||
@ -80,7 +80,7 @@ public class EqEquipmentVo implements Serializable {
|
||||
private String equipmentName;
|
||||
|
||||
/**
|
||||
* 设备状态
|
||||
* 开合度状态 0 10 20 30 40 50 60 70 80 90 100
|
||||
*/
|
||||
@ExcelProperty(value = "设备状态", converter = ExcelDictConvert.class)
|
||||
@ExcelDictFormat(dictType = "eq_status_type")
|
||||
@ -112,5 +112,11 @@ public class EqEquipmentVo implements Serializable {
|
||||
@ExcelProperty(value = "操作次数")
|
||||
private Long operationCount;
|
||||
|
||||
/**
|
||||
* 排序
|
||||
*/
|
||||
@ExcelProperty(value = "排序")
|
||||
private Integer orderNum;
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -0,0 +1,52 @@
|
||||
package org.dromara.web.domain.vo;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import io.github.linpeilie.annotations.AutoMapper;
|
||||
import lombok.Data;
|
||||
import org.dromara.web.domain.EqShare;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* 分享明细视图对象
|
||||
*
|
||||
* @author zzc
|
||||
* @date 2024-07-19
|
||||
*/
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
public class EqShareDetailVo extends EqShareVo {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 家庭名称
|
||||
*/
|
||||
private String familyName;
|
||||
|
||||
/**
|
||||
* 分布(区域)个数
|
||||
*/
|
||||
private int areaNum;
|
||||
|
||||
/**
|
||||
* 设备个数
|
||||
*/
|
||||
private int eqNum;
|
||||
|
||||
/**
|
||||
* 分布列表
|
||||
*/
|
||||
private List<EqAreaVo> eqAreaVos;
|
||||
|
||||
/**
|
||||
* 设备列表
|
||||
*/
|
||||
private List<EqEquipmentVo> eqEquipmentVos;
|
||||
|
||||
}
|
||||
@ -0,0 +1,63 @@
|
||||
package org.dromara.web.domain.vo;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 设备信息视图对象 eq_user_equipment
|
||||
*
|
||||
* @author zzc
|
||||
* @date 2024-08-13
|
||||
*/
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
public class EqUserEquipmentVo implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
|
||||
/**
|
||||
* 用户名称
|
||||
*/
|
||||
@ExcelProperty(value = "用户名称")
|
||||
private String userId;
|
||||
|
||||
/**
|
||||
* 客户名称
|
||||
*/
|
||||
@ExcelProperty(value = "客户名称")
|
||||
private String nickName;
|
||||
|
||||
/**
|
||||
* 绑定账号
|
||||
*/
|
||||
@ExcelProperty(value = "绑定账号")
|
||||
private String userName;
|
||||
|
||||
/**
|
||||
* 绑定设备(个)
|
||||
*/
|
||||
@ExcelProperty(value = "绑定设备(个)")
|
||||
private Integer bindNum;
|
||||
|
||||
/**
|
||||
* 在线设备(个)
|
||||
*/
|
||||
@ExcelProperty(value = "在线设备(个)")
|
||||
private Integer onlineNum;
|
||||
|
||||
/**
|
||||
* 离线设备(个)
|
||||
*/
|
||||
@ExcelProperty(value = "离线设备(个)")
|
||||
private Integer offlineNum;
|
||||
|
||||
|
||||
}
|
||||
@ -1,8 +1,13 @@
|
||||
package org.dromara.web.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import org.dromara.web.domain.EqEquipment;
|
||||
import org.dromara.web.domain.vo.EqEquipmentVo;
|
||||
import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
|
||||
import org.dromara.web.domain.vo.EqUserEquipmentVo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 设备信息Mapper接口
|
||||
@ -12,4 +17,5 @@ import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
|
||||
*/
|
||||
public interface EqEquipmentMapper extends BaseMapperPlus<EqEquipment, EqEquipmentVo> {
|
||||
|
||||
IPage<EqUserEquipmentVo> selectEquipmentVoPage(Page<EqEquipment> page, String nickName);
|
||||
}
|
||||
|
||||
@ -1,14 +1,13 @@
|
||||
package org.dromara.web.service;
|
||||
|
||||
import org.dromara.web.domain.bo.EqAppHomeBo;
|
||||
import org.dromara.web.domain.bo.EqDeviceCmdBo;
|
||||
import org.dromara.web.domain.bo.EqDeviceSetBo;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import org.dromara.web.domain.bo.*;
|
||||
import org.dromara.web.domain.vo.EqEquipmentDetailVo;
|
||||
import org.dromara.web.domain.vo.EqEquipmentStatusVo;
|
||||
import org.dromara.web.domain.vo.EqEquipmentVo;
|
||||
import org.dromara.web.domain.bo.EqEquipmentBo;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||
import org.dromara.web.domain.vo.EqUserEquipmentVo;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
@ -82,5 +81,19 @@ public interface IEqEquipmentService {
|
||||
*/
|
||||
EqEquipmentDetailVo getDeviceMsg(EqAppHomeBo bo);
|
||||
|
||||
/**
|
||||
* 绑定设备
|
||||
* @param bo
|
||||
* @return
|
||||
*/
|
||||
Boolean bindDevice(EqAppHomeBo bo);
|
||||
|
||||
/**
|
||||
* 批量更新
|
||||
* @param bos
|
||||
* @return
|
||||
*/
|
||||
boolean updateByBos(List<EqAppHomeBo> bos);
|
||||
|
||||
IPage<EqUserEquipmentVo> queryEqUserEquipment(EqUserEquipmentBo bo, PageQuery pageQuery);
|
||||
}
|
||||
|
||||
@ -65,4 +65,11 @@ public interface IEqShareService {
|
||||
* @return 是否删除成功
|
||||
*/
|
||||
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
|
||||
|
||||
/**
|
||||
* 删除家庭成员
|
||||
* @param sharedId
|
||||
* @return
|
||||
*/
|
||||
Boolean deleteByShareId(String sharedId);
|
||||
}
|
||||
|
||||
@ -81,8 +81,10 @@ public class EqEquipmentLogServiceImpl implements IEqEquipmentLogService {
|
||||
lqw.eq(bo.getCreatedYearDay() != null, EqEquipmentLog::getCreatedYearDay, bo.getCreatedYearDay());
|
||||
lqw.eq(bo.getCreatedHourSecond() != null, EqEquipmentLog::getCreatedHourSecond, bo.getCreatedHourSecond());
|
||||
lqw.eq(bo.getDayOfWeek() != null, EqEquipmentLog::getDayOfWeek, bo.getDayOfWeek());
|
||||
lqw.between(params.get("beginTime") != null && params.get("endTime") != null,
|
||||
EqEquipmentLog::getCreateTime, params.get("beginTime"), params.get("endTime"));
|
||||
// lqw.between(params.get("beginTime") != null && params.get("endTime") != null,
|
||||
// EqEquipmentLog::getCreateTime, params.get("beginTime"), params.get("endTime"));
|
||||
lqw.between(params.get("beginCreateTime") != null && params.get("endCreateTime") != null,
|
||||
EqEquipmentLog::getCreateTime ,params.get("beginCreateTime"), params.get("endCreateTime"));
|
||||
lqw.orderByDesc(EqEquipmentLog::getCreateTime);
|
||||
return lqw;
|
||||
}
|
||||
|
||||
@ -1,5 +1,7 @@
|
||||
package org.dromara.web.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import org.dromara.common.core.utils.MapstructUtils;
|
||||
import org.dromara.common.core.utils.MessageUtils;
|
||||
import org.dromara.common.core.utils.StringUtils;
|
||||
@ -15,22 +17,17 @@ import org.dromara.web.device.*;
|
||||
import org.dromara.web.device.iot.DeviceDto;
|
||||
import org.dromara.web.device.iot.DeviceMsgDto;
|
||||
import org.dromara.web.device.iot.DeviceServerMsgDto;
|
||||
import org.dromara.web.domain.bo.EqAppHomeBo;
|
||||
import org.dromara.web.domain.bo.EqDeviceCmdBo;
|
||||
import org.dromara.web.domain.bo.EqDeviceSetBo;
|
||||
import org.dromara.web.domain.bo.*;
|
||||
import org.dromara.web.domain.vo.EqEquipmentDetailVo;
|
||||
import org.dromara.web.domain.vo.EqUserEquipmentVo;
|
||||
import org.dromara.web.service.IotService;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.dromara.web.domain.bo.EqEquipmentBo;
|
||||
import org.dromara.web.domain.vo.EqEquipmentVo;
|
||||
import org.dromara.web.domain.EqEquipment;
|
||||
import org.dromara.web.mapper.EqEquipmentMapper;
|
||||
import org.dromara.web.service.IEqEquipmentService;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Collection;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* 设备信息Service业务层处理
|
||||
@ -89,6 +86,7 @@ public class EqEquipmentServiceImpl implements IEqEquipmentService {
|
||||
Map<String, Object> params = bo.getParams();
|
||||
LambdaQueryWrapper<EqEquipment> lqw = Wrappers.lambdaQuery();
|
||||
lqw.eq(bo.getAreaId() != null, EqEquipment::getAreaId, bo.getAreaId());
|
||||
lqw.eq(bo.getUserId() != null, EqEquipment::getUserId, bo.getUserId());
|
||||
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());
|
||||
@ -97,6 +95,7 @@ public class EqEquipmentServiceImpl implements IEqEquipmentService {
|
||||
lqw.eq(bo.getStatus() != null, EqEquipment::getStatus, bo.getStatus());
|
||||
lqw.eq(bo.getFaultStatus() != null, EqEquipment::getFaultStatus, bo.getFaultStatus());
|
||||
lqw.eq(bo.getLineStatus() != null, EqEquipment::getLineStatus, bo.getLineStatus());
|
||||
lqw.orderBy(true, true,EqEquipment::getOrderNum);
|
||||
return lqw;
|
||||
}
|
||||
|
||||
@ -269,6 +268,24 @@ public class EqEquipmentServiceImpl implements IEqEquipmentService {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean updateByBos(List<EqAppHomeBo> bos) {
|
||||
List<EqEquipment> eqEquipments = new ArrayList<>();
|
||||
for (EqAppHomeBo bo : bos) {
|
||||
EqEquipment eqEquipment = new EqEquipment();
|
||||
eqEquipment.setEquipmentId(bo.getEquipmentId());
|
||||
eqEquipment.setOrderNum(bo.getOrderNum());
|
||||
eqEquipments.add(eqEquipment);
|
||||
}
|
||||
return baseMapper.updateBatchById(eqEquipments);
|
||||
}
|
||||
@Override
|
||||
public IPage<EqUserEquipmentVo> queryEqUserEquipment(EqUserEquipmentBo bo, PageQuery pageQuery) {
|
||||
Page<EqEquipment> page = new Page<>(pageQuery.getPageNum(), pageQuery.getPageSize());
|
||||
// 调用Mapper中的新方法
|
||||
IPage<EqUserEquipmentVo> voPage = baseMapper.selectEquipmentVoPage(page, bo.getNickName());
|
||||
return voPage;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -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.common.satoken.utils.LoginHelper;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.dromara.web.domain.bo.EqShareBo;
|
||||
import org.dromara.web.domain.vo.EqShareVo;
|
||||
@ -129,4 +130,13 @@ public class EqShareServiceImpl implements IEqShareService {
|
||||
}
|
||||
return baseMapper.deleteByIds(ids) > 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean deleteByShareId(String sharedId) {
|
||||
Long userId = LoginHelper.getUserId();
|
||||
LambdaQueryWrapper<EqShare> query = Wrappers.lambdaQuery();
|
||||
query.eq(EqShare::getShareUserId, userId).eq(EqShare::getSharedUserId, sharedId);
|
||||
int delete = baseMapper.delete(query);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
266
ruoyi-admin/src/main/resources/application-local.yml
Normal file
266
ruoyi-admin/src/main/resources/application-local.yml
Normal file
@ -0,0 +1,266 @@
|
||||
--- # 监控中心配置
|
||||
spring.boot.admin.client:
|
||||
# 增加客户端开关
|
||||
enabled: true
|
||||
url: http://localhost:9090/admin
|
||||
instance:
|
||||
service-host-type: IP
|
||||
username: ruoyi
|
||||
password: 123456
|
||||
|
||||
--- # snail-job 配置
|
||||
snail-job:
|
||||
enabled: false
|
||||
# 需要在 SnailJob 后台组管理创建对应名称的组,然后创建任务的时候选择对应的组,才能正确分派任务
|
||||
group: "ruoyi_group"
|
||||
# SnailJob 接入验证令牌 详见 script/sql/snail_job.sql `sj_group_config` 表
|
||||
token: "SJ_cKqBTPzCsWA3VyuCfFoccmuIEGXjr5KT"
|
||||
server:
|
||||
host: 127.0.0.1
|
||||
port: 17888
|
||||
# 详见 script/sql/snail_job.sql `sj_namespace` 表
|
||||
namespace: ${spring.profiles.active}
|
||||
# 随主应用端口飘逸
|
||||
port: 2${server.port}
|
||||
|
||||
--- # 数据源配置
|
||||
spring:
|
||||
datasource:
|
||||
type: com.zaxxer.hikari.HikariDataSource
|
||||
# 动态数据源文档 https://www.kancloud.cn/tracy5546/dynamic-datasource/content
|
||||
dynamic:
|
||||
# 性能分析插件(有性能损耗 不建议生产环境使用)
|
||||
p6spy: true
|
||||
# 设置默认的数据源或者数据源组,默认值即为 master
|
||||
primary: master
|
||||
# 严格模式 匹配不到数据源则报错
|
||||
strict: true
|
||||
datasource:
|
||||
# 主库数据源
|
||||
master:
|
||||
type: ${spring.datasource.type}
|
||||
driverClassName: com.mysql.cj.jdbc.Driver
|
||||
# jdbc 所有参数配置参考 https://lionli.blog.csdn.net/article/details/122018562
|
||||
# rewriteBatchedStatements=true 批处理优化 大幅提升批量插入更新删除性能(对数据库有性能损耗 使用批量操作应考虑性能问题)
|
||||
url: jdbc:mysql://124.223.36.143:3306/ry-vue-plus?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true
|
||||
username: root
|
||||
password: 8hifXZpjLdhmD1wq6wsi
|
||||
# 从库数据源
|
||||
slave:
|
||||
lazy: true
|
||||
type: ${spring.datasource.type}
|
||||
driverClassName: com.mysql.cj.jdbc.Driver
|
||||
url: jdbc:mysql://localhost:3306/ry-vue?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true
|
||||
username:
|
||||
password:
|
||||
# oracle:
|
||||
# type: ${spring.datasource.type}
|
||||
# driverClassName: oracle.jdbc.OracleDriver
|
||||
# url: jdbc:oracle:thin:@//localhost:1521/XE
|
||||
# username: ROOT
|
||||
# password: root
|
||||
# postgres:
|
||||
# type: ${spring.datasource.type}
|
||||
# driverClassName: org.postgresql.Driver
|
||||
# url: jdbc:postgresql://localhost:5432/postgres?useUnicode=true&characterEncoding=utf8&useSSL=true&autoReconnect=true&reWriteBatchedInserts=true
|
||||
# username: root
|
||||
# password: root
|
||||
# sqlserver:
|
||||
# type: ${spring.datasource.type}
|
||||
# driverClassName: com.microsoft.sqlserver.jdbc.SQLServerDriver
|
||||
# url: jdbc:sqlserver://localhost:1433;DatabaseName=tempdb;SelectMethod=cursor;encrypt=false;rewriteBatchedStatements=true
|
||||
# username: SA
|
||||
# password: root
|
||||
hikari:
|
||||
# 最大连接池数量
|
||||
maxPoolSize: 20
|
||||
# 最小空闲线程数量
|
||||
minIdle: 10
|
||||
# 配置获取连接等待超时的时间
|
||||
connectionTimeout: 30000
|
||||
# 校验超时时间
|
||||
validationTimeout: 5000
|
||||
# 空闲连接存活最大时间,默认10分钟
|
||||
idleTimeout: 600000
|
||||
# 此属性控制池中连接的最长生命周期,值0表示无限生命周期,默认30分钟
|
||||
maxLifetime: 1800000
|
||||
# 多久检查一次连接的活性
|
||||
keepaliveTime: 30000
|
||||
|
||||
--- # redis 单机配置(单机与集群只能开启一个另一个需要注释掉)
|
||||
spring.data:
|
||||
redis:
|
||||
# 地址
|
||||
host: localhost
|
||||
# 端口,默认为6379
|
||||
port: 6379
|
||||
# 数据库索引
|
||||
database: 0
|
||||
# redis 密码必须配置
|
||||
# password: ruoyi123
|
||||
# 连接超时时间
|
||||
timeout: 10s
|
||||
# 是否开启ssl
|
||||
ssl.enabled: false
|
||||
|
||||
# redisson 配置
|
||||
redisson:
|
||||
# redis key前缀
|
||||
keyPrefix:
|
||||
# 线程池数量
|
||||
threads: 4
|
||||
# Netty线程池数量
|
||||
nettyThreads: 8
|
||||
# 单节点配置
|
||||
singleServerConfig:
|
||||
# 客户端名称
|
||||
clientName: ${ruoyi.name}
|
||||
# 最小空闲连接数
|
||||
connectionMinimumIdleSize: 8
|
||||
# 连接池大小
|
||||
connectionPoolSize: 32
|
||||
# 连接空闲超时,单位:毫秒
|
||||
idleConnectionTimeout: 10000
|
||||
# 命令等待超时,单位:毫秒
|
||||
timeout: 3000
|
||||
# 发布和订阅连接池大小
|
||||
subscriptionConnectionPoolSize: 50
|
||||
|
||||
--- # mail 邮件发送
|
||||
mail:
|
||||
enabled: false
|
||||
host: smtp.163.com
|
||||
port: 465
|
||||
# 是否需要用户名密码验证
|
||||
auth: true
|
||||
# 发送方,遵循RFC-822标准
|
||||
from: xxx@163.com
|
||||
# 用户名(注意:如果使用foxmail邮箱,此处user为qq号)
|
||||
user: xxx@163.com
|
||||
# 密码(注意,某些邮箱需要为SMTP服务单独设置密码,详情查看相关帮助)
|
||||
pass: xxxxxxxxxx
|
||||
# 使用 STARTTLS安全连接,STARTTLS是对纯文本通信协议的扩展。
|
||||
starttlsEnable: true
|
||||
# 使用SSL安全连接
|
||||
sslEnable: true
|
||||
# SMTP超时时长,单位毫秒,缺省值不超时
|
||||
timeout: 0
|
||||
# Socket连接超时值,单位毫秒,缺省值不超时
|
||||
connectionTimeout: 0
|
||||
|
||||
--- # sms 短信 支持 阿里云 腾讯云 云片 等等各式各样的短信服务商
|
||||
# https://sms4j.com/doc3/ 差异配置文档地址 支持单厂商多配置,可以配置多个同时使用
|
||||
sms:
|
||||
# 配置源类型用于标定配置来源(interface,yaml)
|
||||
config-type: yaml
|
||||
# 用于标定yml中的配置是否开启短信拦截,接口配置不受此限制
|
||||
restricted: true
|
||||
# 短信拦截限制单手机号每分钟最大发送,只对开启了拦截的配置有效
|
||||
minute-max: 1
|
||||
# 短信拦截限制单手机号每日最大发送量,只对开启了拦截的配置有效
|
||||
account-max: 30
|
||||
# 以下配置来自于 org.dromara.sms4j.provider.config.BaseConfig类中
|
||||
blends:
|
||||
# 唯一ID 用于发送短信寻找具体配置 随便定义别用中文即可
|
||||
# 可以同时存在两个相同厂商 例如: ali1 ali2 两个不同的阿里短信账号 也可用于区分租户
|
||||
config1:
|
||||
# 框架定义的厂商名称标识,标定此配置是哪个厂商,详细请看厂商标识介绍部分
|
||||
supplier: alibaba
|
||||
# 有些称为accessKey有些称之为apiKey,也有称为sdkKey或者appId。
|
||||
access-key-id: 您的accessKey
|
||||
# 称为accessSecret有些称之为apiSecret
|
||||
access-key-secret: 您的accessKeySecret
|
||||
signature: 您的短信签名
|
||||
sdk-app-id: 您的sdkAppId
|
||||
config2:
|
||||
# 厂商标识,标定此配置是哪个厂商,详细请看厂商标识介绍部分
|
||||
supplier: tencent
|
||||
access-key-id: 您的accessKey
|
||||
access-key-secret: 您的accessKeySecret
|
||||
signature: 您的短信签名
|
||||
sdk-app-id: 您的sdkAppId
|
||||
|
||||
|
||||
--- # 三方授权
|
||||
justauth:
|
||||
# 前端外网访问地址
|
||||
address: http://localhost:80
|
||||
type:
|
||||
maxkey:
|
||||
# maxkey 服务器地址
|
||||
# 注意 如下均配置均不需要修改 maxkey 已经内置好了数据
|
||||
server-url: http://sso.maxkey.top
|
||||
client-id: 876892492581044224
|
||||
client-secret: x1Y5MTMwNzIwMjMxNTM4NDc3Mzche8
|
||||
redirect-uri: ${justauth.address}/social-callback?source=maxkey
|
||||
topiam:
|
||||
# topiam 服务器地址
|
||||
server-url: http://127.0.0.1:1989/api/v1/authorize/y0q************spq***********8ol
|
||||
client-id: 449c4*********937************759
|
||||
client-secret: ac7***********1e0************28d
|
||||
redirect-uri: ${justauth.address}/social-callback?source=topiam
|
||||
scopes: [openid, email, phone, profile]
|
||||
qq:
|
||||
client-id: 10**********6
|
||||
client-secret: 1f7d08**********5b7**********29e
|
||||
redirect-uri: ${justauth.address}/social-callback?source=qq
|
||||
union-id: false
|
||||
weibo:
|
||||
client-id: 10**********6
|
||||
client-secret: 1f7d08**********5b7**********29e
|
||||
redirect-uri: ${justauth.address}/social-callback?source=weibo
|
||||
gitee:
|
||||
client-id: 91436b7940090d09c72c7daf85b959cfd5f215d67eea73acbf61b6b590751a98
|
||||
client-secret: 02c6fcfd70342980cd8dd2f2c06c1a350645d76c754d7a264c4e125f9ba915ac
|
||||
redirect-uri: ${justauth.address}/social-callback?source=gitee
|
||||
dingtalk:
|
||||
client-id: 10**********6
|
||||
client-secret: 1f7d08**********5b7**********29e
|
||||
redirect-uri: ${justauth.address}/social-callback?source=dingtalk
|
||||
baidu:
|
||||
client-id: 10**********6
|
||||
client-secret: 1f7d08**********5b7**********29e
|
||||
redirect-uri: ${justauth.address}/social-callback?source=baidu
|
||||
csdn:
|
||||
client-id: 10**********6
|
||||
client-secret: 1f7d08**********5b7**********29e
|
||||
redirect-uri: ${justauth.address}/social-callback?source=csdn
|
||||
coding:
|
||||
client-id: 10**********6
|
||||
client-secret: 1f7d08**********5b7**********29e
|
||||
redirect-uri: ${justauth.address}/social-callback?source=coding
|
||||
coding-group-name: xx
|
||||
oschina:
|
||||
client-id: 10**********6
|
||||
client-secret: 1f7d08**********5b7**********29e
|
||||
redirect-uri: ${justauth.address}/social-callback?source=oschina
|
||||
alipay_wallet:
|
||||
client-id: 10**********6
|
||||
client-secret: 1f7d08**********5b7**********29e
|
||||
redirect-uri: ${justauth.address}/social-callback?source=alipay_wallet
|
||||
alipay-public-key: MIIB**************DAQAB
|
||||
wechat_open:
|
||||
client-id: 10**********6
|
||||
client-secret: 1f7d08**********5b7**********29e
|
||||
redirect-uri: ${justauth.address}/social-callback?source=wechat_open
|
||||
wechat_mp:
|
||||
client-id: 10**********6
|
||||
client-secret: 1f7d08**********5b7**********29e
|
||||
redirect-uri: ${justauth.address}/social-callback?source=wechat_mp
|
||||
wechat_enterprise:
|
||||
client-id: 10**********6
|
||||
client-secret: 1f7d08**********5b7**********29e
|
||||
redirect-uri: ${justauth.address}/social-callback?source=wechat_enterprise
|
||||
agent-id: 1000002
|
||||
gitlab:
|
||||
client-id: 10**********6
|
||||
client-secret: 1f7d08**********5b7**********29e
|
||||
redirect-uri: ${justauth.address}/social-callback?source=gitlab
|
||||
|
||||
iot:
|
||||
baseurl: http://118.89.86.111:8080
|
||||
url:
|
||||
scopeAttribute: /api/plugins/telemetry/{entityType}/{entityId}/values/attributes/{scope}
|
||||
telemetry: /api/plugins/telemetry/{entityType}/{entityId}/values/timeseries
|
||||
operate: /api/plugins/rpc/oneway/{deviceId}
|
||||
device: /api/device/{deviceId}
|
||||
@ -4,4 +4,22 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="org.dromara.web.mapper.EqEquipmentMapper">
|
||||
|
||||
|
||||
<select id="selectEquipmentVoPage" resultType="org.dromara.web.domain.vo.EqUserEquipmentVo">
|
||||
SELECT
|
||||
user_id,
|
||||
nick_name,
|
||||
user_name,
|
||||
COUNT(*) AS bind_num,
|
||||
SUM(line_status = 1) AS online_num,
|
||||
SUM(line_status = 0) AS offline_num
|
||||
FROM eq_equipment
|
||||
<where>
|
||||
<if test="nickName != null and nickName != ''">
|
||||
AND nick_name like
|
||||
CONCAT('%', #{nickName}, '%')
|
||||
</if>
|
||||
</where>
|
||||
GROUP BY user_name, nick_name
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user