| | |
| | | import com.sandu.common.execption.BusinessException; |
| | | import com.sandu.common.redis.RedisService; |
| | | import com.sandu.common.service.impl.BaseServiceImpl; |
| | | import com.sandu.ximon.admin.param.LampPostParam; |
| | | import com.sandu.ximon.admin.param.PoleBindingParam; |
| | | import com.sandu.ximon.admin.param.PoleParam; |
| | | import com.sandu.ximon.admin.redis.LightKey; |
| | | import com.sandu.ximon.admin.security.CountSet; |
| | | import com.sandu.ximon.dao.domain.LampPost; |
| | | import com.sandu.ximon.dao.domain.Pole; |
| | | import com.sandu.ximon.dao.mapper.ClientMapper; |
| | | import com.sandu.ximon.dao.mapper.LampPostMapper; |
| | | import com.sandu.ximon.dao.domain.PoleBinding; |
| | | import com.sandu.ximon.dao.enums.PoleBindingEnums; |
| | | import com.sandu.ximon.dao.mapper.PoleMapper; |
| | | import lombok.AllArgsConstructor; |
| | | import lombok.extern.slf4j.Slf4j; |
| | |
| | | @Slf4j |
| | | @AllArgsConstructor |
| | | public class PoleService extends BaseServiceImpl<PoleMapper, Pole> { |
| | | private final CountSet countSet; |
| | | private final LampCountService lampCountService; |
| | | private final ClientMapper clientMapper; |
| | | private final LampPostMapper lampPostMapper; |
| | | |
| | | private final RedisService redisService; |
| | | private final PoleBindingService poleBindingService; |
| | | |
| | | public boolean addPole(PoleParam param) { |
| | | Pole pole = new Pole(); |
| | |
| | | /** |
| | | * 删除灯杆 |
| | | */ |
| | | public boolean deletePole(Long poleId){ |
| | | public boolean deletePole(Long poleId) { |
| | | Pole pole = getById(poleId); |
| | | if (pole == null) { |
| | | throw new BusinessException("未找到该灯杆"); |
| | | } |
| | | return removeById(poleId); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | |
| | | return Long.parseLong(sb.toString()); |
| | | } |
| | | |
| | | /** |
| | | * 灯杆绑定设备 |
| | | * |
| | | * @param poleId 绑定灯杆id |
| | | * @param param 被绑定设备信息 |
| | | * @return 是否成功 |
| | | */ |
| | | public boolean bindPole(Long poleId, PoleBindingParam param) { |
| | | Pole pole = getById(poleId); |
| | | if (pole == null) { |
| | | throw new BusinessException("未找到该灯杆"); |
| | | } |
| | | return poleBindingService.bindPole( poleId, param); |
| | | } |
| | | } |