feat:应用端添加相关接口
parent
71afcad7ff
commit
ae85ef7a06
|
@ -4,7 +4,6 @@ import cc.iotkit.common.api.PageRequest;
|
|||
import cc.iotkit.common.api.Paging;
|
||||
import cc.iotkit.common.utils.MapstructUtils;
|
||||
import cc.iotkit.common.utils.ReflectUtil;
|
||||
import cc.iotkit.common.utils.StreamUtils;
|
||||
import cc.iotkit.data.dao.*;
|
||||
import cc.iotkit.data.manager.ICategoryData;
|
||||
import cc.iotkit.data.manager.IDeviceInfoData;
|
||||
|
@ -17,10 +16,7 @@ import cc.iotkit.model.device.message.DevicePropertyCache;
|
|||
import cc.iotkit.model.product.Category;
|
||||
import cc.iotkit.model.product.Product;
|
||||
import cc.iotkit.model.stats.DataItem;
|
||||
import cc.iotkit.model.system.SysDept;
|
||||
import cc.iotkit.model.system.SysUser;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.querydsl.core.types.Expression;
|
||||
import com.querydsl.core.types.Predicate;
|
||||
import com.querydsl.core.types.Projections;
|
||||
import com.querydsl.jpa.impl.JPAQuery;
|
||||
|
@ -41,8 +37,6 @@ import static cc.iotkit.data.model.QTbDeviceGroupMapping.tbDeviceGroupMapping;
|
|||
import static cc.iotkit.data.model.QTbDeviceInfo.tbDeviceInfo;
|
||||
import static cc.iotkit.data.model.QTbDeviceSubUser.tbDeviceSubUser;
|
||||
import static cc.iotkit.data.model.QTbProduct.tbProduct;
|
||||
import static cc.iotkit.data.model.QTbSysDept.tbSysDept;
|
||||
import static cc.iotkit.data.model.QTbSysUser.tbSysUser;
|
||||
|
||||
@Primary
|
||||
@Service
|
||||
|
@ -485,8 +479,10 @@ public class DeviceInfoDataImpl implements IDeviceInfoData, IJPACommData<DeviceI
|
|||
}
|
||||
|
||||
private List<DeviceInfo> buildQuery(Predicate predicate) {
|
||||
List<TbDeviceInfo> devices = jpaQueryFactory.select(Projections.bean(TbDeviceInfo.class,
|
||||
tbDeviceInfo.deviceId, tbDeviceInfo.deviceName, tbDeviceInfo.state ))
|
||||
List<TbDeviceInfo> devices = jpaQueryFactory.select(Projections.bean(TbDeviceInfo.class,tbDeviceInfo.uid,
|
||||
tbDeviceInfo.deviceId, tbDeviceInfo.productKey,tbDeviceInfo.deviceName, tbDeviceInfo.state,tbDeviceInfo.createAt,
|
||||
tbDeviceInfo.id,tbDeviceInfo.onlineTime,tbDeviceInfo.parentId,tbDeviceInfo.latitude,tbDeviceInfo.longitude,tbDeviceInfo.model,
|
||||
tbDeviceInfo.offlineTime,tbDeviceInfo.secret))
|
||||
.from(tbDeviceInfo)
|
||||
.where(predicate).fetch();
|
||||
return MapstructUtils.convert(devices, DeviceInfo.class);
|
||||
|
@ -495,7 +491,8 @@ public class DeviceInfoDataImpl implements IDeviceInfoData, IJPACommData<DeviceI
|
|||
private Predicate buildQueryCondition(DeviceInfo device) {
|
||||
return PredicateBuilder.instance()
|
||||
.and(ObjectUtil.isNotNull(device.getId()), () -> tbDeviceInfo.id.eq(device.getId()))
|
||||
.and(ObjectUtil.isNotNull(device.getState().isOnline()), () -> tbDeviceInfo.state.eq(device.getState().isOnline() ? "online" : "offline"))
|
||||
.and(ObjectUtil.isNotNull(device.getDeviceName()), () -> tbDeviceInfo.deviceName.eq(device.getDeviceName()))
|
||||
.and(ObjectUtil.isNotNull(device.getState()), () -> tbDeviceInfo.state.eq(device.getState().isOnline() ? "online" : "offline"))
|
||||
.build();
|
||||
}
|
||||
|
||||
|
|
|
@ -17,10 +17,12 @@ import cc.iotkit.common.enums.ErrCode;
|
|||
import cc.iotkit.common.exception.BizException;
|
||||
import cc.iotkit.common.satoken.utils.AuthUtil;
|
||||
import cc.iotkit.common.satoken.utils.LoginHelper;
|
||||
import cc.iotkit.common.thing.ThingModelMessage;
|
||||
import cc.iotkit.common.utils.JsonUtils;
|
||||
import cc.iotkit.data.manager.ICategoryData;
|
||||
import cc.iotkit.data.manager.IDeviceInfoData;
|
||||
import cc.iotkit.data.manager.IUserInfoData;
|
||||
import cc.iotkit.manager.dto.bo.device.DeviceLogQueryBo;
|
||||
import cc.iotkit.manager.dto.bo.device.ServiceInvokeBo;
|
||||
import cc.iotkit.manager.dto.bo.device.SetDeviceServicePorpertyBo;
|
||||
import cc.iotkit.manager.dto.bo.ruleinfo.RuleInfoBo;
|
||||
|
@ -93,6 +95,12 @@ public class SpaceDeviceController {
|
|||
return null;
|
||||
}
|
||||
|
||||
@ApiOperation("设备日志")
|
||||
@PostMapping("/deviceLogs")
|
||||
public Paging<ThingModelMessage> logs(@Validated @RequestBody PageRequest<DeviceLogQueryBo> request) {
|
||||
return deviceServiceImpl.logs(request);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取用户收藏设备列表
|
||||
*/
|
||||
|
@ -152,6 +160,7 @@ public class SpaceDeviceController {
|
|||
.deviceId(sd.getDeviceId())
|
||||
.deviceName(device.getDeviceName())
|
||||
.name(sd.getName())
|
||||
.createTime(sd.getCreateTime())
|
||||
.spaceId(sd.getSpaceId())
|
||||
.spaceName(space.getName())
|
||||
.productKey(device.getProductKey())
|
||||
|
@ -192,6 +201,7 @@ public class SpaceDeviceController {
|
|||
List<FindDeviceVo> findDeviceVos = new ArrayList<>();
|
||||
DeviceInfo query=new DeviceInfo();
|
||||
query.setDeviceName(mac);
|
||||
query.setState(null);
|
||||
List<DeviceInfo> devices = deviceInfoData.findAllByCondition(query);
|
||||
if(devices == null){
|
||||
return findDeviceVos;
|
||||
|
|
|
@ -14,6 +14,7 @@ import lombok.Builder;
|
|||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
|
@ -85,6 +86,11 @@ public class SpaceDeviceVo {
|
|||
*/
|
||||
private String categoryName;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private Date createTime;
|
||||
|
||||
/**
|
||||
* 是否收藏
|
||||
*/
|
||||
|
|
Loading…
Reference in New Issue