From fe474d3324d2bf60ea04bc2adbe4359aaa26f4cf Mon Sep 17 00:00:00 2001 From: lishuai Date: Tue, 20 Aug 2024 16:45:08 +0800 Subject: [PATCH] =?UTF-8?q?APP=E5=8A=9F=E8=83=BD=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=EF=BC=8C=E5=9C=A8=E7=BA=BF=E7=A6=BB=E7=BA=BF=E5=AE=9A=E6=97=B6?= =?UTF-8?q?=E4=BB=BB=E5=8A=A1=202024=E5=B9=B48=E6=9C=8820=E6=97=A516:45:03?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/AlarmConfigServiceImpl.java | 2 +- .../eqbxwx/controller/EqWxPlanController.java | 39 ++++++++-------- .../eq/eqbxwx/entity/EqWxPlanEntity.java | 4 +- .../service/impl/EqWxPlanServiceImpl.java | 10 +++-- .../eq/eqby/entity/EqByPlanPartEntity.java | 30 +++---------- .../service/impl/EqByPlanServiceImpl.java | 3 +- .../controller/EqUserGroupController.java | 4 +- .../eq/equsergroup/dto/EqUserGroupDTO.java | 5 +-- .../equsergroup/entity/EqUserGroupEntity.java | 44 +++++++------------ .../service/EqUserGroupService.java | 2 + .../service/impl/EqUserGroupServiceImpl.java | 26 +++++++---- .../quartz/timetask/task/ThingStatusTask.java | 35 ++++++++++----- .../service/impl/AppletServiceImpl.java | 2 +- .../thing/thing/cache/service/CacheInit.java | 4 +- .../service/ThingManageContextService.java | 3 +- .../impl/ThingManageContextServiceImpl.java | 4 +- .../impl/IotThingDictRelationServiceImpl.java | 2 +- .../controller/IotThingEntityController.java | 10 +++-- .../entity/service/IotThingEntityService.java | 4 +- .../impl/IotThingEntityServiceImpl.java | 13 +++--- 20 files changed, 126 insertions(+), 120 deletions(-) diff --git a/modules/alarm/src/main/java/com/thing/alarm/alarm/service/impl/AlarmConfigServiceImpl.java b/modules/alarm/src/main/java/com/thing/alarm/alarm/service/impl/AlarmConfigServiceImpl.java index 01c0cf7..df93b54 100644 --- a/modules/alarm/src/main/java/com/thing/alarm/alarm/service/impl/AlarmConfigServiceImpl.java +++ b/modules/alarm/src/main/java/com/thing/alarm/alarm/service/impl/AlarmConfigServiceImpl.java @@ -62,7 +62,7 @@ public class AlarmConfigServiceImpl extends BaseServiceImpl> optionalList = thingManageContextService.findViewAllEntity(null, null, code, type, UserContext.getRealTenantCode(), - null, null, null, null, TemplateMark.NO.getValue()); + null, null, null, null, TemplateMark.NO.getValue(),null); if(optionalList.isPresent()){ wrapper.in( AlarmConfigEntity::getThingId, optionalList.get().stream().map( s-> s.get(CacheNameEnum.EntityField.THING_ENTITY_ID.getField()).asLong() diff --git a/modules/equipment/src/main/java/com/thing/eq/eqbxwx/controller/EqWxPlanController.java b/modules/equipment/src/main/java/com/thing/eq/eqbxwx/controller/EqWxPlanController.java index 43ceeb3..d5b3211 100644 --- a/modules/equipment/src/main/java/com/thing/eq/eqbxwx/controller/EqWxPlanController.java +++ b/modules/equipment/src/main/java/com/thing/eq/eqbxwx/controller/EqWxPlanController.java @@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSON; import com.thing.common.core.annotation.LogOperation; import com.thing.common.core.constants.Constant; import com.thing.common.core.exception.SysException; +import com.thing.common.core.utils.ConvertUtils; import com.thing.common.core.utils.excel.ExcelUtils; import com.thing.common.core.validator.AssertUtils; import com.thing.common.core.validator.ValidatorUtils; @@ -124,21 +125,23 @@ public class EqWxPlanController { List resultList = new ArrayList<>(); if (CollectionUtil.isNotEmpty(pageData)) { for (EqWxPlanDTO data : pageData) { - EqWxInfoRes eqWxInfoRes = new EqWxInfoRes(); - BeanUtils.copyProperties(data, eqWxInfoRes); + EqWxInfoRes eqWxInfoRes = ConvertUtils.sourceToTarget(data, EqWxInfoRes.class); //调整 String userId = data.getWxUser(); - String[] split = userId.split(","); - List longs = new ArrayList<>(); - for (String s : split) { - longs.add(new Long(s)); - } List planUserName = sysUserService.getUserNameLists(longs); - String name=""; - for (String s : planUserName) { - name+=s+","; + if(StringUtils.isNotBlank(userId)){ + String[] split = userId.split(","); + List longs = new ArrayList<>(); + for (String s : split) { + longs.add(Long.parseLong(s)); + } + List planUserName = sysUserService.getUserNameLists(longs); + String name=""; + for (String s : planUserName) { + name+=s+","; + } + name = name.substring(0, name.length() - 1); + eqWxInfoRes.setWxUseText(name); } - name = name.substring(0, name.length() - 1); - eqWxInfoRes.setWxUseText(name); // 查询设备信息 ThingDTO thingDTO = new ThingDTO(); if (storeThingsMap.containsKey(data.getThingId())) { @@ -153,7 +156,10 @@ public class EqWxPlanController { if (storeEqBxMap.containsKey(data.getEqBxId())) { eqWxInfoRes.setBxInfo(storeEqBxMap.get(data.getEqBxId())); } else { - EqBxEntity eqBxEntity = eqBxService.getById(data.getEqBxId()); + EqBxEntity eqBxEntity = null; + if(!Objects.isNull(data.getEqBxId())){ + eqBxEntity = eqBxService.getById(data.getEqBxId()); + } if (!Objects.isNull(eqBxEntity)) { BxInfoDTO bxInfoDTO = new BxInfoDTO(); BeanUtils.copyProperties(eqBxEntity, bxInfoDTO); @@ -163,13 +169,10 @@ public class EqWxPlanController { storeEqBxMap.put(data.getEqBxId(), null); } } - resultList.add(eqWxInfoRes); } } - PageData page = new PageData<>(resultList, CollectionUtil.isEmpty(resultList) ? 0 : pageList.getTotal()); - return new Result>().ok(page); } @@ -195,7 +198,7 @@ public class EqWxPlanController { String[] split = userId.split(","); List longs = new ArrayList<>(); for (String s : split) { - longs.add(new Long(s)); + longs.add(Long.parseLong(s)); } List planUserName = sysUserService.getUserNameLists(longs); String name=""; for (String s : planUserName) { @@ -355,7 +358,7 @@ public class EqWxPlanController { String[] split = userId.split(","); List longs = new ArrayList<>(); for (String s : split) { - longs.add(new Long(s)); + longs.add(Long.parseLong(s)); } List planUserName = sysUserService.getUserNameLists(longs); String name=""; for (String s : planUserName) { diff --git a/modules/equipment/src/main/java/com/thing/eq/eqbxwx/entity/EqWxPlanEntity.java b/modules/equipment/src/main/java/com/thing/eq/eqbxwx/entity/EqWxPlanEntity.java index 1ee41ab..1c540ef 100644 --- a/modules/equipment/src/main/java/com/thing/eq/eqbxwx/entity/EqWxPlanEntity.java +++ b/modules/equipment/src/main/java/com/thing/eq/eqbxwx/entity/EqWxPlanEntity.java @@ -2,7 +2,9 @@ package com.thing.eq.eqbxwx.entity; import com.mybatisflex.annotation.Id; +import com.mybatisflex.annotation.KeyType; import com.mybatisflex.annotation.Table; +import com.mybatisflex.core.keygen.KeyGenerators; import lombok.Data; import lombok.EqualsAndHashCode; @@ -26,7 +28,7 @@ public class EqWxPlanEntity implements Serializable { /** * id */ - @Id + @Id(keyType = KeyType.Generator,value = KeyGenerators.snowFlakeId) private Long id; /** * 维修班组 diff --git a/modules/equipment/src/main/java/com/thing/eq/eqbxwx/service/impl/EqWxPlanServiceImpl.java b/modules/equipment/src/main/java/com/thing/eq/eqbxwx/service/impl/EqWxPlanServiceImpl.java index ff54dff..e00b704 100644 --- a/modules/equipment/src/main/java/com/thing/eq/eqbxwx/service/impl/EqWxPlanServiceImpl.java +++ b/modules/equipment/src/main/java/com/thing/eq/eqbxwx/service/impl/EqWxPlanServiceImpl.java @@ -23,6 +23,7 @@ import com.thing.eq.eqpartrecord.service.EqPartRecordService; import com.thing.eq.utils.SerialNumberUnit; import com.thing.sys.biz.entity.SysDictDataEntity; import com.thing.sys.security.context.TenantContext; +import com.thing.sys.security.context.UserContext; import com.thing.sys.security.domain.SecurityUser; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.BeanUtils; @@ -258,8 +259,13 @@ public class EqWxPlanServiceImpl extends BaseServiceImpl replaceMentUseDTOList = new ArrayList<>(); @@ -307,7 +312,6 @@ public class EqWxPlanServiceImpl extends BaseServiceImpl { + void save(EqUserGroupDTO dto); + EqUserGroupDTO getById(Long id); List getList(Map params); diff --git a/modules/equipment/src/main/java/com/thing/eq/equsergroup/service/impl/EqUserGroupServiceImpl.java b/modules/equipment/src/main/java/com/thing/eq/equsergroup/service/impl/EqUserGroupServiceImpl.java index 55246e9..f85de74 100644 --- a/modules/equipment/src/main/java/com/thing/eq/equsergroup/service/impl/EqUserGroupServiceImpl.java +++ b/modules/equipment/src/main/java/com/thing/eq/equsergroup/service/impl/EqUserGroupServiceImpl.java @@ -1,7 +1,9 @@ package com.thing.eq.equsergroup.service.impl; +import cn.hutool.core.map.MapUtil; import com.mybatisflex.core.paginate.Page; import com.mybatisflex.core.query.QueryWrapper; +import com.thing.common.core.utils.ConvertUtils; import com.thing.common.core.web.response.PageData; import com.thing.common.orm.service.impl.BaseServiceImpl; import com.thing.eq.equsergroup.dto.EqUserGroupDTO; @@ -38,15 +40,15 @@ public class EqUserGroupServiceImpl extends BaseServiceImpl page(Map params) { - Page page = getPage(params); - params.put("tenantCode", TenantContext.getTenantCode(SecurityUser.getUser())); - List eqUserGroupDTOs = mapper.getListData(params); - for (EqUserGroupDTO eqUserGroupDTO : eqUserGroupDTOs) { + Integer page = MapUtil.getInt(params, "page", 1); + Integer limit = MapUtil.getInt(params, "limit", 10); + Page pageList = mapper.paginateAs(page, limit, getWrapper(params),EqUserGroupDTO.class); + for (EqUserGroupDTO eqUserGroupDTO : pageList.getRecords()) { String userId = eqUserGroupDTO.getUserId(); String[] split = userId.split(","); List longs = new ArrayList<>(); for (String s : split) { - longs.add(new Long(s)); + longs.add(Long.parseLong(s)); } List planUserName = sysUserService.getUserNameLists(longs); String name=""; @@ -56,7 +58,15 @@ public class EqUserGroupServiceImpl extends BaseServiceImpl(eqUserGroupDTOs, eqUserGroupDTOs.size()); + return new PageData<>(pageList.getRecords(), pageList.getTotalRow()); + } + + @Override + public void save(EqUserGroupDTO dto) { + EqUserGroupEntity eqUserGroupEntity = ConvertUtils.sourceToTarget(dto, EqUserGroupEntity.class); + eqUserGroupEntity.setTenantCode(TenantContext.getTenantCode(SecurityUser.getUser())); + eqUserGroupEntity.setDeptId(TenantContext.getCompanyId(SecurityUser.getUser())); + mapper.insert(eqUserGroupEntity); } @Override @@ -67,7 +77,7 @@ public class EqUserGroupServiceImpl extends BaseServiceImpl longs = new ArrayList<>(); for (String s : split) { - longs.add(new Long(s)); + longs.add(Long.parseLong(s)); } List planUserName = sysUserService.getUserNameLists(longs); String name=""; @@ -88,7 +98,7 @@ public class EqUserGroupServiceImpl extends BaseServiceImpl longs = new ArrayList<>(); for (String s : split) { - longs.add(new Long(s)); + longs.add(Long.parseLong(s)); } List planUserName = sysUserService.getUserNameLists(longs); String name=""; diff --git a/modules/quartz/src/main/java/com/thing/quartz/timetask/task/ThingStatusTask.java b/modules/quartz/src/main/java/com/thing/quartz/timetask/task/ThingStatusTask.java index dca0631..a6add85 100644 --- a/modules/quartz/src/main/java/com/thing/quartz/timetask/task/ThingStatusTask.java +++ b/modules/quartz/src/main/java/com/thing/quartz/timetask/task/ThingStatusTask.java @@ -12,6 +12,7 @@ import com.thing.thing.context.service.ThingManageContextService; import com.thing.thing.model.dto.IotThingModelDTO; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; +import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang3.StringUtils; import org.springframework.stereotype.Component; @@ -49,7 +50,7 @@ public class ThingStatusTask implements ITask { @Override public void run(String params) { log.info("设备在线离线 statusTask start"); - //所有物 + //所有物模型 Optional> optionalList = thingManageContextService.findModelByGateway(GateWayStatus.NO_GATE_WAY.getValue()); if(optionalList.isEmpty()) { return; @@ -60,29 +61,41 @@ public class ThingStatusTask implements ITask { //处理 List statusList = optionalList.get().stream() .map(item -> { - IotThingModelDTO iotThingModelDTO = JacksonUtil.convertValue(item, IotThingModelDTO.class); + // IotThingModelDTO iotThingModelDTO = JacksonUtil.convertValue(item, IotThingModelDTO.class); //找到最大时间的属性 Optional optionalMax = lastTsKvList.stream() .filter(tsKvDTO -> StringUtils.equals(tsKvDTO.getThingCode(),item.get(CacheNameEnum.ModelField.THING_MODEL_CODE.getField()).asText())) .max(Comparator.comparing(TsKvDTO::getTs)); if(optionalMax.isEmpty()){ - iotThingModelDTO.setStatus(ThingStatus.OFFLINE.getCode()); -// item.put(CacheNameEnum.ModelField.THING_MODEL_STATUS.getField(),ThingStatus.OFFLINE.getCode()); + item.put(CacheNameEnum.ModelField.THING_MODEL_STATUS.getField(),ThingStatus.OFFLINE.getCode()); }else{ TsKvDTO tsKvDTO = optionalMax.get(); //根据当前时间和获取的最新时间 若大于45min 则离线 否则为在线 boolean isOffline = System.currentTimeMillis() - tsKvDTO.getTs() > TIME_INTERVAL; - iotThingModelDTO.setStatus(isOffline ? ThingStatus.OFFLINE.getCode() : ThingStatus.ONLINE.getCode()); - iotThingModelDTO.setStatusTs(new Date(tsKvDTO.getTs()).getTime()); - // item.put(CacheNameEnum.ModelField.THING_MODEL_STATUS.getField(),isOffline ? ThingStatus.OFFLINE.getCode() : ThingStatus.ONLINE.getCode()); - // item.put(CacheNameEnum.ModelField.THING_MODEL_STATUS_TS.getField(),new Date(tsKvDTO.getTs()).getTime()); + item.put(CacheNameEnum.ModelField.THING_MODEL_STATUS.getField(),isOffline ? ThingStatus.OFFLINE.getCode() : ThingStatus.ONLINE.getCode()); + item.put(CacheNameEnum.ModelField.THING_MODEL_STATUS_TS.getField(),new Date(tsKvDTO.getTs()).getTime()); + //更新实体设备状态 + List entityNodes = cache.findKeyMap(CacheNameEnum.THING_ENTITY, item.get(CacheNameEnum.ModelField.THING_MODEL_CODE.getField()).asText()); + + if(CollectionUtils.isNotEmpty(entityNodes)){ + for (ObjectNode entityNode : entityNodes) { + entityNode.put(CacheNameEnum.EntityField.THING_ENTITY_STATUS.getField() + ,isOffline ? ThingStatus.OFFLINE.getCode() : ThingStatus.ONLINE.getCode()); + cache.updateKeyMap(CacheNameEnum.THING_ENTITY + ,entityNode.get(CacheNameEnum.EntityField.THING_ENTITY_TENANT_CODE.getField()).asText() + + ":" + entityNode.get(CacheNameEnum.EntityField.THING_ENTITY_CODE.getField()).asText() + + ":" + entityNode.get(CacheNameEnum.EntityField.THING_ENTITY_ID.getField()).asText(),entityNode); + } + } } - return iotThingModelDTO; + //更新物模型 + cache.updateKeyMap(CacheNameEnum.THING_MODEL + , item.get(CacheNameEnum.ModelField.THING_MODEL_CODE.getField()).asText() + + ":" + item.get(CacheNameEnum.ModelField.THING_MODEL_ID.getField()).asText(),item); + return JacksonUtil.convertValue(item, IotThingModelDTO.class); }).collect(Collectors.toList()); //修改状态 thingManageContextService.saveModelBatch(statusList); - cache.clearTopic(CacheNameEnum.THING_MODEL); - cache.clearTopic(CacheNameEnum.THING_ENTITY); log.info("设备在线离线 statusTask end"); } diff --git a/modules/report-analysis/src/main/java/com/thing/carbon/xiaochengxu/service/impl/AppletServiceImpl.java b/modules/report-analysis/src/main/java/com/thing/carbon/xiaochengxu/service/impl/AppletServiceImpl.java index da1db19..62ea5c2 100644 --- a/modules/report-analysis/src/main/java/com/thing/carbon/xiaochengxu/service/impl/AppletServiceImpl.java +++ b/modules/report-analysis/src/main/java/com/thing/carbon/xiaochengxu/service/impl/AppletServiceImpl.java @@ -54,7 +54,7 @@ public class AppletServiceImpl implements AppletService { thingParams.put("tenantCode", tenantCode); thingParams.put("companyId", companyId); thingParams.put("enableStatus", "1"); - Optional> optionalList = thingManageContextService.findViewAllEntity(null, null, null, null, tenantCode, null, null, null, "1", TemplateMark.NO.getValue()); + Optional> optionalList = thingManageContextService.findViewAllEntity(null, null, null, null, tenantCode, null, null, null, "1", TemplateMark.NO.getValue(),null); long online = optionalList.orElseGet(Collections::emptyList).stream().filter(item -> ThingStatus.ONLINE.getCode().equals(item.get(CacheNameEnum.EntityField.THING_ENTITY_STATUS.getField()).asText())).count(); long offline = optionalList.orElseGet(Collections::emptyList).stream().filter(item -> ThingStatus.OFFLINE.getCode().equals(item.get(CacheNameEnum.EntityField.THING_ENTITY_STATUS.getField()).asText())).count(); result.setOnlineCount((int) online); diff --git a/modules/thing/src/main/java/com/thing/thing/cache/service/CacheInit.java b/modules/thing/src/main/java/com/thing/thing/cache/service/CacheInit.java index 150a9a7..c2d08e2 100644 --- a/modules/thing/src/main/java/com/thing/thing/cache/service/CacheInit.java +++ b/modules/thing/src/main/java/com/thing/thing/cache/service/CacheInit.java @@ -52,7 +52,7 @@ public class CacheInit { //物模型的初始化 cacheModel(); //定时打印缓存 - notificationsConsumerExecutor.scheduleAtFixedRate(thingCache::printStats, 0, 5, TimeUnit.MINUTES); + notificationsConsumerExecutor.scheduleAtFixedRate(thingCache::printStats, 0, 3, TimeUnit.SECONDS); log.info("thing 【物模型:物实体:物指标】 cache init end"); } @@ -65,7 +65,7 @@ public class CacheInit { private void cacheEntity() { entityService.findList(CacheNameEnum.EntityField.THING_ENTITY_CREATE_DATE.getField(), Constant.DESC, null,null, null, - null, null, null, null, null); + null, null, null, null, null,null); cacheDictRelation(); cacheRelation(); cacheRelationDetail(); diff --git a/modules/thing/src/main/java/com/thing/thing/context/service/ThingManageContextService.java b/modules/thing/src/main/java/com/thing/thing/context/service/ThingManageContextService.java index 3d03af8..0a1d5bb 100644 --- a/modules/thing/src/main/java/com/thing/thing/context/service/ThingManageContextService.java +++ b/modules/thing/src/main/java/com/thing/thing/context/service/ThingManageContextService.java @@ -57,7 +57,8 @@ public interface ThingManageContextService { Optional> findEntityAllByCodeAndTenantCode(Collection codes,Long tenantCode,boolean isEntity); Optional> findViewAllEntity(String orderField,String order, - String name,String type,Long tenantCode,Long deptId,String realType,String tags,String enableStatus,String templateMark); + String name,String type,Long tenantCode,Long deptId,String realType,String tags + ,String enableStatus,String templateMark,String status); Optional findViewEntityById(Long id); diff --git a/modules/thing/src/main/java/com/thing/thing/context/service/impl/ThingManageContextServiceImpl.java b/modules/thing/src/main/java/com/thing/thing/context/service/impl/ThingManageContextServiceImpl.java index 685f164..32aafc2 100644 --- a/modules/thing/src/main/java/com/thing/thing/context/service/impl/ThingManageContextServiceImpl.java +++ b/modules/thing/src/main/java/com/thing/thing/context/service/impl/ThingManageContextServiceImpl.java @@ -100,8 +100,8 @@ public class ThingManageContextServiceImpl implements ThingManageContextService @Override public Optional> findViewAllEntity(String orderField,String order, - String name,String type,Long tenantCode,Long deptId,String realType,String tags,String enableStatus,String templateMark) { - return Optional.ofNullable(entityService.findList(orderField,order,name,type,tenantCode,deptId,realType,tags,enableStatus,templateMark)); + String name,String type,Long tenantCode,Long deptId,String realType,String tags,String enableStatus,String templateMark,String status) { + return Optional.ofNullable(entityService.findList(orderField,order,name,type,tenantCode,deptId,realType,tags,enableStatus,templateMark,status)); } @Override diff --git a/modules/thing/src/main/java/com/thing/thing/dictRelation/service/impl/IotThingDictRelationServiceImpl.java b/modules/thing/src/main/java/com/thing/thing/dictRelation/service/impl/IotThingDictRelationServiceImpl.java index e15b505..a42f3e8 100644 --- a/modules/thing/src/main/java/com/thing/thing/dictRelation/service/impl/IotThingDictRelationServiceImpl.java +++ b/modules/thing/src/main/java/com/thing/thing/dictRelation/service/impl/IotThingDictRelationServiceImpl.java @@ -169,7 +169,7 @@ public class IotThingDictRelationServiceImpl extends BaseServiceImpl entityServiceList = thingEntityService.findList(null, null, null, null, tenantCode, null, null, null, null, templateMark); + List entityServiceList = thingEntityService.findList(null, null, null, null, tenantCode, null, null, null, null, templateMark,null); entityIds = entityServiceList.stream().map(jsonObject -> jsonObject.get(CacheNameEnum.EntityField.THING_ENTITY_ID.getField()).asText()).collect(Collectors.joining(",")); } if(StringUtils.isBlank(orderField)){ diff --git a/modules/thing/src/main/java/com/thing/thing/entity/controller/IotThingEntityController.java b/modules/thing/src/main/java/com/thing/thing/entity/controller/IotThingEntityController.java index e9b549d..d219e18 100644 --- a/modules/thing/src/main/java/com/thing/thing/entity/controller/IotThingEntityController.java +++ b/modules/thing/src/main/java/com/thing/thing/entity/controller/IotThingEntityController.java @@ -63,9 +63,10 @@ public class IotThingEntityController { @Parameter(name = "realType", description = "真实/虚拟物") @RequestParam(required = false) String realType, @Parameter(name = "tags", description = "真实/虚拟物") @RequestParam(required = false) String tags, @Parameter(name = "enableStatus", description = "停用开启")@RequestParam(required = false) String enableStatus, - @Parameter(name = "templateMark", description = "是否是物实体/模板")@RequestParam(required = false) String templateMark) + @Parameter(name = "templateMark", description = "是否是物实体/模板")@RequestParam(required = false) String templateMark, + @Parameter(name = "status", description = "在线离线状态,0离线 1在线 2错误 3未接入") @RequestParam(required = false) String status) { - PageData pageList = service.pageList(page,limit,orderField,order, name,type,deptId,realType,tags,enableStatus,templateMark); + PageData pageList = service.pageList(page,limit,orderField,order, name,type,deptId,realType,tags,enableStatus,templateMark,status); return new Result>().ok(pageList); } @@ -80,9 +81,10 @@ public class IotThingEntityController { @Parameter(name = "realType", description = "真实/虚拟物") @RequestParam(required = false) String realType, @Parameter(name = "tags", description = "真实/虚拟物") @RequestParam(required = false) String tags, @Parameter(name = "enableStatus", description = "停用开启")@RequestParam(required = false) String enableStatus, - @Parameter(name = "enableStatus", description = "是否是物实体/模板")@RequestParam(required = false) String templateMark) + @Parameter(name = "enableStatus", description = "是否是物实体/模板")@RequestParam(required = false) String templateMark, + @Parameter(name = "status", description = "在线离线状态,0离线 1在线 2错误 3未接入") @RequestParam(required = false) String status) { - List list = service.findList(orderField,order,name,type, UserContext.getRealTenantCode(),deptId,realType,tags,enableStatus,templateMark); + List list = service.findList(orderField,order,name,type, UserContext.getRealTenantCode(),deptId,realType,tags,enableStatus,templateMark,status); return new Result>().ok(list); } diff --git a/modules/thing/src/main/java/com/thing/thing/entity/service/IotThingEntityService.java b/modules/thing/src/main/java/com/thing/thing/entity/service/IotThingEntityService.java index 95ca6c6..1eef5ac 100644 --- a/modules/thing/src/main/java/com/thing/thing/entity/service/IotThingEntityService.java +++ b/modules/thing/src/main/java/com/thing/thing/entity/service/IotThingEntityService.java @@ -29,10 +29,10 @@ import java.util.Optional; public interface IotThingEntityService extends IBaseService { PageData pageList(Integer page,Integer limit,String orderField,String order, - String code,String type,Long deptId,String realType,String tags,String enableStatus,String templateMark); + String code,String type,Long deptId,String realType,String tags,String enableStatus,String templateMark,String status); List findList(String orderField,String order, - String name,String type,Long tenantCode,Long deptId,String realType,String tags,String enableStatus,String templateMark); + String name,String type,Long tenantCode,Long deptId,String realType,String tags,String enableStatus,String templateMark,String status); List findAll(Map params); diff --git a/modules/thing/src/main/java/com/thing/thing/entity/service/impl/IotThingEntityServiceImpl.java b/modules/thing/src/main/java/com/thing/thing/entity/service/impl/IotThingEntityServiceImpl.java index fa935e5..32baf16 100644 --- a/modules/thing/src/main/java/com/thing/thing/entity/service/impl/IotThingEntityServiceImpl.java +++ b/modules/thing/src/main/java/com/thing/thing/entity/service/impl/IotThingEntityServiceImpl.java @@ -240,8 +240,8 @@ public class IotThingEntityServiceImpl extends BaseServiceImpl list = findList(orderField, order, name, type, UserContext.getRealTenantCode(),deptId, realType, tags,enableStatus, templateMark); + String templateMark,String status) { + List list = findList(orderField, order, name, type, UserContext.getRealTenantCode(),deptId, realType, tags,enableStatus, templateMark, status); if (CollectionUtils.isEmpty(list)) { return PageData.empty(); } @@ -259,7 +259,7 @@ public class IotThingEntityServiceImpl extends BaseServiceImpl thingList = cache.getTopicMap(CacheNameEnum.THING_ENTITY); if(CollectionUtils.isEmpty(thingList)){ List iotThingViewDTOS = mapper.selectListByQueryAs(getWrapper(orderField,order, null, null,null,null, @@ -277,7 +277,7 @@ public class IotThingEntityServiceImpl extends BaseServiceImpl> pairs = buildParam(type,tenantCode, - deptId,realType,tags,enableStatus,templateMark); + deptId,realType,tags,enableStatus,templateMark,status); String finalOrderField = CaseFormat.LOWER_UNDERSCORE.to(CaseFormat.LOWER_CAMEL, orderField); Comparator comparator = CompareUtils.getComparator(order, finalOrderField); return thingList.stream().filter(jsonObject -> JacksonUtil.filter(jsonObject, pairs)) @@ -932,7 +932,7 @@ public class IotThingEntityServiceImpl extends BaseServiceImpl> filterList = new ArrayList<>(); /* if (StringUtils.isNotBlank(code)) { @@ -962,6 +962,9 @@ public class IotThingEntityServiceImpl extends BaseServiceImpl