Ver Fonte

天气&节假日接口

learshaw há 2 meses atrás
pai
commit
a9be1282fd
28 ficheiros alterados com 1249 adições e 131 exclusões
  1. 4 4
      common-cloud/tool-modules/general-data/Dockerfile
  2. 14 0
      common-cloud/tool-modules/general-data/sql/table.sql
  3. 41 3
      common-cloud/tool-modules/general-data/src/main/java/com/huashe/common/data/config/CollectConfig.java
  4. 120 0
      common-cloud/tool-modules/general-data/src/main/java/com/huashe/common/data/controller/DateAttrConrtoller.java
  5. 10 10
      common-cloud/tool-modules/general-data/src/main/java/com/huashe/common/data/controller/RegionController.java
  6. 31 2
      common-cloud/tool-modules/general-data/src/main/java/com/huashe/common/data/controller/WeatherController.java
  7. 56 0
      common-cloud/tool-modules/general-data/src/main/java/com/huashe/common/data/mapper/AdmHolidayMapper.java
  8. 37 0
      common-cloud/tool-modules/general-data/src/main/java/com/huashe/common/data/mapper/DimGaWeatherMapper.java
  9. 2 1
      common-cloud/tool-modules/general-data/src/main/java/com/huashe/common/data/mapper/DimGbRegionMapper.java
  10. 81 0
      common-cloud/tool-modules/general-data/src/main/java/com/huashe/common/data/model/DateAttr.java
  11. 102 0
      common-cloud/tool-modules/general-data/src/main/java/com/huashe/common/data/model/Region.java
  12. 64 0
      common-cloud/tool-modules/general-data/src/main/java/com/huashe/common/data/model/WeatherType.java
  13. 50 0
      common-cloud/tool-modules/general-data/src/main/java/com/huashe/common/data/service/DateService.java
  14. 20 3
      common-cloud/tool-modules/general-data/src/main/java/com/huashe/common/data/service/RegionService.java
  15. 30 3
      common-cloud/tool-modules/general-data/src/main/java/com/huashe/common/data/service/TaskService.java
  16. 7 0
      common-cloud/tool-modules/general-data/src/main/java/com/huashe/common/data/service/WeatherService.java
  17. 189 0
      common-cloud/tool-modules/general-data/src/main/java/com/huashe/common/data/service/impl/DateServiceImpl.java
  18. 0 52
      common-cloud/tool-modules/general-data/src/main/java/com/huashe/common/data/service/impl/RegionConfServiceImpl.java
  19. 0 43
      common-cloud/tool-modules/general-data/src/main/java/com/huashe/common/data/service/impl/RegionDbServiceImpl.java
  20. 101 0
      common-cloud/tool-modules/general-data/src/main/java/com/huashe/common/data/service/impl/RegionServiceImpl.java
  21. 71 2
      common-cloud/tool-modules/general-data/src/main/java/com/huashe/common/data/service/impl/WeatherServiceimpl.java
  22. 5 1
      common-cloud/tool-modules/general-data/src/main/resources/application-locale.yml
  23. 34 0
      common-cloud/tool-modules/general-data/src/main/resources/mapper/AdmHolidayMapper.xml
  24. 20 0
      common-cloud/tool-modules/general-data/src/main/resources/mapper/DimGaWeatherMapper.xml
  25. 1 1
      common-cloud/tool-modules/general-data/src/main/resources/mapper/DimGbRegionMapper.xml
  26. 61 0
      prod-common/src/main/java/com/huashe/common/domain/model/GaWeatherType.java
  27. 6 6
      prod-common/src/main/java/com/huashe/common/domain/model/GbRegion.java
  28. 92 0
      prod-common/src/main/java/com/huashe/common/domain/model/Holiday.java

+ 4 - 4
common-cloud/tool-modules/general-data/Dockerfile

@@ -1,5 +1,5 @@
 ########################################################
-#   docker build -t collect-weather:1.0 .
+#   docker build -t general-data:1.0 .
 ########################################################
 
 FROM centos-base:7.6.1810
@@ -8,12 +8,12 @@ MAINTAINER learshaw@gmail.com
 
 # 创建目录
 RUN mkdir -p /usr/local/java && \
-    mkdir -p /opt/tool/collect-weather
+    mkdir -p /opt/tool/general-data
 WORKDIR /opt/tool
 
 # 添加JDK
 ADD jdk-8u333-linux-x64.tar.gz /usr/local/java/
-COPY collect-weather-1.0.0-SNAPSHOT.jar /opt/tool/collect-weather/
+COPY general-data-1.0.0-SNAPSHOT.jar /opt/tool/general-data/
 
 # 端口
 EXPOSE 9300
@@ -24,4 +24,4 @@ ENV JRE_HOME /usr/local/java/jdk1.8.0_333/jre
 ENV CLASSPATH .:${JAVA_HOME}/lib:${JRE_HOME}/lib
 ENV PATH $JAVA_HOME/bin:$PATH
 
-CMD ["java", "-Duser.timezone=Asia/Shanghai", "-jar", "/opt/tool/collect-weather/collect-weather-1.0.0-SNAPSHOT.jar"]
+CMD ["java", "-Duser.timezone=Asia/Shanghai", "-jar", "/opt/tool/general-data/general-data-1.0.0-SNAPSHOT.jar"]

+ 14 - 0
common-cloud/tool-modules/general-data/sql/table.sql

@@ -43,6 +43,20 @@ CREATE TABLE `adm_area_weather_forecast` (
 
 
 -- ----------------------------
+-- 节假日
+-- ----------------------------
+DROP TABLE IF EXISTS `adm_holiday`;
+CREATE TABLE `adm_holiday` (
+    `date`    date NOT NULL COMMENT '日期',
+    `name`    VARCHAR(128) NOT NULL COMMENT '节假日',
+    `name_cn` VARCHAR(128) NOT NULL COMMENT '节假日中文',
+    `name_en` VARCHAR(128) NOT NULL COMMENT '节假日英文',
+    `type`       VARCHAR(64) NOT NULL COMMENT '节假日类型',
+    PRIMARY KEY (`date`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='节假日信息表';
+
+
+-- ----------------------------
 -- 接口认证
 -- ----------------------------
 DROP TABLE IF EXISTS `adm_api_auth`;

+ 41 - 3
common-cloud/tool-modules/general-data/src/main/java/com/huashe/common/data/config/CollectConfig.java

@@ -10,14 +10,21 @@
  */
 package com.huashe.common.data.config;
 
-import com.huashe.common.exception.BusinessException;
+import com.huashe.common.data.service.RegionService;
 import com.huashe.common.data.service.WeatherColService;
+import com.huashe.common.exception.BusinessException;
+import org.apache.commons.lang3.ArrayUtils;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Qualifier;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.Configuration;
 
+import javax.annotation.Resource;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
 /**
  * 采集业务配置
  * <功能详细描述>
@@ -35,6 +42,18 @@ public class CollectConfig {
     @Value("${weather.region.conf-adcodes}")
     private String weatherAdcodes;
 
+    @Value("${weather.region.source}")
+    private String weatcherAdcodeSource;
+
+    @Value("${holiday.url}")
+    private String holidayColUrl;
+
+    /**
+     * 区域映射装配
+     */
+    @Resource
+    private RegionService regionService;
+
     @Bean(value = "weatherColService")
     public WeatherColService weatherColService(
         @Qualifier(value = "weatherColAmapService") WeatherColService amapColService) {
@@ -46,7 +65,26 @@ public class CollectConfig {
         }
     }
 
-    public String getWeatherAdcodes() {
-        return weatherAdcodes;
+    /**
+     * 获取天气采集目标行政区划
+     * @return
+     */
+    public List<String> getWeatherAdcodes(){
+        if (StringUtils.equals("db", weatcherAdcodeSource)) {
+            return regionService.getPrefectureLevelCity();
+        }
+        else {
+            String[] areaArray = null;
+
+            if (StringUtils.isBlank(weatherAdcodes)) {
+                areaArray = StringUtils.split(weatherAdcodes, ",");
+            }
+
+            return ArrayUtils.isNotEmpty(areaArray) ? Arrays.asList(areaArray) : new ArrayList<>();
+        }
+    }
+
+    public String getHolidayColUrl() {
+        return holidayColUrl;
     }
 }

+ 120 - 0
common-cloud/tool-modules/general-data/src/main/java/com/huashe/common/data/controller/DateAttrConrtoller.java

@@ -0,0 +1,120 @@
+/*
+ * 文 件 名:  DateAttrConrtoller
+ * 版    权:  华设设计集团股份有限公司
+ * 描    述:  <描述>
+ * 修 改 人:  lvwenbin
+ * 修改时间:  2025/5/9
+ * 跟踪单号:  <跟踪单号>
+ * 修改单号:  <修改单号>
+ * 修改内容:  <修改内容>
+ */
+package com.huashe.common.data.controller;
+
+import com.huashe.common.data.config.ApiAuth;
+import com.huashe.common.data.model.CallResponse;
+import com.huashe.common.data.model.DateAttr;
+import com.huashe.common.data.service.DateService;
+import com.huashe.common.exception.BusinessException;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiResponse;
+import io.swagger.annotations.ApiResponses;
+import org.springframework.web.bind.annotation.CrossOrigin;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
+
+import javax.annotation.Resource;
+import java.util.List;
+
+/**
+ * 日期属性服务
+ * <功能详细描述>
+ *
+ * @author lvwenbin
+ * @version [版本号, 2025/5/9]
+ * @see [相关类/方法]
+ * @since [产品/模块版本]
+ */
+@RestController
+@CrossOrigin(allowedHeaders = "*", allowCredentials = "false")
+@RequestMapping("/date")
+@Api(value = "DateAttrConrtoller", description = "日期属性接口")
+public class DateAttrConrtoller {
+    @Resource
+    private DateService dateService;
+
+    /**
+     * 获取日期属性
+     */
+    @ApiAuth
+    @RequestMapping(value = "/getAttr", method = RequestMethod.GET)
+    @ApiOperation(value = "/getAttr", notes = "获取日期属性")
+    @ApiResponses({ @ApiResponse(code = 200, message = "success"),
+        @ApiResponse(code = 400, message = "{code:****,message:'fail'}")
+    })
+    public CallResponse<DateAttr> getAttr(@RequestParam(value = "date") String date) {
+        CallResponse<DateAttr> callResponse = new CallResponse<>();
+
+        try {
+            DateAttr dateAttr = dateService.getDateAttr(date);
+            callResponse.setData(dateAttr);
+            callResponse.setCode(0);
+            callResponse.setMessage("success");
+        }
+        catch (Exception e) {
+            throw new BusinessException(-1, e.getMessage());
+        }
+
+        return callResponse;
+    }
+
+    /**
+     * 获取日期属性
+     */
+    @ApiAuth
+    @RequestMapping(value = "/getAttrs", method = RequestMethod.GET)
+    @ApiOperation(value = "/getAttrs", notes = "获取日期属性")
+    @ApiResponses({ @ApiResponse(code = 200, message = "success"),
+        @ApiResponse(code = 400, message = "{code:****,message:'fail'}")
+    })
+    public CallResponse<List<DateAttr>> getAttrs(@RequestParam(value = "startDate") String startDate,
+        @RequestParam(value = "endDate") String endDate) {
+        CallResponse<List<DateAttr>> callResponse = new CallResponse<>();
+
+        try {
+            List<DateAttr> dateAttrs = dateService.getDateAttr(startDate, endDate);
+            callResponse.setData(dateAttrs);
+            callResponse.setCode(0);
+            callResponse.setMessage("success");
+        }
+        catch (Exception e) {
+            throw new BusinessException(-1, e.getMessage());
+        }
+
+        return callResponse;
+    }
+
+    /**
+     * 节假日采集触发器
+     */
+    @RequestMapping(value = "/triggerColHoliday", method = RequestMethod.GET)
+    @ApiOperation(value = "/triggerColHoliday", notes = "触发-节假日采集")
+    @ApiResponses({ @ApiResponse(code = 200, message = "success"),
+        @ApiResponse(code = 400, message = "{code:****,message:'fail'}")
+    })
+    public CallResponse<Void> triggerColHoliday(@RequestParam(value = "year") String year) {
+        CallResponse<Void> callResponse = new CallResponse<>();
+        try {
+            dateService.collectHoliday(year);
+            callResponse.setCode(0);
+            callResponse.setMessage("success");
+        }
+        catch (Exception e) {
+            throw new BusinessException(-1, e.getMessage());
+        }
+
+        return callResponse;
+    }
+}

+ 10 - 10
common-cloud/tool-modules/general-data/src/main/java/com/huashe/common/data/controller/GbRegionController.java → common-cloud/tool-modules/general-data/src/main/java/com/huashe/common/data/controller/RegionController.java

@@ -11,9 +11,9 @@
 package com.huashe.common.data.controller;
 
 import com.huashe.common.data.config.ApiAuth;
-import com.huashe.common.data.mapper.DimGbRegionMapper;
 import com.huashe.common.data.model.CallResponse;
-import com.huashe.common.domain.model.GbRegion;
+import com.huashe.common.data.model.Region;
+import com.huashe.common.data.service.RegionService;
 import com.huashe.common.exception.BusinessException;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
@@ -40,9 +40,9 @@ import java.util.List;
 @CrossOrigin(allowedHeaders = "*", allowCredentials = "false")
 @RequestMapping("/region")
 @Api(value = "GbRegionController", description = "行政区划数据接口")
-public class GbRegionController {
+public class RegionController {
     @Autowired
-    private DimGbRegionMapper regionMapper;
+    private RegionService regionService;
 
     /**
      * 获取行政区划列表-全部
@@ -53,11 +53,11 @@ public class GbRegionController {
     @ApiResponses({ @ApiResponse(code = 200, message = "success"),
         @ApiResponse(code = 400, message = "{code:****,message:'fail'}")
     })
-    public CallResponse<List<GbRegion>> getAll() {
-        CallResponse<List<GbRegion>> callResponse = new CallResponse<>();
+    public CallResponse<List<Region>> getAll() {
+        CallResponse<List<Region>> callResponse = new CallResponse<>();
 
         try {
-            List<GbRegion> list = regionMapper.getAll();
+            List<Region> list = regionService.getAll();
             callResponse.setData(list);
             callResponse.setCode(0);
             callResponse.setMessage("success");
@@ -78,11 +78,11 @@ public class GbRegionController {
     @ApiResponses({ @ApiResponse(code = 200, message = "success"),
         @ApiResponse(code = 400, message = "{code:****,message:'fail'}")
     })
-    public CallResponse<List<GbRegion>> getSubArea(GbRegion param) {
-        CallResponse<List<GbRegion>> callResponse = new CallResponse<>();
+    public CallResponse<List<Region>> getSubArea(Region param) {
+        CallResponse<List<Region>> callResponse = new CallResponse<>();
 
         try {
-            List<GbRegion> list = regionMapper.getGbRegion(param);
+            List<Region> list = regionService.getRegion(param);
             callResponse.setData(list);
             callResponse.setCode(0);
             callResponse.setMessage("success");

+ 31 - 2
common-cloud/tool-modules/general-data/src/main/java/com/huashe/common/data/controller/WeatherController.java

@@ -12,6 +12,7 @@ package com.huashe.common.data.controller;
 
 import com.huashe.common.data.config.ApiAuth;
 import com.huashe.common.data.model.CallResponse;
+import com.huashe.common.data.model.WeatherType;
 import com.huashe.common.data.service.TaskService;
 import com.huashe.common.data.service.WeatherService;
 import com.huashe.common.domain.model.WeatherForecast;
@@ -21,6 +22,8 @@ import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import io.swagger.annotations.ApiResponse;
 import io.swagger.annotations.ApiResponses;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.CrossOrigin;
 import org.springframework.web.bind.annotation.RequestMapping;
@@ -44,6 +47,8 @@ import java.util.List;
 @RequestMapping("/weather")
 @Api(value = "WeatherController", description = "天气数据接口")
 public class WeatherController {
+    private static final Logger log = LoggerFactory.getLogger(WeatherController.class);
+
     @Autowired
     private WeatherService weatherService;
 
@@ -127,6 +132,30 @@ public class WeatherController {
     }
 
     /**
+     * 获取天气类型
+     */
+    @RequestMapping(value = "/getWeatherType", method = RequestMethod.GET)
+    @ApiOperation(value = "/getWeatherType", notes = "获取天气类型")
+    @ApiResponses({ @ApiResponse(code = 200, message = "success"),
+        @ApiResponse(code = 400, message = "{code:****,message:'fail'}")
+    })
+    public CallResponse<List<WeatherType>> getWeatherType() {
+        CallResponse<List<WeatherType>> callResponse = new CallResponse<>();
+        try {
+            List<WeatherType> list = weatherService.getWeatherType();
+            callResponse.setCode(0);
+            callResponse.setMessage("success");
+            callResponse.setData(list);
+        }
+        catch (Exception e) {
+            log.error(e.getMessage(), e);
+            throw new BusinessException(-1, e.getMessage());
+        }
+
+        return callResponse;
+    }
+
+    /**
      * 实时天气采集
      */
     @RequestMapping(value = "/triggerColRt", method = RequestMethod.GET)
@@ -151,8 +180,8 @@ public class WeatherController {
     /**
      * 实时天气采集
      */
-    @RequestMapping(value = "/triggercolForecast", method = RequestMethod.GET)
-    @ApiOperation(value = "/triggercolForecast", notes = "触发-预报天气采集")
+    @RequestMapping(value = "/triggerColForecast", method = RequestMethod.GET)
+    @ApiOperation(value = "/triggerColForecast", notes = "触发-预报天气采集")
     @ApiResponses({ @ApiResponse(code = 200, message = "success"),
         @ApiResponse(code = 400, message = "{code:****,message:'fail'}")
     })

+ 56 - 0
common-cloud/tool-modules/general-data/src/main/java/com/huashe/common/data/mapper/AdmHolidayMapper.java

@@ -0,0 +1,56 @@
+/*
+ * 文 件 名:  AdmHolidayMapper
+ * 版    权:  华设设计集团股份有限公司
+ * 描    述:  <描述>
+ * 修 改 人:  lvwenbin
+ * 修改时间:  2025/5/9
+ * 跟踪单号:  <跟踪单号>
+ * 修改单号:  <修改单号>
+ * 修改内容:  <修改内容>
+ */
+package com.huashe.common.data.mapper;
+
+import com.huashe.common.domain.model.Holiday;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+/**
+ * 节假日
+ * <功能详细描述>
+ *
+ * @author lvwenbin
+ * @version [版本号, 2025/5/9]
+ * @see [相关类/方法]
+ * @since [产品/模块版本]
+ */
+@Mapper
+public interface AdmHolidayMapper {
+    /**
+     * 批量插入
+     * @param list 节假日列表
+     */
+    void insertBatch(List<Holiday> list);
+
+    /**
+     * 根据日期查询节假日
+     * @param date 日期
+     * @return 节假日
+     */
+    Holiday selectByDate(@Param("date") String date);
+
+    /**
+     * 查询间隔日期内的节假日
+     * @param startDate 开始日期
+     * @param endDate 结束日期
+     * @return 节假日列表
+     */
+    List<Holiday> selectBetween(@Param("startDate") String startDate, @Param("endDate") String endDate);
+
+    /**
+     * 删除指定年份的节假日数据
+     * @param year 年份
+     */
+    void deleteByYear(String year);
+}

+ 37 - 0
common-cloud/tool-modules/general-data/src/main/java/com/huashe/common/data/mapper/DimGaWeatherMapper.java

@@ -0,0 +1,37 @@
+/*
+ * 文 件 名:  DimGbRegionMapper
+ * 版    权:
+ * 描    述:  <描述>
+ * 修 改 人:  learshaw
+ * 修改时间:  2022/2/18
+ * 跟踪单号:  <跟踪单号>
+ * 修改单号:  <修改单号>
+ * 修改内容:  <修改内容>
+ */
+package com.huashe.common.data.mapper;
+
+import com.huashe.common.data.model.Region;
+import com.huashe.common.domain.model.GaWeatherType;
+import com.huashe.common.domain.model.GbRegion;
+import org.apache.ibatis.annotations.Mapper;
+
+import java.util.List;
+
+/**
+ * 地区数据装配
+ * <功能详细描述>
+ *
+ * @author learshaw
+ * @version [版本号, 2022/2/18]
+ * @see [相关类/方法]
+ * @since [产品/模块版本]
+ */
+@Mapper
+public interface DimGaWeatherMapper {
+    /**
+     * 查询全部天气分类
+     *
+     * @return 行政区划
+     */
+    List<GaWeatherType> getAll();
+}

+ 2 - 1
common-cloud/tool-modules/general-data/src/main/java/com/huashe/common/data/mapper/DimGbRegionMapper.java

@@ -10,6 +10,7 @@
  */
 package com.huashe.common.data.mapper;
 
+import com.huashe.common.data.model.Region;
 import com.huashe.common.domain.model.GbRegion;
 import org.apache.ibatis.annotations.Mapper;
 
@@ -38,7 +39,7 @@ public interface DimGbRegionMapper {
      *
      * @return 行政区划
      */
-    List<GbRegion> getGbRegion(GbRegion param);
+    List<GbRegion> getGbRegion(Region param);
 
     /**
      * 查询地级市

+ 81 - 0
common-cloud/tool-modules/general-data/src/main/java/com/huashe/common/data/model/DateAttr.java

@@ -0,0 +1,81 @@
+/*
+ * 文 件 名:  DateAttr
+ * 版    权:  华设设计集团股份有限公司
+ * 描    述:  <描述>
+ * 修 改 人:  lvwenbin
+ * 修改时间:  2025/5/9
+ * 跟踪单号:  <跟踪单号>
+ * 修改单号:  <修改单号>
+ * 修改内容:  <修改内容>
+ */
+package com.huashe.common.data.model;
+
+/**
+ * 日期属性
+ * <功能详细描述>
+ *
+ * @author lvwenbin
+ * @version [版本号, 2025/5/9]
+ * @see [相关类/方法]
+ * @since [产品/模块版本]
+ */
+public class DateAttr {
+    private String date;
+
+    private int week;
+
+    /**
+     * 星期几-中文
+     */
+    private String weekCn;
+
+    /**
+     * 日期类型
+     */
+    private String type;
+
+    /**
+     * 日期名称-中文
+     */
+    private String dateName;
+
+    public String getDate() {
+        return date;
+    }
+
+    public void setDate(String date) {
+        this.date = date;
+    }
+
+    public int getWeek() {
+        return week;
+    }
+
+    public void setWeek(int week) {
+        this.week = week;
+    }
+
+    public String getWeekCn() {
+        return weekCn;
+    }
+
+    public void setWeekCn(String weekCn) {
+        this.weekCn = weekCn;
+    }
+
+    public String getType() {
+        return type;
+    }
+
+    public void setType(String type) {
+        this.type = type;
+    }
+
+    public String getDateName() {
+        return dateName;
+    }
+
+    public void setDateName(String dateName) {
+        this.dateName = dateName;
+    }
+}

+ 102 - 0
common-cloud/tool-modules/general-data/src/main/java/com/huashe/common/data/model/Region.java

@@ -0,0 +1,102 @@
+/*
+ * 文 件 名:  Region
+ * 版    权:  华设设计集团股份有限公司
+ * 描    述:  <描述>
+ * 修 改 人:  lvwenbin
+ * 修改时间:  2025/5/9
+ * 跟踪单号:  <跟踪单号>
+ * 修改单号:  <修改单号>
+ * 修改内容:  <修改内容>
+ */
+package com.huashe.common.data.model;
+
+import java.util.List;
+
+/**
+ * 行政区划
+ * <功能详细描述>
+ *
+ * @author lvwenbin
+ * @version [版本号, 2025/5/9]
+ * @see [相关类/方法]
+ * @since [产品/模块版本]
+ */
+public class Region {
+    /**
+     * 区划代码
+     */
+    private String adcode;
+
+    /**
+     * 区划名称
+     */
+    private String name;
+
+    /**
+     * 区域类型
+     */
+    private int areaType;
+
+    /**
+     * 父级区划代码
+     */
+    private String parentArea;
+
+    /**
+     * 父级区划名称
+     */
+    private String parentAreaName;
+
+    /**
+     * 子集区域
+     */
+    private List<Region> children;
+
+    public String getAdcode() {
+        return adcode;
+    }
+
+    public void setAdcode(String adcode) {
+        this.adcode = adcode;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public int getAreaType() {
+        return areaType;
+    }
+
+    public void setAreaType(int areaType) {
+        this.areaType = areaType;
+    }
+
+    public String getParentArea() {
+        return parentArea;
+    }
+
+    public void setParentArea(String parentArea) {
+        this.parentArea = parentArea;
+    }
+
+    public String getParentAreaName() {
+        return parentAreaName;
+    }
+
+    public void setParentAreaName(String parentAreaName) {
+        this.parentAreaName = parentAreaName;
+    }
+
+    public List<Region> getChildren() {
+        return children;
+    }
+
+    public void setChildren(List<Region> children) {
+        this.children = children;
+    }
+}

+ 64 - 0
common-cloud/tool-modules/general-data/src/main/java/com/huashe/common/data/model/WeatherType.java

@@ -0,0 +1,64 @@
+/*
+ * 文 件 名:  WeatherType
+ * 版    权:  华设设计集团股份有限公司
+ * 描    述:  <描述>
+ * 修 改 人:  lvwenbin
+ * 修改时间:  2025/5/9
+ * 跟踪单号:  <跟踪单号>
+ * 修改单号:  <修改单号>
+ * 修改内容:  <修改内容>
+ */
+package com.huashe.common.data.model;
+
+import java.util.List;
+
+/**
+ * 天气分类
+ * <功能详细描述>
+ *
+ * @author lvwenbin
+ * @version [版本号, 2025/5/9]
+ * @see [相关类/方法]
+ * @since [产品/模块版本]
+ */
+public class WeatherType {
+    private String code;
+
+    private String name;
+
+    private String desc;
+
+    private List<WeatherType> children;
+
+    public String getCode() {
+        return code;
+    }
+
+    public void setCode(String code) {
+        this.code = code;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public String getDesc() {
+        return desc;
+    }
+
+    public void setDesc(String desc) {
+        this.desc = desc;
+    }
+
+    public List<WeatherType> getChildren() {
+        return children;
+    }
+
+    public void setChildren(List<WeatherType> children) {
+        this.children = children;
+    }
+}

+ 50 - 0
common-cloud/tool-modules/general-data/src/main/java/com/huashe/common/data/service/DateService.java

@@ -0,0 +1,50 @@
+/*
+ * 文 件 名:  DateService
+ * 版    权:  华设设计集团股份有限公司
+ * 描    述:  <描述>
+ * 修 改 人:  lvwenbin
+ * 修改时间:  2025/5/9
+ * 跟踪单号:  <跟踪单号>
+ * 修改单号:  <修改单号>
+ * 修改内容:  <修改内容>
+ */
+package com.huashe.common.data.service;
+
+import com.huashe.common.data.model.DateAttr;
+
+import java.util.List;
+
+/**
+ * 日期服务
+ * <功能详细描述>
+ *
+ * @author lvwenbin
+ * @version [版本号, 2025/5/9]
+ * @see [相关类/方法]
+ * @since [产品/模块版本]
+ */
+public interface DateService {
+    /**
+     * 采集节假日
+     *
+     * @param year 年份
+     */
+    void collectHoliday(String year);
+
+    /**
+     * 获取日期属性
+     *
+     * @param date 日期
+     * @return 日期属性
+     */
+    DateAttr getDateAttr(String date);
+
+    /**
+     * 获取日期属性集合
+     *
+     * @param startDate 开始日期
+     * @param endDate   结束日期
+     * @return 日期属性
+     */
+    List<DateAttr> getDateAttr(String startDate, String endDate);
+}

+ 20 - 3
common-cloud/tool-modules/general-data/src/main/java/com/huashe/common/data/service/RegionService.java

@@ -10,6 +10,8 @@
  */
 package com.huashe.common.data.service;
 
+import com.huashe.common.data.model.Region;
+
 import java.util.List;
 
 /**
@@ -23,8 +25,23 @@ import java.util.List;
  */
 public interface RegionService {
     /**
-     * 查询区域
-     * @return 区域ID集合
+     * 查询全部行政区划
+     *
+     * @return 行政区划
+     */
+    List<Region> getAll();
+
+    /**
+     * 查询子区域
+     *
+     * @return 行政区划
+     */
+    List<Region> getRegion(Region param);
+
+    /**
+     * 查询地级市
+     *
+     * @return 区域列表
      */
-    List<String> fetch();
+    List<String> getPrefectureLevelCity();
 }

+ 30 - 3
common-cloud/tool-modules/general-data/src/main/java/com/huashe/common/data/service/TaskService.java

@@ -10,6 +10,7 @@
  */
 package com.huashe.common.data.service;
 
+import com.huashe.common.data.config.CollectConfig;
 import com.huashe.common.exception.Assert;
 import com.huashe.common.exception.BusinessException;
 import com.huashe.common.utils.ThreadUtils;
@@ -22,6 +23,7 @@ import org.springframework.scheduling.annotation.EnableScheduling;
 import org.springframework.scheduling.annotation.Scheduled;
 
 import javax.annotation.Resource;
+import java.util.Calendar;
 import java.util.List;
 
 /**
@@ -39,12 +41,15 @@ public class TaskService {
     private static final Logger log = LoggerFactory.getLogger(TaskService.class);
 
     @Resource
-    private RegionService regionService;
+    private CollectConfig collectConfig;
 
     @Resource
     @Qualifier(value = "weatherColService")
     private WeatherColService colService;
 
+    @Resource
+    private DateService dateService;
+
     /**
      * 天气实况采集
      *
@@ -56,7 +61,7 @@ public class TaskService {
         log.info("开始天气采集任务...");
 
         try {
-            List<String> adcodes = regionService.fetch();
+            List<String> adcodes = collectConfig.getWeatherAdcodes();
             Assert.notNull(adcodes, -1, "area is null!");
 
             for (String area : adcodes) {
@@ -82,7 +87,7 @@ public class TaskService {
         log.info("开始天气采集任务...");
 
         try {
-            List<String> adcodes = regionService.fetch();
+            List<String> adcodes = collectConfig.getWeatherAdcodes();
             Assert.notNull(adcodes, -1, "area is null!");
 
             for (String area : adcodes) {
@@ -96,4 +101,26 @@ public class TaskService {
 
         log.info("天气预报采集完成.");
     }
+
+    /**
+     * 采集节假日信息
+     *
+     * @see [类、类#方法、类#成员]
+     */
+    @Async
+    @Scheduled(cron = "${holiday.cron}")
+    public void collectHolidays() {
+        log.info("开始节假日任务...");
+
+        try {
+            Calendar calendar = Calendar.getInstance();
+            String year = String.valueOf(calendar.get(Calendar.YEAR));
+            dateService.collectHoliday(year);
+        }
+        catch (BusinessException e) {
+            log.error("collectHolidays fail!", e);
+        }
+
+        log.info("节假日采集完成.");
+    }
 }

+ 7 - 0
common-cloud/tool-modules/general-data/src/main/java/com/huashe/common/data/service/WeatherService.java

@@ -10,6 +10,7 @@
  */
 package com.huashe.common.data.service;
 
+import com.huashe.common.data.model.WeatherType;
 import com.huashe.common.domain.model.WeatherForecast;
 import com.huashe.common.domain.model.WeatherRt;
 
@@ -50,4 +51,10 @@ public interface WeatherService {
      * @return 未来天气预报数据
      */
     List<WeatherForecast> getWeatherForecast(String adcode);
+
+    /**
+     * 获取天气分类
+     * @return 天气分类列表
+     */
+    List<WeatherType> getWeatherType();
 }

+ 189 - 0
common-cloud/tool-modules/general-data/src/main/java/com/huashe/common/data/service/impl/DateServiceImpl.java

@@ -0,0 +1,189 @@
+/*
+ * 文 件 名:  DateService
+ * 版    权:  华设设计集团股份有限公司
+ * 描    述:  <描述>
+ * 修 改 人:  lvwenbin
+ * 修改时间:  2025/5/9
+ * 跟踪单号:  <跟踪单号>
+ * 修改单号:  <修改单号>
+ * 修改内容:  <修改内容>
+ */
+package com.huashe.common.data.service.impl;
+
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.huashe.common.data.config.CollectConfig;
+import com.huashe.common.data.mapper.AdmHolidayMapper;
+import com.huashe.common.data.model.DateAttr;
+import com.huashe.common.data.service.DateService;
+import com.huashe.common.data.util.HttpUtils;
+import com.huashe.common.domain.model.Holiday;
+import com.huashe.common.exception.Assert;
+import com.huashe.common.exception.BusinessException;
+import com.huashe.common.utils.DateUtils;
+import org.apache.commons.collections4.CollectionUtils;
+import org.apache.commons.lang3.StringUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+import java.util.ArrayList;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 日期服务
+ * <功能详细描述>
+ *
+ * @author lvwenbin
+ * @version [版本号, 2025/5/9]
+ * @see [相关类/方法]
+ * @since [产品/模块版本]
+ */
+@Service
+public class DateServiceImpl implements DateService {
+    private static final Logger log = LoggerFactory.getLogger(DateServiceImpl.class);
+
+    @Resource
+    private CollectConfig collectConfig;
+
+    @Resource
+    private AdmHolidayMapper holidayMapper;
+
+    @Override
+    public void collectHoliday(String year) {
+        try {
+            String dfUrl = StringUtils.replace(collectConfig.getHolidayColUrl(), "#year#", year);
+
+            log.debug("get url:\r\n{}", dfUrl);
+            String res = HttpUtils.doGet(dfUrl);
+            log.debug("get res:\r\n{}", res);
+            JSONObject jsonObject = JSON.parseObject(res);
+
+            String bodyYear = jsonObject.getString("year");
+            Assert.isTrue(StringUtils.equals(year, bodyYear), -1, "data error.");
+            JSONArray jsonArray = jsonObject.getJSONArray("dates");
+
+            if (!jsonArray.isEmpty()) {
+                List<Holiday> holidays = convert(jsonArray);
+                holidayMapper.deleteByYear(year);
+                holidayMapper.insertBatch(holidays);
+            }
+        }
+        catch (Exception e) {
+            log.error("collectRt fail!", e);
+        }
+    }
+
+    @Override
+    public DateAttr getDateAttr(String dateStr) {
+        Date date = DateUtils.stringToDate(dateStr, "yyyy-MM-dd");
+        Holiday holiday = holidayMapper.selectByDate(dateStr);
+        return buildDateAttr(date, holiday);
+    }
+
+    @Override
+    public List<DateAttr> getDateAttr(String startDateStr, String endDateStr) {
+        List<DateAttr> result = new ArrayList<>();
+        List<Holiday> holidays = holidayMapper.selectBetween(startDateStr, endDateStr);
+        Map<String, Holiday> holidayMap = new HashMap<>();
+
+        if (CollectionUtils.isNotEmpty(holidays)) {
+            holidays.forEach(holiday -> {
+                holidayMap.put(DateUtils.dateToString(holiday.getDate(), "yyyy-MM-dd"), holiday);
+            });
+        }
+
+        Date date = DateUtils.stringToDate(startDateStr, "yyyy-MM-dd");
+        Date endDate = DateUtils.stringToDate(endDateStr, "yyyy-MM-dd");
+
+        while (date.before(endDate)) {
+            Holiday holiday = holidayMap.get(DateUtils.dateToString(date, "yyyy-MM-dd"));
+            result.add(buildDateAttr(date, holiday));
+            date = DateUtils.adjustDay(date, 1);
+        }
+
+        return result;
+    }
+
+    private String buildWeekCn(int i) {
+        String ret = null;
+        switch (i) {
+            case Calendar.MONDAY:
+                ret = "周一";
+                break;
+            case Calendar.TUESDAY:
+                ret = "周二";
+                break;
+            case Calendar.WEDNESDAY:
+                ret = "周三";
+                break;
+            case Calendar.THURSDAY:
+                ret = "周四";
+                break;
+            case Calendar.FRIDAY:
+                ret = "周五";
+                break;
+            case Calendar.SATURDAY:
+                ret = "周六";
+                break;
+            case Calendar.SUNDAY:
+                ret = "周日";
+                break;
+            default:
+                throw new BusinessException(-1, "week error.");
+        }
+
+        return ret;
+    }
+
+    private DateAttr buildDateAttr(Date date, Holiday holiday) {
+        DateAttr dateAttr = new DateAttr();
+        dateAttr.setDate(DateUtils.dateToString(date, "yyyy-MM-dd"));
+
+        Calendar calendar = Calendar.getInstance();
+        calendar.setTime(date);
+        int dayOfWeek = calendar.get(Calendar.DAY_OF_WEEK);
+        dateAttr.setWeek(dayOfWeek);
+        dateAttr.setWeekCn(buildWeekCn(dayOfWeek));
+
+        if (holiday != null) {
+            dateAttr.setType(holiday.getType());
+            dateAttr.setDateName(holiday.getName());
+        }
+        else {
+            if (dayOfWeek == Calendar.SATURDAY || dayOfWeek == Calendar.SUNDAY) {
+                dateAttr.setType("ordinary_weekend");
+                dateAttr.setDateName("普通周末");
+            }
+            else {
+                dateAttr.setType("working_day");
+                dateAttr.setDateName("工作日");
+            }
+        }
+
+        return dateAttr;
+    }
+
+    private List<Holiday> convert(JSONArray jsonArray) {
+        List<Holiday> holidays = new ArrayList<>();
+
+        jsonArray.forEach(item -> {
+            JSONObject jsonObject = (JSONObject) item;
+            Holiday holiday = new Holiday();
+            holiday.setDate(jsonObject.getDate("date"));
+            holiday.setName(jsonObject.getString("name"));
+            holiday.setNameCn(jsonObject.getString("name_cn"));
+            holiday.setNameEn(jsonObject.getString("name_en"));
+            holiday.setType(jsonObject.getString("type"));
+            holidays.add(holiday);
+        });
+
+        return holidays;
+    }
+}

+ 0 - 52
common-cloud/tool-modules/general-data/src/main/java/com/huashe/common/data/service/impl/RegionConfServiceImpl.java

@@ -1,52 +0,0 @@
-/*
- * 文 件 名:  RegionConfServiceImpl
- * 版    权:
- * 描    述:  <描述>
- * 修 改 人:  learshaw
- * 修改时间:  2022/2/18
- * 跟踪单号:  <跟踪单号>
- * 修改单号:  <修改单号>
- * 修改内容:  <修改内容>
- */
-package com.huashe.common.data.service.impl;
-
-import com.huashe.common.data.config.CollectConfig;
-import com.huashe.common.data.service.RegionService;
-import org.apache.commons.lang3.ArrayUtils;
-import org.apache.commons.lang3.StringUtils;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
-import org.springframework.stereotype.Service;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-
-/**
- * 从数据库提取区域数据
- * <功能详细描述>
- *
- * @author learshaw
- * @version [版本号, 2022/2/18]
- * @see [相关类/方法]
- * @since [产品/模块版本]
- */
-@ConditionalOnProperty(prefix = "weather.region", name = "source", havingValue = "conf", matchIfMissing = false)
-@Service
-public class RegionConfServiceImpl implements RegionService {
-    @Autowired
-    private CollectConfig collectConfig;
-
-    @Override
-    public List<String> fetch() {
-        String cfgStr = collectConfig.getWeatherAdcodes();
-
-        String[] areaArray = null;
-
-        if (StringUtils.isBlank(cfgStr)) {
-            areaArray = StringUtils.split(cfgStr, ",");
-        }
-
-        return ArrayUtils.isNotEmpty(areaArray) ? Arrays.asList(areaArray) : new ArrayList<>();
-    }
-}

+ 0 - 43
common-cloud/tool-modules/general-data/src/main/java/com/huashe/common/data/service/impl/RegionDbServiceImpl.java

@@ -1,43 +0,0 @@
-/*
- * 文 件 名:  RegionDbServiceImpl
- * 版    权:
- * 描    述:  <描述>
- * 修 改 人:  learshaw
- * 修改时间:  2022/2/18
- * 跟踪单号:  <跟踪单号>
- * 修改单号:  <修改单号>
- * 修改内容:  <修改内容>
- */
-package com.huashe.common.data.service.impl;
-
-import com.huashe.common.data.mapper.DimGbRegionMapper;
-import com.huashe.common.data.service.RegionService;
-import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
-import org.springframework.stereotype.Service;
-
-import javax.annotation.Resource;
-import java.util.List;
-
-/**
- * 从数据库提取区域数据
- * <功能详细描述>
- *
- * @author learshaw
- * @version [版本号, 2022/2/18]
- * @see [相关类/方法]
- * @since [产品/模块版本]
- */
-@ConditionalOnProperty(prefix = "weather.region", name = "source", havingValue = "db", matchIfMissing = false)
-@Service
-public class RegionDbServiceImpl implements RegionService {
-    /**
-     * 区域映射装配
-     */
-    @Resource
-    private DimGbRegionMapper mapper;
-
-    @Override
-    public List<String> fetch() {
-        return mapper.getPrefectureLevelCity();
-    }
-}

+ 101 - 0
common-cloud/tool-modules/general-data/src/main/java/com/huashe/common/data/service/impl/RegionServiceImpl.java

@@ -0,0 +1,101 @@
+/*
+ * 文 件 名:  RegionConfServiceImpl
+ * 版    权:
+ * 描    述:  <描述>
+ * 修 改 人:  learshaw
+ * 修改时间:  2022/2/18
+ * 跟踪单号:  <跟踪单号>
+ * 修改单号:  <修改单号>
+ * 修改内容:  <修改内容>
+ */
+package com.huashe.common.data.service.impl;
+
+import com.huashe.common.data.mapper.DimGbRegionMapper;
+import com.huashe.common.data.model.Region;
+import com.huashe.common.data.service.RegionService;
+import com.huashe.common.domain.model.GbRegion;
+import com.huashe.common.utils.ListUtils;
+import org.apache.commons.collections4.CollectionUtils;
+import org.apache.commons.compress.utils.Lists;
+import org.springframework.beans.BeanUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
+
+/**
+ * 从数据库提取区域数据
+ * <功能详细描述>
+ *
+ * @author learshaw
+ * @version [版本号, 2022/2/18]
+ * @see [相关类/方法]
+ * @since [产品/模块版本]
+ */
+@Service
+public class RegionServiceImpl implements RegionService {
+    @Autowired
+    private DimGbRegionMapper regionMapper;
+
+    @Override
+    public List<Region> getAll() {
+        List<GbRegion> regions = regionMapper.getAll();
+        List<Region> tmpList = ListUtils.convert(regions, gbRegion -> {
+            Region region = new Region();
+            BeanUtils.copyProperties(gbRegion, region);
+            return region;
+        });
+
+        List<Region> rootList = ListUtils.filterList(tmpList, region -> region.getParentArea() == null, new ArrayList<>());
+
+        if (CollectionUtils.isNotEmpty(rootList)) {
+            List<Region> subList = ListUtils.filterList(tmpList, region -> region.getParentArea() != null, new ArrayList<>());
+            Map<String, List<Region>> regionMap = subList.stream().collect(Collectors.groupingBy(Region::getParentArea));
+
+            for (Region region : rootList) {
+                region.setChildren(buildSub(regionMap, region.getAdcode()));
+            }
+        }
+
+        return rootList;
+    }
+
+    private List<Region> buildSub(Map<String, List<Region>> regionMap, String key) {
+        List<Region> tmpList = regionMap.get(key);
+
+        if (CollectionUtils.isNotEmpty(tmpList)) {
+            for (Region region : tmpList) {
+                region.setChildren(buildSub(regionMap, region.getAdcode()));
+            }
+        }
+
+        return tmpList;
+    }
+
+    @Override
+    public List<Region> getRegion(Region param) {
+        List<GbRegion> regions = regionMapper.getGbRegion(param);
+        List<Region> ret = null;
+
+        if (CollectionUtils.isNotEmpty(regions)) {
+            ret = ListUtils.convert(regions, gbRegion -> {
+                Region region = new Region();
+                BeanUtils.copyProperties(gbRegion, region);
+                return region;
+            });
+        }
+        else {
+            ret = Lists.newArrayList();
+        }
+
+        return ret;
+    }
+
+    @Override
+    public List<String> getPrefectureLevelCity() {
+        return regionMapper.getPrefectureLevelCity();
+    }
+}

+ 71 - 2
common-cloud/tool-modules/general-data/src/main/java/com/huashe/common/data/service/impl/WeatherServiceimpl.java

@@ -12,14 +12,21 @@ package com.huashe.common.data.service.impl;
 
 import com.huashe.common.data.mapper.AdmWeatherForecastMapper;
 import com.huashe.common.data.mapper.AdmWeatherRtMapper;
+import com.huashe.common.data.mapper.DimGaWeatherMapper;
+import com.huashe.common.data.model.WeatherType;
 import com.huashe.common.data.service.WeatherService;
+import com.huashe.common.domain.model.GaWeatherType;
 import com.huashe.common.domain.model.WeatherForecast;
 import com.huashe.common.domain.model.WeatherRt;
-import com.huashe.common.utils.DateUtils;
+import com.huashe.common.utils.ListUtils;
+import org.apache.commons.collections4.CollectionUtils;
+import org.apache.commons.lang3.StringUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
-import java.util.Date;
+import java.util.ArrayList;
 import java.util.List;
 
 /**
@@ -33,6 +40,11 @@ import java.util.List;
  */
 @Service
 public class WeatherServiceimpl implements WeatherService {
+    private static final Logger log = LoggerFactory.getLogger(WeatherServiceimpl.class);
+
+    @Resource
+    private DimGaWeatherMapper weatherTypeMapper;
+
     @Resource
     private AdmWeatherRtMapper weatherRtMapper;
 
@@ -53,4 +65,61 @@ public class WeatherServiceimpl implements WeatherService {
     public List<WeatherForecast> getWeatherForecast(String adcode) {
         return weatherForecastMapper.getByAdcode(adcode);
     }
+
+    @Override
+    public List<WeatherType> getWeatherType() {
+        List<GaWeatherType> weatherTypes = weatherTypeMapper.getAll();
+        List<WeatherType> retList = new ArrayList<>();
+
+        if (CollectionUtils.isNotEmpty(weatherTypes)) {
+            List<WeatherType> tmp = ListUtils.convert(weatherTypes, gaWeatherType -> {
+                WeatherType weatherType = new WeatherType();
+                weatherType.setCode(gaWeatherType.getKey());
+                weatherType.setName(gaWeatherType.getValue());
+                weatherType.setDesc(gaWeatherType.getDesc());
+                return weatherType;
+            });
+
+            List<WeatherType> c1List = ListUtils.filterList(tmp,
+                weatherType -> StringUtils.endsWith(weatherType.getCode(), "000"));
+            List<WeatherType> c2List = ListUtils.filterList(tmp,
+                weatherType -> !StringUtils.endsWith(weatherType.getCode(), "000") && StringUtils.endsWith(
+                    weatherType.getCode(), "00"));
+            List<WeatherType> c3List = ListUtils.filterList(tmp,
+                weatherType -> !StringUtils.endsWith(weatherType.getCode(), "000") && !StringUtils.endsWith(
+                    weatherType.getCode(), "00"));
+
+            for (WeatherType c1 : c1List) {
+                c1.setChildren(buildC2List(c1.getCode(), c2List, c3List));
+                retList.add(c1);
+            }
+        }
+
+        return retList;
+    }
+
+    private List<WeatherType> buildC2List(String code, List<WeatherType> c2List, List<WeatherType> c3List) {
+        String parentPx = code.replaceAll("0+$", "");
+        List<WeatherType> retList = new ArrayList<>();
+
+        for (WeatherType c2 : c2List) {
+            if (StringUtils.startsWith(c2.getCode(), parentPx)) {
+                c2.setChildren(buildC3List(c2.getCode(), c3List));
+                retList.add(c2);
+            }
+        }
+        return retList;
+    }
+
+    private List<WeatherType> buildC3List(String code, List<WeatherType> c3List) {
+        String parentPx = code.replaceAll("0+$", "");
+        List<WeatherType> retList = new ArrayList<>();
+
+        for (WeatherType c3 : c3List) {
+            if (StringUtils.startsWith(c3.getCode(), parentPx)) {
+                retList.add(c3);
+            }
+        }
+        return retList;
+    }
 }

+ 5 - 1
common-cloud/tool-modules/general-data/src/main/resources/application-locale.yml

@@ -9,9 +9,13 @@ mybatis:
   mapper-locations: classpath:mapper/*.xml
   type-aliases-package: com.huashe.common.domain.model,com.huashe.common.weather.model
 
+holiday:
+  cron: 0 0 8 1 * ?
+  url: https://unpkg.com/holiday-calendar@1.1.6/data/CN/#year#.json
+
 weather:
   rt-cron: 0 15 0,6,12,18 * * ?
-  forecast-cron: 0 15 6 * * ?
+  forecast-cron: 0 15 8 * * ?
   # 服务提供商
   service-provider: amap
   region:

+ 34 - 0
common-cloud/tool-modules/general-data/src/main/resources/mapper/AdmHolidayMapper.xml

@@ -0,0 +1,34 @@
+<?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.huashe.common.data.mapper.AdmHolidayMapper">
+    <resultMap id="BaseResultMap" type="com.huashe.common.domain.model.Holiday">
+        <result column="date" property="date" jdbcType="DATE"/>
+        <result column="name" property="name" jdbcType="VARCHAR"/>
+        <result column="name_cn" property="nameCn" jdbcType="VARCHAR"/>
+        <result column="name_en" property="nameEn" jdbcType="VARCHAR"/>
+        <result column="type" property="type" jdbcType="VARCHAR"/>
+    </resultMap>
+
+    <insert id="insertBatch" parameterType="com.huashe.common.domain.model.Holiday">
+        INSERT INTO `adm_holiday`
+        (`date`, `name`, `name_cn`, `name_en`, `type`)
+        VALUES
+        <foreach collection="list" item="item" index="index" separator=",">
+            (#{item.date}, #{item.name}, #{item.nameCn}, #{item.nameEn}, #{item.type})
+        </foreach>
+    </insert>
+
+    <select id="selectByDate" parameterType="java.lang.String" resultMap="BaseResultMap">
+        SELECT `date`, `name`, `name_cn`, `name_en`, `type` from `adm_holiday` where `date` = #{date}
+    </select>
+
+    <select id="selectBetween" resultMap="BaseResultMap">
+        select
+            `date`, `name`, `name_cn`, `name_en`, `type` from `adm_holiday` where `date` &gt;= STR_TO_DATE(#{startDate},'%Y-%m-%d') and date &lt;= STR_TO_DATE(#{endDate},'%Y-%m-%d')
+    </select>
+
+    <delete id="deleteByYear" parameterType="java.lang.String">
+        DELETE FROM `adm_holiday` WHERE DATE_FORMAT(`date`, '%Y') = #{year}
+    </delete>
+
+</mapper>

+ 20 - 0
common-cloud/tool-modules/general-data/src/main/resources/mapper/DimGaWeatherMapper.xml

@@ -0,0 +1,20 @@
+<?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.huashe.common.data.mapper.DimGaWeatherMapper">
+    <resultMap id="BaseResultMap" type="com.huashe.common.domain.model.GaWeatherType">
+        <result column="key" property="key" jdbcType="VARCHAR"/>
+        <result column="value" property="value" jdbcType="VARCHAR"/>
+        <result column="desc" property="desc" jdbcType="VARCHAR"/>
+    </resultMap>
+
+    <sql id="selectGbRegion">
+        SELECT
+            `key`, `value`, `desc`
+        FROM
+            dim_ga_weather
+    </sql>
+
+    <select id="getAll" resultMap="BaseResultMap">
+        <include refid="selectGbRegion"/>
+    </select>
+</mapper>

+ 1 - 1
common-cloud/tool-modules/general-data/src/main/resources/mapper/DimGbRegionMapper.xml

@@ -20,7 +20,7 @@
         <include refid="selectGbRegion"/>
     </select>
 
-    <select id="getGbRegion" parameterType="com.huashe.common.domain.model.GbRegion" resultMap="BaseResultMap">
+    <select id="getGbRegion" parameterType="com.huashe.common.data.model.Region" resultMap="BaseResultMap">
         <include refid="selectGbRegion"/>
         <where>
             <if test="parentArea != null and parentArea != ''">and parent_area = #{parentArea}</if>

+ 61 - 0
prod-common/src/main/java/com/huashe/common/domain/model/GaWeatherType.java

@@ -0,0 +1,61 @@
+/*
+ * 文 件 名:  GaWeather
+ * 版    权:  华设设计集团股份有限公司
+ * 描    述:  <描述>
+ * 修 改 人:  lvwenbin
+ * 修改时间:  2025/5/9
+ * 跟踪单号:  <跟踪单号>
+ * 修改单号:  <修改单号>
+ * 修改内容:  <修改内容>
+ */
+package com.huashe.common.domain.model;
+
+/**
+ * 国标天气分类
+ * <功能详细描述>
+ *
+ * @author lvwenbin
+ * @version [版本号, 2025/5/9]
+ * @see [相关类/方法]
+ * @since [产品/模块版本]
+ */
+public class GaWeatherType {
+    /**
+     * 天气代码
+     */
+    private String key;
+
+    /**
+     * 天气名称
+     */
+    private String value;
+
+    /**
+     * 天气描述
+     */
+    private String desc;
+
+    public String getKey() {
+        return key;
+    }
+
+    public void setKey(String key) {
+        this.key = key;
+    }
+
+    public String getValue() {
+        return value;
+    }
+
+    public void setValue(String value) {
+        this.value = value;
+    }
+
+    public String getDesc() {
+        return desc;
+    }
+
+    public void setDesc(String desc) {
+        this.desc = desc;
+    }
+}

+ 6 - 6
prod-common/src/main/java/com/huashe/common/domain/model/GbRegion.java

@@ -11,7 +11,7 @@
 package com.huashe.common.domain.model;
 
 /**
- * 区域
+ * 行政区划
  * <功能详细描述>
  *
  * @author learshaw
@@ -21,27 +21,27 @@ package com.huashe.common.domain.model;
  */
 public class GbRegion {
     /**
-     * 区代码
+     * 区代码
      */
     private String adcode;
 
     /**
-     * 区名称
+     * 区名称
      */
     private String name;
 
     /**
-     * 区类型
+     * 区类型
      */
     private int areaType;
 
     /**
-     * 父级区代码
+     * 父级区代码
      */
     private String parentArea;
 
     /**
-     * 父级区名称
+     * 父级区名称
      */
     private String parentAreaName;
 

+ 92 - 0
prod-common/src/main/java/com/huashe/common/domain/model/Holiday.java

@@ -0,0 +1,92 @@
+/*
+ * 文 件 名:  Holiday
+ * 版    权:  华设设计集团股份有限公司
+ * 描    述:  <描述>
+ * 修 改 人:  lvwenbin
+ * 修改时间:  2025/5/9
+ * 跟踪单号:  <跟踪单号>
+ * 修改单号:  <修改单号>
+ * 修改内容:  <修改内容>
+ */
+package com.huashe.common.domain.model;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+
+import java.util.Date;
+
+/**
+ * 节假日
+ * <功能详细描述>
+ *
+ * @author lvwenbin
+ * @version [版本号, 2025/5/9]
+ * @see [相关类/方法]
+ * @since [产品/模块版本]
+ */
+public class Holiday {
+    /**
+     * 日期
+     */
+    @JsonFormat(pattern = "yyyy-MM-dd")
+    private Date date;
+
+    /**
+     * 名称
+     */
+    private String name;
+
+    /**
+     * 名称(中文)
+     */
+    private String nameCn;
+
+    /**
+     * 名称(英文)
+     */
+    private String nameEn;
+
+    /**
+     * 类型
+     */
+    private String type;
+
+    public Date getDate() {
+        return date;
+    }
+
+    public void setDate(Date date) {
+        this.date = date;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public String getNameCn() {
+        return nameCn;
+    }
+
+    public void setNameCn(String nameCn) {
+        this.nameCn = nameCn;
+    }
+
+    public String getNameEn() {
+        return nameEn;
+    }
+
+    public void setNameEn(String nameEn) {
+        this.nameEn = nameEn;
+    }
+
+    public String getType() {
+        return type;
+    }
+
+    public void setType(String type) {
+        this.type = type;
+    }
+}