refactor: 重构
parent
26a590030a
commit
34a3b1c975
|
|
@ -1,7 +1,7 @@
|
||||||
package com.gunshi.project.hsz.mapper;
|
package com.gunshi.project.hsz.common.mapper;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
import com.gunshi.project.hsz.model.StPptnR;
|
import com.gunshi.project.hsz.common.model.StPptnR;
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
import org.apache.ibatis.annotations.Select;
|
import org.apache.ibatis.annotations.Select;
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
package com.gunshi.project.hsz.mapper;
|
package com.gunshi.project.hsz.common.mapper;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
import com.gunshi.project.hsz.model.StPptnRReal;
|
import com.gunshi.project.hsz.common.model.StPptnRReal;
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
import org.apache.ibatis.annotations.Select;
|
import org.apache.ibatis.annotations.Select;
|
||||||
|
|
@ -3,6 +3,10 @@ package com.gunshi.project.hsz.common.mapper;
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
import com.gunshi.project.hsz.common.model.StStbprpBElem;
|
import com.gunshi.project.hsz.common.model.StStbprpBElem;
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
import org.apache.ibatis.annotations.Select;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 描述: 测站监测值类型
|
* 描述: 测站监测值类型
|
||||||
|
|
@ -11,5 +15,12 @@ import org.apache.ibatis.annotations.Mapper;
|
||||||
*/
|
*/
|
||||||
@Mapper
|
@Mapper
|
||||||
public interface StStbprpBElemMapper extends BaseMapper<StStbprpBElem> {
|
public interface StStbprpBElemMapper extends BaseMapper<StStbprpBElem> {
|
||||||
|
@Select("""
|
||||||
|
<script>
|
||||||
|
select b.stcd, e.elem from st_stbprp_b b
|
||||||
|
left join st_stbprp_b_elem e on b.stcd=e.stcd
|
||||||
|
where elem = #{elem}
|
||||||
|
</script>
|
||||||
|
""")
|
||||||
|
List<StStbprpBElem> selectByElem(@Param("elem") String elem);
|
||||||
}
|
}
|
||||||
|
|
@ -9,6 +9,7 @@ import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||||
import com.gunshi.core.dateformat.DateFormatString;
|
import com.gunshi.core.dateformat.DateFormatString;
|
||||||
|
import com.gunshi.db.annotation.IgnoreAutoMapperAndDao;
|
||||||
import com.gunshi.project.hsz.common.validate.markers.Update;
|
import com.gunshi.project.hsz.common.validate.markers.Update;
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import jakarta.validation.constraints.NotNull;
|
import jakarta.validation.constraints.NotNull;
|
||||||
|
|
@ -27,6 +28,7 @@ import java.util.List;
|
||||||
@Schema(description="巡检任务")
|
@Schema(description="巡检任务")
|
||||||
@Data
|
@Data
|
||||||
@TableName("public.inspect_task")
|
@TableName("public.inspect_task")
|
||||||
|
@IgnoreAutoMapperAndDao
|
||||||
public class InspectTask implements Serializable {
|
public class InspectTask implements Serializable {
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,7 @@ import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||||
import com.gunshi.core.dateformat.DateFormatString;
|
import com.gunshi.core.dateformat.DateFormatString;
|
||||||
|
import com.gunshi.db.annotation.IgnoreAutoMapperAndDao;
|
||||||
import com.gunshi.project.hsz.common.validate.markers.Update;
|
import com.gunshi.project.hsz.common.validate.markers.Update;
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import jakarta.validation.constraints.NotNull;
|
import jakarta.validation.constraints.NotNull;
|
||||||
|
|
@ -26,6 +27,7 @@ import java.util.Date;
|
||||||
@Schema(description="巡查信息")
|
@Schema(description="巡查信息")
|
||||||
@Data
|
@Data
|
||||||
@TableName("public.inspect_task_detail")
|
@TableName("public.inspect_task_detail")
|
||||||
|
@IgnoreAutoMapperAndDao
|
||||||
public class InspectTaskDetail implements Serializable {
|
public class InspectTaskDetail implements Serializable {
|
||||||
|
|
||||||
public final static String thisTableName = "InspectTaskDetail";
|
public final static String thisTableName = "InspectTaskDetail";
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@ package com.gunshi.project.hsz.common.model;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableField;
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import com.gunshi.db.annotation.IgnoreAutoMapperAndDao;
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
|
|
@ -13,6 +14,7 @@ import java.math.BigDecimal;
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
@TableName("public.jcsk_by_b_d")
|
@TableName("public.jcsk_by_b_d")
|
||||||
|
@IgnoreAutoMapperAndDao
|
||||||
public class JcskByBD {
|
public class JcskByBD {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,8 @@
|
||||||
package com.gunshi.project.hsz.model;
|
package com.gunshi.project.hsz.common.model;
|
||||||
|
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.IdType;
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
|
@ -12,6 +13,7 @@ import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||||
import com.gunshi.core.dateformat.DateFormatString;
|
import com.gunshi.core.dateformat.DateFormatString;
|
||||||
|
|
||||||
|
import com.gunshi.db.annotation.IgnoreAutoMapperAndDao;
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import jakarta.validation.constraints.NotBlank;
|
import jakarta.validation.constraints.NotBlank;
|
||||||
import jakarta.validation.constraints.NotNull;
|
import jakarta.validation.constraints.NotNull;
|
||||||
|
|
@ -27,6 +29,7 @@ import lombok.Data;
|
||||||
@Data
|
@Data
|
||||||
@TableName("public.st_pptn_r")
|
@TableName("public.st_pptn_r")
|
||||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||||
|
@IgnoreAutoMapperAndDao
|
||||||
public class StPptnR implements Serializable {
|
public class StPptnR implements Serializable {
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
package com.gunshi.project.hsz.model;
|
package com.gunshi.project.hsz.common.model;
|
||||||
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.IdType;
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
|
@ -8,6 +8,7 @@ import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||||
import com.gunshi.core.dateformat.DateFormatString;
|
import com.gunshi.core.dateformat.DateFormatString;
|
||||||
|
import com.gunshi.db.annotation.IgnoreAutoMapperAndDao;
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import jakarta.validation.constraints.NotBlank;
|
import jakarta.validation.constraints.NotBlank;
|
||||||
import jakarta.validation.constraints.NotNull;
|
import jakarta.validation.constraints.NotNull;
|
||||||
|
|
@ -27,6 +28,7 @@ import java.util.Date;
|
||||||
@Data
|
@Data
|
||||||
@TableName("public.st_pptn_r_real")
|
@TableName("public.st_pptn_r_real")
|
||||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||||
|
@IgnoreAutoMapperAndDao
|
||||||
public class StPptnRReal implements Serializable {
|
public class StPptnRReal implements Serializable {
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
<mapper namespace="com.gunshi.project.hsz.mapper.StPptnRMapper">
|
<mapper namespace="com.gunshi.project.hsz.common.mapper.StPptnRMapper">
|
||||||
|
|
||||||
<select id="getStcdLastPptnData" resultType="com.gunshi.project.hsz.model.StPptnR">
|
<select id="getStcdLastPptnData" resultType="com.gunshi.project.hsz.common.model.StPptnR">
|
||||||
SELECT stb.stcd,
|
SELECT stb.stcd,
|
||||||
r.tm stm,
|
r.tm stm,
|
||||||
stb.source,
|
stb.source,
|
||||||
|
|
@ -14,7 +14,7 @@
|
||||||
WHERE stb.source in ('QX', 'SW', 'SH', 'SHYLRES')
|
WHERE stb.source in ('QX', 'SW', 'SH', 'SHYLRES')
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="getStcdFirstPptnData" resultType="com.gunshi.project.hsz.model.StPptnR">
|
<select id="getStcdFirstPptnData" resultType="com.gunshi.project.hsz.common.model.StPptnR">
|
||||||
SELECT stb.stcd,
|
SELECT stb.stcd,
|
||||||
r.tm etm,
|
r.tm etm,
|
||||||
stb.source,
|
stb.source,
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
<mapper namespace="com.gunshi.project.hsz.mapper.StPptnRRealMapper">
|
<mapper namespace="com.gunshi.project.hsz.common.mapper.StPptnRRealMapper">
|
||||||
|
|
||||||
<update id="updatePptnRReal">
|
<update id="updatePptnRReal">
|
||||||
with m1 as (select stcd,max(tm) as tmx from st_pptn_r where stcd = #{stcd}
|
with m1 as (select stcd,max(tm) as tmx from st_pptn_r where stcd = #{stcd}
|
||||||
|
|
@ -1,5 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
|
||||||
<mapper namespace="com.gunshi.project.hsz.common.mapper.StStbprpBElemMapper">
|
|
||||||
|
|
||||||
</mapper>
|
|
||||||
|
|
@ -1,5 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
|
||||||
<mapper namespace="com.gunshi.project.hsz.common.mapper.StStbprpBMapper">
|
|
||||||
|
|
||||||
</mapper>
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
package com.gunshi.project.hsz.datasync.config;
|
package com.gunshi.project.hsz.datasync.config;
|
||||||
|
|
||||||
import com.gunshi.project.hsz.datasync.service.impl.SyncByRService;
|
|
||||||
import com.gunshi.project.hsz.datasync.service.impl.SyncGnssRService;
|
import com.gunshi.project.hsz.datasync.service.impl.SyncGnssRService;
|
||||||
import com.gunshi.project.hsz.datasync.service.impl.SyncSlRService;
|
import com.gunshi.project.hsz.datasync.service.impl.SyncSlRService;
|
||||||
import com.gunshi.project.hsz.datasync.service.impl.SyncSyRService;
|
import com.gunshi.project.hsz.datasync.service.impl.SyncSyRService;
|
||||||
|
|
@ -20,9 +19,6 @@ import java.util.concurrent.Executor;
|
||||||
@Slf4j
|
@Slf4j
|
||||||
public class SyncTaskScheduler implements ApplicationRunner {
|
public class SyncTaskScheduler implements ApplicationRunner {
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private SyncByRService syncByRService;
|
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private SyncGnssRService syncGnssRService;
|
private SyncGnssRService syncGnssRService;
|
||||||
|
|
||||||
|
|
@ -60,34 +56,6 @@ public class SyncTaskScheduler implements ApplicationRunner {
|
||||||
log.info("应用初始化完成,定时任务将在下次调度时开始执行");
|
log.info("应用初始化完成,定时任务将在下次调度时开始执行");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 白蚁数据同步任务 - 每5分钟执行一次
|
|
||||||
* 确保上一次执行完毕后才会再次执行
|
|
||||||
*/
|
|
||||||
@Scheduled(cron = "0 */5 * * * ?")
|
|
||||||
public void scheduleSyncByR() {
|
|
||||||
if (!isApplicationReady) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 检查任务是否正在运行,如果是则跳过本次执行
|
|
||||||
if (isSyncByRRunning) {
|
|
||||||
log.info("白蚁数据同步任务正在执行中,跳过本次调度");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
isSyncByRRunning = true; // 标记任务开始执行
|
|
||||||
log.info("开始执行白蚁数据同步任务");
|
|
||||||
syncByRService.syncData();
|
|
||||||
log.info("白蚁数据同步任务执行完成");
|
|
||||||
} catch (Exception e) {
|
|
||||||
log.error("白蚁数据同步任务执行异常", e);
|
|
||||||
} finally {
|
|
||||||
isSyncByRRunning = false; // 无论成功失败,都标记任务执行完毕
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 位移数据同步任务 - 每15分钟执行一次
|
* 位移数据同步任务 - 每15分钟执行一次
|
||||||
* 确保上一次执行完毕后才会再次执行
|
* 确保上一次执行完毕后才会再次执行
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@ package com.gunshi.project.hsz.datasync.entity.jcsk;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableField;
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import com.gunshi.db.annotation.IgnoreAutoMapperAndDao;
|
||||||
import com.gunshi.project.hsz.common.model.JcskGnssR;
|
import com.gunshi.project.hsz.common.model.JcskGnssR;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
|
|
@ -16,6 +17,7 @@ import java.math.BigDecimal;
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
@TableName("SJZT_MD.\"att_mqtt_calc_data\"")
|
@TableName("SJZT_MD.\"att_mqtt_calc_data\"")
|
||||||
|
@IgnoreAutoMapperAndDao
|
||||||
public class AttMqttCalcData {
|
public class AttMqttCalcData {
|
||||||
/**
|
/**
|
||||||
* 水库编码设备编码
|
* 水库编码设备编码
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@ package com.gunshi.project.hsz.datasync.entity.jcsk;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableField;
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import com.gunshi.db.annotation.IgnoreAutoMapperAndDao;
|
||||||
import com.gunshi.project.hsz.common.model.JcskGnssB;
|
import com.gunshi.project.hsz.common.model.JcskGnssB;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
|
|
@ -14,6 +15,7 @@ import lombok.Data;
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
@TableName("SJZT_MD.\"att_wy_cd_base\"")
|
@TableName("SJZT_MD.\"att_wy_cd_base\"")
|
||||||
|
@IgnoreAutoMapperAndDao
|
||||||
public class AttWyCdBase {
|
public class AttWyCdBase {
|
||||||
/**
|
/**
|
||||||
* 测点编码
|
* 测点编码
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@ package com.gunshi.project.hsz.datasync.entity.jcsk;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableField;
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import com.gunshi.db.annotation.IgnoreAutoMapperAndDao;
|
||||||
import com.gunshi.project.hsz.common.model.JcskSyR;
|
import com.gunshi.project.hsz.common.model.JcskSyR;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
|
|
@ -17,6 +18,7 @@ import java.time.LocalDateTime;
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
@TableName("SJZT_ODS.\"dsm_spg_sppr\"")
|
@TableName("SJZT_ODS.\"dsm_spg_sppr\"")
|
||||||
|
@IgnoreAutoMapperAndDao
|
||||||
public class DsmSpgSppr {
|
public class DsmSpgSppr {
|
||||||
/**
|
/**
|
||||||
* 水库代码
|
* 水库代码
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@ package com.gunshi.project.hsz.datasync.entity.jcsk;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableField;
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import com.gunshi.db.annotation.IgnoreAutoMapperAndDao;
|
||||||
import com.gunshi.project.hsz.common.model.JcskSyB;
|
import com.gunshi.project.hsz.common.model.JcskSyB;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
|
|
@ -18,6 +19,7 @@ import java.time.LocalDateTime;
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
@TableName("SJZT_ODS.\"dsm_spg_spprmp\"")
|
@TableName("SJZT_ODS.\"dsm_spg_spprmp\"")
|
||||||
|
@IgnoreAutoMapperAndDao
|
||||||
public class DsmSpgSpprmp {
|
public class DsmSpgSpprmp {
|
||||||
/**
|
/**
|
||||||
* 水库代码
|
* 水库代码
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@ package com.gunshi.project.hsz.datasync.entity.jcsk;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableField;
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import com.gunshi.db.annotation.IgnoreAutoMapperAndDao;
|
||||||
import com.gunshi.project.hsz.common.model.JcskSlR;
|
import com.gunshi.project.hsz.common.model.JcskSlR;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
|
|
@ -17,6 +18,7 @@ import java.time.LocalDateTime;
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
@TableName("SJZT_ODS.\"dsm_spg_spqn\"")
|
@TableName("SJZT_ODS.\"dsm_spg_spqn\"")
|
||||||
|
@IgnoreAutoMapperAndDao
|
||||||
public class DsmSpgSpqn {
|
public class DsmSpgSpqn {
|
||||||
/**
|
/**
|
||||||
* 水库代码
|
* 水库代码
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@ package com.gunshi.project.hsz.datasync.entity.jcsk;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableField;
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import com.gunshi.db.annotation.IgnoreAutoMapperAndDao;
|
||||||
import com.gunshi.project.hsz.common.model.JcskSlB;
|
import com.gunshi.project.hsz.common.model.JcskSlB;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
|
|
@ -18,6 +19,7 @@ import java.time.LocalDateTime;
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
@TableName("SJZT_ODS.\"dsm_spg_spqnmp\"")
|
@TableName("SJZT_ODS.\"dsm_spg_spqnmp\"")
|
||||||
|
@IgnoreAutoMapperAndDao
|
||||||
public class DsmSpgSpqnmp {
|
public class DsmSpgSpqnmp {
|
||||||
/**
|
/**
|
||||||
* 水库代码
|
* 水库代码
|
||||||
|
|
|
||||||
|
|
@ -1,110 +0,0 @@
|
||||||
package com.gunshi.project.hsz.datasync.entity.jcsk;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableField;
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
|
||||||
import com.gunshi.project.hsz.common.model.JcskByR;
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
import java.time.LocalDateTime;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 白蚁数据表(数据源表)
|
|
||||||
* 对应数据库表:SJZT_ODS.water_data_termites
|
|
||||||
* 数据来源:该表数据同步至jcsk_by_r表
|
|
||||||
* @see WaterDevice
|
|
||||||
* @see JcskByR
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
@TableName("SJZT_ODS.\"water_data_termites\"")
|
|
||||||
public class WaterDataTermites {
|
|
||||||
/**
|
|
||||||
* 设备编码
|
|
||||||
*/
|
|
||||||
@TableField("\"mn_no\"")
|
|
||||||
private String mnNo;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 白蚁蚁情状态,有白蚁入侵为1
|
|
||||||
*/
|
|
||||||
@TableField("\"status\"")
|
|
||||||
private Integer status;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 白蚁设备电量
|
|
||||||
*/
|
|
||||||
@TableField("\"electricity\"")
|
|
||||||
private Integer electricity;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 白蚁设备安装的点位顺序
|
|
||||||
*/
|
|
||||||
@TableField("\"order\"")
|
|
||||||
private String order;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 创建时间
|
|
||||||
*/
|
|
||||||
@TableField("\"created_at\"")
|
|
||||||
private LocalDateTime createdAt;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 观测时间
|
|
||||||
*/
|
|
||||||
@TableField("\"ob_time\"")
|
|
||||||
private String obTime;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 观测时间2
|
|
||||||
*/
|
|
||||||
@TableField("\"ob_date\"")
|
|
||||||
private LocalDateTime obDate;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 主键id
|
|
||||||
*/
|
|
||||||
@TableId("\"id\"")
|
|
||||||
private Integer id;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 水库id
|
|
||||||
*/
|
|
||||||
@TableField("\"station_id\"")
|
|
||||||
private Integer stationId;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 站点名称
|
|
||||||
*/
|
|
||||||
@TableField("\"station_name\"")
|
|
||||||
private String stationName;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 设备id
|
|
||||||
*/
|
|
||||||
@TableField("\"device_id\"")
|
|
||||||
private Integer deviceId;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 设备名称
|
|
||||||
*/
|
|
||||||
@TableField("\"device_name\"")
|
|
||||||
private String deviceName;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 任务状态
|
|
||||||
*/
|
|
||||||
@TableField("\"task_status\"")
|
|
||||||
private String taskStatus;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 任务id
|
|
||||||
*/
|
|
||||||
@TableField("\"task_id\"")
|
|
||||||
private String taskId;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 接收类型
|
|
||||||
*/
|
|
||||||
@TableField("\"receive_type\"")
|
|
||||||
private Short receiveType;
|
|
||||||
}
|
|
||||||
|
|
@ -1,211 +0,0 @@
|
||||||
package com.gunshi.project.hsz.datasync.entity.jcsk;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableField;
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
|
||||||
import com.gunshi.project.hsz.common.model.JcskByB;
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 白蚁设备表(数据源表)
|
|
||||||
* 对应数据库表:SJZT_ODS.water_device
|
|
||||||
* 数据来源:该表数据同步至jcsk_by_b表
|
|
||||||
* @see JcskByB
|
|
||||||
* @see WaterDataTermites
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
@TableName("SJZT_ODS.\"water_device\"")
|
|
||||||
public class WaterDevice {
|
|
||||||
/**
|
|
||||||
* 主键
|
|
||||||
*/
|
|
||||||
@TableField("\"id\"")
|
|
||||||
private Integer id;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 设备名称
|
|
||||||
*/
|
|
||||||
@TableField("\"name\"")
|
|
||||||
private String name;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 设备编码
|
|
||||||
*/
|
|
||||||
@TableField("\"code\"")
|
|
||||||
private String code;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 站点接入编码
|
|
||||||
*/
|
|
||||||
@TableField("\"mn_no\"")
|
|
||||||
private String mnNo;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 厂家id
|
|
||||||
*/
|
|
||||||
@TableField("\"factory_id\"")
|
|
||||||
private Integer factoryId;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 服务站点id
|
|
||||||
*/
|
|
||||||
@TableField("\"station_id\"")
|
|
||||||
private Integer stationId;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 服务站点名称
|
|
||||||
*/
|
|
||||||
@TableField("\"station_name\"")
|
|
||||||
private String stationName;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 创建时间
|
|
||||||
*/
|
|
||||||
@TableField("\"created_at\"")
|
|
||||||
private Integer createdAt;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 创建人id
|
|
||||||
*/
|
|
||||||
@TableField("\"created_user\"")
|
|
||||||
private Integer createdUser;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 修改时间
|
|
||||||
*/
|
|
||||||
@TableField("\"updated_at\"")
|
|
||||||
private Integer updatedAt;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 修改人id
|
|
||||||
*/
|
|
||||||
@TableField("\"updated_user\"")
|
|
||||||
private Integer updatedUser;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 状态
|
|
||||||
*/
|
|
||||||
@TableField("\"status\"")
|
|
||||||
private Integer status;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 纬度
|
|
||||||
*/
|
|
||||||
@TableField("\"lat\"")
|
|
||||||
private BigDecimal lat;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 经度
|
|
||||||
*/
|
|
||||||
@TableField("\"lon\"")
|
|
||||||
private BigDecimal lon;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 省份id
|
|
||||||
*/
|
|
||||||
@TableField("\"province_id\"")
|
|
||||||
private Long provinceId;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 省份名称
|
|
||||||
*/
|
|
||||||
@TableField("\"province_name\"")
|
|
||||||
private String provinceName;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 城市id
|
|
||||||
*/
|
|
||||||
@TableField("\"city_id\"")
|
|
||||||
private Long cityId;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 城市名称
|
|
||||||
*/
|
|
||||||
@TableField("\"city_name\"")
|
|
||||||
private String cityName;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 区域名称
|
|
||||||
*/
|
|
||||||
@TableField("\"area_name\"")
|
|
||||||
private String areaName;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 区域id
|
|
||||||
*/
|
|
||||||
@TableField("\"area_id\"")
|
|
||||||
private Long areaId;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 设备类型
|
|
||||||
*/
|
|
||||||
@TableField("\"type\"")
|
|
||||||
private Integer type;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 设备类型详情
|
|
||||||
*/
|
|
||||||
@TableField("\"send_type\"")
|
|
||||||
private String sendType;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 联系人
|
|
||||||
*/
|
|
||||||
@TableField("\"contact\"")
|
|
||||||
private String contact;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 联系电话
|
|
||||||
*/
|
|
||||||
@TableField("\"telephone\"")
|
|
||||||
private String telephone;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 流域
|
|
||||||
*/
|
|
||||||
@TableField("\"river\"")
|
|
||||||
private String river;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 安装地点
|
|
||||||
*/
|
|
||||||
@TableField("\"address\"")
|
|
||||||
private String address;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 产品型号
|
|
||||||
*/
|
|
||||||
@TableField("\"model\"")
|
|
||||||
private String model;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 备注
|
|
||||||
*/
|
|
||||||
@TableField("\"remark\"")
|
|
||||||
private String remark;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 通信方式
|
|
||||||
*/
|
|
||||||
@TableField("\"communication_type\"")
|
|
||||||
private Integer communicationType;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 设备图片
|
|
||||||
*/
|
|
||||||
@TableField("\"image_url\"")
|
|
||||||
private String imageUrl;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 设备视频流地址的ip
|
|
||||||
*/
|
|
||||||
@TableField("\"video_ip\"")
|
|
||||||
private String videoIp;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 设备视频id
|
|
||||||
*/
|
|
||||||
@TableField("\"video_id\"")
|
|
||||||
private String videoId;
|
|
||||||
}
|
|
||||||
|
|
@ -1,12 +1,12 @@
|
||||||
package com.gunshi.project.hsz.datasync.service.impl;
|
package com.gunshi.project.hsz.datasync.flow;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.gunshi.project.hsz.common.mapper.StFlowRMapper;
|
||||||
import com.gunshi.project.hsz.common.model.StFlowR;
|
import com.gunshi.project.hsz.common.model.StFlowR;
|
||||||
import com.gunshi.project.hsz.common.model.StStbprpBElem;
|
import com.gunshi.project.hsz.common.model.StStbprpBElem;
|
||||||
import com.gunshi.project.hsz.datasync.entity.jcsk.JcskStFlowR;
|
import com.gunshi.project.hsz.datasync.flow.datasource.JcskStFlowR;
|
||||||
import com.gunshi.project.hsz.datasync.mapper.StFlowRMapper;
|
import com.gunshi.project.hsz.common.mapper.StStbprpBElemMapper;
|
||||||
import com.gunshi.project.hsz.datasync.mapper.StbprpElemMapper;
|
import com.gunshi.project.hsz.datasync.flow.datasource.JcskStFlowRMapper;
|
||||||
import com.gunshi.project.hsz.datasync.mapper.jcsk.JcskStFlowRMapper;
|
|
||||||
import com.gunshi.project.hsz.datasync.service.SyncTableRService;
|
import com.gunshi.project.hsz.datasync.service.SyncTableRService;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.beans.BeanUtils;
|
import org.springframework.beans.BeanUtils;
|
||||||
|
|
@ -24,7 +24,7 @@ import java.util.List;
|
||||||
*/
|
*/
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@Service
|
@Service
|
||||||
public class SyncFlowRService implements SyncTableRService<JcskStFlowR, StFlowR> {
|
public class SyncFlowService implements SyncTableRService<JcskStFlowR, StFlowR> {
|
||||||
@Autowired
|
@Autowired
|
||||||
private JcskStFlowRMapper jcskStFlowRMapper;
|
private JcskStFlowRMapper jcskStFlowRMapper;
|
||||||
|
|
||||||
|
|
@ -32,7 +32,7 @@ public class SyncFlowRService implements SyncTableRService<JcskStFlowR, StFlowR>
|
||||||
private StFlowRMapper stFlowRMapper;
|
private StFlowRMapper stFlowRMapper;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private StbprpElemMapper stbprpMapper;
|
private StStbprpBElemMapper stbprpMapper;
|
||||||
|
|
||||||
@Scheduled(cron = "0 */15 * * * ?")
|
@Scheduled(cron = "0 */15 * * * ?")
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -1,9 +1,10 @@
|
||||||
package com.gunshi.project.hsz.datasync.entity.jcsk;
|
package com.gunshi.project.hsz.datasync.flow.datasource;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.IdType;
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
import com.baomidou.mybatisplus.annotation.TableField;
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import com.gunshi.db.annotation.IgnoreAutoMapperAndDao;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
|
@ -15,6 +16,7 @@ import java.time.LocalDateTime;
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
@TableName("SJZT_ODS.\"st_flow_r\"")
|
@TableName("SJZT_ODS.\"st_flow_r\"")
|
||||||
|
@IgnoreAutoMapperAndDao
|
||||||
public class JcskStFlowR {
|
public class JcskStFlowR {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -1,8 +1,7 @@
|
||||||
package com.gunshi.project.hsz.datasync.mapper.jcsk;
|
package com.gunshi.project.hsz.datasync.flow.datasource;
|
||||||
|
|
||||||
import com.baomidou.dynamic.datasource.annotation.DS;
|
import com.baomidou.dynamic.datasource.annotation.DS;
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
import com.gunshi.project.hsz.datasync.entity.jcsk.JcskStFlowR;
|
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -1,33 +0,0 @@
|
||||||
package com.gunshi.project.hsz.datasync.gate;
|
|
||||||
|
|
||||||
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 lombok.Data;
|
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
|
||||||
import java.time.LocalDateTime;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author lyf
|
|
||||||
* @since 2025-10-20
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
@TableName("st_gate_r")
|
|
||||||
public class GateOpeningHeight {
|
|
||||||
@TableId(value = "id", type = IdType.AUTO)
|
|
||||||
private Long id;
|
|
||||||
|
|
||||||
@TableField(value="stcd")
|
|
||||||
private String stcd;
|
|
||||||
|
|
||||||
@TableField(value="gtop")
|
|
||||||
private BigDecimal gtop;
|
|
||||||
|
|
||||||
@TableField(value="tm")
|
|
||||||
private LocalDateTime tm;
|
|
||||||
|
|
||||||
@TableField(value="recv_tm")
|
|
||||||
private LocalDateTime recvTm;
|
|
||||||
}
|
|
||||||
|
|
@ -1,14 +0,0 @@
|
||||||
package com.gunshi.project.hsz.datasync.gate;
|
|
||||||
|
|
||||||
import com.baomidou.dynamic.datasource.annotation.DS;
|
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author lyf
|
|
||||||
* @since 2025-10-20
|
|
||||||
*/
|
|
||||||
@DS("tsg")
|
|
||||||
@Mapper
|
|
||||||
public interface GateOpeningHeightMapper extends BaseMapper<GateOpeningHeight> {
|
|
||||||
}
|
|
||||||
|
|
@ -1,62 +0,0 @@
|
||||||
package com.gunshi.project.hsz.datasync.gate;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.scheduling.annotation.Scheduled;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
|
||||||
import java.math.RoundingMode;
|
|
||||||
import java.time.LocalDateTime;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author lyf
|
|
||||||
* @since 2025-10-20
|
|
||||||
*/
|
|
||||||
@Service
|
|
||||||
public class GateOpeningHeightService {
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private GateOpeningHeightMapper targetMapper;
|
|
||||||
|
|
||||||
@Scheduled(cron = "0 */5 * * * ?")
|
|
||||||
public int syncData() {
|
|
||||||
LocalDateTime tm = LocalDateTime.now();
|
|
||||||
//抹去分和秒
|
|
||||||
tm = tm.withMinute(0).withSecond(0).withNano(0);
|
|
||||||
GateOpeningHeight target = new GateOpeningHeight();
|
|
||||||
BigDecimal height;
|
|
||||||
GateOpeningHeight exist;
|
|
||||||
|
|
||||||
target.setStcd("30111");
|
|
||||||
target.setTm(tm);
|
|
||||||
height = BigDecimal.valueOf(Math.random() * 10).setScale(0, RoundingMode.HALF_UP);
|
|
||||||
target.setGtop(height);
|
|
||||||
target.setRecvTm(tm);
|
|
||||||
exist = targetMapper.selectOne(
|
|
||||||
new LambdaQueryWrapper<GateOpeningHeight>()
|
|
||||||
.eq(GateOpeningHeight::getStcd, target.getStcd())
|
|
||||||
.eq(GateOpeningHeight::getTm, target.getTm())
|
|
||||||
);
|
|
||||||
if (exist == null) {
|
|
||||||
targetMapper.insert(target);
|
|
||||||
}
|
|
||||||
|
|
||||||
target.setStcd("30222");
|
|
||||||
target.setTm(tm);
|
|
||||||
height = BigDecimal.valueOf(Math.random() * 10).setScale(0, RoundingMode.HALF_UP);
|
|
||||||
target.setGtop(height);
|
|
||||||
target.setRecvTm(tm);
|
|
||||||
exist = targetMapper.selectOne(
|
|
||||||
new LambdaQueryWrapper<GateOpeningHeight>()
|
|
||||||
.eq(GateOpeningHeight::getStcd, target.getStcd())
|
|
||||||
.eq(GateOpeningHeight::getTm, target.getTm())
|
|
||||||
);
|
|
||||||
if (exist == null) {
|
|
||||||
targetMapper.insert(target);
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
@ -1,15 +0,0 @@
|
||||||
package com.gunshi.project.hsz.datasync.mapper;
|
|
||||||
|
|
||||||
import com.baomidou.dynamic.datasource.annotation.DS;
|
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
|
||||||
import com.gunshi.project.hsz.common.model.StFlowR;
|
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author lyf
|
|
||||||
* @since 2025-10-16
|
|
||||||
*/
|
|
||||||
@DS("tsg")
|
|
||||||
@Mapper
|
|
||||||
public interface StFlowRMapper extends BaseMapper<StFlowR> {
|
|
||||||
}
|
|
||||||
|
|
@ -1,27 +0,0 @@
|
||||||
package com.gunshi.project.hsz.datasync.mapper;
|
|
||||||
|
|
||||||
import com.baomidou.dynamic.datasource.annotation.DS;
|
|
||||||
import com.gunshi.project.hsz.common.model.StStbprpBElem;
|
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
|
||||||
import org.apache.ibatis.annotations.Param;
|
|
||||||
import org.apache.ibatis.annotations.Select;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author lyf
|
|
||||||
* @since 2025-10-16
|
|
||||||
*/
|
|
||||||
@DS("tsg")
|
|
||||||
@Mapper
|
|
||||||
public interface StbprpElemMapper {
|
|
||||||
|
|
||||||
@Select("""
|
|
||||||
<script>
|
|
||||||
select b.stcd, e.elem from st_stbprp_b b
|
|
||||||
left join st_stbprp_b_elem e on b.stcd=e.stcd
|
|
||||||
where elem = #{elem}
|
|
||||||
</script>
|
|
||||||
""")
|
|
||||||
List<StStbprpBElem> selectByElem(@Param("elem") String elem);
|
|
||||||
}
|
|
||||||
|
|
@ -1,47 +0,0 @@
|
||||||
package com.gunshi.project.hsz.datasync.rainfall;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableField;
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
|
||||||
import java.time.LocalDateTime;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author lyf
|
|
||||||
* @since 2025-10-20
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
@TableName("st_pptn_r")
|
|
||||||
public class Rainfall {
|
|
||||||
/**
|
|
||||||
* 测站编码
|
|
||||||
*/
|
|
||||||
@TableField("stcd")
|
|
||||||
private String stcd;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 时段降水量
|
|
||||||
*/
|
|
||||||
@TableField("drp")
|
|
||||||
private BigDecimal drp;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 时间
|
|
||||||
*/
|
|
||||||
@TableField("tm")
|
|
||||||
private LocalDateTime tm;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 时段长
|
|
||||||
*/
|
|
||||||
@TableField("intv")
|
|
||||||
private BigDecimal intv;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 天气状况
|
|
||||||
*/
|
|
||||||
@TableField("wth")
|
|
||||||
private String wth;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
@ -1,14 +0,0 @@
|
||||||
package com.gunshi.project.hsz.datasync.rainfall;
|
|
||||||
|
|
||||||
import com.baomidou.dynamic.datasource.annotation.DS;
|
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author lyf
|
|
||||||
* @since 2025-10-20
|
|
||||||
*/
|
|
||||||
@DS("tsg")
|
|
||||||
@Mapper
|
|
||||||
public interface RainfallMapper extends BaseMapper<Rainfall> {
|
|
||||||
}
|
|
||||||
|
|
@ -1,13 +0,0 @@
|
||||||
package com.gunshi.project.hsz.datasync.rainfall;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author lyf
|
|
||||||
* @since 2025-10-20
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
@TableName("st_pptn_r_real")
|
|
||||||
public class RainfallReal {
|
|
||||||
}
|
|
||||||
|
|
@ -1,16 +0,0 @@
|
||||||
package com.gunshi.project.hsz.datasync.rainfall;
|
|
||||||
|
|
||||||
import com.baomidou.dynamic.datasource.annotation.DS;
|
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
|
||||||
import org.apache.ibatis.annotations.Param;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author lyf
|
|
||||||
* @since 2025-10-20
|
|
||||||
*/
|
|
||||||
@DS("tsg")
|
|
||||||
@Mapper
|
|
||||||
public interface RainfallRealMapper extends BaseMapper<RainfallReal> {
|
|
||||||
int updateReal(@Param("stcd") String stcd);
|
|
||||||
}
|
|
||||||
|
|
@ -1,8 +1,11 @@
|
||||||
package com.gunshi.project.hsz.datasync.rainfall;
|
package com.gunshi.project.hsz.datasync.rainfall;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.gunshi.project.hsz.common.mapper.StPptnRMapper;
|
||||||
|
import com.gunshi.project.hsz.common.mapper.StPptnRRealMapper;
|
||||||
|
import com.gunshi.project.hsz.common.mapper.StStbprpBElemMapper;
|
||||||
|
import com.gunshi.project.hsz.common.model.StPptnR;
|
||||||
import com.gunshi.project.hsz.common.model.StStbprpBElem;
|
import com.gunshi.project.hsz.common.model.StStbprpBElem;
|
||||||
import com.gunshi.project.hsz.datasync.mapper.StbprpElemMapper;
|
|
||||||
import com.gunshi.project.hsz.datasync.rainfall.datasource.JcskStPptnR;
|
import com.gunshi.project.hsz.datasync.rainfall.datasource.JcskStPptnR;
|
||||||
import com.gunshi.project.hsz.datasync.rainfall.datasource.JcskStPptnRMapper;
|
import com.gunshi.project.hsz.datasync.rainfall.datasource.JcskStPptnRMapper;
|
||||||
import com.gunshi.project.hsz.datasync.service.SyncTableRService;
|
import com.gunshi.project.hsz.datasync.service.SyncTableRService;
|
||||||
|
|
@ -20,18 +23,18 @@ import java.util.List;
|
||||||
* @since 2025-10-20
|
* @since 2025-10-20
|
||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
public class RainfallService implements SyncTableRService<JcskStPptnR, Rainfall> {
|
public class SyncRainfallService implements SyncTableRService<JcskStPptnR, StPptnR> {
|
||||||
@Autowired
|
@Autowired
|
||||||
private JcskStPptnRMapper sourceMapper;
|
private JcskStPptnRMapper sourceMapper;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private RainfallRealMapper targetRealMapper;
|
private StPptnRRealMapper targetRealMapper;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private RainfallMapper targetMapper;
|
private StPptnRMapper targetMapper;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private StbprpElemMapper stbprpMapper;
|
private StStbprpBElemMapper stbprpMapper;
|
||||||
|
|
||||||
@Scheduled(cron = "0 */5 * * * ?")
|
@Scheduled(cron = "0 */5 * * * ?")
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -41,10 +44,10 @@ public class RainfallService implements SyncTableRService<JcskStPptnR, Rainfall>
|
||||||
|
|
||||||
int cnt = 0;
|
int cnt = 0;
|
||||||
for (StStbprpBElem StStbprpBElem : stbprps) {
|
for (StStbprpBElem StStbprpBElem : stbprps) {
|
||||||
Rainfall targetParams = new Rainfall();
|
StPptnR targetParams = new StPptnR();
|
||||||
targetParams.setStcd(StStbprpBElem.getStcd());
|
targetParams.setStcd(StStbprpBElem.getStcd());
|
||||||
|
|
||||||
Rainfall latestTarget = getLatestTargetEntity(targetParams);
|
StPptnR latestTarget = getLatestTargetEntity(targetParams);
|
||||||
List<JcskStPptnR> sourceEntityList = getSourceEntityListByLatestTargetEntity(latestTarget);
|
List<JcskStPptnR> sourceEntityList = getSourceEntityListByLatestTargetEntity(latestTarget);
|
||||||
cnt += saveToTarget(sourceEntityList);
|
cnt += saveToTarget(sourceEntityList);
|
||||||
}
|
}
|
||||||
|
|
@ -53,18 +56,18 @@ public class RainfallService implements SyncTableRService<JcskStPptnR, Rainfall>
|
||||||
|
|
||||||
@NonNull
|
@NonNull
|
||||||
@Override
|
@Override
|
||||||
public Rainfall getLatestTargetEntity(Rainfall targetParams) {
|
public StPptnR getLatestTargetEntity(StPptnR targetParams) {
|
||||||
String stcd = targetParams.getStcd();
|
String stcd = targetParams.getStcd();
|
||||||
|
|
||||||
Rainfall target = targetMapper.selectOne(
|
StPptnR target = targetMapper.selectOne(
|
||||||
new LambdaQueryWrapper<Rainfall>()
|
new LambdaQueryWrapper<StPptnR>()
|
||||||
.eq(Rainfall::getStcd, stcd)
|
.eq(StPptnR::getStcd, stcd)
|
||||||
.orderByDesc(Rainfall::getTm)
|
.orderByDesc(StPptnR::getTm)
|
||||||
.last("limit 1")
|
.last("limit 1")
|
||||||
);
|
);
|
||||||
|
|
||||||
if (target == null) {
|
if (target == null) {
|
||||||
target = new Rainfall();
|
target = new StPptnR();
|
||||||
target.setStcd(stcd);
|
target.setStcd(stcd);
|
||||||
target.setTm(LocalDateTime.of(2025, 10, 20, 15, 0, 0));
|
target.setTm(LocalDateTime.of(2025, 10, 20, 15, 0, 0));
|
||||||
}
|
}
|
||||||
|
|
@ -73,7 +76,7 @@ public class RainfallService implements SyncTableRService<JcskStPptnR, Rainfall>
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<JcskStPptnR> getSourceEntityListByLatestTargetEntity(@NonNull Rainfall targetEntity) {
|
public List<JcskStPptnR> getSourceEntityListByLatestTargetEntity(@NonNull StPptnR targetEntity) {
|
||||||
String stcd = targetEntity.getStcd();
|
String stcd = targetEntity.getStcd();
|
||||||
LocalDateTime tm = targetEntity.getTm();
|
LocalDateTime tm = targetEntity.getTm();
|
||||||
return sourceMapper.selectList(
|
return sourceMapper.selectList(
|
||||||
|
|
@ -89,14 +92,14 @@ public class RainfallService implements SyncTableRService<JcskStPptnR, Rainfall>
|
||||||
for (JcskStPptnR sourceEntity : sourceEntityList) {
|
for (JcskStPptnR sourceEntity : sourceEntityList) {
|
||||||
String stcd = sourceEntity.getStcd();
|
String stcd = sourceEntity.getStcd();
|
||||||
LocalDateTime tm = sourceEntity.getTm();
|
LocalDateTime tm = sourceEntity.getTm();
|
||||||
Rainfall existingTarget = targetMapper.selectOne(
|
StPptnR existingTarget = targetMapper.selectOne(
|
||||||
new LambdaQueryWrapper<Rainfall>()
|
new LambdaQueryWrapper<StPptnR>()
|
||||||
.eq(Rainfall::getStcd, stcd)
|
.eq(StPptnR::getStcd, stcd)
|
||||||
.eq(Rainfall::getTm, tm)
|
.eq(StPptnR::getTm, tm)
|
||||||
);
|
);
|
||||||
|
|
||||||
if (existingTarget == null) {
|
if (existingTarget == null) {
|
||||||
Rainfall targetEntity = new Rainfall();
|
StPptnR targetEntity = new StPptnR();
|
||||||
BeanUtils.copyProperties(sourceEntity, targetEntity);
|
BeanUtils.copyProperties(sourceEntity, targetEntity);
|
||||||
targetMapper.insert(targetEntity);
|
targetMapper.insert(targetEntity);
|
||||||
}
|
}
|
||||||
|
|
@ -106,7 +109,7 @@ public class RainfallService implements SyncTableRService<JcskStPptnR, Rainfall>
|
||||||
if (!sourceEntityList.isEmpty()) {
|
if (!sourceEntityList.isEmpty()) {
|
||||||
JcskStPptnR sourceEntity = sourceEntityList.getFirst();
|
JcskStPptnR sourceEntity = sourceEntityList.getFirst();
|
||||||
String stcd = sourceEntity.getStcd();
|
String stcd = sourceEntity.getStcd();
|
||||||
targetRealMapper.updateReal(stcd);
|
targetRealMapper.updatePptnRReal(stcd);
|
||||||
}
|
}
|
||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
|
|
@ -2,6 +2,7 @@ package com.gunshi.project.hsz.datasync.rainfall.datasource;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableField;
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import com.gunshi.db.annotation.IgnoreAutoMapperAndDao;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
|
@ -13,6 +14,7 @@ import java.time.LocalDateTime;
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
@TableName("SJZT_MD.\"st_pptn_r\"")
|
@TableName("SJZT_MD.\"st_pptn_r\"")
|
||||||
|
@IgnoreAutoMapperAndDao
|
||||||
public class JcskStPptnR {
|
public class JcskStPptnR {
|
||||||
/**
|
/**
|
||||||
* 测站编码
|
* 测站编码
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@ package com.gunshi.project.hsz.datasync.riverWaterLevel;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.gunshi.project.hsz.common.model.StStbprpBElem;
|
import com.gunshi.project.hsz.common.model.StStbprpBElem;
|
||||||
import com.gunshi.project.hsz.datasync.mapper.StbprpElemMapper;
|
import com.gunshi.project.hsz.common.mapper.StStbprpBElemMapper;
|
||||||
import com.gunshi.project.hsz.datasync.rsvrWaterLevel.datasource.JcskStRsvrR;
|
import com.gunshi.project.hsz.datasync.rsvrWaterLevel.datasource.JcskStRsvrR;
|
||||||
import com.gunshi.project.hsz.datasync.rsvrWaterLevel.datasource.JcskStRsvrRMapper;
|
import com.gunshi.project.hsz.datasync.rsvrWaterLevel.datasource.JcskStRsvrRMapper;
|
||||||
import com.gunshi.project.hsz.datasync.service.SyncTableRService;
|
import com.gunshi.project.hsz.datasync.service.SyncTableRService;
|
||||||
|
|
@ -21,7 +21,7 @@ import java.util.List;
|
||||||
* 荆楚水库的河道水位和水库水位共用一张表
|
* 荆楚水库的河道水位和水库水位共用一张表
|
||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
public class RiverWaterLevelService implements SyncTableRService<JcskStRsvrR, RiverWaterLevel> {
|
public class SyncRiverWaterLevelService implements SyncTableRService<JcskStRsvrR, RiverWaterLevel> {
|
||||||
@Autowired
|
@Autowired
|
||||||
private JcskStRsvrRMapper sourceMapper;
|
private JcskStRsvrRMapper sourceMapper;
|
||||||
|
|
||||||
|
|
@ -32,7 +32,7 @@ public class RiverWaterLevelService implements SyncTableRService<JcskStRsvrR, Ri
|
||||||
private RiverWaterLevelMapper targetMapper;
|
private RiverWaterLevelMapper targetMapper;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private StbprpElemMapper stbprpMapper;
|
private StStbprpBElemMapper stbprpMapper;
|
||||||
|
|
||||||
@Scheduled(cron = "0 */5 * * * ?")
|
@Scheduled(cron = "0 */5 * * * ?")
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -2,7 +2,7 @@ package com.gunshi.project.hsz.datasync.rsvrWaterLevel;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.gunshi.project.hsz.common.model.StStbprpBElem;
|
import com.gunshi.project.hsz.common.model.StStbprpBElem;
|
||||||
import com.gunshi.project.hsz.datasync.mapper.StbprpElemMapper;
|
import com.gunshi.project.hsz.common.mapper.StStbprpBElemMapper;
|
||||||
import com.gunshi.project.hsz.datasync.rsvrWaterLevel.datasource.JcskStRsvrR;
|
import com.gunshi.project.hsz.datasync.rsvrWaterLevel.datasource.JcskStRsvrR;
|
||||||
import com.gunshi.project.hsz.datasync.rsvrWaterLevel.datasource.JcskStRsvrRMapper;
|
import com.gunshi.project.hsz.datasync.rsvrWaterLevel.datasource.JcskStRsvrRMapper;
|
||||||
import com.gunshi.project.hsz.datasync.service.SyncTableRService;
|
import com.gunshi.project.hsz.datasync.service.SyncTableRService;
|
||||||
|
|
@ -20,7 +20,7 @@ import java.util.List;
|
||||||
* @since 2025-10-20
|
* @since 2025-10-20
|
||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
public class RsvrWaterLevelService implements SyncTableRService<JcskStRsvrR, RsvrWaterLevel> {
|
public class SyncRsvrWaterLevelService implements SyncTableRService<JcskStRsvrR, RsvrWaterLevel> {
|
||||||
@Autowired
|
@Autowired
|
||||||
private JcskStRsvrRMapper sourceMapper;
|
private JcskStRsvrRMapper sourceMapper;
|
||||||
|
|
||||||
|
|
@ -31,7 +31,7 @@ public class RsvrWaterLevelService implements SyncTableRService<JcskStRsvrR, Rsv
|
||||||
private RsvrWaterLevelMapper targetMapper;
|
private RsvrWaterLevelMapper targetMapper;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private StbprpElemMapper stbprpMapper;
|
private StStbprpBElemMapper stbprpMapper;
|
||||||
|
|
||||||
@Scheduled(cron = "0 */5 * * * ?")
|
@Scheduled(cron = "0 */5 * * * ?")
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -3,6 +3,7 @@ package com.gunshi.project.hsz.datasync.rsvrWaterLevel.datasource;
|
||||||
import com.baomidou.mybatisplus.annotation.TableField;
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import com.gunshi.db.annotation.IgnoreAutoMapperAndDao;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
|
@ -14,6 +15,7 @@ import java.time.LocalDateTime;
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
@TableName("SJZT_MD.\"st_rsvr_r\"")
|
@TableName("SJZT_MD.\"st_rsvr_r\"")
|
||||||
|
@IgnoreAutoMapperAndDao
|
||||||
public class JcskStRsvrR {
|
public class JcskStRsvrR {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -1,104 +0,0 @@
|
||||||
package com.gunshi.project.hsz.datasync.service.impl;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
||||||
import com.gunshi.project.hsz.common.model.JcskByB;
|
|
||||||
import com.gunshi.project.hsz.common.model.JcskByR;
|
|
||||||
import com.gunshi.project.hsz.datasync.entity.jcsk.WaterDataTermites;
|
|
||||||
import com.gunshi.project.hsz.common.mapper.JcskByBMapper;
|
|
||||||
import com.gunshi.project.hsz.common.mapper.JcskByRMapper;
|
|
||||||
import com.gunshi.project.hsz.datasync.mapper.jcsk.WaterDataTermitesMapper;
|
|
||||||
import com.gunshi.project.hsz.datasync.service.SyncTableRService;
|
|
||||||
import org.springframework.beans.BeanUtils;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.lang.NonNull;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
|
|
||||||
import java.time.LocalDateTime;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
@Service
|
|
||||||
public class SyncByRService implements SyncTableRService<WaterDataTermites, JcskByR> {
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private WaterDataTermitesMapper sourceMapper;
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private JcskByBMapper targetBMapper;
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private JcskByRMapper targetMapper;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int syncData() {
|
|
||||||
List<JcskByB> targetBList = targetBMapper.selectList(null);
|
|
||||||
|
|
||||||
int cnt = 0;
|
|
||||||
for (JcskByB targetB : targetBList) {
|
|
||||||
JcskByR targetParams = new JcskByR();
|
|
||||||
targetParams.setDeviceId(targetB.getId());
|
|
||||||
|
|
||||||
JcskByR latestTarget = getLatestTargetEntity(targetParams);
|
|
||||||
List<WaterDataTermites> sourceEntityList = getSourceEntityListByLatestTargetEntity(latestTarget);
|
|
||||||
cnt += saveToTarget(sourceEntityList);
|
|
||||||
}
|
|
||||||
return cnt;
|
|
||||||
}
|
|
||||||
|
|
||||||
@NonNull
|
|
||||||
@Override
|
|
||||||
public JcskByR getLatestTargetEntity(JcskByR targetParams) {
|
|
||||||
Integer deviceId = targetParams.getDeviceId();
|
|
||||||
|
|
||||||
JcskByR target = targetMapper.selectOne(
|
|
||||||
new LambdaQueryWrapper<JcskByR>()
|
|
||||||
.eq(JcskByR::getDeviceId, deviceId)
|
|
||||||
.orderByDesc(JcskByR::getObDate)
|
|
||||||
.last("limit 1")
|
|
||||||
);
|
|
||||||
|
|
||||||
if (target == null) {
|
|
||||||
target = new JcskByR();
|
|
||||||
target.setDeviceId(deviceId);
|
|
||||||
//数据源最早的数据时间
|
|
||||||
target.setObDate(LocalDateTime.of(2025, 8, 22, 10, 15, 0));
|
|
||||||
}
|
|
||||||
|
|
||||||
return target;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<WaterDataTermites> getSourceEntityListByLatestTargetEntity(@NonNull JcskByR targetEntity) {
|
|
||||||
Integer deviceId = targetEntity.getDeviceId();
|
|
||||||
LocalDateTime stm = targetEntity.getObDate();
|
|
||||||
LocalDateTime etm = calculateEtm(stm);
|
|
||||||
return sourceMapper.selectList(
|
|
||||||
new LambdaQueryWrapper<WaterDataTermites>()
|
|
||||||
.gt(WaterDataTermites::getObDate, stm)
|
|
||||||
.le(WaterDataTermites::getObDate, etm)
|
|
||||||
.eq(WaterDataTermites::getDeviceId, deviceId)
|
|
||||||
.ne(WaterDataTermites::getOrder, "000000")
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int saveToTarget(List<WaterDataTermites> sourceEntityList) {
|
|
||||||
int count = 0;
|
|
||||||
for (WaterDataTermites sourceEntity : sourceEntityList) {
|
|
||||||
Integer deviceId = sourceEntity.getId();
|
|
||||||
LocalDateTime tm = sourceEntity.getObDate();
|
|
||||||
LambdaQueryWrapper<JcskByR> queryWrapper = new LambdaQueryWrapper<JcskByR>()
|
|
||||||
.eq(JcskByR::getDeviceId, deviceId)
|
|
||||||
.eq(JcskByR::getObDate, tm)
|
|
||||||
.last("limit 1");
|
|
||||||
JcskByR existingTarget = targetMapper.selectOne(queryWrapper);
|
|
||||||
|
|
||||||
if (existingTarget == null) {
|
|
||||||
JcskByR targetEntity = new JcskByR();
|
|
||||||
BeanUtils.copyProperties(sourceEntity, targetEntity);
|
|
||||||
targetMapper.insert(targetEntity);
|
|
||||||
}
|
|
||||||
count++;
|
|
||||||
}
|
|
||||||
return count;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -7,7 +7,7 @@ import com.gunshi.project.hsz.entity.so.StPptnSo;
|
||||||
import com.gunshi.project.hsz.entity.vo.CartogramVo;
|
import com.gunshi.project.hsz.entity.vo.CartogramVo;
|
||||||
import com.gunshi.project.hsz.entity.vo.StPptnDetailsVo;
|
import com.gunshi.project.hsz.entity.vo.StPptnDetailsVo;
|
||||||
import com.gunshi.project.hsz.entity.vo.StPptnVo;
|
import com.gunshi.project.hsz.entity.vo.StPptnVo;
|
||||||
import com.gunshi.project.hsz.model.StPptnRReal;
|
import com.gunshi.project.hsz.common.model.StPptnRReal;
|
||||||
import com.gunshi.project.hsz.service.RainBasinDivisionService;
|
import com.gunshi.project.hsz.service.RainBasinDivisionService;
|
||||||
import io.swagger.v3.oas.annotations.Parameter;
|
import io.swagger.v3.oas.annotations.Parameter;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.gunshi.core.annotation.Get;
|
import com.gunshi.core.annotation.Get;
|
||||||
import com.gunshi.core.annotation.Post;
|
import com.gunshi.core.annotation.Post;
|
||||||
import com.gunshi.core.result.R;
|
import com.gunshi.core.result.R;
|
||||||
|
import com.gunshi.project.hsz.common.model.StPptnR;
|
||||||
import com.gunshi.project.hsz.common.model.StStbprpB;
|
import com.gunshi.project.hsz.common.model.StStbprpB;
|
||||||
import com.gunshi.project.hsz.entity.so.DataQueryCommonSo;
|
import com.gunshi.project.hsz.entity.so.DataQueryCommonSo;
|
||||||
import com.gunshi.project.hsz.entity.so.PicQuerySo;
|
import com.gunshi.project.hsz.entity.so.PicQuerySo;
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
package com.gunshi.project.hsz.controller;
|
package com.gunshi.project.hsz.controller;
|
||||||
|
|
||||||
import com.gunshi.core.result.R;
|
import com.gunshi.core.result.R;
|
||||||
import com.gunshi.project.hsz.model.StPptnR;
|
import com.gunshi.project.hsz.common.model.StPptnR;
|
||||||
import com.gunshi.project.hsz.service.StPptnRService;
|
import com.gunshi.project.hsz.service.StPptnRService;
|
||||||
import com.gunshi.project.hsz.common.validate.markers.Insert;
|
import com.gunshi.project.hsz.common.validate.markers.Insert;
|
||||||
import com.gunshi.project.hsz.common.validate.markers.Update;
|
import com.gunshi.project.hsz.common.validate.markers.Update;
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
package com.gunshi.project.hsz.controller;
|
package com.gunshi.project.hsz.controller;
|
||||||
|
|
||||||
import com.gunshi.core.result.R;
|
import com.gunshi.core.result.R;
|
||||||
import com.gunshi.project.hsz.model.StPptnRReal;
|
import com.gunshi.project.hsz.common.model.StPptnRReal;
|
||||||
import com.gunshi.project.hsz.service.StPptnRRealService;
|
import com.gunshi.project.hsz.service.StPptnRRealService;
|
||||||
import com.gunshi.project.hsz.common.validate.markers.Insert;
|
import com.gunshi.project.hsz.common.validate.markers.Insert;
|
||||||
import com.gunshi.project.hsz.common.validate.markers.Update;
|
import com.gunshi.project.hsz.common.validate.markers.Update;
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
package com.gunshi.project.hsz.entity.vo;
|
package com.gunshi.project.hsz.entity.vo;
|
||||||
|
|
||||||
|
|
||||||
import com.gunshi.project.hsz.model.StPptnRReal;
|
import com.gunshi.project.hsz.common.model.StPptnRReal;
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@ package com.gunshi.project.hsz.entity.vo;
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
import com.gunshi.core.dateformat.DateFormatString;
|
import com.gunshi.core.dateformat.DateFormatString;
|
||||||
import com.gunshi.project.hsz.model.StPptnRReal;
|
import com.gunshi.project.hsz.common.model.StPptnRReal;
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ import com.gunshi.project.hsz.entity.vo.ForeRainVo;
|
||||||
import com.gunshi.project.hsz.entity.vo.RealRainListVo;
|
import com.gunshi.project.hsz.entity.vo.RealRainListVo;
|
||||||
import com.gunshi.project.hsz.entity.vo.StPptnVo;
|
import com.gunshi.project.hsz.entity.vo.StPptnVo;
|
||||||
import com.gunshi.project.hsz.model.StPptnRD;
|
import com.gunshi.project.hsz.model.StPptnRD;
|
||||||
import com.gunshi.project.hsz.model.StPptnRReal;
|
import com.gunshi.project.hsz.common.model.StPptnRReal;
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
import org.apache.ibatis.annotations.Select;
|
import org.apache.ibatis.annotations.Select;
|
||||||
|
|
|
||||||
|
|
@ -3,33 +3,34 @@ package com.gunshi.project.hsz.model;
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
import com.gunshi.core.dateformat.DateFormatString;
|
import com.gunshi.core.dateformat.DateFormatString;
|
||||||
|
import com.gunshi.project.hsz.common.model.StPptnR;
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 描述: 降水量表-面雨量
|
* 描述: 降水量表-面雨量
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
public class StPptnRAverage extends StPptnR {
|
public class StPptnRAverage extends StPptnR {
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 时段降水量
|
* 时段降水量
|
||||||
*/
|
*/
|
||||||
@Schema(description="时段降水量")
|
@Schema(description = "时段降水量")
|
||||||
private String drp;
|
private String drp;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 时间
|
* 时间
|
||||||
*/
|
*/
|
||||||
@Schema(description="时间")
|
@Schema(description = "时间")
|
||||||
@JsonFormat(pattern = DateFormatString.YYYY_MM_DD_HH_MM_SS, timezone = "GMT+8")
|
@JsonFormat(pattern = DateFormatString.YYYY_MM_DD_HH_MM_SS, timezone = "GMT+8")
|
||||||
private Date tm;
|
private Date tm;
|
||||||
|
|
||||||
public StPptnRAverage(Date tm, String drp) {
|
public StPptnRAverage(Date tm, String drp) {
|
||||||
this.tm = tm;
|
this.tm = tm;
|
||||||
this.drp = drp;
|
this.drp = drp;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.gunshi.algorithm.RrainfallForecast;
|
import com.gunshi.algorithm.RrainfallForecast;
|
||||||
import com.gunshi.algorithm.RunoffService;
|
import com.gunshi.algorithm.RunoffService;
|
||||||
import com.gunshi.model.vo.FloodAlgorithemVo;
|
import com.gunshi.model.vo.FloodAlgorithemVo;
|
||||||
|
import com.gunshi.project.hsz.common.model.StPptnR;
|
||||||
import com.gunshi.project.hsz.common.model.StStbprpB;
|
import com.gunshi.project.hsz.common.model.StStbprpB;
|
||||||
import com.gunshi.project.hsz.entity.vo.ForeRainStatVo;
|
import com.gunshi.project.hsz.entity.vo.ForeRainStatVo;
|
||||||
import com.gunshi.project.hsz.entity.vo.ForeRainTimeVo;
|
import com.gunshi.project.hsz.entity.vo.ForeRainTimeVo;
|
||||||
|
|
|
||||||
|
|
@ -6,9 +6,9 @@ import com.gunshi.project.hsz.entity.vo.CartogramVo;
|
||||||
import com.gunshi.project.hsz.entity.vo.StPptnDetailsVo;
|
import com.gunshi.project.hsz.entity.vo.StPptnDetailsVo;
|
||||||
import com.gunshi.project.hsz.entity.vo.StPptnVo;
|
import com.gunshi.project.hsz.entity.vo.StPptnVo;
|
||||||
import com.gunshi.project.hsz.mapper.RealRainMapper;
|
import com.gunshi.project.hsz.mapper.RealRainMapper;
|
||||||
import com.gunshi.project.hsz.mapper.StPptnRMapper;
|
import com.gunshi.project.hsz.common.mapper.StPptnRMapper;
|
||||||
import com.gunshi.project.hsz.model.StPptnRD;
|
import com.gunshi.project.hsz.model.StPptnRD;
|
||||||
import com.gunshi.project.hsz.model.StPptnRReal;
|
import com.gunshi.project.hsz.common.model.StPptnRReal;
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
import lombok.SneakyThrows;
|
import lombok.SneakyThrows;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import com.gunshi.project.hsz.entity.vo.ResBriefVo;
|
import com.gunshi.project.hsz.entity.vo.ResBriefVo;
|
||||||
import com.gunshi.project.hsz.model.AttResBase;
|
import com.gunshi.project.hsz.model.AttResBase;
|
||||||
import com.gunshi.project.hsz.model.ResBriefR;
|
import com.gunshi.project.hsz.model.ResBriefR;
|
||||||
import com.gunshi.project.hsz.model.StPptnR;
|
import com.gunshi.project.hsz.common.model.StPptnR;
|
||||||
import com.gunshi.project.hsz.common.model.StStbprpB;
|
import com.gunshi.project.hsz.common.model.StStbprpB;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@ package com.gunshi.project.hsz.service;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
||||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||||
|
import com.gunshi.project.hsz.common.model.StPptnRReal;
|
||||||
import com.gunshi.project.hsz.entity.so.DataQueryCommonSo;
|
import com.gunshi.project.hsz.entity.so.DataQueryCommonSo;
|
||||||
import com.gunshi.project.hsz.entity.vo.*;
|
import com.gunshi.project.hsz.entity.vo.*;
|
||||||
import com.gunshi.project.hsz.mapper.AttResBaseMapper;
|
import com.gunshi.project.hsz.mapper.AttResBaseMapper;
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
package com.gunshi.project.hsz.service;
|
package com.gunshi.project.hsz.service;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.gunshi.project.hsz.mapper.StPptnRRealMapper;
|
import com.gunshi.project.hsz.common.mapper.StPptnRRealMapper;
|
||||||
import com.gunshi.project.hsz.model.StPptnRReal;
|
import com.gunshi.project.hsz.common.model.StPptnRReal;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
|
||||||
|
|
@ -8,8 +8,8 @@ import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.gunshi.project.hsz.mapper.StPptnRMapper;
|
import com.gunshi.project.hsz.common.mapper.StPptnRMapper;
|
||||||
import com.gunshi.project.hsz.model.StPptnR;
|
import com.gunshi.project.hsz.common.model.StPptnR;
|
||||||
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||||
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
||||||
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
|
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
|
||||||
|
import com.gunshi.project.hsz.common.model.StPptnR;
|
||||||
import com.gunshi.project.hsz.model.*;
|
import com.gunshi.project.hsz.model.*;
|
||||||
import com.gunshi.project.hsz.service.*;
|
import com.gunshi.project.hsz.service.*;
|
||||||
import com.gunshi.project.hsz.util.OkHttpUtil;
|
import com.gunshi.project.hsz.util.OkHttpUtil;
|
||||||
|
|
@ -14,7 +15,6 @@ import okhttp3.FormBody;
|
||||||
import okhttp3.OkHttpClient;
|
import okhttp3.OkHttpClient;
|
||||||
import okhttp3.Request;
|
import okhttp3.Request;
|
||||||
import okhttp3.Response;
|
import okhttp3.Response;
|
||||||
import org.checkerframework.checker.units.qual.A;
|
|
||||||
import org.springframework.beans.BeanUtils;
|
import org.springframework.beans.BeanUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
|
|
@ -28,10 +28,6 @@ import java.io.IOException;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.text.ParseException;
|
import java.text.ParseException;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.time.Instant;
|
|
||||||
import java.time.LocalDateTime;
|
|
||||||
import java.time.ZoneId;
|
|
||||||
import java.time.format.DateTimeFormatter;
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
import java.util.function.Function;
|
import java.util.function.Function;
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@ import com.gunshi.project.hsz.model.AttResBase;
|
||||||
import com.gunshi.project.hsz.model.ForecastK;
|
import com.gunshi.project.hsz.model.ForecastK;
|
||||||
import com.gunshi.project.hsz.model.ForecastPa;
|
import com.gunshi.project.hsz.model.ForecastPa;
|
||||||
import com.gunshi.project.hsz.model.ForecastUseparam;
|
import com.gunshi.project.hsz.model.ForecastUseparam;
|
||||||
import com.gunshi.project.hsz.model.StPptnR;
|
import com.gunshi.project.hsz.common.model.StPptnR;
|
||||||
import com.gunshi.project.hsz.common.model.StStbprpB;
|
import com.gunshi.project.hsz.common.model.StStbprpB;
|
||||||
import com.gunshi.project.hsz.service.AttResBaseService;
|
import com.gunshi.project.hsz.service.AttResBaseService;
|
||||||
import com.gunshi.project.hsz.service.ForecastKService;
|
import com.gunshi.project.hsz.service.ForecastKService;
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ package com.gunshi.project.hsz.timetask;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||||
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
||||||
import com.gunshi.project.hsz.model.StPptnR;
|
import com.gunshi.project.hsz.common.model.StPptnR;
|
||||||
import com.gunshi.project.hsz.model.StPptnRD;
|
import com.gunshi.project.hsz.model.StPptnRD;
|
||||||
import com.gunshi.project.hsz.model.StPptnRH;
|
import com.gunshi.project.hsz.model.StPptnRH;
|
||||||
import com.gunshi.project.hsz.service.StPptnRDService;
|
import com.gunshi.project.hsz.service.StPptnRDService;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue