| | |
| | | |
| | | import com.dy.pipIrrGlobal.pojoRm.RmSoilDay; |
| | | import com.dy.pipIrrGlobal.pojoRm.RmSoilLast; |
| | | import com.dy.pipIrrGlobal.voRm.VoSoil; |
| | | import com.dy.pipIrrGlobal.voRm.VoSoilDay; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @Author: liurunyu |
| | |
| | | RmSoilDay selectByPrimaryKey(Long id); |
| | | |
| | | List<RmSoilDay> selectRmSoilDay(@Param("stSoilId") Long stSoilId, @Param("ymd") Integer ymd) ; |
| | | /** |
| | | * 根据指定条件查询记录 |
| | | * @param soilId |
| | | * @return |
| | | */ |
| | | List<VoSoilDay> selectOneBySoilId(@Param("soilId") Long soilId, @Param("ymd") Integer ymd); |
| | | |
| | | /** |
| | | * 根据指定条件查询记录数量 |
| | | * @param params |
| | | * @return |
| | | */ |
| | | Long selectCount(Map<?, ?> params); |
| | | |
| | | /** |
| | | * 根据指定条件查询记录 |
| | | * @param params |
| | | * @return |
| | | */ |
| | | List<VoSoilDay> selectSome(Map<?, ?> params); |
| | | |
| | | |
| | | int updateByPrimaryKeySelective(RmSoilDay record); |
| | | |
New file |
| | |
| | | package com.dy.pipIrrGlobal.voRm; |
| | | |
| | | import com.alibaba.fastjson2.annotation.JSONField; |
| | | import com.alibaba.fastjson2.writer.ObjectWriterImplToString; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * @Author: liurunyu |
| | | * @Date: 2025/6/26 9:03 |
| | | * @Description |
| | | */ |
| | | @Data |
| | | public class VoSoilDay { |
| | | public static final long serialVersionUID = 202506261020001L; |
| | | |
| | | /** |
| | | * 记录ID |
| | | */ |
| | | @JSONField(serializeUsing= ObjectWriterImplToString.class) |
| | | public Long id; |
| | | |
| | | /** |
| | | * 墒情站ID |
| | | */ |
| | | @Schema(description = "墒情站ID", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | @JSONField(serializeUsing= ObjectWriterImplToString.class) |
| | | public Long soilId; |
| | | |
| | | /** |
| | | * 墒情站名称 |
| | | */ |
| | | @Schema(description = "墒情站名称", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | public Long soilName; |
| | | |
| | | |
| | | /** |
| | | * 数据日期(年月日) |
| | | */ |
| | | @Schema(description = "数据日期", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | @JsonFormat(pattern = "yyyy-MM-dd") |
| | | public Date dt; |
| | | |
| | | |
| | | /** |
| | | * 日平均土壤湿度1 |
| | | */ |
| | | @Schema(description = "日平均土壤湿度1", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | @JsonFormat(shape = JsonFormat.Shape.NUMBER_FLOAT, pattern="0.00" ) |
| | | public Double soilHumidity1; |
| | | |
| | | /** |
| | | * 日平均土壤湿度2 |
| | | */ |
| | | @Schema(description = "日平均土壤湿度2", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | @JsonFormat(shape = JsonFormat.Shape.NUMBER_FLOAT, pattern="0.00" ) |
| | | public Double soilHumidity2; |
| | | |
| | | /** |
| | | * 日平均土壤湿度3 |
| | | */ |
| | | @Schema(description = "日平均土壤湿度3", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | @JsonFormat(shape = JsonFormat.Shape.NUMBER_FLOAT, pattern="0.00" ) |
| | | public Double soilHumidity3; |
| | | |
| | | /** |
| | | * 日平均土壤湿度4 |
| | | */ |
| | | @Schema(description = "日平均土壤湿度4", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | @JsonFormat(shape = JsonFormat.Shape.NUMBER_FLOAT, pattern="0.00" ) |
| | | public Double soilHumidity4; |
| | | |
| | | /** |
| | | * 日平均土壤湿度5 |
| | | */ |
| | | @Schema(description = "日平均土壤湿度5", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | @JsonFormat(shape = JsonFormat.Shape.NUMBER_FLOAT, pattern="0.00" ) |
| | | public Double soilHumidity5; |
| | | |
| | | /** |
| | | * 日平均土壤温度1 |
| | | */ |
| | | @Schema(description = "日平均土壤温度1", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | @JsonFormat(shape = JsonFormat.Shape.NUMBER_FLOAT, pattern="0.00" ) |
| | | public Double soilTemperature1; |
| | | |
| | | /** |
| | | * 日平均土壤温度2 |
| | | */ |
| | | @Schema(description = "日平均土壤温度2", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | @JsonFormat(shape = JsonFormat.Shape.NUMBER_FLOAT, pattern="0.00" ) |
| | | public Double soilTemperature2; |
| | | |
| | | /** |
| | | * 日平均土壤温度3 |
| | | */ |
| | | @Schema(description = "日平均土壤温度3", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | @JsonFormat(shape = JsonFormat.Shape.NUMBER_FLOAT, pattern="0.00" ) |
| | | public Double soilTemperature3; |
| | | |
| | | /** |
| | | * 日平均土壤温度4 |
| | | */ |
| | | @Schema(description = "日平均土壤温度4", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | @JsonFormat(shape = JsonFormat.Shape.NUMBER_FLOAT, pattern="0.00" ) |
| | | public Double soilTemperature4; |
| | | |
| | | /** |
| | | * 日平均土壤温度5 |
| | | */ |
| | | @Schema(description = "日平均土壤温度5", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | @JsonFormat(shape = JsonFormat.Shape.NUMBER_FLOAT, pattern="0.00" ) |
| | | public Double soilTemperature5; |
| | | |
| | | } |
| | |
| | | soil_sum_humidity4, soil_sum_humidity5, soil_sum_temperature1, soil_sum_temperature2, |
| | | soil_sum_temperature3, soil_sum_temperature4, soil_sum_temperature5 |
| | | </sql> |
| | | <sql id="Part_Column_List"> |
| | | <!--@mbg.generated--> |
| | | id, soil_id, dt, ymd, soil_humidity1, soil_humidity2, soil_humidity3, soil_humidity4, |
| | | soil_humidity5, soil_temperature1, soil_temperature2, soil_temperature3, soil_temperature4, |
| | | soil_temperature5 |
| | | </sql> |
| | | <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap"> |
| | | <!--@mbg.generated--> |
| | | select |
| | |
| | | <if test="stSoilId != null and stSoilId != ''"> |
| | | and soil_id = #{stSoilId} |
| | | </if> |
| | | <if test="ymd != null and ymd != ''"> |
| | | <if test="ymd != null"> |
| | | and ymd = #{ymd} |
| | | </if> |
| | | </where> |
| | | limit 0,1 |
| | | </select> |
| | | |
| | | |
| | | <!--根据指定条件获取记录--> |
| | | <select id="selectOneBySoilId" resultType="com.dy.pipIrrGlobal.voRm.VoSoilDay"> |
| | | select |
| | | <include refid="Part_Column_List" /> |
| | | from rm_soil_day |
| | | <where> |
| | | <if test="soilId != null"> |
| | | and soil_id = #{soilId} |
| | | </if> |
| | | <if test="ymd != null"> |
| | | and ymd = #{ymd} |
| | | </if> |
| | | </where> |
| | | limit 0,1 |
| | | </select> |
| | | |
| | | |
| | | |
| | | <!--根据指定条件查询记录数量--> |
| | | <select id="selectCount" resultType="java.lang.Long"> |
| | | SELECT |
| | | COUNT(*) AS recordCount |
| | | FROM rm_soil_day ltb |
| | | INNER JOIN pr_st_soil mtb ON mtb.id = ltb.soil_id |
| | | <where> |
| | | <if test="soilId != null"> |
| | | AND ltb.soil_id = #{soilId} |
| | | </if> |
| | | <if test = "no != null"> |
| | | AND mtb.no = #{no} |
| | | </if> |
| | | <if test = "name != null and name !=''"> |
| | | AND mtb.name LIKE CONCAT('%',#{name},'%') |
| | | </if> |
| | | <if test = "timeStart != null and timeStop != null"> |
| | | AND ltb.dt BETWEEN #{timeStart} AND #{timeStop} |
| | | </if> |
| | | </where> |
| | | </select> |
| | | |
| | | <!--根据指定条件查询记录--> |
| | | <select id="selectSome" resultType="com.dy.pipIrrGlobal.voRm.VoSoilDay"> |
| | | SELECT |
| | | <include refid="Base_Column_List" />, |
| | | mtb.`name` AS soilName |
| | | FROM rm_soil_day ltb |
| | | INNER JOIN pr_st_soil mtb ON mtb.id = ltb.soil_id |
| | | <where> |
| | | <if test="soilId != null"> |
| | | AND ltb.soil_id = #{soilId} |
| | | </if> |
| | | <if test = "no != null"> |
| | | AND mtb.no = #{no} |
| | | </if> |
| | | <if test = "name != null and name !=''"> |
| | | AND mtb.name LIKE CONCAT('%',#{name},'%') |
| | | </if> |
| | | <if test = "timeStart != null and timeStop != null"> |
| | | AND ltb.dt BETWEEN #{timeStart} AND #{timeStop} |
| | | </if> |
| | | </where> |
| | | ORDER BY ltb.soil_id DESC |
| | | <trim prefix="limit " > |
| | | <if test="start != null and count != null"> |
| | | #{start,javaType=Integer,jdbcType=INTEGER}, #{count,javaType=Integer,jdbcType=INTEGER} |
| | | </if> |
| | | </trim> |
| | | </select> |
| | | |
| | | <delete id="deleteByPrimaryKey" parameterType="java.lang.Long"> |
| | | <!--@mbg.generated--> |
| | | delete from rm_soil_day |
| | |
| | | @SsoAop() |
| | | public BaseResponse<VoManure> oneLast(Long manureId){ |
| | | try { |
| | | if(manureId == null){ |
| | | return BaseResponseUtils.buildFail("水肥机id不能为空") ; |
| | | } |
| | | return BaseResponseUtils.buildSuccess(sv.oneLast(manureId)); |
| | | } catch (Exception e) { |
| | | return BaseResponseUtils.buildException(e.getMessage()) ; |
| | |
| | | @SsoAop() |
| | | public BaseResponse<QueryResultVo<List<VoManure>>> oneHistory(Long manureId){ |
| | | try { |
| | | |
| | | if(manureId == null){ |
| | | return BaseResponseUtils.buildFail("水肥机id不能为空") ; |
| | | } |
| | | return BaseResponseUtils.buildSuccess(sv.oneHistory(manureId)); |
| | | } catch (Exception e) { |
| | | return BaseResponseUtils.buildException(e.getMessage()) ; |
| | |
| | | package com.dy.pipIrrRemote.mqttSd1.soil; |
| | | |
| | | import com.dy.common.aop.SsoAop; |
| | | import com.dy.common.util.NumUtil; |
| | | import com.dy.common.webUtil.BaseResponse; |
| | | import com.dy.common.webUtil.BaseResponseUtils; |
| | | import com.dy.common.webUtil.QueryResultVo; |
| | | import com.dy.pipIrrGlobal.voRm.VoSoil; |
| | | import com.dy.pipIrrGlobal.voRm.VoSoilDay; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | | import lombok.RequiredArgsConstructor; |
| | | import lombok.extern.slf4j.Slf4j; |
| | |
| | | @Autowired |
| | | public void setSv(SoilSv sv){ |
| | | this.sv = sv ; |
| | | } |
| | | |
| | | /** |
| | | * 根据指定条件查询某气象站某一日记录 |
| | | * @param soilId |
| | | * @param yyyy_MM_dd |
| | | * @return |
| | | */ |
| | | @GetMapping(path = "oneDay") |
| | | @SsoAop() |
| | | public BaseResponse<VoSoilDay> oneDay(Long soilId, String yyyy_MM_dd){ |
| | | try { |
| | | if(soilId == null){ |
| | | return BaseResponseUtils.buildFail("墒情站id不能为空") ; |
| | | } |
| | | if(yyyy_MM_dd == null || yyyy_MM_dd.trim().equals("")){ |
| | | return BaseResponseUtils.buildFail("查询日期不能为空") ; |
| | | } |
| | | String ymdStr = yyyy_MM_dd.replaceAll("-", "") ; |
| | | if(!NumUtil.isPlusIntNumber(ymdStr)){ |
| | | return BaseResponseUtils.buildFail("查询日期格式不正确,格式规定为yyyy-MM-dd") ; |
| | | } |
| | | return BaseResponseUtils.buildSuccess(sv.oneDay(soilId, Integer.parseInt(ymdStr))); |
| | | } catch (Exception e) { |
| | | return BaseResponseUtils.buildException(e.getMessage()) ; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 根据指定条件查询某气象站一些日记录 |
| | | * @param qo |
| | | * @return |
| | | */ |
| | | @GetMapping(path = "oneSomeDay") |
| | | @SsoAop() |
| | | public BaseResponse<QueryResultVo<List<VoSoilDay>>> oneSomeDay(SoilQo qo){ |
| | | try { |
| | | if(qo.soilId == null){ |
| | | return BaseResponseUtils.buildFail("墒情站id不能为空") ; |
| | | } |
| | | return BaseResponseUtils.buildSuccess(sv.someDay(qo)); |
| | | } catch (Exception e) { |
| | | return BaseResponseUtils.buildException(e.getMessage()) ; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 根据指定条件查询一些气象站日记录 |
| | | * @param qo |
| | | * @return |
| | | */ |
| | | @GetMapping(path = "someDay") |
| | | @SsoAop() |
| | | public BaseResponse<QueryResultVo<List<VoSoilDay>>> someDay(SoilQo qo){ |
| | | try { |
| | | return BaseResponseUtils.buildSuccess(sv.someDay(qo)); |
| | | } catch (Exception e) { |
| | | return BaseResponseUtils.buildException(e.getMessage()) ; |
| | | } |
| | | } |
| | | |
| | | /** |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 根据指定条件查询最新记录 |
| | | * @param qo |
| | |
| | | package com.dy.pipIrrRemote.mqttSd1.soil; |
| | | |
| | | import com.dy.common.webUtil.QueryResultVo; |
| | | import com.dy.pipIrrGlobal.daoRm.RmSoilDayMapper; |
| | | import com.dy.pipIrrGlobal.daoRm.RmSoilHistoryMapper; |
| | | import com.dy.pipIrrGlobal.daoRm.RmSoilLastMapper; |
| | | import com.dy.pipIrrGlobal.voRm.VoSoil; |
| | | import com.dy.pipIrrGlobal.voRm.VoSoilDay; |
| | | import com.dy.pipIrrRemote.mqttSd1.soil.SoilQo; |
| | | import lombok.RequiredArgsConstructor; |
| | | import lombok.extern.slf4j.Slf4j; |
| | |
| | | public class SoilSv { |
| | | |
| | | @Autowired |
| | | private RmSoilDayMapper rmSoilDayDao ; |
| | | @Autowired |
| | | private RmSoilHistoryMapper rmSoilHistoryDao ; |
| | | @Autowired |
| | | private RmSoilLastMapper rmSoilLastDao ; |
| | | |
| | | public VoSoilDay oneDay(Long soilId, Integer yyyyMMdd) { |
| | | List<VoSoilDay> list = this.rmSoilDayDao.selectOneBySoilId(soilId, yyyyMMdd) ; |
| | | if(list != null && list.size() > 0) { |
| | | return list.get(0) ; |
| | | } |
| | | return null ; |
| | | } |
| | | |
| | | |
| | | public QueryResultVo<List<VoSoilDay>> someDay(SoilQo qo) { |
| | | Map<String, Object> params = (Map<String, Object>) PojoUtils.generalize(qo); |
| | | Long itemTotal = rmSoilDayDao.selectCount(params); |
| | | |
| | | QueryResultVo<List<VoSoilDay>> rsVo = new QueryResultVo<>() ; |
| | | rsVo.pageSize = qo.pageSize ; |
| | | rsVo.pageCurr = qo.pageCurr ; |
| | | |
| | | rsVo.calculateAndSet(itemTotal, params); |
| | | rsVo.obj = rmSoilDayDao.selectSome(params); |
| | | return rsVo ; |
| | | } |
| | | |
| | | |
| | | |
| | | public VoSoil oneLast(Long soilId) { |
| | | List<VoSoil> list = this.rmSoilLastDao.selectSomeBySoilId(soilId) ; |
| | | if(list != null && list.size() > 0) { |
| | |
| | | @SsoAop() |
| | | public BaseResponse<VoWeather> oneLast(Long weatherId){ |
| | | try { |
| | | if(weatherId == null){ |
| | | return BaseResponseUtils.buildFail("气象站id不能为空") ; |
| | | } |
| | | return BaseResponseUtils.buildSuccess(sv.oneLast(weatherId)); |
| | | } catch (Exception e) { |
| | | return BaseResponseUtils.buildException(e.getMessage()) ; |
| | |
| | | @SsoAop() |
| | | public BaseResponse<QueryResultVo<List<VoWeather>>> oneHistory(Long weatherId){ |
| | | try { |
| | | |
| | | return BaseResponseUtils.buildSuccess(sv.oneHistory(weatherId)); |
| | | if(weatherId == null){ |
| | | return BaseResponseUtils.buildFail("气象站id不能为空") ; |
| | | } |
| | | return BaseResponseUtils.buildSuccess(sv.oneHistory(weatherId)); |
| | | } catch (Exception e) { |
| | | return BaseResponseUtils.buildException(e.getMessage()) ; |
| | | } |