forked from dyf/fys-Multi-tenant
Merge remote-tracking branch 'upstream/main'
# Conflicts: # fys-common/fys-common-core/src/main/java/com/fuyuanshen/common/core/constant/GlobalConstants.java
This commit is contained in:
@ -0,0 +1,105 @@
|
||||
//package com.fuyuanshen.app.controller;
|
||||
//
|
||||
//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 com.fuyuanshen.common.idempotent.annotation.RepeatSubmit;
|
||||
//import com.fuyuanshen.common.log.annotation.Log;
|
||||
//import com.fuyuanshen.common.web.core.BaseController;
|
||||
//import com.fuyuanshen.common.mybatis.core.page.PageQuery;
|
||||
//import com.fuyuanshen.common.core.domain.R;
|
||||
//import com.fuyuanshen.common.core.validate.AddGroup;
|
||||
//import com.fuyuanshen.common.core.validate.EditGroup;
|
||||
//import com.fuyuanshen.common.log.enums.BusinessType;
|
||||
//import com.fuyuanshen.common.excel.utils.ExcelUtil;
|
||||
//import com.fuyuanshen.app.domain.vo.AppDeviceShareVo;
|
||||
//import com.fuyuanshen.app.domain.bo.AppDeviceShareBo;
|
||||
//import com.fuyuanshen.app.service.IAppDeviceShareService;
|
||||
//import com.fuyuanshen.common.mybatis.core.page.TableDataInfo;
|
||||
//
|
||||
///**
|
||||
// * 设备分享
|
||||
// *
|
||||
// * @author Lion Li
|
||||
// * @date 2025-07-16
|
||||
// */
|
||||
//@Validated
|
||||
//@RequiredArgsConstructor
|
||||
//@RestController
|
||||
//@RequestMapping("/app/deviceShare")
|
||||
//public class AppDeviceShareController extends BaseController {
|
||||
//
|
||||
// private final IAppDeviceShareService appDeviceShareService;
|
||||
//
|
||||
// /**
|
||||
// * 查询设备分享列表
|
||||
// */
|
||||
// @SaCheckPermission("app:deviceShare:list")
|
||||
// @GetMapping("/list")
|
||||
// public TableDataInfo<AppDeviceShareVo> list(AppDeviceShareBo bo, PageQuery pageQuery) {
|
||||
// return appDeviceShareService.queryPageList(bo, pageQuery);
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 导出设备分享列表
|
||||
// */
|
||||
// @SaCheckPermission("app:deviceShare:export")
|
||||
// @Log(title = "设备分享", businessType = BusinessType.EXPORT)
|
||||
// @PostMapping("/export")
|
||||
// public void export(AppDeviceShareBo bo, HttpServletResponse response) {
|
||||
// List<AppDeviceShareVo> list = appDeviceShareService.queryList(bo);
|
||||
// ExcelUtil.exportExcel(list, "设备分享", AppDeviceShareVo.class, response);
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 获取设备分享详细信息
|
||||
// *
|
||||
// * @param id 主键
|
||||
// */
|
||||
// @SaCheckPermission("app:deviceShare:query")
|
||||
// @GetMapping("/{id}")
|
||||
// public R<AppDeviceShareVo> getInfo(@NotNull(message = "主键不能为空")
|
||||
// @PathVariable Long id) {
|
||||
// return R.ok(appDeviceShareService.queryById(id));
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 新增设备分享
|
||||
// */
|
||||
// @SaCheckPermission("app:deviceShare:add")
|
||||
// @Log(title = "设备分享", businessType = BusinessType.INSERT)
|
||||
// @RepeatSubmit()
|
||||
// @PostMapping()
|
||||
// public R<Void> add(@Validated(AddGroup.class) @RequestBody AppDeviceShareBo bo) {
|
||||
// return toAjax(appDeviceShareService.insertByBo(bo));
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 修改设备分享
|
||||
// */
|
||||
// @SaCheckPermission("app:deviceShare:edit")
|
||||
// @Log(title = "设备分享", businessType = BusinessType.UPDATE)
|
||||
// @RepeatSubmit()
|
||||
// @PutMapping()
|
||||
// public R<Void> edit(@Validated(EditGroup.class) @RequestBody AppDeviceShareBo bo) {
|
||||
// return toAjax(appDeviceShareService.updateByBo(bo));
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 删除设备分享
|
||||
// *
|
||||
// * @param ids 主键串
|
||||
// */
|
||||
// @SaCheckPermission("app:deviceShare:remove")
|
||||
// @Log(title = "设备分享", businessType = BusinessType.DELETE)
|
||||
// @DeleteMapping("/{ids}")
|
||||
// public R<Void> remove(@NotEmpty(message = "主键不能为空")
|
||||
// @PathVariable Long[] ids) {
|
||||
// return toAjax(appDeviceShareService.deleteWithValidByIds(List.of(ids), true));
|
||||
// }
|
||||
//}
|
@ -3,7 +3,6 @@ package com.fuyuanshen.app.controller.equipment;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.fuyuanshen.app.domain.APPDevice;
|
||||
import com.fuyuanshen.app.domain.APPDeviceType;
|
||||
import com.fuyuanshen.app.domain.dto.APPUnbindDTO;
|
||||
import com.fuyuanshen.app.domain.query.APPDeviceQueryCriteria;
|
||||
import com.fuyuanshen.app.service.equipment.APPDeviceService;
|
||||
import com.fuyuanshen.common.core.domain.R;
|
||||
|
@ -0,0 +1,51 @@
|
||||
package com.fuyuanshen.app.domain;
|
||||
|
||||
import com.fuyuanshen.common.tenant.core.TenantEntity;
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.io.Serial;
|
||||
|
||||
/**
|
||||
* 设备分享对象 app_device_share
|
||||
*
|
||||
* @author Lion Li
|
||||
* @date 2025-07-16
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@TableName("app_device_share")
|
||||
public class AppDeviceShare extends TenantEntity {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 主键id
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 设备ID
|
||||
*/
|
||||
private Long deviceId;
|
||||
|
||||
/**
|
||||
* 手机号
|
||||
*/
|
||||
private String phonenumber;
|
||||
|
||||
/**
|
||||
* 功能权限(1:灯光模式;2:激光模式;3:开机画面;4:人员信息登记;5:发送信息;6:产品信息)
|
||||
以逗号分隔
|
||||
*/
|
||||
private String permission;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
|
||||
}
|
@ -36,11 +36,6 @@ public class AppPersonnelInfo extends TenantEntity {
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 部门名称
|
||||
*/
|
||||
private String deptName;
|
||||
|
||||
/**
|
||||
* 单位名称
|
||||
*/
|
||||
|
@ -0,0 +1,49 @@
|
||||
package com.fuyuanshen.app.domain.bo;
|
||||
|
||||
import com.fuyuanshen.app.domain.AppDeviceShare;
|
||||
import com.fuyuanshen.common.mybatis.core.domain.BaseEntity;
|
||||
import io.github.linpeilie.annotations.AutoMapper;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import jakarta.validation.constraints.*;
|
||||
|
||||
/**
|
||||
* 设备分享业务对象 app_device_share
|
||||
*
|
||||
* @author Lion Li
|
||||
* @date 2025-07-16
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@AutoMapper(target = AppDeviceShare.class, reverseConvertGenerate = false)
|
||||
public class AppDeviceShareBo extends BaseEntity {
|
||||
|
||||
/**
|
||||
* 主键id
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 设备ID
|
||||
*/
|
||||
private Long deviceId;
|
||||
|
||||
/**
|
||||
* 手机号
|
||||
*/
|
||||
private String phonenumber;
|
||||
|
||||
/**
|
||||
* 功能权限(1:灯光模式;2:激光模式;3:开机画面;4:人员信息登记;5:发送信息;6:产品信息)
|
||||
以逗号分隔
|
||||
*/
|
||||
private String permission;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
|
||||
private String smsCode;
|
||||
}
|
@ -0,0 +1,72 @@
|
||||
package com.fuyuanshen.app.domain.vo;
|
||||
|
||||
import cn.idev.excel.annotation.ExcelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serial;
|
||||
|
||||
@Data
|
||||
public class AppDeviceDetailVo {
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 设备ID
|
||||
*/
|
||||
@ExcelProperty(value = "设备ID")
|
||||
private Long deviceId;
|
||||
|
||||
/**
|
||||
* 手机号
|
||||
*/
|
||||
@ExcelProperty(value = "手机号")
|
||||
private String phonenumber;
|
||||
|
||||
/**
|
||||
* 设备名称
|
||||
*/
|
||||
private String deviceName;
|
||||
|
||||
/**
|
||||
* 设备IMEI
|
||||
*/
|
||||
private String deviceImei;
|
||||
|
||||
/**
|
||||
* 设备MAC
|
||||
*/
|
||||
private String deviceMac;
|
||||
|
||||
/**
|
||||
* 通讯方式 0:4G;1:蓝牙
|
||||
*/
|
||||
private Integer communicationMode;
|
||||
|
||||
/**
|
||||
* 设备图片
|
||||
*/
|
||||
private String devicePic;
|
||||
|
||||
/**
|
||||
* 设备类型
|
||||
*/
|
||||
private String typeName;
|
||||
|
||||
/**
|
||||
* 蓝牙名称
|
||||
*/
|
||||
private String bluetoothName;
|
||||
|
||||
/**
|
||||
* 设备状态
|
||||
* 0 失效
|
||||
* 1 正常
|
||||
*/
|
||||
private Integer deviceStatus;
|
||||
|
||||
|
||||
/**
|
||||
* 人员信息
|
||||
*/
|
||||
private AppPersonnelInfoVo personnelInfo;
|
||||
}
|
@ -0,0 +1,107 @@
|
||||
package com.fuyuanshen.app.domain.vo;
|
||||
|
||||
import cn.idev.excel.annotation.ExcelIgnoreUnannotated;
|
||||
import cn.idev.excel.annotation.ExcelProperty;
|
||||
import com.fuyuanshen.app.domain.AppDeviceShare;
|
||||
import com.fuyuanshen.common.excel.annotation.ExcelDictFormat;
|
||||
import com.fuyuanshen.common.excel.convert.ExcelDictConvert;
|
||||
import io.github.linpeilie.annotations.AutoMapper;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
|
||||
|
||||
/**
|
||||
* 设备分享视图对象 app_device_share
|
||||
*
|
||||
* @author Lion Li
|
||||
* @date 2025-07-16
|
||||
*/
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
@AutoMapper(target = AppDeviceShare.class)
|
||||
public class AppDeviceShareDetailVo implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 主键id
|
||||
*/
|
||||
@ExcelProperty(value = "主键id")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 设备ID
|
||||
*/
|
||||
@ExcelProperty(value = "设备ID")
|
||||
private Long deviceId;
|
||||
|
||||
/**
|
||||
* 手机号
|
||||
*/
|
||||
@ExcelProperty(value = "手机号")
|
||||
private String phonenumber;
|
||||
|
||||
/**
|
||||
* 功能权限(1:灯光模式;2:激光模式;3:开机画面;4:人员信息登记;5:发送信息;6:产品信息)
|
||||
以逗号分隔
|
||||
*/
|
||||
@ExcelProperty(value = "功能权限", converter = ExcelDictConvert.class)
|
||||
@ExcelDictFormat(readConverterExp = "1=:灯光模式;2:激光模式;3:开机画面;4:人员信息登记;5:发送信息;6:产品信息")
|
||||
private String permission;
|
||||
|
||||
/**
|
||||
* 设备名称
|
||||
*/
|
||||
private String deviceName;
|
||||
|
||||
/**
|
||||
* 设备IMEI
|
||||
*/
|
||||
private String deviceImei;
|
||||
|
||||
/**
|
||||
* 设备MAC
|
||||
*/
|
||||
private String deviceMac;
|
||||
|
||||
/**
|
||||
* 通讯方式 0:4G;1:蓝牙
|
||||
*/
|
||||
private Integer communicationMode;
|
||||
|
||||
/**
|
||||
* 设备图片
|
||||
*/
|
||||
private String devicePic;
|
||||
|
||||
/**
|
||||
* 设备类型
|
||||
*/
|
||||
private String typeName;
|
||||
|
||||
/**
|
||||
* 蓝牙名称
|
||||
*/
|
||||
private String bluetoothName;
|
||||
|
||||
/**
|
||||
* 设备状态
|
||||
* 0 失效
|
||||
* 1 正常
|
||||
*/
|
||||
private Integer deviceStatus;
|
||||
|
||||
|
||||
/**
|
||||
* 人员信息
|
||||
*/
|
||||
private AppPersonnelInfoVo personnelInfo;
|
||||
|
||||
/**
|
||||
* 发送信息
|
||||
*/
|
||||
private String sendMsg;
|
||||
}
|
@ -0,0 +1,72 @@
|
||||
package com.fuyuanshen.app.domain.vo;
|
||||
|
||||
import com.fuyuanshen.app.domain.AppDeviceShare;
|
||||
import cn.idev.excel.annotation.ExcelIgnoreUnannotated;
|
||||
import cn.idev.excel.annotation.ExcelProperty;
|
||||
import com.fuyuanshen.common.excel.annotation.ExcelDictFormat;
|
||||
import com.fuyuanshen.common.excel.convert.ExcelDictConvert;
|
||||
import io.github.linpeilie.annotations.AutoMapper;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 设备分享视图对象 app_device_share
|
||||
*
|
||||
* @author Lion Li
|
||||
* @date 2025-07-16
|
||||
*/
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
@AutoMapper(target = AppDeviceShare.class)
|
||||
public class AppDeviceShareVo implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 主键id
|
||||
*/
|
||||
@ExcelProperty(value = "主键id")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 设备ID
|
||||
*/
|
||||
@ExcelProperty(value = "设备ID")
|
||||
private Long deviceId;
|
||||
|
||||
/**
|
||||
* 设备名称
|
||||
*/
|
||||
@ExcelProperty(value = "设备名称")
|
||||
private String deviceName;
|
||||
|
||||
/**
|
||||
* 手机号
|
||||
*/
|
||||
@ExcelProperty(value = "手机号")
|
||||
private String phonenumber;
|
||||
|
||||
/**
|
||||
* 功能权限(1:灯光模式;2:激光模式;3:开机画面;4:人员信息登记;5:发送信息;6:产品信息)
|
||||
以逗号分隔
|
||||
*/
|
||||
@ExcelProperty(value = "功能权限", converter = ExcelDictConvert.class)
|
||||
@ExcelDictFormat(readConverterExp = "1=:灯光模式;2:激光模式;3:开机画面;4:人员信息登记;5:发送信息;6:产品信息")
|
||||
private String permission;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
@ExcelProperty(value = "备注")
|
||||
private String remark;
|
||||
|
||||
// 设备图片
|
||||
private String devicePic;
|
||||
}
|
@ -0,0 +1,15 @@
|
||||
package com.fuyuanshen.app.mapper;
|
||||
|
||||
import com.fuyuanshen.app.domain.AppDeviceShare;
|
||||
import com.fuyuanshen.app.domain.vo.AppDeviceShareVo;
|
||||
import com.fuyuanshen.common.mybatis.core.mapper.BaseMapperPlus;
|
||||
|
||||
/**
|
||||
* 设备分享Mapper接口
|
||||
*
|
||||
* @author Lion Li
|
||||
* @date 2025-07-16
|
||||
*/
|
||||
public interface AppDeviceShareMapper extends BaseMapperPlus<AppDeviceShare, AppDeviceShareVo> {
|
||||
|
||||
}
|
@ -0,0 +1,68 @@
|
||||
package com.fuyuanshen.app.service;
|
||||
|
||||
import com.fuyuanshen.app.domain.vo.AppDeviceShareVo;
|
||||
import com.fuyuanshen.app.domain.bo.AppDeviceShareBo;
|
||||
import com.fuyuanshen.common.mybatis.core.page.TableDataInfo;
|
||||
import com.fuyuanshen.common.mybatis.core.page.PageQuery;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 设备分享Service接口
|
||||
*
|
||||
* @author Lion Li
|
||||
* @date 2025-07-16
|
||||
*/
|
||||
public interface IAppDeviceShareService {
|
||||
|
||||
/**
|
||||
* 查询设备分享
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 设备分享
|
||||
*/
|
||||
AppDeviceShareVo queryById(Long id);
|
||||
|
||||
/**
|
||||
* 分页查询设备分享列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @param pageQuery 分页参数
|
||||
* @return 设备分享分页列表
|
||||
*/
|
||||
TableDataInfo<AppDeviceShareVo> queryPageList(AppDeviceShareBo bo, PageQuery pageQuery);
|
||||
|
||||
/**
|
||||
* 查询符合条件的设备分享列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @return 设备分享列表
|
||||
*/
|
||||
List<AppDeviceShareVo> queryList(AppDeviceShareBo bo);
|
||||
|
||||
/**
|
||||
* 新增设备分享
|
||||
*
|
||||
* @param bo 设备分享
|
||||
* @return 是否新增成功
|
||||
*/
|
||||
Boolean insertByBo(AppDeviceShareBo bo);
|
||||
|
||||
/**
|
||||
* 修改设备分享
|
||||
*
|
||||
* @param bo 设备分享
|
||||
* @return 是否修改成功
|
||||
*/
|
||||
Boolean updateByBo(AppDeviceShareBo bo);
|
||||
|
||||
/**
|
||||
* 校验并批量删除设备分享信息
|
||||
*
|
||||
* @param ids 待删除的主键集合
|
||||
* @param isValid 是否进行有效性校验
|
||||
* @return 是否删除成功
|
||||
*/
|
||||
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
|
||||
}
|
@ -4,6 +4,7 @@ import com.fuyuanshen.app.domain.vo.AppPersonnelInfoVo;
|
||||
import com.fuyuanshen.app.domain.bo.AppPersonnelInfoBo;
|
||||
import com.fuyuanshen.common.mybatis.core.page.TableDataInfo;
|
||||
import com.fuyuanshen.common.mybatis.core.page.PageQuery;
|
||||
import com.fuyuanshen.equipment.domain.dto.AppDeviceBo;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
@ -65,4 +66,6 @@ public interface IAppPersonnelInfoService {
|
||||
* @return 是否删除成功
|
||||
*/
|
||||
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
|
||||
|
||||
boolean registerPersonInfo(AppPersonnelInfoBo bo);
|
||||
}
|
||||
|
@ -8,7 +8,9 @@ import com.fuyuanshen.app.domain.dto.APPReNameDTO;
|
||||
import com.fuyuanshen.app.domain.dto.APPUnbindDTO;
|
||||
import com.fuyuanshen.app.domain.query.APPDeviceQueryCriteria;
|
||||
import com.fuyuanshen.app.domain.vo.APPDeviceTypeVo;
|
||||
import com.fuyuanshen.app.domain.vo.AppDeviceDetailVo;
|
||||
import com.fuyuanshen.common.mybatis.core.page.TableDataInfo;
|
||||
import com.fuyuanshen.equipment.domain.dto.AppDeviceBo;
|
||||
import com.fuyuanshen.equipment.domain.query.DeviceQueryCriteria;
|
||||
|
||||
import java.util.List;
|
||||
@ -73,4 +75,5 @@ public interface APPDeviceService extends IService<APPDevice> {
|
||||
TableDataInfo<APPDevice> queryAppDeviceList(DeviceQueryCriteria criteria);
|
||||
|
||||
|
||||
int sendMessage(AppDeviceBo bo);
|
||||
}
|
||||
|
@ -0,0 +1,149 @@
|
||||
package com.fuyuanshen.app.service.impl;
|
||||
|
||||
import com.fuyuanshen.common.core.utils.MapstructUtils;
|
||||
import com.fuyuanshen.common.core.utils.StringUtils;
|
||||
import com.fuyuanshen.common.mybatis.core.page.TableDataInfo;
|
||||
import com.fuyuanshen.common.mybatis.core.page.PageQuery;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.fuyuanshen.common.satoken.utils.AppLoginHelper;
|
||||
import com.fuyuanshen.equipment.domain.Device;
|
||||
import com.fuyuanshen.equipment.mapper.DeviceMapper;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.fuyuanshen.app.domain.bo.AppDeviceShareBo;
|
||||
import com.fuyuanshen.app.domain.vo.AppDeviceShareVo;
|
||||
import com.fuyuanshen.app.domain.AppDeviceShare;
|
||||
import com.fuyuanshen.app.mapper.AppDeviceShareMapper;
|
||||
import com.fuyuanshen.app.service.IAppDeviceShareService;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Collection;
|
||||
|
||||
/**
|
||||
* 设备分享Service业务层处理
|
||||
*
|
||||
* @author Lion Li
|
||||
* @date 2025-07-16
|
||||
*/
|
||||
@Slf4j
|
||||
@RequiredArgsConstructor
|
||||
@Service
|
||||
public class AppDeviceShareServiceImpl implements IAppDeviceShareService {
|
||||
|
||||
private final AppDeviceShareMapper baseMapper;
|
||||
|
||||
private final DeviceMapper deviceMapper;
|
||||
|
||||
/**
|
||||
* 查询设备分享
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 设备分享
|
||||
*/
|
||||
@Override
|
||||
public AppDeviceShareVo queryById(Long id){
|
||||
return baseMapper.selectVoById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询设备分享列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @param pageQuery 分页参数
|
||||
* @return 设备分享分页列表
|
||||
*/
|
||||
@Override
|
||||
public TableDataInfo<AppDeviceShareVo> queryPageList(AppDeviceShareBo bo, PageQuery pageQuery) {
|
||||
Long userId = AppLoginHelper.getUserId();
|
||||
bo.setCreateBy(userId);
|
||||
LambdaQueryWrapper<AppDeviceShare> lqw = buildQueryWrapper(bo);
|
||||
Page<AppDeviceShareVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
||||
List<AppDeviceShareVo> records = result.getRecords();
|
||||
records.forEach(r -> {
|
||||
Device device = deviceMapper.selectById(r.getDeviceId());
|
||||
if(device != null){
|
||||
r.setDevicePic(device.getDevicePic());
|
||||
r.setDeviceName(device.getDeviceName());
|
||||
}
|
||||
});
|
||||
return TableDataInfo.build(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询符合条件的设备分享列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @return 设备分享列表
|
||||
*/
|
||||
@Override
|
||||
public List<AppDeviceShareVo> queryList(AppDeviceShareBo bo) {
|
||||
LambdaQueryWrapper<AppDeviceShare> lqw = buildQueryWrapper(bo);
|
||||
return baseMapper.selectVoList(lqw);
|
||||
}
|
||||
|
||||
private LambdaQueryWrapper<AppDeviceShare> buildQueryWrapper(AppDeviceShareBo bo) {
|
||||
Map<String, Object> params = bo.getParams();
|
||||
LambdaQueryWrapper<AppDeviceShare> lqw = Wrappers.lambdaQuery();
|
||||
lqw.eq(bo.getDeviceId() != null, AppDeviceShare::getDeviceId, bo.getDeviceId());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getPhonenumber()), AppDeviceShare::getPhonenumber, bo.getPhonenumber());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getPermission()), AppDeviceShare::getPermission, bo.getPermission());
|
||||
lqw.eq(bo.getCreateBy()!=null, AppDeviceShare::getCreateBy, bo.getCreateBy());
|
||||
return lqw;
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增设备分享
|
||||
*
|
||||
* @param bo 设备分享
|
||||
* @return 是否新增成功
|
||||
*/
|
||||
@Override
|
||||
public Boolean insertByBo(AppDeviceShareBo bo) {
|
||||
AppDeviceShare add = MapstructUtils.convert(bo, AppDeviceShare.class);
|
||||
validEntityBeforeSave(add);
|
||||
boolean flag = baseMapper.insert(add) > 0;
|
||||
if (flag) {
|
||||
bo.setId(add.getId());
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改设备分享
|
||||
*
|
||||
* @param bo 设备分享
|
||||
* @return 是否修改成功
|
||||
*/
|
||||
@Override
|
||||
public Boolean updateByBo(AppDeviceShareBo bo) {
|
||||
AppDeviceShare update = MapstructUtils.convert(bo, AppDeviceShare.class);
|
||||
validEntityBeforeSave(update);
|
||||
return baseMapper.updateById(update) > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存前的数据校验
|
||||
*/
|
||||
private void validEntityBeforeSave(AppDeviceShare entity){
|
||||
//TODO 做一些数据校验,如唯一约束
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验并批量删除设备分享信息
|
||||
*
|
||||
* @param ids 待删除的主键集合
|
||||
* @param isValid 是否进行有效性校验
|
||||
* @return 是否删除成功
|
||||
*/
|
||||
@Override
|
||||
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
|
||||
if(isValid){
|
||||
//TODO 做一些业务上的校验,判断是否需要校验
|
||||
}
|
||||
return baseMapper.deleteByIds(ids) > 0;
|
||||
}
|
||||
}
|
@ -1,5 +1,6 @@
|
||||
package com.fuyuanshen.app.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.fuyuanshen.common.core.utils.MapstructUtils;
|
||||
import com.fuyuanshen.common.core.utils.StringUtils;
|
||||
import com.fuyuanshen.common.mybatis.core.page.TableDataInfo;
|
||||
@ -7,6 +8,8 @@ import com.fuyuanshen.common.mybatis.core.page.PageQuery;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.fuyuanshen.equipment.domain.Device;
|
||||
import com.fuyuanshen.equipment.domain.dto.AppDeviceBo;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
@ -75,7 +78,6 @@ public class AppPersonnelInfoServiceImpl implements IAppPersonnelInfoService {
|
||||
LambdaQueryWrapper<AppPersonnelInfo> lqw = Wrappers.lambdaQuery();
|
||||
lqw.eq(bo.getDeviceId() != null, AppPersonnelInfo::getDeviceId, bo.getDeviceId());
|
||||
lqw.like(StringUtils.isNotBlank(bo.getName()), AppPersonnelInfo::getName, bo.getName());
|
||||
lqw.like(StringUtils.isNotBlank(bo.getDeptName()), AppPersonnelInfo::getDeptName, bo.getDeptName());
|
||||
lqw.like(StringUtils.isNotBlank(bo.getUnitName()), AppPersonnelInfo::getUnitName, bo.getUnitName());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getSendMsg()), AppPersonnelInfo::getSendMsg, bo.getSendMsg());
|
||||
return lqw;
|
||||
@ -132,4 +134,13 @@ public class AppPersonnelInfoServiceImpl implements IAppPersonnelInfoService {
|
||||
}
|
||||
return baseMapper.deleteByIds(ids) > 0;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean registerPersonInfo(AppPersonnelInfoBo bo) {
|
||||
|
||||
AppPersonnelInfo appPersonnelInfo = MapstructUtils.convert(bo, AppPersonnelInfo.class);
|
||||
|
||||
return baseMapper.insertOrUpdate(appPersonnelInfo);
|
||||
}
|
||||
}
|
||||
|
@ -23,8 +23,8 @@ import com.fuyuanshen.common.satoken.utils.AppLoginHelper;
|
||||
import com.fuyuanshen.common.satoken.utils.LoginHelper;
|
||||
import com.fuyuanshen.equipment.domain.Device;
|
||||
import com.fuyuanshen.equipment.domain.DeviceType;
|
||||
import com.fuyuanshen.equipment.domain.dto.AppDeviceBo;
|
||||
import com.fuyuanshen.equipment.domain.query.DeviceQueryCriteria;
|
||||
import com.fuyuanshen.equipment.domain.vo.AppDeviceVo;
|
||||
import com.fuyuanshen.equipment.enums.BindingStatusEnum;
|
||||
import com.fuyuanshen.equipment.enums.CommunicationModeEnum;
|
||||
import com.fuyuanshen.equipment.mapper.DeviceMapper;
|
||||
@ -227,5 +227,14 @@ public class APPDeviceServiceImpl extends ServiceImpl<APPDeviceMapper, APPDevice
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int sendMessage(AppDeviceBo bo) {
|
||||
UpdateWrapper<Device> updateWrapper = new UpdateWrapper<>();
|
||||
updateWrapper.eq("id", bo.getDeviceId())
|
||||
.eq("binding_user_id", AppLoginHelper.getUserId())
|
||||
.set("send_msg", bo.getSendMsg());
|
||||
return deviceMapper.update(updateWrapper);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.fuyuanshen.app.mapper.AppDeviceShareMapper">
|
||||
|
||||
</mapper>
|
@ -21,6 +21,9 @@ import java.util.Date;
|
||||
@JsonInclude(JsonInclude.Include.ALWAYS) // 关键注解
|
||||
public class Device extends TenantEntity {
|
||||
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
@Schema(name = "ID")
|
||||
private Long id;
|
||||
@ -29,6 +32,9 @@ public class Device extends TenantEntity {
|
||||
@TableField(exist = false)
|
||||
private Long assignId;
|
||||
|
||||
/**
|
||||
* device_type
|
||||
*/
|
||||
@Schema(name = "设备类型")
|
||||
private Long deviceType;
|
||||
|
||||
@ -100,8 +106,6 @@ public class Device extends TenantEntity {
|
||||
private Integer deviceStatus;
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 绑定状态
|
||||
* 0 未绑定
|
||||
@ -118,4 +122,6 @@ public class Device extends TenantEntity {
|
||||
private Long bindingUserId;
|
||||
|
||||
private Date bindingTime;
|
||||
|
||||
private String sendMsg;
|
||||
}
|
||||
|
@ -25,6 +25,7 @@ public class DeviceAssignments extends TenantEntity {
|
||||
|
||||
/**
|
||||
* 设备id
|
||||
* device_id
|
||||
*/
|
||||
private Long deviceId;
|
||||
|
||||
|
@ -28,4 +28,7 @@ public class AppDeviceBo {
|
||||
@NotNull(message = "通讯方式不能为空", groups = { EditGroup.class })
|
||||
private Integer communicationMode;
|
||||
|
||||
private String sendMsg;
|
||||
|
||||
private String deviceId;
|
||||
}
|
||||
|
@ -58,7 +58,9 @@ public class DeviceExcelImportDTO {
|
||||
private String remark;
|
||||
|
||||
@ExcelProperty("设备类型名称")
|
||||
@ColumnWidth(20)
|
||||
private String typeName;
|
||||
|
||||
@ExcelProperty("蓝牙名称")
|
||||
private String bluetoothName;
|
||||
|
||||
}
|
@ -44,7 +44,6 @@ import com.fuyuanshen.system.domain.vo.SysOssVo;
|
||||
import com.fuyuanshen.system.service.ISysOssService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.poi.ss.formula.functions.T;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
@ -101,6 +100,12 @@ public class DeviceServiceImpl extends ServiceImpl<DeviceMapper, Device> impleme
|
||||
public TableDataInfo<Device> queryAll(DeviceQueryCriteria criteria, Page<Device> page) throws IOException {
|
||||
|
||||
criteria.setCurrentOwnerId(LoginHelper.getUserId());
|
||||
if (criteria.getDeviceType() != null) {
|
||||
DeviceTypeGrants deviceTypeGrant = deviceTypeGrantsMapper.selectById(criteria.getDeviceType());
|
||||
if (deviceTypeGrant != null) {
|
||||
criteria.setDeviceType(deviceTypeGrant.getDeviceTypeId());
|
||||
}
|
||||
}
|
||||
IPage<Device> devices = deviceMapper.findAll(criteria, page);
|
||||
|
||||
List<Device> records = devices.getRecords();
|
||||
@ -142,6 +147,16 @@ public class DeviceServiceImpl extends ServiceImpl<DeviceMapper, Device> impleme
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void addDevice(DeviceForm deviceForm) throws Exception {
|
||||
|
||||
Device device1 = deviceMapper.selectOne(new QueryWrapper<Device>().eq("device_mac", deviceForm.getDeviceMac()));
|
||||
if (device1 != null) {
|
||||
throw new BadRequestException("设备MAC已存在!!!");
|
||||
}
|
||||
Device device2 = deviceMapper.selectOne(new QueryWrapper<Device>().eq("device_imei", deviceForm.getDeviceImei()));
|
||||
if (device2 != null) {
|
||||
throw new BadRequestException("设备IMEI已存在!!!");
|
||||
}
|
||||
|
||||
DeviceTypeQueryCriteria queryCriteria = new DeviceTypeQueryCriteria();
|
||||
queryCriteria.setDeviceTypeId(deviceForm.getDeviceType());
|
||||
queryCriteria.setCustomerId(LoginHelper.getUserId());
|
||||
|
@ -1,6 +1,8 @@
|
||||
package com.fuyuanshen.equipment.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
@ -10,11 +12,13 @@ import com.fuyuanshen.common.core.utils.PageUtil;
|
||||
import com.fuyuanshen.common.mybatis.core.page.TableDataInfo;
|
||||
import com.fuyuanshen.common.satoken.utils.LoginHelper;
|
||||
import com.fuyuanshen.equipment.domain.Device;
|
||||
import com.fuyuanshen.equipment.domain.DeviceAssignments;
|
||||
import com.fuyuanshen.equipment.domain.DeviceType;
|
||||
import com.fuyuanshen.equipment.domain.DeviceTypeGrants;
|
||||
import com.fuyuanshen.equipment.domain.form.DeviceTypeForm;
|
||||
import com.fuyuanshen.equipment.domain.query.DeviceQueryCriteria;
|
||||
import com.fuyuanshen.equipment.domain.query.DeviceTypeQueryCriteria;
|
||||
import com.fuyuanshen.equipment.mapper.DeviceAssignmentsMapper;
|
||||
import com.fuyuanshen.equipment.mapper.DeviceMapper;
|
||||
import com.fuyuanshen.equipment.mapper.DeviceTypeGrantsMapper;
|
||||
import com.fuyuanshen.equipment.mapper.DeviceTypeMapper;
|
||||
@ -41,6 +45,7 @@ public class DeviceTypeServiceImpl extends ServiceImpl<DeviceTypeMapper, DeviceT
|
||||
private final DeviceMapper deviceMapper;
|
||||
|
||||
private final DeviceTypeGrantsMapper deviceTypeGrantsMapper;
|
||||
private final DeviceAssignmentsMapper deviceAssignmentsMapper;
|
||||
|
||||
|
||||
/**
|
||||
@ -155,30 +160,33 @@ public class DeviceTypeServiceImpl extends ServiceImpl<DeviceTypeMapper, DeviceT
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void deleteAll(List<Long> ids) {
|
||||
|
||||
List<Long> deviceTypeId = new ArrayList<>();
|
||||
|
||||
for (Long id : ids) {
|
||||
DeviceTypeGrants deviceTypeGrant = deviceTypeGrantsMapper.selectById(id);
|
||||
|
||||
// List<DeviceTypeGrants> deviceTypeGrants = deviceTypeGrantsMapper.selectList(new QueryWrapper<DeviceTypeGrants>()
|
||||
// .eq("device_type_id", deviceTypeGrant.getDeviceTypeId()));
|
||||
|
||||
// List<DeviceTypeGrants> deviceAssignments = deviceTypeGrantsMapper.selectList(new QueryWrapper<DeviceTypeGrants>()
|
||||
// .eq("device_id", deviceTypeGrant.getDeviceTypeId()));
|
||||
|
||||
// if (CollectionUtil.isNotEmpty(deviceAssignments)) {
|
||||
// throw new RuntimeException("该设备类型已绑定设备,无法删除");
|
||||
// }
|
||||
// Device device = deviceMapper.selectById(deviceTypeGrant.getDeviceTypeId());
|
||||
|
||||
List<Device> devices = deviceMapper.selectList(new QueryWrapper<Device>()
|
||||
.eq("device_type", deviceTypeGrant.getDeviceTypeId()));
|
||||
if (CollectionUtil.isNotEmpty(devices)) {
|
||||
throw new RuntimeException("该设备类型已绑定设备,无法删除");
|
||||
}
|
||||
deviceTypeId.add(deviceTypeGrant.getDeviceTypeId());
|
||||
}
|
||||
|
||||
deviceTypeGrantsMapper.deleteByIds(ids);
|
||||
//
|
||||
// List<Long> invalidIds = new ArrayList<>();
|
||||
// List<Long> invalidId2 = new ArrayList<>();
|
||||
// for (Long id : ids) {
|
||||
// DeviceType deviceType = deviceTypeMapper.selectById(id);
|
||||
// if (deviceType == null || !Objects.equals(deviceType.getOwnerCustomerId(), LoginHelper.getUserId())) {
|
||||
// invalidIds.add(id);
|
||||
// }
|
||||
// DeviceQueryCriteria deviceQueryCriteria = new DeviceQueryCriteria();
|
||||
// deviceQueryCriteria.setDeviceType(id);
|
||||
// List<Device> devices = deviceMapper.findAll(deviceQueryCriteria);
|
||||
// if (!devices.isEmpty()) {
|
||||
// invalidId2.add(id);
|
||||
// }
|
||||
// }
|
||||
// if (!invalidIds.isEmpty()) {
|
||||
// throw new RuntimeException("以下设备类型无法删除(ID 不存在或无权限): " + invalidIds);
|
||||
// }
|
||||
// if (!invalidId2.isEmpty()) {
|
||||
// throw new RuntimeException("以下设备类型无法删除(已绑定设备): " + invalidId2);
|
||||
// }
|
||||
//
|
||||
// deviceTypeMapper.deleteByIds(ids);
|
||||
deviceTypeMapper.deleteByIds(deviceTypeId);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user