Commit 470f2906 authored by wanghao's avatar wanghao

1 运行检测下 视频监控 企业数据监控 预警信息 调整成 政府 和 企业都可以录,企业查看自己数据,政府查看所有企业数据逻辑。

parent 2de0756e
......@@ -3,8 +3,10 @@ package com.zehong.web.controller.video;
import com.zehong.common.annotation.Log;
import com.zehong.common.core.controller.BaseController;
import com.zehong.common.core.domain.AjaxResult;
import com.zehong.common.core.domain.entity.SysRole;
import com.zehong.common.core.page.TableDataInfo;
import com.zehong.common.enums.BusinessType;
import com.zehong.common.utils.SecurityUtils;
import com.zehong.common.utils.poi.ExcelUtil;
import com.zehong.system.domain.TEnterpriseInfo;
import com.zehong.system.domain.TVideoManager;
......@@ -16,6 +18,7 @@ import org.springframework.web.bind.annotation.*;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
/**
* 视频管理Controller
......@@ -73,8 +76,13 @@ public class TVideoManagerController extends BaseController
enterpriseVideoFirst.setVideoName("视频监控");
enterpriseVideoFirst.setLevel("1");
TEnterpriseInfo tEnterpriseInfo1 = new TEnterpriseInfo();
// 如果是企业的话,就只查该企业下的数据
if (isEnterprise()) {
tEnterpriseInfo1.setEnterpriseId(SecurityUtils.getLoginUser().getUser().getDeptId());
}
List<TEnterpriseInfo> tEnterpriseInfos = itEmployedPeopleInfoService.selectTEnterpriseInfoList(new TEnterpriseInfo());
List<TEnterpriseInfo> tEnterpriseInfos = itEmployedPeopleInfoService.selectTEnterpriseInfoList(tEnterpriseInfo1);
/*TEnterpriseInfo cg=new TEnterpriseInfo();
cg.setEnterpriseId(new Long(0));
cg.setEnterpriseName("城管视频");
......@@ -149,4 +157,16 @@ public class TVideoManagerController extends BaseController
{
return toAjax(tVideoManagerService.deleteTVideoManagerByIds(videoManagerIds));
}
/**
* 判断是否为企业
* @return
*/
private boolean isEnterprise(){
List<SysRole> roles = SecurityUtils.getLoginUser().getUser().getRoles();
List<String> roleKeys = roles.stream().map(item -> item.getRoleKey()).collect(Collectors.toList());
return roleKeys.contains("qy");
}
}
......@@ -20,7 +20,7 @@ public class TDetectorInfo extends BaseEntity
private Long detectorId;
/** 企业id */
private Integer enterpriseId;
private String enterpriseId;
/** 用户id */
@Excel(name = "用户id")
......@@ -116,11 +116,11 @@ public class TDetectorInfo extends BaseEntity
return detectorId;
}
public Integer getEnterpriseId() {
public String getEnterpriseId() {
return enterpriseId;
}
public void setEnterpriseId(Integer enterpriseId) {
public void setEnterpriseId(String enterpriseId) {
this.enterpriseId = enterpriseId;
}
......
......@@ -75,8 +75,8 @@ public class TDeviceReportData extends BaseEntity
private String deviceStatus;
/** 所属企业id */
@Excel(name = "所属企业id")
private Long beyondEnterpriseId;
//@Excel(name = "所属企业id")
private String beyondEnterpriseId;
/** 所属企业名称 */
@Excel(name = "所属企业名称")
......@@ -92,6 +92,10 @@ public class TDeviceReportData extends BaseEntity
private String beyondDeviceName;
/**
* 1 压力表
* 2 流量计
*/
private String deviceType;
public String getDeviceType() {
......@@ -236,12 +240,12 @@ public class TDeviceReportData extends BaseEntity
{
return deviceStatus;
}
public void setBeyondEnterpriseId(Long beyondEnterpriseId)
public void setBeyondEnterpriseId(String beyondEnterpriseId)
{
this.beyondEnterpriseId = beyondEnterpriseId;
}
public Long getBeyondEnterpriseId()
public String getBeyondEnterpriseId()
{
return beyondEnterpriseId;
}
......
package com.zehong.system.service.impl;
import com.github.pagehelper.PageInfo;
import com.zehong.common.core.domain.entity.SysRole;
import com.zehong.common.utils.SecurityUtils;
import com.zehong.system.domain.TDetectorInfo;
import com.zehong.system.mapper.TDetectorInfoMapper;
import com.zehong.system.service.ITDetectorInfoService;
......@@ -9,6 +11,7 @@ import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* 探测器Service业务层处理
......@@ -164,6 +167,22 @@ public class TDetectorInfoServiceImpl implements ITDetectorInfoService
*/
@Override
public List<TDetectorInfo> selectDetectorMointor(TDetectorInfo tDetectorInfo){
// 20240725调整 如果是企业,则只查企业的数据
if (isEnterprise()) {
tDetectorInfo.setEnterpriseId(SecurityUtils.getLoginUser().getUser().getDeptId());
}
return tDetectorInfoMapper.selectDetectorMointor(tDetectorInfo);
}
/**
* 判断是否为企业
* @return
*/
private boolean isEnterprise(){
List<SysRole> roles = SecurityUtils.getLoginUser().getUser().getRoles();
List<String> roleKeys = roles.stream().map(item -> item.getRoleKey()).collect(Collectors.toList());
return roleKeys.contains("qy");
}
}
package com.zehong.system.service.impl;
import java.util.List;
import java.util.stream.Collectors;
import com.zehong.common.core.domain.entity.SysRole;
import com.zehong.common.utils.DateUtils;
import com.zehong.common.utils.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.zehong.system.mapper.TDeviceReportDataMapper;
import com.zehong.system.domain.TDeviceReportData;
import com.zehong.system.service.ITDeviceReportDataService;
import javax.annotation.Resource;
/**
* 设备监控Service业务层处理
*
......@@ -17,7 +23,7 @@ import com.zehong.system.service.ITDeviceReportDataService;
@Service
public class TDeviceReportDataServiceImpl implements ITDeviceReportDataService
{
@Autowired
@Resource
private TDeviceReportDataMapper tDeviceReportDataMapper;
/**
......@@ -41,6 +47,11 @@ public class TDeviceReportDataServiceImpl implements ITDeviceReportDataService
@Override
public List<TDeviceReportData> selectTDeviceReportDataList(TDeviceReportData tDeviceReportData)
{
// 20240725 调整 分 企业 和 政府 角色录入
if(isEnterprise()) {
tDeviceReportData.setBeyondEnterpriseId(SecurityUtils.getLoginUser().getUser().getDeptId());
}
return tDeviceReportDataMapper.selectTDeviceReportDataList(tDeviceReportData);
}
......@@ -93,4 +104,15 @@ public class TDeviceReportDataServiceImpl implements ITDeviceReportDataService
{
return tDeviceReportDataMapper.deleteTDeviceReportDataById(deviceReportDataId);
}
/**
* 判断是否为企业
* @return
*/
private boolean isEnterprise(){
List<SysRole> roles = SecurityUtils.getLoginUser().getUser().getRoles();
List<String> roleKeys = roles.stream().map(item -> item.getRoleKey()).collect(Collectors.toList());
return roleKeys.contains("qy");
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment