From 208b86af1b4908e49408ff682ff7cc43417b407e Mon Sep 17 00:00:00 2001 From: zy <82248909@qq.com> Date: Tue, 3 Mar 2026 18:17:57 +0800 Subject: [PATCH] =?UTF-8?q?=E7=A7=9F=E6=88=B7=E6=94=B9=E9=80=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../config/mybatis/MybatisPlusSaasConfig.java | 32 ++- .../service/impl/SysUserServiceImpl.java | 6 + .../controller/BigScreenController.java | 33 ++- .../controller/BigScreenControllerP2.java | 6 +- .../appmana/controller/InnerController.java | 12 +- .../controller/StatisticsContoller.java | 3 + .../SurvDeviceDeployController.java | 22 +- .../controller/UserInfoController.java | 21 +- .../mapper/SurvDeviceDeployMapper.java | 5 + .../SurvIotVirtualDeviceGroupMapper.java | 4 + .../mapper/SurvIotVirtualDeviceMapper.java | 5 + .../mapper/xml/SurvDeviceDeployMapper.xml | 3 + .../appmana/mapper/xml/SurvEleMapper.xml | 2 +- .../xml/SurvIotVirtualDeviceGroupMapper.xml | 36 +++ .../mapper/xml/SurvIotVirtualDeviceMapper.xml | 1 + .../xml/SurvIotVirtualDeviceModuleMapper.xml | 21 +- .../appmana/mapper/xml/UserInfoMapper.xml | 3 + .../service/ISurvDeviceDeployService.java | 2 + .../ISurvIotVirtualDeviceGroupService.java | 3 + .../service/ISurvIotVirtualDeviceService.java | 5 + .../appmana/service/IWxAppService.java | 1 + .../service/impl/CommonServiceImpl.java | 28 ++- .../service/impl/IotCommonP2ServiceImpl.java | 10 +- .../service/impl/IotCommonServiceImpl.java | 7 +- .../SurvDeviceDeployRelayServiceImpl.java | 3 +- .../impl/SurvDeviceDeployServiceImpl.java | 11 +- .../SurvIotVirtualDeviceGroupServiceImpl.java | 8 + .../impl/SurvIotVirtualDeviceServiceImpl.java | 37 ++- .../service/impl/WxAppServiceImpl.java | 7 + .../org/jeecg/modules/mqtt/MqttConfig.java | 10 +- .../applet/client/ZhAdminFeignClient.java | 2 +- .../SurvDeviceDeployController.java | 27 +- .../controller/SurvFecesLedgerController.java | 4 + .../SurvMaintainItemController.java | 3 + .../controller/SurvMulchRecordController.java | 4 + .../SurvPestlightAlertController.java | 12 +- .../controller/SurvStationInfoController.java | 43 +++- .../applet/controller/WxAppletController.java | 230 +++++++++++------- .../system/applet/dto/AlertSummaryDTO.java | 4 + .../applet/mapper/SurvAlertRecordMapper.java | 2 +- .../applet/mapper/SurvDeviceDeployMapper.java | 14 +- .../applet/mapper/SurvDisplayInfoMapper.java | 3 +- .../mapper/SurvPestlightAlertMapper.java | 3 +- .../applet/mapper/SurvStationInfoMapper.java | 4 +- .../mapper/xml/SurvAlertRecordMapper.xml | 25 +- .../mapper/xml/SurvDeviceDeployMapper.xml | 18 +- .../mapper/xml/SurvDisplayInfoMapper.xml | 13 +- .../mapper/xml/SurvPestlightAlertMapper.xml | 2 +- .../mapper/xml/SurvStationInfoMapper.xml | 31 ++- .../service/ISurvAlertRecordService.java | 2 +- .../service/ISurvDeviceDeployService.java | 14 +- .../service/ISurvDisplayInfoService.java | 2 +- .../service/ISurvPestlightAlertService.java | 2 +- .../service/ISurvStationInfoService.java | 6 +- .../impl/SurvAlertRecordServiceImpl.java | 8 +- .../impl/SurvDeviceDeployServiceImpl.java | 29 ++- .../impl/SurvDisplayInfoServiceImpl.java | 4 +- .../impl/SurvPestlightAlertServiceImpl.java | 4 +- .../impl/SurvStationInfoServiceImpl.java | 12 +- .../jeecg/system/applet/util/TenantUtil.java | 16 ++ .../org/jeecg/system/applet/util/test.java | 5 +- .../java/org/jeecg/common/dto/CommonDTO.java | 10 + .../jeecg/common/entity/SurvDeviceDeploy.java | 3 + .../entity/SurvIotVirtualDeviceGroup.java | 15 +- .../entity/SurvIotVirtualDeviceModule.java | 5 + .../jeecg/common/entity/SurvMaintainItem.java | 4 + .../jeecg/common/entity/SurvStationInfo.java | 3 +- .../org/jeecg/common/entity/UserInfo.java | 2 +- .../iot/common/VOSurvIntegrateParam.java | 2 + .../iot/common/VOWaterSurvIntegrateParam.java | 2 + .../org/jeecg/common/vo/VOBigScreenSurvQ.java | 3 +- .../common/vo/statistic/DeploySummaryVo.java | 3 +- .../common/vo/statistic/ScreenSummaryVo.java | 2 + 73 files changed, 715 insertions(+), 234 deletions(-) create mode 100644 zh-module-applet/zh-applet-api/src/main/java/org/jeecg/system/applet/util/TenantUtil.java create mode 100644 zh-module-applet/zh-applet-common/src/main/java/org/jeecg/common/dto/CommonDTO.java diff --git a/jeecg-boot-base-core/src/main/java/org/jeecg/config/mybatis/MybatisPlusSaasConfig.java b/jeecg-boot-base-core/src/main/java/org/jeecg/config/mybatis/MybatisPlusSaasConfig.java index a8911fe..78e9036 100644 --- a/jeecg-boot-base-core/src/main/java/org/jeecg/config/mybatis/MybatisPlusSaasConfig.java +++ b/jeecg-boot-base-core/src/main/java/org/jeecg/config/mybatis/MybatisPlusSaasConfig.java @@ -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.示例测试 diff --git a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/service/impl/SysUserServiceImpl.java b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/service/impl/SysUserServiceImpl.java index 0c918eb..ad5feec 100644 --- a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/service/impl/SysUserServiceImpl.java +++ b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/service/impl/SysUserServiceImpl.java @@ -133,6 +133,12 @@ public class SysUserServiceImpl extends ServiceImpl 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 page = new Page(pageNo, pageSize); IPage pageList = this.page(page, queryWrapper); diff --git a/zh-module-applet/zh-applet-admin/src/main/java/org/jeecg/modules/appmana/controller/BigScreenController.java b/zh-module-applet/zh-applet-admin/src/main/java/org/jeecg/modules/appmana/controller/BigScreenController.java index 4ecd713..ccc9613 100644 --- a/zh-module-applet/zh-applet-admin/src/main/java/org/jeecg/modules/appmana/controller/BigScreenController.java +++ b/zh-module-applet/zh-applet-admin/src/main/java/org/jeecg/modules/appmana/controller/BigScreenController.java @@ -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 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 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 stationList = survStationInfoService.getAllStationAndDevice(stationCode,"","token"); //补充最新数据进入 JSONArray returnArrs= new JSONArray(); @@ -506,6 +516,7 @@ public class BigScreenController { @PostMapping("/getIndexSummry") @ApiOperation("大屏首页统计") public Result> getIndexSummry (@RequestBody ScreenSummaryVo screenSummaryVo){ + iotTools.getTenantId(screenSummaryVo.getAuthId()); List 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 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 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 stationInfos= survStationInfoService.list(); List 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); diff --git a/zh-module-applet/zh-applet-admin/src/main/java/org/jeecg/modules/appmana/controller/BigScreenControllerP2.java b/zh-module-applet/zh-applet-admin/src/main/java/org/jeecg/modules/appmana/controller/BigScreenControllerP2.java index 8114e69..36ab88e 100644 --- a/zh-module-applet/zh-applet-admin/src/main/java/org/jeecg/modules/appmana/controller/BigScreenControllerP2.java +++ b/zh-module-applet/zh-applet-admin/src/main/java/org/jeecg/modules/appmana/controller/BigScreenControllerP2.java @@ -56,6 +56,7 @@ public class BigScreenControllerP2 { @ApiOperation(value = "01. 查询设备下各检测项的历史数据", notes = "") @PostMapping(value = "/survItemSummary") public Result 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 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> 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 page = new Page(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 timesIntegrate(@RequestBody DeploySummaryVo deploySummaryVo) { + commonService.getTenantId(deploySummaryVo.getAuthId()); VOIntegrateStatistic voIntegrateStatistic = iotCommonP2Service.CalAirSoilTimesIntegrate(deploySummaryVo); return Result.OK(voIntegrateStatistic); } diff --git a/zh-module-applet/zh-applet-admin/src/main/java/org/jeecg/modules/appmana/controller/InnerController.java b/zh-module-applet/zh-applet-admin/src/main/java/org/jeecg/modules/appmana/controller/InnerController.java index 447cfb2..9602053 100644 --- a/zh-module-applet/zh-applet-admin/src/main/java/org/jeecg/modules/appmana/controller/InnerController.java +++ b/zh-module-applet/zh-applet-admin/src/main/java/org/jeecg/modules/appmana/controller/InnerController.java @@ -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(); } diff --git a/zh-module-applet/zh-applet-admin/src/main/java/org/jeecg/modules/appmana/controller/StatisticsContoller.java b/zh-module-applet/zh-applet-admin/src/main/java/org/jeecg/modules/appmana/controller/StatisticsContoller.java index 911332c..971cf90 100644 --- a/zh-module-applet/zh-applet-admin/src/main/java/org/jeecg/modules/appmana/controller/StatisticsContoller.java +++ b/zh-module-applet/zh-applet-admin/src/main/java/org/jeecg/modules/appmana/controller/StatisticsContoller.java @@ -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") diff --git a/zh-module-applet/zh-applet-admin/src/main/java/org/jeecg/modules/appmana/controller/SurvDeviceDeployController.java b/zh-module-applet/zh-applet-admin/src/main/java/org/jeecg/modules/appmana/controller/SurvDeviceDeployController.java index 784e819..454195f 100644 --- a/zh-module-applet/zh-applet-admin/src/main/java/org/jeecg/modules/appmana/controller/SurvDeviceDeployController.java +++ b/zh-module-applet/zh-applet-admin/src/main/java/org/jeecg/modules/appmana/controller/SurvDeviceDeployController.java @@ -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 pageList = relayService.relayList(deployId,null); - jsonObject.put("relayList",pageList); + switch (deploy.getProtocolCode()){ + case IotConstants.lhviot_standard: + List readType = new ArrayList<>(Arrays.asList("read_write")); + List modules = iotVirtualDeviceService.getModuleByGroup(deploy.getDeployCode(),readType); + jsonObject.put("moduleList",modules); + List readType2 = new ArrayList<>(Arrays.asList("read_only")); + List runs = iotVirtualDeviceService.getModuleByType(deploy.getDeployCode(),readType2); + jsonObject.put("runStatus",runs); + break; + default: + List pageList = relayService.relayList(deployId,null); + jsonObject.put("relayList",pageList); + break; + } if(dateTime==null) { jsonObject.put("dataTime", "该设备没有监测数据返回"); diff --git a/zh-module-applet/zh-applet-admin/src/main/java/org/jeecg/modules/appmana/controller/UserInfoController.java b/zh-module-applet/zh-applet-admin/src/main/java/org/jeecg/modules/appmana/controller/UserInfoController.java index e8c1be7..69a70d9 100644 --- a/zh-module-applet/zh-applet-admin/src/main/java/org/jeecg/modules/appmana/controller/UserInfoController.java +++ b/zh-module-applet/zh-applet-admin/src/main/java/org/jeecg/modules/appmana/controller/UserInfoController.java @@ -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 { @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 queryWrapper = QueryGenerator.initQueryWrapper(userInfo, req.getParameterMap()); Page page = new Page(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 pageList = userInfoService.pages(page, userInfo); return Result.OK(pageList); } diff --git a/zh-module-applet/zh-applet-admin/src/main/java/org/jeecg/modules/appmana/mapper/SurvDeviceDeployMapper.java b/zh-module-applet/zh-applet-admin/src/main/java/org/jeecg/modules/appmana/mapper/SurvDeviceDeployMapper.java index d4691eb..93fbf00 100644 --- a/zh-module-applet/zh-applet-admin/src/main/java/org/jeecg/modules/appmana/mapper/SurvDeviceDeployMapper.java +++ b/zh-module-applet/zh-applet-admin/src/main/java/org/jeecg/modules/appmana/mapper/SurvDeviceDeployMapper.java @@ -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 { IPage pages(IPage page,@Param("query") SurvDeviceDeploy survDeviceDeploy); List getDeviceListByStation(@Param("stationCode") String stationCode,@Param("deployType") String deployType); + SurvDeviceDeploy getOneByCode(String deployCode); List getDeviceListByStations(@Param("stationCode") String stationCode,@Param("deployTypeList") List deployTypeList); List getByIdsWithZhiBiao(@Param("ids")List ids); + + @InterceptorIgnore(illegalSql = "true", tenantLine = "true") + SurvDeviceDeploy getDeviceById(@Param("deployId")String deployId, @Param("tenantId")String tenantId); } diff --git a/zh-module-applet/zh-applet-admin/src/main/java/org/jeecg/modules/appmana/mapper/SurvIotVirtualDeviceGroupMapper.java b/zh-module-applet/zh-applet-admin/src/main/java/org/jeecg/modules/appmana/mapper/SurvIotVirtualDeviceGroupMapper.java index b9e0c5b..ecb946e 100644 --- a/zh-module-applet/zh-applet-admin/src/main/java/org/jeecg/modules/appmana/mapper/SurvIotVirtualDeviceGroupMapper.java +++ b/zh-module-applet/zh-applet-admin/src/main/java/org/jeecg/modules/appmana/mapper/SurvIotVirtualDeviceGroupMapper.java @@ -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 { + List getModuleGroup(@Param("deviceId") String deviceId, @Param("readType") List readType); } diff --git a/zh-module-applet/zh-applet-admin/src/main/java/org/jeecg/modules/appmana/mapper/SurvIotVirtualDeviceMapper.java b/zh-module-applet/zh-applet-admin/src/main/java/org/jeecg/modules/appmana/mapper/SurvIotVirtualDeviceMapper.java index cb329a2..84e9d59 100644 --- a/zh-module-applet/zh-applet-admin/src/main/java/org/jeecg/modules/appmana/mapper/SurvIotVirtualDeviceMapper.java +++ b/zh-module-applet/zh-applet-admin/src/main/java/org/jeecg/modules/appmana/mapper/SurvIotVirtualDeviceMapper.java @@ -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 getDeviceByCode(@Param("deployCode")String deployCode); + + } diff --git a/zh-module-applet/zh-applet-admin/src/main/java/org/jeecg/modules/appmana/mapper/xml/SurvDeviceDeployMapper.xml b/zh-module-applet/zh-applet-admin/src/main/java/org/jeecg/modules/appmana/mapper/xml/SurvDeviceDeployMapper.xml index 2a8fc44..eb5d427 100644 --- a/zh-module-applet/zh-applet-admin/src/main/java/org/jeecg/modules/appmana/mapper/xml/SurvDeviceDeployMapper.xml +++ b/zh-module-applet/zh-applet-admin/src/main/java/org/jeecg/modules/appmana/mapper/xml/SurvDeviceDeployMapper.xml @@ -144,4 +144,7 @@ from surv_device_deploy where ID = #{deployId}; + \ No newline at end of file diff --git a/zh-module-applet/zh-applet-admin/src/main/java/org/jeecg/modules/appmana/mapper/xml/SurvEleMapper.xml b/zh-module-applet/zh-applet-admin/src/main/java/org/jeecg/modules/appmana/mapper/xml/SurvEleMapper.xml index a9ce9f4..4a03f0c 100644 --- a/zh-module-applet/zh-applet-admin/src/main/java/org/jeecg/modules/appmana/mapper/xml/SurvEleMapper.xml +++ b/zh-module-applet/zh-applet-admin/src/main/java/org/jeecg/modules/appmana/mapper/xml/SurvEleMapper.xml @@ -1,5 +1,5 @@ - + \ No newline at end of file diff --git a/zh-module-applet/zh-applet-admin/src/main/java/org/jeecg/modules/appmana/mapper/xml/SurvIotVirtualDeviceGroupMapper.xml b/zh-module-applet/zh-applet-admin/src/main/java/org/jeecg/modules/appmana/mapper/xml/SurvIotVirtualDeviceGroupMapper.xml index b334f9a..973d14d 100644 --- a/zh-module-applet/zh-applet-admin/src/main/java/org/jeecg/modules/appmana/mapper/xml/SurvIotVirtualDeviceGroupMapper.xml +++ b/zh-module-applet/zh-applet-admin/src/main/java/org/jeecg/modules/appmana/mapper/xml/SurvIotVirtualDeviceGroupMapper.xml @@ -2,5 +2,41 @@ + + + + + + + + + + + + + + + + + + + + + + + + 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 + + + \ No newline at end of file diff --git a/zh-module-applet/zh-applet-admin/src/main/java/org/jeecg/modules/appmana/mapper/xml/SurvIotVirtualDeviceMapper.xml b/zh-module-applet/zh-applet-admin/src/main/java/org/jeecg/modules/appmana/mapper/xml/SurvIotVirtualDeviceMapper.xml index 61555d4..01f4879 100644 --- a/zh-module-applet/zh-applet-admin/src/main/java/org/jeecg/modules/appmana/mapper/xml/SurvIotVirtualDeviceMapper.xml +++ b/zh-module-applet/zh-applet-admin/src/main/java/org/jeecg/modules/appmana/mapper/xml/SurvIotVirtualDeviceMapper.xml @@ -48,4 +48,5 @@ select from surv_iot_virtual_device where IOT_CODE = #{deployCode} + \ No newline at end of file diff --git a/zh-module-applet/zh-applet-admin/src/main/java/org/jeecg/modules/appmana/mapper/xml/SurvIotVirtualDeviceModuleMapper.xml b/zh-module-applet/zh-applet-admin/src/main/java/org/jeecg/modules/appmana/mapper/xml/SurvIotVirtualDeviceModuleMapper.xml index e3b0c5b..4e0d25c 100644 --- a/zh-module-applet/zh-applet-admin/src/main/java/org/jeecg/modules/appmana/mapper/xml/SurvIotVirtualDeviceModuleMapper.xml +++ b/zh-module-applet/zh-applet-admin/src/main/java/org/jeecg/modules/appmana/mapper/xml/SurvIotVirtualDeviceModuleMapper.xml @@ -12,6 +12,7 @@ + @@ -39,7 +40,7 @@ - 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 @@ -55,5 +56,21 @@ from surv_iot_virtual_device_module where DEVICE_ID = #{deviceId} order by SORT_NO,CREATE_TIME desc; - + \ No newline at end of file diff --git a/zh-module-applet/zh-applet-admin/src/main/java/org/jeecg/modules/appmana/mapper/xml/UserInfoMapper.xml b/zh-module-applet/zh-applet-admin/src/main/java/org/jeecg/modules/appmana/mapper/xml/UserInfoMapper.xml index 0c4b393..1b8cf38 100644 --- a/zh-module-applet/zh-applet-admin/src/main/java/org/jeecg/modules/appmana/mapper/xml/UserInfoMapper.xml +++ b/zh-module-applet/zh-applet-admin/src/main/java/org/jeecg/modules/appmana/mapper/xml/UserInfoMapper.xml @@ -43,6 +43,9 @@ and phone like concat('%',#{param2.phone},'%') + + and app_id = #{param2.appId} + and nick_name like concat('%',#{param2.nickName},'%') diff --git a/zh-module-applet/zh-applet-admin/src/main/java/org/jeecg/modules/appmana/service/ISurvDeviceDeployService.java b/zh-module-applet/zh-applet-admin/src/main/java/org/jeecg/modules/appmana/service/ISurvDeviceDeployService.java index dd57391..536e2e4 100644 --- a/zh-module-applet/zh-applet-admin/src/main/java/org/jeecg/modules/appmana/service/ISurvDeviceDeployService.java +++ b/zh-module-applet/zh-applet-admin/src/main/java/org/jeecg/modules/appmana/service/ISurvDeviceDeployService.java @@ -35,4 +35,6 @@ public interface ISurvDeviceDeployService extends IService { List getAllDevice(String stationCode,List deployTypes); SurvDeviceDeploy getOrientDeviceByStation(String stationCode); + + SurvDeviceDeploy getDeviceById(String deployId,String tenantId); } diff --git a/zh-module-applet/zh-applet-admin/src/main/java/org/jeecg/modules/appmana/service/ISurvIotVirtualDeviceGroupService.java b/zh-module-applet/zh-applet-admin/src/main/java/org/jeecg/modules/appmana/service/ISurvIotVirtualDeviceGroupService.java index 9dcd5a6..e4f5d67 100644 --- a/zh-module-applet/zh-applet-admin/src/main/java/org/jeecg/modules/appmana/service/ISurvIotVirtualDeviceGroupService.java +++ b/zh-module-applet/zh-applet-admin/src/main/java/org/jeecg/modules/appmana/service/ISurvIotVirtualDeviceGroupService.java @@ -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 { + List getModuleGroup(String deployCode, List readType); } diff --git a/zh-module-applet/zh-applet-admin/src/main/java/org/jeecg/modules/appmana/service/ISurvIotVirtualDeviceService.java b/zh-module-applet/zh-applet-admin/src/main/java/org/jeecg/modules/appmana/service/ISurvIotVirtualDeviceService.java index 1ba9e18..a8da8bd 100644 --- a/zh-module-applet/zh-applet-admin/src/main/java/org/jeecg/modules/appmana/service/ISurvIotVirtualDeviceService.java +++ b/zh-module-applet/zh-applet-admin/src/main/java/org/jeecg/modules/appmana/service/ISurvIotVirtualDeviceService.java @@ -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 getAllMqttTopic(); void processCache(DeviceActionVo deviceQueryActionVo); + + List getModuleByType(String deployCode, List readType); + + List getModuleByGroup(String deployCode, List readType); } diff --git a/zh-module-applet/zh-applet-admin/src/main/java/org/jeecg/modules/appmana/service/IWxAppService.java b/zh-module-applet/zh-applet-admin/src/main/java/org/jeecg/modules/appmana/service/IWxAppService.java index f34502a..b14c602 100644 --- a/zh-module-applet/zh-applet-admin/src/main/java/org/jeecg/modules/appmana/service/IWxAppService.java +++ b/zh-module-applet/zh-applet-admin/src/main/java/org/jeecg/modules/appmana/service/IWxAppService.java @@ -11,4 +11,5 @@ import org.jeecg.common.entity.WxApp; */ public interface IWxAppService extends IService { + WxApp getAppByTenantId(String tenantId); } diff --git a/zh-module-applet/zh-applet-admin/src/main/java/org/jeecg/modules/appmana/service/impl/CommonServiceImpl.java b/zh-module-applet/zh-applet-admin/src/main/java/org/jeecg/modules/appmana/service/impl/CommonServiceImpl.java index 572c611..c2c4b87 100644 --- a/zh-module-applet/zh-applet-admin/src/main/java/org/jeecg/modules/appmana/service/impl/CommonServiceImpl.java +++ b/zh-module-applet/zh-applet-admin/src/main/java/org/jeecg/modules/appmana/service/impl/CommonServiceImpl.java @@ -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);//设置当前租户 + } + } } diff --git a/zh-module-applet/zh-applet-admin/src/main/java/org/jeecg/modules/appmana/service/impl/IotCommonP2ServiceImpl.java b/zh-module-applet/zh-applet-admin/src/main/java/org/jeecg/modules/appmana/service/impl/IotCommonP2ServiceImpl.java index abaed39..5164914 100644 --- a/zh-module-applet/zh-applet-admin/src/main/java/org/jeecg/modules/appmana/service/impl/IotCommonP2ServiceImpl.java +++ b/zh-module-applet/zh-applet-admin/src/main/java/org/jeecg/modules/appmana/service/impl/IotCommonP2ServiceImpl.java @@ -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); diff --git a/zh-module-applet/zh-applet-admin/src/main/java/org/jeecg/modules/appmana/service/impl/IotCommonServiceImpl.java b/zh-module-applet/zh-applet-admin/src/main/java/org/jeecg/modules/appmana/service/impl/IotCommonServiceImpl.java index b7c37a8..804f375 100644 --- a/zh-module-applet/zh-applet-admin/src/main/java/org/jeecg/modules/appmana/service/impl/IotCommonServiceImpl.java +++ b/zh-module-applet/zh-applet-admin/src/main/java/org/jeecg/modules/appmana/service/impl/IotCommonServiceImpl.java @@ -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 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 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() diff --git a/zh-module-applet/zh-applet-admin/src/main/java/org/jeecg/modules/appmana/service/impl/SurvDeviceDeployRelayServiceImpl.java b/zh-module-applet/zh-applet-admin/src/main/java/org/jeecg/modules/appmana/service/impl/SurvDeviceDeployRelayServiceImpl.java index 23f30dd..4a5e6d8 100644 --- a/zh-module-applet/zh-applet-admin/src/main/java/org/jeecg/modules/appmana/service/impl/SurvDeviceDeployRelayServiceImpl.java +++ b/zh-module-applet/zh-applet-admin/src/main/java/org/jeecg/modules/appmana/service/impl/SurvDeviceDeployRelayServiceImpl.java @@ -189,7 +189,7 @@ public class SurvDeviceDeployRelayServiceImpl extends ServiceImpl implements ISurvIotVirtualDeviceGroupService { + + @Override + public List getModuleGroup(String deviceId, List readType) { + return baseMapper.getModuleGroup(deviceId,readType); + } } diff --git a/zh-module-applet/zh-applet-admin/src/main/java/org/jeecg/modules/appmana/service/impl/SurvIotVirtualDeviceServiceImpl.java b/zh-module-applet/zh-applet-admin/src/main/java/org/jeecg/modules/appmana/service/impl/SurvIotVirtualDeviceServiceImpl.java index baf54fc..fb1ea75 100644 --- a/zh-module-applet/zh-applet-admin/src/main/java/org/jeecg/modules/appmana/service/impl/SurvIotVirtualDeviceServiceImpl.java +++ b/zh-module-applet/zh-applet-admin/src/main/java/org/jeecg/modules/appmana/service/impl/SurvIotVirtualDeviceServiceImpl.java @@ -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 modules){ FunctionCode functionCode = FunctionCode.valueOfCode(modbusResult.getFunctionCode()); @@ -747,4 +748,32 @@ public class SurvIotVirtualDeviceServiceImpl extends ServiceImpl getModuleByType(String deployCode, List readType) { + SurvIotVirtualDevice device = lambdaQuery() + .eq(SurvIotVirtualDevice::getIotCode,deployCode) + .last("limit 1") + .one(); + Assert.notNull(device,"无效设备号"+deployCode); + List 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 getModuleByGroup(String deployCode, List readType) { + SurvIotVirtualDevice device = lambdaQuery() + .eq(SurvIotVirtualDevice::getIotCode,deployCode) + .last("limit 1") + .one(); + Assert.notNull(device,"无效设备号"+deployCode); + return groupService.getModuleGroup(device.getId(),readType); + } + } diff --git a/zh-module-applet/zh-applet-admin/src/main/java/org/jeecg/modules/appmana/service/impl/WxAppServiceImpl.java b/zh-module-applet/zh-applet-admin/src/main/java/org/jeecg/modules/appmana/service/impl/WxAppServiceImpl.java index 3817c4a..44dcba6 100644 --- a/zh-module-applet/zh-applet-admin/src/main/java/org/jeecg/modules/appmana/service/impl/WxAppServiceImpl.java +++ b/zh-module-applet/zh-applet-admin/src/main/java/org/jeecg/modules/appmana/service/impl/WxAppServiceImpl.java @@ -15,4 +15,11 @@ import org.springframework.stereotype.Service; @Service public class WxAppServiceImpl extends ServiceImpl implements IWxAppService { + @Override + public WxApp getAppByTenantId(String tenantId) { + WxApp wxApp = lambdaQuery().eq(WxApp::getTenantId,tenantId) + .last("limit 1") + .one(); + return wxApp; + } } diff --git a/zh-module-applet/zh-applet-admin/src/main/java/org/jeecg/modules/mqtt/MqttConfig.java b/zh-module-applet/zh-applet-admin/src/main/java/org/jeecg/modules/mqtt/MqttConfig.java index a063a32..6b5949f 100644 --- a/zh-module-applet/zh-applet-admin/src/main/java/org/jeecg/modules/mqtt/MqttConfig.java +++ b/zh-module-applet/zh-applet-admin/src/main/java/org/jeecg/modules/mqtt/MqttConfig.java @@ -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; } diff --git a/zh-module-applet/zh-applet-api/src/main/java/org/jeecg/system/applet/client/ZhAdminFeignClient.java b/zh-module-applet/zh-applet-api/src/main/java/org/jeecg/system/applet/client/ZhAdminFeignClient.java index 3821743..41c7c39 100644 --- a/zh-module-applet/zh-applet-api/src/main/java/org/jeecg/system/applet/client/ZhAdminFeignClient.java +++ b/zh-module-applet/zh-applet-api/src/main/java/org/jeecg/system/applet/client/ZhAdminFeignClient.java @@ -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); /** * 构造面源数据 diff --git a/zh-module-applet/zh-applet-api/src/main/java/org/jeecg/system/applet/controller/SurvDeviceDeployController.java b/zh-module-applet/zh-applet-api/src/main/java/org/jeecg/system/applet/controller/SurvDeviceDeployController.java index 9d985a8..0f71a4c 100644 --- a/zh-module-applet/zh-applet-api/src/main/java/org/jeecg/system/applet/controller/SurvDeviceDeployController.java +++ b/zh-module-applet/zh-applet-api/src/main/java/org/jeecg/system/applet/controller/SurvDeviceDeployController.java @@ -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> queryPageList(SurvDeviceDeploy survDeviceDeploy) { - List survList = survDeviceDeployService.getCameraGroupByStation(PollutionConstants.CAMERA); - List stationInfoList = stationInfoService.list(); + String tenantId = TenantUtil.getCurTenant(survDeviceDeploy.getAuthId()); + List survList = survDeviceDeployService.getCameraGroupByStation(PollutionConstants.CAMERA,tenantId); + List stationInfoList = stationInfoService.list(new QueryWrapper().eq("TENANT_ID",tenantId)); Map 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> deviceList(@RequestParam(name = "stationCode",required = false)String stationCode) { + public R> deviceList(@RequestParam(name = "stationCode",required = false)String stationCode,@RequestParam(name = "authId",required = false)String authId) { List deployTypes = new ArrayList<>(); // deployTypes.add(PollutionConstants.CAMERA); deployTypes.add(PollutionConstants.AIR_SURV); deployTypes.add(PollutionConstants.SOIL_SURV); - List deploys = survDeviceDeployService.getDeviceListByStation(stationCode,deployTypes,null); + String tenantId = TenantUtil.getCurTenant(authId); + List 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> OrientDeviceList(@RequestParam(name = "stationCode",required = false)String stationCode) { + public R> OrientDeviceList(@RequestParam(name = "stationCode",required = false)String stationCode,@RequestParam(name = "authId",required = false)String authId) { List deployTypes = new ArrayList<>(); deployTypes.add(PollutionConstants.WATER_ORIENT); deployTypes.add(PollutionConstants.WATER_LIVE); - List deploys = survDeviceDeployService.getDeviceListByStation(stationCode,deployTypes,null); + String tenantId = TenantUtil.getCurTenant(authId); + List 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> survDeviceList(@RequestParam(name = "stationCode",required = false)String stationCode) { + public R> survDeviceList(@RequestParam(name = "stationCode",required = false)String stationCode,@RequestParam(name = "authId",required = false)String authId) { List 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 deploys = survDeviceDeployService.getDeviceListByStation(stationCode,deployTypes,null); + String tenantId = TenantUtil.getCurTenant(authId); + List 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> waterDeviceList(@RequestParam(name = "stationCode",required = false)String stationCode) { + public R> waterDeviceList(@RequestParam(name = "stationCode",required = false)String stationCode,@RequestParam(name = "authId",required = false)String authId) { List deployTypes = new ArrayList<>(); deployTypes.add(PollutionConstants.WATER_QULITY); - List deploys = survDeviceDeployService.getDeviceListByStation(stationCode,deployTypes,null); + String tenantId = TenantUtil.getCurTenant(authId); + List deploys = survDeviceDeployService.getDeviceListByStation(stationCode,deployTypes,null,tenantId); return R.ok(deploys); } } diff --git a/zh-module-applet/zh-applet-api/src/main/java/org/jeecg/system/applet/controller/SurvFecesLedgerController.java b/zh-module-applet/zh-applet-api/src/main/java/org/jeecg/system/applet/controller/SurvFecesLedgerController.java index 111d40e..e6749e1 100644 --- a/zh-module-applet/zh-applet-api/src/main/java/org/jeecg/system/applet/controller/SurvFecesLedgerController.java +++ b/zh-module-applet/zh-applet-api/src/main/java/org/jeecg/system/applet/controller/SurvFecesLedgerController.java @@ -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> 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 queryWrapper = QueryGenerator.initQueryWrapper(survFecesLedger, req.getParameterMap()); Page page = new Page(pageNo, pageSize); + String tenantId = TenantUtil.getCurTenant(authId); + survFecesLedger.setTenantId(tenantId); IPage pageList = survFecesLedgerService.pages(page, survFecesLedger); return R.ok(pageList); } diff --git a/zh-module-applet/zh-applet-api/src/main/java/org/jeecg/system/applet/controller/SurvMaintainItemController.java b/zh-module-applet/zh-applet-api/src/main/java/org/jeecg/system/applet/controller/SurvMaintainItemController.java index d4b9312..68becd0 100644 --- a/zh-module-applet/zh-applet-api/src/main/java/org/jeecg/system/applet/controller/SurvMaintainItemController.java +++ b/zh-module-applet/zh-applet-api/src/main/java/org/jeecg/system/applet/controller/SurvMaintainItemController.java @@ -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> queryPageList(SurvMaintainItem survMaintainRecord, HttpServletRequest req) { + String tenantId = TenantUtil.getCurTenant(survMaintainRecord.getAuthId()); + survMaintainRecord.setTenantId(tenantId); List pageList = survMaintainItemService.list(Wrappers.lambdaQuery(survMaintainRecord)); return R.ok(pageList); } diff --git a/zh-module-applet/zh-applet-api/src/main/java/org/jeecg/system/applet/controller/SurvMulchRecordController.java b/zh-module-applet/zh-applet-api/src/main/java/org/jeecg/system/applet/controller/SurvMulchRecordController.java index fe431a7..778b186 100644 --- a/zh-module-applet/zh-applet-api/src/main/java/org/jeecg/system/applet/controller/SurvMulchRecordController.java +++ b/zh-module-applet/zh-applet-api/src/main/java/org/jeecg/system/applet/controller/SurvMulchRecordController.java @@ -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> 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 page = new Page(pageNo, pageSize); + String tenantId = TenantUtil.getCurTenant(authId); + survMulchRecord.setTenantId(tenantId); IPage pageList = survMulchRecordService.pages(page, survMulchRecord); return R.ok(pageList); } diff --git a/zh-module-applet/zh-applet-api/src/main/java/org/jeecg/system/applet/controller/SurvPestlightAlertController.java b/zh-module-applet/zh-applet-api/src/main/java/org/jeecg/system/applet/controller/SurvPestlightAlertController.java index c7bacb0..deba726 100644 --- a/zh-module-applet/zh-applet-api/src/main/java/org/jeecg/system/applet/controller/SurvPestlightAlertController.java +++ b/zh-module-applet/zh-applet-api/src/main/java/org/jeecg/system/applet/controller/SurvPestlightAlertController.java @@ -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> 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 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); diff --git a/zh-module-applet/zh-applet-api/src/main/java/org/jeecg/system/applet/controller/SurvStationInfoController.java b/zh-module-applet/zh-applet-api/src/main/java/org/jeecg/system/applet/controller/SurvStationInfoController.java index 75fc188..e3cea6e 100644 --- a/zh-module-applet/zh-applet-api/src/main/java/org/jeecg/system/applet/controller/SurvStationInfoController.java +++ b/zh-module-applet/zh-applet-api/src/main/java/org/jeecg/system/applet/controller/SurvStationInfoController.java @@ -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 queryWrapper = Wrappers.query(survStationInfo); Page page = new Page(pageNo, pageSize); + String tenantId = TenantUtil.getCurTenant(survStationInfo.getAuthId()); + survStationInfo.setTenantId(tenantId); IPage 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> queryList(SurvStationInfo survStationInfo) { + + String tenantId = TenantUtil.getCurTenant(survStationInfo.getAuthId()); + survStationInfo.setTenantId(tenantId); QueryWrapper queryWrapper = Wrappers.query(survStationInfo); List 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 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 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 camList = survDeviceDeployService.list(Wrappers.lambdaQuery().eq(SurvDeviceDeploy::getStationCode,stationCode).eq(SurvDeviceDeploy::getDeployType,PollutionConstants.CAMERA).orderByAsc(SurvDeviceDeploy::getSortNo)); + List camList = survDeviceDeployService + .list(Wrappers.lambdaQuery() + .eq(SurvDeviceDeploy::getTenantId,tenantId) + .eq(SurvDeviceDeploy::getStationCode,stationCode) + .eq(SurvDeviceDeploy::getDeployType,PollutionConstants.CAMERA) + .orderByAsc(SurvDeviceDeploy::getSortNo)); List 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 stationList = survStationInfoService.listALlStation(); + List stationList = survStationInfoService.listALlStation(tenantId); for (SurvStationInfo survStationInfo : stationList) { - List pageList = survDeviceDeployService.getDeviceByStationNoCam(survStationInfo.getStationCode(),null); + List pageList = survDeviceDeployService.getDeviceByStationNoCam(survStationInfo.getStationCode(),null,tenantId); List 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 deployTypes = new ArrayList<>(); // deployTypes.add(PollutionConstants.CAMERA); deployTypes.add(PollutionConstants.AIR_SURV); deployTypes.add(PollutionConstants.SOIL_SURV); - List deploys = survDeviceDeployService.getDeviceListByStation(stationCode,deployTypes,stationFilter); + String tenantId = TenantUtil.getCurTenant(authId); + List deploys = survDeviceDeployService.getDeviceListByStation(stationCode,deployTypes,stationFilter,tenantId); List adds = new ArrayList<>(); if(!deploys.isEmpty()){ List codeList = deploys.stream().map(SurvDeviceDeploy::getDeviceCode).collect(Collectors.toList()); codeList = codeList.stream().distinct().collect(Collectors.toList()); - List deviceDetails = survDeviceDeployService.getDeviceInfo(codeList); + List deviceDetails = survDeviceDeployService.getDeviceInfo(codeList);//由原接口改造,实际用deviceCode查询了字典表 Map 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 queryWrapper = Wrappers.query(survStationInfo); List pageList = survStationInfoService.list(queryWrapper); JSONObject job = new JSONObject(); job.put("stationInfo",pageList); //杀虫灯数据 - List depList= pestlightInfoService.list(); + LambdaQueryWrapper pestQuery = new LambdaQueryWrapper<>(); + pestQuery.eq(SurvPestlightInfo::getTenantId,tenantId); + List depList= pestlightInfoService.list(pestQuery); job.put("pestlight",depList); //增加自定义点位 - List locationList = survDisplayInfoService.getInfoByType("custom_localtion"); + List locationList = survDisplayInfoService.getInfoByType("custom_localtion",tenantId); List 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 deploys = survDeviceDeployService.getDeviceListByStation(null,deployTypes,null); + + List deploys = survDeviceDeployService.getDeviceListByStation(null,deployTypes,null,tenantId); if(!deploys.isEmpty()){ for (SurvDeviceDeploy deploy : deploys) { CommonLocationTrans ent = new CommonLocationTrans(); diff --git a/zh-module-applet/zh-applet-api/src/main/java/org/jeecg/system/applet/controller/WxAppletController.java b/zh-module-applet/zh-applet-api/src/main/java/org/jeecg/system/applet/controller/WxAppletController.java index 20b38af..ba83545 100644 --- a/zh-module-applet/zh-applet-api/src/main/java/org/jeecg/system/applet/controller/WxAppletController.java +++ b/zh-module-applet/zh-applet-api/src/main/java/org/jeecg/system/applet/controller/WxAppletController.java @@ -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 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 stationList = stationInfoService.getAllStationAndDevice("","","token",tenantId); Integer dataCounts = 0; //补充最新数据进入 List 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 remainList = new ArrayList<>(); List 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 dis5 = survDisplayInfoService.getInfoByType(infoType); + List 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 page = new Page(pageNo, pageSize); //查询站点里的所有设备 List allList =new ArrayList<>(); if(StringUtils.isNotBlank(stationCode)){ - List dList = deviceDeployService.getDeviceByStation(stationCode,""); + List dList = deviceDeployService.getDeviceByStation(stationCode,"",tenantId); dList.forEach(item->allList.add(item.getId())); } else if (StringUtils.isNotBlank(deployId)) { allList.add(deployId); } - IPage pageList = alertRecordService.pages(page, allList,yearStr); + IPage 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 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 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 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 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 result = zhAdminFeignClient.survIntegrateStatistic(voSurvIntegrateParam); - if(result!=null){ - if(result.getResult()!=null){ - if(result.getResult().getObjResults()!=null){ - List 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 result = zhAdminFeignClient.survIntegrateStatistic(voSurvIntegrateParam); + if (result != null) { + if (result.getResult() != null) { + if (result.getResult().getObjResults() != null) { + List 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 stinkSummry = vocsService.getMonthSummry(stinkList,curYear); - List dataOu = new ArrayList<>(); - List dataNh3 = new ArrayList<>(); - List dataH2s = new ArrayList<>(); - List 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 stinkSummry = vocsService.getMonthSummry(stinkList, curYear); + List dataOu = new ArrayList<>(); + List dataNh3 = new ArrayList<>(); + List dataH2s = new ArrayList<>(); + List 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 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 stationList = stationInfoService.getAllStationAndDevice(stationCode,"","token",tenantId); JSONArray jsonArray = new JSONArray(); if(dataCounts==null){ dataCounts=5; diff --git a/zh-module-applet/zh-applet-api/src/main/java/org/jeecg/system/applet/dto/AlertSummaryDTO.java b/zh-module-applet/zh-applet-api/src/main/java/org/jeecg/system/applet/dto/AlertSummaryDTO.java index 0b78de7..c4e741b 100644 --- a/zh-module-applet/zh-applet-api/src/main/java/org/jeecg/system/applet/dto/AlertSummaryDTO.java +++ b/zh-module-applet/zh-applet-api/src/main/java/org/jeecg/system/applet/dto/AlertSummaryDTO.java @@ -13,4 +13,8 @@ public class AlertSummaryDTO { @ApiModelProperty("结束时间") private String endTime; + + + @ApiModelProperty("租户ID") + private String authId; } diff --git a/zh-module-applet/zh-applet-api/src/main/java/org/jeecg/system/applet/mapper/SurvAlertRecordMapper.java b/zh-module-applet/zh-applet-api/src/main/java/org/jeecg/system/applet/mapper/SurvAlertRecordMapper.java index 149d999..175f4f9 100644 --- a/zh-module-applet/zh-applet-api/src/main/java/org/jeecg/system/applet/mapper/SurvAlertRecordMapper.java +++ b/zh-module-applet/zh-applet-api/src/main/java/org/jeecg/system/applet/mapper/SurvAlertRecordMapper.java @@ -17,7 +17,7 @@ import java.util.List; */ public interface SurvAlertRecordMapper extends BaseMapper { - IPage pages(IPage page, @Param("deviceList") List deviceList, @Param("yearStr") String yearStr); + IPage pages(IPage page, @Param("deviceList") List deviceList, @Param("yearStr") String yearStr,@Param("tenantId") String tenantId); List getSpotCheckData(@Param("deployId")String deployId,@Param("itemCode")String itemCode, @Param("dateList") List dateList,@Param("startDateTime")LocalDateTime startDateTime,@Param("endDateTime")LocalDateTime endDateTime); } diff --git a/zh-module-applet/zh-applet-api/src/main/java/org/jeecg/system/applet/mapper/SurvDeviceDeployMapper.java b/zh-module-applet/zh-applet-api/src/main/java/org/jeecg/system/applet/mapper/SurvDeviceDeployMapper.java index 7386569..f79457b 100644 --- a/zh-module-applet/zh-applet-api/src/main/java/org/jeecg/system/applet/mapper/SurvDeviceDeployMapper.java +++ b/zh-module-applet/zh-applet-api/src/main/java/org/jeecg/system/applet/mapper/SurvDeviceDeployMapper.java @@ -15,17 +15,19 @@ import java.util.List; */ public interface SurvDeviceDeployMapper extends BaseMapper { - List getCameraGroupByStation(String camera); + List getCameraGroupByStation(@Param("camera") String camera,@Param("tenantId") String tenantId); - List getDeviceByStation(String stationCode,String deployType); + List 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 getDeviceByStationNoCam(String stationCode, String deployType); + List getDeviceByStationNoCam(@Param("stationCode")String stationCode, @Param("deployType")String deployType,@Param("tenantId")String tenantId); - List getDeviceListByStations(@Param("stationCode")String stationCode,@Param("deployTypeList") List deployTypeList,@Param("stationFilter")String stationFilter); + List getDeviceListByStations(@Param("stationCode")String stationCode,@Param("deployTypeList") List 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 getDeviceInfoList(@Param("codeList") List codeList); + + SurvDeviceDeploy getDeviceById(@Param("deployId")String deployId, @Param("tenantId")String tenantId); } diff --git a/zh-module-applet/zh-applet-api/src/main/java/org/jeecg/system/applet/mapper/SurvDisplayInfoMapper.java b/zh-module-applet/zh-applet-api/src/main/java/org/jeecg/system/applet/mapper/SurvDisplayInfoMapper.java index 6513ed5..e1e43de 100644 --- a/zh-module-applet/zh-applet-api/src/main/java/org/jeecg/system/applet/mapper/SurvDisplayInfoMapper.java +++ b/zh-module-applet/zh-applet-api/src/main/java/org/jeecg/system/applet/mapper/SurvDisplayInfoMapper.java @@ -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 { - List getInfoByType(String projectBrief); + List getInfoByType(@Param("projectBrief")String projectBrief, @Param("tenantId")String tenantId); } diff --git a/zh-module-applet/zh-applet-api/src/main/java/org/jeecg/system/applet/mapper/SurvPestlightAlertMapper.java b/zh-module-applet/zh-applet-api/src/main/java/org/jeecg/system/applet/mapper/SurvPestlightAlertMapper.java index 8256010..fe927c7 100644 --- a/zh-module-applet/zh-applet-api/src/main/java/org/jeecg/system/applet/mapper/SurvPestlightAlertMapper.java +++ b/zh-module-applet/zh-applet-api/src/main/java/org/jeecg/system/applet/mapper/SurvPestlightAlertMapper.java @@ -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 { - Integer countAlert(String status); + Integer countAlert(@Param("status")String status, @Param("tenantId")String tenantId); } diff --git a/zh-module-applet/zh-applet-api/src/main/java/org/jeecg/system/applet/mapper/SurvStationInfoMapper.java b/zh-module-applet/zh-applet-api/src/main/java/org/jeecg/system/applet/mapper/SurvStationInfoMapper.java index 6c5a94e..39d1775 100644 --- a/zh-module-applet/zh-applet-api/src/main/java/org/jeecg/system/applet/mapper/SurvStationInfoMapper.java +++ b/zh-module-applet/zh-applet-api/src/main/java/org/jeecg/system/applet/mapper/SurvStationInfoMapper.java @@ -20,9 +20,9 @@ public interface SurvStationInfoMapper extends BaseMapper { List getStationInfo(String stationCode); - List listALlStation(); + List listALlStation(@Param("tenantId") String tenantId); - List getAllStationAndDevice(@Param("stationCode") String stationCode,@Param("camera") String camera, @Param("token")String token); + List getAllStationAndDevice(@Param("stationCode") String stationCode,@Param("camera") String camera, @Param("token")String token,@Param("tenantId")String tenantId); Integer getCountOfAllData(); } diff --git a/zh-module-applet/zh-applet-api/src/main/java/org/jeecg/system/applet/mapper/xml/SurvAlertRecordMapper.xml b/zh-module-applet/zh-applet-api/src/main/java/org/jeecg/system/applet/mapper/xml/SurvAlertRecordMapper.xml index 3ed0112..209db1d 100644 --- a/zh-module-applet/zh-applet-api/src/main/java/org/jeecg/system/applet/mapper/xml/SurvAlertRecordMapper.xml +++ b/zh-module-applet/zh-applet-api/src/main/java/org/jeecg/system/applet/mapper/xml/SurvAlertRecordMapper.xml @@ -45,16 +45,21 @@ diff --git a/zh-module-applet/zh-applet-api/src/main/java/org/jeecg/system/applet/mapper/xml/SurvDeviceDeployMapper.xml b/zh-module-applet/zh-applet-api/src/main/java/org/jeecg/system/applet/mapper/xml/SurvDeviceDeployMapper.xml index 24b766c..0b1b053 100644 --- a/zh-module-applet/zh-applet-api/src/main/java/org/jeecg/system/applet/mapper/xml/SurvDeviceDeployMapper.xml +++ b/zh-module-applet/zh-applet-api/src/main/java/org/jeecg/system/applet/mapper/xml/SurvDeviceDeployMapper.xml @@ -72,7 +72,7 @@ + \ No newline at end of file diff --git a/zh-module-applet/zh-applet-api/src/main/java/org/jeecg/system/applet/mapper/xml/SurvDisplayInfoMapper.xml b/zh-module-applet/zh-applet-api/src/main/java/org/jeecg/system/applet/mapper/xml/SurvDisplayInfoMapper.xml index 286257f..fb45201 100644 --- a/zh-module-applet/zh-applet-api/src/main/java/org/jeecg/system/applet/mapper/xml/SurvDisplayInfoMapper.xml +++ b/zh-module-applet/zh-applet-api/src/main/java/org/jeecg/system/applet/mapper/xml/SurvDisplayInfoMapper.xml @@ -32,9 +32,14 @@ \ No newline at end of file diff --git a/zh-module-applet/zh-applet-api/src/main/java/org/jeecg/system/applet/mapper/xml/SurvPestlightAlertMapper.xml b/zh-module-applet/zh-applet-api/src/main/java/org/jeecg/system/applet/mapper/xml/SurvPestlightAlertMapper.xml index 6d9fae8..1aebf93 100644 --- a/zh-module-applet/zh-applet-api/src/main/java/org/jeecg/system/applet/mapper/xml/SurvPestlightAlertMapper.xml +++ b/zh-module-applet/zh-applet-api/src/main/java/org/jeecg/system/applet/mapper/xml/SurvPestlightAlertMapper.xml @@ -3,6 +3,6 @@ \ No newline at end of file diff --git a/zh-module-applet/zh-applet-api/src/main/java/org/jeecg/system/applet/mapper/xml/SurvStationInfoMapper.xml b/zh-module-applet/zh-applet-api/src/main/java/org/jeecg/system/applet/mapper/xml/SurvStationInfoMapper.xml index 6298210..2d52dd8 100644 --- a/zh-module-applet/zh-applet-api/src/main/java/org/jeecg/system/applet/mapper/xml/SurvStationInfoMapper.xml +++ b/zh-module-applet/zh-applet-api/src/main/java/org/jeecg/system/applet/mapper/xml/SurvStationInfoMapper.xml @@ -39,12 +39,12 @@ - + - + @@ -90,15 +93,25 @@ diff --git a/zh-module-applet/zh-applet-api/src/main/java/org/jeecg/system/applet/service/ISurvAlertRecordService.java b/zh-module-applet/zh-applet-api/src/main/java/org/jeecg/system/applet/service/ISurvAlertRecordService.java index 3121368..642fcd0 100644 --- a/zh-module-applet/zh-applet-api/src/main/java/org/jeecg/system/applet/service/ISurvAlertRecordService.java +++ b/zh-module-applet/zh-applet-api/src/main/java/org/jeecg/system/applet/service/ISurvAlertRecordService.java @@ -16,7 +16,7 @@ import java.util.List; */ public interface ISurvAlertRecordService extends IService { - IPage pages(IPage page, List deviceList, String yearStr); + IPage pages(IPage page, List deviceList, String yearStr,String tenantId); AlertSummaryVo getSummary(AlertSummaryDTO alertSummaryDTO); } diff --git a/zh-module-applet/zh-applet-api/src/main/java/org/jeecg/system/applet/service/ISurvDeviceDeployService.java b/zh-module-applet/zh-applet-api/src/main/java/org/jeecg/system/applet/service/ISurvDeviceDeployService.java index 2fb9ca8..b038a74 100644 --- a/zh-module-applet/zh-applet-api/src/main/java/org/jeecg/system/applet/service/ISurvDeviceDeployService.java +++ b/zh-module-applet/zh-applet-api/src/main/java/org/jeecg/system/applet/service/ISurvDeviceDeployService.java @@ -13,18 +13,20 @@ import java.util.List; * @Version: V1.0 */ public interface ISurvDeviceDeployService extends IService { - List getCameraGroupByStation(String camera); + List getCameraGroupByStation(String camera,String tenantId); - List getDeviceByStation(String stationCode,String deployType); + List getDeviceByStation(String stationCode,String deployType,String tenantId); - SurvDeviceDeploy getDeviceByCode(String deployCode); + SurvDeviceDeploy getDeviceByCode(String deployCode,String tenantId); - List getDeviceByStationNoCam(String stationCode, String deployType); + List getDeviceByStationNoCam(String stationCode, String deployType,String tenantId); - List getDeviceListByStation(String stationCode, List deployTypes,String stationFilter); + List getDeviceListByStation(String stationCode, List deployTypes,String stationFilter,String tenantId); - SurvDeviceDeploy getDeployZhibiao(String deployId); + SurvDeviceDeploy getDeployZhibiao(String deployId,String tenantId); List getDeviceInfo(List codeList); + + SurvDeviceDeploy getDeviceById(String deployId, String tenantId); } diff --git a/zh-module-applet/zh-applet-api/src/main/java/org/jeecg/system/applet/service/ISurvDisplayInfoService.java b/zh-module-applet/zh-applet-api/src/main/java/org/jeecg/system/applet/service/ISurvDisplayInfoService.java index b109ec2..2daa935 100644 --- a/zh-module-applet/zh-applet-api/src/main/java/org/jeecg/system/applet/service/ISurvDisplayInfoService.java +++ b/zh-module-applet/zh-applet-api/src/main/java/org/jeecg/system/applet/service/ISurvDisplayInfoService.java @@ -14,7 +14,7 @@ import java.util.List; */ public interface ISurvDisplayInfoService extends IService { - List getInfoByType(@Param("projectBrief") String projectBrief); + List getInfoByType(@Param("projectBrief") String projectBrief,String tenantId); } diff --git a/zh-module-applet/zh-applet-api/src/main/java/org/jeecg/system/applet/service/ISurvPestlightAlertService.java b/zh-module-applet/zh-applet-api/src/main/java/org/jeecg/system/applet/service/ISurvPestlightAlertService.java index 39cf24f..e8f6874 100644 --- a/zh-module-applet/zh-applet-api/src/main/java/org/jeecg/system/applet/service/ISurvPestlightAlertService.java +++ b/zh-module-applet/zh-applet-api/src/main/java/org/jeecg/system/applet/service/ISurvPestlightAlertService.java @@ -11,5 +11,5 @@ import org.jeecg.common.entity.SurvPestlightAlert; */ public interface ISurvPestlightAlertService extends IService { - Integer countAlert(String status); + Integer countAlert(String status,String tenantId); } diff --git a/zh-module-applet/zh-applet-api/src/main/java/org/jeecg/system/applet/service/ISurvStationInfoService.java b/zh-module-applet/zh-applet-api/src/main/java/org/jeecg/system/applet/service/ISurvStationInfoService.java index e9cbcf0..d83045d 100644 --- a/zh-module-applet/zh-applet-api/src/main/java/org/jeecg/system/applet/service/ISurvStationInfoService.java +++ b/zh-module-applet/zh-applet-api/src/main/java/org/jeecg/system/applet/service/ISurvStationInfoService.java @@ -18,11 +18,11 @@ public interface ISurvStationInfoService extends IService { List getStationInfo(String stationCode); - List listALlStation(); + List listALlStation(String tenantId); - List getAllStationAndDevice(String stationCode,String deployType, String token); + List getAllStationAndDevice(String stationCode,String deployType, String token,String tenantId); Integer getCountOfAllData(); - Integer getStationDataCounts(SurvStationInfo survStationInfo); + Integer getStationDataCounts(SurvStationInfo survStationInfo,String tenantId); } diff --git a/zh-module-applet/zh-applet-api/src/main/java/org/jeecg/system/applet/service/impl/SurvAlertRecordServiceImpl.java b/zh-module-applet/zh-applet-api/src/main/java/org/jeecg/system/applet/service/impl/SurvAlertRecordServiceImpl.java index 971205a..6017369 100644 --- a/zh-module-applet/zh-applet-api/src/main/java/org/jeecg/system/applet/service/impl/SurvAlertRecordServiceImpl.java +++ b/zh-module-applet/zh-applet-api/src/main/java/org/jeecg/system/applet/service/impl/SurvAlertRecordServiceImpl.java @@ -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 pages(IPage page, List deviceList, String yearStr) { - return baseMapper.pages(page,deviceList,yearStr); + public IPage pages(IPage page, List 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 survItemInfos = new ArrayList<>(); diff --git a/zh-module-applet/zh-applet-api/src/main/java/org/jeecg/system/applet/service/impl/SurvDeviceDeployServiceImpl.java b/zh-module-applet/zh-applet-api/src/main/java/org/jeecg/system/applet/service/impl/SurvDeviceDeployServiceImpl.java index 5db1318..8692fe4 100644 --- a/zh-module-applet/zh-applet-api/src/main/java/org/jeecg/system/applet/service/impl/SurvDeviceDeployServiceImpl.java +++ b/zh-module-applet/zh-applet-api/src/main/java/org/jeecg/system/applet/service/impl/SurvDeviceDeployServiceImpl.java @@ -19,33 +19,33 @@ import java.util.List; public class SurvDeviceDeployServiceImpl extends ServiceImpl implements ISurvDeviceDeployService { @Override - public List getCameraGroupByStation(String camera) { - return baseMapper.getCameraGroupByStation(camera); + public List getCameraGroupByStation(String camera,String tenantId) { + return baseMapper.getCameraGroupByStation(camera,tenantId); } @Override - public List getDeviceByStation(String stationCode,String deployType) { - return baseMapper.getDeviceByStation(stationCode, deployType); + public List 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 getDeviceByStationNoCam(String stationCode, String deployType) { - return baseMapper.getDeviceByStationNoCam(stationCode,deployType); + public List getDeviceByStationNoCam(String stationCode, String deployType,String tenantId) { + return baseMapper.getDeviceByStationNoCam(stationCode,deployType,tenantId); } @Override - public List getDeviceListByStation(String stationCode, List deployTypes,String stationFilter) { - return baseMapper.getDeviceListByStations(stationCode,deployTypes,stationFilter); + public List getDeviceListByStation(String stationCode, List 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 implements ISurvDisplayInfoService { @Override - public List getInfoByType(String projectBrief) { - return baseMapper.getInfoByType(projectBrief); + public List getInfoByType(String projectBrief,String tenantId) { + return baseMapper.getInfoByType(projectBrief,tenantId); } } diff --git a/zh-module-applet/zh-applet-api/src/main/java/org/jeecg/system/applet/service/impl/SurvPestlightAlertServiceImpl.java b/zh-module-applet/zh-applet-api/src/main/java/org/jeecg/system/applet/service/impl/SurvPestlightAlertServiceImpl.java index 38c4342..f6dc7a7 100644 --- a/zh-module-applet/zh-applet-api/src/main/java/org/jeecg/system/applet/service/impl/SurvPestlightAlertServiceImpl.java +++ b/zh-module-applet/zh-applet-api/src/main/java/org/jeecg/system/applet/service/impl/SurvPestlightAlertServiceImpl.java @@ -16,7 +16,7 @@ import org.springframework.stereotype.Service; public class SurvPestlightAlertServiceImpl extends ServiceImpl implements ISurvPestlightAlertService { @Override - public Integer countAlert(String status) { - return baseMapper.countAlert(status); + public Integer countAlert(String status,String tenantId) { + return baseMapper.countAlert(status,tenantId); } } diff --git a/zh-module-applet/zh-applet-api/src/main/java/org/jeecg/system/applet/service/impl/SurvStationInfoServiceImpl.java b/zh-module-applet/zh-applet-api/src/main/java/org/jeecg/system/applet/service/impl/SurvStationInfoServiceImpl.java index cdda2ef..622b973 100644 --- a/zh-module-applet/zh-applet-api/src/main/java/org/jeecg/system/applet/service/impl/SurvStationInfoServiceImpl.java +++ b/zh-module-applet/zh-applet-api/src/main/java/org/jeecg/system/applet/service/impl/SurvStationInfoServiceImpl.java @@ -57,13 +57,13 @@ public class SurvStationInfoServiceImpl extends ServiceImpl listALlStation() { - return baseMapper.listALlStation(); + public List listALlStation(String tenantId) { + return baseMapper.listALlStation(tenantId); } @Override - public List getAllStationAndDevice(String stationCode,String deployType, String token) { - return baseMapper.getAllStationAndDevice(stationCode,deployType,token); + public List 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 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()){ diff --git a/zh-module-applet/zh-applet-api/src/main/java/org/jeecg/system/applet/util/TenantUtil.java b/zh-module-applet/zh-applet-api/src/main/java/org/jeecg/system/applet/util/TenantUtil.java new file mode 100644 index 0000000..ae9def7 --- /dev/null +++ b/zh-module-applet/zh-applet-api/src/main/java/org/jeecg/system/applet/util/TenantUtil.java @@ -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; + } +} diff --git a/zh-module-applet/zh-applet-api/src/main/java/org/jeecg/system/applet/util/test.java b/zh-module-applet/zh-applet-api/src/main/java/org/jeecg/system/applet/util/test.java index d43d66c..7e161c0 100644 --- a/zh-module-applet/zh-applet-api/src/main/java/org/jeecg/system/applet/util/test.java +++ b/zh-module-applet/zh-applet-api/src/main/java/org/jeecg/system/applet/util/test.java @@ -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); } } diff --git a/zh-module-applet/zh-applet-common/src/main/java/org/jeecg/common/dto/CommonDTO.java b/zh-module-applet/zh-applet-common/src/main/java/org/jeecg/common/dto/CommonDTO.java new file mode 100644 index 0000000..d0c084d --- /dev/null +++ b/zh-module-applet/zh-applet-common/src/main/java/org/jeecg/common/dto/CommonDTO.java @@ -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; +} diff --git a/zh-module-applet/zh-applet-common/src/main/java/org/jeecg/common/entity/SurvDeviceDeploy.java b/zh-module-applet/zh-applet-common/src/main/java/org/jeecg/common/entity/SurvDeviceDeploy.java index 499ee9b..b0213f6 100644 --- a/zh-module-applet/zh-applet-common/src/main/java/org/jeecg/common/entity/SurvDeviceDeploy.java +++ b/zh-module-applet/zh-applet-common/src/main/java/org/jeecg/common/entity/SurvDeviceDeploy.java @@ -288,6 +288,9 @@ public class SurvDeviceDeploy implements Serializable { @TableField(exist = false) private List relayList; + @TableField(exist = false) + private String authId; + public String[] getDepCodeArr() { if(StringUtils.isNotBlank(depCodes)) { return depCodes.split(","); diff --git a/zh-module-applet/zh-applet-common/src/main/java/org/jeecg/common/entity/SurvIotVirtualDeviceGroup.java b/zh-module-applet/zh-applet-common/src/main/java/org/jeecg/common/entity/SurvIotVirtualDeviceGroup.java index d03e896..9213f5d 100644 --- a/zh-module-applet/zh-applet-common/src/main/java/org/jeecg/common/entity/SurvIotVirtualDeviceGroup.java +++ b/zh-module-applet/zh-applet-common/src/main/java/org/jeecg/common/entity/SurvIotVirtualDeviceGroup.java @@ -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 modules; } diff --git a/zh-module-applet/zh-applet-common/src/main/java/org/jeecg/common/entity/SurvIotVirtualDeviceModule.java b/zh-module-applet/zh-applet-common/src/main/java/org/jeecg/common/entity/SurvIotVirtualDeviceModule.java index f913a4c..346c913 100644 --- a/zh-module-applet/zh-applet-common/src/main/java/org/jeecg/common/entity/SurvIotVirtualDeviceModule.java +++ b/zh-module-applet/zh-applet-common/src/main/java/org/jeecg/common/entity/SurvIotVirtualDeviceModule.java @@ -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=测量仪") diff --git a/zh-module-applet/zh-applet-common/src/main/java/org/jeecg/common/entity/SurvMaintainItem.java b/zh-module-applet/zh-applet-common/src/main/java/org/jeecg/common/entity/SurvMaintainItem.java index 265c1fe..625a6d2 100644 --- a/zh-module-applet/zh-applet-common/src/main/java/org/jeecg/common/entity/SurvMaintainItem.java +++ b/zh-module-applet/zh-applet-common/src/main/java/org/jeecg/common/entity/SurvMaintainItem.java @@ -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; } diff --git a/zh-module-applet/zh-applet-common/src/main/java/org/jeecg/common/entity/SurvStationInfo.java b/zh-module-applet/zh-applet-common/src/main/java/org/jeecg/common/entity/SurvStationInfo.java index 4b1a838..6fe45c5 100644 --- a/zh-module-applet/zh-applet-common/src/main/java/org/jeecg/common/entity/SurvStationInfo.java +++ b/zh-module-applet/zh-applet-common/src/main/java/org/jeecg/common/entity/SurvStationInfo.java @@ -202,7 +202,8 @@ public class SurvStationInfo implements Serializable { @TableField(exist = false) private String name; - + @TableField(exist = false) + private String authId; @TableField(exist = false) diff --git a/zh-module-applet/zh-applet-common/src/main/java/org/jeecg/common/entity/UserInfo.java b/zh-module-applet/zh-applet-common/src/main/java/org/jeecg/common/entity/UserInfo.java index acc897a..febd033 100644 --- a/zh-module-applet/zh-applet-common/src/main/java/org/jeecg/common/entity/UserInfo.java +++ b/zh-module-applet/zh-applet-common/src/main/java/org/jeecg/common/entity/UserInfo.java @@ -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; diff --git a/zh-module-applet/zh-applet-common/src/main/java/org/jeecg/common/iot/common/VOSurvIntegrateParam.java b/zh-module-applet/zh-applet-common/src/main/java/org/jeecg/common/iot/common/VOSurvIntegrateParam.java index ee25579..5e522df 100644 --- a/zh-module-applet/zh-applet-common/src/main/java/org/jeecg/common/iot/common/VOSurvIntegrateParam.java +++ b/zh-module-applet/zh-applet-common/src/main/java/org/jeecg/common/iot/common/VOSurvIntegrateParam.java @@ -17,4 +17,6 @@ public class VOSurvIntegrateParam { private String endTime; @ApiModelProperty("统计模式,dayhours=日小时统计,monthDays=月每日统计,yearMonth=年每月统计") private String summrayMode; + @ApiModelProperty("租户号") + private String authId; } diff --git a/zh-module-applet/zh-applet-common/src/main/java/org/jeecg/common/iot/common/VOWaterSurvIntegrateParam.java b/zh-module-applet/zh-applet-common/src/main/java/org/jeecg/common/iot/common/VOWaterSurvIntegrateParam.java index adb8012..b6580d5 100644 --- a/zh-module-applet/zh-applet-common/src/main/java/org/jeecg/common/iot/common/VOWaterSurvIntegrateParam.java +++ b/zh-module-applet/zh-applet-common/src/main/java/org/jeecg/common/iot/common/VOWaterSurvIntegrateParam.java @@ -17,4 +17,6 @@ public class VOWaterSurvIntegrateParam { private String endTime; @ApiModelProperty("统计模式,dayhours=日小时统计,monthDays=月每日统计,yearMonth=年每月统计") private String summrayMode; + @ApiModelProperty("租户号") + private String authId; } diff --git a/zh-module-applet/zh-applet-common/src/main/java/org/jeecg/common/vo/VOBigScreenSurvQ.java b/zh-module-applet/zh-applet-common/src/main/java/org/jeecg/common/vo/VOBigScreenSurvQ.java index 4f65474..27da633 100644 --- a/zh-module-applet/zh-applet-common/src/main/java/org/jeecg/common/vo/VOBigScreenSurvQ.java +++ b/zh-module-applet/zh-applet-common/src/main/java/org/jeecg/common/vo/VOBigScreenSurvQ.java @@ -17,5 +17,6 @@ public class VOBigScreenSurvQ { private String endTime; @ApiModelProperty("统计模式") private String summrayMode; - + @ApiModelProperty("租户id") + private String authId; } diff --git a/zh-module-applet/zh-applet-common/src/main/java/org/jeecg/common/vo/statistic/DeploySummaryVo.java b/zh-module-applet/zh-applet-common/src/main/java/org/jeecg/common/vo/statistic/DeploySummaryVo.java index e3c9f22..eae1f60 100644 --- a/zh-module-applet/zh-applet-common/src/main/java/org/jeecg/common/vo/statistic/DeploySummaryVo.java +++ b/zh-module-applet/zh-applet-common/src/main/java/org/jeecg/common/vo/statistic/DeploySummaryVo.java @@ -15,5 +15,6 @@ public class DeploySummaryVo { private String endTime; @ApiModelProperty("统计模式,dayhours=日小时统计,monthDays=月每日统计,yearMonth=年每月统计") private String summrayMode; - + @ApiModelProperty("租户id") + private String authId; } diff --git a/zh-module-applet/zh-applet-common/src/main/java/org/jeecg/common/vo/statistic/ScreenSummaryVo.java b/zh-module-applet/zh-applet-common/src/main/java/org/jeecg/common/vo/statistic/ScreenSummaryVo.java index fba173a..8ff0e63 100644 --- a/zh-module-applet/zh-applet-common/src/main/java/org/jeecg/common/vo/statistic/ScreenSummaryVo.java +++ b/zh-module-applet/zh-applet-common/src/main/java/org/jeecg/common/vo/statistic/ScreenSummaryVo.java @@ -13,5 +13,7 @@ public class ScreenSummaryVo { private String endTime; @ApiModelProperty("统计模式,dayhours=日小时统计,monthDays=月每日统计,yearMonth=年每月统计") private String summrayMode; + @ApiModelProperty("租户id") + private String authId; }