定时获取水、雨情、图像实时、历史数据,获取雨情按天数据
parent
a2795cad3a
commit
75fb08a559
9
pom.xml
9
pom.xml
|
|
@ -66,7 +66,14 @@
|
|||
<version>3.1.1</version>
|
||||
</dependency>
|
||||
|
||||
<!-- <dependency>-->
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>fastjson</artifactId>
|
||||
<version>1.2.79</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>org.springframework.boot</groupId>-->
|
||||
<!-- <artifactId>spring-boot-starter-data-elasticsearch</artifactId>-->
|
||||
<!-- </dependency>-->
|
||||
|
|
|
|||
|
|
@ -0,0 +1,18 @@
|
|||
package com.gunshi.project.xyt.entity;
|
||||
|
||||
|
||||
import com.gunshi.project.xyt.model.StPptnRD;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Sun Lejun
|
||||
* @version 1.0
|
||||
* @date 2024/2/23
|
||||
*/
|
||||
|
||||
@Data
|
||||
public class SkSyncData {
|
||||
List<StPptnRD> stPptnRD;
|
||||
}
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
package com.gunshi.project.xyt.entity;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author Sun Lejun
|
||||
* @version 1.0
|
||||
* @date 2024/2/26
|
||||
*/
|
||||
@Data
|
||||
public class SkSyncResp {
|
||||
SkSyncData data;
|
||||
}
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
package com.gunshi.project.xyt.entity;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author Sun Lejun
|
||||
* @version 1.0
|
||||
* @date 2024/2/20
|
||||
*/
|
||||
|
||||
@Data
|
||||
public class SyncDataReq {
|
||||
/**
|
||||
* 抽取的行政区划编码 6位
|
||||
*/
|
||||
private String adcd;
|
||||
/**
|
||||
* 抽取的开始时间 格式 yyyy-MM-dd
|
||||
*/
|
||||
private String startDate;
|
||||
/**
|
||||
* 抽取的结束时间 格式 yyyy-MM-dd
|
||||
*/
|
||||
private String endDate;
|
||||
/**
|
||||
* 抽取的类型 QX SW SK SH
|
||||
*/
|
||||
private String type;
|
||||
}
|
||||
|
|
@ -4,6 +4,8 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
|||
import com.gunshi.project.xyt.model.StImgR;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 描述: 图像历史表
|
||||
* author: xusan
|
||||
|
|
@ -12,4 +14,5 @@ import org.apache.ibatis.annotations.Mapper;
|
|||
@Mapper
|
||||
public interface StImgRMapper extends BaseMapper<StImgR> {
|
||||
|
||||
List<StImgR> getStcdLastImgData();
|
||||
}
|
||||
|
|
@ -4,6 +4,8 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
|||
import com.gunshi.project.xyt.model.StPptnRD;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 描述:
|
||||
* author: xusan
|
||||
|
|
@ -12,4 +14,5 @@ import org.apache.ibatis.annotations.Mapper;
|
|||
@Mapper
|
||||
public interface StPptnRDMapper extends BaseMapper<StPptnRD> {
|
||||
|
||||
List<StPptnRD> getStcdLastPptnDayData();
|
||||
}
|
||||
|
|
@ -8,6 +8,7 @@ import org.apache.ibatis.annotations.Select;
|
|||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 描述: 降水量表
|
||||
|
|
@ -27,4 +28,6 @@ public interface StPptnRMapper extends BaseMapper<StPptnR> {
|
|||
</script>
|
||||
""")
|
||||
BigDecimal queryStPptnTimeQuantumByStcdAndTime(@Param("stcd") String stcd, @Param("startTime") Date startTime, @Param("endTime") Date endTime);
|
||||
|
||||
List<StPptnR> getStcdLastPptnData();
|
||||
}
|
||||
|
|
@ -4,6 +4,8 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
|||
import com.gunshi.project.xyt.model.StRsvrR;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 描述: 水库历史水位表
|
||||
* author: xusan
|
||||
|
|
@ -12,4 +14,5 @@ import org.apache.ibatis.annotations.Mapper;
|
|||
@Mapper
|
||||
public interface StRsvrRMapper extends BaseMapper<StRsvrR> {
|
||||
|
||||
List<StRsvrR> getStcdLastRsvrData();
|
||||
}
|
||||
|
|
@ -3,6 +3,7 @@ package com.gunshi.project.xyt.model;
|
|||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
import com.github.jeffreyning.mybatisplus.anno.MppMultiId;
|
||||
import com.gunshi.core.dateformat.DateFormatString;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
|
|
@ -17,6 +18,7 @@ import java.util.Date;
|
|||
@Schema
|
||||
@Data
|
||||
@TableName(value = "st_img_r")
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
public class StImgR implements Serializable {
|
||||
@TableField(value = "stcd")
|
||||
@MppMultiId
|
||||
|
|
@ -74,4 +76,12 @@ public class StImgR implements Serializable {
|
|||
public static final String COL_SOURCE = "source";
|
||||
|
||||
public static final String COL_MTMCD = "mtmcd";
|
||||
|
||||
|
||||
|
||||
@TableField(exist = false)
|
||||
private Date stm;// 同步的数据的开始时间
|
||||
|
||||
@TableField(exist = false)
|
||||
private Date etm;// 同步的数据的结束时间
|
||||
}
|
||||
|
|
@ -1,30 +1,34 @@
|
|||
package com.gunshi.project.xyt.model;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.github.jeffreyning.mybatisplus.anno.MppMultiId;
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import jakarta.validation.constraints.Size;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
@Schema
|
||||
@Data
|
||||
@TableName(value = "st_img_r_real")
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
public class StImgRReal implements Serializable {
|
||||
@TableField(value = "stcd")
|
||||
@MppMultiId
|
||||
|
||||
|
||||
@TableField(value="stcd")
|
||||
@Schema(description="测站编码")
|
||||
@Size(max = 20,message = "测站编码最大长度要小于 20")
|
||||
@NotBlank(message = "测站编码不能为空")
|
||||
private String stcd;
|
||||
|
||||
@TableField(value = "tm")
|
||||
@MppMultiId
|
||||
@Schema(description="")
|
||||
@NotNull(message = "不能为null")
|
||||
private Date tm;
|
||||
|
|
@ -40,7 +44,7 @@ public class StImgRReal implements Serializable {
|
|||
@NotBlank(message = "不能为空")
|
||||
private String imgPath;
|
||||
|
||||
@TableField(value = "chid")
|
||||
@TableId(value="chid", type = IdType.NONE)
|
||||
@Schema(description="")
|
||||
@Size(max = 10,message = "最大长度要小于 10")
|
||||
@NotBlank(message = "不能为空")
|
||||
|
|
|
|||
|
|
@ -1,21 +1,23 @@
|
|||
package com.gunshi.project.xyt.model;
|
||||
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
import com.gunshi.core.dateformat.DateFormatString;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import jakarta.validation.constraints.Size;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 描述: 降水量表
|
||||
* author: xusan
|
||||
|
|
@ -24,6 +26,7 @@ import java.util.Date;
|
|||
@Schema(description="降水量表")
|
||||
@Data
|
||||
@TableName("public.st_pptn_r")
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
public class StPptnR implements Serializable {
|
||||
|
||||
|
||||
|
|
@ -92,4 +95,10 @@ public class StPptnR implements Serializable {
|
|||
@JsonFormat(pattern = DateFormatString.YYYY_MM_DD_HH_MM_SS, timezone = "GMT+8")
|
||||
private Date chtm;
|
||||
|
||||
|
||||
@TableField(exist = false)
|
||||
private Date stm;// 同步的数据的开始时间
|
||||
|
||||
@TableField(exist = false)
|
||||
private Date etm;// 同步的数据的结束时间
|
||||
}
|
||||
|
|
@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.annotation.TableField;
|
|||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
import com.gunshi.core.dateformat.DateFormatString;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
|
|
@ -25,6 +26,7 @@ import java.util.Date;
|
|||
@Schema(description="")
|
||||
@Data
|
||||
@TableName("public.st_pptn_r_d")
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
public class StPptnRD implements Serializable {
|
||||
|
||||
|
||||
|
|
@ -65,4 +67,9 @@ public class StPptnRD implements Serializable {
|
|||
@NotNull(message = "year不能为空")
|
||||
private Integer year;
|
||||
|
||||
@TableField(exist = false)
|
||||
private Date stm;// 同步的数据的开始时间
|
||||
|
||||
@TableField(exist = false)
|
||||
private String addvcd;
|
||||
}
|
||||
|
|
@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.annotation.TableField;
|
|||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
import com.gunshi.core.dateformat.DateFormatString;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
|
|
@ -24,6 +25,7 @@ import java.util.Date;
|
|||
@Schema(description="降水量历史表")
|
||||
@Data
|
||||
@TableName("public.st_pptn_r_real")
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
public class StPptnRReal implements Serializable {
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.annotation.TableField;
|
|||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
import com.gunshi.core.dateformat.DateFormatString;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
|
|
@ -24,6 +25,7 @@ import java.util.Date;
|
|||
@Schema(description="水库历史水位表")
|
||||
@Data
|
||||
@TableName("public.st_rsvr_r")
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
public class StRsvrR implements Serializable {
|
||||
|
||||
|
||||
|
|
@ -149,4 +151,11 @@ public class StRsvrR implements Serializable {
|
|||
// @Size(max = 0,message = "source_int最大长度要小于 0")
|
||||
private Integer sourceInt;
|
||||
|
||||
|
||||
@TableField(exist = false)
|
||||
private Date stm;// 同步的数据的开始时间
|
||||
|
||||
@TableField(exist = false)
|
||||
private Date etm;// 同步的数据的结束时间
|
||||
|
||||
}
|
||||
|
|
@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.annotation.TableField;
|
|||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
import com.gunshi.core.dateformat.DateFormatString;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
|
|
@ -23,6 +24,7 @@ import java.util.Date;
|
|||
@Schema(description="水库水位实时数据表")
|
||||
@Data
|
||||
@TableName("public.st_rsvr_r_real")
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
public class StRsvrRReal implements Serializable {
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,13 +1,15 @@
|
|||
package com.gunshi.project.xyt.service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.gunshi.project.xyt.mapper.StImgRMapper;
|
||||
import com.gunshi.project.xyt.model.StImgR;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.Date;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
/**
|
||||
* 描述: 图像历史表
|
||||
|
|
@ -20,6 +22,9 @@ import java.util.Date;
|
|||
public class StImgRService extends ServiceImpl<StImgRMapper, StImgR>
|
||||
{
|
||||
|
||||
public List<StImgR> getStcdLastImgData() {
|
||||
return baseMapper.getStcdLastImgData();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -7,6 +7,8 @@ import lombok.extern.slf4j.Slf4j;
|
|||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 描述:
|
||||
* author: xusan
|
||||
|
|
@ -18,6 +20,9 @@ import org.springframework.transaction.annotation.Transactional;
|
|||
public class StPptnRDService extends ServiceImpl<StPptnRDMapper, StPptnRD>
|
||||
{
|
||||
|
||||
public List<StPptnRD> getStcdLastPptnDayData() {
|
||||
return baseMapper.getStcdLastPptnDayData();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,13 +1,15 @@
|
|||
package com.gunshi.project.xyt.service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.gunshi.project.xyt.mapper.StPptnRMapper;
|
||||
import com.gunshi.project.xyt.model.StPptnR;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.Date;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
/**
|
||||
* 描述: 降水量表
|
||||
|
|
@ -20,6 +22,9 @@ import java.util.Date;
|
|||
public class StPptnRService extends ServiceImpl<StPptnRMapper, StPptnR>
|
||||
{
|
||||
|
||||
public List<StPptnR> getStcdLastPptnData() {
|
||||
return baseMapper.getStcdLastPptnData();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,13 +1,15 @@
|
|||
package com.gunshi.project.xyt.service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.gunshi.project.xyt.mapper.StRsvrRMapper;
|
||||
import com.gunshi.project.xyt.model.StRsvrR;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.Date;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
/**
|
||||
* 描述: 水库历史水位表
|
||||
|
|
@ -20,6 +22,9 @@ import java.util.Date;
|
|||
public class StRsvrRService extends ServiceImpl<StRsvrRMapper, StRsvrR>
|
||||
{
|
||||
|
||||
public List<StRsvrR> getStcdLastRsvrData() {
|
||||
return baseMapper.getStcdLastRsvrData();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,477 @@
|
|||
package com.gunshi.project.xyt.timetask;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
||||
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
|
||||
import com.fasterxml.jackson.databind.DeserializationFeature;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.gunshi.project.xyt.entity.SkSyncData;
|
||||
import com.gunshi.project.xyt.entity.SkSyncResp;
|
||||
import com.gunshi.project.xyt.entity.SyncDataReq;
|
||||
import com.gunshi.project.xyt.model.StImgR;
|
||||
import com.gunshi.project.xyt.model.StImgRReal;
|
||||
import com.gunshi.project.xyt.model.StPptnR;
|
||||
import com.gunshi.project.xyt.model.StPptnRD;
|
||||
import com.gunshi.project.xyt.model.StPptnRReal;
|
||||
import com.gunshi.project.xyt.model.StRsvrR;
|
||||
import com.gunshi.project.xyt.model.StRsvrRReal;
|
||||
import com.gunshi.project.xyt.model.StStbprpB;
|
||||
import com.gunshi.project.xyt.service.StImgRRealService;
|
||||
import com.gunshi.project.xyt.service.StImgRService;
|
||||
import com.gunshi.project.xyt.service.StPptnRDService;
|
||||
import com.gunshi.project.xyt.service.StPptnRRealService;
|
||||
import com.gunshi.project.xyt.service.StPptnRService;
|
||||
import com.gunshi.project.xyt.service.StRsvrRRealService;
|
||||
import com.gunshi.project.xyt.service.StRsvrRService;
|
||||
import com.gunshi.project.xyt.service.StStbprpBService;
|
||||
import com.gunshi.project.xyt.util.OkHttpUtil;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import okhttp3.FormBody;
|
||||
import okhttp3.MediaType;
|
||||
import okhttp3.OkHttpClient;
|
||||
import okhttp3.Request;
|
||||
import okhttp3.RequestBody;
|
||||
import okhttp3.Response;
|
||||
import ru.olegcherednik.jackson_utils.JacksonUtils;
|
||||
|
||||
/**
|
||||
* @author cxw
|
||||
* @description: 数据定时任务
|
||||
* @classname DataTask.java
|
||||
* @create 2024-07-11, 星期四, 14:19:22
|
||||
*/
|
||||
@EnableScheduling//开启定时任务
|
||||
@Component
|
||||
@Slf4j
|
||||
public class DataTask {
|
||||
private static SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
private static SimpleDateFormat sdfD = new SimpleDateFormat("yyyy-MM-dd");
|
||||
private static SimpleDateFormat sdfH = new SimpleDateFormat("yyyy-MM-dd HH");
|
||||
|
||||
@Value("${owrsvrPath}")
|
||||
private String owrsvrPath;// 获取水雨情、图像接口 http://owrsvr.cloudowr.cn/
|
||||
|
||||
@Value("${apiPath}")
|
||||
private String apiPath;// 获取雨情按天接口
|
||||
|
||||
public static String hbskpprealstsRoute = "pubapi/hbsk/pprealsts";// 站点实时雨情
|
||||
|
||||
public static String hbskpphisRoute = "pubapi/hbsk/pphis";// 站点历史雨情
|
||||
|
||||
public static String hbskzzrealstsRoute = "pubapi/hbsk/zzrealsts";// 站点实时水情
|
||||
|
||||
public static String hbskzzhisRoute = "pubapi/hbsk/zzhis";// 站点历史水情
|
||||
|
||||
public static String hbskpicrealstsRoute = "pubapi/hbsk/picrealsts";// 站点实时图像
|
||||
|
||||
public static String hbskpichisRoute = "pubapi/hbsk/pichis";// 站点历史图像
|
||||
|
||||
|
||||
// 水库站点
|
||||
@Autowired
|
||||
private StStbprpBService stStbprpBService;
|
||||
|
||||
// 实时雨情
|
||||
@Autowired
|
||||
private StPptnRRealService stPptnRRealService;
|
||||
|
||||
// 历史雨情
|
||||
@Autowired
|
||||
private StPptnRService stPptnRService;
|
||||
|
||||
// 按天雨情
|
||||
@Autowired
|
||||
private StPptnRDService stPptnRDService;
|
||||
|
||||
// 实时水情
|
||||
@Autowired
|
||||
private StRsvrRRealService stRsvrRRealService;
|
||||
|
||||
// 历史水情
|
||||
@Autowired
|
||||
private StRsvrRService stRsvrRService;
|
||||
|
||||
// 实时图像
|
||||
@Autowired
|
||||
private StImgRRealService stImgRRealService;
|
||||
|
||||
// 历史图像
|
||||
@Autowired
|
||||
private StImgRService stImgRService;
|
||||
|
||||
|
||||
/**
|
||||
* @description: 定时获取水库雨情数据(实时)
|
||||
* @param
|
||||
* @return: void
|
||||
* @auther: cxw
|
||||
* @date: 2024-07-11, 周四, 14:21:35
|
||||
*/
|
||||
@Async
|
||||
@Scheduled(fixedRate = 5, timeUnit = TimeUnit.MINUTES)
|
||||
public void getSkYqRealData() {
|
||||
Date now = new Date();
|
||||
System.out.println("雨情实时定时任务,执行时间:" + sdf.format(now));
|
||||
// 获取水库站点编码
|
||||
String sts = "[" + stStbprpBService.list(new QueryWrapper<StStbprpB>().eq("source", "SK")).stream().map(StStbprpB::getStcd).collect(Collectors.joining(",")) + "]";
|
||||
OkHttpClient client = OkHttpUtil.build();
|
||||
try {
|
||||
Response resp = client.newCall(new Request.Builder().url(owrsvrPath + hbskpprealstsRoute)
|
||||
.post(new FormBody.Builder().add("sts", sts).build())
|
||||
.build()).execute();
|
||||
String respStr = resp.body().string();
|
||||
ObjectMapper om = new ObjectMapper();
|
||||
Map map = om.readValue(respStr, Map.class);
|
||||
List<LinkedHashMap> list = (List<LinkedHashMap>)map.get("data");
|
||||
for (Map map1 : list) {
|
||||
StPptnRReal stPptnRReal = new ObjectMapper().convertValue(map1, StPptnRReal.class);
|
||||
if(ObjectUtils.isEmpty(stPptnRReal.getChtm())){
|
||||
stPptnRReal.setChtm(new Date());
|
||||
}
|
||||
UpdateWrapper<StPptnRReal> updateWrapper = new UpdateWrapper<>();
|
||||
updateWrapper.eq("stcd", stPptnRReal.getStcd());
|
||||
stPptnRRealService.saveOrUpdate(stPptnRReal, updateWrapper);
|
||||
}
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
log.error("雨情实时定时任务错误:", e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @description: 定时获取水库雨情数据(历史)
|
||||
* @param
|
||||
* @return: void
|
||||
* @auther: cxw
|
||||
* @date: 2024-07-11, 周四, 14:21:35
|
||||
*/
|
||||
@Async
|
||||
@Scheduled(fixedRate = 5, timeUnit = TimeUnit.MINUTES)
|
||||
public void getSkYqHisData() {
|
||||
Date now = new Date();
|
||||
System.out.println("雨情历史定时任务,执行时间:" + sdf.format(now));
|
||||
// 获取水库站点编码历史雨情表中站点最新数据时间
|
||||
List<StPptnR> stcdLast = stPptnRService.getStcdLastPptnData();
|
||||
OkHttpClient client = OkHttpUtil.build();
|
||||
try {
|
||||
for(StPptnR stPptnR : stcdLast){
|
||||
Date stm = stPptnR.getStm();
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
// 默认40天前(接口最多40天),存在则加1秒(接口是大于等于开始时间)
|
||||
if(ObjectUtils.isEmpty(stm)){
|
||||
calendar.add(Calendar.DATE, -40);
|
||||
} else {
|
||||
calendar.add(Calendar.SECOND, 1);
|
||||
}
|
||||
stm = calendar.getTime();
|
||||
Response resp = client.newCall(new Request.Builder().url(owrsvrPath + hbskpphisRoute)
|
||||
.post(new FormBody.Builder().add("stcd", stPptnR.getStcd())
|
||||
.add("stm", sdfH.format(stm))
|
||||
.add("etm", sdfH.format(now))
|
||||
.build())
|
||||
.build()).execute();
|
||||
String respStr = resp.body().string();
|
||||
ObjectMapper om = new ObjectMapper();
|
||||
Map map = om.readValue(respStr, Map.class);
|
||||
if("400".equals(map.get("code").toString())){
|
||||
continue;
|
||||
}
|
||||
List<LinkedHashMap> list = (List<LinkedHashMap>)map.get("data");
|
||||
if(CollectionUtils.isNotEmpty(list)){
|
||||
List<StPptnR> rlist = JSONObject.parseArray(JSONObject.toJSONString(list)).toJavaList(StPptnR.class);
|
||||
stPptnRService.saveBatch(rlist);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
log.error("雨情历史定时任务错误:", e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @description: 定时获取水库雨情数据(按天)
|
||||
* @param
|
||||
* @return: void
|
||||
* @auther: cxw
|
||||
* @date: 2024-07-11, 周四, 14:21:35
|
||||
*/
|
||||
@Async
|
||||
@Scheduled(fixedRate = 5, timeUnit = TimeUnit.MINUTES)
|
||||
public void getSkYqDayData() {
|
||||
Date now = new Date();
|
||||
System.out.println("雨情按天定时任务,执行时间:" + sdf.format(now));
|
||||
// 获取水库站点编码按天雨情表中站点最新数据时间
|
||||
List<StPptnRD> stcdLast = stPptnRDService.getStcdLastPptnDayData();
|
||||
OkHttpClient client = OkHttpUtil.build();
|
||||
try {
|
||||
for(StPptnRD stPptnRD : stcdLast){
|
||||
String stcd = stPptnRD.getStcd();
|
||||
Date stm = stPptnRD.getStm();
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
// 默认两周前的时间(接口只提供addvcd的条件,数据量较大),如果存在,需要加一天(接口是大于等于开始时间)
|
||||
if(ObjectUtils.isEmpty(stm)){
|
||||
calendar.add(Calendar.DATE, -14);
|
||||
} else {
|
||||
calendar.add(Calendar.DATE, 1);
|
||||
}
|
||||
stm = calendar.getTime();
|
||||
MediaType mediaType = MediaType.parse("application/json");
|
||||
SyncDataReq syncDataReq = new SyncDataReq();
|
||||
syncDataReq.setAdcd(stPptnRD.getAddvcd());
|
||||
syncDataReq.setType("SK");
|
||||
syncDataReq.setStartDate(sdfD.format(stm));
|
||||
syncDataReq.setEndDate(sdfD.format(now));
|
||||
RequestBody body = RequestBody.create(JacksonUtils.writeValue(syncDataReq), mediaType);
|
||||
Response resp = client.newCall(new Request.Builder().url(apiPath)
|
||||
.post(body)
|
||||
.build()).execute();
|
||||
String respStr = resp.body().string();
|
||||
ObjectMapper objectMapper = new ObjectMapper();
|
||||
objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
|
||||
SkSyncResp resq = objectMapper.readValue(respStr, SkSyncResp.class);
|
||||
SkSyncData data = resq.getData();
|
||||
List<StPptnRD> stPptnRDList = data.getStPptnRD();
|
||||
if(CollectionUtils.isNotEmpty(stPptnRDList)) {
|
||||
Iterator<StPptnRD> iterator = stPptnRDList.iterator();
|
||||
while (iterator.hasNext()) {
|
||||
StPptnRD stPptnRD1 = iterator.next();
|
||||
if (!stcd.equals(stPptnRD1.getStcd())) {
|
||||
iterator.remove();
|
||||
continue;
|
||||
}
|
||||
stPptnRD1.setYear(Integer.valueOf(sdfD.format(stPptnRD1.getTm()).substring(0, 4)));
|
||||
}
|
||||
stPptnRDService.saveBatch(stPptnRDList);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
log.error("雨情按天定时任务错误:", e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @description: 定时获取水库水情数据(实时)
|
||||
* @param
|
||||
* @return: void
|
||||
* @auther: cxw
|
||||
* @date: 2024-07-11, 周四, 14:21:35
|
||||
*/
|
||||
@Async
|
||||
@Scheduled(fixedRate = 5, timeUnit = TimeUnit.MINUTES)
|
||||
public void getSkSqRealData() {
|
||||
Date now = new Date();
|
||||
System.out.println("水情实时定时任务,执行时间:" + sdf.format(now));
|
||||
// 获取水库站点编码
|
||||
String sts = "[" + stStbprpBService.list(new QueryWrapper<StStbprpB>().eq("source", "SK")).stream().map(StStbprpB::getStcd).collect(Collectors.joining(",")) + "]";
|
||||
OkHttpClient client = OkHttpUtil.build();
|
||||
try {
|
||||
Response resp = client.newCall(new Request.Builder().url(owrsvrPath + hbskzzrealstsRoute)
|
||||
.post(new FormBody.Builder().add("sts", sts).build())
|
||||
.build()).execute();
|
||||
String respStr = resp.body().string();
|
||||
ObjectMapper om = new ObjectMapper();
|
||||
Map map = om.readValue(respStr, Map.class);
|
||||
List<LinkedHashMap> list = (List<LinkedHashMap>)map.get("data");
|
||||
for (Map map1 : list) {
|
||||
StRsvrRReal stRsvrRReal = new ObjectMapper().convertValue(map1, StRsvrRReal.class);
|
||||
if(ObjectUtils.isEmpty(stRsvrRReal.getChtm())){
|
||||
stRsvrRReal.setChtm(new Date());
|
||||
}
|
||||
UpdateWrapper<StRsvrRReal> updateWrapper = new UpdateWrapper<>();
|
||||
updateWrapper.eq("stcd", stRsvrRReal.getStcd());
|
||||
stRsvrRRealService.saveOrUpdate(stRsvrRReal, updateWrapper);
|
||||
}
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
log.error("水情实时定时任务错误:", e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @description: 定时获取水库水情数据(历史)
|
||||
* @param
|
||||
* @return: void
|
||||
* @auther: cxw
|
||||
* @date: 2024-07-11, 周四, 14:21:35
|
||||
*/
|
||||
@Async
|
||||
@Scheduled(fixedRate = 5, timeUnit = TimeUnit.MINUTES)
|
||||
public void getSkSqHisData() {
|
||||
Date now = new Date();
|
||||
System.out.println("水情历史定时任务,执行时间:" + sdf.format(now));
|
||||
// 获取水库站点编码历史水情表中站点最新数据时间
|
||||
List<StRsvrR> stcdLast = stRsvrRService.getStcdLastRsvrData();
|
||||
OkHttpClient client = OkHttpUtil.build();
|
||||
try {
|
||||
for(StRsvrR stRsvrR : stcdLast){
|
||||
Date stm = stRsvrR.getStm();
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
// 默认40天前(接口最多40天),存在则加1秒(接口是大于等于开始时间)
|
||||
if(ObjectUtils.isEmpty(stm)){
|
||||
calendar.add(Calendar.DATE, -40);
|
||||
} else {
|
||||
calendar.add(Calendar.SECOND, 1);
|
||||
}
|
||||
stm = calendar.getTime();
|
||||
Response resp = client.newCall(new Request.Builder().url(owrsvrPath + hbskzzhisRoute)
|
||||
.post(new FormBody.Builder().add("stcd", stRsvrR.getStcd())
|
||||
.add("stm", sdfH.format(stm))
|
||||
.add("etm", sdfH.format(now))
|
||||
.build())
|
||||
.build()).execute();
|
||||
String respStr = resp.body().string();
|
||||
ObjectMapper om = new ObjectMapper();
|
||||
Map map = om.readValue(respStr, Map.class);
|
||||
if("400".equals(map.get("code").toString())){
|
||||
continue;
|
||||
}
|
||||
List<LinkedHashMap> list = (List<LinkedHashMap>)map.get("data");
|
||||
if(CollectionUtils.isNotEmpty(list)){
|
||||
List<StRsvrR> rlist = JSONObject.parseArray(JSONObject.toJSONString(list)).toJavaList(StRsvrR.class);
|
||||
stRsvrRService.saveBatch(rlist);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
log.error("水情历史定时任务错误:", e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @description: 定时获取水库图像数据(实时)
|
||||
* @param
|
||||
* @return: void
|
||||
* @auther: cxw
|
||||
* @date: 2024-07-22, 周一, 13:54:08
|
||||
*/
|
||||
@Async
|
||||
@Scheduled(fixedRate = 5, timeUnit = TimeUnit.MINUTES)
|
||||
public void getSkImgRealData() {
|
||||
Date now = new Date();
|
||||
System.out.println("图像实时图像定时任务,执行时间:" + sdf.format(now));
|
||||
// 获取水库站点编码
|
||||
String sts = "[" + stStbprpBService.list(new QueryWrapper<StStbprpB>().eq("source", "SK")).stream().map(StStbprpB::getStcd).collect(Collectors.joining(",")) + "]";
|
||||
OkHttpClient client = OkHttpUtil.build();
|
||||
try {
|
||||
Response resp = client.newCall(new Request.Builder().url(owrsvrPath + hbskpicrealstsRoute)
|
||||
.post(new FormBody.Builder().add("sts", sts).build())
|
||||
.build()).execute();
|
||||
String respStr = resp.body().string();
|
||||
ObjectMapper om = new ObjectMapper();
|
||||
Map map = om.readValue(respStr, Map.class);
|
||||
List<LinkedHashMap> list = (List<LinkedHashMap>)map.get("data");
|
||||
for (Map map1 : list) {
|
||||
StImgRReal stImgRReal = new ObjectMapper().configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false).setDateFormat(sdf).convertValue(map1, StImgRReal.class);
|
||||
if(ObjectUtils.isEmpty(stImgRReal.getChtm())){
|
||||
stImgRReal.setChtm(new Date());
|
||||
}
|
||||
if(ObjectUtils.isEmpty(stImgRReal.getChid())){
|
||||
stImgRReal.setChid(map1.get("machineid").toString());
|
||||
}
|
||||
if(ObjectUtils.isEmpty(stImgRReal.getImgPath())){
|
||||
stImgRReal.setImgPath(map1.get("url").toString());
|
||||
}
|
||||
UpdateWrapper<StImgRReal> updateWrapper = new UpdateWrapper<>();
|
||||
updateWrapper.eq("stcd", stImgRReal.getStcd()).eq("chid", stImgRReal.getChid());
|
||||
stImgRRealService.saveOrUpdate(stImgRReal, updateWrapper);
|
||||
}
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
log.error("图像实时定时任务错误:", e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @description: 定时获取水库图像数据(历史)
|
||||
* @param
|
||||
* @return: void
|
||||
* @auther: cxw
|
||||
* @date: 2024-07-22, 周一, 13:55:45
|
||||
*/
|
||||
@Async
|
||||
@Scheduled(fixedRate = 5, timeUnit = TimeUnit.MINUTES)
|
||||
public void getSkImgHisData() {
|
||||
Date now = new Date();
|
||||
System.out.println("图像历史定时任务,执行时间:" + sdf.format(now));
|
||||
// 获取水库站点编码历史图像表中站点最新数据时间
|
||||
List<StImgR> stcdLast = stImgRService.getStcdLastImgData();
|
||||
OkHttpClient client = OkHttpUtil.build();
|
||||
try {
|
||||
for (StImgR stImgR : stcdLast) {
|
||||
Date stm = stImgR.getStm();
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
// 默认40天前(接口最多40天),存在则加1秒(接口是大于等于开始时间)
|
||||
if(ObjectUtils.isEmpty(stm)){
|
||||
calendar.add(Calendar.DATE, -40);
|
||||
} else {
|
||||
calendar.add(Calendar.SECOND, 1);
|
||||
}
|
||||
stm = calendar.getTime();
|
||||
Response resp = client.newCall(new Request.Builder().url(owrsvrPath + hbskpichisRoute)
|
||||
.post(new FormBody.Builder().add("stcd", stImgR.getStcd())
|
||||
.add("stm", sdfH.format(stm))
|
||||
.add("etm", sdfH.format(now))
|
||||
.build())
|
||||
.build()).execute();
|
||||
String respStr = resp.body().string();
|
||||
ObjectMapper om = new ObjectMapper();
|
||||
Map map = om.readValue(respStr, Map.class);
|
||||
if ("400".equals(map.get("code").toString())) {
|
||||
continue;
|
||||
}
|
||||
List<LinkedHashMap> list = (List<LinkedHashMap>)map.get("data");
|
||||
if (CollectionUtils.isNotEmpty(list)) {
|
||||
List<StImgR> rlist = list.stream().map(map1 -> {
|
||||
StImgR stImgRNew = new ObjectMapper().configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false).setDateFormat(sdf).convertValue(map1, StImgR.class);
|
||||
// 手动设置对应属性
|
||||
if(ObjectUtils.isEmpty(stImgRNew.getChtm())){
|
||||
stImgRNew.setChtm(new Date());
|
||||
}
|
||||
if(ObjectUtils.isEmpty(stImgRNew.getChid())){
|
||||
stImgRNew.setChid(map1.get("machineid").toString());
|
||||
}
|
||||
if(ObjectUtils.isEmpty(stImgRNew.getImgPath())){
|
||||
stImgRNew.setImgPath(map1.get("url").toString());
|
||||
}
|
||||
return stImgRNew;
|
||||
}).collect(Collectors.toList());
|
||||
stImgRService.saveBatch(rlist);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
log.error("图像历史定时任务错误:", e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
package com.gunshi.project.xyt.timetask;
|
||||
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.scheduling.TaskScheduler;
|
||||
import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler;
|
||||
|
||||
/**
|
||||
* @author cxw
|
||||
* @description: 定时任务池
|
||||
* @classname ScheduledPool.java
|
||||
* @create 2024-07-22, 星期一, 10:43:54
|
||||
*/
|
||||
@Configuration
|
||||
public class ScheduledPool {
|
||||
@Bean
|
||||
public TaskScheduler taskScheduler() {
|
||||
ThreadPoolTaskScheduler taskScheduler = new ThreadPoolTaskScheduler();
|
||||
// 设置定时任务线程数量
|
||||
taskScheduler.setPoolSize(20);
|
||||
return taskScheduler;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,30 @@
|
|||
package com.gunshi.project.xyt.util;
|
||||
|
||||
import com.google.common.base.Suppliers;
|
||||
import okhttp3.OkHttpClient;
|
||||
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
public class OkHttpUtil {
|
||||
private OkHttpUtil(){
|
||||
|
||||
}
|
||||
private static final Supplier<OkHttpClient> OK_HTTP_CLIENT_FACTORY = Suppliers.memoize(OkHttpClient::new);
|
||||
|
||||
public static OkHttpClient build(){
|
||||
return OK_HTTP_CLIENT_FACTORY.get().newBuilder().retryOnConnectionFailure(true)
|
||||
.connectTimeout(10, TimeUnit.SECONDS)
|
||||
.callTimeout(240, TimeUnit.SECONDS)
|
||||
.readTimeout(240, TimeUnit.SECONDS)
|
||||
.build();
|
||||
}
|
||||
|
||||
public static OkHttpClient build(int timeout, int callTimeout){
|
||||
return OK_HTTP_CLIENT_FACTORY.get().newBuilder().retryOnConnectionFailure(true)
|
||||
.connectTimeout(timeout, TimeUnit.SECONDS)
|
||||
.callTimeout(callTimeout, TimeUnit.SECONDS)
|
||||
.readTimeout(callTimeout, TimeUnit.SECONDS)
|
||||
.build();
|
||||
}
|
||||
}
|
||||
|
|
@ -27,4 +27,9 @@ gunshi:
|
|||
privateBucket: test.by-lyf.tmp
|
||||
|
||||
shqxjsCloudowrCnPath: http://shqxjs.cloudowr.cn/service/
|
||||
|
||||
owrsvrPath: http://owrsvr.cloudowr.cn/
|
||||
|
||||
apiPath: http://223.75.53.141:8000/shzh/monitdata/datasync/getData
|
||||
|
||||
shqxjsWarnPath: http://223.75.53.141:8000/shzh/met/zyqxfw/api/warning/getGroupWarning
|
||||
|
|
|
|||
|
|
@ -2,4 +2,13 @@
|
|||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.gunshi.project.xyt.mapper.StImgRMapper">
|
||||
|
||||
<select id="getStcdLastImgData" resultType="com.gunshi.project.xyt.model.StImgR">
|
||||
SELECT stb.stcd,
|
||||
r.tm stm
|
||||
FROM public.st_stbprp_b stb
|
||||
LEFT JOIN (SELECT *
|
||||
FROM (SELECT *, ROW_NUMBER() OVER ( PARTITION BY stcd ORDER BY tm DESC ) AS rn FROM public.st_img_r) subquery
|
||||
WHERE subquery.rn = 1) r ON stb.stcd = r.stcd
|
||||
WHERE stb.source = 'SK'
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
|
|||
|
|
@ -2,4 +2,14 @@
|
|||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.gunshi.project.xyt.mapper.StPptnRDMapper">
|
||||
|
||||
<select id="getStcdLastPptnDayData" resultType="com.gunshi.project.xyt.model.StPptnRD">
|
||||
SELECT stb.stcd,
|
||||
stb.addvcd,
|
||||
r.tm stm
|
||||
FROM public.st_stbprp_b stb
|
||||
LEFT JOIN (SELECT *
|
||||
FROM (SELECT *, ROW_NUMBER() OVER ( PARTITION BY stcd ORDER BY tm DESC ) AS rn FROM public.st_pptn_r_d) subquery
|
||||
WHERE subquery.rn = 1) r ON stb.stcd = r.stcd
|
||||
WHERE stb.source = 'SK'
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
|
|||
|
|
@ -2,4 +2,13 @@
|
|||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.gunshi.project.xyt.mapper.StPptnRMapper">
|
||||
|
||||
<select id="getStcdLastPptnData" resultType="com.gunshi.project.xyt.model.StPptnR">
|
||||
SELECT stb.stcd,
|
||||
r.tm stm
|
||||
FROM public.st_stbprp_b stb
|
||||
LEFT JOIN (SELECT *
|
||||
FROM (SELECT *, ROW_NUMBER() OVER ( PARTITION BY stcd ORDER BY tm DESC ) AS rn FROM public.st_pptn_r) subquery
|
||||
WHERE subquery.rn = 1) r ON stb.stcd = r.stcd
|
||||
WHERE stb.source = 'SK'
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
|
|||
|
|
@ -2,4 +2,13 @@
|
|||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.gunshi.project.xyt.mapper.StRsvrRMapper">
|
||||
|
||||
<select id="getStcdLastRsvrData" resultType="com.gunshi.project.xyt.model.StRsvrR">
|
||||
SELECT stb.stcd,
|
||||
r.tm stm
|
||||
FROM public.st_stbprp_b stb
|
||||
LEFT JOIN (SELECT *
|
||||
FROM (SELECT *, ROW_NUMBER() OVER ( PARTITION BY stcd ORDER BY tm DESC ) AS rn FROM public.st_rsvr_r) subquery
|
||||
WHERE subquery.rn = 1) r ON stb.stcd = r.stcd
|
||||
WHERE stb.source = 'SK'
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
|
|||
Loading…
Reference in New Issue