| | |
| | | |
| | | import cn.hutool.core.collection.CollectionUtil; |
| | | import cn.hutool.core.util.ArrayUtil; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.github.pagehelper.PageHelper; |
| | | import com.sandu.common.domain.CommonPage; |
| | | import com.sandu.common.domain.ResponseVO; |
| | | import com.sandu.common.object.BaseConditionVO; |
| | | import com.sandu.common.security.annotation.AnonymousAccess; |
| | | import com.sandu.common.util.ResponseUtil; |
| | | import com.sandu.common.util.SpringContextHolder; |
| | | import com.sandu.ximon.admin.dto.DeviceStatus; |
| | | import com.sandu.ximon.admin.param.PoleBindParam; |
| | | import com.sandu.ximon.admin.param.PoleBindingParam; |
| | |
| | | import com.sandu.ximon.admin.service.MonitorService; |
| | | import com.sandu.ximon.admin.service.PoleService; |
| | | import com.sandu.ximon.dao.domain.Pole; |
| | | import com.sandu.ximon.dao.enums.MenuEnum; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.sql.Wrapper; |
| | | import java.util.List; |
| | | |
| | | /** |
| | |
| | | |
| | | @PostMapping("/list") |
| | | public ResponseVO<Object> listPole(BaseConditionVO baseConditionVO, @RequestBody PoleStatesParam param) { |
| | | if(!permissionConfig.check("路灯列表")){ |
| | | if (!permissionConfig.check(MenuEnum.POLE_LIST.getCode())) { |
| | | return ResponseUtil.fail("缺少对应用户权限"); |
| | | } |
| | | PageHelper.startPage(baseConditionVO.getPageNo(), baseConditionVO.getPageSize()); |
| | | List<Pole> results = poleService.queryAllStatesAndList(baseConditionVO.getPageNo(), baseConditionVO.getPageSize(),param); |
| | | List<Pole> results = poleService.queryAllStatesAndList(baseConditionVO.getPageNo(), baseConditionVO.getPageSize(), param); |
| | | CommonPage commonPage = CommonPage.restPage(results); |
| | | int size = results.size(); |
| | | commonPage.setTotal((long) size); |
| | |
| | | commonPage.setTotalPage(size / baseConditionVO.getPageSize()); |
| | | } |
| | | return ResponseUtil.success(commonPage); |
| | | // return ResponseUtil.success(poles); |
| | | // return ResponseUtil.success(poles); |
| | | } |
| | | |
| | | @GetMapping("/listPoleAndState") |
| | | public ResponseVO<Object> listPoleAndState(BaseConditionVO baseConditionVO, @RequestParam(value = "keyword", required = false) String keyword, |
| | | @RequestParam(value = "groupid", required = false) Long groupid) { |
| | | PageHelper.startPage(baseConditionVO.getPageNo(), baseConditionVO.getPageSize()); |
| | | List<Pole> poles = poleService.queryStatesAndList(baseConditionVO.getPageNo(), baseConditionVO.getPageSize(),keyword,groupid); |
| | | List<Pole> poles = poleService.queryStatesAndList(baseConditionVO.getPageNo(), baseConditionVO.getPageSize(), keyword, groupid); |
| | | return ResponseUtil.successPage(poles); |
| | | } |
| | | |
| | | /** |
| | | * 在线数量 |
| | | */ |
| | | @GetMapping("/online") |
| | | public ResponseVO<Object> online() { |
| | | return ResponseUtil.success(poleService.poleCount()); |
| | | } |
| | | |
| | | |
| | |
| | | public ResponseVO<Object> bindPole(@PathVariable Long poleId, @RequestBody @Validated PoleBindingParam param) { |
| | | boolean result = poleService.bindPole(poleId, param); |
| | | if (result) { |
| | | //设备类型,0路灯,1led屏幕,2充电桩,3大气监测,4水质监测,5ip音柱,6lcd广告机,7摄像头,8杆体倾测,9一键救助 |
| | | //设备类型,0路灯,1nove,2充电桩,3大气监测,4水质监测,5ip音柱,6lcd广告机,7摄像头,8杆体倾测,9一键救助, 10熙讯, 11农耕 |
| | | switch (param.getDeviceType()) { |
| | | case 0: |
| | | Pole pole = poleService.getById(poleId); |
| | | if (pole != null) { |
| | | pole.setPoleName(param.getDeviceName()); |
| | | pole.setDeviceCode(param.getDeviceCode()); |
| | | poleService.updateById(pole); |
| | | } |
| | | break; |
| | | case 1: |
| | | break; |
| | |
| | | break; |
| | | case 9: |
| | | break; |
| | | case 10: |
| | | break; |
| | | case 11: |
| | | break; |
| | | default: |
| | | break; |
| | | } |
| | |
| | | public ResponseVO<Object> unBindPole(@PathVariable Long poleId, @RequestBody @Validated PoleBindingParam param) { |
| | | boolean result = poleService.unBindPole(poleId, param.getDeviceCode()); |
| | | if (result) { |
| | | //设备类型,0路灯,1led屏幕,2充电桩,3大气监测,4水质监测,5ip音柱,6lcd广告机,7摄像头,8杆体倾测,9一键救助 |
| | | //设备类型,0路灯,1led屏幕,2充电桩,3大气监测,4水质监测,5ip音柱,6lcd广告机,7摄像头,8杆体倾测,9一键救助, 10熙讯, 11农耕 |
| | | switch (param.getDeviceType()) { |
| | | case 0: |
| | | //删除灯杆的devicescode |
| | | Pole pole = poleService.getOne(Wrappers.lambdaQuery(Pole.class).eq(Pole::getId, poleId)); |
| | | if (pole != null) { |
| | | poleService.updateDeviceCode(pole.getId()); |
| | | } |
| | | break; |
| | | case 1: |
| | | break; |
| | |
| | | case 8: |
| | | break; |
| | | case 9: |
| | | break; |
| | | case 10: |
| | | break; |
| | | case 11: |
| | | break; |
| | | default: |
| | | break; |
| | |
| | | /** |
| | | * 查找自己拥有的灯杆 |
| | | */ |
| | | @PostMapping("/getOwnerPole") |
| | | public ResponseVO<Object> getOwnerPole(BaseConditionVO baseConditionVO, @RequestParam(value = "keyword", required = false) String keyword) { |
| | | //public ResponseVO<Object> setMac() { |
| | | return ResponseUtil.success(poleService.getOwnerPole(baseConditionVO,keyword)); |
| | | // return ResponseUtil.success(poleService.setMac()); |
| | | @PostMapping("/getOwnerPole/{cilentId}") |
| | | public ResponseVO<Object> getOwnerPole(BaseConditionVO baseConditionVO, @RequestParam(value = "keyword", required = false) String keyword |
| | | , @PathVariable Long cilentId) { |
| | | List<Pole> results = poleService.getOwnerPole(baseConditionVO, keyword, cilentId); |
| | | // CommonPage commonPage = CommonPage.restPage(results); |
| | | // int size = results.size(); |
| | | // commonPage.setTotal((long) size); |
| | | // commonPage.setTotalPage(size / baseConditionVO.getPageSize() + 1); |
| | | // if (size % baseConditionVO.getPageSize() == 0) { |
| | | // commonPage.setTotalPage(size / baseConditionVO.getPageSize()); |
| | | // } |
| | | // return ResponseUtil.success(commonPage); |
| | | return ResponseUtil.success(results); |
| | | } |
| | | |
| | | /** |
| | | * 查看灯杆绑定的设备 |
| | | */ |
| | | @PostMapping("/getPoleBindDevice/{poleId}") |
| | | public ResponseVO<Object> getPoleBindDevice(@PathVariable Long poleId) { |
| | | return ResponseUtil.success(poleService.getBindByPoleId(poleId)); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 推送大气设备到诺瓦 |
| | | */ |
| | | @AnonymousAccess |
| | | @GetMapping("/pushAidDataToNova/{poleId}") |
| | | public ResponseVO<Object> pushAirDataToNova(@PathVariable Long poleId) { |
| | | return ResponseUtil.success(poleService.pushAirDataToNova(poleId)); |
| | | } |
| | | |
| | | /** |
| | | * 推送大气设备到熙讯 |
| | | */ |
| | | @AnonymousAccess |
| | | @GetMapping("/pushAirDataToXiXun/{poleId}") |
| | | public ResponseVO<Object> pushAirDataToXiXun(@PathVariable Long poleId) { |
| | | return ResponseUtil.success(poleService.pushAirDataToXiXun(poleId)); |
| | | } |
| | | |
| | | } |