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