Sfoglia il codice sorgente

Merge remote-tracking branch 'origin/dev_20251009' into dev_20251009

donglang 3 mesi fa
parent
commit
bd9596fe21
17 ha cambiato i file con 604 aggiunte e 267 eliminazioni
  1. 3 0
      iot-platform-common/src/main/java/com/platform/enums/ErrorCodeEnum.java
  2. 10 6
      iot-platform-common/src/main/java/com/platform/exception/BusinessException.java
  3. 0 42
      iot-platform-common/src/main/java/com/platform/exception/CommonErrorCode.java
  4. 10 5
      iot-platform-common/src/main/java/com/platform/request/PageRequest.java
  5. 7 7
      iot-platform-common/src/main/java/com/platform/result/HttpResult.java
  6. 1 183
      iot-platform-common/src/main/java/com/platform/result/HttpStatus.java
  7. 64 0
      iot-platform-manager/src/main/java/com/platform/controller/IotDeviceGroupController.java
  8. 15 0
      iot-platform-manager/src/main/java/com/platform/entity/IotDeviceGroup.java
  9. 65 0
      iot-platform-manager/src/main/java/com/platform/manage/IotDeviceGroupManage.java
  10. 0 12
      iot-platform-manager/src/main/java/com/platform/request/Demo.java
  11. 26 0
      iot-platform-manager/src/main/java/com/platform/request/device/DeviceGroupDetailReq.java
  12. 84 0
      iot-platform-manager/src/main/java/com/platform/request/deviceGroup/IotDeviceGroupRequest.java
  13. 0 12
      iot-platform-manager/src/main/java/com/platform/response/Demo.java
  14. 103 0
      iot-platform-manager/src/main/java/com/platform/response/deviceGroup/DeviceGroupDetailResp.java
  15. 127 0
      iot-platform-manager/src/main/java/com/platform/response/deviceGroup/DeviceGroupPageResp.java
  16. 39 0
      iot-platform-manager/src/main/java/com/platform/service/IotDeviceGroupService.java
  17. 50 0
      iot-platform-manager/src/main/java/com/platform/service/impl/IotDeviceGroupServiceImpl.java

+ 3 - 0
iot-platform-common/src/main/java/com/platform/enums/ErrorCodeEnum.java

@@ -1,11 +1,14 @@
 package com.platform.enums;
 
+import lombok.Getter;
+
 /**
  *Author: donglang
  *Time: 2025-10-09
  *Description: IoT平台异常编码枚举,统一管理系统中的错误码和描述
  *Version: 1.0
  */
+@Getter
 public enum ErrorCodeEnum {
 
     // ====================== 通用错误(10000~19999)======================

+ 10 - 6
iot-platform-common/src/main/java/com/platform/exception/BusinessException.java

@@ -1,31 +1,35 @@
 package com.platform.exception;
 
+import com.platform.enums.ErrorCodeEnum;
 import lombok.Getter;
 
+import static com.platform.enums.ErrorCodeEnum.SYSTEM_ERROR;
+
 /**
  * 业务异常类
+ * @author PC
  */
 @Getter
 public class BusinessException extends RuntimeException {
     
-    private final Integer code;
+    private final String code;
     private final String message;
     
     public BusinessException(String message) {
         super(message);
-        this.code = 500;
+        this.code = SYSTEM_ERROR.getCode();
         this.message = message;
     }
     
-    public BusinessException(Integer code, String message) {
+    public BusinessException(String code, String message) {
         super(message);
         this.code = code;
         this.message = message;
     }
     
-    public BusinessException(ErrorCode errorCode) {
-        super(errorCode.getMessage());
+    public BusinessException(ErrorCodeEnum errorCode) {
+        super(errorCode.getDesc());
         this.code = errorCode.getCode();
-        this.message = errorCode.getMessage();
+        this.message = errorCode.getDesc();
     }
 }

+ 0 - 42
iot-platform-common/src/main/java/com/platform/exception/CommonErrorCode.java

@@ -1,42 +0,0 @@
-package com.platform.exception;
-
-
-
-/**
- * 常见错误码枚举
- */
-public enum CommonErrorCode implements ErrorCode {
-    
-    /**
-     * 参数校验异常
-     */
-    PARAM_VALIDATE_FAILED(1001, "参数校验失败"),
-    
-    /**
-     * 数据不存在
-     */
-    DATA_NOT_FOUND(1002, "数据不存在"),
-    
-    /**
-     * 系统异常
-     */
-    SYSTEM_ERROR(9999, "系统异常");
-    
-    private final Integer code;
-    private final String message;
-    
-    CommonErrorCode(Integer code, String message) {
-        this.code = code;
-        this.message = message;
-    }
-    
-    @Override
-    public Integer getCode() {
-        return code;
-    }
-    
-    @Override
-    public String getMessage() {
-        return message;
-    }
-}

+ 10 - 5
iot-platform-common/src/main/java/com/platform/request/PageRequest.java

@@ -2,16 +2,21 @@ package com.platform.request;
 
 import lombok.Data;
 
+import java.io.Serial;
+import java.io.Serializable;
+
 
 /**
  * @author PC
  */
 @Data
-public class PageRequest {
-	/**
-	 * 当前页码
-	 */
-	private int page = 1;
+public class PageRequest implements Serializable {
+    @Serial
+    private static final long serialVersionUID = 1513010094486554750L;
+    /**
+     * 当前页码
+     */
+    private int current = 1;
 	/**
 	 * 每页数量
 	 */

+ 7 - 7
iot-platform-common/src/main/java/com/platform/result/HttpResult.java

@@ -13,7 +13,7 @@ import java.io.Serializable;
 @Data
 public class HttpResult<T> implements Serializable {
 
-	private int code = HttpStatus.SUCCESS_CODE;
+	private String code = HttpStatus.SUCCESS_CODE;
 	private String message = HttpStatus.SUCCESS_MESSAGE;
 	private T data;
     /**
@@ -27,7 +27,7 @@ public class HttpResult<T> implements Serializable {
      */
     public static <T> HttpResult<T> success(T data) {
         HttpResult<T> result = new HttpResult<>();
-        result.setCode(200);
+        result.setCode("000000");
         result.setMessage("success");
         result.setData(data);
         return result;
@@ -38,7 +38,7 @@ public class HttpResult<T> implements Serializable {
      */
     public static <T> HttpResult<T> failed(String message) {
         HttpResult<T> result = new HttpResult<>();
-        result.setCode(500);
+        result.setCode("500");
         result.setMessage(message);
         return result;
     }
@@ -46,7 +46,7 @@ public class HttpResult<T> implements Serializable {
     /**
      * 失败响应 - 自定义码值和消息
      */
-    public static <T> HttpResult<T> failed(Integer code, String message) {
+    public static <T> HttpResult<T> failed(String code, String message) {
         HttpResult<T> result = new HttpResult<>();
         result.setCode(code);
         result.setMessage(message);
@@ -58,7 +58,7 @@ public class HttpResult<T> implements Serializable {
      */
     public static <T> HttpResult<T> validateFailed(String message) {
         HttpResult<T> result = new HttpResult<>();
-        result.setCode(400);
+        result.setCode("400");
         result.setMessage(message);
         return result;
     }
@@ -68,7 +68,7 @@ public class HttpResult<T> implements Serializable {
      */
     public static <T> HttpResult<T> unauthorized(T data) {
         HttpResult<T> result = new HttpResult<>();
-        result.setCode(401);
+        result.setCode("401");
         result.setMessage("Unauthorized");
         result.setData(data);
         return result;
@@ -79,7 +79,7 @@ public class HttpResult<T> implements Serializable {
      */
     public static <T> HttpResult<T> forbidden(T data) {
         HttpResult<T> result = new HttpResult<>();
-        result.setCode(403);
+        result.setCode("403");
         result.setMessage("Forbidden");
         result.setData(data);
         return result;

+ 1 - 183
iot-platform-common/src/main/java/com/platform/result/HttpStatus.java

@@ -8,191 +8,9 @@ package com.platform.result;
 public class HttpStatus {
 
     /**成功状态码*/
-    public static final int SUCCESS_CODE = 200;
+    public static final String SUCCESS_CODE = "000000";
 
     /**成功提示信息*/
     public static final String SUCCESS_MESSAGE = "success";
 
-    /**未登录状态码*/
-    public static final int UN_LOGIN_CODE = 60300;
-    /**未登录提示信息*/
-    public static final String UN_LOGIN_MESSAGE = "您尚未登录,请先登录!";
-
-    /**访问权限状态码*/
-    public static final int AUTHORITY_NO_CODE = 60403;
-    public static final String ACCESS_FIAL = "暂无该功能权限!";
-
-    /**全局异常状态码*/
-    public static final int GLOBAL_EXCEPTION_CODE = 60500;
-
-    /**完结贸易订单失败异常码*/
-    public static final int COMPLETE_TORDER_FAIL_CODE = 60666;
-
-    /** 商品上架失败异常码*/
-    public static final int GOODS_PUT_ON_SHELVES_FAIL_CODE = 60667;
-
-    /**全局异常提示信息*/
-    public static final String GLOBAL_EXCEPTION_MESSAGE = "攻城狮正在拼命优化,请您稍候再试!";
-
-    /**参数缺失状态码*/
-    public static final int PARAMETERS_MISSING_CODE = 60600;
-    public static final String ID_MISSING = "id不能为空!";
-    public static final String ACCOUNT_MISSING = "用户账号必填!";
-    public static final String ACCOUNT_FREEZE = "用户账号不能重复冻结!";
-    public static final String ACCOUNT_UNFREEZE = "用户账号不能重复解冻!";
-    public static final String PWD_MISSING = "密码不能为空!";
-    public static final String TOKEN_MISSING = "token不能为空!";
-    public static final String TOKEN_ERROR = "非法token!";
-    public static final String CAPCHA_ERROR = "验证码无效!";
-    public static final String ADDRESS_EXISTS = "地点已存在,不可重复!";
-    public static final String INVALID_REQUEST = "无效的接口请求!";
-
-    /**其他自定义状态码*/
-    public static final int CODE_60603 = 60603;
-    public static final String ENTCERTIFICATES_INVAILD = "您的企业资质已失效,暂没有权限访问,请尽快更新资质";
-    public static final String ENTCERTIFICATES_NOT_REGISTER = "您未做企业资质认证,暂没有权限访问";
-    public static final String ENTCERTIFICATES_NOT_PASS = "您的企业资质认证还在审核中,暂没有权限访问";
-
-
-
-    public static final int CODE_60604 = 60604;
-    public static final int CODE_60605 = 60605;
-    public static final int CODE_60606 = 60606;
-    public static final int CODE_60607 = 60607;
-    public static final int CODE_60608 = 60608;
-    public static final int CODE_60609 = 60609;
-    /**sentinel异常code定义*/
-    public static final int CODE_60701 = 60701;
-    public static final int CODE_60801 = 60801;
-    public static final int CODE_60901 = 60901;
-    public static final int CODE_601001 = 601001;
-    public static final int CODE_601101 = 601101;
-    public static final int CODE_601201 = 601201;
-
-    public static final String FLOW_EXCEPTION_ERROR_MESSAGE = "您的访问过于频繁,请稍后重试";
-    public static final String DEGRADE_EXCEPTION_ERROR_MESSAGE = "调用服务响应异常,请稍后重试";
-    public static final String PARAM_FLOW_EXCEPTION_ERROR_MESSAGE = "您对热点参数访问过于频繁,请稍后重试";
-    public static final String SYSTEM_BLOCK_EXCEPTION_ERROR_MESSAGE = "已触碰系统的红线规则,请检查访问参数";
-    public static final String AUTHORITY_EXCEPTION_ERROR_MESSAGE = "授权规则检测不同,请检查访问参数";
-    public static final String OTHER_EXCEPTION_ERROR_MESSAGE = "非法访问,请稍后重试";
-
-    /**版本号和接口版本不对称状态码*/
-    public static final int VERSION_NOT_NEWEST_CODE = 60700;
-    /**版本号和接口版本不对称提示信息*/
-    public static final String VERSION_NOT_NEWEST_MESSAGE = "当前版本较低,请更新升级后再试!";
-
-
-    /**参数格式不正确状态码*/
-    public static final int PARAMETERS_PATTERN_ERROR_CODE = 60800;
-    /**参数格式不正确提示信息*/
-    public static final String PARAMETERS_PATTERN_ERROR_MESSAGE = "参数格式不正确";
-    public static final String CONTACTS_ERROR = "联系人格式不正确";
-    public static final String CONTACTS_PHONE_ERROR = "联系人手机号格式不正确";
-    public static final String LEGAL_NAME_ERROR = "法人格式不正确";
-    public static final String LEGAL_PHONE_ERROR = "法人手机号格式不正确";
-    public static final String LEGAL_ID_CARD_ERROR = "法人身份证号格式不正确";
-    public static final String ENT_CODE_ERROR = "营业执照编号格式不正确";
-
-    /**账号在别处登录状态码*/
-    public static final int ACCOUNT_OTHER_LOGIN_CODE = 60900;
-    /**账号在别处登录提示信息*/
-    public static final String ACCOUNT_OTHER_LOGIN_MESSAGE = "您的账号已在其他设备登录,如非本人操作,请及时修改密码!";
-
-
-    /**token无效状态码*/
-    public static final int TOKEN_INVALID_CODE = 60901;
-    /**token无效提示信息*/
-    public static final String TOKEN_INVALID_MESSAGE = "由于您一段时间未操作,为了您的账户安全,请重新登录!";
-
-    /**请求超过次数*/
-    public static final int FREQUENCY_OUT = 60902;
-    /**请求超过次数提示信息*/
-    public static final String FREQUENCY_OUT_MESSAGE = "您的操作过于频繁,请刷新浏览器或稍候重试!";
-
-    /**审核状态状态码*/
-    public static final int ACCOUNT_AUDIT_CODE = 60903;
-    /**审核状态状提示信息*/
-    public static final String ACCOUNT_AUDIT_MESSAGE = "您所属企业企业资质审批未通过,请核实确认!";
-
-    /**微信账号未绑定态码*/
-    public static final int WECHAR_BIND_CODE = 60904;
-    /**微信账号未绑定提示信息*/
-    public static final String WECHAR_BIND_MESSAGE = "您的微信还未绑定危品汇账号!";
-
-    /**
-     * 自定义状态码,该状态码没有特殊含义,只是提供一个状态标识(目前提供9个,可自行扩展)
-     * 现作为校验失败的一类异常码
-     */
-    public static final int CODE_10301 = 10301;
-
-    /**数据库的操作失败*/
-    public static final int CRUD_FAIL_CODE = 60601;
-    public static final String UPDATE_FAIL = "更新失败";
-    public static final String INSERT_FAIL = "新增失败";
-    public static final String DELETE_FAIL = "删除失败";
-
-    /**未查询到相关信息*/
-    public static final int QUERY_FAIL_CODE = 60602;
-    public static final String ACCOUNT_NOT_EXISTS = "用户信息不存在或已失效";
-    public static final String ENT_NOT_EXISTS = "企业信息不存在或已失效";
-    public static final String DEPT_NOT_EXISTS = "机构信息不存在或已失效";
-    public static final String ENTCERTIFICATES_NOT_EXISTS = "未查询到企业资质信息";
-    public static final String ROLE_NOT_EXISTS = "未查询到关联的角色";
-    public static final String USER_DEPT_NOT_EXISTS = "未查询到用户-机构关联信息";
-    public static final String MENU_NOT_EXISTS = "未查询到菜单信息";
-    public static final String PARENT_MENU_NOT_EXISTS = "未查询到父菜单信息";
-    public static final String PARENT_UNIT_NOT_EXISTS = "未查询到父级单位信息";
-    public static final String COOPERATE_ATTRIBUTE_NOT_EXISTS = "未查询到已有的合作属性";
-    public static final String COOPERATE_NOT_EXISTS = "未查询到合作记录或已失效";
-    public static final String COOPERATE_CANCEL_EXISTS = "未查询到可撤销的记录";
-    public static final String ADDRESS_NOT_EXISTS = "未查询到地址记录或已失效";
-    public static final String CONTRACT_NOT_EXISTS = "未查询到合同或已失效";
-    public static final String BANNER_NOT_EXISTS = "未查询到banner数据或已失效";
-
-    /**自定义提示消息*/
-    public static final String PASSWD_ERROR = "密码不正确";
-    public static final String PASSWD_REPEAT = "新密码与旧密码不能一样!";
-    public static final String CAPTCHA_ERROR = "验证码输入错误";
-    public static final String MSG_001 = "密码重置成功";
-    public static final String MSG_002 = "密码修改成功";
-    public static final String MSG_003 = "新增成功";
-    public static final String MSG_004 = "审批完成";
-    public static final String MSG_005 = "更新成功";
-    public static final String MSG_006 = "当前系统不允许绑定多个岗位!";
-    public static final String MSG_007 = "注册成功!";
-    public static final String MSG_008 = "删除成功!";
-    public static final String MSG_009 = "认证提交成功!";
-    public static final String MSG_010 = "绑定成功!";
-    public static final String MSG_011 = "当前企业还存在员工数据,不能删除!";
-    public static final String MSG_012 = "只能解除状态为合作中的记录!";
-    public static final String MSG_013 = "只能删除状态为已解除的记录!";
-    public static final String MSG_014 = "导出失败";
-    public static final String MSG_015 = "与对方企业存在待审核的合作关系,请撤销或者完成审核再申请!";
-    public static final String MSG_016 = "与对方企业已存在相同属性的合作关系!";
-    public static final String MSG_017 = "发起申请成功!";
-    public static final String MSG_018 = "撤销成功!";
-    public static final String MSG_019 = "只能操作正在审核中的记录!";
-    public static final String MSG_020 = "当前机构还存在员工数据,不能删除!";
-    public static final String MSG_021 = "不能重复设置默认地址!";
-    public static final String MSG_022 = "只能对草稿进行删除!";
-    public static final String MSG_023 = "解除成功!";
-    public static final String MSG_024 = "名称不能重复!";
-    public static final String MSG_025 = "禁止删除本人信息!";
-    public static final String MSG_026 = "资质认证审核中,请等待审核后再提交!";
-    public static final String MSG_027 = "一级机构不能删除!";
-    public static final String MSG_028 = "合同未签约,不能手动完结!";
-    public static final String MSG_029 = "合同编号超长!";
-    public static final String MSG_030 = "合同名称超长!";
-    public static final String MSG_031 = "您与所选企业存在未完结销售订单,当前无法删除!";
-    public static final String MSG_032 = "您与所选企业存在未完结托运承运订单,当前无法删除!";
-    public static final String MSG_033 = "当前企业资质在审核中,无法删除!";
-    public static final String MSG_034 = "您与所选企业存在未完结对账单,当前无法删除!";
-    public static final String MSG_035 = "地址信息已存在";
-
-    public static final String ENT_EXISTS = "企业已存在,不可重复!";
-    public static final String ACCOUNT_EXISTS = "用户账号已存在!";
-    public static final String DICTTYPE_EXISTS = "字典类型已存在,不可重复!";
-    public static final String DICT_EXISTS = "字典键值已存在,不可重复!";
-    public static final String PL34 = "3PL和4PL不能同时注册!";
-
 }

+ 64 - 0
iot-platform-manager/src/main/java/com/platform/controller/IotDeviceGroupController.java

@@ -0,0 +1,64 @@
+package com.platform.controller;
+
+import com.platform.manage.IotDeviceGroupManage;
+import com.platform.request.device.DeviceGroupDetailReq;
+import com.platform.request.deviceGroup.IotDeviceGroupRequest;
+import com.platform.response.deviceGroup.DeviceGroupPageResp;
+import com.platform.response.deviceGroup.DeviceGroupDetailResp;
+import com.platform.result.HttpResult;
+import lombok.RequiredArgsConstructor;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.*;
+
+/**
+ * 物联网设备管理控制器
+ * @author PC
+ */
+@RestController
+@RequestMapping("/iot/device/group")
+@RequiredArgsConstructor
+@Validated
+public class IotDeviceGroupController {
+
+    private final IotDeviceGroupManage iotDeviceGroupManage;
+
+    /**
+     * 添加物联网设备
+     */
+    @PostMapping("/addDeviceGroup")
+    public HttpResult<Boolean> addDeviceGroup(@RequestBody IotDeviceGroupRequest request) {
+        return HttpResult.success(iotDeviceGroupManage.addDeviceGroup(request));
+    }
+
+    /**
+     * 修改物联网设备
+     */
+    @PostMapping("/updateDeviceGroup")
+    public HttpResult<Boolean> updateDeviceGroup(@RequestBody IotDeviceGroupRequest request) {
+        return HttpResult.success(iotDeviceGroupManage.updateDeviceGroup(request));
+    }
+
+    /**
+     * 删除物联网设备
+     */
+    @GetMapping("/delDeviceGroup")
+    public HttpResult<Boolean> delDeviceGroup(@RequestParam("deviceGroupCode") String deviceGroupCode) {
+        return HttpResult.success(iotDeviceGroupManage.delDeviceGroup(deviceGroupCode));
+    }
+
+
+    /**
+     * 物联设备详情查询
+     */
+    @PostMapping("/getDeviceGroupDetail")
+    public HttpResult<DeviceGroupDetailResp> getDeviceGroupDetail(@RequestBody DeviceGroupDetailReq req) {
+        return HttpResult.success(iotDeviceGroupManage.getDeviceGroupDetail(req));
+    }
+    /**
+     * 分页查询物联设备
+     */
+    @PostMapping("/pageGroupDevice")
+    public HttpResult<DeviceGroupPageResp> pageGroupDevice(@RequestBody DeviceGroupDetailReq req) {
+        return HttpResult.success(iotDeviceGroupManage.pageGroupDevice(req));
+    }
+}

+ 15 - 0
iot-platform-manager/src/main/java/com/platform/entity/IotDeviceGroup.java

@@ -1,6 +1,7 @@
 package com.platform.entity;
 
 import com.baomidou.mybatisplus.annotation.*;
+import com.platform.request.deviceGroup.IotDeviceGroupRequest;
 import lombok.Data;
 import java.time.LocalDateTime;
 
@@ -77,4 +78,18 @@ public class IotDeviceGroup {
      */
     @TableField("update_user")
     private String updateUser;
+
+    public static IotDeviceGroup getInstance(){
+        return new IotDeviceGroup();
+    }
+    public static IotDeviceGroup toIotDeviceGroup(IotDeviceGroupRequest request){
+        IotDeviceGroup instance = IotDeviceGroup.getInstance();
+        instance.setId(request.getId());
+        instance.setDeviceGroupCode(request.getDeviceGroupCode());
+        instance.setTenantId(request.getTenantId());
+        instance.setCompanyId(request.getCompanyId());
+        instance.setTitle(request.getTitle());
+        instance.setLargeType(request.getLargeType());
+        return instance;
+    }
 }

+ 65 - 0
iot-platform-manager/src/main/java/com/platform/manage/IotDeviceGroupManage.java

@@ -0,0 +1,65 @@
+package com.platform.manage;
+
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.platform.entity.IotDeviceGroup;
+import com.platform.exception.BusinessException;
+import com.platform.request.device.DeviceGroupDetailReq;
+import com.platform.request.deviceGroup.IotDeviceGroupRequest;
+import com.platform.response.deviceGroup.DeviceGroupPageResp;
+import com.platform.response.deviceGroup.DeviceGroupDetailResp;
+import com.platform.service.IotDeviceGroupService;
+import lombok.RequiredArgsConstructor;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.stereotype.Service;
+
+import java.util.Objects;
+
+
+/**
+ * @author PC
+ */
+@Service
+@RequiredArgsConstructor
+public class IotDeviceGroupManage {
+    private final IotDeviceGroupService iotDeviceGroupService;
+    public Boolean addDeviceGroup(IotDeviceGroupRequest request) {
+        IotDeviceGroup oneByName = iotDeviceGroupService.getOneByTitle(request.getTitle());
+        if (Objects.nonNull(oneByName)){
+            throw new BusinessException("设备分组名称已存在");
+        }
+        IotDeviceGroup iotDeviceGroup = IotDeviceGroup.toIotDeviceGroup(request);
+        return iotDeviceGroupService.addDeviceGroup(iotDeviceGroup);
+    }
+
+    public Boolean updateDeviceGroup(IotDeviceGroupRequest request) {
+        if (StringUtils.isBlank(request.getDeviceGroupCode())){
+            throw new BusinessException("设备分组码值不能为空");
+        }
+        IotDeviceGroup iotDeviceGroup = IotDeviceGroup.toIotDeviceGroup(request);
+        return iotDeviceGroupService.updateDeviceGroup(iotDeviceGroup);
+    }
+
+    public Boolean delDeviceGroup(String deviceGroupCode) {
+        if (StringUtils.isBlank(deviceGroupCode)){
+            throw new BusinessException("设备分组码值不能为空");
+        }
+        return iotDeviceGroupService.delDeviceGroup(deviceGroupCode);
+    }
+
+    public DeviceGroupDetailResp getDeviceGroupDetail(DeviceGroupDetailReq req) {
+        //todo 设置参数
+        IotDeviceGroup iotDeviceGroup = new IotDeviceGroup();
+        IotDeviceGroup iotGroupDetail= iotDeviceGroupService.getDeviceGroupDetail(iotDeviceGroup);
+        if (Objects.nonNull(iotGroupDetail)){
+            return DeviceGroupDetailResp.toDeviceGroupDetailResp(iotGroupDetail);
+        }
+        return DeviceGroupDetailResp.getInstance();
+    }
+
+    public DeviceGroupPageResp pageGroupDevice(DeviceGroupDetailReq req) {
+        //todo 设置参数
+        IotDeviceGroup iotDeviceGroup = new IotDeviceGroup();
+        Page page = iotDeviceGroupService.pageGroupDevice(req.getCurrent(),req.getPageSize(),iotDeviceGroup);
+        return null;
+    }
+}

+ 0 - 12
iot-platform-manager/src/main/java/com/platform/request/Demo.java

@@ -1,12 +0,0 @@
-package com.platform.request;
-
-/**
- * @Author: 马超伟
- * @CreateTime: 2025-10-09
- * @Description:
- * @Version: 1.0
- */
-
-
-public class Demo {
-}

+ 26 - 0
iot-platform-manager/src/main/java/com/platform/request/device/DeviceGroupDetailReq.java

@@ -0,0 +1,26 @@
+package com.platform.request.device;
+
+import com.platform.request.PageRequest;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+import java.io.Serial;
+
+/**
+ * @Author: 马超伟
+ * @CreateTime: 2025-10-09
+ * @Description:
+ * @Version: 1.0
+ */
+
+
+@EqualsAndHashCode(callSuper = true)
+@Data
+public class DeviceGroupDetailReq extends PageRequest {
+    @Serial
+    private static final long serialVersionUID = -4283288286780625958L;
+    /**
+     * 设备分组码值
+     */
+    private String deviceGroupCode;
+}

+ 84 - 0
iot-platform-manager/src/main/java/com/platform/request/deviceGroup/IotDeviceGroupRequest.java

@@ -0,0 +1,84 @@
+package com.platform.request.deviceGroup;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import lombok.Data;
+
+import java.io.Serial;
+import java.io.Serializable;
+import java.time.LocalDateTime;
+
+/**
+ * 设备分组表实体类
+ * @author cxf
+ */
+@Data
+public class IotDeviceGroupRequest implements Serializable {
+
+    @Serial
+    private static final long serialVersionUID = 5529931062653486264L;
+    /**
+     * 主键ID
+     */
+    private Long id;
+
+    /**
+     * 设备分组码值
+     */
+
+    private String deviceGroupCode;
+
+    /**
+     * 租户id
+     */
+
+    private String tenantId;
+
+    /**
+     * 所属客户id
+     */
+
+    private Long companyId;
+
+    /**
+     * 设备分组名称
+     */
+
+    private String title;
+
+    /**
+     * [有点晕?]1-12(车辆、装载机、矿卡、人员、水表、电表、边坡监控、视频监控、皮带称重、环境监测、无人地磅、排放监测)
+     */
+
+    private Integer largeType;
+
+    /**
+     * 0-未删除,1-删除
+     */
+
+    private Integer delFlag;
+
+    /**
+     * 创建时间
+     */
+
+    private LocalDateTime createTime;
+
+    /**
+     * 更新时间
+     */
+
+    private LocalDateTime updateTime;
+
+    /**
+     * 创建人
+     */
+
+    private String createUser;
+
+    /**
+     * 更新人
+     */
+    private String updateUser;
+}

+ 0 - 12
iot-platform-manager/src/main/java/com/platform/response/Demo.java

@@ -1,12 +0,0 @@
-package com.platform.response;
-
-/**
- * @Author: 马超伟
- * @CreateTime: 2025-10-09
- * @Description:
- * @Version: 1.0
- */
-
-
-public class Demo {
-}

+ 103 - 0
iot-platform-manager/src/main/java/com/platform/response/deviceGroup/DeviceGroupDetailResp.java

@@ -0,0 +1,103 @@
+package com.platform.response.deviceGroup;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.platform.entity.IotDevice;
+import com.platform.entity.IotDeviceGroup;
+import lombok.Data;
+
+import java.io.Serial;
+import java.io.Serializable;
+import java.time.LocalDateTime;
+
+
+
+
+/**
+ * @author PC
+ */
+@Data
+public class DeviceGroupDetailResp implements Serializable {
+
+
+    @Serial
+    private static final long serialVersionUID = -3891584296778137376L;
+    /**
+     * 主键ID
+     */
+    private Long id;
+
+    /**
+     * 设备分组码值
+     */
+    private String deviceGroupCode;
+
+    /**
+     * 租户id
+     */
+    private String tenantId;
+
+    /**
+     * 所属客户id
+     */
+
+    private Long companyId;
+
+    /**
+     * 设备分组名称
+     */
+
+    private String title;
+
+    /**
+     * [有点晕?]1-12(车辆、装载机、矿卡、人员、水表、电表、边坡监控、视频监控、皮带称重、环境监测、无人地磅、排放监测)
+     */
+    private Integer largeType;
+
+    /**
+     * 0-未删除,1-删除
+     */
+    private Integer delFlag;
+
+    /**
+     * 创建时间
+     */
+    private String createTime;
+
+    /**
+     * 更新时间
+     */
+
+    private String updateTime;
+
+    /**
+     * 创建人
+     */
+    private String createUser;
+
+    /**
+     * 更新人
+     */
+    private String updateUser;
+
+    public static DeviceGroupDetailResp getInstance(){
+        return new DeviceGroupDetailResp();
+    }
+
+    public static DeviceGroupDetailResp toDeviceGroupDetailResp(IotDeviceGroup iotDeviceGroup) {
+        DeviceGroupDetailResp instance = DeviceGroupDetailResp.getInstance();
+        instance.setId(iotDeviceGroup.getId());
+        instance.setDeviceGroupCode(iotDeviceGroup.getDeviceGroupCode());
+        instance.setTenantId(iotDeviceGroup.getTenantId());
+        instance.setCompanyId(iotDeviceGroup.getCompanyId());
+        instance.setTitle(iotDeviceGroup.getTitle());
+        instance.setLargeType(iotDeviceGroup.getLargeType());
+        instance.setDelFlag(iotDeviceGroup.getDelFlag());
+        instance.setCreateTime("");
+        instance.setUpdateTime("");
+        instance.setCreateUser(iotDeviceGroup.getCreateUser());
+        instance.setUpdateUser(iotDeviceGroup.getUpdateUser());
+        return instance;
+    }
+}

+ 127 - 0
iot-platform-manager/src/main/java/com/platform/response/deviceGroup/DeviceGroupPageResp.java

@@ -0,0 +1,127 @@
+package com.platform.response.deviceGroup;
+
+import lombok.Data;
+
+import java.io.Serial;
+import java.io.Serializable;
+
+/**
+ * @Author: 马超伟
+ * @CreateTime: 2025-10-09
+ * @Description:
+ * @Version: 1.0
+ */
+
+
+@Data
+public class DeviceGroupPageResp implements Serializable {
+
+    @Serial
+    private static final long serialVersionUID = 4129323442919345144L;
+
+
+    private Long id;
+
+    /**
+     * 租户id
+     */
+    private String tenantId;
+
+    /**
+     * 所属客户id
+     */
+    private Long companyId;
+
+    /**
+     * 唯一标识[暂时保留]
+     */
+    private String guid;
+
+    /**
+     * 设备编号
+     */
+    private String deviceCode;
+
+    /**
+     * sn通常是:IMEI
+     */
+    private String sn;
+
+    /**
+     * 物联网模型码值
+     */
+    private String modCode;
+
+    /**
+     * 物联网模型名称
+     */
+    private String modName;
+
+    /**
+     * 设备名称[旧系统的title]
+     */
+    private String deviceName;
+
+    /**
+     * 设备品牌名称
+     */
+
+    private String brand;
+
+    /**
+     * 型号
+     */
+
+    private String modelCode;
+
+    /**
+     * 最后一次设备更新信息值[旧系统的desc]
+     */
+    private String description;
+
+    /**
+     * 备注
+     */
+    private String remarks;
+
+    /**
+     * 1在线2离线3异常
+     */
+    private Integer status;
+
+    /**
+     * 经度[lng]
+     */
+    private String longitude;
+
+    /**
+     * 纬度[lat]
+     */
+    private String latitude;
+
+    /**
+     * 高度
+     */
+    private String high;
+
+
+    /**
+     * 创建人
+     */
+    private String createUser;
+
+    /**
+     * 更新人
+     */
+    private String updateUser;
+
+    /**
+     * 0-未删除,1-删除
+     */
+    private Integer delFlag;
+
+    /**
+     * 设备类别
+     */
+    private Long egId;
+}

+ 39 - 0
iot-platform-manager/src/main/java/com/platform/service/IotDeviceGroupService.java

@@ -1,5 +1,6 @@
 package com.platform.service;
 
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.platform.entity.IotDeviceGroup;
 
@@ -12,4 +13,42 @@ import com.platform.entity.IotDeviceGroup;
 
 
 public interface IotDeviceGroupService extends IService<IotDeviceGroup> {
+    IotDeviceGroup getOneByTitle(String title);
+
+    /**
+     *  添加物联设备分组
+     * @param iotDeviceGroup 设备分组信息
+     * @return 结果
+     */
+    Boolean addDeviceGroup(IotDeviceGroup iotDeviceGroup);
+
+    /**
+     *  修改物联设备分组
+     * @param iotDeviceGroup 设备分组信息
+     * @return 修改结果
+     */
+    Boolean updateDeviceGroup(IotDeviceGroup iotDeviceGroup);
+
+    /**
+     * 删除设备分组
+     * @param deviceGroupCode 设备分组码值
+     * @return 删除结果
+     */
+    Boolean delDeviceGroup(String deviceGroupCode);
+
+    /**
+     *  设备分组详情查询
+     * @param iotDeviceGroup 设备分组信息
+     * @return  设备分组详情
+     */
+    IotDeviceGroup getDeviceGroupDetail(IotDeviceGroup iotDeviceGroup);
+
+    /**
+     * 分页查询设备分组
+     * @param current 当前页
+     * @param pageSize 每页数量
+     * @param iotDeviceGroup 设备分组信息
+     * @return 分页结果
+     */
+    Page pageGroupDevice(Integer current ,Integer pageSize,IotDeviceGroup iotDeviceGroup);
 }

+ 50 - 0
iot-platform-manager/src/main/java/com/platform/service/impl/IotDeviceGroupServiceImpl.java

@@ -1,9 +1,12 @@
 package com.platform.service.impl;
 
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.platform.entity.IotDeviceGroup;
 import com.platform.mapper.IotDeviceGroupMapper;
 import com.platform.service.IotDeviceGroupService;
+import org.checkerframework.common.returnsreceiver.qual.This;
 import org.springframework.stereotype.Service;
 
 /**
@@ -15,4 +18,51 @@ import org.springframework.stereotype.Service;
 
 @Service
 public class IotDeviceGroupServiceImpl extends ServiceImpl<IotDeviceGroupMapper, IotDeviceGroup> implements IotDeviceGroupService {
+    @Override
+    public IotDeviceGroup getOneByTitle(String title) {
+        return getOne( Wrappers.<IotDeviceGroup>lambdaQuery()
+                .eq(IotDeviceGroup::getTitle,title)
+                .eq(IotDeviceGroup::getDelFlag,0)
+                .last("limit 1"));
+    }
+
+    @Override
+    public Boolean addDeviceGroup(IotDeviceGroup iotDeviceGroup) {
+        return save(iotDeviceGroup);
+    }
+
+    @Override
+    public Boolean updateDeviceGroup(IotDeviceGroup iotDeviceGroup) {
+
+        return update(iotDeviceGroup,Wrappers.<IotDeviceGroup>lambdaUpdate()
+                .eq(IotDeviceGroup::getDeviceGroupCode,iotDeviceGroup.getDeviceGroupCode())
+                .eq(IotDeviceGroup::getDelFlag,0));
+    }
+
+    @Override
+    public Boolean delDeviceGroup(String deviceGroupCode) {
+        IotDeviceGroup iotDeviceGroup = new IotDeviceGroup();
+        iotDeviceGroup.setDelFlag(1);
+        return update(iotDeviceGroup,Wrappers.<IotDeviceGroup>lambdaUpdate()
+                .eq(IotDeviceGroup::getDeviceGroupCode,deviceGroupCode));
+    }
+
+    @Override
+    public IotDeviceGroup getDeviceGroupDetail(IotDeviceGroup iotDeviceGroup) {
+        return getOne(Wrappers.<IotDeviceGroup>lambdaQuery()
+                .eq(IotDeviceGroup::getDeviceGroupCode,iotDeviceGroup.getDeviceGroupCode())
+                .eq(IotDeviceGroup::getDelFlag,0)
+                .last("limit 1"));
+    }
+
+    @Override
+    public Page pageGroupDevice(Integer current, Integer pageSize, IotDeviceGroup iotDeviceGroup) {
+        Page<IotDeviceGroup> page = new Page<>(current, pageSize);
+        return page(page,Wrappers.<IotDeviceGroup>lambdaQuery()
+                .eq(IotDeviceGroup::getDelFlag,0)
+                .orderByDesc(IotDeviceGroup::getCreateTime)
+                .orderByDesc(IotDeviceGroup::getId));
+    }
+
+
 }