设备管理-设备清单-批次的设备清单-新增区域维度功能调整:展示机构+批次下所有护理单元的护理单元信息、已配置基础服务、设备信息数量
This commit is contained in:
parent
232b1af5b0
commit
bd13a5aaa8
|
|
@ -6,13 +6,17 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.nu.modules.device.config.entity.DeviceConfig;
|
import com.nu.modules.device.config.entity.DeviceConfig;
|
||||||
import com.nu.modules.device.manager.entity.*;
|
import com.nu.modules.device.manager.entity.*;
|
||||||
import com.nu.modules.device.manager.service.IDeviceManagerService;
|
import com.nu.modules.device.manager.service.IDeviceManagerService;
|
||||||
|
import dm.jdbc.util.StringUtil;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.apache.commons.lang.StringUtils;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
import org.jeecg.common.api.vo.Result;
|
import org.jeecg.common.api.vo.Result;
|
||||||
import org.jeecg.common.aspect.annotation.AutoLog;
|
import org.jeecg.common.aspect.annotation.AutoLog;
|
||||||
import org.jeecg.common.system.base.controller.JeecgController;
|
import org.jeecg.common.system.base.controller.JeecgController;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.web.servlet.ModelAndView;
|
import org.springframework.web.servlet.ModelAndView;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
|
@ -23,34 +27,34 @@ import java.util.Map;
|
||||||
/**
|
/**
|
||||||
* @Description: 设备管理
|
* @Description: 设备管理
|
||||||
* @Author: jeecg-boot
|
* @Author: jeecg-boot
|
||||||
* @Date: 2026-03-30
|
* @Date: 2026-03-30
|
||||||
* @Version: V1.0
|
* @Version: V1.0
|
||||||
*/
|
*/
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/iot/device/manager")
|
@RequestMapping("/iot/device/manager")
|
||||||
@Slf4j
|
@Slf4j
|
||||||
public class DeviceManagerController extends JeecgController<DeviceManager, IDeviceManagerService> {
|
public class DeviceManagerController extends JeecgController<DeviceManager, IDeviceManagerService> {
|
||||||
@Autowired
|
@Autowired
|
||||||
private IDeviceManagerService service;
|
private IDeviceManagerService service;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 分页列表查询
|
* 分页列表查询
|
||||||
*
|
*
|
||||||
* @param DeviceManager
|
* @param DeviceManager
|
||||||
* @param pageNo
|
* @param pageNo
|
||||||
* @param pageSize
|
* @param pageSize
|
||||||
* @param req
|
* @param req
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@GetMapping(value = "/list")
|
@GetMapping(value = "/list")
|
||||||
public Result<IPage<DeviceManager>> queryPageList(DeviceManager DeviceManager,
|
public Result<IPage<DeviceManager>> queryPageList(DeviceManager DeviceManager,
|
||||||
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
|
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
|
||||||
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
|
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
|
||||||
HttpServletRequest req) {
|
HttpServletRequest req) {
|
||||||
Page<DeviceManager> page = new Page<DeviceManager>(pageNo, pageSize);
|
Page<DeviceManager> page = new Page<DeviceManager>(pageNo, pageSize);
|
||||||
IPage<DeviceManager> pageList = service.findPlanPage(page, DeviceManager);
|
IPage<DeviceManager> pageList = service.findPlanPage(page, DeviceManager);
|
||||||
return Result.OK(pageList);
|
return Result.OK(pageList);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 分页列表查询
|
* 分页列表查询
|
||||||
|
|
@ -63,8 +67,8 @@ public class DeviceManagerController extends JeecgController<DeviceManager, IDev
|
||||||
*/
|
*/
|
||||||
@GetMapping(value = "/batchList")
|
@GetMapping(value = "/batchList")
|
||||||
public Result<IPage<DeviceBatch>> queryBatchPageList(DeviceBatch deviceBatch,
|
public Result<IPage<DeviceBatch>> queryBatchPageList(DeviceBatch deviceBatch,
|
||||||
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
|
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
|
||||||
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
|
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
|
||||||
HttpServletRequest req) {
|
HttpServletRequest req) {
|
||||||
Page<DeviceBatch> page = new Page<DeviceBatch>(pageNo, pageSize);
|
Page<DeviceBatch> page = new Page<DeviceBatch>(pageNo, pageSize);
|
||||||
IPage<DeviceBatch> pageList = service.findBatchPage(page, deviceBatch);
|
IPage<DeviceBatch> pageList = service.findBatchPage(page, deviceBatch);
|
||||||
|
|
@ -72,54 +76,54 @@ public class DeviceManagerController extends JeecgController<DeviceManager, IDev
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取批次号
|
* 获取批次号
|
||||||
*
|
*
|
||||||
* @param deviceBatch
|
* @param deviceBatch
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@GetMapping(value = "/getBatchNo")
|
@GetMapping(value = "/getBatchNo")
|
||||||
public Result<Map<String,String>> getBatchNo(DeviceBatch deviceBatch) {
|
public Result<Map<String, String>> getBatchNo(DeviceBatch deviceBatch) {
|
||||||
String batchNo = service.getBatchNo(deviceBatch);
|
String batchNo = service.getBatchNo(deviceBatch);
|
||||||
Map<String,String> map = new HashMap<>();
|
Map<String, String> map = new HashMap<>();
|
||||||
map.put("batchNo",batchNo);
|
map.put("batchNo", batchNo);
|
||||||
return Result.OK(map);
|
return Result.OK(map);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 添加
|
* 添加
|
||||||
*
|
*
|
||||||
* @param deviceBatch
|
* @param deviceBatch
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@PostMapping(value = "/addBatch")
|
@PostMapping(value = "/addBatch")
|
||||||
public Result<String> addBatch(@RequestBody DeviceBatch deviceBatch) {
|
public Result<String> addBatch(@RequestBody DeviceBatch deviceBatch) {
|
||||||
service.saveBatch(deviceBatch);
|
service.saveBatch(deviceBatch);
|
||||||
return Result.OK("添加成功!");
|
return Result.OK("添加成功!");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 编辑
|
* 编辑
|
||||||
*
|
*
|
||||||
* @param deviceBatch
|
* @param deviceBatch
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@RequestMapping(value = "/editBatch", method = {RequestMethod.PUT,RequestMethod.POST})
|
@RequestMapping(value = "/editBatch", method = {RequestMethod.PUT, RequestMethod.POST})
|
||||||
public Result<String> editBatch(@RequestBody DeviceBatch deviceBatch) {
|
public Result<String> editBatch(@RequestBody DeviceBatch deviceBatch) {
|
||||||
service.updateBatch(deviceBatch);
|
service.updateBatch(deviceBatch);
|
||||||
return Result.OK("编辑成功!");
|
return Result.OK("编辑成功!");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 通过id删除
|
* 通过id删除
|
||||||
*
|
*
|
||||||
* @param deviceBatch
|
* @param deviceBatch
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@RequestMapping(value = "/deleteBatch", method = {RequestMethod.PUT,RequestMethod.POST})
|
@RequestMapping(value = "/deleteBatch", method = {RequestMethod.PUT, RequestMethod.POST})
|
||||||
public Result<String> deleteBatch(@RequestBody DeviceBatch deviceBatch) {
|
public Result<String> deleteBatch(@RequestBody DeviceBatch deviceBatch) {
|
||||||
service.removeBatch(deviceBatch);
|
service.removeBatch(deviceBatch);
|
||||||
return Result.OK("删除成功!");
|
return Result.OK("删除成功!");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 设备集成-机构设备清单分页列表查询
|
* 设备集成-机构设备清单分页列表查询
|
||||||
|
|
@ -132,8 +136,8 @@ public class DeviceManagerController extends JeecgController<DeviceManager, IDev
|
||||||
*/
|
*/
|
||||||
@GetMapping(value = "/departPreview")
|
@GetMapping(value = "/departPreview")
|
||||||
public Result<IPage<DevicePreview>> departPreview(DevicePreview devicePreview,
|
public Result<IPage<DevicePreview>> departPreview(DevicePreview devicePreview,
|
||||||
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
|
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
|
||||||
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
|
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
|
||||||
HttpServletRequest req) {
|
HttpServletRequest req) {
|
||||||
Page<DevicePreview> page = new Page<DevicePreview>(pageNo, pageSize);
|
Page<DevicePreview> page = new Page<DevicePreview>(pageNo, pageSize);
|
||||||
IPage<DevicePreview> pageList = service.findDepartPreviewPlanPage(page, devicePreview);
|
IPage<DevicePreview> pageList = service.findDepartPreviewPlanPage(page, devicePreview);
|
||||||
|
|
@ -162,16 +166,16 @@ public class DeviceManagerController extends JeecgController<DeviceManager, IDev
|
||||||
*/
|
*/
|
||||||
@GetMapping(value = "/nuPreview")
|
@GetMapping(value = "/nuPreview")
|
||||||
public Result<IPage<DevicePreview>> nuPreview(DevicePreview devicePreview,
|
public Result<IPage<DevicePreview>> nuPreview(DevicePreview devicePreview,
|
||||||
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
|
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
|
||||||
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
|
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
|
||||||
HttpServletRequest req) {
|
HttpServletRequest req) {
|
||||||
Page<DevicePreview> page = new Page<DevicePreview>(pageNo, pageSize);
|
Page<DevicePreview> page = new Page<DevicePreview>(pageNo, pageSize);
|
||||||
IPage<DevicePreview> pageList = service.findNuPreviewPlanPage(page, devicePreview);
|
IPage<DevicePreview> pageList = service.findNuPreviewPlanPage(page, devicePreview);
|
||||||
return Result.OK(pageList);
|
return Result.OK(pageList);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 增加设备清单
|
* 增加设备清单
|
||||||
*
|
*
|
||||||
* @param devicePreview
|
* @param devicePreview
|
||||||
* @return
|
* @return
|
||||||
|
|
@ -183,7 +187,7 @@ public class DeviceManagerController extends JeecgController<DeviceManager, IDev
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改设备清单
|
* 修改设备清单
|
||||||
*
|
*
|
||||||
* @param devicePreview
|
* @param devicePreview
|
||||||
* @return
|
* @return
|
||||||
|
|
@ -195,7 +199,45 @@ public class DeviceManagerController extends JeecgController<DeviceManager, IDev
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 通过id删除
|
* 查询对应机构+批次 各护理单元已配置的设备数量
|
||||||
|
* @param batchNo
|
||||||
|
* @param orgCode
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@RequestMapping(value = "/queryQuantityByOrgCode", method = RequestMethod.GET)
|
||||||
|
public Result<List<DevicePreview>> queryQuantityByOrgCode(@RequestParam("batchNo") String batchNo, @RequestParam("orgCode") String orgCode) {
|
||||||
|
return Result.OK(service.queryQuantityByOrgCode(batchNo, orgCode));
|
||||||
|
}
|
||||||
|
|
||||||
|
@RequestMapping(value = "/batchSave", method = RequestMethod.POST)
|
||||||
|
public Result<String> batchSave(@RequestBody List<DevicePreview> list) {
|
||||||
|
list.forEach(item -> {
|
||||||
|
if (item.getId() == null) {
|
||||||
|
service.addPreviewPlan(item);
|
||||||
|
} else {
|
||||||
|
service.updatePreviewPlan(item);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return Result.OK("保存成功!");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据orgCode获取护理单元信息
|
||||||
|
*
|
||||||
|
* @param orgCode
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@GetMapping("/getNuListByOrgCode")
|
||||||
|
public Result<Map<String,Map<String, Object>>> getNuListByOrgCode(@RequestParam("orgCode") String orgCode) {
|
||||||
|
if(StringUtils.isBlank(orgCode)){
|
||||||
|
return Result.error("orgCode不能为空");
|
||||||
|
}
|
||||||
|
Map<String,Map<String, Object>> result = service.getNuListByOrgCode(orgCode);
|
||||||
|
return Result.ok(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通过id删除
|
||||||
*
|
*
|
||||||
* @param devicePreview
|
* @param devicePreview
|
||||||
* @return
|
* @return
|
||||||
|
|
@ -207,7 +249,7 @@ public class DeviceManagerController extends JeecgController<DeviceManager, IDev
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 推送业务
|
* 推送业务
|
||||||
*
|
*
|
||||||
* @param devicePreview
|
* @param devicePreview
|
||||||
* @return
|
* @return
|
||||||
|
|
@ -229,9 +271,9 @@ public class DeviceManagerController extends JeecgController<DeviceManager, IDev
|
||||||
*/
|
*/
|
||||||
@GetMapping(value = "/cameraList")
|
@GetMapping(value = "/cameraList")
|
||||||
public Result<IPage<DeviceIntegration>> cameraList(DeviceIntegration deviceIntegration,
|
public Result<IPage<DeviceIntegration>> cameraList(DeviceIntegration deviceIntegration,
|
||||||
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
|
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
|
||||||
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
|
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
|
||||||
HttpServletRequest req) {
|
HttpServletRequest req) {
|
||||||
Page<DeviceIntegration> page = new Page<DeviceIntegration>(pageNo, pageSize);
|
Page<DeviceIntegration> page = new Page<DeviceIntegration>(pageNo, pageSize);
|
||||||
IPage<DeviceIntegration> pageList = service.findCameraPage(page, deviceIntegration);
|
IPage<DeviceIntegration> pageList = service.findCameraPage(page, deviceIntegration);
|
||||||
return Result.OK(pageList);
|
return Result.OK(pageList);
|
||||||
|
|
@ -259,9 +301,9 @@ public class DeviceManagerController extends JeecgController<DeviceManager, IDev
|
||||||
*/
|
*/
|
||||||
@GetMapping(value = "/networkList")
|
@GetMapping(value = "/networkList")
|
||||||
public Result<IPage<DeviceIntegration>> networkList(DeviceIntegration deviceIntegration,
|
public Result<IPage<DeviceIntegration>> networkList(DeviceIntegration deviceIntegration,
|
||||||
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
|
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
|
||||||
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
|
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
|
||||||
HttpServletRequest req) {
|
HttpServletRequest req) {
|
||||||
Page<DeviceIntegration> page = new Page<DeviceIntegration>(pageNo, pageSize);
|
Page<DeviceIntegration> page = new Page<DeviceIntegration>(pageNo, pageSize);
|
||||||
IPage<DeviceIntegration> pageList = service.findNetworkPage(page, deviceIntegration);
|
IPage<DeviceIntegration> pageList = service.findNetworkPage(page, deviceIntegration);
|
||||||
return Result.OK(pageList);
|
return Result.OK(pageList);
|
||||||
|
|
@ -290,9 +332,9 @@ public class DeviceManagerController extends JeecgController<DeviceManager, IDev
|
||||||
*/
|
*/
|
||||||
@GetMapping(value = "/electricityList")
|
@GetMapping(value = "/electricityList")
|
||||||
public Result<IPage<DeviceIntegration>> electricityList(DeviceIntegration deviceIntegration,
|
public Result<IPage<DeviceIntegration>> electricityList(DeviceIntegration deviceIntegration,
|
||||||
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
|
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
|
||||||
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
|
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
|
||||||
HttpServletRequest req) {
|
HttpServletRequest req) {
|
||||||
Page<DeviceIntegration> page = new Page<DeviceIntegration>(pageNo, pageSize);
|
Page<DeviceIntegration> page = new Page<DeviceIntegration>(pageNo, pageSize);
|
||||||
IPage<DeviceIntegration> pageList = service.findElectricityPage(page, deviceIntegration);
|
IPage<DeviceIntegration> pageList = service.findElectricityPage(page, deviceIntegration);
|
||||||
return Result.OK(pageList);
|
return Result.OK(pageList);
|
||||||
|
|
@ -325,9 +367,9 @@ public class DeviceManagerController extends JeecgController<DeviceManager, IDev
|
||||||
*/
|
*/
|
||||||
@GetMapping(value = "/waterList")
|
@GetMapping(value = "/waterList")
|
||||||
public Result<IPage<DeviceIntegration>> waterList(DeviceIntegration deviceIntegration,
|
public Result<IPage<DeviceIntegration>> waterList(DeviceIntegration deviceIntegration,
|
||||||
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
|
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
|
||||||
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
|
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
|
||||||
HttpServletRequest req) {
|
HttpServletRequest req) {
|
||||||
Page<DeviceIntegration> page = new Page<DeviceIntegration>(pageNo, pageSize);
|
Page<DeviceIntegration> page = new Page<DeviceIntegration>(pageNo, pageSize);
|
||||||
IPage<DeviceIntegration> pageList = service.findWaterPage(page, deviceIntegration);
|
IPage<DeviceIntegration> pageList = service.findWaterPage(page, deviceIntegration);
|
||||||
return Result.OK(pageList);
|
return Result.OK(pageList);
|
||||||
|
|
@ -355,9 +397,9 @@ public class DeviceManagerController extends JeecgController<DeviceManager, IDev
|
||||||
*/
|
*/
|
||||||
@GetMapping(value = "/humidList")
|
@GetMapping(value = "/humidList")
|
||||||
public Result<IPage<DeviceIntegration>> humidList(DeviceIntegration deviceIntegration,
|
public Result<IPage<DeviceIntegration>> humidList(DeviceIntegration deviceIntegration,
|
||||||
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
|
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
|
||||||
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
|
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
|
||||||
HttpServletRequest req) {
|
HttpServletRequest req) {
|
||||||
Page<DeviceIntegration> page = new Page<DeviceIntegration>(pageNo, pageSize);
|
Page<DeviceIntegration> page = new Page<DeviceIntegration>(pageNo, pageSize);
|
||||||
IPage<DeviceIntegration> pageList = service.findHumidPage(page, deviceIntegration);
|
IPage<DeviceIntegration> pageList = service.findHumidPage(page, deviceIntegration);
|
||||||
return Result.OK(pageList);
|
return Result.OK(pageList);
|
||||||
|
|
@ -385,9 +427,9 @@ public class DeviceManagerController extends JeecgController<DeviceManager, IDev
|
||||||
*/
|
*/
|
||||||
@GetMapping(value = "/bingLogList")
|
@GetMapping(value = "/bingLogList")
|
||||||
public Result<IPage<DeviceBindLog>> bingLogList(DeviceBindLog deviceBindLog,
|
public Result<IPage<DeviceBindLog>> bingLogList(DeviceBindLog deviceBindLog,
|
||||||
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
|
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
|
||||||
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
|
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
|
||||||
HttpServletRequest req) {
|
HttpServletRequest req) {
|
||||||
Page<DeviceBindLog> page = new Page<DeviceBindLog>(pageNo, pageSize);
|
Page<DeviceBindLog> page = new Page<DeviceBindLog>(pageNo, pageSize);
|
||||||
IPage<DeviceBindLog> pageList = service.findBingLogPage(page, deviceBindLog);
|
IPage<DeviceBindLog> pageList = service.findBingLogPage(page, deviceBindLog);
|
||||||
return Result.OK(pageList);
|
return Result.OK(pageList);
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,165 @@
|
||||||
|
package com.nu.modules.device.manager.entity;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.*;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
import org.jeecg.common.aspect.annotation.Dict;
|
||||||
|
import org.jeecgframework.poi.excel.annotation.Excel;
|
||||||
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description: 护理单元
|
||||||
|
* @Author: jeecg-boot
|
||||||
|
* @Date: 2025-04-11
|
||||||
|
* @Version: V1.0
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class DeviceNuBaseInfoEntity implements Serializable {
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ID
|
||||||
|
*/
|
||||||
|
@TableId(type = IdType.ASSIGN_ID)
|
||||||
|
@ApiModelProperty(value = "ID")
|
||||||
|
private String id;
|
||||||
|
/**
|
||||||
|
* openId
|
||||||
|
*/
|
||||||
|
@Excel(name = "openId", width = 15)
|
||||||
|
@ApiModelProperty(value = "openId")
|
||||||
|
private String openId;
|
||||||
|
/**
|
||||||
|
* 长者id nu_biz_elder_info.id
|
||||||
|
*/
|
||||||
|
@Excel(name = "长者id", width = 15)
|
||||||
|
@ApiModelProperty(value = "长者id")
|
||||||
|
private String elderId;
|
||||||
|
/**
|
||||||
|
* 护理单元名称
|
||||||
|
*/
|
||||||
|
@Excel(name = "护理单元名称", width = 15)
|
||||||
|
@ApiModelProperty(value = "护理单元名称")
|
||||||
|
private String nuName;
|
||||||
|
/**
|
||||||
|
* 护理单元编码
|
||||||
|
*/
|
||||||
|
@Excel(name = "护理单元编码", width = 15)
|
||||||
|
@ApiModelProperty(value = "护理单元编码")
|
||||||
|
private String nuId;
|
||||||
|
/**
|
||||||
|
* 区域标签ID
|
||||||
|
*/
|
||||||
|
@Excel(name = "区域标签ID", width = 15, dicCode = "nu_type")
|
||||||
|
@ApiModelProperty(value = "区域标签ID")
|
||||||
|
private String areaFlag;
|
||||||
|
/**
|
||||||
|
* 使用状态 0未使用 1占用 2入住 3退住 4留床
|
||||||
|
*/
|
||||||
|
@Excel(name = "使用状态 0未使用 1占用 2入住 3退住 4留床", width = 15, dicCode = "nu_status")
|
||||||
|
@Dict(dicCode = "nu_status")
|
||||||
|
@ApiModelProperty(value = "使用状态 0未使用 1占用 2入住 3退住 4留床")
|
||||||
|
private String status;
|
||||||
|
/**
|
||||||
|
* 客户
|
||||||
|
*/
|
||||||
|
// @Excel(name = "客户", width = 15)
|
||||||
|
// @ApiModelProperty(value = "客户")
|
||||||
|
// private java.lang.String customerId;
|
||||||
|
/**
|
||||||
|
* 是否删除 0未删除 1删除
|
||||||
|
*/
|
||||||
|
@Excel(name = "是否删除 0未删除 1删除", width = 15)
|
||||||
|
@ApiModelProperty(value = "是否删除 0未删除 1删除")
|
||||||
|
@TableLogic
|
||||||
|
private String delFlag;
|
||||||
|
/**
|
||||||
|
* 创建人
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "创建人")
|
||||||
|
private String createBy;
|
||||||
|
/**
|
||||||
|
* 创建日期
|
||||||
|
*/
|
||||||
|
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
@ApiModelProperty(value = "创建日期")
|
||||||
|
private java.util.Date createTime;
|
||||||
|
/**
|
||||||
|
* 更新人
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "更新人")
|
||||||
|
private String updateBy;
|
||||||
|
/**
|
||||||
|
* 更新日期
|
||||||
|
*/
|
||||||
|
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
@ApiModelProperty(value = "更新日期")
|
||||||
|
private java.util.Date updateTime;
|
||||||
|
/**
|
||||||
|
* 所属部门
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "所属部门")
|
||||||
|
private String sysOrgCode;
|
||||||
|
/**
|
||||||
|
* 是否已同步0已同步 1未同步
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "是否已同步0已同步 1未同步")
|
||||||
|
private String izSync;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否绑定护理单元支付中 Y支付中(有客户正在给护理单元充值) N没有人在绑定缴费(可以让用户绑定)
|
||||||
|
*/
|
||||||
|
private String izBindPaying;
|
||||||
|
|
||||||
|
@TableField(exist = false)
|
||||||
|
private String deviceId;//摄像头 ID
|
||||||
|
@TableField(exist = false)
|
||||||
|
private String deviceName;//摄像头名称
|
||||||
|
@TableField(exist = false)
|
||||||
|
private String deviceSn;//设备编号
|
||||||
|
@TableField(exist = false)
|
||||||
|
private String deviceStatus;//摄像头状态
|
||||||
|
@TableField(exist = false)
|
||||||
|
private String deviceMac;//摄像头状态
|
||||||
|
|
||||||
|
@TableField(exist = false)
|
||||||
|
private int streamType;
|
||||||
|
@TableField(exist = false)
|
||||||
|
private String deviceIndex;
|
||||||
|
|
||||||
|
@TableField(exist = false)
|
||||||
|
private String elderTableId;
|
||||||
|
@TableField(exist = false)
|
||||||
|
private String maintainStatus;//设备状态
|
||||||
|
@TableField(exist = false)
|
||||||
|
private String deviceType;//设备类型
|
||||||
|
@TableField(exist = false)
|
||||||
|
private String parentId;//上级id
|
||||||
|
|
||||||
|
@TableField(exist = false)
|
||||||
|
private List<DeviceNuBaseInfoEntity> children = new ArrayList<>();
|
||||||
|
|
||||||
|
// 构造方法
|
||||||
|
public DeviceNuBaseInfoEntity(String id, String nuName, String nuId, String parentId) {
|
||||||
|
this.id = id;
|
||||||
|
this.nuName = nuName;
|
||||||
|
this.nuId = nuId;
|
||||||
|
this.parentId = parentId;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 添加子节点
|
||||||
|
public void addChild(DeviceNuBaseInfoEntity child) {
|
||||||
|
children.add(child);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -11,44 +11,82 @@ import java.util.List;
|
||||||
/**
|
/**
|
||||||
* @Description: 设备管理-机构信息
|
* @Description: 设备管理-机构信息
|
||||||
* @Author: jeecg-boot
|
* @Author: jeecg-boot
|
||||||
* @Date: 2026-03-30
|
* @Date: 2026-03-30
|
||||||
* @Version: V1.0
|
* @Version: V1.0
|
||||||
*/
|
*/
|
||||||
public interface DeviceManagerMapper extends BaseMapper<DeviceManager> {
|
public interface DeviceManagerMapper extends BaseMapper<DeviceManager> {
|
||||||
IPage<DeviceManager> findPlanPage(Page<DeviceManager> page, @Param("params") DeviceManager deviceManager);
|
IPage<DeviceManager> findPlanPage(Page<DeviceManager> page, @Param("params") DeviceManager deviceManager);
|
||||||
|
|
||||||
IPage<DeviceBatch> findBatchPage(Page<DeviceBatch> page, @Param("params") DeviceBatch deviceBatch);
|
IPage<DeviceBatch> findBatchPage(Page<DeviceBatch> page, @Param("params") DeviceBatch deviceBatch);
|
||||||
|
|
||||||
void saveBatch(DeviceBatch deviceBatch);
|
void saveBatch(DeviceBatch deviceBatch);
|
||||||
|
|
||||||
void updateBatch(DeviceBatch deviceBatch);
|
void updateBatch(DeviceBatch deviceBatch);
|
||||||
|
|
||||||
void removeBatch(DeviceBatch deviceBatch);
|
void removeBatch(DeviceBatch deviceBatch);
|
||||||
|
|
||||||
void removePlanByBatch(DeviceBatch deviceBatch);
|
void removePlanByBatch(DeviceBatch deviceBatch);
|
||||||
|
|
||||||
void syncBatch(DevicePreview devicePreview);
|
void syncBatch(DevicePreview devicePreview);
|
||||||
|
|
||||||
List<DevicePreview> queryNuList(DevicePreview devicePreview);
|
List<DevicePreview> queryNuList(DevicePreview devicePreview);
|
||||||
|
|
||||||
IPage<DevicePreview> findDepartPreviewPlanPage(Page<DevicePreview> page, @Param("params") DevicePreview devicePreview);
|
IPage<DevicePreview> findDepartPreviewPlanPage(Page<DevicePreview> page, @Param("params") DevicePreview devicePreview);
|
||||||
|
|
||||||
IPage<DevicePreview> findNuPreviewPlanPage(Page<DevicePreview> page, @Param("params") DevicePreview devicePreview);
|
IPage<DevicePreview> findNuPreviewPlanPage(Page<DevicePreview> page, @Param("params") DevicePreview devicePreview);
|
||||||
|
|
||||||
List<DevicePreview> getPreviewPlanList(DevicePreview devicePreview);
|
List<DevicePreview> getPreviewPlanList(DevicePreview devicePreview);
|
||||||
|
|
||||||
int addPreviewPlan(DevicePreview devicePreview);
|
int addPreviewPlan(DevicePreview devicePreview);
|
||||||
|
|
||||||
void updatePreviewPlan(DevicePreview devicePreview);
|
void updatePreviewPlan(DevicePreview devicePreview);
|
||||||
|
|
||||||
void deletePreviewPlanById(DevicePreview devicePreview);
|
void deletePreviewPlanById(DevicePreview devicePreview);
|
||||||
|
|
||||||
void deletePreviewPlanByBatch(DeviceBatch deviceBatch);
|
void deletePreviewPlanByBatch(DeviceBatch deviceBatch);
|
||||||
|
|
||||||
DevicePreview getPreviewPlanQuantity(DevicePreview devicePreview);
|
DevicePreview getPreviewPlanQuantity(DevicePreview devicePreview);
|
||||||
|
|
||||||
void deletePreviewByBatch(DevicePreview devicePreview);
|
void deletePreviewByBatch(DevicePreview devicePreview);
|
||||||
|
|
||||||
int addPreview(DevicePreview devicePreview);
|
int addPreview(DevicePreview devicePreview);
|
||||||
|
|
||||||
List<DevicePreview> getPreviewList(DevicePreview devicePreview);
|
List<DevicePreview> getPreviewList(DevicePreview devicePreview);
|
||||||
// DevicePreview getPreview(DevicePreview devicePreview);
|
// DevicePreview getPreview(DevicePreview devicePreview);
|
||||||
|
|
||||||
void syncPreview(String id);
|
void syncPreview(String id);
|
||||||
|
|
||||||
void editPreviewStatusBySn(DeviceIntegration deviceIntegration);
|
void editPreviewStatusBySn(DeviceIntegration deviceIntegration);
|
||||||
|
|
||||||
void deletePreviewById(String id);
|
void deletePreviewById(String id);
|
||||||
|
|
||||||
void editPreviewSn(DevicePreview devicePreview);
|
void editPreviewSn(DevicePreview devicePreview);
|
||||||
|
|
||||||
void bindPreview(DevicePreview devicePreview);
|
void bindPreview(DevicePreview devicePreview);
|
||||||
|
|
||||||
IPage<DeviceIntegration> findCameraPage(Page<DeviceIntegration> page, @Param("params") DeviceIntegration deviceIntegration);
|
IPage<DeviceIntegration> findCameraPage(Page<DeviceIntegration> page, @Param("params") DeviceIntegration deviceIntegration);
|
||||||
|
|
||||||
IPage<DeviceIntegration> findNetworkPage(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> findElectricityPage(Page<DeviceIntegration> page, @Param("params") DeviceIntegration deviceIntegration);
|
||||||
|
|
||||||
IPage<DeviceIntegration> findWaterPage(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);
|
IPage<DeviceIntegration> findHumidPage(Page<DeviceIntegration> page, @Param("params") DeviceIntegration deviceIntegration);
|
||||||
|
|
||||||
IPage<DeviceBindLog> findBingLogPage(Page<DeviceBindLog> page, @Param("params") DeviceBindLog deviceBindLog);
|
IPage<DeviceBindLog> findBingLogPage(Page<DeviceBindLog> page, @Param("params") DeviceBindLog deviceBindLog);
|
||||||
|
|
||||||
void addBindPreview(DeviceBindLog deviceBindLog);
|
void addBindPreview(DeviceBindLog deviceBindLog);
|
||||||
void addDeviceReleaseLog(String orgCode,String nuId);
|
|
||||||
void releaseNu(String orgCode,String nuId);
|
void addDeviceReleaseLog(String orgCode, String nuId);
|
||||||
|
|
||||||
|
void releaseNu(String orgCode, String nuId);
|
||||||
|
|
||||||
|
List<DevicePreview> queryQuantityByOrgCode(@Param("batchNo") String batchNo, @Param("orgCode") String orgCode);
|
||||||
|
|
||||||
|
List<DeviceNuBaseInfoEntity> selectWlsbList();
|
||||||
|
|
||||||
|
List<DeviceNuBaseInfoEntity> selectJcgnList();
|
||||||
|
|
||||||
|
List<DeviceNuBaseInfoEntity> selectAllNu();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,13 +2,14 @@
|
||||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
<!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">
|
<mapper namespace="com.nu.modules.device.manager.mapper.DeviceManagerMapper">
|
||||||
|
|
||||||
<select id="findPlanPage" parameterType="com.nu.modules.device.manager.entity.DeviceManager" resultType="com.nu.modules.device.manager.entity.DeviceManager">
|
<select id="findPlanPage" parameterType="com.nu.modules.device.manager.entity.DeviceManager"
|
||||||
|
resultType="com.nu.modules.device.manager.entity.DeviceManager">
|
||||||
select a.id,
|
select a.id,
|
||||||
a.org_code,
|
a.org_code,
|
||||||
a.depart_name,
|
a.depart_name,
|
||||||
b.org_leader,
|
b.org_leader,
|
||||||
b.audit_status,
|
b.audit_status,
|
||||||
b.audit_time
|
b.audit_time
|
||||||
from sys_depart a
|
from sys_depart a
|
||||||
inner join nu_org_info b on a.id = b.id
|
inner join nu_org_info b on a.id = b.id
|
||||||
inner join nu_work_order c on c.org_id = a.id and c.status = '3'
|
inner join nu_work_order c on c.org_id = a.id and c.status = '3'
|
||||||
|
|
@ -23,15 +24,16 @@
|
||||||
order by a.org_code desc
|
order by a.org_code desc
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="findBatchPage" parameterType="com.nu.modules.device.manager.entity.DeviceBatch" resultType="com.nu.modules.device.manager.entity.DeviceBatch">
|
<select id="findBatchPage" parameterType="com.nu.modules.device.manager.entity.DeviceBatch"
|
||||||
|
resultType="com.nu.modules.device.manager.entity.DeviceBatch">
|
||||||
select a.id,
|
select a.id,
|
||||||
a.batch_no,
|
a.batch_no,
|
||||||
a.org_code,
|
a.org_code,
|
||||||
b.depart_name,
|
b.depart_name,
|
||||||
a.iz_push,
|
a.iz_push,
|
||||||
a.create_time,
|
a.create_time,
|
||||||
a.create_by,
|
a.create_by,
|
||||||
a.remarks
|
a.remarks
|
||||||
from nu_iot_device_preview_batch a
|
from nu_iot_device_preview_batch a
|
||||||
inner join sys_depart b on a.org_code = b.org_code
|
inner join sys_depart b on a.org_code = b.org_code
|
||||||
where a.org_code = #{params.orgCode}
|
where a.org_code = #{params.orgCode}
|
||||||
|
|
@ -44,128 +46,133 @@
|
||||||
order by a.create_time desc
|
order by a.create_time desc
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<insert id="saveBatch" parameterType="com.nu.modules.device.manager.entity.DevicePreview" useGeneratedKeys="true" keyProperty="id">
|
<insert id="saveBatch" parameterType="com.nu.modules.device.manager.entity.DevicePreview" useGeneratedKeys="true"
|
||||||
insert into nu_iot_device_preview_batch(
|
keyProperty="id">
|
||||||
batch_no,
|
insert into nu_iot_device_preview_batch(batch_no,
|
||||||
org_code,
|
org_code,
|
||||||
iz_push,
|
iz_push,
|
||||||
create_time,
|
create_time,
|
||||||
create_by,
|
create_by,
|
||||||
remarks
|
remarks)
|
||||||
)
|
values (#{batchNo},
|
||||||
values(
|
#{orgCode},
|
||||||
#{batchNo},
|
'N',
|
||||||
#{orgCode},
|
now(),
|
||||||
'N',
|
#{createBy},
|
||||||
now(),
|
#{remarks})
|
||||||
#{createBy},
|
|
||||||
#{remarks}
|
|
||||||
)
|
|
||||||
</insert>
|
</insert>
|
||||||
|
|
||||||
<update id="updateBatch">
|
<update id="updateBatch">
|
||||||
update nu_iot_device_preview_batch
|
update nu_iot_device_preview_batch
|
||||||
set iz_push = #{izPush},
|
set iz_push = #{izPush},
|
||||||
remarks = #{remarks},
|
remarks = #{remarks},
|
||||||
update_by = #{updateBy},
|
update_by = #{updateBy},
|
||||||
update_time = now()
|
update_time = now()
|
||||||
where id = #{id}
|
where id = #{id}
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
<delete id="removeBatch">
|
<delete id="removeBatch">
|
||||||
delete from nu_iot_device_preview_batch where id = #{id}
|
delete
|
||||||
|
from nu_iot_device_preview_batch
|
||||||
|
where id = #{id}
|
||||||
</delete>
|
</delete>
|
||||||
|
|
||||||
<delete id="removePlanByBatch">
|
<delete id="removePlanByBatch">
|
||||||
delete from nu_iot_device_preview_plan where batch_no = #{batchNo}
|
delete
|
||||||
|
from nu_iot_device_preview_plan
|
||||||
|
where batch_no = #{batchNo}
|
||||||
</delete>
|
</delete>
|
||||||
|
|
||||||
<update id="syncBatch">
|
<update id="syncBatch">
|
||||||
update nu_iot_device_preview_batch
|
update nu_iot_device_preview_batch
|
||||||
set iz_push = 'Y',
|
set iz_push = 'Y',
|
||||||
push_time = now()
|
push_time = now()
|
||||||
where batch_no = #{batchNo}
|
where batch_no = #{batchNo}
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
<select id="queryNuList" parameterType="com.nu.modules.device.manager.entity.DevicePreview" resultType="com.nu.modules.device.manager.entity.DevicePreview">
|
<select id="queryNuList" parameterType="com.nu.modules.device.manager.entity.DevicePreview"
|
||||||
select nu_id,nu_name
|
resultType="com.nu.modules.device.manager.entity.DevicePreview">
|
||||||
|
select nu_id, nu_name
|
||||||
from nu_base_info
|
from nu_base_info
|
||||||
where status != '5'
|
where status != '5'
|
||||||
and sys_org_code = #{orgCode}
|
and sys_org_code = #{orgCode}
|
||||||
order by nu_id asc
|
order by nu_id asc
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="findDepartPreviewPlanPage" parameterType="com.nu.modules.device.manager.entity.DevicePreview" resultType="com.nu.modules.device.manager.entity.DevicePreview">
|
<select id="findDepartPreviewPlanPage" parameterType="com.nu.modules.device.manager.entity.DevicePreview"
|
||||||
|
resultType="com.nu.modules.device.manager.entity.DevicePreview">
|
||||||
select
|
select
|
||||||
a.org_code,
|
a.org_code,
|
||||||
b.depart_name,
|
b.depart_name,
|
||||||
a.batch_no,
|
a.batch_no,
|
||||||
a.device_name,
|
a.device_name,
|
||||||
a.device_type,
|
a.device_type,
|
||||||
a.device_model,
|
a.device_model,
|
||||||
a.factory,
|
a.factory,
|
||||||
a.dimension,
|
a.dimension,
|
||||||
sum(a.purchase_quantity) as purchaseQuantity
|
sum(a.purchase_quantity) as purchaseQuantity
|
||||||
from nu_iot_device_preview_plan a
|
from nu_iot_device_preview_plan a
|
||||||
inner join sys_depart b on a.org_code = b.org_code
|
inner join sys_depart b on a.org_code = b.org_code
|
||||||
where a.org_code = #{params.orgCode} and a.batch_no = #{params.batchNo}
|
where a.org_code = #{params.orgCode} and a.batch_no = #{params.batchNo}
|
||||||
<if test="params.dimension != null and params.dimension != ''">
|
<if test="params.dimension != null and params.dimension != ''">
|
||||||
AND a.dimension = #{params.dimension}
|
AND a.dimension = #{params.dimension}
|
||||||
</if>
|
</if>
|
||||||
<if test="params.deviceType != null and params.deviceType != ''">
|
<if test="params.deviceType != null and params.deviceType != ''">
|
||||||
AND a.device_type = #{params.deviceType}
|
AND a.device_type = #{params.deviceType}
|
||||||
</if>
|
</if>
|
||||||
group by a.org_code,b.depart_name,a.device_name,a.device_type,a.device_model,a.factory,a.dimension
|
group by a.org_code,b.depart_name,a.device_name,a.device_type,a.device_model,a.factory,a.dimension
|
||||||
order by a.device_type asc
|
order by a.device_type asc
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="findNuPreviewPlanPage" parameterType="com.nu.modules.device.manager.entity.DevicePreview" resultType="com.nu.modules.device.manager.entity.DevicePreview">
|
<select id="findNuPreviewPlanPage" parameterType="com.nu.modules.device.manager.entity.DevicePreview"
|
||||||
|
resultType="com.nu.modules.device.manager.entity.DevicePreview">
|
||||||
select
|
select
|
||||||
a.id,
|
a.id,
|
||||||
a.org_code,
|
a.org_code,
|
||||||
b.depart_name,
|
b.depart_name,
|
||||||
a.nu_id,
|
a.nu_id,
|
||||||
c.nu_name,
|
c.nu_name,
|
||||||
a.batch_no,
|
a.batch_no,
|
||||||
a.device_name,
|
a.device_name,
|
||||||
a.device_type,
|
a.device_type,
|
||||||
a.device_model,
|
a.device_model,
|
||||||
a.factory,
|
a.factory,
|
||||||
a.dimension,
|
a.dimension,
|
||||||
a.purchase_quantity
|
a.purchase_quantity
|
||||||
from nu_iot_device_preview_plan a
|
from nu_iot_device_preview_plan a
|
||||||
inner join sys_depart b on a.org_code = b.org_code
|
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
|
left join nu_base_info c on a.nu_id = c.nu_id
|
||||||
where a.org_code = #{params.orgCode} and a.batch_no = #{params.batchNo}
|
where a.org_code = #{params.orgCode} and a.batch_no = #{params.batchNo}
|
||||||
<if test="params.nuName != null and params.nuName != ''">
|
<if test="params.nuName != null and params.nuName != ''">
|
||||||
AND c.nu_name LIKE concat('%',#{params.nuName},'%')
|
AND c.nu_name LIKE concat('%',#{params.nuName},'%')
|
||||||
</if>
|
</if>
|
||||||
<if test="params.dimension != null and params.dimension != ''">
|
<if test="params.dimension != null and params.dimension != ''">
|
||||||
AND a.dimension = #{params.dimension}
|
AND a.dimension = #{params.dimension}
|
||||||
</if>
|
</if>
|
||||||
<if test="params.deviceType != null and params.deviceType != ''">
|
<if test="params.deviceType != null and params.deviceType != ''">
|
||||||
AND a.device_type = #{params.deviceType}
|
AND a.device_type = #{params.deviceType}
|
||||||
</if>
|
</if>
|
||||||
order by a.nu_id,a.device_type asc
|
order by a.nu_id,a.device_type asc
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="getPreviewPlanList" parameterType="com.nu.modules.device.manager.entity.DevicePreview" resultType="com.nu.modules.device.manager.entity.DevicePreview">
|
<select id="getPreviewPlanList" parameterType="com.nu.modules.device.manager.entity.DevicePreview"
|
||||||
|
resultType="com.nu.modules.device.manager.entity.DevicePreview">
|
||||||
select id,
|
select id,
|
||||||
batch_no,
|
batch_no,
|
||||||
org_code,
|
org_code,
|
||||||
nu_id,
|
nu_id,
|
||||||
dimension,
|
dimension,
|
||||||
device_name,
|
device_name,
|
||||||
device_type,
|
device_type,
|
||||||
device_model,
|
device_model,
|
||||||
factory,
|
factory,
|
||||||
purchase_quantity,
|
purchase_quantity,
|
||||||
create_time,
|
create_time,
|
||||||
create_by,
|
create_by,
|
||||||
update_time,
|
update_time,
|
||||||
update_by
|
update_by
|
||||||
from nu_iot_device_preview_plan
|
from nu_iot_device_preview_plan
|
||||||
<where> org_code = #{orgCode} and batch_no = #{batchNo}
|
<where>org_code = #{orgCode} and batch_no = #{batchNo}
|
||||||
<if test="dimension != null and dimension != ''">
|
<if test="dimension != null and dimension != ''">
|
||||||
AND dimension = #{dimension}
|
AND dimension = #{dimension}
|
||||||
</if>
|
</if>
|
||||||
|
|
@ -187,107 +194,112 @@
|
||||||
</where>
|
</where>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<insert id="addPreviewPlan" parameterType="com.nu.modules.device.manager.entity.DevicePreview" useGeneratedKeys="true" keyProperty="id">
|
<insert id="addPreviewPlan" parameterType="com.nu.modules.device.manager.entity.DevicePreview"
|
||||||
insert into nu_iot_device_preview_plan(
|
useGeneratedKeys="true" keyProperty="id">
|
||||||
org_code,
|
insert into nu_iot_device_preview_plan(org_code,
|
||||||
nu_id,
|
nu_id,
|
||||||
batch_no,
|
batch_no,
|
||||||
device_name,
|
device_name,
|
||||||
device_type,
|
device_type,
|
||||||
device_model,
|
device_model,
|
||||||
factory,
|
factory,
|
||||||
dimension,
|
dimension,
|
||||||
create_time,
|
create_time,
|
||||||
create_by,
|
create_by,
|
||||||
purchase_quantity
|
purchase_quantity)
|
||||||
)
|
values (#{orgCode},
|
||||||
values(
|
#{nuId},
|
||||||
#{orgCode},
|
#{batchNo},
|
||||||
#{nuId},
|
#{deviceName},
|
||||||
#{batchNo},
|
#{deviceType},
|
||||||
#{deviceName},
|
#{deviceModel},
|
||||||
#{deviceType},
|
#{factory},
|
||||||
#{deviceModel},
|
#{dimension},
|
||||||
#{factory},
|
now(),
|
||||||
#{dimension},
|
#{createBy},
|
||||||
now(),
|
#{purchaseQuantity})
|
||||||
#{createBy},
|
|
||||||
#{purchaseQuantity}
|
|
||||||
)
|
|
||||||
</insert>
|
</insert>
|
||||||
|
|
||||||
<update id="updatePreviewPlan">
|
<update id="updatePreviewPlan">
|
||||||
update nu_iot_device_preview_plan
|
update nu_iot_device_preview_plan
|
||||||
set nu_id = #{nuId},
|
set
|
||||||
purchase_quantity = #{purchaseQuantity},
|
<if test="nuId !=null and nuId != ''">
|
||||||
update_time = now()
|
nu_id = #{nuId},
|
||||||
|
</if>
|
||||||
|
purchase_quantity = #{purchaseQuantity},
|
||||||
|
update_time = now()
|
||||||
where id = #{id}
|
where id = #{id}
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
<delete id="deletePreviewPlanById">
|
<delete id="deletePreviewPlanById">
|
||||||
delete from nu_iot_device_preview_plan where id = #{id}
|
delete
|
||||||
|
from nu_iot_device_preview_plan
|
||||||
|
where id = #{id}
|
||||||
</delete>
|
</delete>
|
||||||
|
|
||||||
<delete id="deletePreviewPlanByBatch">
|
<delete id="deletePreviewPlanByBatch">
|
||||||
delete from nu_iot_device_preview_plan where batch_no = #{batchNo}
|
delete
|
||||||
|
from nu_iot_device_preview_plan
|
||||||
|
where batch_no = #{batchNo}
|
||||||
</delete>
|
</delete>
|
||||||
|
|
||||||
<select id="getPreviewPlanQuantity" parameterType="com.nu.modules.device.manager.entity.DevicePreview" resultType="com.nu.modules.device.manager.entity.DevicePreview">
|
<select id="getPreviewPlanQuantity" parameterType="com.nu.modules.device.manager.entity.DevicePreview"
|
||||||
|
resultType="com.nu.modules.device.manager.entity.DevicePreview">
|
||||||
select sum(purchase_quantity) as purchaseQuantity
|
select sum(purchase_quantity) as purchaseQuantity
|
||||||
from nu_iot_device_preview_plan
|
from nu_iot_device_preview_plan
|
||||||
where batch_no = #{batchNo}
|
where batch_no = #{batchNo}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<delete id="deletePreviewByBatch">
|
<delete id="deletePreviewByBatch">
|
||||||
delete from nu_iot_device_preview where batch_no = #{batchNo}
|
delete
|
||||||
|
from nu_iot_device_preview
|
||||||
|
where batch_no = #{batchNo}
|
||||||
</delete>
|
</delete>
|
||||||
|
|
||||||
<insert id="addPreview" parameterType="com.nu.modules.device.manager.entity.DevicePreview" useGeneratedKeys="true" keyProperty="id">
|
<insert id="addPreview" parameterType="com.nu.modules.device.manager.entity.DevicePreview" useGeneratedKeys="true"
|
||||||
insert into nu_iot_device_preview(
|
keyProperty="id">
|
||||||
org_code,
|
insert into nu_iot_device_preview(org_code,
|
||||||
nu_id,
|
nu_id,
|
||||||
batch_no,
|
batch_no,
|
||||||
device_name,
|
device_name,
|
||||||
device_type,
|
device_type,
|
||||||
device_model,
|
device_model,
|
||||||
factory,
|
factory,
|
||||||
dimension,
|
dimension,
|
||||||
create_time,
|
create_time,
|
||||||
create_by
|
create_by)
|
||||||
)
|
values (#{orgCode},
|
||||||
values(
|
#{nuId},
|
||||||
#{orgCode},
|
#{batchNo},
|
||||||
#{nuId},
|
#{deviceName},
|
||||||
#{batchNo},
|
#{deviceType},
|
||||||
#{deviceName},
|
#{deviceModel},
|
||||||
#{deviceType},
|
#{factory},
|
||||||
#{deviceModel},
|
#{dimension},
|
||||||
#{factory},
|
now(),
|
||||||
#{dimension},
|
#{createBy})
|
||||||
now(),
|
|
||||||
#{createBy}
|
|
||||||
)
|
|
||||||
</insert>
|
</insert>
|
||||||
|
|
||||||
<select id="getPreviewList" parameterType="com.nu.modules.device.manager.entity.DevicePreview" resultType="com.nu.modules.device.manager.entity.DevicePreview">
|
<select id="getPreviewList" parameterType="com.nu.modules.device.manager.entity.DevicePreview"
|
||||||
|
resultType="com.nu.modules.device.manager.entity.DevicePreview">
|
||||||
select id,
|
select id,
|
||||||
org_code,
|
org_code,
|
||||||
nu_id,
|
nu_id,
|
||||||
batch_no,
|
batch_no,
|
||||||
dimension,
|
dimension,
|
||||||
sn,
|
sn,
|
||||||
device_name,
|
device_name,
|
||||||
device_type,
|
device_type,
|
||||||
device_model,
|
device_model,
|
||||||
factory,
|
factory,
|
||||||
device_status,
|
device_status,
|
||||||
create_time,
|
create_time,
|
||||||
create_by,
|
create_by,
|
||||||
update_time,
|
update_time,
|
||||||
update_by,
|
update_by,
|
||||||
iz_sync,
|
iz_sync,
|
||||||
sync_time,
|
sync_time,
|
||||||
sync_by
|
sync_by
|
||||||
from nu_iot_device_preview
|
from nu_iot_device_preview
|
||||||
<where>
|
<where>
|
||||||
<if test="orgCode != null and orgCode != ''">
|
<if test="orgCode != null and orgCode != ''">
|
||||||
|
|
@ -367,7 +379,7 @@
|
||||||
|
|
||||||
<update id="syncPreview">
|
<update id="syncPreview">
|
||||||
update nu_iot_device_preview
|
update nu_iot_device_preview
|
||||||
set iz_sync = 'Y',
|
set iz_sync = 'Y',
|
||||||
sync_time = now()
|
sync_time = now()
|
||||||
where id = #{id}
|
where id = #{id}
|
||||||
</update>
|
</update>
|
||||||
|
|
@ -379,7 +391,9 @@
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
<delete id="deletePreviewById">
|
<delete id="deletePreviewById">
|
||||||
delete from nu_iot_device_preview where id = #{id}
|
delete
|
||||||
|
from nu_iot_device_preview
|
||||||
|
where id = #{id}
|
||||||
</delete>
|
</delete>
|
||||||
|
|
||||||
<update id="editPreviewSn">
|
<update id="editPreviewSn">
|
||||||
|
|
@ -390,140 +404,150 @@
|
||||||
|
|
||||||
<update id="bindPreview">
|
<update id="bindPreview">
|
||||||
update nu_iot_device_preview
|
update nu_iot_device_preview
|
||||||
set nu_id = #{nuId},
|
set nu_id = #{nuId},
|
||||||
device_status = #{deviceStatus},
|
device_status = #{deviceStatus},
|
||||||
update_time = now()
|
update_time = now()
|
||||||
where id = #{id}
|
where id = #{id}
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
<select id="findCameraPage" parameterType="com.nu.modules.device.manager.entity.DeviceIntegration" resultType="com.nu.modules.device.manager.entity.DeviceIntegration">
|
<select id="findCameraPage" parameterType="com.nu.modules.device.manager.entity.DeviceIntegration"
|
||||||
select
|
resultType="com.nu.modules.device.manager.entity.DeviceIntegration">
|
||||||
a.org_code,
|
select a.org_code,
|
||||||
a.dimension,
|
a.dimension,
|
||||||
a.sn,
|
a.sn,
|
||||||
a.device_name,
|
a.device_name,
|
||||||
a.device_type,
|
a.device_type,
|
||||||
a.device_model,
|
a.device_model,
|
||||||
a.factory,
|
a.factory,
|
||||||
(
|
(
|
||||||
case when b.id is null then '待集成'
|
case
|
||||||
else (case ifnull(b.device_status,'') when '0' then '离线' when '1' then '在线' else '-' end)
|
when b.id is null then '待集成'
|
||||||
end
|
else (case ifnull(b.device_status, '') when '0' then '离线' when '1' then '在线' else '-' end)
|
||||||
) as device_status,
|
end
|
||||||
a.device_status as maintainStatus,
|
) as device_status,
|
||||||
b.device_index
|
a.device_status as maintainStatus,
|
||||||
|
b.device_index
|
||||||
from nu_iot_device_preview a
|
from nu_iot_device_preview a
|
||||||
left join nu_iot_tplink_camera b on a.sn = b.mac
|
left join nu_iot_tplink_camera b on a.sn = b.mac
|
||||||
where a.org_code = #{params.orgCode}
|
where a.org_code = #{params.orgCode}
|
||||||
AND a.device_type in ('SURVEILLANCECAMERA','NETWORKVIDEORECORDER')
|
AND a.device_type in ('SURVEILLANCECAMERA', 'NETWORKVIDEORECORDER')
|
||||||
order by a.id
|
order by a.id
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="findNetworkPage" parameterType="com.nu.modules.device.manager.entity.DeviceIntegration" resultType="com.nu.modules.device.manager.entity.DeviceIntegration">
|
<select id="findNetworkPage" parameterType="com.nu.modules.device.manager.entity.DeviceIntegration"
|
||||||
select
|
resultType="com.nu.modules.device.manager.entity.DeviceIntegration">
|
||||||
a.org_code,
|
select a.org_code,
|
||||||
a.dimension,
|
a.dimension,
|
||||||
a.sn,
|
a.sn,
|
||||||
a.device_name,
|
a.device_name,
|
||||||
a.device_type,
|
a.device_type,
|
||||||
a.device_model,
|
a.device_model,
|
||||||
a.factory,
|
a.factory,
|
||||||
(
|
(
|
||||||
case when b.id is null then '待集成'
|
case
|
||||||
else (case ifnull(b.device_status,'') when '0' then '离线' when '1' then '在线' else '-' end)
|
when b.id is null then '待集成'
|
||||||
end
|
else (case ifnull(b.device_status, '') when '0' then '离线' when '1' then '在线' else '-' end)
|
||||||
) as device_status,
|
end
|
||||||
a.device_status as maintainStatus
|
) as device_status,
|
||||||
|
a.device_status as maintainStatus
|
||||||
from nu_iot_device_preview a
|
from nu_iot_device_preview a
|
||||||
left join nu_iot_tplink_camera b on a.sn = b.mac
|
left join nu_iot_tplink_camera b on a.sn = b.mac
|
||||||
where a.org_code = #{params.orgCode}
|
where a.org_code = #{params.orgCode}
|
||||||
AND a.device_type in ('SWITCH','ROUTER','AP')
|
AND a.device_type in ('SWITCH', 'ROUTER', 'AP')
|
||||||
order by a.id
|
order by a.id
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="findElectricityPage" parameterType="com.nu.modules.device.manager.entity.DeviceIntegration" resultType="com.nu.modules.device.manager.entity.DeviceIntegration">
|
<select id="findElectricityPage" parameterType="com.nu.modules.device.manager.entity.DeviceIntegration"
|
||||||
select
|
resultType="com.nu.modules.device.manager.entity.DeviceIntegration">
|
||||||
a.org_code,
|
select a.org_code,
|
||||||
a.dimension,
|
a.dimension,
|
||||||
a.sn,
|
a.sn,
|
||||||
a.device_name,
|
a.device_name,
|
||||||
a.device_type,
|
a.device_type,
|
||||||
a.device_model,
|
a.device_model,
|
||||||
a.factory,
|
a.factory,
|
||||||
(
|
(
|
||||||
case when b.id is null then '待集成'
|
case
|
||||||
else
|
when b.id is null then '待集成'
|
||||||
(case when b.sim is null then '待集成'
|
else
|
||||||
else (case ifnull(b.relay_state,'') when '0' then '拉闸' when '1' then '合闸' else '-' end) end)
|
(case
|
||||||
end
|
when b.sim is null then '待集成'
|
||||||
) as device_status,
|
else (case ifnull(b.relay_state, '')
|
||||||
a.device_status as maintainStatus
|
when '0' then '拉闸'
|
||||||
|
when '1' then '合闸'
|
||||||
|
else '-' end) end)
|
||||||
|
end
|
||||||
|
) as device_status,
|
||||||
|
a.device_status as maintainStatus
|
||||||
from nu_iot_device_preview a
|
from nu_iot_device_preview a
|
||||||
left join nu_iot_ds_electricity_meter b on a.sn = b.sn
|
left join nu_iot_ds_electricity_meter b on a.sn = b.sn
|
||||||
where a.org_code = #{params.orgCode}
|
where a.org_code = #{params.orgCode}
|
||||||
AND a.device_type = 'db'
|
AND a.device_type = 'db'
|
||||||
order by a.id
|
order by a.id
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="findWaterPage" parameterType="com.nu.modules.device.manager.entity.DeviceIntegration" resultType="com.nu.modules.device.manager.entity.DeviceIntegration">
|
<select id="findWaterPage" parameterType="com.nu.modules.device.manager.entity.DeviceIntegration"
|
||||||
select
|
resultType="com.nu.modules.device.manager.entity.DeviceIntegration">
|
||||||
a.org_code,
|
select a.org_code,
|
||||||
a.dimension,
|
a.dimension,
|
||||||
a.sn,
|
a.sn,
|
||||||
a.device_name,
|
a.device_name,
|
||||||
a.device_type,
|
a.device_type,
|
||||||
a.device_model,
|
a.device_model,
|
||||||
a.factory,
|
a.factory,
|
||||||
(
|
(
|
||||||
case when b.id is null then '待集成'
|
case
|
||||||
else (case ifnull(b.relay_state,'') when '0' then '关阀' when '1' then '开阀' else '-' end)
|
when b.id is null then '待集成'
|
||||||
end
|
else (case ifnull(b.relay_state, '') when '0' then '关阀' when '1' then '开阀' else '-' end)
|
||||||
) as device_status,
|
end
|
||||||
a.device_status as maintainStatus
|
) as device_status,
|
||||||
|
a.device_status as maintainStatus
|
||||||
from nu_iot_device_preview a
|
from nu_iot_device_preview a
|
||||||
left join nu_iot_tq_water_meter b on a.sn = b.cid
|
left join nu_iot_tq_water_meter b on a.sn = b.cid
|
||||||
where a.org_code = #{params.orgCode}
|
where a.org_code = #{params.orgCode}
|
||||||
AND a.device_type = 'sb'
|
AND a.device_type = 'sb'
|
||||||
order by a.id
|
order by a.id
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="findHumidPage" parameterType="com.nu.modules.device.manager.entity.DeviceIntegration" resultType="com.nu.modules.device.manager.entity.DeviceIntegration">
|
<select id="findHumidPage" parameterType="com.nu.modules.device.manager.entity.DeviceIntegration"
|
||||||
select
|
resultType="com.nu.modules.device.manager.entity.DeviceIntegration">
|
||||||
a.org_code,
|
select a.org_code,
|
||||||
a.dimension,
|
a.dimension,
|
||||||
a.sn,
|
a.sn,
|
||||||
a.device_name,
|
a.device_name,
|
||||||
a.device_type,
|
a.device_type,
|
||||||
a.device_model,
|
a.device_model,
|
||||||
a.factory,
|
a.factory,
|
||||||
(
|
(
|
||||||
case when b.id is null then '待集成'
|
case
|
||||||
else (case ifnull(b.status,'') when '0' then '在线' when '1' then '离线' else '-' end)
|
when b.id is null then '待集成'
|
||||||
end
|
else (case ifnull(b.status, '') when '0' then '在线' when '1' then '离线' else '-' end)
|
||||||
) as device_status,
|
end
|
||||||
a.device_status as maintainStatus
|
) as device_status,
|
||||||
|
a.device_status as maintainStatus
|
||||||
from nu_iot_device_preview a
|
from nu_iot_device_preview a
|
||||||
left join nu_iot_yiweilian_humid_device b on a.sn = b.sn
|
left join nu_iot_yiweilian_humid_device b on a.sn = b.sn
|
||||||
where a.org_code = #{params.orgCode}
|
where a.org_code = #{params.orgCode}
|
||||||
AND a.device_type = 'wsdj'
|
AND a.device_type = 'wsdj'
|
||||||
order by a.id
|
order by a.id
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="findBingLogPage" parameterType="com.nu.modules.device.manager.entity.DeviceBindLog" resultType="com.nu.modules.device.manager.entity.DeviceBindLog">
|
<select id="findBingLogPage" parameterType="com.nu.modules.device.manager.entity.DeviceBindLog"
|
||||||
|
resultType="com.nu.modules.device.manager.entity.DeviceBindLog">
|
||||||
select
|
select
|
||||||
id,
|
id,
|
||||||
org_code,
|
org_code,
|
||||||
nu_id,
|
nu_id,
|
||||||
nu_name,
|
nu_name,
|
||||||
dimension,
|
dimension,
|
||||||
device_name,
|
device_name,
|
||||||
device_type,
|
device_type,
|
||||||
device_model,
|
device_model,
|
||||||
sn,
|
sn,
|
||||||
factory,
|
factory,
|
||||||
opt_date,
|
opt_date,
|
||||||
opt_type,
|
opt_type,
|
||||||
remarks
|
remarks
|
||||||
from nu_iot_device_bind_log
|
from nu_iot_device_bind_log
|
||||||
where org_code = #{params.orgCode}
|
where org_code = #{params.orgCode}
|
||||||
<if test="params.dimension != null and params.dimension != ''">
|
<if test="params.dimension != null and params.dimension != ''">
|
||||||
|
|
@ -538,71 +562,92 @@
|
||||||
order by org_code asc ,factory asc ,device_type asc ,device_model asc ,sn asc,opt_date desc
|
order by org_code asc ,factory asc ,device_type asc ,device_model asc ,sn asc,opt_date desc
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="queryQuantityByOrgCode" resultType="com.nu.modules.device.manager.entity.DevicePreview">
|
||||||
|
select *
|
||||||
|
from nu_iot_device_preview_plan
|
||||||
|
<where>
|
||||||
|
<if test="batchNo != null and batchNo != ''">
|
||||||
|
and batch_no = #{batchNo}
|
||||||
|
</if>
|
||||||
|
<if test="orgCode != null and orgCode != ''">
|
||||||
|
and org_code = #{orgCode}
|
||||||
|
</if>
|
||||||
|
</where>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectWlsbList" resultType="com.nu.modules.device.manager.entity.DeviceNuBaseInfoEntity">
|
||||||
|
select nu_id as device_sn,device_name, device_type,nu_id,device_status as maintain_status from nu_iot_device_preview
|
||||||
|
where nu_id is not null and device_status is not null and device_status != '损坏'
|
||||||
|
</select>
|
||||||
|
|
||||||
|
|
||||||
|
<select id="selectJcgnList" resultType="com.nu.modules.device.manager.entity.DeviceNuBaseInfoEntity">
|
||||||
|
SELECT a.permission_id as id,b.name as nu_name,a.role_id as nu_id,b.parent_id from nu_app_nuid_permission a
|
||||||
|
inner join nu_app_permission b on a.permission_id = b.id
|
||||||
|
</select>
|
||||||
|
<select id="selectAllNu" resultType="com.nu.modules.device.manager.entity.DeviceNuBaseInfoEntity">
|
||||||
|
select * from nu_base_info where del_flag = '0'
|
||||||
|
</select>
|
||||||
|
|
||||||
<insert id="addBindPreview">
|
<insert id="addBindPreview">
|
||||||
insert into nu_iot_device_bind_log(
|
insert into nu_iot_device_bind_log(org_code,
|
||||||
org_code,
|
nu_id,
|
||||||
nu_id,
|
nu_name,
|
||||||
nu_name,
|
dimension,
|
||||||
dimension,
|
device_name,
|
||||||
device_name,
|
device_type,
|
||||||
device_type,
|
device_model,
|
||||||
device_model,
|
sn,
|
||||||
sn,
|
factory,
|
||||||
factory,
|
opt_date,
|
||||||
opt_date,
|
opt_type,
|
||||||
opt_type,
|
remarks)
|
||||||
remarks
|
values (#{orgCode},
|
||||||
)values(
|
#{nuId},
|
||||||
#{orgCode},
|
#{nuName},
|
||||||
#{nuId},
|
#{dimension},
|
||||||
#{nuName},
|
#{deviceName},
|
||||||
#{dimension},
|
#{deviceType},
|
||||||
#{deviceName},
|
#{deviceModel},
|
||||||
#{deviceType},
|
#{sn},
|
||||||
#{deviceModel},
|
#{factory},
|
||||||
#{sn},
|
now(),
|
||||||
#{factory},
|
#{optType},
|
||||||
now(),
|
#{remarks})
|
||||||
#{optType},
|
|
||||||
#{remarks}
|
|
||||||
)
|
|
||||||
</insert>
|
</insert>
|
||||||
|
|
||||||
<insert id="addDeviceReleaseLog">
|
<insert id="addDeviceReleaseLog">
|
||||||
insert into nu_iot_device_bind_log(
|
insert into nu_iot_device_bind_log(org_code,
|
||||||
org_code,
|
sn,
|
||||||
sn,
|
dimension,
|
||||||
dimension,
|
device_name,
|
||||||
device_name,
|
device_type,
|
||||||
device_type,
|
device_model,
|
||||||
device_model,
|
factory,
|
||||||
factory,
|
opt_date,
|
||||||
opt_date,
|
opt_type,
|
||||||
opt_type,
|
remarks)
|
||||||
remarks
|
select #{orgCode},
|
||||||
)
|
sn,
|
||||||
select
|
dimension,
|
||||||
#{orgCode},
|
device_name,
|
||||||
sn,
|
device_type,
|
||||||
dimension,
|
device_model,
|
||||||
device_name,
|
factory,
|
||||||
device_type,
|
now(),
|
||||||
device_model,
|
'释放',
|
||||||
factory,
|
'区域停用'
|
||||||
now(),
|
|
||||||
'释放',
|
|
||||||
'区域停用'
|
|
||||||
from nu_iot_device_preview a
|
from nu_iot_device_preview a
|
||||||
where a.org_code = #{orgCode}
|
where a.org_code = #{orgCode}
|
||||||
and a.nu_id = #{nuId}
|
and a.nu_id = #{nuId}
|
||||||
and ifnull(a.device_status,'') != '损坏'
|
and ifnull(a.device_status, '') != '损坏'
|
||||||
</insert>
|
</insert>
|
||||||
|
|
||||||
<update id="releaseNu">
|
<update id="releaseNu">
|
||||||
update nu_iot_device_preview
|
update nu_iot_device_preview
|
||||||
set nu_id = null
|
set nu_id = null
|
||||||
where org_code = #{orgCode}
|
where org_code = #{orgCode}
|
||||||
and nu_id = #{nuId}
|
and nu_id = #{nuId}
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@ import com.nu.modules.device.manager.entity.*;
|
||||||
import org.jeecg.common.api.vo.Result;
|
import org.jeecg.common.api.vo.Result;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Description: 设备管理-机构信息
|
* @Description: 设备管理-机构信息
|
||||||
|
|
@ -48,4 +49,7 @@ public interface IDeviceManagerService extends IService<DeviceManager> {
|
||||||
void addBindPreview(DeviceBindLog deviceBindLog);
|
void addBindPreview(DeviceBindLog deviceBindLog);
|
||||||
void releaseNu(String orgCode,String nuId);
|
void releaseNu(String orgCode,String nuId);
|
||||||
|
|
||||||
|
List<DevicePreview> queryQuantityByOrgCode(String batchNo, String orgCode);
|
||||||
|
|
||||||
|
Map<String,Map<String, Object>> getNuListByOrgCode(String orgCode);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,8 @@ package com.nu.modules.device.manager.service.impl;
|
||||||
import cn.hutool.core.date.DateUtil;
|
import cn.hutool.core.date.DateUtil;
|
||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.baomidou.dynamic.datasource.annotation.DS;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
|
@ -40,14 +42,13 @@ import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
import java.time.format.DateTimeFormatter;
|
import java.time.format.DateTimeFormatter;
|
||||||
import java.util.ArrayList;
|
import java.util.*;
|
||||||
import java.util.Date;
|
import java.util.stream.Collectors;
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Description: 设备管理-机构信息
|
* @Description: 设备管理-机构信息
|
||||||
* @Author: jeecg-boot
|
* @Author: jeecg-boot
|
||||||
* @Date: 2026-03-30
|
* @Date: 2026-03-30
|
||||||
* @Version: V1.0
|
* @Version: V1.0
|
||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
|
|
@ -78,15 +79,15 @@ public class DeviceManagerServiceImpl extends ServiceImpl<DeviceManagerMapper, D
|
||||||
IHumidDeviceService humidDeviceService;
|
IHumidDeviceService humidDeviceService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IPage<DeviceManager> findPlanPage(Page<DeviceManager> page, DeviceManager deviceManager){
|
public IPage<DeviceManager> findPlanPage(Page<DeviceManager> page, DeviceManager deviceManager) {
|
||||||
return baseMapper.findPlanPage(page,deviceManager);
|
return baseMapper.findPlanPage(page, deviceManager);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IPage<DeviceBatch> findBatchPage(Page<DeviceBatch> page, DeviceBatch deviceBatch){
|
public IPage<DeviceBatch> findBatchPage(Page<DeviceBatch> page, DeviceBatch deviceBatch) {
|
||||||
IPage<DeviceBatch> records = baseMapper.findBatchPage(page,deviceBatch);
|
IPage<DeviceBatch> records = baseMapper.findBatchPage(page, deviceBatch);
|
||||||
List<DeviceBatch> list = records.getRecords();
|
List<DeviceBatch> list = records.getRecords();
|
||||||
for(int i=0;i<list.size();i++){
|
for (int i = 0; i < list.size(); i++) {
|
||||||
DeviceBatch entity = list.get(i);
|
DeviceBatch entity = list.get(i);
|
||||||
DevicePreview dp = new DevicePreview();
|
DevicePreview dp = new DevicePreview();
|
||||||
dp.setOrgCode(entity.getOrgCode());
|
dp.setOrgCode(entity.getOrgCode());
|
||||||
|
|
@ -98,13 +99,13 @@ public class DeviceManagerServiceImpl extends ServiceImpl<DeviceManagerMapper, D
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getBatchNo(DeviceBatch deviceBatch){
|
public String getBatchNo(DeviceBatch deviceBatch) {
|
||||||
// 机构编码 + 年月日时分秒
|
// 机构编码 + 年月日时分秒
|
||||||
return deviceBatch.getOrgCode() + DateUtil.format(new Date(),"yyMMddHHmmss");
|
return deviceBatch.getOrgCode() + DateUtil.format(new Date(), "yyMMddHHmmss");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void saveBatch(DeviceBatch deviceBatch){
|
public void saveBatch(DeviceBatch deviceBatch) {
|
||||||
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
||||||
if (sysUser != null) {
|
if (sysUser != null) {
|
||||||
deviceBatch.setCreateBy(sysUser.getRealname());
|
deviceBatch.setCreateBy(sysUser.getRealname());
|
||||||
|
|
@ -113,7 +114,7 @@ public class DeviceManagerServiceImpl extends ServiceImpl<DeviceManagerMapper, D
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateBatch(DeviceBatch deviceBatch){
|
public void updateBatch(DeviceBatch deviceBatch) {
|
||||||
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
||||||
if (sysUser != null) {
|
if (sysUser != null) {
|
||||||
deviceBatch.setUpdateBy(sysUser.getRealname());
|
deviceBatch.setUpdateBy(sysUser.getRealname());
|
||||||
|
|
@ -122,28 +123,28 @@ public class DeviceManagerServiceImpl extends ServiceImpl<DeviceManagerMapper, D
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void removeBatch(DeviceBatch deviceBatch){
|
public void removeBatch(DeviceBatch deviceBatch) {
|
||||||
baseMapper.deletePreviewPlanByBatch(deviceBatch);
|
baseMapper.deletePreviewPlanByBatch(deviceBatch);
|
||||||
baseMapper.removeBatch(deviceBatch);
|
baseMapper.removeBatch(deviceBatch);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<DevicePreview> queryNuList(DevicePreview devicePreview){
|
public List<DevicePreview> queryNuList(DevicePreview devicePreview) {
|
||||||
return baseMapper.queryNuList(devicePreview);
|
return baseMapper.queryNuList(devicePreview);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IPage<DevicePreview> findDepartPreviewPlanPage(Page<DevicePreview> page, DevicePreview devicePreview){
|
public IPage<DevicePreview> findDepartPreviewPlanPage(Page<DevicePreview> page, DevicePreview devicePreview) {
|
||||||
return baseMapper.findDepartPreviewPlanPage(page,devicePreview);
|
return baseMapper.findDepartPreviewPlanPage(page, devicePreview);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IPage<DevicePreview> findNuPreviewPlanPage(Page<DevicePreview> page, DevicePreview devicePreview){
|
public IPage<DevicePreview> findNuPreviewPlanPage(Page<DevicePreview> page, DevicePreview devicePreview) {
|
||||||
return baseMapper.findNuPreviewPlanPage(page,devicePreview);
|
return baseMapper.findNuPreviewPlanPage(page, devicePreview);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addPreviewPlan(DevicePreview devicePreview){
|
public void addPreviewPlan(DevicePreview devicePreview) {
|
||||||
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
||||||
if (sysUser != null) {
|
if (sysUser != null) {
|
||||||
devicePreview.setCreateBy(sysUser.getRealname());
|
devicePreview.setCreateBy(sysUser.getRealname());
|
||||||
|
|
@ -152,7 +153,7 @@ public class DeviceManagerServiceImpl extends ServiceImpl<DeviceManagerMapper, D
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updatePreviewPlan(DevicePreview devicePreview){
|
public void updatePreviewPlan(DevicePreview devicePreview) {
|
||||||
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
||||||
if (sysUser != null) {
|
if (sysUser != null) {
|
||||||
devicePreview.setUpdateBy(sysUser.getRealname());
|
devicePreview.setUpdateBy(sysUser.getRealname());
|
||||||
|
|
@ -161,22 +162,22 @@ public class DeviceManagerServiceImpl extends ServiceImpl<DeviceManagerMapper, D
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void deletePreviewPlan(DevicePreview devicePreview){
|
public void deletePreviewPlan(DevicePreview devicePreview) {
|
||||||
baseMapper.deletePreviewPlanById(devicePreview);
|
baseMapper.deletePreviewPlanById(devicePreview);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void sendBatch(DevicePreview devicePreview){
|
public void sendBatch(DevicePreview devicePreview) {
|
||||||
DevicePreview qdp = baseMapper.getPreviewPlanQuantity(devicePreview);
|
DevicePreview qdp = baseMapper.getPreviewPlanQuantity(devicePreview);
|
||||||
List<DevicePreview> list = baseMapper.getPreviewList(devicePreview);
|
List<DevicePreview> list = baseMapper.getPreviewList(devicePreview);
|
||||||
if(qdp.getPurchaseQuantity()!=list.size()){
|
if (qdp.getPurchaseQuantity() != list.size()) {
|
||||||
List<DevicePreview> planList = baseMapper.getPreviewPlanList(devicePreview);
|
List<DevicePreview> planList = baseMapper.getPreviewPlanList(devicePreview);
|
||||||
if(planList.size()>0){
|
if (planList.size() > 0) {
|
||||||
baseMapper.deletePreviewByBatch(devicePreview);
|
baseMapper.deletePreviewByBatch(devicePreview);
|
||||||
for(int i=0;i<planList.size();i++){
|
for (int i = 0; i < planList.size(); i++) {
|
||||||
DevicePreview entity = planList.get(i);
|
DevicePreview entity = planList.get(i);
|
||||||
int quantity = entity.getPurchaseQuantity();
|
int quantity = entity.getPurchaseQuantity();
|
||||||
for(int j=0;j<quantity;j++){
|
for (int j = 0; j < quantity; j++) {
|
||||||
entity.setNuId(null);
|
entity.setNuId(null);
|
||||||
baseMapper.addPreview(entity);
|
baseMapper.addPreview(entity);
|
||||||
}
|
}
|
||||||
|
|
@ -186,11 +187,11 @@ public class DeviceManagerServiceImpl extends ServiceImpl<DeviceManagerMapper, D
|
||||||
|
|
||||||
List<DevicePreviewMqDto> iotList = new ArrayList<>();
|
List<DevicePreviewMqDto> iotList = new ArrayList<>();
|
||||||
list = baseMapper.getPreviewList(devicePreview);
|
list = baseMapper.getPreviewList(devicePreview);
|
||||||
for(int i=0;i<list.size();i++){
|
for (int i = 0; i < list.size(); i++) {
|
||||||
DevicePreview entity = list.get(i);
|
DevicePreview entity = list.get(i);
|
||||||
DevicePreviewMqDto previewDto = new DevicePreviewMqDto();
|
DevicePreviewMqDto previewDto = new DevicePreviewMqDto();
|
||||||
BeanUtils.copyProperties(entity,previewDto);
|
BeanUtils.copyProperties(entity, previewDto);
|
||||||
String resId = addLog(entity.getOrgCode(),"", JSON.toJSONString(entity),"推送清单",entity.getDeviceType());
|
String resId = addLog(entity.getOrgCode(), "", JSON.toJSONString(entity), "推送清单", entity.getDeviceType());
|
||||||
previewDto.setLogId(resId);
|
previewDto.setLogId(resId);
|
||||||
previewDto.setYwId(previewDto.getId());
|
previewDto.setYwId(previewDto.getId());
|
||||||
iotList.add(previewDto);
|
iotList.add(previewDto);
|
||||||
|
|
@ -202,58 +203,59 @@ public class DeviceManagerServiceImpl extends ServiceImpl<DeviceManagerMapper, D
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void syncPreview(String id){
|
public void syncPreview(String id) {
|
||||||
baseMapper.syncPreview(id);
|
baseMapper.syncPreview(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void syncPreviewPlan(String batchNo){
|
public void syncPreviewPlan(String batchNo) {
|
||||||
DevicePreview devicePreview = new DevicePreview();
|
DevicePreview devicePreview = new DevicePreview();
|
||||||
devicePreview.setBatchNo(batchNo);
|
devicePreview.setBatchNo(batchNo);
|
||||||
devicePreview.setIzSync("Y");
|
devicePreview.setIzSync("Y");
|
||||||
DevicePreview qdp = baseMapper.getPreviewPlanQuantity(devicePreview);
|
DevicePreview qdp = baseMapper.getPreviewPlanQuantity(devicePreview);
|
||||||
List<DevicePreview> list = baseMapper.getPreviewList(devicePreview);
|
List<DevicePreview> list = baseMapper.getPreviewList(devicePreview);
|
||||||
if(qdp.getPurchaseQuantity()==list.size()){
|
if (qdp.getPurchaseQuantity() == list.size()) {
|
||||||
baseMapper.syncBatch(devicePreview);
|
baseMapper.syncBatch(devicePreview);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void deletePreviewById(String id){
|
public void deletePreviewById(String id) {
|
||||||
baseMapper.deletePreviewById(id);
|
baseMapper.deletePreviewById(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void editPreviewSn(DevicePreview devicePreview){
|
public void editPreviewSn(DevicePreview devicePreview) {
|
||||||
baseMapper.editPreviewSn(devicePreview);
|
baseMapper.editPreviewSn(devicePreview);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void bindPreview(DevicePreview devicePreview){
|
public void bindPreview(DevicePreview devicePreview) {
|
||||||
baseMapper.bindPreview(devicePreview);
|
baseMapper.bindPreview(devicePreview);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IPage<DeviceIntegration> findCameraPage(Page<DeviceIntegration> page, DeviceIntegration deviceIntegration){
|
public IPage<DeviceIntegration> findCameraPage(Page<DeviceIntegration> page, DeviceIntegration deviceIntegration) {
|
||||||
return baseMapper.findCameraPage(page,deviceIntegration);
|
return baseMapper.findCameraPage(page, deviceIntegration);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 拉取监控设备
|
* 拉取监控设备
|
||||||
|
*
|
||||||
* @param deviceIntegration
|
* @param deviceIntegration
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Result<String> pullCamera(DeviceIntegration deviceIntegration){
|
public Result<String> pullCamera(DeviceIntegration deviceIntegration) {
|
||||||
String mac = formatMacAddress(deviceIntegration.getSn());
|
String mac = formatMacAddress(deviceIntegration.getSn());
|
||||||
CameraInfo cameraInfo = new CameraInfo();
|
CameraInfo cameraInfo = new CameraInfo();
|
||||||
cameraInfo.setMac(mac);
|
cameraInfo.setMac(mac);
|
||||||
cameraInfo.setDeviceType(deviceIntegration.getDeviceType());
|
cameraInfo.setDeviceType(deviceIntegration.getDeviceType());
|
||||||
Result<String> res = cameraInfoService.syncAllDevices(cameraInfo);
|
Result<String> res = cameraInfoService.syncAllDevices(cameraInfo);
|
||||||
if(!res.isSuccess()){
|
if (!res.isSuccess()) {
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
res = syncBizService.syncDevice(deviceIntegration.getOrgCode(),deviceIntegration.getSn());
|
res = syncBizService.syncDevice(deviceIntegration.getOrgCode(), deviceIntegration.getSn());
|
||||||
if(!res.isSuccess()){
|
if (!res.isSuccess()) {
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
deviceIntegration.setDeviceStatus("正常");
|
deviceIntegration.setDeviceStatus("正常");
|
||||||
|
|
@ -262,25 +264,26 @@ public class DeviceManagerServiceImpl extends ServiceImpl<DeviceManagerMapper, D
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IPage<DeviceIntegration> findNetworkPage(Page<DeviceIntegration> page, DeviceIntegration deviceIntegration){
|
public IPage<DeviceIntegration> findNetworkPage(Page<DeviceIntegration> page, DeviceIntegration deviceIntegration) {
|
||||||
return baseMapper.findNetworkPage(page,deviceIntegration);
|
return baseMapper.findNetworkPage(page, deviceIntegration);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IPage<DeviceIntegration> findElectricityPage(Page<DeviceIntegration> page, DeviceIntegration deviceIntegration){
|
public IPage<DeviceIntegration> findElectricityPage(Page<DeviceIntegration> page, DeviceIntegration deviceIntegration) {
|
||||||
return baseMapper.findElectricityPage(page,deviceIntegration);
|
return baseMapper.findElectricityPage(page, deviceIntegration);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 拉取电表
|
* 拉取电表
|
||||||
|
*
|
||||||
* @param deviceIntegration
|
* @param deviceIntegration
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Result<String> pullElectricity(DeviceIntegration deviceIntegration){
|
public Result<String> pullElectricity(DeviceIntegration deviceIntegration) {
|
||||||
DsElectricityMeter dsElectricityMeter = new DsElectricityMeter();
|
DsElectricityMeter dsElectricityMeter = new DsElectricityMeter();
|
||||||
dsElectricityMeter.setSn(deviceIntegration.getSn());
|
dsElectricityMeter.setSn(deviceIntegration.getSn());
|
||||||
Result<String> res = electricityMeterService.add(dsElectricityMeter);
|
Result<String> res = electricityMeterService.add(dsElectricityMeter);
|
||||||
if(!res.isSuccess()){
|
if (!res.isSuccess()) {
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
//获取设备sim
|
//获取设备sim
|
||||||
|
|
@ -296,34 +299,36 @@ public class DeviceManagerServiceImpl extends ServiceImpl<DeviceManagerMapper, D
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 拉取电表
|
* 拉取电表
|
||||||
|
*
|
||||||
* @param deviceIntegration
|
* @param deviceIntegration
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Result<String> deleteElectricity(DeviceIntegration deviceIntegration){
|
public Result<String> deleteElectricity(DeviceIntegration deviceIntegration) {
|
||||||
DsElectricityMeter dsElectricityMeter = new DsElectricityMeter();
|
DsElectricityMeter dsElectricityMeter = new DsElectricityMeter();
|
||||||
dsElectricityMeter.setSn(deviceIntegration.getSn());
|
dsElectricityMeter.setSn(deviceIntegration.getSn());
|
||||||
Result<String> res = electricityMeterService.delete(dsElectricityMeter);
|
Result<String> res = electricityMeterService.delete(dsElectricityMeter);
|
||||||
if(!res.isSuccess()){
|
if (!res.isSuccess()) {
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
return Result.OK("拉取电表成功!");
|
return Result.OK("拉取电表成功!");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IPage<DeviceIntegration> findWaterPage(Page<DeviceIntegration> page, DeviceIntegration deviceIntegration){
|
public IPage<DeviceIntegration> findWaterPage(Page<DeviceIntegration> page, DeviceIntegration deviceIntegration) {
|
||||||
return baseMapper.findWaterPage(page,deviceIntegration);
|
return baseMapper.findWaterPage(page, deviceIntegration);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 拉取水表
|
* 拉取水表
|
||||||
|
*
|
||||||
* @param deviceIntegration
|
* @param deviceIntegration
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Result<String> pullWater(DeviceIntegration deviceIntegration){
|
public Result<String> pullWater(DeviceIntegration deviceIntegration) {
|
||||||
TqDeviceInfo tqDeviceInfo = new TqDeviceInfo();
|
TqDeviceInfo tqDeviceInfo = new TqDeviceInfo();
|
||||||
tqDeviceInfo.setCid(deviceIntegration.getSn());
|
tqDeviceInfo.setCid(deviceIntegration.getSn());
|
||||||
String errorMsg = tqDeviceInfoService.addCollector(tqDeviceInfo);
|
String errorMsg = tqDeviceInfoService.addCollector(tqDeviceInfo);
|
||||||
if(!errorMsg.equals("")){
|
if (!errorMsg.equals("")) {
|
||||||
tqDeviceInfoService.deleteCollector(tqDeviceInfo);
|
tqDeviceInfoService.deleteCollector(tqDeviceInfo);
|
||||||
return Result.error(errorMsg);
|
return Result.error(errorMsg);
|
||||||
}
|
}
|
||||||
|
|
@ -331,7 +336,7 @@ public class DeviceManagerServiceImpl extends ServiceImpl<DeviceManagerMapper, D
|
||||||
waterMeter.setCid(deviceIntegration.getSn());
|
waterMeter.setCid(deviceIntegration.getSn());
|
||||||
waterMeter.setAddress(deviceIntegration.getSn());
|
waterMeter.setAddress(deviceIntegration.getSn());
|
||||||
errorMsg = waterMeterService.addWater(waterMeter);
|
errorMsg = waterMeterService.addWater(waterMeter);
|
||||||
if(!errorMsg.equals("")){
|
if (!errorMsg.equals("")) {
|
||||||
waterMeterService.deleteWater(waterMeter);
|
waterMeterService.deleteWater(waterMeter);
|
||||||
return Result.error(errorMsg);
|
return Result.error(errorMsg);
|
||||||
}
|
}
|
||||||
|
|
@ -340,14 +345,14 @@ public class DeviceManagerServiceImpl extends ServiceImpl<DeviceManagerMapper, D
|
||||||
// 2、或在异步中判断opr_id进行推送
|
// 2、或在异步中判断opr_id进行推送
|
||||||
// waterMeter.setOprId("集成");
|
// waterMeter.setOprId("集成");
|
||||||
Result<String> res = waterMeterService.waterRead(waterMeter);
|
Result<String> res = waterMeterService.waterRead(waterMeter);
|
||||||
if(!res.isSuccess()){
|
if (!res.isSuccess()) {
|
||||||
tqDeviceInfoService.deleteCollector(tqDeviceInfo);
|
tqDeviceInfoService.deleteCollector(tqDeviceInfo);
|
||||||
waterMeterService.deleteWater(waterMeter);
|
waterMeterService.deleteWater(waterMeter);
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
tqDeviceInfoService.getAllMeter(true);
|
tqDeviceInfoService.getAllMeter(true);
|
||||||
tqDeviceInfoService.getAllCollector(true);
|
tqDeviceInfoService.getAllCollector(true);
|
||||||
syncBizService.syncDevice(deviceIntegration.getOrgCode(),deviceIntegration.getSn());
|
syncBizService.syncDevice(deviceIntegration.getOrgCode(), deviceIntegration.getSn());
|
||||||
deviceIntegration.setDeviceStatus("正常");
|
deviceIntegration.setDeviceStatus("正常");
|
||||||
baseMapper.editPreviewStatusBySn(deviceIntegration);
|
baseMapper.editPreviewStatusBySn(deviceIntegration);
|
||||||
return Result.OK("拉取水表成功!");
|
return Result.OK("拉取水表成功!");
|
||||||
|
|
@ -355,26 +360,27 @@ public class DeviceManagerServiceImpl extends ServiceImpl<DeviceManagerMapper, D
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IPage<DeviceIntegration> findHumidPage(Page<DeviceIntegration> page, DeviceIntegration deviceIntegration){
|
public IPage<DeviceIntegration> findHumidPage(Page<DeviceIntegration> page, DeviceIntegration deviceIntegration) {
|
||||||
return baseMapper.findHumidPage(page,deviceIntegration);
|
return baseMapper.findHumidPage(page, deviceIntegration);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 拉取温湿度计
|
* 拉取温湿度计
|
||||||
|
*
|
||||||
* @param deviceIntegration
|
* @param deviceIntegration
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Result<String> pullHumid(DeviceIntegration deviceIntegration){
|
public Result<String> pullHumid(DeviceIntegration deviceIntegration) {
|
||||||
HumidDevice humidDevice = new HumidDevice();
|
HumidDevice humidDevice = new HumidDevice();
|
||||||
humidDevice.setSn(deviceIntegration.getSn());
|
humidDevice.setSn(deviceIntegration.getSn());
|
||||||
humidDevice.setDeviceName(deviceIntegration.getDeviceName());
|
humidDevice.setDeviceName(deviceIntegration.getDeviceName());
|
||||||
humidDevice.setTimeCode("01");
|
humidDevice.setTimeCode("01");
|
||||||
Result<String> res = humidDeviceService.insertDevice(humidDevice);
|
Result<String> res = humidDeviceService.insertDevice(humidDevice);
|
||||||
if(!res.isSuccess()){
|
if (!res.isSuccess()) {
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
res = syncBizService.syncDevice(deviceIntegration.getOrgCode(),deviceIntegration.getSn());
|
res = syncBizService.syncDevice(deviceIntegration.getOrgCode(), deviceIntegration.getSn());
|
||||||
if(!res.isSuccess()){
|
if (!res.isSuccess()) {
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
deviceIntegration.setDeviceStatus("正常");
|
deviceIntegration.setDeviceStatus("正常");
|
||||||
|
|
@ -383,16 +389,16 @@ public class DeviceManagerServiceImpl extends ServiceImpl<DeviceManagerMapper, D
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IPage<DeviceBindLog> findBingLogPage(Page<DeviceBindLog> page, DeviceBindLog deviceBindLog){
|
public IPage<DeviceBindLog> findBingLogPage(Page<DeviceBindLog> page, DeviceBindLog deviceBindLog) {
|
||||||
return baseMapper.findBingLogPage(page,deviceBindLog);
|
return baseMapper.findBingLogPage(page, deviceBindLog);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addBindPreview(DeviceBindLog deviceBindLog){
|
public void addBindPreview(DeviceBindLog deviceBindLog) {
|
||||||
baseMapper.addBindPreview(deviceBindLog);
|
baseMapper.addBindPreview(deviceBindLog);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String addLog(String orgCode,String orgName,String json,String type,String iotType){
|
public String addLog(String orgCode, String orgName, String json, String type, String iotType) {
|
||||||
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
||||||
|
|
||||||
String logId = UuidUtils.getUUID();
|
String logId = UuidUtils.getUUID();
|
||||||
|
|
@ -412,9 +418,14 @@ public class DeviceManagerServiceImpl extends ServiceImpl<DeviceManagerMapper, D
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void releaseNu(String orgCode,String nuId){
|
public void releaseNu(String orgCode, String nuId) {
|
||||||
baseMapper.addDeviceReleaseLog(orgCode,nuId);// 记录设备释放日志
|
baseMapper.addDeviceReleaseLog(orgCode, nuId);// 记录设备释放日志
|
||||||
baseMapper.releaseNu(orgCode,nuId);// 更新湿度计
|
baseMapper.releaseNu(orgCode, nuId);// 更新湿度计
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<DevicePreview> queryQuantityByOrgCode(String batchNo, String orgCode) {
|
||||||
|
return baseMapper.queryQuantityByOrgCode(batchNo, orgCode);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String formatMacAddress(String mac) {
|
public String formatMacAddress(String mac) {
|
||||||
|
|
@ -428,4 +439,130 @@ public class DeviceManagerServiceImpl extends ServiceImpl<DeviceManagerMapper, D
|
||||||
// 使用正则表达式每2个字符插入一个"-"
|
// 使用正则表达式每2个字符插入一个"-"
|
||||||
return mac.toUpperCase().replaceAll("(.{2})(?!$)", "$1-");
|
return mac.toUpperCase().replaceAll("(.{2})(?!$)", "$1-");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@DS("#orgCode")
|
||||||
|
public Map<String, Map<String, Object>> getNuListByOrgCode(String orgCode) {
|
||||||
|
//护理单元
|
||||||
|
List<DeviceNuBaseInfoEntity> list = baseMapper.selectAllNu();
|
||||||
|
Map<String, Map<String, Object>> result = new HashMap<>();
|
||||||
|
//设备信息
|
||||||
|
List<DeviceNuBaseInfoEntity> wlsbList = baseMapper.selectWlsbList();
|
||||||
|
//基础功能
|
||||||
|
List<DeviceNuBaseInfoEntity> jcgnList = baseMapper.selectJcgnList();
|
||||||
|
List<DeviceNuBaseInfoEntity> mergedTrees = buildTree(jcgnList);
|
||||||
|
|
||||||
|
for (DeviceNuBaseInfoEntity info : list) {
|
||||||
|
String sxtStr = "";//摄像头集合
|
||||||
|
String dbStr = "";//电表集合
|
||||||
|
String sbStr = "";//水表集合
|
||||||
|
String wsdjStr = "";//温湿度计集合
|
||||||
|
List<DeviceNuBaseInfoEntity> children = new ArrayList<>();
|
||||||
|
if (wlsbList == null) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
for (DeviceNuBaseInfoEntity wlsb : wlsbList) {
|
||||||
|
if (info.getNuId().equals(wlsb.getNuId())) {
|
||||||
|
if ("SURVEILLANCECAMERA".equals(wlsb.getDeviceType())) {
|
||||||
|
sxtStr = sxtStr + wlsb.getNuId() + ",";
|
||||||
|
} else if ("db".equals(wlsb.getDeviceType())) {
|
||||||
|
dbStr = dbStr + wlsb.getNuId() + ",";
|
||||||
|
} else if ("sb".equals(wlsb.getDeviceType())) {
|
||||||
|
sbStr = sbStr + wlsb.getNuId() + ",";
|
||||||
|
} else if ("wsdj".equals(wlsb.getDeviceType())) {
|
||||||
|
wsdjStr = wsdjStr + wlsb.getNuId() + ",";
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (sxtStr.length() > 0) sxtStr = sxtStr.split(",").length + "";
|
||||||
|
if (dbStr.length() > 0) dbStr = dbStr.split(",").length + "";
|
||||||
|
if (sbStr.length() > 0) sbStr = sbStr.split(",").length + "";
|
||||||
|
if (wsdjStr.length() > 0) wsdjStr = wsdjStr.split(",").length + "";
|
||||||
|
|
||||||
|
for (DeviceNuBaseInfoEntity mergedTree : mergedTrees) {
|
||||||
|
if (info.getNuId().equals(mergedTree.getNuId())) {
|
||||||
|
children.add(mergedTree);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Map<String, Object> map = Map.of(
|
||||||
|
"nuId", info.getNuId(),
|
||||||
|
"nuName", info.getNuName(),
|
||||||
|
"status", info.getStatus(),
|
||||||
|
"sxtList", sxtStr,
|
||||||
|
"dbList", dbStr,
|
||||||
|
"sbList", sbStr,
|
||||||
|
"wsdjList", wsdjStr,
|
||||||
|
"children", children
|
||||||
|
);
|
||||||
|
result.put(info.getNuId(),map);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 构建分类树
|
||||||
|
*
|
||||||
|
* @param nodes 原始节点列表
|
||||||
|
* @return 根节点列表
|
||||||
|
*/
|
||||||
|
public List<DeviceNuBaseInfoEntity> buildTree(List<DeviceNuBaseInfoEntity> nodes) {
|
||||||
|
// 按 nuId 分组
|
||||||
|
Map<String, List<DeviceNuBaseInfoEntity>> groupByNuId = nodes.stream()
|
||||||
|
.collect(Collectors.groupingBy(DeviceNuBaseInfoEntity::getNuId));
|
||||||
|
|
||||||
|
List<DeviceNuBaseInfoEntity> allRootNodes = new ArrayList<>();
|
||||||
|
|
||||||
|
// 对每个 nuId 分组单独构建树
|
||||||
|
for (Map.Entry<String, List<DeviceNuBaseInfoEntity>> entry : groupByNuId.entrySet()) {
|
||||||
|
String nuId = entry.getKey();
|
||||||
|
List<DeviceNuBaseInfoEntity> sameNuIdNodes = entry.getValue();
|
||||||
|
|
||||||
|
List<DeviceNuBaseInfoEntity> rootNodes = buildSingleTree(sameNuIdNodes, nuId);
|
||||||
|
allRootNodes.addAll(rootNodes);
|
||||||
|
}
|
||||||
|
|
||||||
|
return allRootNodes;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 构建单个 nuId 的分类树
|
||||||
|
*/
|
||||||
|
private List<DeviceNuBaseInfoEntity> buildSingleTree(List<DeviceNuBaseInfoEntity> nodes, String nuId) {
|
||||||
|
List<DeviceNuBaseInfoEntity> rootNodes = new ArrayList<>();
|
||||||
|
Map<String, DeviceNuBaseInfoEntity> nodeMap = new HashMap<>();
|
||||||
|
|
||||||
|
// 第一步:将所有节点存入map
|
||||||
|
for (DeviceNuBaseInfoEntity node : nodes) {
|
||||||
|
nodeMap.put(node.getId(), node);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 第二步:建立父子关系
|
||||||
|
for (DeviceNuBaseInfoEntity node : nodes) {
|
||||||
|
String parentId = node.getParentId();
|
||||||
|
|
||||||
|
if (parentId == null || parentId.isEmpty() || parentId.equals("0")) {
|
||||||
|
// 根节点
|
||||||
|
rootNodes.add(node);
|
||||||
|
} else {
|
||||||
|
// 查找父节点
|
||||||
|
DeviceNuBaseInfoEntity parent = nodeMap.get(parentId);
|
||||||
|
if (parent != null) {
|
||||||
|
// 父节点存在,添加到父节点的children
|
||||||
|
if (parent.getChildren() == null) {
|
||||||
|
parent.setChildren(new ArrayList<>());
|
||||||
|
}
|
||||||
|
parent.getChildren().add(node);
|
||||||
|
} else {
|
||||||
|
// 父节点不存在,作为根节点处理
|
||||||
|
rootNodes.add(node);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return rootNodes;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue