设备维护
This commit is contained in:
parent
6a60335df6
commit
e35ecb16ac
|
@ -47,6 +47,10 @@
|
|||
<version>2.0.0</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.nursingunit.boot</groupId>
|
||||
<artifactId>nu-system-biz</artifactId>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
|
|
|
@ -321,6 +321,8 @@ public class CameraInfo implements Serializable {
|
|||
private String oldDepartName;//原机构名称
|
||||
|
||||
private String maintainStatus;//维修状态 0正常 1报修 2报废
|
||||
private String reserveDepartId;//预留机构ID
|
||||
private String reserveDepartName;//预留机构名称
|
||||
|
||||
@TableField(exist = false)
|
||||
private String checkType;
|
||||
|
|
|
@ -86,6 +86,9 @@ public class ElectricityMeter implements Serializable {
|
|||
private String oldDepartId;//原机构id
|
||||
private String oldDepartName;//原机构名称
|
||||
private String maintainStatus;//维修状态 0正常 1报修 2报废
|
||||
private String reserveDepartId;//预留机构ID
|
||||
private String reserveDepartName;//预留机构名称
|
||||
|
||||
@TableField(exist = false)
|
||||
private String oldOrgCode;//原机构编码
|
||||
@TableField(exist = false)
|
||||
|
|
|
@ -89,6 +89,9 @@ public class WaterMeter implements Serializable {
|
|||
private String oldDepartId;//原机构id
|
||||
private String oldDepartName;//原机构名称
|
||||
private String maintainStatus;//维修状态 0正常 1报修 2报废
|
||||
private String reserveDepartId;//预留机构ID
|
||||
private String reserveDepartName;//预留机构名称
|
||||
|
||||
@TableField(exist = false)
|
||||
private String checkType;
|
||||
@TableField(exist = false)
|
||||
|
|
|
@ -0,0 +1,54 @@
|
|||
package com.nu.modules.weihu.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.nu.modules.weihu.entity.DeviceMaintain;
|
||||
import com.nu.modules.weihu.service.DeviceMaintainService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.common.system.base.controller.JeecgController;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/iot/weihu/deviceMaintain")
|
||||
public class DeviceMaintainController extends JeecgController<DeviceMaintain, DeviceMaintainService> {
|
||||
|
||||
@Autowired
|
||||
private DeviceMaintainService service;
|
||||
|
||||
/**
|
||||
* 分页列表查询
|
||||
*
|
||||
* @param deviceInfo
|
||||
* @param pageNo
|
||||
* @param pageSize
|
||||
* @param req
|
||||
* @return
|
||||
*/
|
||||
@GetMapping(value = "/list")
|
||||
public Result<IPage<DeviceMaintain>> queryPageList(DeviceMaintain deviceInfo,
|
||||
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
|
||||
HttpServletRequest req) {
|
||||
Page<DeviceMaintain> page = new Page<DeviceMaintain>(pageNo, pageSize);
|
||||
IPage<DeviceMaintain> pageList = service.findPage(page, deviceInfo);
|
||||
return Result.OK(pageList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 指派机构
|
||||
*
|
||||
* @param deviceInfo
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/saveSendOrg", method = {RequestMethod.PUT,RequestMethod.POST})
|
||||
public Result<String> saveSendOrg(@RequestBody DeviceMaintain deviceInfo) {
|
||||
service.saveSendOrg(deviceInfo);
|
||||
return Result.OK("操作成功!");
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,48 @@
|
|||
package com.nu.modules.weihu.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>Class:设备维护表Entity
|
||||
*/
|
||||
@Data
|
||||
@TableName("nu_iot_weihu_info")
|
||||
public class DeviceMaintain implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
private String id;//主键
|
||||
private String type;//设备类型
|
||||
private String deviceId;//设备编码
|
||||
private String remark;//备注
|
||||
private String updateDate;//更新时间
|
||||
@TableField(exist = false)
|
||||
private String sn;//设备SN号
|
||||
@TableField(exist = false)
|
||||
private String deviceName;//设备名称
|
||||
@TableField(exist = false)
|
||||
private String nuId;//区域编码
|
||||
@TableField(exist = false)
|
||||
private String nuName;//区域名称
|
||||
@TableField(exist = false)
|
||||
private String maintainStatus;//维修状态 0正常 1报修 2报废
|
||||
@TableField(exist = false)
|
||||
private String departId;//机构ID
|
||||
@TableField(exist = false)
|
||||
private String departName;//机构名称
|
||||
@TableField(exist = false)
|
||||
private String orgCode;//机构编码
|
||||
@TableField(exist = false)
|
||||
private String reserveDepartId;//预留机构ID,记录发往机构的设备归属
|
||||
@TableField(exist = false)
|
||||
private String reserveDepartName;//预留机构名称,记录发往机构的设备归属
|
||||
|
||||
@TableField(exist = false)
|
||||
private List<DeviceMaintain> deviceMaintainList;//子列表
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
package com.nu.modules.weihu.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.nu.modules.weihu.entity.DeviceMaintain;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
public interface DeviceMaintainMapper extends BaseMapper<DeviceMaintain> {
|
||||
IPage<DeviceMaintain> findPage(Page<DeviceMaintain> page, @Param("params") DeviceMaintain deviceInfo);
|
||||
}
|
|
@ -0,0 +1,152 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.nu.modules.weihu.mapper.DeviceMaintainMapper">
|
||||
<select id="findPage" parameterType="com.nu.modules.weihu.entity.DeviceMaintain" resultType="com.nu.modules.weihu.entity.DeviceMaintain">
|
||||
select * from (
|
||||
select
|
||||
a.mac as id,
|
||||
a.mac as deviceId,
|
||||
a.sn,
|
||||
'摄像头' as type,
|
||||
b.remark,
|
||||
b.update_date as updateDate,
|
||||
a.maintain_status as maintainStatus,
|
||||
a.nu_id as nuId,
|
||||
a.nu_name as nuName,
|
||||
a.depart_id as departId,
|
||||
a.depart_name as departName,
|
||||
a.depart_server_url as orgCode,
|
||||
a.reserve_depart_id as reserveDepartId,
|
||||
a.reserve_depart_name as reserveDepartName
|
||||
from nu_iot_tplink_camera a
|
||||
left join nu_iot_weihu_info b on a.mac = b.device_id
|
||||
<where>
|
||||
<if test="params.sn != null and params.sn != ''">
|
||||
AND a.sn = #{params.sn}
|
||||
</if>
|
||||
<if test="params.nuId != null and params.nuId != ''">
|
||||
AND a.nu_id = #{params.nuId}
|
||||
</if>
|
||||
<if test="params.departId != null and params.departId != ''">
|
||||
AND a.depart_id = #{params.departId}
|
||||
</if>
|
||||
<if test="params.maintainStatus != null and params.maintainStatus != ''">
|
||||
AND a.maintain_status = #{params.maintainStatus}
|
||||
</if>
|
||||
<if test="params.departId != null and params.departId != ''">
|
||||
AND a.reserve_depart_id = #{params.reserveDepartId}
|
||||
</if>
|
||||
</where>
|
||||
union all
|
||||
select
|
||||
a.cid as id,
|
||||
a.cid as deviceId,
|
||||
a.cid as sn,
|
||||
'电表' as type,
|
||||
b.remark,
|
||||
b.update_date as updateDate,
|
||||
a.maintain_status as maintainStatus,
|
||||
a.nu_id as nuId,
|
||||
a.nu_name as nuName,
|
||||
a.depart_id as departId,
|
||||
a.depart_name as departName,
|
||||
a.depart_server_url as orgCode,
|
||||
a.reserve_depart_id as reserveDepartId,
|
||||
a.reserve_depart_name as reserveDepartName
|
||||
from nu_iot_tq_electricity_meter a
|
||||
left join nu_iot_weihu_info b on a.cid = b.device_id
|
||||
<where>
|
||||
<if test="params.sn != null and params.sn != ''">
|
||||
AND a.cid = #{params.sn}
|
||||
</if>
|
||||
<if test="params.nuId != null and params.nuId != ''">
|
||||
AND a.nu_id = #{params.nuId}
|
||||
</if>
|
||||
<if test="params.departId != null and params.departId != ''">
|
||||
AND a.depart_id = #{params.departId}
|
||||
</if>
|
||||
<if test="params.maintainStatus != null and params.maintainStatus != ''">
|
||||
AND a.maintain_status = #{params.maintainStatus}
|
||||
</if>
|
||||
<if test="params.departId != null and params.departId != ''">
|
||||
AND a.reserve_depart_id = #{params.reserveDepartId}
|
||||
</if>
|
||||
</where>
|
||||
union all
|
||||
select
|
||||
a.cid as id,
|
||||
a.cid as deviceId,
|
||||
a.cid as sn,
|
||||
'水表' as type,
|
||||
b.remark,
|
||||
b.update_date as updateDate,
|
||||
a.maintain_status as maintainStatus,
|
||||
a.nu_id as nuId,
|
||||
a.nu_name as nuName,
|
||||
a.depart_id as departId,
|
||||
a.depart_name as departName,
|
||||
a.depart_server_url as orgCode,
|
||||
a.reserve_depart_id as reserveDepartId,
|
||||
a.reserve_depart_name as reserveDepartName
|
||||
from nu_iot_tq_water_meter a
|
||||
left join nu_iot_weihu_info b on a.cid = b.device_id
|
||||
<where>
|
||||
<if test="params.sn != null and params.sn != ''">
|
||||
AND a.cid = #{params.sn}
|
||||
</if>
|
||||
<if test="params.nuId != null and params.nuId != ''">
|
||||
AND a.nu_id = #{params.nuId}
|
||||
</if>
|
||||
<if test="params.departId != null and params.departId != ''">
|
||||
AND a.depart_id = #{params.departId}
|
||||
</if>
|
||||
<if test="params.maintainStatus != null and params.maintainStatus != ''">
|
||||
AND a.maintain_status = #{params.maintainStatus}
|
||||
</if>
|
||||
<if test="params.departId != null and params.departId != ''">
|
||||
AND a.reserve_depart_id = #{params.reserveDepartId}
|
||||
</if>
|
||||
</where>
|
||||
union all
|
||||
select
|
||||
a.sn as id,
|
||||
a.sn as deviceId,
|
||||
a.sn as sn,
|
||||
'温湿度计' as type,
|
||||
b.remark,
|
||||
b.update_date as updateDate,
|
||||
a.maintain_status as maintainStatus,
|
||||
a.nu_id as nuId,
|
||||
a.nu_name as nuName,
|
||||
a.depart_id as departId,
|
||||
a.depart_name as departName,
|
||||
a.depart_server_url as orgCode,
|
||||
a.reserve_depart_id as reserveDepartId,
|
||||
a.reserve_depart_name as reserveDepartName
|
||||
from nu_iot_yiweilian_humid_device a
|
||||
left join nu_iot_weihu_info b on a.sn = b.device_id
|
||||
<where>
|
||||
<if test="params.sn != null and params.sn != ''">
|
||||
AND a.sn = #{params.sn}
|
||||
</if>
|
||||
<if test="params.nuId != null and params.nuId != ''">
|
||||
AND a.nu_id = #{params.nuId}
|
||||
</if>
|
||||
<if test="params.departId != null and params.departId != ''">
|
||||
AND a.depart_id = #{params.departId}
|
||||
</if>
|
||||
<if test="params.maintainStatus != null and params.maintainStatus != ''">
|
||||
AND a.maintain_status = #{params.maintainStatus}
|
||||
</if>
|
||||
<if test="params.departId != null and params.departId != ''">
|
||||
AND a.reserve_depart_id = #{params.reserveDepartId}
|
||||
</if>
|
||||
</where>
|
||||
) t
|
||||
<where>
|
||||
<if test="params.type != null and params.type != ''">
|
||||
AND type = #{params.type}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
</mapper>
|
|
@ -0,0 +1,11 @@
|
|||
package com.nu.modules.weihu.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.nu.modules.weihu.entity.DeviceMaintain;
|
||||
|
||||
public interface DeviceMaintainService extends IService<DeviceMaintain> {
|
||||
IPage<DeviceMaintain> findPage(Page<DeviceMaintain> page, DeviceMaintain deviceInfo);
|
||||
void saveSendOrg(DeviceMaintain deviceInfo);
|
||||
}
|
|
@ -0,0 +1,120 @@
|
|||
package com.nu.modules.weihu.service.impl;
|
||||
|
||||
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;
|
||||
import com.nu.modules.tplink.camera.entity.CameraInfo;
|
||||
import com.nu.modules.tplink.camera.service.ICameraCapabilityService;
|
||||
import com.nu.modules.tplink.camera.service.ICameraInfoService;
|
||||
import com.nu.modules.tq.common.service.ITqDeviceInfoService;
|
||||
import com.nu.modules.tq.electricity.entity.ElectricityMeter;
|
||||
import com.nu.modules.tq.electricity.service.IElectricityMeterService;
|
||||
import com.nu.modules.tq.water.entity.WaterMeter;
|
||||
import com.nu.modules.tq.water.service.IWaterMeterService;
|
||||
import com.nu.modules.weihu.entity.DeviceMaintain;
|
||||
import com.nu.modules.weihu.mapper.DeviceMaintainMapper;
|
||||
import com.nu.modules.weihu.service.DeviceMaintainService;
|
||||
import com.nu.modules.yiweilian.humid.entity.HumidDevice;
|
||||
import com.nu.modules.yiweilian.humid.service.IHumidDeviceService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.jeecg.common.util.DateUtils;
|
||||
import org.jeecg.modules.system.entity.SysDepart;
|
||||
import org.jeecg.modules.system.service.ISysDepartService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Slf4j
|
||||
@Service
|
||||
public class DeviceMaintainServiceImpl extends ServiceImpl<DeviceMaintainMapper, DeviceMaintain> implements DeviceMaintainService {
|
||||
|
||||
@Autowired
|
||||
private ICameraInfoService cameraInfoService;
|
||||
|
||||
@Autowired
|
||||
private IElectricityMeterService electricityMeterService;
|
||||
|
||||
@Autowired
|
||||
private IWaterMeterService waterMeterService;
|
||||
|
||||
@Autowired
|
||||
private IHumidDeviceService humidDeviceService;
|
||||
|
||||
@Autowired
|
||||
private ISysDepartService sysDepartService;
|
||||
|
||||
@Override
|
||||
public IPage<DeviceMaintain> findPage(Page<DeviceMaintain> page, DeviceMaintain deviceInfo){
|
||||
return baseMapper.findPage(page,deviceInfo);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void saveSendOrg(DeviceMaintain deviceInfo){
|
||||
String reserveDepartId = deviceInfo.getReserveDepartId();
|
||||
SysDepart sysDepart = sysDepartService.getDepartById(reserveDepartId);
|
||||
String reserveDepartName = sysDepart.getDepartName();
|
||||
String remark = deviceInfo.getRemark();
|
||||
String updateDate = DateUtils.formatDate("yyyy-MM-dd HH:mm:ss");
|
||||
List<DeviceMaintain> list = deviceInfo.getDeviceMaintainList();
|
||||
for(int i=0;i<list.size();i++){
|
||||
DeviceMaintain di = list.get(i);
|
||||
di.setReserveDepartId(reserveDepartId);
|
||||
di.setReserveDepartName(reserveDepartName);
|
||||
di.setRemark(remark);
|
||||
di.setUpdateDate(updateDate);
|
||||
updateDeviceByType(di);
|
||||
QueryWrapper<DeviceMaintain> qw = new QueryWrapper<>();
|
||||
qw.eq("device_id",di.getDeviceId());
|
||||
DeviceMaintain entity = this.getOne(qw);
|
||||
if(entity!=null){
|
||||
entity.setReserveDepartId(reserveDepartId);
|
||||
entity.setReserveDepartName(reserveDepartName);
|
||||
entity.setRemark(remark);
|
||||
entity.setUpdateDate(updateDate);
|
||||
this.updateById(entity);
|
||||
}else{
|
||||
di.setId(null);
|
||||
this.save(di);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void updateDeviceByType(DeviceMaintain entity){
|
||||
String type = entity.getType();
|
||||
if(type.equals("摄像头")){
|
||||
QueryWrapper<CameraInfo> cameraQw = new QueryWrapper<>();
|
||||
cameraQw.eq("mac",entity.getDeviceId());
|
||||
CameraInfo cameraInfo = cameraInfoService.getOne(cameraQw);
|
||||
cameraInfo.setReserveDepartId(entity.getReserveDepartId());
|
||||
cameraInfo.setReserveDepartName(entity.getReserveDepartName());
|
||||
cameraInfoService.updateById(cameraInfo);
|
||||
}
|
||||
if(type.equals("电表")){
|
||||
QueryWrapper<ElectricityMeter> electricityQw = new QueryWrapper<>();
|
||||
electricityQw.eq("cid",entity.getDeviceId());
|
||||
ElectricityMeter electricityMeter = electricityMeterService.getOne(electricityQw);
|
||||
electricityMeter.setReserveDepartId(entity.getReserveDepartId());
|
||||
electricityMeter.setReserveDepartName(entity.getReserveDepartName());
|
||||
electricityMeterService.updateById(electricityMeter);
|
||||
}
|
||||
if(type.equals("水表")){
|
||||
QueryWrapper<WaterMeter> waterQw = new QueryWrapper<>();
|
||||
waterQw.eq("cid",entity.getDeviceId());
|
||||
WaterMeter waterMeter = waterMeterService.getOne(waterQw);
|
||||
waterMeter.setReserveDepartId(entity.getReserveDepartId());
|
||||
waterMeter.setReserveDepartName(entity.getReserveDepartName());
|
||||
waterMeterService.updateById(waterMeter);
|
||||
}
|
||||
if(type.equals("温湿度计")){
|
||||
QueryWrapper<HumidDevice> humidQw = new QueryWrapper<>();
|
||||
humidQw.eq("sn",entity.getDeviceId());
|
||||
HumidDevice humidDevice = humidDeviceService.getOne(humidQw);
|
||||
humidDevice.setReserveDepartId(entity.getReserveDepartId());
|
||||
humidDevice.setReserveDepartName(entity.getReserveDepartName());
|
||||
humidDeviceService.updateById(humidDevice);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -110,6 +110,9 @@ public class HumidDevice implements Serializable {
|
|||
private String nuId;//护理单元ID
|
||||
private String nuName;//护理单元
|
||||
private String maintainStatus;//维修状态 0正常 1报修 2报废
|
||||
private String reserveDepartId;//预留机构ID
|
||||
private String reserveDepartName;//预留机构名称
|
||||
|
||||
@Dict(dicCode = "nu_type")
|
||||
@TableField(exist = false)
|
||||
private String areaFlag;//区域标签
|
||||
|
|
Loading…
Reference in New Issue