设备管理-设备清单-批次的设备清单-新增区域维度功能调整:展示机构+批次下所有护理单元的护理单元信息、已配置基础服务、设备信息数量
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.manager.entity.*;
|
||||
import com.nu.modules.device.manager.service.IDeviceManagerService;
|
||||
import dm.jdbc.util.StringUtil;
|
||||
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.aspect.annotation.AutoLog;
|
||||
import org.jeecg.common.system.base.controller.JeecgController;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.Arrays;
|
||||
|
|
@ -194,6 +198,44 @@ public class DeviceManagerController extends JeecgController<DeviceManager, IDev
|
|||
return Result.OK("修改成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询对应机构+批次 各护理单元已配置的设备数量
|
||||
* @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删除
|
||||
*
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -16,39 +16,77 @@ import java.util.List;
|
|||
*/
|
||||
public interface DeviceManagerMapper extends BaseMapper<DeviceManager> {
|
||||
IPage<DeviceManager> findPlanPage(Page<DeviceManager> page, @Param("params") DeviceManager deviceManager);
|
||||
|
||||
IPage<DeviceBatch> findBatchPage(Page<DeviceBatch> page, @Param("params") DeviceBatch deviceBatch);
|
||||
|
||||
void saveBatch(DeviceBatch deviceBatch);
|
||||
|
||||
void updateBatch(DeviceBatch deviceBatch);
|
||||
|
||||
void removeBatch(DeviceBatch deviceBatch);
|
||||
|
||||
void removePlanByBatch(DeviceBatch deviceBatch);
|
||||
|
||||
void syncBatch(DevicePreview devicePreview);
|
||||
|
||||
List<DevicePreview> queryNuList(DevicePreview devicePreview);
|
||||
|
||||
IPage<DevicePreview> findDepartPreviewPlanPage(Page<DevicePreview> page, @Param("params") DevicePreview devicePreview);
|
||||
|
||||
IPage<DevicePreview> findNuPreviewPlanPage(Page<DevicePreview> page, @Param("params") DevicePreview devicePreview);
|
||||
|
||||
List<DevicePreview> getPreviewPlanList(DevicePreview devicePreview);
|
||||
|
||||
int addPreviewPlan(DevicePreview devicePreview);
|
||||
|
||||
void updatePreviewPlan(DevicePreview devicePreview);
|
||||
|
||||
void deletePreviewPlanById(DevicePreview devicePreview);
|
||||
|
||||
void deletePreviewPlanByBatch(DeviceBatch deviceBatch);
|
||||
|
||||
DevicePreview getPreviewPlanQuantity(DevicePreview devicePreview);
|
||||
|
||||
void deletePreviewByBatch(DevicePreview devicePreview);
|
||||
|
||||
int addPreview(DevicePreview devicePreview);
|
||||
|
||||
List<DevicePreview> getPreviewList(DevicePreview devicePreview);
|
||||
// DevicePreview getPreview(DevicePreview devicePreview);
|
||||
|
||||
void syncPreview(String id);
|
||||
|
||||
void editPreviewStatusBySn(DeviceIntegration deviceIntegration);
|
||||
|
||||
void deletePreviewById(String id);
|
||||
|
||||
void editPreviewSn(DevicePreview devicePreview);
|
||||
|
||||
void bindPreview(DevicePreview devicePreview);
|
||||
|
||||
IPage<DeviceIntegration> findCameraPage(Page<DeviceIntegration> page, @Param("params") DeviceIntegration deviceIntegration);
|
||||
|
||||
IPage<DeviceIntegration> findNetworkPage(Page<DeviceIntegration> page, @Param("params") DeviceIntegration deviceIntegration);
|
||||
|
||||
IPage<DeviceIntegration> findElectricityPage(Page<DeviceIntegration> page, @Param("params") DeviceIntegration deviceIntegration);
|
||||
|
||||
IPage<DeviceIntegration> findWaterPage(Page<DeviceIntegration> page, @Param("params") DeviceIntegration deviceIntegration);
|
||||
|
||||
IPage<DeviceIntegration> findHumidPage(Page<DeviceIntegration> page, @Param("params") DeviceIntegration deviceIntegration);
|
||||
|
||||
IPage<DeviceBindLog> findBingLogPage(Page<DeviceBindLog> page, @Param("params") DeviceBindLog deviceBindLog);
|
||||
|
||||
void addBindPreview(DeviceBindLog deviceBindLog);
|
||||
|
||||
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,7 +2,8 @@
|
|||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.nu.modules.device.manager.mapper.DeviceManagerMapper">
|
||||
|
||||
<select id="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,
|
||||
a.org_code,
|
||||
a.depart_name,
|
||||
|
|
@ -23,7 +24,8 @@
|
|||
order by a.org_code desc
|
||||
</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,
|
||||
a.batch_no,
|
||||
a.org_code,
|
||||
|
|
@ -44,23 +46,20 @@
|
|||
order by a.create_time desc
|
||||
</select>
|
||||
|
||||
<insert id="saveBatch" parameterType="com.nu.modules.device.manager.entity.DevicePreview" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into nu_iot_device_preview_batch(
|
||||
batch_no,
|
||||
<insert id="saveBatch" parameterType="com.nu.modules.device.manager.entity.DevicePreview" useGeneratedKeys="true"
|
||||
keyProperty="id">
|
||||
insert into nu_iot_device_preview_batch(batch_no,
|
||||
org_code,
|
||||
iz_push,
|
||||
create_time,
|
||||
create_by,
|
||||
remarks
|
||||
)
|
||||
values(
|
||||
#{batchNo},
|
||||
remarks)
|
||||
values (#{batchNo},
|
||||
#{orgCode},
|
||||
'N',
|
||||
now(),
|
||||
#{createBy},
|
||||
#{remarks}
|
||||
)
|
||||
#{remarks})
|
||||
</insert>
|
||||
|
||||
<update id="updateBatch">
|
||||
|
|
@ -73,11 +72,15 @@
|
|||
</update>
|
||||
|
||||
<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 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>
|
||||
|
||||
<update id="syncBatch">
|
||||
|
|
@ -87,7 +90,8 @@
|
|||
where batch_no = #{batchNo}
|
||||
</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"
|
||||
resultType="com.nu.modules.device.manager.entity.DevicePreview">
|
||||
select nu_id, nu_name
|
||||
from nu_base_info
|
||||
where status != '5'
|
||||
|
|
@ -95,7 +99,8 @@
|
|||
order by nu_id asc
|
||||
</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
|
||||
a.org_code,
|
||||
b.depart_name,
|
||||
|
|
@ -119,7 +124,8 @@
|
|||
order by a.device_type asc
|
||||
</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
|
||||
a.id,
|
||||
a.org_code,
|
||||
|
|
@ -149,7 +155,8 @@
|
|||
order by a.nu_id,a.device_type asc
|
||||
</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,
|
||||
batch_no,
|
||||
org_code,
|
||||
|
|
@ -187,9 +194,9 @@
|
|||
</where>
|
||||
</select>
|
||||
|
||||
<insert id="addPreviewPlan" parameterType="com.nu.modules.device.manager.entity.DevicePreview" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into nu_iot_device_preview_plan(
|
||||
org_code,
|
||||
<insert id="addPreviewPlan" parameterType="com.nu.modules.device.manager.entity.DevicePreview"
|
||||
useGeneratedKeys="true" keyProperty="id">
|
||||
insert into nu_iot_device_preview_plan(org_code,
|
||||
nu_id,
|
||||
batch_no,
|
||||
device_name,
|
||||
|
|
@ -199,10 +206,8 @@
|
|||
dimension,
|
||||
create_time,
|
||||
create_by,
|
||||
purchase_quantity
|
||||
)
|
||||
values(
|
||||
#{orgCode},
|
||||
purchase_quantity)
|
||||
values (#{orgCode},
|
||||
#{nuId},
|
||||
#{batchNo},
|
||||
#{deviceName},
|
||||
|
|
@ -212,39 +217,48 @@
|
|||
#{dimension},
|
||||
now(),
|
||||
#{createBy},
|
||||
#{purchaseQuantity}
|
||||
)
|
||||
#{purchaseQuantity})
|
||||
</insert>
|
||||
|
||||
<update id="updatePreviewPlan">
|
||||
update nu_iot_device_preview_plan
|
||||
set nu_id = #{nuId},
|
||||
set
|
||||
<if test="nuId !=null and nuId != ''">
|
||||
nu_id = #{nuId},
|
||||
</if>
|
||||
purchase_quantity = #{purchaseQuantity},
|
||||
update_time = now()
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<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 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>
|
||||
|
||||
<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
|
||||
from nu_iot_device_preview_plan
|
||||
where batch_no = #{batchNo}
|
||||
</select>
|
||||
|
||||
<delete id="deletePreviewByBatch">
|
||||
delete from nu_iot_device_preview where batch_no = #{batchNo}
|
||||
delete
|
||||
from nu_iot_device_preview
|
||||
where batch_no = #{batchNo}
|
||||
</delete>
|
||||
|
||||
<insert id="addPreview" parameterType="com.nu.modules.device.manager.entity.DevicePreview" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into nu_iot_device_preview(
|
||||
org_code,
|
||||
<insert id="addPreview" parameterType="com.nu.modules.device.manager.entity.DevicePreview" useGeneratedKeys="true"
|
||||
keyProperty="id">
|
||||
insert into nu_iot_device_preview(org_code,
|
||||
nu_id,
|
||||
batch_no,
|
||||
device_name,
|
||||
|
|
@ -253,10 +267,8 @@
|
|||
factory,
|
||||
dimension,
|
||||
create_time,
|
||||
create_by
|
||||
)
|
||||
values(
|
||||
#{orgCode},
|
||||
create_by)
|
||||
values (#{orgCode},
|
||||
#{nuId},
|
||||
#{batchNo},
|
||||
#{deviceName},
|
||||
|
|
@ -265,11 +277,11 @@
|
|||
#{factory},
|
||||
#{dimension},
|
||||
now(),
|
||||
#{createBy}
|
||||
)
|
||||
#{createBy})
|
||||
</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,
|
||||
org_code,
|
||||
nu_id,
|
||||
|
|
@ -379,7 +391,9 @@
|
|||
</update>
|
||||
|
||||
<delete id="deletePreviewById">
|
||||
delete from nu_iot_device_preview where id = #{id}
|
||||
delete
|
||||
from nu_iot_device_preview
|
||||
where id = #{id}
|
||||
</delete>
|
||||
|
||||
<update id="editPreviewSn">
|
||||
|
|
@ -396,9 +410,9 @@
|
|||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<select id="findCameraPage" parameterType="com.nu.modules.device.manager.entity.DeviceIntegration" resultType="com.nu.modules.device.manager.entity.DeviceIntegration">
|
||||
select
|
||||
a.org_code,
|
||||
<select id="findCameraPage" parameterType="com.nu.modules.device.manager.entity.DeviceIntegration"
|
||||
resultType="com.nu.modules.device.manager.entity.DeviceIntegration">
|
||||
select a.org_code,
|
||||
a.dimension,
|
||||
a.sn,
|
||||
a.device_name,
|
||||
|
|
@ -406,7 +420,8 @@
|
|||
a.device_model,
|
||||
a.factory,
|
||||
(
|
||||
case when b.id is null then '待集成'
|
||||
case
|
||||
when b.id is null then '待集成'
|
||||
else (case ifnull(b.device_status, '') when '0' then '离线' when '1' then '在线' else '-' end)
|
||||
end
|
||||
) as device_status,
|
||||
|
|
@ -419,9 +434,9 @@
|
|||
order by a.id
|
||||
</select>
|
||||
|
||||
<select id="findNetworkPage" parameterType="com.nu.modules.device.manager.entity.DeviceIntegration" resultType="com.nu.modules.device.manager.entity.DeviceIntegration">
|
||||
select
|
||||
a.org_code,
|
||||
<select id="findNetworkPage" parameterType="com.nu.modules.device.manager.entity.DeviceIntegration"
|
||||
resultType="com.nu.modules.device.manager.entity.DeviceIntegration">
|
||||
select a.org_code,
|
||||
a.dimension,
|
||||
a.sn,
|
||||
a.device_name,
|
||||
|
|
@ -429,7 +444,8 @@
|
|||
a.device_model,
|
||||
a.factory,
|
||||
(
|
||||
case when b.id is null then '待集成'
|
||||
case
|
||||
when b.id is null then '待集成'
|
||||
else (case ifnull(b.device_status, '') when '0' then '离线' when '1' then '在线' else '-' end)
|
||||
end
|
||||
) as device_status,
|
||||
|
|
@ -441,9 +457,9 @@
|
|||
order by a.id
|
||||
</select>
|
||||
|
||||
<select id="findElectricityPage" parameterType="com.nu.modules.device.manager.entity.DeviceIntegration" resultType="com.nu.modules.device.manager.entity.DeviceIntegration">
|
||||
select
|
||||
a.org_code,
|
||||
<select id="findElectricityPage" parameterType="com.nu.modules.device.manager.entity.DeviceIntegration"
|
||||
resultType="com.nu.modules.device.manager.entity.DeviceIntegration">
|
||||
select a.org_code,
|
||||
a.dimension,
|
||||
a.sn,
|
||||
a.device_name,
|
||||
|
|
@ -451,10 +467,15 @@
|
|||
a.device_model,
|
||||
a.factory,
|
||||
(
|
||||
case when b.id is null then '待集成'
|
||||
case
|
||||
when b.id is null then '待集成'
|
||||
else
|
||||
(case when b.sim is null then '待集成'
|
||||
else (case ifnull(b.relay_state,'') when '0' then '拉闸' when '1' then '合闸' else '-' end) end)
|
||||
(case
|
||||
when b.sim is null then '待集成'
|
||||
else (case ifnull(b.relay_state, '')
|
||||
when '0' then '拉闸'
|
||||
when '1' then '合闸'
|
||||
else '-' end) end)
|
||||
end
|
||||
) as device_status,
|
||||
a.device_status as maintainStatus
|
||||
|
|
@ -465,9 +486,9 @@
|
|||
order by a.id
|
||||
</select>
|
||||
|
||||
<select id="findWaterPage" parameterType="com.nu.modules.device.manager.entity.DeviceIntegration" resultType="com.nu.modules.device.manager.entity.DeviceIntegration">
|
||||
select
|
||||
a.org_code,
|
||||
<select id="findWaterPage" parameterType="com.nu.modules.device.manager.entity.DeviceIntegration"
|
||||
resultType="com.nu.modules.device.manager.entity.DeviceIntegration">
|
||||
select a.org_code,
|
||||
a.dimension,
|
||||
a.sn,
|
||||
a.device_name,
|
||||
|
|
@ -475,7 +496,8 @@
|
|||
a.device_model,
|
||||
a.factory,
|
||||
(
|
||||
case when b.id is null then '待集成'
|
||||
case
|
||||
when b.id is null then '待集成'
|
||||
else (case ifnull(b.relay_state, '') when '0' then '关阀' when '1' then '开阀' else '-' end)
|
||||
end
|
||||
) as device_status,
|
||||
|
|
@ -487,9 +509,9 @@
|
|||
order by a.id
|
||||
</select>
|
||||
|
||||
<select id="findHumidPage" parameterType="com.nu.modules.device.manager.entity.DeviceIntegration" resultType="com.nu.modules.device.manager.entity.DeviceIntegration">
|
||||
select
|
||||
a.org_code,
|
||||
<select id="findHumidPage" parameterType="com.nu.modules.device.manager.entity.DeviceIntegration"
|
||||
resultType="com.nu.modules.device.manager.entity.DeviceIntegration">
|
||||
select a.org_code,
|
||||
a.dimension,
|
||||
a.sn,
|
||||
a.device_name,
|
||||
|
|
@ -497,7 +519,8 @@
|
|||
a.device_model,
|
||||
a.factory,
|
||||
(
|
||||
case when b.id is null then '待集成'
|
||||
case
|
||||
when b.id is null then '待集成'
|
||||
else (case ifnull(b.status, '') when '0' then '在线' when '1' then '离线' else '-' end)
|
||||
end
|
||||
) as device_status,
|
||||
|
|
@ -509,7 +532,8 @@
|
|||
order by a.id
|
||||
</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
|
||||
id,
|
||||
org_code,
|
||||
|
|
@ -538,9 +562,35 @@
|
|||
order by org_code asc ,factory asc ,device_type asc ,device_model asc ,sn asc,opt_date desc
|
||||
</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 into nu_iot_device_bind_log(
|
||||
org_code,
|
||||
insert into nu_iot_device_bind_log(org_code,
|
||||
nu_id,
|
||||
nu_name,
|
||||
dimension,
|
||||
|
|
@ -551,9 +601,8 @@
|
|||
factory,
|
||||
opt_date,
|
||||
opt_type,
|
||||
remarks
|
||||
)values(
|
||||
#{orgCode},
|
||||
remarks)
|
||||
values (#{orgCode},
|
||||
#{nuId},
|
||||
#{nuName},
|
||||
#{dimension},
|
||||
|
|
@ -564,13 +613,11 @@
|
|||
#{factory},
|
||||
now(),
|
||||
#{optType},
|
||||
#{remarks}
|
||||
)
|
||||
#{remarks})
|
||||
</insert>
|
||||
|
||||
<insert id="addDeviceReleaseLog">
|
||||
insert into nu_iot_device_bind_log(
|
||||
org_code,
|
||||
insert into nu_iot_device_bind_log(org_code,
|
||||
sn,
|
||||
dimension,
|
||||
device_name,
|
||||
|
|
@ -579,10 +626,8 @@
|
|||
factory,
|
||||
opt_date,
|
||||
opt_type,
|
||||
remarks
|
||||
)
|
||||
select
|
||||
#{orgCode},
|
||||
remarks)
|
||||
select #{orgCode},
|
||||
sn,
|
||||
dimension,
|
||||
device_name,
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ import com.nu.modules.device.manager.entity.*;
|
|||
import org.jeecg.common.api.vo.Result;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @Description: 设备管理-机构信息
|
||||
|
|
@ -48,4 +49,7 @@ public interface IDeviceManagerService extends IService<DeviceManager> {
|
|||
void addBindPreview(DeviceBindLog deviceBindLog);
|
||||
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 com.alibaba.fastjson.JSON;
|
||||
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.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
|
|
@ -40,9 +42,8 @@ import org.springframework.transaction.annotation.Transactional;
|
|||
|
||||
import java.time.LocalDate;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @Description: 设备管理-机构信息
|
||||
|
|
@ -240,6 +241,7 @@ public class DeviceManagerServiceImpl extends ServiceImpl<DeviceManagerMapper, D
|
|||
|
||||
/**
|
||||
* 拉取监控设备
|
||||
*
|
||||
* @param deviceIntegration
|
||||
*/
|
||||
@Override
|
||||
|
|
@ -273,6 +275,7 @@ public class DeviceManagerServiceImpl extends ServiceImpl<DeviceManagerMapper, D
|
|||
|
||||
/**
|
||||
* 拉取电表
|
||||
*
|
||||
* @param deviceIntegration
|
||||
*/
|
||||
@Override
|
||||
|
|
@ -296,6 +299,7 @@ public class DeviceManagerServiceImpl extends ServiceImpl<DeviceManagerMapper, D
|
|||
|
||||
/**
|
||||
* 拉取电表
|
||||
*
|
||||
* @param deviceIntegration
|
||||
*/
|
||||
@Override
|
||||
|
|
@ -316,6 +320,7 @@ public class DeviceManagerServiceImpl extends ServiceImpl<DeviceManagerMapper, D
|
|||
|
||||
/**
|
||||
* 拉取水表
|
||||
*
|
||||
* @param deviceIntegration
|
||||
*/
|
||||
@Override
|
||||
|
|
@ -361,6 +366,7 @@ public class DeviceManagerServiceImpl extends ServiceImpl<DeviceManagerMapper, D
|
|||
|
||||
/**
|
||||
* 拉取温湿度计
|
||||
*
|
||||
* @param deviceIntegration
|
||||
*/
|
||||
@Override
|
||||
|
|
@ -417,6 +423,11 @@ public class DeviceManagerServiceImpl extends ServiceImpl<DeviceManagerMapper, D
|
|||
baseMapper.releaseNu(orgCode, nuId);// 更新湿度计
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DevicePreview> queryQuantityByOrgCode(String batchNo, String orgCode) {
|
||||
return baseMapper.queryQuantityByOrgCode(batchNo, orgCode);
|
||||
}
|
||||
|
||||
public String formatMacAddress(String mac) {
|
||||
if (mac == null || mac.length() != 12) {
|
||||
throw new IllegalArgumentException("MAC地址必须为12位十六进制字符");
|
||||
|
|
@ -428,4 +439,130 @@ public class DeviceManagerServiceImpl extends ServiceImpl<DeviceManagerMapper, D
|
|||
// 使用正则表达式每2个字符插入一个"-"
|
||||
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