Kaynağa Gözat

代码修改优化

yangbq 1 ay önce
ebeveyn
işleme
41646b76b7

+ 32 - 40
src/main/java/com/sckj/project/service/task/BuildingTaskService.java

@@ -1,7 +1,7 @@
 package com.sckj.project.service.task;
 
+import cn.hutool.core.collection.CollectionUtil;
 import cn.hutool.json.JSONArray;
-import cn.hutool.json.JSONUtil;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.sckj.project.config.ApiUrlConfig;
 import com.sckj.project.domain.building.LargeBuilding;
@@ -14,13 +14,12 @@ import com.sckj.project.service.building.ILargePlatBuildingLoadDetailService;
 import com.sckj.project.service.building.ILargePlatBuildingService;
 import com.sckj.project.util.HttpRequestUtil;
 import lombok.extern.slf4j.Slf4j;
-import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.http.ResponseEntity;
 import org.springframework.stereotype.Service;
-import org.springframework.web.client.RestClientException;
 
 import java.util.List;
+import java.util.Objects;
+
 @Slf4j
 @Service
 public class BuildingTaskService {
@@ -46,65 +45,58 @@ public class BuildingTaskService {
         /*楼宇表*/
         try {
             JSONArray array = httpRequestUtil.callExternalApi(ApiUrlConfig.getBuildingUrl());
-            if (array == null){
-                return;
-            }
-            List<LargeBuilding> list = array.toList(LargeBuilding.class);
-            if (list.size() < 1){
-                return;
+            if (Objects.nonNull(array)){
+                List<LargeBuilding> list = array.toList(LargeBuilding.class);
+                if (CollectionUtil.isNotEmpty(list)){
+                    largePlatBuildingService.remove(new LambdaQueryWrapper<>());
+                    largePlatBuildingService.saveBatch(list);
+                }
             }
-            largePlatBuildingService.remove(new LambdaQueryWrapper<>());
-            largePlatBuildingService.saveBatch(list);
         } catch (Exception e) {
-            e.getMessage();
+            log.error(e.getMessage());
         }
 
         /*楼宇中控*/
         try {
             JSONArray array = httpRequestUtil.callExternalApi(ApiUrlConfig.getBuildingControlUrl());
-            if (array == null){
-                return;
-            }
-            List<LargeBuildingControl> list = array.toList(LargeBuildingControl.class);
-            if (list.size() < 1){
-                return;
+            if (Objects.nonNull(array)){
+                List<LargeBuildingControl> list = array.toList(LargeBuildingControl.class);
+                if (CollectionUtil.isNotEmpty(list)){
+                    largePlatBuildingControlService.remove(new LambdaQueryWrapper<>());
+                    largePlatBuildingControlService.saveBatch(list);
+                }
             }
-            largePlatBuildingControlService.remove(new LambdaQueryWrapper<>());
-            largePlatBuildingControlService.saveBatch(list);
         } catch (Exception e) {
-            e.getMessage();
+            log.error(e.getMessage());
         }
 
         /*楼宇中控电表明细表*/
         try {
             JSONArray array = httpRequestUtil.callExternalApi(ApiUrlConfig.getBuildingAmmeterDetailUrl());
-            if (array == null){
-                return;
+            if (Objects.nonNull(array)){
+                List<LargeBuildingControlAmmeterDetail> list = array.toList(LargeBuildingControlAmmeterDetail.class);
+                if (CollectionUtil.isNotEmpty(list)){
+                    largePlatBuildingAmmeterDetailService.remove(new LambdaQueryWrapper<>());
+                    largePlatBuildingAmmeterDetailService.saveBatch(list);
+                }
             }
-            List<LargeBuildingControlAmmeterDetail> list = array.toList(LargeBuildingControlAmmeterDetail.class);
-            if (list.size() < 1){
-                return;
-            }
-            largePlatBuildingAmmeterDetailService.remove(new LambdaQueryWrapper<>());
-            largePlatBuildingAmmeterDetailService.saveBatch(list);
         } catch (Exception e) {
-          e.getMessage();
+            log.error(e.getMessage());
         }
 
         /*楼宇中控负载明细表*/
         try {
             JSONArray array = httpRequestUtil.callExternalApi(ApiUrlConfig.getBuildingLoadDetailUrl());
-            if (array == null){
-                return;
-            }
-            List<LargeBuildingControlLoadDetail> list = array.toList(LargeBuildingControlLoadDetail.class);
-            if (list.size() < 1){
-                return;
+            if (Objects.nonNull(array)){
+                List<LargeBuildingControlLoadDetail> list = array.toList(LargeBuildingControlLoadDetail.class);
+                if (CollectionUtil.isNotEmpty(list)){
+                    largePlatBuildingLoadDetailService.remove(new LambdaQueryWrapper<>());
+                    largePlatBuildingLoadDetailService.saveBatch(list);
+                }
             }
-            largePlatBuildingLoadDetailService.remove(new LambdaQueryWrapper<>());
-            largePlatBuildingLoadDetailService.saveBatch(list);
+
         } catch (Exception e) {
-            e.getMessage();
+            log.error(e.getMessage());
         }
 
     }

+ 24 - 27
src/main/java/com/sckj/project/service/task/CarTaskService.java

@@ -1,5 +1,6 @@
 package com.sckj.project.service.task;
 
+import cn.hutool.core.collection.CollectionUtil;
 import cn.hutool.json.JSONArray;
 import cn.hutool.json.JSONUtil;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
@@ -20,6 +21,8 @@ import org.springframework.stereotype.Service;
 import org.springframework.web.client.RestClientException;
 
 import java.util.List;
+import java.util.Objects;
+
 @Slf4j
 @Service
 public class CarTaskService {
@@ -47,49 +50,43 @@ public class CarTaskService {
         /*公务用车年度增加减少表*/
         try {
             JSONArray array = httpRequestUtil.callExternalApi(ApiUrlConfig.getCarChangeUrl());
-            if (array == null){
-                return;
-            }
-            List<LargeCarDetail> list = array.toList(LargeCarDetail.class);
-            if (list.size() < 1){
-                return;
+            if (Objects.nonNull(array)){
+                List<LargeCarDetail> list = array.toList(LargeCarDetail.class);
+                if (CollectionUtil.isNotEmpty(list)){
+                    largeCarDetailService.remove(new LambdaQueryWrapper<>());
+                    largeCarDetailService.saveBatch(list);
+                }
             }
-            largeCarDetailService.remove(new LambdaQueryWrapper<>());
-            largeCarDetailService.saveBatch(list);
         } catch (Exception e) {
-            e.getMessage();
+            log.error(e.getMessage());
         }
 
         /*公务用车预警明细表*/
         try {
             JSONArray array = httpRequestUtil.callExternalApi(ApiUrlConfig.getCarWarnUrl());
-            if (array == null){
-                return;
+            if (Objects.nonNull(array)){
+                List<LargeWarnDetail> list = array.toList(LargeWarnDetail.class);
+                if (CollectionUtil.isNotEmpty(list)){
+                    largeWarnDetailService.remove(new LambdaQueryWrapper<>());
+                    largeWarnDetailService.saveBatch(list);
+                }
             }
-            List<LargeWarnDetail> list = array.toList(LargeWarnDetail.class);
-            if (list.size() < 1){
-                return;
-            }
-            largeWarnDetailService.remove(new LambdaQueryWrapper<>());
-            largeWarnDetailService.saveBatch(list);
         } catch (Exception e) {
-            e.getMessage();
+            log.error(e.getMessage());
         }
 
         /*公务用车单车活跃排名表*/
         try {
             JSONArray array = httpRequestUtil.callExternalApi(ApiUrlConfig.getCarRankUrl());
-            if (array == null){
-                return;
-            }
-            List<LargeCarRank> list = array.toList(LargeCarRank.class);
-            if (list.size() < 1){
-                return;
+            if (Objects.nonNull(array)){
+                List<LargeCarRank> list = array.toList(LargeCarRank.class);
+                if (CollectionUtil.isNotEmpty(list)){
+                    largeCarRankService.remove(new LambdaQueryWrapper<>());
+                    largeCarRankService.saveBatch(list);
+                }
             }
-            largeCarRankService.remove(new LambdaQueryWrapper<>());
-            largeCarRankService.saveBatch(list);
         } catch (Exception e) {
-            e.getMessage();
+            log.error(e.getMessage());
         }
     }
 }

+ 23 - 27
src/main/java/com/sckj/project/service/task/EngineeringTaskService.java

@@ -1,5 +1,6 @@
 package com.sckj.project.service.task;
 
+import cn.hutool.core.collection.CollectionUtil;
 import cn.hutool.json.JSONArray;
 import cn.hutool.json.JSONUtil;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
@@ -19,6 +20,7 @@ import org.springframework.stereotype.Service;
 import org.springframework.web.client.RestClientException;
 
 import java.util.List;
+import java.util.Objects;
 
 @Slf4j
 @Service
@@ -42,49 +44,43 @@ public class EngineeringTaskService {
         /*监控表*/
         try {
             JSONArray array = httpRequestUtil.callExternalApi(ApiUrlConfig.getEngineerCameraUrl());
-            if (array == null){
-                return;
+            if (Objects.nonNull(array)){
+                List<LargeCamera> list = array.toList(LargeCamera.class);
+                if (CollectionUtil.isNotEmpty(list)){
+                    largeCameraService.remove(new LambdaQueryWrapper<>());
+                    largeCameraService.saveBatch(list);
+                }
             }
-            List<LargeCamera> list = array.toList(LargeCamera.class);
-            if (list.size() < 1){
-                return;
-            }
-            largeCameraService.remove(new LambdaQueryWrapper<>());
-            largeCameraService.saveBatch(list);
         } catch (Exception e) {
-            e.getMessage();
+            log.error(e.getMessage());
         }
 
         /*上报问题表*/
         try {
             JSONArray array = httpRequestUtil.callExternalApi(ApiUrlConfig.getEngineerIssueUrl());
-            if (array == null){
-                return;
-            }
-            List<LargeIssue> list = array.toList(LargeIssue.class);
-            if (list.size() < 1){
-                return;
+            if (Objects.nonNull(array)){
+                List<LargeIssue> list = array.toList(LargeIssue.class);
+                if (CollectionUtil.isNotEmpty(list)){
+                    largePlatIssueService.remove(new LambdaQueryWrapper<>());
+                    largePlatIssueService.saveBatch(list);
+                }
             }
-            largePlatIssueService.remove(new LambdaQueryWrapper<>());
-            largePlatIssueService.saveBatch(list);
         } catch (Exception e) {
-            e.getMessage();
+            log.error(e.getMessage());
         }
 
         /*项目表*/
         try {
             JSONArray array = httpRequestUtil.callExternalApi(ApiUrlConfig.getEngineerProjectUrl());
-            if (array == null){
-                return;
-            }
-            List<LargeProject> list = array.toList(LargeProject.class);
-            if (list.size() < 1){
-                return;
+            if (Objects.nonNull(array)){
+                List<LargeProject> list = array.toList(LargeProject.class);
+                if (CollectionUtil.isNotEmpty(list)){
+                    largePlatProjectService.remove(new LambdaQueryWrapper<>());
+                    largePlatProjectService.saveBatch(list);
+                }
             }
-            largePlatProjectService.remove(new LambdaQueryWrapper<>());
-            largePlatProjectService.saveBatch(list);
         } catch (Exception e) {
-            e.getMessage();
+            log.error(e.getMessage());
         }
 
     }

+ 31 - 36
src/main/java/com/sckj/project/service/task/LogisticsTaskService.java

@@ -1,5 +1,6 @@
 package com.sckj.project.service.task;
 
+import cn.hutool.core.collection.CollectionUtil;
 import cn.hutool.json.JSONArray;
 import cn.hutool.json.JSONUtil;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
@@ -18,6 +19,8 @@ import org.springframework.stereotype.Service;
 import org.springframework.web.client.RestClientException;
 
 import java.util.List;
+import java.util.Objects;
+
 @Slf4j
 @Service
 public class LogisticsTaskService {
@@ -47,17 +50,15 @@ public class LogisticsTaskService {
         /*房产土地表*/
         try {
             JSONArray array = httpRequestUtil.callExternalApi(ApiUrlConfig.getLogisticsHousingUrl());
-            if (array == null){
-                return;
-            }
-            List<LargeHousingLand> list = array.toList(LargeHousingLand.class);
-            if (list.size() < 1){
-                return;
+            if (Objects.nonNull(array)){
+                List<LargeHousingLand> list = array.toList(LargeHousingLand.class);
+                if ( CollectionUtil.isNotEmpty(list)){
+                    largePlatHousingLandService.remove(new LambdaQueryWrapper<>());
+                    largePlatHousingLandService.saveBatch(list);
+                }
             }
-            largePlatHousingLandService.remove(new LambdaQueryWrapper<>());
-            largePlatHousingLandService.saveBatch(list);
         } catch (Exception e) {
-            e.getMessage();
+            log.error(e.getMessage());
         }
 
         /*后勤运行监控中心表*/
@@ -66,49 +67,43 @@ public class LogisticsTaskService {
         /*楼宇设备表*/
         try {
             JSONArray array = httpRequestUtil.callExternalApi(ApiUrlConfig.getLogisticsBuildingAssetUrl());
-            if (array == null){
-                return;
-            }
-            List<LargeBuildingAssetDirs> list = array.toList(LargeBuildingAssetDirs.class);
-            if (list.size() < 1){
-                return;
+            if ( Objects.nonNull(array)){
+                List<LargeBuildingAssetDirs> list = array.toList(LargeBuildingAssetDirs.class);
+                if ( CollectionUtil.isNotEmpty(list)){
+                    largePlatLogisticsBuildingAssetService.remove(new LambdaQueryWrapper<>());
+                    largePlatLogisticsBuildingAssetService.saveBatch(list);
+                }
             }
-            largePlatLogisticsBuildingAssetService.remove(new LambdaQueryWrapper<>());
-            largePlatLogisticsBuildingAssetService.saveBatch(list);
         } catch (Exception e) {
-            e.getMessage();
+            log.error(e.getMessage());
         }
 
         /*办公资产表*/
         try {
             JSONArray array = httpRequestUtil.callExternalApi(ApiUrlConfig.getLogisticsOfficeAssetUrl());
-            if (array == null){
-                return;
+            if ( Objects.nonNull(array)){
+                List<LargeOfficeAssetDirs> list = array.toList(LargeOfficeAssetDirs.class);
+                if ( CollectionUtil.isNotEmpty(list)){
+                    largePlatLogisticsOfficeAssetService.remove(new LambdaQueryWrapper<>());
+                    largePlatLogisticsOfficeAssetService.saveBatch(list);
+                }
             }
-            List<LargeOfficeAssetDirs> list = array.toList(LargeOfficeAssetDirs.class);
-            if (list.size() < 1){
-                return;
-            }
-            largePlatLogisticsOfficeAssetService.remove(new LambdaQueryWrapper<>());
-            largePlatLogisticsOfficeAssetService.saveBatch(list);
         } catch (Exception e) {
-            e.getMessage();
+            log.error(e.getMessage());
         }
 
         /*服务设备表*/
         try {
             JSONArray array = httpRequestUtil.callExternalApi(ApiUrlConfig.getLogisticsServiceAssetUrl());
-            if (array == null){
-                return;
-            }
-            List<LargeServiceAssetDirs> list = array.toList(LargeServiceAssetDirs.class);
-            if (list.size() < 1){
-                return;
+            if (Objects.nonNull(array)){
+                List<LargeServiceAssetDirs> list = array.toList(LargeServiceAssetDirs.class);
+                if ( CollectionUtil.isNotEmpty(list)){
+                    largePlatLogisticsServiceAssetService.remove(new LambdaQueryWrapper<>());
+                    largePlatLogisticsServiceAssetService.saveBatch(list);
+                }
             }
-            largePlatLogisticsServiceAssetService.remove(new LambdaQueryWrapper<>());
-            largePlatLogisticsServiceAssetService.saveBatch(list);
         } catch (Exception e) {
-            e.getMessage();
+            log.error(e.getMessage());
         }
 
     }

+ 64 - 54
src/main/java/com/sckj/project/service/task/ServiceTaskService.java

@@ -1,5 +1,6 @@
 package com.sckj.project.service.task;
 
+import cn.hutool.core.collection.CollectionUtil;
 import cn.hutool.json.JSONArray;
 import cn.hutool.json.JSONUtil;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
@@ -15,6 +16,8 @@ import org.springframework.stereotype.Service;
 import org.springframework.web.client.RestClientException;
 
 import java.util.List;
+import java.util.Objects;
+
 @Slf4j
 @Service
 public class ServiceTaskService {
@@ -82,31 +85,44 @@ public class ServiceTaskService {
     public void myTask(){
 
         /*便捷出入*/
-        largePlatAccessService.saveOrUpdate(httpRequestUtil.callExternalApi(ApiUrlConfig.getAccessUrl()));
+        JSONArray accArray = httpRequestUtil.callExternalApi(ApiUrlConfig.getAccessUrl());
+        if (Objects.nonNull(accArray)){
+            largePlatAccessService.saveOrUpdate(accArray);
+        }
+
 
         /*基础运行数据*/
-        largePlatBasicsService.saveOrUpdate(httpRequestUtil.callExternalApi(ApiUrlConfig.getBasicsApiUrl()));
+        JSONArray basicArray = httpRequestUtil.callExternalApi(ApiUrlConfig.getBasicsApiUrl());
+        if (Objects.nonNull(basicArray)){
+            largePlatBasicsService.saveOrUpdate(basicArray);
+        }
+
 
         /*公司活跃人数*/
-        largePlatBasicsCompanyService.saveOrUpdate(httpRequestUtil.callExternalApi(ApiUrlConfig.getBasicsCompanyUrl()));
+        JSONArray compArray = httpRequestUtil.callExternalApi(ApiUrlConfig.getBasicsCompanyUrl());
+        if (Objects.nonNull(compArray)){
+            largePlatBasicsCompanyService.saveOrUpdate(compArray);
+        }
+
 
         /*服务信息*/
-        largePlatBasicsServerService.saveOrUpdate(httpRequestUtil.callExternalApi(ApiUrlConfig.getBasicsServerUrl()));
+        JSONArray serverArray = httpRequestUtil.callExternalApi(ApiUrlConfig.getBasicsServerUrl());
+        if (Objects.nonNull(serverArray)){
+            largePlatBasicsServerService.saveOrUpdate(serverArray);
+        }
 
         /*系统运行峰值情况分析*/
         try {
-            JSONArray array = httpRequestUtil.callExternalApi(ApiUrlConfig.getBasicsSystemUrl());
-            if (array == null){
-                return;
+            JSONArray sysArray = httpRequestUtil.callExternalApi(ApiUrlConfig.getBasicsSystemUrl());
+            if (Objects.nonNull(sysArray)){
+                List<PlatBasicsSystem> list = sysArray.toList(PlatBasicsSystem.class);
+                if ( CollectionUtil.isNotEmpty(list)){
+                    largePlatBasicsSystemService.remove(new LambdaQueryWrapper<>());
+                    largePlatBasicsSystemService.saveBatch(list);
+                }
             }
-            List<PlatBasicsSystem> list = array.toList(PlatBasicsSystem.class);
-            if (list.size() < 1){
-                return;
-            }
-            largePlatBasicsSystemService.remove(new LambdaQueryWrapper<>());
-            largePlatBasicsSystemService.saveBatch(list);
         } catch (Exception e) {
-            e.getMessage();
+            log.error(e.getMessage());
         }
 
         /*员工健康*/
@@ -114,18 +130,16 @@ public class ServiceTaskService {
 
         /*多发疾病排行*/
         try {
-            JSONArray array = httpRequestUtil.callExternalApi(ApiUrlConfig.getHealthIllnessUrl());
-            if (array == null){
-                return;
-            }
-            List<PlatEmployeeHealthIllness> list = array.toList(PlatEmployeeHealthIllness.class);
-            if (list.size() < 1){
-                return;
+            JSONArray helthArray = httpRequestUtil.callExternalApi(ApiUrlConfig.getHealthIllnessUrl());
+            if (Objects.nonNull(helthArray)){
+                List<PlatEmployeeHealthIllness> list = helthArray.toList(PlatEmployeeHealthIllness.class);
+                if ( CollectionUtil.isNotEmpty(list)){
+                    largePlatEmployeeHealthIllnessService.remove(new LambdaQueryWrapper<>());
+                    largePlatEmployeeHealthIllnessService.saveBatch(list);
+                }
             }
-            largePlatEmployeeHealthIllnessService.remove(new LambdaQueryWrapper<>());
-            largePlatEmployeeHealthIllnessService.saveBatch(list);
         } catch (Exception e) {
-            e.getMessage();
+            log.error(e.getMessage());
         }
 
         /*员工概况*/
@@ -133,18 +147,16 @@ public class ServiceTaskService {
 
         /*近一周人流量统计*/
         try {
-            JSONArray array = httpRequestUtil.callExternalApi(ApiUrlConfig.getEmployeeTypeFlowUrl());
-            if (array == null){
-                return;
+            JSONArray employeeArray = httpRequestUtil.callExternalApi(ApiUrlConfig.getEmployeeTypeFlowUrl());
+            if ( Objects.nonNull(employeeArray)){
+                List<PlatEmployeeTypeFlow> list = employeeArray.toList(PlatEmployeeTypeFlow.class);
+                if ( CollectionUtil.isNotEmpty(list)){
+                    largePlatEmployeeTypeFlowService.remove(new LambdaQueryWrapper<>());
+                    largePlatEmployeeTypeFlowService.saveBatch(list);
+                }
             }
-            List<PlatEmployeeTypeFlow> list = array.toList(PlatEmployeeTypeFlow.class);
-            if (list.size() < 1){
-                return;
-            }
-            largePlatEmployeeTypeFlowService.remove(new LambdaQueryWrapper<>());
-            largePlatEmployeeTypeFlowService.saveBatch(list);
         } catch (Exception e) {
-            e.getMessage();
+            log.error(e.getMessage());
         }
 
         /*菜谱数据*/
@@ -158,18 +170,17 @@ public class ServiceTaskService {
 
         /*绿智食堂 排名*/
         try {
-            JSONArray array = httpRequestUtil.callExternalApi(ApiUrlConfig.getGreenSmartRankUrl());
-            if (array == null){
-                return;
-            }
-            List<PlatGreenSmartRank> list = array.toList(PlatGreenSmartRank.class);
-            if (list.size() < 1){
-                return;
+            JSONArray smartArray = httpRequestUtil.callExternalApi(ApiUrlConfig.getGreenSmartRankUrl());
+            if (Objects.nonNull(smartArray)){
+                List<PlatGreenSmartRank> list = smartArray.toList(PlatGreenSmartRank.class);
+                if ( CollectionUtil.isNotEmpty(list)){
+                    largePlatGreenSmartRankService.remove(new LambdaQueryWrapper<>());
+                    largePlatGreenSmartRankService.saveBatch(list);
+                }
             }
-            largePlatGreenSmartRankService.remove(new LambdaQueryWrapper<>());
-            largePlatGreenSmartRankService.saveBatch(list);
+
         } catch (Exception e) {
-            e.getMessage();
+            log.error(e.getMessage());
         }
 
         /*食堂安全管理*/
@@ -180,18 +191,16 @@ public class ServiceTaskService {
 
         /*近六个月报修分类占比*/
         try {
-            JSONArray array = httpRequestUtil.callExternalApi(ApiUrlConfig.getPostStationChartUrl());
-            if (array == null){
-                return;
-            }
-            List<PlatPostStationChart> list = array.toList(PlatPostStationChart.class);
-            if (list.size() < 1){
-                return;
+            JSONArray stationArray = httpRequestUtil.callExternalApi(ApiUrlConfig.getPostStationChartUrl());
+            if ( Objects.nonNull(stationArray)){
+                List<PlatPostStationChart> list = stationArray.toList(PlatPostStationChart.class);
+                if (CollectionUtil.isNotEmpty(list)){
+                    largePlatPostStationChartService.remove(new LambdaQueryWrapper<>());
+                    largePlatPostStationChartService.saveBatch(list);
+                }
             }
-            largePlatPostStationChartService.remove(new LambdaQueryWrapper<>());
-            largePlatPostStationChartService.saveBatch(list);
         } catch (Exception e) {
-            e.getMessage();
+            log.error(e.getMessage());
         }
 
         /*共享驿站*/
@@ -204,4 +213,5 @@ public class ServiceTaskService {
         largePlatPropertyToolsService.saveOrUpdate(httpRequestUtil.callExternalApi(ApiUrlConfig.getPropertyToolsUrl()));
 
     }
+
 }

+ 30 - 0
src/main/java/com/sckj/project/task/TestController.java

@@ -0,0 +1,30 @@
+package com.sckj.project.task;
+
+import com.sckj.project.service.task.ServiceTaskService;
+import lombok.extern.slf4j.Slf4j;
+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;
+
+/**
+ * @Description 手动触发执行
+ * @Author bqyang
+ * @Date 2025/3/19 14:07
+ * @Version 1.0
+ */
+@Slf4j
+@RestController
+@RequestMapping("/api")
+public class TestController {
+
+    @Autowired
+    private ServiceTaskService serviceTaskService;
+
+    @GetMapping("/task")
+    public void test(){
+        log.info("服务保障中心触发手动任务开始执行");
+        serviceTaskService.myTask();
+        log.info("服务保障中心定时任务开始执行完成");
+    }
+}

+ 4 - 1
src/main/java/com/sckj/project/util/HttpRequestUtil.java

@@ -3,6 +3,7 @@ package com.sckj.project.util;
 import cn.hutool.json.JSONArray;
 import cn.hutool.json.JSONUtil;
 import com.sckj.project.constants.Constants;
+import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.http.HttpEntity;
@@ -19,6 +20,7 @@ import org.springframework.web.client.RestTemplate;
  * @Date 2025/3/7 11:33
  * @Version 1.0
  */
+@Slf4j
 @Component
 public class HttpRequestUtil {
 
@@ -38,7 +40,8 @@ public class HttpRequestUtil {
                 return null;
             }
             return JSONUtil.parseObj(response.getBody()).getJSONArray("data");
-        } catch (RestClientException e) {
+        } catch (Exception e) {
+            log.error("网络请求出现异常:{}", e.getMessage());
             return null;
         }
     }

+ 3 - 3
src/main/resources/application-prod.yml

@@ -13,9 +13,9 @@ spring:
         max-wait: 1000
       datasource:
         master:
-          url: jdbc:mysql://localhost:3306/sxgw?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=Asia/Shanghai
+          url: jdbc:mysql://25.39.79.239:13306/znhq?useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Hongkong&allowPublicKeyRetrieval=true&allowMultiQueries=true
           username: root
-          password: qwer123456
+          password: Ldsx@2020
           driver-class-name: com.mysql.cj.jdbc.Driver
 
 
@@ -37,7 +37,7 @@ logging:
 # 接口地址配置
 apiurl:
   # 接口前缀
-  prefixUrl: http://192.168.110.247:8115/synchronize
+  prefixUrl: http://25.39.64.37:10611/sxgw/synchronize
 
   # 服务保障中心
   accessUrl: /getServiceAccess

+ 1 - 1
src/main/resources/application.yml

@@ -1,5 +1,5 @@
 server:
-  port: 18080
+  port: 12888
 
 spring:
   profiles: