ouyang преди 2 години
родител
ревизия
3c7d5971df
променени са 23 файла, в които са добавени 776 реда и са изтрити 17 реда
  1. 3 0
      soc-api/soc-api-system/src/main/java/com/xunmei/system/api/RemoteOrgService.java
  2. 25 0
      soc-api/soc-api-system/src/main/java/com/xunmei/system/api/RemoteWeatherTaskService.java
  3. 1 1
      soc-api/soc-api-system/src/main/java/com/xunmei/system/api/domain/SysOrgExtend.java
  4. 5 0
      soc-api/soc-api-system/src/main/java/com/xunmei/system/api/factory/RemoteOrgFallbackFactory.java
  5. 27 0
      soc-api/soc-api-system/src/main/java/com/xunmei/system/api/factory/RemoteWeatherFallbackFactory.java
  6. 2 1
      soc-api/soc-api-system/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
  7. 75 0
      soc-common/soc-common-core/src/main/java/com/xunmei/common/core/domain/weather/domain/WeatherWarning.java
  8. 33 0
      soc-common/soc-common-core/src/main/java/com/xunmei/common/core/domain/weather/dto/WeatherWarningDto.java
  9. 1 0
      soc-modules/soc-modules-core/src/main/java/com/xunmei/core/retrieval/controller/CoreMonitoringRetrievalTaskController.java
  10. 3 3
      soc-modules/soc-modules-core/src/main/java/com/xunmei/core/retrieval/service/impl/CoreMonitoringRetrievalTaskServiceImpl.java
  11. 58 0
      soc-modules/soc-modules-core/src/main/java/com/xunmei/core/weather/controller/WeatherWarningController.java
  12. 32 0
      soc-modules/soc-modules-core/src/main/java/com/xunmei/core/weather/mapper/WeatherWarningMapper.java
  13. 29 0
      soc-modules/soc-modules-core/src/main/java/com/xunmei/core/weather/service/IWeatherWarningService.java
  14. 90 0
      soc-modules/soc-modules-core/src/main/java/com/xunmei/core/weather/service/impl/WeatherWarningServiceImpl.java
  15. 311 0
      soc-modules/soc-modules-core/src/main/java/com/xunmei/core/weather/utils/HttpUtils.java
  16. 31 0
      soc-modules/soc-modules-core/src/main/resources/mapper/weather/WeatherWarningMapper.xml
  17. 37 0
      soc-modules/soc-modules-job/src/main/java/com/xunmei/job/task/WeatherTask.java
  18. 6 1
      soc-modules/soc-modules-system/src/main/java/com/xunmei/system/controller/SysOrgExtendController.java
  19. 0 2
      soc-modules/soc-modules-system/src/main/java/com/xunmei/system/dto/SysOrgExtendDto.java
  20. 1 1
      soc-modules/soc-modules-system/src/main/java/com/xunmei/system/mapper/SysOrgExtendMapper.java
  21. 1 3
      soc-modules/soc-modules-system/src/main/java/com/xunmei/system/service/ISysOrgExtendService.java
  22. 1 1
      soc-modules/soc-modules-system/src/main/java/com/xunmei/system/service/impl/SysOrgExtendServiceImpl.java
  23. 4 4
      soc-modules/soc-modules-system/src/main/resources/mapper/system/SysOrgExtendMapper.xml

+ 3 - 0
soc-api/soc-api-system/src/main/java/com/xunmei/system/api/RemoteOrgService.java

@@ -6,6 +6,7 @@ import com.xunmei.common.core.domain.R;
 import com.xunmei.common.core.vo.IdNameVo;
 import com.xunmei.system.api.Eto.OrgListByTypesConditionEto;
 import com.xunmei.system.api.domain.SysOrg;
+import com.xunmei.system.api.domain.SysOrgExtend;
 import com.xunmei.system.api.factory.RemoteOrgFallbackFactory;
 import org.springframework.cloud.openfeign.FeignClient;
 import org.springframework.web.bind.annotation.*;
@@ -122,6 +123,8 @@ public interface RemoteOrgService {
      */
     @PostMapping("/dept/selectByOrgIdList")
     List<SysOrg> selectByOrgIdList(@RequestBody List<Long> ids, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
+    @GetMapping("/extend/selectSysOrgExtendById")
+    SysOrgExtend selectSysOrgExtendById(@RequestParam("orgId") Long orgId,  @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
 
 //    @PostMapping("/dept/selectParentHs")
 //    List<SysOrg> selectParentHs(@RequestBody List<Long> orgList, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);

+ 25 - 0
soc-api/soc-api-system/src/main/java/com/xunmei/system/api/RemoteWeatherTaskService.java

@@ -0,0 +1,25 @@
+package com.xunmei.system.api;
+
+import com.xunmei.common.core.constant.SecurityConstants;
+import com.xunmei.common.core.constant.ServiceNameConstants;
+import com.xunmei.common.core.web.domain.AjaxResult;
+import com.xunmei.system.api.factory.RemoteRetrievalTaskFallbackFactory;
+import com.xunmei.system.api.factory.RemoteWeatherFallbackFactory;
+import org.springframework.cloud.openfeign.FeignClient;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestHeader;
+import org.springframework.web.bind.annotation.RequestParam;
+
+import java.time.LocalDate;
+
+@FeignClient(contextId = "remoteWeatherTaskService", value = ServiceNameConstants.CORE_SERVICE, fallbackFactory = RemoteWeatherFallbackFactory.class)
+public interface RemoteWeatherTaskService {
+    /**
+     * 每天生成日任务 如果当天是周一还需生成周任务
+     *
+     * @return
+     */
+    @GetMapping("/weatherWarning/getDataFromApi")
+    AjaxResult getDataFromApi(@RequestHeader(SecurityConstants.FROM_SOURCE) String source);
+
+}

+ 1 - 1
soc-modules/soc-modules-system/src/main/java/com/xunmei/system/domain/SysOrgExtend.java → soc-api/soc-api-system/src/main/java/com/xunmei/system/api/domain/SysOrgExtend.java

@@ -1,4 +1,4 @@
-package com.xunmei.system.domain;
+package com.xunmei.system.api.domain;
 
 import com.fasterxml.jackson.annotation.JsonFormat;
 import com.fasterxml.jackson.databind.annotation.JsonSerialize;

+ 5 - 0
soc-api/soc-api-system/src/main/java/com/xunmei/system/api/factory/RemoteOrgFallbackFactory.java

@@ -5,6 +5,7 @@ import com.xunmei.common.core.vo.IdNameVo;
 import com.xunmei.system.api.Eto.OrgListByTypesConditionEto;
 import com.xunmei.system.api.RemoteOrgService;
 import com.xunmei.system.api.domain.SysOrg;
+import com.xunmei.system.api.domain.SysOrgExtend;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.cloud.openfeign.FallbackFactory;
@@ -132,6 +133,10 @@ public class RemoteOrgFallbackFactory implements FallbackFactory<RemoteOrgServic
             public List<SysOrg> selectChildHs(Long orgId, String source) {
                 return new ArrayList<>();
             }
+            @Override
+            public SysOrgExtend selectSysOrgExtendById(Long orgId, String source) {
+                return null;
+            }
         };
     }
 }

+ 27 - 0
soc-api/soc-api-system/src/main/java/com/xunmei/system/api/factory/RemoteWeatherFallbackFactory.java

@@ -0,0 +1,27 @@
+package com.xunmei.system.api.factory;
+
+import com.xunmei.common.core.domain.R;
+import com.xunmei.common.core.web.domain.AjaxResult;
+import com.xunmei.system.api.RemoteTaskService;
+import com.xunmei.system.api.RemoteWeatherTaskService;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.cloud.openfeign.FallbackFactory;
+import org.springframework.stereotype.Component;
+
+@Component
+public class RemoteWeatherFallbackFactory implements FallbackFactory<RemoteWeatherTaskService> {
+    private static final Logger log = LoggerFactory.getLogger(RemoteUserFallbackFactory.class);
+    @Override
+    public RemoteWeatherTaskService create(Throwable throwable) {
+
+        log.error("天气服务调用失败:{}", throwable.getMessage());
+        return new RemoteWeatherTaskService()
+        {
+            @Override
+            public AjaxResult getDataFromApi(String source) {
+                return null;
+            }
+        };
+    }
+}

+ 2 - 1
soc-api/soc-api-system/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports

@@ -9,4 +9,5 @@ com.xunmei.system.api.factory.RemoteTaskFallbackFactory
 com.xunmei.system.api.factory.RemoteDictDataFallbackFactory
 com.xunmei.system.api.factory.RemoteRetrievalTaskFallbackFactory
 com.xunmei.system.api.factory.RemoteEduTrainingFallbackFactory
-com.xunmei.system.api.factory.RemoteResumptionTaskFallbackFactory
+com.xunmei.system.api.factory.RemoteResumptionTaskFallbackFactory
+com.xunmei.system.api.factory.RemoteWeatherFallbackFactory

+ 75 - 0
soc-common/soc-common-core/src/main/java/com/xunmei/common/core/domain/weather/domain/WeatherWarning.java

@@ -0,0 +1,75 @@
+package com.xunmei.common.core.domain.weather.domain;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * <p>
+ * 天气预警数据
+ * </p>
+ *
+ * @author oygj
+ * @since 2023-03-09
+ */
+@Data
+@EqualsAndHashCode(callSuper = false)
+@TableName("core_weather_warning")
+@ApiModel(value="WeatherWarning对象", description="天气预警数据")
+public class WeatherWarning implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+      @TableId(value = "id", type = IdType.AUTO)
+    private Long id;
+
+    @ApiModelProperty(value = "预警标题")
+    @TableField("alarm_title")
+    private String alarmTitle;
+
+    @ApiModelProperty(value = "预警内容")
+    @TableField("alarm_content")
+    private String alarmContent;
+
+    @ApiModelProperty(value = "预警等级")
+    @TableField("alarm_level")
+    private String alarmLevel;
+
+    @ApiModelProperty(value = "省")
+    @TableField("province")
+    private String province;
+
+    @ApiModelProperty(value = "市")
+    @TableField("city")
+    private String city;
+
+    @ApiModelProperty(value = "区、县")
+    @TableField("area")
+    private String area;
+
+    @ApiModelProperty(value = "市区县的编号")
+    @TableField("code")
+    private String code;
+
+    @ApiModelProperty(value = "预警类型")
+    @TableField("alarm_type")
+    private String alarmType;
+
+    @ApiModelProperty(value = "预警发布时间")
+    @TableField("alarm_time")
+    private Date alarmTime;
+
+    @ApiModelProperty(value = "创建时间")
+    @TableField("create_time")
+    private Date createTime;
+
+
+}

+ 33 - 0
soc-common/soc-common-core/src/main/java/com/xunmei/common/core/domain/weather/dto/WeatherWarningDto.java

@@ -0,0 +1,33 @@
+package com.xunmei.common.core.domain.weather.dto;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * <p>
+ * 试卷
+ * </p>
+ *
+ * @author oygj
+ * @since 2023-01-17
+ */
+@Data
+public class WeatherWarningDto implements Serializable {
+
+    @ApiModelProperty(value = "告警名称")
+    private String alarmTitle;
+
+    @ApiModelProperty(value = "区域code")
+    private String code;
+
+    @ApiModelProperty(value = "告警时间")
+    private String[] alarmDates;
+    private Long pageNum;
+    /**
+     * 每页大小
+     */
+    private Long pageSize;
+}

+ 1 - 0
soc-modules/soc-modules-core/src/main/java/com/xunmei/core/retrieval/controller/CoreMonitoringRetrievalTaskController.java

@@ -37,6 +37,7 @@ public class CoreMonitoringRetrievalTaskController extends BaseController {
      * 查询监控调阅任务列表
      */
     @ApiOperation(value = "查询CoreMonitoringRetrievalTask列表")
+    @RequiresPermissions("core:task:weblist")
     @GetMapping("/list")
     public TableDataInfo list(RetrievalTaskPageDto request) {
 

+ 3 - 3
soc-modules/soc-modules-core/src/main/java/com/xunmei/core/retrieval/service/impl/CoreMonitoringRetrievalTaskServiceImpl.java

@@ -100,15 +100,15 @@ public class CoreMonitoringRetrievalTaskServiceImpl extends ServiceImpl<CoreMoni
     @Override
     public void export(RetrievalTaskPageDto request, HttpServletResponse response) throws IOException {
         //不分页
-        request.setPageSize(null);
-        request.setPageNum(null);
+        request.setPageSize(1L);
+        request.setPageNum(100000L);
         SysOrg sysOrg = RemoteCallHandlerExecutor.executeRemoteCall(() -> orgService.selectSysOrgById(request.getOrgId(),SecurityConstants.INNER), ErrorMsgConstants.QUERY_ORG_DATA_ERROR);
         List<SysDictData> listDict = RemoteCallHandlerExecutor.executeRemoteCall(() -> dictDataService.selectDictByeType("retrieval_task_status", SecurityConstants.INNER), ErrorMsgConstants.QUERY_DICT_DATA_ERROR);
         final TableDataInfo tableDataInfo = this.selectPage(request);
         if (ObjectUtil.isEmpty(tableDataInfo.getRows())) {
             throw new RuntimeException("导出数据为空!");
         }
-        List<CoreMonitoringRetrievalTaskVo> list = this.selectPage(request).getRows();
+        List<CoreMonitoringRetrievalTaskVo> list = tableDataInfo.getRows();
         list.forEach(r -> {
             r.setStatusText(listDict.stream().filter(d -> d.getDictValue().equals(r.getStatus())).findFirst().orElse(new SysDictData()).getDictLabel());
         });

+ 58 - 0
soc-modules/soc-modules-core/src/main/java/com/xunmei/core/weather/controller/WeatherWarningController.java

@@ -0,0 +1,58 @@
+package com.xunmei.core.weather.controller;
+
+
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.xunmei.common.core.domain.weather.domain.WeatherWarning;
+import com.xunmei.common.core.domain.weather.dto.WeatherWarningDto;
+import com.xunmei.common.core.utils.KeyValue;
+import com.xunmei.common.core.web.domain.AjaxResult;
+import com.xunmei.common.core.web.page.TableDataInfo;
+import com.xunmei.common.security.annotation.RequiresPermissions;
+import com.xunmei.core.access.vo.TMonitoringRetrievalPlanVO;
+import com.xunmei.core.weather.service.IWeatherWarningService;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.web.bind.annotation.*;
+
+import javax.annotation.Resource;
+import java.util.List;
+
+/**
+ * <p>
+ * 天气预警数据 前端控制器
+ * </p>
+ *
+ * @author oygj
+ * @since 2023-03-09
+ */
+@RestController
+@RequestMapping("/weatherWarning")
+public class WeatherWarningController {
+    @Resource
+    IWeatherWarningService weatherWarningService;
+
+    @ApiOperation(value = "天气预警列表")
+    @GetMapping(value = "/pageList")
+    @RequiresPermissions("core:weather:list")
+    public TableDataInfo<WeatherWarning> pageList( WeatherWarningDto request) {
+        return  weatherWarningService.pageList(request);
+    }
+    @ApiOperation(value = "根据机构获取地区天气预警")
+    @GetMapping(value = "/getTheAreaWeather/{orgId}")
+    public AjaxResult getTheAreaWeather( @PathVariable final Long orgId){
+        List<WeatherWarning> weatherWarnings =weatherWarningService.getTheAreaWeather(orgId);
+        return AjaxResult.success(weatherWarnings);
+
+    }
+    @GetMapping(value = "/cityCodeList")
+    public AjaxResult cityCodeList(){
+        List<KeyValue> cityList = weatherWarningService.cityCodeList();
+    return AjaxResult.success(cityList);
+    }
+
+    @GetMapping(value = "/getDataFromApi")
+    public void getDataFromApi() {
+        weatherWarningService.getDataFromApi();
+    }
+
+}
+

+ 32 - 0
soc-modules/soc-modules-core/src/main/java/com/xunmei/core/weather/mapper/WeatherWarningMapper.java

@@ -0,0 +1,32 @@
+package com.xunmei.core.weather.mapper;
+
+import cn.hutool.core.date.DateTime;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.xunmei.common.core.domain.weather.domain.WeatherWarning;
+import com.xunmei.common.core.domain.weather.dto.WeatherWarningDto;
+import com.xunmei.common.core.utils.KeyValue;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+/**
+ * <p>
+ * 天气预警数据 Mapper 接口
+ * </p>
+ *
+ * @author oygj
+ * @since 2023-03-09
+ */
+@Mapper
+public interface WeatherWarningMapper extends BaseMapper<WeatherWarning> {
+
+    Page<WeatherWarning> pageList(@Param("mePage") Page<WeatherWarning> mePage, @Param("request") WeatherWarningDto request);
+
+    List<String> findAreaList();
+
+    List<WeatherWarning> findListAllByDate(@Param("time") DateTime time);
+
+    List<KeyValue> cityCodeList();
+}

+ 29 - 0
soc-modules/soc-modules-core/src/main/java/com/xunmei/core/weather/service/IWeatherWarningService.java

@@ -0,0 +1,29 @@
+package com.xunmei.core.weather.service;
+
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.xunmei.common.core.domain.weather.domain.WeatherWarning;
+import com.xunmei.common.core.domain.weather.dto.WeatherWarningDto;
+import com.xunmei.common.core.utils.KeyValue;
+import com.xunmei.common.core.web.page.TableDataInfo;
+
+import java.util.List;
+
+/**
+ * <p>
+ * 天气预警数据 服务类
+ * </p>
+ *
+ * @author oygj
+ * @since 2023-03-09
+ */
+public interface IWeatherWarningService extends IService<WeatherWarning> {
+
+    TableDataInfo<WeatherWarning> pageList(WeatherWarningDto request);
+
+    void getDataFromApi();
+
+    List<WeatherWarning> getTheAreaWeather(Long orgId);
+
+    List<KeyValue> cityCodeList();
+}

Файловите разлики са ограничени, защото са твърде много
+ 90 - 0
soc-modules/soc-modules-core/src/main/java/com/xunmei/core/weather/service/impl/WeatherWarningServiceImpl.java


+ 311 - 0
soc-modules/soc-modules-core/src/main/java/com/xunmei/core/weather/utils/HttpUtils.java

@@ -0,0 +1,311 @@
+package com.xunmei.core.weather.utils;
+
+import org.apache.commons.lang3.StringUtils;
+import org.apache.http.HttpResponse;
+import org.apache.http.NameValuePair;
+import org.apache.http.client.HttpClient;
+import org.apache.http.client.entity.UrlEncodedFormEntity;
+import org.apache.http.client.methods.HttpDelete;
+import org.apache.http.client.methods.HttpGet;
+import org.apache.http.client.methods.HttpPost;
+import org.apache.http.client.methods.HttpPut;
+import org.apache.http.conn.ClientConnectionManager;
+import org.apache.http.conn.scheme.Scheme;
+import org.apache.http.conn.scheme.SchemeRegistry;
+import org.apache.http.conn.ssl.SSLSocketFactory;
+import org.apache.http.entity.ByteArrayEntity;
+import org.apache.http.entity.StringEntity;
+import org.apache.http.impl.client.DefaultHttpClient;
+import org.apache.http.message.BasicNameValuePair;
+
+import javax.net.ssl.SSLContext;
+import javax.net.ssl.TrustManager;
+import javax.net.ssl.X509TrustManager;
+import java.io.UnsupportedEncodingException;
+import java.net.URLEncoder;
+import java.security.KeyManagementException;
+import java.security.NoSuchAlgorithmException;
+import java.security.cert.X509Certificate;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+public class HttpUtils {
+	
+	/**
+	 * get
+	 * 
+	 * @param host
+	 * @param path
+	 * @param method
+	 * @param headers
+	 * @param querys
+	 * @return
+	 * @throws Exception
+	 */
+	public static HttpResponse doGet(String host, String path, String method, 
+			Map<String, String> headers, 
+			Map<String, String> querys)
+            throws Exception {    	
+    	HttpClient httpClient = wrapClient(host);
+
+    	HttpGet request = new HttpGet(buildUrl(host, path, querys));
+        for (Map.Entry<String, String> e : headers.entrySet()) {
+        	request.addHeader(e.getKey(), e.getValue());
+        }
+        
+        return httpClient.execute(request);
+    }
+	
+	/**
+	 * post form
+	 * 
+	 * @param host
+	 * @param path
+	 * @param method
+	 * @param headers
+	 * @param querys
+	 * @param bodys
+	 * @return
+	 * @throws Exception
+	 */
+	public static HttpResponse doPost(String host, String path, String method, 
+			Map<String, String> headers, 
+			Map<String, String> querys, 
+			Map<String, String> bodys)
+            throws Exception {    	
+    	HttpClient httpClient = wrapClient(host);
+
+    	HttpPost request = new HttpPost(buildUrl(host, path, querys));
+        for (Map.Entry<String, String> e : headers.entrySet()) {
+        	request.addHeader(e.getKey(), e.getValue());
+        }
+
+        if (bodys != null) {
+            List<NameValuePair> nameValuePairList = new ArrayList<NameValuePair>();
+
+            for (String key : bodys.keySet()) {
+                nameValuePairList.add(new BasicNameValuePair(key, bodys.get(key)));
+            }
+            UrlEncodedFormEntity formEntity = new UrlEncodedFormEntity(nameValuePairList, "utf-8");
+            formEntity.setContentType("application/x-www-form-urlencoded; charset=UTF-8");
+            request.setEntity(formEntity);
+        }
+
+        return httpClient.execute(request);
+    }	
+	
+	/**
+	 * Post String
+	 * 
+	 * @param host
+	 * @param path
+	 * @param method
+	 * @param headers
+	 * @param querys
+	 * @param body
+	 * @return
+	 * @throws Exception
+	 */
+	public static HttpResponse doPost(String host, String path, String method, 
+			Map<String, String> headers, 
+			Map<String, String> querys, 
+			String body)
+            throws Exception {    	
+    	HttpClient httpClient = wrapClient(host);
+
+    	HttpPost request = new HttpPost(buildUrl(host, path, querys));
+        for (Map.Entry<String, String> e : headers.entrySet()) {
+        	request.addHeader(e.getKey(), e.getValue());
+        }
+
+        if (StringUtils.isNotBlank(body)) {
+        	request.setEntity(new StringEntity(body, "utf-8"));
+        }
+
+        return httpClient.execute(request);
+    }
+	
+	/**
+	 * Post stream
+	 * 
+	 * @param host
+	 * @param path
+	 * @param method
+	 * @param headers
+	 * @param querys
+	 * @param body
+	 * @return
+	 * @throws Exception
+	 */
+	public static HttpResponse doPost(String host, String path, String method, 
+			Map<String, String> headers, 
+			Map<String, String> querys, 
+			byte[] body)
+            throws Exception {    	
+    	HttpClient httpClient = wrapClient(host);
+
+    	HttpPost request = new HttpPost(buildUrl(host, path, querys));
+        for (Map.Entry<String, String> e : headers.entrySet()) {
+        	request.addHeader(e.getKey(), e.getValue());
+        }
+
+        if (body != null) {
+        	request.setEntity(new ByteArrayEntity(body));
+        }
+
+        return httpClient.execute(request);
+    }
+	
+	/**
+	 * Put String
+	 * @param host
+	 * @param path
+	 * @param method
+	 * @param headers
+	 * @param querys
+	 * @param body
+	 * @return
+	 * @throws Exception
+	 */
+	public static HttpResponse doPut(String host, String path, String method, 
+			Map<String, String> headers, 
+			Map<String, String> querys, 
+			String body)
+            throws Exception {    	
+    	HttpClient httpClient = wrapClient(host);
+
+    	HttpPut request = new HttpPut(buildUrl(host, path, querys));
+        for (Map.Entry<String, String> e : headers.entrySet()) {
+        	request.addHeader(e.getKey(), e.getValue());
+        }
+
+        if (StringUtils.isNotBlank(body)) {
+        	request.setEntity(new StringEntity(body, "utf-8"));
+        }
+
+        return httpClient.execute(request);
+    }
+	
+	/**
+	 * Put stream
+	 * @param host
+	 * @param path
+	 * @param method
+	 * @param headers
+	 * @param querys
+	 * @param body
+	 * @return
+	 * @throws Exception
+	 */
+	public static HttpResponse doPut(String host, String path, String method, 
+			Map<String, String> headers, 
+			Map<String, String> querys, 
+			byte[] body)
+            throws Exception {    	
+    	HttpClient httpClient = wrapClient(host);
+
+    	HttpPut request = new HttpPut(buildUrl(host, path, querys));
+        for (Map.Entry<String, String> e : headers.entrySet()) {
+        	request.addHeader(e.getKey(), e.getValue());
+        }
+
+        if (body != null) {
+        	request.setEntity(new ByteArrayEntity(body));
+        }
+
+        return httpClient.execute(request);
+    }
+	
+	/**
+	 * Delete
+	 *  
+	 * @param host
+	 * @param path
+	 * @param method
+	 * @param headers
+	 * @param querys
+	 * @return
+	 * @throws Exception
+	 */
+	public static HttpResponse doDelete(String host, String path, String method, 
+			Map<String, String> headers, 
+			Map<String, String> querys)
+            throws Exception {    	
+    	HttpClient httpClient = wrapClient(host);
+
+    	HttpDelete request = new HttpDelete(buildUrl(host, path, querys));
+        for (Map.Entry<String, String> e : headers.entrySet()) {
+        	request.addHeader(e.getKey(), e.getValue());
+        }
+        
+        return httpClient.execute(request);
+    }
+	
+	private static String buildUrl(String host, String path, Map<String, String> querys) throws UnsupportedEncodingException {
+    	StringBuilder sbUrl = new StringBuilder();
+    	sbUrl.append(host);
+    	if (!StringUtils.isBlank(path)) {
+    		sbUrl.append(path);
+        }
+    	if (null != querys) {
+    		StringBuilder sbQuery = new StringBuilder();
+        	for (Map.Entry<String, String> query : querys.entrySet()) {
+        		if (0 < sbQuery.length()) {
+        			sbQuery.append("&");
+        		}
+        		if (StringUtils.isBlank(query.getKey()) && !StringUtils.isBlank(query.getValue())) {
+        			sbQuery.append(query.getValue());
+                }
+        		if (!StringUtils.isBlank(query.getKey())) {
+        			sbQuery.append(query.getKey());
+        			if (!StringUtils.isBlank(query.getValue())) {
+        				sbQuery.append("=");
+        				sbQuery.append(URLEncoder.encode(query.getValue(), "utf-8"));
+        			}        			
+                }
+        	}
+        	if (0 < sbQuery.length()) {
+        		sbUrl.append("?").append(sbQuery);
+        	}
+        }
+    	
+    	return sbUrl.toString();
+    }
+	
+	private static HttpClient wrapClient(String host) {
+		HttpClient httpClient = new DefaultHttpClient();
+		if (host.startsWith("https://")) {
+			sslClient(httpClient);
+		}
+		
+		return httpClient;
+	}
+	
+	private static void sslClient(HttpClient httpClient) {
+        try {
+            SSLContext ctx = SSLContext.getInstance("TLS");
+            X509TrustManager tm = new X509TrustManager() {
+                public X509Certificate[] getAcceptedIssuers() {
+                    return null;
+                }
+                public void checkClientTrusted(X509Certificate[] xcs, String str) {
+                	
+                }
+                public void checkServerTrusted(X509Certificate[] xcs, String str) {
+                	
+                }
+            };
+            ctx.init(null, new TrustManager[] { tm }, null);
+            SSLSocketFactory ssf = new SSLSocketFactory(ctx);
+            ssf.setHostnameVerifier(SSLSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER);
+            ClientConnectionManager ccm = httpClient.getConnectionManager();
+            SchemeRegistry registry = ccm.getSchemeRegistry();
+            registry.register(new Scheme("https", 443, ssf));
+        } catch (KeyManagementException ex) {
+            throw new RuntimeException(ex);
+        } catch (NoSuchAlgorithmException ex) {
+        	throw new RuntimeException(ex);
+        }
+    }
+}

+ 31 - 0
soc-modules/soc-modules-core/src/main/resources/mapper/weather/WeatherWarningMapper.xml

@@ -0,0 +1,31 @@
+<?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.xunmei.core.weather.mapper.WeatherWarningMapper">
+
+<select id="pageList" resultType="com.xunmei.common.core.domain.weather.domain.WeatherWarning">
+    select * from core_weather_warning a where 1=1
+    <if test="request.alarmTitle!=null and request.alarmTitle!=''">
+        and a.alarm_title like CONCAT('%',#{request.alarmTitle},'%')
+    </if>
+    <if test="request.alarmDates!=null">
+        and a.alarm_time>=#{request.alarmDates[0]}
+        and #{request.alarmDates[1]}>=a.alarm_time
+    </if>
+    <if test="request.code!=null and request.code!=''">
+        and a.code =#{request.code}
+    </if>
+    order by a.alarm_time desc
+    </select>
+
+<select id="findAreaList" resultType="java.lang.String">
+    select AREAID from core_weather_city
+    </select>
+
+<select id="findListAllByDate" resultType="com.xunmei.common.core.domain.weather.domain.WeatherWarning">
+    select * from core_weather_warning where create_time>#{time}
+    </select>
+
+<select id="cityCodeList" resultType="com.xunmei.common.core.utils.KeyValue">
+    select AREAID as `key`,NAMECN as `value` from core_weather_city
+    </select>
+</mapper>

+ 37 - 0
soc-modules/soc-modules-job/src/main/java/com/xunmei/job/task/WeatherTask.java

@@ -0,0 +1,37 @@
+package com.xunmei.job.task;
+
+
+import cn.hutool.core.lang.UUID;
+import com.alibaba.fastjson.JSON;
+import com.xunmei.common.core.constant.SecurityConstants;
+import com.xunmei.common.core.web.domain.AjaxResult;
+import com.xunmei.system.api.RemoteRetrievalTaskService;
+import com.xunmei.system.api.RemoteWeatherTaskService;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.stereotype.Component;
+
+import javax.annotation.Resource;
+import java.time.LocalDate;
+import java.util.Date;
+
+/**
+ * 监控调阅定时任务
+ *
+ * @author xunmei
+ */
+@Slf4j
+@Component("WeatherTask")
+public class WeatherTask {
+    @Resource
+    private RemoteWeatherTaskService remoteWeatherTaskService;
+
+    /**
+     * 每天定时获取天气预警数据
+     */
+    public void getDataFromApi()
+    {   String id = UUID.fastUUID().toString();
+        log.info("开始执行获取天气预警数据的任务,当前任务 id:{},当前时间:{}", id, new Date());
+        AjaxResult result = remoteWeatherTaskService.getDataFromApi( SecurityConstants.INNER);
+        log.info("获取天气预警数据的任务执行结束,当前任务 id:{},当前时间:{},结果:{}", id, new Date(), JSON.toJSONString(result));
+    }
+}

+ 6 - 1
soc-modules/soc-modules-system/src/main/java/com/xunmei/system/controller/SysOrgExtendController.java

@@ -6,7 +6,7 @@ import com.xunmei.common.core.web.page.TableDataInfo;
 import com.xunmei.common.log.annotation.Log;
 import com.xunmei.common.log.enums.BusinessType;
 import com.xunmei.common.security.annotation.RequiresPermissions;
-import com.xunmei.system.domain.SysOrgExtend;
+import com.xunmei.system.api.domain.SysOrgExtend;
 import com.xunmei.system.dto.SysOrgExtendDto;
 import com.xunmei.system.service.ISysOrgExtendService;
 import io.swagger.annotations.Api;
@@ -101,4 +101,9 @@ public class SysOrgExtendController extends BaseController {
     public AjaxResult remove(@PathVariable Long[] ids) {
         return toAjax(sysOrgExtendService.deleteSysOrgExtendByIds(ids));
     }
+
+    @GetMapping(value = "/selectSysOrgExtendById/{orgId}")
+    public AjaxResult selectSysOrgExtendById(@PathVariable("orgId") Long orgId) {
+        return success(sysOrgExtendService.selectSysOrgExtendByOrgId(orgId));
+    }
 }

+ 0 - 2
soc-modules/soc-modules-system/src/main/java/com/xunmei/system/dto/SysOrgExtendDto.java

@@ -4,8 +4,6 @@ import com.baomidou.mybatisplus.annotation.TableField;
 import com.baomidou.mybatisplus.annotation.TableId;
 import com.fasterxml.jackson.databind.annotation.JsonSerialize;
 import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
-import com.xunmei.system.api.domain.SysOrg;
-import com.xunmei.system.domain.SysOrgExtend;
 import com.xunmei.system.domain.SysPhysicalDefenseConstruction;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;

+ 1 - 1
soc-modules/soc-modules-system/src/main/java/com/xunmei/system/mapper/SysOrgExtendMapper.java

@@ -2,7 +2,7 @@ package com.xunmei.system.mapper;
 
 import java.util.List;
 
-import com.xunmei.system.domain.SysOrgExtend;
+import com.xunmei.system.api.domain.SysOrgExtend;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 
 /**

+ 1 - 3
soc-modules/soc-modules-system/src/main/java/com/xunmei/system/service/ISysOrgExtendService.java

@@ -2,10 +2,8 @@ package com.xunmei.system.service;
 
 import java.util.List;
 
-import com.xunmei.system.api.domain.SysOrg;
-import com.xunmei.system.domain.SysOrgExtend;
+import com.xunmei.system.api.domain.SysOrgExtend;
 import com.baomidou.mybatisplus.extension.service.IService;
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.xunmei.common.core.web.page.TableDataInfo;
 import com.xunmei.system.dto.SysOrgExtendDto;
 

+ 1 - 1
soc-modules/soc-modules-system/src/main/java/com/xunmei/system/service/impl/SysOrgExtendServiceImpl.java

@@ -26,7 +26,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.xunmei.common.core.web.page.TableDataInfo;
 import com.xunmei.system.mapper.SysOrgExtendMapper;
-import com.xunmei.system.domain.SysOrgExtend;
+import com.xunmei.system.api.domain.SysOrgExtend;
 import com.xunmei.system.service.ISysOrgExtendService;
 
 /**

+ 4 - 4
soc-modules/soc-modules-system/src/main/resources/mapper/system/SysOrgExtendMapper.xml

@@ -4,7 +4,7 @@
         "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.xunmei.system.mapper.SysOrgExtendMapper">
 
-    <resultMap type="com.xunmei.system.domain.SysOrgExtend" id="SysOrgExtendResult">
+    <resultMap type="com.xunmei.system.api.domain.SysOrgExtend" id="SysOrgExtendResult">
                 <result property="id" column="id"/>
                 <result property="orgType" column="org_type"/>
                 <result property="weatherAreaCode" column="weather_area_code"/>
@@ -35,7 +35,7 @@ _type, duty_mode, remote_control, self_service_bank, lobby_equipment, wall_penet
         from sys_org_extend
     </sql>
 
-    <select id="selectSysOrgExtendList" parameterType="com.xunmei.system.domain.SysOrgExtend"
+    <select id="selectSysOrgExtendList" parameterType="com.xunmei.system.api.domain.SysOrgExtend"
             resultMap="SysOrgExtendResult">
         <include refid="selectSysOrgExtendVo"/>
         <where>
@@ -99,7 +99,7 @@ Type}
             where id = #{id}
     </select>
 
-    <insert id="insertSysOrgExtend" parameterType="com.xunmei.system.domain.SysOrgExtend"            useGeneratedKeys="true" keyProperty="id">
+    <insert id="insertSysOrgExtend" parameterType="com.xunmei.system.api.domain.SysOrgExtend" useGeneratedKeys="true" keyProperty="id">
         insert into sys_org_extend
         <trim prefix="(" suffix=")" suffixOverrides=",">
                     <if test="orgType != null">org_type,
@@ -191,7 +191,7 @@ Type},
         </trim>
     </insert>
 
-    <update id="updateSysOrgExtend" parameterType="com.xunmei.system.domain.SysOrgExtend">
+    <update id="updateSysOrgExtend" parameterType="com.xunmei.system.api.domain.SysOrgExtend">
         update sys_org_extend
         <trim prefix="SET" suffixOverrides=",">
                     <if test="orgType != null">org_type =

Някои файлове не бяха показани, защото твърде много файлове са промени