|
@@ -1,24 +1,14 @@
|
|
|
package com.zy.bms.service.impl;
|
|
|
|
|
|
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
|
|
-import com.zy.bms.common.Constant;
|
|
|
+import com.zy.bms.common.enums.DeviceType;
|
|
|
import com.zy.bms.entity.DeviceBase;
|
|
|
-import com.zy.bms.entity.lp.LpInfoState;
|
|
|
-import com.zy.bms.entity.ubi.UbiInfoState;
|
|
|
import com.zy.bms.mapper.DeviceBaseMapper;
|
|
|
-import com.zy.bms.pojo.vo.DeviceWxListVo;
|
|
|
import com.zy.bms.service.IDeviceBaseService;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
-import com.zy.bms.service.lp.ILpInfoStateService;
|
|
|
-import com.zy.bms.service.ubi.IUbiInfoStateService;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
-import javax.annotation.Resource;
|
|
|
-import java.util.ArrayList;
|
|
|
import java.util.List;
|
|
|
-import java.util.Map;
|
|
|
-import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
|
* 设备静态信息 服务实现类
|
|
@@ -29,11 +19,10 @@ import java.util.stream.Collectors;
|
|
|
@Service
|
|
|
public class DeviceBaseServiceImpl extends ServiceImpl<DeviceBaseMapper, DeviceBase> implements IDeviceBaseService {
|
|
|
|
|
|
- @Resource
|
|
|
- private IUbiInfoStateService ubiInfoStateService;
|
|
|
-
|
|
|
- @Resource
|
|
|
- private ILpInfoStateService lpInfoStateService;
|
|
|
+ @Override
|
|
|
+ public List<String> listOpenNumByGroupId(String groupId, DeviceType type) {
|
|
|
+ return baseMapper.listOpenNumByGroupId(groupId, type.value);
|
|
|
+ }
|
|
|
|
|
|
@Override
|
|
|
public void updateRemark(DeviceBase deviceBase) {
|
|
@@ -43,42 +32,4 @@ public class DeviceBaseServiceImpl extends ServiceImpl<DeviceBaseMapper, DeviceB
|
|
|
this.update(updateWrapper);
|
|
|
}
|
|
|
|
|
|
- @Override
|
|
|
- public List listByGroupIdWx(String groupId) {
|
|
|
- String type = baseMapper.getTypeByGroupId(groupId);
|
|
|
- if (type == null) return null;
|
|
|
- //普适型设备
|
|
|
- if (type.equals(Constant.DEVICE_TYPE.UBI)) {
|
|
|
- return ubiInfoStateService.listByGroupId(groupId);
|
|
|
- }
|
|
|
- //路牌设备
|
|
|
- if (type.equals(Constant.DEVICE_TYPE.LP)) {
|
|
|
- return lpInfoStateService.listByGroupId(groupId);
|
|
|
- }
|
|
|
- return null;
|
|
|
- }
|
|
|
-
|
|
|
- @Override
|
|
|
- public Map<String, List<DeviceWxListVo>> listByUserIdWx(Integer userId) {
|
|
|
- List<DeviceWxListVo> result = new ArrayList<>();
|
|
|
- //路牌
|
|
|
- List<DeviceWxListVo> lpList = lpInfoStateService.listByUserId(userId);
|
|
|
- if (lpList != null) result.addAll(lpList);
|
|
|
- //普适型
|
|
|
- List<DeviceWxListVo> ubiList = ubiInfoStateService.listByUserId(userId);
|
|
|
- if (ubiList != null) result.addAll(ubiList);
|
|
|
- return result.isEmpty() ? null : result.stream().collect(Collectors.groupingBy(DeviceWxListVo::getGroupId));
|
|
|
- }
|
|
|
-
|
|
|
- @Override
|
|
|
- public Object getDetailWx(String openNum) {
|
|
|
- String type = baseMapper.selectOne(new QueryWrapper<DeviceBase>().eq("open_num", openNum)).getType();
|
|
|
- if (type.equals(Constant.DEVICE_TYPE.UBI)) {
|
|
|
- return ubiInfoStateService.getOne(new QueryWrapper<UbiInfoState>().eq("open_num", openNum));
|
|
|
- }
|
|
|
- if (type.equals(Constant.DEVICE_TYPE.LP)) {
|
|
|
- return lpInfoStateService.getOne(new QueryWrapper<LpInfoState>().eq("open_num", openNum));
|
|
|
- }
|
|
|
- return null;
|
|
|
- }
|
|
|
}
|