| | |
| | | package com.sandu.ximon.admin.service; |
| | | |
| | | import com.github.pagehelper.PageHelper; |
| | | import com.sandu.common.object.BaseConditionVO; |
| | | import com.sandu.common.service.impl.BaseServiceImpl; |
| | | import com.sandu.ximon.admin.manager.iot.rrpc.enums.LightPoleHeelingEnum; |
| | | import com.sandu.ximon.admin.security.SecurityUtils; |
| | | import com.sandu.ximon.admin.utils.RedisUtils; |
| | | import com.sandu.ximon.dao.bo.LightPoleHeelingEquipmentBo; |
| | | import com.sandu.ximon.dao.domain.LightPoleHeelingEquipment; |
| | | import com.sandu.ximon.dao.mapper.LightPoleHeelingEquipmentMapper; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author ZZQ |
| | | * @date 2022/4/13 16:52 |
| | | */ |
| | | @Service |
| | | @AllArgsConstructor |
| | | public class LightPoleHeelingEquipmentService extends BaseServiceImpl<LightPoleHeelingEquipmentMapper, LightPoleHeelingEquipment> { |
| | | private LightPoleHeelingEquipmentMapper lightPoleHeelingEquipmentMapper; |
| | | |
| | | /** |
| | | * 添加灯杆倾斜到设备表 |
| | | * |
| | | * @param bean |
| | | * @return |
| | | */ |
| | | public boolean addLightPoleHeelingEquipment(LightPoleHeelingEquipment bean) { |
| | | //存储设备状态到缓存 |
| | | RedisUtils.getBean().set(LightPoleHeelingEnum.LIGHT_POLE_HEELING_STATE.getCode() + bean.getMac() |
| | | , 1, 300L); |
| | | return save(bean); |
| | | } |
| | | |
| | | /** |
| | | * 灯杆倾斜设备列表 |
| | | * |
| | | * @return |
| | | */ |
| | | public List<LightPoleHeelingEquipmentBo> LightPoleHeelingEquipmentList(BaseConditionVO baseConditionVO) { |
| | | PageHelper.startPage(baseConditionVO.getPageNo(), baseConditionVO.getPageSize()); |
| | | //为空是超管 |
| | | List<LightPoleHeelingEquipmentBo> lightPoleHeelingEquipmentBos; |
| | | if (SecurityUtils.getClientId() == null) { |
| | | lightPoleHeelingEquipmentBos = lightPoleHeelingEquipmentMapper.LightPoleHeelingEquipmentList(null); |
| | | } else { |
| | | lightPoleHeelingEquipmentBos = lightPoleHeelingEquipmentMapper.LightPoleHeelingEquipmentList(SecurityUtils.getUserId()); |
| | | } |
| | | return lightPoleHeelingEquipmentBos; |
| | | } |
| | | |
| | | /** |
| | | * 灯杆倾斜设备列表(用于首页数据统计) |
| | | * |
| | | * @return |
| | | */ |
| | | public List<LightPoleHeelingEquipmentBo> LightPoleHeelingEquipmentListOnHome() { |
| | | //为空是超管 |
| | | List<LightPoleHeelingEquipmentBo> lightPoleHeelingEquipmentBos; |
| | | if (SecurityUtils.getClientId() == null) { |
| | | lightPoleHeelingEquipmentBos = lightPoleHeelingEquipmentMapper.LightPoleHeelingEquipmentList(null); |
| | | } else { |
| | | lightPoleHeelingEquipmentBos = lightPoleHeelingEquipmentMapper.LightPoleHeelingEquipmentList(SecurityUtils.getUserId()); |
| | | } |
| | | return lightPoleHeelingEquipmentBos; |
| | | } |
| | | } |