| | |
| | | import com.sandu.common.object.BaseConditionVO; |
| | | import com.sandu.common.util.ResponseUtil; |
| | | 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.param.PoleParam; |
| | | import com.sandu.ximon.admin.service.AirEquipmentService; |
| | | import com.sandu.ximon.admin.service.MonitorService; |
| | | import com.sandu.ximon.admin.service.PoleService; |
| | | import com.sandu.ximon.dao.domain.Pole; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.validation.constraints.NotEmpty; |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 灯杆模块以及设置分组到对应灯杆 |
| | |
| | | public class PoleController { |
| | | |
| | | private final PoleService poleService; |
| | | private MonitorService monitorService; |
| | | private AirEquipmentService airEquipmentService; |
| | | |
| | | @PostMapping("/add") |
| | | public ResponseVO<Object> addPole(@RequestBody @Validated PoleParam param) { |
| | |
| | | return ResponseUtil.successPage(list); |
| | | } |
| | | |
| | | @GetMapping("listPoleAndState") |
| | | @GetMapping("/listPoleAndState") |
| | | public ResponseVO<Object> listPoleAndState(BaseConditionVO baseConditionVO, @RequestParam(value = "keyword", required = false) String keyword) { |
| | | PageHelper.startPage(baseConditionVO.getPageNo(), baseConditionVO.getPageSize()); |
| | | |
| | |
| | | */ |
| | | @PostMapping("/setMac/{baseMac}") |
| | | public ResponseVO<Object> setMac(@PathVariable String baseMac) { |
| | | //public ResponseVO<Object> setMac() { |
| | | //public ResponseVO<Object> setMac() { |
| | | return ResponseUtil.success(poleService.setMac(baseMac)); |
| | | // return ResponseUtil.success(poleService.setMac()); |
| | | // return ResponseUtil.success(poleService.setMac()); |
| | | } |
| | | |
| | | /** |
| | |
| | | return ResponseUtil.success(poleService.poleReset(poleId)); |
| | | } |
| | | |
| | | |
| | | //TODO 设备的绑定解绑都要单独重新处理 |
| | | /** |
| | | * 灯杆绑定设备 |
| | | */ |
| | |
| | | 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一键救助 |
| | | switch (param.getDeviceType()) { |
| | | case 0: |
| | | break; |
| | | case 1: |
| | | break; |
| | | case 2: |
| | | break; |
| | | case 3: |
| | | break; |
| | | case 4: |
| | | break; |
| | | case 5: |
| | | break; |
| | | case 6: |
| | | break; |
| | | case 7: |
| | | monitorService.updateBingdingState(true, param.getDeviceCode()); |
| | | break; |
| | | case 8: |
| | | break; |
| | | case 9: |
| | | break; |
| | | default: |
| | | break; |
| | | } |
| | | |
| | | return ResponseUtil.success("绑定成功"); |
| | | } else { |
| | | return ResponseUtil.fail("绑定失败"); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 灯杆绑定设备 |
| | | */ |
| | | @PostMapping("/unBind/{poleId}") |
| | | public ResponseVO<Object> unBindPole(@PathVariable Long poleId, @RequestBody @Validated PoleBindingParam param) { |
| | | boolean result = poleService.unBindPole(param.getDeviceCode()); |
| | | if (result) { |
| | | //设备类型,0路灯,1led屏幕,2充电桩,3大气监测,4水质监测,5ip音柱,6lcd广告机,7摄像头,8杆体倾测,9一键救助 |
| | | switch (param.getDeviceType()) { |
| | | case 0: |
| | | break; |
| | | case 1: |
| | | break; |
| | | case 2: |
| | | break; |
| | | case 3: |
| | | break; |
| | | case 4: |
| | | break; |
| | | case 5: |
| | | break; |
| | | case 6: |
| | | break; |
| | | case 7: |
| | | monitorService.updateBingdingState(false, param.getDeviceCode()); |
| | | break; |
| | | case 8: |
| | | break; |
| | | case 9: |
| | | break; |
| | | default: |
| | | break; |
| | | } |
| | | |
| | | return ResponseUtil.success("解绑成功"); |
| | | } else { |
| | | return ResponseUtil.fail("解绑失败"); |
| | | } |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | @PostMapping("/ClientBindingPole") |
| | | public ResponseVO<Object> ClientBindingPole(@RequestBody long clientId, @RequestBody int[] poleIds) { |
| | | |
| | | return ResponseUtil.success(poleService.ClientBindingPole(clientId, poleIds));////////////// |
| | | public ResponseVO<Object> ClientBindingPole(@RequestBody PoleBindParam param) { |
| | | return ResponseUtil.success(poleService.ClientBindingPole(param.getClientId(), param.getPoleIds()));////////////// |
| | | } |
| | | |
| | | |