| | |
| | | package com.sandu.ximon.admin.controller; |
| | | |
| | | import com.sandu.common.domain.ResponseVO; |
| | | import com.sandu.common.object.BaseConditionVO; |
| | | import com.sandu.common.util.ResponseUtil; |
| | | import com.sandu.ximon.admin.param.C3ChargingParam; |
| | | import com.sandu.ximon.admin.param.LightPoleHeelingListParam; |
| | | import com.sandu.ximon.admin.param.LightPoleHeelingParam; |
| | | import com.sandu.ximon.admin.security.PermissionConfig; |
| | | import com.sandu.ximon.admin.service.LightPoleHeelingService; |
| | | import com.sandu.ximon.dao.domain.LightPoleHeeling; |
| | | import com.sandu.ximon.dao.enums.MenuEnum; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.PathVariable; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 灯杆倾斜 |
| | | * 灯杆倾斜警告列表 |
| | | */ |
| | | @RestController |
| | | @AllArgsConstructor |
| | | @RequestMapping("/v1/admin/LightPoleHeeling") |
| | | public class LightPoleHeelingController { |
| | | private final LightPoleHeelingService lightPoleHeelingService; |
| | | |
| | | @GetMapping |
| | | public ResponseVO<Object> listLightPoleHeeling() { |
| | | List<LightPoleHeeling> list = lightPoleHeelingService.listLightPoleHeeling(); |
| | | return ResponseUtil.successPage(list); |
| | | } |
| | | private PermissionConfig permissionConfig; |
| | | |
| | | /** |
| | | * 模糊查询 |
| | | * |
| | | * @return |
| | | */ |
| | | @GetMapping("/listLightPoleHeelingByKeyword/{keyword}") |
| | | public ResponseVO<Object> listLightPoleHeelingByKeyword(@PathVariable String keyword) { |
| | | List<LightPoleHeeling> list = lightPoleHeelingService.listLightPoleHeelingByKeyword(keyword); |
| | | @PostMapping("/listLightPoleHeelingByKeyword") |
| | | public ResponseVO<Object> listLightPoleHeelingByKeyword(BaseConditionVO baseConditionVO |
| | | , @RequestBody(required = false) LightPoleHeelingListParam lightPoleHeelingListParam) { |
| | | if (!permissionConfig.check(MenuEnum.LIGHT_POLE_HEELING_LIST.getCode())) { |
| | | return ResponseUtil.fail("缺少对应用户权限"); |
| | | } |
| | | List<LightPoleHeeling> list = lightPoleHeelingService.listLightPoleHeelingByKeyword(baseConditionVO, lightPoleHeelingListParam); |
| | | return ResponseUtil.successPage(list); |
| | | } |
| | | |
| | | /** |
| | | * 灯杆倾斜心跳包 |
| | | * |
| | | * @return |
| | | */ |
| | | @PostMapping("/LightPoleHeelingHeartbeatPackage") |
| | | public ResponseVO<Object> LightPoleHeelingHeartbeatPackage(@RequestBody @Validated LightPoleHeelingParam lightPoleHeelingParam) { |
| | | if (!permissionConfig.check(MenuEnum.LIGHT_POLE_HEELING_HEARTBEAT_PACKAGE.getCode())) { |
| | | return ResponseUtil.fail("缺少对应用户权限"); |
| | | } |
| | | return ResponseUtil.success(lightPoleHeelingService.LightPoleHeelingHeartbeatPackage(lightPoleHeelingParam.getDeviceName())); |
| | | |
| | | } |
| | | |
| | | /** |
| | | * 查询心跳包间隔时间 |
| | | * |
| | | * @return |
| | | */ |
| | | @PostMapping("/QueryIntervalTime") |
| | | public ResponseVO<Object> QueryIntervalTime(@RequestBody @Validated LightPoleHeelingParam lightPoleHeelingParam) { |
| | | if (!permissionConfig.check(MenuEnum.LIGHT_POLE_HEELING_HEARTBEAT_PACKAGE_QUERY_TIME.getCode())) { |
| | | return ResponseUtil.fail("缺少对应用户权限"); |
| | | } |
| | | return ResponseUtil.success(lightPoleHeelingService.QueryIntervalTime(lightPoleHeelingParam.getDeviceName())); |
| | | |
| | | } |
| | | |
| | | /** |
| | | * 灯杆倾斜软重启 |
| | | * |
| | | * @return |
| | | */ |
| | | @PostMapping("/RestartLightPoleHeeling") |
| | | public ResponseVO<Object> RestartLightPoleHeeling(@RequestBody @Validated LightPoleHeelingParam lightPoleHeelingParam) { |
| | | if (!permissionConfig.check(MenuEnum.LIGHT_POLE_HEELING_RESTART.getCode())) { |
| | | return ResponseUtil.fail("缺少对应用户权限"); |
| | | } |
| | | String result = lightPoleHeelingService.RestartLightPoleHeeling(lightPoleHeelingParam.getDeviceName()); |
| | | if ("操作成功".equals(result)) { |
| | | return ResponseUtil.success(result); |
| | | } else { |
| | | return ResponseUtil.fail(result); |
| | | } |
| | | |
| | | } |
| | | |
| | | /** |
| | | * 设置心跳包间隔时间(秒) |
| | | */ |
| | | @PostMapping("/SetHeartbeatPacketTime") |
| | | public ResponseVO<Object> SetHeartbeatPacketTime(@RequestBody @Validated LightPoleHeelingParam lightPoleHeelingParam) { |
| | | if (!permissionConfig.check(MenuEnum.LIGHT_POLE_HEELING_HEARTBEAT_PACKAGE_SET_TIME.getCode())) { |
| | | return ResponseUtil.fail("缺少对应用户权限"); |
| | | } |
| | | String result = lightPoleHeelingService.SetHeartbeatPacketTime(lightPoleHeelingParam.getDeviceName(), lightPoleHeelingParam.getTime()); |
| | | if ("操作成功".equals(result)) { |
| | | return ResponseUtil.success(result); |
| | | } else { |
| | | return ResponseUtil.fail(result); |
| | | } |
| | | |
| | | } |
| | | |
| | | /** |
| | | * 设置传感器为初始状态 |
| | | */ |
| | | @PostMapping("/SetSensorState") |
| | | public ResponseVO<Object> SetSensorState(@RequestBody @Validated LightPoleHeelingParam lightPoleHeelingParam) { |
| | | if (!permissionConfig.check(MenuEnum.LIGHT_POLE_HEELING_SET_SENSORSTATE.getCode())) { |
| | | return ResponseUtil.fail("缺少对应用户权限"); |
| | | } |
| | | String result = lightPoleHeelingService.SetSensorState(lightPoleHeelingParam.getDeviceName()); |
| | | if ("操作成功".equals(result)) { |
| | | return ResponseUtil.success(result); |
| | | } else { |
| | | return ResponseUtil.fail(result); |
| | | } |
| | | } |
| | | } |