1、完善代码;2、作物去除lat属性,采用关联气象站的lat;3、project模块增加查询全部气象站的方法。
| | |
| | | public Double life4Factor ; |
| | | |
| | | /** |
| | | * 纬度 |
| | | */ |
| | | @Schema(description = "纬度", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | public Double lat; |
| | | |
| | | /** |
| | | * 是否停止计算,1是,0否 |
| | | */ |
| | | @Schema(description = "停止计算标识", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | |
| | | import com.alibaba.fastjson2.writer.ObjectWriterImplToString; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.fasterxml.jackson.annotation.JsonPropertyOrder; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | |
| | | import java.io.Serializable; |
| | |
| | | */ |
| | | |
| | | @Data |
| | | @JsonPropertyOrder({"id", "name", "startDt", "endDt", "stopped", "isStopped", "remarks", "createDt"}) |
| | | @JsonPropertyOrder({"id", "name", "startDt", "endDt", |
| | | |
| | | "stopped", "stoppedStr", "remarks", "createDt"}) |
| | | public class VoCrops implements Serializable { |
| | | |
| | | public static final long serialVersionUID = 202508061124001L; |
| | |
| | | public String endDt; |
| | | |
| | | /** |
| | | * 是否停止计算,1是,0否 |
| | | * 生长初期开始天数(默认是1) |
| | | */ |
| | | public Byte stopped; |
| | | public Integer life1Start; |
| | | |
| | | /** |
| | | * 生长初期结束天数 |
| | | */ |
| | | public Integer life1End; |
| | | |
| | | /** |
| | | * 生长初期作物系数 |
| | | */ |
| | | public Double life1Factor ; |
| | | |
| | | /** |
| | | * 快速生长期开始天数(默认生长初期结束天数+1) |
| | | */ |
| | | public Integer life2Start; |
| | | |
| | | /** |
| | | * 快速生长期结束天数 |
| | | */ |
| | | public Integer life2End; |
| | | |
| | | /** |
| | | * 快速生长期作物系数 |
| | | */ |
| | | public Double life2Factor ; |
| | | |
| | | /** |
| | | * 生长中期开始天数(默认快速生长期结束天数+1) |
| | | */ |
| | | public Integer life3Start; |
| | | |
| | | /** |
| | | * 生长中期结束天数 |
| | | */ |
| | | public Integer life3End; |
| | | |
| | | /** |
| | | * 生长中期作物系数 |
| | | */ |
| | | public Double life3Factor ; |
| | | |
| | | /** |
| | | * 生长末期开始天数(默认生长中期结束天数+1) |
| | | */ |
| | | public Integer life4Start; |
| | | |
| | | /** |
| | | * 生长末期结束天数 |
| | | */ |
| | | public Integer life4End; |
| | | |
| | | /** |
| | | * 生长末期作物系数 |
| | | */ |
| | | public Double life4Factor ; |
| | | |
| | | /** |
| | | * 纬度 |
| | | */ |
| | | public Double lat; |
| | | |
| | | /** |
| | | * 是否停止计算,1是,0否 |
| | | */ |
| | | public String stoppedStr; |
| | | public Byte stopped; |
| | | |
| | | /** |
| | | * 备注 |
| | |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | public Date createDt; |
| | | |
| | | /** |
| | | * 已经生成时长(天) |
| | | */ |
| | | public Integer lifeLen; |
| | | /** |
| | | * 当前生长阶段 |
| | | */ |
| | | public String lifeCur ; |
| | | /** |
| | | * 对应作物生长阶段的系数 |
| | | */ |
| | | public Double lifeFactor ; |
| | | /** |
| | | * 是否停止计算,1是,0否 |
| | | */ |
| | | public String stoppedStr; |
| | | |
| | | } |
| | |
| | | <result column="life3_end" jdbcType="INTEGER" property="life3End" /> |
| | | <result column="life4_start" jdbcType="INTEGER" property="life4Start" /> |
| | | <result column="life4_end" jdbcType="INTEGER" property="life4End" /> |
| | | <result column="lat" jdbcType="DOUBLE" property="lat" /> |
| | | <result column="stopped" jdbcType="TINYINT" property="stopped" /> |
| | | <result column="remarks" jdbcType="VARCHAR" property="remarks" /> |
| | | <result column="create_dt" jdbcType="TIMESTAMP" property="createDt" /> |
| | |
| | | life2_start, life2_end, life2_factor, |
| | | life3_start, life3_end, life3_factor, |
| | | life4_start, life4_end, life4_factor, |
| | | lat, stopped, remarks, create_dt, deleted |
| | | stopped, remarks, create_dt, deleted |
| | | </sql> |
| | | <sql id="Part_Column_List"> |
| | | id, weather_id, `name`, start_dt, end_dt, |
| | |
| | | life2_start, life2_end, life2_factor, |
| | | life3_start, life3_end, life3_factor, |
| | | life4_start, life4_end, life4_factor, |
| | | lat, stopped, remarks, create_dt |
| | | stopped, remarks, create_dt |
| | | </sql> |
| | | <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap"> |
| | | <!--@mbg.generated--> |
| | |
| | | life2_start, life2_end, life2_factor, |
| | | life3_start, life3_end, life3_factor, |
| | | life4_start, life4_end, life4_factor, |
| | | lat, stopped, remarks, create_dt, deleted |
| | | stopped, remarks, create_dt, deleted |
| | | ) |
| | | values (#{id,jdbcType=BIGINT}, #{weatherId,jdbcType=BIGINT}, #{name,jdbcType=VARCHAR}, |
| | | #{startDt,jdbcType=VARCHAR}, #{endDt,jdbcType=VARCHAR}, |
| | |
| | | #{life2Start,jdbcType=INTEGER}, #{life2End,jdbcType=INTEGER}, #{life2Factor,jdbcType=DOUBLE}, |
| | | #{life3Start,jdbcType=INTEGER}, #{life3End,jdbcType=INTEGER}, #{life3Factor,jdbcType=DOUBLE}, |
| | | #{life4Start,jdbcType=INTEGER}, #{life4End,jdbcType=INTEGER}, #{life4Factor,jdbcType=DOUBLE}, |
| | | #{lat,jdbcType=DOUBLE}, #{stopped,jdbcType=TINYINT}, |
| | | #{stopped,jdbcType=TINYINT}, |
| | | #{remarks,jdbcType=VARCHAR}, #{createDt,jdbcType=TIMESTAMP}, #{deleted,jdbcType=TINYINT} |
| | | ) |
| | | </insert> |
| | |
| | | </if> |
| | | <if test="life4Factor != null"> |
| | | life4_factor, |
| | | </if> |
| | | <if test="lat != null"> |
| | | lat, |
| | | </if> |
| | | <if test="stopped != null"> |
| | | stopped, |
| | |
| | | </if> |
| | | <if test="life4Factor != null"> |
| | | #{life4Factor,jdbcType=DOUBLE}, |
| | | </if> |
| | | <if test="lat != null"> |
| | | #{lat,jdbcType=DOUBLE}, |
| | | </if> |
| | | <if test="stopped != null"> |
| | | #{stopped,jdbcType=TINYINT}, |
| | |
| | | <if test="life4Factor != null"> |
| | | life4_factor = #{life4Factor,jdbcType=DOUBLE}, |
| | | </if> |
| | | <if test="lat != null"> |
| | | lat = #{lat,jdbcType=DOUBLE}, |
| | | </if> |
| | | <if test="stopped != null"> |
| | | stopped = #{stopped,jdbcType=TINYINT}, |
| | | </if> |
| | |
| | | life4_start = #{life4Start,jdbcType=INTEGER}, |
| | | life4_end = #{life4End,jdbcType=INTEGER}, |
| | | life4_factor = #{life4Factor,jdbcType=DOUBLE}, |
| | | lat = #{lat,jdbcType=DOUBLE}, |
| | | stopped = #{stopped,jdbcType=TINYINT}, |
| | | remarks = #{remarks,jdbcType=VARCHAR}, |
| | | create_dt = #{createDt,jdbcType=TIMESTAMP}, |
| | |
| | | package com.dy.pipIrrModel.crops; |
| | | |
| | | import com.dy.common.aop.SsoAop; |
| | | import com.dy.common.util.DateTime; |
| | | import com.dy.common.webUtil.BaseResponse; |
| | | import com.dy.common.webUtil.BaseResponseUtils; |
| | | import com.dy.common.webUtil.QueryResultVo; |
| | |
| | | if(bindingResult != null && bindingResult.hasErrors()){ |
| | | return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); |
| | | } |
| | | po.id = null ; |
| | | po.createDt = new Date(); |
| | | po.deleted = 0 ; |
| | | int count; |
| | | try { |
| | | po.id = null ; |
| | | po.createDt = new Date(); |
| | | po.deleted = 0 ; |
| | | if(po.life4End != null && po.startDt != null && !po.startDt.trim().equals("")){ |
| | | String nowYear = DateTime.yyyy() ; |
| | | String startDt = nowYear + "-" + po.startDt ; |
| | | String endDt = DateTime.nextXDay_yyyy_MM_dd(startDt, po.life4End) ; |
| | | po.endDt = endDt.substring(5, 10) ; |
| | | } |
| | | count = this.sv.save(po); |
| | | } catch (Exception e) { |
| | | log.error("保存作物异常", e); |
| | |
| | | } |
| | | |
| | | /** |
| | | * 查询全部气象站记录 |
| | | * @return |
| | | */ |
| | | @Operation(summary = "获得全部气象站记录", description = "返回全部气象站数据") |
| | | @ApiResponses(value = { |
| | | @ApiResponse( |
| | | responseCode = ResultCodeMsg.RsCode.SUCCESS_CODE, |
| | | description = "返回全部气象站数据(BaseResponse.content:QueryResultVo[{}])", |
| | | content = {@Content(mediaType = MediaType.APPLICATION_JSON_VALUE, |
| | | schema = @Schema(implementation = VoWeather.class))} |
| | | ) |
| | | }) |
| | | @GetMapping(path = "/all") |
| | | @SsoAop() |
| | | public BaseResponse<List<VoWeather>> all(){ |
| | | try { |
| | | return BaseResponseUtils.buildSuccess(this.sv.allSimple()); |
| | | } catch (Exception e) { |
| | | log.error("获取气象站记录异常", e); |
| | | return BaseResponseUtils.buildException(e.getMessage()) ; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 分页查询气象站记录 |
| | | * @param vo |
| | | * @return |