Commit 196a1894 authored by suhuiguang's avatar suhuiguang

1.公共代码整理

parent 99ee0e55
package com.yeejoin.amos.boot.module.statistcs.biz.init; package com.yeejoin.amos.boot.module.statistcs.biz.init;
import com.yeejoin.amos.boot.module.statistcs.biz.service.impl.AQZSDPStatisticsServiceImpl; import com.yeejoin.amos.boot.module.statistcs.biz.service.impl.AQZSDPStatisticsServiceImpl;
import com.yeejoin.amos.boot.module.statistcs.biz.service.impl.JGDPStatisticsServiceImpl;
import com.yeejoin.amos.boot.module.statistcs.biz.service.impl.StCommonServiceImpl; import com.yeejoin.amos.boot.module.statistcs.biz.service.impl.StCommonServiceImpl;
import com.yeejoin.amos.component.robot.AmosRequestContext; import com.yeejoin.amos.component.robot.AmosRequestContext;
import org.springframework.boot.ApplicationArguments; import org.springframework.boot.ApplicationArguments;
...@@ -15,19 +14,14 @@ import org.typroject.tyboot.core.foundation.context.RequestContext; ...@@ -15,19 +14,14 @@ import org.typroject.tyboot.core.foundation.context.RequestContext;
@Component @Component
public class DataInitAfterRuning implements ApplicationRunner { public class DataInitAfterRuning implements ApplicationRunner {
private JGDPStatisticsServiceImpl jgdpStatisticsService;
private AQZSDPStatisticsServiceImpl aqzsdpStatisticsService;
private StCommonServiceImpl stCommonService; private StCommonServiceImpl stCommonService;
private AmosRequestContext amosRequestContext; private AmosRequestContext amosRequestContext;
public DataInitAfterRuning(JGDPStatisticsServiceImpl jgdpStatisticsService, StCommonServiceImpl stCommonService, AmosRequestContext amosRequestContext, AQZSDPStatisticsServiceImpl aqzsdpStatisticsService) { public DataInitAfterRuning(StCommonServiceImpl stCommonService, AmosRequestContext amosRequestContext) {
this.jgdpStatisticsService = jgdpStatisticsService;
this.stCommonService = stCommonService; this.stCommonService = stCommonService;
this.amosRequestContext = amosRequestContext; this.amosRequestContext = amosRequestContext;
this.aqzsdpStatisticsService = aqzsdpStatisticsService;
} }
@Override @Override
...@@ -36,8 +30,6 @@ public class DataInitAfterRuning implements ApplicationRunner { ...@@ -36,8 +30,6 @@ public class DataInitAfterRuning implements ApplicationRunner {
RequestContext.setAppKey(amosRequestContext.getAppKey()); RequestContext.setAppKey(amosRequestContext.getAppKey());
RequestContext.setProduct(amosRequestContext.getProduct()); RequestContext.setProduct(amosRequestContext.getProduct());
RequestContext.setToken(amosRequestContext.getToken()); RequestContext.setToken(amosRequestContext.getToken());
jgdpStatisticsService.init();
stCommonService.init(); stCommonService.init();
aqzsdpStatisticsService.init();
} }
} }
...@@ -29,7 +29,6 @@ import java.io.IOException; ...@@ -29,7 +29,6 @@ import java.io.IOException;
import java.time.LocalDate; import java.time.LocalDate;
import java.time.format.DateTimeFormatter; import java.time.format.DateTimeFormatter;
import java.util.*; import java.util.*;
import java.util.concurrent.ConcurrentHashMap;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@Service @Service
...@@ -45,13 +44,14 @@ public class ZLDPStatisticsServiceImpl { ...@@ -45,13 +44,14 @@ public class ZLDPStatisticsServiceImpl {
private RestHighLevelClient restHighLevelClient; private RestHighLevelClient restHighLevelClient;
private static Map<String, String> regionCodeOrgCodeMap = new ConcurrentHashMap<>(); private StCommonServiceImpl stCommonService;
public ZLDPStatisticsServiceImpl(ZLStatisticsMapper screenMapper, DataDictionaryServiceImpl iDataDictionaryService, AlertStatisticsMapper alertStatisticsMapper, RestHighLevelClient restHighLevelClient) { public ZLDPStatisticsServiceImpl(ZLStatisticsMapper screenMapper, DataDictionaryServiceImpl iDataDictionaryService, AlertStatisticsMapper alertStatisticsMapper, RestHighLevelClient restHighLevelClient, StCommonServiceImpl stCommonService) {
this.screenMapper = screenMapper; this.screenMapper = screenMapper;
this.iDataDictionaryService = iDataDictionaryService; this.iDataDictionaryService = iDataDictionaryService;
this.alertStatisticsMapper = alertStatisticsMapper; this.alertStatisticsMapper = alertStatisticsMapper;
this.restHighLevelClient = restHighLevelClient; this.restHighLevelClient = restHighLevelClient;
this.stCommonService = stCommonService;
} }
...@@ -462,7 +462,7 @@ public class ZLDPStatisticsServiceImpl { ...@@ -462,7 +462,7 @@ public class ZLDPStatisticsServiceImpl {
SearchRequest searchRequest = new SearchRequest("idx_biz_view_jg_all"); SearchRequest searchRequest = new SearchRequest("idx_biz_view_jg_all");
SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder(); SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder();
//设置模糊搜索 //设置模糊搜索
String orgCode = getAndSetOrgCode(screenDto.getCityCode()); String orgCode = stCommonService.getAndSetOrgCode(screenDto.getCityCode());
searchSourceBuilder.query(QueryBuilders.boolQuery() searchSourceBuilder.query(QueryBuilders.boolQuery()
.must(QueryBuilders.wildcardQuery("ORG_BRANCH_CODE.keyword", QueryParser.escape(orgCode) + "*"))); .must(QueryBuilders.wildcardQuery("ORG_BRANCH_CODE.keyword", QueryParser.escape(orgCode) + "*")));
searchSourceBuilder.aggregation(AggregationBuilders.terms("count_by_use_site_code").field("USE_SITE_CODE").size(500)); searchSourceBuilder.aggregation(AggregationBuilders.terms("count_by_use_site_code").field("USE_SITE_CODE").size(500));
...@@ -499,16 +499,6 @@ public class ZLDPStatisticsServiceImpl { ...@@ -499,16 +499,6 @@ public class ZLDPStatisticsServiceImpl {
return returnList; return returnList;
} }
private String getAndSetOrgCode(String cityCode) {
String orgCode = regionCodeOrgCodeMap.get(cityCode);
if (orgCode == null) {
orgCode = screenMapper.getOrgCodeByCompanyCode(cityCode);
if (orgCode != null) {
regionCodeOrgCodeMap.put(cityCode, orgCode);
}
}
return orgCode;
}
public Map<String,Object> userCountNew(DPFilterParamDto screenDto) { public Map<String,Object> userCountNew(DPFilterParamDto screenDto) {
List<String> unitTypeList = UnitTypeEnum.getNameListByType(screenDto.getCompanyType()); List<String> unitTypeList = UnitTypeEnum.getNameListByType(screenDto.getCompanyType());
...@@ -580,7 +570,7 @@ public class ZLDPStatisticsServiceImpl { ...@@ -580,7 +570,7 @@ public class ZLDPStatisticsServiceImpl {
jsonObject5.put("value", ValidationUtil.isEmpty(statistics.getAvgTime()) ? 0 : statistics.getAvgTime()); jsonObject5.put("value", ValidationUtil.isEmpty(statistics.getAvgTime()) ? 0 : statistics.getAvgTime());
jsonObject5.put("name", "平均救援时间"); jsonObject5.put("name", "平均救援时间");
String orgCode = this.getAndSetOrgCode(regionCode); String orgCode = stCommonService.getAndSetOrgCode(regionCode);
JSONObject jsonObject6 = new JSONObject(); JSONObject jsonObject6 = new JSONObject();
jsonObject6.put("key", "jycq"); jsonObject6.put("key", "jycq");
jsonObject6.put("value", this.getQuestionNumber("检验超期",params, orgCode)); jsonObject6.put("value", this.getQuestionNumber("检验超期",params, orgCode));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment