diff --git a/ruoyi-admin/src/main/resources/excel/flowResult.xls b/ruoyi-admin/src/main/resources/excel/flowResult.xls new file mode 100644 index 0000000..0c3dcae Binary files /dev/null and b/ruoyi-admin/src/main/resources/excel/flowResult.xls differ diff --git a/ruoyi-admin/src/main/resources/excel/hyXsmsrsG.xls b/ruoyi-admin/src/main/resources/excel/hyXsmsrsG.xls new file mode 100644 index 0000000..466d142 Binary files /dev/null and b/ruoyi-admin/src/main/resources/excel/hyXsmsrsG.xls differ diff --git a/ruoyi-admin/src/test/java/com/ruoyi/swlscx/day/service/impl/HyDpCServiceImplTest.java b/ruoyi-admin/src/test/java/com/ruoyi/swlscx/day/service/impl/HyDpCServiceImplTest.java index 0d34a0f..2960b47 100644 --- a/ruoyi-admin/src/test/java/com/ruoyi/swlscx/day/service/impl/HyDpCServiceImplTest.java +++ b/ruoyi-admin/src/test/java/com/ruoyi/swlscx/day/service/impl/HyDpCServiceImplTest.java @@ -8,6 +8,7 @@ import com.ruoyi.swlscx.basic.service.YcExportTaskService; import com.ruoyi.swlscx.common.PageParams; import com.ruoyi.swlscx.day.service.HyDcsFService; import com.ruoyi.swlscx.day.service.HyDwtCService; +import com.ruoyi.swlscx.day.service.HyZscsBService; import com.ruoyi.swlscx.excerpt.service.HyHltdzBService; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; @@ -39,6 +40,9 @@ class HyDpCServiceImplTest { @Autowired private HyStscAService hyStscAService; + + @Autowired + private HyZscsBService hyZscsBService; @Test public void importData() throws Exception { @@ -49,12 +53,13 @@ class HyDpCServiceImplTest { // "逐潮高低潮位表201501-201701", // "逐潮高低潮位表201701-202001" // ,"逐潮高低潮位表202001-"); - List stringList = Arrays.asList("日平均含沙量表195001-199001","日平均含沙量表199001-"); + List stringList = Arrays.asList("逐时潮水位表 (1)","逐时潮水位表 (2)","逐时潮水位表 (3)"); long newTime = System.currentTimeMillis(); System.out.println("当前时间:" + newTime); for (String s : stringList) { - File file = new File("C:\\Users\\12974\\Desktop\\历史查询子系统\\历史数据\\日表类\\日平均含沙量表-已完成\\" + s + ".xls"); +// File file = new File("C:\\Users\\12974\\Desktop\\历史查询子系统\\历史数据\\日表类\\日平均含沙量表-已完成\\" + s + ".xls"); + File file = new File("C:\\Users\\12974\\Downloads\\" + s + ".xls"); // 创建 FileInputStream 对象 FileInputStream fileInputStream = new FileInputStream(file); @@ -65,7 +70,7 @@ class HyDpCServiceImplTest { "application/vnd.ms-excel", fileInputStream ); - hyDcsFService.importHyDcsFData(multipartFile); + hyZscsBService.importHyZscsBData(multipartFile); } System.out.println("总耗时:" + (System.currentTimeMillis() - newTime)); } @@ -74,4 +79,8 @@ class HyDpCServiceImplTest { public void test() { System.out.println(hyStscAService.testSqlServer()); } + + + + } \ No newline at end of file diff --git a/swlscx/src/main/java/com/ruoyi/swlscx/actualSurvey/controller/ActualSurveyController.java b/swlscx/src/main/java/com/ruoyi/swlscx/actualSurvey/controller/ActualSurveyController.java new file mode 100644 index 0000000..0517bd6 --- /dev/null +++ b/swlscx/src/main/java/com/ruoyi/swlscx/actualSurvey/controller/ActualSurveyController.java @@ -0,0 +1,52 @@ +package com.ruoyi.swlscx.actualSurvey.controller; + +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.ruoyi.common.core.page.R; +import com.ruoyi.swlscx.actualSurvey.domain.vo.HyObqGVo; +import com.ruoyi.swlscx.actualSurvey.domain.vo.HyXsmsrsGVo; +import com.ruoyi.swlscx.actualSurvey.service.HyObqGService; +import com.ruoyi.swlscx.actualSurvey.service.HyXsmsrsGService; +import com.ruoyi.swlscx.basic.domain.vo.HyStscAVo; +import com.ruoyi.swlscx.common.PageParams; +import com.ruoyi.swlscx.year.domain.vo.HyYrpFVo; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +/** + * @Author al + * @Date 2025/7/10 15:49 + * @Description: TODO + * @Version + */ +@RestController +@RequestMapping("/actualSurvey") +public class ActualSurveyController { + + @Autowired + private HyObqGService hyObqGService; + + @Autowired + private HyXsmsrsGService hyXsmsrsGService; + + /** + * 实测流量成果表 + */ + @GetMapping("/getFlowResult") + public R getMonthRainList(Integer pageNum, Integer pageSize, String startTime, String endTime, String stcd, String stnm) { + PageParams pageParams = new PageParams(pageNum.longValue(), pageSize.longValue()); + IPage hyObqGVoIPage = hyObqGService.selectHyObqGDataByPageAndInfo(pageParams, startTime, endTime, stcd, stnm); + return R.ok().put("data", hyObqGVoIPage.getRecords()).put("count", hyObqGVoIPage.getTotal()); + } + + /** + * 实测大断面成果表 + */ + @GetMapping("/getActualMeasurementList") + public R getActualMeasurementList(Integer pageNum, Integer pageSize, String startTime, String endTime, String stcd, String stnm) { + PageParams pageParams = new PageParams(pageNum.longValue(), pageSize.longValue()); + IPage hyXsmsrsGVoIPage = hyXsmsrsGService.selectHyXsmsrsGDataByPageAndInfo(pageParams, startTime, endTime, stcd, stnm); + return R.ok().put("data", hyXsmsrsGVoIPage.getRecords()).put("count", hyXsmsrsGVoIPage.getTotal()); + } +} diff --git a/swlscx/src/main/java/com/ruoyi/swlscx/actualSurvey/controller/ActualSurveyExportController.java b/swlscx/src/main/java/com/ruoyi/swlscx/actualSurvey/controller/ActualSurveyExportController.java new file mode 100644 index 0000000..93d222f --- /dev/null +++ b/swlscx/src/main/java/com/ruoyi/swlscx/actualSurvey/controller/ActualSurveyExportController.java @@ -0,0 +1,56 @@ +package com.ruoyi.swlscx.actualSurvey.controller; + +import com.ruoyi.common.core.page.R; +import com.ruoyi.swlscx.actualSurvey.service.HyObqGService; +import com.ruoyi.swlscx.actualSurvey.service.HyXsmsrsGService; +import lombok.RequiredArgsConstructor; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; + +import javax.servlet.http.HttpServletResponse; + +/** + * @Author al + * @Date 2025/7/10 16:13 + * @Description: TODO + * @Version + */ + +@RequestMapping("/report") +@RestController +public class ActualSurveyExportController { + + @Autowired + private HyObqGService hyObqGService; + + + @Autowired + private HyXsmsrsGService hyXsmsrsGService; + /** + * 导出实测流量成果表 + */ + @RequestMapping("/flowResult") + public R exportHyObqGtList(HttpServletResponse response, + @RequestParam String startTime, + @RequestParam String endTime, + @RequestParam String stcd, + @RequestParam String stnm) { + return hyObqGService.exportHyObqGData(response, startTime, endTime, stcd, stnm); + } + + + + /** + * 导出实测大断面成果表 + */ + @RequestMapping("/actualMeasurement") + public R exportActualMeasurementList(HttpServletResponse response, + @RequestParam String startTime, + @RequestParam String endTime, + @RequestParam String stcd, + @RequestParam String stnm) { + return hyXsmsrsGService.exportHyXsmsrsGData(response, startTime, endTime, stcd, stnm); + } +} diff --git a/swlscx/src/main/java/com/ruoyi/swlscx/actualSurvey/domain/po/HyObqG.java b/swlscx/src/main/java/com/ruoyi/swlscx/actualSurvey/domain/po/HyObqG.java new file mode 100644 index 0000000..6681b60 --- /dev/null +++ b/swlscx/src/main/java/com/ruoyi/swlscx/actualSurvey/domain/po/HyObqG.java @@ -0,0 +1,48 @@ +package com.ruoyi.swlscx.actualSurvey.domain.po; + +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; + +import java.time.LocalDateTime; +import java.util.Date; + +/** + * @Author al + * @Date 2025/7/10 15:44 + * @Description: TODO + * @Version + */ +@Data +@TableName("hy_obq_g") +public class HyObqG { + + private String id; // 唯一标识符 + + private String stcd; // 站码 + private Integer yr; // 年份(整数类型) + private Integer mnth; // 月份(整数类型) + private Integer qobno; // 流量施测号数 + + private Date msqbgtm; // 测流起时间(使用LocalDateTime) + private Date msqedtm; // 测流止时间 + + private String xsqlc; // 测流断面位置 + private String msqmt; // 测流方法 + private Double bsggz; // 基本水尺水位 + private Double q; // 流量 + private String qrcd; // 流量注解码 + private Double xstta; // 断面总面积 + private Double xsa; // 断面过水面积 + private String xsarcd; // 断面面积注解码 + private Double xsavv; // 断面平均流速 + private Double xsmxv; // 断面最大流速 + private Double tpwd; // 水面宽 + private Double xsavdp; // 断面平均水深 + private Double xsmxdp; // 断面最大水深 + private Double ibwd; // 水浸冰底宽度 + private Double ibavdp; // 水浸冰底平均水深 + private Double ibmxdp; // 水浸冰底最大水深 + private Double rvsfsl; // 水面比降 + private Double n; // 糙率 + private String obnont; // 测次说明 +} diff --git a/swlscx/src/main/java/com/ruoyi/swlscx/actualSurvey/domain/po/HyXsmsrsG.java b/swlscx/src/main/java/com/ruoyi/swlscx/actualSurvey/domain/po/HyXsmsrsG.java new file mode 100644 index 0000000..b06aac5 --- /dev/null +++ b/swlscx/src/main/java/com/ruoyi/swlscx/actualSurvey/domain/po/HyXsmsrsG.java @@ -0,0 +1,33 @@ +package com.ruoyi.swlscx.actualSurvey.domain.po; + +import com.baomidou.mybatisplus.annotation.IdType; +import lombok.Data; + +import java.math.BigDecimal; +import java.time.LocalDateTime; +import java.util.Date; + +/** + * @Author al + * @Date 2025/7/11 15:39 + * @Description: TODO + * @Version + */ +@Data +public class HyXsmsrsG { + private String stcd; // 站码 + + private Date obdt; // 施测日期 + + private Integer obno; // 测次号 + + private String vtno; // 垂线号 + + private BigDecimal di; // 起点距(米) + private BigDecimal rvbbel; // 河底高程(米) + private String rvbbelrcd; // 河底高程注解码 + private BigDecimal odbrz; // 测时水位(米) + private String odbrzrcd; // 测时水位注解码 + private String vtaz; // 垂线方位 + private Integer nof; // 默认值1 +} diff --git a/swlscx/src/main/java/com/ruoyi/swlscx/actualSurvey/domain/vo/HyObqGVo.java b/swlscx/src/main/java/com/ruoyi/swlscx/actualSurvey/domain/vo/HyObqGVo.java new file mode 100644 index 0000000..ecb0e4e --- /dev/null +++ b/swlscx/src/main/java/com/ruoyi/swlscx/actualSurvey/domain/vo/HyObqGVo.java @@ -0,0 +1,60 @@ +package com.ruoyi.swlscx.actualSurvey.domain.vo; + +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + +/** + * @Author al + * @Date 2025/7/10 15:44 + * @Description: TODO + * @Version + */ +@Data +public class HyObqGVo implements Serializable { + + private String id; // 唯一标识符 + + private String stcd; // 站码 + private Integer yr; // 年份(整数类型) + private Integer mnth; // 月份(整数类型) + private Integer qobno; // 流量施测号数 + + private Date msqbgtm; // 测流起时间(使用LocalDateTime) + private Date msqedtm; // 测流止时间 + + private String xsqlc; // 测流断面位置 + private String msqmt; // 测流方法 + private Double bsggz; // 基本水尺水位 + private Double q; // 流量 + private String qrcd; // 流量注解码 + + + private Double xstta; // 断面总面积 + private Double xsa; // 断面过水面积 + private String xsarcd; // 断面面积注解码 + private Double xsavv; // 断面平均流速 + private Double xsmxv; // 断面最大流速 + + private Double tpwd; // 水面宽 + private Double xsavdp; // 断面平均水深 + private Double xsmxdp; // 断面最大水深 + private Double ibwd; // 水浸冰底宽度 + private Double ibavdp; // 水浸冰底平均水深 + private Double ibmxdp; // 水浸冰底最大水深 + private Double rvsfsl; // 水面比降 + private Double n; // 糙率 + private String obnont; // 测次说明 + + /**站名**/ + private String stnm; + + /** + * 行政区划码 + */ + private String addvcd; + + private static final long serialVersionUID = 1L; +} diff --git a/swlscx/src/main/java/com/ruoyi/swlscx/actualSurvey/domain/vo/HyXsmsrsGVo.java b/swlscx/src/main/java/com/ruoyi/swlscx/actualSurvey/domain/vo/HyXsmsrsGVo.java new file mode 100644 index 0000000..7308297 --- /dev/null +++ b/swlscx/src/main/java/com/ruoyi/swlscx/actualSurvey/domain/vo/HyXsmsrsGVo.java @@ -0,0 +1,44 @@ +package com.ruoyi.swlscx.actualSurvey.domain.vo; + +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.Date; + +/** + * @Author al + * @Date 2025/7/11 15:39 + * @Description: TODO + * @Version + */ +@Data +public class HyXsmsrsGVo implements Serializable { + private String stcd; // 站码 + + private Date obdt; // 施测日期 + + private Integer obno; // 测次号 + + private String vtno; // 垂线号 + + private BigDecimal di; // 起点距(米) + private BigDecimal rvbbel; // 河底高程(米) + private String rvbbelrcd; // 河底高程注解码 + private BigDecimal odbrz; // 测时水位(米) + private String odbrzrcd; // 测时水位注解码 + private String vtaz; // 垂线方位 + private Integer nof; // 默认值1 + + + /**站名**/ + private String stnm; + + /** + * 行政区划码 + */ + private String addvcd; + + private static final long serialVersionUID = 1L; + +} diff --git a/swlscx/src/main/java/com/ruoyi/swlscx/actualSurvey/mapper/HyObqGMapper.java b/swlscx/src/main/java/com/ruoyi/swlscx/actualSurvey/mapper/HyObqGMapper.java new file mode 100644 index 0000000..78209cb --- /dev/null +++ b/swlscx/src/main/java/com/ruoyi/swlscx/actualSurvey/mapper/HyObqGMapper.java @@ -0,0 +1,25 @@ +package com.ruoyi.swlscx.actualSurvey.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.ruoyi.swlscx.actualSurvey.domain.po.HyObqG; +import com.ruoyi.swlscx.actualSurvey.domain.vo.HyObqGVo; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; +import java.util.Map; + +/** + * @Author al + * @Date 2025/7/10 15:46 + * @Description: TODO + * @Version + */ +@Mapper +public interface HyObqGMapper extends BaseMapper { + IPage selectHyObqGDataByPageAndInfo(@Param("page") Page page, @Param("map") Map map); + + List selectHyObqGData(@Param("map") Map map); +} diff --git a/swlscx/src/main/java/com/ruoyi/swlscx/actualSurvey/mapper/HyXsmsrsGMapper.java b/swlscx/src/main/java/com/ruoyi/swlscx/actualSurvey/mapper/HyXsmsrsGMapper.java new file mode 100644 index 0000000..5755738 --- /dev/null +++ b/swlscx/src/main/java/com/ruoyi/swlscx/actualSurvey/mapper/HyXsmsrsGMapper.java @@ -0,0 +1,25 @@ +package com.ruoyi.swlscx.actualSurvey.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.ruoyi.swlscx.actualSurvey.domain.po.HyXsmsrsG; +import com.ruoyi.swlscx.actualSurvey.domain.vo.HyXsmsrsGVo; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; +import java.util.Map; + +/** + * @Author al + * @Date 2025/7/11 15:40 + * @Description: TODO + * @Version + */ +@Mapper +public interface HyXsmsrsGMapper extends BaseMapper { + IPage selectHyXsmsrsGDataByPageAndInfo(@Param("page") Page page, @Param("map") Map map); + + List selectHyXsmsrsGData(@Param("map") Map map); +} diff --git a/swlscx/src/main/java/com/ruoyi/swlscx/actualSurvey/service/HyObqGService.java b/swlscx/src/main/java/com/ruoyi/swlscx/actualSurvey/service/HyObqGService.java new file mode 100644 index 0000000..7a2a4be --- /dev/null +++ b/swlscx/src/main/java/com/ruoyi/swlscx/actualSurvey/service/HyObqGService.java @@ -0,0 +1,26 @@ +package com.ruoyi.swlscx.actualSurvey.service; + +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.service.IService; +import com.ruoyi.common.core.page.R; +import com.ruoyi.swlscx.actualSurvey.domain.po.HyObqG; +import com.ruoyi.swlscx.actualSurvey.domain.vo.HyObqGVo; +import com.ruoyi.swlscx.common.PageParams; + +import javax.servlet.http.HttpServletResponse; + +/** + * @Author al + * @Date 2025/7/10 15:47 + * @Description: TODO + * @Version + */ +public interface HyObqGService extends IService { + + /** + * 查询实测流量表 + */ + IPage selectHyObqGDataByPageAndInfo(PageParams pageParams, String startTime, String endTime, String stcd, String stnm); + + R exportHyObqGData(HttpServletResponse response, String startTime, String endTime, String stcd, String stnm); +} diff --git a/swlscx/src/main/java/com/ruoyi/swlscx/actualSurvey/service/HyXsmsrsGService.java b/swlscx/src/main/java/com/ruoyi/swlscx/actualSurvey/service/HyXsmsrsGService.java new file mode 100644 index 0000000..0ce2290 --- /dev/null +++ b/swlscx/src/main/java/com/ruoyi/swlscx/actualSurvey/service/HyXsmsrsGService.java @@ -0,0 +1,22 @@ +package com.ruoyi.swlscx.actualSurvey.service; + +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.service.IService; +import com.ruoyi.common.core.page.R; +import com.ruoyi.swlscx.actualSurvey.domain.po.HyXsmsrsG; +import com.ruoyi.swlscx.actualSurvey.domain.vo.HyXsmsrsGVo; +import com.ruoyi.swlscx.common.PageParams; + +import javax.servlet.http.HttpServletResponse; + +/** + * @Author al + * @Date 2025/7/11 15:40 + * @Description: TODO + * @Version + */ +public interface HyXsmsrsGService extends IService { + IPage selectHyXsmsrsGDataByPageAndInfo(PageParams pageParams, String startTime, String endTime, String stcd, String stnm); + + R exportHyXsmsrsGData(HttpServletResponse response, String startTime, String endTime, String stcd, String stnm); +} diff --git a/swlscx/src/main/java/com/ruoyi/swlscx/actualSurvey/service/impl/HyObqGServiceImpl.java b/swlscx/src/main/java/com/ruoyi/swlscx/actualSurvey/service/impl/HyObqGServiceImpl.java new file mode 100644 index 0000000..0319c60 --- /dev/null +++ b/swlscx/src/main/java/com/ruoyi/swlscx/actualSurvey/service/impl/HyObqGServiceImpl.java @@ -0,0 +1,210 @@ +package com.ruoyi.swlscx.actualSurvey.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.ruoyi.common.config.RuoYiConfig; +import com.ruoyi.common.core.page.R; +import com.ruoyi.common.utils.DateUtils; +import com.ruoyi.common.utils.SecurityUtils; +import com.ruoyi.swlscx.actualSurvey.domain.po.HyObqG; +import com.ruoyi.swlscx.actualSurvey.domain.vo.HyObqGVo; +import com.ruoyi.swlscx.actualSurvey.mapper.HyObqGMapper; +import com.ruoyi.swlscx.actualSurvey.service.HyObqGService; +import com.ruoyi.swlscx.basic.domain.po.YcExportTask; +import com.ruoyi.swlscx.basic.service.YcExportTaskService; +import com.ruoyi.swlscx.common.PageParams; +import com.ruoyi.swlscx.common.constants.SystemConstants; +import com.ruoyi.swlscx.common.utils.CommonUtils; +import com.ruoyi.swlscx.common.utils.ExcelUtils; +import com.ruoyi.swlscx.common.utils.Query; +import com.ruoyi.swlscx.month.domain.vo.HyMptEVo; +import org.apache.commons.lang3.ObjectUtils; +import org.apache.poi.ss.usermodel.CellStyle; +import org.apache.poi.ss.usermodel.Row; +import org.apache.poi.ss.usermodel.Sheet; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.ApplicationContext; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletResponse; +import java.io.File; +import java.util.Date; +import java.util.List; +import java.util.Map; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.ThreadPoolExecutor; + +/** + * @Author al + * @Date 2025/7/10 15:47 + * @Description: TODO + * @Version + */ +@Service +public class HyObqGServiceImpl extends ServiceImpl + implements HyObqGService { + + + + @Override + public IPage selectHyObqGDataByPageAndInfo(PageParams pageParams, String startTime, String endTime, String stcd, String stnm) { + Map map = CommonUtils.getMonthDataMap(pageParams, startTime, endTime, stcd, stnm); + return this.baseMapper.selectHyObqGDataByPageAndInfo(new Query().getPage(map), map); + } + + @Override + public R exportHyObqGData(HttpServletResponse response, String startTime, String endTime, String stcd, String stnm) { + Long userId = SecurityUtils.getUserId(); + String tableName = "实测流量表"; + return taskAndExport(tableName,startTime, endTime, stcd, stnm, userId); + } + + @Resource + private ThreadPoolExecutor labelThreadPool; + + @Resource + private YcExportTaskService ycExportTaskService; + + @Resource + private ThreadPoolExecutor importThreadPool; + + @Autowired + private ApplicationContext context; + + private R taskAndExport(String tableName,String startTime, String endTime, String stcd, String stnm, Long userId) { + String startNewTime=""; + String endNewTime=""; + if (ObjectUtils.isNotEmpty(startTime) ){ + startNewTime=startTime.substring(0,6); + } + if (ObjectUtils.isNotEmpty(endTime)){ + endNewTime=endTime.substring(0,6); + } + String filename = tableName + startNewTime + "-" + endNewTime; + // 查询是否已存在相同条件且未完成的任务 + List ongoingTasks = ycExportTaskService.list( + new QueryWrapper() + .eq("user_id", userId) + .eq("filename", filename) + .eq("status", 0) // 状态为0表示任务未完成 + ); + + if (!ongoingTasks.isEmpty()) { + return R.error("当前任务正在下载中,请稍后重试"); + } + + YcExportTask ycExportTask = new YcExportTask(); + String pathPeffix = RuoYiConfig.getExportPath() + + File.separator + userId + File.separator+ + DateUtils.parseDateToStr("yyyy-MM-dd",DateUtils.getNowDate()) + File.separator + + DateUtils.parseDateToStr("HH_mm",DateUtils.getNowDate())+File.separator; + ycExportTask.setFilename(filename); + ycExportTask.setUserId(userId); + ycExportTask.setStartTime(new Date()); + ycExportTask.setStatus(0); + ycExportTask.setFilepath(pathPeffix); + ycExportTaskService.save(ycExportTask); + CompletableFuture.runAsync(() -> { + try { + File dest = new File(pathPeffix); + if (!dest.exists()) { + dest.mkdirs(); + } + String fullPath = pathPeffix + filename; + exportBlackData(fullPath, startTime, endTime, stcd, stnm); + + ycExportTask.setStatus(1); + ycExportTask.setEndTime(new Date()); + ycExportTaskService.updateById(ycExportTask); + } catch (Exception e) { + log.error(e.getMessage(), e); + R.error("任务下载失败"); + } + }, labelThreadPool); + return R.ok("任务已提交,请稍后下载"); + } + + + private void exportBlackData(String tableName, String startTime, String endTime, String stcd, String stnm) { + Map rainMap = CommonUtils.getMonthDataMap(new PageParams(0L, 1000000000L), startTime, endTime, stcd, stnm); + ExcelUtils.excelBackExport2("flowResult.xls", tableName, (Sheet sheet, CellStyle style) -> + dataModel1(rainMap, sheet, style)); + } + public int dataModel1(Map map, Sheet sheet, CellStyle style) { + // 批量查询数据 + List hyObqGVos = this.baseMapper.selectHyObqGData(map); + + // 定义当前sheet的行号 + int rowIndex = 2; // 从第二行开始写入数据 + // 定义全局序号 + int globalIndex = 1; // 从1开始 + + // 定义当前sheet的编号 + int sheetIndex = 1; + + // 最大行数限制 + int maxRowsPerSheet = 65536; // 对于 .xls 文件,最大行数为 65536 + int batchSize = 1000; // 每次批量处理1000行,减少逐行写入的开销 + + // 复制表头到新sheet的逻辑 + ExcelUtils.copyHeader(sheet, style); + + // 批量处理数据 + for (int i = 0; i < hyObqGVos.size(); i += batchSize) { + // 处理一批数据 + int toIndex = Math.min(i + batchSize, hyObqGVos.size()); + List batchList = hyObqGVos.subList(i, toIndex); + + // 批量写入数据 + for (HyObqGVo vo : batchList) { + // 如果当前行数达到最大行数,创建新sheet + if (rowIndex >= maxRowsPerSheet) { + sheetIndex++; + sheet = sheet.getWorkbook().createSheet("实测流量表" + sheetIndex); + rowIndex = 2; // 重置行号 + // 复制表头到新sheet + ExcelUtils.copyHeader(sheet, style); + } + + // 创建新行并写入数据 + Row row = ExcelUtils.createRow(sheet, rowIndex); + + // 使用 globalIndex 作为序号 + ExcelUtils.formatCell(row, 0, String.valueOf(globalIndex), style); + ExcelUtils.formatCell(row, 1, vo.getStcd() != null ? vo.getStcd() : "", style); + ExcelUtils.formatCell(row, 2, vo.getStnm() != null ? vo.getStnm() : "", style); + ExcelUtils.formatCell(row, 3, vo.getAddvcd() != null ? vo.getAddvcd() : "", style); + ExcelUtils.formatCell(row, 4, vo.getYr() != null ? vo.getYr().toString() : "", style); + ExcelUtils.formatCell(row, 5, vo.getMnth() != null ? vo.getMnth().toString() : "", style); + ExcelUtils.formatCell(row, 6, vo.getQobno() != null ? vo.getQobno().toString() : "", style); + ExcelUtils.formatCell(row, 7, vo.getMsqbgtm() != null ? DateUtils.parseDateToStr(SystemConstants.TIME_FORMAT,vo.getMsqbgtm()) : "", style); + ExcelUtils.formatCell(row, 8, vo.getMsqedtm() != null ? DateUtils.parseDateToStr(SystemConstants.TIME_FORMAT,vo.getMsqedtm()) : "", style); + ExcelUtils.formatCell(row, 9, vo.getXsqlc() != null ? vo.getXsqlc() : "", style); + ExcelUtils.formatCell(row, 10, vo.getMsqmt() != null ? vo.getMsqmt() : "", style); + ExcelUtils.formatCell(row, 11, vo.getBsggz() != null ? vo.getBsggz().toString() : "", style); + ExcelUtils.formatCell(row, 12, vo.getQ() != null ? vo.getQ().toString() : "", style); + ExcelUtils.formatCell(row, 13, vo.getQrcd() != null ? vo.getQrcd() : "", style); + ExcelUtils.formatCell(row, 14, vo.getXstta() != null ? vo.getXstta().toString() : "", style); + ExcelUtils.formatCell(row, 15, vo.getXsa() != null ? vo.getXsa().toString() : "", style); + ExcelUtils.formatCell(row, 16, vo.getXsarcd() != null ? vo.getXsarcd() : "", style); + ExcelUtils.formatCell(row, 17, vo.getXsavv() != null ? vo.getXsavv().toString() : "", style); + ExcelUtils.formatCell(row, 18, vo.getXsmxv() != null ? vo.getXsmxv().toString() : "", style); + ExcelUtils.formatCell(row, 19, vo.getTpwd() != null ? vo.getTpwd().toString() : "", style); + ExcelUtils.formatCell(row, 20, vo.getXsavdp() != null ? vo.getXsavdp().toString() : "", style); + ExcelUtils.formatCell(row, 21, vo.getXsmxdp() != null ? vo.getXsmxdp().toString() : "", style); + ExcelUtils.formatCell(row, 22, vo.getIbwd() != null ? vo.getIbwd().toString() : "", style); + ExcelUtils.formatCell(row, 23, vo.getIbavdp() != null ? vo.getIbavdp().toString() : "", style); + ExcelUtils.formatCell(row, 24, vo.getIbmxdp() != null ? vo.getIbmxdp().toString() : "", style); + ExcelUtils.formatCell(row, 25, vo.getRvsfsl() != null ? vo.getRvsfsl().toString() : "", style); + ExcelUtils.formatCell(row, 26, vo.getN() != null ? vo.getN().toString() : "", style); + ExcelUtils.formatCell(row, 27, vo.getObnont() != null ? vo.getObnont() : "", style); + // 增加行号和全局序号 + rowIndex++; + globalIndex++; + } + } + return 0; + } +} diff --git a/swlscx/src/main/java/com/ruoyi/swlscx/actualSurvey/service/impl/HyXsmsrsGServiceImpl.java b/swlscx/src/main/java/com/ruoyi/swlscx/actualSurvey/service/impl/HyXsmsrsGServiceImpl.java new file mode 100644 index 0000000..72ef9f9 --- /dev/null +++ b/swlscx/src/main/java/com/ruoyi/swlscx/actualSurvey/service/impl/HyXsmsrsGServiceImpl.java @@ -0,0 +1,187 @@ +package com.ruoyi.swlscx.actualSurvey.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.ruoyi.common.config.RuoYiConfig; +import com.ruoyi.common.core.page.R; +import com.ruoyi.common.utils.DateUtils; +import com.ruoyi.common.utils.SecurityUtils; +import com.ruoyi.swlscx.actualSurvey.domain.po.HyXsmsrsG; +import com.ruoyi.swlscx.actualSurvey.domain.vo.HyObqGVo; +import com.ruoyi.swlscx.actualSurvey.domain.vo.HyXsmsrsGVo; +import com.ruoyi.swlscx.actualSurvey.mapper.HyXsmsrsGMapper; +import com.ruoyi.swlscx.actualSurvey.service.HyXsmsrsGService; +import com.ruoyi.swlscx.basic.domain.po.YcExportTask; +import com.ruoyi.swlscx.basic.service.YcExportTaskService; +import com.ruoyi.swlscx.common.PageParams; +import com.ruoyi.swlscx.common.constants.SystemConstants; +import com.ruoyi.swlscx.common.utils.CommonUtils; +import com.ruoyi.swlscx.common.utils.ExcelUtils; +import com.ruoyi.swlscx.common.utils.Query; +import org.apache.commons.lang3.ObjectUtils; +import org.apache.poi.ss.usermodel.CellStyle; +import org.apache.poi.ss.usermodel.Row; +import org.apache.poi.ss.usermodel.Sheet; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletResponse; +import java.io.File; +import java.util.Date; +import java.util.List; +import java.util.Map; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.ThreadPoolExecutor; + +/** + * @Author al + * @Date 2025/7/11 15:41 + * @Description: TODO + * @Version + */ +@Service +public class HyXsmsrsGServiceImpl extends ServiceImpl + implements HyXsmsrsGService { + + @Resource + private ThreadPoolExecutor labelThreadPool; + + @Resource + private YcExportTaskService ycExportTaskService; + + @Override + public IPage selectHyXsmsrsGDataByPageAndInfo(PageParams pageParams, String startTime, String endTime, String stcd, String stnm) { + Map map = CommonUtils.getYearAndDayDataMap(pageParams, startTime, endTime, stcd, stnm); + return this.baseMapper.selectHyXsmsrsGDataByPageAndInfo(new Query().getPage(map), map); + } + + @Override + public R exportHyXsmsrsGData(HttpServletResponse response, String startTime, String endTime, String stcd, String stnm) { + Long userId = SecurityUtils.getUserId(); + String tableName = "实测大断面成果表"; + return taskAndExport(tableName,startTime, endTime, stcd, stnm, userId); + } + + private R taskAndExport(String tableName,String startTime, String endTime, String stcd, String stnm, Long userId) { + String startNewTime=""; + String endNewTime=""; + if (ObjectUtils.isNotEmpty(startTime) ){ + startNewTime=startTime.substring(0,6); + } + if (ObjectUtils.isNotEmpty(endTime)){ + endNewTime=endTime.substring(0,6); + } + String filename = tableName + startNewTime + "-" + endNewTime; + // 查询是否已存在相同条件且未完成的任务 + List ongoingTasks = ycExportTaskService.list( + new QueryWrapper() + .eq("user_id", userId) + .eq("filename", filename) + .eq("status", 0) // 状态为0表示任务未完成 + ); + + if (!ongoingTasks.isEmpty()) { + return R.error("当前任务正在下载中,请稍后重试"); + } + + YcExportTask ycExportTask = new YcExportTask(); + String pathPeffix = RuoYiConfig.getExportPath() + + File.separator + userId + File.separator+ + DateUtils.parseDateToStr("yyyy-MM-dd",DateUtils.getNowDate()) + File.separator + + DateUtils.parseDateToStr("HH_mm",DateUtils.getNowDate())+File.separator; + ycExportTask.setFilename(filename); + ycExportTask.setUserId(userId); + ycExportTask.setStartTime(new Date()); + ycExportTask.setStatus(0); + ycExportTask.setFilepath(pathPeffix); + ycExportTaskService.save(ycExportTask); + CompletableFuture.runAsync(() -> { + try { + File dest = new File(pathPeffix); + if (!dest.exists()) { + dest.mkdirs(); + } + String fullPath = pathPeffix + filename; + exportBlackData(fullPath, startTime, endTime, stcd, stnm); + + ycExportTask.setStatus(1); + ycExportTask.setEndTime(new Date()); + ycExportTaskService.updateById(ycExportTask); + } catch (Exception e) { + log.error(e.getMessage(), e); + R.error("任务下载失败"); + } + }, labelThreadPool); + return R.ok("任务已提交,请稍后下载"); + } + + + private void exportBlackData(String tableName, String startTime, String endTime, String stcd, String stnm) { + Map rainMap = CommonUtils.getYearAndDayDataMap(new PageParams(0L, 1000000000L), startTime, endTime, stcd, stnm); + ExcelUtils.excelBackExport2("hyXsmsrsG.xls", tableName, (Sheet sheet, CellStyle style) -> + dataModel1(rainMap, sheet, style)); + } + + public int dataModel1(Map map, Sheet sheet, CellStyle style) { + // 批量查询数据 + List hyXsmsrsGVos = this.baseMapper.selectHyXsmsrsGData(map); + + // 定义当前sheet的行号 + int rowIndex = 2; // 从第二行开始写入数据 + // 定义全局序号 + int globalIndex = 1; // 从1开始 + + // 定义当前sheet的编号 + int sheetIndex = 1; + + // 最大行数限制 + int maxRowsPerSheet = 65536; // 对于 .xls 文件,最大行数为 65536 + int batchSize = 1000; // 每次批量处理1000行,减少逐行写入的开销 + + // 复制表头到新sheet的逻辑 + ExcelUtils.copyHeader(sheet, style); + + // 批量处理数据 + for (int i = 0; i < hyXsmsrsGVos.size(); i += batchSize) { + // 处理一批数据 + int toIndex = Math.min(i + batchSize, hyXsmsrsGVos.size()); + List batchList = hyXsmsrsGVos.subList(i, toIndex); + + // 批量写入数据 + for (HyXsmsrsGVo vo : batchList) { + // 如果当前行数达到最大行数,创建新sheet + if (rowIndex >= maxRowsPerSheet) { + sheetIndex++; + sheet = sheet.getWorkbook().createSheet("实测大断面成果表" + sheetIndex); + rowIndex = 2; // 重置行号 + // 复制表头到新sheet + ExcelUtils.copyHeader(sheet, style); + } + + // 创建新行并写入数据 + Row row = ExcelUtils.createRow(sheet, rowIndex); + + // 使用 globalIndex 作为序号 + ExcelUtils.formatCell(row, 0, String.valueOf(globalIndex), style); + ExcelUtils.formatCell(row, 1, vo.getStcd() != null ? vo.getStcd() : "", style); + ExcelUtils.formatCell(row, 2, vo.getStnm() != null ? vo.getStnm() : "", style); + ExcelUtils.formatCell(row, 3, vo.getAddvcd() != null ? vo.getAddvcd() : "", style); + ExcelUtils.formatCell(row, 4, vo.getObdt() != null ? DateUtils.parseDateToStr(SystemConstants.TIME_FORMAT,vo.getObdt()) : "", style); + ExcelUtils.formatCell(row, 5, vo.getObno() != null ? vo.getObno().toString() : "", style); + ExcelUtils.formatCell(row, 6, vo.getVtno() != null ? vo.getVtno() : "", style); + ExcelUtils.formatCell(row, 7, vo.getDi() != null ? vo.getDi().toString() : "", style); + ExcelUtils.formatCell(row, 8, vo.getRvbbel() != null ? vo.getRvbbel().toString() : "", style); + ExcelUtils.formatCell(row, 9, vo.getRvbbelrcd() != null ? vo.getRvbbelrcd() : "", style); + ExcelUtils.formatCell(row, 10, vo.getOdbrz() != null ? vo.getOdbrz().toString() : "", style); + ExcelUtils.formatCell(row, 11, vo.getOdbrzrcd() != null ? vo.getOdbrzrcd() : "", style); + ExcelUtils.formatCell(row, 12, vo.getVtaz() != null ? vo.getVtaz() : "", style); + ExcelUtils.formatCell(row, 13, vo.getNof() != null ? vo.getNof() .toString(): "", style); + // 增加行号和全局序号 + rowIndex++; + globalIndex++; + } + } + return 0; + } +} diff --git a/swlscx/src/main/java/com/ruoyi/swlscx/basic/controller/BaseInfoController.java b/swlscx/src/main/java/com/ruoyi/swlscx/basic/controller/BaseInfoController.java index 600b966..aab6ee5 100644 --- a/swlscx/src/main/java/com/ruoyi/swlscx/basic/controller/BaseInfoController.java +++ b/swlscx/src/main/java/com/ruoyi/swlscx/basic/controller/BaseInfoController.java @@ -14,7 +14,9 @@ import com.ruoyi.swlscx.basic.domain.vo.HyStscAVo; import com.ruoyi.swlscx.basic.service.YcExportTaskService; import com.ruoyi.swlscx.common.PageParams; import com.ruoyi.swlscx.basic.service.HyStscAService; +import com.ruoyi.swlscx.synchronousData.service.YcResTableInfoService; import lombok.RequiredArgsConstructor; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.http.HttpHeaders; import org.springframework.security.access.prepost.PreAuthorize; @@ -27,6 +29,7 @@ import java.sql.Connection; import java.sql.DriverManager; import java.sql.SQLException; import java.util.HashMap; +import java.util.List; import java.util.Map; /** @@ -62,7 +65,14 @@ public class BaseInfoController { public R getStationList(@RequestParam(value = "startTime",defaultValue = "") String startTime, @RequestParam(value = "endTime",defaultValue = "")String endTime, @RequestParam(value = "type",defaultValue = "") String type) { - return R.ok().put("data", hyStscAService.getList(startTime,endTime,type)); + HyStscASelectVo list = hyStscAService.getList(startTime, endTime, type); + + int size = list.getChildren().size(); + if (size == 0) { + return R.ok().put("data", list).put("count", 0); + }else { + return R.ok().put("data", list).put("count", size-1); + } } /** @@ -154,7 +164,14 @@ public class BaseInfoController { public R getStationListByType(@RequestParam(value = "type",defaultValue = "") String type, @RequestParam(value = "startTime",defaultValue = "") String startTime, @RequestParam(value = "endTime",defaultValue = "")String endTime) { - return R.ok().put("data", hyStscAService.getStationListByType(startTime,endTime,type)); + HyStscASelectVo list = hyStscAService.getStationListByType(startTime, endTime, type); + List children = list.getChildren(); + int size = children.size(); + if (size == 0) { + return R.ok().put("data", list).put("count", 0); + }else { + return R.ok().put("data", list).put("count", size-1); + } } @RequestMapping("/testConnection") @@ -195,4 +212,15 @@ public class BaseInfoController { } + @Autowired + private YcResTableInfoService ycResTableInfoService; + + @RequestMapping("/getStatInfo") + public R getStatInfo(@RequestParam(value = "stcd",defaultValue = "") String stcds, + @RequestParam(value = "startTime",defaultValue = "") String startTime, + @RequestParam(value = "endTime",defaultValue = "")String endTime, + @RequestParam(value = "page") Integer pageNum, + @RequestParam(value = "limit") Integer pageSize) { + return ycResTableInfoService.getStatInfo(stcds,startTime,endTime,pageNum,pageSize); + } } diff --git a/swlscx/src/main/java/com/ruoyi/swlscx/basic/mapper/HyStscAMapper.java b/swlscx/src/main/java/com/ruoyi/swlscx/basic/mapper/HyStscAMapper.java index 364d36c..2e26728 100644 --- a/swlscx/src/main/java/com/ruoyi/swlscx/basic/mapper/HyStscAMapper.java +++ b/swlscx/src/main/java/com/ruoyi/swlscx/basic/mapper/HyStscAMapper.java @@ -54,6 +54,10 @@ public interface HyStscAMapper extends BaseMapper { List listHyDzC(@Param("startTimeDay") String startTimeDay, @Param("endTimeDay") String endTimeDay); List listHyDpc(@Param("startTimeDay") String startTimeDay, @Param("endTimeDay") String endTimeDay); + + List getStatList(@Param("startTime") String startTime, @Param("endTime") String endTime); + + List getStatAllList(); } diff --git a/swlscx/src/main/java/com/ruoyi/swlscx/basic/service/impl/HyStscAServiceImpl.java b/swlscx/src/main/java/com/ruoyi/swlscx/basic/service/impl/HyStscAServiceImpl.java index 7c0510e..a182ba8 100644 --- a/swlscx/src/main/java/com/ruoyi/swlscx/basic/service/impl/HyStscAServiceImpl.java +++ b/swlscx/src/main/java/com/ruoyi/swlscx/basic/service/impl/HyStscAServiceImpl.java @@ -268,6 +268,8 @@ public class HyStscAServiceImpl extends ServiceImpl impl @Autowired private HyStscAService hyStscAService; + + @Override public HyStscASelectVo getList(String startTime, String endTime, String type) { List list = new ArrayList<>(); @@ -749,6 +751,16 @@ public class HyStscAServiceImpl extends ServiceImpl impl if (!stcds.isEmpty()) { list = this.list(Wrappers.lambdaQuery(HyStscA.class).in(HyStscA::getStcd, stcds)); } + }else if (type.equals("YcStat")){ + List stcds = new ArrayList<>(); + if (ObjectUtils.isNotEmpty(startTime) || ObjectUtils.isNotEmpty(endTime)){ + stcds =this.baseMapper.getStatList(startTime, endTime); + }else { + stcds =this.baseMapper.getStatAllList(); + } + if (!stcds.isEmpty()) { + list = this.list(Wrappers.lambdaQuery(HyStscA.class).in(HyStscA::getStcd, stcds)); + } } diff --git a/swlscx/src/main/java/com/ruoyi/swlscx/synchronousData/controller/TimeTasksController.java b/swlscx/src/main/java/com/ruoyi/swlscx/synchronousData/controller/TimeTasksController.java index 5fd74b3..75bffe9 100644 --- a/swlscx/src/main/java/com/ruoyi/swlscx/synchronousData/controller/TimeTasksController.java +++ b/swlscx/src/main/java/com/ruoyi/swlscx/synchronousData/controller/TimeTasksController.java @@ -4,6 +4,7 @@ import com.ruoyi.common.core.page.R; import com.ruoyi.swlscx.basic.service.YcExportTaskService; import com.ruoyi.swlscx.synchronousData.dto.JHDayData; import com.ruoyi.swlscx.synchronousData.service.TimeTasksService; +import com.ruoyi.swlscx.synchronousData.service.YcResTableInfoService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestHeader; @@ -24,6 +25,9 @@ public class TimeTasksController { @Autowired private TimeTasksService timeTasksService; + @Autowired + private YcResTableInfoService ycResTableInfoService; + @RequestMapping("/importSqlserverToMysql") public R importSqlserverToMysql(@RequestBody List jhDayDataList, @RequestHeader("X-Type")String type) { @@ -268,4 +272,11 @@ public class TimeTasksController { } + + @RequestMapping("/test666") + public R getTest666(){ + return ycResTableInfoService.getYcResTableInfo(); + } + + } diff --git a/swlscx/src/main/java/com/ruoyi/swlscx/synchronousData/dto/YcResStatInfo.java b/swlscx/src/main/java/com/ruoyi/swlscx/synchronousData/dto/YcResStatInfo.java new file mode 100644 index 0000000..27dd998 --- /dev/null +++ b/swlscx/src/main/java/com/ruoyi/swlscx/synchronousData/dto/YcResStatInfo.java @@ -0,0 +1,35 @@ +package com.ruoyi.swlscx.synchronousData.dto; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import lombok.Data; +import org.springframework.data.annotation.Id; + +/** + * @Author al + * @Date 2025/7/8 15:35 + * @Description: TODO + * @Version + */ +@Data +public class YcResStatInfo { + + private Long id; + + private String stcd; + + private String stnm; + + private String sType; + + private String resType; + + private Long resTableId; + + private String resTable; + + private String statYear; + + private String oldYear; + +} diff --git a/swlscx/src/main/java/com/ruoyi/swlscx/synchronousData/mapper/YcResTableInfoMapper.java b/swlscx/src/main/java/com/ruoyi/swlscx/synchronousData/mapper/YcResTableInfoMapper.java new file mode 100644 index 0000000..7c150d2 --- /dev/null +++ b/swlscx/src/main/java/com/ruoyi/swlscx/synchronousData/mapper/YcResTableInfoMapper.java @@ -0,0 +1,33 @@ +package com.ruoyi.swlscx.synchronousData.mapper; + +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.ruoyi.swlscx.basic.domain.vo.HyStscAVo; +import com.ruoyi.swlscx.synchronousData.dto.YcResStatInfo; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; +import java.util.Map; + +/** + * @Author al + * @Date 2025/7/8 15:18 + * @Description: TODO + * @Version + */ +@Mapper +public interface YcResTableInfoMapper { + + List getResTableByDay(@Param("tableName") String tableName); + + void saveBatch(List ycResStatInfoList); + + IPage getPageList(@Param("page") Page page, @Param("param")Map map); + + List getResTableRainXPList(@Param("tableName") String tableName); + + List getResTableRainrexBList(@Param("tableName") String tableName); + + List getResTableTMList(@Param("tableName") String tableName); +} diff --git a/swlscx/src/main/java/com/ruoyi/swlscx/synchronousData/service/YcResTableInfoService.java b/swlscx/src/main/java/com/ruoyi/swlscx/synchronousData/service/YcResTableInfoService.java new file mode 100644 index 0000000..908cba9 --- /dev/null +++ b/swlscx/src/main/java/com/ruoyi/swlscx/synchronousData/service/YcResTableInfoService.java @@ -0,0 +1,15 @@ +package com.ruoyi.swlscx.synchronousData.service; + +import com.ruoyi.common.core.page.R; + +/** + * @Author al + * @Date 2025/7/8 15:18 + * @Description: TODO + * @Version + */ +public interface YcResTableInfoService { + R getYcResTableInfo(); + + R getStatInfo(String stcds, String startTime, String endTime,Integer pageNum,Integer pageSize); +} diff --git a/swlscx/src/main/java/com/ruoyi/swlscx/synchronousData/service/impl/TimeTasksServiceImpl.java b/swlscx/src/main/java/com/ruoyi/swlscx/synchronousData/service/impl/TimeTasksServiceImpl.java index 07f65bd..406ed75 100644 --- a/swlscx/src/main/java/com/ruoyi/swlscx/synchronousData/service/impl/TimeTasksServiceImpl.java +++ b/swlscx/src/main/java/com/ruoyi/swlscx/synchronousData/service/impl/TimeTasksServiceImpl.java @@ -23,6 +23,7 @@ import org.springframework.data.redis.core.StringRedisTemplate; import org.springframework.scheduling.annotation.Scheduled; import org.springframework.stereotype.Service; +import java.time.LocalDate; import java.time.LocalDateTime; import java.time.Year; import java.time.format.DateTimeFormatter; @@ -60,7 +61,7 @@ public class TimeTasksServiceImpl implements TimeTasksService { * 获取江河湖库日雨量数据 */ @Override - @Scheduled(cron = "0 10 0 18 * ?") + @Scheduled(cron = "0 10 0 13 * ?") @DataSource(DataSourceType.SLAVE) public void getDayRainData() { List ycStations = getYcStations(); @@ -97,7 +98,7 @@ public class TimeTasksServiceImpl implements TimeTasksService { * 获取江河湖库日平均流量表 */ @DataSource(DataSourceType.SLAVE) - @Scheduled(cron = "0 20 0 18 * ?") + @Scheduled(cron = "0 20 0 13 * ?") @Override public void getDayQData() { List ycStations = getYcStations(); @@ -134,7 +135,7 @@ public class TimeTasksServiceImpl implements TimeTasksService { * 获取江河湖库日平均输沙率表 */ @DataSource(DataSourceType.SLAVE) - @Scheduled(cron = "0 30 0 18 * ?") + @Scheduled(cron = "0 30 0 13 * ?") @Override public void getDayDqsData() { List ycStations = getYcStations(); @@ -173,7 +174,7 @@ public class TimeTasksServiceImpl implements TimeTasksService { * 获取江河湖库日平均含沙量表 */ @DataSource(DataSourceType.SLAVE) - @Scheduled(cron = "0 40 0 18 * ?") + @Scheduled(cron = "0 40 0 13 * ?") @Override public void getDayDcsData() { List ycStations = getYcStations(); @@ -212,7 +213,7 @@ public class TimeTasksServiceImpl implements TimeTasksService { * 获取江河湖库日时段最大降水表 */ @DataSource(DataSourceType.SLAVE) - @Scheduled(cron = "0 50 0 18 * ?") + @Scheduled(cron = "0 50 0 13 * ?") @Override public void getDayDmxpData() { List ycStations = getYcStations(); @@ -252,7 +253,7 @@ public class TimeTasksServiceImpl implements TimeTasksService { * 获取江河湖库日水面蒸发量表 */ @DataSource(DataSourceType.SLAVE) - @Scheduled(cron = "0 0 1 18 * ?") // 每月19号01:00执行 + @Scheduled(cron = "0 0 1 13 * ?") // 每月19号01:00执行 @Override public void getDayDweData() { List ycStations = getYcStations(); @@ -291,7 +292,7 @@ public class TimeTasksServiceImpl implements TimeTasksService { * 获取江河湖库日水温表 */ @DataSource(DataSourceType.SLAVE) - @Scheduled(cron = "0 10 1 18 * ?") + @Scheduled(cron = "0 10 1 13 * ?") @Override public void getDayDwtData() { List ycStations = getYcStations(); @@ -329,7 +330,7 @@ public class TimeTasksServiceImpl implements TimeTasksService { * 获取江河湖库日平均水位表 */ @DataSource(DataSourceType.SLAVE) - @Scheduled(cron = "0 20 1 18 * ?") + @Scheduled(cron = "0 20 1 13 * ?") @Override public void getDayDzcData() { List ycStations = getYcStations(); @@ -367,7 +368,7 @@ public class TimeTasksServiceImpl implements TimeTasksService { * 获取江河湖库时段最大洪量表 */ @DataSource(DataSourceType.SLAVE) - @Scheduled(cron = "0 30 1 18 * ?") + @Scheduled(cron = "0 30 1 13 * ?") @Override public void getDayImxfwData() { List ycStations = getYcStations(); @@ -401,7 +402,7 @@ public class TimeTasksServiceImpl implements TimeTasksService { } getDateService.insertRainData(stcds, SWTableEnum.DAY_MXFW.value());} @DataSource(DataSourceType.SLAVE) - @Scheduled(cron = "0 40 1 18 * ?") + @Scheduled(cron = "0 40 1 13 * ?") @Override public void getFdheexData() { List ycStations = getYcStations(); @@ -435,7 +436,7 @@ public class TimeTasksServiceImpl implements TimeTasksService { }getDateService.insertRainData(stcds, SWTableEnum.DP_FDHEEX.value());} @DataSource(DataSourceType.SLAVE) - @Scheduled(cron = "0 50 1 18 * ?") + @Scheduled(cron = "0 50 1 13 * ?") @Override public void getHltdzData() { List ycStations = getYcStations(); @@ -466,7 +467,7 @@ public class TimeTasksServiceImpl implements TimeTasksService { TimeUnit.HOURS);stcds.add("HyHltdzB:"+ycStation.getStcd());} getDateService.insertRainData(stcds, SWTableEnum.DP_HLTDZ.value());} @DataSource(DataSourceType.SLAVE) - @Scheduled(cron = "0 0 2 18 * ?") @Override + @Scheduled(cron = "0 0 2 13 * ?") @Override public void getHmxpData() { List ycStations = getYcStations(); String[] startAndEndTime = getStartAndEndTime(); @@ -495,7 +496,7 @@ public class TimeTasksServiceImpl implements TimeTasksService { getDateService.insertRainData(stcds, SWTableEnum.DP_HMXP.value());} @DataSource(DataSourceType.SLAVE) - @Scheduled(cron = "0 10 2 18 * ?") + @Scheduled(cron = "0 10 2 13 * ?") @Override public void getMmxpData() { List ycStations = getYcStations(); @@ -535,7 +536,7 @@ public class TimeTasksServiceImpl implements TimeTasksService { * 获取江河湖库月含沙量表 */ @DataSource(DataSourceType.SLAVE) - @Scheduled(cron = "0 20 2 18 * ?") + @Scheduled(cron = "0 20 2 13 * ?") @Override public void getMtcsData() { List ycStations = getYcStations(); @@ -579,7 +580,7 @@ public class TimeTasksServiceImpl implements TimeTasksService { * 获取江河湖库月降水表数据 */ @Override - @Scheduled(cron = "0 30 2 18 * ?") + @Scheduled(cron = "0 30 2 13 * ?") @DataSource(DataSourceType.SLAVE) public void getMonthRainData() { List ycStations = getYcStations(); @@ -620,7 +621,7 @@ public class TimeTasksServiceImpl implements TimeTasksService { * 获取江河湖库月流量表数据 */ @Override - @Scheduled(cron = "0 40 2 18 * ?") + @Scheduled(cron = "0 40 2 13 * ?") @DataSource(DataSourceType.SLAVE) public void getMonthQData() { List ycStations = getYcStations(); @@ -663,7 +664,7 @@ public class TimeTasksServiceImpl implements TimeTasksService { * 获取江河湖库月输沙率表 */ @Override - @Scheduled(cron = "0 50 2 18 * ?") + @Scheduled(cron = "0 50 2 13 * ?") @DataSource(DataSourceType.SLAVE) public void getMonthMtqsData() { List ycStations = getYcStations(); @@ -704,7 +705,7 @@ public class TimeTasksServiceImpl implements TimeTasksService { * 获取江河湖库月潮位表 */ @Override - @Scheduled(cron = "0 0 3 18 * ?") + @Scheduled(cron = "0 0 3 13 * ?") @DataSource(DataSourceType.SLAVE) public void getMonthMttdzData() { List ycStations = getYcStations(); @@ -772,7 +773,7 @@ public class TimeTasksServiceImpl implements TimeTasksService { * 获取江河湖库月水面蒸发量表 */ @Override - @Scheduled(cron = "0 10 3 18 * ?") + @Scheduled(cron = "0 10 3 13 * ?") @DataSource(DataSourceType.SLAVE) public void getMonthMtweData() { List ycStations = getYcStations(); @@ -815,7 +816,7 @@ public class TimeTasksServiceImpl implements TimeTasksService { * 获取江河湖库月水温表 */ @Override - @Scheduled(cron = "0 20 3 18 * ?") + @Scheduled(cron = "0 20 3 13 * ?") @DataSource(DataSourceType.SLAVE) public void getMonthMtwtData() { List ycStations = getYcStations(); @@ -857,7 +858,7 @@ public class TimeTasksServiceImpl implements TimeTasksService { * 获取江河湖库月河道水位表 */ @Override - @Scheduled(cron = "0 30 3 18 * ?") + @Scheduled(cron = "0 30 3 13 * ?") @DataSource(DataSourceType.SLAVE) public void getMonthRiverData() { List ycStations = getYcStations(); @@ -902,7 +903,7 @@ public class TimeTasksServiceImpl implements TimeTasksService { * 获取江河湖库降水量摘录表 */ @Override - @Scheduled(cron = "0 40 3 18 * ?") + @Scheduled(cron = "0 40 3 13 * ?") @DataSource(DataSourceType.SLAVE) public void getHourRainData() { List ycStations = getYcStations(); @@ -941,7 +942,7 @@ public class TimeTasksServiceImpl implements TimeTasksService { * 获取江河湖库水库洪水水位要素摘录表 */ @Override - @Scheduled(cron = "0 50 3 18 * ?") + @Scheduled(cron = "0 50 3 13 * ?") @DataSource(DataSourceType.SLAVE) public void getRvfhexData() { List ycStations = getYcStations(); @@ -978,7 +979,7 @@ public class TimeTasksServiceImpl implements TimeTasksService { * 获取江河湖库水闸洪水水文要素摘录表 */ @Override - @Scheduled(cron = "0 0 4 18 * ?") + @Scheduled(cron = "0 0 4 13 * ?") @DataSource(DataSourceType.SLAVE) public void getWsfhexData() { List ycStations = getYcStations(); @@ -1017,7 +1018,7 @@ public class TimeTasksServiceImpl implements TimeTasksService { * 获取江河湖库年含沙量表 */ @Override - @Scheduled(cron = "0 10 4 18 * ?") + @Scheduled(cron = "0 10 4 13 * ?") @DataSource(DataSourceType.SLAVE) public void getYrcsData() { List ycStations = getYcStations(); @@ -1053,7 +1054,7 @@ public class TimeTasksServiceImpl implements TimeTasksService { * 获取江河湖库年流量表 */ @Override - @Scheduled(cron = "0 20 4 18 * ?") + @Scheduled(cron = "0 20 4 13 * ?") @DataSource(DataSourceType.SLAVE) public void getYearQData() { List ycStations = getYcStations(); @@ -1090,7 +1091,7 @@ public class TimeTasksServiceImpl implements TimeTasksService { * 获取江河湖库年降水表 */ @Override - @Scheduled(cron = "0 30 4 18 * ?") + @Scheduled(cron = "0 30 4 13 * ?") @DataSource(DataSourceType.SLAVE) public void getYearRainData() { List ycStations = getYcStations(); @@ -1128,7 +1129,7 @@ public class TimeTasksServiceImpl implements TimeTasksService { * 获取江河湖库年潮位表 */ @Override - @Scheduled(cron = "0 40 4 18 * ?") + @Scheduled(cron = "0 40 4 13 * ?") @DataSource(DataSourceType.SLAVE) public void getYearTideData() { List ycStations = getYcStations(); @@ -1195,7 +1196,7 @@ public class TimeTasksServiceImpl implements TimeTasksService { * 获取江河湖库年水面蒸发量表 */ @Override - @Scheduled(cron = "0 50 4 18 * ?") + @Scheduled(cron = "0 50 4 13 * ?") @DataSource(DataSourceType.SLAVE) public void getYearMtweData() { List ycStations = getYcStations(); @@ -1236,7 +1237,7 @@ public class TimeTasksServiceImpl implements TimeTasksService { * 获取江河湖库年水温表 */ @Override - @Scheduled(cron = "0 0 5 18 * ?") + @Scheduled(cron = "0 0 5 13 * ?") @DataSource(DataSourceType.SLAVE) public void getYearWtData() { List ycStations = getYcStations(); @@ -1274,7 +1275,7 @@ public class TimeTasksServiceImpl implements TimeTasksService { * 获取江河湖库河道年水位表 */ @Override - @Scheduled(cron = "0 10 5 18 * ?") + @Scheduled(cron = "0 10 5 13 * ?") @DataSource(DataSourceType.SLAVE) public void getYearYrzData() { List ycStations = getYcStations(); @@ -1331,15 +1332,19 @@ public class TimeTasksServiceImpl implements TimeTasksService { private static String[] getStartAndEndTime() { DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); - LocalDateTime endDate = LocalDateTime.now() - .withHour(0) - .withMinute(0) - .withSecond(0); - LocalDateTime startDate = endDate.minusMonths(6); + // 获取当前年份的1月1日 00:00:00(今年开始时刻) + LocalDateTime startDate = LocalDate.now() + .withMonth(1) // 设置为1月 + .withDayOfMonth(1) // 设置为1号 + .atStartOfDay(); // 转换为当天的00:00:00 [7,8](@ref) + + // 获取当前精确时间(至今) + LocalDateTime endDate = LocalDateTime.now(); + return new String[]{ - endDate.format(formatter), // endTime - startDate.format(formatter) // startTime + startDate.format(formatter), // 今年开始时间 + endDate.format(formatter) // 当前时间 }; } diff --git a/swlscx/src/main/java/com/ruoyi/swlscx/synchronousData/service/impl/YcResTableInfoServiceImpl.java b/swlscx/src/main/java/com/ruoyi/swlscx/synchronousData/service/impl/YcResTableInfoServiceImpl.java new file mode 100644 index 0000000..f75c703 --- /dev/null +++ b/swlscx/src/main/java/com/ruoyi/swlscx/synchronousData/service/impl/YcResTableInfoServiceImpl.java @@ -0,0 +1,224 @@ +package com.ruoyi.swlscx.synchronousData.service.impl; + +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.ruoyi.common.core.page.R; +import com.ruoyi.common.core.text.Convert; +import com.ruoyi.swlscx.basic.domain.vo.HyStscAVo; +import com.ruoyi.swlscx.common.utils.Query; +import com.ruoyi.swlscx.synchronousData.dto.YcResStatInfo; +import com.ruoyi.swlscx.synchronousData.enums.SWTableEnum; +import com.ruoyi.swlscx.synchronousData.mapper.YcResTableInfoMapper; +import com.ruoyi.swlscx.synchronousData.service.YcResTableInfoService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.*; +import java.util.stream.Collectors; + +/** + * @Author al + * @Date 2025/7/8 15:18 + * @Description: TODO + * @Version + */ +@Service +public class YcResTableInfoServiceImpl implements YcResTableInfoService { + + @Autowired + private YcResTableInfoMapper ycResTableInfoMapper; + + @Override + @Transactional(rollbackFor = Exception.class) + public R getYcResTableInfo() { + //逐日降水 + List ycResStatInfoList = ycResTableInfoMapper.getResTableRainXPList(SWTableEnum.MONTH_RAIN.value()); + ycResStatInfoList.forEach(i -> { + i.setSType("P"); + i.setResType("雨量资料"); + i.setResTableId(1L); + String statYear = i.getStatYear(); + i.setStatYear(formatYears(statYear)); + i.setOldYear(statYear); + i.setResTable("逐日降水数据表"); + } + ); + ycResTableInfoMapper.saveBatch(ycResStatInfoList); + + //最大小时降水表(1) + List ycResStatInfoMMXPList = ycResTableInfoMapper.getResTableRainXPList(SWTableEnum.DP_MMXP.value()); + ycResStatInfoMMXPList.forEach(i -> { + i.setSType("P"); + i.setResType("雨量资料"); + i.setResTableId(2L); + String statYear = i.getStatYear(); + i.setStatYear(formatYears(statYear)); + i.setOldYear(statYear); + i.setResTable("各时段最大降水表(1)"); + } + ); + ycResTableInfoMapper.saveBatch(ycResStatInfoMMXPList); + + + //最大小时降水表(2) + List ycResStatInfoHMXPList = ycResTableInfoMapper.getResTableRainXPList(SWTableEnum.DP_HMXP.value()); + ycResStatInfoHMXPList.forEach(i -> { + i.setSType("P"); + i.setResType("雨量资料"); + i.setResTableId(3L); + String statYear = i.getStatYear(); + i.setStatYear(formatYears(statYear)); + i.setOldYear(statYear); + i.setResTable("各时段最大降水表(2)"); + } + ); + ycResTableInfoMapper.saveBatch(ycResStatInfoHMXPList); + + //降水量摘录表 + List ycResStatInfoPrexBList = ycResTableInfoMapper.getResTableRainrexBList(SWTableEnum.DP_HOUR.value()); + ycResStatInfoPrexBList.forEach(i -> { + i.setSType("P"); + i.setResType("雨量资料"); + i.setResTableId(4L); + String statYear = i.getStatYear(); + i.setStatYear(formatYears(statYear)); + i.setOldYear(statYear); + i.setResTable("降水量摘录表"); + } + ); + ycResTableInfoMapper.saveBatch(ycResStatInfoPrexBList); + + + //逐日平均水位表 + List ycResStatInfoZDayList = ycResTableInfoMapper.getResTableRainXPList(SWTableEnum.MONTH_RIVER.value()); + ycResStatInfoZDayList.forEach(i -> { + i.setSType("Z"); + i.setResType("水位资料"); + i.setResTableId(5L); + String statYear = i.getStatYear(); + i.setStatYear(formatYears(statYear)); + i.setOldYear(statYear); + i.setResTable("逐日平均水位表"); + } + ); + + ycResTableInfoMapper.saveBatch(ycResStatInfoZDayList); + + // 水闸洪水水文要素摘录表 + List ycResStatInfoSZList2 = ycResTableInfoMapper.getResTableTMList(SWTableEnum.DP_WSFHEX.value()); + ycResStatInfoSZList2.forEach(i -> { + i.setSType("Z"); + i.setResType("水位资料"); + i.setResTableId(6L); + String statYear = i.getStatYear(); + i.setStatYear(formatYears(statYear)); + i.setOldYear(statYear); + i.setResTable("水闸洪水水文要素摘录表"); + } + ); + ycResTableInfoMapper.saveBatch(ycResStatInfoSZList2); + + + // 逐潮高低潮位表 + List ycResStatInfoZCList2 = ycResTableInfoMapper.getResTableTMList(SWTableEnum.DP_HLTDZ.value()); + ycResStatInfoZCList2.forEach(i -> { + i.setSType("Z"); + i.setResType("水位资料"); + i.setResTableId(7L); + String statYear = i.getStatYear(); + i.setStatYear(formatYears(statYear)); + i.setOldYear(statYear); + i.setResTable("逐潮高低潮位表"); + } + ); + ycResTableInfoMapper.saveBatch(ycResStatInfoZCList2); + + + + // 潮位月年统计表 + List ycResStatInfoCWList2 = ycResTableInfoMapper.getResTableRainXPList(SWTableEnum.MONTH_MTTDZ.value()); + ycResStatInfoCWList2.forEach(i -> { + i.setSType("Z"); + i.setResType("水位资料"); + i.setResTableId(8L); + String statYear = i.getStatYear(); + i.setStatYear(formatYears(statYear)); + i.setOldYear(statYear); + i.setResTable("潮位月年统计表"); + } + ); + ycResTableInfoMapper.saveBatch(ycResStatInfoCWList2); + + + return R.ok().put("data", ycResStatInfoSZList2); + } + + public static String formatYears(String yearStr) { + if (yearStr == null || yearStr.isEmpty()) { + return ""; + } + + // 拆分年份并转换为整数集合 + String[] yearArray = yearStr.split(","); + List years = new ArrayList<>(); + for (String year : yearArray) { + try { + years.add(Integer.parseInt(year.trim())); + } catch (NumberFormatException ignored) { + } + } + if (years.isEmpty()) return ""; + + // 排序年份 + Collections.sort(years); + + // 合并连续年份 + List parts = new ArrayList<>(); + int start = years.get(0); + int prev = start; + + for (int i = 1; i < years.size(); i++) { + int current = years.get(i); + if (current == prev + 1) { // 连续年份 + prev = current; + } else { // 非连续年份 + addYearPart(parts, start, prev); + start = current; + prev = current; + } + } + addYearPart(parts, start, prev); // 处理最后一组 + + return String.join(",", parts); + } + + private static void addYearPart(List parts, int start, int end) { + if (start == end) { + parts.add(String.valueOf(start)); + } else { + parts.add(start + "-" + end); + } + } + + @Override + public R getStatInfo(String stcds, String startTime, String endTime, Integer pageNum, Integer pageSize) { + Map map = new HashMap<>(); + map.put("page", Convert.toStr(pageNum)); + map.put("limit", Convert.toStr(pageSize)); + List filteredList = Collections.emptyList(); + if (stcds != null) { + if (stcds.contains("all")) { + stcds = ""; + } + filteredList = Arrays.stream(stcds.split(",")) + .filter(s -> s != null && !s.trim().isEmpty()) + .map(String::trim) + .collect(Collectors.toList()); + } + System.out.println("stcds: "+stcds); + map.put("stcds", filteredList.isEmpty() ? null : filteredList); + IPage ycResStatInfoIPage = ycResTableInfoMapper.getPageList(new Query().getPage(map), map); + + return R.ok().put("data", ycResStatInfoIPage.getRecords()).put("count", ycResStatInfoIPage.getTotal()); + } +} diff --git a/swlscx/src/main/resources/mapper/actualSurvey/HyObqGMapper.xml b/swlscx/src/main/resources/mapper/actualSurvey/HyObqGMapper.xml new file mode 100644 index 0000000..02b1c3f --- /dev/null +++ b/swlscx/src/main/resources/mapper/actualSurvey/HyObqGMapper.xml @@ -0,0 +1,70 @@ + + + + + + + + diff --git a/swlscx/src/main/resources/mapper/actualSurvey/HyXsmsrsGMapper.xml b/swlscx/src/main/resources/mapper/actualSurvey/HyXsmsrsGMapper.xml new file mode 100644 index 0000000..4785bb7 --- /dev/null +++ b/swlscx/src/main/resources/mapper/actualSurvey/HyXsmsrsGMapper.xml @@ -0,0 +1,54 @@ + + + + + + + + + + \ No newline at end of file diff --git a/swlscx/src/main/resources/mapper/basic/HyStscAMapper.xml b/swlscx/src/main/resources/mapper/basic/HyStscAMapper.xml index 44eb228..e658f31 100644 --- a/swlscx/src/main/resources/mapper/basic/HyStscAMapper.xml +++ b/swlscx/src/main/resources/mapper/basic/HyStscAMapper.xml @@ -221,4 +221,36 @@ WITH select stcd,dt from hy_dq_c where dt >= #{startTimeDay} and dt <= #{endTimeDay} + + + + + diff --git a/swlscx/src/main/resources/mapper/synchronousData/YcResTableInfoMapper.xml b/swlscx/src/main/resources/mapper/synchronousData/YcResTableInfoMapper.xml new file mode 100644 index 0000000..53a2925 --- /dev/null +++ b/swlscx/src/main/resources/mapper/synchronousData/YcResTableInfoMapper.xml @@ -0,0 +1,84 @@ + + + + + + + + + INSERT INTO yc_res_stat_info + (stcd, s_type, res_table_id, res_type, res_table,stat_year,old_year) + VALUES + + (#{item.stcd}, #{item.sType}, #{item.resTableId}, #{item.resType}, #{item.resTable}, + #{item.statYear}, #{item.oldYear}) + + ON DUPLICATE KEY UPDATE + res_type = VALUES(res_type), + res_table = VALUES(res_table), + stat_year = VALUES(stat_year), + old_year = VALUES(old_year) + + + + + + + + + + + +