New file |
| | |
| | | package com.dy.pipIrrWechat.mqtt; |
| | | |
| | | import com.dy.common.aop.SsoAop; |
| | | import com.dy.common.webUtil.BaseResponse; |
| | | import com.dy.common.webUtil.BaseResponseUtils; |
| | | import com.dy.common.webUtil.ResultCodeMsg; |
| | | import com.dy.pipIrrGlobal.voPr.VoMqttSimple; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import io.swagger.v3.oas.annotations.media.Content; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import io.swagger.v3.oas.annotations.responses.ApiResponse; |
| | | import io.swagger.v3.oas.annotations.responses.ApiResponses; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | | import lombok.RequiredArgsConstructor; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.http.MediaType; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @Author: liurunyu |
| | | * @Date: 2025/8/13 16:41 |
| | | * @Description |
| | | */ |
| | | @Slf4j |
| | | @Tag(name = "åä¸çæºç»¼åç«", description = "åä¸çæºç»¼åç«ç®¡ç") |
| | | @RestController |
| | | @RequestMapping(path = "mqtt") |
| | | @RequiredArgsConstructor |
| | | public class MqttCtrl { |
| | | |
| | | private MqttSv sv ; |
| | | |
| | | @Autowired |
| | | public void setSv(MqttSv sv) { |
| | | this.sv = sv; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 客æ·ç«¯è¯·æ±å¾å°æææ°´è¥æºãæ°è±¡ç«ã墿
ç«ç®åä¿¡æ¯ |
| | | * @return æææ°´è¥æºãæ°è±¡ç«ã墿
ç«ç®åä¿¡æ¯ |
| | | */ |
| | | @Operation(summary = "è·å¾å
¨é¨æ°´è¥æºãæ°è±¡ç«ã墿
ç«ç®åä¿¡æ¯", description = "è¿åå
¨é¨æ°´è¥æºãæ°è±¡ç«ã墿
ç«ç®åä¿¡æ¯") |
| | | @ApiResponses(value = { |
| | | @ApiResponse( |
| | | responseCode = ResultCodeMsg.RsCode.SUCCESS_CODE, |
| | | description = "è¿åå
¨é¨æ°´è¥æºãæ°è±¡ç«ã墿
ç«ç®åä¿¡æ¯æ°æ®ï¼BaseResponse.content:TypesVo[{}]ï¼", |
| | | content = {@Content(mediaType = MediaType.APPLICATION_JSON_VALUE, |
| | | schema = @Schema(implementation = MqttVo.class))} |
| | | ) |
| | | }) |
| | | @GetMapping(path = "allSimple") |
| | | @SsoAop() |
| | | public BaseResponse<MqttVo> allSimple() { |
| | | try { |
| | | MqttVo reVo = new MqttVo() ; |
| | | reVo.manures = this.sv.allManureSimple() ; |
| | | reVo.soils = this.sv.allSoilSimple() ; |
| | | reVo.weathers = this.sv.allWeatherSimple() ; |
| | | return BaseResponseUtils.buildSuccess(reVo); |
| | | } catch (Exception e) { |
| | | log.error("æ¥è¯¢å
¨é¨æ°´è¥æºãæ°è±¡ç«ã墿
ç«ç®åä¿¡æ¯å¼å¸¸", e); |
| | | return BaseResponseUtils.buildException(e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 客æ·ç«¯è¯·æ±å¾å°æææ°´è¥æºç®åä¿¡æ¯ |
| | | * @return æææ°´è¥æºç®åä¿¡æ¯ |
| | | */ |
| | | @Operation(summary = "è·å¾å
¨é¨æ°´è¥æºç®åä¿¡æ¯", description = "è¿åå
¨é¨æ°´è¥æºç®åä¿¡æ¯") |
| | | @ApiResponses(value = { |
| | | @ApiResponse( |
| | | responseCode = ResultCodeMsg.RsCode.SUCCESS_CODE, |
| | | description = "è¿åå
¨é¨æ°´è¥æºãæ°è±¡ç«ã墿
ç«ç®åä¿¡æ¯æ°æ®ï¼BaseResponse.content:TypesVo[{}]ï¼", |
| | | content = {@Content(mediaType = MediaType.APPLICATION_JSON_VALUE, |
| | | schema = @Schema(implementation = VoMqttSimple.class))} |
| | | ) |
| | | }) |
| | | @GetMapping(path = "allManureSimple") |
| | | @SsoAop() |
| | | public BaseResponse<List<VoMqttSimple>> allManureSimple() { |
| | | try { |
| | | List<VoMqttSimple> list = this.sv.allManureSimple() ; |
| | | return BaseResponseUtils.buildSuccess(list); |
| | | } catch (Exception e) { |
| | | log.error("æ¥è¯¢å
¨é¨æ°´è¥æºç®åä¿¡æ¯å¼å¸¸", e); |
| | | return BaseResponseUtils.buildException(e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 客æ·ç«¯è¯·æ±å¾å°ææå¢æ
ç«ç®åä¿¡æ¯ |
| | | * @return ææå¢æ
ç«ç®åä¿¡æ¯ |
| | | */ |
| | | @Operation(summary = "è·å¾å
¨é¨å¢æ
ç«ç®åä¿¡æ¯", description = "è¿åå
¨é¨å¢æ
ç«ç®åä¿¡æ¯") |
| | | @ApiResponses(value = { |
| | | @ApiResponse( |
| | | responseCode = ResultCodeMsg.RsCode.SUCCESS_CODE, |
| | | description = "è¿åå
¨é¨å¢æ
ç«ç®åä¿¡æ¯æ°æ®ï¼BaseResponse.content:TypesVo[{}]ï¼", |
| | | content = {@Content(mediaType = MediaType.APPLICATION_JSON_VALUE, |
| | | schema = @Schema(implementation = VoMqttSimple.class))} |
| | | ) |
| | | }) |
| | | @GetMapping(path = "allSoilSimple") |
| | | @SsoAop() |
| | | public BaseResponse<List<VoMqttSimple>> allSoilSimple() { |
| | | try { |
| | | List<VoMqttSimple> list = this.sv.allSoilSimple() ; |
| | | return BaseResponseUtils.buildSuccess(list); |
| | | } catch (Exception e) { |
| | | log.error("æ¥è¯¢å
¨é¨å¢æ
ç«ç®åä¿¡æ¯å¼å¸¸", e); |
| | | return BaseResponseUtils.buildException(e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 客æ·ç«¯è¯·æ±å¾å°æææ°è±¡ç«ç®åä¿¡æ¯ |
| | | * @return æææ°è±¡ç«ç®åä¿¡æ¯ |
| | | */ |
| | | @Operation(summary = "è·å¾å
¨é¨æ°è±¡ç«ç®åä¿¡æ¯", description = "è¿åå
¨é¨æ°è±¡ç«ç®åä¿¡æ¯") |
| | | @ApiResponses(value = { |
| | | @ApiResponse( |
| | | responseCode = ResultCodeMsg.RsCode.SUCCESS_CODE, |
| | | description = "è¿åå
¨é¨æ°è±¡ç«ç®åä¿¡æ¯æ°æ®ï¼BaseResponse.content:TypesVo[{}]ï¼", |
| | | content = {@Content(mediaType = MediaType.APPLICATION_JSON_VALUE, |
| | | schema = @Schema(implementation = MqttVo.class))} |
| | | ) |
| | | }) |
| | | @GetMapping(path = "allWeatherSimple") |
| | | @SsoAop() |
| | | public BaseResponse<List<VoMqttSimple>> allWeatherSimple() { |
| | | try { |
| | | List<VoMqttSimple> list = this.sv.allWeatherSimple() ; |
| | | return BaseResponseUtils.buildSuccess(list); |
| | | } catch (Exception e) { |
| | | log.error("æ¥è¯¢å
¨é¨æ°è±¡ç«ç®åä¿¡æ¯å¼å¸¸", e); |
| | | return BaseResponseUtils.buildException(e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | } |