| | |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.github.pagehelper.PageHelper; |
| | | import com.sandu.common.execption.BusinessException; |
| | | import com.sandu.common.object.BaseConditionVO; |
| | | import com.sandu.common.service.impl.BaseServiceImpl; |
| | | import com.sandu.ximon.admin.manager.iot.frame.A5Frame; |
| | | import com.sandu.ximon.admin.manager.iot.frame.inner.report.*; |
| | |
| | | import com.sandu.ximon.admin.manager.iot.rrpc.dto.CommonFrame; |
| | | import com.sandu.ximon.admin.manager.iot.rrpc.enums.A5OrderEnum; |
| | | import com.sandu.ximon.admin.manager.iot.rrpc.mainboard.MainBoardInvokeSyncService; |
| | | import com.sandu.ximon.admin.param.LightPoleHeelingListParam; |
| | | import com.sandu.ximon.dao.domain.LightPoleHeeling; |
| | | import com.sandu.ximon.dao.mapper.LightPoleHeelingMapper; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Service |
| | | @AllArgsConstructor |
| | | public class LightPoleHeelingService extends BaseServiceImpl<LightPoleHeelingMapper, LightPoleHeeling> { |
| | | private LightPoleHeelingMapper lightPoleHeelingMapper; |
| | | |
| | | /** |
| | | * 查询全部灯杆倾侧告警 |
| | | */ |
| | |
| | | /** |
| | | * 模糊查询 |
| | | */ |
| | | public List<LightPoleHeeling> listLightPoleHeelingByKeyword(String keyword) { |
| | | |
| | | LambdaQueryWrapper<LightPoleHeeling> wrapper = Wrappers.lambdaQuery(LightPoleHeeling.class); |
| | | if (keyword != null) { |
| | | wrapper.like(LightPoleHeeling::getLightPoleName, keyword).or( |
| | | lambdaQueryWrapper -> { |
| | | lambdaQueryWrapper.like(LightPoleHeeling::getLightPoleId, keyword); |
| | | } |
| | | ).or( |
| | | lambdaQueryWrapper -> { |
| | | lambdaQueryWrapper.like(LightPoleHeeling::getWarningNumber, keyword); |
| | | } |
| | | ); |
| | | public List<LightPoleHeeling> listLightPoleHeelingByKeyword(BaseConditionVO baseConditionVO, LightPoleHeelingListParam lightPoleHeelingListParam) { |
| | | PageHelper.startPage(baseConditionVO.getPageNo(), baseConditionVO.getPageSize()); |
| | | if (lightPoleHeelingListParam == null) { |
| | | lightPoleHeelingListParam = new LightPoleHeelingListParam(); |
| | | } |
| | | List<LightPoleHeeling> forHelpList = list(wrapper); |
| | | return forHelpList; |
| | | List<LightPoleHeeling> lightPoleHeelings |
| | | = lightPoleHeelingMapper.listLightPoleHeeling(lightPoleHeelingListParam.getKeyword(), lightPoleHeelingListParam.getProcessingState()); |
| | | return lightPoleHeelings; |
| | | } |
| | | |
| | | /** |
| | |
| | | |
| | | A5LightPoleHeelingHeartbeatReportInnerFrame heartbeatReportInnerFrame |
| | | = new A5LightPoleHeelingHeartbeatReportInnerFrame().transformFrame(commonFrame.getPayload()); |
| | | |
| | | if (heartbeatReportInnerFrame.isValidate()) { |
| | | |
| | | //灯杆倾斜心跳包保存数据库 |
| | | saveLightPoleHeelingHeartbeat(deviceName, heartbeatReportInnerFrame.getHeartBeatDataPackage()); |
| | | |
| | | return heartbeatReportInnerFrame.getHeartBeatDataPackage(); |
| | | } else { |
| | | throw new BusinessException("数据校验错误,请重新请求"); |
| | |
| | | throw new BusinessException("数据校验错误,请重新请求"); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 保存心跳包数据 |
| | | * |
| | | * @param deviceName |
| | | * @param heartBeatDataPackage |
| | | * @return |
| | | */ |
| | | public boolean saveLightPoleHeelingHeartbeat(String deviceName, A5LightPoleHeelingHeartbeatReportInnerFrame.HeartBeatDataPackage heartBeatDataPackage) { |
| | | |
| | | LightPoleHeeling lightPoleHeeling = new LightPoleHeeling(); |
| | | lightPoleHeeling.setMac(deviceName); |
| | | lightPoleHeeling.setTheXAxis(heartBeatDataPackage.getTheXAxis()); |
| | | lightPoleHeeling.setTheYAxis(heartBeatDataPackage.getTheYAxis()); |
| | | lightPoleHeeling.setTheZAxis(heartBeatDataPackage.getTheZAxis()); |
| | | if (Math.abs(heartBeatDataPackage.getTheXAxis()) >= 10 || Math.abs(heartBeatDataPackage.getTheYAxis()) >= 10) { |
| | | lightPoleHeeling.setWarningLevel("一级警告"); |
| | | } else if ((Math.abs(heartBeatDataPackage.getTheXAxis()) >= 5 && Math.abs(heartBeatDataPackage.getTheXAxis()) < 10) |
| | | || (Math.abs(heartBeatDataPackage.getTheYAxis()) >= 5 && Math.abs(heartBeatDataPackage.getTheYAxis()) < 10)) { |
| | | lightPoleHeeling.setWarningLevel("二级警告"); |
| | | } else { |
| | | lightPoleHeeling.setWarningLevel("正常"); |
| | | } |
| | | |
| | | return save(lightPoleHeeling); |
| | | } |
| | | } |