refactor: 重构

master
李一帆 2025-11-05 17:19:05 +08:00
parent 26a590030a
commit 34a3b1c975
56 changed files with 126 additions and 792 deletions

View File

@ -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;

View File

@ -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;

View File

@ -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);
} }

View File

@ -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 {

View File

@ -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";

View File

@ -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 {
/** /**

View File

@ -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 {

View File

@ -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 {

View File

@ -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,

View File

@ -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}

View File

@ -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>

View File

@ -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>

View File

@ -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
* *

View File

@ -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 {
/** /**
* *

View File

@ -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 {
/** /**
* *

View File

@ -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 {
/** /**
* *

View File

@ -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 {
/** /**
* *

View File

@ -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 {
/** /**
* *

View File

@ -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 {
/** /**
* *

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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

View File

@ -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 {
/** /**

View File

@ -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;
/** /**

View File

@ -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;
}

View File

@ -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> {
}

View File

@ -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;
}
}

View File

@ -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> {
}

View File

@ -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);
}

View File

@ -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;
}

View File

@ -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> {
}

View File

@ -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 {
}

View File

@ -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);
}

View File

@ -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;
} }

View File

@ -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 {
/** /**
* *

View File

@ -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

View File

@ -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

View File

@ -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 {
/** /**

View File

@ -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;
}
}

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;
} }
} }

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;