Merge remote-tracking branch 'origin/master'

dev
夜笙歌 1 year ago
commit 5e7498555c

@ -1,41 +1,29 @@
package com.ruoyi.business.controller;
import java.util.Date;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletResponse;
import com.ruoyi.business.domain.*;
import com.ruoyi.business.domain.HwDevice;
import com.ruoyi.business.domain.HwDeviceMode;
import com.ruoyi.business.domain.HwMonitorUnit;
import com.ruoyi.business.domain.HwScene;
import com.ruoyi.business.domain.VO.DeviceControlVo;
import com.ruoyi.business.domain.VO.DeviceModeVo;
import com.ruoyi.business.domain.VO.HwMonitorUnitVo;
import com.ruoyi.business.service.IHwDeviceModeService;
import com.ruoyi.business.service.IHwDeviceService;
import com.ruoyi.business.service.IHwMonitorUnitService;
import com.ruoyi.business.service.IHwSceneService;
import com.ruoyi.common.core.constant.HwDictConstants;
import com.ruoyi.common.security.annotation.InnerAuth;
import com.ruoyi.common.security.utils.SecurityUtils;
import com.ruoyi.system.api.domain.SysDept;
import com.ruoyi.system.api.domain.SysRole;
import com.ruoyi.system.api.domain.SysUser;
import com.ruoyi.system.api.model.LoginUser;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.log.annotation.Log;
import com.ruoyi.common.log.enums.BusinessType;
import com.ruoyi.common.security.annotation.RequiresPermissions;
import com.ruoyi.business.service.IHwDeviceService;
import com.ruoyi.common.core.utils.poi.ExcelUtil;
import com.ruoyi.common.core.web.controller.BaseController;
import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.common.core.utils.poi.ExcelUtil;
import com.ruoyi.common.core.web.page.TableDataInfo;
import com.ruoyi.common.log.annotation.Log;
import com.ruoyi.common.log.enums.BusinessType;
import com.ruoyi.common.security.annotation.InnerAuth;
import com.ruoyi.common.security.annotation.RequiresPermissions;
import com.ruoyi.common.security.utils.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
/**
* Controller

@ -113,4 +113,6 @@ public interface HwDeviceMapper
public int selectAbnormalDeviceNumCount(HwDevice hwDevice);
public List<HwDevice> selectHwDeviceListByMonitor(HwDevice hwDevice);
}

@ -123,6 +123,10 @@ public class HwDeviceServiceImpl implements IHwDeviceService {
@Transactional
@Override
public int insertHwDevice(HwDevice hwDevice) {
HwDevice duplicateDevice = hwDeviceMapper.selectHwDeviceByDeviceCode(hwDevice.getDeviceCode());
if(duplicateDevice != null){
throw new ServiceException("设备编号已经存在,请修改");
}
hwDevice.setCreateTime(DateUtils.getNowDate());
String deviceType = hwDevice.getDeviceType();
int deviceId = hwDeviceMapper.insertHwDevice(hwDevice);
@ -393,8 +397,7 @@ public class HwDeviceServiceImpl implements IHwDeviceService {
List<HwDeviceVo> acquisitionDeviceVos = new ArrayList<HwDeviceVo>();
String databaseName = TdEngineConstants.getDatabaseName();
queryHwDevice.setDeviceType(HwDictConstants.DEVICE_TYPE_GATEWAY_SUB_EQUIPMENT);
List<HwDevice> hwDevices = hwDeviceMapper.selectHwDeviceList(queryHwDevice);
List<HwDevice> hwDevices = hwDeviceMapper.selectHwDeviceListByMonitor(queryHwDevice);
hwDevices.forEach(hwDevice -> {
Long deviceId = hwDevice.getDeviceId();
HwDeviceModeFunction queryDeviceModeFunction = new HwDeviceModeFunction();

@ -180,7 +180,7 @@ public class HwMonitorUnitServiceImpl implements IHwMonitorUnitService {
@Override
public SubDeviceSumVo selectSubDeviceSum(Long sceneId) {
AllNumsVo numsVo = selectAllNums(sceneId);
//获取在线设备数量,获取已发布状态子设备并且关联网关为在线的数量
//获取在线设备数量,获取已发布状态子设备并且关联网关为在线的数量以及在线状态发布状态的直连设备数量之和
int onlineDeviceNum = hwDeviceMapper.getOnlineDeviceNum(sceneId);
SubDeviceSumVo subDeviceSumVo = new SubDeviceSumVo();

@ -232,8 +232,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="getOnlineDeviceNum" parameterType="Long">
SELECT count(1) as count FROM hw_device hd
where hd.device_type=2 and hd.device_status=1
and exists (select 1 from hw_device hdd where hd.releated_device_id=hdd.device_id and hdd.online_status=1 and hdd.device_status=1)
where hd.device_status=1 and ((hd.device_type=2
and exists (select 1 from hw_device hdd where hd.releated_device_id=hdd.device_id and hdd.online_status=1 and hdd.device_status=1)) or (hd.device_type=3 and hd.online_status=1))
<if test="sceneId != null and sceneId!=0">and hd.scene_id=#{sceneId}</if>
</select>
@ -309,4 +309,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</select>
<select id="selectHwDeviceListByMonitor" parameterType="HwDevice" resultMap="HwDeviceResult">
<include refid="selectHwDeviceVo"/>
<where>
<if test="sceneId != null "> and scene_id = #{sceneId}</if>
<if test="monitorUnitId != null "> and monitor_unit_id = #{monitorUnitId}</if>
and device_status !='9' and (device_type='2' or device_type='3')
<!-- 租户数据范围过滤 -->
${params.tenantDataScope}
</where>
order by hd.device_id desc
</select>
</mapper>
Loading…
Cancel
Save