租户改造
This commit is contained in:
parent
1e64789456
commit
208b86af1b
|
|
@ -41,7 +41,7 @@ public class MybatisPlusSaasConfig {
|
|||
* 3.菜单表、租户表不做租户隔离
|
||||
* 4.通过拦截器MybatisInterceptor实现,增删改查数据 自动注入租户ID
|
||||
*/
|
||||
public static final Boolean OPEN_SYSTEM_TENANT_CONTROL = false;
|
||||
public static final Boolean OPEN_SYSTEM_TENANT_CONTROL = true;
|
||||
|
||||
/**
|
||||
* 哪些表需要做多租户 表需要添加一个字段 tenant_id
|
||||
|
|
@ -59,6 +59,36 @@ public class MybatisPlusSaasConfig {
|
|||
TENANT_TABLE.add("sys_data_source");
|
||||
TENANT_TABLE.add("sys_position");
|
||||
//TENANT_TABLE.add("sys_announcement");
|
||||
|
||||
//增加业务表
|
||||
TENANT_TABLE.add("surv_alert_record");
|
||||
TENANT_TABLE.add("surv_company_info");
|
||||
TENANT_TABLE.add("surv_device_deploy");
|
||||
TENANT_TABLE.add("surv_device_deploy_relay");
|
||||
TENANT_TABLE.add("surv_device_deploy_relaygroup");
|
||||
TENANT_TABLE.add("surv_display_detail");
|
||||
TENANT_TABLE.add("surv_display_info");
|
||||
TENANT_TABLE.add("surv_enterprise_info");
|
||||
TENANT_TABLE.add("surv_feces_ledger");
|
||||
TENANT_TABLE.add("surv_hisdata_air");
|
||||
TENANT_TABLE.add("surv_hisdata_livestockwater");
|
||||
TENANT_TABLE.add("surv_hisdata_orientwater");
|
||||
TENANT_TABLE.add("surv_hisdata_pestlight");
|
||||
TENANT_TABLE.add("surv_hisdata_soil");
|
||||
TENANT_TABLE.add("surv_hisdata_vocs");
|
||||
TENANT_TABLE.add("surv_hisdata_vocs_min");
|
||||
TENANT_TABLE.add("surv_maintain_record");
|
||||
TENANT_TABLE.add("surv_mulch_record");
|
||||
TENANT_TABLE.add("surv_pestlight_alert");
|
||||
TENANT_TABLE.add("surv_pestlight_info");
|
||||
TENANT_TABLE.add("surv_station_info");
|
||||
TENANT_TABLE.add("surv_transdata_air");
|
||||
TENANT_TABLE.add("surv_transdata_livestockwater");
|
||||
TENANT_TABLE.add("surv_transdata_orientwater");
|
||||
TENANT_TABLE.add("surv_transdata_pestlight");
|
||||
TENANT_TABLE.add("surv_transdata_soil");
|
||||
TENANT_TABLE.add("surv_transdata_vocs");
|
||||
TENANT_TABLE.add("surv_transdata_vocs_min");
|
||||
}
|
||||
|
||||
//2.示例测试
|
||||
|
|
|
|||
|
|
@ -133,6 +133,12 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
|||
|
||||
//TODO 外部模拟登陆临时账号,列表不显示
|
||||
queryWrapper.ne("username", "_reserve_user_external");
|
||||
String tenantId = TenantContext.getTenant();
|
||||
if(StringUtils.isNotBlank(tenantId)){
|
||||
if(!tenantId.equals("0")){//非超级租户,都使用各自的租户
|
||||
queryWrapper.eq("login_tenant_id",tenantId);
|
||||
}
|
||||
}
|
||||
Page<SysUser> page = new Page<SysUser>(pageNo, pageSize);
|
||||
IPage<SysUser> pageList = this.page(page, queryWrapper);
|
||||
|
||||
|
|
|
|||
|
|
@ -11,12 +11,14 @@ import org.jeecg.common.constant.CacheConstants;
|
|||
import org.jeecg.common.constant.IotConstants;
|
||||
import org.jeecg.common.constant.PollutionConstants;
|
||||
import org.jeecg.common.constant.enums.ScreenIndexSummaryEnum;
|
||||
import org.jeecg.common.dto.CommonDTO;
|
||||
import org.jeecg.common.entity.*;
|
||||
import org.jeecg.common.util.oConvertUtils;
|
||||
import org.jeecg.common.vo.*;
|
||||
import org.jeecg.common.vo.statistic.ScreenIndexSummaryDetailVo;
|
||||
import org.jeecg.common.vo.statistic.ScreenSummaryVo;
|
||||
import org.jeecg.modules.appmana.service.*;
|
||||
import org.jeecg.modules.appmana.service.impl.CommonServiceImpl;
|
||||
import org.jeecg.modules.appmana.service.impl.IotCommonP2ServiceImpl;
|
||||
import org.jeecg.modules.appmana.service.impl.IotCommonP3ServiceImpl;
|
||||
import org.jeecg.modules.appmana.service.impl.IotCommonServiceImpl;
|
||||
|
|
@ -126,6 +128,10 @@ public class BigScreenController {
|
|||
@Lazy
|
||||
private IotCommonP3ServiceImpl commonP3Service;
|
||||
|
||||
@Autowired
|
||||
@Lazy
|
||||
private CommonServiceImpl iotTools;
|
||||
|
||||
@ApiOperation("获取萤石云token")
|
||||
@PostMapping(value = "/getYsToken")
|
||||
public Result getToken(){
|
||||
|
|
@ -201,7 +207,9 @@ public class BigScreenController {
|
|||
|
||||
@PostMapping("/displayInfo")
|
||||
@ApiOperation("获取首页信息侧数据")
|
||||
public Result getDisplayInfo(){
|
||||
public Result getDisplayInfo(@RequestBody(required = false) CommonDTO commonDTO){
|
||||
iotTools.processTenant(commonDTO);
|
||||
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
//项目概况
|
||||
List<SurvDisplayInfo> dis1 = survDisplayInfoService.getInfoByType("project_brief");
|
||||
|
|
@ -244,7 +252,8 @@ public class BigScreenController {
|
|||
|
||||
@PostMapping("/stationInfo")
|
||||
@ApiOperation("获取首页站点侧数据")
|
||||
public Result getStationInfo(@RequestParam(value = "stationCode",required = false)String stationCode){
|
||||
public Result getStationInfo(@RequestParam(value = "stationCode",required = false)String stationCode,@RequestBody(required = false) CommonDTO commonDTO){
|
||||
iotTools.processTenant(commonDTO);
|
||||
//萤石云token
|
||||
String token = getYsToken();
|
||||
List<SurvStationInfo> stationList = survStationInfoService.getAllStationAndDevice(stationCode,"",token);
|
||||
|
|
@ -347,15 +356,16 @@ public class BigScreenController {
|
|||
|
||||
@ApiOperation("获取污染物字典属性")
|
||||
@GetMapping("/getPollutionDict")
|
||||
public Result getPollutionDict(){
|
||||
public Result getPollutionDict(@RequestParam(value = "authId",required = false)String authId){
|
||||
iotTools.getTenantId(authId);
|
||||
return Result.ok(iotutils.getPollutionDict());
|
||||
}
|
||||
|
||||
|
||||
@PostMapping("/getNewestData")
|
||||
@ApiOperation("站点最新数据")
|
||||
public Result getNewestData(@RequestParam(value = "stationCode",required = false)String stationCode,@RequestParam(required = false) String dataMode){
|
||||
|
||||
public Result getNewestData(@RequestParam(value = "stationCode",required = false)String stationCode,@RequestParam(required = false) String dataMode,@RequestParam(value = "authId",required = false)String authId){
|
||||
iotTools.getTenantId(authId);
|
||||
List<SurvStationInfo> stationList = survStationInfoService.getAllStationAndDevice(stationCode,"","token");
|
||||
//补充最新数据进入
|
||||
JSONArray returnArrs= new JSONArray();
|
||||
|
|
@ -506,6 +516,7 @@ public class BigScreenController {
|
|||
@PostMapping("/getIndexSummry")
|
||||
@ApiOperation("大屏首页统计")
|
||||
public Result<List<ScreenIndexSummaryDetailVo>> getIndexSummry (@RequestBody ScreenSummaryVo screenSummaryVo){
|
||||
iotTools.getTenantId(screenSummaryVo.getAuthId());
|
||||
List<ScreenIndexSummaryDetailVo> results = new ArrayList<>();
|
||||
if(StringUtils.isBlank(screenSummaryVo.getSummrayMode())){//不传模式,默认为天数据
|
||||
screenSummaryVo.setSummrayMode(IotConstants.month_days);
|
||||
|
|
@ -794,7 +805,8 @@ public class BigScreenController {
|
|||
|
||||
@PostMapping("/getStationDetail")
|
||||
@ApiOperation("站点详情")
|
||||
public Result getStationDetail(@RequestParam(value = "stationCode")String stationCode){
|
||||
public Result getStationDetail(@RequestParam(value = "stationCode")String stationCode,@RequestParam(value = "authId",required = false)String authId){
|
||||
iotTools.getTenantId(authId);
|
||||
//萤石云token
|
||||
String token = getYsToken();
|
||||
List<SurvStationInfo> stationList = survStationInfoService.getAllStationAndDevice(stationCode,"",token);
|
||||
|
|
@ -936,7 +948,8 @@ public class BigScreenController {
|
|||
|
||||
@GetMapping("/getStationDisplay")
|
||||
@ApiOperation("获取站点展示信息数据")
|
||||
public Result getStationDisplay (@RequestParam("stationCode") String stationCode){
|
||||
public Result getStationDisplay (@RequestParam("stationCode") String stationCode,@RequestParam(value = "authId",required = false)String authId){
|
||||
iotTools.getTenantId(authId);
|
||||
//站点评价
|
||||
List<SurvDisplayInfo> list1= survDisplayInfoService.getInfoByStationAndType(stationCode,"effect_assess");
|
||||
//临时恶臭
|
||||
|
|
@ -951,7 +964,8 @@ public class BigScreenController {
|
|||
|
||||
@GetMapping("/getAllstationAndPestLight")
|
||||
@ApiOperation("获取所有站点和杀虫灯")
|
||||
public Result getAllstationAndPestLight (@RequestParam(value = "isShowLight",required = false)String isShowLight){
|
||||
public Result getAllstationAndPestLight (@RequestParam(value = "isShowLight",required = false)String isShowLight,@RequestParam(value = "authId",required = false)String authId){
|
||||
iotTools.getTenantId(authId);
|
||||
//站点
|
||||
List<SurvStationInfo> stationInfos= survStationInfoService.list();
|
||||
List<CommonLocationTrans> returnList = new ArrayList<>();
|
||||
|
|
@ -1042,7 +1056,8 @@ public class BigScreenController {
|
|||
|
||||
@PostMapping("/stationInfoWithCamera")
|
||||
@ApiOperation("获取首页站点侧数据")
|
||||
public Result stationInfoWithCamera(@RequestParam(value = "stationCode",required = false)String stationCode){
|
||||
public Result stationInfoWithCamera(@RequestParam(value = "stationCode",required = false)String stationCode,@RequestParam(value = "authId",required = false)String authId){
|
||||
iotTools.getTenantId(authId);
|
||||
//萤石云token
|
||||
//萤石云token
|
||||
SurvConfig survConfig = survConfigService.getOneByTypeWithTenant("0", IotConstants.ysyAcess);
|
||||
|
|
|
|||
|
|
@ -56,6 +56,7 @@ public class BigScreenControllerP2 {
|
|||
@ApiOperation(value = "01. 查询设备下各检测项的历史数据", notes = "")
|
||||
@PostMapping(value = "/survItemSummary")
|
||||
public Result<VOHisResult> survItemSummary(@RequestBody VOBigScreenSurvQ voBigScreenSurvQ) {
|
||||
commonService.getTenantId(voBigScreenSurvQ.getAuthId());
|
||||
VOHisResult voHisResult = iotCommonP3Service.survItemSummary(voBigScreenSurvQ);
|
||||
return Result.OK(voHisResult);
|
||||
}
|
||||
|
|
@ -64,6 +65,7 @@ public class BigScreenControllerP2 {
|
|||
@ApiOperation(value = "01-1. 查询设备下各检测项的历史数据", notes = "")
|
||||
@PostMapping(value = "/survItemSummary2")
|
||||
public Result<VOHisResult> survItemSummary2(@RequestBody VOBigScreenSurvQ voBigScreenSurvQ) {
|
||||
commonService.getTenantId(voBigScreenSurvQ.getAuthId());
|
||||
PollutionEnum pollutionEnum = PollutionEnum.catchPollution(voBigScreenSurvQ.getSurvItem());
|
||||
SurvDeviceDeploy deploy = null;
|
||||
if(StringUtils.isNotBlank(voBigScreenSurvQ.getStationCode())){
|
||||
|
|
@ -115,7 +117,8 @@ public class BigScreenControllerP2 {
|
|||
@ApiOperation(value = "02. 站点运维分页", notes = "")
|
||||
@GetMapping(value = "/stationMaintainPage")
|
||||
public Result<IPage<SurvMaintainRecord>> stationMaintainPage(StationMaintainPage stationMaintainPage,@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
|
||||
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize) {
|
||||
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,@RequestParam(value = "authId",required = false)String authId) {
|
||||
commonService.getTenantId(authId);
|
||||
Page<SurvMaintainRecord> page = new Page<SurvMaintainRecord>(pageNo,pageSize);
|
||||
SurvMaintainRecord survMaintainRecord = new SurvMaintainRecord();
|
||||
survMaintainRecord.setBeginDate(stationMaintainPage.getStartTime());
|
||||
|
|
@ -129,6 +132,7 @@ public class BigScreenControllerP2 {
|
|||
@ApiOperation(value = "03. 实际日综合曲线数据", notes = "")
|
||||
@PostMapping(value = "/timesIntegrate")
|
||||
public Result<VOIntegrateStatistic> timesIntegrate(@RequestBody DeploySummaryVo deploySummaryVo) {
|
||||
commonService.getTenantId(deploySummaryVo.getAuthId());
|
||||
VOIntegrateStatistic voIntegrateStatistic = iotCommonP2Service.CalAirSoilTimesIntegrate(deploySummaryVo);
|
||||
return Result.OK(voIntegrateStatistic);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@ import org.jeecg.common.vo.VOBigScreenSurvQ;
|
|||
import org.jeecg.common.vo.VOHisResult;
|
||||
import org.jeecg.common.vo.inner.*;
|
||||
import org.jeecg.modules.appmana.service.ISurvDeviceDeployService;
|
||||
import org.jeecg.modules.appmana.service.impl.CommonServiceImpl;
|
||||
import org.jeecg.modules.appmana.service.impl.IotCommonP3ServiceImpl;
|
||||
import org.jeecg.modules.appmana.service.impl.IotCommonServiceImpl;
|
||||
import org.jeecg.modules.appmana.utils.CommonUtils;
|
||||
|
|
@ -41,6 +42,8 @@ public class InnerController {
|
|||
private ISurvDeviceDeployService deviceDeployService;
|
||||
@Autowired
|
||||
private IotCommonP3ServiceImpl iotCommonP3Service;
|
||||
@Autowired
|
||||
private CommonServiceImpl commonService;
|
||||
|
||||
@ApiOperation(value = "1. 空气土壤监测综合数据统计", notes = "")
|
||||
@ApiOperationSupport(order = 1)
|
||||
|
|
@ -90,8 +93,9 @@ public class InnerController {
|
|||
@ApiOperation(value = "6. 实时数据构造", notes = "")
|
||||
@ApiOperationSupport(order = 5)
|
||||
@PostMapping(value = "/deviceNewestData")
|
||||
public VOTransData deviceNewestData(@RequestParam String deployId) {
|
||||
SurvDeviceDeploy deploy = deviceDeployService.getById(deployId);
|
||||
public VOTransData deviceNewestData(@RequestParam String deployId,@RequestParam String tenantId) {
|
||||
commonService.getTenantId(tenantId);
|
||||
SurvDeviceDeploy deploy = deviceDeployService.getDeviceById(deployId,tenantId);
|
||||
if(deploy!=null){
|
||||
return CommonUtils.transData(deploy, false, null, null, null, null);
|
||||
}
|
||||
|
|
@ -136,7 +140,9 @@ public class InnerController {
|
|||
@PostMapping(value = "/singleItemSummary")
|
||||
public VOHisResult singleItemSummary(@RequestBody VOBigScreenSurvQ voBigScreenSurvQ) {
|
||||
if(voBigScreenSurvQ!=null){
|
||||
return iotCommonP3Service.survItemSummary(voBigScreenSurvQ);
|
||||
commonService.getTenantId(voBigScreenSurvQ.getAuthId());
|
||||
VOHisResult voHisResult = iotCommonP3Service.survItemSummary(voBigScreenSurvQ);
|
||||
return voHisResult;
|
||||
}else {
|
||||
return new VOHisResult();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ import org.jeecg.common.api.vo.Result;
|
|||
import org.jeecg.common.iot.common.VOIntegrateStatistic;
|
||||
import org.jeecg.common.iot.common.VOSurvIntegrateParam;
|
||||
import org.jeecg.common.iot.common.VOWaterSurvIntegrateParam;
|
||||
import org.jeecg.modules.appmana.service.impl.CommonServiceImpl;
|
||||
import org.jeecg.modules.appmana.service.impl.IotCommonServiceImpl;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
|
|
@ -26,6 +27,8 @@ public class StatisticsContoller {
|
|||
private IotCommonServiceImpl iotCommonService;
|
||||
|
||||
|
||||
|
||||
|
||||
@ApiOperation(value = "1. 空气土壤监测综合数据统计", notes = "")
|
||||
@ApiOperationSupport(order = 1)
|
||||
@PostMapping(value = "/airSoilIntegrate")
|
||||
|
|
|
|||
|
|
@ -33,6 +33,7 @@ import org.springframework.web.servlet.ModelAndView;
|
|||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
|
@ -76,6 +77,10 @@ public class SurvDeviceDeployController extends JeecgController<SurvDeviceDeploy
|
|||
|
||||
@Autowired
|
||||
private Iotutils iotutils;
|
||||
|
||||
@Autowired
|
||||
private ISurvIotVirtualDeviceService iotVirtualDeviceService;
|
||||
|
||||
/**
|
||||
* 分页列表查询
|
||||
*
|
||||
|
|
@ -285,7 +290,6 @@ public class SurvDeviceDeployController extends JeecgController<SurvDeviceDeploy
|
|||
}else {
|
||||
return Result.error("无效的设备");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -423,8 +427,20 @@ public class SurvDeviceDeployController extends JeecgController<SurvDeviceDeploy
|
|||
}
|
||||
}
|
||||
|
||||
List<SurvDeviceDeployRelay> pageList = relayService.relayList(deployId,null);
|
||||
jsonObject.put("relayList",pageList);
|
||||
switch (deploy.getProtocolCode()){
|
||||
case IotConstants.lhviot_standard:
|
||||
List<String> readType = new ArrayList<>(Arrays.asList("read_write"));
|
||||
List<SurvIotVirtualDeviceGroup> modules = iotVirtualDeviceService.getModuleByGroup(deploy.getDeployCode(),readType);
|
||||
jsonObject.put("moduleList",modules);
|
||||
List<String> readType2 = new ArrayList<>(Arrays.asList("read_only"));
|
||||
List<SurvIotVirtualDeviceModule> runs = iotVirtualDeviceService.getModuleByType(deploy.getDeployCode(),readType2);
|
||||
jsonObject.put("runStatus",runs);
|
||||
break;
|
||||
default:
|
||||
List<SurvDeviceDeployRelay> pageList = relayService.relayList(deployId,null);
|
||||
jsonObject.put("relayList",pageList);
|
||||
break;
|
||||
}
|
||||
|
||||
if(dateTime==null) {
|
||||
jsonObject.put("dataTime", "该设备没有监测数据返回");
|
||||
|
|
|
|||
|
|
@ -5,15 +5,20 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.common.aspect.annotation.AutoLog;
|
||||
import org.jeecg.common.config.TenantContext;
|
||||
import org.jeecg.common.entity.UserInfo;
|
||||
import org.jeecg.common.entity.WxApp;
|
||||
import org.jeecg.common.system.base.controller.JeecgController;
|
||||
import org.jeecg.common.util.R;
|
||||
import org.jeecg.modules.appmana.service.IUserInfoService;
|
||||
import org.jeecg.modules.appmana.service.IWxAppService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
|
||||
import org.springframework.security.crypto.password.PasswordEncoder;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
|
@ -37,7 +42,9 @@ import java.util.Date;
|
|||
public class UserInfoController extends JeecgController<UserInfo, IUserInfoService> {
|
||||
@Autowired
|
||||
private IUserInfoService userInfoService;
|
||||
|
||||
@Autowired
|
||||
@Lazy
|
||||
private IWxAppService wxAppService;
|
||||
@Value(value = "${applet.initPass}")
|
||||
private String initPass;
|
||||
|
||||
|
|
@ -63,6 +70,18 @@ public class UserInfoController extends JeecgController<UserInfo, IUserInfoServi
|
|||
HttpServletRequest req) {
|
||||
// QueryWrapper<UserInfo> queryWrapper = QueryGenerator.initQueryWrapper(userInfo, req.getParameterMap());
|
||||
Page<UserInfo> page = new Page<UserInfo>(pageNo, pageSize);
|
||||
//租戶
|
||||
String tenantId = TenantContext.getTenant();
|
||||
if(StringUtils.isNotBlank(tenantId)){
|
||||
if(!"0".equals(tenantId)){//非0租户检查小程序所属小程序
|
||||
WxApp wxApp = wxAppService.getAppByTenantId(tenantId);
|
||||
if(wxApp!=null){
|
||||
userInfo.setAppId(wxApp.getId());
|
||||
}else{
|
||||
userInfo.setAppId("x");
|
||||
}
|
||||
}
|
||||
}
|
||||
IPage<UserInfo> pageList = userInfoService.pages(page, userInfo);
|
||||
return Result.OK(pageList);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
package org.jeecg.modules.appmana.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.InterceptorIgnore;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
|
@ -18,9 +19,13 @@ public interface SurvDeviceDeployMapper extends BaseMapper<SurvDeviceDeploy> {
|
|||
IPage<SurvDeviceDeploy> pages(IPage<SurvDeviceDeploy> page,@Param("query") SurvDeviceDeploy survDeviceDeploy);
|
||||
|
||||
List<String> getDeviceListByStation(@Param("stationCode") String stationCode,@Param("deployType") String deployType);
|
||||
|
||||
SurvDeviceDeploy getOneByCode(String deployCode);
|
||||
|
||||
List<SurvDeviceDeploy> getDeviceListByStations(@Param("stationCode") String stationCode,@Param("deployTypeList") List<String> deployTypeList);
|
||||
|
||||
List<SurvDeviceDeploy> getByIdsWithZhiBiao(@Param("ids")List<String> ids);
|
||||
|
||||
@InterceptorIgnore(illegalSql = "true", tenantLine = "true")
|
||||
SurvDeviceDeploy getDeviceById(@Param("deployId")String deployId, @Param("tenantId")String tenantId);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,8 +1,11 @@
|
|||
package org.jeecg.modules.appmana.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.jeecg.common.entity.SurvIotVirtualDeviceGroup;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Description: 虚拟设备模块分组
|
||||
* @Author: jeecg-boot
|
||||
|
|
@ -11,4 +14,5 @@ import org.jeecg.common.entity.SurvIotVirtualDeviceGroup;
|
|||
*/
|
||||
public interface SurvIotVirtualDeviceGroupMapper extends BaseMapper<SurvIotVirtualDeviceGroup> {
|
||||
|
||||
List<SurvIotVirtualDeviceGroup> getModuleGroup(@Param("deviceId") String deviceId, @Param("readType") List<String> readType);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,6 +3,9 @@ package org.jeecg.modules.appmana.mapper;
|
|||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.jeecg.common.entity.SurvIotVirtualDevice;
|
||||
import org.jeecg.common.entity.SurvIotVirtualDeviceGroup;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Description: 虚拟设备表
|
||||
|
|
@ -13,4 +16,6 @@ import org.jeecg.common.entity.SurvIotVirtualDevice;
|
|||
public interface SurvIotVirtualDeviceMapper extends BaseMapper<SurvIotVirtualDevice> {
|
||||
|
||||
SurvIotVirtualDevice getDeviceByCode(@Param("deployCode")String deployCode);
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -144,4 +144,7 @@
|
|||
from surv_device_deploy
|
||||
where ID = #{deployId};
|
||||
</select>
|
||||
<select id="getDeviceById" resultType="org.jeecg.common.entity.SurvDeviceDeploy">
|
||||
select <include refid="basesql"/> from surv_device_deploy where IS_DEL = 0 AND ID = #{deployId} AND TENANT_ID = #{tenantId} limit 1
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
<?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="org.jeecg.common.entity.SurvDictEle">
|
||||
<mapper namespace="org.jeecg.modules.appmana.mapper.SurvDictEleMapper">
|
||||
|
||||
</mapper>
|
||||
|
|
@ -2,5 +2,41 @@
|
|||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="org.jeecg.modules.appmana.mapper.SurvIotVirtualDeviceGroupMapper">
|
||||
|
||||
<resultMap type="org.jeecg.common.entity.SurvIotVirtualDeviceGroup" id="baseMap">
|
||||
<result property="id" column="ID" jdbcType="VARCHAR"/>
|
||||
<result property="companyId" column="COMPANY_ID" jdbcType="VARCHAR"/>
|
||||
<result property="farmId" column="FARM_ID" jdbcType="VARCHAR"/>
|
||||
<result property="deviceId" column="DEVICE_ID" jdbcType="VARCHAR"/>
|
||||
<result property="groupType" column="GROUP_TYPE" jdbcType="VARCHAR"/>
|
||||
<result property="groupName" column="GROUP_NAME" jdbcType="VARCHAR"/>
|
||||
<result property="groupIcon" column="GROUP_ICON" jdbcType="VARCHAR"/>
|
||||
<result property="groupNotes" column="GROUP_NOTES" jdbcType="VARCHAR"/>
|
||||
<result property="sortNo" column="SORT_NO" jdbcType="INTEGER"/>
|
||||
<result property="tenantId" column="TENANT_ID" jdbcType="VARCHAR"/>
|
||||
<result property="reVision" column="RE_VISION" jdbcType="INTEGER"/>
|
||||
<result property="createBy" column="CREATE_BY" jdbcType="VARCHAR"/>
|
||||
<result property="createTime" column="CREATE_TIME" jdbcType="TIMESTAMP"/>
|
||||
<result property="updateBy" column="UPDATE_BY" jdbcType="VARCHAR"/>
|
||||
<result property="isDel" column="IS_DEL" jdbcType="INTEGER"/>
|
||||
<result property="updateTime" column="UPDATE_TIME" jdbcType="TIMESTAMP"/>
|
||||
</resultMap>
|
||||
|
||||
<resultMap id="ext" type="org.jeecg.common.entity.SurvIotVirtualDeviceGroup" extends="baseMap">
|
||||
<collection property="modules" select="org.jeecg.modules.appmana.mapper.SurvIotVirtualDeviceModuleMapper.getGroupModule" column="{groupId = id,readType= readType}"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="baseSql">
|
||||
ID,COMPANY_ID,FARM_ID,DEVICE_ID,GROUP_TYPE,GROUP_NAME,GROUP_ICON,GROUP_NOTES,SORT_NO,TENANT_ID,RE_VISION,CREATE_BY,CREATE_TIME,UPDATE_BY,IS_DEL,UPDATE_TIME
|
||||
</sql>
|
||||
|
||||
<select id="getModuleGroup" resultMap="ext">
|
||||
select <include refid="baseSql"/>,#{readType} as readType
|
||||
from surv_iot_virtual_device_group
|
||||
<where>
|
||||
<if test="deviceId!=null and deviceId!=''">
|
||||
and DEVICE_ID = #{deviceId}
|
||||
</if>
|
||||
</where>
|
||||
order by SORT_NO,CREATE_TIME desc
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
@ -48,4 +48,5 @@
|
|||
select <include refid="baseSql"/>
|
||||
from surv_iot_virtual_device where IOT_CODE = #{deployCode}
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
|
@ -12,6 +12,7 @@
|
|||
<result property="moduleBusId" column="MODULE_BUS_ID" jdbcType="VARCHAR"/>
|
||||
<result property="moduleGroupId" column="MODULE_GROUP_ID" jdbcType="VARCHAR"/>
|
||||
<result property="moduleNetId" column="MODULE_NET_ID" jdbcType="VARCHAR"/>
|
||||
<result property="readType" column="READ_TYPE" jdbcType="VARCHAR"/>
|
||||
<result property="moduleType" column="MODULE_TYPE" jdbcType="VARCHAR"/>
|
||||
<result property="moduleSecType" column="MODULE_SEC_TYPE" jdbcType="VARCHAR"/>
|
||||
<result property="moduleName" column="MODULE_NAME" jdbcType="VARCHAR"/>
|
||||
|
|
@ -39,7 +40,7 @@
|
|||
</resultMap>
|
||||
|
||||
<sql id="baseSql">
|
||||
ID,COMPANY_ID,FARM_ID,DEVICE_ID,MODULE_CODE,MODULE_NUM,MODULE_BUS_ID,MODULE_GROUP_ID,MODULE_NET_ID,MODULE_TYPE,MODULE_SEC_TYPE,MODULE_NAME,MODULE_NOTES,MODULE_MODE,MODULE_VIRTUAL_STATUS,MODULE_PATH,REGISTER_TYPE,REGISTER_NUM,REGISTER_CMD_ON,REGISTER_CMD_OFF,REGISTER_CMD_STOP,REGISTER_ON,REGISTER_OFF,REGISTER_STOP,SORT_NO,IS_ENABLE,TENANT_ID,RE_VISION,CREATE_BY,CREATE_TIME,UPDATE_BY,IS_DEL,UPDATE_TIME
|
||||
ID,COMPANY_ID,FARM_ID,DEVICE_ID,MODULE_CODE,MODULE_NUM,MODULE_BUS_ID,MODULE_GROUP_ID,MODULE_NET_ID,READ_TYPE,MODULE_TYPE,MODULE_SEC_TYPE,MODULE_NAME,MODULE_NOTES,MODULE_MODE,MODULE_VIRTUAL_STATUS,MODULE_PATH,REGISTER_TYPE,REGISTER_NUM,REGISTER_CMD_ON,REGISTER_CMD_OFF,REGISTER_CMD_STOP,REGISTER_ON,REGISTER_OFF,REGISTER_STOP,SORT_NO,IS_ENABLE,TENANT_ID,RE_VISION,CREATE_BY,CREATE_TIME,UPDATE_BY,IS_DEL,UPDATE_TIME
|
||||
</sql>
|
||||
|
||||
|
||||
|
|
@ -55,5 +56,21 @@
|
|||
from surv_iot_virtual_device_module where DEVICE_ID = #{deviceId} order by SORT_NO,CREATE_TIME desc;
|
||||
</select>
|
||||
|
||||
|
||||
<select id="getGroupModule" resultMap="FIotVirtualDeviceModuleMap">
|
||||
select
|
||||
<include refid="baseSql"/>
|
||||
from surv_iot_virtual_device_module
|
||||
<where>
|
||||
<if test="groupId!=null and groupId!=''">
|
||||
and MODULE_GROUP_ID = #{groupId}
|
||||
</if>
|
||||
<if test="readType!=null">
|
||||
and READ_TYPE IN
|
||||
<foreach collection="readType" index="index" item="id" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</if>
|
||||
</where>
|
||||
order by SORT_NO,CREATE_TIME desc;
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
@ -43,6 +43,9 @@
|
|||
<if test="param2.phone!=null and param2.phone!=''">
|
||||
and phone like concat('%',#{param2.phone},'%')
|
||||
</if>
|
||||
<if test="param2.appId!=null and param2.appId!=''">
|
||||
and app_id = #{param2.appId}
|
||||
</if>
|
||||
<if test="param2.nickName!=null and param2.nickName!=''">
|
||||
and nick_name like concat('%',#{param2.nickName},'%')
|
||||
</if>
|
||||
|
|
|
|||
|
|
@ -35,4 +35,6 @@ public interface ISurvDeviceDeployService extends IService<SurvDeviceDeploy> {
|
|||
List<SurvDeviceDeploy> getAllDevice(String stationCode,List<String> deployTypes);
|
||||
|
||||
SurvDeviceDeploy getOrientDeviceByStation(String stationCode);
|
||||
|
||||
SurvDeviceDeploy getDeviceById(String deployId,String tenantId);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,6 +3,8 @@ package org.jeecg.modules.appmana.service;
|
|||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import org.jeecg.common.entity.SurvIotVirtualDeviceGroup;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Description: 虚拟设备模块分组
|
||||
* @Author: jeecg-boot
|
||||
|
|
@ -11,4 +13,5 @@ import org.jeecg.common.entity.SurvIotVirtualDeviceGroup;
|
|||
*/
|
||||
public interface ISurvIotVirtualDeviceGroupService extends IService<SurvIotVirtualDeviceGroup> {
|
||||
|
||||
List<SurvIotVirtualDeviceGroup> getModuleGroup(String deployCode, List<String> readType);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ package org.jeecg.modules.appmana.service;
|
|||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import org.jeecg.common.entity.SurvDeviceDeploy;
|
||||
import org.jeecg.common.entity.SurvIotVirtualDevice;
|
||||
import org.jeecg.common.entity.SurvIotVirtualDeviceGroup;
|
||||
import org.jeecg.common.entity.SurvIotVirtualDeviceModule;
|
||||
import org.jeecg.common.iot.Fertilizer.VOFertilizerStats;
|
||||
import org.jeecg.common.iot.up.DeviceActionVo;
|
||||
|
|
@ -67,4 +68,8 @@ public interface ISurvIotVirtualDeviceService extends IService<SurvIotVirtualDev
|
|||
List<String> getAllMqttTopic();
|
||||
|
||||
void processCache(DeviceActionVo deviceQueryActionVo);
|
||||
|
||||
List<SurvIotVirtualDeviceModule> getModuleByType(String deployCode, List<String> readType);
|
||||
|
||||
List<SurvIotVirtualDeviceGroup> getModuleByGroup(String deployCode, List<String> readType);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,4 +11,5 @@ import org.jeecg.common.entity.WxApp;
|
|||
*/
|
||||
public interface IWxAppService extends IService<WxApp> {
|
||||
|
||||
WxApp getAppByTenantId(String tenantId);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,9 +4,12 @@ import com.alibaba.fastjson.JSONObject;
|
|||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.beanutils.BeanUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.jeecg.common.config.TenantContext;
|
||||
import org.jeecg.common.constant.PollutionConstants;
|
||||
import org.jeecg.common.constant.enums.PollutionEnum;
|
||||
import org.jeecg.common.dto.CommonDTO;
|
||||
import org.jeecg.common.entity.*;
|
||||
import org.jeecg.common.tenant.TenantContextHolder;
|
||||
import org.jeecg.common.vo.VOHisResult;
|
||||
import org.jeecg.modules.appmana.service.ISurvHisdataAirService;
|
||||
import org.jeecg.modules.appmana.service.ISurvHisdataLivestockwaterService;
|
||||
|
|
@ -36,7 +39,7 @@ public class CommonServiceImpl {
|
|||
@Autowired
|
||||
@Lazy
|
||||
private SurvConfigServiceImpl configService;
|
||||
|
||||
private static String defaultTenant = "1000";
|
||||
/**
|
||||
* 获取监测设备的数据
|
||||
*/
|
||||
|
|
@ -160,6 +163,29 @@ public class CommonServiceImpl {
|
|||
return configService.getCacheConfig(tenantId, configType);
|
||||
}
|
||||
|
||||
public String getTenantId(String authId){
|
||||
String tenantId = "";
|
||||
if(StringUtils.isNotBlank(authId)){
|
||||
tenantId = authId;
|
||||
}else{
|
||||
String headerTenantId = TenantContext.getTenant();
|
||||
log.error("==============tenantCheck==========="+headerTenantId);
|
||||
if(StringUtils.isNotBlank(headerTenantId)){
|
||||
tenantId = headerTenantId;
|
||||
}else{
|
||||
tenantId = defaultTenant;
|
||||
}
|
||||
}
|
||||
TenantContext.setTenant(tenantId);//设置当前租户
|
||||
return tenantId;
|
||||
}
|
||||
|
||||
public void processTenant(CommonDTO commonDTO) {
|
||||
if(commonDTO!=null){
|
||||
getTenantId(commonDTO.getAuthId());
|
||||
}else{
|
||||
TenantContext.setTenant(defaultTenant);//设置当前租户
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -484,11 +484,15 @@ public class IotCommonP2ServiceImpl {
|
|||
timeList.addAll(yesterData.getIndexs().subList(yesterDataCounts,yesterData.getIndexs().size()));
|
||||
}
|
||||
}
|
||||
|
||||
timeList.addAll(nowItegrate.getIndexs().subList(0,todayDataCounts));
|
||||
//过滤无数据情况
|
||||
if(!nowItegrate.getIndexs().isEmpty()){
|
||||
timeList.addAll(nowItegrate.getIndexs().subList(0,todayDataCounts));
|
||||
}
|
||||
|
||||
if(dataMap.isEmpty()){//如果非今日,传入第一次的统计
|
||||
dataMap.putAll(nowItegrate.getSurvResult());
|
||||
if(nowItegrate.getSurvResult()!=null){//过滤空数据
|
||||
dataMap.putAll(nowItegrate.getSurvResult());
|
||||
}
|
||||
}
|
||||
voSurvIntegrateResult.setHeaders(nowItegrate.getHeaders());
|
||||
voSurvIntegrateResult.setSurvResult(dataMap);
|
||||
|
|
|
|||
|
|
@ -57,9 +57,13 @@ public class IotCommonServiceImpl {
|
|||
@Autowired
|
||||
@Lazy
|
||||
private ISurvHisdataLivestockwaterService livestockwaterService;
|
||||
@Autowired
|
||||
@Lazy
|
||||
private CommonServiceImpl commonService;
|
||||
|
||||
|
||||
public VOIntegrateStatistic airSoilIntegrate(VOSurvIntegrateParam voSurvIntegrateParam){
|
||||
commonService.getTenantId(voSurvIntegrateParam.getAuthId());
|
||||
//获取所有设备
|
||||
List<String> deployTypes = new ArrayList<>();
|
||||
deployTypes.add(PollutionConstants.AIR_SURV);
|
||||
|
|
@ -90,6 +94,7 @@ public class IotCommonServiceImpl {
|
|||
|
||||
|
||||
public VOIntegrateStatistic waterIntegrate(VOWaterSurvIntegrateParam voSurvIntegrateParam) {
|
||||
commonService.getTenantId(voSurvIntegrateParam.getAuthId());
|
||||
//获取所有设备
|
||||
List<String> deployTypes = new ArrayList<>();
|
||||
deployTypes.add(PollutionConstants.WATER_ORIENT);
|
||||
|
|
@ -1298,7 +1303,7 @@ public class IotCommonServiceImpl {
|
|||
if(!noDatas.isEmpty()) {
|
||||
avgNO = noDatas.stream()
|
||||
.map(Double::parseDouble)
|
||||
.collect(Collectors.toList());
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
if(!codDatas.isEmpty()) {
|
||||
avgCOD = codDatas.stream()
|
||||
|
|
|
|||
|
|
@ -189,7 +189,7 @@ public class SurvDeviceDeployRelayServiceImpl extends ServiceImpl<SurvDeviceDepl
|
|||
Assert.notNull(deploy,"设备已失效");
|
||||
if(StringUtils.isNotBlank(fDeviceDeployRelay.getGroupId())){
|
||||
if(containsChinese(fDeviceDeployRelay.getGroupId())){//如果含有中文,说明为新增
|
||||
String groupId = IdUtil.getSnowflakeNextIdStr();;
|
||||
String groupId = IdUtil.getSnowflakeNextIdStr();
|
||||
SurvDeviceDeployRelaygroup fDeviceDeployRelaygroup = new SurvDeviceDeployRelaygroup();
|
||||
fDeviceDeployRelaygroup.setId(groupId);
|
||||
fDeviceDeployRelaygroup.setDeployId(deploy.getId());
|
||||
|
|
@ -274,7 +274,6 @@ public class SurvDeviceDeployRelayServiceImpl extends ServiceImpl<SurvDeviceDepl
|
|||
relayDesMap.put(keyNum + "", statusDes);
|
||||
relayNum++;
|
||||
}
|
||||
|
||||
}
|
||||
for (SurvDeviceDeployRelay relay : relays) {
|
||||
relay.setRelayValue(relayMap.get(relay.getRelayKey()));
|
||||
|
|
|
|||
|
|
@ -451,7 +451,7 @@ public class SurvDeviceDeployServiceImpl extends ServiceImpl<SurvDeviceDeployMap
|
|||
String deployType ="";
|
||||
if(stationInfo.getStationType().contains("orient")){//面源站
|
||||
deployType = PollutionConstants.WATER_ORIENT;
|
||||
}else if(stationInfo.getStationType().contains("live")) {//面源站
|
||||
}else if(stationInfo.getStationType().contains("live")) {//畜禽站
|
||||
deployType = PollutionConstants.WATER_LIVE;
|
||||
}
|
||||
|
||||
|
|
@ -462,6 +462,8 @@ public class SurvDeviceDeployServiceImpl extends ServiceImpl<SurvDeviceDeployMap
|
|||
return deploy;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void updDeployRelay(SurvDeviceDeploy fDeviceDeploy, XphDeviceInfoVo xphDeviceInfoVo) {
|
||||
if (xphDeviceInfoVo != null) {
|
||||
if (StringUtils.isNotBlank(xphDeviceInfoVo.getRelayName()) && StringUtils.isNotBlank(xphDeviceInfoVo.getRelayNum())) {
|
||||
|
|
@ -570,6 +572,7 @@ public class SurvDeviceDeployServiceImpl extends ServiceImpl<SurvDeviceDeployMap
|
|||
fDeviceDeployRelaygroup.setGroupNotes("分组_"+relayGroupCn);
|
||||
fDeviceDeployRelaygroup.setSortNo(groupCount);
|
||||
fDeviceDeployRelaygroup.setTenantId(relay.getTenantId());
|
||||
fDeviceDeployRelaygroup.setGroupTypeName("group");
|
||||
}
|
||||
// relay.setGroupName(relayGroupCn);//不再保存分组名,直接使用id获取
|
||||
relay.setGroupId(groupId);
|
||||
|
|
@ -622,4 +625,10 @@ public class SurvDeviceDeployServiceImpl extends ServiceImpl<SurvDeviceDeployMap
|
|||
.in(SurvDeviceDeploy::getDeployCode, deploys).set(SurvDeviceDeploy::getLastsyncTime, new Date()).update();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public SurvDeviceDeploy getDeviceById(String deployId, String tenantId) {
|
||||
return baseMapper.getDeviceById(deployId,tenantId);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,6 +6,9 @@ import org.jeecg.modules.appmana.mapper.SurvIotVirtualDeviceGroupMapper;
|
|||
import org.jeecg.modules.appmana.service.ISurvIotVirtualDeviceGroupService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Description: 虚拟设备模块分组
|
||||
* @Author: jeecg-boot
|
||||
|
|
@ -15,4 +18,9 @@ import org.springframework.stereotype.Service;
|
|||
@Service
|
||||
public class SurvIotVirtualDeviceGroupServiceImpl extends ServiceImpl<SurvIotVirtualDeviceGroupMapper, SurvIotVirtualDeviceGroup> implements ISurvIotVirtualDeviceGroupService {
|
||||
|
||||
|
||||
@Override
|
||||
public List<SurvIotVirtualDeviceGroup> getModuleGroup(String deviceId, List<String> readType) {
|
||||
return baseMapper.getModuleGroup(deviceId,readType);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,10 +10,7 @@ import org.apache.commons.codec.binary.Hex;
|
|||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.jeecg.common.constant.IotConstants;
|
||||
import org.jeecg.common.constant.TopicConstant;
|
||||
import org.jeecg.common.entity.SurvDeviceDeploy;
|
||||
import org.jeecg.common.entity.SurvIotVirtualDevice;
|
||||
import org.jeecg.common.entity.SurvIotVirtualDeviceModule;
|
||||
import org.jeecg.common.entity.SurvIotVirtualDeviceNet;
|
||||
import org.jeecg.common.entity.*;
|
||||
import org.jeecg.common.iot.Fertilizer.VOFertilizerStats;
|
||||
import org.jeecg.common.iot.Fertilizer.VOFertilizerStatsArr;
|
||||
import org.jeecg.common.iot.common.DeviceLogVo;
|
||||
|
|
@ -59,6 +56,8 @@ public class SurvIotVirtualDeviceServiceImpl extends ServiceImpl<SurvIotVirtualD
|
|||
@Autowired
|
||||
private SurvIotVirtualDeviceModuleServiceImpl moduleService;
|
||||
@Autowired
|
||||
private SurvIotVirtualDeviceGroupServiceImpl groupService;
|
||||
@Autowired
|
||||
private SurvIotVirtualDeviceNetServiceImpl netService;
|
||||
@Autowired(required = false)
|
||||
private MqttService mqttCustomerClient;
|
||||
|
|
@ -511,6 +510,8 @@ public class SurvIotVirtualDeviceServiceImpl extends ServiceImpl<SurvIotVirtualD
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//将modus处理为json
|
||||
public ModuleStatusResultVo processHexToJson(ModbusResponseParser.ModbusResult modbusResult, List<SurvIotVirtualDeviceModule> modules){
|
||||
FunctionCode functionCode = FunctionCode.valueOfCode(modbusResult.getFunctionCode());
|
||||
|
|
@ -747,4 +748,32 @@ public class SurvIotVirtualDeviceServiceImpl extends ServiceImpl<SurvIotVirtualD
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public List<SurvIotVirtualDeviceModule> getModuleByType(String deployCode, List<String> readType) {
|
||||
SurvIotVirtualDevice device = lambdaQuery()
|
||||
.eq(SurvIotVirtualDevice::getIotCode,deployCode)
|
||||
.last("limit 1")
|
||||
.one();
|
||||
Assert.notNull(device,"无效设备号"+deployCode);
|
||||
List<SurvIotVirtualDeviceModule> list = moduleService.lambdaQuery()
|
||||
.eq(SurvIotVirtualDeviceModule::getDeviceId,device.getId())
|
||||
.in(readType!=null,SurvIotVirtualDeviceModule::getReadType,readType)
|
||||
.orderByAsc(SurvIotVirtualDeviceModule::getSortNo)
|
||||
.orderByDesc(SurvIotVirtualDeviceModule::getCreateTime)
|
||||
.list()
|
||||
;
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SurvIotVirtualDeviceGroup> getModuleByGroup(String deployCode, List<String> readType) {
|
||||
SurvIotVirtualDevice device = lambdaQuery()
|
||||
.eq(SurvIotVirtualDevice::getIotCode,deployCode)
|
||||
.last("limit 1")
|
||||
.one();
|
||||
Assert.notNull(device,"无效设备号"+deployCode);
|
||||
return groupService.getModuleGroup(device.getId(),readType);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,4 +15,11 @@ import org.springframework.stereotype.Service;
|
|||
@Service
|
||||
public class WxAppServiceImpl extends ServiceImpl<WxAppMapper, WxApp> implements IWxAppService {
|
||||
|
||||
@Override
|
||||
public WxApp getAppByTenantId(String tenantId) {
|
||||
WxApp wxApp = lambdaQuery().eq(WxApp::getTenantId,tenantId)
|
||||
.last("limit 1")
|
||||
.one();
|
||||
return wxApp;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -42,9 +42,9 @@ public class MqttConfig {
|
|||
@Bean//注入Spring
|
||||
public MyMqttClient myMqttClient() {
|
||||
MyMqttClient myMqttClient = new MyMqttClient(host, username, password, clientId, timeOut, keepAlive, clearSession);
|
||||
// String activeProfile = env.getActiveProfiles()[0];
|
||||
String profiles = env.getProperty("runtime.active");
|
||||
//正式环境才连接mqtt
|
||||
// if(activeProfile.contains("prod")){
|
||||
if(profiles.contains("prod")){
|
||||
log.warn("-------------正式环境,MQTT启动初始化---------");
|
||||
for (int i = 0; i < 10; i++) {
|
||||
try {
|
||||
|
|
@ -62,9 +62,9 @@ public class MqttConfig {
|
|||
}
|
||||
}
|
||||
}
|
||||
// }else{
|
||||
// log.warn("-------------非正式环境跳过Mqtt订阅---------");
|
||||
// }
|
||||
}else{
|
||||
log.warn("-------------非正式环境跳过Mqtt订阅---------");
|
||||
}
|
||||
return myMqttClient;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ public interface ZhAdminFeignClient {
|
|||
* @return
|
||||
*/
|
||||
@PostMapping("/appmana/inner/api/deviceNewestData")
|
||||
VOTransData deviceNewestData(@RequestParam String deployId);
|
||||
VOTransData deviceNewestData(@RequestParam String deployId,@RequestParam String tenantId);
|
||||
|
||||
/**
|
||||
* 构造面源数据
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
package org.jeecg.system.applet.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
|
@ -16,6 +17,7 @@ import org.jeecg.system.applet.client.ZhAdminFeignClient;
|
|||
import org.jeecg.system.applet.service.ISurvDeviceDeployService;
|
||||
import org.jeecg.system.applet.service.ISurvStationInfoService;
|
||||
import org.jeecg.system.applet.util.Iotutils;
|
||||
import org.jeecg.system.applet.util.TenantUtil;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
|
|
@ -54,8 +56,9 @@ public class SurvDeviceDeployController {
|
|||
@GetMapping(value = "/list")
|
||||
@ApiLogin
|
||||
public R<List<SurvDeviceDeploy>> queryPageList(SurvDeviceDeploy survDeviceDeploy) {
|
||||
List<SurvDeviceDeploy> survList = survDeviceDeployService.getCameraGroupByStation(PollutionConstants.CAMERA);
|
||||
List<SurvStationInfo> stationInfoList = stationInfoService.list();
|
||||
String tenantId = TenantUtil.getCurTenant(survDeviceDeploy.getAuthId());
|
||||
List<SurvDeviceDeploy> survList = survDeviceDeployService.getCameraGroupByStation(PollutionConstants.CAMERA,tenantId);
|
||||
List<SurvStationInfo> stationInfoList = stationInfoService.list(new QueryWrapper<SurvStationInfo>().eq("TENANT_ID",tenantId));
|
||||
Map<String,String> mp = new HashMap<>();
|
||||
for (SurvStationInfo survStationInfo : stationInfoList) {
|
||||
mp.put(survStationInfo.getStationCode(),survStationInfo.getStationName());
|
||||
|
|
@ -79,12 +82,13 @@ public class SurvDeviceDeployController {
|
|||
@ApiOperation(value="设备列表", notes="设备列表")
|
||||
@GetMapping(value = "/deviceList")
|
||||
@ApiLogin
|
||||
public R<List<SurvDeviceDeploy>> deviceList(@RequestParam(name = "stationCode",required = false)String stationCode) {
|
||||
public R<List<SurvDeviceDeploy>> deviceList(@RequestParam(name = "stationCode",required = false)String stationCode,@RequestParam(name = "authId",required = false)String authId) {
|
||||
List<String> deployTypes = new ArrayList<>();
|
||||
// deployTypes.add(PollutionConstants.CAMERA);
|
||||
deployTypes.add(PollutionConstants.AIR_SURV);
|
||||
deployTypes.add(PollutionConstants.SOIL_SURV);
|
||||
List<SurvDeviceDeploy> deploys = survDeviceDeployService.getDeviceListByStation(stationCode,deployTypes,null);
|
||||
String tenantId = TenantUtil.getCurTenant(authId);
|
||||
List<SurvDeviceDeploy> deploys = survDeviceDeployService.getDeviceListByStation(stationCode,deployTypes,null,tenantId);
|
||||
|
||||
return R.ok(deploys);
|
||||
}
|
||||
|
|
@ -116,11 +120,12 @@ public class SurvDeviceDeployController {
|
|||
@ApiOperation(value="监测设备列表", notes="监测设备列表")
|
||||
@GetMapping(value = "/OrientDeviceList")
|
||||
@ApiLogin
|
||||
public R<List<SurvDeviceDeploy>> OrientDeviceList(@RequestParam(name = "stationCode",required = false)String stationCode) {
|
||||
public R<List<SurvDeviceDeploy>> OrientDeviceList(@RequestParam(name = "stationCode",required = false)String stationCode,@RequestParam(name = "authId",required = false)String authId) {
|
||||
List<String> deployTypes = new ArrayList<>();
|
||||
deployTypes.add(PollutionConstants.WATER_ORIENT);
|
||||
deployTypes.add(PollutionConstants.WATER_LIVE);
|
||||
List<SurvDeviceDeploy> deploys = survDeviceDeployService.getDeviceListByStation(stationCode,deployTypes,null);
|
||||
String tenantId = TenantUtil.getCurTenant(authId);
|
||||
List<SurvDeviceDeploy> deploys = survDeviceDeployService.getDeviceListByStation(stationCode,deployTypes,null,tenantId);
|
||||
return R.ok(deploys);
|
||||
}
|
||||
|
||||
|
|
@ -132,14 +137,15 @@ public class SurvDeviceDeployController {
|
|||
@ApiOperation(value="监测设备列表", notes="监测设备列表")
|
||||
@GetMapping(value = "/survDeviceList")
|
||||
@ApiLogin
|
||||
public R<List<SurvDeviceDeploy>> survDeviceList(@RequestParam(name = "stationCode",required = false)String stationCode) {
|
||||
public R<List<SurvDeviceDeploy>> survDeviceList(@RequestParam(name = "stationCode",required = false)String stationCode,@RequestParam(name = "authId",required = false)String authId) {
|
||||
List<String> deployTypes = new ArrayList<>();
|
||||
deployTypes.add(PollutionConstants.AIR_SURV);
|
||||
deployTypes.add(PollutionConstants.SOIL_SURV);
|
||||
deployTypes.add(PollutionConstants.WATER_QULITY);
|
||||
deployTypes.add(PollutionConstants.WATER_ORIENT);
|
||||
deployTypes.add(PollutionConstants.WATER_LIVE);
|
||||
List<SurvDeviceDeploy> deploys = survDeviceDeployService.getDeviceListByStation(stationCode,deployTypes,null);
|
||||
String tenantId = TenantUtil.getCurTenant(authId);
|
||||
List<SurvDeviceDeploy> deploys = survDeviceDeployService.getDeviceListByStation(stationCode,deployTypes,null,tenantId);
|
||||
return R.ok(deploys);
|
||||
}
|
||||
|
||||
|
|
@ -151,10 +157,11 @@ public class SurvDeviceDeployController {
|
|||
@ApiOperation(value="五常设备列表", notes="五常设备列表")
|
||||
@GetMapping(value = "/waterDeviceList")
|
||||
@ApiLogin
|
||||
public R<List<SurvDeviceDeploy>> waterDeviceList(@RequestParam(name = "stationCode",required = false)String stationCode) {
|
||||
public R<List<SurvDeviceDeploy>> waterDeviceList(@RequestParam(name = "stationCode",required = false)String stationCode,@RequestParam(name = "authId",required = false)String authId) {
|
||||
List<String> deployTypes = new ArrayList<>();
|
||||
deployTypes.add(PollutionConstants.WATER_QULITY);
|
||||
List<SurvDeviceDeploy> deploys = survDeviceDeployService.getDeviceListByStation(stationCode,deployTypes,null);
|
||||
String tenantId = TenantUtil.getCurTenant(authId);
|
||||
List<SurvDeviceDeploy> deploys = survDeviceDeployService.getDeviceListByStation(stationCode,deployTypes,null,tenantId);
|
||||
return R.ok(deploys);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ import lombok.extern.slf4j.Slf4j;
|
|||
import org.jeecg.common.entity.SurvFecesLedger;
|
||||
import org.jeecg.common.util.R;
|
||||
import org.jeecg.system.applet.service.ISurvFecesLedgerService;
|
||||
import org.jeecg.system.applet.util.TenantUtil;
|
||||
import org.jeecg.system.applet.util.ThirdSessionHolder;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
|
@ -46,9 +47,12 @@ public class SurvFecesLedgerController {
|
|||
public R<IPage<SurvFecesLedger>> queryPageList(SurvFecesLedger survFecesLedger,
|
||||
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
|
||||
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
|
||||
@RequestParam(name = "authId",required = false)String authId,
|
||||
HttpServletRequest req) {
|
||||
// QueryWrapper<SurvFecesLedger> queryWrapper = QueryGenerator.initQueryWrapper(survFecesLedger, req.getParameterMap());
|
||||
Page<SurvFecesLedger> page = new Page<SurvFecesLedger>(pageNo, pageSize);
|
||||
String tenantId = TenantUtil.getCurTenant(authId);
|
||||
survFecesLedger.setTenantId(tenantId);
|
||||
IPage<SurvFecesLedger> pageList = survFecesLedgerService.pages(page, survFecesLedger);
|
||||
return R.ok(pageList);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ import lombok.extern.slf4j.Slf4j;
|
|||
import org.jeecg.common.entity.SurvMaintainItem;
|
||||
import org.jeecg.common.util.R;
|
||||
import org.jeecg.system.applet.service.ISurvMaintainItemService;
|
||||
import org.jeecg.system.applet.util.TenantUtil;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
|
|
@ -36,6 +37,8 @@ public class SurvMaintainItemController {
|
|||
@GetMapping(value = "/list")
|
||||
public R<List<SurvMaintainItem>> queryPageList(SurvMaintainItem survMaintainRecord,
|
||||
HttpServletRequest req) {
|
||||
String tenantId = TenantUtil.getCurTenant(survMaintainRecord.getAuthId());
|
||||
survMaintainRecord.setTenantId(tenantId);
|
||||
List<SurvMaintainItem> pageList = survMaintainItemService.list(Wrappers.lambdaQuery(survMaintainRecord));
|
||||
return R.ok(pageList);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ import lombok.extern.slf4j.Slf4j;
|
|||
import org.jeecg.common.entity.SurvMulchRecord;
|
||||
import org.jeecg.common.util.R;
|
||||
import org.jeecg.system.applet.service.ISurvMulchRecordService;
|
||||
import org.jeecg.system.applet.util.TenantUtil;
|
||||
import org.jeecg.system.applet.util.ThirdSessionHolder;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
|
@ -45,8 +46,11 @@ public class SurvMulchRecordController {
|
|||
public R<IPage<SurvMulchRecord>> queryPageList(SurvMulchRecord survMulchRecord,
|
||||
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
|
||||
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
|
||||
@RequestParam(name = "authId",required = false)String authId,
|
||||
HttpServletRequest req) {
|
||||
Page<SurvMulchRecord> page = new Page<SurvMulchRecord>(pageNo, pageSize);
|
||||
String tenantId = TenantUtil.getCurTenant(authId);
|
||||
survMulchRecord.setTenantId(tenantId);
|
||||
IPage<SurvMulchRecord> pageList = survMulchRecordService.pages(page, survMulchRecord);
|
||||
return R.ok(pageList);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ import org.apache.commons.lang3.StringUtils;
|
|||
import org.jeecg.common.entity.SurvPestlightAlert;
|
||||
import org.jeecg.common.util.R;
|
||||
import org.jeecg.system.applet.service.ISurvPestlightAlertService;
|
||||
import org.jeecg.system.applet.util.TenantUtil;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
|
|
@ -50,13 +51,15 @@ public class SurvPestlightAlertController {
|
|||
public R<IPage<SurvPestlightAlert>> queryPageList(SurvPestlightAlert survPestlightAlert,
|
||||
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
|
||||
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
|
||||
@RequestParam(name = "authId",required = false)String authId,
|
||||
HttpServletRequest req) {
|
||||
String tempDeviceNo ="";
|
||||
if(StringUtils.isNotBlank(survPestlightAlert.getDeviceNo())){
|
||||
tempDeviceNo=survPestlightAlert.getDeviceNo();
|
||||
survPestlightAlert.setDeviceNo(null);
|
||||
}
|
||||
|
||||
String tenantId = TenantUtil.getCurTenant(authId);
|
||||
survPestlightAlert.setTenantId(tenantId);
|
||||
QueryWrapper<SurvPestlightAlert> queryWrapper = Wrappers.query(survPestlightAlert);
|
||||
if(StringUtils.isNotBlank(tempDeviceNo)) {
|
||||
queryWrapper.like("DEVICE_NO", tempDeviceNo);
|
||||
|
|
@ -70,9 +73,10 @@ public class SurvPestlightAlertController {
|
|||
|
||||
@ApiOperation(value="报警数量查询", notes="报警数量查询")
|
||||
@GetMapping(value = "/getLightAlertCount")
|
||||
public R getLightAlertCount(){
|
||||
Integer alertCount = survPestlightAlertService.countAlert("1");
|
||||
Integer disAlertCount = survPestlightAlertService.countAlert("0");
|
||||
public R getLightAlertCount(@RequestParam(name = "authId",required = false)String authId){
|
||||
String tenantId = TenantUtil.getCurTenant(authId);
|
||||
Integer alertCount = survPestlightAlertService.countAlert("1",tenantId);
|
||||
Integer disAlertCount = survPestlightAlertService.countAlert("0",tenantId);
|
||||
Integer finalCount = alertCount-disAlertCount;
|
||||
JSONObject job =new JSONObject();
|
||||
job.put("alertCount",finalCount<0?0:finalCount);
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ package org.jeecg.system.applet.controller;
|
|||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
|
|
@ -20,6 +21,7 @@ import org.jeecg.system.applet.annotation.ApiLogin;
|
|||
import org.jeecg.system.applet.client.ZhAdminFeignClient;
|
||||
import org.jeecg.system.applet.service.*;
|
||||
import org.jeecg.system.applet.util.Iotutils;
|
||||
import org.jeecg.system.applet.util.TenantUtil;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
|
|
@ -111,6 +113,8 @@ public class SurvStationInfoController {
|
|||
) {
|
||||
// QueryWrapper<SurvStationInfo> queryWrapper = Wrappers.query(survStationInfo);
|
||||
Page<SurvStationInfo> page = new Page<SurvStationInfo>(pageNo, pageSize);
|
||||
String tenantId = TenantUtil.getCurTenant(survStationInfo.getAuthId());
|
||||
survStationInfo.setTenantId(tenantId);
|
||||
IPage<SurvStationInfo> pageList = survStationInfoService.pages(page, survStationInfo);
|
||||
if(!pageList.getRecords().isEmpty()) {
|
||||
for (SurvStationInfo record : pageList.getRecords()) {
|
||||
|
|
@ -215,6 +219,9 @@ public class SurvStationInfoController {
|
|||
@GetMapping(value = "/list")
|
||||
@ApiLogin
|
||||
public R<List<SurvStationInfo>> queryList(SurvStationInfo survStationInfo) {
|
||||
|
||||
String tenantId = TenantUtil.getCurTenant(survStationInfo.getAuthId());
|
||||
survStationInfo.setTenantId(tenantId);
|
||||
QueryWrapper<SurvStationInfo> queryWrapper = Wrappers.query(survStationInfo);
|
||||
List<SurvStationInfo> pageList = survStationInfoService.list(queryWrapper);
|
||||
return R.ok(pageList);
|
||||
|
|
@ -227,9 +234,9 @@ public class SurvStationInfoController {
|
|||
*/
|
||||
@GetMapping(value = "/getStationInfo")
|
||||
@ApiLogin
|
||||
public R getStationInfo(@RequestParam(value = "stationCode",required = false) String stationCode){
|
||||
|
||||
List<SurvStationInfo> stationInfos = survStationInfoService.getAllStationAndDevice(stationCode,"","token");
|
||||
public R getStationInfo(@RequestParam(value = "stationCode",required = false) String stationCode,@RequestParam(value = "authId",required = false) String authId){
|
||||
String tenantId = TenantUtil.getCurTenant(authId);
|
||||
List<SurvStationInfo> stationInfos = survStationInfoService.getAllStationAndDevice(stationCode,"","token",tenantId);
|
||||
|
||||
if(stationInfos.size()>0){
|
||||
SurvStationInfo curStation = stationInfos.get(0);
|
||||
|
|
@ -280,7 +287,12 @@ public class SurvStationInfoController {
|
|||
|
||||
jsonObject.put("survItemList",allSurv);
|
||||
//监控摄像头
|
||||
List<SurvDeviceDeploy> camList = survDeviceDeployService.list(Wrappers.<SurvDeviceDeploy>lambdaQuery().eq(SurvDeviceDeploy::getStationCode,stationCode).eq(SurvDeviceDeploy::getDeployType,PollutionConstants.CAMERA).orderByAsc(SurvDeviceDeploy::getSortNo));
|
||||
List<SurvDeviceDeploy> camList = survDeviceDeployService
|
||||
.list(Wrappers.<SurvDeviceDeploy>lambdaQuery()
|
||||
.eq(SurvDeviceDeploy::getTenantId,tenantId)
|
||||
.eq(SurvDeviceDeploy::getStationCode,stationCode)
|
||||
.eq(SurvDeviceDeploy::getDeployType,PollutionConstants.CAMERA)
|
||||
.orderByAsc(SurvDeviceDeploy::getSortNo));
|
||||
List<SurvDeviceDeploy> adds = iotutils.addOnlineStatus(camList);
|
||||
jsonObject.put("survCamera",adds);
|
||||
|
||||
|
|
@ -449,12 +461,13 @@ public class SurvStationInfoController {
|
|||
@GetMapping(value = "/deviceList")
|
||||
@ApiLogin
|
||||
public R deviceList(SurvDeviceDeploy survDeviceDeploy) {
|
||||
String tenantId = TenantUtil.getCurTenant(survDeviceDeploy.getAuthId());
|
||||
// JSONObject job = new JSONObject();
|
||||
JSONArray joa = new JSONArray();
|
||||
Integer count =1;
|
||||
List<SurvStationInfo> stationList = survStationInfoService.listALlStation();
|
||||
List<SurvStationInfo> stationList = survStationInfoService.listALlStation(tenantId);
|
||||
for (SurvStationInfo survStationInfo : stationList) {
|
||||
List<SurvDeviceDeploy> pageList = survDeviceDeployService.getDeviceByStationNoCam(survStationInfo.getStationCode(),null);
|
||||
List<SurvDeviceDeploy> pageList = survDeviceDeployService.getDeviceByStationNoCam(survStationInfo.getStationCode(),null,tenantId);
|
||||
List<SurvDeviceDeploy> adds = iotutils.addOnlineStatus(pageList);
|
||||
joa.add(adds);
|
||||
count++;
|
||||
|
|
@ -471,19 +484,20 @@ public class SurvStationInfoController {
|
|||
@ApiOperation(value="非站点监测设备查询", notes="各站点设备查询")
|
||||
@GetMapping(value = "/fdeviceList")
|
||||
@ApiLogin
|
||||
public R fdeviceList(@RequestParam(required = false) String stationCode,@RequestParam(required = false) String stationFilter) {
|
||||
public R fdeviceList(@RequestParam(required = false) String stationCode,@RequestParam(required = false) String stationFilter,@RequestParam(name = "authId",required = false)String authId) {
|
||||
|
||||
JSONArray joa = new JSONArray();
|
||||
List<String> deployTypes = new ArrayList<>();
|
||||
// deployTypes.add(PollutionConstants.CAMERA);
|
||||
deployTypes.add(PollutionConstants.AIR_SURV);
|
||||
deployTypes.add(PollutionConstants.SOIL_SURV);
|
||||
List<SurvDeviceDeploy> deploys = survDeviceDeployService.getDeviceListByStation(stationCode,deployTypes,stationFilter);
|
||||
String tenantId = TenantUtil.getCurTenant(authId);
|
||||
List<SurvDeviceDeploy> deploys = survDeviceDeployService.getDeviceListByStation(stationCode,deployTypes,stationFilter,tenantId);
|
||||
List<SurvDeviceDeploy> adds = new ArrayList<>();
|
||||
if(!deploys.isEmpty()){
|
||||
List<String> codeList = deploys.stream().map(SurvDeviceDeploy::getDeviceCode).collect(Collectors.toList());
|
||||
codeList = codeList.stream().distinct().collect(Collectors.toList());
|
||||
List<SurvDictDeviceDetail> deviceDetails = survDeviceDeployService.getDeviceInfo(codeList);
|
||||
List<SurvDictDeviceDetail> deviceDetails = survDeviceDeployService.getDeviceInfo(codeList);//由原接口改造,实际用deviceCode查询了字典表
|
||||
Map<String,SurvDictDeviceDetail> deviceDetailMap = new HashMap<>();
|
||||
deviceDetails.forEach(item->deviceDetailMap.put(item.getId(),item));
|
||||
for (SurvDeviceDeploy deploy : deploys) {
|
||||
|
|
@ -506,15 +520,19 @@ public class SurvStationInfoController {
|
|||
@GetMapping(value = "/stationMap")
|
||||
@ApiLogin
|
||||
public R stationMap(SurvStationInfo survStationInfo) {
|
||||
String tenantId = TenantUtil.getCurTenant(survStationInfo.getAuthId());
|
||||
survStationInfo.setTenantId(tenantId);
|
||||
QueryWrapper<SurvStationInfo> queryWrapper = Wrappers.query(survStationInfo);
|
||||
List<SurvStationInfo> pageList = survStationInfoService.list(queryWrapper);
|
||||
JSONObject job = new JSONObject();
|
||||
job.put("stationInfo",pageList);
|
||||
//杀虫灯数据
|
||||
List<SurvPestlightInfo> depList= pestlightInfoService.list();
|
||||
LambdaQueryWrapper<SurvPestlightInfo> pestQuery = new LambdaQueryWrapper<>();
|
||||
pestQuery.eq(SurvPestlightInfo::getTenantId,tenantId);
|
||||
List<SurvPestlightInfo> depList= pestlightInfoService.list(pestQuery);
|
||||
job.put("pestlight",depList);
|
||||
//增加自定义点位
|
||||
List<SurvDisplayInfo> locationList = survDisplayInfoService.getInfoByType("custom_localtion");
|
||||
List<SurvDisplayInfo> locationList = survDisplayInfoService.getInfoByType("custom_localtion",tenantId);
|
||||
List<SurvStationInfo> cusList = new ArrayList<>();
|
||||
if(locationList.size()>0&&locationList.get(0).getDetailList().size()>0) {
|
||||
Integer orders = 0;
|
||||
|
|
@ -553,7 +571,8 @@ public class SurvStationInfoController {
|
|||
// deployTypes.add(PollutionConstants.CAMERA);
|
||||
deployTypes.add(PollutionConstants.AIR_SURV);
|
||||
deployTypes.add(PollutionConstants.SOIL_SURV);
|
||||
List<SurvDeviceDeploy> deploys = survDeviceDeployService.getDeviceListByStation(null,deployTypes,null);
|
||||
|
||||
List<SurvDeviceDeploy> deploys = survDeviceDeployService.getDeviceListByStation(null,deployTypes,null,tenantId);
|
||||
if(!deploys.isEmpty()){
|
||||
for (SurvDeviceDeploy deploy : deploys) {
|
||||
CommonLocationTrans ent = new CommonLocationTrans();
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@ import org.jeecg.common.vo.inner.TransZhiBiaoVo;
|
|||
import org.jeecg.common.vo.iot.common.Result;
|
||||
import org.jeecg.system.applet.client.ZhAdminFeignClient;
|
||||
import org.jeecg.system.applet.service.*;
|
||||
import org.jeecg.system.applet.util.TenantUtil;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
|
|
@ -141,14 +142,15 @@ public class WxAppletController {
|
|||
|
||||
@PostMapping("/getNewestData")
|
||||
@ApiOperation("获取首页最新数据")
|
||||
public R getNewestData(@RequestParam(required = false) String dataMode){
|
||||
List<SurvStationInfo> stationList = stationInfoService.getAllStationAndDevice("","","token");
|
||||
public R getNewestData(@RequestParam(required = false) String dataMode,@RequestParam(value = "authId",required = false) String authId){
|
||||
String tenantId = TenantUtil.getCurTenant(authId);
|
||||
List<SurvStationInfo> stationList = stationInfoService.getAllStationAndDevice("","","token",tenantId);
|
||||
Integer dataCounts = 0;
|
||||
//补充最新数据进入
|
||||
List<CommonDataTrans> listFinal = new ArrayList<>();
|
||||
if(stationList!=null&&stationList.size()>0){
|
||||
for (SurvStationInfo survStationInfo : stationList) {
|
||||
dataCounts = dataCounts + stationInfoService.getStationDataCounts(survStationInfo);
|
||||
dataCounts = dataCounts + stationInfoService.getStationDataCounts(survStationInfo,tenantId);
|
||||
if(survStationInfo.getDeviceList()!=null&&survStationInfo.getDeviceList().size()>0){
|
||||
List<SurvDeviceDeploy> remainList = new ArrayList<>();
|
||||
List<String> airList = new ArrayList<>();
|
||||
|
|
@ -217,8 +219,8 @@ public class WxAppletController {
|
|||
}
|
||||
if(IotConstants.Data_Types_All.equals(dataTypes) || IotConstants.Data_Types_Water.equals(dataTypes)) {
|
||||
if(!waterList.isEmpty()) {//五常
|
||||
VOTransData voTransData = zhAdminFeignClient.deviceNewestData(waterList.get(0));
|
||||
if(voTransData!=null){
|
||||
VOTransData voTransData = zhAdminFeignClient.deviceNewestData(waterList.get(0),tenantId);
|
||||
if(voTransData!=null && voTransData.getTransData()!=null){
|
||||
listFinal.addAll(voTransData.getTransData());
|
||||
}
|
||||
|
||||
|
|
@ -262,10 +264,11 @@ public class WxAppletController {
|
|||
|
||||
@PostMapping("/displayInfo")
|
||||
@ApiOperation("获取展示信息")
|
||||
public R getDisplayInfo(@RequestParam("infoType")String infoType){
|
||||
public R getDisplayInfo(@RequestParam("infoType")String infoType,@RequestParam(value = "authId",required = false)String authId){
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
String tenantId = TenantUtil.getCurTenant(authId);
|
||||
//效果评价
|
||||
List<SurvDisplayInfo> dis5 = survDisplayInfoService.getInfoByType(infoType);
|
||||
List<SurvDisplayInfo> dis5 = survDisplayInfoService.getInfoByType(infoType,tenantId);
|
||||
jsonObject.put("effect_assess",dis5.size()>0?dis5.get(0):"");
|
||||
return R.ok(jsonObject);
|
||||
}
|
||||
|
|
@ -278,30 +281,33 @@ public class WxAppletController {
|
|||
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
|
||||
@RequestParam(value = "stationCode",required = false)String stationCode,
|
||||
@RequestParam(value = "deployId",required = false)String deployId,
|
||||
@RequestParam(value = "yearStr",required = false)String yearStr){
|
||||
@RequestParam(value = "yearStr",required = false)String yearStr,
|
||||
@RequestParam(value = "authId",required = false)String authId
|
||||
){
|
||||
String tenantId = TenantUtil.getCurTenant(authId);
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
//效果评价
|
||||
Page<SurvAlertRecord> page = new Page<SurvAlertRecord>(pageNo, pageSize);
|
||||
//查询站点里的所有设备
|
||||
List<String> allList =new ArrayList<>();
|
||||
if(StringUtils.isNotBlank(stationCode)){
|
||||
List<SurvDeviceDeploy> dList = deviceDeployService.getDeviceByStation(stationCode,"");
|
||||
List<SurvDeviceDeploy> dList = deviceDeployService.getDeviceByStation(stationCode,"",tenantId);
|
||||
dList.forEach(item->allList.add(item.getId()));
|
||||
} else if (StringUtils.isNotBlank(deployId)) {
|
||||
allList.add(deployId);
|
||||
}
|
||||
|
||||
|
||||
IPage<SurvAlertRecord> pageList = alertRecordService.pages(page, allList,yearStr);
|
||||
IPage<SurvAlertRecord> pageList = alertRecordService.pages(page, allList,yearStr,tenantId);
|
||||
return R.ok(pageList);
|
||||
}
|
||||
|
||||
|
||||
@PostMapping("/getPplutionSummry")
|
||||
@ApiOperation("污染物月统计")
|
||||
public R getPplutionSummry (@RequestParam(value = "stationCode",required = false)String stationCode){
|
||||
|
||||
List<SurvStationInfo> stationList = stationInfoService.getAllStationAndDevice(stationCode,"","token");
|
||||
public R getPplutionSummry (@RequestParam(value = "stationCode",required = false)String stationCode,@RequestParam(value = "authId",required = false)String authId){
|
||||
String tenantId = TenantUtil.getCurTenant(authId);
|
||||
List<SurvStationInfo> stationList = stationInfoService.getAllStationAndDevice(stationCode,"","token",tenantId);
|
||||
//补充最新数据进入
|
||||
JSONArray returnArrs= new JSONArray();
|
||||
String curYear = String.valueOf(LocalDateTime.now().getYear());
|
||||
|
|
@ -421,12 +427,13 @@ public class WxAppletController {
|
|||
|
||||
@ApiOperation("按设备查询监测数据")
|
||||
@GetMapping("/getSurvDataByDevice")
|
||||
public R getSurvDataByDevice(@RequestParam("deployCode") String deployCode,@RequestParam("deployId") String deployId){
|
||||
public R getSurvDataByDevice(@RequestParam(value = "deployCode",required = false) String deployCode,@RequestParam(value = "deployId",required = false) String deployId,@RequestParam(value = "authId",required = false) String authId){
|
||||
String tenantId = TenantUtil.getCurTenant(authId);
|
||||
SurvDeviceDeploy survDeviceDeploy = null;
|
||||
if(StringUtils.isNotBlank(deployId)){
|
||||
survDeviceDeploy = deviceDeployService.getById(deployId);
|
||||
survDeviceDeploy = deviceDeployService.getDeviceById(deployId,tenantId);
|
||||
}else if(StringUtils.isNotBlank(deployCode)){
|
||||
survDeviceDeploy = deviceDeployService.getDeviceByCode(deployCode);
|
||||
survDeviceDeploy = deviceDeployService.getDeviceByCode(deployCode,tenantId);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -473,16 +480,16 @@ public class WxAppletController {
|
|||
|
||||
}else if(PollutionConstants.AIR_SURV.equals(survDeviceDeploy.getDeployType())){
|
||||
// SurvTransdataAirVo airVo=transdataAirService.getNewestData(deployCode);
|
||||
VOTransData voTransData = zhAdminFeignClient.deviceNewestData(survDeviceDeploy.getId());
|
||||
VOTransData voTransData = zhAdminFeignClient.deviceNewestData(survDeviceDeploy.getId(),tenantId);
|
||||
job.put("dataList",voTransData.getTransData());
|
||||
|
||||
}else if(PollutionConstants.SOIL_SURV.equals(survDeviceDeploy.getDeployType())){
|
||||
// SurvTransdataSoilVo soilVo = transdataSoilService.getNewestData(deployCode);
|
||||
VOTransData voTransData = zhAdminFeignClient.deviceNewestData(survDeviceDeploy.getId());
|
||||
VOTransData voTransData = zhAdminFeignClient.deviceNewestData(survDeviceDeploy.getId(),tenantId);
|
||||
job.put("dataList",voTransData.getTransData());
|
||||
|
||||
}else if(PollutionConstants.WATER_QULITY.equals(survDeviceDeploy.getDeployType())){
|
||||
VOTransData voTransData = zhAdminFeignClient.deviceNewestData(survDeviceDeploy.getId());
|
||||
VOTransData voTransData = zhAdminFeignClient.deviceNewestData(survDeviceDeploy.getId(),tenantId);
|
||||
if(voTransData!=null){
|
||||
job.put("dataList",voTransData.getTransData());
|
||||
}else{
|
||||
|
|
@ -499,9 +506,9 @@ public class WxAppletController {
|
|||
|
||||
@PostMapping("/getSinglePollutionSummry")
|
||||
@ApiOperation("站点单项污染物数据统计")
|
||||
public R getSinglePollutionSummry (@RequestParam(value = "stationCode",required = true)String stationCode,@RequestParam(value = "pollutionCode",required = true)String pollutionCode){
|
||||
|
||||
List<SurvStationInfo> stationList = stationInfoService.getAllStationAndDevice(stationCode,"","token");
|
||||
public R getSinglePollutionSummry (@RequestParam(value = "stationCode",required = true)String stationCode,@RequestParam(value = "pollutionCode",required = true)String pollutionCode,@RequestParam(value = "authId",required = false)String authId){
|
||||
String tenantId = TenantUtil.getCurTenant(authId);
|
||||
List<SurvStationInfo> stationList = stationInfoService.getAllStationAndDevice(stationCode,"","token",tenantId);
|
||||
//补充最新数据进入
|
||||
String curYear = String.valueOf(LocalDateTime.now().getYear());
|
||||
JSONArray returnArrs = new JSONArray();
|
||||
|
|
@ -533,80 +540,127 @@ public class WxAppletController {
|
|||
// remainList.add(survDeviceDeploy);
|
||||
}
|
||||
}
|
||||
PollutionEnum pollutionEnum = null;
|
||||
try {
|
||||
pollutionEnum = PollutionEnum.catchPollution(pollutionCode);
|
||||
} catch (Exception e) {
|
||||
return R.ok(returnArrs);
|
||||
}
|
||||
if (pollutionEnum == null) {
|
||||
return R.ok(returnArrs);
|
||||
}
|
||||
|
||||
if(!soilList.isEmpty()){
|
||||
if(PollutionConstants.SOIL_SURV.equals(pollutionEnum.getType())) {
|
||||
if (!soilList.isEmpty()) {
|
||||
VOBigScreenSurvQ voBigScreenSurvQ = new VOBigScreenSurvQ();
|
||||
voBigScreenSurvQ.setSummrayMode(IotConstants.year_months);
|
||||
voBigScreenSurvQ.setDeployId(soilList.get(0));
|
||||
voBigScreenSurvQ.setSurvItem(pollutionCode);
|
||||
VOHisResult voHisResult = zhAdminFeignClient.singleItemSummary(voBigScreenSurvQ);
|
||||
JSONArray temps = JSONArray.parseArray(JSONObject.toJSONString(voHisResult.getDataList()));
|
||||
if (temps != null) {
|
||||
returnArrs.addAll(temps);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
if(PollutionConstants.AIR_SURV.equals(pollutionEnum.getType())) {
|
||||
if (!airList.isEmpty()) {
|
||||
VOBigScreenSurvQ voBigScreenSurvQ = new VOBigScreenSurvQ();
|
||||
voBigScreenSurvQ.setSummrayMode(IotConstants.year_months);
|
||||
voBigScreenSurvQ.setDeployId(soilList.get(0));
|
||||
voBigScreenSurvQ.setDeployId(airList.get(0));
|
||||
voBigScreenSurvQ.setSurvItem(pollutionCode);
|
||||
VOHisResult voHisResult = zhAdminFeignClient.singleItemSummary(voBigScreenSurvQ);
|
||||
returnArrs = JSONArray.parseArray(JSONObject.toJSONString(voHisResult.getDataList()));
|
||||
JSONArray temps = JSONArray.parseArray(JSONObject.toJSONString(voHisResult.getDataList()));
|
||||
if (temps != null) {
|
||||
returnArrs.addAll(temps);
|
||||
}
|
||||
}
|
||||
if(!airList.isEmpty()){
|
||||
VOBigScreenSurvQ voBigScreenSurvQ = new VOBigScreenSurvQ();
|
||||
voBigScreenSurvQ.setSummrayMode(IotConstants.year_months);
|
||||
voBigScreenSurvQ.setDeployId(airList.get(0));
|
||||
voBigScreenSurvQ.setSurvItem(pollutionCode);
|
||||
VOHisResult voHisResult = zhAdminFeignClient.singleItemSummary(voBigScreenSurvQ);
|
||||
returnArrs = JSONArray.parseArray(JSONObject.toJSONString(voHisResult.getDataList()));
|
||||
}
|
||||
|
||||
if(!waterList.isEmpty()){
|
||||
VOSurvIntegrateParam voSurvIntegrateParam = new VOSurvIntegrateParam();
|
||||
voSurvIntegrateParam.setDeployIds(waterList);
|
||||
voSurvIntegrateParam.setStartTime(curYear);
|
||||
voSurvIntegrateParam.setEndTime(curYear);
|
||||
voSurvIntegrateParam.setSummrayMode(IotConstants.year_months);
|
||||
Result<VOIntegrateStatistic> result = zhAdminFeignClient.survIntegrateStatistic(voSurvIntegrateParam);
|
||||
if(result!=null){
|
||||
if(result.getResult()!=null){
|
||||
if(result.getResult().getObjResults()!=null){
|
||||
List<String> datas = result.getResult().getObjResults().get(pollutionCode);
|
||||
returnArrs = JSONArray.parseArray(JSONObject.toJSONString(datas));
|
||||
}
|
||||
if(PollutionConstants.WATER_QULITY.equals(pollutionEnum.getType())) {
|
||||
if (!waterList.isEmpty()) {
|
||||
VOSurvIntegrateParam voSurvIntegrateParam = new VOSurvIntegrateParam();
|
||||
voSurvIntegrateParam.setDeployIds(waterList);
|
||||
voSurvIntegrateParam.setStartTime(curYear);
|
||||
voSurvIntegrateParam.setEndTime(curYear);
|
||||
voSurvIntegrateParam.setSummrayMode(IotConstants.year_months);
|
||||
Result<VOIntegrateStatistic> result = zhAdminFeignClient.survIntegrateStatistic(voSurvIntegrateParam);
|
||||
if (result != null) {
|
||||
if (result.getResult() != null) {
|
||||
if (result.getResult().getObjResults() != null) {
|
||||
List<String> datas = result.getResult().getObjResults().get(pollutionCode);
|
||||
if (datas != null) {
|
||||
returnArrs.addAll(JSONArray.parseArray(JSONObject.toJSONString(datas)));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if(!orientList.isEmpty()){
|
||||
VOBigScreenSurvQ voBigScreenSurvQ = new VOBigScreenSurvQ();
|
||||
voBigScreenSurvQ.setSummrayMode(IotConstants.year_months);
|
||||
voBigScreenSurvQ.setDeployId(orientList.get(0));
|
||||
voBigScreenSurvQ.setSurvItem(pollutionCode);
|
||||
VOHisResult voHisResult = zhAdminFeignClient.singleItemSummary(voBigScreenSurvQ);
|
||||
returnArrs = JSONArray.parseArray(JSONObject.toJSONString(voHisResult.getDataList()));
|
||||
}
|
||||
if(!liveList.isEmpty()){
|
||||
VOBigScreenSurvQ voBigScreenSurvQ = new VOBigScreenSurvQ();
|
||||
voBigScreenSurvQ.setSummrayMode(IotConstants.year_months);
|
||||
voBigScreenSurvQ.setDeployId(liveList.get(0));
|
||||
voBigScreenSurvQ.setSurvItem(pollutionCode);
|
||||
VOHisResult voHisResult = zhAdminFeignClient.singleItemSummary(voBigScreenSurvQ);
|
||||
returnArrs = JSONArray.parseArray(JSONObject.toJSONString(voHisResult.getDataList()));
|
||||
}
|
||||
if(!stinkList.isEmpty()){
|
||||
List<StinkDataTrans> stinkSummry = vocsService.getMonthSummry(stinkList,curYear);
|
||||
List<Double> dataOu = new ArrayList<>();
|
||||
List<Double> dataNh3 = new ArrayList<>();
|
||||
List<Double> dataH2s = new ArrayList<>();
|
||||
List<Double> dataTvoc = new ArrayList<>();
|
||||
if(!stinkSummry.isEmpty()){
|
||||
for (StinkDataTrans stinkDataTrans : stinkSummry) {
|
||||
dataOu.add(stinkDataTrans.getAvgDataOu());
|
||||
dataNh3.add(stinkDataTrans.getAvgDataNh3());
|
||||
dataH2s.add(stinkDataTrans.getAvgDataH2s());
|
||||
dataTvoc.add(stinkDataTrans.getAvgDataTvoc());
|
||||
if(pollutionEnum.getType().startsWith("water") || pollutionEnum.getType().contains("orient")) {
|
||||
if (!orientList.isEmpty()) {
|
||||
VOBigScreenSurvQ voBigScreenSurvQ = new VOBigScreenSurvQ();
|
||||
voBigScreenSurvQ.setSummrayMode(IotConstants.year_months);
|
||||
voBigScreenSurvQ.setDeployId(orientList.get(0));
|
||||
voBigScreenSurvQ.setSurvItem(pollutionCode);
|
||||
VOHisResult voHisResult = zhAdminFeignClient.singleItemSummary(voBigScreenSurvQ);
|
||||
JSONArray temps = JSONArray.parseArray(JSONObject.toJSONString(voHisResult.getDataList()));
|
||||
if (temps != null) {
|
||||
returnArrs.addAll(temps);
|
||||
}
|
||||
}
|
||||
if(PollutionEnum.dataStinkOu.getCode().equals(pollutionCode)){
|
||||
returnArrs = JSONArray.parseArray(JSONObject.toJSONString(dataOu));
|
||||
}else if(PollutionEnum.dataStinkNh3.getCode().equals(pollutionCode)){
|
||||
returnArrs = JSONArray.parseArray(JSONObject.toJSONString(dataNh3));
|
||||
}else if(PollutionEnum.dataStinkH2s.getCode().equals(pollutionCode)){
|
||||
returnArrs = JSONArray.parseArray(JSONObject.toJSONString(dataH2s));
|
||||
}else if(PollutionEnum.dataStinkTvoc.getCode().equals(pollutionCode)){
|
||||
returnArrs = JSONArray.parseArray(JSONObject.toJSONString(dataTvoc));
|
||||
}
|
||||
|
||||
if(pollutionEnum.getType().startsWith("water") || pollutionEnum.getType().contains("live")) {
|
||||
if (!liveList.isEmpty()) {
|
||||
VOBigScreenSurvQ voBigScreenSurvQ = new VOBigScreenSurvQ();
|
||||
voBigScreenSurvQ.setSummrayMode(IotConstants.year_months);
|
||||
voBigScreenSurvQ.setDeployId(liveList.get(0));
|
||||
voBigScreenSurvQ.setSurvItem(pollutionCode);
|
||||
VOHisResult voHisResult = zhAdminFeignClient.singleItemSummary(voBigScreenSurvQ);
|
||||
JSONArray temps = JSONArray.parseArray(JSONObject.toJSONString(voHisResult.getDataList()));
|
||||
if (temps != null) {
|
||||
returnArrs.addAll(temps);
|
||||
}
|
||||
}
|
||||
}
|
||||
if(PollutionConstants.STINK.equals(pollutionEnum.getType())) {
|
||||
if (!stinkList.isEmpty()) {
|
||||
List<StinkDataTrans> stinkSummry = vocsService.getMonthSummry(stinkList, curYear);
|
||||
List<Double> dataOu = new ArrayList<>();
|
||||
List<Double> dataNh3 = new ArrayList<>();
|
||||
List<Double> dataH2s = new ArrayList<>();
|
||||
List<Double> dataTvoc = new ArrayList<>();
|
||||
if (!stinkSummry.isEmpty()) {
|
||||
for (StinkDataTrans stinkDataTrans : stinkSummry) {
|
||||
dataOu.add(stinkDataTrans.getAvgDataOu());
|
||||
dataNh3.add(stinkDataTrans.getAvgDataNh3());
|
||||
dataH2s.add(stinkDataTrans.getAvgDataH2s());
|
||||
dataTvoc.add(stinkDataTrans.getAvgDataTvoc());
|
||||
}
|
||||
}
|
||||
if (PollutionEnum.dataStinkOu.getCode().equals(pollutionCode)) {
|
||||
JSONArray tempQu = JSONArray.parseArray(JSONObject.toJSONString(dataOu));
|
||||
if (tempQu != null) {
|
||||
returnArrs.addAll(tempQu);
|
||||
}
|
||||
} else if (PollutionEnum.dataStinkNh3.getCode().equals(pollutionCode)) {
|
||||
JSONArray tempNh3 = JSONArray.parseArray(JSONObject.toJSONString(dataNh3));
|
||||
if (tempNh3 != null) {
|
||||
returnArrs.addAll(tempNh3);
|
||||
}
|
||||
} else if (PollutionEnum.dataStinkH2s.getCode().equals(pollutionCode)) {
|
||||
JSONArray tempH2s = JSONArray.parseArray(JSONObject.toJSONString(dataH2s));
|
||||
if (tempH2s != null) {
|
||||
returnArrs.addAll(tempH2s);
|
||||
}
|
||||
} else if (PollutionEnum.dataStinkTvoc.getCode().equals(pollutionCode)) {
|
||||
JSONArray tempTvoc = JSONArray.parseArray(JSONObject.toJSONString(dataTvoc));
|
||||
if (tempTvoc != null) {
|
||||
returnArrs.addAll(tempTvoc);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -623,9 +677,11 @@ public class WxAppletController {
|
|||
@GetMapping("/getRealTimeSignle")
|
||||
public R getRealTimeSignle(@RequestParam("stationCode") String stationCode,@RequestParam(value = "pollutionCode",required = true)String pollutionCode,@RequestParam(value = "dataCounts",required = false)Integer dataCounts,
|
||||
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
|
||||
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize){
|
||||
|
||||
List<SurvStationInfo> stationList = stationInfoService.getAllStationAndDevice(stationCode,"","token");
|
||||
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
|
||||
@RequestParam(value = "authId",required = false)String authId
|
||||
){
|
||||
String tenantId = TenantUtil.getCurTenant(authId);
|
||||
List<SurvStationInfo> stationList = stationInfoService.getAllStationAndDevice(stationCode,"","token",tenantId);
|
||||
JSONArray jsonArray = new JSONArray();
|
||||
if(dataCounts==null){
|
||||
dataCounts=5;
|
||||
|
|
|
|||
|
|
@ -13,4 +13,8 @@ public class AlertSummaryDTO {
|
|||
|
||||
@ApiModelProperty("结束时间")
|
||||
private String endTime;
|
||||
|
||||
|
||||
@ApiModelProperty("租户ID")
|
||||
private String authId;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ import java.util.List;
|
|||
*/
|
||||
public interface SurvAlertRecordMapper extends BaseMapper<SurvAlertRecord> {
|
||||
|
||||
IPage<SurvAlertRecord> pages(IPage<SurvAlertRecord> page, @Param("deviceList") List<String> deviceList, @Param("yearStr") String yearStr);
|
||||
IPage<SurvAlertRecord> pages(IPage<SurvAlertRecord> page, @Param("deviceList") List<String> deviceList, @Param("yearStr") String yearStr,@Param("tenantId") String tenantId);
|
||||
|
||||
List<AlertSummayDetail> getSpotCheckData(@Param("deployId")String deployId,@Param("itemCode")String itemCode, @Param("dateList") List<String> dateList,@Param("startDateTime")LocalDateTime startDateTime,@Param("endDateTime")LocalDateTime endDateTime);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,17 +15,19 @@ import java.util.List;
|
|||
*/
|
||||
public interface SurvDeviceDeployMapper extends BaseMapper<SurvDeviceDeploy> {
|
||||
|
||||
List<SurvDeviceDeploy> getCameraGroupByStation(String camera);
|
||||
List<SurvDeviceDeploy> getCameraGroupByStation(@Param("camera") String camera,@Param("tenantId") String tenantId);
|
||||
|
||||
List<SurvDeviceDeploy> getDeviceByStation(String stationCode,String deployType);
|
||||
List<SurvDeviceDeploy> getDeviceByStation(@Param("stationCode")String stationCode,@Param("deployType")String deployType,@Param("tenantId") String tenantId);
|
||||
|
||||
SurvDeviceDeploy getDeviceByCode(String deployCode);
|
||||
SurvDeviceDeploy getDeviceByCode(@Param("deployCode")String deployCode,@Param("tenantId")String tenantId);
|
||||
|
||||
List<SurvDeviceDeploy> getDeviceByStationNoCam(String stationCode, String deployType);
|
||||
List<SurvDeviceDeploy> getDeviceByStationNoCam(@Param("stationCode")String stationCode, @Param("deployType")String deployType,@Param("tenantId")String tenantId);
|
||||
|
||||
List<SurvDeviceDeploy> getDeviceListByStations(@Param("stationCode")String stationCode,@Param("deployTypeList") List<String> deployTypeList,@Param("stationFilter")String stationFilter);
|
||||
List<SurvDeviceDeploy> getDeviceListByStations(@Param("stationCode")String stationCode,@Param("deployTypeList") List<String> deployTypeList,@Param("stationFilter")String stationFilter,@Param("tenantId")String tenantId);
|
||||
|
||||
SurvDeviceDeploy getDeployZhibiao(@Param("deployId") String deployId);
|
||||
SurvDeviceDeploy getDeployZhibiao(@Param("deployId") String deployId,@Param("tenantId") String tenantId);
|
||||
|
||||
List<SurvDictDeviceDetail> getDeviceInfoList(@Param("codeList") List<String> codeList);
|
||||
|
||||
SurvDeviceDeploy getDeviceById(@Param("deployId")String deployId, @Param("tenantId")String tenantId);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
package org.jeecg.system.applet.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.jeecg.common.entity.SurvDisplayInfo;
|
||||
|
||||
import java.util.List;
|
||||
|
|
@ -13,5 +14,5 @@ import java.util.List;
|
|||
*/
|
||||
public interface SurvDisplayInfoMapper extends BaseMapper<SurvDisplayInfo> {
|
||||
|
||||
List<SurvDisplayInfo> getInfoByType(String projectBrief);
|
||||
List<SurvDisplayInfo> getInfoByType(@Param("projectBrief")String projectBrief, @Param("tenantId")String tenantId);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
package org.jeecg.system.applet.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.jeecg.common.entity.SurvPestlightAlert;
|
||||
|
||||
/**
|
||||
|
|
@ -11,5 +12,5 @@ import org.jeecg.common.entity.SurvPestlightAlert;
|
|||
*/
|
||||
public interface SurvPestlightAlertMapper extends BaseMapper<SurvPestlightAlert> {
|
||||
|
||||
Integer countAlert(String status);
|
||||
Integer countAlert(@Param("status")String status, @Param("tenantId")String tenantId);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,9 +20,9 @@ public interface SurvStationInfoMapper extends BaseMapper<SurvStationInfo> {
|
|||
List<SurvStationInfo> getStationInfo(String stationCode);
|
||||
|
||||
|
||||
List<SurvStationInfo> listALlStation();
|
||||
List<SurvStationInfo> listALlStation(@Param("tenantId") String tenantId);
|
||||
|
||||
List<SurvStationInfo> getAllStationAndDevice(@Param("stationCode") String stationCode,@Param("camera") String camera, @Param("token")String token);
|
||||
List<SurvStationInfo> getAllStationAndDevice(@Param("stationCode") String stationCode,@Param("camera") String camera, @Param("token")String token,@Param("tenantId")String tenantId);
|
||||
|
||||
Integer getCountOfAllData();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -45,16 +45,21 @@
|
|||
</select>
|
||||
<select id="pages" resultMap="baseResultMap">
|
||||
select <include refid="baseSql"/>
|
||||
from surv_alert_record where 1=1
|
||||
<if test="deviceList!=null and deviceList.size()>0">
|
||||
and DEPLOY_ID IN
|
||||
<foreach collection="deviceList" index="index" item="id" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="yearStr!=null">
|
||||
and DATE_FORMAT(ALERT_TIME,'%Y') = #{yearStr}
|
||||
</if>
|
||||
from surv_alert_record
|
||||
<where>
|
||||
<if test="deviceList!=null and deviceList.size()>0">
|
||||
and DEPLOY_ID IN
|
||||
<foreach collection="deviceList" index="index" item="id" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="yearStr!=null">
|
||||
and DATE_FORMAT(ALERT_TIME,'%Y') = #{yearStr}
|
||||
</if>
|
||||
<if test="tenantId!=null and tenantId!=''">
|
||||
and TENANT_ID = #{tenantId}
|
||||
</if>
|
||||
</where>
|
||||
order by ALERT_TIME desc
|
||||
</select>
|
||||
|
||||
|
|
|
|||
|
|
@ -72,7 +72,7 @@
|
|||
|
||||
<select id="getCameraGroupByStation" resultType="org.jeecg.common.entity.SurvDeviceDeploy">
|
||||
select s.STATION_CODE,group_concat(s.DEPLOY_CODE) as depCodes,group_concat(s.DEPLOY_DES) as depDess,group_concat(s.DEPLOY_PIC) as depPics,group_concat(s.DEVICE_URL) as depUrls
|
||||
from surv_device_deploy s where s.IS_DEL = 0 AND s.DEPLOY_TYPE='camera' group by s.STATION_CODE
|
||||
from surv_device_deploy s where s.IS_DEL = 0 AND s.DEPLOY_TYPE=#{camera} AND s.TENANT_ID = #{tenantId} group by s.STATION_CODE
|
||||
</select>
|
||||
|
||||
<select id="getDeviceByStation" resultMap="adResultMap">
|
||||
|
|
@ -83,10 +83,13 @@
|
|||
<if test="param2 != null and param2 != ''">
|
||||
AND DEPLOY_TYPE = #{param2}
|
||||
</if>
|
||||
<if test="tenantId != null and tenantId != ''">
|
||||
AND TENANT_ID = #{tenantId}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="getDeviceByCode" resultMap="baseResultMap">
|
||||
select <include refid="baseSql"/> from surv_device_deploy where IS_DEL = 0 AND DEPLOY_CODE = #{deployCode}
|
||||
select <include refid="baseSql"/> from surv_device_deploy where IS_DEL = 0 AND DEPLOY_CODE = #{deployCode} AND TENANT_ID = #{tenantId}
|
||||
</select>
|
||||
|
||||
<select id="getDeviceByStationNoCam" resultMap="adResultMap">
|
||||
|
|
@ -97,6 +100,9 @@
|
|||
<if test="param2 != null and param2 != ''">
|
||||
AND DEPLOY_TYPE = #{param2}
|
||||
</if>
|
||||
<if test="tenantId != null and tenantId != ''">
|
||||
AND TENANT_ID = #{tenantId}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="getDeviceListByStations" resultMap="baseResultMap">
|
||||
|
|
@ -118,12 +124,15 @@
|
|||
<if test="stationFilter != null and stationFilter == '0'">
|
||||
and (STATION_CODE is null or STATION_CODE = '')
|
||||
</if>
|
||||
<if test="tenantId != null and tenantId != ''">
|
||||
and TENANT_ID = #{tenantId}
|
||||
</if>
|
||||
</where>
|
||||
order by SORT_NO,CREATE_TIME desc
|
||||
</select>
|
||||
|
||||
<select id="getDeployZhibiao" resultMap="zhibiaoMap">
|
||||
select <include refid="baseSql"/> from surv_device_deploy where ID = #{deployId}
|
||||
select <include refid="baseSql"/> from surv_device_deploy where ID = #{deployId} AND TENANT_ID = #{tenantId}
|
||||
</select>
|
||||
|
||||
<select id="getDeviceInfoList" resultType="org.jeecg.common.entity.SurvDictDeviceDetail">
|
||||
|
|
@ -132,4 +141,7 @@
|
|||
#{id}
|
||||
</foreach>
|
||||
</select>
|
||||
<select id="getDeviceById" resultMap="baseResultMap">
|
||||
select <include refid="baseSql"/> from surv_device_deploy where IS_DEL = 0 AND ID = #{deployId} AND TENANT_ID = #{tenantId}
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
@ -32,9 +32,14 @@
|
|||
|
||||
<select id="getInfoByType" resultMap="baseResultMap">
|
||||
select
|
||||
<include refid="baseSql" /> from surv_display_info where 1=1
|
||||
<if test="projectBrief != null and projectBrief != ''">
|
||||
and INFO_TYPE = #{projectBrief}
|
||||
</if>
|
||||
<include refid="baseSql" /> from surv_display_info
|
||||
<where>
|
||||
<if test="projectBrief != null and projectBrief != ''">
|
||||
and INFO_TYPE = #{projectBrief}
|
||||
</if>
|
||||
<if test="tenantId != null and tenantId != ''">
|
||||
and TENANT_ID = #{tenantId}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
@ -3,6 +3,6 @@
|
|||
<mapper namespace="org.jeecg.system.applet.mapper.SurvPestlightAlertMapper">
|
||||
|
||||
<select id="countAlert" resultType="java.lang.Integer">
|
||||
select count(1) from surv_pestlight_alert where DEVICE_STATUS = #{status}
|
||||
select count(1) from surv_pestlight_alert where DEVICE_STATUS = #{status} AND TENANT_ID = #{tenantId}
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
@ -39,12 +39,12 @@
|
|||
</sql>
|
||||
|
||||
<resultMap id="deviceResultMap" type="org.jeecg.common.entity.SurvStationInfo" extends="baseResultMap">
|
||||
<collection property="deviceList" select="getDeviceList" column="{STATION_CODE = STATION_CODE,deviceType = deviceType,ysToken = ysToken}" />
|
||||
<collection property="deviceList" select="getDeviceList" column="{STATION_CODE = STATION_CODE,TENANT_ID = TENANT_ID,deviceType = deviceType,ysToken = ysToken}" />
|
||||
</resultMap>
|
||||
|
||||
<resultMap id="countMap" type="org.jeecg.common.entity.SurvStationInfo" extends="baseResultMap">
|
||||
<association property="survItemCount" javaType="java.lang.Integer" select="getZhiBiaoCount" column="STATION_CODE" />
|
||||
<collection property="deviceList" select="getSimpleDeviceList" column="{STATION_CODE = STATION_CODE}" />
|
||||
<collection property="deviceList" select="getSimpleDeviceList" column="{STATION_CODE = STATION_CODE,TENANT_ID = TENANT_ID}" />
|
||||
</resultMap>
|
||||
|
||||
<select id="getDeviceCount" resultType="Integer">
|
||||
|
|
@ -60,14 +60,14 @@
|
|||
</select>
|
||||
|
||||
<select id="getDeviceList" resultType="org.jeecg.common.entity.SurvDeviceDeploy">
|
||||
select ID,DEPLOY_TYPE,DEVICE_URL,DEPLOY_CODE,DEVICE_CODE,DEPLOY_DES,#{ysToken} as ysToken from surv_device_deploy where IS_DEL = 0 AND STATION_CODE = #{STATION_CODE}
|
||||
select ID,DEPLOY_TYPE,DEVICE_URL,DEPLOY_CODE,DEVICE_CODE,DEPLOY_DES,#{ysToken} as ysToken from surv_device_deploy where IS_DEL = 0 AND STATION_CODE = #{STATION_CODE} AND TENANT_ID = #{TENANT_ID}
|
||||
<if test="deviceType != null and deviceType != ''">
|
||||
AND DEPLOY_TYPE = #{deviceType}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="getSimpleDeviceList" resultType="org.jeecg.common.entity.SurvDeviceDeploy">
|
||||
select ID,DEPLOY_TYPE,DEVICE_URL,DEPLOY_CODE,DEVICE_CODE,DEPLOY_DES,DEPLOY_PIC from surv_device_deploy where IS_DEL = 0 AND STATION_CODE = #{STATION_CODE}
|
||||
select ID,DEPLOY_TYPE,DEVICE_URL,DEPLOY_CODE,DEVICE_CODE,DEPLOY_DES,DEPLOY_PIC from surv_device_deploy where IS_DEL = 0 AND STATION_CODE = #{STATION_CODE} AND TENANT_ID = #{TENANT_ID}
|
||||
</select>
|
||||
|
||||
<select id="pages" resultMap="countMap">
|
||||
|
|
@ -76,6 +76,9 @@
|
|||
<if test="param2.stationCode != null and param2.stationCode != ''">
|
||||
AND STATION_CODE = #{param2.stationCode}
|
||||
</if>
|
||||
<if test="param2.tenantId != null and param2.tenantId != ''">
|
||||
AND TENANT_ID = #{param2.tenantId}
|
||||
</if>
|
||||
order by SORT_NO,CREATE_TIME desc
|
||||
</select>
|
||||
|
||||
|
|
@ -90,15 +93,25 @@
|
|||
|
||||
<select id="listALlStation" resultMap="countMap">
|
||||
select <include refid="baseSql"/>
|
||||
from surv_station_info where 1=1
|
||||
from surv_station_info
|
||||
<where>
|
||||
<if test="tenantId != null and tenantId != ''">
|
||||
AND TENANT_ID = #{tenantId}
|
||||
</if>
|
||||
</where>
|
||||
order by SORT_NO,CREATE_TIME desc
|
||||
</select>
|
||||
|
||||
<select id="getAllStationAndDevice" resultMap="deviceResultMap">
|
||||
select <include refid="baseSql" />,#{camera} as deviceType,#{token} as ysToken from surv_station_info where 1=1
|
||||
<if test="stationCode != null and stationCode != ''">
|
||||
AND STATION_CODE = #{stationCode}
|
||||
</if>
|
||||
select <include refid="baseSql" />,#{camera} as deviceType,#{token} as ysToken from surv_station_info
|
||||
<where>
|
||||
<if test="stationCode != null and stationCode != ''">
|
||||
AND STATION_CODE = #{stationCode}
|
||||
</if>
|
||||
<if test="tenantId != null and tenantId != ''">
|
||||
AND TENANT_ID = #{tenantId}
|
||||
</if>
|
||||
</where>
|
||||
order by SORT_NO
|
||||
</select>
|
||||
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ import java.util.List;
|
|||
*/
|
||||
public interface ISurvAlertRecordService extends IService<SurvAlertRecord> {
|
||||
|
||||
IPage<SurvAlertRecord> pages(IPage<SurvAlertRecord> page, List<String> deviceList, String yearStr);
|
||||
IPage<SurvAlertRecord> pages(IPage<SurvAlertRecord> page, List<String> deviceList, String yearStr,String tenantId);
|
||||
|
||||
AlertSummaryVo getSummary(AlertSummaryDTO alertSummaryDTO);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,18 +13,20 @@ import java.util.List;
|
|||
* @Version: V1.0
|
||||
*/
|
||||
public interface ISurvDeviceDeployService extends IService<SurvDeviceDeploy> {
|
||||
List<SurvDeviceDeploy> getCameraGroupByStation(String camera);
|
||||
List<SurvDeviceDeploy> getCameraGroupByStation(String camera,String tenantId);
|
||||
|
||||
|
||||
List<SurvDeviceDeploy> getDeviceByStation(String stationCode,String deployType);
|
||||
List<SurvDeviceDeploy> getDeviceByStation(String stationCode,String deployType,String tenantId);
|
||||
|
||||
SurvDeviceDeploy getDeviceByCode(String deployCode);
|
||||
SurvDeviceDeploy getDeviceByCode(String deployCode,String tenantId);
|
||||
|
||||
List<SurvDeviceDeploy> getDeviceByStationNoCam(String stationCode, String deployType);
|
||||
List<SurvDeviceDeploy> getDeviceByStationNoCam(String stationCode, String deployType,String tenantId);
|
||||
|
||||
List<SurvDeviceDeploy> getDeviceListByStation(String stationCode, List<String> deployTypes,String stationFilter);
|
||||
List<SurvDeviceDeploy> getDeviceListByStation(String stationCode, List<String> deployTypes,String stationFilter,String tenantId);
|
||||
|
||||
SurvDeviceDeploy getDeployZhibiao(String deployId);
|
||||
SurvDeviceDeploy getDeployZhibiao(String deployId,String tenantId);
|
||||
|
||||
List<SurvDictDeviceDetail> getDeviceInfo(List<String> codeList);
|
||||
|
||||
SurvDeviceDeploy getDeviceById(String deployId, String tenantId);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ import java.util.List;
|
|||
*/
|
||||
public interface ISurvDisplayInfoService extends IService<SurvDisplayInfo> {
|
||||
|
||||
List<SurvDisplayInfo> getInfoByType(@Param("projectBrief") String projectBrief);
|
||||
List<SurvDisplayInfo> getInfoByType(@Param("projectBrief") String projectBrief,String tenantId);
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,5 +11,5 @@ import org.jeecg.common.entity.SurvPestlightAlert;
|
|||
*/
|
||||
public interface ISurvPestlightAlertService extends IService<SurvPestlightAlert> {
|
||||
|
||||
Integer countAlert(String status);
|
||||
Integer countAlert(String status,String tenantId);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,11 +18,11 @@ public interface ISurvStationInfoService extends IService<SurvStationInfo> {
|
|||
|
||||
List<SurvStationInfo> getStationInfo(String stationCode);
|
||||
|
||||
List<SurvStationInfo> listALlStation();
|
||||
List<SurvStationInfo> listALlStation(String tenantId);
|
||||
|
||||
List<SurvStationInfo> getAllStationAndDevice(String stationCode,String deployType, String token);
|
||||
List<SurvStationInfo> getAllStationAndDevice(String stationCode,String deployType, String token,String tenantId);
|
||||
|
||||
Integer getCountOfAllData();
|
||||
|
||||
Integer getStationDataCounts(SurvStationInfo survStationInfo);
|
||||
Integer getStationDataCounts(SurvStationInfo survStationInfo,String tenantId);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@ import org.jeecg.common.vo.statistic.CommonDateListResult;
|
|||
import org.jeecg.system.applet.dto.AlertSummaryDTO;
|
||||
import org.jeecg.system.applet.mapper.SurvAlertRecordMapper;
|
||||
import org.jeecg.system.applet.service.ISurvAlertRecordService;
|
||||
import org.jeecg.system.applet.util.TenantUtil;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
|
|
@ -44,14 +45,15 @@ public class SurvAlertRecordServiceImpl extends ServiceImpl<SurvAlertRecordMappe
|
|||
@Autowired
|
||||
private SurvDeviceDeployServiceImpl deployService;
|
||||
@Override
|
||||
public IPage<SurvAlertRecord> pages(IPage<SurvAlertRecord> page, List<String> deviceList, String yearStr) {
|
||||
return baseMapper.pages(page,deviceList,yearStr);
|
||||
public IPage<SurvAlertRecord> pages(IPage<SurvAlertRecord> page, List<String> deviceList, String yearStr,String tenantId) {
|
||||
return baseMapper.pages(page,deviceList,yearStr,tenantId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AlertSummaryVo getSummary(AlertSummaryDTO alertSummaryDTO) {
|
||||
Assert.notNull(alertSummaryDTO,"传入格式错误");
|
||||
SurvDeviceDeploy deploy = deployService.getDeployZhibiao(alertSummaryDTO.getDeployId());
|
||||
String tenantId = TenantUtil.getCurTenant(alertSummaryDTO.getAuthId());
|
||||
SurvDeviceDeploy deploy = deployService.getDeployZhibiao(alertSummaryDTO.getDeployId(),tenantId);
|
||||
Assert.notNull(deploy,"设备无效");
|
||||
AlertSummaryVo alertSummaryVo = new AlertSummaryVo();
|
||||
List<SurvItemInfo> survItemInfos = new ArrayList<>();
|
||||
|
|
|
|||
|
|
@ -19,33 +19,33 @@ import java.util.List;
|
|||
public class SurvDeviceDeployServiceImpl extends ServiceImpl<SurvDeviceDeployMapper, SurvDeviceDeploy> implements ISurvDeviceDeployService {
|
||||
|
||||
@Override
|
||||
public List<SurvDeviceDeploy> getCameraGroupByStation(String camera) {
|
||||
return baseMapper.getCameraGroupByStation(camera);
|
||||
public List<SurvDeviceDeploy> getCameraGroupByStation(String camera,String tenantId) {
|
||||
return baseMapper.getCameraGroupByStation(camera,tenantId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SurvDeviceDeploy> getDeviceByStation(String stationCode,String deployType) {
|
||||
return baseMapper.getDeviceByStation(stationCode, deployType);
|
||||
public List<SurvDeviceDeploy> getDeviceByStation(String stationCode,String deployType,String tenantId) {
|
||||
return baseMapper.getDeviceByStation(stationCode, deployType,tenantId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SurvDeviceDeploy getDeviceByCode(String deployCode) {
|
||||
return baseMapper.getDeviceByCode(deployCode);
|
||||
public SurvDeviceDeploy getDeviceByCode(String deployCode,String tenantId) {
|
||||
return baseMapper.getDeviceByCode(deployCode,tenantId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SurvDeviceDeploy> getDeviceByStationNoCam(String stationCode, String deployType) {
|
||||
return baseMapper.getDeviceByStationNoCam(stationCode,deployType);
|
||||
public List<SurvDeviceDeploy> getDeviceByStationNoCam(String stationCode, String deployType,String tenantId) {
|
||||
return baseMapper.getDeviceByStationNoCam(stationCode,deployType,tenantId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SurvDeviceDeploy> getDeviceListByStation(String stationCode, List<String> deployTypes,String stationFilter) {
|
||||
return baseMapper.getDeviceListByStations(stationCode,deployTypes,stationFilter);
|
||||
public List<SurvDeviceDeploy> getDeviceListByStation(String stationCode, List<String> deployTypes,String stationFilter,String tenantId) {
|
||||
return baseMapper.getDeviceListByStations(stationCode,deployTypes,stationFilter,tenantId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SurvDeviceDeploy getDeployZhibiao(String deployId) {
|
||||
return baseMapper.getDeployZhibiao(deployId);
|
||||
public SurvDeviceDeploy getDeployZhibiao(String deployId,String tenantId) {
|
||||
return baseMapper.getDeployZhibiao(deployId,tenantId);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -53,4 +53,9 @@ public class SurvDeviceDeployServiceImpl extends ServiceImpl<SurvDeviceDeployMap
|
|||
return baseMapper.getDeviceInfoList(codeList);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SurvDeviceDeploy getDeviceById(String deployId, String tenantId) {
|
||||
return baseMapper.getDeviceById(deployId,tenantId);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ import java.util.List;
|
|||
public class SurvDisplayInfoServiceImpl extends ServiceImpl<SurvDisplayInfoMapper, SurvDisplayInfo> implements ISurvDisplayInfoService {
|
||||
|
||||
@Override
|
||||
public List<SurvDisplayInfo> getInfoByType(String projectBrief) {
|
||||
return baseMapper.getInfoByType(projectBrief);
|
||||
public List<SurvDisplayInfo> getInfoByType(String projectBrief,String tenantId) {
|
||||
return baseMapper.getInfoByType(projectBrief,tenantId);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ import org.springframework.stereotype.Service;
|
|||
public class SurvPestlightAlertServiceImpl extends ServiceImpl<SurvPestlightAlertMapper, SurvPestlightAlert> implements ISurvPestlightAlertService {
|
||||
|
||||
@Override
|
||||
public Integer countAlert(String status) {
|
||||
return baseMapper.countAlert(status);
|
||||
public Integer countAlert(String status,String tenantId) {
|
||||
return baseMapper.countAlert(status,tenantId);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -57,13 +57,13 @@ public class SurvStationInfoServiceImpl extends ServiceImpl<SurvStationInfoMappe
|
|||
}
|
||||
|
||||
@Override
|
||||
public List<SurvStationInfo> listALlStation() {
|
||||
return baseMapper.listALlStation();
|
||||
public List<SurvStationInfo> listALlStation(String tenantId) {
|
||||
return baseMapper.listALlStation(tenantId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SurvStationInfo> getAllStationAndDevice(String stationCode,String deployType, String token) {
|
||||
return baseMapper.getAllStationAndDevice(stationCode,deployType,token);
|
||||
public List<SurvStationInfo> getAllStationAndDevice(String stationCode,String deployType, String token,String tenantId) {
|
||||
return baseMapper.getAllStationAndDevice(stationCode,deployType,token,tenantId);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -72,14 +72,14 @@ public class SurvStationInfoServiceImpl extends ServiceImpl<SurvStationInfoMappe
|
|||
}
|
||||
|
||||
@Override
|
||||
public Integer getStationDataCounts(SurvStationInfo survStationInfo) {
|
||||
public Integer getStationDataCounts(SurvStationInfo survStationInfo,String tenantId) {
|
||||
Integer dataCounts = 0;
|
||||
if(survStationInfo!=null){
|
||||
List<SurvDeviceDeploy> deploys = new ArrayList<>();
|
||||
if(survStationInfo.getDeviceList() !=null && !survStationInfo.getDeviceList().isEmpty()){ //没有设备传入去重新查询
|
||||
deploys = survStationInfo.getDeviceList();
|
||||
}else{
|
||||
deploys = deviceDeployService.getDeviceByStation(survStationInfo.getStationCode(),null);
|
||||
deploys = deviceDeployService.getDeviceByStation(survStationInfo.getStationCode(),null,tenantId);
|
||||
}
|
||||
|
||||
if(!deploys.isEmpty()){
|
||||
|
|
|
|||
|
|
@ -0,0 +1,16 @@
|
|||
package org.jeecg.system.applet.util;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
public class TenantUtil {
|
||||
|
||||
public static String getCurTenant(String tenantId){
|
||||
String tenant = "";
|
||||
if(StringUtils.isNotBlank(tenantId) && !"0".equals(tenantId)){
|
||||
tenant = tenantId;
|
||||
}else{
|
||||
tenant = "1000";//默认汾西
|
||||
}
|
||||
return tenant;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,5 +1,7 @@
|
|||
package org.jeecg.system.applet.util;
|
||||
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
|
|
@ -31,7 +33,8 @@ public class test {
|
|||
// s2.add("2");
|
||||
// s2.addAll(s1);
|
||||
// s1 = s2;
|
||||
System.out.println( s1.subList(1,s1.size()));
|
||||
String groupId = IdUtil.getSnowflakeNextIdStr();;
|
||||
System.out.println(groupId);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,10 @@
|
|||
package org.jeecg.common.dto;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class CommonDTO {
|
||||
@ApiModelProperty("授权id,即租户")
|
||||
private String authId;
|
||||
}
|
||||
|
|
@ -288,6 +288,9 @@ public class SurvDeviceDeploy implements Serializable {
|
|||
@TableField(exist = false)
|
||||
private List<SurvDeviceDeployRelay> relayList;
|
||||
|
||||
@TableField(exist = false)
|
||||
private String authId;
|
||||
|
||||
public String[] getDepCodeArr() {
|
||||
if(StringUtils.isNotBlank(depCodes)) {
|
||||
return depCodes.split(",");
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
package org.jeecg.common.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 com.fasterxml.jackson.annotation.JsonFormat;
|
||||
|
|
@ -14,6 +15,8 @@ import org.springframework.format.annotation.DateTimeFormat;
|
|||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Description: 虚拟设备模块分组
|
||||
* @Author: jeecg-boot
|
||||
|
|
@ -44,11 +47,16 @@ public class SurvIotVirtualDeviceGroup implements Serializable {
|
|||
@ApiModelProperty(value = "农场ID")
|
||||
private String farmId;
|
||||
|
||||
/**分组类型;module=模块分组*/
|
||||
@Excel(name = "分组类型;module=模块分组", width = 15)
|
||||
/**設備;module=模块分组*/
|
||||
@Excel(name = "分组类型;module=模块分组", width = 15)
|
||||
@ApiModelProperty(value = "分组类型;module=模块分组")
|
||||
private String groupType;
|
||||
|
||||
/**设备ID*/
|
||||
@Excel(name = "设备ID", width = 15)
|
||||
@ApiModelProperty(value = "设备ID")
|
||||
private String deviceId;
|
||||
|
||||
/**设备分组*/
|
||||
@Excel(name = "设备分组", width = 15)
|
||||
@ApiModelProperty(value = "设备分组")
|
||||
|
|
@ -103,4 +111,7 @@ public class SurvIotVirtualDeviceGroup implements Serializable {
|
|||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
@ApiModelProperty(value = "更新时间")
|
||||
private Date updateTime;
|
||||
|
||||
@TableField(exist = false)
|
||||
private List<SurvIotVirtualDeviceModule> modules;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -75,6 +75,11 @@ public class SurvIotVirtualDeviceModule implements Serializable {
|
|||
@ApiModelProperty(value = "模块网络id")
|
||||
private String moduleNetId;
|
||||
|
||||
/**可读类型;read_only=只读,read_write=可读写*/
|
||||
@Excel(name = "可读类型;read_only=只读,read_write=可读写", width = 15)
|
||||
@ApiModelProperty(value = "可读类型;read_only=只读,read_write=可读写")
|
||||
private String readType;
|
||||
|
||||
/**模块主类型;sensor=传感器,meter=测量仪*/
|
||||
@Excel(name = "模块主类型;sensor=传感器,meter=测量仪", width = 15)
|
||||
@ApiModelProperty(value = "模块主类型;sensor=传感器,meter=测量仪")
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
package org.jeecg.common.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 com.fasterxml.jackson.annotation.JsonFormat;
|
||||
|
|
@ -83,4 +84,7 @@ public class SurvMaintainItem implements Serializable {
|
|||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
@ApiModelProperty(value = "更新时间")
|
||||
private java.util.Date updatedTime;
|
||||
|
||||
@TableField(exist = false)
|
||||
private String authId;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -202,7 +202,8 @@ public class SurvStationInfo implements Serializable {
|
|||
@TableField(exist = false)
|
||||
private String name;
|
||||
|
||||
|
||||
@TableField(exist = false)
|
||||
private String authId;
|
||||
|
||||
|
||||
@TableField(exist = false)
|
||||
|
|
|
|||
|
|
@ -121,7 +121,7 @@ public class UserInfo implements Serializable {
|
|||
/**租户ID*/
|
||||
@Excel(name = "租户", width = 15)
|
||||
@ApiModelProperty(value = "租户ID")
|
||||
private java.lang.Integer tenantId;
|
||||
private String tenantId;
|
||||
|
||||
@TableField(exist = false)
|
||||
private String thirdSession;
|
||||
|
|
|
|||
|
|
@ -17,4 +17,6 @@ public class VOSurvIntegrateParam {
|
|||
private String endTime;
|
||||
@ApiModelProperty("统计模式,dayhours=日小时统计,monthDays=月每日统计,yearMonth=年每月统计")
|
||||
private String summrayMode;
|
||||
@ApiModelProperty("租户号")
|
||||
private String authId;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,4 +17,6 @@ public class VOWaterSurvIntegrateParam {
|
|||
private String endTime;
|
||||
@ApiModelProperty("统计模式,dayhours=日小时统计,monthDays=月每日统计,yearMonth=年每月统计")
|
||||
private String summrayMode;
|
||||
@ApiModelProperty("租户号")
|
||||
private String authId;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,5 +17,6 @@ public class VOBigScreenSurvQ {
|
|||
private String endTime;
|
||||
@ApiModelProperty("统计模式")
|
||||
private String summrayMode;
|
||||
|
||||
@ApiModelProperty("租户id")
|
||||
private String authId;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,5 +15,6 @@ public class DeploySummaryVo {
|
|||
private String endTime;
|
||||
@ApiModelProperty("统计模式,dayhours=日小时统计,monthDays=月每日统计,yearMonth=年每月统计")
|
||||
private String summrayMode;
|
||||
|
||||
@ApiModelProperty("租户id")
|
||||
private String authId;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,5 +13,7 @@ public class ScreenSummaryVo {
|
|||
private String endTime;
|
||||
@ApiModelProperty("统计模式,dayhours=日小时统计,monthDays=月每日统计,yearMonth=年每月统计")
|
||||
private String summrayMode;
|
||||
@ApiModelProperty("租户id")
|
||||
private String authId;
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue