物联设备管理
This commit is contained in:
parent
2e7480594d
commit
a7a3868364
|
|
@ -1,5 +0,0 @@
|
|||
<?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.nu.modules.config.mapper.DeviceConfigMapper">
|
||||
|
||||
</mapper>
|
||||
|
|
@ -1,13 +0,0 @@
|
|||
package com.nu.modules.config.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.nu.modules.config.entity.DeviceConfig;
|
||||
|
||||
/**
|
||||
* @Description: 设备配置
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2026-03-27
|
||||
* @Version: V1.0
|
||||
*/
|
||||
public interface IDeviceInfoService extends IService<DeviceConfig> {
|
||||
}
|
||||
|
|
@ -1,20 +0,0 @@
|
|||
package com.nu.modules.config.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.nu.modules.config.entity.DeviceConfig;
|
||||
import com.nu.modules.config.mapper.DeviceConfigMapper;
|
||||
import com.nu.modules.config.service.IDeviceInfoService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* @Description: 设备配置
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2026-03-27
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
public class DeviceConfigServiceImpl extends ServiceImpl<DeviceConfigMapper, DeviceConfig> implements IDeviceInfoService {
|
||||
|
||||
}
|
||||
|
|
@ -1,19 +1,14 @@
|
|||
package com.nu.modules.config.controller;
|
||||
package com.nu.modules.device.config.controller;
|
||||
|
||||
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.nu.modules.config.entity.DeviceConfig;
|
||||
import com.nu.modules.config.service.IDeviceInfoService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import com.nu.modules.device.config.entity.DeviceConfig;
|
||||
import com.nu.modules.device.config.service.IDeviceConfigService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.common.aspect.annotation.AutoLog;
|
||||
import org.jeecg.common.system.base.controller.JeecgController;
|
||||
import org.jeecg.common.system.query.QueryGenerator;
|
||||
import org.jeecg.common.system.query.QueryRuleEnum;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
|
@ -21,8 +16,7 @@ import org.springframework.web.servlet.ModelAndView;
|
|||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Description: 设备配置
|
||||
|
|
@ -33,9 +27,9 @@ import java.util.Map;
|
|||
@RestController
|
||||
@RequestMapping("/iot/device/config")
|
||||
@Slf4j
|
||||
public class DeviceConfigController extends JeecgController<DeviceConfig, IDeviceInfoService> {
|
||||
public class DeviceConfigController extends JeecgController<DeviceConfig, IDeviceConfigService> {
|
||||
@Autowired
|
||||
private IDeviceInfoService service;
|
||||
private IDeviceConfigService service;
|
||||
|
||||
/**
|
||||
* 分页列表查询
|
||||
|
|
@ -56,6 +50,11 @@ public class DeviceConfigController extends JeecgController<DeviceConfig, IDevic
|
|||
IPage<DeviceConfig> pageList = service.page(page, queryWrapper);
|
||||
return Result.OK(pageList);
|
||||
}
|
||||
|
||||
@GetMapping(value = "/queryList")
|
||||
public Result<List<DeviceConfig>> queryList(DeviceConfig deviceConfig) {
|
||||
return Result.OK(service.queryList(deviceConfig));
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package com.nu.modules.config.entity;
|
||||
package com.nu.modules.device.config.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
|
|
@ -1,7 +1,9 @@
|
|||
package com.nu.modules.config.mapper;
|
||||
package com.nu.modules.device.config.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.nu.modules.config.entity.DeviceConfig;
|
||||
import com.nu.modules.device.config.entity.DeviceConfig;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Description: 设备配置
|
||||
|
|
@ -10,5 +12,5 @@ import com.nu.modules.config.entity.DeviceConfig;
|
|||
* @Version: V1.0
|
||||
*/
|
||||
public interface DeviceConfigMapper extends BaseMapper<DeviceConfig> {
|
||||
|
||||
List<DeviceConfig> queryList(DeviceConfig deviceConfig);
|
||||
}
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
<?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.nu.modules.device.config.mapper.DeviceConfigMapper">
|
||||
|
||||
<select id="queryList" parameterType="com.nu.modules.device.config.entity.DeviceConfig" resultType="com.nu.modules.device.config.entity.DeviceConfig">
|
||||
select
|
||||
id,
|
||||
device_type,
|
||||
device_model,
|
||||
factory,
|
||||
dimension
|
||||
from nu_iot_device_config
|
||||
<where>
|
||||
<if test="dimension != null and dimension != ''">
|
||||
AND dimension = #{dimension}
|
||||
</if>
|
||||
</where>
|
||||
order by device_type,id
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
package com.nu.modules.device.config.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.nu.modules.device.config.entity.DeviceConfig;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Description: 设备配置
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2026-03-27
|
||||
* @Version: V1.0
|
||||
*/
|
||||
public interface IDeviceConfigService extends IService<DeviceConfig> {
|
||||
List<DeviceConfig> queryList(DeviceConfig deviceConfig);
|
||||
}
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
package com.nu.modules.device.config.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.nu.modules.device.config.entity.DeviceConfig;
|
||||
import com.nu.modules.device.config.mapper.DeviceConfigMapper;
|
||||
import com.nu.modules.device.config.service.IDeviceConfigService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Description: 设备配置
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2026-03-27
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
public class DeviceConfigServiceImpl extends ServiceImpl<DeviceConfigMapper, DeviceConfig> implements IDeviceConfigService {
|
||||
@Override
|
||||
public List<DeviceConfig> queryList(DeviceConfig deviceConfig){
|
||||
return baseMapper.queryList(deviceConfig);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,310 @@
|
|||
package com.nu.modules.device.manager.controller;
|
||||
|
||||
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.nu.modules.device.config.entity.DeviceConfig;
|
||||
import com.nu.modules.device.manager.entity.DeviceIntegration;
|
||||
import com.nu.modules.device.manager.entity.DeviceManager;
|
||||
import com.nu.modules.device.manager.entity.DevicePreview;
|
||||
import com.nu.modules.device.manager.service.IDeviceManagerService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.common.system.base.controller.JeecgController;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Description: 设备管理
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2026-03-30
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/iot/device/manager")
|
||||
@Slf4j
|
||||
public class DeviceManagerController extends JeecgController<DeviceManager, IDeviceManagerService> {
|
||||
@Autowired
|
||||
private IDeviceManagerService service;
|
||||
|
||||
/**
|
||||
* 分页列表查询
|
||||
*
|
||||
* @param DeviceManager
|
||||
* @param pageNo
|
||||
* @param pageSize
|
||||
* @param req
|
||||
* @return
|
||||
*/
|
||||
@GetMapping(value = "/list")
|
||||
public Result<IPage<DeviceManager>> queryPageList(DeviceManager DeviceManager,
|
||||
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
|
||||
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
|
||||
HttpServletRequest req) {
|
||||
Page<DeviceManager> page = new Page<DeviceManager>(pageNo, pageSize);
|
||||
IPage<DeviceManager> pageList = service.findPage(page, DeviceManager);
|
||||
return Result.OK(pageList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加
|
||||
*
|
||||
* @param DeviceManager
|
||||
* @return
|
||||
*/
|
||||
@PostMapping(value = "/add")
|
||||
public Result<String> add(@RequestBody DeviceManager DeviceManager) {
|
||||
service.save(DeviceManager);
|
||||
return Result.OK("添加成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*
|
||||
* @param DeviceManager
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST})
|
||||
public Result<String> edit(@RequestBody DeviceManager DeviceManager) {
|
||||
service.updateById(DeviceManager);
|
||||
return Result.OK("编辑成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id删除
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@DeleteMapping(value = "/delete")
|
||||
public Result<String> delete(@RequestParam(name="id",required=true) String id) {
|
||||
service.removeById(id);
|
||||
return Result.OK("删除成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
@DeleteMapping(value = "/deleteBatch")
|
||||
public Result<String> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
|
||||
this.service.removeByIds(Arrays.asList(ids.split(",")));
|
||||
return Result.OK("批量删除成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id查询
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@GetMapping(value = "/queryById")
|
||||
public Result<DeviceManager> queryById(@RequestParam(name="id",required=true) String id) {
|
||||
DeviceManager DeviceManager = service.getById(id);
|
||||
if(DeviceManager==null) {
|
||||
return Result.error("未找到对应数据");
|
||||
}
|
||||
return Result.OK(DeviceManager);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出excel
|
||||
*
|
||||
* @param request
|
||||
* @param DeviceManager
|
||||
*/
|
||||
@RequestMapping(value = "/exportXls")
|
||||
public ModelAndView exportXls(HttpServletRequest request, DeviceManager DeviceManager) {
|
||||
return super.exportXls(request, DeviceManager, DeviceManager.class, "物联设备配置");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过excel导入数据
|
||||
*
|
||||
* @param request
|
||||
* @param response
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
|
||||
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
|
||||
return super.importExcel(request, response, DeviceManager.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* 设备集成-机构设备清单分页列表查询
|
||||
*
|
||||
* @param devicePreview
|
||||
* @param pageNo
|
||||
* @param pageSize
|
||||
* @param req
|
||||
* @return
|
||||
*/
|
||||
@GetMapping(value = "/departPreview")
|
||||
public Result<IPage<DevicePreview>> departPreview(DevicePreview devicePreview,
|
||||
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
|
||||
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
|
||||
HttpServletRequest req) {
|
||||
Page<DevicePreview> page = new Page<DevicePreview>(pageNo, pageSize);
|
||||
IPage<DevicePreview> pageList = service.findDepartPreviewPage(page, devicePreview);
|
||||
return Result.OK(pageList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 设备集成-区域列表查询
|
||||
*
|
||||
* @param devicePreview
|
||||
* @return
|
||||
*/
|
||||
@GetMapping(value = "/nuList")
|
||||
public Result<List<DevicePreview>> nuList(DevicePreview devicePreview) {
|
||||
return Result.OK(service.queryNuList(devicePreview));
|
||||
}
|
||||
|
||||
/**
|
||||
* 设备集成-区域设备清单分页列表查询
|
||||
*
|
||||
* @param devicePreview
|
||||
* @param pageNo
|
||||
* @param pageSize
|
||||
* @param req
|
||||
* @return
|
||||
*/
|
||||
@GetMapping(value = "/nuPreview")
|
||||
public Result<IPage<DevicePreview>> nuPreview(DevicePreview devicePreview,
|
||||
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
|
||||
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
|
||||
HttpServletRequest req) {
|
||||
Page<DevicePreview> page = new Page<DevicePreview>(pageNo, pageSize);
|
||||
IPage<DevicePreview> pageList = service.findNuPreviewPage(page, devicePreview);
|
||||
return Result.OK(pageList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 增加设备清单
|
||||
*
|
||||
* @param devicePreview
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/savePreview", method = RequestMethod.POST)
|
||||
public Result<String> savePreview(@RequestBody DevicePreview devicePreview) {
|
||||
service.addPreview(devicePreview);
|
||||
return Result.OK("添加成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id删除
|
||||
*
|
||||
* @param devicePreview
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/deletePreview", method = RequestMethod.POST)
|
||||
public Result<String> deletePreview(@RequestBody DevicePreview devicePreview) {
|
||||
service.deletePreview(devicePreview);
|
||||
return Result.OK("删除成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 设备集成-监控设备分页列表查询
|
||||
*
|
||||
* @param deviceIntegration
|
||||
* @param pageNo
|
||||
* @param pageSize
|
||||
* @param req
|
||||
* @return
|
||||
*/
|
||||
@GetMapping(value = "/cameraList")
|
||||
public Result<IPage<DeviceIntegration>> cameraList(DeviceIntegration deviceIntegration,
|
||||
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
|
||||
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
|
||||
HttpServletRequest req) {
|
||||
Page<DeviceIntegration> page = new Page<DeviceIntegration>(pageNo, pageSize);
|
||||
IPage<DeviceIntegration> pageList = service.findCameraPage(page, deviceIntegration);
|
||||
return Result.OK(pageList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 设备集成-网络设备分页列表查询
|
||||
*
|
||||
* @param deviceIntegration
|
||||
* @param pageNo
|
||||
* @param pageSize
|
||||
* @param req
|
||||
* @return
|
||||
*/
|
||||
@GetMapping(value = "/networkList")
|
||||
public Result<IPage<DeviceIntegration>> networkList(DeviceIntegration deviceIntegration,
|
||||
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
|
||||
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
|
||||
HttpServletRequest req) {
|
||||
Page<DeviceIntegration> page = new Page<DeviceIntegration>(pageNo, pageSize);
|
||||
IPage<DeviceIntegration> pageList = service.findNetworkPage(page, deviceIntegration);
|
||||
return Result.OK(pageList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 设备集成-电表分页列表查询
|
||||
*
|
||||
* @param deviceIntegration
|
||||
* @param pageNo
|
||||
* @param pageSize
|
||||
* @param req
|
||||
* @return
|
||||
*/
|
||||
@GetMapping(value = "/electricityList")
|
||||
public Result<IPage<DeviceIntegration>> electricityList(DeviceIntegration deviceIntegration,
|
||||
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
|
||||
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
|
||||
HttpServletRequest req) {
|
||||
Page<DeviceIntegration> page = new Page<DeviceIntegration>(pageNo, pageSize);
|
||||
IPage<DeviceIntegration> pageList = service.findElectricityPage(page, deviceIntegration);
|
||||
return Result.OK(pageList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 设备集成-水表分页列表查询
|
||||
*
|
||||
* @param deviceIntegration
|
||||
* @param pageNo
|
||||
* @param pageSize
|
||||
* @param req
|
||||
* @return
|
||||
*/
|
||||
@GetMapping(value = "/waterList")
|
||||
public Result<IPage<DeviceIntegration>> waterList(DeviceIntegration deviceIntegration,
|
||||
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
|
||||
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
|
||||
HttpServletRequest req) {
|
||||
Page<DeviceIntegration> page = new Page<DeviceIntegration>(pageNo, pageSize);
|
||||
IPage<DeviceIntegration> pageList = service.findWaterPage(page, deviceIntegration);
|
||||
return Result.OK(pageList);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 设备集成-温湿度计分页列表查询
|
||||
*
|
||||
* @param deviceIntegration
|
||||
* @param pageNo
|
||||
* @param pageSize
|
||||
* @param req
|
||||
* @return
|
||||
*/
|
||||
@GetMapping(value = "/humidList")
|
||||
public Result<IPage<DeviceIntegration>> humidList(DeviceIntegration deviceIntegration,
|
||||
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
|
||||
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
|
||||
HttpServletRequest req) {
|
||||
Page<DeviceIntegration> page = new Page<DeviceIntegration>(pageNo, pageSize);
|
||||
IPage<DeviceIntegration> pageList = service.findHumidPage(page, deviceIntegration);
|
||||
return Result.OK(pageList);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
package com.nu.modules.device.manager.entity;
|
||||
|
||||
import lombok.Data;
|
||||
import org.jeecg.common.aspect.annotation.Dict;
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
public class DeviceIntegration implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private String id;
|
||||
private String departId;
|
||||
private String dimension;
|
||||
@Dict(dicCode = "tplink_device_type")
|
||||
private String deviceType;
|
||||
private String deviceModel;
|
||||
private String factory;
|
||||
//在线状态
|
||||
private String deviceStatus;
|
||||
//设备状态
|
||||
private String maintainStatus;
|
||||
}
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
package com.nu.modules.device.manager.entity;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
public class DeviceManager implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private String id;
|
||||
private String orgCode;
|
||||
private String departName;
|
||||
private String orgLeader;
|
||||
private String auditStatus;
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd")
|
||||
private Date auditTime;
|
||||
}
|
||||
|
|
@ -0,0 +1,30 @@
|
|||
package com.nu.modules.device.manager.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import org.jeecg.common.aspect.annotation.Dict;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
public class DevicePreview implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
/**ID*/
|
||||
@TableId(type = IdType.AUTO)
|
||||
@ApiModelProperty(value = "ID")
|
||||
private Integer id;
|
||||
private String orgCode;
|
||||
private String departName;
|
||||
private String nuId;
|
||||
private String nuName;
|
||||
@Dict(dicCode = "tplink_device_type")
|
||||
private String deviceType;
|
||||
private String deviceModel;
|
||||
private String factory;
|
||||
private String dimension;
|
||||
private Integer purchaseQuantity;
|
||||
}
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
package com.nu.modules.device.manager.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.nu.modules.device.manager.entity.DeviceIntegration;
|
||||
import com.nu.modules.device.manager.entity.DeviceManager;
|
||||
import com.nu.modules.device.manager.entity.DevicePreview;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Description: 设备管理-机构信息
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2026-03-30
|
||||
* @Version: V1.0
|
||||
*/
|
||||
public interface DeviceManagerMapper extends BaseMapper<DeviceManager> {
|
||||
IPage<DeviceManager> findPage(Page<DeviceManager> page, @Param("params") DeviceManager deviceManager);
|
||||
List<DevicePreview> queryNuList(DevicePreview devicePreview);
|
||||
IPage<DevicePreview> findDepartPreviewPage(Page<DevicePreview> page, @Param("params") DevicePreview devicePreview);
|
||||
IPage<DevicePreview> findNuPreviewPage(Page<DevicePreview> page, @Param("params") DevicePreview devicePreview);
|
||||
DevicePreview getPreview(DevicePreview devicePreview);
|
||||
void addPreview(DevicePreview devicePreview);
|
||||
void updatePreview(DevicePreview devicePreview);
|
||||
void deletePreview(DevicePreview devicePreview);
|
||||
IPage<DeviceIntegration> findCameraPage(Page<DeviceIntegration> page, @Param("params") DeviceIntegration deviceIntegration);
|
||||
IPage<DeviceIntegration> findNetworkPage(Page<DeviceIntegration> page, @Param("params") DeviceIntegration deviceIntegration);
|
||||
IPage<DeviceIntegration> findElectricityPage(Page<DeviceIntegration> page, @Param("params") DeviceIntegration deviceIntegration);
|
||||
IPage<DeviceIntegration> findWaterPage(Page<DeviceIntegration> page, @Param("params") DeviceIntegration deviceIntegration);
|
||||
IPage<DeviceIntegration> findHumidPage(Page<DeviceIntegration> page, @Param("params") DeviceIntegration deviceIntegration);
|
||||
}
|
||||
|
|
@ -0,0 +1,218 @@
|
|||
<?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.nu.modules.device.manager.mapper.DeviceManagerMapper">
|
||||
|
||||
<select id="findPage" parameterType="com.nu.modules.device.manager.entity.DeviceManager" resultType="com.nu.modules.device.manager.entity.DeviceManager">
|
||||
select a.id,
|
||||
a.org_code,
|
||||
a.depart_name,
|
||||
b.org_leader,
|
||||
b.audit_status,
|
||||
b.audit_time
|
||||
from sys_depart a
|
||||
inner join nu_org_info b on a.id = b.id
|
||||
<where>
|
||||
<if test="params.orgCode != null and params.orgCode != ''">
|
||||
AND a.org_code LIKE concat('%',#{params.orgCode},'%')
|
||||
</if>
|
||||
<if test="params.departName != null and params.departName != ''">
|
||||
AND a.depart_name LIKE concat('%',#{params.departName},'%')
|
||||
</if>
|
||||
</where>
|
||||
order by a.org_code desc
|
||||
</select>
|
||||
|
||||
<select id="queryNuList" parameterType="com.nu.modules.device.manager.entity.DevicePreview" resultType="com.nu.modules.device.manager.entity.DevicePreview">
|
||||
select nu_id,nu_name
|
||||
from nu_base_info
|
||||
where status != '5'
|
||||
and sys_org_code = #{orgCode}
|
||||
order by nu_id asc
|
||||
</select>
|
||||
|
||||
<select id="findDepartPreviewPage" parameterType="com.nu.modules.device.manager.entity.DevicePreview" resultType="com.nu.modules.device.manager.entity.DevicePreview">
|
||||
select
|
||||
a.org_code,
|
||||
b.depart_name,
|
||||
a.device_type,
|
||||
a.device_model,
|
||||
a.factory,
|
||||
a.dimension,
|
||||
sum(purchase_quantity) as purchaseQuantity
|
||||
from nu_iot_device_preview a
|
||||
inner join sys_depart b on a.org_code = b.org_code
|
||||
where a.org_code = #{params.orgCode}
|
||||
<if test="params.dimension != null and params.dimension != ''">
|
||||
AND a.dimension = #{params.dimension}
|
||||
</if>
|
||||
<if test="params.deviceType != null and params.deviceType != ''">
|
||||
AND a.device_type = #{params.deviceType}
|
||||
</if>
|
||||
group by a.org_code,b.depart_name,a.device_type,a.device_model,a.factory,a.dimension
|
||||
order by a.device_type asc
|
||||
</select>
|
||||
|
||||
<select id="findNuPreviewPage" parameterType="com.nu.modules.device.manager.entity.DevicePreview" resultType="com.nu.modules.device.manager.entity.DevicePreview">
|
||||
select a.id,
|
||||
a.org_code,
|
||||
b.depart_name,
|
||||
a.nu_id,
|
||||
c.nu_name,
|
||||
a.device_type,
|
||||
a.device_model,
|
||||
a.factory,
|
||||
a.dimension,
|
||||
purchase_quantity
|
||||
from nu_iot_device_preview a
|
||||
inner join sys_depart b on a.org_code = b.org_code
|
||||
left join nu_base_info c on a.nu_id = c.nu_id
|
||||
where a.org_code = #{params.orgCode}
|
||||
<if test="params.nuName != null and params.nuName != ''">
|
||||
AND c.nu_name LIKE concat('%',#{params.nuName},'%')
|
||||
</if>
|
||||
<if test="params.dimension != null and params.dimension != ''">
|
||||
AND a.dimension = #{params.dimension}
|
||||
</if>
|
||||
<if test="params.deviceType != null and params.deviceType != ''">
|
||||
AND a.device_type = #{params.deviceType}
|
||||
</if>
|
||||
order by a.nu_id,a.device_type,a.id asc
|
||||
</select>
|
||||
|
||||
<select id="getPreview" parameterType="com.nu.modules.device.manager.entity.DevicePreview" resultType="com.nu.modules.device.manager.entity.DevicePreview">
|
||||
select id,
|
||||
org_code,
|
||||
nu_id,
|
||||
device_type,
|
||||
device_model,
|
||||
factory,
|
||||
dimension,
|
||||
purchase_quantity
|
||||
from nu_iot_device_preview
|
||||
<where> org_code = #{orgCode}
|
||||
<if test="dimension != null and dimension != ''">
|
||||
AND dimension = #{dimension}
|
||||
</if>
|
||||
<if test="orgCode != null and orgCode != ''">
|
||||
AND org_code = #{orgCode}
|
||||
</if>
|
||||
<if test="deviceType != null and deviceType != ''">
|
||||
AND device_type = #{deviceType}
|
||||
</if>
|
||||
<if test="deviceModel != null and deviceModel != ''">
|
||||
AND device_model = #{deviceModel}
|
||||
</if>
|
||||
<if test="factory != null and factory != ''">
|
||||
AND factory = #{factory}
|
||||
</if>
|
||||
<if test="nuId != null and nuId != ''">
|
||||
AND nu_id = #{nuId}
|
||||
</if>
|
||||
</where>
|
||||
limit 1
|
||||
</select>
|
||||
|
||||
<insert id="addPreview">
|
||||
insert into nu_iot_device_preview(
|
||||
org_code,
|
||||
nu_id,
|
||||
device_type,
|
||||
device_model,
|
||||
factory,
|
||||
dimension,
|
||||
purchase_quantity
|
||||
)
|
||||
values(
|
||||
#{orgCode},
|
||||
#{nuId},
|
||||
#{deviceType},
|
||||
#{deviceModel},
|
||||
#{factory},
|
||||
#{dimension},
|
||||
#{purchaseQuantity}
|
||||
)
|
||||
</insert>
|
||||
|
||||
<update id="updatePreview">
|
||||
update nu_iot_device_preview
|
||||
set purchase_quantity = #{purchaseQuantity}
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="deletePreview">
|
||||
delete from nu_iot_device_preview where id = #{id}
|
||||
</delete>
|
||||
|
||||
<select id="findCameraPage" parameterType="com.nu.modules.device.manager.entity.DeviceIntegration" resultType="com.nu.modules.device.manager.entity.DeviceIntegration">
|
||||
select
|
||||
a.dimension,
|
||||
a.device_type,
|
||||
a.device_model,
|
||||
b.factory,
|
||||
( case a.device_status when '0' then '离线' when '1' then '在线' end ) as device_status,
|
||||
a.maintain_status
|
||||
from nu_iot_tplink_camera a
|
||||
inner join nu_iot_device_config b on a.device_config_id = b.id
|
||||
where a.depart_id = #{params.departId}
|
||||
AND a.device_type in ('SURVEILLANCECAMERA','NETWORKVIDEORECORDER')
|
||||
order by a.id
|
||||
</select>
|
||||
|
||||
<select id="findNetworkPage" parameterType="com.nu.modules.device.manager.entity.DeviceIntegration" resultType="com.nu.modules.device.manager.entity.DeviceIntegration">
|
||||
select
|
||||
a.dimension,
|
||||
a.device_type,
|
||||
b.device_model,
|
||||
b.factory,
|
||||
( case a.device_status when '0' then '离线' when '1' then '在线' end ) as device_status,
|
||||
a.maintain_status
|
||||
from nu_iot_tplink_camera a
|
||||
inner join nu_iot_device_config b on a.device_config_id = b.id
|
||||
where a.depart_id = #{params.departId}
|
||||
AND a.device_type in ('SWITCH','ROUTER','AP')
|
||||
order by a.id
|
||||
</select>
|
||||
|
||||
<select id="findElectricityPage" parameterType="com.nu.modules.device.manager.entity.DeviceIntegration" resultType="com.nu.modules.device.manager.entity.DeviceIntegration">
|
||||
select
|
||||
a.dimension,
|
||||
'db' as device_type,
|
||||
b.device_model,
|
||||
b.factory,
|
||||
( case a.relay_state when '0' then '拉闸' else '合闸' end ) as device_status,
|
||||
a.maintain_status
|
||||
from nu_iot_ds_electricity_meter a
|
||||
inner join nu_iot_device_config b on a.device_config_id = b.id
|
||||
where a.depart_id = #{params.departId}
|
||||
order by a.id
|
||||
</select>
|
||||
|
||||
<select id="findWaterPage" parameterType="com.nu.modules.device.manager.entity.DeviceIntegration" resultType="com.nu.modules.device.manager.entity.DeviceIntegration">
|
||||
select
|
||||
a.dimension,
|
||||
'sb' as device_type,
|
||||
b.device_model,
|
||||
b.factory,
|
||||
( case a.relay_state when '0' then '关阀' else '开阀' end ) as device_status,
|
||||
a.maintain_status
|
||||
from nu_iot_tq_water_meter a
|
||||
inner join nu_iot_device_config b on a.device_config_id = b.id
|
||||
where a.depart_id = #{params.departId}
|
||||
order by a.id
|
||||
</select>
|
||||
|
||||
<select id="findHumidPage" parameterType="com.nu.modules.device.manager.entity.DeviceIntegration" resultType="com.nu.modules.device.manager.entity.DeviceIntegration">
|
||||
select
|
||||
a.dimension,
|
||||
'wsdj' as device_type,
|
||||
b.device_model,
|
||||
b.factory,
|
||||
( case status when '0' then '在线' else '离线' end ) as device_status,
|
||||
a.maintain_status
|
||||
from nu_iot_yiweilian_humid_device a
|
||||
inner join nu_iot_device_config b on a.device_config_id = b.id
|
||||
where a.depart_id = #{params.departId}
|
||||
order by a.id
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
package com.nu.modules.device.manager.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.nu.modules.device.manager.entity.DeviceIntegration;
|
||||
import com.nu.modules.device.manager.entity.DeviceManager;
|
||||
import com.nu.modules.device.manager.entity.DevicePreview;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Description: 设备管理-机构信息
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2026-03-30
|
||||
* @Version: V1.0
|
||||
*/
|
||||
public interface IDeviceManagerService extends IService<DeviceManager> {
|
||||
IPage<DeviceManager> findPage(Page<DeviceManager> page, DeviceManager deviceManager);
|
||||
List<DevicePreview> queryNuList(DevicePreview devicePreview);
|
||||
IPage<DevicePreview> findDepartPreviewPage(Page<DevicePreview> page, DevicePreview devicePreview);
|
||||
IPage<DevicePreview> findNuPreviewPage(Page<DevicePreview> page, DevicePreview devicePreview);
|
||||
void addPreview(DevicePreview devicePreview);
|
||||
void updatePreview(DevicePreview devicePreview);
|
||||
void deletePreview(DevicePreview devicePreview);
|
||||
IPage<DeviceIntegration> findCameraPage(Page<DeviceIntegration> page, DeviceIntegration deviceIntegration);
|
||||
IPage<DeviceIntegration> findNetworkPage(Page<DeviceIntegration> page, DeviceIntegration deviceIntegration);
|
||||
IPage<DeviceIntegration> findElectricityPage(Page<DeviceIntegration> page, DeviceIntegration deviceIntegration);
|
||||
IPage<DeviceIntegration> findWaterPage(Page<DeviceIntegration> page, DeviceIntegration deviceIntegration);
|
||||
IPage<DeviceIntegration> findHumidPage(Page<DeviceIntegration> page, DeviceIntegration deviceIntegration);
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,95 @@
|
|||
package com.nu.modules.device.manager.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.nu.modules.device.manager.entity.DeviceIntegration;
|
||||
import com.nu.modules.device.manager.entity.DeviceManager;
|
||||
import com.nu.modules.device.manager.entity.DevicePreview;
|
||||
import com.nu.modules.device.manager.mapper.DeviceManagerMapper;
|
||||
import com.nu.modules.device.manager.service.IDeviceManagerService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Description: 设备管理-机构信息
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2026-03-30
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
public class DeviceManagerServiceImpl extends ServiceImpl<DeviceManagerMapper, DeviceManager> implements IDeviceManagerService {
|
||||
|
||||
@Override
|
||||
public IPage<DeviceManager> findPage(Page<DeviceManager> page, DeviceManager deviceManager){
|
||||
return baseMapper.findPage(page,deviceManager);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DevicePreview> queryNuList(DevicePreview devicePreview){
|
||||
return baseMapper.queryNuList(devicePreview);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IPage<DevicePreview> findDepartPreviewPage(Page<DevicePreview> page, DevicePreview devicePreview){
|
||||
return baseMapper.findDepartPreviewPage(page,devicePreview);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IPage<DevicePreview> findNuPreviewPage(Page<DevicePreview> page, DevicePreview devicePreview){
|
||||
return baseMapper.findNuPreviewPage(page,devicePreview);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addPreview(DevicePreview devicePreview){
|
||||
DevicePreview entity = baseMapper.getPreview(devicePreview);
|
||||
if(entity!=null){
|
||||
int purchaseQuantity = devicePreview.getPurchaseQuantity()+entity.getPurchaseQuantity();
|
||||
DevicePreview vo = new DevicePreview();
|
||||
vo.setId(entity.getId());
|
||||
vo.setPurchaseQuantity(purchaseQuantity);
|
||||
baseMapper.updatePreview(vo);
|
||||
}else{
|
||||
baseMapper.addPreview(devicePreview);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updatePreview(DevicePreview devicePreview){
|
||||
baseMapper.updatePreview(devicePreview);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deletePreview(DevicePreview devicePreview){
|
||||
baseMapper.deletePreview(devicePreview);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IPage<DeviceIntegration> findCameraPage(Page<DeviceIntegration> page, DeviceIntegration deviceIntegration){
|
||||
return baseMapper.findCameraPage(page,deviceIntegration);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IPage<DeviceIntegration> findNetworkPage(Page<DeviceIntegration> page, DeviceIntegration deviceIntegration){
|
||||
return baseMapper.findNetworkPage(page,deviceIntegration);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IPage<DeviceIntegration> findElectricityPage(Page<DeviceIntegration> page, DeviceIntegration deviceIntegration){
|
||||
return baseMapper.findElectricityPage(page,deviceIntegration);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IPage<DeviceIntegration> findWaterPage(Page<DeviceIntegration> page, DeviceIntegration deviceIntegration){
|
||||
return baseMapper.findWaterPage(page,deviceIntegration);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IPage<DeviceIntegration> findHumidPage(Page<DeviceIntegration> page, DeviceIntegration deviceIntegration){
|
||||
return baseMapper.findHumidPage(page,deviceIntegration);
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Reference in New Issue